public WeenieError jump_is_allowed(float extent, int staminaCost) { if (PhysicsObj == null) { return(WeenieError.NoPhysicsObject); } if (WeenieObj == null && !WeenieObj.IsCreature() || !PhysicsObj.State.HasFlag(PhysicsState.Gravity) || PhysicsObj.TransientState.HasFlag(TransientStateFlags.Contact | TransientStateFlags.OnWalkable)) { if (PhysicsObj.IsFullyConstrained()) { return(WeenieError.GeneralMovementFailure); } if (PendingMotions.Count > 1 && PendingMotions.First.Value.JumpErrorCode != 0) { return(PendingMotions.First.Value.JumpErrorCode); } var jumpError = jump_charge_is_allowed(); if (jumpError == WeenieError.None) { jumpError = motion_allows_jump(InterpretedState.ForwardCommand); if (jumpError == WeenieError.None && WeenieObj != null && WeenieObj.JumpStaminaCost(extent, staminaCost) == 0) { jumpError = WeenieError.GeneralMovementFailure; } } return(jumpError); } return(WeenieError.YouCantJumpWhileInTheAir); }
public Sequence jump_is_allowed(float extent, int staminaCost) { if (PhysicsObj == null) { return(new Sequence(0x24)); } if (WeenieObj == null && !WeenieObj.IsCreature() || !PhysicsObj.State.HasFlag(PhysicsState.Gravity) || PhysicsObj.TransientState.HasFlag(TransientStateFlags.Contact | TransientStateFlags.OnWalkable)) { if (PhysicsObj.IsFullyConstrained()) { return(new Sequence(0x47)); } if (PendingMotions.Count > 1 && PendingMotions[0].JumpErrorCode != 0) { return(new Sequence(PendingMotions[0].JumpErrorCode)); } var jumpError = jump_charge_is_allowed(); if (jumpError.ID == 0) { jumpError.ID = motion_allows_jump(InterpretedState.ForwardCommand); if (jumpError.ID == 0 && WeenieObj != null && WeenieObj.JumpStaminaCost(extent, staminaCost) != 0) { jumpError.ID = 0x47; } } return(jumpError); } return(new Sequence(0x24)); }