Page 1 of 1

silo_script causing server problems?

Posted: Mon Jan 07, 2019 11:42 pm
by Musical_tanks
I made the Expanded Rocket payload mod https://mods.factorio.com/mod/expanded-rocket-payloads

I have gotten a bug pop up from one of the users of my mod https://mods.factorio.com/mod/expanded- ... 000b5871c0

They say:
Once I shot my first one into space, the server which i host crashed with the following message when normally the space science appears (indented and spaced for clarity):

Error MainLoop.cpp:1035:

Exception at tick 160017902:
Error while running event expanded-rocket-payloads::on_rocket_launched (ID 10)
Unknown interface: silo_script
stack traceback:
expanded-rocket-payloads/control.lua:4: in function <expanded-rocket-payloads/control.lua:1>

Error ServerMultiplayerManager.cpp:96: MultiplayerManager failed: "Error while running event expanded-rocket-payloads::on_rocket_launched (ID 10)
Unknown interface: silo_script
stack traceback:
expanded-rocket-payloads/control.lua:4: in function <expanded-rocket-payloads/control.lua:1>"

Info ServerMultiplayerManager.cpp:699: mapTick(160017902) changing state from(InGame) to(Failed)

=====

I am using version 0.16.5. When the server crashed, I manually saved on my client.

1: When i load this savefile on the server the error makes the server crash on the first tick
2: Loading it in singleplayer does the same (just making sure)
3: When updating the mod to the latest version (0.16.6), the crash persists.

After some careful analyzing, I discovered that the silo_script isn't present in any of the saves generated by a custom scenario (FactorioScenarioMultiplayerSpawn). So it might not be your fault. But I can't find anything in their code that removes that interface.

4: global.silo_script is also nill if remote.interfaces.silo_script is missing
When i coded my mod the only place I can remember working with the Silo Scrips was in the Control.lua which looks like this:

Code: Select all

script.on_event(defines.events.on_rocket_launched, function(event)
    local rocket = event.rocket
    if rocket.get_item_count("satellite") < 1 then
     remote.call("silo_script", "set_show_launched_without_satellite", false)
    end
end)

script.on_init(setup_remote_call)
script.on_configuration_changed(setup_remote_call)

  function setup_remote_call()
    remote.call(interface_name, "set_show_launched_without_satellite", false)
end

script.on_event(defines.events.on_research_finished, function(event)
    if event.research.name == 'improved-space-program-theory' then
        function setup_remote_call()
            remote.call(interface_name, "set_show_launched_without_satellite", false)
        end
    end
end)

script.on_event(defines.events.on_research_finished, function(event)
    if event.research.name == 'satellite-tracking' then
         remote.call("silo_script", "add_tracked_item", "advanced-probe")
         remote.call("silo_script", "add_tracked_item", "space-lab")
         remote.call("silo_script", "add_tracked_item", "space-telescope")
         remote.call("silo_script", "add_tracked_item", "space-shuttle")
         remote.call("silo_script", "add_tracked_item", "spy-shuttle")
         remote.call("silo_script", "add_tracked_item", "mining-shuttle")
         remote.call("silo_script", "add_tracked_item", "orbital-solar-collector")
         remote.call("silo_script", "add_tracked_item", "observation-satellite")
         remote.call("silo_script", "add_tracked_item", "fabricator-shuttle")
    end
end)
I am not super familiar with script coding so I shambled together what I could to kill the 'launched without satellite' warning from silo_script in a couple different ways (to ensure it died for current and new users) and add new items to be tracked for my mod through a tech.

I don't know how to fix this, help please!

Re: silo_script causing server problems?

Posted: Tue Jan 08, 2019 4:59 pm
by rorror
I'am one of the persons getting the silo_script errors. Happens on diffrent "triggers".

1.) When launcing an empty rocket.

2.) When researching the research of the Mod, you need to Research Satallite-tracking, when that is complete. I also get an Silo_script error. And put me back to main menu of factorio. Unable to do the reseach.

script.on_event(defines.events.on_research_finished, function(event)
if event.research.name == 'satellite-tracking' then
remote.call("silo_script", "add_tracked_item", "advanced-probe")
remote.call("silo_script", "add_tracked_item", "space-lab")
remote.call("silo_script", "add_tracked_item", "space-telescope")
remote.call("silo_script", "add_tracked_item", "space-shuttle")
remote.call("silo_script", "add_tracked_item", "spy-shuttle")
remote.call("silo_script", "add_tracked_item", "mining-shuttle")
remote.call("silo_script", "add_tracked_item", "orbital-solar-collector")
remote.call("silo_script", "add_tracked_item", "observation-satellite")
remote.call("silo_script", "add_tracked_item", "fabricator-shuttle")
end
end)

When i use: /c game.player.force.research_all_technologies() as a test.
The satallite-tracking is completed, and i can continue the research. (But underlying reseach is not complete by the command)

3.) After the above command i can continue the reseach. And able to launch my first "Advanced-Probe". The game crashed again on the silo_script.

I am btw playing in a single player game

Re: silo_script causing server problems?

Posted: Tue Jan 08, 2019 5:29 pm
by Klonan
People may be playing a scenario which does not have the silo script,
You should check that it exists before trying to call it:

Code: Select all

if not remote.interfaces["silo_script"] then return end

Re: silo_script causing server problems?

Posted: Tue Jan 08, 2019 7:34 pm
by rorror
Klonan wrote:
Tue Jan 08, 2019 5:29 pm
People may be playing a scenario which does not have the silo script,
You should check that it exists before trying to call it:

Code: Select all

if not remote.interfaces["silo_script"] then return end
I have changed to control.lua and this fixes for me this the issue.

Re: silo_script causing server problems?

Posted: Wed Jan 09, 2019 2:56 am
by Musical_tanks
perfect thank you!

I'll send out an update tomorrow with the new code