Zero-K icon indicating copy to clipboard operation
Zero-K copied to clipboard

Something gives annoying move orders to units near a busy factory

Open CarabusX opened this issue 5 years ago • 4 comments

Something gives random move orders to any units near a busy factory, which is annoying as it repeatedly overrides player orders, and it is hard to find why it happens.

Steps to reproduce:

  1. ~~Have UnitNoStuckInFactory widget enabled.~~ (proven to happen without the widget too)
  2. Plop rover factory.
  3. Make it build Fencer on Repeat. The factory must keep working.
  4. As soon as first Fencer leaves factory try to give Stop order to it. And again. And again. Good luck. It will only stop once it moves some distance from factory.
  5. Try to give it move order to near a working factory (even on its rear side). Good luck again.

Took a while to find out what is giving these random move orders to my Comm and units. And in what circumstances it happens (only when near busy factory). It is very unintuitive to repeatedly override player orders like that for no obvious reason.

CarabusX avatar Sep 25 '21 04:09 CarabusX

Nice. I thought this was bugger off when I saw it, not a widget.

GoogleFrog avatar Sep 25 '21 05:09 GoogleFrog

As far as I can tell the widget doesn't do what you're saying at all. It only contains widget:UnitFromFactory and I'm noticing bugger off behaviour with it disabled.

GoogleFrog avatar Sep 25 '21 06:09 GoogleFrog

As far as I can tell the widget doesn't do what you're saying at all. It only contains widget:UnitFromFactory and I'm noticing bugger off behaviour with it disabled.

Indeed it happens even with the widget disabled, my bad. No idea how I got that impression, probably while I was disabling the widget, the factory stopped, and I didn't notice. Now I see the widget actually helps as it inserts forward move order to produced units, so the random move order is at least not issued to produced units while still inside factory. I have edited the issue to not point at the UnitNoStuckInFactory widget.

I did more testing now. It still happens even with /luaui disable so it is definitely not any widget. After /luarules disable it stops happening, so it is caused by gadget or unit script, most likely by the BUGGER_OFF you mentioned. (although it seems to not stop immediately, only after several seconds, possibly the BUGGER_OFF state set by factory unit script is still active for a few seconds)

I see factory scripts are calling BUGGER_OFF in a loop by calling GG.Script.UnstickFactory(). Perhaps this is a little excessive? Shouldn't it only be needed before the factory starts producing (to clear the pad), and after unit is finished (to clear the exit)? Or perhaps it a custom Lua solution would be better?

Edit: It is funny how it works. If you move from somewhere far to near the rear of a busy factory, you can stop there. But if you move near the front of it, then to the rear, you can't stop until you move away some distance from it.

CarabusX avatar Sep 25 '21 17:09 CarabusX

Units near a busy factory kept getting move orders that overrode Stop. CarabusX traced this to factory scripts setting COB.BUGGER_OFF in a loop. https://github.com/ZeroK-RTS/Zero-K/commit/95c3577104a08dfd16b7fd79246a67ee363cf286 removes that loop. Factories now use the engine's factory bugger-off on a small area in front of the factory (35 elmos by default). No test was run; this is from the code and history. This looks resolved; it can be closed if the reporter agrees.

Found with help from Claude Code.

moss-orbit-9f339e avatar Oct 24 '26 08:10 moss-orbit-9f339e