description = "Can walk fast using the fast_move mode",
give_to_singleplayer = false,
})
+minetest.register_privilege("noclip", {
+ description = "Can fly through walls",
+ give_to_singleplayer = false,
+})
minetest.register_privilege("rollback", "Can use the rollback functionality")
settings->setDefault("keymap_rangeselect", "KEY_KEY_R");
settings->setDefault("keymap_freemove", "KEY_KEY_K");
settings->setDefault("keymap_fastmove", "KEY_KEY_J");
+ settings->setDefault("keymap_noclip", "KEY_KEY_H");
settings->setDefault("keymap_screenshot", "KEY_F12");
settings->setDefault("keymap_toggle_hud", "KEY_F1");
settings->setDefault("keymap_toggle_chat", "KEY_F2");
settings->setDefault("shader_path", "");
settings->setDefault("video_driver", "opengl");
settings->setDefault("free_move", "false");
+ settings->setDefault("noclip", "false");
settings->setDefault("continuous_forward", "false");
settings->setDefault("fast_move", "false");
settings->setDefault("invert_mouse", "false");
statustext += L" (note: no 'fast' privilege)";
}
}
+ else if(input->wasKeyDown(getKeySetting("keymap_noclip")))
+ {
+ if(g_settings->getBool("noclip"))
+ {
+ g_settings->set("noclip","false");
+ statustext = L"noclip disabled";
+ statustext_time = 0;
+ }
+ else
+ {
+ g_settings->set("noclip","true");
+ statustext = L"noclip enabled";
+ statustext_time = 0;
+ if(!client.checkPrivilege("noclip"))
+ statustext += L" (note: no 'noclip' privilege)";
+ }
+ }
else if(input->wasKeyDown(getKeySetting("keymap_screenshot")))
{
irr::video::IImage* const image = driver->createScreenShot();
GUI_ID_KEY_FLY_BUTTON,
GUI_ID_KEY_FAST_BUTTON,
GUI_ID_KEY_JUMP_BUTTON,
+ GUI_ID_KEY_NOCLIP_BUTTON,
GUI_ID_KEY_CHAT_BUTTON,
GUI_ID_KEY_CMD_BUTTON,
GUI_ID_KEY_CONSOLE_BUTTON,
this->add_key(GUI_ID_KEY_CONSOLE_BUTTON, "Console", "keymap_console");
this->add_key(GUI_ID_KEY_FLY_BUTTON, "Toggle fly", "keymap_freemove");
this->add_key(GUI_ID_KEY_FAST_BUTTON, "Toggle fast", "keymap_fastmove");
+ this->add_key(GUI_ID_KEY_NOCLIP_BUTTON, "Toggle noclip", "keymap_noclip");
this->add_key(GUI_ID_KEY_RANGE_BUTTON, "Range select", "keymap_rangeselect");
this->add_key(GUI_ID_KEY_DUMP_BUTTON, "Print stacks", "keymap_print_debug_stacks");
}
return;
}
- // Skip collision detection if a special movement mode is used
+ // Skip collision detection if noclip mode is used
bool fly_allowed = m_gamedef->checkLocalPrivilege("fly");
- bool free_move = fly_allowed && g_settings->getBool("free_move");
+ bool noclip = m_gamedef->checkLocalPrivilege("noclip") &&
+ g_settings->getBool("noclip");
+ bool free_move = noclip && fly_allowed && g_settings->getBool("free_move");
if(free_move)
{
position += m_speed * dtime;
Report collisions
*/
bool bouncy_jump = false;
- if(collision_info)
+ // Dont report if flying
+ if(collision_info && !g_settings->getBool("free_move"))
{
for(size_t i=0; i<result.collisions.size(); i++){
const CollisionInfo &info = result.collisions[i];