Remove PA component references (#15252)
This commit is contained in:
@@ -7,15 +7,15 @@ using Content.Server.Power.Components;
|
|||||||
using Content.Server.Power.EntitySystems;
|
using Content.Server.Power.EntitySystems;
|
||||||
using Content.Server.UserInterface;
|
using Content.Server.UserInterface;
|
||||||
using Content.Shared.Database;
|
using Content.Shared.Database;
|
||||||
// using Content.Server.WireHacking;
|
|
||||||
using Content.Shared.Singularity.Components;
|
using Content.Shared.Singularity.Components;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Server.Player;
|
using Robust.Server.Player;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Map.Components;
|
using Robust.Shared.Map.Components;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
// using static Content.Shared.Wires.SharedWiresComponent;
|
|
||||||
using Timer = Robust.Shared.Timing.Timer;
|
using Timer = Robust.Shared.Timing.Timer;
|
||||||
|
// using Content.Server.WireHacking;
|
||||||
|
// using static Content.Shared.Wires.SharedWiresComponent;
|
||||||
|
|
||||||
namespace Content.Server.ParticleAccelerator.Components
|
namespace Content.Server.ParticleAccelerator.Components
|
||||||
{
|
{
|
||||||
@@ -191,7 +191,8 @@ namespace Content.Server.ParticleAccelerator.Components
|
|||||||
Master = null;
|
Master = null;
|
||||||
foreach (var part in AllParts())
|
foreach (var part in AllParts())
|
||||||
{
|
{
|
||||||
part.Master = null;
|
if (_entMan.TryGetComponent(part.Owner, out ParticleAcceleratorPartComponent? paPart))
|
||||||
|
paPart.Master = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
base.OnRemove();
|
base.OnRemove();
|
||||||
@@ -322,7 +323,8 @@ namespace Content.Server.ParticleAccelerator.Components
|
|||||||
SwitchOff(playerSession, true);
|
SwitchOff(playerSession, true);
|
||||||
foreach (var part in AllParts())
|
foreach (var part in AllParts())
|
||||||
{
|
{
|
||||||
part.Master = null;
|
if (_entMan.TryGetComponent(part.Owner, out ParticleAcceleratorPartComponent? paPart))
|
||||||
|
paPart.Master = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
_isAssembled = false;
|
_isAssembled = false;
|
||||||
@@ -395,7 +397,8 @@ namespace Content.Server.ParticleAccelerator.Components
|
|||||||
|
|
||||||
foreach (var part in AllParts())
|
foreach (var part in AllParts())
|
||||||
{
|
{
|
||||||
part.Master = this;
|
if (_entMan.TryGetComponent(part.Owner, out ParticleAcceleratorPartComponent? paPart))
|
||||||
|
paPart.Master = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateUI();
|
UpdateUI();
|
||||||
@@ -408,7 +411,7 @@ namespace Content.Server.ParticleAccelerator.Components
|
|||||||
}
|
}
|
||||||
|
|
||||||
private bool ScanPart<T>(Vector2i offset, [NotNullWhen(true)] out T? part)
|
private bool ScanPart<T>(Vector2i offset, [NotNullWhen(true)] out T? part)
|
||||||
where T : ParticleAcceleratorPartComponent
|
where T : Component
|
||||||
{
|
{
|
||||||
var xform = _entMan.GetComponent<TransformComponent>(Owner);
|
var xform = _entMan.GetComponent<TransformComponent>(Owner);
|
||||||
if (!_mapManager.TryGetGrid(xform.GridUid, out var grid))
|
if (!_mapManager.TryGetGrid(xform.GridUid, out var grid))
|
||||||
@@ -430,7 +433,7 @@ namespace Content.Server.ParticleAccelerator.Components
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerable<ParticleAcceleratorPartComponent> AllParts()
|
private IEnumerable<Component> AllParts()
|
||||||
{
|
{
|
||||||
if (_partFuelChamber != null)
|
if (_partFuelChamber != null)
|
||||||
yield return _partFuelChamber;
|
yield return _partFuelChamber;
|
||||||
@@ -668,7 +671,7 @@ namespace Content.Server.ParticleAccelerator.Components
|
|||||||
//no endcap because it has no powerlevel-sprites
|
//no endcap because it has no powerlevel-sprites
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdatePartVisualState(ParticleAcceleratorPartComponent? component)
|
private void UpdatePartVisualState(Component? component)
|
||||||
{
|
{
|
||||||
if (component == null || !_entMan.TryGetComponent<AppearanceComponent?>(component.Owner, out var appearanceComponent))
|
if (component == null || !_entMan.TryGetComponent<AppearanceComponent?>(component.Owner, out var appearanceComponent))
|
||||||
{
|
{
|
||||||
@@ -681,12 +684,6 @@ namespace Content.Server.ParticleAccelerator.Components
|
|||||||
appearanceComponent.SetData(ParticleAcceleratorVisuals.VisualState, state);
|
appearanceComponent.SetData(ParticleAcceleratorVisuals.VisualState, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Moved()
|
|
||||||
{
|
|
||||||
// We rotate OURSELVES when scanning for parts, so don't actually run rescan on rotate.
|
|
||||||
// That would be silly.
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum ParticleAcceleratorControlBoxWires
|
public enum ParticleAcceleratorControlBoxWires
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -3,8 +3,7 @@
|
|||||||
namespace Content.Server.ParticleAccelerator.Components
|
namespace Content.Server.ParticleAccelerator.Components
|
||||||
{
|
{
|
||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
[ComponentReference(typeof(ParticleAcceleratorPartComponent))]
|
public sealed class ParticleAcceleratorEmitterComponent : Component
|
||||||
public sealed class ParticleAcceleratorEmitterComponent : ParticleAcceleratorPartComponent
|
|
||||||
{
|
{
|
||||||
[DataField("emitterType")]
|
[DataField("emitterType")]
|
||||||
public ParticleAcceleratorEmitterType Type = ParticleAcceleratorEmitterType.Center;
|
public ParticleAcceleratorEmitterType Type = ParticleAcceleratorEmitterType.Center;
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
namespace Content.Server.ParticleAccelerator.Components
|
namespace Content.Server.ParticleAccelerator.Components;
|
||||||
|
|
||||||
|
[RegisterComponent]
|
||||||
|
public sealed class ParticleAcceleratorEndCapComponent : Component
|
||||||
{
|
{
|
||||||
[RegisterComponent]
|
|
||||||
[ComponentReference(typeof(ParticleAcceleratorPartComponent))]
|
|
||||||
public sealed class ParticleAcceleratorEndCapComponent : ParticleAcceleratorPartComponent
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
namespace Content.Server.ParticleAccelerator.Components
|
namespace Content.Server.ParticleAccelerator.Components;
|
||||||
|
|
||||||
|
[RegisterComponent]
|
||||||
|
public sealed class ParticleAcceleratorFuelChamberComponent : Component
|
||||||
{
|
{
|
||||||
[RegisterComponent]
|
|
||||||
[ComponentReference(typeof(ParticleAcceleratorPartComponent))]
|
|
||||||
public sealed class ParticleAcceleratorFuelChamberComponent : ParticleAcceleratorPartComponent
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
namespace Content.Server.ParticleAccelerator.Components
|
namespace Content.Server.ParticleAccelerator.Components
|
||||||
{
|
{
|
||||||
public abstract class ParticleAcceleratorPartComponent : Component
|
[RegisterComponent]
|
||||||
|
[Virtual]
|
||||||
|
public class ParticleAcceleratorPartComponent : Component
|
||||||
{
|
{
|
||||||
[ViewVariables] public ParticleAcceleratorControlBoxComponent? Master;
|
[ViewVariables] public ParticleAcceleratorControlBoxComponent? Master;
|
||||||
|
|
||||||
@@ -29,7 +31,7 @@ namespace Content.Server.ParticleAccelerator.Components
|
|||||||
Master?.RescanParts();
|
Master?.RescanParts();
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void Moved()
|
public void Moved()
|
||||||
{
|
{
|
||||||
RescanIfPossible();
|
RescanIfPossible();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,18 +1,16 @@
|
|||||||
using Content.Server.Power.Components;
|
using Content.Server.Power.Components;
|
||||||
|
|
||||||
namespace Content.Server.ParticleAccelerator.Components
|
namespace Content.Server.ParticleAccelerator.Components;
|
||||||
|
|
||||||
|
[RegisterComponent]
|
||||||
|
public sealed class ParticleAcceleratorPowerBoxComponent : Component
|
||||||
{
|
{
|
||||||
[RegisterComponent]
|
[ViewVariables] public PowerConsumerComponent? PowerConsumerComponent;
|
||||||
[ComponentReference(typeof(ParticleAcceleratorPartComponent))]
|
|
||||||
public sealed class ParticleAcceleratorPowerBoxComponent : ParticleAcceleratorPartComponent
|
protected override void Initialize()
|
||||||
{
|
{
|
||||||
[ViewVariables] public PowerConsumerComponent? PowerConsumerComponent;
|
base.Initialize();
|
||||||
|
|
||||||
protected override void Initialize()
|
PowerConsumerComponent = Owner.EnsureComponentWarn<PowerConsumerComponent>();
|
||||||
{
|
|
||||||
base.Initialize();
|
|
||||||
|
|
||||||
PowerConsumerComponent = Owner.EnsureComponentWarn<PowerConsumerComponent>();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,12 +10,13 @@ namespace Content.Server.ParticleAccelerator.EntitySystems
|
|||||||
SubscribeLocalEvent<ParticleAcceleratorPowerBoxComponent, PowerConsumerReceivedChanged>(PowerBoxReceivedChanged);
|
SubscribeLocalEvent<ParticleAcceleratorPowerBoxComponent, PowerConsumerReceivedChanged>(PowerBoxReceivedChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void PowerBoxReceivedChanged(
|
private void PowerBoxReceivedChanged(
|
||||||
EntityUid uid,
|
EntityUid uid,
|
||||||
ParticleAcceleratorPowerBoxComponent component,
|
ParticleAcceleratorPowerBoxComponent component,
|
||||||
ref PowerConsumerReceivedChanged args)
|
ref PowerConsumerReceivedChanged args)
|
||||||
{
|
{
|
||||||
component.Master?.PowerBoxReceivedChanged(args);
|
if (TryComp(uid, out ParticleAcceleratorPartComponent? paPart))
|
||||||
|
paPart.Master?.PowerBoxReceivedChanged(args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
visuals:
|
visuals:
|
||||||
- type: ParticleAcceleratorPartVisualizer
|
- type: ParticleAcceleratorPartVisualizer
|
||||||
baseState: unlit
|
baseState: unlit
|
||||||
|
- type: ParticleAcceleratorPart
|
||||||
- type: ParticleAcceleratorEmitter
|
- type: ParticleAcceleratorEmitter
|
||||||
emitterType: Left
|
emitterType: Left
|
||||||
- type: Construction
|
- type: Construction
|
||||||
@@ -45,6 +46,7 @@
|
|||||||
visuals:
|
visuals:
|
||||||
- type: ParticleAcceleratorPartVisualizer
|
- type: ParticleAcceleratorPartVisualizer
|
||||||
baseState: unlit
|
baseState: unlit
|
||||||
|
- type: ParticleAcceleratorPart
|
||||||
- type: ParticleAcceleratorEmitter
|
- type: ParticleAcceleratorEmitter
|
||||||
emitterType: Center
|
emitterType: Center
|
||||||
- type: Construction
|
- type: Construction
|
||||||
@@ -52,7 +54,7 @@
|
|||||||
node: completed
|
node: completed
|
||||||
- type: GuideHelp
|
- type: GuideHelp
|
||||||
guides: [ Singularity, Power ]
|
guides: [ Singularity, Power ]
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
parent: ParticleAcceleratorBase
|
parent: ParticleAcceleratorBase
|
||||||
id: ParticleAcceleratorEmitterRight
|
id: ParticleAcceleratorEmitterRight
|
||||||
@@ -72,6 +74,7 @@
|
|||||||
visuals:
|
visuals:
|
||||||
- type: ParticleAcceleratorPartVisualizer
|
- type: ParticleAcceleratorPartVisualizer
|
||||||
baseState: unlit
|
baseState: unlit
|
||||||
|
- type: ParticleAcceleratorPart
|
||||||
- type: ParticleAcceleratorEmitter
|
- type: ParticleAcceleratorEmitter
|
||||||
emitterType: Right
|
emitterType: Right
|
||||||
- type: Construction
|
- type: Construction
|
||||||
@@ -79,7 +82,7 @@
|
|||||||
node: completed
|
node: completed
|
||||||
- type: GuideHelp
|
- type: GuideHelp
|
||||||
guides: [ Singularity, Power ]
|
guides: [ Singularity, Power ]
|
||||||
|
|
||||||
# Unfinished
|
# Unfinished
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
@@ -137,4 +140,4 @@
|
|||||||
node: start
|
node: start
|
||||||
defaultTarget: completed
|
defaultTarget: completed
|
||||||
- type: GuideHelp
|
- type: GuideHelp
|
||||||
guides: [ Singularity, Power ]
|
guides: [ Singularity, Power ]
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
- type: Sprite
|
- type: Sprite
|
||||||
sprite: Structures/Power/Generation/PA/end_cap.rsi
|
sprite: Structures/Power/Generation/PA/end_cap.rsi
|
||||||
state: capc
|
state: capc
|
||||||
|
- type: ParticleAcceleratorPart
|
||||||
- type: ParticleAcceleratorEndCap
|
- type: ParticleAcceleratorEndCap
|
||||||
- type: Construction
|
- type: Construction
|
||||||
graph: ParticleAcceleratorEndCap
|
graph: ParticleAcceleratorEndCap
|
||||||
@@ -33,4 +34,4 @@
|
|||||||
node: start
|
node: start
|
||||||
defaultTarget: completed
|
defaultTarget: completed
|
||||||
- type: GuideHelp
|
- type: GuideHelp
|
||||||
guides: [ Singularity, Power ]
|
guides: [ Singularity, Power ]
|
||||||
|
|||||||
@@ -17,13 +17,14 @@
|
|||||||
visuals:
|
visuals:
|
||||||
- type: ParticleAcceleratorPartVisualizer
|
- type: ParticleAcceleratorPartVisualizer
|
||||||
baseState: unlit
|
baseState: unlit
|
||||||
|
- type: ParticleAcceleratorPart
|
||||||
- type: ParticleAcceleratorFuelChamber
|
- type: ParticleAcceleratorFuelChamber
|
||||||
- type: Construction
|
- type: Construction
|
||||||
graph: ParticleAcceleratorFuelChamber
|
graph: ParticleAcceleratorFuelChamber
|
||||||
node: completed
|
node: completed
|
||||||
- type: GuideHelp
|
- type: GuideHelp
|
||||||
guides: [ Singularity, Power ]
|
guides: [ Singularity, Power ]
|
||||||
|
|
||||||
# Unfinished
|
# Unfinished
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
@@ -43,4 +44,4 @@
|
|||||||
node: start
|
node: start
|
||||||
defaultTarget: completed
|
defaultTarget: completed
|
||||||
- type: GuideHelp
|
- type: GuideHelp
|
||||||
guides: [ Singularity, Power ]
|
guides: [ Singularity, Power ]
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
visuals:
|
visuals:
|
||||||
- type: ParticleAcceleratorPartVisualizer
|
- type: ParticleAcceleratorPartVisualizer
|
||||||
baseState: unlit
|
baseState: unlit
|
||||||
|
- type: ParticleAcceleratorPart
|
||||||
- type: ParticleAcceleratorPowerBox
|
- type: ParticleAcceleratorPowerBox
|
||||||
- type: PowerConsumer
|
- type: PowerConsumer
|
||||||
voltage: High
|
voltage: High
|
||||||
@@ -49,4 +50,4 @@
|
|||||||
node: start
|
node: start
|
||||||
defaultTarget: completed
|
defaultTarget: completed
|
||||||
- type: GuideHelp
|
- type: GuideHelp
|
||||||
guides: [ Singularity, Power ]
|
guides: [ Singularity, Power ]
|
||||||
|
|||||||
Reference in New Issue
Block a user