Enhance stomp usage.

This commit is contained in:
Karamel 2018-06-19 23:42:45 +02:00
parent 937ee8ac66
commit 4cc361ea41

@ -237,17 +237,17 @@ function poschangelib.trigger_stomp(player, pos_to_stomp, chance_factor)
local node = minetest.get_node(pos_to_stomp)
local node_desc = minetest.registered_nodes[node.name]
if not node_desc or not stomps[node.name] or #stomps[node.name] == 0 then
return
return false
end
local stomp_desc = stomps[node.name]
if not stomp_desc then
return
return false
end
if chance_factor == nil then chance_factor = 1.0 end
for i, s_desc in ipairs(stomp_desc) do
if (math.random() * s_desc.chance) < (1.0 * chance_factor) then
poschangelib.do_stomp(player, pos_to_stomp, node, node_desc, s_desc)
return
return true
end
end
end