Skip to content

Commit

Permalink
CCVar Cleanup (new-frontiers-14#1900)
Browse files Browse the repository at this point in the history
* CleanUp

* Update CCVars.cs

* fixup

* Small Change

* Fix GhostUIController ref, CCVars.cs->NFCCVars.cs

---------

Co-authored-by: Whatstone <[email protected]>
  • Loading branch information
dvir001 and whatston3 authored Aug 23, 2024
1 parent e14202d commit ff8ad62
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using Content.Client.UserInterface.Systems.Gameplay;
using Content.Client.UserInterface.Systems.Ghost.Widgets;
using Content.Shared.CCVar;
using Content.Shared.NF14.CCVar;
using Content.Shared._NF.CCVar; // Frontier
using Content.Shared.Ghost;
using Robust.Client.Console;
using Robust.Client.UserInterface;
Expand Down Expand Up @@ -76,8 +76,8 @@ public void UpdateGui()
Gui.Visible = _system?.IsGhost ?? false;
Gui.Update(_system?.AvailableGhostRoleCount, _system?.Player?.CanReturnToBody,
_system?.Player?.TimeOfDeath,
_cfg.GetCVar(NF14CVars.RespawnTime),
_canUncryo && _cfg.GetCVar(NF14CVars.CryoReturnEnabled));
_cfg.GetCVar(NFCCVars.RespawnTime), // Frontier
_canUncryo && _cfg.GetCVar(NFCCVars.CryoReturnEnabled)); // Frontier
}

private void UpdateRespawn(TimeSpan? timeOfDeath)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Timing;
using Robust.Shared.Configuration;
using Content.Shared.CCVar;
using Content.Shared.NF14.CCVar;
using Content.Shared._NF.CCVar; // Frontier

namespace Content.Client.UserInterface.Systems.Ghost.Widgets;

Expand Down Expand Up @@ -58,7 +57,7 @@ public void UpdateRespawn(TimeSpan? todd)
if (todd != null)
{
_timeOfDeath = todd;
_minTimeToRespawn = _configurationManager.GetCVar(NF14CVars.RespawnTime);
_minTimeToRespawn = _configurationManager.GetCVar(NFCCVars.RespawnTime); // Frontier
}
}

Expand Down
6 changes: 3 additions & 3 deletions Content.Server/_NF/Commands/GhostRespawnCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using Content.Shared.CCVar;
using Content.Shared.Ghost;
using Content.Shared.Mind;
using Content.Shared.NF14.CCVar;
using Content.Shared._NF.CCVar;
using Content.Shared.Roles;
using Robust.Server.Player;
using Robust.Shared.Configuration;
Expand All @@ -27,7 +27,7 @@ public sealed class GhostRespawnCommand : IConsoleCommand

public void Execute(IConsoleShell shell, string argStr, string[] args)
{
if (!_configurationManager.GetCVar(NF14CVars.RespawnEnabled))
if (!_configurationManager.GetCVar(NFCCVars.RespawnEnabled))
{
shell.WriteLine("Respawning is disabled, ask an admin to respawn you.");
return;
Expand Down Expand Up @@ -58,7 +58,7 @@ public void Execute(IConsoleShell shell, string argStr, string[] args)
return;
}
var time = (_gameTiming.CurTime - ghost.TimeOfDeath);
var respawnTime = _configurationManager.GetCVar(NF14CVars.RespawnTime);
var respawnTime = _configurationManager.GetCVar(NFCCVars.RespawnTime);

if (respawnTime > time.TotalSeconds)
{
Expand Down
4 changes: 2 additions & 2 deletions Content.Server/_NF/CryoSleep/CryoSleepSystem.Returning.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using Content.Shared.Database;
using Content.Shared.Ghost;
using Content.Shared.Mind;
using Content.Shared.NF14.CCVar;
using Content.Shared._NF.CCVar;
using Content.Shared.Players;
using Robust.Shared.Configuration;
using Robust.Shared.Network;
Expand Down Expand Up @@ -48,7 +48,7 @@ public void OnGetStatusMessage(GetStatusMessage message, EntitySessionEventArgs
/// </summary>
public ReturnToBodyStatus TryReturnToBody(MindComponent mind, bool force = false)
{
if (!_configurationManager.GetCVar(NF14CVars.CryoReturnEnabled))
if (!_configurationManager.GetCVar(NFCCVars.CryoReturnEnabled))
return ReturnToBodyStatus.Disabled;

var id = mind.UserId;
Expand Down
4 changes: 2 additions & 2 deletions Content.Server/_NF/CryoSleep/CryoSleepSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
using Content.Shared.Mind.Components;
using Content.Shared.Mobs.Components;
using Content.Shared.Mobs.Systems;
using Content.Shared.NF14.CCVar;
using Content.Shared._NF.CCVar;
using Content.Shared.Popups;
using Content.Shared.Verbs;
using Robust.Server.Containers;
Expand Down Expand Up @@ -283,7 +283,7 @@ public void CryoStoreBody(EntityUid bodyId, EntityUid cryopod)
_doAfter.Cancel(cryo.CryosleepDoAfter);

// Start a timer. When it ends, the body needs to be deleted.
Timer.Spawn(TimeSpan.FromSeconds(_configurationManager.GetCVar(NF14CVars.CryoExpirationTime)), () =>
Timer.Spawn(TimeSpan.FromSeconds(_configurationManager.GetCVar(NFCCVars.CryoExpirationTime)), () =>
{
if (id != null)
ResetCryosleepState(id.Value);
Expand Down
14 changes: 7 additions & 7 deletions Content.Server/_NF/GameRule/NfAdventureRuleSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
using Content.Server.Maps;
using Content.Server.Station.Systems;
using Content.Shared.CCVar;
using Content.Shared.NF14.CCVar;
using Content.Shared._NF.CCVar; // Frontier
using Robust.Shared.Configuration;
using Robust.Shared.Physics.Components;
using Content.Server.Shuttles.Components;
Expand Down Expand Up @@ -125,7 +125,7 @@ protected override void Started(EntityUid uid, AdventureRuleComponent component,
{
_mapId = GameTicker.DefaultMap;

_distanceOffset = _configurationManager.GetCVar(NF14CVars.POIDistanceModifier);
_distanceOffset = _configurationManager.GetCVar(NFCCVars.POIDistanceModifier);
_stationCoords = new List<Vector2>();

//First, we need to grab the list and sort it into its respective spawning logics
Expand Down Expand Up @@ -194,7 +194,7 @@ private void GenerateDepots(List<PointOfInterestPrototype> depotPrototypes, out
//by the number of depots set in our corresponding cvar

depotStations = new List<EntityUid>();
var depotCount = _configurationManager.GetCVar(NF14CVars.CargoDepots);
var depotCount = _configurationManager.GetCVar(NFCCVars.CargoDepots);
var rotation = 2 * Math.PI / depotCount;
var rotationOffset = _random.NextAngle() / depotCount;

Expand Down Expand Up @@ -226,7 +226,7 @@ private void GenerateMarkets(List<PointOfInterestPrototype> marketPrototypes, ou
//ideal world

marketStations = new List<EntityUid>();
var marketCount = _configurationManager.GetCVar(NF14CVars.MarketStations);
var marketCount = _configurationManager.GetCVar(NFCCVars.MarketStations);
_random.Shuffle(marketPrototypes);
int marketsAdded = 0;
foreach (var proto in marketPrototypes)
Expand All @@ -252,7 +252,7 @@ private void GenerateOptionals(List<PointOfInterestPrototype> optionalPrototypes
//and most RP places. This will essentially put them all into a pool to pull from, and still does not use the RNG function.

optionalStations = new List<EntityUid>();
var optionalCount = _configurationManager.GetCVar(NF14CVars.OptionalStations);
var optionalCount = _configurationManager.GetCVar(NFCCVars.OptionalStations);
_random.Shuffle(optionalPrototypes);
int optionalsAdded = 0;
foreach (var proto in optionalPrototypes)
Expand Down Expand Up @@ -372,8 +372,8 @@ private bool TrySpawnPoiGrid(PointOfInterestPrototype proto, Vector2 offset, out

private Vector2 GetRandomPOICoord(float unscaledMinRange, float unscaledMaxRange, bool scaleRange)
{
int numRetries = int.Max(_configurationManager.GetCVar(NF14CVars.POIPlacementRetries), 0);
float minDistance = float.Max(_configurationManager.GetCVar(NF14CVars.MinPOIDistance), 0); // Constant at the end to avoid NaN weirdness
int numRetries = int.Max(_configurationManager.GetCVar(NFCCVars.POIPlacementRetries), 0);
float minDistance = float.Max(_configurationManager.GetCVar(NFCCVars.MinPOIDistance), 0); // Constant at the end to avoid NaN weirdness

Vector2 coords = _random.NextVector2(unscaledMinRange, unscaledMaxRange);
if (scaleRange)
Expand Down
22 changes: 11 additions & 11 deletions Content.Server/_NF/PublicTransit/PublicTransitSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using Content.Server.Shuttles.Events;
using Content.Server.Shuttles.Systems;
using Content.Shared.GameTicking;
using Content.Shared.NF14.CCVar;
using Content.Shared._NF.CCVar;
using Content.Shared.Shuttles.Components;
using Content.Shared.Tiles;
using Robust.Server.GameObjects;
Expand Down Expand Up @@ -49,12 +49,12 @@ public override void Initialize()
SubscribeLocalEvent<TransitShuttleComponent, FTLTagEvent>(OnShuttleTag);
SubscribeLocalEvent<RoundStartedEvent>(OnRoundStart);

Enabled = _cfgManager.GetCVar(NF14CVars.PublicTransit);
FlyTime = _cfgManager.GetCVar(NF14CVars.PublicTransitFlyTime);
Enabled = _cfgManager.GetCVar(NFCCVars.PublicTransit);
FlyTime = _cfgManager.GetCVar(NFCCVars.PublicTransitFlyTime);
Counter = 0;
StationList.Clear();
_cfgManager.OnValueChanged(NF14CVars.PublicTransit, SetTransit);
_cfgManager.OnValueChanged(NF14CVars.PublicTransitFlyTime, SetFly);
_cfgManager.OnValueChanged(NFCCVars.PublicTransit, SetTransit);
_cfgManager.OnValueChanged(NFCCVars.PublicTransitFlyTime, SetFly);
}

public void OnRoundStart(RoundStartedEvent args)
Expand All @@ -67,8 +67,8 @@ public void OnRoundStart(RoundStartedEvent args)
public override void Shutdown()
{
base.Shutdown();
_cfgManager.UnsubValueChanged(NF14CVars.PublicTransitFlyTime, SetFly);
_cfgManager.UnsubValueChanged(NF14CVars.PublicTransit, SetTransit);
_cfgManager.UnsubValueChanged(NFCCVars.PublicTransitFlyTime, SetFly);
_cfgManager.UnsubValueChanged(NFCCVars.PublicTransit, SetTransit);
}


Expand Down Expand Up @@ -136,7 +136,7 @@ private void OnShuttleArrival(EntityUid uid, TransitShuttleComponent comp, ref F
var destinationString = metadata.EntityName;

_chat.TrySendInGameICMessage(consoleUid, Loc.GetString("public-transit-arrival",
("destination", destinationString), ("waittime", _cfgManager.GetCVar(NF14CVars.PublicTransitWaitTime))),
("destination", destinationString), ("waittime", _cfgManager.GetCVar(NFCCVars.PublicTransitWaitTime))),
InGameICChatType.Speak, ChatTransmitRange.HideChat, hideLog: true, checkRadioPrefix: false,
ignoreActionBlocker: true);
}
Expand Down Expand Up @@ -206,7 +206,7 @@ public override void Update(float frameTime)
if (TryGetNextStation(out var nextStation) && nextStation is { Valid: true } destination)
comp.NextStation = destination;

comp.NextTransfer = curTime + TimeSpan.FromSeconds(FlyTime + _cfgManager.GetCVar(NF14CVars.PublicTransitWaitTime));
comp.NextTransfer = curTime + TimeSpan.FromSeconds(FlyTime + _cfgManager.GetCVar(NFCCVars.PublicTransitWaitTime));
}
}

Expand Down Expand Up @@ -261,7 +261,7 @@ private void SetupPublicTransit()

// Spawn the bus onto a dummy map
var dummyMap = _mapManager.CreateMap();
var busMap = _cfgManager.GetCVar(NF14CVars.PublicTransitBusMap);
var busMap = _cfgManager.GetCVar(NFCCVars.PublicTransitBusMap);
if (_loader.TryLoad(dummyMap, busMap, out var shuttleUids))
{
var shuttleComp = Comp<ShuttleComponent>(shuttleUids[0]);
Expand All @@ -274,7 +274,7 @@ private void SetupPublicTransit()
//we set up a default in case the second time we call it fails for some reason
transitComp.NextStation = destination;
_shuttles.FTLToDock(shuttleUids[0], shuttleComp, destination, hyperspaceTime: 5f);
transitComp.NextTransfer = _timing.CurTime + TimeSpan.FromSeconds(_cfgManager.GetCVar(NF14CVars.PublicTransitWaitTime));
transitComp.NextTransfer = _timing.CurTime + TimeSpan.FromSeconds(_cfgManager.GetCVar(NFCCVars.PublicTransitWaitTime));

//since the initial cached value of the next station is actually the one we are 'starting' from, we need to run the
//bus stop list code one more time so that our first trip isnt just Frontier - Frontier
Expand Down
2 changes: 1 addition & 1 deletion Content.Shared/DeltaV/CCVars/DCCVars.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Robust.Shared.Configuration;
using Robust.Shared.Configuration;

namespace Content.Shared.DeltaV.CCVars;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using Robust.Shared.Configuration;

namespace Content.Shared.NF14.CCVar;
namespace Content.Shared._NF.CCVar;

[CVarDefs]
public sealed class NF14CVars
public sealed class NFCCVars
{
/// <summary>
/// Whether or not respawning is enabled.
Expand Down

0 comments on commit ff8ad62

Please sign in to comment.