fix mergeconflicts
This commit is contained in:
commit
9052d3ae14
98 changed files with 2574 additions and 582 deletions
|
@ -93,47 +93,48 @@ screwdriver.handler = function(itemstack, user, pointed_thing, mode, uses)
|
|||
|
||||
local node = minetest.get_node(pos)
|
||||
local ndef = minetest.registered_nodes[node.name]
|
||||
if not ndef then
|
||||
return itemstack
|
||||
end
|
||||
-- can we rotate this paramtype2?
|
||||
local fn = screwdriver.rotate[ndef.paramtype2]
|
||||
if not fn then
|
||||
return
|
||||
if not fn and not ndef.on_rotate then
|
||||
return itemstack
|
||||
end
|
||||
|
||||
local should_rotate = true
|
||||
local new_param2 = fn(pos, node, mode)
|
||||
local new_param2
|
||||
if fn then
|
||||
new_param2 = fn(pos, node, mode)
|
||||
else
|
||||
new_param2 = node.param2
|
||||
end
|
||||
|
||||
-- Node provides a handler, so let the handler decide instead if the node can be rotated
|
||||
if ndef and ndef.on_rotate then
|
||||
if ndef.on_rotate then
|
||||
-- Copy pos and node because callback can modify it
|
||||
local result = ndef.on_rotate(vector.new(pos),
|
||||
{name = node.name, param1 = node.param1, param2 = node.param2},
|
||||
user, mode, new_param2)
|
||||
if result == false then -- Disallow rotation
|
||||
return
|
||||
return itemstack
|
||||
elseif result == true then
|
||||
should_rotate = false
|
||||
end
|
||||
else
|
||||
if not ndef or
|
||||
ndef.on_rotate == false or
|
||||
(ndef.drawtype == "nodebox" and
|
||||
(ndef.node_box and ndef.node_box.type ~= "fixed")) or
|
||||
node.param2 == nil then
|
||||
return
|
||||
end
|
||||
|
||||
if ndef.can_dig and not ndef.can_dig(pos, user) then
|
||||
return
|
||||
end
|
||||
elseif ndef.on_rotate == false then
|
||||
return itemstack
|
||||
elseif ndef.can_dig and not ndef.can_dig(pos, user) then
|
||||
return itemstack
|
||||
end
|
||||
|
||||
if should_rotate then
|
||||
if should_rotate and new_param2 ~= node.param2 then
|
||||
node.param2 = new_param2
|
||||
minetest.swap_node(pos, node)
|
||||
minetest.check_for_falling(pos)
|
||||
end
|
||||
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
if not (creative and creative.is_enabled_for
|
||||
and creative.is_enabled_for(user:get_player_name())) then
|
||||
itemstack:add_wear(65535 / ((uses or 200) - 1))
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue