Remove cryo pod component references (#15247)

This commit is contained in:
DrSmugleaf
2023-04-09 15:28:19 -07:00
committed by GitHub
parent ec28358e06
commit 66adf34f59
8 changed files with 40 additions and 44 deletions

View File

@@ -1,7 +0,0 @@
using Content.Shared.DragDrop;
using Content.Shared.Medical.Cryogenics;
namespace Content.Client.Medical.Cryogenics;
[RegisterComponent, ComponentReference(typeof(SharedCryoPodComponent))]
public sealed class CryoPodComponent : SharedCryoPodComponent { }

View File

@@ -1,5 +1,4 @@
using Content.Shared.Destructible;
using Content.Shared.Emag.Systems;
using Content.Shared.Emag.Systems;
using Content.Shared.Medical.Cryogenics;
using Content.Shared.Verbs;
using Robust.Client.GameObjects;
@@ -46,15 +45,15 @@ public sealed class CryoPodSystem: SharedCryoPodSystem
spriteComponent.Offset = component.PreviousOffset;
}
private void OnAppearanceChange(EntityUid uid, SharedCryoPodComponent component, ref AppearanceChangeEvent args)
private void OnAppearanceChange(EntityUid uid, CryoPodComponent component, ref AppearanceChangeEvent args)
{
if (args.Sprite == null)
{
return;
}
if (!_appearance.TryGetData<bool>(uid, SharedCryoPodComponent.CryoPodVisuals.ContainsEntity, out var isOpen, args.Component)
|| !_appearance.TryGetData<bool>(uid, SharedCryoPodComponent.CryoPodVisuals.IsOn, out var isOn, args.Component))
if (!_appearance.TryGetData<bool>(uid, CryoPodComponent.CryoPodVisuals.ContainsEntity, out var isOpen, args.Component)
|| !_appearance.TryGetData<bool>(uid, CryoPodComponent.CryoPodVisuals.IsOn, out var isOn, args.Component))
{
return;
}

View File

@@ -1,11 +1,10 @@
using Content.Server.Atmos;
using Content.Shared.Atmos;
using Content.Shared.Medical.Cryogenics;
namespace Content.Server.Medical.Components;
[RegisterComponent, ComponentReference(typeof(SharedCryoPodComponent))]
public sealed class CryoPodComponent: SharedCryoPodComponent
[RegisterComponent]
public sealed class CryoPodAirComponent : Component
{
/// <summary>
/// Local air buffer that will be mixed with the pipenet, if one exists, per tick.

View File

@@ -110,7 +110,7 @@ public sealed partial class CryoPodSystem: SharedCryoPodSystem
}
}
public override void EjectBody(EntityUid uid, SharedCryoPodComponent? cryoPodComponent)
public override void EjectBody(EntityUid uid, CryoPodComponent? cryoPodComponent)
{
if (!Resolve(uid, ref cryoPodComponent))
return;
@@ -221,17 +221,24 @@ public sealed partial class CryoPodSystem: SharedCryoPodSystem
if (!nodeContainer.TryGetNode(cryoPod.PortName, out PortablePipeNode? portNode))
return;
_atmosphereSystem.React(cryoPod.Air, portNode);
if (!TryComp(uid, out CryoPodAirComponent? cryoPodAir))
return;
_atmosphereSystem.React(cryoPodAir.Air, portNode);
if (portNode.NodeGroup is PipeNet {NodeCount: > 1} net)
{
_gasCanisterSystem.MixContainerWithPipeNet(cryoPod.Air, net.Air);
_gasCanisterSystem.MixContainerWithPipeNet(cryoPodAir.Air, net.Air);
}
}
private void OnGasAnalyzed(EntityUid uid, CryoPodComponent component, GasAnalyzerScanEvent args)
{
var gasMixDict = new Dictionary<string, GasMixture?> { { Name(uid), component.Air } };
if (!TryComp(uid, out CryoPodAirComponent? cryoPodAir))
return;
var gasMixDict = new Dictionary<string, GasMixture?> { { Name(uid), cryoPodAir.Air } };
// If it's connected to a port, include the port side
if (TryComp(uid, out NodeContainerComponent? nodeContainer))
{

View File

@@ -19,26 +19,26 @@ namespace Content.Server.Medical
private void OnGetAir(EntityUid uid, InsideCryoPodComponent component, ref AtmosExposedGetAirEvent args)
{
if (TryComp<CryoPodComponent>(Transform(uid).ParentUid, out var cryoPodComponent))
if (TryComp<CryoPodAirComponent>(Transform(uid).ParentUid, out var cryoPodAir))
{
args.Gas = cryoPodComponent.Air;
args.Gas = cryoPodAir.Air;
args.Handled = true;
}
}
private void OnInhaleLocation(EntityUid uid, InsideCryoPodComponent component, InhaleLocationEvent args)
{
if (TryComp<CryoPodComponent>(Transform(uid).ParentUid, out var cryoPodComponent))
if (TryComp<CryoPodAirComponent>(Transform(uid).ParentUid, out var cryoPodAir))
{
args.Gas = cryoPodComponent.Air;
args.Gas = cryoPodAir.Air;
}
}
private void OnExhaleLocation(EntityUid uid, InsideCryoPodComponent component, ExhaleLocationEvent args)
{
if (TryComp<CryoPodComponent>(Transform(uid).ParentUid, out var cryoPodComponent))
if (TryComp<CryoPodAirComponent>(Transform(uid).ParentUid, out var cryoPodAir))
{
args.Gas = cryoPodComponent.Air;
args.Gas = cryoPodAir.Air;
}
}

View File

@@ -1,14 +1,12 @@
using Content.Shared.Body.Components;
using Content.Shared.DragDrop;
using Robust.Shared.Containers;
using Robust.Shared.Containers;
using Robust.Shared.GameStates;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
namespace Content.Shared.Medical.Cryogenics;
[NetworkedComponent]
public abstract class SharedCryoPodComponent: Component
[RegisterComponent, NetworkedComponent]
public sealed class CryoPodComponent : Component
{
/// <summary>
/// Specifies the name of the atmospherics port to draw gas from.

View File

@@ -1,6 +1,6 @@
using Content.Server.Medical.Components;
using Content.Shared.DoAfter;
using Content.Shared.Body.Components;
using Content.Shared.DoAfter;
using Content.Shared.DragDrop;
using Content.Shared.Emag.Systems;
using Content.Shared.Mobs.Components;
@@ -10,7 +10,6 @@ using Content.Shared.Standing;
using Content.Shared.Stunnable;
using Content.Shared.Verbs;
using Robust.Shared.Containers;
using Robust.Shared.Player;
using Robust.Shared.Serialization;
namespace Content.Shared.Medical.Cryogenics;
@@ -27,11 +26,11 @@ public abstract partial class SharedCryoPodSystem: EntitySystem
{
base.Initialize();
SubscribeLocalEvent<SharedCryoPodComponent, CanDropTargetEvent>(OnCryoPodCanDropOn);
SubscribeLocalEvent<CryoPodComponent, CanDropTargetEvent>(OnCryoPodCanDropOn);
InitializeInsideCryoPod();
}
private void OnCryoPodCanDropOn(EntityUid uid, SharedCryoPodComponent component, ref CanDropTargetEvent args)
private void OnCryoPodCanDropOn(EntityUid uid, CryoPodComponent component, ref CanDropTargetEvent args)
{
if (args.Handled)
return;
@@ -40,12 +39,12 @@ public abstract partial class SharedCryoPodSystem: EntitySystem
args.Handled = true;
}
protected void OnComponentInit(EntityUid uid, SharedCryoPodComponent cryoPodComponent, ComponentInit args)
protected void OnComponentInit(EntityUid uid, CryoPodComponent cryoPodComponent, ComponentInit args)
{
cryoPodComponent.BodyContainer = _containerSystem.EnsureContainer<ContainerSlot>(uid, "scanner-body");
}
protected void UpdateAppearance(EntityUid uid, SharedCryoPodComponent? cryoPod = null, AppearanceComponent? appearance = null)
protected void UpdateAppearance(EntityUid uid, CryoPodComponent? cryoPod = null, AppearanceComponent? appearance = null)
{
if (!Resolve(uid, ref cryoPod))
return;
@@ -57,11 +56,11 @@ public abstract partial class SharedCryoPodSystem: EntitySystem
if (!Resolve(uid, ref appearance))
return;
_appearanceSystem.SetData(uid, SharedCryoPodComponent.CryoPodVisuals.ContainsEntity, cryoPod.BodyContainer.ContainedEntity == null, appearance);
_appearanceSystem.SetData(uid, SharedCryoPodComponent.CryoPodVisuals.IsOn, cryoPodEnabled, appearance);
_appearanceSystem.SetData(uid, CryoPodComponent.CryoPodVisuals.ContainsEntity, cryoPod.BodyContainer.ContainedEntity == null, appearance);
_appearanceSystem.SetData(uid, CryoPodComponent.CryoPodVisuals.IsOn, cryoPodEnabled, appearance);
}
public void InsertBody(EntityUid uid, EntityUid target, SharedCryoPodComponent cryoPodComponent)
public void InsertBody(EntityUid uid, EntityUid target, CryoPodComponent cryoPodComponent)
{
if (cryoPodComponent.BodyContainer.ContainedEntity != null)
return;
@@ -78,7 +77,7 @@ public abstract partial class SharedCryoPodSystem: EntitySystem
UpdateAppearance(uid, cryoPodComponent);
}
public void TryEjectBody(EntityUid uid, EntityUid userId, SharedCryoPodComponent? cryoPodComponent)
public void TryEjectBody(EntityUid uid, EntityUid userId, CryoPodComponent? cryoPodComponent)
{
if (!Resolve(uid, ref cryoPodComponent))
{
@@ -94,7 +93,7 @@ public abstract partial class SharedCryoPodSystem: EntitySystem
EjectBody(uid, cryoPodComponent);
}
public virtual void EjectBody(EntityUid uid, SharedCryoPodComponent? cryoPodComponent)
public virtual void EjectBody(EntityUid uid, CryoPodComponent? cryoPodComponent)
{
if (!Resolve(uid, ref cryoPodComponent))
return;
@@ -119,7 +118,7 @@ public abstract partial class SharedCryoPodSystem: EntitySystem
UpdateAppearance(uid, cryoPodComponent);
}
protected void AddAlternativeVerbs(EntityUid uid, SharedCryoPodComponent cryoPodComponent, GetVerbsEvent<AlternativeVerb> args)
protected void AddAlternativeVerbs(EntityUid uid, CryoPodComponent cryoPodComponent, GetVerbsEvent<AlternativeVerb> args)
{
if (!args.CanAccess || !args.CanInteract)
return;
@@ -137,7 +136,7 @@ public abstract partial class SharedCryoPodSystem: EntitySystem
}
}
protected void OnEmagged(EntityUid uid, SharedCryoPodComponent? cryoPodComponent, ref GotEmaggedEvent args)
protected void OnEmagged(EntityUid uid, CryoPodComponent? cryoPodComponent, ref GotEmaggedEvent args)
{
if (!Resolve(uid, ref cryoPodComponent))
{
@@ -149,7 +148,7 @@ public abstract partial class SharedCryoPodSystem: EntitySystem
args.Handled = true;
}
protected void OnCryoPodPryFinished(EntityUid uid, SharedCryoPodComponent cryoPodComponent, CryoPodPryFinished args)
protected void OnCryoPodPryFinished(EntityUid uid, CryoPodComponent cryoPodComponent, CryoPodPryFinished args)
{
if (args.Cancelled)
return;

View File

@@ -100,5 +100,6 @@
containers:
- scanner-body
- type: CryoPod
- type: CryoPodAir
- type: ContainerTemperatureDamageThresholds
coldDamageThreshold: 10