Add unassigned unit to a spawner
Posted: Mon Nov 30, 2020 6:16 pm
Is there a way to add a unit to a spawner after it has been removed from a spawner with LuaEntity.release_from_spawner()
The only way I found, is to set the unit command to wandering and wait. but there is no trigger event to check when the unit has been reassigned to a spawner and it might take some time before the unit searches for a new spawner.
The LuaEntity.units and LuaEntity.spawner fields are read only and the command type "defines.command.group" does only work to add to groups.
I want to replace a spawner with a stonger version and readd all units from the old spawner to the new one. If I just let them wander, the new spawner can spawn new units until the old ones are added but it would be already "full" and stop spawning if I could add the old units right away.
The only way I found, is to set the unit command to wandering and wait. but there is no trigger event to check when the unit has been reassigned to a spawner and it might take some time before the unit searches for a new spawner.
The LuaEntity.units and LuaEntity.spawner fields are read only and the command type "defines.command.group" does only work to add to groups.
I want to replace a spawner with a stonger version and readd all units from the old spawner to the new one. If I just let them wander, the new spawner can spawn new units until the old ones are added but it would be already "full" and stop spawning if I could add the old units right away.