| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- using Content.Shared.Alert;
- using Content.Shared.Damage;
- using Content.Shared.Nutrition.EntitySystems;
- using Robust.Shared.GameStates;
- using Robust.Shared.Prototypes;
- using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
- namespace Content.Shared.Nutrition.Components;
- [RegisterComponent, NetworkedComponent, Access(typeof(ThirstSystem))]
- [AutoGenerateComponentState(fieldDeltas: true), AutoGenerateComponentPause]
- public sealed partial class ThirstComponent : Component
- {
- // Base stuff
- [ViewVariables(VVAccess.ReadWrite)]
- [DataField("baseDecayRate")]
- [AutoNetworkedField]
- public float BaseDecayRate = 0.15f;
- [ViewVariables(VVAccess.ReadWrite)]
- [AutoNetworkedField]
- public float ActualDecayRate;
- [DataField, AutoNetworkedField, ViewVariables(VVAccess.ReadWrite)]
- public ThirstThreshold CurrentThirstThreshold;
- [DataField, AutoNetworkedField, ViewVariables(VVAccess.ReadWrite)]
- public ThirstThreshold LastThirstThreshold;
- [ViewVariables(VVAccess.ReadWrite)]
- [DataField("startingThirst")]
- [AutoNetworkedField]
- public float CurrentThirst = -1f;
- /// <summary>
- /// Damage dealt when your current threshold is at HungerThreshold.Dead
- /// </summary>
- [DataField("thirstDamage")]
- public DamageSpecifier? ThirstDamage;
- /// <summary>
- /// The time when the hunger will update next.
- /// </summary>
- [DataField("nextUpdateTime", customTypeSerializer: typeof(TimeOffsetSerializer)), ViewVariables(VVAccess.ReadWrite)]
- [AutoNetworkedField]
- [AutoPausedField]
- public TimeSpan NextUpdateTime;
- /// <summary>
- /// The time between each update.
- /// </summary>
- [ViewVariables(VVAccess.ReadWrite)]
- [DataField, AutoNetworkedField]
- public TimeSpan UpdateRate = TimeSpan.FromSeconds(1);
- [DataField("thresholds")]
- [AutoNetworkedField]
- public Dictionary<ThirstThreshold, float> ThirstThresholds = new()
- {
- {ThirstThreshold.OverHydrated, 600.0f},
- {ThirstThreshold.Okay, 450.0f},
- {ThirstThreshold.Thirsty, 300.0f},
- {ThirstThreshold.Parched, 150.0f},
- {ThirstThreshold.Dead, 0.0f},
- };
- [DataField]
- public ProtoId<AlertCategoryPrototype> ThirstyCategory = "Thirst";
- public static readonly Dictionary<ThirstThreshold, ProtoId<AlertPrototype>> ThirstThresholdAlertTypes = new()
- {
- {ThirstThreshold.Thirsty, "Thirsty"},
- {ThirstThreshold.Parched, "Parched"},
- {ThirstThreshold.Dead, "Parched"},
- };
- }
- [Flags]
- public enum ThirstThreshold : byte
- {
- // Hydrohomies
- Dead = 0,
- Parched = 1 << 0,
- Thirsty = 1 << 1,
- Okay = 1 << 2,
- OverHydrated = 1 << 3,
- }
|