Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor/wounds #13917

Closed
wants to merge 187 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
187 commits
Select commit Hold shift + click to select a range
6b0677a
started work on wound prototypes
Jezithyr Nov 5, 2022
7f57303
implemented wound application and stacking
Jezithyr Nov 12, 2022
bb6d320
implemented SKIN and created Bones!
Jezithyr Nov 13, 2022
d095766
implemented bone typing
Jezithyr Nov 13, 2022
3579d26
fixing a stupid with damage specifier
Jezithyr Nov 13, 2022
170ac18
fixing some serialization fuckups and implementing per part damage caps
Jezithyr Nov 13, 2022
bdf11c4
updating
Jezithyr Nov 13, 2022
854b176
interm commit
Jezithyr Nov 13, 2022
a4ba814
Merge remote-tracking branch 'upstream/master' into refactor/wounds
Jezithyr Nov 13, 2022
f8cf84f
implemented wound table caching, updated wound tables to use severity
Jezithyr Nov 13, 2022
c983122
Implemented Wounding :D
Jezithyr Nov 14, 2022
31e290c
added listener for damage
Jezithyr Nov 14, 2022
cbea569
Merge branch 'master' into refactor/wounds
Jezithyr Nov 14, 2022
8d19e70
Interm test
Jezithyr Nov 14, 2022
eb97064
Fix errors
DrSmugleaf Nov 14, 2022
7629390
Moved woundPools out of damagetype to their own prototype
Jezithyr Nov 15, 2022
ced971e
Unfuck Csproj
Jezithyr Nov 15, 2022
2db4d1e
Converted to new trauma-damage based system
Jezithyr Nov 16, 2022
6db19b3
Merge branch 'refactor/wounds'
Jezithyr Nov 16, 2022
6bbcccb
Merge branch 'master' of https://github.com/space-wizards/space-stati…
DrSmugleaf Nov 16, 2022
8476dd5
Use methods from merge
DrSmugleaf Nov 16, 2022
5bd8295
Cleanup
DrSmugleaf Nov 16, 2022
c0e8821
Cleanup
DrSmugleaf Nov 16, 2022
5bb7447
Default to traumaType if no penTraumaType
DrSmugleaf Nov 16, 2022
02a7376
Remove infected
DrSmugleaf Nov 16, 2022
1a215cf
Cleanup
DrSmugleaf Nov 16, 2022
d87d7d7
Add health damage and integrity damage
DrSmugleaf Nov 16, 2022
37962b9
Merge branch 'master' of https://github.com/space-wizards/space-stati…
DrSmugleaf Nov 16, 2022
070a1c4
Fix sandbox error
DrSmugleaf Nov 16, 2022
24df4b7
Add test injury crack
DrSmugleaf Nov 16, 2022
f2a286c
Roll pen chance with default type as pen type
DrSmugleaf Nov 17, 2022
381e5c0
removing Severity from wounds
Jezithyr Nov 17, 2022
cb14fb2
Merge remote-tracking branch 'Sanctuary-Station/refactor/wounds' into…
Jezithyr Nov 17, 2022
e9ac961
Change TryPickInjury to get the first injury
DrSmugleaf Nov 17, 2022
02a0350
Merge remote-tracking branch 'sanctuary/refactor/wounds' into refacto…
DrSmugleaf Nov 17, 2022
5fcc42c
Add slash injuries, remove TraumaSpecifier, cleanup
DrSmugleaf Nov 17, 2022
53ea81b
Pick random part instead of applying to all
DrSmugleaf Nov 17, 2022
33e8ae1
Rename injury to wound
DrSmugleaf Nov 17, 2022
c137ae9
Merge branch 'master' of https://github.com/space-wizards/space-stati…
DrSmugleaf Nov 17, 2022
d746bb7
Change wounds to be entities
DrSmugleaf Nov 17, 2022
2b5e05e
Merge branch 'master' of https://github.com/space-wizards/space-stati…
DrSmugleaf Nov 17, 2022
6e682c2
Renamed structure to integrity
Jezithyr Nov 19, 2022
edb048b
Merge branch 'master' of https://github.com/space-wizards/space-stati…
DrSmugleaf Nov 19, 2022
da95faf
Implement wound damage and woundable destruction
DrSmugleaf Nov 19, 2022
444dfab
Gib root parts on destroy
DrSmugleaf Nov 19, 2022
9d9ab53
Add todo for gibbing body parts
DrSmugleaf Nov 19, 2022
34ff0aa
Fix integrity destroy check
DrSmugleaf Nov 23, 2022
a4a8c78
Implemented healthcap-based wounding
Jezithyr Nov 27, 2022
8f13cbb
Split WoundSystem into a partial. Converted severity to use floats
Jezithyr Nov 27, 2022
bbe5e9e
implemented wound healing
Jezithyr Nov 27, 2022
c612176
Interm commit
Jezithyr Nov 27, 2022
96c37f3
implement woundable healing
Jezithyr Nov 27, 2022
58e491f
Fix errors on adding and removing wounds
DrSmugleaf Nov 27, 2022
73592ab
Fixing Typo
Jezithyr Nov 27, 2022
e431e20
Merge remote-tracking branch 'sanctuary/refactor/wounds' into refacto…
DrSmugleaf Nov 27, 2022
a48bb81
Merge remote-tracking branch 'sanctuary/refactor/wounds' into refacto…
DrSmugleaf Nov 27, 2022
04797b2
Fix for healing math
Jezithyr Nov 27, 2022
9402037
adjust wound application order
Jezithyr Nov 27, 2022
0a2018f
Change floats with fixedpoint2
DrSmugleaf Nov 27, 2022
47fcfc7
Merge remote-tracking branch 'sanctuary/refactor/wounds' into refacto…
DrSmugleaf Nov 27, 2022
fe42976
Add component states
DrSmugleaf Nov 27, 2022
611583d
Move traumas inflicted to damage type prototype
DrSmugleaf Nov 27, 2022
9c89c03
Started creating Medical Hud
Jezithyr Nov 27, 2022
a645952
Merge remote-tracking branch 'Sanctuary-Station/refactor/wounds' into…
Jezithyr Nov 27, 2022
54490a3
Moved Medical status into it's own control for tabbing
Jezithyr Nov 27, 2022
2c5de9c
Merge branch 'master' into refactor/wounds
Jezithyr Dec 16, 2022
6638c20
Implemented UI frontend for Firstaid/treatment window
Jezithyr Dec 17, 2022
fee488d
started implementing medical ui menu
Jezithyr Dec 18, 2022
e819bd1
continued implementing medial ui
Jezithyr Dec 19, 2022
9e9f362
Created EntityFlag System.
Jezithyr Dec 19, 2022
b5633db
Created EntityFlag System.
Jezithyr Dec 19, 2022
cc3fd8c
Merge remote-tracking branch 'Sanctuary-Station/refactor/wounds' into…
Jezithyr Dec 19, 2022
8b37ad7
a
Jezithyr Dec 19, 2022
a783236
Removed entity flags and setup MentalState
Jezithyr Dec 19, 2022
6e83733
Cleaned up obsolete properties from MobStateComponent
Jezithyr Dec 20, 2022
5ec15ea
Merge branch 'master' into refactor/mobstate
Jezithyr Dec 20, 2022
edc327a
interm commit
Jezithyr Dec 20, 2022
d5cb986
Converted MobState to use ticketing system
Jezithyr Dec 20, 2022
c30c2cf
Merge branch 'master' into refactor/mobstate
Jezithyr Dec 20, 2022
9f37025
Fixing some errors with mobstatecomp
Jezithyr Dec 26, 2022
b674bd8
Converted old systems to use new mobstate system
Jezithyr Jan 7, 2023
30220fd
Removed clientside and serverside mobstate, renamed sharedMobstate to…
Jezithyr Jan 7, 2023
4f9022d
updating mobstate namespaces fixing compile errors
Jezithyr Jan 7, 2023
b40f889
converted mobstate in yaml to mobthresholds
Jezithyr Jan 8, 2023
3de1b9e
fixed rev
Jezithyr Jan 8, 2023
3967bc1
Namespace and file folder cleanup
Jezithyr Jan 9, 2023
c651d31
Converted mob event to use broadcast
Jezithyr Jan 9, 2023
e3cda29
Fixing some a typo with mobstate logic and cleaning up damage overlay…
Jezithyr Jan 9, 2023
68088ae
Merge remote-tracking branch 'origin/master' into refactor/mobstate
Jezithyr Jan 9, 2023
c9bdac9
Fixing merge conflicts
Jezithyr Jan 9, 2023
7ce1fca
Mobstate actually works
Jezithyr Jan 9, 2023
f29aa1a
Fixed damage overlay
Jezithyr Jan 9, 2023
a116fe6
Fix entering the old state instead of new
DrSmugleaf Jan 9, 2023
e6ab93b
Fix checking for Asphyxiation instead of Airloss
DrSmugleaf Jan 9, 2023
f853e18
Fix usages of MobState
DrSmugleaf Jan 9, 2023
3f4f74b
Fix not clearing crit and brute overlays
DrSmugleaf Jan 9, 2023
8bcbbf3
Fix the dumb
Jezithyr Jan 10, 2023
df0f5b9
Merge branch 'refactor/mobstate' into refactor/wounds
Jezithyr Jan 10, 2023
3d62cf2
Fixing a sus dependency
Jezithyr Jan 10, 2023
3f1cbe4
Fix tests and reformat
DrSmugleaf Jan 10, 2023
2595687
Reset RobustToolbox
DrSmugleaf Jan 10, 2023
6caebba
Merge branch 'master' of https://github.com/space-wizards/space-stati…
DrSmugleaf Jan 10, 2023
508f449
Replace ticketing with an event
DrSmugleaf Jan 10, 2023
27bb73f
Converting MentalState System to Consciousness System
Jezithyr Jan 10, 2023
6e40715
Implement get/handle state for ConsciousnessComponent
DrSmugleaf Jan 10, 2023
1e179af
Merge branch 'refactor/mobstate' into refactor/wounds
Jezithyr Jan 10, 2023
3a6e0ed
Setup consciousness affecting mobstate
Jezithyr Jan 10, 2023
51f3cee
Cleanup/simplification of consciousness update event
Jezithyr Jan 10, 2023
812b9c0
Adjusted ComponentUpdate pattern for Consciousness
Jezithyr Jan 10, 2023
227278e
Fixing double resolve
Jezithyr Jan 10, 2023
b679a81
Implemented circulation
Jezithyr Jan 10, 2023
df6cf6b
V 0.5 Circulation system
Jezithyr Jan 11, 2023
22dc816
renaming for clarity
Jezithyr Jan 11, 2023
ee8d8b6
Fixed some typos added a relay for circulation ticks to circulationVe…
Jezithyr Jan 11, 2023
97d8485
Implemented networking
Jezithyr Jan 11, 2023
c83c2ce
Deleting respiration and circulation
Jezithyr Jan 12, 2023
832d1bc
Merge branch 'master' into refactor/wounds
Jezithyr Jan 14, 2023
3fe1012
Merge branch 'master' into refactor/wounds
Jezithyr Jan 14, 2023
bdf2f28
Merge branch 'master' into refactor/wounds
Jezithyr Jan 15, 2023
d1bb2b1
Merge branch 'master' into refactor/wounds
Jezithyr Jan 15, 2023
116b88f
Merge remote-tracking branch 'Sanctuary-Station/master' into refactor…
Jezithyr Jan 16, 2023
4bd0411
Implemented medical conditions
Jezithyr Jan 16, 2023
bc6b3c7
Merge branch 'master' into refactor/wounds
Jezithyr Jan 16, 2023
74beba2
Merge branch 'master' into refactor/wounds
Jezithyr Jan 22, 2023
8835bc3
Merge branch 'master' into refactor/wounds
Jezithyr Jan 27, 2023
071adb6
Implemented support for multiple condition groups on a single medical…
Jezithyr Jan 27, 2023
a661bba
Reverted conditions having multiple groups
Jezithyr Jan 27, 2023
9144bcd
Created pain system + setup test wounds
Jezithyr Jan 28, 2023
5341102
File Cleanup, Implemented wound event relays to root bodies
Jezithyr Jan 28, 2023
667bd58
Removing generalized pain system
Jezithyr Jan 29, 2023
1724582
Wounding cleanup
Jezithyr Feb 3, 2023
3a4ef82
Remove skin and bone code
DrSmugleaf Feb 4, 2023
fe3d8fe
Rename medical conditions to symptoms
DrSmugleaf Feb 4, 2023
3ddb940
Fix naming for passOutThreshold
DrSmugleaf Feb 4, 2023
cfee65d
Finish renaming to symptoms, fix removing symptoms
DrSmugleaf Feb 4, 2023
19af7bd
Merge branch 'master' of https://github.com/space-wizards/space-stati…
DrSmugleaf Feb 4, 2023
7b9eb15
Add missing custom type serializer to symptom group symptom
DrSmugleaf Feb 4, 2023
eb3d032
Remove description and group from symptom component
DrSmugleaf Feb 4, 2023
4da443b
Cleanup wound prototypes
DrSmugleaf Feb 5, 2023
7500ce7
Remove symptoms
DrSmugleaf Feb 5, 2023
3959096
Rename TraumaGroups to Traumas
DrSmugleaf Feb 5, 2023
b11b5fd
removing unimplemented functionality
Jezithyr Feb 6, 2023
1546868
Re-added pain, implemented start of WoundProtos
Jezithyr Feb 6, 2023
5c463b2
Adding Pain to bodyparts
Jezithyr Feb 18, 2023
4994e6e
Splitting pain out of bodypart
Jezithyr Feb 18, 2023
6c0f627
adding pain system
Jezithyr Mar 6, 2023
64096ea
Merge remote-tracking branch 'SS14/master' into refactor/wounds
Jezithyr Mar 6, 2023
f1b25dd
update rt to latest
Jezithyr Mar 6, 2023
2372218
Fixing some analyzer errors
Jezithyr Mar 6, 2023
4d8e5a4
Rewrote Consciousness to not be ass to work with
Jezithyr Mar 6, 2023
aa03044
Implemented pain system
Jezithyr Mar 6, 2023
03d80c1
Optimized pain system (removed the thresholds because we already have…
Jezithyr Mar 12, 2023
be26a82
implemented consciousness damage (again)
Jezithyr Mar 13, 2023
18b5e6b
Merge remote-tracking branch 'SS14/master' into refactor/wounds
Jezithyr Mar 18, 2023
428f791
Moved Bleeding to medical folder
Jezithyr Mar 19, 2023
c382789
Implemented wound rejuvenation
Jezithyr Mar 19, 2023
bbaab0d
Formatting cleanup
Jezithyr Mar 19, 2023
612714b
add null checks
deltanedas Mar 28, 2023
c729b06
null check for attaching
deltanedas Mar 30, 2023
73eb593
Started work on treatment system, cleaned up woundable a bit
Jezithyr Apr 1, 2023
32c3efb
started implementing treatments
Jezithyr Apr 1, 2023
df09f6c
adding treatment system
Jezithyr Apr 1, 2023
4ebd2eb
Merge remote-tracking branch 'SS14/master' into refactor/wounds
Jezithyr Apr 6, 2023
f5d29d2
fixing merge conflicts by deleting files what could go wrong!
Jezithyr Apr 8, 2023
371a705
Implemented debug wound list command
Jezithyr Apr 10, 2023
b99c3f9
Merge branch 'master' of https://github.com/space-wizards/space-stati…
DrSmugleaf Apr 14, 2023
1897dc9
Cleanup treatments
DrSmugleaf Apr 14, 2023
34b3dc4
Auto network cleanup
DrSmugleaf Apr 14, 2023
78120ab
Merge fixes
DrSmugleaf Apr 14, 2023
0301151
Merge fixes
DrSmugleaf Apr 14, 2023
a4cb6f4
Woundable, wound and trauma inflicter auto comp states
DrSmugleaf Apr 14, 2023
93ae307
Implement bleed treatments
DrSmugleaf Apr 14, 2023
93cdb29
Implement treatments
DrSmugleaf Apr 14, 2023
fb480c0
Fixed missing partial keyword for autogenerated components
DrSmugleaf Apr 16, 2023
c203e8c
Port MaterialCloth healing
DrSmugleaf Apr 16, 2023
5bb6c95
Updating woundmed prototypes
Jezithyr Apr 16, 2023
ca3f05b
Merge remote-tracking branch 'origin/refactor/wounds' into refactor/w…
Jezithyr Apr 16, 2023
7c5f5a1
Fix startup errors
DrSmugleaf Apr 16, 2023
0303967
started consciousness rewrite to use modifier stacks
Jezithyr Apr 25, 2023
465e703
Finished Consciousness rewrite. A lot simpler (Less math \o/)
Jezithyr Apr 25, 2023
87a95b1
Added support for modifier categories. (to allow more than 1 modifier…
Jezithyr Apr 25, 2023
b708fe0
Merge pull request #2 from deltanedas/patch-3
Jezithyr May 11, 2023
21d33ef
Merge remote-tracking branch 'upstream/master' into refactor/wounds
metalgearsloth May 20, 2023
424469a
weh
metalgearsloth May 20, 2023
b33e635
consciousness
metalgearsloth May 20, 2023
e55524a
Merge remote-tracking branch 'upstream/master' into refactor/wounds
metalgearsloth Jun 23, 2023
f7b389e
weh
metalgearsloth Jun 24, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,16 @@
HorizontalExpand="True"
AppendStyleClass="{x:Static style:StyleBase.ButtonSquare}"
/>
<ui:MenuButton
Name="MedicalButton"
Access="Internal"
Icon="{xe:Tex '/Textures/Interface/fist.svg.192dpi.png'}"
BoundKey = "{x:Static is:ContentKeyFunctions.OpenActionsMenu}"
ToolTip="Open Medical Menu"
MinSize="42 64"
HorizontalExpand="True"
AppendStyleClass="{x:Static style:StyleBase.ButtonSquare}"
/>
<ui:MenuButton
Name="AdminButton"
Access="Internal"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
using Content.Server.Explosion.EntitySystems;
using Content.Server.GhostKick;
using Content.Server.Medical;
using Content.Server.Medical.Bloodstream.Components;
using Content.Server.Medical.Bloodstream.Systems;
using Content.Server.Nutrition.EntitySystems;
using Content.Server.Pointing.Components;
using Content.Server.Polymorph.Systems;
Expand Down
1 change: 1 addition & 0 deletions Content.Server/Body/Components/MetabolizerComponent.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Content.Server.Body.Systems;
using Content.Server.Medical.Bloodstream.Components;
using Content.Shared.Body.Prototypes;
using Content.Shared.FixedPoint;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
Expand Down
1 change: 1 addition & 0 deletions Content.Server/Body/Components/StomachComponent.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Content.Server.Body.Systems;
using Content.Server.Nutrition.EntitySystems;
using Content.Server.Medical.Bloodstream.Components;
using Content.Shared.FixedPoint;
using Content.Shared.Whitelist;

Expand Down
4 changes: 2 additions & 2 deletions Content.Server/Body/Systems/BodySystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public override bool AttachPart(
BodyPartSlot slot,
[NotNullWhen(true)] BodyPartComponent? part = null)
{
if (!base.AttachPart(partId, slot, part))
if (partId == null || !Resolve(partId.Value, ref part, false) || !base.AttachPart(partId, slot, part))
return false;

if (part.Body is { } body &&
Expand All @@ -102,7 +102,7 @@ public override bool DropPart(EntityUid? partId, BodyPartComponent? part = null)
if (partId == null || !Resolve(partId.Value, ref part))
return false;

if (!base.DropPart(partId, part))
if (partId == null || !Resolve(partId.Value, ref part, false) || !base.DropPart(partId, part))
return false;

var oldBody = part.Body;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using Content.Server.Body.Components;
using Content.Server.Chemistry.Components;
using Content.Server.Chemistry.Components.SolutionManager;
using Content.Shared.Chemistry;
using Content.Server.Medical.Bloodstream.Components;
using Content.Shared.Chemistry.Components;
using Content.Shared.Chemistry.Reagent;
using Content.Shared.Database;
Expand Down
1 change: 1 addition & 0 deletions Content.Server/Chemistry/EntitySystems/ChemistrySystem.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Content.Server.Administration.Logs;
using Content.Server.Body.Systems;
using Content.Server.Interaction;
using Content.Server.Medical.Bloodstream.Systems;
using Content.Server.Popups;
using Content.Shared.CombatMode;
using Content.Shared.Chemistry;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
using Content.Server.Body.Systems;
using Content.Server.Chemistry.Components;
using Content.Server.Chemistry.Components.SolutionManager;
using Content.Server.Medical.Bloodstream.Components;
using Content.Server.Medical.Bloodstream.Systems;
using Content.Shared.Inventory;
using JetBrains.Annotations;
using Robust.Shared.Physics.Dynamics;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Content.Shared.Chemistry.Reagent;
using JetBrains.Annotations;
using Content.Server.Body.Systems;
using Robust.Shared.Prototypes;
using Content.Server.Medical.Bloodstream.Systems;

namespace Content.Server.Chemistry.ReactionEffects
{
Expand Down
2 changes: 2 additions & 0 deletions Content.Server/Chemistry/ReagentEffects/ModifyBleedAmount.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using Content.Server.Body.Components;
using Content.Server.Body.Systems;
using Content.Server.Medical.Bloodstream.Components;
using Content.Server.Medical.Bloodstream.Systems;
using Content.Shared.Chemistry.Reagent;
using Robust.Shared.Prototypes;

Expand Down
2 changes: 2 additions & 0 deletions Content.Server/Chemistry/ReagentEffects/ModifyBloodLevel.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using Content.Server.Body.Components;
using Content.Server.Body.Systems;
using Content.Server.Medical.Bloodstream.Components;
using Content.Server.Medical.Bloodstream.Systems;
using Content.Shared.Chemistry.Reagent;
using Content.Shared.FixedPoint;
using Robust.Shared.Prototypes;
Expand Down
1 change: 1 addition & 0 deletions Content.Server/Dragon/DragonSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Content.Server.Chat.Systems;
using Content.Server.GameTicking;
using Content.Server.GameTicking.Rules;
using Content.Server.Medical.Bloodstream.Systems;
using Content.Server.NPC;
using Content.Shared.Damage;
using Content.Shared.Dragon;
Expand Down
2 changes: 2 additions & 0 deletions Content.Server/Fluids/EntitySystems/SmokeSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
using Content.Server.Chemistry.EntitySystems;
using Content.Server.Chemistry.ReactionEffects;
using Content.Server.Coordinates.Helpers;
using Content.Server.Medical.Bloodstream.Components;
using Content.Server.Medical.Bloodstream.Systems;
using Content.Server.Spreader;
using Content.Shared.Chemistry;
using Content.Shared.Chemistry.Components;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
using Content.Server.Climbing;
using Content.Server.Construction;
using Content.Server.Materials;
using Content.Server.Medical.Bloodstream.Components;
using Content.Server.Mind.Components;
using Content.Shared.DoAfter;
using Content.Shared.Humanoid;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using Content.Server.Medical.Bloodstream.Systems;
using Content.Shared.FixedPoint;

namespace Content.Server.Medical.Bloodstream.Components;

[RegisterComponent, Access(typeof(BloodstreamSystem))]
public sealed class BleedInflicterComponent : Component
{
//How much bloodloss to apply
[DataField("bloodloss", required: true)]
public FixedPoint2 Bloodloss;
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
using Content.Server.Body.Systems;
using Content.Server.Chemistry.EntitySystems;
using Content.Server.Medical.Bloodstream.Systems;
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
namespace Content.Server.Medical.Bloodstream.Components
{
[RegisterComponent, Access(typeof(BloodstreamSystem), (typeof(ChemistrySystem)))]
public sealed class BloodstreamComponent : Component
Expand All @@ -29,7 +29,7 @@ public sealed class BloodstreamComponent : Component
/// This generally corresponds to an amount of damage and can't go above 100.
/// </remarks>
[ViewVariables(VVAccess.ReadWrite)]
public float BleedAmount;
public FixedPoint2 BleedAmount;

/// <summary>
/// How much should bleeding should be reduced every update interval?
Expand All @@ -47,7 +47,7 @@ public sealed class BloodstreamComponent : Component
/// What percentage of current blood is necessary to avoid dealing blood loss damage?
/// </summary>
[DataField("bloodlossThreshold")]
public float BloodlossThreshold = 0.9f;
public FixedPoint2 BloodlossThreshold = 0.9f;

/// <summary>
/// The base bloodloss damage to be incurred if below <see cref="BloodlossThreshold"/>
Expand All @@ -74,7 +74,7 @@ public sealed class BloodstreamComponent : Component
/// How much reagent of blood should be restored each update interval?
/// </summary>
[DataField("bloodRefreshAmount")]
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?
Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,31 @@
using Content.Server.Body.Components;
using Content.Server.Body.Systems;
using Content.Server.Chemistry.EntitySystems;
using Content.Server.Chemistry.ReactionEffects;
using Content.Server.Fluids.EntitySystems;
using Content.Server.Forensics;
using Content.Server.HealthExaminable;
using Content.Server.Medical.Bloodstream.Components;
using Content.Server.Popups;
using Content.Shared.Chemistry.Components;
using Content.Shared.Chemistry.Reaction;
using Content.Shared.Damage;
using Content.Shared.Damage.Prototypes;
using Content.Shared.Drunk;
using Content.Shared.FixedPoint;
using Content.Shared.IdentityManagement;
using Content.Shared.Popups;
using Content.Shared.Drunk;
using Content.Shared.Medical.Wounds.Components;
using Content.Shared.Medical.Wounds.Systems;
using Content.Shared.Mobs.Components;
using Content.Shared.Mobs.Systems;
using Content.Shared.Popups;
using Content.Shared.Rejuvenate;
using Robust.Server.GameObjects;
using Robust.Shared.Audio;
using Robust.Shared.Player;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
using Content.Shared.Speech.EntitySystems;

namespace Content.Server.Body.Systems;
namespace Content.Server.Medical.Bloodstream.Systems;

public sealed class BloodstreamSystem : EntitySystem
{
Expand All @@ -49,6 +51,42 @@ public override void Initialize()
SubscribeLocalEvent<BloodstreamComponent, ApplyMetabolicMultiplierEvent>(OnApplyMetabolicMultiplier);
SubscribeLocalEvent<BloodstreamComponent, ReactionAttemptEvent>(OnReactionAttempt);
SubscribeLocalEvent<BloodstreamComponent, RejuvenateEvent>(OnRejuvenate);
SubscribeLocalEvent<BloodstreamComponent, WoundAddedEvent>(OnWoundAdded);
SubscribeLocalEvent<BloodstreamComponent, WoundSeverityChangedEvent>(OnWoundSeverityUpdate);
SubscribeLocalEvent<BloodstreamComponent, WoundCauterizedEvent>(OnWoundCauterizeUpdate);
}

private void OnWoundCauterizeUpdate(EntityUid uid, BloodstreamComponent component, ref WoundCauterizedEvent args)
{
if (!TryComp(args.WoundEntity, out BleedInflicterComponent? bleed))
return;

if (args.OldState)
{
//Add bleeding back if we are reopening a wound
TryModifyBleedAmount(uid, bleed.Bloodloss*args.WoundComponent.Severity, component);
}
else
{
//Remove bleeding if we are cauterizing
TryModifyBleedAmount(uid, - bleed.Bloodloss*args.WoundComponent.Severity, component);
}
}

private void OnWoundSeverityUpdate(EntityUid uid, BloodstreamComponent component, ref WoundSeverityChangedEvent args)
{
if (!TryComp(args.WoundEntity, out BleedInflicterComponent? bleed) || args.WoundComponent.CanBleed)
return;
var severityDelta = args.WoundComponent.Severity - args.OldSeverity;
var bleedDelta = severityDelta * bleed.Bloodloss;
TryModifyBleedAmount(uid, bleedDelta, component);
}

private void OnWoundAdded(EntityUid uid, BloodstreamComponent component, ref WoundAddedEvent args)
{
if (!TryComp(args.WoundEntity, out BleedInflicterComponent? bleed) || args.WoundComponent.CanBleed)
return;
TryModifyBleedAmount(uid, bleed.Bloodloss*args.WoundComponent.Severity, component);
}

private void OnReactionAttempt(EntityUid uid, BloodstreamComponent component, ReactionAttemptEvent args)
Expand Down Expand Up @@ -102,9 +140,7 @@ public override void Update(float frameTime)
// as well as stop their bleeding to a certain extent.
if (bloodstream.BleedAmount > 0)
{
// 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.
TryModifyBloodLevel(uid, (-bloodstream.BleedAmount) / 10, bloodstream);
TryModifyBleedAmount(uid, -bloodstream.BleedReductionAmount, bloodstream);
}

Expand Down Expand Up @@ -173,26 +209,19 @@ private void OnDamageChanged(EntityUid uid, BloodstreamComponent component, Dama
if (bloodloss.Empty)
return;

// Does the calculation of how much bleed rate should be added/removed, then applies it
var oldBleedAmount = component.BleedAmount;
var total = bloodloss.Total;
var totalFloat = total.Float();
TryModifyBleedAmount(uid, totalFloat, component);

/// <summary>
/// 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);
var prob = Math.Clamp(totalFloat / 50, 0, 1);
var healPopupProb = Math.Clamp(Math.Abs(totalFloat) / 25, 0, 1);
if (totalFloat > 0 && _robustRandom.Prob(prob))
{
TryModifyBloodLevel(uid, (-total) / 5, component);
_audio.PlayPvs(component.InstantBloodSound, uid);
}

// Heat damage will cauterize, causing the bleed rate to be reduced.
else if (totalFloat < 0 && oldBleedAmount > 0)
else if (totalFloat < 0 && oldBleedAmount > 0 && _robustRandom.Prob(healPopupProb))
{
// Magically, this damage has healed some bleeding, likely
// because it's burn damage that cauterized their wounds.
Expand All @@ -203,25 +232,20 @@ private void OnDamageChanged(EntityUid uid, BloodstreamComponent component, Dama
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)
{
// Shows profusely bleeding at half the max bleed rate.
if (component.BleedAmount > component.MaxBleedAmount / 2)
if (component.BleedAmount > 10)
{
args.Message.PushNewline();
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)
{
args.Message.PushNewline();
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)
{
args.Message.PushNewline();
Expand Down Expand Up @@ -336,13 +360,13 @@ public bool TryModifyBloodLevel(EntityUid uid, FixedPoint2 amount, BloodstreamCo
/// <summary>
/// Tries to make an entity bleed more or less
/// </summary>
public bool TryModifyBleedAmount(EntityUid uid, float amount, BloodstreamComponent? component = null)
public bool TryModifyBleedAmount(EntityUid uid, FixedPoint2 amount, BloodstreamComponent? component = null)
{
if (!Resolve(uid, ref component, false))
return false;

component.BleedAmount += amount;
component.BleedAmount = Math.Clamp(component.BleedAmount, 0, component.MaxBleedAmount);
component.BleedAmount = FixedPoint2.Clamp(component.BleedAmount, 0, component.MaxBleedAmount);

return true;
}
Expand Down Expand Up @@ -375,4 +399,16 @@ public void SpillAllSolutions(EntityUid uid, BloodstreamComponent? component = n
}
}
}

public void ModifyBleedInflicter(EntityUid inflicterId, EntityUid bloodstreamId, FixedPoint2 delta, BleedInflicterComponent? inflicter = null, WoundComponent? wound = null, BloodstreamComponent? bloodstream = null)
{
if (!Resolve(inflicterId, ref inflicter, ref wound))
return;

var oldBleed = inflicter.Bloodloss * wound.Severity;

inflicter.Bloodloss += delta;
var newBleed = inflicter.Bloodloss * wound.Severity;
TryModifyBleedAmount(bloodstreamId, newBleed - oldBleed, bloodstream);
}
}
Loading