1 if (minetest
.get_modpath("intllib")) then
2 dofile(minetest
.get_modpath("intllib").."/intllib.lua")
3 S
= intllib
.Getter(minetest
.get_current_modname())
5 S
= function ( s
) return s
end
8 minetest
.register_tool("wateringcan:wateringcan_water", {
9 description
= S("watering can with water"),
10 inventory_image
= "wateringcan_wateringcan_water.png",
11 wield_image
= "wateringcan_wateringcan_wield.png",
12 liquids_pointable
= true,
15 full_punch_interval
= 2.0,
17 on_place
= function(itemstack
, user
, pointed_thing
)
18 if(pointed_thing
.type == "node") then
19 local pos
= pointed_thing
.under
20 local node
= minetest
.get_node_or_nil(pos
)
26 if minetest
.get_item_group(node
.name
, "plant") > 0 or minetest
.get_item_group(node
.name
, "flora") > 0 or minetest
.get_item_group(node
.name
, "seed") > 0 then
27 pos
= {x
=pos
.x
, y
=pos
.y
-1, z
=pos
.z
}
28 underunder
= minetest
.get_node_or_nil(pos
)
29 if(underunder
~= nil) then
30 name
= underunder
.name
31 nodedef
= minetest
.registered_nodes
[name
]
37 nodedef
= minetest
.registered_nodes
[name
]
39 if minetest
.get_item_group(name
, "water") > 0 then
40 newtool
= { name
= "wateringcan:wateringcan_water" }
42 elseif name
== "farming:soil" and minetest
.get_modpath("farming") ~= nil then
43 minetest
.set_node(pos
, { name
= "farming:soil_wet" })
44 elseif name
== "farming:desert_sand_soil" and minetest
.get_modpath("farming") ~= nil then
45 minetest
.set_node(pos
, { name
= "farming:desert_sand_soil_wet" })
47 elseif minetest
.get_item_group(name
, "sucky") > 0 and minetest
.get_item_group(name
, "wet") < 2 and minetest
.get_modpath("pedology") ~= nil then
52 wear
= itemstack
:get_wear()
53 wear
= wear
+ 2849 -- 24 uses
55 newtool
= { name
= "wateringcan:wateringcan_empty" }
57 newtool
= { name
= "wateringcan:wateringcan_water", wear
= wear
}
68 minetest
.register_tool("wateringcan:wateringcan_empty", {
69 description
= S("empty watering can"),
70 inventory_image
= "wateringcan_wateringcan_empty.png",
71 wield_image
= "wateringcan_wateringcan_wield.png",
72 liquids_pointable
= true,
75 full_punch_interval
= 2.0,
77 on_place
= function(itemstack
, user
, pointed_thing
)
78 local node
= minetest
.get_node_or_nil(pointed_thing
.under
)
80 local name
= node
.name
81 local nodedef
= minetest
.registered_nodes
[name
]
82 if minetest
.get_item_group(name
, "water") > 0 then
83 return { name
= "wateringcan:wateringcan_water" }