Page 1 of 1

[0.17.64] force.add_chart_tag not working at the start

Posted: Sun Aug 11, 2019 2:49 am
by TheFunnySide
i am using force.add_chart_tag in an on_chunk_generated event. And the tags i place before the game has rendered the first frame arent visible/not existant.
The tags which are placed later by on_chunk are visible. I placed some log() and they tell me that the code is being executed like it is supposed to be.

function add_chart_tag_for_all_forces(surface, position, text)
log("tag_all")
for i, force in pairs(game.forces) do
log("tag")
log(force.name)
log(text)
force.add_chart_tag(surface, {position = position, text = text})
end
end
9363.713 Script @__Annotorio__/prototypes/map/island_naming.lua:104: tag_all
9363.713 Script @__Annotorio__/prototypes/map/island_naming.lua:106: tag
9363.713 Script @__Annotorio__/prototypes/map/island_naming.lua:107: player
9363.713 Script @__Annotorio__/prototypes/map/island_naming.lua:108: Leocord Reef
9363.713 Script @__Annotorio__/prototypes/map/island_naming.lua:106: tag
9363.713 Script @__Annotorio__/prototypes/map/island_naming.lua:107: enemy
9363.713 Script @__Annotorio__/prototypes/map/island_naming.lua:108: Leocord Reef
9363.713 Script @__Annotorio__/prototypes/map/island_naming.lua:106: tag
9363.713 Script @__Annotorio__/prototypes/map/island_naming.lua:107: neutral
9363.713 Script @__Annotorio__/prototypes/map/island_naming.lua:108: Leocord Reef

Re: [0.17.64] force.add_chart_tag not working at the start

Posted: Sun Aug 11, 2019 4:50 am
by Rseding91
Thanks for the report. You need to wait for the chunk to be charted before you can add tags to it. The tags are stored on the charting for that chunk so when it's first generated it has no chart data.