diff --git a/OpenRa.Game/Combat.cs b/OpenRa.Game/Combat.cs index c5481ef6f4..37aa3ff088 100644 --- a/OpenRa.Game/Combat.cs +++ b/OpenRa.Game/Combat.cs @@ -56,7 +56,7 @@ namespace OpenRa.Game { var projectile = Rules.ProjectileInfo[weapon.Projectile]; - if (projectile.ASW && target.traits.Contains()) return true; + if (projectile.ASW && target.traits.Contains()) return true; if (projectile.AA && target.traits.Contains()) return true; if (projectile.UnderWater && !target.Info.WaterBound) return false; return projectile.AG; diff --git a/OpenRa.Game/Controller.cs b/OpenRa.Game/Controller.cs index a39cb7b456..57631a1394 100644 --- a/OpenRa.Game/Controller.cs +++ b/OpenRa.Game/Controller.cs @@ -142,6 +142,12 @@ namespace OpenRa.Game return Cursor.Deploy; else return Cursor.DeployBlocked; + case "ActivatePortableChronoshift": return Cursor.Deploy; + case "UsePortableChronoshift": + if (Game.IsCellBuildable(location, a.Info.WaterBound ? UnitMovementType.Float : UnitMovementType.Wheel, a)) + return Cursor.Chronoshift; + else + return Cursor.MoveBlocked; case "DeliverOre": return Cursor.Enter; case "Harvest": return Cursor.Attack; // TODO: special harvest cursor? default: diff --git a/OpenRa.Game/Cursor.cs b/OpenRa.Game/Cursor.cs index 04e7eefc05..a54fd00508 100644 --- a/OpenRa.Game/Cursor.cs +++ b/OpenRa.Game/Cursor.cs @@ -22,5 +22,6 @@ namespace OpenRa.Game public static Cursor Deploy { get { return new Cursor("deploy"); } } public static Cursor Enter { get { return new Cursor("enter"); } } public static Cursor DeployBlocked { get { return new Cursor("deploy-blocked"); } } + public static Cursor Chronoshift { get { return new Cursor("chrono"); } } } } diff --git a/OpenRa.Game/Graphics/WorldRenderer.cs b/OpenRa.Game/Graphics/WorldRenderer.cs index 36263ac982..cdaa2b5ffa 100644 --- a/OpenRa.Game/Graphics/WorldRenderer.cs +++ b/OpenRa.Game/Graphics/WorldRenderer.cs @@ -144,6 +144,44 @@ namespace OpenRa.Game.Graphics lineRenderer.DrawLine(xy + new float2(0, -4), z + new float2(0, -4), healthColor2, healthColor2); + + // Render Pips + var pips = selectedUnit.traits.WithInterface().FirstOrDefault(); + if (pips != null) + { + const int pipSize = 2; // How big are the pips? + int pipCount = pips.GetPipCount(); + Color pipBorderColor = pips.GetBorderColor(); + float2 pipxy = xY + new float2(1, -1); + + // Draw the border + lineRenderer.DrawLine(pipxy, + pipxy + new float2(pipCount * (pipSize + 1) + 1, 0), + pipBorderColor, pipBorderColor); + + lineRenderer.DrawLine(pipxy + new float2(0, -(pipSize + 1)), + pipxy + new float2(pipCount * (pipSize + 1) + 1, -(pipSize + 1)), + pipBorderColor, pipBorderColor); + + // Draw vertical dividers + for (int i = 0; i <= pipCount; i++) + { + lineRenderer.DrawLine(pipxy + new float2(i * (pipSize + 1), -(pipSize + 1)), + pipxy + new float2(i * (pipSize + 1), 0), + pipBorderColor, pipBorderColor); + } + + // Draw pips + for (int i = 0; i < pipCount; i++) + { + Color pipColor = pips.GetColorForPip(i); + if (pipColor == Color.Transparent) continue; // Empty pip + + lineRenderer.DrawLine(pipxy + new float2(1 + i * (pipSize + 1), -2), + pipxy + new float2(1 + i * (pipSize + 1) + pipSize, -2), + pipColor, pipColor); + } + } } if (ShowUnitPaths) diff --git a/OpenRa.Game/OpenRa.Game.csproj b/OpenRa.Game/OpenRa.Game.csproj index ba20ebf291..40e700ea59 100644 --- a/OpenRa.Game/OpenRa.Game.csproj +++ b/OpenRa.Game/OpenRa.Game.csproj @@ -2,7 +2,7 @@ Debug AnyCPU - 9.0.30729 + 9.0.21022 2.0 {0DFB103F-2962-400F-8C6D-E2C28CCBA633} WinExe @@ -128,6 +128,7 @@ + @@ -161,6 +162,7 @@ + @@ -183,6 +185,7 @@ + diff --git a/OpenRa.Game/Order.cs b/OpenRa.Game/Order.cs index 978cdfd39a..8fec44b1de 100644 --- a/OpenRa.Game/Order.cs +++ b/OpenRa.Game/Order.cs @@ -149,6 +149,16 @@ namespace OpenRa.Game return new Order("Move", subject, null, target, null); } + public static Order ActivatePortableChronoshift(Actor subject) + { + return new Order("ActivatePortableChronoshift", subject, null, int2.Zero, null); + } + + public static Order UsePortableChronoshift(Actor subject, int2 target) + { + return new Order("UsePortableChronoshift", subject, null, target, null); + } + public static Order DeployMcv(Actor subject) { return new Order("DeployMcv", subject, null, int2.Zero, null); diff --git a/OpenRa.Game/PlaceBuilding.cs b/OpenRa.Game/PlaceBuilding.cs index f1a6e25840..3497a423f9 100644 --- a/OpenRa.Game/PlaceBuilding.cs +++ b/OpenRa.Game/PlaceBuilding.cs @@ -18,11 +18,17 @@ namespace OpenRa.Game { if( mi.Button == MouseButton.Left ) { - if( !Game.CanPlaceBuilding( Building, xy, null, true ) ) - yield break; + if (!Game.CanPlaceBuilding(Building, xy, null, true)) + { + Sound.Play("nodeply1.aud"); + yield break; + } - if (!Game.IsCloseEnoughToBase(Producer.Owner, Building, xy)) - yield break; + if (!Game.IsCloseEnoughToBase(Producer.Owner, Building, xy)) + { + Sound.Play("nodeply1.aud"); + yield break; + } yield return OpenRa.Game.Order.PlaceBuilding( Producer.Owner, xy, Building.Name ); } diff --git a/OpenRa.Game/Traits/Cloak.cs b/OpenRa.Game/Traits/Cloak.cs index 6d471512e9..f152b04c9e 100644 --- a/OpenRa.Game/Traits/Cloak.cs +++ b/OpenRa.Game/Traits/Cloak.cs @@ -6,22 +6,22 @@ namespace OpenRa.Game.Traits { class Cloak : IRenderModifier, INotifyAttack, ITick { - int remainingSurfaceTime = 2; /* setup for initial dive */ + int remainingUncloakTime = 2; /* setup for initial cloak */ public Cloak(Actor self) {} public void Attacking(Actor self) { - if (remainingSurfaceTime <= 0) - OnSurface(); + if (remainingUncloakTime <= 0) + OnCloak(); - remainingSurfaceTime = (int)(Rules.General.SubmergeDelay * 60 * 25); + remainingUncloakTime = (int)(Rules.General.SubmergeDelay * 60 * 25); } public IEnumerable> ModifyRender(Actor self, IEnumerable> rs) { - if (remainingSurfaceTime > 0) + if (remainingUncloakTime > 0) return rs; if (self.Owner == Game.LocalPlayer) @@ -32,19 +32,19 @@ namespace OpenRa.Game.Traits public void Tick(Actor self) { - if (remainingSurfaceTime > 0) - if (--remainingSurfaceTime <= 0) - OnDive(); + if (remainingUncloakTime > 0) + if (--remainingUncloakTime <= 0) + OnUncloak(); } - void OnSurface() + void OnCloak() { - Sound.Play("subshow1.aud"); + Sound.Play("ironcur9.aud"); } - void OnDive() + void OnUncloak() { - Sound.Play("subshow1.aud"); /* is this the right sound?? */ + Sound.Play("ironcur9.aud"); /* is this the right sound?? */ } } } diff --git a/OpenRa.Game/Traits/TraitsInterfaces.cs b/OpenRa.Game/Traits/TraitsInterfaces.cs index 32f4781c73..ee23a2cf82 100644 --- a/OpenRa.Game/Traits/TraitsInterfaces.cs +++ b/OpenRa.Game/Traits/TraitsInterfaces.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using OpenRa.Game.GameRules; using OpenRa.Game.Graphics; +using System.Drawing; namespace OpenRa.Game.Traits { @@ -23,4 +24,9 @@ namespace OpenRa.Game.Traits ModifyRender( Actor self, IEnumerable> r ); } interface IDamageModifier { float GetDamageModifier(); } interface ISpeedModifier { float GetSpeedModifier(); } + interface IPips { + Color GetBorderColor(); + int GetPipCount(); + Color GetColorForPip(int index); + } } diff --git a/OpenRa.Game/UnitOrders.cs b/OpenRa.Game/UnitOrders.cs index 0da649bd4f..33cbf49e42 100755 --- a/OpenRa.Game/UnitOrders.cs +++ b/OpenRa.Game/UnitOrders.cs @@ -21,6 +21,8 @@ namespace OpenRa.Game case "StartProduction": case "PauseProduction": case "CancelProduction": + case "ActivatePortableChronoshift": + case "UsePortableChronoshift": { foreach( var t in order.Subject.traits.WithInterface() ) t.ResolveOrder( order.Subject, order ); diff --git a/aftermathUnits.ini b/aftermathUnits.ini index 9ec343a9e6..9e7f248de9 100755 --- a/aftermathUnits.ini +++ b/aftermathUnits.ini @@ -7,19 +7,29 @@ QTNK [STNK] Description=Stealth Tank -Traits=Unit, Mobile, RenderUnit +Traits=Unit, Mobile, Turreted, AttackTurreted, RenderUnitTurreted, Cloak +Recoil=2 +Voice=VehicleVoice + [TTNK] Description=Tesla Tank Traits=Unit, Mobile, AttackBase, RenderUnitSpinner +Voice=VehicleVoice + [CTNK] Description=Chrono Tank -Traits=Unit, Mobile, RenderUnit +Traits=Unit, Mobile, AttackBase, RenderUnit, ChronoshiftDeploy +Voice=VehicleVoice + [DTRK] Description=Demo Truck -Traits=Unit, Mobile, RenderUnit +Traits=Unit, Mobile, AttackBase, RenderUnit +Voice=VehicleVoice + [QTNK] Description=M.A.D. Tank Traits=Unit, Mobile, RenderUnit +Voice=VehicleVoice @@ -32,8 +42,8 @@ MSUB Description=Missile Submarine WaterBound=yes BuiltAt=spen -Traits=Unit, Mobile, RenderUnit - +Traits=Unit, Mobile, AttackBase, RenderUnit, Submarine +FireDelay=2 @@ -46,12 +56,13 @@ MECH Description=Tesla Trooper Traits=Unit, Mobile, AttackBase, RenderInfantry SquadSize=1 +Voice=ShokVoice [MECH] Description=Mechanic Traits=Unit, Mobile, AttackBase, RenderInfantry SquadSize=1 - +Voice=MechVoice @@ -60,6 +71,9 @@ SquadSize=1 PortaTesla TTankZap GoodWrench +APTusk +Democharge +SubSCUD [PortaTesla] RenderAsTesla=true @@ -78,3 +92,16 @@ Mechanical [Mechanical] +[VoiceTypes] +ShokVoice +MechVoice + +[ShokVoice] +Select=jchrge1,jjuice1,jjump1,jpower1 +Move=jdance1,jyes1 +Attack=jburn,jcrisp1,jshock1,jlight1 + +[MechVoice] +Select=mhowdy1,mhotdig1,mhuh1 +Move=mlaff1,mhotdig1,mhear1,mboss1,myeehaw1 +Attack=mwrench1,mrise1,mboss1,myeehaw1 \ No newline at end of file diff --git a/sequences-aftermath.xml b/sequences-aftermath.xml index 82f89ed97b..def95e99bd 100644 --- a/sequences-aftermath.xml +++ b/sequences-aftermath.xml @@ -3,6 +3,22 @@ + + sequence name="deploy-0" start="35" length="5" /> + + + + + + + + + + + + + + @@ -16,6 +32,12 @@ + + + + + + @@ -67,4 +89,15 @@ + + + + + + + + + + + diff --git a/units.ini b/units.ini index 2ef769949d..5c7999f85a 100755 --- a/units.ini +++ b/units.ini @@ -106,7 +106,7 @@ PT Description=Submarine WaterBound=yes BuiltAt=spen -Traits=Unit, Mobile, RenderUnit, Cloak, AttackBase +Traits=Unit, Mobile, RenderUnit, Submarine, AttackBase FireDelay=2 LongDesc=Submerged anti-ship unit armed with \ntorpedoes.\n Strong vs Ships\n Weak vs Everything\n Special Ability: Submerge [DD]