* EI NATH

* fix gibs

* figs
This commit is contained in:
Kara
2022-06-23 05:19:32 -07:00
committed by GitHub
parent d684c67ee3
commit a63f698544
9 changed files with 84 additions and 3 deletions

View File

@@ -0,0 +1,12 @@
using Content.Shared.Actions;
namespace Content.Server.Magic.Events;
public sealed class SmiteSpellEvent : EntityTargetActionEvent
{
/// <summary>
/// Should this smite delete all parts/mechanisms gibbed except for the brain?
/// </summary>
[DataField("deleteNonBrainParts")]
public bool DeleteNonBrainParts = true;
}

View File

@@ -1,4 +1,5 @@
using System.Threading;
using Content.Server.Body.Components;
using Content.Server.Coordinates.Helpers;
using Content.Server.Decals;
using Content.Server.DoAfter;
@@ -9,6 +10,7 @@ using Content.Server.Spawners.Components;
using Content.Server.Weapon.Ranged.Systems;
using Content.Shared.Actions;
using Content.Shared.Actions.ActionTypes;
using Content.Shared.Body.Components;
using Content.Shared.Doors.Components;
using Content.Shared.Doors.Systems;
using Content.Shared.Interaction.Events;
@@ -49,6 +51,7 @@ public sealed class MagicSystem : EntitySystem
SubscribeLocalEvent<InstantSpawnSpellEvent>(OnInstantSpawn);
SubscribeLocalEvent<TeleportSpellEvent>(OnTeleportSpell);
SubscribeLocalEvent<KnockSpellEvent>(OnKnockSpell);
SubscribeLocalEvent<SmiteSpellEvent>(OnSmiteSpell);
SubscribeLocalEvent<WorldSpawnSpellEvent>(OnWorldSpawn);
SubscribeLocalEvent<ProjectileSpellEvent>(OnProjectileSpell);
}
@@ -264,6 +267,30 @@ public sealed class MagicSystem : EntitySystem
args.Handled = true;
}
private void OnSmiteSpell(SmiteSpellEvent ev)
{
if (ev.Handled)
return;
if (!TryComp<BodyComponent>(ev.Target, out var body))
return;
var ents = body.Gib(true);
if (!ev.DeleteNonBrainParts)
return;
foreach (var part in ents)
{
// just leaves a brain and clothes
if ((HasComp<BodyPartComponent>(part) || HasComp<MechanismComponent>(part))
&& !HasComp<BrainComponent>(part))
{
QueueDel(part);
}
}
}
/// <summary>
/// Spawns entity prototypes from a list within range of click.
/// </summary>