12
Content.Server/Magic/Events/SmiteSpellEvent.cs
Normal file
12
Content.Server/Magic/Events/SmiteSpellEvent.cs
Normal 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;
|
||||
}
|
||||
@@ -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>
|
||||
|
||||
@@ -397,7 +397,7 @@ namespace Content.Shared.Body.Components
|
||||
RemovePart(part);
|
||||
|
||||
if (gibParts)
|
||||
part.Gib();
|
||||
gibs.UnionWith(part.Gib());
|
||||
}
|
||||
|
||||
return gibs;
|
||||
|
||||
@@ -287,12 +287,17 @@ namespace Content.Shared.Body.Components
|
||||
/// <summary>
|
||||
/// Gibs the body part.
|
||||
/// </summary>
|
||||
public virtual void Gib()
|
||||
public virtual HashSet<EntityUid> Gib()
|
||||
{
|
||||
var gibs = new HashSet<EntityUid>();
|
||||
|
||||
foreach (var mechanism in _mechanisms)
|
||||
{
|
||||
gibs.Add(mechanism.Owner);
|
||||
RemoveMechanism(mechanism);
|
||||
}
|
||||
|
||||
return gibs;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BIN
Resources/Audio/Magic/disintegrate.ogg
Normal file
BIN
Resources/Audio/Magic/disintegrate.ogg
Normal file
Binary file not shown.
@@ -3,5 +3,6 @@ https://github.com/Citadel-Station-13/Citadel-Station-13/blob/master/sound/magic
|
||||
https://github.com/Citadel-Station-13/Citadel-Station-13/blob/master/sound/magic/Knock.ogg
|
||||
|
||||
fireball.ogg taken from /tg/station at https://github.com/tgstation/tgstation/commit/906fb0682bab6a0975b45036001c54f021f58ae7
|
||||
disintegrate.ogg from /tg/station at https://github.com/tgstation/tgstation/commit/6fde7a49fcd56d6edb844cd31a04ce026065de8b
|
||||
|
||||
copyright: CC BY-SA 3.0
|
||||
copyright: CC BY-SA 3.0
|
||||
|
||||
@@ -9,6 +9,10 @@ action-name-spell-knock = Knock
|
||||
action-description-spell-knock = This spell opens nearby doors.
|
||||
action-speech-spell-knock = AULIE OXIN FIERA
|
||||
|
||||
action-name-spell-smite = Smite
|
||||
action-description-spell-smite = Instantly gibs a target.
|
||||
action-speech-spell-smite = EI NATH!
|
||||
|
||||
action-name-spell-blink = Blink
|
||||
action-description-spell-blink = Teleport to the clicked location.
|
||||
|
||||
|
||||
@@ -50,6 +50,20 @@
|
||||
worldSpells:
|
||||
Blink: -1
|
||||
|
||||
- type: entity
|
||||
id: SmiteBook
|
||||
name: smite spellbook
|
||||
parent: BaseSpellbook
|
||||
components:
|
||||
- type: Sprite
|
||||
netsync: false
|
||||
sprite: Objects/Magic/spellbooks.rsi
|
||||
layers:
|
||||
- state: spellbook
|
||||
- type: Spellbook
|
||||
entitySpells:
|
||||
Smite: -1
|
||||
|
||||
- type: entity
|
||||
id: KnockSpellbook
|
||||
name: knock spellbook
|
||||
|
||||
18
Resources/Prototypes/Magic/smite_spells.yml
Normal file
18
Resources/Prototypes/Magic/smite_spells.yml
Normal file
@@ -0,0 +1,18 @@
|
||||
- type: entityTargetAction
|
||||
id: Smite
|
||||
name: action-name-spell-smite
|
||||
description: action-description-spell-smite
|
||||
useDelay: 60
|
||||
speech: action-speech-spell-smite
|
||||
itemIconStyle: BigAction
|
||||
whitelist:
|
||||
components:
|
||||
- Body
|
||||
canTargetSelf: false
|
||||
interactOnMiss: false
|
||||
sound: !type:SoundPathSpecifier
|
||||
path: /Audio/Magic/disintegrate.ogg
|
||||
icon:
|
||||
sprite: Objects/Magic/magicactions.rsi
|
||||
state: gib
|
||||
serverEvent: !type:SmiteSpellEvent
|
||||
Reference in New Issue
Block a user