Pollution detector

by Schorty

Adds a new entity for detecting pollution

a month ago
0.13 - 2.0
1.37K

b Crashes after leaving Lab

11 months ago

Hi,
Bug only occurs in combination with blueprint lab (MOD: Editor Extension)!
If I'm in the Lab and mark one of the detectors with the deconstruction planner, it gets immediately removed.
a few seconds later I get a Mod Crash with the following error:
Error while running event pollution-detector::on_tick(ID 0)
LuaEntity API call when LuaEntity was invalid
stack traceback:
[C]: in function 'index'
__pollution-detector
/control.lua:58 in function
<pollution-detector/control.lua:54>

If i remove the detector with a right click (mine it) there is no error.
I guess the removing via planner skips the "clean up" of detectors that are updated, which is causing the script to fail to update an detector that is no longer existing.

New response