Remove AftermathInfo and move some Rules.GeneralInfo settings onto traits
This commit is contained in:
@@ -1,14 +0,0 @@
|
|||||||
|
|
||||||
namespace OpenRa.GameRules
|
|
||||||
{
|
|
||||||
public class AftermathInfo
|
|
||||||
{
|
|
||||||
public readonly int MTankDistance = 0;
|
|
||||||
public readonly float QuakeUnitDamage = 0f;
|
|
||||||
public readonly float QuakeBuildingDamage = 0f;
|
|
||||||
public readonly float QuakeInfantryDamage = 0f;
|
|
||||||
public readonly int QuakeDelay = 0;
|
|
||||||
public readonly int CarrierLaunchDelay = 0;
|
|
||||||
public readonly int ChronoTankDuration = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -4,19 +4,6 @@ namespace OpenRa.GameRules
|
|||||||
{
|
{
|
||||||
public class GeneralInfo
|
public class GeneralInfo
|
||||||
{
|
{
|
||||||
/* Crates */
|
|
||||||
public readonly int CrateMinimum = 0;
|
|
||||||
public readonly int CrateMaximum = 0;
|
|
||||||
public readonly float CrateRadius = 0;
|
|
||||||
public readonly float CrateRegen = 0;
|
|
||||||
public readonly string UnitCrateType = null; /* =none, if any */
|
|
||||||
public readonly float WaterCrateChance = 0;
|
|
||||||
|
|
||||||
public readonly int SoloCrateMoney = 2000;
|
|
||||||
public readonly string SilverCrate = null; /* solo play crate contents */
|
|
||||||
public readonly string WaterCrate = null;
|
|
||||||
public readonly string WoodCrate = null;
|
|
||||||
|
|
||||||
/* Special Weapons */
|
/* Special Weapons */
|
||||||
public readonly float GapRegenInterval =0;
|
public readonly float GapRegenInterval =0;
|
||||||
public readonly int BadgerBombCount = 1;
|
public readonly int BadgerBombCount = 1;
|
||||||
@@ -40,9 +27,6 @@ namespace OpenRa.GameRules
|
|||||||
|
|
||||||
/* Combat & Damage */
|
/* Combat & Damage */
|
||||||
public readonly float TurboBoost = 1.5f;
|
public readonly float TurboBoost = 1.5f;
|
||||||
public readonly int APMineDamage = 0;
|
|
||||||
public readonly int AVMineDamage = 0;
|
|
||||||
public readonly int AtomDamage = 0;
|
|
||||||
public readonly float BallisticScatter = 0;
|
public readonly float BallisticScatter = 0;
|
||||||
public readonly float C4Delay = 0;
|
public readonly float C4Delay = 0;
|
||||||
public readonly float ExpSpread = 0;
|
public readonly float ExpSpread = 0;
|
||||||
@@ -58,7 +42,6 @@ namespace OpenRa.GameRules
|
|||||||
public readonly int Incoming = 0;
|
public readonly int Incoming = 0;
|
||||||
|
|
||||||
/* Income & Production */
|
/* Income & Production */
|
||||||
public readonly int BailCount = 0;
|
|
||||||
public readonly float BuildSpeed = 0;
|
public readonly float BuildSpeed = 0;
|
||||||
public readonly float BuildupTime = 0;
|
public readonly float BuildupTime = 0;
|
||||||
public readonly int GemValue = 0;
|
public readonly int GemValue = 0;
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ namespace OpenRa
|
|||||||
public static InfoLoader<ProjectileInfo> ProjectileInfo;
|
public static InfoLoader<ProjectileInfo> ProjectileInfo;
|
||||||
public static InfoLoader<VoiceInfo> VoiceInfo;
|
public static InfoLoader<VoiceInfo> VoiceInfo;
|
||||||
public static GeneralInfo General;
|
public static GeneralInfo General;
|
||||||
public static AftermathInfo Aftermath;
|
|
||||||
public static TechTree TechTree;
|
public static TechTree TechTree;
|
||||||
|
|
||||||
public static Dictionary<string, ActorInfo> Info;
|
public static Dictionary<string, ActorInfo> Info;
|
||||||
@@ -30,11 +29,6 @@ namespace OpenRa
|
|||||||
General = new GeneralInfo();
|
General = new GeneralInfo();
|
||||||
FieldLoader.Load(General, AllRules.GetSection("General"));
|
FieldLoader.Load(General, AllRules.GetSection("General"));
|
||||||
|
|
||||||
// dirty hack. all of this needs to either die or go to traitinfos
|
|
||||||
Aftermath = new AftermathInfo();
|
|
||||||
if (AllRules.GetSection("Aftermath", true).Count() > 0)
|
|
||||||
FieldLoader.Load(Aftermath, AllRules.GetSection("Aftermath"));
|
|
||||||
|
|
||||||
LoadCategories(
|
LoadCategories(
|
||||||
"Weapon",
|
"Weapon",
|
||||||
"Warhead",
|
"Warhead",
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ namespace OpenRa.GameRules
|
|||||||
{
|
{
|
||||||
// Debug settings
|
// Debug settings
|
||||||
public readonly bool UnitDebug = false;
|
public readonly bool UnitDebug = false;
|
||||||
public readonly bool BuildingDebug = false;
|
|
||||||
public readonly bool PathDebug = false;
|
public readonly bool PathDebug = false;
|
||||||
public readonly bool PerfGraph = true;
|
public readonly bool PerfGraph = true;
|
||||||
|
|
||||||
@@ -19,7 +18,6 @@ namespace OpenRa.GameRules
|
|||||||
public readonly int SheetSize = 512;
|
public readonly int SheetSize = 512;
|
||||||
|
|
||||||
// External game settings
|
// External game settings
|
||||||
public readonly bool UseAftermath = false;
|
|
||||||
public readonly string NetworkHost = "";
|
public readonly string NetworkHost = "";
|
||||||
public readonly int NetworkPort = 0;
|
public readonly int NetworkPort = 0;
|
||||||
public readonly string Map = "scm12ea.ini";
|
public readonly string Map = "scm12ea.ini";
|
||||||
@@ -29,6 +27,7 @@ namespace OpenRa.GameRules
|
|||||||
public readonly string[] InitialMods = { "ra" };
|
public readonly string[] InitialMods = { "ra" };
|
||||||
|
|
||||||
// Gameplay options
|
// Gameplay options
|
||||||
|
// TODO: These need to die
|
||||||
public readonly bool RepairRequiresConyard = true;
|
public readonly bool RepairRequiresConyard = true;
|
||||||
public readonly bool PowerDownBuildings = true;
|
public readonly bool PowerDownBuildings = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -86,7 +86,6 @@
|
|||||||
<Compile Include="Effects\Smoke.cs" />
|
<Compile Include="Effects\Smoke.cs" />
|
||||||
<Compile Include="Effects\TeslaZap.cs" />
|
<Compile Include="Effects\TeslaZap.cs" />
|
||||||
<Compile Include="Exts.cs" />
|
<Compile Include="Exts.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\ActorInfo.cs" />
|
<Compile Include="GameRules\ActorInfo.cs" />
|
||||||
@@ -118,6 +117,7 @@
|
|||||||
<Compile Include="Support\OpenAlInterop.cs" />
|
<Compile Include="Support\OpenAlInterop.cs" />
|
||||||
<Compile Include="Support\PerfHistory.cs" />
|
<Compile Include="Support\PerfHistory.cs" />
|
||||||
<Compile Include="Sync.cs" />
|
<Compile Include="Sync.cs" />
|
||||||
|
<Compile Include="Traits\CrateSpawner.cs" />
|
||||||
<Compile Include="Traits\OreRefinery.cs" />
|
<Compile Include="Traits\OreRefinery.cs" />
|
||||||
<Compile Include="Traits\Activities\Attack.cs" />
|
<Compile Include="Traits\Activities\Attack.cs" />
|
||||||
<Compile Include="Traits\Activities\CallFunc.cs" />
|
<Compile Include="Traits\Activities\CallFunc.cs" />
|
||||||
|
|||||||
@@ -6,6 +6,9 @@ namespace OpenRa.Traits
|
|||||||
{
|
{
|
||||||
class CloakInfo : ITraitInfo
|
class CloakInfo : ITraitInfo
|
||||||
{
|
{
|
||||||
|
public readonly float CloakDelay = 1.2f; // Seconds
|
||||||
|
public readonly string CloakSound = "ironcur9.aud";
|
||||||
|
public readonly string UncloakSound = "ironcur9.aud";
|
||||||
public object Create(Actor self) { return new Cloak(self); }
|
public object Create(Actor self) { return new Cloak(self); }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -14,14 +17,18 @@ namespace OpenRa.Traits
|
|||||||
[Sync]
|
[Sync]
|
||||||
int remainingUncloakTime = 2; /* setup for initial cloak */
|
int remainingUncloakTime = 2; /* setup for initial cloak */
|
||||||
|
|
||||||
public Cloak(Actor self) {}
|
Actor self;
|
||||||
|
public Cloak(Actor self)
|
||||||
|
{
|
||||||
|
this.self = self;
|
||||||
|
}
|
||||||
|
|
||||||
public void Attacking(Actor self)
|
public void Attacking(Actor self)
|
||||||
{
|
{
|
||||||
if (remainingUncloakTime <= 0)
|
if (remainingUncloakTime <= 0)
|
||||||
OnCloak();
|
OnCloak();
|
||||||
|
|
||||||
remainingUncloakTime = (int)(Rules.General.SubmergeDelay * 60 * 25);
|
remainingUncloakTime = (int)(self.Info.Traits.Get<CloakInfo>().CloakDelay * 25);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<Renderable>
|
public IEnumerable<Renderable>
|
||||||
@@ -45,12 +52,12 @@ namespace OpenRa.Traits
|
|||||||
|
|
||||||
void OnCloak()
|
void OnCloak()
|
||||||
{
|
{
|
||||||
Sound.Play("ironcur9.aud");
|
Sound.Play(self.Info.Traits.Get<CloakInfo>().CloakSound);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnUncloak()
|
void OnUncloak()
|
||||||
{
|
{
|
||||||
Sound.Play("ironcur9.aud"); /* is this the right sound?? */
|
Sound.Play(self.Info.Traits.Get<CloakInfo>().UncloakSound);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
27
OpenRa.Game/Traits/CrateSpawner.cs
Normal file
27
OpenRa.Game/Traits/CrateSpawner.cs
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace OpenRa.Traits
|
||||||
|
{
|
||||||
|
class CrateSpawnerInfo : ITraitInfo
|
||||||
|
{
|
||||||
|
public readonly int CrateMinimum = 1; // Minumum number of crates
|
||||||
|
public readonly int CrateMaximum = 255; // Maximum number of crates
|
||||||
|
public readonly int CrateRadius = 3; // Radius of crate effect TODO: This belongs on the crate effect itself
|
||||||
|
public readonly int CrateRegen = 180; // Average time (seconds) between crate spawn
|
||||||
|
public readonly float WaterCrateChance = 0.2f; // Change of generating a water crate instead of a land crate
|
||||||
|
|
||||||
|
public object Create(Actor self) { return new CrateSpawner(self); }
|
||||||
|
}
|
||||||
|
|
||||||
|
class CrateSpawner
|
||||||
|
{
|
||||||
|
Actor self;
|
||||||
|
public CrateSpawner(Actor self)
|
||||||
|
{
|
||||||
|
this.self = self;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,7 +5,8 @@ namespace OpenRa.Traits
|
|||||||
{
|
{
|
||||||
class HarvesterInfo : ITraitInfo
|
class HarvesterInfo : ITraitInfo
|
||||||
{
|
{
|
||||||
public object Create(Actor self) { return new Harvester(); }
|
public readonly int BailCount = 28;
|
||||||
|
public object Create(Actor self) { return new Harvester(self); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Harvester : IIssueOrder, IResolveOrder, IPips
|
public class Harvester : IIssueOrder, IResolveOrder, IPips
|
||||||
@@ -14,8 +15,14 @@ namespace OpenRa.Traits
|
|||||||
public int oreCarried = 0; /* sum of these must not exceed capacity */
|
public int oreCarried = 0; /* sum of these must not exceed capacity */
|
||||||
[Sync]
|
[Sync]
|
||||||
public int gemsCarried = 0;
|
public int gemsCarried = 0;
|
||||||
|
|
||||||
|
Actor self;
|
||||||
|
public Harvester(Actor self)
|
||||||
|
{
|
||||||
|
this.self = self;
|
||||||
|
}
|
||||||
|
|
||||||
public bool IsFull { get { return oreCarried + gemsCarried == Rules.General.BailCount; } }
|
public bool IsFull { get { return oreCarried + gemsCarried == self.Info.Traits.Get<HarvesterInfo>().BailCount; } }
|
||||||
public bool IsEmpty { get { return oreCarried == 0 && gemsCarried == 0; } }
|
public bool IsEmpty { get { return oreCarried == 0 && gemsCarried == 0; } }
|
||||||
|
|
||||||
public void AcceptResource(bool isGem)
|
public void AcceptResource(bool isGem)
|
||||||
@@ -67,13 +74,13 @@ namespace OpenRa.Traits
|
|||||||
const int numPips = 7;
|
const int numPips = 7;
|
||||||
for (int i = 0; i < numPips; i++)
|
for (int i = 0; i < numPips; i++)
|
||||||
{
|
{
|
||||||
if (gemsCarried * 1.0f / Rules.General.BailCount > i * 1.0f / numPips)
|
if (gemsCarried * 1.0f / self.Info.Traits.Get<HarvesterInfo>().BailCount > i * 1.0f / numPips)
|
||||||
{
|
{
|
||||||
yield return PipType.Red;
|
yield return PipType.Red;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((gemsCarried + oreCarried) * 1.0f / Rules.General.BailCount > i * 1.0f / numPips)
|
if ((gemsCarried + oreCarried) * 1.0f / self.Info.Traits.Get<HarvesterInfo>().BailCount > i * 1.0f / numPips)
|
||||||
{
|
{
|
||||||
yield return PipType.Yellow;
|
yield return PipType.Yellow;
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -6,6 +6,9 @@ namespace OpenRa.Traits
|
|||||||
{
|
{
|
||||||
class SubmarineInfo : ITraitInfo
|
class SubmarineInfo : ITraitInfo
|
||||||
{
|
{
|
||||||
|
public readonly float SubmergeDelay = 1.2f; // Seconds
|
||||||
|
public readonly string SubmergeSound = "subshow1.aud";
|
||||||
|
public readonly string SurfaceSound = "subshow1.aud";
|
||||||
public object Create(Actor self) { return new Submarine(self); }
|
public object Create(Actor self) { return new Submarine(self); }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -13,15 +16,19 @@ namespace OpenRa.Traits
|
|||||||
{
|
{
|
||||||
[Sync]
|
[Sync]
|
||||||
int remainingSurfaceTime = 2; /* setup for initial dive */
|
int remainingSurfaceTime = 2; /* setup for initial dive */
|
||||||
|
|
||||||
public Submarine(Actor self) { }
|
Actor self;
|
||||||
|
public Submarine(Actor self)
|
||||||
|
{
|
||||||
|
this.self = self;
|
||||||
|
}
|
||||||
|
|
||||||
void DoSurface()
|
void DoSurface()
|
||||||
{
|
{
|
||||||
if (remainingSurfaceTime <= 0)
|
if (remainingSurfaceTime <= 0)
|
||||||
OnSurface();
|
OnSurface();
|
||||||
|
|
||||||
remainingSurfaceTime = (int)(Rules.General.SubmergeDelay * 60 * 25);
|
remainingSurfaceTime = (int)(self.Info.Traits.Get<SubmarineInfo>().SubmergeDelay * 25);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Attacking(Actor self) { DoSurface(); }
|
public void Attacking(Actor self) { DoSurface(); }
|
||||||
@@ -48,12 +55,12 @@ namespace OpenRa.Traits
|
|||||||
|
|
||||||
void OnSurface()
|
void OnSurface()
|
||||||
{
|
{
|
||||||
Sound.Play("subshow1.aud");
|
Sound.Play(self.Info.Traits.Get<SubmarineInfo>().SurfaceSound);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnDive()
|
void OnDive()
|
||||||
{
|
{
|
||||||
Sound.Play("subshow1.aud"); /* is this the right sound?? */
|
Sound.Play(self.Info.Traits.Get<SubmarineInfo>().SubmergeSound);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ namespace OpenRa.Mods.Aftermath
|
|||||||
{
|
{
|
||||||
class ChronoshiftDeployInfo : ITraitInfo
|
class ChronoshiftDeployInfo : ITraitInfo
|
||||||
{
|
{
|
||||||
|
public readonly int ChargeTime = 120; // Seconds
|
||||||
public object Create(Actor self) { return new ChronoshiftDeploy(self); }
|
public object Create(Actor self) { return new ChronoshiftDeploy(self); }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -16,7 +17,6 @@ namespace OpenRa.Mods.Aftermath
|
|||||||
// Recharge logic
|
// Recharge logic
|
||||||
[Sync]
|
[Sync]
|
||||||
int chargeTick = 0; // How long until we can chronoshift again?
|
int chargeTick = 0; // How long until we can chronoshift again?
|
||||||
readonly int chargeLength = (int)(Rules.Aftermath.ChronoTankDuration * 60 * 25); // How long between shifts?
|
|
||||||
|
|
||||||
public ChronoshiftDeploy(Actor self) { }
|
public ChronoshiftDeploy(Actor self) { }
|
||||||
|
|
||||||
@@ -53,7 +53,7 @@ namespace OpenRa.Mods.Aftermath
|
|||||||
self.CancelActivity();
|
self.CancelActivity();
|
||||||
self.QueueActivity(new Teleport(order.TargetLocation));
|
self.QueueActivity(new Teleport(order.TargetLocation));
|
||||||
Sound.Play("chrotnk1.aud");
|
Sound.Play("chrotnk1.aud");
|
||||||
chargeTick = chargeLength;
|
chargeTick = 25 * self.Info.Traits.Get<ChronoshiftDeployInfo>().ChargeTime;
|
||||||
|
|
||||||
foreach (var a in self.World.Queries.WithTrait<ChronoshiftPaletteEffect>())
|
foreach (var a in self.World.Queries.WithTrait<ChronoshiftPaletteEffect>())
|
||||||
a.Trait.DoChronoshift();
|
a.Trait.DoChronoshift();
|
||||||
@@ -66,7 +66,7 @@ namespace OpenRa.Mods.Aftermath
|
|||||||
const int numPips = 5;
|
const int numPips = 5;
|
||||||
for (int i = 0; i < numPips; i++)
|
for (int i = 0; i < numPips; i++)
|
||||||
{
|
{
|
||||||
if ((1 - chargeTick * 1.0f / chargeLength) * numPips < i + 1)
|
if ((1 - chargeTick * 1.0f / (25 * self.Info.Traits.Get<ChronoshiftDeployInfo>().ChargeTime)) * numPips < i + 1)
|
||||||
{
|
{
|
||||||
yield return PipType.Transparent;
|
yield return PipType.Transparent;
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
Reference in New Issue
Block a user