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

View File

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