1
0
Fork 0
VoxeLibre/mods/CORE/walkover/init.lua

36 lines
1.0 KiB
Lua
Raw Normal View History

-- register extra flavours of a base nodedef
2020-11-05 16:05:42 +01:00
walkover = {}
walkover.registered_globals = {}
function walkover.register_global(func)
table.insert(walkover.registered_globals, func)
end
local timer = 0
minetest.register_globalstep(function(dtime)
timer = timer + dtime;
if timer >= 0.3 then
for _,player in pairs(minetest.get_connected_players()) do
2019-02-01 06:33:07 +01:00
local pp = player:get_pos()
2017-08-21 05:25:15 +02:00
pp.y = math.ceil(pp.y)
local loc = vector.add(pp, {x=0,y=-1,z=0})
if loc ~= nil then
local nodeiamon = minetest.get_node(loc)
2020-11-05 16:05:42 +01:00
if nodeiamon ~= nil then
local def = minetest.registered_nodes[nodeiamon.name]
if def ~= nil and def.on_walk_over ~= nil then
def.on_walk_over(loc, nodeiamon, player)
end
2020-11-05 16:05:42 +01:00
for _, func in ipairs(walkover.registered_globals) do
func(loc, nodeiamon, player)
end
end
end
end
timer = 0
end
end)