Skip to content

Commit

Permalink
Auto ACO Procedure bug fixes (#2424)
Browse files Browse the repository at this point in the history
* bug fixes and safty improvments

* remove unsued useings

* this is dumb but ok

* removed global annoucement

* why does my ide keep doing this shit

* remove unessesary stuff
  • Loading branch information
ewokswagger authored Dec 12, 2024
1 parent 9c3e4f7 commit 9db6651
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 9 deletions.
18 changes: 14 additions & 4 deletions Content.Server/DeltaV/Station/Systems/CaptainStateSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,22 @@ public override void Initialize()
{
SubscribeLocalEvent<CaptainStateComponent, PlayerJobAddedEvent>(OnPlayerJobAdded);
SubscribeLocalEvent<CaptainStateComponent, PlayerJobsRemovedEvent>(OnPlayerJobsRemoved);
SubscribeLocalEvent<CaptainStateComponent, ComponentInit>(OnInit);
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 = a, true);
Subs.CVar(_cfg, DCCVars.RequestAcoDelay, a => _acoDelay = 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)
{
// There is some weird persistince issues this will hopefully fix
ent.Comp.IsACORequestActive = false;
ent.Comp.IsAAInPlay = false;
ent.Comp.HasCaptain = false;
}

public override void Update(float frameTime)
{
base.Update(frameTime);
Expand Down Expand Up @@ -72,7 +81,7 @@ private void OnPlayerJobsRemoved(Entity<CaptainStateComponent> ent, ref PlayerJo
{
_chat.DispatchStationAnnouncement(
ent,
Loc.GetString(ent.Comp.ACORequestNoAAMessage, ("minutes", _aaDelay.TotalMinutes)),
Loc.GetString(ent.Comp.ACORequestNoAAMessage),
colorOverride: Color.Gold);

ent.Comp.IsACORequestActive = true;
Expand All @@ -90,7 +99,8 @@ private void HandleHasCaptain(Entity<CaptainStateComponent?> station, CaptainSta
if (!captainState.IsACORequestActive)
return;

_chat.DispatchStationAnnouncement(station,
_chat.DispatchStationAnnouncement(
station,
Loc.GetString(captainState.RevokeACOMessage),
colorOverride: Color.Gold);

Expand Down
8 changes: 4 additions & 4 deletions Content.Shared/DeltaV/CCVars/DCCVars.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ public sealed class DCCVars
/// <summary>
/// How long with no captain before requesting an ACO be elected.
/// </summary>
public static readonly CVarDef<TimeSpan> RequestAcoDelay =
CVarDef.Create("game.request_aco_delay", TimeSpan.FromMinutes(15), CVar.SERVERONLY | CVar.ARCHIVE);
public static readonly CVarDef<float> RequestAcoDelay =
CVarDef.Create("game.request_aco_delay_minutes", 15f, CVar.SERVERONLY | CVar.ARCHIVE);

/// <summary>
/// Determines whether an ACO should be requested when the captain leaves during the round,
Expand All @@ -88,8 +88,8 @@ public sealed class DCCVars
/// <summary>
/// How long after an ACO request announcement is made before All Access (AA) should be unlocked.
/// </summary>
public static readonly CVarDef<TimeSpan> AutoUnlockAllAccessDelay =
CVarDef.Create("game.auto_unlock_aa_delay", TimeSpan.FromMinutes(5), CVar.SERVERONLY | CVar.ARCHIVE);
public static readonly CVarDef<float> AutoUnlockAllAccessDelay =
CVarDef.Create("game.auto_unlock_aa_delay_minutes", 5f, CVar.SERVERONLY | CVar.ARCHIVE);

/*
* Misc.
Expand Down
8 changes: 7 additions & 1 deletion Resources/ConfigPresets/Build/debug.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
[events]
[events]
# Annoying
enabled = false

[game]
# Easier testing
request_aco_delay_minutes = 1
auto_unlock_aa_delay_minutes = 1
auto_unlock_aa_enabled = true

[shuttle]
auto_call_time = 0

0 comments on commit 9db6651

Please sign in to comment.