Потеря мозговых клеток - гарантированна (#841)

This commit is contained in:
BIGZi0348
2024-12-23 23:44:25 +03:00
committed by GitHub
4 changed files with 37 additions and 22 deletions

View File

@@ -33,6 +33,8 @@ public sealed class AuthPanelSystem : EntitySystem
public static int MaxCount = 2; public static int MaxCount = 2;
public static int RandomAcceptRate = 8;
private TimeSpan? _delay; private TimeSpan? _delay;
public override void Initialize() public override void Initialize()
@@ -61,7 +63,7 @@ public sealed class AuthPanelSystem : EntitySystem
{ {
if (args.Action is AuthPanelAction.ERTRecruit) if (args.Action is AuthPanelAction.ERTRecruit)
{ {
if (_random.Next(10) < 2) if (_random.Next(10) < RandomAcceptRate)
{ {
_gameTicker.AddGameRule(ERTRecruitmentRuleComponent.EventName); _gameTicker.AddGameRule(ERTRecruitmentRuleComponent.EventName);
} }
@@ -71,6 +73,7 @@ public sealed class AuthPanelSystem : EntitySystem
if (station != null) if (station != null)
_ert.DeclineERT(station.Value); _ert.DeclineERT(station.Value);
_adminLogger.Add(LogType.EventStarted, LogImpact.High, $"ERT Declined - due to random");
} }
foreach (var entities in Counter.Values) foreach (var entities in Counter.Values)

View File

@@ -7,6 +7,8 @@ using Content.Server.GameTicking.Rules.Components;
using Content.Server.StationEvents.Events; using Content.Server.StationEvents.Events;
using Content.Server._White.GhostRecruitment; using Content.Server._White.GhostRecruitment;
using Content.Server.GameTicking.Components; using Content.Server.GameTicking.Components;
using Content.Shared.Administration.Logs;
using Content.Shared.Database;
using Content.Shared._White; using Content.Shared._White;
using Content.Shared._White.GhostRecruitment; using Content.Shared._White.GhostRecruitment;
using JetBrains.Annotations; using JetBrains.Annotations;
@@ -29,6 +31,7 @@ public sealed class ERTRecruitmentRule : StationEventSystem<ERTRecruitmentRuleCo
[Dependency] private readonly IConfigurationManager _cfgManager = default!; [Dependency] private readonly IConfigurationManager _cfgManager = default!;
[Dependency] private readonly GameTicker _ticker = default!; [Dependency] private readonly GameTicker _ticker = default!;
[Dependency] private readonly IEntityManager _entities = default!; [Dependency] private readonly IEntityManager _entities = default!;
[Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
private ISawmill _logger = default!; private ISawmill _logger = default!;
@@ -76,14 +79,14 @@ public sealed class ERTRecruitmentRule : StationEventSystem<ERTRecruitmentRuleCo
if (component.TargetStation == null || component.IsBlocked || IsDisabled) if (component.TargetStation == null || component.IsBlocked || IsDisabled)
{ {
ForceEndSelf(uid, gameRule); ForceEndSelf(uid, gameRule);
_logger.Debug("oopsie doopsie we make a poopie poopie on starting event!"); _adminLogger.Add(LogType.EventStarted, LogImpact.High, $"ERT Declined - Event disabled");
return; return;
} }
if (_recruitment.GetEventSpawners(ERTRecruitmentRuleComponent.EventName).Count() < component.MinPlayer) if (_recruitment.GetEventSpawners(ERTRecruitmentRuleComponent.EventName).Count() < component.MinPlayer)
{ {
_logger.Debug("Not enough spawners!");
DeclineERT(component.TargetStation.Value); DeclineERT(component.TargetStation.Value);
_adminLogger.Add(LogType.EventStarted, LogImpact.High, $"ERT Declined - Not enough spawners");
return; return;
} }
@@ -91,6 +94,7 @@ public sealed class ERTRecruitmentRule : StationEventSystem<ERTRecruitmentRuleCo
{ {
_logger.Debug("Not enough time passed!"); _logger.Debug("Not enough time passed!");
DeclineERT(component.TargetStation.Value); DeclineERT(component.TargetStation.Value);
_adminLogger.Add(LogType.EventStarted, LogImpact.High, $"ERT Declined - Not enough time passed");
return; return;
} }
@@ -109,15 +113,25 @@ public sealed class ERTRecruitmentRule : StationEventSystem<ERTRecruitmentRuleCo
protected override void Ended(EntityUid uid, ERTRecruitmentRuleComponent component, GameRuleComponent gameRule, GameRuleEndedEvent args) protected override void Ended(EntityUid uid, ERTRecruitmentRuleComponent component, GameRuleComponent gameRule, GameRuleEndedEvent args)
{ {
base.Ended(uid, component, gameRule, args); base.Ended(uid, component, gameRule, args);
var ertsys = _entities.System<ERTRecruitmentRule>();
var check1 = component.IsBlocked; var check1 = component.IsBlocked || ertsys.IsDisabled;
var check2 = _recruitment.GetAllRecruited(ERTRecruitmentRuleComponent.EventName).Count() < component.MinPlayer; var check2 = _recruitment.GetAllRecruited(ERTRecruitmentRuleComponent.EventName).Count() < component.MinPlayer;
if (check1 || check2) if (check1)
{ {
if (component.TargetStation != null) if (component.TargetStation != null)
DeclineERT(component.TargetStation.Value); DeclineERT(component.TargetStation.Value);
_adminLogger.Add(LogType.EventStarted, LogImpact.High, $"ERT Declined - Event disabled");
_recruitment.Cleanup(ERTRecruitmentRuleComponent.EventName);
return;
}
if (check2)
{
if (component.TargetStation != null)
DeclineERT(component.TargetStation.Value);
_adminLogger.Add(LogType.EventStarted, LogImpact.High, $"ERT Declined - Not enough ghosts willing to play ERT");
_recruitment.Cleanup(ERTRecruitmentRuleComponent.EventName); _recruitment.Cleanup(ERTRecruitmentRuleComponent.EventName);
return; return;
} }
@@ -127,7 +141,6 @@ public sealed class ERTRecruitmentRule : StationEventSystem<ERTRecruitmentRuleCo
AcceptERT(component.TargetStation.Value); AcceptERT(component.TargetStation.Value);
_recruitment.EndRecruitment(ERTRecruitmentRuleComponent.EventName); _recruitment.EndRecruitment(ERTRecruitmentRuleComponent.EventName);
var ertsys = _entities.System<ERTRecruitmentRule>();
ertsys.IsDisabled = true; ertsys.IsDisabled = true;
} }

View File

@@ -63,8 +63,7 @@ public sealed class GhostRecruitmentSystem : EntitySystem
var count = 0; var count = 0;
//var maxCount = Math.Max(3, _playerManager.PlayerCount / 8); var maxCount = Math.Max(3, _playerManager.PlayerCount / 8);
var maxCount = 1;
var query = EntityQueryEnumerator<GhostRecruitedComponent>(); var query = EntityQueryEnumerator<GhostRecruitedComponent>();
while (query.MoveNext(out var uid, out var ghostRecruitedComponent)) while (query.MoveNext(out var uid, out var ghostRecruitedComponent))

View File

@@ -5,7 +5,7 @@
components: components:
- type: StationEvent - type: StationEvent
weight: 0 weight: 0
duration: 20 duration: 30
- type: ERTRecruitmentRule - type: ERTRecruitmentRule
minPlayer: 4 minPlayer: 4
earliestStart: 30 earliestStart: 30