Allow picking up items in combat mode (#20431)
* Allow picking up items in combat mode * dont hardcode that
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user