Split Locomotor trait from Mobile

Add GrantConditionOn*Layer traits

This allows to
- drop some booleans from Locomotor
- drop a good part of the subterranean- and jumpjet-specific code/hacks from Mobile
- grant more than 1 condition per layer type (via multiple traits)
- easily add more traits of this kind for other layers
This commit is contained in:
reaperrr
2018-03-14 20:51:16 +01:00
committed by abcdefg30
parent f453d9c148
commit 81343926b6
29 changed files with 813 additions and 475 deletions

View File

@@ -69,7 +69,7 @@ namespace OpenRA.Mods.Common.Traits
}
}
bool ICustomMovementLayer.EnabledForActor(ActorInfo a, MobileInfo mi) { return enabled; }
bool ICustomMovementLayer.EnabledForActor(ActorInfo a, LocomotorInfo li) { return enabled; }
byte ICustomMovementLayer.Index { get { return CustomMovementLayerType.ElevatedBridge; } }
bool ICustomMovementLayer.InteractsWithDefaultLayer { get { return true; } }
@@ -78,12 +78,12 @@ namespace OpenRA.Mods.Common.Traits
return cellCenters[cell];
}
int ICustomMovementLayer.EntryMovementCost(ActorInfo a, MobileInfo mi, CPos cell)
int ICustomMovementLayer.EntryMovementCost(ActorInfo a, LocomotorInfo li, CPos cell)
{
return ends.Contains(cell) ? 0 : int.MaxValue;
}
int ICustomMovementLayer.ExitMovementCost(ActorInfo a, MobileInfo mi, CPos cell)
int ICustomMovementLayer.ExitMovementCost(ActorInfo a, LocomotorInfo li, CPos cell)
{
return ends.Contains(cell) ? 0 : int.MaxValue;
}