Pow3r: stage 1 (#4208)

Co-authored-by: 20kdc <asdd2808@gmail.com>
This commit is contained in:
Pieter-Jan Briers
2021-07-04 18:11:52 +02:00
committed by GitHub
parent ea60a81fdf
commit 103bc19508
212 changed files with 8584 additions and 4426 deletions

View File

@@ -6,9 +6,10 @@ using System.Diagnostics.CodeAnalysis;
using System.Threading;
using Content.Server.Notification;
using Content.Server.Power.Components;
using Content.Server.Power.EntitySystems;
using Content.Server.UserInterface;
using Content.Server.VendingMachines;
using Content.Server.Wires.Components;
using Content.Server.WireHacking;
using Content.Shared.ActionBlocker;
using Content.Shared.Interaction;
using Content.Shared.Interaction.Events;
@@ -47,7 +48,7 @@ namespace Content.Server.ParticleAccelerator.Components
/// <summary>
/// Power receiver for the control console itself.
/// </summary>
[ViewVariables] private PowerReceiverComponent _powerReceiverComponent = default!;
[ViewVariables] private ApcPowerReceiverComponent _apcPowerReceiverComponent = default!;
[ViewVariables] private ParticleAcceleratorFuelChamberComponent? _partFuelChamber;
[ViewVariables] private ParticleAcceleratorEndCapComponent? _partEndCap;
@@ -88,7 +89,7 @@ namespace Content.Server.ParticleAccelerator.Components
[ViewVariables(VVAccess.ReadWrite)] [DataField("powerDrawBase")] private int _powerDrawBase = 500;
[ViewVariables(VVAccess.ReadWrite)] [DataField("powerDrawMult")] private int _powerDrawMult = 1500;
[ViewVariables] private bool ConsolePowered => _powerReceiverComponent?.Powered ?? true;
[ViewVariables] private bool ConsolePowered => _apcPowerReceiverComponent?.Powered ?? true;
public ParticleAcceleratorControlBoxComponent()
{
@@ -107,9 +108,9 @@ namespace Content.Server.ParticleAccelerator.Components
UserInterface.OnReceiveMessage += UserInterfaceOnOnReceiveMessage;
}
Owner.EnsureComponent(out _powerReceiverComponent);
Owner.EnsureComponent(out _apcPowerReceiverComponent);
_powerReceiverComponent!.Load = 250;
_apcPowerReceiverComponent!.Load = 250;
}
public override void HandleMessage(ComponentMessage message, IComponent? component)
@@ -189,8 +190,8 @@ namespace Content.Server.ParticleAccelerator.Components
public void UpdateUI()
{
var draw = 0;
var receive = 0;
var draw = 0f;
var receive = 0f;
if (_isEnabled)
{
@@ -202,8 +203,8 @@ namespace Content.Server.ParticleAccelerator.Components
_isAssembled,
_isEnabled,
_selectedStrength,
draw,
receive,
(int) draw,
(int) receive,
_partEmitterLeft != null,
_partEmitterCenter != null,
_partEmitterRight != null,
@@ -577,7 +578,7 @@ namespace Content.Server.ParticleAccelerator.Components
if (Owner.TryGetComponent(out AppearanceComponent? appearance))
{
appearance.SetData(ParticleAcceleratorVisuals.VisualState,
_powerReceiverComponent!.Powered
_apcPowerReceiverComponent!.Powered
? (ParticleAcceleratorVisualState) _selectedStrength
: ParticleAcceleratorVisualState.Unpowered);
}
@@ -645,7 +646,7 @@ namespace Content.Server.ParticleAccelerator.Components
} * _powerDrawMult + _powerDrawBase;
}
public void PowerBoxReceivedChanged(object? sender, ReceivedPowerChangedEventArgs eventArgs)
public void PowerBoxReceivedChanged(PowerConsumerReceivedChanged eventArgs)
{
DebugTools.Assert(_isAssembled);