I'm writing a complex scenario where LuaEntity with a "character" type tracks enemies on their own and tries to kills them. The scenario also assumes that "character" type can also destroy building such as walls.
The problem is that after I search for enemies using LuaSurface:find_entities_filtered I feed the position of found entities, that are of opposite hostile force, to my "character" NPC.
- If the found entity is some kind of biter or character and NPC doesn't have a weapon defines.shooting.shooting_enemies and defines.shooting.shooting_selected, will work. The NPC will start attack them with an axe, assuming they're in close distance.
- If NPC has a weapon, only defines.shooting.shooting_enemies will work and fail always for defines.shooting.shooting_selected in both cases.
- If NPC doesn't have a weapon and it tries to attack enemy structure, nothing will happen. The NPC will just stand there, but no attack will happen with an axe. No defines.shooting state works.
- If NPC has a weapon and it tries to attack enemy structure, nothing will happen. The NPC will just stand there, but no attack will happen with an weapon. No defines.shooting state works.
Questions and expectations:
- I would expect for "character" type LuaEntity to attack enemy structures with an axe. Currently that's not possible despite the fact that shooting_state is set.
- I would expect for "character" type LuaEntity to attack enemy structures with an weapon, if present in inventory. Currently that's not possible despite the fact that shooting_state is set.
- Why do we need shooting_enemies and shooting_selected? Why cannot it be done with only single state? Both states only require position parameter anyway.