Bows & arrows (#19771)

This commit is contained in:
Kara
2023-09-22 02:45:21 -07:00
committed by GitHub
parent 1ba1ab6d61
commit f8d194b117
51 changed files with 507 additions and 22 deletions

View File

@@ -73,6 +73,14 @@ public abstract partial class SharedProjectileSystem : EntitySystem
_physics.SetBodyType(uid, BodyType.Dynamic, body: physics, xform: xform);
_transform.AttachToGridOrMap(uid, xform);
// Reset whether the projectile has damaged anything if it successfully was removed
if (TryComp<ProjectileComponent>(uid, out var projectile))
{
projectile.Shooter = null;
projectile.Weapon = null;
projectile.DamagedEntity = false;
}
// Land it just coz uhhh yeah
var landEv = new LandEvent(args.User, true);
RaiseLocalEvent(uid, ref landEv);
@@ -81,6 +89,9 @@ public abstract partial class SharedProjectileSystem : EntitySystem
private void OnEmbedThrowDoHit(EntityUid uid, EmbeddableProjectileComponent component, ThrowDoHitEvent args)
{
if (!component.EmbedOnThrow)
return;
Embed(uid, args.Target, component);
}
@@ -91,7 +102,7 @@ public abstract partial class SharedProjectileSystem : EntitySystem
// Raise a specific event for projectiles.
if (TryComp<ProjectileComponent>(uid, out var projectile))
{
var ev = new ProjectileEmbedEvent(projectile.Shooter, projectile.Weapon, args.Target);
var ev = new ProjectileEmbedEvent(projectile.Shooter!.Value, projectile.Weapon!.Value, args.Target);
RaiseLocalEvent(uid, ref ev);
}
}