option for LuaForce.clear_chart to not remove tags
-
- Inserter
- Posts: 47
- Joined: Wed Apr 29, 2020 9:53 pm
- Contact:
option for LuaForce.clear_chart to not remove tags
For a mod I'm making, I'd like to be able to clear the chart without tags disappearing. I assume that clear_chart just nils the chart, but would it be possible to provide a way to clear the chart but leaving the tags?
Re: option for LuaForce.clear_chart to not remove tags
Unfortunately; no. The tags are stored directly on the chart itself so if the chart is removed so are the tags.
If you want to get ahold of me I'm almost always on Discord.
- Stringweasel
- Filter Inserter
- Posts: 421
- Joined: Thu Apr 27, 2017 8:22 pm
- Contact:
Re: option for LuaForce.clear_chart to not remove tags
You could always work around it. Use find_chart_tags to find all the tags in the area you want to clear and remember them, and after you cleared the chart you add_chart_tag them all back in.
Alt-F4 Author | Factorio Modder
My Mods: Hall of Fame | Better Victory Screen | Fluidic Power | Biter Power | Space Spidertron | Spidertron Dock |Weasel's Demolition Derby
Official Contributor to Space Exploration
My Mods: Hall of Fame | Better Victory Screen | Fluidic Power | Biter Power | Space Spidertron | Spidertron Dock |
Official Contributor to Space Exploration
Re: option for LuaForce.clear_chart to not remove tags
It's more complicated than that:Stringweasel wrote: ↑Tue Mar 15, 2022 7:58 am You could always work around it. Use find_chart_tags to find all the tags in the area you want to clear and remember them, and after you cleared the chart you add_chart_tag them all back in.
add_chart_tag wrote:Note
The chunk must be charted for a tag to be valid at that location.
- Stringweasel
- Filter Inserter
- Posts: 421
- Joined: Thu Apr 27, 2017 8:22 pm
- Contact:
Re: option for LuaForce.clear_chart to not remove tags
Ahh, thought there might be something like that lurking with Rseding said that tags are stored in the chart. Thanks for clarifying
Alt-F4 Author | Factorio Modder
My Mods: Hall of Fame | Better Victory Screen | Fluidic Power | Biter Power | Space Spidertron | Spidertron Dock |Weasel's Demolition Derby
Official Contributor to Space Exploration
My Mods: Hall of Fame | Better Victory Screen | Fluidic Power | Biter Power | Space Spidertron | Spidertron Dock |
Official Contributor to Space Exploration
Re: option for LuaForce.clear_chart to not remove tags
This would work if you store the tags when the chunk is cleared, but restore them in the on_chunk_charted eventStringweasel wrote: ↑Tue Mar 15, 2022 7:58 am could always work around it. Use find_chart_tags to find all the tags in the area you want to clear and remember them, and after you cleared the chart you add_chart_tag them all back in.
-
- Inserter
- Posts: 47
- Joined: Wed Apr 29, 2020 9:53 pm
- Contact:
Re: option for LuaForce.clear_chart to not remove tags
There is a subtle reason I haven't tried; I want to perform this action every tick, on multiplayer. Ne pas.
Re: option for LuaForce.clear_chart to not remove tags
If you just want to get rid of the mapping of terrain, you can set map size to something very small and generate the actual map during runtime.thesixthroc wrote: ↑Fri Mar 18, 2022 9:07 pm There is a subtle reason I haven't tried; I want to perform this action every tick, on multiplayer. Ne pas.
Re: option for LuaForce.clear_chart to not remove tags
Setting a chart tag shouldn't be extremely expensive. It should be very cheap even if it's done in lua compared to chunk generation. Restoring chart tags every tick is possible to do quickly if you use tables with chunk location as index.thesixthroc wrote: ↑Fri Mar 18, 2022 9:07 pm There is a subtle reason I haven't tried; I want to perform this action every tick, on multiplayer. Ne pas.
My mods: Capsule Ammo | HandyHands - Automatic handcrafting | ChunkyChunks - Configurable Gridlines
Some other creations: Combinassembly Language GitHub w instructions and link to run it in your browser | 0~drain Laser
Some other creations: Combinassembly Language GitHub w instructions and link to run it in your browser | 0~drain Laser