MrxBunkerBuster
Module: mrxbunkerbuster.lua
Overview
MrxBunkerBuster is the laser-guided “penetrator” support weapon: it reuses the whole drop/guidance pipeline of its parent MrxLaserGuidedBomb and only overrides BombExplodes to play a dramatic multi-stage detonation — staged ground shockwaves, a big final blast, then a randomized wave of nearby-building demolition. It has two modes selected purely by which projectile guid was loaded: a standard "Bunker Buster Projectile" and a "Nuclear Bunker Buster Projectile" (the tactical-nuke path, which fires the tact-nuke screen grade).
Inheritance
- Inherits from:
MrxLaserGuidedBomb→MrxSupport - Imports:
MrxSupportDesignatorLaser
Instance pattern
Same class-factory pattern as MrxLaserGuidedBomb/MrxSupport, not per-uGuid — Create(self, uPlayerGuid) builds a new table via setmetatable/__index, exactly like its parent chain. No OnActivate/Awake, no tInstance registry. It tracks the following key fields:
tVOCues: A table of sound cues associated with the support weapon.sBomb: The name of the bomb projectile.uBomb: The GUID of the bomb projectile.oDesignator: An instance ofMrxSupportDesignatorLaserused for designating targets.uPlayerGuid: The GUID of the player who owns the support weapon.sRecruit: The recruit type required to use the support weapon.sModuleName: The name of the module (MrxBunkerBuster).sDeliveryVehicle: The delivery vehicle for the bomb.uDeliveryVehicle: The GUID of the delivery vehicle.uSpawnedBomb: The GUID of the spawned bomb projectile.
Module constants & templates
Set at file scope (module-level globals, not local):
sBomb = "Bunker Buster Projectile"anduBomb = Pg.GetGuidByName("Bunker Buster Projectile").tVOCues— three"Misha-None-Freeplay-Support-*"lines (02/12/20).
Explosion/particle template strings spawned by the detonation chain (all via Pg.Spawn / MrxUtil.SpawnObject / Graphics.Effect.Terrain, so all editable only as engine assets):
"Explosion (Bunker Buster Stage 1)","Explosion (Bunker Buster Stage 2)","Explosion (Airstike Bomb Final Strike)"(note the engine’s ownAirstiketypo)."global_particle_exp_shockwave_ground_bunkerbuster"(ground shockwave).- Nuclear branch:
"global_particle_airstrike_tactnuke"and"global_particle_exp_shockwave_ground_tactnuke"(spawned at named location"loc_shockwave").
Functions
Create(self, uPlayerGuid)
Class-factory constructor. Builds a MrxSupportDesignatorLaser, sets owner / recruit "Pilot" / module name, copies delivery-vehicle and bomb fields onto the instance, and — notably — copies self.BombExplodes onto the instance so the parent’s DropBomb (inherited from MrxLaserGuidedBomb) calls this module’s override.
BombExplodes(self)
Override of the parent stub. Reads self.uSpawnedBomb’s position, spawns "Explosion (Bunker Buster Stage 1)", kills the bomb object, then schedules a staged shockwave chain via Event.Create(Event.TimerRelative, …): GroundExplosion at +0.5 s (r=20), +1 s (r=45), +1.5 s (r=65), and FinalExplosion at +2.75 s.
FinalExplosion(self, nBombX, nBombY, nBombZ)
Branches on which projectile guid self.uBomb holds:
- Standard (
"Bunker Buster Projectile"): spawns"Explosion (Bunker Buster Stage 2)", then schedulesAfterShockwith radius 50 at +2 s. - Nuclear (
"Nuclear Bunker Buster Projectile"): spawns the tact-nuke particle, spawns the ground shockwave at"loc_shockwave"at +1 s, schedulesAfterShockradius 80 at +2 s, andEvent.Post("Nuked", {x,y,z})at +2 s so other systems can react to a nuke detonation.
GroundExplosion(radius, density, nBombX, nBombY, nBombZ)
Draws a terrain shockwave decal with Graphics.Effect.Terrain("global_particle_exp_shockwave_ground_bunkerbuster", radius, density, nBombX, 0, nBombZ). Called from the timer chain with escalating radii.
AfterShock(self, nRadius, nBombX, nBombY, nBombZ)
Posts Event.Post("Busted", {x,y,z}), collects buildings in range with Pg.FastCollectBuildings(nBombX, nBombY, nBombZ, nRadius), and for each schedules a Demolish after a random math.randf()-based delay — so buildings topple in a staggered wave rather than all at once.
Demolish(building)
Spawns "Explosion (Airstike Bomb Final Strike)" at a building’s position (guarded by a position check).
Events
- No
Event.Createsubscriptions. AllEvent.*use is eitherEvent.TimerRelativescheduling (the staged 0.5/1/1.5/2.75/+2 s chain above) orEvent.Postbroadcasts:"Nuked"(nuclear branch) and"Busted"(every AfterShock). Modules elsewhere can subscribe to those two signals. BombExplodes/FinalExplosion/GroundExplosion/AfterShock/Demolishare plain functions invoked via the timer chain and the inherited drop pipeline — they are not event handlers.
Notes for modders
- Radius/timing are the real levers, and they’re plain numeric literals in the timer chain — override
BombExplodesorAfterShock(both plain globals) to change the shockwave radii (20/45/65), the demolish radius (50 / 80 nuclear), or the stage timings. - The standard-vs-nuclear split keys entirely off
self.uBomb(the guid of"Bunker Buster Projectile"vs"Nuclear Bunker Buster Projectile"). SetuBombto the nuclear projectile’s guid before firing to get the nuke path (bigger radius + tact-nuke FX +"Nuked"broadcast). - Listen for the
Event.Post("Nuked", …)/Event.Post("Busted", …)broadcasts if you want your own mod to react to a bunker-buster/nuke detonation. - The staged demolition uses
Pg.FastCollectBuildings— buildings outsidenRadiusof the impact are never touched.