mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-17 05:27:38 +03:00
# Description Makes natural blood regeneration use up some hunger and thirst, and halt completely when you are starving/dying of thirst. This is necessary to fix two issues: 1. It being possible to feed off of your own blood, by repeatedly drawing your blood and injecting it back with a syringe. (I actually know a few people on floof who do that on a daily basis) 2. Hunger and thirst having no real impact on gameplay, besides giving you a mildly annoying depression overlay when low. This PR also slightly refactors the blood deficiency trait so that it's no longer completely hardcoded in the bloodstream system. <details><summary><h1>Media</h1></summary> <p> https://github.com/user-attachments/assets/f8634de5-19bd-44a5-ada2-62f4504bf3d4 </p> </details> # Changelog 🆑 - add: Blood regeneration now uses up hunger and thirst, and comes to a halt when you are very hungry or thirst. - fix: It is no longer feasible to drink your own blood to satiate your own hunger. # Conflicts: # Content.Server/Body/Systems/BloodstreamSystem.cs
25 lines
868 B
C#
25 lines
868 B
C#
using Content.Server.Body.Components;
|
|
using Content.Server.Body.Events;
|
|
using Content.Server.Traits.Assorted;
|
|
using Content.Shared.FixedPoint;
|
|
|
|
namespace Content.Server.Traits;
|
|
|
|
public sealed class BloodDeficiencySystem : EntitySystem
|
|
{
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
SubscribeLocalEvent<BloodDeficiencyComponent, NaturalBloodRegenerationAttemptEvent>(OnBloodRegen);
|
|
}
|
|
|
|
private void OnBloodRegen(Entity<BloodDeficiencyComponent> ent, ref NaturalBloodRegenerationAttemptEvent args)
|
|
{
|
|
if (!ent.Comp.Active || !TryComp<BloodstreamComponent>(ent.Owner, out var bloodstream))
|
|
return;
|
|
|
|
args.Amount = FixedPoint2.Min(args.Amount, 0) // If the blood regen amount already was negative, we keep it.
|
|
- bloodstream.BloodMaxVolume * ent.Comp.BloodLossPercentage;
|
|
}
|
|
}
|