Add CVar to disable pow3r parallel processing (#28488)
* Add CVar to disable pow3r parallel processing * Cache CVar value * Fix pointyhat * Move all CVar-ing to Content.Server
This commit is contained in:
@@ -3,9 +3,11 @@ using Content.Server.NodeContainer.EntitySystems;
|
||||
using Content.Server.Power.Components;
|
||||
using Content.Server.Power.NodeGroups;
|
||||
using Content.Server.Power.Pow3r;
|
||||
using Content.Shared.CCVar;
|
||||
using Content.Shared.Power;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Configuration;
|
||||
using Robust.Shared.Threading;
|
||||
|
||||
namespace Content.Server.Power.EntitySystems
|
||||
@@ -18,6 +20,7 @@ namespace Content.Server.Power.EntitySystems
|
||||
{
|
||||
[Dependency] private readonly AppearanceSystem _appearance = default!;
|
||||
[Dependency] private readonly PowerNetConnectorSystem _powerNetConnector = default!;
|
||||
[Dependency] private readonly IConfigurationManager _cfg = default!;
|
||||
[Dependency] private readonly IParallelManager _parMan = default!;
|
||||
[Dependency] private readonly PowerReceiverSystem _powerReceiver = default!;
|
||||
|
||||
@@ -25,13 +28,14 @@ namespace Content.Server.Power.EntitySystems
|
||||
private readonly HashSet<PowerNet> _powerNetReconnectQueue = new();
|
||||
private readonly HashSet<ApcNet> _apcNetReconnectQueue = new();
|
||||
|
||||
private readonly BatteryRampPegSolver _solver = new();
|
||||
private BatteryRampPegSolver _solver = new();
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
UpdatesAfter.Add(typeof(NodeGroupSystem));
|
||||
_solver = new(_cfg.GetCVar(CCVars.DebugPow3rDisableParallel));
|
||||
|
||||
SubscribeLocalEvent<ApcPowerReceiverComponent, ComponentInit>(ApcPowerReceiverInit);
|
||||
SubscribeLocalEvent<ApcPowerReceiverComponent, ComponentShutdown>(ApcPowerReceiverShutdown);
|
||||
@@ -53,6 +57,13 @@ namespace Content.Server.Power.EntitySystems
|
||||
SubscribeLocalEvent<PowerSupplierComponent, ComponentShutdown>(PowerSupplierShutdown);
|
||||
SubscribeLocalEvent<PowerSupplierComponent, EntityPausedEvent>(PowerSupplierPaused);
|
||||
SubscribeLocalEvent<PowerSupplierComponent, EntityUnpausedEvent>(PowerSupplierUnpaused);
|
||||
|
||||
Subs.CVar(_cfg, CCVars.DebugPow3rDisableParallel, DebugPow3rDisableParallelChanged);
|
||||
}
|
||||
|
||||
private void DebugPow3rDisableParallelChanged(bool val)
|
||||
{
|
||||
_solver = new(val);
|
||||
}
|
||||
|
||||
private void ApcPowerReceiverInit(EntityUid uid, ApcPowerReceiverComponent component, ComponentInit args)
|
||||
|
||||
Reference in New Issue
Block a user