Let entities attack their outermost container (#13406)

Closes https://github.com/space-wizards/space-station-14/issues/13405
closes https://github.com/space-wizards/space-station-14/issues/13403
This commit is contained in:
Rane
2023-01-20 10:48:28 -05:00
committed by GitHub
parent f0429edbb1
commit 943495922a
2 changed files with 9 additions and 1 deletions

View File

@@ -56,6 +56,7 @@ public abstract class SharedMechSystem : EntitySystem
SubscribeLocalEvent<MechPilotComponent, GetMeleeWeaponEvent>(OnGetMeleeWeapon);
SubscribeLocalEvent<MechPilotComponent, CanAttackFromContainerEvent>(OnCanAttackFromContainer);
SubscribeLocalEvent<MechPilotComponent, AttackAttemptEvent>(OnAttackAttempt);
}
#region State Handling
@@ -451,6 +452,12 @@ public abstract class SharedMechSystem : EntitySystem
args.CanAttack = true;
}
private void OnAttackAttempt(EntityUid uid, MechPilotComponent component, AttackAttemptEvent args)
{
if (args.Target == component.Mech)
args.Cancel();
}
private void UpdateAppearance(EntityUid uid, SharedMechComponent ? component = null, AppearanceComponent? appearance = null)
{
if (!Resolve(uid, ref component, ref appearance, false))