From a8a3036bc4915a1f4bba37de7f0dbafbb55a3d85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Sun, 20 Apr 2014 15:25:43 +0200 Subject: [PATCH] moved StartGameNotification into its own trait --- OpenRA.Game/Game.cs | 3 --- OpenRA.Mods.RA/OpenRA.Mods.RA.csproj | 1 + OpenRA.Mods.RA/StartGameNotification.cs | 36 +++++++++++++++++++++++++ mods/ra/maps/desert-shellmap/map.yaml | 1 + mods/ra/rules/world.yaml | 1 + mods/ts/maps/blank-shellmap/map.yaml | 1 + mods/ts/rules/world.yaml | 1 + 7 files changed, 41 insertions(+), 3 deletions(-) create mode 100644 OpenRA.Mods.RA/StartGameNotification.cs diff --git a/OpenRA.Game/Game.cs b/OpenRA.Game/Game.cs index 17d589b786..bcf50f1fd1 100644 --- a/OpenRA.Game/Game.cs +++ b/OpenRA.Game/Game.cs @@ -262,9 +262,6 @@ namespace OpenRA orderManager.LastTickTime = Environment.TickCount; orderManager.StartGame(); worldRenderer.RefreshPalette(); - - if (!isShellmap) - Sound.PlayNotification(null, "Speech", "StartGame", null); } public static bool IsHost diff --git a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj index 4c538e05da..ab8bb3ebb8 100644 --- a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj +++ b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj @@ -496,6 +496,7 @@ + diff --git a/OpenRA.Mods.RA/StartGameNotification.cs b/OpenRA.Mods.RA/StartGameNotification.cs new file mode 100644 index 0000000000..495a098b93 --- /dev/null +++ b/OpenRA.Mods.RA/StartGameNotification.cs @@ -0,0 +1,36 @@ +#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.Graphics; +using OpenRA.Traits; + +namespace OpenRA.Mods.RA +{ + class StartGameNotificationInfo : ITraitInfo + { + public readonly string Notification = "StartGame"; + + public object Create(ActorInitializer init) { return new StartGameNotification(this); } + } + + class StartGameNotification : IWorldLoaded + { + StartGameNotificationInfo info; + public StartGameNotification(StartGameNotificationInfo info) + { + this.info = info; + } + + public void WorldLoaded(World w, WorldRenderer wr) + { + Sound.PlayNotification(null, "Speech", info.Notification, null); + } + } +} diff --git a/mods/ra/maps/desert-shellmap/map.yaml b/mods/ra/maps/desert-shellmap/map.yaml index df096a95d7..6046df662e 100644 --- a/mods/ra/maps/desert-shellmap/map.yaml +++ b/mods/ra/maps/desert-shellmap/map.yaml @@ -1307,6 +1307,7 @@ Rules: LuaScripts: desert-shellmap.lua LoadWidgetAtGameStart: Widget: MAINMENU + -StartGameNotification: TRAN.Husk2: Burns: Damage: 0 diff --git a/mods/ra/rules/world.yaml b/mods/ra/rules/world.yaml index 7c2889fadd..a59bc00154 100644 --- a/mods/ra/rules/world.yaml +++ b/mods/ra/rules/world.yaml @@ -165,4 +165,5 @@ World: ValidateOrder: DebugPauseState: RadarPings: + StartGameNotification: diff --git a/mods/ts/maps/blank-shellmap/map.yaml b/mods/ts/maps/blank-shellmap/map.yaml index dfa05fb7d2..979bde074b 100644 --- a/mods/ts/maps/blank-shellmap/map.yaml +++ b/mods/ts/maps/blank-shellmap/map.yaml @@ -37,6 +37,7 @@ Smudges: Rules: World: + -StartGameNotification: -SpawnMPUnits: -MPStartLocations: LoadWidgetAtGameStart: diff --git a/mods/ts/rules/world.yaml b/mods/ts/rules/world.yaml index e28bcc198a..79c2cfd1e7 100644 --- a/mods/ts/rules/world.yaml +++ b/mods/ts/rules/world.yaml @@ -97,4 +97,5 @@ World: DebugPauseState: ScreenShaker: RadarPings: + StartGameNotification: