Better glue (#17381)

This commit is contained in:
Slava0135
2023-06-30 22:07:44 +03:00
committed by GitHub
parent 0ad77202b8
commit aadcc48ddc
11 changed files with 148 additions and 169 deletions

View File

@@ -1,15 +1,42 @@
using Content.Shared.Chemistry.Reagent;
using Content.Shared.FixedPoint;
using Robust.Shared.Audio;
using Robust.Shared.GameStates;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Shared.Glue
namespace Content.Shared.Glue;
[RegisterComponent, NetworkedComponent]
[Access(typeof(SharedGlueSystem))]
public sealed class GlueComponent : Component
{
[RegisterComponent, NetworkedComponent]
public sealed class GlueComponent : Component
{
/// <summary>
/// Noise made when glue applied.
/// </summary>
[DataField("squeeze")]
public SoundSpecifier Squeeze = new SoundPathSpecifier("/Audio/Items/squeezebottle.ogg");
}
/// <summary>
/// Noise made when glue applied.
/// </summary>
[DataField("squeeze")]
public SoundSpecifier Squeeze = new SoundPathSpecifier("/Audio/Items/squeezebottle.ogg");
/// <summary>
/// Solution on the entity that contains the glue.
/// </summary>
[DataField("solution")]
public string Solution = "drink";
/// <summary>
/// Reagent that will be used as glue.
/// </summary>
[DataField("reagent", customTypeSerializer: typeof(PrototypeIdSerializer<ReagentPrototype>))]
public string Reagent = "SpaceGlue";
/// <summary>
/// Reagent consumption per use.
/// </summary>
[DataField("consumptionUnit"), ViewVariables(VVAccess.ReadWrite)]
public FixedPoint2 ConsumptionUnit = FixedPoint2.New(5);
/// <summary>
/// Duration per unit
/// </summary>
[DataField("durationPerUnit"), ViewVariables(VVAccess.ReadWrite)]
public TimeSpan DurationPerUnit = TimeSpan.FromSeconds(6);
}

View File

@@ -1,42 +1,20 @@
using Robust.Shared.Audio;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
namespace Content.Shared.Glue;
[RegisterComponent]
[Access(typeof(SharedGlueSystem))]
public sealed class GluedComponent : Component
{
/// <summary>
/// Reverts name to before prefix event (essentially removes prefix).
/// </summary>
[DataField("beforeGluedEntityName"), ViewVariables(VVAccess.ReadOnly)]
public string BeforeGluedEntityName = String.Empty;
public string BeforeGluedEntityName = string.Empty;
/// <summary>
/// Sound made when glue applied.
/// </summary>
[DataField("squeeze")]
public SoundSpecifier Squeeze = new SoundPathSpecifier("/Audio/Items/squeezebottle.ogg");
[DataField("until", customTypeSerializer: typeof(TimeOffsetSerializer)), ViewVariables(VVAccess.ReadWrite)]
public TimeSpan Until;
/// <summary>
/// Timings for glue duration and removal.
/// </summary>
[DataField("nextGlueTime", customTypeSerializer: typeof(TimeOffsetSerializer)), ViewVariables(VVAccess.ReadWrite)]
public TimeSpan? NextGlueTime;
[DataField("glueTime", customTypeSerializer: typeof(TimeOffsetSerializer))]
public TimeSpan GlueTime = TimeSpan.Zero;
[DataField("glueCooldown")]
public TimeSpan GlueCooldown = TimeSpan.FromSeconds(20);
/// <summary>
/// Bools which control timings and when to apply the glue effect.
/// </summary>
public bool GlueBroken = false;
[DataField("glued")]
[ViewVariables(VVAccess.ReadWrite)]
public bool Glued = false;
[DataField("duration", customTypeSerializer: typeof(TimeOffsetSerializer)), ViewVariables(VVAccess.ReadWrite)]
public TimeSpan Duration;
}

View File

@@ -0,0 +1,5 @@
namespace Content.Shared.Glue;
public abstract class SharedGlueSystem : EntitySystem
{
}