Admin tool auditing, fix falling check
This commit is contained in:
parent
675c1891a3
commit
1d35109312
@ -1,6 +1,8 @@
|
|||||||
-- LUALOCALS < ---------------------------------------------------------
|
-- LUALOCALS < ---------------------------------------------------------
|
||||||
local ItemStack, minetest, nodecore
|
local ItemStack, minetest, nodecore, string
|
||||||
= ItemStack, minetest, nodecore
|
= ItemStack, minetest, nodecore, string
|
||||||
|
local string_format
|
||||||
|
= string.format
|
||||||
-- LUALOCALS > ---------------------------------------------------------
|
-- LUALOCALS > ---------------------------------------------------------
|
||||||
|
|
||||||
local modname = minetest.get_current_modname()
|
local modname = minetest.get_current_modname()
|
||||||
@ -32,12 +34,6 @@ minetest.register_chatcommand("nckfa", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
local cooldown = {}
|
local cooldown = {}
|
||||||
local function givestack(pos, player, stack)
|
|
||||||
if stack:is_empty() then return end
|
|
||||||
stack = player:get_inventory():add_item("main", stack)
|
|
||||||
if stack:is_empty() then return end
|
|
||||||
return nodecore.item_eject(pos, stack)
|
|
||||||
end
|
|
||||||
minetest.register_on_punchnode(function(pos, node, puncher)
|
minetest.register_on_punchnode(function(pos, node, puncher)
|
||||||
if not (puncher and puncher:is_player()) then return end
|
if not (puncher and puncher:is_player()) then return end
|
||||||
|
|
||||||
@ -55,15 +51,22 @@ minetest.register_on_punchnode(function(pos, node, puncher)
|
|||||||
if cd and cd > now then return end
|
if cd and cd > now then return end
|
||||||
cooldown[pname] = now + 250 * 1000
|
cooldown[pname] = now + 250 * 1000
|
||||||
|
|
||||||
givestack(pos, puncher, nodecore.stack_get(pos))
|
if not nodecore.stack_giveto(pos, puncher) then
|
||||||
|
nodecore.item_eject(pos, nodecore.stack_get(pos))
|
||||||
|
end
|
||||||
|
|
||||||
|
nodecore.log("action", string_format("%s super-digs %s at %s",
|
||||||
|
pname, node.name, minetest.pos_to_string(pos)))
|
||||||
|
|
||||||
local def = minetest.registered_nodes[node.name]
|
local def = minetest.registered_nodes[node.name]
|
||||||
if (not def) or (not def.air_equivalent) and (not def.groups.is_stack_only) then
|
if (not def) or (not def.air_equivalent) and (not def.groups.is_stack_only) then
|
||||||
local stack = ItemStack(node.name)
|
local stack = ItemStack(node.name)
|
||||||
stack:get_meta():from_table({fields = minetest.get_meta(pos)
|
stack:get_meta():from_table({fields = minetest.get_meta(pos)
|
||||||
:to_table().field})
|
:to_table().field})
|
||||||
givestack(pos, puncher, stack)
|
stack = puncher:get_inventory():add_item("main", stack)
|
||||||
|
if not stack:is_empty() then nodecore.item_eject(pos, stack) end
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.remove_node(pos)
|
minetest.remove_node(pos)
|
||||||
|
return nodecore.fallcheck(pos)
|
||||||
end)
|
end)
|
||||||
|
@ -42,7 +42,7 @@ for i = 1, #nodecore.writing_glyphs do
|
|||||||
sounds = nodecore.sounds("nc_terrain_crunchy"),
|
sounds = nodecore.sounds("nc_terrain_crunchy"),
|
||||||
on_node_touchthru = function(pos, node, under, player)
|
on_node_touchthru = function(pos, node, under, player)
|
||||||
local raw = nodecore.touchtip_node(under, nil, player)
|
local raw = nodecore.touchtip_node(under, nil, player)
|
||||||
if vector.equals(vector.subtract(under, pos),
|
if raw and vector.equals(vector.subtract(under, pos),
|
||||||
nodecore.facedirs[node.param2].b) then
|
nodecore.facedirs[node.param2].b) then
|
||||||
return raw .. "\n" .. desc
|
return raw .. "\n" .. desc
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user