-
Notifications
You must be signed in to change notification settings - Fork 187
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2a5e36e
commit 5eeac51
Showing
15 changed files
with
140 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using Content.Shared.Body.Components; | ||
using Content.Shared.Body.Systems; | ||
using Content.Shared.Body.Events; | ||
using Content.Shared.Body.Organ; | ||
using Content.Server.DelayedDeath; | ||
using Content.Server.Body.Components; | ||
namespace Content.Server.Body.Systems; | ||
|
||
public sealed class HeartSystem : EntitySystem | ||
{ | ||
[Dependency] private readonly SharedBodySystem _bodySystem = default!; | ||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
SubscribeLocalEvent<HeartComponent, OrganAddedToBodyEvent>(HandleAddition); | ||
SubscribeLocalEvent<HeartComponent, OrganRemovedFromBodyEvent>(HandleRemoval); | ||
} | ||
|
||
private void HandleRemoval(EntityUid uid, HeartComponent _, ref OrganRemovedFromBodyEvent args) | ||
{ | ||
if (TerminatingOrDeleted(uid) || TerminatingOrDeleted(args.OldBody)) | ||
return; | ||
|
||
// TODO: Add some form of very violent bleeding effect. | ||
EnsureComp<DelayedDeathComponent>(args.OldBody); | ||
} | ||
|
||
private void HandleAddition(EntityUid uid, HeartComponent _, ref OrganAddedToBodyEvent args) | ||
{ | ||
if (TerminatingOrDeleted(uid) || TerminatingOrDeleted(args.Body)) | ||
return; | ||
|
||
if (_bodySystem.TryGetBodyOrganComponents<BrainComponent>(args.Body, out var _)) | ||
RemComp<DelayedDeathComponent>(args.Body); | ||
} | ||
// Shitmed-End | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
namespace Content.Server.DelayedDeath; | ||
|
||
[RegisterComponent] | ||
public sealed partial class DelayedDeathComponent : Component | ||
{ | ||
/// <summary> | ||
/// How long it takes to kill the entity. | ||
/// </summary> | ||
[DataField] | ||
public float DeathTime = 60; | ||
|
||
/// <summary> | ||
/// How long it has been since the delayed death timer started. | ||
/// </summary> | ||
public float DeathTimer; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using Content.Shared.Body.Organ; | ||
using Content.Shared.Body.Events; | ||
using Content.Shared.Damage; | ||
using Content.Shared.Damage.Prototypes; | ||
using Content.Shared.Mobs.Systems; | ||
using Robust.Shared.Timing; | ||
using Robust.Shared.Prototypes; | ||
namespace Content.Server.DelayedDeath; | ||
|
||
public partial class DelayedDeathSystem : EntitySystem | ||
{ | ||
[Dependency] private readonly DamageableSystem _damageable = default!; | ||
[Dependency] private readonly MobStateSystem _mobState = default!; | ||
[Dependency] private readonly IPrototypeManager _prototypes = default!; | ||
public override void Update(float frameTime) | ||
{ | ||
base.Update(frameTime); | ||
|
||
using var query = EntityQueryEnumerator<DelayedDeathComponent>(); | ||
while (query.MoveNext(out var ent, out var component)) | ||
{ | ||
component.DeathTimer += frameTime; | ||
|
||
if (component.DeathTimer >= component.DeathTime && !_mobState.IsDead(ent)) | ||
{ | ||
var damage = new DamageSpecifier(_prototypes.Index<DamageTypePrototype>("Bloodloss"), 150); | ||
_damageable.TryChangeDamage(ent, damage, partMultiplier: 0f); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
Content.Shared/Medical/Surgery/SurgeryStepDamageChangeEvent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
using Content.Shared.Damage; | ||
|
||
namespace Content.Shared.Medical.Surgery; | ||
|
||
/// <summary> | ||
/// Raised on the target entity. | ||
/// </summary> | ||
[ByRefEvent] | ||
public record struct SurgeryStepDamageChangeEvent(EntityUid User, EntityUid Body, EntityUid Part, EntityUid Step); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters