diff --git a/OpenRA.Mods.RA/Missions/Allies04Script.cs b/OpenRA.Mods.RA/Missions/Allies04Script.cs index 8ffdc7632e..dc4d36fd57 100644 --- a/OpenRA.Mods.RA/Missions/Allies04Script.cs +++ b/OpenRA.Mods.RA/Missions/Allies04Script.cs @@ -87,6 +87,11 @@ namespace OpenRA.Mods.RA.Missions int nextCivilianMove = 1; + Actor bridgeTank; + Actor bridgeAttackPoint; + Actor bridge; + bool attackingBridge; + void MissionFailed(string text) { if (allies1.WinState != WinState.Undefined) @@ -123,7 +128,7 @@ namespace OpenRA.Mods.RA.Missions { InsertSpies(); } - if (world.FrameNumber == 600) + if (world.FrameNumber == 25 * 25) { SendHind(hind1EntryPoint, hind1Points, hind1ExitPoint); } @@ -146,6 +151,19 @@ namespace OpenRA.Mods.RA.Missions { destroyBaseTimer.Tick(); } + if (world.FrameNumber == frameInfiltrated + 1500 * 12 && !bridgeTank.IsDead() && bridgeTank.IsInWorld && !bridge.IsDead()) + { + bridgeTank.QueueActivity(new Attack(Target.FromPos(bridge.CenterLocation), 4)); + attackingBridge = true; + } + if (bridge.IsDead() && attackingBridge) + { + if (!bridgeTank.IsDead()) + { + bridgeTank.CancelActivity(); + } + attackingBridge = false; + } } foreach (var patrol in patrols) { @@ -235,8 +253,8 @@ namespace OpenRA.Mods.RA.Missions void OnLabInfiltrated(Actor spy) { - if (spy == allies1Spy) { allies1SpyInfiltratedLab = true; } - else if (spy == allies2Spy) { allies2SpyInfiltratedLab = true; } + if (spy == allies1Spy) allies1SpyInfiltratedLab = true; + else if (spy == allies2Spy) allies2SpyInfiltratedLab = true; if (allies1SpyInfiltratedLab && (allies2SpyInfiltratedLab || allies2Spy == null)) { objectives[InfiltrateID].Status = ObjectiveStatus.Completed; @@ -345,16 +363,9 @@ namespace OpenRA.Mods.RA.Missions void SetupSubStances() { - if (!Game.IsHost) - { - return; - } foreach (var actor in world.Actors.Where(a => a.IsInWorld && a.Owner == soviets && !a.IsDead() && a.HasTrait())) { - world.IssueOrder(new Order("SetUnitStance", actor, false) - { - TargetLocation = new CPos((int)UnitStance.Defend, 0) - }); + actor.Trait().stance = UnitStance.Defend; } } @@ -373,6 +384,7 @@ namespace OpenRA.Mods.RA.Missions } soviets = w.Players.Single(p => p.InternalName == "Soviets"); neutral = w.Players.Single(p => p.InternalName == "Neutral"); + objectives[InfiltrateID].Text = Infiltrate.F(allies1 != allies2 ? "spies" : "spy"); destroyBaseTicks = difficulty == "Hard" ? 1500 * 20 : difficulty == "Normal" ? 1500 * 25 : 1500 * 30; @@ -435,9 +447,17 @@ namespace OpenRA.Mods.RA.Missions new Patrol(world, new[] { "e1", "dog.patrol", "dog.patrol" }, soviets, patrolPoints4, 0), new Patrol(world, new[] { "e1", "dog.patrol", "dog.patrol" }, soviets, patrolPoints5, 0), }; - objectives[InfiltrateID].Text = Infiltrate.F(allies1 != allies2 ? "spies" : "spy"); + + bridgeTank = actors["BridgeTank"]; + bridgeAttackPoint = actors["BridgeAttackPoint"]; + bridge = world.Actors + .Where(a => a.HasTrait() && !a.IsDead()) + .OrderBy(a => (a.Location - bridgeAttackPoint.Location).LengthSquared) + .FirstOrDefault(); + OnObjectivesUpdated(false); SetupSubStances(); + var res = allies1.PlayerActor.Trait(); res.TakeOre(res.Ore); res.TakeCash(res.Cash); @@ -447,6 +467,7 @@ namespace OpenRA.Mods.RA.Missions res.TakeOre(res.Ore); res.TakeCash(res.Cash); } + Game.MoveViewport(lstEntryPoint.Location.ToFloat2()); MissionUtils.PlayMissionMusic(); } @@ -529,29 +550,31 @@ namespace OpenRA.Mods.RA.Missions class Allies04TrivialBuilding { } - class Allies04TryRepairBuildingInfo : ITraitInfo + class Allies04MaintainBuildingInfo : ITraitInfo { public readonly string Player = null; - public object Create(ActorInitializer init) { return new Allies04TryRepairBuilding(this); } + public object Create(ActorInitializer init) { return new Allies04MaintainBuilding(this); } } - class Allies04TryRepairBuilding : INotifyDamageStateChanged + class Allies04MaintainBuilding : INotifyDamageStateChanged { - Allies04TryRepairBuildingInfo info; + Allies04MaintainBuildingInfo info; - public Allies04TryRepairBuilding(Allies04TryRepairBuildingInfo info) + public Allies04MaintainBuilding(Allies04MaintainBuildingInfo info) { this.info = info; } public void DamageStateChanged(Actor self, AttackInfo e) { - if (self.HasTrait() && self.Owner.InternalName == info.Player && Game.IsHost - && e.DamageState > DamageState.Undamaged && e.PreviousDamageState == DamageState.Undamaged) - { - self.World.IssueOrder(new Order("RepairBuilding", self.Owner.PlayerActor, false) { TargetActor = self }); - } + if (self.Owner.InternalName != info.Player) return; + + if (self.HasTrait() && e.DamageState == DamageState.Critical && e.PreviousDamageState < DamageState.Critical) + self.Trait().Sell(self); + + else if (self.HasTrait() && e.DamageState > DamageState.Undamaged && e.PreviousDamageState == DamageState.Undamaged) + self.Trait().RepairBuilding(self, self.Owner); } } } diff --git a/OpenRA.Mods.RA/Missions/MissionUtils.cs b/OpenRA.Mods.RA/Missions/MissionUtils.cs index 839cfe50ac..5a76a1c0bc 100644 --- a/OpenRA.Mods.RA/Missions/MissionUtils.cs +++ b/OpenRA.Mods.RA/Missions/MissionUtils.cs @@ -15,8 +15,8 @@ using OpenRA.FileFormats; using OpenRA.Mods.RA.Activities; using OpenRA.Mods.RA.Air; using OpenRA.Mods.RA.Buildings; -using OpenRA.Traits; using OpenRA.Network; +using OpenRA.Traits; namespace OpenRA.Mods.RA.Missions { diff --git a/OpenRA.Mods.RA/Sellable.cs b/OpenRA.Mods.RA/Sellable.cs index 8fdfc533d8..28fe77f27e 100644 --- a/OpenRA.Mods.RA/Sellable.cs +++ b/OpenRA.Mods.RA/Sellable.cs @@ -25,20 +25,23 @@ namespace OpenRA.Mods.RA public void ResolveOrder(Actor self, Order order) { if (order.OrderString == "Sell") - { - if (!self.Trait().Lock()) - return; + Sell(self); + } - foreach( var ns in self.TraitsImplementing() ) - ns.Selling( self ); + public void Sell(Actor self) + { + if (!self.Trait().Lock()) + return; - self.CancelActivity(); + foreach (var ns in self.TraitsImplementing()) + ns.Selling(self); - var rb = self.TraitOrDefault(); - if (rb != null && self.Info.Traits.Get().HasMakeAnimation) - self.QueueActivity(new MakeAnimation(self, true, () => rb.PlayCustomAnim(self, "make"))); - self.QueueActivity(new Sell()); - } + self.CancelActivity(); + + var rb = self.TraitOrDefault(); + if (rb != null && self.Info.Traits.Get().HasMakeAnimation) + self.QueueActivity(new MakeAnimation(self, true, () => rb.PlayCustomAnim(self, "make"))); + self.QueueActivity(new Sell()); } } } diff --git a/mods/ra/maps/allies-04/map.yaml b/mods/ra/maps/allies-04/map.yaml index 0cf1e0aa95..50f0e5c405 100644 --- a/mods/ra/maps/allies-04/map.yaml +++ b/mods/ra/maps/allies-04/map.yaml @@ -180,7 +180,7 @@ Actors: Location: 93,70 Owner: Soviets Lab: miss - Location: 34,28 + Location: 34,30 Owner: Soviets Actor45: brik Location: 39,34 @@ -203,11 +203,11 @@ Actors: Actor36: brik Location: 39,29 Owner: Soviets - Actor46: brik - Location: 32,26 + Actor494: e4 + Location: 98,38 Owner: Soviets - Actor55: brik - Location: 32,27 + Actor495: e4 + Location: 48,34 Owner: Soviets Actor58: brik Location: 32,28 @@ -215,8 +215,8 @@ Actors: Actor35: brik Location: 39,28 Owner: Soviets - Actor32: brik - Location: 38,27 + Actor110: e1 + Location: 33,28 Owner: Soviets Actor60: apwr Location: 44,46 @@ -236,11 +236,11 @@ Actors: Actor100: brik Location: 32,33 Owner: Soviets - Actor23: brik - Location: 36,26 + Actor263: 3tnk + Location: 37,35 Owner: Soviets - Actor24: brik - Location: 37,26 + Actor138: e2 + Location: 39,37 Owner: Soviets Actor99: brik Location: 32,32 @@ -254,8 +254,8 @@ Actors: Actor14: brik Location: 32,35 Owner: Soviets - Actor29: brik - Location: 37,27 + Actor55: brik + Location: 32,26 Owner: Soviets Actor40: apwr Location: 44,43 @@ -272,8 +272,8 @@ Actors: Actor102: ftur Location: 46,39 Owner: Soviets - Actor110: brik - Location: 39,36 + Actor4: brik + Location: 38,34 Owner: Soviets Actor121: e1 Location: 100,21 @@ -288,8 +288,8 @@ Actors: Actor62: apwr Location: 46,52 Owner: Soviets - Actor4: brik - Location: 39,38 + Actor29: brik + Location: 35,26 Owner: Soviets Actor87: tsla Location: 31,61 @@ -359,20 +359,20 @@ Actors: Actor74: ftur Location: 31,36 Owner: Soviets - Actor17: brik - Location: 38,38 + Actor32: brik + Location: 34,26 Owner: Soviets Actor104: tsla Location: 28,80 Owner: Soviets - Actor7: brik - Location: 33,26 + Actor493: e4 + Location: 102,24 Owner: Soviets - Actor12: brik - Location: 35,26 + Actor274: e3 + Location: 34,41 Owner: Soviets - Actor11: brik - Location: 34,26 + Actor452: e4 + Location: 34,32 Owner: Soviets Actor112: fenc Location: 96,39 @@ -395,11 +395,11 @@ Actors: Actor108: stek Location: 38,55 Owner: Soviets - Actor109: brik - Location: 39,37 + Actor7: brik + Location: 38,35 Owner: Soviets - Actor19: brik - Location: 38,37 + Actor46: brik + Location: 33,26 Owner: Soviets Actor6: brik Location: 39,35 @@ -476,8 +476,8 @@ Actors: HijackFactory: weap Location: 98,32 Owner: Soviets - Actor138: sam - Location: 33,27 + Actor12: sam + Location: 34,27 Owner: Soviets Actor143: e1 Location: 61,98 @@ -724,9 +724,12 @@ Actors: Actor221: 4tnk Location: 39,46 Owner: Soviets - Actor228: e1 + Actor228: brik Location: 102,34 Owner: Soviets + Actor514: brik + Location: 103,34 + Owner: Soviets Actor227: e1 Location: 98,28 Owner: Soviets @@ -760,6 +763,7 @@ Actors: Actor229: v2rl Location: 96,19 Owner: Soviets + Facing: 64 Actor137: e1 Location: 66,34 Owner: Soviets @@ -838,8 +842,8 @@ Actors: Actor262: e1 Location: 37,31 Owner: Soviets - Actor274: truk - Location: 36,31 + Actor17: brik + Location: 37,28 Owner: Soviets Actor264: v2rl Location: 50,36 @@ -869,9 +873,6 @@ Actors: Actor122: fenc Location: 107,39 Owner: Soviets - Actor263: bio - Location: 34,31 - Owner: Soviets Actor152: ftur Location: 107,40 Owner: Soviets @@ -1502,8 +1503,8 @@ Actors: Actor453: brl3 Location: 38,31 Owner: Soviets - Actor452: brl3 - Location: 38,36 + Actor11: truk + Location: 36,32 Owner: Soviets Actor455: silo Location: 82,67 @@ -1656,6 +1657,78 @@ Actors: Actor492: e1 Location: 35,35 Owner: Soviets + BridgeTank: 3tnk + Location: 76,20 + Owner: Soviets + BridgeAttackPoint: waypoint + Location: 74,25 + Owner: Neutral + Actor19: brik + Location: 37,27 + Owner: Soviets + Actor23: brik + Location: 37,26 + Owner: Soviets + Actor24: brik + Location: 36,26 + Owner: Soviets + Actor109: brik + Location: 32,27 + Owner: Soviets + Actor496: e4 + Location: 57,38 + Owner: Soviets + Actor497: e4 + Location: 38,60 + Owner: Soviets + Actor498: apc + Location: 78,99 + Owner: Soviets + Actor499: 3tnk + Location: 106,23 + Owner: Soviets + Actor500: sbag + Location: 44,30 + Owner: Soviets + Actor501: sbag + Location: 44,31 + Owner: Soviets + Actor502: sbag + Location: 44,32 + Owner: Soviets + Actor503: sbag + Location: 44,33 + Owner: Soviets + Actor504: sbag + Location: 43,30 + Owner: Soviets + Actor505: e1 + Location: 43,32 + Owner: Soviets + Actor506: e3 + Location: 43,31 + Owner: Soviets + Actor507: brik + Location: 104,36 + Owner: Soviets + Actor508: brik + Location: 104,35 + Owner: Soviets + Actor509: brik + Location: 104,34 + Owner: Soviets + Actor510: brik + Location: 102,35 + Owner: Soviets + Actor511: brik + Location: 102,36 + Owner: Soviets + Actor512: brik + Location: 103,36 + Owner: Soviets + Actor513: e1 + Location: 110,34 + Owner: Soviets Smudges: @@ -1670,7 +1743,7 @@ Rules: MissionObjectivesPanel: ObjectivesPanel: MISSION_OBJECTIVES ^Building: - Allies04TryRepairBuilding: + Allies04MaintainBuilding: Player: Soviets MISS: AutoTargetIgnore: