Add unassigned unit to a spawner

Place to get help with not working mods / modding interface.
JonnyOnSeSocks
Manual Inserter
Manual Inserter
Posts: 4
Joined: Tue Nov 17, 2020 10:11 pm
Contact:

Add unassigned unit to a spawner

Post by JonnyOnSeSocks »

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.
Post Reply

Return to “Modding help”