Skip to content

Commit

Permalink
IT WORKS NOW
Browse files Browse the repository at this point in the history
  • Loading branch information
VMSolidus committed Dec 22, 2024
1 parent 505e20b commit 02d15b0
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions Content.Shared/Mobs/Systems/MobStateSystem.Subscribers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public partial class MobStateSystem
private void SubscribeEvents()
{
SubscribeLocalEvent<MobStateComponent, BeforeGettingStrippedEvent>(OnGettingStripped);
SubscribeLocalEvent<MobStateComponent, ChangeDirectionAttemptEvent>(CheckAct);
SubscribeLocalEvent<MobStateComponent, ChangeDirectionAttemptEvent>(OnDirectionAttempt);
SubscribeLocalEvent<MobStateComponent, UseAttemptEvent>(CheckAct);
SubscribeLocalEvent<MobStateComponent, AttackAttemptEvent>(CheckAct);
SubscribeLocalEvent<MobStateComponent, ConsciousAttemptEvent>(CheckAct);
Expand All @@ -42,7 +42,7 @@ private void SubscribeEvents()
SubscribeLocalEvent<MobStateComponent, DropAttemptEvent>(CheckAct);
SubscribeLocalEvent<MobStateComponent, PickupAttemptEvent>(CheckAct);
SubscribeLocalEvent<MobStateComponent, StartPullAttemptEvent>(CheckAct);
SubscribeLocalEvent<MobStateComponent, UpdateCanMoveEvent>(CheckAct);
SubscribeLocalEvent<MobStateComponent, UpdateCanMoveEvent>(OnMoveAttempt);
SubscribeLocalEvent<MobStateComponent, StandAttemptEvent>(CheckAct);
SubscribeLocalEvent<MobStateComponent, PointAttemptEvent>(CheckAct);
SubscribeLocalEvent<MobStateComponent, TryingToSleepEvent>(OnSleepAttempt);
Expand All @@ -52,6 +52,23 @@ private void SubscribeEvents()
SubscribeLocalEvent<MobStateComponent, UnbuckleAttemptEvent>(OnUnbuckleAttempt);
}

private void OnDirectionAttempt(Entity<MobStateComponent> ent, ref ChangeDirectionAttemptEvent args)
{
if (ent.Comp.CurrentState is MobState.Critical && _configurationManager.GetCVar(CCVars.AllowMovementWhileCrit))
return;

CheckAct(ent.Owner, ent.Comp, args);
}

private void OnMoveAttempt(Entity<MobStateComponent> ent, ref UpdateCanMoveEvent args)
{
if (ent.Comp.CurrentState is MobState.Critical && _configurationManager.GetCVar(CCVars.AllowMovementWhileCrit))
return;

CheckAct(ent.Owner, ent.Comp, args);
}


private void OnUnbuckleAttempt(Entity<MobStateComponent> ent, ref UnbuckleAttemptEvent args)
{
// TODO is this necessary?
Expand Down

0 comments on commit 02d15b0

Please sign in to comment.