Fix /stomp chatcommand (choose stomp with index).

This commit is contained in:
Karamel 2017-08-30 11:02:04 +02:00
parent 1e77e9a59a
commit 4515adbe3b

@ -215,9 +215,16 @@ minetest.register_chatcommand('stomp', {
local pos = player:getpos()
local node_pos = {['x'] = pos.x, ['y'] = pos.y - 1, ['z'] = pos.z}
local node = minetest.get_node(node_pos)
local node_desc = minetest.registered_nodes[node.name]
if not node_desc then return end -- unknown node
if not stomps[node.name] or #stomps[node.name] == 0 then
return false, 'No stomping data found for ' .. node.name
elseif #stomps[node.name] > 1 then
local num = tonumber(param)
if num and num > 0 and num <= #stomps[node.name] then
poschangelib.do_stomp(player, node_pos, node, node_desc, stomps[node.name][num])
return true
end
local local_stomps = stomps[node.name]
minetest.chat_send_player(name, 'Multiple stomping data found for ' .. node.name)
minetest.chat_send_player(name, 'Use /stomp X to choose which one to trigger.')
@ -226,7 +233,7 @@ minetest.register_chatcommand('stomp', {
end
return false
else
poschangelib.do_stomp(node_pos, node, stomps[node.name][1])
poschangelib.do_stomp(player, node_pos, node, node_desc, stomps[node.name][1])
return true
end
end,