mirror of
https://files.creativekara.fr/git/poschangelib.git
synced 2024-12-04 21:13:50 +01:00
Enhance stomp usage.
This commit is contained in:
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
|
||||
|
Loading…
Reference in New Issue
Block a user