Files
tbd-station-14/Content.Server/Body/Components/BloodstreamComponent.cs
Whisper 0e43f90bb8 The bleed update (#14814)
* Removed arbitrary modifier scaling. The bleed amount is now 1-1 in units.

* Added some comments to explain the blood and bleed code

* added some comments

* added some comments

* profusely bleeding message scales with max bleed rate

* Added some comments

* Added some comments (tm)

* Halved the speed bleed rate heals.

* Changed the wording of a comment to make the function of the values more clear

* Changed bleed rate values, made heat heal more bleed rate

* doubled crit chance, since damage types were reduced

* Made iron restore more blood, 2->4u per 1u

* Starting to add the blood pack

* add bloodlevel to healingcomponent

* Created code support in the healing system for restoring blood

* first test of blood pack prototype

* More pack testing, and defining the yml stack

* yml syntax fix

* adds bloodpack tag

* Successfully added the item, but the effect and deletion after using the item is not working yet.

* the blood regen worksgit add -A!

* blood pack is entirely functioning

* Removed bleed rate healing from brute pack

* Comment correction

* I tried

* Removed bleed stats from corrupted corgi, they inherit same stats from basemob

* Removed bleed stats from xeno, they inherit same stats from a base mob

* Removed bleed stats from diona, they inherit same stats from a base mob

* Removed bleed stats from slimes, they inherit same stats from a base mob

* All mobs now heal bloodloss damage at a rate of 1 instead of 0.25 when healthy

* The cautery now closes bleed wounds

* Nerf blood pack bleed rate heal

* Added 2 blood packs to medicine locker

* Added 2 blood packs to wall medicine locker

* Minor YML fix to chemistry locker, no changes in game

* Added tag to medical belt for blood pack, added 2 blood packs to medical belt

* Added 1 gauze to medical belt

* 5 blood packs addded to nanomed plus

* nanomed inventory change

* 2 blood packs added to medical supplies crate from cargo

* Moved 1 gauze from med kit to advanced med kit

* Moved 1 tricord pill from advanced med kit to basic med kit

* added 2 ointment to burn kit

* Moved ina syringe from burn treatment to oxygen kit

* Removed one gauze from brute kit

* Added one bloodpack to brute med kit

* Moved tranex acid syringe from advanced first aid to brute kit

* Poison medipen moved from advanced first aid kit to toxin kit

* Removed health analyzer from advanced first aid kit

* removed one brute pack from advanced aid kit

* added one ointment to advanced aid kit

* Added one blood pack to advanced aid kit

* Added 2 blood packs to combat med kit

* Starting with adding the license for the tg sprite

* Adds the blood pack sprite and meta.json code

* I forgor to actually code the sprite in

* Advanced med kit missing one blood pack

* Replaced tricord pill with emergency medipen in cobat kit

* Removed emergency pen from combat kit, there's no space for it

* Revert "I tried"

This reverts commit 94c2e28df3200993d3f09b72ecabc838ea5ae5c0.

* Trying to fix yml test fail

* Try again

* attempt number 3

* Restock crate price was too low

* fixing merge conflict without making a HUGE mess this time

* ???

* again

* again

* Can I add the newline now maybe???

* Revert "Can I add the newline now maybe???"

This reverts commit 22d26706a65a24633f7da1dea6315012e2d3ac6f.

* Adds the doafter fix code from Keron to the blood level healing

* minor typo fix

* Feedback from Emisse and sloth; Removed chance based feedback on cauterizing

* comment fix
2023-04-02 23:59:51 -06:00

151 lines
5.9 KiB
C#

using Content.Server.Body.Systems;
using Content.Server.Chemistry.EntitySystems;
using Content.Shared.Chemistry.Components;
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;
namespace Content.Server.Body.Components
{
[RegisterComponent, Access(typeof(BloodstreamSystem), (typeof(ChemistrySystem)))]
public sealed class BloodstreamComponent : Component
{
public static string DefaultChemicalsSolutionName = "chemicals";
public static string DefaultBloodSolutionName = "bloodstream";
public static string DefaultBloodTemporarySolutionName = "bloodstreamTemporary";
public float AccumulatedFrametime = 0.0f;
/// <summary>
/// How much is this entity currently bleeding?
/// Higher numbers mean more blood lost every tick.
///
/// Goes down slowly over time, and items like bandages
/// or clotting reagents can lower bleeding.
/// </summary>
/// <remarks>
/// This generally corresponds to an amount of damage and can't go above 100.
/// </remarks>
[ViewVariables(VVAccess.ReadWrite)]
public float BleedAmount;
/// <summary>
/// How much should bleeding should be reduced every update interval?
/// </summary>
[DataField("bleedReductionAmount")]
public float BleedReductionAmount = 0.5f;
/// <summary>
/// How high can <see cref="BleedAmount"/> go?
/// </summary>
[DataField("maxBleedAmount")]
public float MaxBleedAmount = 20.0f;
/// <summary>
/// What percentage of current blood is necessary to avoid dealing blood loss damage?
/// </summary>
[DataField("bloodlossThreshold")]
public float BloodlossThreshold = 0.9f;
/// <summary>
/// The base bloodloss damage to be incurred if below <see cref="BloodlossThreshold"/>
/// </summary>
[DataField("bloodlossDamage", required: true)]
public DamageSpecifier BloodlossDamage = new();
/// <summary>
/// The base bloodloss damage to be healed if above <see cref="BloodlossThreshold"/>
/// </summary>
[DataField("bloodlossHealDamage", required: true)]
public DamageSpecifier BloodlossHealDamage = new();
/// <summary>
/// How frequently should this bloodstream update, in seconds?
/// </summary>
[DataField("updateInterval")]
public float UpdateInterval = 5.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("bloodRefreshAmount")]
public float BloodRefreshAmount = 0.3f;
/// <summary>
/// How much blood needs to be in the temporary solution in order to create a puddle?
/// </summary>
[DataField("bleedPuddleThreshold")]
public FixedPoint2 BleedPuddleThreshold = 5.0f;
/// <summary>
/// A modifier set prototype ID corresponding to how damage should be modified
/// before taking it into account for bloodloss.
/// </summary>
/// <remarks>
/// For example, piercing damage is increased while poison damage is nullified entirely.
/// </remarks>
[DataField("damageBleedModifiers", customTypeSerializer:typeof(PrototypeIdSerializer<DamageModifierSetPrototype>))]
public string DamageBleedModifiers = "BloodlossHuman";
/// <summary>
/// The sound to be played when a weapon instantly deals blood loss damage.
/// </summary>
[DataField("instantBloodSound")]
public SoundSpecifier InstantBloodSound = new SoundCollectionSpecifier("blood");
/// <summary>
/// The sound to be played when some damage actually heals bleeding rather than starting it.
/// </summary>
[DataField("bloodHealedSound")]
public SoundSpecifier BloodHealedSound = new SoundPathSpecifier("/Audio/Effects/lightburn.ogg");
// TODO probably damage bleed thresholds.
/// <summary>
/// Max volume of internal chemical solution storage
/// </summary>
[DataField("chemicalMaxVolume")]
public FixedPoint2 ChemicalMaxVolume = FixedPoint2.New(250);
/// <summary>
/// Max volume of internal blood storage,
/// and starting level of blood.
/// </summary>
[DataField("bloodMaxVolume")]
public FixedPoint2 BloodMaxVolume = FixedPoint2.New(300);
/// <summary>
/// Which reagent is considered this entities 'blood'?
/// </summary>
/// <remarks>
/// Slime-people might use slime as their blood or something like that.
/// </remarks>
[DataField("bloodReagent")]
public string BloodReagent = "Blood";
/// <summary>
/// Internal solution for reagent storage
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[Access(typeof(BloodstreamSystem), Other = AccessPermissions.ReadExecute)] // FIXME Friends
public Solution ChemicalSolution = default!;
/// <summary>
/// Internal solution for blood storage
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
public Solution BloodSolution = default!;
/// <summary>
/// Temporary blood solution.
/// When blood is lost, it goes to this solution, and when this
/// solution hits a certain cap, the blood is actually spilled as a puddle.
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
public Solution BloodTemporarySolution = default!;
}
}