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))
|
||||
{
|
||||
var minPlayers = gameRule.MinPlayers;
|
||||
if (!gameRule.CancelPresetOnTooFewPlayers)
|
||||
continue;
|
||||
if (args.Players.Length >= minPlayers)
|
||||
continue;
|
||||
|
||||
|
||||
@@ -41,12 +41,19 @@ public abstract partial class GameRuleSystem<T> : EntitySystem where T : ICompon
|
||||
if (args.Players.Length >= minPlayers)
|
||||
continue;
|
||||
|
||||
if (gameRule.CancelPresetOnTooFewPlayers)
|
||||
{
|
||||
ChatManager.SendAdminAnnouncement(Loc.GetString("preset-not-enough-ready-players",
|
||||
("readyPlayersCount", args.Players.Length),
|
||||
("minimumPlayers", minPlayers),
|
||||
("presetName", ToPrettyString(uid))));
|
||||
args.Cancel();
|
||||
}
|
||||
else
|
||||
{
|
||||
ForceEndSelf(uid, gameRule);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnGameRuleAdded(EntityUid uid, T component, ref GameRuleAddedEvent args)
|
||||
|
||||
@@ -164,7 +164,7 @@ public sealed class SecretRuleSystem : GameRuleSystem<SecretRuleComponent>
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ruleComp.MinPlayers > players)
|
||||
if (ruleComp.MinPlayers > players && ruleComp.CancelPresetOnTooFewPlayers)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,13 @@ public sealed partial class GameRuleComponent : Component
|
||||
[DataField]
|
||||
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>
|
||||
/// A delay for when the rule the is started and when the starting logic actually runs.
|
||||
/// </summary>
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
components:
|
||||
- type: GameRule
|
||||
minPlayers: 25
|
||||
cancelPresetOnTooFewPlayers: false
|
||||
- type: MeteorScheduler
|
||||
|
||||
- type: weightedRandomEntity
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
description: survival-description
|
||||
rules:
|
||||
- RampingStationEventScheduler
|
||||
- GameRuleMeteorScheduler
|
||||
- BasicRoundstartVariation
|
||||
|
||||
- type: gamePreset
|
||||
@@ -20,6 +21,7 @@
|
||||
- Revolutionary
|
||||
- Zombie
|
||||
- RampingStationEventScheduler
|
||||
- GameRuleMeteorScheduler
|
||||
|
||||
- type: gamePreset
|
||||
id: Extended
|
||||
@@ -44,6 +46,7 @@
|
||||
description: greenshift-description
|
||||
rules:
|
||||
- BasicRoundstartVariation
|
||||
- GameRuleMeteorScheduler
|
||||
|
||||
- type: gamePreset
|
||||
id: Secret
|
||||
|
||||
Reference in New Issue
Block a user