How to detect, if entity is active?
Posted: Mon Apr 20, 2015 8:49 am
Hi all. i have some problem. I have any entity of "assembling-machine" type - chemical-plant e.g. I need to do some actions runtime (in control.lua), ONLY when my chemical plant is producing its recipe. I tried options (it shows "true" both when plant is working or staying idle)
and (the same amount, it changes only when entity connects\disconnects electric net. i hoped entity.energy depends on current energy usage)
Yea, i know we can get access to input/output inventory of assembling machine, and every game tick check if result item has been produced. But i dont think its a good idea cause of high frequency checks. Also player can almost immediately take "result item" from output inventory using inserters, so this check will not be valid. I hope you have any ideas?solutions, thanks.
Code: Select all
entity.active
and
Code: Select all
entity.energy
Yea, i know we can get access to input/output inventory of assembling machine, and every game tick check if result item has been produced. But i dont think its a good idea cause of high frequency checks. Also player can almost immediately take "result item" from output inventory using inserters, so this check will not be valid. I hope you have any ideas?solutions, thanks.