Move starting units configuration to rules.

This commit is contained in:
Paul Chote
2016-02-29 20:20:02 +00:00
parent e34864fe40
commit 3c779d4101
7 changed files with 27 additions and 11 deletions

View File

@@ -617,7 +617,8 @@ namespace OpenRA.Mods.Common.Server
return true;
}
if (!server.Map.Options.ConfigurableStartingUnits)
var startingUnits = server.Map.Rules.Actors["world"].TraitInfoOrDefault<SpawnMPUnitsInfo>();
if (startingUnits == null || startingUnits.Locked)
{
server.SendOrderTo(conn, "Message", "Map has disabled start unit configuration.");
return true;
@@ -1030,6 +1031,9 @@ namespace OpenRA.Mods.Common.Server
var resources = server.Map.Rules.Actors["player"].TraitInfo<PlayerResourcesInfo>();
gs.StartingCash = resources.DefaultCash;
var startingUnits = server.Map.Rules.Actors["world"].TraitInfoOrDefault<SpawnMPUnitsInfo>();
gs.StartingUnitsClass = startingUnits == null ? "none" : startingUnits.StartingUnitsClass;
server.Map.Options.UpdateServerSettings(server.LobbyInfo.GlobalSettings);
}