This commit is contained in:
yvt 2014-03-30 01:42:18 +09:00
parent d01acd7978
commit bfcf96ad13
3 changed files with 16 additions and 1 deletions

View File

@ -795,8 +795,13 @@ namespace spades {
PlayerInput inp = ParsePlayerInput(reader.ReadByte());
if(GetWorld()->GetLocalPlayer() == p)
if(GetWorld()->GetLocalPlayer() == p) {
// handle "/fly" jump
if(inp.jump) {
p->ForceJump();
}
break;
}
p->SetInput(inp);
}

View File

@ -1143,6 +1143,15 @@ namespace spades {
return ((velocity.z >= 0.f && velocity.z < .017f) && !airborne);
}
void Player::ForceJump() {
velocity.z = -0.36f;
lastJump = true;
if(world->GetListener() && world->GetTime() > lastJumpTime + .1f){
world->GetListener()->PlayerJumped(this);
lastJumpTime = world->GetTime();
}
}
void Player::MovePlayer(float fsynctics) {
if(input.jump && (!lastJump) &&
IsOnGroundOrWade()) {

View File

@ -164,6 +164,7 @@ namespace spades {
void SetWeaponInput(WeaponInput);
void SetTool(ToolType);
void SetHeldBlockColor(IntVector3);
void ForceJump();
bool IsBlockCursorActive();
bool IsBlockCursorDragging();
IntVector3 GetBlockCursorPos(){return blockCursorPos;}