This was my last attempt:
Code: Select all
if targets.energy_source ~= nil then
if targets.energy_source.emissions ~= nil then
signature = signature + (targets.energy_source.emissions * 50000)
-- eg a mining drill produces 0.15/15=0.01 per tick , so it gets (100 health + 50000*0.01) = 600 signature
end
end
and I don't know how else to check whether it exists within the entity before trying to get the value.LuaEntity doesn't contain key energy_source.