* Add powered crossbow

* Add spear embedding (#18578)

* Add spear embedding

* fuck this copy-paste

* Juicier

* the river

* Add crossbow embedding

* Fix crossbow construction

* Finish crossbow

* Remove unused

---------

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
Aviu00
2023-08-24 21:05:56 +03:00
committed by Aviu00
parent 7b9a36e4b6
commit d0431ee61e
31 changed files with 723 additions and 15 deletions

View File

@@ -0,0 +1,43 @@
using Content.Shared.Projectiles;
using Content.Shared.Throwing;
using Content.Shared.White.Crossbow;
namespace Content.Server.White.Crossbow;
public sealed class ThrowDamageModifierSystem : EntitySystem
{
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<ThrowDamageModifierComponent, StopThrowEvent>(OnStopped);
SubscribeLocalEvent<ThrowDamageModifierComponent, EmbedStartEvent>(OnEmbedStart);
SubscribeLocalEvent<ThrowDamageModifierComponent, EmbedRemovedEvent>(OnEmbedRemoved);
}
private void OnEmbedStart(EntityUid uid, ThrowDamageModifierComponent component, ref EmbedStartEvent args)
{
component.ClearDamageOnRemove = true;
if (component.AddEmbedding)
args.Embed.PreventEmbedding = true;
}
private void OnEmbedRemoved(EntityUid uid, ThrowDamageModifierComponent component, EmbedRemovedEvent args)
{
if (!component.ClearDamageOnRemove)
return;
component.ClearDamageOnRemove = false;
component.Damage.DamageDict.Clear();
if (component.AddEmbedding)
RemComp<EmbeddableProjectileComponent>(uid);
}
private void OnStopped(EntityUid uid, ThrowDamageModifierComponent component, StopThrowEvent args)
{
if (!component.ClearDamageOnRemove)
component.Damage.DamageDict.Clear();
}
}