Remove on_place definition from curtains' code
will stay on the indev branch until better times
This commit is contained in:
parent
025adfad38
commit
5512b916d0
35
api.lua
35
api.lua
|
@ -354,41 +354,6 @@ function mcl_decor.register_curtains(color, desc, wool, wooltile, dye, colorgrou
|
|||
},
|
||||
_mcl_blast_resistance = 0.2,
|
||||
_mcl_hardness = 0.2,
|
||||
--[[
|
||||
function below should stop players from placing curtains on floor and ceiling, BUT it makes them infinite (bug)
|
||||
will be uncommented and fixed one day... maybe...
|
||||
---
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
-- taken from mcl_signs (partially)
|
||||
local above = pointed_thing.above
|
||||
local under = pointed_thing.under
|
||||
|
||||
-- use pointed node's on_rightclick function first, if present
|
||||
local node_under = minetest.get_node(under)
|
||||
if placer and not placer:get_player_control().sneak then
|
||||
if minetest.registered_nodes[node_under.name] and minetest.registered_nodes[node_under.name].on_rightclick then
|
||||
return minetest.registered_nodes[node_under.name].on_rightclick(under, node_under, placer, itemstack) or itemstack
|
||||
end
|
||||
end
|
||||
|
||||
local dir = vector.subtract(under, above)
|
||||
local wdir = minetest.dir_to_wallmounted(dir)
|
||||
|
||||
-- FIXME: curtains can be placed infinitely just like in creative mode
|
||||
if wdir == 0 or wdir == 1 then
|
||||
return itemstack
|
||||
else
|
||||
local _, success = minetest.item_place_node(itemstack, placer, pointed_thing, wdir)
|
||||
if not success then
|
||||
return itemstack
|
||||
end
|
||||
-- V this one SHOULD fix infinite curtains problem, but it doesn't V
|
||||
if not minetest.is_creative_enabled(placer:get_player_name()) then
|
||||
itemstack:take_item()
|
||||
end
|
||||
end
|
||||
end,
|
||||
]]
|
||||
on_rightclick = function(pos, node, _, itemstack)
|
||||
minetest.set_node(pos, {name="mcl_decor:curtain_"..color.."_closed", param2=node.param2})
|
||||
return itemstack
|
||||
|
|
Reference in New Issue