Rocket silo events

by Quezler

Provides rocket silo animation keyframe events to other mods.

Internal
1 year, 8 months ago
1.1
1.24K

g Rocket Explosions

2 years ago

Reference mod: Rocket Explosions

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

2 years 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)
2 years ago
(updated 2 years ago)

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

2 years 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