Predict PoweredLights (#36541)

* Move PoweredLight to shared

* Predict the rest of the owl

* reacher

* compinit & anim

* Fix names

* Revert this?

* Fix these

* chicken drummies

* deita

* Fix

* review

* fix

* fixes

* fix PVS weirdness

---------

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
This commit is contained in:
metalgearsloth
2025-08-12 07:06:28 +10:00
committed by GitHub
parent 3d71ddd1de
commit fd52f698c7
16 changed files with 630 additions and 566 deletions

View File

@@ -8,69 +8,61 @@ namespace Content.Shared.Light.Components;
/// Component that represents a light bulb. Can be broken, or burned, which turns them mostly useless.
/// TODO: Breaking and burning should probably be moved to another component eventually.
/// </summary>
[RegisterComponent, NetworkedComponent]
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
public sealed partial class LightBulbComponent : Component
{
/// <summary>
/// The color of the lightbulb and the light it produces.
/// </summary>
[DataField("color")]
[ViewVariables(VVAccess.ReadWrite)]
[DataField, AutoNetworkedField]
public Color Color = Color.White;
/// <summary>
/// The type of lightbulb. Tube/bulb/etc...
/// </summary>
[DataField("bulb")]
[ViewVariables(VVAccess.ReadWrite)]
public LightBulbType Type = LightBulbType.Tube;
/// <summary>
/// The initial state of the lightbulb.
/// </summary>
[DataField("startingState")]
[DataField("startingState"), AutoNetworkedField]
public LightBulbState State = LightBulbState.Normal;
/// <summary>
/// The temperature the air around the lightbulb is exposed to when the lightbulb burns out.
/// </summary>
[DataField("BurningTemperature")]
[ViewVariables(VVAccess.ReadWrite)]
public int BurningTemperature = 1400;
/// <summary>
/// Relates to how bright the light produced by the lightbulb is.
/// </summary>
[DataField("lightEnergy")]
[ViewVariables(VVAccess.ReadWrite)]
[DataField]
public float LightEnergy = 0.8f;
/// <summary>
/// The maximum radius of the point light source this light produces.
/// </summary>
[DataField("lightRadius")]
[ViewVariables(VVAccess.ReadWrite)]
[DataField]
public float LightRadius = 10;
/// <summary>
/// Relates to the falloff constant of the light produced by the lightbulb.
/// </summary>
[DataField("lightSoftness")]
[ViewVariables(VVAccess.ReadWrite)]
[DataField]
public float LightSoftness = 1;
/// <summary>
/// The amount of power used by the lightbulb when it's active.
/// </summary>
[DataField("PowerUse")]
[ViewVariables(VVAccess.ReadWrite)]
public int PowerUse = 60;
/// <summary>
/// The sound produced when the lightbulb breaks.
/// </summary>
[DataField("breakSound")]
[ViewVariables(VVAccess.ReadWrite)]
[DataField]
public SoundSpecifier BreakSound = new SoundCollectionSpecifier("GlassBreak", AudioParams.Default.WithVolume(-6f));
#region Appearance
@@ -78,22 +70,19 @@ public sealed partial class LightBulbComponent : Component
/// <summary>
/// The sprite state used when the lightbulb is intact.
/// </summary>
[DataField("normalSpriteState")]
[ViewVariables(VVAccess.ReadWrite)]
[DataField]
public string NormalSpriteState = "normal";
/// <summary>
/// The sprite state used when the lightbulb is broken.
/// </summary>
[DataField("brokenSpriteState")]
[ViewVariables(VVAccess.ReadWrite)]
[DataField]
public string BrokenSpriteState = "broken";
/// <summary>
/// The sprite state used when the lightbulb is burned.
/// </summary>
[DataField("burnedSpriteState")]
[ViewVariables(VVAccess.ReadWrite)]
[DataField]
public string BurnedSpriteState = "burned";
#endregion Appearance

View File

@@ -1,3 +1,4 @@
using Content.Shared.Light.Components;
using Content.Shared.Light.EntitySystems;
using Content.Shared.Storage;
using Robust.Shared.Audio;

View File

@@ -0,0 +1,87 @@
using Content.Shared.DeviceLinking;
using Content.Shared.Light.EntitySystems;
using Robust.Shared.Audio;
using Robust.Shared.Containers;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
namespace Content.Shared.Light.Components
{
/// <summary>
/// Component that represents a wall light. It has a light bulb that can be replaced when broken.
/// </summary>
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState, AutoGenerateComponentPause, Access(typeof(SharedPoweredLightSystem))]
public sealed partial class PoweredLightComponent : Component
{
/*
* Stop adding more fields, use components or I will shed you.
*/
[DataField]
public SoundSpecifier BurnHandSound = new SoundPathSpecifier("/Audio/Effects/lightburn.ogg");
[DataField]
public SoundSpecifier TurnOnSound = new SoundPathSpecifier("/Audio/Machines/light_tube_on.ogg");
// Should be using containerfill?
[DataField]
public EntProtoId? HasLampOnSpawn = null;
[DataField("bulb")]
public LightBulbType BulbType;
[DataField, AutoNetworkedField]
public bool On = true;
[DataField]
public bool IgnoreGhostsBoo;
[DataField]
public TimeSpan GhostBlinkingTime = TimeSpan.FromSeconds(10);
[DataField]
public TimeSpan GhostBlinkingCooldown = TimeSpan.FromSeconds(60);
[ViewVariables]
public ContainerSlot LightBulbContainer = default!;
[AutoNetworkedField]
public bool CurrentLit;
[DataField, AutoNetworkedField]
public bool IsBlinking;
[DataField, AutoNetworkedField, AutoPausedField]
public TimeSpan LastThunk;
[DataField, AutoPausedField]
public TimeSpan? LastGhostBlink;
[DataField]
public ProtoId<SinkPortPrototype> OnPort = "On";
[DataField]
public ProtoId<SinkPortPrototype> OffPort = "Off";
[DataField]
public ProtoId<SinkPortPrototype> TogglePort = "Toggle";
/// <summary>
/// How long it takes to eject a bulb from this
/// </summary>
[DataField]
public float EjectBulbDelay = 2;
/// <summary>
/// Shock damage done to a mob that hits the light with an unarmed attack
/// </summary>
[DataField]
public int UnarmedHitShock = 20;
/// <summary>
/// Stun duration applied to a mob that hits the light with an unarmed attack
/// </summary>
[DataField]
public TimeSpan UnarmedHitStun = TimeSpan.FromSeconds(5);
}
}