[2.0.69] on_chart_tag_modified not raised for changed text/icon

Bugs which we just recently fixed in our development version and will reach you in the next release.
Pi-C
Smart Inserter
Smart Inserter
Posts: 1783
Joined: Sun Oct 14, 2018 8:13 am
Contact:

[2.0.69] on_chart_tag_modified not raised for changed text/icon

Post by Pi-C »

What?
According to the description, on_chart_tag_modified will be "[c]alled when a chart tag is modified by a player or by script." However, the event is only raised if tag position or tag surface have been changed – changes to icon or text are ignored.
How to reproduce
I've started a new game with only the attached mod active. This is the contents of its control.lua:

Code: Select all

script.on_event(defines.events.on_chart_tag_modified, function(event)
  log("Entered handler for on_chart_tag_modified with these data: "..serpent.block(event))
end)

script.on_event(defines.events.on_player_joined_game, function(event)
game.create_surface("ASDF")

local p = game.get_player(event.player_index)
local tag = p.force.add_chart_tag(p.surface, {position = {p.position.x + 5, p.position.y}, text = "Test", icon = {name = "car"}})

log("Changing text!")
tag.text = "New text"

log("Changing icon!")
tag.icon = {name = "tank"}

log("Changing position!")
tag.position = {p.position.x - 5, p.position.y}

log("Changing surface!")
tag.surface = "ASDF"

end)
As you can see from the attached log file, only changes to position and surface trigger the event.
Attachments
factorio-current.log
(12.4 KiB) Downloaded 4 times
test_0.0.1.zip
(918 Bytes) Downloaded 5 times
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
Pi-C
Smart Inserter
Smart Inserter
Posts: 1783
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: [2.0.69] on_chart_tag_modified not raised for changed text/icon

Post by Pi-C »

Sorry, I forgot to mention that the event is raised when tag icon or text are changed by a player. But it won't be raised when icon or text are changed by script.
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
Rseding91
Factorio Staff
Factorio Staff
Posts: 16168
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [2.0.69] on_chart_tag_modified not raised for changed text/icon

Post by Rseding91 »

Thanks for the report. This is now fixed for the next release.
If you want to get ahold of me I'm almost always on Discord.
Post Reply

Return to “Resolved for the next release”