move 'player.noclip' and 'player.flight' handlers to Lua
This commit is contained in:
@@ -21,8 +21,6 @@ inline const std::string BIND_MOVE_CROUCH = "movement.crouch";
|
||||
inline const std::string BIND_MOVE_CHEAT = "movement.cheat";
|
||||
inline const std::string BIND_CAM_ZOOM = "camera.zoom";
|
||||
inline const std::string BIND_CAM_MODE = "camera.mode";
|
||||
inline const std::string BIND_PLAYER_NOCLIP = "player.noclip";
|
||||
inline const std::string BIND_PLAYER_FLIGHT = "player.flight";
|
||||
inline const std::string BIND_PLAYER_ATTACK = "player.attack";
|
||||
inline const std::string BIND_PLAYER_DESTROY = "player.destroy";
|
||||
inline const std::string BIND_PLAYER_BUILD = "player.build";
|
||||
|
||||
@@ -288,8 +288,6 @@ void PlayerController::updateKeyboard() {
|
||||
input.jump = Events::active(BIND_MOVE_JUMP);
|
||||
input.zoom = Events::active(BIND_CAM_ZOOM);
|
||||
input.cameraMode = Events::jactive(BIND_CAM_MODE);
|
||||
input.noclip = Events::jactive(BIND_PLAYER_NOCLIP);
|
||||
input.flight = Events::jactive(BIND_PLAYER_FLIGHT);
|
||||
}
|
||||
|
||||
void PlayerController::resetKeyboard() {
|
||||
|
||||
@@ -135,18 +135,7 @@ void Player::updateInput(PlayerInput& input, float delta) {
|
||||
hitbox->velocity.y = JUMP_FORCE;
|
||||
}
|
||||
|
||||
if ((input.flight && !noclip) || (input.noclip && flight == noclip)) {
|
||||
flight = !flight;
|
||||
if (flight) {
|
||||
hitbox->velocity.y += 1.0f;
|
||||
}
|
||||
}
|
||||
hitbox->type = noclip ? BodyType::KINEMATIC : BodyType::DYNAMIC;
|
||||
if (input.noclip) {
|
||||
noclip = !noclip;
|
||||
}
|
||||
input.noclip = false;
|
||||
input.flight = false;
|
||||
}
|
||||
|
||||
void Player::updateSelectedEntity() {
|
||||
|
||||
@@ -27,8 +27,6 @@ struct PlayerInput {
|
||||
bool shift : 1;
|
||||
bool cheat : 1;
|
||||
bool jump : 1;
|
||||
bool noclip : 1;
|
||||
bool flight : 1;
|
||||
};
|
||||
|
||||
struct CursorSelection {
|
||||
|
||||
Reference in New Issue
Block a user