Merge pull request #2 from ademant/master

typo for variable player(s); adding settingtypes
This commit is contained in:
squiddible 2020-06-18 17:58:21 -04:00 committed by GitHub
commit 034bf9bf8b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 7 deletions

View File

@ -5,24 +5,24 @@ level, max gravity at sea level.
]]--
local update = function()
for _, players in ipairs(minetest.get_connected_players()) do
local pos = player:get_pos()
local grav = 1
if pos.y > 300 then grav = 300/pos.y end
if pos.y < -300 then grav = -300/pos.y end
player:set_physics_override({gravity=grav})
end
end
local action_timer = 0
local realgthres=minetest.settings:get('real_g_threshold') or 300
local gravity_update = function()
for _, players in ipairs(minetest.get_connected_players()) do
local pos = players:get_pos()
local grav = 1
if abs(pos.y) > realgthres then grav = abs(realgthres/pos.y) end
players:set_physics_override({gravity=grav})
end
end
local function gravity_globaltimer(dtime)
action_timer = action_timer + dtime
if action_timer > 4 then
update()
gravity_update()
action_timer = 0
end
end

2
mod.conf Normal file
View File

@ -0,0 +1,2 @@
name = real_g
depends = default

1
settingtypes.txt Normal file
View File

@ -0,0 +1 @@
real_g_threshold (Threshold for activating real_g) int 300