Modifying rocket silo stats (items launched "count")

Place to get help with not working mods / modding interface.
robertpaulson
Long Handed Inserter
Long Handed Inserter
Posts: 92
Joined: Sun Jun 18, 2017 2:21 pm
Contact:

Modifying rocket silo stats (items launched "count")

Post by robertpaulson »

Hi, I'm trying to access the count for each tracked items in rocket silo stats.

I tried various things:
1-
player.force.items_launched["orbital-ion-cannon"] = player.force.items_launched["orbital-ion-cannon"] - 1

2-
local count = player.force.items_launched["orbital-ion-cannon"] - 1 -- any number here, doesn't do anything at all
player.force.set_item_launched("orbital-ion-cannon", count)

any help would be great.

Edit: if I could call some function that initiates right after the rocket is launched, but before the event.on_rocket_launched (that still has access to the rocket entity. that would work too since i can change swap/remove the rocket item that was launched.... but that seems like a long shot
User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5282
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: Modifying rocket silo stats (items launched "count")

Post by Klonan »

You will need to tell the silo script to update after you change the tracked items, there is a remote.call for it
robertpaulson
Long Handed Inserter
Long Handed Inserter
Posts: 92
Joined: Sun Jun 18, 2017 2:21 pm
Contact:

Re: Modifying rocket silo stats (items launched "count")

Post by robertpaulson »

Klonan wrote: Sun Oct 28, 2018 8:33 am You will need to tell the silo script to update after you change the tracked items, there is a remote.call for it
sry i don't thin i follow.

are you saying that the count is within the tracked items list?

i don't see any update call for rocket-silo script there, unless it was added after 16.30 (thats the version i'm running)
User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5282
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: Modifying rocket silo stats (items launched "count")

Post by Klonan »

robertpaulson wrote: Sun Oct 28, 2018 8:04 pm
Klonan wrote: Sun Oct 28, 2018 8:33 am You will need to tell the silo script to update after you change the tracked items, there is a remote.call for it
sry i don't thin i follow.

are you saying that the count is within the tracked items list?

i don't see any update call for rocket-silo script there, unless it was added after 16.30 (thats the version i'm running)
ah right, I thought there was a specific remote.call for updating the GUI

You can just do the remove_tracked_item remote call with `""` as the parameter, it should refresh the GUI.
robertpaulson
Long Handed Inserter
Long Handed Inserter
Posts: 92
Joined: Sun Jun 18, 2017 2:21 pm
Contact:

Re: Modifying rocket silo stats (items launched "count")

Post by robertpaulson »

Klonan wrote: Mon Oct 29, 2018 8:32 am
ah right, I thought there was a specific remote.call for updating the GUI

You can just do the remove_tracked_item remote call with `""` as the parameter, it should refresh the GUI.
ah nice that worked! thanks a lot for your help
Post Reply

Return to “Modding help”