Move crates option to rules.
This commit is contained in:
@@ -58,7 +58,6 @@ namespace OpenRA
|
|||||||
|
|
||||||
public class MapOptions
|
public class MapOptions
|
||||||
{
|
{
|
||||||
public bool? Crates;
|
|
||||||
public bool? Creeps;
|
public bool? Creeps;
|
||||||
public bool? Fog;
|
public bool? Fog;
|
||||||
public bool? Shroud;
|
public bool? Shroud;
|
||||||
@@ -71,8 +70,6 @@ namespace OpenRA
|
|||||||
|
|
||||||
public void UpdateServerSettings(Session.Global settings)
|
public void UpdateServerSettings(Session.Global settings)
|
||||||
{
|
{
|
||||||
if (Crates.HasValue)
|
|
||||||
settings.Crates = Crates.Value;
|
|
||||||
if (Creeps.HasValue)
|
if (Creeps.HasValue)
|
||||||
settings.Creeps = Creeps.Value;
|
settings.Creeps = Creeps.Value;
|
||||||
if (Fog.HasValue)
|
if (Fog.HasValue)
|
||||||
|
|||||||
@@ -519,7 +519,8 @@ namespace OpenRA.Mods.Common.Server
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (server.Map.Options.Crates.HasValue)
|
var crateSpawner = server.Map.Rules.Actors["world"].TraitInfoOrDefault<CrateSpawnerInfo>();
|
||||||
|
if (crateSpawner == null || crateSpawner.Locked)
|
||||||
{
|
{
|
||||||
server.SendOrderTo(conn, "Message", "Map has disabled crate configuration.");
|
server.SendOrderTo(conn, "Message", "Map has disabled crate configuration.");
|
||||||
return true;
|
return true;
|
||||||
@@ -1015,6 +1016,9 @@ namespace OpenRA.Mods.Common.Server
|
|||||||
var gs = server.LobbyInfo.GlobalSettings;
|
var gs = server.LobbyInfo.GlobalSettings;
|
||||||
var devMode = server.Map.Rules.Actors["player"].TraitInfo<DeveloperModeInfo>();
|
var devMode = server.Map.Rules.Actors["player"].TraitInfo<DeveloperModeInfo>();
|
||||||
gs.AllowCheats = devMode.Enabled;
|
gs.AllowCheats = devMode.Enabled;
|
||||||
|
|
||||||
|
var crateSpawner = server.Map.Rules.Actors["world"].TraitInfoOrDefault<CrateSpawnerInfo>();
|
||||||
|
gs.Crates = crateSpawner != null && crateSpawner.Enabled;
|
||||||
server.Map.Options.UpdateServerSettings(server.LobbyInfo.GlobalSettings);
|
server.Map.Options.UpdateServerSettings(server.LobbyInfo.GlobalSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,12 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
{
|
{
|
||||||
public class CrateSpawnerInfo : ITraitInfo
|
public class CrateSpawnerInfo : ITraitInfo
|
||||||
{
|
{
|
||||||
|
[Desc("Default value of the crates checkbox in the lobby.")]
|
||||||
|
public readonly bool Enabled = true;
|
||||||
|
|
||||||
|
[Desc("Prevent the crates state from being changed in the lobby.")]
|
||||||
|
public readonly bool Locked = false;
|
||||||
|
|
||||||
[Desc("Minimum number of crates.")]
|
[Desc("Minimum number of crates.")]
|
||||||
public readonly int Minimum = 1;
|
public readonly int Minimum = 1;
|
||||||
|
|
||||||
@@ -42,14 +48,14 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
public readonly int WaterChance = 20;
|
public readonly int WaterChance = 20;
|
||||||
|
|
||||||
[ActorReference]
|
[ActorReference]
|
||||||
[Desc("Crate actors to drop")]
|
[Desc("Crate actors to drop.")]
|
||||||
public readonly string[] CrateActors = { "crate" };
|
public readonly string[] CrateActors = { "crate" };
|
||||||
|
|
||||||
[Desc("Chance of each crate actor spawning")]
|
[Desc("Chance of each crate actor spawning.")]
|
||||||
public readonly int[] CrateActorShares = { 10 };
|
public readonly int[] CrateActorShares = { 10 };
|
||||||
|
|
||||||
[ActorReference]
|
[ActorReference]
|
||||||
[Desc("If a DeliveryAircraft: is specified, then this actor will deliver crates")]
|
[Desc("If a DeliveryAircraft: is specified, then this actor will deliver crates.")]
|
||||||
public readonly string DeliveryAircraft = null;
|
public readonly string DeliveryAircraft = null;
|
||||||
|
|
||||||
[Desc("Number of facings that the delivery aircraft may approach from.")]
|
[Desc("Number of facings that the delivery aircraft may approach from.")]
|
||||||
|
|||||||
@@ -361,8 +361,14 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
var crates = optionsBin.GetOrNull<CheckboxWidget>("CRATES_CHECKBOX");
|
var crates = optionsBin.GetOrNull<CheckboxWidget>("CRATES_CHECKBOX");
|
||||||
if (crates != null)
|
if (crates != null)
|
||||||
{
|
{
|
||||||
|
var cratesLocked = new CachedTransform<Map, bool>(map =>
|
||||||
|
{
|
||||||
|
var crateSpawner = map.Rules.Actors["world"].TraitInfoOrDefault<CrateSpawnerInfo>();
|
||||||
|
return crateSpawner == null || crateSpawner.Locked;
|
||||||
|
});
|
||||||
|
|
||||||
crates.IsChecked = () => orderManager.LobbyInfo.GlobalSettings.Crates;
|
crates.IsChecked = () => orderManager.LobbyInfo.GlobalSettings.Crates;
|
||||||
crates.IsDisabled = () => configurationDisabled() || Map.Options.Crates.HasValue;
|
crates.IsDisabled = () => configurationDisabled() || cratesLocked.Update(Map);
|
||||||
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)));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ Type: Drop Zone
|
|||||||
Videos:
|
Videos:
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
Crates: True
|
|
||||||
Fog: False
|
Fog: False
|
||||||
Shroud: False
|
Shroud: False
|
||||||
AllyBuildRadius: False
|
AllyBuildRadius: False
|
||||||
|
|||||||
@@ -163,7 +163,6 @@ ServerTraits:
|
|||||||
LobbySettingsNotification
|
LobbySettingsNotification
|
||||||
|
|
||||||
LobbyDefaults:
|
LobbyDefaults:
|
||||||
Crates: true
|
|
||||||
StartingUnitsClass: light
|
StartingUnitsClass: light
|
||||||
FragileAlliances: false
|
FragileAlliances: false
|
||||||
Shroud: true
|
Shroud: true
|
||||||
|
|||||||
@@ -156,7 +156,6 @@ ServerTraits:
|
|||||||
LobbySettingsNotification
|
LobbySettingsNotification
|
||||||
|
|
||||||
LobbyDefaults:
|
LobbyDefaults:
|
||||||
Crates: true
|
|
||||||
StartingUnitsClass: none
|
StartingUnitsClass: none
|
||||||
FragileAlliances: false
|
FragileAlliances: false
|
||||||
Shroud: true
|
Shroud: true
|
||||||
|
|||||||
@@ -166,7 +166,6 @@ ServerTraits:
|
|||||||
LobbySettingsNotification
|
LobbySettingsNotification
|
||||||
|
|
||||||
LobbyDefaults:
|
LobbyDefaults:
|
||||||
Crates: true
|
|
||||||
StartingUnitsClass: none
|
StartingUnitsClass: none
|
||||||
FragileAlliances: false
|
FragileAlliances: false
|
||||||
Shroud: true
|
Shroud: true
|
||||||
|
|||||||
@@ -215,7 +215,6 @@ ServerTraits:
|
|||||||
LobbySettingsNotification
|
LobbySettingsNotification
|
||||||
|
|
||||||
LobbyDefaults:
|
LobbyDefaults:
|
||||||
Crates: true
|
|
||||||
StartingUnitsClass: none
|
StartingUnitsClass: none
|
||||||
FragileAlliances: false
|
FragileAlliances: false
|
||||||
Shroud: true
|
Shroud: true
|
||||||
|
|||||||
Reference in New Issue
Block a user