Make throwable star damage stamina (#23527)
* feat(star.yml): make throwable star damage stamina * feat(Components): add new StaminaTresholdDamageOnEmbedComponent * feat(SharedProjectileSystem): update system with new events to change stamins treshold on embeed projectile remove / add * feat(StaminaSystem): update system with new subscriptions * feat(throwing_stars): update yml with new component * feat(StaminaDamageOnEmbed): add stamina damage on embeed * cleanup unused / ajust numbers * fix(StaminaSystem / OnEmbedComponent ) apply requested changes * Rest of the review * another warning --------- Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
@@ -55,8 +55,11 @@ public sealed partial class StaminaSystem : EntitySystem
|
||||
SubscribeLocalEvent<StaminaComponent, DisarmedEvent>(OnDisarmed);
|
||||
SubscribeLocalEvent<StaminaComponent, RejuvenateEvent>(OnRejuvenate);
|
||||
|
||||
SubscribeLocalEvent<StaminaDamageOnEmbedComponent, EmbedEvent>(OnProjectileEmbed);
|
||||
|
||||
SubscribeLocalEvent<StaminaDamageOnCollideComponent, ProjectileHitEvent>(OnProjectileHit);
|
||||
SubscribeLocalEvent<StaminaDamageOnCollideComponent, ThrowDoHitEvent>(OnThrowHit);
|
||||
|
||||
SubscribeLocalEvent<StaminaDamageOnHitComponent, MeleeHitEvent>(OnMeleeHit);
|
||||
}
|
||||
|
||||
@@ -114,7 +117,7 @@ public sealed partial class StaminaSystem : EntitySystem
|
||||
component.StaminaDamage = 0;
|
||||
RemComp<ActiveStaminaComponent>(uid);
|
||||
SetStaminaAlert(uid, component);
|
||||
Dirty(component);
|
||||
Dirty(uid, component);
|
||||
}
|
||||
|
||||
private void OnDisarmed(EntityUid uid, StaminaComponent component, DisarmedEvent args)
|
||||
@@ -192,6 +195,14 @@ public sealed partial class StaminaSystem : EntitySystem
|
||||
OnCollide(uid, component, args.Target);
|
||||
}
|
||||
|
||||
private void OnProjectileEmbed(EntityUid uid, StaminaDamageOnEmbedComponent component, ref EmbedEvent args)
|
||||
{
|
||||
if (!TryComp<StaminaComponent>(args.Embedded, out var stamina))
|
||||
return;
|
||||
|
||||
TakeStaminaDamage(args.Embedded, component.Damage, stamina, source: uid);
|
||||
}
|
||||
|
||||
private void OnThrowHit(EntityUid uid, StaminaDamageOnCollideComponent component, ThrowDoHitEvent args)
|
||||
{
|
||||
OnCollide(uid, component, args.Target);
|
||||
|
||||
Reference in New Issue
Block a user