#6746 closed defect (fixed)

Animal becomes idle for queued garrison

Reported by: Langbart Owned by: Freagarach
Priority: If Time Permits Milestone: Alpha 27
Component: Simulation Keywords:
Cc: Patch: Phab:D4954

Description

to reproduce

  • build and select two corrals
  • press ctrl while keeping shift pressed, right-click on the first corral and then on the second corral
  • make animals, note that the animal from the first corral does not go into the second corral once the first corral is full

expected behavior

  • animal goes into the second corral and does not become idle

Attachments (2)

goat.gif (1.3 MB ) - added by Langbart 15 months ago.
workaround.png (906.0 KB ) - added by Langbart 15 months ago.

Change History (8)

by Langbart, 15 months ago

Attachment: goat.gif added

comment:1 by Stan, 15 months ago

Hey thanks for the report :) Is this a new bug? I don't we follow chained orders for anything if one of the orders fails. It's hard to know when it makes sense to proceed after a failure.

comment:2 by Langbart, 15 months ago

Its reproducible till [14386] after which I stopped testing.

the workaround is adding an outside flag, shall i close it?

by Langbart, 15 months ago

Attachment: workaround.png added

comment:3 by Stan, 15 months ago

I suppose move orders don't get cancelled. I'll wait for Freagarach's input.

comment:4 by Langbart, 15 months ago

Can't the autoGarrison check just be removed?

Ref: [14144] and [14146]

  • binaries/data/mods/public/simulation/components/Trainer.js

    a b Trainer.prototype.Item.prototype.Spawn = function()  
    293293        createdEnts.push(ent);
    294294    }
    295295
    296     if (spawnedEnts.length && !autoGarrison && cmpRallyPoint)
     296    if (spawnedEnts.length && cmpRallyPoint)
    297297        for (const com of GetRallyPointCommands(cmpRallyPoint, spawnedEnts))
    298298            ProcessCommand(this.player, com);

OR

  • binaries/data/mods/public/simulation/components/Trainer.js

    a b Trainer.prototype.Item.prototype.Spawn = function()  
    254254                // Temporary owner affectation needed for GarrisonHolder checks.
    255255                cmpNewOwnership.SetOwnerQuiet(this.player);
    256256                garrisoned = cmpGarrisonable.Garrison(this.trainer);
     257                if (!garrisoned)
     258                    autoGarrison = false
    257259                cmpNewOwnership.SetOwnerQuiet(INVALID_PLAYER);
    258260            }
    259261        }
Last edited 15 months ago by Langbart (previous) (diff)

comment:5 by Freagarach, 15 months ago

Owner: set to Freagarach
Patch: Phab:D4954

Very nice! I was annoyed many times by this already. :)

The first fix would lead to the garrison command being given twice, which should not be too bad. This also means that one can task entities to do actions when garrisoned (e.g. mining).

The second fix may be unexpected, since it may be just one that fails to garrison (in the future). (E.g. if some autoresearched tech increases the garrison limit, and the tech is researched the moment the requirements are met, which can be entity requirements met by spawning the entity.)

comment:6 by Freagarach, 15 months ago

Resolution: fixed
Status: newclosed

In 27560:

Fix units idling after unable to garrison while there are rally points.

When unable to garrison and that is the first rally point, the rest of the rally point queue is not handled.
The check was introduced in r14146 / rP14146 because UnitAI didn't guard garrisoning properly.

Patch by: @Langbart
Differential revision: https://code.wildfiregames.com/D4954
Fixes #6746

Note: See TracTickets for help on using tickets.