public func Advance() { // Letzten Vertex ermitteln var iLastVertex = GetVertexNum() - 1; // Einschlag im Boden if (GBackSemiSolid(GetVertex(iLastVertex, 0) - GetX(), GetVertex(iLastVertex, 1) - GetY())) return(Remove()); // Schon über fünf Schritte fortgeschritten: Schaden an Objekten verursachen if (iLastVertex > 5) BlastObjects(GetVertex(iLastVertex, 0), GetVertex(iLastVertex, 1), 3); // Neuen Schritt durchführen if (Not(AddVertex(GetVertex(iLastVertex, 0) + Local(0) + Random(Local(1)), GetVertex(iLastVertex, 1) + Local(2) + Random(Local(3)) ))) return(Remove()); // Anziehung an ein Zielobjekt prüfen var pTarget; iLastVertex = GetVertexNum() - 1; if (iLastVertex > 7) if (pTarget = FindObject( 0, GetVertex(iLastVertex, 0) - GetX() - 50, GetVertex(iLastVertex, 1) - GetY() - 50, 100, 100, OCF_AttractLightning() )) Attraction(pTarget); }
global func DoExplosion(int x, int y, int level, object inobj, int cause_plr, object layer, bool silent, int damage_level) { // Zero-size explosion doesn't affect anything if (level <= 0) return; // If the object is contained, loop through all parent containers until the blast is contained or no container is found. // Blast the containers it passes through and the objects inside them. var container = inobj; var prev_container = nil; while (container) { // Determine first whether the container has a parent and if it contains the blast. // This is needed because the container might be exploded var contains_blast = container.ContainBlast; var parent_container = container->Contained(); // Blast the current container, but not the previous container. BlastObjects(x + GetX(), y + GetY(), level, container, cause_plr, damage_level, layer, prev_container); // Break the blasting if this container contains the blast. if (contains_blast) break; // Move one container up if possible. prev_container = container; container = parent_container; } // Explosion outside: Explosion effects. if (!container) { // Blast objects outside if there was no final container containing the blast. BlastObjects(x + GetX(), y + GetY(), level, container, cause_plr, damage_level, layer, prev_container); // Incinerate oil. if (!IncinerateLandscape(x, y, cause_plr)) if (!IncinerateLandscape(x, y - 10, cause_plr)) if (!IncinerateLandscape(x - 5, y - 5, cause_plr)) IncinerateLandscape(x + 5, y - 5, cause_plr); // Graphic effects. Call("ExplosionEffect", level, x, y, 0, silent, damage_level); // Landscape destruction. Happens after BlastObjects, so that recently blown-free materials are not affected BlastFree(x, y, level, cause_plr); } return true; }