Add starting cash option.
This commit is contained in:
@@ -29,6 +29,7 @@ namespace OpenRA
|
|||||||
public bool? Shroud;
|
public bool? Shroud;
|
||||||
public bool? AllyBuildRadius;
|
public bool? AllyBuildRadius;
|
||||||
public bool? FragileAlliances;
|
public bool? FragileAlliances;
|
||||||
|
public int? StartingCash;
|
||||||
public bool ConfigurableStartingUnits = true;
|
public bool ConfigurableStartingUnits = true;
|
||||||
public string[] Difficulties = { };
|
public string[] Difficulties = { };
|
||||||
|
|
||||||
@@ -44,6 +45,8 @@ namespace OpenRA
|
|||||||
settings.Shroud = Shroud.Value;
|
settings.Shroud = Shroud.Value;
|
||||||
if (AllyBuildRadius.HasValue)
|
if (AllyBuildRadius.HasValue)
|
||||||
settings.AllyBuildRadius = AllyBuildRadius.Value;
|
settings.AllyBuildRadius = AllyBuildRadius.Value;
|
||||||
|
if (StartingCash.HasValue)
|
||||||
|
settings.StartingCash = StartingCash.Value;
|
||||||
if (FragileAlliances.HasValue)
|
if (FragileAlliances.HasValue)
|
||||||
settings.FragileAlliances = FragileAlliances.Value;
|
settings.FragileAlliances = FragileAlliances.Value;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -95,6 +95,7 @@ namespace OpenRA.Network
|
|||||||
public bool Shroud = true;
|
public bool Shroud = true;
|
||||||
public bool Fog = true;
|
public bool Fog = true;
|
||||||
public bool AllyBuildRadius = true;
|
public bool AllyBuildRadius = true;
|
||||||
|
public int StartingCash = 5000;
|
||||||
public string StartingUnitsClass = "none";
|
public string StartingUnitsClass = "none";
|
||||||
public bool AllowVersionMismatch;
|
public bool AllowVersionMismatch;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ namespace OpenRA.Traits
|
|||||||
{
|
{
|
||||||
public class PlayerResourcesInfo : ITraitInfo
|
public class PlayerResourcesInfo : ITraitInfo
|
||||||
{
|
{
|
||||||
public readonly int InitialCash = 10000;
|
public readonly int[] SelectableCash = { 2500, 5000, 10000, 20000 };
|
||||||
public readonly int InitialOre = 0;
|
public readonly int DefaultCash = 5000;
|
||||||
public readonly int AdviceInterval = 250;
|
public readonly int AdviceInterval = 250;
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new PlayerResources(init.self, this); }
|
public object Create(ActorInitializer init) { return new PlayerResources(init.self, this); }
|
||||||
@@ -34,8 +34,7 @@ namespace OpenRA.Traits
|
|||||||
{
|
{
|
||||||
Owner = self.Owner;
|
Owner = self.Owner;
|
||||||
|
|
||||||
Cash = info.InitialCash;
|
Cash = self.World.LobbyInfo.GlobalSettings.StartingCash;
|
||||||
Ore = info.InitialOre;
|
|
||||||
AdviceInterval = info.AdviceInterval;
|
AdviceInterval = info.AdviceInterval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -495,6 +495,25 @@ namespace OpenRA.Mods.RA.Server
|
|||||||
server.SyncLobbyInfo();
|
server.SyncLobbyInfo();
|
||||||
return true;
|
return true;
|
||||||
}},
|
}},
|
||||||
|
{ "startingcash",
|
||||||
|
s =>
|
||||||
|
{
|
||||||
|
if (!client.IsAdmin)
|
||||||
|
{
|
||||||
|
server.SendOrderTo(conn, "Message", "Only the host can set that option");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (server.Map.Options.StartingCash.HasValue)
|
||||||
|
{
|
||||||
|
server.SendOrderTo(conn, "Message", "Map has disabled cash configuration");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
server.lobbyInfo.GlobalSettings.StartingCash = int.Parse(s);
|
||||||
|
server.SyncLobbyInfo();
|
||||||
|
return true;
|
||||||
|
}},
|
||||||
{ "kick",
|
{ "kick",
|
||||||
s =>
|
s =>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -368,6 +368,31 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
|||||||
optionsBin.Get<LabelWidget>("STARTINGUNITS_DESC").IsVisible = startingUnits.IsVisible;
|
optionsBin.Get<LabelWidget>("STARTINGUNITS_DESC").IsVisible = startingUnits.IsVisible;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var startingCash = optionsBin.GetOrNull<DropDownButtonWidget>("STARTINGCASH_DROPDOWNBUTTON");
|
||||||
|
if (startingCash != null)
|
||||||
|
{
|
||||||
|
startingCash.IsDisabled = () => Map.Options.StartingCash.HasValue || configurationDisabled();
|
||||||
|
startingCash.GetText = () => Map.Options.StartingCash.HasValue ? "Not Available" : "${0}".F(orderManager.LobbyInfo.GlobalSettings.StartingCash);
|
||||||
|
startingCash.OnMouseDown = _ =>
|
||||||
|
{
|
||||||
|
var options = Rules.Info["player"].Traits.Get<PlayerResourcesInfo>().SelectableCash.Select(c => new DropDownOption
|
||||||
|
{
|
||||||
|
Title = "${0}".F(c),
|
||||||
|
IsSelected = () => orderManager.LobbyInfo.GlobalSettings.StartingCash == c,
|
||||||
|
OnClick = () => orderManager.IssueOrder(Order.Command("startingcash {0}".F(c)))
|
||||||
|
});
|
||||||
|
|
||||||
|
Func<DropDownOption, ScrollItemWidget, ScrollItemWidget> setupItem = (option, template) =>
|
||||||
|
{
|
||||||
|
var item = ScrollItemWidget.Setup(template, option.IsSelected, option.OnClick);
|
||||||
|
item.Get<LabelWidget>("LABEL").GetText = () => option.Title;
|
||||||
|
return item;
|
||||||
|
};
|
||||||
|
|
||||||
|
startingCash.ShowDropDown("LABEL_DROPDOWN_TEMPLATE", options.Count() * 30, options, setupItem);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
var enableShroud = optionsBin.GetOrNull<CheckboxWidget>("SHROUD_CHECKBOX");
|
var enableShroud = optionsBin.GetOrNull<CheckboxWidget>("SHROUD_CHECKBOX");
|
||||||
if (enableShroud != null)
|
if (enableShroud != null)
|
||||||
{
|
{
|
||||||
@@ -481,6 +506,11 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
|||||||
else
|
else
|
||||||
throw new InvalidOperationException("Server's new map doesn't exist on your system and Downloading turned off");
|
throw new InvalidOperationException("Server's new map doesn't exist on your system and Downloading turned off");
|
||||||
Map = new Map(Game.modData.AvailableMaps[MapUid].Path);
|
Map = new Map(Game.modData.AvailableMaps[MapUid].Path);
|
||||||
|
|
||||||
|
// Restore default starting cash if the last map set it to something invalid
|
||||||
|
var pri = Rules.Info["player"].Traits.Get<PlayerResourcesInfo>();
|
||||||
|
if (!Map.Options.StartingCash.HasValue && !pri.SelectableCash.Contains(orderManager.LobbyInfo.GlobalSettings.StartingCash))
|
||||||
|
orderManager.IssueOrder(Order.Command("startingcash {0}".F(pri.DefaultCash)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdatePlayerList()
|
void UpdatePlayerList()
|
||||||
|
|||||||
@@ -249,6 +249,20 @@ Background@LOBBY_OPTIONS_BIN:
|
|||||||
Width:230
|
Width:230
|
||||||
Height:20
|
Height:20
|
||||||
Text:Build off Ally ConYards
|
Text:Build off Ally ConYards
|
||||||
|
Label@STARTINGCASH_DESC:
|
||||||
|
X:10
|
||||||
|
Y:72
|
||||||
|
Width:80
|
||||||
|
Height:25
|
||||||
|
Text:Starting Cash:
|
||||||
|
Align:Right
|
||||||
|
DropDownButton@STARTINGCASH_DROPDOWNBUTTON:
|
||||||
|
X:95
|
||||||
|
Y:72
|
||||||
|
Width:120
|
||||||
|
Height:25
|
||||||
|
Font:Bold
|
||||||
|
Text:$5000
|
||||||
Label@STARTINGUNITS_DESC:
|
Label@STARTINGUNITS_DESC:
|
||||||
X:PARENT_RIGHT - WIDTH - 145
|
X:PARENT_RIGHT - WIDTH - 145
|
||||||
Y:72
|
Y:72
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ Options:
|
|||||||
Shroud: true
|
Shroud: true
|
||||||
AllyBuildRadius: false
|
AllyBuildRadius: false
|
||||||
FragileAlliances: false
|
FragileAlliances: false
|
||||||
|
StartingCash: 500
|
||||||
ConfigurableStartingUnits: false
|
ConfigurableStartingUnits: false
|
||||||
|
|
||||||
Players:
|
Players:
|
||||||
@@ -47,7 +48,6 @@ Players:
|
|||||||
LockSpawn: True
|
LockSpawn: True
|
||||||
Spawn: 0
|
Spawn: 0
|
||||||
AllowBots: False
|
AllowBots: False
|
||||||
InitialCash: 20
|
|
||||||
Allies: GoodGuy
|
Allies: GoodGuy
|
||||||
Enemies: BadGuy,Creeps
|
Enemies: BadGuy,Creeps
|
||||||
Required: True
|
Required: True
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ Options:
|
|||||||
Shroud: true
|
Shroud: true
|
||||||
AllyBuildRadius: false
|
AllyBuildRadius: false
|
||||||
FragileAlliances: false
|
FragileAlliances: false
|
||||||
|
StartingCash: 0
|
||||||
ConfigurableStartingUnits: false
|
ConfigurableStartingUnits: false
|
||||||
|
|
||||||
Players:
|
Players:
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ Options:
|
|||||||
Crates: true
|
Crates: true
|
||||||
AllyBuildRadius: false
|
AllyBuildRadius: false
|
||||||
FragileAlliances: false
|
FragileAlliances: false
|
||||||
|
StartingCash: 5000
|
||||||
ConfigurableStartingUnits: false
|
ConfigurableStartingUnits: false
|
||||||
|
|
||||||
Players:
|
Players:
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ Player:
|
|||||||
PowerManager:
|
PowerManager:
|
||||||
AllyRepair:
|
AllyRepair:
|
||||||
PlayerResources:
|
PlayerResources:
|
||||||
InitialCash: 5000
|
|
||||||
ActorGroupProxy:
|
ActorGroupProxy:
|
||||||
DeveloperMode:
|
DeveloperMode:
|
||||||
HackyAI@Default:
|
HackyAI@Default:
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ Player:
|
|||||||
AdviceInterval: 650
|
AdviceInterval: 650
|
||||||
AllyRepair:
|
AllyRepair:
|
||||||
PlayerResources:
|
PlayerResources:
|
||||||
InitialCash: 5000
|
|
||||||
AdviceInterval: 650
|
AdviceInterval: 650
|
||||||
ActorGroupProxy:
|
ActorGroupProxy:
|
||||||
DeveloperMode:
|
DeveloperMode:
|
||||||
|
|||||||
@@ -102,6 +102,19 @@ Background@LOBBY_OPTIONS_BIN:
|
|||||||
Width:230
|
Width:230
|
||||||
Height:20
|
Height:20
|
||||||
Text:Build off Ally ConYards
|
Text:Build off Ally ConYards
|
||||||
|
Label@STARTINGCASH_DESC:
|
||||||
|
Y:87
|
||||||
|
Width:80
|
||||||
|
Height:25
|
||||||
|
Text:Starting Cash:
|
||||||
|
Align:Right
|
||||||
|
DropDownButton@STARTINGCASH_DROPDOWNBUTTON:
|
||||||
|
X:85
|
||||||
|
Y:87
|
||||||
|
Width:130
|
||||||
|
Height:25
|
||||||
|
Font:Bold
|
||||||
|
Text:$5000
|
||||||
Label@STARTINGUNITS_DESC:
|
Label@STARTINGUNITS_DESC:
|
||||||
X:PARENT_RIGHT - WIDTH - 145
|
X:PARENT_RIGHT - WIDTH - 145
|
||||||
Y:87
|
Y:87
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ Options:
|
|||||||
Shroud: true
|
Shroud: true
|
||||||
AllyBuildRadius: false
|
AllyBuildRadius: false
|
||||||
FragileAlliances: false
|
FragileAlliances: false
|
||||||
|
StartingCash: 50
|
||||||
ConfigurableStartingUnits: false
|
ConfigurableStartingUnits: false
|
||||||
|
|
||||||
Players:
|
Players:
|
||||||
@@ -512,8 +513,6 @@ Rules:
|
|||||||
Unit: e7
|
Unit: e7
|
||||||
SelectionShares: 10
|
SelectionShares: 10
|
||||||
Player:
|
Player:
|
||||||
PlayerResources:
|
|
||||||
InitialCash: 50
|
|
||||||
ClassicProductionQueue@Infantry:
|
ClassicProductionQueue@Infantry:
|
||||||
Type: Infantry
|
Type: Infantry
|
||||||
BuildSpeed: 1
|
BuildSpeed: 1
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ Options:
|
|||||||
Shroud: true
|
Shroud: true
|
||||||
AllyBuildRadius: false
|
AllyBuildRadius: false
|
||||||
FragileAlliances: false
|
FragileAlliances: false
|
||||||
|
StartingCash: 5000
|
||||||
ConfigurableStartingUnits: false
|
ConfigurableStartingUnits: false
|
||||||
Difficulties: Easy,Normal,Hard
|
Difficulties: Easy,Normal,Hard
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ Options:
|
|||||||
Shroud: true
|
Shroud: true
|
||||||
AllyBuildRadius: false
|
AllyBuildRadius: false
|
||||||
FragileAlliances: false
|
FragileAlliances: false
|
||||||
|
StartingCash: 5000
|
||||||
ConfigurableStartingUnits: false
|
ConfigurableStartingUnits: false
|
||||||
|
|
||||||
Players:
|
Players:
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ Options:
|
|||||||
Shroud: true
|
Shroud: true
|
||||||
AllyBuildRadius: false
|
AllyBuildRadius: false
|
||||||
FragileAlliances: false
|
FragileAlliances: false
|
||||||
|
StartingCash: 5000
|
||||||
ConfigurableStartingUnits: false
|
ConfigurableStartingUnits: false
|
||||||
Difficulties: Easy, Normal
|
Difficulties: Easy, Normal
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ Options:
|
|||||||
Shroud: true
|
Shroud: true
|
||||||
AllyBuildRadius: false
|
AllyBuildRadius: false
|
||||||
FragileAlliances: false
|
FragileAlliances: false
|
||||||
|
StartingCash: 5000
|
||||||
ConfigurableStartingUnits: false
|
ConfigurableStartingUnits: false
|
||||||
|
|
||||||
Players:
|
Players:
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ Options:
|
|||||||
Shroud: true
|
Shroud: true
|
||||||
AllyBuildRadius: false
|
AllyBuildRadius: false
|
||||||
FragileAlliances: false
|
FragileAlliances: false
|
||||||
|
StartingCash: 5000
|
||||||
ConfigurableStartingUnits: false
|
ConfigurableStartingUnits: false
|
||||||
Difficulties: Easy, Normal, Hard
|
Difficulties: Easy, Normal, Hard
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ Options:
|
|||||||
Shroud: true
|
Shroud: true
|
||||||
AllyBuildRadius: false
|
AllyBuildRadius: false
|
||||||
FragileAlliances: false
|
FragileAlliances: false
|
||||||
|
StartingCash: 5000
|
||||||
ConfigurableStartingUnits: false
|
ConfigurableStartingUnits: false
|
||||||
Difficulties: Easy,Normal,Hard
|
Difficulties: Easy,Normal,Hard
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ Options:
|
|||||||
Shroud: true
|
Shroud: true
|
||||||
AllyBuildRadius: false
|
AllyBuildRadius: false
|
||||||
FragileAlliances: false
|
FragileAlliances: false
|
||||||
|
StartingCash: 60
|
||||||
ConfigurableStartingUnits: false
|
ConfigurableStartingUnits: false
|
||||||
|
|
||||||
Players:
|
Players:
|
||||||
@@ -805,8 +806,6 @@ Rules:
|
|||||||
Player:
|
Player:
|
||||||
ClassicProductionQueue@Building:
|
ClassicProductionQueue@Building:
|
||||||
BuildSpeed: 0.4
|
BuildSpeed: 0.4
|
||||||
PlayerResources:
|
|
||||||
InitialCash: 60
|
|
||||||
|
|
||||||
MNLYR:
|
MNLYR:
|
||||||
Inherits: ^Tank
|
Inherits: ^Tank
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ Options:
|
|||||||
Crates: true
|
Crates: true
|
||||||
AllyBuildRadius: false
|
AllyBuildRadius: false
|
||||||
FragileAlliances: false
|
FragileAlliances: false
|
||||||
|
StartingCash: 5000
|
||||||
ConfigurableStartingUnits: false
|
ConfigurableStartingUnits: false
|
||||||
|
|
||||||
Players:
|
Players:
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ Options:
|
|||||||
Crates: true
|
Crates: true
|
||||||
AllyBuildRadius: false
|
AllyBuildRadius: false
|
||||||
FragileAlliances: false
|
FragileAlliances: false
|
||||||
|
StartingCash: 5000
|
||||||
ConfigurableStartingUnits: false
|
ConfigurableStartingUnits: false
|
||||||
|
|
||||||
Players:
|
Players:
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ Options:
|
|||||||
Crates: true
|
Crates: true
|
||||||
AllyBuildRadius: false
|
AllyBuildRadius: false
|
||||||
FragileAlliances: false
|
FragileAlliances: false
|
||||||
|
StartingCash: 5000
|
||||||
ConfigurableStartingUnits: false
|
ConfigurableStartingUnits: false
|
||||||
|
|
||||||
Players:
|
Players:
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ Options:
|
|||||||
Shroud: true
|
Shroud: true
|
||||||
AllyBuildRadius: false
|
AllyBuildRadius: false
|
||||||
FragileAlliances: false
|
FragileAlliances: false
|
||||||
|
StartingCash: 5000
|
||||||
ConfigurableStartingUnits: false
|
ConfigurableStartingUnits: false
|
||||||
|
|
||||||
Players:
|
Players:
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ Options:
|
|||||||
Shroud: true
|
Shroud: true
|
||||||
AllyBuildRadius: false
|
AllyBuildRadius: false
|
||||||
FragileAlliances: false
|
FragileAlliances: false
|
||||||
|
StartingCash: 0
|
||||||
ConfigurableStartingUnits: false
|
ConfigurableStartingUnits: false
|
||||||
|
|
||||||
Players:
|
Players:
|
||||||
@@ -848,8 +849,6 @@ Smudges:
|
|||||||
Rules:
|
Rules:
|
||||||
Player:
|
Player:
|
||||||
-ConquestVictoryConditions:
|
-ConquestVictoryConditions:
|
||||||
PlayerResources:
|
|
||||||
InitialCash: 0
|
|
||||||
World:
|
World:
|
||||||
-CrateDrop:
|
-CrateDrop:
|
||||||
-SpawnMPUnits:
|
-SpawnMPUnits:
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ Options:
|
|||||||
Shroud: true
|
Shroud: true
|
||||||
AllyBuildRadius: false
|
AllyBuildRadius: false
|
||||||
FragileAlliances: false
|
FragileAlliances: false
|
||||||
|
StartingCash: 100
|
||||||
ConfigurableStartingUnits: false
|
ConfigurableStartingUnits: false
|
||||||
|
|
||||||
Players:
|
Players:
|
||||||
@@ -807,8 +808,6 @@ Rules:
|
|||||||
-SpawnMPUnits:
|
-SpawnMPUnits:
|
||||||
-MPStartLocations:
|
-MPStartLocations:
|
||||||
Player:
|
Player:
|
||||||
PlayerResources:
|
|
||||||
InitialCash: 100
|
|
||||||
ClassicProductionQueue@Infantry:
|
ClassicProductionQueue@Infantry:
|
||||||
Type: Infantry
|
Type: Infantry
|
||||||
BuildSpeed: 1
|
BuildSpeed: 1
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ Player:
|
|||||||
PowerManager:
|
PowerManager:
|
||||||
AllyRepair:
|
AllyRepair:
|
||||||
PlayerResources:
|
PlayerResources:
|
||||||
InitialCash: 5000
|
|
||||||
ActorGroupProxy:
|
ActorGroupProxy:
|
||||||
DeveloperMode:
|
DeveloperMode:
|
||||||
HackyAI@EasyAI:
|
HackyAI@EasyAI:
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ Player:
|
|||||||
PowerManager:
|
PowerManager:
|
||||||
AllyRepair:
|
AllyRepair:
|
||||||
PlayerResources:
|
PlayerResources:
|
||||||
InitialCash: 5000
|
|
||||||
ActorGroupProxy:
|
ActorGroupProxy:
|
||||||
DeveloperMode:
|
DeveloperMode:
|
||||||
PlayerColorPalette:
|
PlayerColorPalette:
|
||||||
|
|||||||
Reference in New Issue
Block a user