Fix some TEG code conventions (#19259)
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
using Content.Client.Examine;
|
using Content.Client.Examine;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Prototypes;
|
||||||
|
|
||||||
namespace Content.Client.Power.Generation.Teg;
|
namespace Content.Client.Power.Generation.Teg;
|
||||||
|
|
||||||
@@ -14,6 +15,9 @@ namespace Content.Client.Power.Generation.Teg;
|
|||||||
/// <seealso cref="TegCirculatorComponent"/>
|
/// <seealso cref="TegCirculatorComponent"/>
|
||||||
public sealed class TegSystem : EntitySystem
|
public sealed class TegSystem : EntitySystem
|
||||||
{
|
{
|
||||||
|
[ValidatePrototypeId<EntityPrototype>]
|
||||||
|
private const string ArrowPrototype = "TegCirculatorArrow";
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
SubscribeLocalEvent<TegCirculatorComponent, ClientExaminedEvent>(CirculatorExamined);
|
SubscribeLocalEvent<TegCirculatorComponent, ClientExaminedEvent>(CirculatorExamined);
|
||||||
@@ -21,6 +25,6 @@ public sealed class TegSystem : EntitySystem
|
|||||||
|
|
||||||
private void CirculatorExamined(EntityUid uid, TegCirculatorComponent component, ClientExaminedEvent args)
|
private void CirculatorExamined(EntityUid uid, TegCirculatorComponent component, ClientExaminedEvent args)
|
||||||
{
|
{
|
||||||
Spawn("TegCirculatorArrow", new EntityCoordinates(uid, 0, 0));
|
Spawn(ArrowPrototype, new EntityCoordinates(uid, 0, 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,30 +14,35 @@ public sealed class TegCirculatorComponent : Component
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The difference between the inlet and outlet pressure at the start of the previous tick.
|
/// The difference between the inlet and outlet pressure at the start of the previous tick.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField("last_pressure_delta")] [ViewVariables(VVAccess.ReadWrite)]
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
|
[DataField("lastPressureDelta")]
|
||||||
public float LastPressureDelta;
|
public float LastPressureDelta;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The amount of moles transferred by the circulator last tick.
|
/// The amount of moles transferred by the circulator last tick.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField("last_moles_transferred")] [ViewVariables(VVAccess.ReadWrite)]
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
|
[DataField("lastMolesTransferred")]
|
||||||
public float LastMolesTransferred;
|
public float LastMolesTransferred;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Minimum pressure delta between inlet and outlet for which the circulator animation speed is "fast".
|
/// Minimum pressure delta between inlet and outlet for which the circulator animation speed is "fast".
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField("visual_speed_delta")] [ViewVariables(VVAccess.ReadWrite)]
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
|
[DataField("visualSpeedDelta")]
|
||||||
public float VisualSpeedDelta = 5 * Atmospherics.OneAtmosphere;
|
public float VisualSpeedDelta = 5 * Atmospherics.OneAtmosphere;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Light color of this circulator when it's running at "slow" speed.
|
/// Light color of this circulator when it's running at "slow" speed.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField("light_color_slow")] [ViewVariables(VVAccess.ReadWrite)]
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
public Color LightColorSlow;
|
[DataField("lightColorSlow")]
|
||||||
|
public Color LightColorSlow = Color.FromHex("#FF3300");
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Light color of this circulator when it's running at "fast" speed.
|
/// Light color of this circulator when it's running at "fast" speed.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField("light_color_fast")] [ViewVariables(VVAccess.ReadWrite)]
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
public Color LightColorFast;
|
[DataField("lightColorFast")]
|
||||||
|
public Color LightColorFast = Color.FromHex("#AA00FF");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,55 +15,64 @@ public sealed class TegGeneratorComponent : Component
|
|||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// A value of 0.9 means that 90% of energy transferred goes to electricity.
|
/// A value of 0.9 means that 90% of energy transferred goes to electricity.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
[ViewVariables(VVAccess.ReadWrite)] [DataField("thermal_efficiency")]
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
|
[DataField("thermalEfficiency")]
|
||||||
public float ThermalEfficiency = 0.65f;
|
public float ThermalEfficiency = 0.65f;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Simple factor that scales effective electricity generation.
|
/// Simple factor that scales effective electricity generation.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ViewVariables(VVAccess.ReadWrite)] [DataField("power_factor")]
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
|
[DataField("powerFactor")]
|
||||||
public float PowerFactor = 1;
|
public float PowerFactor = 1;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Amount of energy (Joules) generated by the TEG last atmos tick.
|
/// Amount of energy (Joules) generated by the TEG last atmos tick.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ViewVariables(VVAccess.ReadWrite)] [DataField("last_generation")]
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
|
[DataField("lastGeneration")]
|
||||||
public float LastGeneration;
|
public float LastGeneration;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The current target for TEG power generation.
|
/// The current target for TEG power generation.
|
||||||
/// Drifts towards actual power draw of the network with <see cref="PowerFactor"/>.
|
/// Drifts towards actual power draw of the network with <see cref="PowerFactor"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ViewVariables(VVAccess.ReadWrite)] [DataField("ramp_position")]
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
|
[DataField("rampPosition")]
|
||||||
public float RampPosition;
|
public float RampPosition;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Factor by which TEG power generation scales, both up and down.
|
/// Factor by which TEG power generation scales, both up and down.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ViewVariables(VVAccess.ReadWrite)] [DataField("ramp_factor")]
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
|
[DataField("rampFactor")]
|
||||||
public float RampFactor = 1.05f;
|
public float RampFactor = 1.05f;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Minimum position for the ramp. Avoids TEG taking too long to start.
|
/// Minimum position for the ramp. Avoids TEG taking too long to start.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ViewVariables(VVAccess.ReadWrite)] [DataField("ramp_threshold")]
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
|
[DataField("rampMinimum")]
|
||||||
public float RampMinimum = 5000;
|
public float RampMinimum = 5000;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Power output value at which the sprite appearance and sound volume should cap out.
|
/// Power output value at which the sprite appearance and sound volume should cap out.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ViewVariables(VVAccess.ReadWrite)] [DataField("max_visual_power")]
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
|
[DataField("maxVisualPower")]
|
||||||
public float MaxVisualPower = 200_000;
|
public float MaxVisualPower = 200_000;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Minimum ambient sound volume, when we're producing just barely any power at all.
|
/// Minimum ambient sound volume, when we're producing just barely any power at all.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ViewVariables(VVAccess.ReadWrite)] [DataField("volume_min")]
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
|
[DataField("volumeMin")]
|
||||||
public float VolumeMin = -9;
|
public float VolumeMin = -9;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Maximum ambient sound volume, when we're producing >= <see cref="MaxVisualPower"/> power.
|
/// Maximum ambient sound volume, when we're producing >= <see cref="MaxVisualPower"/> power.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ViewVariables(VVAccess.ReadWrite)] [DataField("volume_max")]
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
|
[DataField("volumeMax")]
|
||||||
public float VolumeMax = -4;
|
public float VolumeMax = -4;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public sealed class SensorMonitoringConsoleComponent : Component
|
|||||||
/// If enabled, additional data streams are shown intended to only be visible for debugging.
|
/// If enabled, additional data streams are shown intended to only be visible for debugging.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ViewVariables(VVAccess.ReadWrite)]
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
[DataField("debug_streams")]
|
[DataField("debugStreams")]
|
||||||
public bool DebugStreams = false;
|
public bool DebugStreams = false;
|
||||||
|
|
||||||
[ViewVariables(VVAccess.ReadWrite)]
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
|
|||||||
@@ -1434,7 +1434,7 @@ entities:
|
|||||||
pos: -1.5,5.5
|
pos: -1.5,5.5
|
||||||
parent: 2
|
parent: 2
|
||||||
type: Transform
|
type: Transform
|
||||||
- debug_streams: True
|
- debugStreams: True
|
||||||
type: SensorMonitoringConsole
|
type: SensorMonitoringConsole
|
||||||
- ShutdownSubscribers:
|
- ShutdownSubscribers:
|
||||||
- 3
|
- 3
|
||||||
|
|||||||
@@ -166,8 +166,6 @@
|
|||||||
|
|
||||||
- type: AtmosUnsafeUnanchor
|
- type: AtmosUnsafeUnanchor
|
||||||
- type: TegCirculator
|
- type: TegCirculator
|
||||||
light_color_fast: '#AA00FF'
|
|
||||||
light_color_slow: '#FF3300'
|
|
||||||
|
|
||||||
- # Spawned by the client-side circulator examine code to indicate the inlet/outlet direction.
|
- # Spawned by the client-side circulator examine code to indicate the inlet/outlet direction.
|
||||||
type: entity
|
type: entity
|
||||||
|
|||||||
Reference in New Issue
Block a user