Merge pull request #3687 from pchote/mapoptions

Lobby map option improvements.
This commit is contained in:
Matthias Mailänder
2013-08-17 02:42:23 -07:00
35 changed files with 749 additions and 162 deletions

View File

@@ -475,9 +475,6 @@ namespace OpenRA.Editor
Console.WriteLine(s.Key); Console.WriteLine(s.Key);
switch (s.Key) switch (s.Key)
{ {
case "Credits":
pr.InitialCash = int.Parse(s.Value);
break;
case "Allies": case "Allies":
pr.Allies = s.Value.Split(',').Intersect(players).Except(neutral).ToArray(); pr.Allies = s.Value.Split(',').Intersect(players).Except(neutral).ToArray();
pr.Enemies = s.Value.Split(',').SymmetricDifference(players).Except(neutral).ToArray(); pr.Enemies = s.Value.Split(',').SymmetricDifference(players).Except(neutral).ToArray();

View File

@@ -276,6 +276,13 @@ namespace OpenRA.FileFormats
return fieldType.GetConstructor(argTypes).Invoke(argValues); return fieldType.GetConstructor(argTypes).Invoke(argValues);
} }
else if (fieldType.IsGenericType && fieldType.GetGenericTypeDefinition() == typeof(Nullable<>))
{
var innerType = fieldType.GetGenericArguments().First();
var innerValue = GetValue("Nullable<T>", innerType, x);
return fieldType.GetConstructor(new []{ innerType }).Invoke(new []{ innerValue });
}
UnknownFieldAction("[Type] {0}".F(x), fieldType); UnknownFieldAction("[Type] {0}".F(x), fieldType);
return null; return null;
} }

View File

@@ -39,7 +39,6 @@ namespace OpenRA.FileFormats
public bool LockTeam = false; public bool LockTeam = false;
public int Team = 0; public int Team = 0;
public int InitialCash = 0;
public string[] Allies = {}; public string[] Allies = {};
public string[] Enemies = {}; public string[] Enemies = {};

View File

@@ -16,10 +16,42 @@ using System.Linq;
using System.Security.Cryptography; using System.Security.Cryptography;
using System.Text; using System.Text;
using OpenRA.FileFormats; using OpenRA.FileFormats;
using OpenRA.Network;
using OpenRA.Traits; using OpenRA.Traits;
namespace OpenRA namespace OpenRA
{ {
public class MapOptions
{
public bool? Cheats;
public bool? Crates;
public bool? Fog;
public bool? Shroud;
public bool? AllyBuildRadius;
public bool? FragileAlliances;
public int? StartingCash;
public bool ConfigurableStartingUnits = true;
public string[] Difficulties = { };
public void UpdateServerSettings(Session.Global settings)
{
if (Cheats.HasValue)
settings.AllowCheats = Cheats.Value;
if (Crates.HasValue)
settings.Crates = Crates.Value;
if (Fog.HasValue)
settings.Fog = Fog.Value;
if (Shroud.HasValue)
settings.Shroud = Shroud.Value;
if (AllyBuildRadius.HasValue)
settings.AllyBuildRadius = AllyBuildRadius.Value;
if (StartingCash.HasValue)
settings.StartingCash = StartingCash.Value;
if (FragileAlliances.HasValue)
settings.FragileAlliances = FragileAlliances.Value;
}
}
public class Map public class Map
{ {
[FieldLoader.Ignore] IFolder container; [FieldLoader.Ignore] IFolder container;
@@ -37,9 +69,20 @@ namespace OpenRA
public string Description; public string Description;
public string Author; public string Author;
public string Tileset; public string Tileset;
public string[] Difficulties;
public bool AllowStartUnitConfig = true; public bool AllowStartUnitConfig = true;
[FieldLoader.LoadUsing("LoadOptions")]
public MapOptions Options;
static object LoadOptions(MiniYaml y)
{
var options = new MapOptions();
if (y.NodesDict.ContainsKey("Options"))
FieldLoader.Load(options, y.NodesDict["Options"]);
return options;
}
[FieldLoader.Ignore] public Lazy<Dictionary<string, ActorReference>> Actors; [FieldLoader.Ignore] public Lazy<Dictionary<string, ActorReference>> Actors;
public int PlayerCount { get { return Players.Count(p => p.Value.Playable); } } public int PlayerCount { get { return Players.Count(p => p.Value.Playable); } }
@@ -177,7 +220,7 @@ namespace OpenRA
"Description", "Description",
"Author", "Author",
"Tileset", "Tileset",
"Difficulties", "Options",
"MapSize", "MapSize",
"Bounds", "Bounds",
"UseAsShellmap", "UseAsShellmap",

View File

@@ -94,6 +94,8 @@ namespace OpenRA.Network
public bool Crates = true; public bool Crates = true;
public bool Shroud = true; public bool Shroud = true;
public bool Fog = true; public bool Fog = true;
public bool AllyBuildRadius = true;
public int StartingCash = 5000;
public string StartingUnitsClass = "none"; public string StartingUnitsClass = "none";
public bool AllowVersionMismatch; public bool AllowVersionMismatch;
} }

View File

@@ -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;
} }

View File

@@ -56,11 +56,17 @@ namespace OpenRA.Mods.RA.Buildings
return devMode.FastBuild || progress == 0; return devMode.FastBuild || progress == 0;
} }
bool ValidRenderPlayer()
{
var allyBuildRadius = self.World.LobbyInfo.GlobalSettings.AllyBuildRadius;
return self.Owner == self.World.RenderPlayer || (allyBuildRadius && self.Owner.IsAlliedWith(self.World.RenderPlayer));
}
// Range circle // Range circle
public void RenderAfterWorld(WorldRenderer wr) public void RenderAfterWorld(WorldRenderer wr)
{ {
// Visible to player and allies // Visible to player and allies
if (!self.Owner.IsAlliedWith(self.World.RenderPlayer)) if (!ValidRenderPlayer())
return; return;
wr.DrawRangeCircleWithContrast( wr.DrawRangeCircleWithContrast(
@@ -73,7 +79,7 @@ namespace OpenRA.Mods.RA.Buildings
public float GetValue() public float GetValue()
{ {
// Visible to player and allies // Visible to player and allies
if (!self.Owner.IsAlliedWith(self.World.RenderPlayer)) if (!ValidRenderPlayer())
return 0f; return 0f;
// Ready or delay disabled // Ready or delay disabled

View File

@@ -43,7 +43,8 @@ namespace OpenRA.Mods.RA.Buildings
var center = topLeft.CenterPosition + FootprintUtils.CenterOffset(this); var center = topLeft.CenterPosition + FootprintUtils.CenterOffset(this);
foreach (var bp in world.ActorsWithTrait<BaseProvider>()) foreach (var bp in world.ActorsWithTrait<BaseProvider>())
{ {
if (bp.Actor.Owner.Stances[p] != Stance.Ally || !bp.Trait.Ready()) var validOwner = bp.Actor.Owner == p || (world.LobbyInfo.GlobalSettings.AllyBuildRadius && bp.Actor.Owner.Stances[p] == Stance.Ally);
if (!validOwner || !bp.Trait.Ready())
continue; continue;
// Range is counted from the center of the actor, not from each cell. // Range is counted from the center of the actor, not from each cell.
@@ -72,13 +73,20 @@ namespace OpenRA.Mods.RA.Buildings
var nearnessCandidates = new List<CPos>(); var nearnessCandidates = new List<CPos>();
var bi = world.WorldActor.Trait<BuildingInfluence>(); var bi = world.WorldActor.Trait<BuildingInfluence>();
var allyBuildRadius = world.LobbyInfo.GlobalSettings.AllyBuildRadius;
for (var y = scanStart.Y; y < scanEnd.Y; y++) for (var y = scanStart.Y; y < scanEnd.Y; y++)
{
for (var x = scanStart.X; x < scanEnd.X; x++) for (var x = scanStart.X; x < scanEnd.X; x++)
{ {
var at = bi.GetBuildingAt(new CPos(x, y)); var pos = new CPos(x, y);
if (at != null && at.Owner.Stances[p] == Stance.Ally && at.HasTrait<GivesBuildableArea>()) var at = bi.GetBuildingAt(pos);
nearnessCandidates.Add(new CPos(x, y)); if (at == null || !at.HasTrait<GivesBuildableArea>())
continue;
if (at.Owner == p || (allyBuildRadius && at.Owner.Stances[p] == Stance.Ally))
nearnessCandidates.Add(pos);
}
} }
var buildingTiles = FootprintUtils.Tiles(buildingName, this, topLeft).ToList(); var buildingTiles = FootprintUtils.Tiles(buildingName, this, topLeft).ToList();

View File

@@ -309,6 +309,12 @@ namespace OpenRA.Mods.RA.Server
return true; return true;
} }
if (server.Map.Options.FragileAlliances.HasValue)
{
server.SendOrderTo(conn, "Message", "Map has disabled alliance configuration");
return true;
}
bool.TryParse(s, out server.lobbyInfo.GlobalSettings.FragileAlliances); bool.TryParse(s, out server.lobbyInfo.GlobalSettings.FragileAlliances);
server.SyncLobbyInfo(); server.SyncLobbyInfo();
return true; return true;
@@ -322,6 +328,12 @@ namespace OpenRA.Mods.RA.Server
return true; return true;
} }
if (server.Map.Options.Cheats.HasValue)
{
server.SendOrderTo(conn, "Message", "Map has disabled cheat configuration");
return true;
}
bool.TryParse(s, out server.lobbyInfo.GlobalSettings.AllowCheats); bool.TryParse(s, out server.lobbyInfo.GlobalSettings.AllowCheats);
server.SyncLobbyInfo(); server.SyncLobbyInfo();
return true; return true;
@@ -335,6 +347,12 @@ namespace OpenRA.Mods.RA.Server
return true; return true;
} }
if (server.Map.Options.Shroud.HasValue)
{
server.SendOrderTo(conn, "Message", "Map has disabled shroud configuration");
return true;
}
bool.TryParse(s, out server.lobbyInfo.GlobalSettings.Shroud); bool.TryParse(s, out server.lobbyInfo.GlobalSettings.Shroud);
server.SyncLobbyInfo(); server.SyncLobbyInfo();
return true; return true;
@@ -348,6 +366,13 @@ namespace OpenRA.Mods.RA.Server
return true; return true;
} }
if (server.Map.Options.Fog.HasValue)
{
server.SendOrderTo(conn, "Message", "Map has disabled fog configuration");
return true;
}
bool.TryParse(s, out server.lobbyInfo.GlobalSettings.Fog); bool.TryParse(s, out server.lobbyInfo.GlobalSettings.Fog);
server.SyncLobbyInfo(); server.SyncLobbyInfo();
return true; return true;
@@ -402,10 +427,35 @@ namespace OpenRA.Mods.RA.Server
return true; return true;
} }
if (server.Map.Options.Crates.HasValue)
{
server.SendOrderTo(conn, "Message", "Map has disabled crate configuration");
return true;
}
bool.TryParse(s, out server.lobbyInfo.GlobalSettings.Crates); bool.TryParse(s, out server.lobbyInfo.GlobalSettings.Crates);
server.SyncLobbyInfo(); server.SyncLobbyInfo();
return true; return true;
}}, }},
{ "allybuildradius",
s =>
{
if (!client.IsAdmin)
{
server.SendOrderTo(conn, "Message", "Only the host can set that option");
return true;
}
if (server.Map.Options.AllyBuildRadius.HasValue)
{
server.SendOrderTo(conn, "Message", "Map has disabled ally build radius configuration");
return true;
}
bool.TryParse(s, out server.lobbyInfo.GlobalSettings.AllyBuildRadius);
server.SyncLobbyInfo();
return true;
}},
{ "difficulty", { "difficulty",
s => s =>
{ {
@@ -414,10 +464,11 @@ namespace OpenRA.Mods.RA.Server
server.SendOrderTo(conn, "Message", "Only the host can set that option"); server.SendOrderTo(conn, "Message", "Only the host can set that option");
return true; return true;
} }
if ((server.Map.Difficulties == null && s != null) || (server.Map.Difficulties != null && !server.Map.Difficulties.Contains(s)))
if (s != null && !server.Map.Options.Difficulties.Contains(s))
{ {
server.SendOrderTo(conn, "Message", "Unsupported difficulty selected: {0}".F(s)); server.SendOrderTo(conn, "Message", "Unsupported difficulty selected: {0}".F(s));
server.SendOrderTo(conn, "Message", "Supported difficulties: {0}".F(server.Map.Difficulties.JoinWith(","))); server.SendOrderTo(conn, "Message", "Supported difficulties: {0}".F(server.Map.Options.Difficulties.JoinWith(",")));
return true; return true;
} }
@@ -434,7 +485,7 @@ namespace OpenRA.Mods.RA.Server
return true; return true;
} }
if (!server.Map.AllowStartUnitConfig) if (!server.Map.Options.ConfigurableStartingUnits)
{ {
server.SendOrderTo(conn, "Message", "Map has disabled start unit configuration"); server.SendOrderTo(conn, "Message", "Map has disabled start unit configuration");
return true; return true;
@@ -444,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 =>
{ {
@@ -636,16 +706,20 @@ namespace OpenRA.Mods.RA.Server
.Select(p => MakeSlotFromPlayerReference(p.Value)) .Select(p => MakeSlotFromPlayerReference(p.Value))
.Where(s => s != null) .Where(s => s != null)
.ToDictionary(s => s.PlayerReference, s => s); .ToDictionary(s => s.PlayerReference, s => s);
server.Map.Options.UpdateServerSettings(server.lobbyInfo.GlobalSettings);
} }
static void SetDefaultDifficulty(S server) static void SetDefaultDifficulty(S server)
{ {
if (server.Map.Difficulties != null && server.Map.Difficulties.Any()) if (!server.Map.Options.Difficulties.Any())
{ {
if (!server.Map.Difficulties.Contains(server.lobbyInfo.GlobalSettings.Difficulty)) server.lobbyInfo.GlobalSettings.Difficulty = null;
server.lobbyInfo.GlobalSettings.Difficulty = server.Map.Difficulties.First(); return;
} }
else server.lobbyInfo.GlobalSettings.Difficulty = null;
if (!server.Map.Options.Difficulties.Contains(server.lobbyInfo.GlobalSettings.Difficulty))
server.lobbyInfo.GlobalSettings.Difficulty = server.Map.Options.Difficulties.First();
} }
} }
} }

View File

@@ -272,7 +272,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
if (allowCheats != null) if (allowCheats != null)
{ {
allowCheats.IsChecked = () => orderManager.LobbyInfo.GlobalSettings.AllowCheats; allowCheats.IsChecked = () => orderManager.LobbyInfo.GlobalSettings.AllowCheats;
allowCheats.IsDisabled = configurationDisabled; allowCheats.IsDisabled = () => Map.Options.Cheats.HasValue || configurationDisabled();
allowCheats.OnClick = () => orderManager.IssueOrder(Order.Command( allowCheats.OnClick = () => orderManager.IssueOrder(Order.Command(
"allowcheats {0}".F(!orderManager.LobbyInfo.GlobalSettings.AllowCheats))); "allowcheats {0}".F(!orderManager.LobbyInfo.GlobalSettings.AllowCheats)));
} }
@@ -281,16 +281,25 @@ namespace OpenRA.Mods.RA.Widgets.Logic
if (crates != null) if (crates != null)
{ {
crates.IsChecked = () => orderManager.LobbyInfo.GlobalSettings.Crates; crates.IsChecked = () => orderManager.LobbyInfo.GlobalSettings.Crates;
crates.IsDisabled = configurationDisabled; crates.IsDisabled = () => Map.Options.Crates.HasValue || configurationDisabled();
crates.OnClick = () => orderManager.IssueOrder(Order.Command( crates.OnClick = () => orderManager.IssueOrder(Order.Command(
"crates {0}".F(!orderManager.LobbyInfo.GlobalSettings.Crates))); "crates {0}".F(!orderManager.LobbyInfo.GlobalSettings.Crates)));
} }
var allybuildradius = optionsBin.GetOrNull<CheckboxWidget>("ALLYBUILDRADIUS_CHECKBOX");
if (allybuildradius != null)
{
allybuildradius.IsChecked = () => orderManager.LobbyInfo.GlobalSettings.AllyBuildRadius;
allybuildradius.IsDisabled = () => Map.Options.AllyBuildRadius.HasValue || configurationDisabled();
allybuildradius.OnClick = () => orderManager.IssueOrder(Order.Command(
"allybuildradius {0}".F(!orderManager.LobbyInfo.GlobalSettings.AllyBuildRadius)));
}
var fragileAlliance = optionsBin.GetOrNull<CheckboxWidget>("FRAGILEALLIANCES_CHECKBOX"); var fragileAlliance = optionsBin.GetOrNull<CheckboxWidget>("FRAGILEALLIANCES_CHECKBOX");
if (fragileAlliance != null) if (fragileAlliance != null)
{ {
fragileAlliance.IsChecked = () => orderManager.LobbyInfo.GlobalSettings.FragileAlliances; fragileAlliance.IsChecked = () => orderManager.LobbyInfo.GlobalSettings.FragileAlliances;
fragileAlliance.IsDisabled = configurationDisabled; fragileAlliance.IsDisabled = () => Map.Options.FragileAlliances.HasValue || configurationDisabled();
fragileAlliance.OnClick = () => orderManager.IssueOrder(Order.Command( fragileAlliance.OnClick = () => orderManager.IssueOrder(Order.Command(
"fragilealliance {0}".F(!orderManager.LobbyInfo.GlobalSettings.FragileAlliances))); "fragilealliance {0}".F(!orderManager.LobbyInfo.GlobalSettings.FragileAlliances)));
}; };
@@ -298,12 +307,12 @@ namespace OpenRA.Mods.RA.Widgets.Logic
var difficulty = optionsBin.GetOrNull<DropDownButtonWidget>("DIFFICULTY_DROPDOWNBUTTON"); var difficulty = optionsBin.GetOrNull<DropDownButtonWidget>("DIFFICULTY_DROPDOWNBUTTON");
if (difficulty != null) if (difficulty != null)
{ {
difficulty.IsVisible = () => Map != null && Map.Difficulties != null && Map.Difficulties.Any(); difficulty.IsVisible = () => Map.Options.Difficulties.Any();
difficulty.IsDisabled = configurationDisabled; difficulty.IsDisabled = configurationDisabled;
difficulty.GetText = () => orderManager.LobbyInfo.GlobalSettings.Difficulty; difficulty.GetText = () => orderManager.LobbyInfo.GlobalSettings.Difficulty;
difficulty.OnMouseDown = _ => difficulty.OnMouseDown = _ =>
{ {
var options = Map.Difficulties.Select(d => new DropDownOption var options = Map.Options.Difficulties.Select(d => new DropDownOption
{ {
Title = d, Title = d,
IsSelected = () => orderManager.LobbyInfo.GlobalSettings.Difficulty == d, IsSelected = () => orderManager.LobbyInfo.GlobalSettings.Difficulty == d,
@@ -335,9 +344,8 @@ namespace OpenRA.Mods.RA.Widgets.Logic
var classes = Rules.Info["world"].Traits.WithInterface<MPStartUnitsInfo>() var classes = Rules.Info["world"].Traits.WithInterface<MPStartUnitsInfo>()
.Select(a => a.Class).Distinct(); .Select(a => a.Class).Distinct();
startingUnits.IsDisabled = configurationDisabled; startingUnits.IsDisabled = () => !Map.Options.ConfigurableStartingUnits || configurationDisabled();
startingUnits.IsVisible = () => Map.AllowStartUnitConfig; startingUnits.GetText = () => !Map.Options.ConfigurableStartingUnits ? "Not Available" : className(orderManager.LobbyInfo.GlobalSettings.StartingUnitsClass);
startingUnits.GetText = () => className(orderManager.LobbyInfo.GlobalSettings.StartingUnitsClass);
startingUnits.OnMouseDown = _ => startingUnits.OnMouseDown = _ =>
{ {
var options = classes.Select(c => new DropDownOption var options = classes.Select(c => new DropDownOption
@@ -360,11 +368,36 @@ 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)
{ {
enableShroud.IsChecked = () => orderManager.LobbyInfo.GlobalSettings.Shroud; enableShroud.IsChecked = () => orderManager.LobbyInfo.GlobalSettings.Shroud;
enableShroud.IsDisabled = configurationDisabled; enableShroud.IsDisabled = () => Map.Options.Shroud.HasValue || configurationDisabled();
enableShroud.OnClick = () => orderManager.IssueOrder(Order.Command( enableShroud.OnClick = () => orderManager.IssueOrder(Order.Command(
"shroud {0}".F(!orderManager.LobbyInfo.GlobalSettings.Shroud))); "shroud {0}".F(!orderManager.LobbyInfo.GlobalSettings.Shroud)));
}; };
@@ -373,7 +406,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
if (enableFog != null) if (enableFog != null)
{ {
enableFog.IsChecked = () => orderManager.LobbyInfo.GlobalSettings.Fog; enableFog.IsChecked = () => orderManager.LobbyInfo.GlobalSettings.Fog;
enableFog.IsDisabled = configurationDisabled; enableFog.IsDisabled = () => Map.Options.Fog.HasValue || configurationDisabled();
enableFog.OnClick = () => orderManager.IssueOrder(Order.Command( enableFog.OnClick = () => orderManager.IssueOrder(Order.Command(
"fog {0}".F(!orderManager.LobbyInfo.GlobalSettings.Fog))); "fog {0}".F(!orderManager.LobbyInfo.GlobalSettings.Fog)));
}; };
@@ -473,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()

View File

@@ -206,57 +206,80 @@ Background@LOBBY_OPTIONS_BIN:
Children: Children:
Label@TITLE: Label@TITLE:
X:0 X:0
Y:40 Y:30
Width:PARENT_RIGHT Width:PARENT_RIGHT
Height:25 Height:25
Font:Bold Font:Bold
Align:Center Align:Center
Text: Map Options Text: Map Options
Checkbox@ALLOWCHEATS_CHECKBOX: Container:
X:80 X:30
Y:75 Y:65
Width:230 Width: PARENT_RIGHT-60
Height:20 Height: PARENT_BOTTOM-75
Text:Cheats / Debug Menu Children:
Checkbox@CRATES_CHECKBOX:
X:80
Y:110
Width:230
Height:20
Text:Crates
Checkbox@SHROUD_CHECKBOX: Checkbox@SHROUD_CHECKBOX:
X:310
Y:75
Width:230 Width:230
Height:20 Height:20
Text:Shroud Text:Shroud
Checkbox@FOG_CHECKBOX: Checkbox@FOG_CHECKBOX:
X:310 Y:35
Y:110
Width:230 Width:230
Height:20 Height:20
Text:Fog of War Text:Fog of War
Checkbox@CRATES_CHECKBOX:
X:160
Width:230
Height:20
Text:Crates Appear
Checkbox@ALLYBUILDRADIUS_CHECKBOX:
X:160
Y:35
Width:230
Height:20
Text:Build off Ally ConYards
Checkbox@ALLOWCHEATS_CHECKBOX:
X:325
Width:230
Height:20
Text:Debug Menu
Label@STARTINGCASH_DESC:
X:10
Y:72
Width:70
Height:25
Text:Starting Cash:
Align:Right
DropDownButton@STARTINGCASH_DROPDOWNBUTTON:
X:85
Y:72
Width:120
Height:25
Font:Bold
Text:$5000
Label@STARTINGUNITS_DESC: Label@STARTINGUNITS_DESC:
X:135 X:PARENT_RIGHT - WIDTH - 135
Y:142 Y:72
Width:120 Width:120
Height:25 Height:25
Text:Starting Units: Text:Starting Units:
Align:Right
DropDownButton@STARTINGUNITS_DROPDOWNBUTTON: DropDownButton@STARTINGUNITS_DROPDOWNBUTTON:
X:230 X:PARENT_RIGHT - WIDTH + 10
Y:142 Y:72
Width:140 Width:140
Height:25 Height:25
Font:Bold Font:Bold
Label@DIFFICULTY_DESC: Label@DIFFICULTY_DESC:
X:125 X:PARENT_RIGHT - WIDTH - 135
Y:177 Y:107
Width:120 Width:120
Height:25 Height:25
Text:Mission Difficulty: Text:Mission Difficulty:
Align:Right
DropDownButton@DIFFICULTY_DROPDOWNBUTTON: DropDownButton@DIFFICULTY_DROPDOWNBUTTON:
X:230 X:PARENT_RIGHT - WIDTH + 10
Y:177 Y:107
Width:100 Width:140
Height:25 Height:25
Font:Bold Font:Bold

View File

@@ -20,7 +20,14 @@ UseAsShellmap: False
Type: Campaign Type: Campaign
AllowStartUnitConfig: False Options:
Crates: false
Fog: false
Shroud: true
AllyBuildRadius: false
FragileAlliances: false
StartingCash: 500
ConfigurableStartingUnits: false
Players: Players:
PlayerReference@BadGuy: PlayerReference@BadGuy:
@@ -41,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

View File

@@ -20,7 +20,14 @@ UseAsShellmap: False
Type: Campaign Type: Campaign
AllowStartUnitConfig: False Options:
Crates: false
Fog: false
Shroud: true
AllyBuildRadius: false
FragileAlliances: false
StartingCash: 0
ConfigurableStartingUnits: false
Players: Players:
PlayerReference@Neutral: PlayerReference@Neutral:

Binary file not shown.

BIN
mods/cnc/maps/the-hot-box/map.bin Executable file

Binary file not shown.

View File

@@ -0,0 +1,247 @@
Selectable: True
MapFormat: 5
Title: The Hot Box
Description: Drop Zone for CnC
Author: Dan9550
Tileset: DESERT
MapSize: 64,64
Bounds: 16,16,36,36
UseAsShellmap: False
Type: Drop Zone
Options:
Fog: false
Shroud: false
Crates: true
AllyBuildRadius: false
FragileAlliances: false
StartingCash: 5000
ConfigurableStartingUnits: false
Players:
PlayerReference@Neutral:
Name: Neutral
OwnsWorld: True
NonCombatant: True
Race: gdi
PlayerReference@Multi0:
Name: Multi0
Playable: True
LockRace: True
Race: nod
Enemies: Multi9,Multi1,Multi2,Multi3,Multi4,Multi5,Multi6,Multi7,Multi8
PlayerReference@Multi1:
Name: Multi1
Playable: True
LockRace: True
Race: nod
Enemies: Multi0,Multi2,Multi3,Multi4,Multi5,Multi6,Multi7,Multi8,Multi9
PlayerReference@Multi2:
Name: Multi2
Playable: True
LockRace: True
Race: nod
Enemies: Multi0,Multi1,Multi3,Multi4,Multi5,Multi6,Multi7,Multi8,Multi9
PlayerReference@Multi3:
Name: Multi3
Playable: True
LockRace: True
Race: nod
Enemies: Multi0,Multi1,Multi2,Multi4,Multi5,Multi6,Multi7,Multi8,Multi9
PlayerReference@Multi4:
Name: Multi4
Playable: True
LockRace: True
Race: nod
Enemies: Multi0,Multi1,Multi2,Multi3,Multi5,Multi6,Multi7,Multi8,Multi9
PlayerReference@Multi5:
Name: Multi5
Playable: True
LockRace: True
Race: nod
Enemies: Multi0,Multi1,Multi2,Multi3,Multi4,Multi6,Multi7,Multi8,Multi9
PlayerReference@Multi6:
Name: Multi6
Playable: True
LockRace: True
Race: nod
Enemies: Multi0,Multi1,Multi2,Multi3,Multi4,Multi5,Multi7,Multi8,Multi9
PlayerReference@Multi7:
Name: Multi7
Playable: True
LockRace: True
Race: nod
Enemies: Multi0,Multi1,Multi2,Multi3,Multi4,Multi5,Multi6,Multi8,Multi9
PlayerReference@Multi8:
Name: Multi8
Playable: True
LockRace: True
Race: nod
Enemies: Multi0,Multi1,Multi2,Multi3,Multi4,Multi5,Multi6,Multi7,Multi9
PlayerReference@Multi9:
Name: Multi9
Playable: True
LockRace: True
Race: nod
Enemies: Multi0,Multi1,Multi2,Multi3,Multi4,Multi5,Multi6,Multi7,Multi8
PlayerReference@Creeps:
Name: Creeps
NonCombatant: True
Race: gdi
Enemies: Multi0,Multi1,Multi2,Multi3,Multi4,Multi5,Multi6,Multi7,Multi8,Multi9
Actors:
Actor0: apc
Location: 40,17
Owner: Multi0
Actor1: apc
Location: 42,17
Owner: Multi1
Actor2: apc
Location: 40,19
Owner: Multi2
Actor3: apc
Location: 46,21
Owner: Multi3
Actor4: apc
Location: 48,21
Owner: Multi4
Actor5: apc
Location: 50,19
Owner: Multi5
Actor6: apc
Location: 50,21
Owner: Multi6
Actor7: apc
Location: 50,17
Owner: Multi7
Actor8: apc
Location: 39,21
Owner: Multi8
Actor9: apc
Location: 47,17
Owner: Multi9
Actor10: tc02
Location: 22,43
Owner: Neutral
Actor11: v20
Location: 44,38
Owner: Neutral
Actor12: v34
Location: 28,38
Owner: Neutral
Actor13: v35
Location: 29,39
Owner: Neutral
Actor14: v36
Location: 38,35
Owner: Neutral
Actor15: v23
Location: 46,39
Owner: Neutral
Actor16: v27
Location: 22,28
Owner: Neutral
Actor17: t02
Location: 26,26
Owner: Neutral
Actor18: t07
Location: 26,27
Owner: Neutral
Actor19: tc04
Location: 25,16
Owner: Neutral
Actor20: tc03
Location: 26,17
Owner: Neutral
Actor21: mpspawn
Location: 40,18
Owner: Neutral
Actor22: mpspawn
Location: 42,18
Owner: Neutral
Actor23: mpspawn
Location: 40,20
Owner: Neutral
Actor24: mpspawn
Location: 39,22
Owner: Neutral
Actor25: mpspawn
Location: 47,18
Owner: Neutral
Actor26: mpspawn
Location: 50,18
Owner: Neutral
Actor27: mpspawn
Location: 50,20
Owner: Neutral
Actor28: mpspawn
Location: 50,22
Owner: Neutral
Actor29: mpspawn
Location: 48,22
Owner: Neutral
Actor30: mpspawn
Location: 46,22
Owner: Neutral
Smudges:
Rules:
World:
CrateSpawner:
Maximum: 4
SpawnInterval: 5
-SpawnMPUnits:
-MPStartLocations:
CRATE:
-HealUnitsCrateAction:
-LevelUpCrateAction:
-GiveMcvCrateAction:
-RevealMapCrateAction:
-HideMapCrateAction:
-CloakCrateAction:
-ExplodeCrateAction@nuke:
-ExplodeCrateAction@boom:
-ExplodeCrateAction@fire:
-SupportPowerCrateAction@parabombs:
-GiveCashCrateAction:
GiveUnitCrateAction@stnk:
SelectionShares: 4
Unit: stnk
GiveUnitCrateAction@bike:
SelectionShares: 6
Unit: bike
GiveUnitCrateAction@htnk:
SelectionShares: 1
Unit: htnk
GiveUnitCrateAction@e5:
SelectionShares: 1
Unit: e5
GiveUnitCrateAction@e1:
SelectionShares: 1
Unit: e1
APC:
Health:
HP: 1000
RevealsShroud:
Range: 40
MustBeDestroyed:
-AttackMove:
Sequences:
Weapons:
Voices:
Notifications:

View File

@@ -6,7 +6,6 @@ Player:
PowerManager: PowerManager:
AllyRepair: AllyRepair:
PlayerResources: PlayerResources:
InitialCash: 5000
ActorGroupProxy: ActorGroupProxy:
DeveloperMode: DeveloperMode:
HackyAI@Default: HackyAI@Default:

View File

@@ -39,7 +39,6 @@ Player:
AdviceInterval: 650 AdviceInterval: 650
AllyRepair: AllyRepair:
PlayerResources: PlayerResources:
InitialCash: 5000
AdviceInterval: 650 AdviceInterval: 650
ActorGroupProxy: ActorGroupProxy:
DeveloperMode: DeveloperMode:

View File

@@ -59,63 +59,85 @@ Background@LOBBY_OPTIONS_BIN:
Children: Children:
Label@TITLE: Label@TITLE:
X:0 X:0
Y:40 Y:30
Width:PARENT_RIGHT Width:PARENT_RIGHT
Height:25 Height:25
Font:Bold Font:Bold
Align:Center Align:Center
Text: Map Options Text: Map Options
Checkbox@ALLOWCHEATS_CHECKBOX: Container:
X:80 X:30
Y:75 Y:70
Width:230 Width: PARENT_RIGHT-60
Height:20 Height: PARENT_BOTTOM-75
Text:Cheats / Debug Menu Children:
Checkbox@FRAGILEALLIANCES_CHECKBOX:
X:80
Y:110
Width:220
Height:20
Text:Allow Team Changes
Checkbox@CRATES_CHECKBOX:
X:80
Y:145
Width:230
Height:20
Text:Crates
Checkbox@SHROUD_CHECKBOX: Checkbox@SHROUD_CHECKBOX:
X:310
Y:75
Width:230 Width:230
Height:20 Height:20
Text:Shroud Text:Shroud
Checkbox@FOG_CHECKBOX: Checkbox@FOG_CHECKBOX:
X:310 Y:40
Y:110
Width:230 Width:230
Height:20 Height:20
Text:Fog of War Text:Fog of War
Checkbox@CRATES_CHECKBOX:
X:155
Width:230
Height:20
Text:Crates Appear
Checkbox@ALLYBUILDRADIUS_CHECKBOX:
X:155
Y:40
Width:230
Height:20
Text:Build off Ally ConYards
Checkbox@ALLOWCHEATS_CHECKBOX:
X:350
Width:230
Height:20
Text:Debug Menu
Checkbox@FRAGILEALLIANCES_CHECKBOX:
X:350
Y:40
Width:220
Height:20
Text:Team Changes
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:215 X:PARENT_RIGHT - WIDTH - 145
Y:142 Y:87
Width:120 Width:120
Height:25 Height:25
Text:Starting Units: Text:Starting Units:
Align:Right
DropDownButton@STARTINGUNITS_DROPDOWNBUTTON: DropDownButton@STARTINGUNITS_DROPDOWNBUTTON:
X:310 X:PARENT_RIGHT - WIDTH
Y:142 Y:87
Width:140 Width:140
Height:25 Height:25
Font:Bold Font:Bold
Label@DIFFICULTY_DESC: Label@DIFFICULTY_DESC:
X:195 X:PARENT_RIGHT - WIDTH - 145
Y:177 Y:122
Width:120 Width:120
Height:25 Height:25
Text:Mission Difficulty: Text:Mission Difficulty:
Align:Right
DropDownButton@DIFFICULTY_DROPDOWNBUTTON: DropDownButton@DIFFICULTY_DROPDOWNBUTTON:
X:310 X:PARENT_RIGHT - WIDTH
Y:177 Y:122
Width:100 Width:140
Height:25 Height:25
Font:Bold Font:Bold

View File

@@ -18,6 +18,14 @@ UseAsShellmap: False
Type: Minigame Type: Minigame
Options:
Fog: true
Shroud: true
AllyBuildRadius: false
FragileAlliances: false
StartingCash: 50
ConfigurableStartingUnits: false
Players: Players:
PlayerReference@Neutral: PlayerReference@Neutral:
Name: Neutral Name: Neutral
@@ -505,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

View File

@@ -10,15 +10,23 @@ Author: Nuke'm Bro.
Tileset: TEMPERAT Tileset: TEMPERAT
Difficulties: Easy,Normal,Hard
MapSize: 96,64 MapSize: 96,64
Bounds: 4,4,88,56 Bounds: 4,4,88,56
UseAsShellmap: False UseAsShellmap: False
Type: Campaign Type: Minigame
Options:
Crates: false
Fog: true
Shroud: true
AllyBuildRadius: false
FragileAlliances: false
StartingCash: 5000
ConfigurableStartingUnits: false
Difficulties: Easy,Normal,Hard
Players: Players:
PlayerReference@Neutral: PlayerReference@Neutral:

View File

@@ -16,7 +16,16 @@ Bounds: 2,2,76,76
UseAsShellmap: False UseAsShellmap: False
Type: Campaign Type: Minigame
Options:
Crates: false
Fog: true
Shroud: true
AllyBuildRadius: false
FragileAlliances: false
StartingCash: 5000
ConfigurableStartingUnits: false
Players: Players:
PlayerReference@Neutral: PlayerReference@Neutral:

View File

@@ -20,6 +20,14 @@ UseAsShellmap: False
Type: Campaign Type: Campaign
Options:
Crates: false
Fog: true
Shroud: true
AllyBuildRadius: false
FragileAlliances: false
StartingCash: 5000
ConfigurableStartingUnits: false
Difficulties: Easy, Normal Difficulties: Easy, Normal
Players: Players:

View File

@@ -20,6 +20,15 @@ UseAsShellmap: False
Type: Campaign Type: Campaign
Options:
Crates: false
Fog: true
Shroud: true
AllyBuildRadius: false
FragileAlliances: false
StartingCash: 5000
ConfigurableStartingUnits: false
Players: Players:
PlayerReference@Neutral: PlayerReference@Neutral:
Name: Neutral Name: Neutral

View File

@@ -20,6 +20,14 @@ UseAsShellmap: False
Type: Campaign Type: Campaign
Options:
Crates: false
Fog: true
Shroud: true
AllyBuildRadius: false
FragileAlliances: false
StartingCash: 5000
ConfigurableStartingUnits: false
Difficulties: Easy, Normal, Hard Difficulties: Easy, Normal, Hard
Players: Players:

View File

@@ -12,6 +12,14 @@ Author: Scott_NZ
Tileset: TEMPERAT Tileset: TEMPERAT
Options:
Crates: false
Fog: true
Shroud: true
AllyBuildRadius: false
FragileAlliances: false
StartingCash: 5000
ConfigurableStartingUnits: false
Difficulties: Easy,Normal,Hard Difficulties: Easy,Normal,Hard
MapSize: 128,128 MapSize: 128,128

View File

@@ -18,6 +18,15 @@ UseAsShellmap: False
Type: Minigame Type: Minigame
Options:
Crates: false
Fog: true
Shroud: true
AllyBuildRadius: false
FragileAlliances: false
StartingCash: 60
ConfigurableStartingUnits: false
Players: Players:
PlayerReference@Neutral: PlayerReference@Neutral:
Name: Neutral Name: Neutral
@@ -798,8 +807,6 @@ Rules:
Player: Player:
ClassicProductionQueue@Building: ClassicProductionQueue@Building:
BuildSpeed: 0.4 BuildSpeed: 0.4
PlayerResources:
InitialCash: 60
MNLYR: MNLYR:
Inherits: ^Tank Inherits: ^Tank

View File

@@ -16,7 +16,16 @@ Bounds: 16,16,32,32
UseAsShellmap: False UseAsShellmap: False
Type: Minigame Type: Drop Zone
Options:
Crates: true
Fog: false
Shroud: false
AllyBuildRadius: false
FragileAlliances: false
StartingCash: 5000
ConfigurableStartingUnits: false
Players: Players:
PlayerReference@Neutral: PlayerReference@Neutral:

View File

@@ -16,7 +16,16 @@ Bounds: 16,16,32,32
UseAsShellmap: False UseAsShellmap: False
Type: Minigame Type: Drop Zone
Options:
Crates: true
Fog: false
Shroud: false
AllyBuildRadius: false
FragileAlliances: false
StartingCash: 5000
ConfigurableStartingUnits: false
Players: Players:
PlayerReference@Neutral: PlayerReference@Neutral:

View File

@@ -16,7 +16,16 @@ Bounds: 16,16,32,32
UseAsShellmap: False UseAsShellmap: False
Type: Minigame Type: Drop Zone
Options:
Crates: true
Fog: false
Shroud: false
AllyBuildRadius: false
FragileAlliances: false
StartingCash: 5000
ConfigurableStartingUnits: false
Players: Players:
PlayerReference@Neutral: PlayerReference@Neutral:

View File

@@ -20,6 +20,15 @@ UseAsShellmap: False
Type: Campaign Type: Campaign
Options:
Crates: false
Fog: true
Shroud: true
AllyBuildRadius: false
FragileAlliances: false
StartingCash: 5000
ConfigurableStartingUnits: false
Players: Players:
PlayerReference@Greece: PlayerReference@Greece:
Name: Greece Name: Greece

View File

@@ -20,6 +20,15 @@ UseAsShellmap: False
Type: Campaign Type: Campaign
Options:
Crates: false
Fog: true
Shroud: true
AllyBuildRadius: false
FragileAlliances: false
StartingCash: 0
ConfigurableStartingUnits: false
Players: Players:
PlayerReference@GoodGuy: PlayerReference@GoodGuy:
Name: GoodGuy Name: GoodGuy
@@ -841,8 +850,6 @@ Smudges:
Rules: Rules:
Player: Player:
-ConquestVictoryConditions: -ConquestVictoryConditions:
PlayerResources:
InitialCash: 0
World: World:
-CrateDrop: -CrateDrop:
-SpawnMPUnits: -SpawnMPUnits:

View File

@@ -18,6 +18,15 @@ UseAsShellmap: False
Type: Minigame Type: Minigame
Options:
Crates: false
Fog: true
Shroud: true
AllyBuildRadius: false
FragileAlliances: false
StartingCash: 100
ConfigurableStartingUnits: false
Players: Players:
PlayerReference@Neutral: PlayerReference@Neutral:
Name: Neutral Name: Neutral
@@ -800,8 +809,6 @@ Rules:
-SpawnMPUnits: -SpawnMPUnits:
-MPStartLocations: -MPStartLocations:
Player: Player:
PlayerResources:
InitialCash: 100
ClassicProductionQueue@Infantry: ClassicProductionQueue@Infantry:
Type: Infantry Type: Infantry
BuildSpeed: 1 BuildSpeed: 1

View File

@@ -38,7 +38,6 @@ Player:
PowerManager: PowerManager:
AllyRepair: AllyRepair:
PlayerResources: PlayerResources:
InitialCash: 5000
ActorGroupProxy: ActorGroupProxy:
DeveloperMode: DeveloperMode:
HackyAI@EasyAI: HackyAI@EasyAI:

View File

@@ -30,7 +30,6 @@ Player:
PowerManager: PowerManager:
AllyRepair: AllyRepair:
PlayerResources: PlayerResources:
InitialCash: 5000
ActorGroupProxy: ActorGroupProxy:
DeveloperMode: DeveloperMode:
PlayerColorPalette: PlayerColorPalette: