Page 1 of 1

[Tobias][1.1.74] on_entity_renamed for a train stop doesn't contain player_index when triggered by copy paste

Posted: Sun Dec 18, 2022 12:40 pm
by EvilPLa
Hello,
when I copy a Train stop name via Shift-click or via CTRL-C blueprint onto another stop, the resulting on_entity_renamed event does not contain the player_index field in the EventData.
The following code:

Code: Select all

script.on_event(defines.events.on_entity_renamed, function (event)
    log("------ on_entity_renamed -------")
    log("---- TYPE : " .. event.entity.type)
    log(serpent.block(event))
end)
Produces this log:

Code: Select all

  96.603 Script @__test__/control.lua:3: ------ on_entity_renamed -------
  96.603 Script @__test__/control.lua:4: ---- TYPE : train-stop
  96.603 Script @__test__/control.lua:5: {
  by_script = false,
  entity = {
    __self = "userdata"
  },
  name = 59,
  old_name = "Igor Timurov",
  player_index = 1,
  tick = 3130
}
 106.387 Script @__test__/control.lua:3: ------ on_entity_renamed -------
 106.387 Script @__test__/control.lua:4: ---- TYPE : train-stop
 106.388 Script @__test__/control.lua:5: {
  by_script = false,
  entity = {
    __self = "userdata"
  },
  name = 59,
  old_name = "Nicolas the Hamstroll",
  tick = 3717
}
First event: rename a train stop via gui
then I buld another stop and SHIFT-right click the first stop
Second event: paste the data to the second stop with SHIFT-left click

Then I did the same with a spidertron and the second event had the player_index in the EvenData as expected, that is in the log too

Re: [Tobias][1.1.74] on_entity_renamed for a train stop doesn't contain player_index when triggered by copy paste

Posted: Fri Jan 13, 2023 7:16 am
by Tobias1595
Thanks for the report. A fix will be included in the next release.