f37a918f0f
- Storeboxes are now scalable. - Standardize touch-hurt operation. - Touch-hurt damage on scaling. - Now possible to alter scaling time via scaling_time group (percent of original scaling time)
29 lines
816 B
Lua
29 lines
816 B
Lua
-- LUALOCALS < ---------------------------------------------------------
|
|
local minetest, nodecore
|
|
= minetest, nodecore
|
|
-- LUALOCALS > ---------------------------------------------------------
|
|
|
|
nodecore.register_on_register_item(function(_, def)
|
|
if not def.damage_per_second then return end
|
|
|
|
def.on_punch = def.on_punch or function(pos, node, puncher, ...)
|
|
if puncher and puncher:is_player() then
|
|
nodecore.addphealth(puncher, -1, {
|
|
nc_type = "node_touch_hurt",
|
|
node = node
|
|
})
|
|
end
|
|
return minetest.node_punch(pos, node, puncher, ...)
|
|
end
|
|
|
|
def.on_scaling = def.on_scaling or function(_, _, player, node)
|
|
if player and player:is_player() then
|
|
nodecore.addphealth(player, -1, {
|
|
nc_type = "node_touch_hurt",
|
|
node = node
|
|
})
|
|
end
|
|
return true
|
|
end
|
|
end)
|