Move StoresOre into Mods.RA
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
@@ -187,7 +187,6 @@
|
||||
<Compile Include="Traits\Production.cs" />
|
||||
<Compile Include="Traits\RallyPoint.cs" />
|
||||
<Compile Include="Traits\Render\RenderSimple.cs" />
|
||||
<Compile Include="Traits\StoresOre.cs" />
|
||||
<Compile Include="Traits\Cloak.cs" />
|
||||
<Compile Include="Traits\TraitsInterfaces.cs" />
|
||||
<Compile Include="Traits\Turreted.cs" />
|
||||
@@ -263,4 +262,7 @@
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
<ItemGroup>
|
||||
<Folder Include="Traits\" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -48,8 +48,8 @@ namespace OpenRA.Traits
|
||||
int nextSiloAdviceTime = 0;
|
||||
void TickOre(Actor self)
|
||||
{
|
||||
OreCapacity = self.World.Queries.OwnedBy[Owner].WithTrait<StoresOre>()
|
||||
.Sum(a => a.Actor.Info.Traits.Get<StoresOreInfo>().Capacity);
|
||||
OreCapacity = self.World.Queries.OwnedBy[Owner].WithTrait<IStoreOre>()
|
||||
.Sum(a => a.Actor.traits.WithInterface<IStoreOre>().Sum(b => b.Capacity));
|
||||
|
||||
if (Ore > OreCapacity)
|
||||
Ore = OreCapacity;
|
||||
|
||||
@@ -56,6 +56,7 @@ namespace OpenRA.Traits
|
||||
public interface INotifyEnterCell { void OnEnterCell(Actor self, int2 cell); }
|
||||
public interface IProvideHazard { IEnumerable<HazardLayer.Hazard> HazardCells(Actor self); }
|
||||
public interface IAvoidHazard { string Type { get; } }
|
||||
public interface IStoreOre { int Capacity { get; }}
|
||||
|
||||
public interface ITerrainTypeModifier { string GetTerrainType(int2 cell); }
|
||||
public interface ITerrainCost { float GetTerrainCost(int2 cell, Actor forActor); }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
@@ -201,6 +201,7 @@
|
||||
<Compile Include="OreRefineryDockAction.cs" />
|
||||
<Compile Include="Activities\Drag.cs" />
|
||||
<Compile Include="ProducesHelicopters.cs" />
|
||||
<Compile Include="StoresOre.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">
|
||||
|
||||
@@ -19,8 +19,9 @@
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace OpenRA.Traits
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
{
|
||||
class StoresOreInfo : ITraitInfo
|
||||
{
|
||||
@@ -30,7 +31,7 @@ namespace OpenRA.Traits
|
||||
public object Create(ActorInitializer init) { return new StoresOre(init.self, this); }
|
||||
}
|
||||
|
||||
class StoresOre : IPips, INotifyCapture, INotifyDamage, IExplodeModifier
|
||||
class StoresOre : IPips, INotifyCapture, INotifyDamage, IExplodeModifier, IStoreOre
|
||||
{
|
||||
readonly PlayerResources Player;
|
||||
readonly StoresOreInfo Info;
|
||||
@@ -41,6 +42,8 @@ namespace OpenRA.Traits
|
||||
Info = info;
|
||||
}
|
||||
|
||||
public int Capacity { get { return Info.Capacity; } }
|
||||
|
||||
public void OnCapture(Actor self, Actor captor)
|
||||
{
|
||||
var ore = Stored(self);
|
||||
Reference in New Issue
Block a user