Scaling node placement respects protection
Players can still product dynamic "touch" lights in protected areas, but can't place actual climbable scaling nodes.
This commit is contained in:
parent
943464be23
commit
e34ce24d74
@ -68,8 +68,10 @@ local function tryreplace(pos, newname, rootpos)
|
||||
return true
|
||||
end
|
||||
|
||||
function nodecore.scaling_apply(pointed)
|
||||
if pointed.type ~= "node" or (not pointed.above) or (not pointed.under) then return end
|
||||
function nodecore.scaling_apply(pointed, player)
|
||||
if pointed.type ~= "node" or (not pointed.above) or (not pointed.under)
|
||||
or minetest.is_protected(pointed.above, player:get_player_name()) then return end
|
||||
|
||||
local pos = pointed.above
|
||||
if pointed.under.y > pointed.above.y and issolid(pointed.under) then
|
||||
if tryreplace(pos, "ceil", pointed.under) then
|
||||
|
@ -72,7 +72,7 @@ hand.on_place = function(stack, player, pointed, ...)
|
||||
if def and def.on_scaling and def.on_scaling(stats,
|
||||
stack, player, pointed, node, ...) then return end
|
||||
|
||||
if nodecore.scaling_apply(pointed) then
|
||||
if nodecore.scaling_apply(pointed, player) then
|
||||
if nodecore.player_stat_add then
|
||||
nodecore.player_stat_add(1, player, "craft",
|
||||
"scaling dy=" .. (pointed.under.y - pointed.above.y))
|
||||
|
Loading…
x
Reference in New Issue
Block a user