Rocket Silo: Is rocket ready?

Place to get help with not working mods / modding interface.
NearlyDutch
Inserter
Inserter
Posts: 47
Joined: Tue Oct 20, 2015 12:56 pm
Contact:

Rocket Silo: Is rocket ready?

Post by NearlyDutch »

Is there a way to check if the rocket inside a rocket silo is ready?

This gives 0 after the 100th rocket part is constructed and the rocket is ready to launch:

Code: Select all

entity.rocket_parts
And checking for a satellite in the silo is not the desired information, as there is a state inbetween, where the rocket is constructed and ready too launch, but a satellite isn't put into its inventory yet.
NearlyDutch
Inserter
Inserter
Posts: 47
Joined: Tue Oct 20, 2015 12:56 pm
Contact:

Re: Rocket Silo: Is rocket ready?

Post by NearlyDutch »

Okay I found a way. For anybody looking for a solution now or in the future:

Code: Select all

if silo.get_item_count("satellite") == 1 then
    -- rocket ready with loaded inventory (ready to launch)
elseif silo.can_insert({name = "satellite", count = 1}) then
    -- rocket ready but not loaded
else
    -- rocket not ready
end
Post Reply

Return to “Modding help”