using Content.Server.Power.EntitySystems;
using Content.Server.UserInterface;
using Content.Shared.Database;
-// using Content.Server.WireHacking;
using Content.Shared.Singularity.Components;
using Robust.Server.GameObjects;
using Robust.Server.Player;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using Robust.Shared.Utility;
-// using static Content.Shared.Wires.SharedWiresComponent;
using Timer = Robust.Shared.Timing.Timer;
+// using Content.Server.WireHacking;
+// using static Content.Shared.Wires.SharedWiresComponent;
namespace Content.Server.ParticleAccelerator.Components
{
Master = null;
foreach (var part in AllParts())
{
- part.Master = null;
+ if (_entMan.TryGetComponent(part.Owner, out ParticleAcceleratorPartComponent? paPart))
+ paPart.Master = null;
}
base.OnRemove();
SwitchOff(playerSession, true);
foreach (var part in AllParts())
{
- part.Master = null;
+ if (_entMan.TryGetComponent(part.Owner, out ParticleAcceleratorPartComponent? paPart))
+ paPart.Master = null;
}
_isAssembled = false;
foreach (var part in AllParts())
{
- part.Master = this;
+ if (_entMan.TryGetComponent(part.Owner, out ParticleAcceleratorPartComponent? paPart))
+ paPart.Master = this;
}
UpdateUI();
}
private bool ScanPart<T>(Vector2i offset, [NotNullWhen(true)] out T? part)
- where T : ParticleAcceleratorPartComponent
+ where T : Component
{
var xform = _entMan.GetComponent<TransformComponent>(Owner);
if (!_mapManager.TryGetGrid(xform.GridUid, out var grid))
return false;
}
- private IEnumerable<ParticleAcceleratorPartComponent> AllParts()
+ private IEnumerable<Component> AllParts()
{
if (_partFuelChamber != null)
yield return _partFuelChamber;
//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))
{
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
{
/// <summary>
namespace Content.Server.ParticleAccelerator.Components
{
[RegisterComponent]
- [ComponentReference(typeof(ParticleAcceleratorPartComponent))]
- public sealed class ParticleAcceleratorEmitterComponent : ParticleAcceleratorPartComponent
+ public sealed class ParticleAcceleratorEmitterComponent : Component
{
[DataField("emitterType")]
public ParticleAcceleratorEmitterType Type = ParticleAcceleratorEmitterType.Center;
-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
- {
- }
}
-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
- {
- }
}
namespace Content.Server.ParticleAccelerator.Components
{
- public abstract class ParticleAcceleratorPartComponent : Component
+ [RegisterComponent]
+ [Virtual]
+ public class ParticleAcceleratorPartComponent : Component
{
[ViewVariables] public ParticleAcceleratorControlBoxComponent? Master;
Master?.RescanParts();
}
- public virtual void Moved()
+ public void Moved()
{
RescanIfPossible();
}
using Content.Server.Power.Components;
-namespace Content.Server.ParticleAccelerator.Components
+namespace Content.Server.ParticleAccelerator.Components;
+
+[RegisterComponent]
+public sealed class ParticleAcceleratorPowerBoxComponent : Component
{
- [RegisterComponent]
- [ComponentReference(typeof(ParticleAcceleratorPartComponent))]
- public sealed class ParticleAcceleratorPowerBoxComponent : ParticleAcceleratorPartComponent
- {
- [ViewVariables] public PowerConsumerComponent? PowerConsumerComponent;
+ [ViewVariables] public PowerConsumerComponent? PowerConsumerComponent;
- protected override void Initialize()
- {
- base.Initialize();
+ protected override void Initialize()
+ {
+ base.Initialize();
- PowerConsumerComponent = Owner.EnsureComponentWarn<PowerConsumerComponent>();
- }
+ PowerConsumerComponent = Owner.EnsureComponentWarn<PowerConsumerComponent>();
}
}
SubscribeLocalEvent<ParticleAcceleratorPowerBoxComponent, PowerConsumerReceivedChanged>(PowerBoxReceivedChanged);
}
- private static void PowerBoxReceivedChanged(
+ private void PowerBoxReceivedChanged(
EntityUid uid,
ParticleAcceleratorPowerBoxComponent component,
ref PowerConsumerReceivedChanged args)
{
- component.Master?.PowerBoxReceivedChanged(args);
+ if (TryComp(uid, out ParticleAcceleratorPartComponent? paPart))
+ paPart.Master?.PowerBoxReceivedChanged(args);
}
}
}
visuals:
- type: ParticleAcceleratorPartVisualizer
baseState: unlit
+ - type: ParticleAcceleratorPart
- type: ParticleAcceleratorEmitter
emitterType: Left
- type: Construction
visuals:
- type: ParticleAcceleratorPartVisualizer
baseState: unlit
+ - type: ParticleAcceleratorPart
- type: ParticleAcceleratorEmitter
emitterType: Center
- type: Construction
node: completed
- type: GuideHelp
guides: [ Singularity, Power ]
-
+
- type: entity
parent: ParticleAcceleratorBase
id: ParticleAcceleratorEmitterRight
visuals:
- type: ParticleAcceleratorPartVisualizer
baseState: unlit
+ - type: ParticleAcceleratorPart
- type: ParticleAcceleratorEmitter
emitterType: Right
- type: Construction
node: completed
- type: GuideHelp
guides: [ Singularity, Power ]
-
+
# Unfinished
- type: entity
node: start
defaultTarget: completed
- type: GuideHelp
- guides: [ Singularity, Power ]
\ No newline at end of file
+ guides: [ Singularity, Power ]
- type: Sprite
sprite: Structures/Power/Generation/PA/end_cap.rsi
state: capc
+ - type: ParticleAcceleratorPart
- type: ParticleAcceleratorEndCap
- type: Construction
graph: ParticleAcceleratorEndCap
node: start
defaultTarget: completed
- type: GuideHelp
- guides: [ Singularity, Power ]
\ No newline at end of file
+ guides: [ Singularity, Power ]
visuals:
- type: ParticleAcceleratorPartVisualizer
baseState: unlit
+ - type: ParticleAcceleratorPart
- type: ParticleAcceleratorFuelChamber
- type: Construction
graph: ParticleAcceleratorFuelChamber
node: completed
- type: GuideHelp
guides: [ Singularity, Power ]
-
+
# Unfinished
- type: entity
node: start
defaultTarget: completed
- type: GuideHelp
- guides: [ Singularity, Power ]
\ No newline at end of file
+ guides: [ Singularity, Power ]
visuals:
- type: ParticleAcceleratorPartVisualizer
baseState: unlit
+ - type: ParticleAcceleratorPart
- type: ParticleAcceleratorPowerBox
- type: PowerConsumer
voltage: High
node: start
defaultTarget: completed
- type: GuideHelp
- guides: [ Singularity, Power ]
\ No newline at end of file
+ guides: [ Singularity, Power ]