Rocket silo events

by Quezler

Provides rocket silo animation keyframe events to other mods.

Internal
1 year, 18 days ago
1.1
1.11K

g Rocket Explosions

1 year, 7 months ago

Reference mod: Rocket Explosions

Can you please explain how to do the events for this mod?

1 year, 7 months ago

you'll need something like this in your control.lua:

function register_events()
  script.on_event(remote.call("glutenfree-rocket-silo-events", "on_rocket_silo_status_changed"), function()
    local text = rocket_silo_status[event.old_status] ..' -> '.. rocket_silo_status[event.rocket_silo.rocket_silo_status]
    game.print(event.tick .. ': ' .. text)

    event.rocket_silo.surface.create_entity({
      name = "flying-text",
      position = event.rocket_silo.position,
      text = text,
    })
  end
end

script.on_init(function(event)
  -- any other code
  register_events()
end)

script.on_load(function(event)
  -- any other code
  register_events()
end)
1 year, 7 months ago
(updated 1 year, 7 months ago)

Is using the event script.on_load really multiplayer-safe?

1 year, 7 months ago

yes, on_load does not refer to the server loading the world, but in fact it runs for everyone after downloading the world & before catching up.

New response