Make it easier to delimb extremities, make it harder to delimb core (#3585)

* Make it easier to delimb extremities, make it harder to delimb core

* thresholds

* thresholds yaml warrioring

* direction feedback

* mrrrp
This commit is contained in:
pathetic meowmeow 2025-05-09 21:16:56 -04:00 committed by GitHub
parent 8601e46844
commit 90dcb5eecc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 126 additions and 7 deletions

View File

@ -117,11 +117,11 @@ public sealed partial class BodyPartComponent : Component, ISurgeryToolComponent
public string Species { get; set; } = "";
/// <summary>
/// Shitmed Change: The total damage that has to be dealt to a body part
/// to make possible severing it.
/// Shitmed Change: Any of these damage specifiers being present on the part
/// will result in it severing
/// </summary>
[DataField, AutoNetworkedField]
public float SeverIntegrity = 90;
public List<DamageSpecifier> SeverThresholds = [];
/// <summary>
/// Shitmed Change: The ID of the base layer for this body part.

View File

@ -34,7 +34,6 @@ public partial class SharedBodySystem
[Dependency] private readonly DamageableSystem _damageable = default!;
[Dependency] private readonly SharedPopupSystem _popup = default!;
private readonly ProtoId<DamageTypePrototype>[] _severingDamageTypes = { "Slash", "Piercing", "Blunt" };
private const double IntegrityJobTime = 0.005;
private readonly JobQueue _integrityJobQueue = new(IntegrityJobTime);
public sealed class IntegrityJob : Job<object>
@ -212,6 +211,19 @@ public partial class SharedBodySystem
return landed;
}
private bool CheckDamageThreshold(DamageSpecifier thresholds, DamageSpecifier testing)
{
foreach (var (kind, amount) in thresholds.DamageDict)
{
if (!testing.DamageDict.TryGetValue(kind, out var testAmount))
return false;
if (testAmount < amount)
return false;
}
return true;
}
private void OnDamageChanged(Entity<BodyPartComponent> partEnt, ref DamageChangedEvent args)
{
if (!TryComp<DamageableComponent>(partEnt, out var damageable) || _timing.ApplyingState) // DeltaV: Don't try to predict limb severing
@ -227,8 +239,7 @@ public partial class SharedBodySystem
&& delta != null
&& !HasComp<BodyPartReattachedComponent>(partEnt)
&& !partEnt.Comp.Enabled
&& damageable.TotalDamage >= partEnt.Comp.SeverIntegrity
&& _severingDamageTypes.Any(damageType => delta.DamageDict.TryGetValue(damageType, out var value) && value > 0))
&& partEnt.Comp.SeverThresholds.Any(threshold => CheckDamageThreshold(threshold, damageable.Damage)))
severed = true;
CheckBodyPart(partEnt, GetTargetBodyPart(partEnt), severed, damageable);

View File

@ -78,6 +78,7 @@
- type: entity
abstract: true
parent: BaseHeadDV # DeltaV - adjusted damages
id: BaseHead
name: "head"
components:
@ -102,6 +103,7 @@
- type: entity
abstract: true
parent: BaseArmDV # DeltaV - adjusted damages
id: BaseLeftArm
name: "left arm"
components:
@ -120,6 +122,7 @@
- type: entity
abstract: true
parent: BaseArmDV # DeltaV - adjusted damages
id: BaseRightArm
name: "right arm"
components:
@ -138,6 +141,7 @@
- type: entity
abstract: true
parent: BaseHandDV # DeltaV - adjusted damages
id: BaseLeftHand
name: "left hand"
components:
@ -152,6 +156,7 @@
- type: entity
abstract: true
parent: BaseHandDV # DeltaV - adjusted damages
id: BaseRightHand
name: "right hand"
components:
@ -166,6 +171,7 @@
- type: entity
abstract: true
parent: BaseLegDV # DeltaV - adjusted damages
id: BaseLeftLeg
name: "left leg"
components:
@ -185,6 +191,7 @@
- type: entity
abstract: true
parent: BaseLegDV # DeltaV - adjusted damages
id: BaseRightLeg
name: "right leg"
components:
@ -204,6 +211,7 @@
- type: entity
abstract: true
parent: BaseFootDV # DeltaV - adjusted damages
id: BaseLeftFoot
name: "left foot"
components:
@ -218,6 +226,7 @@
- type: entity
abstract: true
parent: BaseFootDV # DeltaV - adjusted damages
id: BaseRightFoot
name: "right foot"
components:

View File

@ -0,0 +1,99 @@
- type: entity
abstract: true
id: BaseHeadDV
components:
- type: BodyPart
severThresholds:
- types:
Piercing: 100
- types:
Slash: 100
- types:
Blunt: 100
integrityThresholds:
CriticallyWounded: 90
HeavilyWounded: 75
ModeratelyWounded: 60
SomewhatWounded: 40
LightlyWounded: 20
Healthy: 10
- type: entity
abstract: true
id: BaseArmDV
components:
- type: BodyPart
severThresholds:
- types:
Piercing: 90
- types:
Slash: 55
- types:
Blunt: 90
integrityThresholds:
CriticallyWounded: 50
HeavilyWounded: 40
ModeratelyWounded: 30
SomewhatWounded: 20
LightlyWounded: 15
Healthy: 10
- type: entity
abstract: true
id: BaseHandDV
components:
- type: BodyPart
severThresholds:
- types:
Piercing: 90
- types:
Slash: 40
- types:
Blunt: 90
integrityThresholds:
CriticallyWounded: 35
HeavilyWounded: 30
ModeratelyWounded: 25
SomewhatWounded: 20
LightlyWounded: 15
Healthy: 10
- type: entity
abstract: true
id: BaseLegDV
components:
- type: BodyPart
severThresholds:
- types:
Piercing: 90
- types:
Slash: 80
- types:
Blunt: 90
integrityThresholds:
CriticallyWounded: 70
HeavilyWounded: 60
ModeratelyWounded: 50
SomewhatWounded: 40
LightlyWounded: 20
Healthy: 10
- type: entity
abstract: true
id: BaseFootDV
components:
- type: BodyPart
severThresholds:
- types:
Piercing: 90
- types:
Slash: 40
- types:
Blunt: 90
integrityThresholds:
CriticallyWounded: 35
HeavilyWounded: 30
ModeratelyWounded: 25
SomewhatWounded: 20
LightlyWounded: 15
Healthy: 10

View File

@ -17,7 +17,7 @@
- trigger:
!type:DamageTypeTrigger
damageType: Slash
damage: 60 # DeltaV - was 150
damage: 150
behaviors:
- !type:GibPartBehavior { }
- trigger: