Combat Robots Overhaul

by Wannie

Overhaul of Factorio's Combat Robots behaviour to make them more useful by automatically attacking enemies.

Tweaks
8 hours ago
1.1 - 2.0
10.9K
Combat

b [Fixed] LuaPlayer.surface is VERY problematic

2 days ago

Found a veeeery problematic behaviour in the defenders, the steps to reproduce are this:

  1. deploy some defenders
  2. travel to another surface/planet
  3. deploy more defenders
  4. use remote view
  5. activate the "follow player" mode via shortcut
  6. use remote view to inspect the other surface/planet

Now the defenders will start reacting to the player position change EVEN when this is in another surface.

Looking at the code, the use of the player "surface" property is the problem, as this property can change when using remote view. Looking at Factorio's modding API, the use of "physical_surface" could resolve this, as well as the other "physical_*" properties.

I almost ran into a biter nest using the bots when looking for a insland in fulgora xd

2 days ago

Another one: when deactivating the shortcut, the defenders that are following the player position from another surface/planet won't stop following (I can't move further to fulgora's nort, as the bots will collide with a biter nest)

8 hours ago

Thanks for the extensive report and information on how to fix it. I changed the player.surface property to player.physical_surface_index. With this, both issues (following in remote view and not stopping when pressing the shortcut) should be fixed.

New response