Missing meteor presets (#29044)
* add meteors into missing game presets * changes for real * implement code * this too
This commit is contained in:
@@ -140,6 +140,8 @@ public sealed class TestRuleSystem : EntitySystem
|
|||||||
while (query.MoveNext(out _, out _, out var gameRule))
|
while (query.MoveNext(out _, out _, out var gameRule))
|
||||||
{
|
{
|
||||||
var minPlayers = gameRule.MinPlayers;
|
var minPlayers = gameRule.MinPlayers;
|
||||||
|
if (!gameRule.CancelPresetOnTooFewPlayers)
|
||||||
|
continue;
|
||||||
if (args.Players.Length >= minPlayers)
|
if (args.Players.Length >= minPlayers)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|||||||
@@ -41,12 +41,19 @@ public abstract partial class GameRuleSystem<T> : EntitySystem where T : ICompon
|
|||||||
if (args.Players.Length >= minPlayers)
|
if (args.Players.Length >= minPlayers)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (gameRule.CancelPresetOnTooFewPlayers)
|
||||||
|
{
|
||||||
ChatManager.SendAdminAnnouncement(Loc.GetString("preset-not-enough-ready-players",
|
ChatManager.SendAdminAnnouncement(Loc.GetString("preset-not-enough-ready-players",
|
||||||
("readyPlayersCount", args.Players.Length),
|
("readyPlayersCount", args.Players.Length),
|
||||||
("minimumPlayers", minPlayers),
|
("minimumPlayers", minPlayers),
|
||||||
("presetName", ToPrettyString(uid))));
|
("presetName", ToPrettyString(uid))));
|
||||||
args.Cancel();
|
args.Cancel();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ForceEndSelf(uid, gameRule);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnGameRuleAdded(EntityUid uid, T component, ref GameRuleAddedEvent args)
|
private void OnGameRuleAdded(EntityUid uid, T component, ref GameRuleAddedEvent args)
|
||||||
|
|||||||
@@ -164,7 +164,7 @@ public sealed class SecretRuleSystem : GameRuleSystem<SecretRuleComponent>
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ruleComp.MinPlayers > players)
|
if (ruleComp.MinPlayers > players && ruleComp.CancelPresetOnTooFewPlayers)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,13 @@ public sealed partial class GameRuleComponent : Component
|
|||||||
[DataField]
|
[DataField]
|
||||||
public int MinPlayers;
|
public int MinPlayers;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// If true, this rule not having enough players will cancel the preset selection.
|
||||||
|
/// If false, it will simply not run silently.
|
||||||
|
/// </summary>
|
||||||
|
[DataField]
|
||||||
|
public bool CancelPresetOnTooFewPlayers = true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A delay for when the rule the is started and when the starting logic actually runs.
|
/// A delay for when the rule the is started and when the starting logic actually runs.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
components:
|
components:
|
||||||
- type: GameRule
|
- type: GameRule
|
||||||
minPlayers: 25
|
minPlayers: 25
|
||||||
|
cancelPresetOnTooFewPlayers: false
|
||||||
- type: MeteorScheduler
|
- type: MeteorScheduler
|
||||||
|
|
||||||
- type: weightedRandomEntity
|
- type: weightedRandomEntity
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
description: survival-description
|
description: survival-description
|
||||||
rules:
|
rules:
|
||||||
- RampingStationEventScheduler
|
- RampingStationEventScheduler
|
||||||
|
- GameRuleMeteorScheduler
|
||||||
- BasicRoundstartVariation
|
- BasicRoundstartVariation
|
||||||
|
|
||||||
- type: gamePreset
|
- type: gamePreset
|
||||||
@@ -20,6 +21,7 @@
|
|||||||
- Revolutionary
|
- Revolutionary
|
||||||
- Zombie
|
- Zombie
|
||||||
- RampingStationEventScheduler
|
- RampingStationEventScheduler
|
||||||
|
- GameRuleMeteorScheduler
|
||||||
|
|
||||||
- type: gamePreset
|
- type: gamePreset
|
||||||
id: Extended
|
id: Extended
|
||||||
@@ -44,6 +46,7 @@
|
|||||||
description: greenshift-description
|
description: greenshift-description
|
||||||
rules:
|
rules:
|
||||||
- BasicRoundstartVariation
|
- BasicRoundstartVariation
|
||||||
|
- GameRuleMeteorScheduler
|
||||||
|
|
||||||
- type: gamePreset
|
- type: gamePreset
|
||||||
id: Secret
|
id: Secret
|
||||||
|
|||||||
Reference in New Issue
Block a user