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