add logging
This commit is contained in:
parent
1f5800ce77
commit
f7d741b2e7
14
init.lua
14
init.lua
@ -77,6 +77,8 @@ local function roll_dice(pos, node)
|
||||
pitch = 1.0 + 0.1*math.random(),
|
||||
}
|
||||
minetest.sound_play(spec, parameters, true)
|
||||
|
||||
return val
|
||||
end
|
||||
|
||||
minetest.register_node("yl_dice:dice", {
|
||||
@ -99,10 +101,16 @@ minetest.register_node("yl_dice:dice", {
|
||||
palette = "yl_dice_6_palette.png",
|
||||
|
||||
on_construct = function(pos)
|
||||
roll_dice(pos)
|
||||
local val = roll_dice(pos)
|
||||
minetest.log("action", ("[yl_dice] placed d6 has rolled %s at %s"):format(val, minetest.pos_to_string(pos)))
|
||||
end,
|
||||
on_rightclick = function(pos, node, puncher, itemstack, pointed_thing)
|
||||
roll_dice(pos, node)
|
||||
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||
local val = roll_dice(pos, node)
|
||||
if val then
|
||||
-- `val` is nil when cooldown has not ended yet
|
||||
local name = clicker and clicker:is_player() and clicker:get_player_name() or "UNKNOWN"
|
||||
minetest.log("action", ("[yl_dice] %s has rolled %s by using d6 at %s"):format(name, val, minetest.pos_to_string(pos)))
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user