Made both Cargo and Carryall conditional#20534
Conversation
4a99e85 to
8da7878
Compare
PunkPun
left a comment
There was a problem hiding this comment.
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 |
PunkPun
left a comment
There was a problem hiding this comment.
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
PunkPun
left a comment
There was a problem hiding this comment.
FerryUnitactivity still needs to cancel OnFirstRun when carryall is disabledRideTransportactivity needs to cancel on carryall becoming disabledAutoCaryallneeds IsTraitDisabled checks in FindCarryableForTransport and RequestTransportNotify
|
D2K testcase ProvidesPrerequisite@radar:
Prerequisite: radar
RequiresCondition: !disabledAdd to carryall AutoCarryall:
RequiresCondition: enabled
GrantConditionOnPrerequisite:
Condition: enabled
Prerequisites: radarthis allows you to toggle all caryalls |
7f9882d to
cccf9c0
Compare
|
needs a rebase |
cccf9c0 to
172daba
Compare
There was a problem hiding this comment.
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.
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