private func FitsInElevator(pObject) { // Fahrzeuge, die eine Extra Aufzugsaktion haben, sollten immer passen if(pObject->~FitsInElevator()) return(1);//ObjectSetAction(pObject, "Elevator")) return(1); // Alle (ungedrehten) Vertices des Objekts prüfen var vertexCount = GetDefCoreVal("Vertices", "DefCore", pObject->GetID()); for (var i = 0; i < vertexCount; i++) { var vertexX = GetDefCoreVal("VertexX", "DefCore", pObject->GetID(), i); var vertexY = GetDefCoreVal("VertexY", "DefCore", pObject->GetID(), i); // Passt nicht if (!Inside(vertexX, -12, 11) || !Inside(vertexY, -20, 16)) return(0); } // Passt return(1); }
public func Activate(caster, real_caster) { // Zaubernden Clonk ermitteln var clonk = caster; if (real_caster) clonk = real_caster; // Kombiniert mit Beton -> Clonk in den Boden stecken var obj; if (!Contained(clonk) && (obj = FindContents(CNCR, clonk))) { var height = GetDefCoreVal("Height", "DefCore", GetID(clonk)); var radius = RandomX(25, 35); var x = GetX(clonk); var y = GetY(clonk); // Unter dem Clonk freischütteln und buddeln DigFree(x, y+height+radius, height/2); ShakeFree(x, y+height+(radius/2), radius); // Tiefstes freigeschüttelte Y-Position ermitteln while (!GBackSolid(AbsX(x), AbsY(y++ + height))) {} // Effekte! DrawParticleLine("MSpark", 0, 0, 0, AbsY(y), height*3/2, height*5/2, RGBa(255-Random(50),255-Random(50), 0,128), RGBa(155-Random(50),155-Random(50), 0,128), -10); // Zauberer an ermittelte Stelle versetzen SetPosition(x, y, clonk); // Objekt entfernen RemoveObject(obj); } // Sonst normale Wirkung (Gravitation erhöhen) else { // Gravitation bereits auf Maximum? if (GetGravity() >= 290) return(0, Message("$MsgAlreadyMaxed$", caster), RemoveObject()); // Sonst erhöhen // Effekt global starten if (!AddEffect("GravChangeUSpell", 0, 150, 80, 0, MGDW, 20)) return(0, RemoveObject()); Message("$MsgRaised$", caster, GetGravity()); } Sound("Magic1"); RemoveObject(); return(1); }
// Callback by the engine when the completion of an object changes. global func OnCompletionChange(int old_con, int new_con) { if (!this || GetType(this) != C4V_C4Object) return _inherited(old_con, new_con, ...); // Determine whether the object allows Oversize. var oversize = GetDefCoreVal("Oversize", "DefCore"); // Loop over all components and set their new count. var index = 0, comp; while (comp = GetID()->GetComponent(nil, index)) { var def_cnt = GetID()->GetComponent(comp); var new_cnt = Max(def_cnt * new_con / 100000, 0); // If the object has no Oversize then constrain the maximum number of components. if (!oversize) new_cnt = Min(new_cnt, def_cnt); SetComponent(comp, new_cnt); index++; } return _inherited(old_con, new_con, ...); }
global func GetDefProjectile() { return GetDefCoreVal("Projectile", "DefCore"); }
global func GetDefNoPushEnter() { return GetDefCoreVal("NoPushEnter", "DefCore"); }
global func GetDefConstruction(){ return GetDefCoreVal("Construction", "DefCore"); }
global func GetDefFireTop() { return GetDefCoreVal("FireTop", "DefCore"); }
global func GetDefTemporaryCrew() { return GetDefCoreVal("TemporaryCrew", "DefCore"); }
global func GetDefConSizeOff() { return GetDefCoreVal("ConSizeOff", "DefCore"); }
global func GetDefUprightAttach() { return GetDefCoreVal("UprightAttach", "DefCore"); }
global func GetDefClosedContainer() { return GetDefCoreVal("ClosedContainer", "DefCore"); }
global func GetDefHorizontalFix() { return GetDefCoreVal("HorizontalFix", "DefCore"); }
global func GetDefLiftTop() { return GetDefCoreVal("LiftTop", "DefCore"); }
global func GetDefFloat() { return GetDefCoreVal("Float", "DefCore"); }
global func GetDefRotate() { return GetDefCoreVal("Rotate", "DefCore"); }
global func GetDefGrabPutGet() { return GetDefCoreVal("GrabPutGet", "DefCore"); }
global func GetDefVehicleControl() { return GetDefCoreVal("VehicleControl", "DefCore"); }
global func GetDefStretchGrowth() { return GetDefCoreVal("StretchGrowth", "DefCore"); }
global func GetDefNoComponentMass() { return GetDefCoreVal("NoComponentMass", "DefCore"); }
global func GetDefIncompleteActivity() { return GetDefCoreVal("IncompleteActivity", "DefCore"); }
global func GetDefSilentCommands() { return GetDefCoreVal("SilentCommands", "DefCore"); }
global func GetDefLine() { return GetDefCoreVal("Line", "DefCore"); }
global func GetDefNoBreath() { return GetDefCoreVal("NoBreath", "DefCore"); }
/* Helpers! */ #strict 2 global func GetRect(id idDef, &ox, &oy, &wdt, &hgt) { ox = GetDefCoreVal("Offset", "DefCore", idDef, 0); oy = GetDefCoreVal("Offset", "DefCore", idDef, 1); wdt = GetDefCoreVal("Width", "DefCore", idDef); hgt = GetDefCoreVal("Height", "DefCore", idDef); } global func Find_AtObject(object pObj) { if (!pObj) pObj = this; if (!pObj) return; var ox, oy, wdt, hgt; GetRect(GetID(pObj), ox, oy, wdt, hgt); var xpos = GetX(pObj); var ypos = GetY(pObj); return([C4FO_AtRect, xpos + ox, ypos + oy, wdt, hgt]); } global func Find_ActionTarget2(object pObj) { return Find_Func("IsActionTarget2", pObj); } global func Find_ActionTargets(object pTarget) { return Find_Or(Find_ActionTarget(pTarget), Find_ActionTarget2(pTarget)); } global func IsActionTarget2 (object pObj) { return GetActionTarget(1) == pObj;
global func GetDefAttractLightning() { return GetDefCoreVal("AttractLightning", "DefCore"); }
global func GetDefCrewMember() { return GetDefCoreVal("CrewMember", "DefCore"); }
global func GetDefOversize() { return GetDefCoreVal("Oversize", "DefCore"); }
global func GetDefFragile() { return GetDefCoreVal("Fragile", "DefCore"); }
public func Activate(caster, real_caster) { // Zaubernden Clonk ermitteln var clonk = caster; if (real_caster) clonk = real_caster; // Richtungsvorzeichen ermitteln var dir_sign = -1; if (GetDir(caster) == DIR_Right()) dir_sign = +1; // Evtl. mit Flint kombinieren var obj; if (obj = FindContents(FLNT, clonk)) { // Holz erzeugen, anzünden und in Guckrichtung schleudern var wood = CreateObject(WOOD, 5*dir_sign, 0, -1); Incinerate(wood); // Richtigen Controller setzen SetController(GetController(clonk),wood); SetXDir(40*dir_sign, wood); SetYDir(-10, wood); // Flint verbrauchen RemoveObject(obj); } // Evtl. mit Pfeil kombinieren else { obj = FindContents(ARRW, clonk); if(!obj) if(FindContents(ARWP, clonk)) obj = FindContents(ARWP, clonk)->GetItem(); if(obj) { // Ein paar Objekte schleudern var fling_cnt = RandomX(4, 10); var fling_obj; while (fling_obj = FindObject(0, 0, 0, -1, -1, OCF_InFree(), 0, 0, NoContainer(), fling_obj)) { // Zu weit weg vom Clonk? if (ObjectDistance(clonk, fling_obj) > 5*GetDefCoreVal("Width", "DefCore", GetID(caster))) break; // Der Wolf konnte keine Steinhütten wegblasen - Clonks können keine Hütten mit Fundament wegblasen if (!LocalN("basement", fling_obj)) { var pBasement = Local(9, fling_obj); if (GetType(pBasement) != C4V_C4Object()) pBasement=0; if (pBasement) if (!PrivateCall(pBasement, "BasementID")) pBasement=0; if (!pBasement) { SetXDir(dir_sign*Min(80, 80*350/GetMass(fling_obj)), fling_obj); SetYDir(-Min(20, 20/GetMass(fling_obj)), fling_obj); // Bei Objekten noch den Controller anpassen if(GetCategory(fling_obj) & C4D_Object()) SetController(GetController(clonk),fling_obj); } } // Schon genügend Objekte geschleudert? if (!fling_cnt--) break; } if (!Contained(clonk)) { Fling(clonk, 8*dir_sign, -2); } // Pfeil verbrauchen RemoveObject(obj); } // Sonst normale Wirkung else { AddEffect("WindUSpell", 0, 104, 50, 0, GetID(), GetDir(caster)); Sound("Wind2"); } } RemoveObject(); return(1); }
global func GetDefColorByOwner(){ return GetDefCoreVal("ColorByOwner", "DefCore"); }