KeinNiemand / Factorio-GhostOnWater

Factorio mod to make it possible to paste blueprints on water in one go
https://mods.factorio.com/mod/GhostOnWater
MIT License
1 stars 8 forks source link

Reduce/Remove Lag Spiked by storing water ghosts in a table in global. #5

Closed KeinNiemand closed 1 year ago

KeinNiemand commented 1 year ago

Instead of searching all entitles for water ghosts every time the mod updates, store water ghosts in a table in global and use that table when processing. Add water ghosts to this table trough events like on_built_entity or script_raised_built or any other possible build events. Scan for water ghosts entities when initializing the global table, and maybe do infrequent scans refilling the table, if there are any issues regarding water ghost entities not ending up in the table.