Remove BuildingInfluence from ResourceLayer.
This commit is contained in:
committed by
Matthias Mailänder
parent
e4faa6b0f0
commit
90b25be1b6
@@ -35,7 +35,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
}
|
||||
|
||||
[Desc("Attach this to the world actor.", "Order of the layers defines the Z sorting.")]
|
||||
public class ResourceLayerInfo : TraitInfo, IResourceLayerInfo, Requires<ResourceTypeInfo>, Requires<BuildingInfluenceInfo>
|
||||
public class ResourceLayerInfo : TraitInfo, IResourceLayerInfo, Requires<ResourceTypeInfo>
|
||||
{
|
||||
public override object Create(ActorInitializer init) { return new ResourceLayer(init.Self); }
|
||||
}
|
||||
@@ -43,7 +43,6 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public class ResourceLayer : IResourceLayer, IWorldLoaded
|
||||
{
|
||||
readonly World world;
|
||||
readonly BuildingInfluence buildingInfluence;
|
||||
|
||||
protected readonly CellLayer<ResourceLayerContents> Content;
|
||||
|
||||
@@ -56,7 +55,6 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public ResourceLayer(Actor self)
|
||||
{
|
||||
world = self.World;
|
||||
buildingInfluence = self.Trait<BuildingInfluence>();
|
||||
|
||||
Content = new CellLayer<ResourceLayerContents>(world.Map);
|
||||
}
|
||||
@@ -116,11 +114,14 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (!rt.Info.AllowedTerrainTypes.Contains(world.Map.GetTerrainInfo(cell).Type))
|
||||
return false;
|
||||
|
||||
if (!rt.Info.AllowUnderActors && world.ActorMap.AnyActorsAt(cell))
|
||||
foreach (var a in world.ActorMap.GetActorsAt(cell))
|
||||
{
|
||||
if (!rt.Info.AllowUnderActors)
|
||||
return false;
|
||||
|
||||
if (!rt.Info.AllowUnderBuildings && buildingInfluence.GetBuildingAt(cell) != null)
|
||||
if (!rt.Info.AllowUnderBuildings && a.TraitOrDefault<Building>() != null)
|
||||
return false;
|
||||
}
|
||||
|
||||
return rt.Info.AllowOnRamps || world.Map.Ramp[cell] == 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user