diff --git a/OpenRA.Game/Traits/DrawLineToTarget.cs b/OpenRA.Game/Traits/DrawLineToTarget.cs index 4ad3889063..3407762c79 100644 --- a/OpenRA.Game/Traits/DrawLineToTarget.cs +++ b/OpenRA.Game/Traits/DrawLineToTarget.cs @@ -17,7 +17,7 @@ namespace OpenRA.Traits { public class DrawLineToTargetInfo : ITraitInfo { - public readonly int Ticks = 60; + public readonly int Delay = 60; public virtual object Create(ActorInitializer init) { return new DrawLineToTarget(init.Self, this); } } @@ -38,7 +38,7 @@ namespace OpenRA.Traits this.c = c; if (display) - lifetime = info.Ticks; + lifetime = info.Delay; } public void SetTargets(Actor self, List targets, Color c, bool display) @@ -47,7 +47,7 @@ namespace OpenRA.Traits this.c = c; if (display) - lifetime = info.Ticks; + lifetime = info.Delay; } public void Selected(Actor a) @@ -56,7 +56,7 @@ namespace OpenRA.Traits return; // Reset the order line timeout. - lifetime = info.Ticks; + lifetime = info.Delay; } public IEnumerable RenderAfterWorld(WorldRenderer wr) diff --git a/OpenRA.Mods.Common/Activities/HarvestResource.cs b/OpenRA.Mods.Common/Activities/HarvestResource.cs index b18cf077d9..98af831440 100644 --- a/OpenRA.Mods.Common/Activities/HarvestResource.cs +++ b/OpenRA.Mods.Common/Activities/HarvestResource.cs @@ -74,7 +74,7 @@ namespace OpenRA.Mods.Common.Activities foreach (var t in self.TraitsImplementing()) t.Harvested(self, resource); - return ActivityUtils.SequenceActivities(new Wait(harvInfo.LoadTicksPerBale), this); + return ActivityUtils.SequenceActivities(new Wait(harvInfo.BaleLoadDelay), this); } } } diff --git a/OpenRA.Mods.Common/Activities/Rearm.cs b/OpenRA.Mods.Common/Activities/Rearm.cs index 2e13776dd0..611646f936 100644 --- a/OpenRA.Mods.Common/Activities/Rearm.cs +++ b/OpenRA.Mods.Common/Activities/Rearm.cs @@ -28,7 +28,7 @@ namespace OpenRA.Mods.Common.Activities if (ammoPools == null) return; - ammoPoolsReloadTimes = ammoPools.ToDictionary(x => x, y => y.Info.ReloadTicks); + ammoPoolsReloadTimes = ammoPools.ToDictionary(x => x, y => y.Info.ReloadDelay); } public override Activity Tick(Actor self) @@ -66,7 +66,7 @@ namespace OpenRA.Mods.Common.Activities if (sound != null) Game.Sound.Play(sound, self.CenterPosition); - ammoPoolsReloadTimes[pool] = pool.Info.ReloadTicks; + ammoPoolsReloadTimes[pool] = pool.Info.ReloadDelay; } return needsReloading ? this : NextActivity; diff --git a/OpenRA.Mods.Common/Traits/AmmoPool.cs b/OpenRA.Mods.Common/Traits/AmmoPool.cs index 83f54b592e..8dc8268375 100644 --- a/OpenRA.Mods.Common/Traits/AmmoPool.cs +++ b/OpenRA.Mods.Common/Traits/AmmoPool.cs @@ -43,13 +43,13 @@ namespace OpenRA.Mods.Common.Traits public readonly string RearmSound = null; [Desc("Time to reload per ReloadCount on airfield etc.")] - public readonly int ReloadTicks = 25 * 2; + public readonly int ReloadDelay = 50; [Desc("Whether or not ammo is replenished on its own.")] public readonly bool SelfReloads = false; [Desc("Time to reload per ReloadCount when actor 'SelfReloads'.")] - public readonly int SelfReloadTicks = 25 * 2; + public readonly int SelfReloadDelay = 50; [Desc("Whether or not reload timer should be reset when ammo has been fired.")] public readonly bool ResetOnFire = false; @@ -72,7 +72,7 @@ namespace OpenRA.Mods.Common.Traits else CurrentAmmo = Info.Ammo; - RemainingTicks = Info.SelfReloadTicks; + RemainingTicks = Info.SelfReloadDelay; PreviousAmmo = GetAmmoCount(); } @@ -112,13 +112,13 @@ namespace OpenRA.Mods.Common.Traits // Resets the tick counter if ammo was fired. if (Info.ResetOnFire && GetAmmoCount() < PreviousAmmo) { - RemainingTicks = Info.SelfReloadTicks; + RemainingTicks = Info.SelfReloadDelay; PreviousAmmo = GetAmmoCount(); } if (!FullAmmo() && --RemainingTicks == 0) { - RemainingTicks = Info.SelfReloadTicks; + RemainingTicks = Info.SelfReloadDelay; for (var i = 0; i < Info.ReloadCount; i++) GiveAmmo(); diff --git a/OpenRA.Mods.Common/Traits/Attack/AttackCharge.cs b/OpenRA.Mods.Common/Traits/Attack/AttackCharge.cs index c640ac56a8..9e51574b96 100644 --- a/OpenRA.Mods.Common/Traits/Attack/AttackCharge.cs +++ b/OpenRA.Mods.Common/Traits/Attack/AttackCharge.cs @@ -22,7 +22,7 @@ namespace OpenRA.Mods.Common.Traits public readonly int MaxCharges = 1; [Desc("Reload time for all charges (in ticks).")] - public readonly int ReloadTime = 120; + public readonly int ReloadDelay = 120; [Desc("Delay for initial charge attack (in ticks).")] public readonly int InitialChargeDelay = 22; @@ -67,7 +67,7 @@ namespace OpenRA.Mods.Common.Traits public void Attacking(Actor self, Target target, Armament a, Barrel barrel) { --charges; - timeToRecharge = info.ReloadTime; + timeToRecharge = info.ReloadDelay; } public override Activity GetAttackActivity(Actor self, Target newTarget, bool allowMove, bool forceAttack) diff --git a/OpenRA.Mods.Common/Traits/Harvester.cs b/OpenRA.Mods.Common/Traits/Harvester.cs index 2978cf38e3..4f0c20d44f 100644 --- a/OpenRA.Mods.Common/Traits/Harvester.cs +++ b/OpenRA.Mods.Common/Traits/Harvester.cs @@ -33,10 +33,10 @@ namespace OpenRA.Mods.Common.Traits [Desc("How much resources it can carry.")] public readonly int Capacity = 28; - public readonly int LoadTicksPerBale = 4; + public readonly int BaleLoadDelay = 4; [Desc("How fast it can dump it's carryage.")] - public readonly int UnloadTicksPerBale = 4; + public readonly int BaleUnloadDelay = 4; [Desc("How many squares to show the fill level.")] public readonly int PipCount = 7; @@ -290,7 +290,7 @@ namespace OpenRA.Mods.Common.Traits if (--contents[type] == 0) contents.Remove(type); - currentUnloadTicks = Info.UnloadTicksPerBale; + currentUnloadTicks = Info.BaleUnloadDelay; } return contents.Count == 0; diff --git a/OpenRA.Mods.Common/Traits/Player/StrategicVictoryConditions.cs b/OpenRA.Mods.Common/Traits/Player/StrategicVictoryConditions.cs index 1f39ca80e8..0af56bdbbb 100644 --- a/OpenRA.Mods.Common/Traits/Player/StrategicVictoryConditions.cs +++ b/OpenRA.Mods.Common/Traits/Player/StrategicVictoryConditions.cs @@ -22,8 +22,8 @@ namespace OpenRA.Mods.Common.Traits [Desc("Allows King of the Hill (KotH) style gameplay.")] public class StrategicVictoryConditionsInfo : ITraitInfo, Requires { - [Desc("Amount of time (in game ticks) that the player has to hold all the strategic points.", "Defaults to 5 minutes.")] - public readonly int TicksToHold = 25 * 60 * 5; + [Desc("Amount of time (in game ticks) that the player has to hold all the strategic points.", "Defaults to 7500 ticks (5 minutes at default speed).")] + public readonly int HoldDuration = 7500; [Desc("Should the timer reset when the player loses hold of a strategic point.")] public readonly bool ResetOnHoldLost = true; @@ -52,7 +52,7 @@ namespace OpenRA.Mods.Common.Traits public StrategicVictoryConditions(Actor self, StrategicVictoryConditionsInfo svcInfo) { info = svcInfo; - TicksLeft = info.TicksToHold; + TicksLeft = info.HoldDuration; player = self.Owner; mo = self.Trait(); } @@ -97,7 +97,7 @@ namespace OpenRA.Mods.Common.Traits } else if (TicksLeft != 0) if (info.ResetOnHoldLost) - TicksLeft = info.TicksToHold; // Reset the time hold + TicksLeft = info.HoldDuration; // Reset the time hold } } diff --git a/OpenRA.Mods.Common/Traits/Render/WithInfantryBody.cs b/OpenRA.Mods.Common/Traits/Render/WithInfantryBody.cs index c55d5f44f6..12791704c9 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithInfantryBody.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithInfantryBody.cs @@ -19,8 +19,8 @@ namespace OpenRA.Mods.Common.Traits { public class WithInfantryBodyInfo : UpgradableTraitInfo, IRenderActorPreviewSpritesInfo, Requires, Requires { - public readonly int MinIdleWaitTicks = 30; - public readonly int MaxIdleWaitTicks = 110; + public readonly int MinIdleDelay = 30; + public readonly int MaxIdleDelay = 110; [SequenceReference] public readonly string MoveSequence = "run"; [SequenceReference] public readonly string AttackSequence = null; @@ -146,7 +146,7 @@ namespace OpenRA.Mods.Common.Traits if (Info.IdleSequences.Length > 0) { idleSequence = Info.IdleSequences.Random(self.World.SharedRandom); - idleDelay = self.World.SharedRandom.Next(Info.MinIdleWaitTicks, Info.MaxIdleWaitTicks); + idleDelay = self.World.SharedRandom.Next(Info.MinIdleDelay, Info.MaxIdleDelay); } } else if (AllowIdleAnimation(self)) diff --git a/OpenRA.Mods.Common/Traits/SelfHealing.cs b/OpenRA.Mods.Common/Traits/SelfHealing.cs index 08d5b6cfac..ca4b2dd6b7 100644 --- a/OpenRA.Mods.Common/Traits/SelfHealing.cs +++ b/OpenRA.Mods.Common/Traits/SelfHealing.cs @@ -17,7 +17,7 @@ namespace OpenRA.Mods.Common.Traits class SelfHealingInfo : UpgradableTraitInfo, Requires { public readonly int Step = 5; - public readonly int Ticks = 5; + public readonly int Delay = 5; public readonly float HealIfBelow = .5f; public readonly int DamageCooldown = 0; @@ -53,7 +53,7 @@ namespace OpenRA.Mods.Common.Traits if (--ticks <= 0) { - ticks = Info.Ticks; + ticks = Info.Delay; self.InflictDamage(self, -Info.Step, null); } } diff --git a/OpenRA.Mods.Common/Traits/Wanders.cs b/OpenRA.Mods.Common/Traits/Wanders.cs index c6894d4b78..b39a1410cb 100644 --- a/OpenRA.Mods.Common/Traits/Wanders.cs +++ b/OpenRA.Mods.Common/Traits/Wanders.cs @@ -20,13 +20,13 @@ namespace OpenRA.Mods.Common.Traits public readonly int WanderMoveRadius = 1; [Desc("Number of ticks to wait before decreasing the effective move radius.")] - public readonly int TicksToWaitBeforeReducingMoveRadius = 5; + public readonly int ReduceMoveRadiusDelay = 5; [Desc("Minimum amount of ticks the actor will sit idly before starting to wander.")] - public readonly int MinMoveDelayInTicks = 0; + public readonly int MinMoveDelay = 0; [Desc("Maximum amount of ticks the actor will sit idly before starting to wander.")] - public readonly int MaxMoveDelayInTicks = 0; + public readonly int MaxMoveDelay = 0; public abstract object Create(ActorInitializer init); } @@ -49,7 +49,7 @@ namespace OpenRA.Mods.Common.Traits public virtual void OnBecomingIdle(Actor self) { - countdown = self.World.SharedRandom.Next(info.MinMoveDelayInTicks, info.MaxMoveDelayInTicks); + countdown = self.World.SharedRandom.Next(info.MinMoveDelay, info.MaxMoveDelay); } public void TickIdle(Actor self) @@ -70,7 +70,7 @@ namespace OpenRA.Mods.Common.Traits if (!self.World.Map.Contains(targetCell)) { // If MoveRadius is too big there might not be a valid cell to order the attack to (if actor is on a small island and can't leave) - if (++ticksIdle % info.TicksToWaitBeforeReducingMoveRadius == 0) + if (++ticksIdle % info.ReduceMoveRadiusDelay == 0) effectiveMoveRadius--; return CPos.Zero; // We'll be back the next tick; better to sit idle for a few seconds than prolong this tick indefinitely with a loop diff --git a/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs b/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs index 052684320e..d036ba4ed2 100644 --- a/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs +++ b/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs @@ -617,6 +617,33 @@ namespace OpenRA.Mods.Common.UtilityCommands node.Key = "Image"; } + if (engineVersion < 20160321) + { + var parentKey = parent != null ? parent.Key.Split('@').First() : null; + if (node.Key == "Ticks" && parentKey == "DrawLineToTarget") + node.Key = "Duration"; + if (node.Key == "ReloadTicks") + node.Key = "ReloadDelay"; + if (node.Key == "SelfReloadTicks") + node.Key = "SelfReloadDelay"; + if (node.Key == "LoadTicksPerBale") + node.Key = "BaleLoadDelay"; + if (node.Key == "UnloadTicksPerBale") + node.Key = "BaleUnloadDelay"; + if (node.Key == "TicksToHold") + node.Key = "HoldDuration"; + if (node.Key == "Ticks" && parentKey == "SelfHealing") + node.Key = "Delay"; + if (node.Key == "TicksToWaitBeforeReducingMoveRadius") + node.Key = "ReduceMoveRadiusDelay"; + if (node.Key == "MinIdleWaitTicks") + node.Key = "MinIdleDelay"; + if (node.Key == "MaxIdleWaitTicks") + node.Key = "MaxIdleWaitDelay"; + if (node.Key == "ReloadTime") + node.Key = "ReloadDelay"; + } + UpgradeActorRules(engineVersion, ref node.Value.Nodes, node, depth + 1); } }