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