From 3beea75887bfbf6e221f562411f5bcac03269f03 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 18 Jun 2020 16:56:55 +0200 Subject: [PATCH] combine if --- init.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/init.lua b/init.lua index a307ce2..eacf733 100644 --- a/init.lua +++ b/init.lua @@ -12,8 +12,7 @@ local gravity_update = function() for _, players in ipairs(minetest.get_connected_players()) do local pos = players:get_pos() local grav = 1 - if pos.y > realgthres then grav = realgthres/pos.y end - if pos.y < (-1)*realgthres then grav = -1*realgthres/pos.y end + if abs(pos.y) > realgthres then grav = abs(realgthres/pos.y) end players:set_physics_override({gravity=grav}) end end