Skip to content

Commit

Permalink
changed container event & removed inventory check from climb initation
Browse files Browse the repository at this point in the history
  • Loading branch information
benev0 committed Sep 21, 2024
1 parent 5f3e730 commit 0686129
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions Content.Shared/Climbing/Systems/ClimbSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public override void Initialize()
SubscribeLocalEvent<ClimbingComponent, ClimbDoAfterEvent>(OnDoAfter);
SubscribeLocalEvent<ClimbingComponent, EndCollideEvent>(OnClimbEndCollide);
SubscribeLocalEvent<ClimbingComponent, BuckledEvent>(OnBuckled);
SubscribeLocalEvent<ClimbingComponent, ContainerGettingInsertedAttemptEvent>(OnStored);
SubscribeLocalEvent<ClimbingComponent, EntGotInsertedIntoContainerMessage>(OnStored);

SubscribeLocalEvent<ClimbableComponent, CanDropTargetEvent>(OnCanDragDropOn);
SubscribeLocalEvent<ClimbableComponent, GetVerbsEvent<AlternativeVerb>>(AddClimbableVerb);
Expand Down Expand Up @@ -247,6 +247,10 @@ private void OnDoAfter(EntityUid uid, ClimbingComponent component, ClimbDoAfterE
if (args.Handled || args.Cancelled || args.Args.Target == null || args.Args.Used == null)
return;

if (_containers.IsEntityInContainer(uid))
args.Handled = true;
return;

Climb(uid, args.Args.User, args.Args.Target.Value, climbing: component);
args.Handled = true;
}
Expand All @@ -260,9 +264,6 @@ private void Climb(EntityUid uid, EntityUid user, EntityUid climbable, bool sile
if (!Resolve(climbable, ref comp, false))
return;

if (_containers.IsEntityInContainer(uid))
return;

if (!ReplaceFixtures(uid, climbing, fixtures))
return;

Expand Down Expand Up @@ -519,7 +520,7 @@ private void OnBuckled(EntityUid uid, ClimbingComponent component, ref BuckledEv
StopOrCancelClimb(uid, component);
}

private void OnStored(EntityUid uid, ClimbingComponent component, ref ContainerGettingInsertedAttemptEvent args)
private void OnStored(EntityUid uid, ClimbingComponent component, ref EntGotInsertedIntoContainerMessage args)
{
StopOrCancelClimb(uid, component);
}
Expand Down

0 comments on commit 0686129

Please sign in to comment.