1 minetest
.register_tool("wateringcan:wateringcan_water", {
2 description
= "watering can with water",
3 inventory_image
= "wateringcan_wateringcan_water.png",
4 wield_image
= "wateringcan_wateringcan_wield.png",
5 liquids_pointable
= true,
8 full_punch_interval
= 2.0,
10 on_place
= function(itemstack
, user
, pointed_thing
)
11 if(pointed_thing
.type == "node") then
12 local node
= minetest
.get_node_or_nil(pointed_thing
.under
)
14 local name
= node
.name
15 local nodedef
= minetest
.registered_nodes
[name
]
18 if minetest
.get_item_group(name
, "water") > 0 then
19 newtool
= { name
= "wateringcan:wateringcan_water" }
21 elseif name
== "farming:soil" and minetest
.get_modpath("farming") ~= nil then
22 minetest
.set_node(pointed_thing
.under
, { name
= "farming:soil_wet" })
23 elseif minetest
.get_item_group(name
, "sucky") > 0 and minetest
.get_item_group(name
, "wet") <= 2 and minetest
.get_modpath("pedology") ~= nil then
24 pedology
.wetten(pointed_thing
.under
)
28 wear
= itemstack
:get_wear()
29 wear
= wear
+ 2849 -- 24 uses
31 newtool
= { name
= "wateringcan:wateringcan_empty" }
33 newtool
= { name
= "wateringcan:wateringcan_water", wear
= wear
}
44 minetest
.register_tool("wateringcan:wateringcan_empty", {
45 description
= "empty watering can",
46 inventory_image
= "wateringcan_wateringcan_empty.png",
47 wield_image
= "wateringcan_wateringcan_wield.png",
48 liquids_pointable
= true,
51 full_punch_interval
= 2.0,
53 on_place
= function(itemstack
, user
, pointed_thing
)
54 local node
= minetest
.get_node_or_nil(pointed_thing
.under
)
56 local name
= node
.name
57 local nodedef
= minetest
.registered_nodes
[name
]
58 if minetest
.get_item_group(name
, "water") > 0 then
59 return { name
= "wateringcan:wateringcan_water" }