Body code cleanup (#24946)
* Fix test * Kill float accumulators * Use entity proxy methods * DataField auto name generation where possible * Kill comp properties * Clean up server comps * Make events record structs * Clean up shared body code * Clean up server body code * Rename organ events to be same names as in med refactor
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
using Content.Server.Body.Systems;
|
||||
using Content.Server.Chemistry.EntitySystems;
|
||||
using Content.Shared.Chemistry.Components;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Damage.Prototypes;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
|
||||
|
||||
namespace Content.Server.Body.Components
|
||||
{
|
||||
@@ -16,7 +18,17 @@ namespace Content.Server.Body.Components
|
||||
public static string DefaultBloodSolutionName = "bloodstream";
|
||||
public static string DefaultBloodTemporarySolutionName = "bloodstreamTemporary";
|
||||
|
||||
public float AccumulatedFrametime = 0.0f;
|
||||
/// <summary>
|
||||
/// The next time that blood level will be updated and bloodloss damage dealt.
|
||||
/// </summary>
|
||||
[DataField(customTypeSerializer: typeof(TimeOffsetSerializer))]
|
||||
public TimeSpan NextUpdate;
|
||||
|
||||
/// <summary>
|
||||
/// The interval at which this component updates.
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public TimeSpan UpdateInterval = TimeSpan.FromSeconds(3);
|
||||
|
||||
/// <summary>
|
||||
/// How much is this entity currently bleeding?
|
||||
@@ -32,7 +44,7 @@ namespace Content.Server.Body.Components
|
||||
public float BleedAmount;
|
||||
|
||||
/// <summary>
|
||||
/// How much should bleeding should be reduced every update interval?
|
||||
/// How much should bleeding be reduced every update interval?
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public float BleedReductionAmount = 0.33f;
|
||||
@@ -63,18 +75,12 @@ namespace Content.Server.Body.Components
|
||||
[DataField(required: true)]
|
||||
public DamageSpecifier BloodlossHealDamage = new();
|
||||
|
||||
/// <summary>
|
||||
/// How frequently should this bloodstream update, in seconds?
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public float UpdateInterval = 3.0f;
|
||||
|
||||
// TODO shouldn't be hardcoded, should just use some organ simulation like bone marrow or smth.
|
||||
/// <summary>
|
||||
/// How much reagent of blood should be restored each update interval?
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public float BloodRefreshAmount = 1.0f;
|
||||
public FixedPoint2 BloodRefreshAmount = 1.0f;
|
||||
|
||||
/// <summary>
|
||||
/// How much blood needs to be in the temporary solution in order to create a puddle?
|
||||
@@ -89,8 +95,8 @@ namespace Content.Server.Body.Components
|
||||
/// <remarks>
|
||||
/// For example, piercing damage is increased while poison damage is nullified entirely.
|
||||
/// </remarks>
|
||||
[DataField(customTypeSerializer:typeof(PrototypeIdSerializer<DamageModifierSetPrototype>))]
|
||||
public string DamageBleedModifiers = "BloodlossHuman";
|
||||
[DataField]
|
||||
public ProtoId<DamageModifierSetPrototype> DamageBleedModifiers = "BloodlossHuman";
|
||||
|
||||
/// <summary>
|
||||
/// The sound to be played when a weapon instantly deals blood loss damage.
|
||||
@@ -126,7 +132,7 @@ namespace Content.Server.Body.Components
|
||||
/// Slime-people might use slime as their blood or something like that.
|
||||
/// </remarks>
|
||||
[DataField]
|
||||
public string BloodReagent = "Blood";
|
||||
public ProtoId<ReagentPrototype> BloodReagent = "Blood";
|
||||
|
||||
/// <summary>Name/Key that <see cref="BloodSolution"/> is indexed by.</summary>
|
||||
[DataField]
|
||||
@@ -164,6 +170,6 @@ namespace Content.Server.Body.Components
|
||||
/// Variable that stores the amount of status time added by having a low blood level.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public float StatusTime;
|
||||
public TimeSpan StatusTime;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user