rename NewUnitInfo -> ActorInfo
This commit is contained in:
@@ -13,7 +13,7 @@ namespace OpenRa
|
|||||||
{
|
{
|
||||||
[Sync]
|
[Sync]
|
||||||
public readonly TypeDictionary traits = new TypeDictionary();
|
public readonly TypeDictionary traits = new TypeDictionary();
|
||||||
public readonly NewUnitInfo Info;
|
public readonly ActorInfo Info;
|
||||||
public readonly uint ActorID;
|
public readonly uint ActorID;
|
||||||
[Sync]
|
[Sync]
|
||||||
public int2 Location;
|
public int2 Location;
|
||||||
|
|||||||
4
OpenRa.Game/GameRules/NewUnitInfo.cs → OpenRa.Game/GameRules/ActorInfo.cs
Executable file → Normal file
4
OpenRa.Game/GameRules/NewUnitInfo.cs → OpenRa.Game/GameRules/ActorInfo.cs
Executable file → Normal file
@@ -9,13 +9,13 @@ using System.IO;
|
|||||||
|
|
||||||
namespace OpenRa.GameRules
|
namespace OpenRa.GameRules
|
||||||
{
|
{
|
||||||
public class NewUnitInfo
|
public class ActorInfo
|
||||||
{
|
{
|
||||||
public readonly string Name;
|
public readonly string Name;
|
||||||
public readonly string Category;
|
public readonly string Category;
|
||||||
public readonly TypeDictionary Traits = new TypeDictionary();
|
public readonly TypeDictionary Traits = new TypeDictionary();
|
||||||
|
|
||||||
public NewUnitInfo( string name, MiniYaml node, Dictionary<string, MiniYaml> allUnits )
|
public ActorInfo( string name, MiniYaml node, Dictionary<string, MiniYaml> allUnits )
|
||||||
{
|
{
|
||||||
var mergedNode = MergeWithParent( node, allUnits ).Nodes;
|
var mergedNode = MergeWithParent( node, allUnits ).Nodes;
|
||||||
|
|
||||||
@@ -22,7 +22,7 @@ namespace OpenRa
|
|||||||
public static Map Map;
|
public static Map Map;
|
||||||
public static TileSet TileSet;
|
public static TileSet TileSet;
|
||||||
|
|
||||||
public static Dictionary<string, NewUnitInfo> NewUnitInfo;
|
public static Dictionary<string, ActorInfo> NewUnitInfo;
|
||||||
|
|
||||||
public static void LoadRules(string mapFileName, bool useAftermath)
|
public static void LoadRules(string mapFileName, bool useAftermath)
|
||||||
{
|
{
|
||||||
@@ -70,9 +70,9 @@ namespace OpenRa
|
|||||||
|
|
||||||
yamlRules = MiniYaml.Merge( MiniYaml.FromFile( "[mod]Separate buildqueue for defense.yaml" ), yamlRules );
|
yamlRules = MiniYaml.Merge( MiniYaml.FromFile( "[mod]Separate buildqueue for defense.yaml" ), yamlRules );
|
||||||
|
|
||||||
NewUnitInfo = new Dictionary<string, NewUnitInfo>();
|
NewUnitInfo = new Dictionary<string, ActorInfo>();
|
||||||
foreach( var kv in yamlRules )
|
foreach( var kv in yamlRules )
|
||||||
NewUnitInfo.Add(kv.Key.ToLowerInvariant(), new NewUnitInfo(kv.Key.ToLowerInvariant(), kv.Value, yamlRules));
|
NewUnitInfo.Add(kv.Key.ToLowerInvariant(), new ActorInfo(kv.Key.ToLowerInvariant(), kv.Value, yamlRules));
|
||||||
|
|
||||||
TechTree = new TechTree();
|
TechTree = new TechTree();
|
||||||
Map = new Map( AllRules );
|
Map = new Map( AllRules );
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ namespace OpenRa.GameRules
|
|||||||
{
|
{
|
||||||
public class TechTree
|
public class TechTree
|
||||||
{
|
{
|
||||||
readonly Cache<string, List<NewUnitInfo>> producesIndex = new Cache<string, List<NewUnitInfo>>(x => new List<NewUnitInfo>());
|
readonly Cache<string, List<ActorInfo>> producesIndex = new Cache<string, List<ActorInfo>>(x => new List<ActorInfo>());
|
||||||
|
|
||||||
public TechTree()
|
public TechTree()
|
||||||
{
|
{
|
||||||
@@ -34,7 +34,7 @@ namespace OpenRa.GameRules
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool CanBuild( NewUnitInfo info, Player player, Cache<string, List<Actor>> playerBuildings )
|
public bool CanBuild( ActorInfo info, Player player, Cache<string, List<Actor>> playerBuildings )
|
||||||
{
|
{
|
||||||
var bi = info.Traits.GetOrDefault<BuildableInfo>();
|
var bi = info.Traits.GetOrDefault<BuildableInfo>();
|
||||||
if( bi == null ) return false;
|
if( bi == null ) return false;
|
||||||
@@ -60,7 +60,7 @@ namespace OpenRa.GameRules
|
|||||||
yield return unit.Name;
|
yield return unit.Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<NewUnitInfo> AllBuildables(Player player, params string[] categories)
|
public IEnumerable<ActorInfo> AllBuildables(Player player, params string[] categories)
|
||||||
{
|
{
|
||||||
return Rules.NewUnitInfo.Values
|
return Rules.NewUnitInfo.Values
|
||||||
.Where( x => x.Name[ 0 ] != '^' )
|
.Where( x => x.Name[ 0 ] != '^' )
|
||||||
@@ -68,7 +68,7 @@ namespace OpenRa.GameRules
|
|||||||
.Where( x => x.Traits.Contains<BuildableInfo>() );
|
.Where( x => x.Traits.Contains<BuildableInfo>() );
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<NewUnitInfo> UnitBuiltAt( NewUnitInfo info )
|
public IEnumerable<ActorInfo> UnitBuiltAt( ActorInfo info )
|
||||||
{
|
{
|
||||||
var builtAt = info.Traits.Get<BuildableInfo>().BuiltAt;
|
var builtAt = info.Traits.Get<BuildableInfo>().BuiltAt;
|
||||||
if( builtAt.Length != 0 )
|
if( builtAt.Length != 0 )
|
||||||
|
|||||||
@@ -95,7 +95,7 @@
|
|||||||
<Compile Include="GameRules\AftermathInfo.cs" />
|
<Compile Include="GameRules\AftermathInfo.cs" />
|
||||||
<Compile Include="GameRules\ArmorType.cs" />
|
<Compile Include="GameRules\ArmorType.cs" />
|
||||||
<Compile Include="GameRules\GeneralInfo.cs" />
|
<Compile Include="GameRules\GeneralInfo.cs" />
|
||||||
<Compile Include="GameRules\NewUnitInfo.cs" />
|
<Compile Include="GameRules\ActorInfo.cs" />
|
||||||
<Compile Include="GameRules\SupportPowerInfo.cs" />
|
<Compile Include="GameRules\SupportPowerInfo.cs" />
|
||||||
<Compile Include="GameRules\TechTree.cs" />
|
<Compile Include="GameRules\TechTree.cs" />
|
||||||
<Compile Include="GameRules\UserSettings.cs" />
|
<Compile Include="GameRules\UserSettings.cs" />
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ namespace OpenRa.Traits
|
|||||||
|
|
||||||
public Production( Actor self ) { }
|
public Production( Actor self ) { }
|
||||||
|
|
||||||
public virtual int2? CreationLocation( Actor self, NewUnitInfo producee )
|
public virtual int2? CreationLocation( Actor self, ActorInfo producee )
|
||||||
{
|
{
|
||||||
return ( 1 / 24f * self.CenterLocation ).ToInt2();
|
return ( 1 / 24f * self.CenterLocation ).ToInt2();
|
||||||
}
|
}
|
||||||
@@ -29,7 +29,7 @@ namespace OpenRa.Traits
|
|||||||
return newUnit.Info.Traits.GetOrDefault<UnitInfo>().InitialFacing;
|
return newUnit.Info.Traits.GetOrDefault<UnitInfo>().InitialFacing;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Produce( Actor self, NewUnitInfo producee )
|
public bool Produce( Actor self, ActorInfo producee )
|
||||||
{
|
{
|
||||||
var location = CreationLocation( self, producee );
|
var location = CreationLocation( self, producee );
|
||||||
if( location == null || Game.UnitInfluence.GetUnitsAt( location.Value ).Any() )
|
if( location == null || Game.UnitInfluence.GetUnitsAt( location.Value ).Any() )
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ namespace OpenRa.Traits
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override int2? CreationLocation(Actor self, NewUnitInfo producee)
|
public override int2? CreationLocation(Actor self, ActorInfo producee)
|
||||||
{
|
{
|
||||||
return FindAdjacentTile(self, producee.Traits.Get<OwnedActorInfo>().WaterBound ?
|
return FindAdjacentTile(self, producee.Traits.Get<OwnedActorInfo>().WaterBound ?
|
||||||
UnitMovementType.Float : UnitMovementType.Wheel); /* hackety hack */
|
UnitMovementType.Float : UnitMovementType.Wheel); /* hackety hack */
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ namespace OpenRa.Traits
|
|||||||
|
|
||||||
interface IProducer
|
interface IProducer
|
||||||
{
|
{
|
||||||
bool Produce( Actor self, NewUnitInfo producee );
|
bool Produce( Actor self, ActorInfo producee );
|
||||||
void SetPrimaryProducer(Actor self, bool isPrimary);
|
void SetPrimaryProducer(Actor self, bool isPrimary);
|
||||||
}
|
}
|
||||||
public interface IOccupySpace { IEnumerable<int2> OccupiedCells(); }
|
public interface IOccupySpace { IEnumerable<int2> OccupiedCells(); }
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user