New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Made both Cargo and Carryall conditional #20534
Conversation
4a99e85
to
8da7878
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PickupUnit activity will also need this check, otherwise it doesn't cancel properly. I managed to glitch out the transport by giving it a pickup order at the same moment it was loading infantry.
The testcase commit should also be renamed to testcase
This should also be tested with the AutoCarryall trait, I imagine there will also need to be checks added to FerryUnit activity, and to the trait itself |
Tested that, as expected AutoCarryall ignores conditions, for most cases it can be simply fixed by removing actors with disabled AutoCarryall from being requested to pickup Carryables. diff --git a/OpenRA.Mods.Common/Traits/AutoCarryable.cs b/OpenRA.Mods.Common/Traits/AutoCarryable.cs
index c248d7146b..cbeccc6583 100644
--- a/OpenRA.Mods.Common/Traits/AutoCarryable.cs
+++ b/OpenRA.Mods.Common/Traits/AutoCarryable.cs
@@ -64,7 +64,7 @@ void RequestTransport(Actor self, CPos destination)
// Inform all idle carriers
var carriers = self.World.ActorsWithTrait<Carryall>()
- .Where(c => c.Trait.State == Carryall.CarryallState.Idle && !c.Actor.IsDead && c.Actor.Owner == self.Owner && c.Actor.IsInWorld)
+ .Where(c => c.Trait.State == Carryall.CarryallState.Idle && !c.Trait.IsTraitDisabled && !c.Actor.IsDead && c.Actor.Owner == self.Owner && c.Actor.IsInWorld)
.OrderBy(p => (self.Location - p.Actor.Location).LengthSquared); However if the AutoCarryall gets disabled mid carrying it will still ignore the condition. That could be fixed depending on desired behaviour in that scenario. Should the carryall attempt to deliver the cargo and wait untill the condition has expired or just stand in place being unable to perform its task? |
8da7878
to
9335682
Compare
Adjusted |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A disabled check should be added to FindCarryableForTransport
in AutoCarryall
.
Also, other issues mentioned by me are still unresolved
9335682
to
c6bba8f
Compare
PickupUnit and AttachUnit activities still need IsTraitDisabled checks |
c6bba8f
to
7f9882d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FerryUnit
activity still needs to cancel OnFirstRun when carryall is disabledRideTransport
activity needs to cancel on carryall becoming disabledAutoCaryall
needs IsTraitDisabled checks in FindCarryableForTransport and RequestTransportNotify
D2K testcase ProvidesPrerequisite@radar:
Prerequisite: radar
RequiresCondition: !disabled Add to carryall AutoCarryall:
RequiresCondition: enabled
GrantConditionOnPrerequisite:
Condition: enabled
Prerequisites: radar this allows you to toggle all caryalls |
7f9882d
to
cccf9c0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
needs a rebase |
cccf9c0
to
172daba
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a bit weird when AutoCarryall is disabled when carrying a unit. It gets stuck carrying that unit forever.
I can see 2 main solutions, 1st is to immediately drop of the Carryable once AutoCarryall becomes disabled, or the other is to trigger a drop off once Autocarryall becomes enabled and has cargo. Personally I don't feel that it's a must to address in this PR
172daba
to
1abc55d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RideTransport
should have an TickInner
override, which should contain an IsTraitDisabled and call Cancel when Cargo becomes disabled. Otherwise units can be chasing the the disabled cargo forever.
Might as well also include a check wether the unit is even valid to be carries, as in is there enough space for it? This would make loading up transports much easier
544eff2
to
4cce8d5
Compare
4cce8d5
to
b527c44
Compare
Closes #17330