This has made debugging rather frustrating, since I had to restart the game each time an error occured.
There appears to be something similar in this function, but I haven't gotten to investigating yet.
Code: Select all
function tickDummies(id,iSurface,iPosition) -- This and kill dummies need to use a factory. I have no idea what that is. Need research
--GlobalPrint("2")
if not id.units then
id.units = {}
else
-- Already exists.
end
if not id.units.accumulator then
id.units.accumulator = iSurface.create_entity{name = "laser-turret-dummy", position = iPosition, force=game.forces.player}
id.units.accumulator.energy = RanaMods.ModularArmor.config.accumulatorEnergyCap -- initialize energy levels
id.previousEnergy = id.units.accumulator.energy -- and previous energy level from last tick
id.units.accumulator.destructible = false -- Make dummy invulnerable.
else
id.units.accumulator.teleport(iPosition) -- Ensure that the power drain dummy is always at the player's position.
end
end