Added the ability to refuel torches (and other expendable lights) (#36209)

* Added expendable light source refueling. Also fixed it to use the name modifier system so attributes like glue show up.

* Removed a duplicate line of code.

* Replaced TryGetComponent with TryComp, changed a variable name to be a little more clear.

* Removed the removed field "spentDesc" in flares and glowsticks

* Fixed to comply with slarticodefast's review. Name modifiers don't work yet (fixing that tmr)

* Fixed the localization!!!! :DDDD
This commit is contained in:
mjarduk
2025-04-18 04:59:41 +03:00
committed by GitHub
parent 2c60d6b27f
commit fb912b3d5c
6 changed files with 73 additions and 46 deletions

View File

@@ -1,5 +1,7 @@
using Content.Shared.Stacks;
using Robust.Shared.Audio;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
namespace Content.Shared.Light.Components;
@@ -9,34 +11,37 @@ public abstract partial class SharedExpendableLightComponent : Component
{
[ViewVariables(VVAccess.ReadOnly)]
public ExpendableLightState CurrentState { get; set; }
public ExpendableLightState CurrentState;
[DataField("turnOnBehaviourID")]
public string TurnOnBehaviourID { get; set; } = string.Empty;
[DataField]
public string TurnOnBehaviourID = string.Empty;
[DataField("fadeOutBehaviourID")]
public string FadeOutBehaviourID { get; set; } = string.Empty;
[DataField]
public string FadeOutBehaviourID = string.Empty;
[DataField("glowDuration")]
public float GlowDuration { get; set; } = 60 * 15f;
[DataField]
public TimeSpan GlowDuration = TimeSpan.FromSeconds(60 * 15f);
[DataField("fadeOutDuration")]
public float FadeOutDuration { get; set; } = 60 * 5f;
[DataField]
public TimeSpan FadeOutDuration = TimeSpan.FromSeconds(60 * 5f);
[DataField("spentDesc")]
public string SpentDesc { get; set; } = string.Empty;
[DataField]
public ProtoId<StackPrototype>? RefuelMaterialID;
[DataField("spentName")]
public string SpentName { get; set; } = string.Empty;
[DataField]
public TimeSpan RefuelMaterialTime = TimeSpan.FromSeconds(15f);
[DataField("litSound")]
public SoundSpecifier? LitSound { get; set; }
[DataField]
public TimeSpan RefuelMaximumDuration = TimeSpan.FromSeconds(60 * 15f * 2);
[DataField("loopedSound")]
public SoundSpecifier? LoopedSound { get; set; }
[DataField]
public SoundSpecifier? LitSound;
[DataField("dieSound")]
public SoundSpecifier? DieSound { get; set; } = null;
[DataField]
public SoundSpecifier? LoopedSound;
[DataField]
public SoundSpecifier? DieSound;
}
[Serializable, NetSerializable]