Make it RUN under Minetest 5.1.1!!! :)

This commit is contained in:
kay27 2022-01-24 03:07:55 +04:00
parent ce7a4fec3d
commit 0096100228
4 changed files with 25 additions and 3 deletions

View File

@ -107,7 +107,9 @@ minetest.register_globalstep(function(dtime)
local pos = player:get_pos()
if tick == true and pool[name] > 0 then
local pool_name = pool[name]
if tick == true and pool_name and pool_name > 0 then
minetest.sound_play("item_drop_pickup", {
pos = pos,
gain = 0.7,

View File

@ -55,10 +55,16 @@ minetest.register_globalstep(function(dtime)
for p=1, #players do
if players[p].set_moon then
players[p]:set_moon(moon_arg)
else
-- TODO: use old sky api
end
end
end)
minetest.register_on_joinplayer(function(player)
player:set_moon({texture = get_moon_texture(), scale=3.75})
if player.set_moon then
player:set_moon({texture = get_moon_texture(), scale=3.75})
else
-- TODO: use old sky api
end
end)

View File

@ -90,6 +90,11 @@ end
local function set_texture(player, index, texture)
local textures = player_textures[player:get_player_name()]
if not textures then
-- TODO: Check if minetest.register_on_joinplayer() shouldn't really work in minetest 5.1.1?
player_textures[player:get_player_name()] = {"blank.png", "blank.png", "blank.png"}
textures = player_textures[player:get_player_name()]
end
textures[index] = texture
player:set_properties({textures = textures})
end

View File

@ -277,6 +277,11 @@ minetest.register_globalstep(function(dtime)
local fly_node = minetest.get_node({x = fly_pos.x, y = fly_pos.y - 0.5, z = fly_pos.z}).name
local elytra = mcl_playerplus.elytra[player]
if not elytra then
mcl_playerplus.elytra[player] = {}
elytra = mcl_playerplus.elytra[player]
end
elytra.active = player:get_inventory():get_stack("armor", 3):get_name() == "mcl_armor:elytra"
and not player:get_attach()
and (elytra.active or control.jump and player_velocity.y < -6)
@ -399,7 +404,8 @@ minetest.register_globalstep(function(dtime)
-- Update jump status immediately since we need this info in real time.
-- WARNING: This section is HACKY as hell since it is all just based on heuristics.
if mcl_playerplus_internal[name].jump_cooldown > 0 then
local mcl_playerplus_internal_name = mcl_playerplus_internal[name]
if mcl_playerplus_internal_name and mcl_playerplus_internal_name.jump_cooldown > 0 then
mcl_playerplus_internal[name].jump_cooldown = mcl_playerplus_internal[name].jump_cooldown - dtime
end
@ -614,6 +620,9 @@ minetest.register_globalstep(function(dtime)
end
-- Update internal values
if not mcl_playerplus_internal[name] then
mcl_playerplus_internal[name] = {}
end
mcl_playerplus_internal[name].lastPos = pos
end