Revert "Gamerule Entities" (#15724)

This commit is contained in:
metalgearsloth
2023-04-24 16:21:05 +10:00
committed by GitHub
parent 39cc02b8f9
commit d3552dae00
124 changed files with 4328 additions and 3083 deletions

View File

@@ -1,7 +1,9 @@
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Threading.Tasks;
using Content.Server.GameTicking.Events;
using Content.Server.GameTicking.Presets;
using Content.Server.GameTicking.Rules;
using Content.Server.Ghost.Components;
using Content.Shared.CCVar;
using Content.Shared.Damage;
@@ -9,7 +11,6 @@ using Content.Shared.Damage.Prototypes;
using Content.Shared.Database;
using Content.Shared.Mobs.Components;
using Content.Shared.Mobs.Systems;
using JetBrains.Annotations;
using Robust.Server.Player;
namespace Content.Server.GameTicking
@@ -42,6 +43,7 @@ namespace Content.Server.GameTicking
if (_configurationManager.GetCVar(CCVars.GameLobbyFallbackEnabled))
{
var oldPreset = Preset;
ClearGameRules();
SetGamePreset(_configurationManager.GetCVar(CCVars.GameLobbyFallbackPreset));
AddGamePresetRules();
@@ -123,7 +125,6 @@ namespace Content.Server.GameTicking
return prototype != null;
}
[PublicAPI]
private bool AddGamePresetRules()
{
if (DummyTicker || Preset == null)
@@ -131,7 +132,10 @@ namespace Content.Server.GameTicking
foreach (var rule in Preset.Rules)
{
AddGameRule(rule);
if (!_prototypeManager.TryIndex(rule, out GameRulePrototype? ruleProto))
continue;
AddGameRule(ruleProto);
}
return true;
@@ -140,7 +144,7 @@ namespace Content.Server.GameTicking
private void StartGamePresetRules()
{
// May be touched by the preset during init.
foreach (var rule in GetAddedGameRules())
foreach (var rule in _addedGameRules.ToArray())
{
StartGameRule(rule);
}
@@ -162,12 +166,10 @@ namespace Content.Server.GameTicking
if (mind.PreventGhosting)
{
if (mind.Session != null) // Logging is suppressed to prevent spam from ghost attempts caused by movement attempts
{
if (mind.Session != null)
// Logging is suppressed to prevent spam from ghost attempts caused by movement attempts
_chatManager.DispatchServerMessage(mind.Session, Loc.GetString("comp-mind-ghosting-prevented"),
true);
}
return false;
}