Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aco fix round 2 #2429

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions Content.Server/DeltaV/Station/Systems/CaptainStateSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Content.Server.DeltaV.Station.Components;
using Content.Server.DeltaV.Station.Events;
using Content.Server.GameTicking;
using Content.Server.GameTicking.Events;
using Content.Server.Station.Components;
using Content.Shared.Access.Components;
using Content.Shared.Access;
Expand All @@ -28,20 +29,25 @@ public override void Initialize()
{
SubscribeLocalEvent<CaptainStateComponent, PlayerJobAddedEvent>(OnPlayerJobAdded);
SubscribeLocalEvent<CaptainStateComponent, PlayerJobsRemovedEvent>(OnPlayerJobsRemoved);
SubscribeLocalEvent<CaptainStateComponent, ComponentInit>(OnInit);
SubscribeLocalEvent<RoundStartingEvent>(OnRoundStarting);
Subs.CVar(_cfg, DCCVars.AutoUnlockAllAccessEnabled, a => _aaEnabled = a, true);
Subs.CVar(_cfg, DCCVars.RequestAcoOnCaptainDeparture, a => _acoOnDeparture = a, true);
Subs.CVar(_cfg, DCCVars.AutoUnlockAllAccessDelay, a => _aaDelay = TimeSpan.FromMinutes(a), true);
Subs.CVar(_cfg, DCCVars.RequestAcoDelay, a => _acoDelay = TimeSpan.FromMinutes(a), true);
base.Initialize();
}

private void OnInit(Entity<CaptainStateComponent> ent, ref ComponentInit args)
private void OnRoundStarting(RoundStartingEvent ev)
{
// There is some weird persistince issues this will hopefully fix
ent.Comp.IsACORequestActive = false;
ent.Comp.IsAAInPlay = false;
ent.Comp.HasCaptain = false;
var query = EntityQueryEnumerator<CaptainStateComponent>();
while (query.MoveNext(out var captainState))
{
// Component not being reset between rounds so will reset is manualy here
captainState.IsACORequestActive = false;
captainState.IsAAInPlay = false;
captainState.HasCaptain = false;
Log.Info($"{captainState} reset to defaults");
}
}

public override void Update(float frameTime)
Expand Down
Loading