[0.9.2] getitemcount in onentitydied when ghosts are active
Posted: Wed Mar 05, 2014 7:43 pm
I have these lines of code in the onEntityDied-event:
It works fine and as intended as long as ghostbuildings are not researched. After that getitemcount will always return 0.
Any idea for a workaround or is it a bug?
Code: Select all
if (event.entity.type == "container") or (event.entity.type == "smart-container") then
local wasteAmount = event.entity.getitemcount("toxic-waste")
if wasteAmount > 0 then
game.pollute(event.entity.position, wasteAmount * 10)
end
end
Any idea for a workaround or is it a bug?