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
This commit is contained in:
Whisper
2023-04-03 01:59:51 -04:00
committed by GitHub
parent 793df1ce89
commit 0e43f90bb8
28 changed files with 131 additions and 75 deletions

View File

@@ -35,7 +35,7 @@ namespace Content.Server.Body.Components
/// How much should bleeding should be reduced every update interval? /// How much should bleeding should be reduced every update interval?
/// </summary> /// </summary>
[DataField("bleedReductionAmount")] [DataField("bleedReductionAmount")]
public float BleedReductionAmount = 1.0f; public float BleedReductionAmount = 0.5f;
/// <summary> /// <summary>
/// How high can <see cref="BleedAmount"/> go? /// How high can <see cref="BleedAmount"/> go?

View File

@@ -101,7 +101,9 @@ public sealed class BloodstreamSystem : EntitySystem
// as well as stop their bleeding to a certain extent. // as well as stop their bleeding to a certain extent.
if (bloodstream.BleedAmount > 0) if (bloodstream.BleedAmount > 0)
{ {
TryModifyBloodLevel(uid, (-bloodstream.BleedAmount) / 20, bloodstream); // Blood is removed from the bloodstream at a 1-1 rate with the bleed amount
TryModifyBloodLevel(uid, (-bloodstream.BleedAmount), bloodstream);
// Bleed rate is reduced by the bleed reduction amount in the bloodstream component.
TryModifyBleedAmount(uid, -bloodstream.BleedReductionAmount, bloodstream); TryModifyBleedAmount(uid, -bloodstream.BleedReductionAmount, bloodstream);
} }
@@ -160,19 +162,26 @@ public sealed class BloodstreamSystem : EntitySystem
if (bloodloss.Empty) if (bloodloss.Empty)
return; return;
// Does the calculation of how much bleed rate should be added/removed, then applies it
var oldBleedAmount = component.BleedAmount; var oldBleedAmount = component.BleedAmount;
var total = bloodloss.Total; var total = bloodloss.Total;
var totalFloat = total.Float(); var totalFloat = total.Float();
TryModifyBleedAmount(uid, totalFloat, component); TryModifyBleedAmount(uid, totalFloat, component);
var prob = Math.Clamp(totalFloat / 50, 0, 1); /// <summary>
var healPopupProb = Math.Clamp(Math.Abs(totalFloat) / 25, 0, 1); /// Critical hit. Causes target to lose blood, using the bleed rate modifier of the weapon, currently divided by 5
/// The crit chance is currently the bleed rate modifier divided by 25.
/// Higher damage weapons have a higher chance to crit!
/// </summary>
var prob = Math.Clamp(totalFloat / 25, 0, 1);
if (totalFloat > 0 && _robustRandom.Prob(prob)) if (totalFloat > 0 && _robustRandom.Prob(prob))
{ {
TryModifyBloodLevel(uid, (-total) / 5, component); TryModifyBloodLevel(uid, (-total) / 5, component);
_audio.PlayPvs(component.InstantBloodSound, uid); _audio.PlayPvs(component.InstantBloodSound, uid);
} }
else if (totalFloat < 0 && oldBleedAmount > 0 && _robustRandom.Prob(healPopupProb))
// Heat damage will cauterize, causing the bleed rate to be reduced.
else if (totalFloat < 0 && oldBleedAmount > 0)
{ {
// Magically, this damage has healed some bleeding, likely // Magically, this damage has healed some bleeding, likely
// because it's burn damage that cauterized their wounds. // because it's burn damage that cauterized their wounds.
@@ -183,20 +192,25 @@ public sealed class BloodstreamSystem : EntitySystem
uid, PopupType.Medium); uid, PopupType.Medium);
} }
} }
/// <summary>
/// Shows text on health examine, based on bleed rate and blood level.
/// </summary>
private void OnHealthBeingExamined(EntityUid uid, BloodstreamComponent component, HealthBeingExaminedEvent args) private void OnHealthBeingExamined(EntityUid uid, BloodstreamComponent component, HealthBeingExaminedEvent args)
{ {
if (component.BleedAmount > 10) // Shows profusely bleeding at half the max bleed rate.
if (component.BleedAmount > component.MaxBleedAmount / 2)
{ {
args.Message.PushNewline(); args.Message.PushNewline();
args.Message.AddMarkup(Loc.GetString("bloodstream-component-profusely-bleeding", ("target", Identity.Entity(uid, EntityManager)))); args.Message.AddMarkup(Loc.GetString("bloodstream-component-profusely-bleeding", ("target", Identity.Entity(uid, EntityManager))));
} }
// Shows bleeding message when bleeding, but less than profusely.
else if (component.BleedAmount > 0) else if (component.BleedAmount > 0)
{ {
args.Message.PushNewline(); args.Message.PushNewline();
args.Message.AddMarkup(Loc.GetString("bloodstream-component-bleeding", ("target", Identity.Entity(uid, EntityManager)))); args.Message.AddMarkup(Loc.GetString("bloodstream-component-bleeding", ("target", Identity.Entity(uid, EntityManager))));
} }
// If the mob's blood level is below the damage threshhold, the pale message is added.
if (GetBloodLevelPercentage(uid, component) < component.BloodlossThreshold) if (GetBloodLevelPercentage(uid, component) < component.BloodlossThreshold)
{ {
args.Message.PushNewline(); args.Message.PushNewline();

View File

@@ -24,6 +24,13 @@ namespace Content.Server.Medical.Components
[ViewVariables(VVAccess.ReadWrite)] [ViewVariables(VVAccess.ReadWrite)]
public float BloodlossModifier = 0.0f; public float BloodlossModifier = 0.0f;
/// <summary>
/// Restore missing blood.
/// </summary>
[DataField("ModifyBloodLevel")]
[ViewVariables(VVAccess.ReadWrite)]
public float ModifyBloodLevel = 0.0f;
/// <remarks> /// <remarks>
/// The supported damage types are specified using a <see cref="DamageContainerPrototype"/>s. For a /// The supported damage types are specified using a <see cref="DamageContainerPrototype"/>s. For a
/// HealingComponent this filters what damage container type this component should work on. If null, /// HealingComponent this filters what damage container type this component should work on. If null,

View File

@@ -54,6 +54,10 @@ public sealed class HealingSystem : EntitySystem
if (healing.BloodlossModifier != 0) if (healing.BloodlossModifier != 0)
_bloodstreamSystem.TryModifyBleedAmount(uid, healing.BloodlossModifier); _bloodstreamSystem.TryModifyBleedAmount(uid, healing.BloodlossModifier);
// Restores missing blood
if (healing.ModifyBloodLevel != 0)
_bloodstreamSystem.TryModifyBloodLevel(uid, healing.ModifyBloodLevel);
var healed = _damageable.TryChangeDamage(uid, healing.Damage, true, origin: args.Args.User); var healed = _damageable.TryChangeDamage(uid, healing.Damage, true, origin: args.Args.User);
if (healed == null && healing.BloodlossModifier != 0) if (healed == null && healing.BloodlossModifier != 0)

View File

@@ -72,7 +72,7 @@
sprite: Objects/Specific/Service/vending_machine_restock.rsi sprite: Objects/Specific/Service/vending_machine_restock.rsi
state: base state: base
product: CrateVendingMachineRestockMedicalFilled product: CrateVendingMachineRestockMedicalFilled
cost: 1500 cost: 1750
category: Medical category: Medical
group: market group: market

View File

@@ -17,6 +17,8 @@
amount: 2 amount: 2
- id: Gauze - id: Gauze
amount: 2 amount: 2
- id: Bloodpack
amount: 2
- id: BoxLatexGloves - id: BoxLatexGloves
amount: 1 amount: 1
- id: BoxSterileMask - id: BoxSterileMask

View File

@@ -59,9 +59,13 @@
- type: StorageFill - type: StorageFill
contents: contents:
- id: Brutepack - id: Brutepack
amount: 3 amount: 2
- id: Ointment - id: Ointment
amount: 3 amount: 2
- id: Bloodpack
amount: 2
- id: Gauze
amount: 1
- id: EmergencyMedipen #You never know what people are going to latejoin into - id: EmergencyMedipen #You never know what people are going to latejoin into
- type: entity - type: entity

View File

@@ -10,10 +10,10 @@
amount: 1 amount: 1
- id: Brutepack - id: Brutepack
amount: 2 amount: 2
- id: Gauze
amount: 1
- id: Ointment - id: Ointment
amount: 2 amount: 2
- id: PillTricordrazine
amount: 3
# see https://github.com/tgstation/blob/master/code/game/objects/items/storage/firstaid.dm for example contents # see https://github.com/tgstation/blob/master/code/game/objects/items/storage/firstaid.dm for example contents
- type: entity - type: entity
@@ -24,11 +24,9 @@
- type: StorageFill - type: StorageFill
contents: contents:
- id: Ointment - id: Ointment
amount: 2 amount: 4
- id: PillKelotane - id: PillKelotane
amount: 3 amount: 3
- id: SyringeInaprovaline
amount: 1
- type: entity - type: entity
id: MedkitBruteFilled id: MedkitBruteFilled
@@ -42,7 +40,11 @@
- id: PillIron - id: PillIron
amount: 2 amount: 2
- id: Gauze - id: Gauze
amount: 2 amount: 1
- id: Bloodpack
amount: 1
- id: SyringeTranexamicAcid
amount: 1
- type: entity - type: entity
id: MedkitToxinFilled id: MedkitToxinFilled
@@ -57,6 +59,8 @@
amount: 1 amount: 1
- id: PillDylovene - id: PillDylovene
amount: 3 amount: 3
- id: AntiPoisonMedipen
amount: 1
- type: entity - type: entity
id: MedkitOxygenFilled id: MedkitOxygenFilled
@@ -70,7 +74,7 @@
- id: PillDexalin - id: PillDexalin
amount: 3 amount: 3
- id: SyringeInaprovaline - id: SyringeInaprovaline
amount: 1 amount: 2
- type: entity - type: entity
id: MedkitRadiationFilled id: MedkitRadiationFilled
@@ -93,16 +97,14 @@
components: components:
- type: StorageFill - type: StorageFill
contents: contents:
- id: HandheldHealthAnalyzer
amount: 1
- id: Brutepack - id: Brutepack
amount: 3 # TO DO: Advanced fills amount: 2 # TO DO: Advanced fills
- id: SyringeTranexamicAcid - id: Gauze
amount: 1 amount: 1
- id: PillTricordrazine - id: Ointment
amount: 1
- id: AntiPoisonMedipen
amount: 1 amount: 1
- id: Bloodpack
amount: 2
- type: entity - type: entity
id: MedkitCombatFilled id: MedkitCombatFilled
@@ -117,10 +119,10 @@
amount: 1 # TO DO: More combat meds amount: 1 # TO DO: More combat meds
- id: SyringeTranexamicAcid - id: SyringeTranexamicAcid
amount: 1 amount: 1
- id: PillTricordrazine
amount: 1
- id: AntiPoisonMedipen - id: AntiPoisonMedipen
amount: 1 amount: 1
- id: Bloodpack
amount: 2
- type: entity - type: entity
id: StimkitFilled id: StimkitFilled

View File

@@ -15,6 +15,8 @@
amount: 2 amount: 2
- id: Ointment - id: Ointment
amount: 2 amount: 2
- id: Bloodpack
amount: 2
- type: entity - type: entity
id: LockerWallMedicalFilled id: LockerWallMedicalFilled
@@ -34,6 +36,8 @@
amount: 2 amount: 2
- id: Ointment - id: Ointment
amount: 2 amount: 2
- id: Bloodpack
amount: 2
- type: entity - type: entity
@@ -85,7 +89,10 @@
- type: StorageFill - type: StorageFill
contents: contents:
- id: BoxSyringe - id: BoxSyringe
amount: 1
- id: BoxBeaker - id: BoxBeaker
amount: 1
- id: BoxPillCanister - id: BoxPillCanister
amount: 1
- id: BoxBottle - id: BoxBottle
- id: BoxBottle amount: 2

View File

@@ -4,5 +4,6 @@
HandheldHealthAnalyzer: 3 HandheldHealthAnalyzer: 3
Brutepack: 5 Brutepack: 5
Ointment: 5 Ointment: 5
Bloodpack: 5
EpinephrineChemistryBottle: 3 EpinephrineChemistryBottle: 3
Syringe: 5 Syringe: 5

View File

@@ -1,7 +1,8 @@
- type: vendingMachineInventory - type: vendingMachineInventory
id: NanoMedInventory id: NanoMedInventory
startingInventory: startingInventory:
Brutepack: 5 Brutepack: 3
Ointment: 5 Ointment: 3
Bloodpack: 3
EpinephrineChemistryBottle: 3 EpinephrineChemistryBottle: 3
Syringe: 5 Syringe: 3

View File

@@ -147,16 +147,16 @@
Blunt: 5 Blunt: 5
# Represents which damage types should be modified # Represents which damage types should be modified
# in relation to how they cause bloodloss damage. # in relation to how they cause bleed rate.
- type: damageModifierSet - type: damageModifierSet
id: BloodlossHuman id: BloodlossHuman
coefficients: coefficients:
Blunt: 0.8 Blunt: 0.08
Slash: 2.5 Slash: 0.25
Piercing: 2.0 Piercing: 0.2
Shock: 0.0 Shock: 0.0
Cold: 0.0 Cold: 0.0
Heat: -0.25 # heat damage cauterizes wounds! Heat: -1 # heat damage cauterizes wounds, but will still hurt obviously.
Poison: 0.0 Poison: 0.0
Radiation: 0.0 Radiation: 0.0
Asphyxiation: 0.0 Asphyxiation: 0.0

View File

@@ -237,6 +237,7 @@
- Bottle - Bottle
- Spray - Spray
- Brutepack - Brutepack
- Bloodpack
- Gauze - Gauze
- Ointment - Ointment
- CigPack - CigPack

View File

@@ -1647,14 +1647,6 @@
gender: epicene gender: epicene
- type: Bloodstream - type: Bloodstream
bloodReagent: DemonsBlood bloodReagent: DemonsBlood
bloodlossDamage:
types:
Bloodloss:
1
bloodlossHealDamage:
types:
Bloodloss:
-0.25
- type: Damageable - type: Damageable
damageContainer: Biological damageContainer: Biological
damageModifierSet: Infernal damageModifierSet: Infernal

View File

@@ -19,7 +19,7 @@
bloodlossHealDamage: bloodlossHealDamage:
types: types:
Bloodloss: Bloodloss:
-0.25 -1
- type: InteractionOutline - type: InteractionOutline
- type: Fixtures - type: Fixtures
fixtures: fixtures:

View File

@@ -67,7 +67,7 @@
bloodlossHealDamage: bloodlossHealDamage:
types: types:
Bloodloss: Bloodloss:
-0.25 -1
- type: Damageable - type: Damageable
damageContainer: Biological damageContainer: Biological
- type: RadiationReceiver - type: RadiationReceiver

View File

@@ -65,14 +65,6 @@
excess: 200 excess: 200
- type: Bloodstream - type: Bloodstream
bloodReagent: FluorosulfuricAcid bloodReagent: FluorosulfuricAcid
bloodlossDamage:
types:
Bloodloss:
1
bloodlossHealDamage:
types:
Bloodloss:
-0.25
- type: MeleeWeapon - type: MeleeWeapon
hidden: true hidden: true
angle: 0 angle: 0

View File

@@ -26,7 +26,7 @@
bloodlossHealDamage: bloodlossHealDamage:
types: types:
Bloodloss: Bloodloss:
-0.25 -1
- type: InteractionOutline - type: InteractionOutline
- type: Fixtures - type: Fixtures
fixtures: fixtures:

View File

@@ -65,7 +65,7 @@
bloodlossHealDamage: bloodlossHealDamage:
types: types:
Bloodloss: Bloodloss:
-0.25 -1
- type: Stamina - type: Stamina
- type: StatusEffects - type: StatusEffects
allowed: allowed:

View File

@@ -26,14 +26,6 @@
amount: 5 amount: 5
- type: Bloodstream - type: Bloodstream
bloodReagent: Water bloodReagent: Water
bloodlossDamage:
types:
Bloodloss:
1
bloodlossHealDamage:
types:
Bloodloss:
-0.25
- type: Fixtures - type: Fixtures
fixtures: fixtures:
- shape: - shape:

View File

@@ -21,14 +21,6 @@
damageModifierSet: Slime damageModifierSet: Slime
- type: Bloodstream - type: Bloodstream
bloodReagent: Slime # TODO Color slime blood based on their slime color or smth bloodReagent: Slime # TODO Color slime blood based on their slime color or smth
bloodlossDamage:
types:
Bloodloss:
1
bloodlossHealDamage:
types:
Bloodloss:
-0.25
- type: Barotrauma - type: Barotrauma
damage: damage:
types: types:

View File

@@ -59,7 +59,6 @@
damage: damage:
groups: groups:
Brute: -15 # 5 for each type in the group Brute: -15 # 5 for each type in the group
bloodlossModifier: -3 # a little bit of bloodloss healing.
healingBeginSound: healingBeginSound:
path: "/Audio/Items/Medical/brutepack_begin.ogg" path: "/Audio/Items/Medical/brutepack_begin.ogg"
healingEndSound: healingEndSound:
@@ -70,6 +69,33 @@
- type: StackPrice - type: StackPrice
price: 10 price: 10
- type: entity
name: blood pack
description: Contains a groundbreaking universal blood replacement created by Nanotrasen's advanced medical science.
parent: BaseHealingItem
id: Bloodpack
components:
- type: Tag
tags:
- Bloodpack
- type: Sprite
state: bloodpack
- type: Healing
damageContainer: Biological
damage:
types:
bloodloss: -0.5 #for whatever godforsaken reason I cannot touch blood level without healing one of these, so fuck it, bleed rate healing
ModifyBloodLevel: 10
healingBeginSound:
path: "/Audio/Items/Medical/brutepack_begin.ogg"
healingEndSound:
path: "/Audio/Items/Medical/brutepack_end.ogg"
- type: Stack
stackType: Bloodpack
count: 10
- type: StackPrice
price: 10
- type: entity - type: entity
name: roll of gauze name: roll of gauze
description: Some sterile gauze to wrap around bloody stumps. description: Some sterile gauze to wrap around bloody stumps.

View File

@@ -24,6 +24,12 @@
- type: Item - type: Item
sprite: Objects/Specific/Medical/Surgery/cautery.rsi sprite: Objects/Specific/Medical/Surgery/cautery.rsi
- type: ItemCooldown - type: ItemCooldown
- type: MeleeWeapon
damage:
types:
Heat: 5
soundHit:
path: /Audio/Effects/lightburn.ogg
# Drill # Drill

View File

@@ -118,7 +118,7 @@
Medicine: Medicine:
effects: effects:
- !type:ModifyBloodLevel - !type:ModifyBloodLevel
amount: 2 amount: 4
- type: reagent - type: reagent
id: Lithium id: Lithium

View File

@@ -1,4 +1,4 @@
- type: stack - type: stack
id: Ointment id: Ointment
name: ointment name: ointment
icon: { sprite: "/Textures/Objects/Specific/Medical/medical.rsi", state: ointment } icon: { sprite: "/Textures/Objects/Specific/Medical/medical.rsi", state: ointment }
@@ -25,3 +25,10 @@
icon: { sprite: "/Textures/Objects/Specific/Medical/medical.rsi", state: gauze } icon: { sprite: "/Textures/Objects/Specific/Medical/medical.rsi", state: gauze }
spawn: Brutepack spawn: Brutepack
maxCount: 10 maxCount: 10
- type: stack
id: Bloodpack
name: bloodpack
icon: { sprite: "/Textures/Objects/Specific/Medical/medical.rsi", state: bloodpack }
spawn: Bloodpack
maxCount: 10

View File

@@ -22,6 +22,9 @@
- type: Tag - type: Tag
id: BikeHorn id: BikeHorn
- type: Tag
id: Bloodpack
- type: Tag - type: Tag
id: BodyBag id: BodyBag

Binary file not shown.

After

Width:  |  Height:  |  Size: 407 B

View File

@@ -1,7 +1,7 @@
{ {
"version": 1, "version": 1,
"license": "CC-BY-SA-3.0", "license": "CC-BY-SA-3.0",
"copyright": "Taken from cev-eris at https://github.com/discordia-space/CEV-Eris/commit/740ff31a81313086cf16761f3677cf1e2ab46c93", "copyright": "Taken from cev-eris at https://github.com/discordia-space/CEV-Eris/commit/740ff31a81313086cf16761f3677cf1e2ab46c93 and Taken from tgstation at https://github.com/tgstation/tgstation/blob/623290915c2292b56da11048deb62d758e1e3fb4/icons/obj/bloodpack.dmi",
"size": { "size": {
"x": 32, "x": 32,
"y": 32 "y": 32
@@ -37,6 +37,9 @@
{ {
"name": "ointment-inhand-right", "name": "ointment-inhand-right",
"directions": 4 "directions": 4
},
{
"name": "bloodpack"
} }
] ]
} }