@@ -159,7 +159,6 @@
|
||||
<Compile Include="Traits\Util.cs" />
|
||||
<Compile Include="Traits\ValidateOrder.cs" />
|
||||
<Compile Include="Traits\World\Country.cs" />
|
||||
<Compile Include="Traits\World\ResourceLayer.cs" />
|
||||
<Compile Include="Traits\World\ResourceType.cs" />
|
||||
<Compile Include="Traits\World\ScreenShaker.cs" />
|
||||
<Compile Include="Traits\World\Shroud.cs" />
|
||||
|
||||
@@ -28,6 +28,7 @@ namespace OpenRA.Traits
|
||||
|
||||
public readonly string[] AllowedTerrainTypes = { };
|
||||
public readonly bool AllowUnderActors = false;
|
||||
public readonly bool AllowUnderBuildings = false;
|
||||
|
||||
public PipType PipColor = PipType.Yellow;
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
using System.Linq;
|
||||
using OpenRA.Traits;
|
||||
using OpenRA.Mods.RA;
|
||||
|
||||
namespace OpenRA.Mods.Cnc
|
||||
{
|
||||
|
||||
@@ -11,8 +11,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.Mods.RA;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Traits
|
||||
namespace OpenRA.Mods.D2k
|
||||
{
|
||||
public class D2kResourceLayerInfo : TraitInfo<D2kResourceLayer> { }
|
||||
|
||||
|
||||
@@ -96,7 +96,8 @@ namespace OpenRA.Mods.RA
|
||||
if (!info.TerrainTypes.Contains(type))
|
||||
return false;
|
||||
|
||||
if (self.World.WorldActor.Trait<BuildingInfluence>().GetBuildingAt(cell) != null) return false;
|
||||
if (self.World.WorldActor.Trait<BuildingInfluence>().GetBuildingAt(cell) != null)
|
||||
return false;
|
||||
|
||||
if (!checkTransientActors)
|
||||
return true;
|
||||
|
||||
@@ -520,6 +520,7 @@
|
||||
<Compile Include="Player\ProvidesCustomPrerequisite.cs" />
|
||||
<Compile Include="Lint\CheckActors.cs" />
|
||||
<Compile Include="Lint\CheckMapCordon.cs" />
|
||||
<Compile Include="World\ResourceLayer.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\OpenRA.Game\OpenRA.Game.csproj">
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2013 The OpenRA Developers (see AUTHORS)
|
||||
* Copyright 2007-2014 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
@@ -12,9 +12,12 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Mods.RA.Buildings;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Traits
|
||||
namespace OpenRA.Mods.RA
|
||||
{
|
||||
[Desc("Attach this to the world actor.")]
|
||||
public class ResourceLayerInfo : TraitInfo<ResourceLayer>, Requires<ResourceTypeInfo> { }
|
||||
|
||||
public class ResourceLayer : IRenderOverlay, IWorldLoaded, ITickRender
|
||||
@@ -22,6 +25,9 @@ namespace OpenRA.Traits
|
||||
static readonly CellContents EmptyCell = new CellContents();
|
||||
|
||||
World world;
|
||||
|
||||
BuildingInfluence buildingInfluence;
|
||||
|
||||
protected CellLayer<CellContents> content;
|
||||
protected CellLayer<CellContents> render;
|
||||
List<CPos> dirty;
|
||||
@@ -54,6 +60,9 @@ namespace OpenRA.Traits
|
||||
public void WorldLoaded(World w, WorldRenderer wr)
|
||||
{
|
||||
this.world = w;
|
||||
|
||||
buildingInfluence = world.WorldActor.Trait<BuildingInfluence>();
|
||||
|
||||
content = new CellLayer<CellContents>(w.Map);
|
||||
render = new CellLayer<CellContents>(w.Map);
|
||||
dirty = new List<CPos>();
|
||||
@@ -139,6 +148,9 @@ namespace OpenRA.Traits
|
||||
if (!rt.Info.AllowUnderActors && world.ActorMap.AnyUnitsAt(cell))
|
||||
return false;
|
||||
|
||||
if (!rt.Info.AllowUnderBuildings && buildingInfluence.GetBuildingAt(cell) != null)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user