1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Only fly through walls in noclip mode wich requires the noclip privilege

This commit is contained in:
PilzAdam 2012-12-09 13:34:16 +01:00
parent 1d13d106dd
commit 52ba413185
5 changed files with 31 additions and 3 deletions

View file

@ -73,9 +73,11 @@ void LocalPlayer::move(f32 dtime, Map &map, f32 pos_max_d,
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;
@ -300,7 +302,8 @@ void LocalPlayer::move(f32 dtime, Map &map, f32 pos_max_d,
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];