add feather falling (#73)

* add feather falling

add feather falling

* add feather falling to init.lua

add feather falling routine to globalstep

* add feather falling to readme

add feather falling to readme
This commit is contained in:
tenplus1
2022-04-02 15:16:23 +00:00
committed by GitHub
parent ac445a6cd0
commit e1a262ba20
3 changed files with 20 additions and 2 deletions

View File

@ -440,6 +440,20 @@ end, true)
minetest.register_globalstep(function(dtime)
timer = timer + dtime
if armor.config.feather_fall == true then
for _,player in pairs(minetest.get_connected_players()) do
local name = player:get_player_name()
if armor.def[name].feather > 0 then
local vel_y = player:get_velocity().y
if vel_y < 0 and vel_y < 3 then
vel_y = -(vel_y * 0.05)
player:add_velocity({x = 0, y = vel_y, z = 0})
end
end
end
end
if timer <= armor.config.init_delay then
return
end