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

@@ -51,7 +51,7 @@ namespace OpenRA.Mods.Common.Activities
{
List<CPos> path;
using (var search =
PathSearch.FromPoint(self.World, mobile.Info, self, mobile.ToCell, destination, false)
PathSearch.FromPoint(self.World, mobile.Info.LocomotorInfo, self, mobile.ToCell, destination, false)
.WithoutLaneBias())
path = self.World.WorldActor.Trait<IPathFinder>().FindPath(search);
return path;
@@ -293,7 +293,9 @@ namespace OpenRA.Mods.Common.Activities
// Wait a bit to see if they leave
if (!hasWaited)
{
waitTicksRemaining = mobile.Info.WaitAverage + self.World.SharedRandom.Next(-mobile.Info.WaitSpread, mobile.Info.WaitSpread);
waitTicksRemaining = mobile.Info.LocomotorInfo.WaitAverage
+ self.World.SharedRandom.Next(-mobile.Info.LocomotorInfo.WaitSpread, mobile.Info.LocomotorInfo.WaitSpread);
hasWaited = true;
}