Skip to content

Commit

Permalink
Fix swim stamina cost (Grasscutters#2287)
Browse files Browse the repository at this point in the history
  • Loading branch information
NotThorny committed Aug 7, 2023
1 parent 8291e36 commit 58d2650
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,9 @@ public void handleCombatInvocationsNotify(@NotNull GameSession session, @NotNull
return;
}

// Update previous motion state
this.previousState = currentState;

// Update the current state.
this.currentState = motionState;
// logger.trace(currentState + "\t" + (notifyEntityId == currentAvatarEntityId ? "character" : "vehicle"));
Expand Down Expand Up @@ -417,6 +420,11 @@ public void handleVehicleInteractReq(GameSession session, int vehicleId, Vehicle
// Internal handler

private void handleImmediateStamina(GameSession session, @NotNull MotionState motionState) {
// Don't double dip on sustained stamina start costs
if (previousState == currentState) {
return;
}

switch (motionState) {
case MOTION_STATE_CLIMB ->
updateStaminaRelative(session, new Consumption(ConsumptionType.CLIMB_START), true);
Expand Down

0 comments on commit 58d2650

Please sign in to comment.