Number of "rockets sent" reset to 1 if score window deleted

This subforum contains all the issues which we already resolved.
Post Reply
User avatar
binbinhfr
Smart Inserter
Smart Inserter
Posts: 1524
Joined: Sat Feb 27, 2016 7:37 pm
Contact:

Number of "rockets sent" reset to 1 if score window deleted

Post by binbinhfr »

if you delete the rocket score window (by console, or by a mod), at the next rocket you launch, the window is reopened but the score is set to 1. You must wait the next launch to see a correct score.

This could be corrected in the control.lua of the map (rocket event) :

Code: Select all

    for index, player in pairs(force.players) do
      if player.gui.left.rocket_score == nil then
        local frame = player.gui.left.add{name = "rocket_score", type = "frame", direction = "horizontal", caption={"score"}}
        frame.add{name="rocket_count_label", type = "label", caption={"", {"rockets-sent"}, ""}}
        frame.add{name="rocket_count", type = "label", caption="1"}  -- PROBLEM
      else
        player.gui.left.rocket_score.rocket_count.caption = tostring(global.satellite_sent[force.name])
      end
    end
should better be :

Code: Select all

    for index, player in pairs(force.players) do
      if player.gui.left.rocket_score == nil then
        local frame = player.gui.left.add{name = "rocket_score", type = "frame", direction = "horizontal", caption={"score"}}
        frame.add{name="rocket_count_label", type = "label", caption={"", {"rockets-sent"}, ""}}
        frame.add{name="rocket_count", type = "label", caption=tostring(global.satellite_sent[force.name])}
      else
        player.gui.left.rocket_score.rocket_count.caption = tostring(global.satellite_sent[force.name])
      end
    end
My mods on the Factorio Mod Portal :geek:

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5150
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: Number of "rockets sent" reset to 1 if score window deleted

Post by Klonan »

Thanks for the report,

I guess i can fix this :)

Rseding91
Factorio Staff
Factorio Staff
Posts: 13209
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Number of "rockets sent" reset to 1 if score window deleted

Post by Rseding91 »

Klonan wrote:Thanks for the report,

I guess i can fix this :)
While you're at it add a remote interface to read the rockets sent so other mods can get that information without needing to track it themselves.
If you want to get ahold of me I'm almost always on Discord.

User avatar
binbinhfr
Smart Inserter
Smart Inserter
Posts: 1524
Joined: Sat Feb 27, 2016 7:37 pm
Contact:

Re: Number of "rockets sent" reset to 1 if score window deleted

Post by binbinhfr »

Rseding91 wrote:While you're at it add a remote interface to read the rockets sent so other mods can get that information without needing to track it themselves.
Great idea ! It would be useful for my new mod that has to leach the original score window before closing it ;-)

viewtopic.php?f=92&t=26519

A nice idea would also be to trigger the rocket event at the very beginning of the launch and not only when the rocket is far away.
And to have an easy access to the satellite slot (it would be useful for other mods that use this slot like Orbital Cannon, etc...).
My mods on the Factorio Mod Portal :geek:

User avatar
binbinhfr
Smart Inserter
Smart Inserter
Posts: 1524
Joined: Sat Feb 27, 2016 7:37 pm
Contact:

Re: Number of "rockets sent" reset to 1 if score window deleted

Post by binbinhfr »

I see that you implement this change in 0.13. Nice !

But please have a look at this other request, easy to implement, like the previous one...
viewtopic.php?f=28&t=26840
My mods on the Factorio Mod Portal :geek:

Post Reply

Return to “Resolved Problems and Bugs”