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