Make scaling exempt from protection

...similar to how loose items are.
- They're emphemeral/air-like anyway
- Prevent exploiting protection areas to make traps to
  capture players or their items.
This commit is contained in:
Aaron Suen 2021-03-23 22:24:53 -04:00
parent c1588a7656
commit b05180da02
2 changed files with 2 additions and 3 deletions

View File

@ -68,10 +68,9 @@ local function tryreplace(pos, newname, rootpos)
return true
end
function nodecore.scaling_apply(pointed, player)
function nodecore.scaling_apply(pointed)
if pointed.type ~= "node" or (not pointed.above) or (not pointed.under) then return end
local pos = pointed.above
if nodecore.protection_test(pos, player) then return end
if pointed.under.y > pointed.above.y and issolid(pointed.under) then
if tryreplace(pos, "ceil", pointed.under) then
if tryreplace({x = pos.x, y = pos.y - 1, z = pos.z}, "hang", pos) then

View File

@ -75,7 +75,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, player) then
if nodecore.scaling_apply(pointed) then
nodecore.player_discover(player, "craft:scaling dy="
.. (pointed.under.y - pointed.above.y))
return nodecore.scaling_particles(pointed.above, {