Nexela / Nanobots

Early version of ghost building construction bots. Allows researching automated construction earlier (for blueprints etc)
MIT License
31 stars 22 forks source link

Stop nanobots from trying to repair a character #121

Closed curiosity-a closed 3 years ago

curiosity-a commented 4 years ago

Describe the Bug

Nanobots will try to repair damaged player characters, wasting ammo.

To Reproduce

To reproduce, select a nanobot emitter with construction ammo, get hurt and stand still. Observe the characteristic blue cloud effect on the character and the spending of ammo.

Possible cause: or instead of and in the repairability check https://github.com/Nexela/Nanobots/blob/f691914411b7d457e9c840a2c116fa5ff61ed690/scripts/nanobots.lua#L131

credomane commented 3 years ago

This is especially noticeable when playing with space exploration where health regen is practically non-existent. Higher nanobot research will have you blowing through lots of ammo.

From my understanding of the factorio code this is an improper check altogether. Why not use the exact same flag that repair-tools item type uses to determine if something can be repaired or not? One check versus two and will also result in the same behavior as repair-tools.

local repairable = not entity.has_flag('not-repairable')
curiosity-a commented 3 years ago

I would imagine that robots are repairable, so they would still have to be excluded to achieve the same effect (for whatever reason it's needed). But checking not-repairable instead of breaths-air does seem more fitting.

curiosity-a commented 3 years ago

Can't edit the message, so here's the addendum: in the depths of repository history there is a note saying that "robots don't repair correctly" or something like that. If this is about combat robots, they already have the not-repairable flag, so the single flag check should be enough.

credomane commented 3 years ago

in the depths of repository history there is a note saying that "robots don't repair correctly" or something like that.

I bet that is related to construction drones and logistic bots. They don't have collision boxes far as I know. I assume that whenever #119 is fixed or worked-around this check could be further simplified as well.