Move creeps configuration to rules.

This commit is contained in:
Paul Chote
2016-02-29 20:41:16 +00:00
parent 3c779d4101
commit cce292a68a
7 changed files with 40 additions and 5 deletions

View File

@@ -376,8 +376,14 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var creeps = optionsBin.GetOrNull<CheckboxWidget>("CREEPS_CHECKBOX");
if (creeps != null)
{
var creepsLocked = new CachedTransform<Map, bool>(map =>
{
var mapCreeps = map.Rules.Actors["world"].TraitInfoOrDefault<MapCreepsInfo>();
return mapCreeps == null || mapCreeps.Locked;
});
creeps.IsChecked = () => orderManager.LobbyInfo.GlobalSettings.Creeps;
creeps.IsDisabled = () => configurationDisabled() || Map.Options.Creeps.HasValue;
creeps.IsDisabled = () => configurationDisabled() || creepsLocked.Update(Map);
creeps.OnClick = () => orderManager.IssueOrder(Order.Command(
"creeps {0}".F(!orderManager.LobbyInfo.GlobalSettings.Creeps)));
}