Add a lobby option to control spawning creeps (viceroids/worms)

The lobby option is only exposed in d2k currently, not in TD or TS.
This commit is contained in:
Oliver Brakmann
2014-12-28 17:39:26 +01:00
parent c1bf8b29e3
commit de0a62eb42
9 changed files with 314 additions and 2 deletions

View File

@@ -60,6 +60,7 @@ namespace OpenRA
{ {
public bool? Cheats; public bool? Cheats;
public bool? Crates; public bool? Crates;
public bool? Creeps;
public bool? Fog; public bool? Fog;
public bool? Shroud; public bool? Shroud;
public bool? AllyBuildRadius; public bool? AllyBuildRadius;
@@ -76,6 +77,8 @@ namespace OpenRA
settings.AllowCheats = Cheats.Value; settings.AllowCheats = Cheats.Value;
if (Crates.HasValue) if (Crates.HasValue)
settings.Crates = Crates.Value; settings.Crates = Crates.Value;
if (Creeps.HasValue)
settings.Creeps = Creeps.Value;
if (Fog.HasValue) if (Fog.HasValue)
settings.Fog = Fog.Value; settings.Fog = Fog.Value;
if (Shroud.HasValue) if (Shroud.HasValue)

View File

@@ -180,6 +180,7 @@ namespace OpenRA.Network
public bool Dedicated; public bool Dedicated;
public string Difficulty; public string Difficulty;
public bool Crates = true; public bool Crates = true;
public bool Creeps = true;
public bool Shroud = true; public bool Shroud = true;
public bool Fog = true; public bool Fog = true;
public bool AllyBuildRadius = true; public bool AllyBuildRadius = true;

View File

@@ -32,6 +32,7 @@ namespace OpenRA.Mods.Cnc.Traits
public void Killed(Actor self, AttackInfo e) public void Killed(Actor self, AttackInfo e)
{ {
if (!self.World.LobbyInfo.GlobalSettings.Creeps) return;
if (e.Warhead == null || e.Warhead.DeathType != spawnViceroidInfo.DeathType) return; if (e.Warhead == null || e.Warhead.DeathType != spawnViceroidInfo.DeathType) return;
if (self.World.SharedRandom.Next(100) > spawnViceroidInfo.Probability) return; if (self.World.SharedRandom.Next(100) > spawnViceroidInfo.Probability) return;

View File

@@ -523,6 +523,29 @@ namespace OpenRA.Mods.Common.Server
return true; return true;
} }
}, },
{ "creeps",
s =>
{
if (!client.IsAdmin)
{
server.SendOrderTo(conn, "Message", "Only the host can set that option.");
return true;
}
if (server.Map.Options.Creeps.HasValue)
{
server.SendOrderTo(conn, "Message", "Map has disabled Creeps spawning configuration.");
return true;
}
bool.TryParse(s, out server.LobbyInfo.GlobalSettings.Creeps);
server.SyncLobbyGlobalSettings();
server.SendMessage("{0} {1} Creeps spawning."
.F(client.Name, server.LobbyInfo.GlobalSettings.Creeps ? "enabled" : "disabled"));
return true;
}
},
{ "allybuildradius", { "allybuildradius",
s => s =>
{ {

View File

@@ -40,6 +40,9 @@ namespace OpenRA.Mods.Common.Server
if (server.LobbyInfo.GlobalSettings.Crates != defaults.Crates) if (server.LobbyInfo.GlobalSettings.Crates != defaults.Crates)
server.SendOrderTo(conn, "Message", "Crates Appear: {0}".F(server.LobbyInfo.GlobalSettings.Crates)); server.SendOrderTo(conn, "Message", "Crates Appear: {0}".F(server.LobbyInfo.GlobalSettings.Crates));
if (server.LobbyInfo.GlobalSettings.Creeps != defaults.Creeps)
server.SendOrderTo(conn, "Message", "Creeps Spawn: {0}".F(server.LobbyInfo.GlobalSettings.Creeps));
if (server.LobbyInfo.GlobalSettings.AllyBuildRadius != defaults.AllyBuildRadius) if (server.LobbyInfo.GlobalSettings.AllyBuildRadius != defaults.AllyBuildRadius)
server.SendOrderTo(conn, "Message", "Build off Ally ConYards: {0}".F(server.LobbyInfo.GlobalSettings.AllyBuildRadius)); server.SendOrderTo(conn, "Message", "Build off Ally ConYards: {0}".F(server.LobbyInfo.GlobalSettings.AllyBuildRadius));

View File

@@ -56,7 +56,8 @@ namespace OpenRA.Mods.D2k.Traits
public void Tick(Actor self) public void Tick(Actor self)
{ {
// TODO: Add a lobby option to disable worms just like crates if (!self.World.LobbyInfo.GlobalSettings.Creeps)
return;
// TODO: It would be even better to stop // TODO: It would be even better to stop
if (!spawnPoints.Value.Any()) if (!spawnPoints.Value.Any())

View File

@@ -335,6 +335,15 @@ namespace OpenRA.Mods.RA.Widgets.Logic
"crates {0}".F(!orderManager.LobbyInfo.GlobalSettings.Crates))); "crates {0}".F(!orderManager.LobbyInfo.GlobalSettings.Crates)));
} }
var creeps = optionsBin.GetOrNull<CheckboxWidget>("CREEPS_CHECKBOX");
if (creeps != null)
{
creeps.IsChecked = () => orderManager.LobbyInfo.GlobalSettings.Creeps;
creeps.IsDisabled = () => Map.Status != MapStatus.Available || Map.Map.Options.Creeps.HasValue || configurationDisabled();
creeps.OnClick = () => orderManager.IssueOrder(Order.Command(
"creeps {0}".F(!orderManager.LobbyInfo.GlobalSettings.Creeps)));
}
var allybuildradius = optionsBin.GetOrNull<CheckboxWidget>("ALLYBUILDRADIUS_CHECKBOX"); var allybuildradius = optionsBin.GetOrNull<CheckboxWidget>("ALLYBUILDRADIUS_CHECKBOX");
if (allybuildradius != null) if (allybuildradius != null)
{ {

View File

@@ -0,0 +1,271 @@
Background@KICK_CLIENT_DIALOG:
X: 20
Y: 67
Width: 535
Height: 235
Logic: KickClientLogic
Background: dialog3
Children:
Label@TITLE:
X: 0
Y: 40
Width: PARENT_RIGHT
Height: 25
Font: Bold
Align: Center
Label@TEXTA:
X: 0
Y: 67
Width: PARENT_RIGHT
Height: 25
Font: Regular
Align: Center
Text: You may also apply a temporary ban, preventing
Label@TEXTB:
X: 0
Y: 85
Width: PARENT_RIGHT
Height: 25
Font: Regular
Align: Center
Text: them from joining for the remainder of this game.
Checkbox@PREVENT_REJOINING_CHECKBOX:
X: (PARENT_RIGHT - WIDTH)/2
Y: 120
Width: 150
Height: 20
Text: Temporarily Ban
Button@OK_BUTTON:
X: (PARENT_RIGHT - WIDTH)/2 + 75
Y: 155
Width: 120
Height: 25
Text: Kick
Font: Bold
Button@CANCEL_BUTTON:
X: (PARENT_RIGHT - WIDTH)/2 - 75
Y: 155
Width: 120
Height: 25
Text: Cancel
Font: Bold
Background@KICK_SPECTATORS_DIALOG:
X: 20
Y: 67
Width: 535
Height: 235
Logic: KickSpectatorsLogic
Background: dialog3
Children:
Label@TITLE:
X: 0
Y: 40
Width: PARENT_RIGHT
Height: 25
Font: Bold
Align: Center
Text: Kick Spectators
Label@TEXT:
X: 0
Y: 85
Width: PARENT_RIGHT
Height: 25
Font: Regular
Align: Center
Button@OK_BUTTON:
X: (PARENT_RIGHT - WIDTH)/2 + 75
Y: 155
Width: 120
Height: 25
Text: Ok
Font: Bold
Button@CANCEL_BUTTON:
X: (PARENT_RIGHT - WIDTH)/2 - 75
Y: 155
Width: 120
Height: 25
Text: Cancel
Font: Bold
Background@LOBBY_OPTIONS_BIN:
X: 20
Y: 67
Width: 593
Height: 235
Background: dialog3
Children:
Label@TITLE:
X: 0
Y: 5
Width: PARENT_RIGHT
Height: 25
Font: Bold
Align: Center
Text: Map Options
Container:
X: 30
Y: 50
Width: PARENT_RIGHT-60
Height: PARENT_BOTTOM-75
Children:
Checkbox@SHROUD_CHECKBOX:
Width: 140
Height: 20
Text: Shroud
Checkbox@FOG_CHECKBOX:
Y: 35
Width: 140
Height: 20
Text: Fog of War
Checkbox@SHORTGAME_CHECKBOX:
X: 150
Width: 140
Height: 20
Text: Short Game
Checkbox@CRATES_CHECKBOX:
X: 150
Y: 35
Width: 140
Height: 20
Text: Crates
Checkbox@ALLYBUILDRADIUS_CHECKBOX:
X: 290
Width: 140
Height: 20
Text: Build off Allies' ConYards
Checkbox@FRAGILEALLIANCES_CHECKBOX:
X: 290
Y: 35
Width: 140
Height: 20
Text: Diplomacy Changes
Checkbox@CREEPS_CHECKBOX:
Y: 70
Width: 140
Height: 20
Text: Worms
Checkbox@ALLOWCHEATS_CHECKBOX:
X: 150
Y: 70
Width: 140
Height: 20
Text: Debug Menu
Label@STARTINGCASH_DESC:
Y: 110
Width: 80
Height: 25
Text: Starting Cash:
Align: Right
DropDownButton@STARTINGCASH_DROPDOWNBUTTON:
X: 85
Y: 110
Width: 130
Height: 25
Font: Regular
Text: $5000
Label@STARTINGUNITS_DESC:
X: PARENT_RIGHT - WIDTH - 145
Y: 110
Width: 120
Height: 25
Text: Starting Units:
Align: Right
DropDownButton@STARTINGUNITS_DROPDOWNBUTTON:
X: PARENT_RIGHT - WIDTH
Y: 110
Width: 140
Height: 25
Font: Regular
Label@DIFFICULTY_DESC:
X: PARENT_RIGHT - WIDTH - 145
Y: 150
Width: 120
Height: 25
Text: Mission Difficulty:
Align: Right
DropDownButton@DIFFICULTY_DROPDOWNBUTTON:
X: PARENT_RIGHT - WIDTH
Y: 150
Width: 140
Height: 25
Font: Regular
DropDownButton@TECHLEVEL_DROPDOWNBUTTON:
X: 85
Y: 150
Width: 130
Height: 25
Font: Regular
Text: 10
Label@TECHLEVEL_DESC:
Y: 150
Width: 80
Height: 25
Text: Tech Level:
Align: Right
Background@FORCE_START_DIALOG:
X: 20
Y: 67
Width: 593
Height: 235
Background: dialog3
Children:
Label@TITLE:
X: 0
Y: 40
Width: PARENT_RIGHT
Height: 25
Font: Bold
Align: Center
Text: Start Game?
Label@TEXTA:
X: 0
Y: 67
Width: PARENT_RIGHT
Height: 25
Font: Regular
Align: Center
Text: One or more players are not yet ready.
Label@TEXTB:
X: 0
Y: 85
Width: PARENT_RIGHT
Height: 25
Font: Regular
Align: Center
Text: Are you sure that you want to force start the game?
Container@KICK_WARNING:
Width: PARENT_RIGHT
Children:
Label@KICK_WARNING_A:
X: 0
Y: 106
Width: PARENT_RIGHT
Height: 25
Font: Bold
Align: Center
Text: One or more clients are missing the selected
Label@KICK_WARNING_B:
X: 0
Y: 123
Width: PARENT_RIGHT
Height: 25
Font: Bold
Align: Center
Text: map, and will be kicked from the server.
Button@OK_BUTTON:
X: (PARENT_RIGHT - WIDTH)/2 + 75
Y: 155
Width: 120
Height: 25
Text: Start
Font: Bold
Button@CANCEL_BUTTON:
X: (PARENT_RIGHT - WIDTH)/2 - 75
Y: 155
Width: 120
Height: 25
Text: Cancel
Font: Bold

View File

@@ -80,7 +80,7 @@ ChromeLayout:
./mods/ra/chrome/lobby.yaml ./mods/ra/chrome/lobby.yaml
./mods/ra/chrome/lobby-mappreview.yaml ./mods/ra/chrome/lobby-mappreview.yaml
./mods/d2k/chrome/lobby-playerbin.yaml ./mods/d2k/chrome/lobby-playerbin.yaml
./mods/ra/chrome/lobby-dialogs.yaml ./mods/d2k/chrome/lobby-dialogs.yaml
./mods/d2k/chrome/color-picker.yaml ./mods/d2k/chrome/color-picker.yaml
./mods/ra/chrome/map-chooser.yaml ./mods/ra/chrome/map-chooser.yaml
./mods/ra/chrome/create-server.yaml ./mods/ra/chrome/create-server.yaml