Skip to content

Instantly share code, notes, and snippets.

@PilzAdam
Created December 2, 2012 09:28
Show Gist options
  • Save PilzAdam/4187946 to your computer and use it in GitHub Desktop.
Save PilzAdam/4187946 to your computer and use it in GitHub Desktop.
diff --git a/builtin/privileges.lua b/builtin/privileges.lua
index 9ec09d7..402305b 100644
--- a/builtin/privileges.lua
+++ b/builtin/privileges.lua
@@ -44,5 +44,9 @@ minetest.register_privilege("fast", {
description = "Can walk fast using the fast_move mode",
give_to_singleplayer = false,
})
+minetest.register_privilege("noclip", {
+ description = "Can fly through nodes using the free_move mode",
+ give_to_singleplayer = false,
+})
minetest.register_privilege("rollback", "Can use the rollback functionality")
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index 17c4cde..7a19c93 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -70,7 +70,8 @@ void LocalPlayer::move(f32 dtime, Map &map, f32 pos_max_d,
// Skip collision detection if a special movement 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");
+ bool free_move = noclip && fly_allowed && g_settings->getBool("free_move");
if(free_move)
{
position += m_speed * dtime;
@@ -295,7 +296,7 @@ void LocalPlayer::move(f32 dtime, Map &map, f32 pos_max_d,
Report collisions
*/
bool bouncy_jump = false;
- if(collision_info)
+ if(collision_info && !g_settings->getBool("free_move"))
{
for(size_t i=0; i<result.collisions.size(); i++){
const CollisionInfo &info = result.collisions[i];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment