Skip to content

mod.weapons

The last word on what a superweapon strike hits.

server

fn(plan, ctx) runs on the server each time weapon builds a strike on an island, after the record’s own limits. It never runs for strikes on the Silo, nor in the client VM. plan holds copies of the game’s lists: knocks (buildings hit, { id, at, ... }), destroy (missiles destroyed, { index, at }) and scorch (missile indexes). Remove or reorder entries in place and return nothing. Entries you add or edit are dropped: only the game’s own entries can stay, each once. If fn errors, the plan is left as it was. Register while your mod loads.

Parameter Type
weapon string An existing weapon id, base or added, or "ion".
fn function fn(plan, ctx); ctx is { weapon, level, radius }.

Raises

  • register on_plan hooks while the mod loads
  • on_plan expects a function
  • unknown superweapon '
-- a level 1 Sun Lance never destroys more than one missile
mod.weapons.on_plan("sunlance", function(plan, ctx)
if ctx.level == 1 then
for i = #plan.destroy, 2, -1 do
plan.destroy[i] = nil
end
end
end)