make limb severing bleed instead of bloodloss damage (#2668)

Co-authored-by: deltanedas <@deltanedas:kde.org>
This commit is contained in:
deltanedas 2025-01-09 18:02:34 +00:00 committed by GitHub
parent c5a008cb81
commit 17d0861596
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 15 additions and 16 deletions

View File

@ -23,6 +23,7 @@ namespace Content.Server.Body.Systems;
public sealed class BodySystem : SharedBodySystem
{
[Dependency] private readonly BloodstreamSystem _bloodstream = default!; // Shitmed Change
[Dependency] private readonly GhostSystem _ghostSystem = default!;
[Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly HumanoidAppearanceSystem _humanoidSystem = default!;
@ -195,5 +196,13 @@ public sealed class BodySystem : SharedBodySystem
Dirty(target, bodyAppearance);
}
protected override void PartRemoveDamage(Entity<BodyComponent?> bodyEnt, Entity<BodyPartComponent> partEnt)
{
var bleeding = partEnt.Comp.SeverBleeding;
if (partEnt.Comp.IsVital)
bleeding *= 2f;
_bloodstream.TryModifyBleedAmount(bodyEnt, bleeding);
}
// Shitmed Change End
}

View File

@ -32,11 +32,11 @@ public sealed partial class BodyPartComponent : Component, ISurgeryToolComponent
public BodyPartSlot? ParentSlot;
/// <summary>
/// Shitmed Change: Amount of damage to deal when the part gets removed.
/// Only works if IsVital is true.
/// Shitmed Change: Bleeding stacks to give when this body part is severed.
/// Doubled for <see cref="IsVital"/>. parts.
/// </summary>
[DataField, AutoNetworkedField]
public FixedPoint2 VitalDamage = 100;
[DataField]
public float SeverBleeding = 4f;
[DataField, AlwaysPushInheritance]
public string ToolName { get; set; } = "A body part";

View File

@ -383,19 +383,9 @@ public partial class SharedBodySystem
}
}
private void PartRemoveDamage(Entity<BodyComponent?> bodyEnt, Entity<BodyPartComponent> partEnt)
// Shitmed Change: made virtual, bleeding damage is done on server
protected virtual void PartRemoveDamage(Entity<BodyComponent?> bodyEnt, Entity<BodyPartComponent> partEnt)
{
if (!Resolve(bodyEnt, ref bodyEnt.Comp, logMissing: false))
return;
if (!_timing.ApplyingState
&& partEnt.Comp.IsVital
&& !GetBodyChildrenOfType(bodyEnt, partEnt.Comp.PartType, bodyEnt.Comp).Any()
)
{
var damage = new DamageSpecifier(Prototypes.Index<DamageTypePrototype>("Bloodloss"), partEnt.Comp.VitalDamage); // Shitmed Change
Damageable.TryChangeDamage(bodyEnt, damage, partMultiplier: 0f); // Shitmed Change
}
}
/// <summary>