Allow picking up items in combat mode (#20431)

* Allow picking up items in combat mode

* dont hardcode that
This commit is contained in:
Kara
2023-09-24 12:47:42 -07:00
committed by GitHub
parent 9e1bf43242
commit 657e4d861e
4 changed files with 60 additions and 6 deletions

View File

@@ -1,6 +1,7 @@
using Content.Shared.Bed.Sleep;
using Content.Shared.Emoting;
using Content.Shared.Hands;
using Content.Shared.Interaction;
using Content.Shared.Interaction.Events;
using Content.Shared.Inventory.Events;
using Content.Shared.Item;
@@ -36,6 +37,7 @@ public partial class MobStateSystem
SubscribeLocalEvent<MobStateComponent, UpdateCanMoveEvent>(CheckAct);
SubscribeLocalEvent<MobStateComponent, StandAttemptEvent>(CheckAct);
SubscribeLocalEvent<MobStateComponent, TryingToSleepEvent>(OnSleepAttempt);
SubscribeLocalEvent<MobStateComponent, CombatModeShouldHandInteractEvent>(OnCombatModeShouldHandInteract);
}
private void OnStateExitSubscribers(EntityUid target, MobStateComponent component, MobState state)
@@ -139,5 +141,13 @@ public partial class MobStateSystem
CheckAct(target, component, args);
}
private void OnCombatModeShouldHandInteract(EntityUid uid, MobStateComponent component, ref CombatModeShouldHandInteractEvent args)
{
// Disallow empty-hand-interacting in combat mode
// for non-dead mobs
if (!IsDead(uid, component))
args.Cancelled = true;
}
#endregion
}