Merge branch 'master' into ConsFix
This commit is contained in:
@@ -33,13 +33,15 @@ public sealed class AuthPanelSystem : EntitySystem
|
||||
|
||||
public static int MaxCount = 2;
|
||||
|
||||
public static int RandomAcceptRate = 8;
|
||||
|
||||
private TimeSpan? _delay;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
SubscribeLocalEvent<AuthPanelComponent,AuthPanelButtonPressedMessage>(OnButtonPressed);
|
||||
SubscribeLocalEvent<AuthPanelComponent,AuthPanelPerformActionEvent>(OnPerformAction);
|
||||
SubscribeLocalEvent<RecruitedComponent,ERTRecruitedReasonEvent>(OnReason);
|
||||
SubscribeLocalEvent<AuthPanelComponent, AuthPanelButtonPressedMessage>(OnButtonPressed);
|
||||
SubscribeLocalEvent<AuthPanelComponent, AuthPanelPerformActionEvent>(OnPerformAction);
|
||||
SubscribeLocalEvent<RecruitedComponent, ERTRecruitedReasonEvent>(OnReason);
|
||||
|
||||
SubscribeLocalEvent<RoundRestartCleanupEvent>(OnRestart);
|
||||
}
|
||||
@@ -61,7 +63,7 @@ public sealed class AuthPanelSystem : EntitySystem
|
||||
{
|
||||
if (args.Action is AuthPanelAction.ERTRecruit)
|
||||
{
|
||||
if (_random.Next(10) < 2)
|
||||
if (_random.Next(10) < RandomAcceptRate)
|
||||
{
|
||||
_gameTicker.AddGameRule(ERTRecruitmentRuleComponent.EventName);
|
||||
}
|
||||
@@ -71,6 +73,7 @@ public sealed class AuthPanelSystem : EntitySystem
|
||||
|
||||
if (station != null)
|
||||
_ert.DeclineERT(station.Value);
|
||||
_adminLogger.Add(LogType.EventStarted, LogImpact.High, $"ERT Declined - due to random");
|
||||
}
|
||||
|
||||
foreach (var entities in Counter.Values)
|
||||
@@ -91,7 +94,7 @@ public sealed class AuthPanelSystem : EntitySystem
|
||||
if (!access.Contains("Command"))
|
||||
{
|
||||
_popup.PopupEntity(Loc.GetString("auth-panel-no-access"),
|
||||
args.Actor,args.Actor);
|
||||
args.Actor, args.Actor);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -112,22 +115,22 @@ public sealed class AuthPanelSystem : EntitySystem
|
||||
if (!Counter.TryGetValue(args.Button, out var hashSet))
|
||||
{
|
||||
hashSet = new HashSet<EntityUid>();
|
||||
Counter.Add(args.Button,hashSet);
|
||||
Counter.Add(args.Button, hashSet);
|
||||
}
|
||||
|
||||
if(hashSet.Count == MaxCount)
|
||||
if (hashSet.Count == MaxCount)
|
||||
return;
|
||||
|
||||
if (!CardIndexes.TryGetValue(args.Button, out var cardSet))
|
||||
{
|
||||
cardSet = new HashSet<int>();
|
||||
CardIndexes.Add(args.Button,cardSet);
|
||||
CardIndexes.Add(args.Button, cardSet);
|
||||
}
|
||||
|
||||
if (cardSet.Contains(access.Count))
|
||||
{
|
||||
_popup.PopupEntity(Loc.GetString("auth-panel-used-ID"),
|
||||
args.Actor,args.Actor);
|
||||
args.Actor, args.Actor);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -148,19 +151,19 @@ public sealed class AuthPanelSystem : EntitySystem
|
||||
if (hashSet.Count == MaxCount)
|
||||
{
|
||||
var ev = new AuthPanelPerformActionEvent(args.Button);
|
||||
RaiseLocalEvent(uid,ev);
|
||||
RaiseLocalEvent(uid, ev);
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateUserInterface(AuthPanelAction rawaction)
|
||||
{
|
||||
if(!Counter.TryGetValue(rawaction,out var hashSet))
|
||||
if (!Counter.TryGetValue(rawaction, out var hashSet))
|
||||
return;
|
||||
|
||||
var action = new AuthPanelConfirmationAction(rawaction, hashSet.Count, MaxCount,Reason);
|
||||
var action = new AuthPanelConfirmationAction(rawaction, hashSet.Count, MaxCount, Reason);
|
||||
|
||||
var query = EntityQueryEnumerator<AuthPanelComponent>();
|
||||
while (query.MoveNext(out var uid,out _))
|
||||
while (query.MoveNext(out var uid, out _))
|
||||
{
|
||||
if (!_ui.HasUi(uid, AuthPanelUiKey.Key))
|
||||
return;
|
||||
@@ -168,7 +171,7 @@ public sealed class AuthPanelSystem : EntitySystem
|
||||
var state = new AuthPanelConfirmationActionState(action);
|
||||
|
||||
_ui.SetUiState(uid, AuthPanelUiKey.Key, state);
|
||||
_appearance.SetData(uid,AuthPanelVisualLayers.Confirm,true);
|
||||
_appearance.SetData(uid, AuthPanelVisualLayers.Confirm, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,8 @@ using Content.Server.GameTicking.Rules.Components;
|
||||
using Content.Server.StationEvents.Events;
|
||||
using Content.Server._White.GhostRecruitment;
|
||||
using Content.Server.GameTicking.Components;
|
||||
using Content.Shared.Administration.Logs;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared._White;
|
||||
using Content.Shared._White.GhostRecruitment;
|
||||
using JetBrains.Annotations;
|
||||
@@ -29,6 +31,7 @@ public sealed class ERTRecruitmentRule : StationEventSystem<ERTRecruitmentRuleCo
|
||||
[Dependency] private readonly IConfigurationManager _cfgManager = default!;
|
||||
[Dependency] private readonly GameTicker _ticker = default!;
|
||||
[Dependency] private readonly IEntityManager _entities = default!;
|
||||
[Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
|
||||
|
||||
private ISawmill _logger = default!;
|
||||
|
||||
@@ -76,14 +79,14 @@ public sealed class ERTRecruitmentRule : StationEventSystem<ERTRecruitmentRuleCo
|
||||
if (component.TargetStation == null || component.IsBlocked || IsDisabled)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
if (_recruitment.GetEventSpawners(ERTRecruitmentRuleComponent.EventName).Count() < component.MinPlayer)
|
||||
{
|
||||
_logger.Debug("Not enough spawners!");
|
||||
DeclineERT(component.TargetStation.Value);
|
||||
_adminLogger.Add(LogType.EventStarted, LogImpact.High, $"ERT Declined - Not enough spawners");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -91,6 +94,7 @@ public sealed class ERTRecruitmentRule : StationEventSystem<ERTRecruitmentRuleCo
|
||||
{
|
||||
_logger.Debug("Not enough time passed!");
|
||||
DeclineERT(component.TargetStation.Value);
|
||||
_adminLogger.Add(LogType.EventStarted, LogImpact.High, $"ERT Declined - Not enough time passed");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -109,15 +113,25 @@ public sealed class ERTRecruitmentRule : StationEventSystem<ERTRecruitmentRuleCo
|
||||
protected override void Ended(EntityUid uid, ERTRecruitmentRuleComponent component, GameRuleComponent gameRule, GameRuleEndedEvent 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;
|
||||
|
||||
if (check1 || check2)
|
||||
if (check1)
|
||||
{
|
||||
if (component.TargetStation != null)
|
||||
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);
|
||||
return;
|
||||
}
|
||||
@@ -127,7 +141,6 @@ public sealed class ERTRecruitmentRule : StationEventSystem<ERTRecruitmentRuleCo
|
||||
AcceptERT(component.TargetStation.Value);
|
||||
|
||||
_recruitment.EndRecruitment(ERTRecruitmentRuleComponent.EventName);
|
||||
var ertsys = _entities.System<ERTRecruitmentRule>();
|
||||
ertsys.IsDisabled = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -63,8 +63,7 @@ public sealed class GhostRecruitmentSystem : EntitySystem
|
||||
|
||||
var count = 0;
|
||||
|
||||
//var maxCount = Math.Max(3, _playerManager.PlayerCount / 8);
|
||||
var maxCount = 1;
|
||||
var maxCount = Math.Max(3, _playerManager.PlayerCount / 8);
|
||||
var query = EntityQueryEnumerator<GhostRecruitedComponent>();
|
||||
|
||||
while (query.MoveNext(out var uid, out var ghostRecruitedComponent))
|
||||
|
||||
@@ -260,7 +260,7 @@
|
||||
startingItem: MagazinePistolRubber
|
||||
insertSound: /Audio/Weapons/Guns/MagIn/pistol_magin.ogg
|
||||
ejectSound: /Audio/Weapons/Guns/MagOut/pistol_magout.ogg
|
||||
priority: 2
|
||||
priority: 4
|
||||
whitelist:
|
||||
tags:
|
||||
- MagazinePistol
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
components:
|
||||
- type: StationEvent
|
||||
weight: 0
|
||||
duration: 20
|
||||
duration: 30
|
||||
- type: ERTRecruitmentRule
|
||||
minPlayer: 4
|
||||
earliestStart: 30
|
||||
|
||||
Reference in New Issue
Block a user