Replace ResourceLayer references with IResourceLayer in traits/warheads.

This commit is contained in:
Paul Chote
2021-03-07 17:31:26 +00:00
committed by reaperrr
parent 5adcbe4c78
commit dcd8eccee4
14 changed files with 72 additions and 80 deletions

View File

@@ -106,7 +106,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly IReadOnlyDictionary<ResourceTypeInfo, int> Contents;
readonly Mobile mobile;
readonly ResourceLayer resLayer;
readonly IResourceLayer resourceLayer;
readonly ResourceClaimLayer claimLayer;
readonly Dictionary<ResourceTypeInfo, int> contents = new Dictionary<ResourceTypeInfo, int>();
int conditionToken = Actor.InvalidConditionToken;
@@ -138,7 +138,7 @@ namespace OpenRA.Mods.Common.Traits
Contents = new ReadOnlyDictionary<ResourceTypeInfo, int>(contents);
mobile = self.Trait<Mobile>();
resLayer = self.World.WorldActor.Trait<ResourceLayer>();
resourceLayer = self.World.WorldActor.Trait<IResourceLayer>();
claimLayer = self.World.WorldActor.Trait<ResourceClaimLayer>();
}
@@ -276,12 +276,12 @@ namespace OpenRA.Mods.Common.Traits
if (cell.Layer != 0)
return false;
var resType = resLayer.GetResourceType(cell);
if (resType == null)
var resourceType = resourceLayer.GetResource(cell).Type;
if (resourceType == null)
return false;
// Can the harvester collect this kind of resource?
return Info.Resources.Contains(resType.Info.Type);
return Info.Resources.Contains(resourceType.Info.Type);
}
IEnumerable<IOrderTargeter> IIssueOrder.Orders