2024-01-17 01:49:21 -08:00
|
|
|
using Robust.Shared.GameStates;
|
2023-05-03 00:57:47 -04:00
|
|
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
|
|
|
|
|
|
2023-12-20 21:19:50 -07:00
|
|
|
namespace Content.Shared.Atmos.Rotting;
|
2023-05-03 00:57:47 -04:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// This makes mobs eventually start rotting when they die.
|
|
|
|
|
/// It may be expanded to food at some point, but it's just for mobs right now.
|
|
|
|
|
/// </summary>
|
2024-02-26 04:36:19 +01:00
|
|
|
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState, AutoGenerateComponentPause]
|
2024-01-17 01:49:21 -08:00
|
|
|
[Access(typeof(SharedRottingSystem))]
|
2023-08-22 18:14:33 -07:00
|
|
|
public sealed partial class PerishableComponent : Component
|
2023-05-03 00:57:47 -04:00
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// How long it takes after death to start rotting.
|
|
|
|
|
/// </summary>
|
2024-01-17 01:49:21 -08:00
|
|
|
[DataField]
|
2023-05-15 11:52:31 -04:00
|
|
|
public TimeSpan RotAfter = TimeSpan.FromMinutes(10);
|
2023-05-03 00:57:47 -04:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// How much rotting has occured
|
|
|
|
|
/// </summary>
|
2024-01-17 01:49:21 -08:00
|
|
|
[DataField]
|
2023-05-03 00:57:47 -04:00
|
|
|
public TimeSpan RotAccumulator = TimeSpan.Zero;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gasses are released, this is when the next gas release update will be.
|
|
|
|
|
/// </summary>
|
2024-01-17 01:49:21 -08:00
|
|
|
[DataField(customTypeSerializer: typeof(TimeOffsetSerializer))]
|
2024-02-26 04:36:19 +01:00
|
|
|
[AutoPausedField]
|
2024-01-17 01:49:21 -08:00
|
|
|
public TimeSpan RotNextUpdate = TimeSpan.Zero;
|
2023-05-03 00:57:47 -04:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// How often the rotting ticks.
|
2023-08-06 04:05:43 +01:00
|
|
|
/// Feel free to tweak this if there are perf concerns.
|
2023-05-03 00:57:47 -04:00
|
|
|
/// </summary>
|
2024-01-17 01:49:21 -08:00
|
|
|
[DataField]
|
2023-05-03 00:57:47 -04:00
|
|
|
public TimeSpan PerishUpdateRate = TimeSpan.FromSeconds(5);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// How many moles of gas released per second, per unit of mass.
|
|
|
|
|
/// </summary>
|
2024-01-17 01:49:21 -08:00
|
|
|
[DataField]
|
2023-05-03 00:57:47 -04:00
|
|
|
public float MolsPerSecondPerUnitMass = 0.0025f;
|
2024-01-17 01:49:21 -08:00
|
|
|
|
|
|
|
|
[DataField, AutoNetworkedField]
|
|
|
|
|
public int Stage;
|
2024-09-11 09:52:27 -04:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// If true, rot will always progress.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DataField, AutoNetworkedField]
|
|
|
|
|
public bool ForceRotProgression;
|
2023-05-03 00:57:47 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[ByRefEvent]
|
|
|
|
|
public record struct IsRottingEvent(bool Handled = false);
|