Unbitrot GDI01. The broken rules overrides have been left as a testcase for #768

This commit is contained in:
Paul Chote
2011-06-19 18:14:07 +12:00
parent c014731a2f
commit 347a80f0a7
4 changed files with 48 additions and 40 deletions

View File

@@ -8,6 +8,7 @@
*/ */
#endregion #endregion
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using OpenRA.FileFormats; using OpenRA.FileFormats;
@@ -15,10 +16,11 @@ using OpenRA.Mods.RA;
using OpenRA.Mods.RA.Activities; using OpenRA.Mods.RA.Activities;
using OpenRA.Mods.RA.Move; using OpenRA.Mods.RA.Move;
using OpenRA.Traits; using OpenRA.Traits;
using OpenRA.Widgets;
namespace OpenRA.Mods.Cnc namespace OpenRA.Mods.Cnc
{ {
class Gdi01ScriptInfo : TraitInfo<Gdi01Script>, Requires<OpenWidgetAtGameStartInfo> { } class Gdi01ScriptInfo : TraitInfo<Gdi01Script>, Requires<LoadWidgetAtGameStartInfo> { }
class Gdi01Script: IWorldLoaded, ITick class Gdi01Script: IWorldLoaded, ITick
{ {
@@ -40,24 +42,20 @@ namespace OpenRA.Mods.Cnc
})); }));
} }
// THIS IS SHIT
public void OnVictory(World w) public void OnVictory(World w)
{ {
started = false; started = false;
Sound.PlayToPlayer(Players["GoodGuy"], "accom1.aud"); Sound.PlayToPlayer(Players["GoodGuy"], "accom1.aud");
Players["GoodGuy"].WinState = WinState.Won; Players["GoodGuy"].WinState = WinState.Won;
w.WorldActor.CancelActivity(); Action afterFMV = () =>
w.WorldActor.QueueActivity(new Wait(125));
w.WorldActor.QueueActivity(new CallFunc(
() => Scripting.Media.PlayFMVFullscreen(w, "consyard.vqa", () =>
{ {
Sound.StopMusic(); Sound.StopMusic();
//Game.Disconnect(); Game.Disconnect();
//Widget.CloseWindow(); Widget.ResetAll();
//Widget.LoadWidget("MENU_BACKGROUND"); Game.LoadShellMap();
}))); };
Game.RunAfterDelay(5000, () => Scripting.Media.PlayFMVFullscreen(w, "consyard.vqa", afterFMV));
} }
public void OnLose(World w) public void OnLose(World w)
@@ -66,16 +64,14 @@ namespace OpenRA.Mods.Cnc
Sound.PlayToPlayer(Players["GoodGuy"], "fail1.aud"); Sound.PlayToPlayer(Players["GoodGuy"], "fail1.aud");
Players["GoodGuy"].WinState = WinState.Lost; Players["GoodGuy"].WinState = WinState.Lost;
w.WorldActor.CancelActivity(); Action afterFMV = () =>
w.WorldActor.QueueActivity(new Wait(125));
w.WorldActor.QueueActivity(new CallFunc(
() => Scripting.Media.PlayFMVFullscreen(w, "gameover.vqa", () =>
{ {
Sound.StopMusic(); Sound.StopMusic();
//Game.Disconnect(); Game.Disconnect();
//Widget.CloseWindow(); Widget.ResetAll();
//Widget.LoadWidget("MENU_BACKGROUND"); Game.LoadShellMap();
}))); };
Game.RunAfterDelay(5000, () => Scripting.Media.PlayFMVFullscreen(w, "gameover.vqa", afterFMV));
} }
int ticks = 0; int ticks = 0;
@@ -111,7 +107,8 @@ namespace OpenRA.Mods.Cnc
} }
// GoodGuy win conditions // GoodGuy win conditions
// BadGuy is dead // BadGuy is dead
var badcount = self.World.Actors.Count(a => a.Owner == Players["BadGuy"] && !a.IsDead()); var badcount = self.World.Actors.Count(a => a != a.Owner.PlayerActor &&
a.Owner == Players["BadGuy"] && !a.IsDead());
if (badcount != lastBadCount) if (badcount != lastBadCount)
{ {
Game.Debug("{0} badguys remain".F(badcount)); Game.Debug("{0} badguys remain".F(badcount));
@@ -121,9 +118,10 @@ namespace OpenRA.Mods.Cnc
OnVictory(self.World); OnVictory(self.World);
} }
//GoodGuy lose conditions //GoodGuy lose conditions: MCV/cyard must survive
var goodCount = self.World.Actors.Count(a => a.Owner == Players["GoodGuy"] && !a.IsDead()); var hasAnything = self.World.ActorsWithTrait<MustBeDestroyed>()
if (goodCount == 0) .Any( a => a.Actor.Owner == Players["GoodGuy"] );
if (!hasAnything)
OnLose(self.World); OnLose(self.World);
// GoodGuy reinforcements // GoodGuy reinforcements

View File

@@ -84,6 +84,6 @@ namespace OpenRA.Mods.RA
/* tag trait for things that must be destroyed for a short game to end */ /* tag trait for things that must be destroyed for a short game to end */
class MustBeDestroyedInfo : TraitInfo<MustBeDestroyed> { } public class MustBeDestroyedInfo : TraitInfo<MustBeDestroyed> { }
class MustBeDestroyed { } public class MustBeDestroyed { }
} }

View File

@@ -142,3 +142,15 @@ Container@INGAME_ROOT:
Image:repair Image:repair
Description:Repair Description:Repair
LongDesc:Repair damaged buildings LongDesc:Repair damaged buildings
Background@FMVPLAYER:
Id:FMVPLAYER
Width:WINDOW_RIGHT
Height:WINDOW_BOTTOM
Background:dialog4
Children:
VqaPlayer:
Id:PLAYER
X:0
Y:0
Width:WINDOW_RIGHT
Height:WINDOW_BOTTOM

View File

@@ -4,9 +4,9 @@ MapFormat: 5
RequiresMod: cnc RequiresMod: cnc
Title: Gdi 01 Title: Storm the Beachhead
Description: Describe your map here Description: Remake of the first GDI Mission
Author: Westwood Studios Author: Westwood Studios
@@ -321,7 +321,7 @@ Actors:
Health: 0.1875 Health: 0.1875
Facing: 160 Facing: 160
ActorStance: None ActorStance: None
Actor86: mcv mcv: mcv
Location: 56,53 Location: 56,53
Owner: GoodGuy Owner: GoodGuy
Health: 1 Health: 1
@@ -431,31 +431,31 @@ Actors:
Facing: 96 Facing: 96
ActorStance: Hunt ActorStance: Hunt
SubCell: 4 SubCell: 4
spawn27: mpspawn spawn27: waypoint
Location: 51,47 Location: 51,47
Owner: Neutral Owner: Neutral
nod0: mpspawn nod0: waypoint
Location: 36,39 Location: 36,39
Owner: Neutral Owner: Neutral
nod1: mpspawn nod1: waypoint
Location: 37,46 Location: 37,46
Owner: Neutral Owner: Neutral
nod2: mpspawn nod2: waypoint
Location: 38,55 Location: 38,55
Owner: Neutral Owner: Neutral
nod3: mpspawn nod3: waypoint
Location: 52,52 Location: 52,52
Owner: Neutral Owner: Neutral
gunboatRight: mpspawn gunboatRight: waypoint
Location: 61,59 Location: 61,59
Owner: Neutral Owner: Neutral
gunboatLeft: mpspawn gunboatLeft: waypoint
Location: 35,59 Location: 35,59
Owner: Neutral Owner: Neutral
lstStart: mpspawn lstStart: waypoint
Location: 54,61 Location: 54,61
Owner: Neutral Owner: Neutral
lstEnd: mpspawn lstEnd: waypoint
Location: 54,56 Location: 54,56
Owner: Neutral Owner: Neutral
@@ -469,8 +469,6 @@ Rules:
Gdi01Script: Gdi01Script:
Player: Player:
-ConquestVictoryConditions: -ConquestVictoryConditions:
PROC.proxy:
-Buildable:
SILO: SILO:
-Buildable: -Buildable:
WEAP: WEAP: