diff --git a/CHANGELOG b/CHANGELOG index 6ffd6ef058..c9ad1d084b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -76,6 +76,7 @@ NEW: Decreased Visceroid health by 25% and removed their ability to gain experience. Increased the chance of Tiberium or chemical deaths spawning a Visceroid from 2% to 10%. Increased Obelisk of Light laser damage from 200 to 360. + Fixed Obelisk of Light charge animation and sound not playing. Engine: Converted Aircraft CruiseAltitude to world coordinates. Converted Health Radius to world coordinates. @@ -95,6 +96,8 @@ NEW: Fixed performance issues with units pathing to naval transports. Fixed unit moving to transports that have moved. Updated shroud-based traits to use world units. + Renamed AttackTesla into AttackCharge and un-hardcoded initial charge delay and delay for additional charges. + Updated RenderBuildingCharge so you can set a custom charge sequence name (default is active). Server: Message of the day is now shared between all mods and a default motd.txt gets created in the user directory. Asset Browser: diff --git a/OpenRA.Mods.RA/Attack/AttackCharge.cs b/OpenRA.Mods.RA/Attack/AttackCharge.cs new file mode 100644 index 0000000000..363bdc914b --- /dev/null +++ b/OpenRA.Mods.RA/Attack/AttackCharge.cs @@ -0,0 +1,118 @@ +#region Copyright & License Information +/* + * Copyright 2007-2014 The OpenRA Developers (see AUTHORS) + * This file is part of OpenRA, which is free software. It is made + * available to you under the terms of the GNU General Public License + * as published by the Free Software Foundation. For more information, + * see COPYING. + */ +#endregion + +using OpenRA.Mods.RA.Activities; +using OpenRA.FileFormats; +using OpenRA.Mods.RA.Render; +using OpenRA.Traits; + +namespace OpenRA.Mods.RA +{ + class AttackChargeInfo : AttackOmniInfo + { + public readonly int MaxCharges = 1; + [Desc("Reload time (for all charges).")] + public readonly int ReloadTime = 120; + [Desc("Delay for first charge. Needs to match FireDelay for Obelisk.")] + public readonly int InitialChargeDelay = 22; + [Desc("Delay for additional charges if MaxCharge is larger than 1.")] + public readonly int ChargeDelay = 3; + public override object Create(ActorInitializer init) { return new AttackCharge(init.self); } + } + + class AttackCharge : AttackOmni, ITick, INotifyAttack, ISync + { + [Sync] int charges; + [Sync] int timeToRecharge; + + public AttackCharge(Actor self) + : base(self) + { + charges = self.Info.Traits.Get().MaxCharges; + } + + public override void Tick( Actor self ) + { + if( --timeToRecharge <= 0 ) + charges = self.Info.Traits.Get().MaxCharges; + + base.Tick( self ); + } + + public void Attacking(Actor self, Target target, Armament a, Barrel barrel) + { + --charges; + timeToRecharge = self.Info.Traits.Get().ReloadTime; + } + + public override Activity GetAttackActivity(Actor self, Target newTarget, bool allowMove) + { + return new ChargeAttack(newTarget); + } + + + public override void ResolveOrder(Actor self, Order order) + { + base.ResolveOrder(self, order); + + if (order.OrderString == "Stop") + self.CancelActivity(); + } + + class ChargeAttack : Activity + { + readonly Target target; + public ChargeAttack(Target target) + { + this.target = target; + } + + public override Activity Tick(Actor self) + { + if (IsCanceled || !target.IsValidFor(self)) + return NextActivity; + + var initDelay = self.Info.Traits.Get().InitialChargeDelay; + + var attack = self.Trait(); + if(attack.charges == 0 || !attack.CanAttack(self, target)) + return this; + + self.Trait().PlayCharge(self); + return Util.SequenceActivities(new Wait(initDelay), new ChargeFire(target), this); + } + } + + class ChargeFire : Activity + { + readonly Target target; + public ChargeFire(Target target) + { + this.target = target; + } + + public override Activity Tick(Actor self) + { + if (IsCanceled || !target.IsValidFor(self)) + return NextActivity; + + var chargeDelay = self.Info.Traits.Get().ChargeDelay; + + var attack = self.Trait(); + if(attack.charges == 0) + return NextActivity; + + attack.DoAttack(self, target); + + return Util.SequenceActivities(new Wait(chargeDelay), this); + } + } + } +} diff --git a/OpenRA.Mods.RA/Attack/AttackTesla.cs b/OpenRA.Mods.RA/Attack/AttackTesla.cs deleted file mode 100644 index 56f2091ec3..0000000000 --- a/OpenRA.Mods.RA/Attack/AttackTesla.cs +++ /dev/null @@ -1,101 +0,0 @@ -#region Copyright & License Information -/* - * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made - * available to you under the terms of the GNU General Public License - * as published by the Free Software Foundation. For more information, - * see COPYING. - */ -#endregion - -using OpenRA.Mods.RA.Activities; -using OpenRA.Mods.RA.Render; -using OpenRA.Traits; - -namespace OpenRA.Mods.RA -{ - class AttackTeslaInfo : AttackOmniInfo - { - public readonly int MaxCharges = 3; - public readonly int ReloadTime = 120; - public override object Create(ActorInitializer init) { return new AttackTesla(init.self); } - } - - class AttackTesla : AttackOmni, ITick, INotifyAttack, ISync - { - [Sync] int charges; - [Sync] int timeToRecharge; - - public AttackTesla( Actor self ) - : base( self ) - { - charges = self.Info.Traits.Get().MaxCharges; - } - - public override void Tick( Actor self ) - { - if( --timeToRecharge <= 0 ) - charges = self.Info.Traits.Get().MaxCharges; - - base.Tick( self ); - } - - public void Attacking(Actor self, Target target, Armament a, Barrel barrel) - { - --charges; - timeToRecharge = self.Info.Traits.Get().ReloadTime; - } - - public override Activity GetAttackActivity( Actor self, Target newTarget, bool allowMove ) - { - return new TeslaAttack( newTarget ); - } - - - public override void ResolveOrder(Actor self, Order order) - { - base.ResolveOrder(self, order); - - if (order.OrderString == "Stop") - self.CancelActivity(); - } - - class TeslaAttack : Activity - { - readonly Target target; - public TeslaAttack( Target target ) { this.target = target; } - - public override Activity Tick( Actor self ) - { - if (IsCanceled || !target.IsValidFor(self)) - return NextActivity; - - var attack = self.Trait(); - if( attack.charges == 0 || !attack.CanAttack( self, target ) ) - return this; - - self.Trait().PlayCharge(self); - return Util.SequenceActivities( new Wait( 22 ), new TeslaZap( target ), this ); - } - } - - class TeslaZap : Activity - { - readonly Target target; - public TeslaZap( Target target ) { this.target = target; } - - public override Activity Tick( Actor self ) - { - if (IsCanceled || !target.IsValidFor(self)) - return NextActivity; - - var attack = self.Trait(); - if( attack.charges == 0 ) return NextActivity; - - attack.DoAttack( self, target ); - - return Util.SequenceActivities( new Wait( 3 ), this ); - } - } - } -} diff --git a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj index 02aa8caf19..0d30d9f469 100644 --- a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj +++ b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj @@ -156,7 +156,7 @@ - + diff --git a/OpenRA.Mods.RA/Render/RenderBuildingCharge.cs b/OpenRA.Mods.RA/Render/RenderBuildingCharge.cs index 1abbffcfb0..d356a9e97c 100755 --- a/OpenRA.Mods.RA/Render/RenderBuildingCharge.cs +++ b/OpenRA.Mods.RA/Render/RenderBuildingCharge.cs @@ -1,6 +1,6 @@ #region Copyright & License Information /* - * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) + * Copyright 2007-2014 The OpenRA Developers (see AUTHORS) * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, @@ -8,15 +8,20 @@ */ #endregion +using OpenRA.FileFormats; + namespace OpenRA.Mods.RA.Render { public class RenderBuildingChargeInfo : RenderBuildingInfo { - public readonly string ChargeAudio = "tslachg2.aud"; + [Desc("Sound to play when building charges.")] + public readonly string ChargeAudio = null; + [Desc("Sequence to use for building charge animation.")] + public readonly string ChargeSequence = "active"; public override object Create(ActorInitializer init) { return new RenderBuildingCharge(init, this); } } - /* used for tesla */ + /* used for tesla and obelisk */ public class RenderBuildingCharge : RenderBuilding { RenderBuildingChargeInfo info; @@ -30,7 +35,7 @@ namespace OpenRA.Mods.RA.Render public void PlayCharge(Actor self) { Sound.Play(info.ChargeAudio, self.CenterPosition); - anim.PlayThen(NormalizeSequence(self, "active"), + anim.PlayThen(NormalizeSequence(self, info.ChargeSequence), () => anim.PlayRepeating(NormalizeSequence(self, "idle"))); } } diff --git a/OpenRA.Utility/UpgradeRules.cs b/OpenRA.Utility/UpgradeRules.cs index 4dbc29fae2..0c8930ddd4 100644 --- a/OpenRA.Utility/UpgradeRules.cs +++ b/OpenRA.Utility/UpgradeRules.cs @@ -106,6 +106,19 @@ namespace OpenRA.Utility } } + // AttackTesla was replaced with AttackCharge + if (engineVersion < 20140307) + { + if (depth == 1 && parentKey == "World") + { + if (node.Key == "AttackTesla") + node.Key = "AttackCharge"; + + if (node.Key == "-AttackTesla") + node.Key = "-AttackCharge"; + } + } + // AttackMove was generalized to support all moveable actor types if (engineVersion < 20140116) { diff --git a/mods/cnc/rules/structures.yaml b/mods/cnc/rules/structures.yaml index 3eb66d38b1..d0f4c254e7 100644 --- a/mods/cnc/rules/structures.yaml +++ b/mods/cnc/rules/structures.yaml @@ -600,10 +600,10 @@ OBLI: Armament: Weapon: Laser LocalOffset: 0,0,725 - FireDelay: 8 - AttackTesla: - MaxCharge: 1 + FireDelay: 25 + AttackCharge: ReloadTime: 90 + InitialChargeDelay: 25 AutoTarget: -RenderBuilding: RenderRangeCircle: diff --git a/mods/cnc/sequences/structures.yaml b/mods/cnc/sequences/structures.yaml index 8fd3f8184c..1e45d3af21 100644 --- a/mods/cnc/sequences/structures.yaml +++ b/mods/cnc/sequences/structures.yaml @@ -340,11 +340,11 @@ obli: active: Start: 0 Length: 4 - Tick: 400 + Tick: 680 damaged-active: Start: 4 Length: 4 - Tick: 400 + Tick: 680 dead: Start: 8 make: oblimake diff --git a/mods/ra/rules/structures.yaml b/mods/ra/rules/structures.yaml index d9224ee343..131db9ed7f 100644 --- a/mods/ra/rules/structures.yaml +++ b/mods/ra/rules/structures.yaml @@ -303,10 +303,12 @@ TSLA: RevealsShroud: Range: 8c0 RenderBuildingCharge: + ChargeAudio: tslachg2.aud Armament: Weapon: TeslaZap LocalOffset: 0,0,427 - AttackTesla: + AttackCharge: + MaxCharges: 3 ReloadTime: 120 AutoTarget: IronCurtainable: