Hello,
I am using Combat Robot Overhaul version 2.1.31 together with Krastorio 2 on Factorio 2.0.77, without Space Age.
When I enter a specific area of the map with the player character, the game terminates and reports an unrecoverable error caused by Combat Robot Overhaul. The problem appears to be connected to a destroyer combat robot group located in, or activated by entering, that area.
Steps to reproduce:
- Load the affected save.
- Move the player character into the affected map area.
- As soon as the area is entered, Combat Robot Overhaul produces the error and the game terminates.
Expected behavior:
The combat robot group should update normally and the game should continue running.
Actual behavior:
During the periodic destroyer group update, Combat Robot Overhaul attempts to access a LuaEntity that is no longer valid, causing the game to terminate.
Full error message:
Error while running event CombatRobotsOverhaul::on_nth_tick(60)
LuaEntity API call when LuaEntity was invalid.
stack traceback:
[C]: in function '__index'
CombatRobotsOverhaul/scripts/basegroup.lua:101: in function 'move_to_target'
CombatRobotsOverhaul/scripts/destroyergroup.lua:48: in function 'update'
CombatRobotsOverhaul/control.lua:302: in function <CombatRobotsOverhaul/control.lua:295>
Possible cause:
It appears that move_to_target in scripts/basegroup.lua, around line 101, accesses a combat robot, target, or another stored LuaEntity reference after that entity has been destroyed, removed, or otherwise invalidated. A validity check such as entity and entity.valid may be missing before the entity is accessed.
Entering the map area may only trigger the update of the affected destroyer group; the underlying issue seems to be an invalid entity reference stored by that group.
I can provide my complete mod list if required.