Skip to content
This repository has been archived by the owner on Nov 1, 2024. It is now read-only.

Commit

Permalink
Cvar cleanups (new-frontiers-14#2325)
Browse files Browse the repository at this point in the history
* Update CCVars.cs

* CVAR Cleanups

* Update CCVars.cs

* NFCCVars Fixup

* Update CCVars.cs

* Tips

* touch up the tips

* Revert expedition_cooldown change, frontier cmnts

* Bluespace crate generation param

---------

Co-authored-by: Whatstone <[email protected]>
  • Loading branch information
dvir001 and whatston3 authored Oct 29, 2024
1 parent 657e9bc commit 7a833ed
Show file tree
Hide file tree
Showing 13 changed files with 277 additions and 261 deletions.
3 changes: 2 additions & 1 deletion Content.Client/Salvage/UI/SalvageExpeditionWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Content.Client.Stylesheets;
using Content.Client.UserInterface.Controls;
using Content.Shared.CCVar;
using Content.Shared._NF.CCVar; // Frontier
using Content.Shared.Parallax.Biomes;
using Content.Shared.Salvage;
using Content.Shared.Salvage.Expeditions;
Expand Down Expand Up @@ -303,7 +304,7 @@ protected override void FrameUpdate(FrameEventArgs args)
else
{
var cooldown = _cooldown
? TimeSpan.FromSeconds(_cfgManager.GetCVar(CCVars.SalvageExpeditionFailedCooldown))
? TimeSpan.FromSeconds(_cfgManager.GetCVar(NFCCVars.SalvageExpeditionFailedCooldown))
: TimeSpan.FromSeconds(_cfgManager.GetCVar(CCVars.SalvageExpeditionCooldown));

NextOfferBar.Value = 1f - (float) (remaining / cooldown);
Expand Down
5 changes: 3 additions & 2 deletions Content.Server/Connection/ConnectionManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Content.Server.GameTicking;
using Content.Server.Preferences.Managers;
using Content.Shared.CCVar;
using Content.Shared._NF.CCVar; // Frontier
using Content.Shared.GameTicking;
using Content.Shared.Players.PlayTimeTracking;
using Robust.Server.Player;
Expand Down Expand Up @@ -322,9 +323,9 @@ session.Status is SessionStatus.Connected or SessionStatus.InGame
//This is our little chunk that serves as a dAuth. It takes in a comma seperated list of IP:PORT, and chekcs
//the requesting player against the list of players logged in to other servers. It is intended to be failsafe.
//In the case of Admins, it shares the same bypass setting as the soft_max_player_limit
if (!_cfg.GetCVar(CCVars.AllowMultiConnect) && !adminBypass)
if (!_cfg.GetCVar(NFCCVars.AllowMultiConnect) && !adminBypass)
{
var serverListString = _cfg.GetCVar(CCVars.ServerAuthList);
var serverListString = _cfg.GetCVar(NFCCVars.ServerAuthList);
var serverList = serverListString.Split(",");
foreach (var server in serverList)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Text.Json;
using System.Text.Json.Serialization;
using Content.Shared.CCVar;
using Content.Shared._NF.CCVar; // Frontier
using Content.Server.Maps;
using Content.Shared.GameTicking;
using Robust.Shared;
Expand Down Expand Up @@ -33,9 +34,9 @@ public override void Initialize()
SubscribeLocalEvent<RoundStartedEvent>(OnRoundStarted);
SubscribeLocalEvent<RoundEndedEvent>(OnRoundEnded);

_config.OnValueChanged(CCVars.DiscordRoundWebhook, value => _webhookUrl = value, true);
_config.OnValueChanged(CCVars.DiscordRoundRoleId, value => _roleId = value, true);
_config.OnValueChanged(CCVars.DiscordRoundStartOnly, value => _roundStartOnly = value, true);
_config.OnValueChanged(NFCCVars.DiscordRoundWebhook, value => _webhookUrl = value, true); // Frontier: namespaced CVar
_config.OnValueChanged(NFCCVars.DiscordRoundRoleId, value => _roleId = value, true); // Frontier: namespaced CVar
_config.OnValueChanged(NFCCVars.DiscordRoundStartOnly, value => _roundStartOnly = value, true); // Frontier: namespaced CVar
_config.OnValueChanged(CVars.GameHostName, OnServerNameChanged, true);

_sawmill = IoCManager.Resolve<ILogManager>().GetSawmill("notifications");
Expand Down
6 changes: 4 additions & 2 deletions Content.Server/Salvage/SalvageSystem.Expeditions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ private void InitializeExpeditions()
SubscribeLocalEvent<SalvageStructureComponent, ExaminedEvent>(OnStructureExamine);

Subs.CVar(_configurationManager, CCVars.SalvageExpeditionCooldown, SetCooldownChange, true); // Frontier
Subs.CVar(_configurationManager, CCVars.SalvageExpeditionFailedCooldown, SetFailedCooldownChange, true); // Frontier
Subs.CVar(_configurationManager, NFCCVars.SalvageExpeditionFailedCooldown, SetFailedCooldownChange, true); // Frontier
}

private void OnExpeditionGetState(EntityUid uid, SalvageExpeditionComponent component, ref ComponentGetState args)
Expand All @@ -74,11 +74,13 @@ private void OnExpeditionGetState(EntityUid uid, SalvageExpeditionComponent comp
};
}

// Frontier
private void ShutdownExpeditions()
{
_configurationManager.UnsubValueChanged(CCVars.SalvageExpeditionCooldown, SetCooldownChange);
_configurationManager.UnsubValueChanged(CCVars.SalvageExpeditionFailedCooldown, SetFailedCooldownChange);
_configurationManager.UnsubValueChanged(NFCCVars.SalvageExpeditionFailedCooldown, SetFailedCooldownChange);
}
// End Frontier

private void SetCooldownChange(float obj)
{
Expand Down
7 changes: 4 additions & 3 deletions Content.Server/Shipyard/Systems/ShipyardSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using Robust.Server.Maps;
using Robust.Shared.Map;
using Content.Shared.CCVar;
using Content.Shared._NF.CCVar;
using Robust.Shared.Configuration;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
Expand Down Expand Up @@ -62,8 +63,8 @@ public struct ShipyardSaleResult
public override void Initialize()
{
base.Initialize();
_enabled = _configManager.GetCVar(CCVars.Shipyard);
_configManager.OnValueChanged(CCVars.Shipyard, SetShipyardEnabled, true);
_enabled = _configManager.GetCVar(NFCCVars.Shipyard);
_configManager.OnValueChanged(NFCCVars.Shipyard, SetShipyardEnabled, true);
_sawmill = Logger.GetSawmill("shipyard");

SubscribeLocalEvent<ShipyardConsoleComponent, ComponentStartup>(OnShipyardStartup);
Expand All @@ -77,7 +78,7 @@ public override void Initialize()
}
public override void Shutdown()
{
_configManager.UnsubValueChanged(CCVars.Shipyard, SetShipyardEnabled);
_configManager.UnsubValueChanged(NFCCVars.Shipyard, SetShipyardEnabled);
}
private void OnShipyardStartup(EntityUid uid, ShipyardConsoleComponent component, ComponentStartup args)
{
Expand Down
2 changes: 1 addition & 1 deletion Content.Server/_NF/GameRule/NfAdventureRuleSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ private void AddStationCoordsToSet(Vector2 coords)
private async Task ReportRound(string message, int color = 0x77DDE7)
{
Logger.InfoS("discord", message);
String webhookUrl = _configurationManager.GetCVar(CCVars.DiscordLeaderboardWebhook);
String webhookUrl = _configurationManager.GetCVar(NFCCVars.DiscordLeaderboardWebhook);
if (webhookUrl == string.Empty)
return;

Expand Down
4 changes: 2 additions & 2 deletions Content.Server/_NF/StationEvents/Events/BluespaceCargoRule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
using Robust.Shared.Configuration;
using Content.Server.Atmos.EntitySystems;
using Content.Shared.GameTicking.Components;
using Content.Shared.CCVar;
using Content.Shared._NF.CCVar;

namespace Content.Server.StationEvents.Events;

Expand Down Expand Up @@ -53,7 +53,7 @@ public void SpawnOnRandomGridLocation(EntityUid grid, string toSpawn, string toS
var xform = Transform(grid);

var targetCoords = xform.Coordinates;
var gridBounds = gridComp.LocalAABB.Scale(_configuration.GetCVar(CCVars.CargoGenerationGridBoundsScale));
var gridBounds = gridComp.LocalAABB.Scale(_configuration.GetCVar(NFCCVars.CrateGenerationGridBoundsScale));

for (var i = 0; i < 25; i++)
{
Expand Down
Loading

0 comments on commit 7a833ed

Please sign in to comment.