diff --git a/OpenRa.Game/GameRules/AftermathInfo.cs b/OpenRa.Game/GameRules/AftermathInfo.cs deleted file mode 100644 index e571f171c2..0000000000 --- a/OpenRa.Game/GameRules/AftermathInfo.cs +++ /dev/null @@ -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; - } -} diff --git a/OpenRa.Game/GameRules/GeneralInfo.cs b/OpenRa.Game/GameRules/GeneralInfo.cs index fa9f86e264..ea8fa66894 100644 --- a/OpenRa.Game/GameRules/GeneralInfo.cs +++ b/OpenRa.Game/GameRules/GeneralInfo.cs @@ -4,19 +4,6 @@ namespace OpenRa.GameRules { 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 */ public readonly float GapRegenInterval =0; public readonly int BadgerBombCount = 1; @@ -40,9 +27,6 @@ namespace OpenRa.GameRules /* Combat & Damage */ 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 C4Delay = 0; public readonly float ExpSpread = 0; @@ -58,7 +42,6 @@ namespace OpenRa.GameRules public readonly int Incoming = 0; /* Income & Production */ - public readonly int BailCount = 0; public readonly float BuildSpeed = 0; public readonly float BuildupTime = 0; public readonly int GemValue = 0; diff --git a/OpenRa.Game/GameRules/Rules.cs b/OpenRa.Game/GameRules/Rules.cs index d755c8b07f..5d62d957cc 100755 --- a/OpenRa.Game/GameRules/Rules.cs +++ b/OpenRa.Game/GameRules/Rules.cs @@ -16,7 +16,6 @@ namespace OpenRa public static InfoLoader ProjectileInfo; public static InfoLoader VoiceInfo; public static GeneralInfo General; - public static AftermathInfo Aftermath; public static TechTree TechTree; public static Dictionary Info; @@ -30,11 +29,6 @@ namespace OpenRa General = new GeneralInfo(); 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( "Weapon", "Warhead", diff --git a/OpenRa.Game/GameRules/UserSettings.cs b/OpenRa.Game/GameRules/UserSettings.cs index 0b1344bab1..573e554b64 100644 --- a/OpenRa.Game/GameRules/UserSettings.cs +++ b/OpenRa.Game/GameRules/UserSettings.cs @@ -5,7 +5,6 @@ namespace OpenRa.GameRules { // Debug settings public readonly bool UnitDebug = false; - public readonly bool BuildingDebug = false; public readonly bool PathDebug = false; public readonly bool PerfGraph = true; @@ -19,7 +18,6 @@ namespace OpenRa.GameRules public readonly int SheetSize = 512; // External game settings - public readonly bool UseAftermath = false; public readonly string NetworkHost = ""; public readonly int NetworkPort = 0; public readonly string Map = "scm12ea.ini"; @@ -29,6 +27,7 @@ namespace OpenRa.GameRules public readonly string[] InitialMods = { "ra" }; // Gameplay options + // TODO: These need to die public readonly bool RepairRequiresConyard = true; public readonly bool PowerDownBuildings = true; } diff --git a/OpenRa.Game/OpenRa.Game.csproj b/OpenRa.Game/OpenRa.Game.csproj index 10506cf73a..bb1abf8cb2 100644 --- a/OpenRa.Game/OpenRa.Game.csproj +++ b/OpenRa.Game/OpenRa.Game.csproj @@ -86,7 +86,6 @@ - @@ -118,6 +117,7 @@ + diff --git a/OpenRa.Game/Traits/Cloak.cs b/OpenRa.Game/Traits/Cloak.cs index a24cf80cc3..c4e302063e 100644 --- a/OpenRa.Game/Traits/Cloak.cs +++ b/OpenRa.Game/Traits/Cloak.cs @@ -6,6 +6,9 @@ namespace OpenRa.Traits { 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); } } @@ -14,14 +17,18 @@ namespace OpenRa.Traits [Sync] 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) { if (remainingUncloakTime <= 0) OnCloak(); - remainingUncloakTime = (int)(Rules.General.SubmergeDelay * 60 * 25); + remainingUncloakTime = (int)(self.Info.Traits.Get().CloakDelay * 25); } public IEnumerable @@ -45,12 +52,12 @@ namespace OpenRa.Traits void OnCloak() { - Sound.Play("ironcur9.aud"); + Sound.Play(self.Info.Traits.Get().CloakSound); } void OnUncloak() { - Sound.Play("ironcur9.aud"); /* is this the right sound?? */ + Sound.Play(self.Info.Traits.Get().UncloakSound); } } } diff --git a/OpenRa.Game/Traits/CrateSpawner.cs b/OpenRa.Game/Traits/CrateSpawner.cs new file mode 100644 index 0000000000..6d9b62690a --- /dev/null +++ b/OpenRa.Game/Traits/CrateSpawner.cs @@ -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; + } + } +} diff --git a/OpenRa.Game/Traits/Harvester.cs b/OpenRa.Game/Traits/Harvester.cs index 10d6bc41ae..d1ac875733 100644 --- a/OpenRa.Game/Traits/Harvester.cs +++ b/OpenRa.Game/Traits/Harvester.cs @@ -5,7 +5,8 @@ namespace OpenRa.Traits { 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 @@ -14,8 +15,14 @@ namespace OpenRa.Traits public int oreCarried = 0; /* sum of these must not exceed capacity */ [Sync] 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().BailCount; } } public bool IsEmpty { get { return oreCarried == 0 && gemsCarried == 0; } } public void AcceptResource(bool isGem) @@ -67,13 +74,13 @@ namespace OpenRa.Traits const int numPips = 7; 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().BailCount > i * 1.0f / numPips) { yield return PipType.Red; continue; } - if ((gemsCarried + oreCarried) * 1.0f / Rules.General.BailCount > i * 1.0f / numPips) + if ((gemsCarried + oreCarried) * 1.0f / self.Info.Traits.Get().BailCount > i * 1.0f / numPips) { yield return PipType.Yellow; continue; diff --git a/OpenRa.Game/Traits/Submarine.cs b/OpenRa.Game/Traits/Submarine.cs index 1f30b0c465..66093a4cda 100644 --- a/OpenRa.Game/Traits/Submarine.cs +++ b/OpenRa.Game/Traits/Submarine.cs @@ -6,6 +6,9 @@ namespace OpenRa.Traits { 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); } } @@ -13,15 +16,19 @@ namespace OpenRa.Traits { [Sync] int remainingSurfaceTime = 2; /* setup for initial dive */ - - public Submarine(Actor self) { } + + Actor self; + public Submarine(Actor self) + { + this.self = self; + } void DoSurface() { if (remainingSurfaceTime <= 0) OnSurface(); - remainingSurfaceTime = (int)(Rules.General.SubmergeDelay * 60 * 25); + remainingSurfaceTime = (int)(self.Info.Traits.Get().SubmergeDelay * 25); } public void Attacking(Actor self) { DoSurface(); } @@ -48,12 +55,12 @@ namespace OpenRa.Traits void OnSurface() { - Sound.Play("subshow1.aud"); + Sound.Play(self.Info.Traits.Get().SurfaceSound); } void OnDive() { - Sound.Play("subshow1.aud"); /* is this the right sound?? */ + Sound.Play(self.Info.Traits.Get().SubmergeSound); } } } diff --git a/OpenRa.Mods.Aftermath/ChronoshiftDeploy.cs b/OpenRa.Mods.Aftermath/ChronoshiftDeploy.cs index dc44045f49..846f93b8de 100644 --- a/OpenRa.Mods.Aftermath/ChronoshiftDeploy.cs +++ b/OpenRa.Mods.Aftermath/ChronoshiftDeploy.cs @@ -8,6 +8,7 @@ namespace OpenRa.Mods.Aftermath { class ChronoshiftDeployInfo : ITraitInfo { + public readonly int ChargeTime = 120; // Seconds public object Create(Actor self) { return new ChronoshiftDeploy(self); } } @@ -16,7 +17,6 @@ namespace OpenRa.Mods.Aftermath // Recharge logic [Sync] 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) { } @@ -53,7 +53,7 @@ namespace OpenRa.Mods.Aftermath self.CancelActivity(); self.QueueActivity(new Teleport(order.TargetLocation)); Sound.Play("chrotnk1.aud"); - chargeTick = chargeLength; + chargeTick = 25 * self.Info.Traits.Get().ChargeTime; foreach (var a in self.World.Queries.WithTrait()) a.Trait.DoChronoshift(); @@ -66,7 +66,7 @@ namespace OpenRa.Mods.Aftermath const int numPips = 5; 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().ChargeTime)) * numPips < i + 1) { yield return PipType.Transparent; continue;