Create Generic DamageOnInteract/Attacked Comps/Systems (#30244)
* Everything but the submodule * stuff I forgot * heat * missed lights * behonky * LocId * I guess it was a skill issue? * predicted audio * It works with lights now * Borg equality * Gorilla gauntlet grants protection from anomaly returned damage when attacking it * woops, there we go * NONE * Use DamageModifierSets, remove Behonker damage * Reviews dealt with --------- Co-authored-by: plykiya <plykiya@protonmail.com>
This commit is contained in:
@@ -30,7 +30,6 @@ public abstract class SharedAnomalySystem : EntitySystem
|
||||
[Dependency] private readonly INetManager _net = default!;
|
||||
[Dependency] protected readonly IRobustRandom Random = default!;
|
||||
[Dependency] protected readonly ISharedAdminLogManager AdminLog = default!;
|
||||
[Dependency] private readonly DamageableSystem _damageable = default!;
|
||||
[Dependency] protected readonly SharedAudioSystem Audio = default!;
|
||||
[Dependency] protected readonly SharedAppearanceSystem Appearance = default!;
|
||||
[Dependency] private readonly SharedPhysicsSystem _physics = default!;
|
||||
@@ -42,26 +41,10 @@ public abstract class SharedAnomalySystem : EntitySystem
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<AnomalyComponent, InteractHandEvent>(OnInteractHand);
|
||||
SubscribeLocalEvent<AnomalyComponent, AttackedEvent>(OnAttacked);
|
||||
SubscribeLocalEvent<AnomalyComponent, MeleeThrowOnHitStartEvent>(OnAnomalyThrowStart);
|
||||
SubscribeLocalEvent<AnomalyComponent, MeleeThrowOnHitEndEvent>(OnAnomalyThrowEnd);
|
||||
}
|
||||
|
||||
private void OnInteractHand(EntityUid uid, AnomalyComponent component, InteractHandEvent args)
|
||||
{
|
||||
DoAnomalyBurnDamage(uid, args.User, component);
|
||||
args.Handled = true;
|
||||
}
|
||||
|
||||
private void OnAttacked(EntityUid uid, AnomalyComponent component, AttackedEvent args)
|
||||
{
|
||||
if (HasComp<CorePoweredThrowerComponent>(args.Used))
|
||||
return;
|
||||
|
||||
DoAnomalyBurnDamage(uid, args.User, component);
|
||||
}
|
||||
|
||||
private void OnAnomalyThrowStart(Entity<AnomalyComponent> ent, ref MeleeThrowOnHitStartEvent args)
|
||||
{
|
||||
if (!TryComp<CorePoweredThrowerComponent>(args.Used, out var corePowered) || !TryComp<PhysicsComponent>(ent, out var body))
|
||||
@@ -75,15 +58,6 @@ public abstract class SharedAnomalySystem : EntitySystem
|
||||
_physics.SetBodyType(ent, BodyType.Static);
|
||||
}
|
||||
|
||||
public void DoAnomalyBurnDamage(EntityUid source, EntityUid target, AnomalyComponent component)
|
||||
{
|
||||
_damageable.TryChangeDamage(target, component.AnomalyContactDamage, true);
|
||||
if (!Timing.IsFirstTimePredicted || _net.IsServer)
|
||||
return;
|
||||
Audio.PlayPvs(component.AnomalyContactDamageSound, source);
|
||||
Popup.PopupEntity(Loc.GetString("anomaly-component-contact-damage"), target, target);
|
||||
}
|
||||
|
||||
public void DoAnomalyPulse(EntityUid uid, AnomalyComponent? component = null)
|
||||
{
|
||||
if (!Resolve(uid, ref component))
|
||||
|
||||
Reference in New Issue
Block a user