Remove duplicate bucket definition
This commit is contained in:
parent
b6438d8a59
commit
82a01803c2
@ -151,193 +151,6 @@ minetest.register_craftitem(
|
||||
stack_max = 1,
|
||||
})
|
||||
|
||||
minetest.register_craftitem(
|
||||
"default:bucket_water",
|
||||
{
|
||||
description = S("Water Bucket"),
|
||||
inventory_image = "default_bucket_water.png",
|
||||
stack_max = 1,
|
||||
wield_scale = {x=1,y=1,z=2},
|
||||
liquids_pointable = true,
|
||||
on_place = function(itemstack, user, pointed_thing)
|
||||
if pointed_thing.type ~= "node" then return end
|
||||
|
||||
local pos_protected = minetest.get_pointed_thing_position(pointed_thing, true)
|
||||
if minetest.is_protected(pos_protected, user) then return end
|
||||
|
||||
local inv=user:get_inventory()
|
||||
|
||||
if inv:room_for_item("main", {name="default:bucket"}) then
|
||||
inv:add_item("main", "default:bucket")
|
||||
else
|
||||
local pos = user:get_pos()
|
||||
pos.y = math.floor(pos.y + 0.5)
|
||||
minetest.add_item(pos, "default:bucket")
|
||||
end
|
||||
|
||||
local pos = pointed_thing.above
|
||||
local above_nodedef = minetest.registered_nodes[minetest.get_node(pointed_thing.above).name]
|
||||
local under_nodedef = minetest.registered_nodes[minetest.get_node(pointed_thing.under).name]
|
||||
|
||||
if under_nodedef.buildable_to then
|
||||
pos=pointed_thing.under
|
||||
end
|
||||
|
||||
if not above_nodedef.walkable then
|
||||
minetest.add_node(pos, {name = "default:water_source"})
|
||||
end
|
||||
|
||||
return itemstack
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_craftitem(
|
||||
"default:bucket_river_water",
|
||||
{
|
||||
description = S("River Water Bucket"),
|
||||
inventory_image = "default_bucket_river_water.png",
|
||||
stack_max = 1,
|
||||
wield_scale = {x=1,y=1,z=2},
|
||||
liquids_pointable = true,
|
||||
on_place = function(itemstack, user, pointed_thing)
|
||||
if pointed_thing.type ~= "node" then return end
|
||||
|
||||
local pos_protected = minetest.get_pointed_thing_position(pointed_thing, true)
|
||||
if minetest.is_protected(pos_protected, user) then return end
|
||||
|
||||
itemstack:take_item()
|
||||
|
||||
local inv=user:get_inventory()
|
||||
|
||||
if inv:room_for_item("main", {name="default:bucket"}) then
|
||||
inv:add_item("main", "default:bucket")
|
||||
else
|
||||
local pos = user:get_pos()
|
||||
pos.y = math.floor(pos.y + 0.5)
|
||||
minetest.add_item(pos, "default:bucket")
|
||||
end
|
||||
|
||||
local pos = pointed_thing.above
|
||||
local above_nodedef = minetest.registered_nodes[minetest.get_node(pointed_thing.above).name]
|
||||
local under_nodedef = minetest.registered_nodes[minetest.get_node(pointed_thing.under).name]
|
||||
|
||||
if under_nodedef.buildable_to then
|
||||
pos=pointed_thing.under
|
||||
end
|
||||
|
||||
if not above_nodedef.walkable then
|
||||
minetest.add_node(pos, {name = "default:river_water_source"})
|
||||
end
|
||||
|
||||
return itemstack
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_craftitem(
|
||||
"default:bucket_swamp_water",
|
||||
{
|
||||
description = S("Swamp Water Bucket"),
|
||||
inventory_image = "default_bucket_swamp_water.png",
|
||||
stack_max = 1,
|
||||
wield_scale = {x=1,y=1,z=2},
|
||||
liquids_pointable = true,
|
||||
on_place = function(itemstack, user, pointed_thing)
|
||||
if pointed_thing.type ~= "node" then return end
|
||||
|
||||
local pos_protected = minetest.get_pointed_thing_position(pointed_thing, true)
|
||||
if minetest.is_protected(pos_protected, user) then return end
|
||||
|
||||
itemstack:take_item()
|
||||
|
||||
local inv=user:get_inventory()
|
||||
|
||||
if inv:room_for_item("main", {name="default:bucket"}) then
|
||||
inv:add_item("main", "default:bucket")
|
||||
else
|
||||
local pos = user:get_pos()
|
||||
pos.y = math.floor(pos.y + 0.5)
|
||||
minetest.add_item(pos, "default:bucket")
|
||||
end
|
||||
|
||||
local pos = pointed_thing.above
|
||||
local above_nodedef = minetest.registered_nodes[minetest.get_node(pointed_thing.above).name]
|
||||
local under_nodedef = minetest.registered_nodes[minetest.get_node(pointed_thing.under).name]
|
||||
|
||||
if under_nodedef.buildable_to then
|
||||
pos=pointed_thing.under
|
||||
end
|
||||
|
||||
if not above_nodedef.walkable then
|
||||
minetest.add_node(pos, {name = "default:swamp_water_source"})
|
||||
end
|
||||
|
||||
return itemstack
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_craftitem(
|
||||
"default:bucket",
|
||||
{
|
||||
description = S("Empty Bucket"),
|
||||
inventory_image = "default_bucket.png",
|
||||
stack_max = 10,
|
||||
wield_scale = {x=1,y=1,z=2},
|
||||
liquids_pointable = true,
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
if pointed_thing.type ~= "node" then return end
|
||||
|
||||
local nodename=minetest.get_node(pointed_thing.under).name
|
||||
|
||||
if nodename == "default:water_source" then
|
||||
itemstack:take_item()
|
||||
|
||||
local inv=user:get_inventory()
|
||||
|
||||
if inv:room_for_item("main", {name="default:bucket_water"}) then
|
||||
inv:add_item("main", "default:bucket_water")
|
||||
else
|
||||
local pos = user:get_pos()
|
||||
pos.y = math.floor(pos.y + 0.5)
|
||||
minetest.add_item(pos, "default:bucket_water")
|
||||
end
|
||||
|
||||
minetest.remove_node(pointed_thing.under)
|
||||
elseif nodename == "default:river_water_source" then
|
||||
itemstack:take_item()
|
||||
|
||||
local inv=user:get_inventory()
|
||||
|
||||
if inv:room_for_item("main", {name="default:bucket_river_water"}) then
|
||||
inv:add_item("main", "default:bucket_river_water")
|
||||
else
|
||||
local pos = user:get_pos()
|
||||
pos.y = math.floor(pos.y + 0.5)
|
||||
minetest.add_item(pos, "default:bucket_river_water")
|
||||
end
|
||||
|
||||
minetest.remove_node(pointed_thing.under)
|
||||
elseif nodename == "default:swamp_water_source" then
|
||||
itemstack:take_item()
|
||||
|
||||
local inv=user:get_inventory()
|
||||
|
||||
if inv:room_for_item("main", {name="default:bucket_swamp_water"}) then
|
||||
inv:add_item("main", "default:bucket_swamp_water")
|
||||
else
|
||||
local pos = user:get_pos()
|
||||
pos.y = math.floor(pos.y + 0.5)
|
||||
minetest.add_item(pos, "default:bucket_swamp_water")
|
||||
end
|
||||
|
||||
minetest.remove_node(pointed_thing.under)
|
||||
end
|
||||
|
||||
return itemstack
|
||||
end
|
||||
|
||||
})
|
||||
|
||||
|
||||
minetest.register_craftitem(
|
||||
"default:fertilizer",
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user