first commit
This commit is contained in:
commit
a5f6d52b60
113 changed files with 3263 additions and 0 deletions
43
items.lua
Normal file
43
items.lua
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
local pf = potted_farming
|
||||
local S = pf.S
|
||||
|
||||
local h_k = minetest.get_modpath("homedecor_kitchen") ~= nil
|
||||
local h_b = minetest.get_modpath("homedecor_bathroom") ~= nil
|
||||
local h_e = minetest.get_modpath("homedecor_exterior") ~= nil
|
||||
|
||||
local water_list = {
|
||||
["default:water_source"] = true,
|
||||
["default:water_flowing"] = true,
|
||||
["default:river_water_source"] = true,
|
||||
["default:river_water_flowing"] = true,
|
||||
["homedecor:kitchen_cabinet_colorable_with_sink"] = h_k,
|
||||
["homedecor:kitchen_cabinet_colorable_with_sink_locked"] = h_k,
|
||||
["homedecor:kitchen_faucet"] = h_b,
|
||||
["homedecor:sink"] = h_b,
|
||||
["homedecor:taps"] = h_b,
|
||||
["homedecor:taps_brass"] = h_b,
|
||||
["homedecor:well"] = h_e,
|
||||
}
|
||||
|
||||
minetest.register_craftitem(pf.modname .. ":empty_watering_can", {
|
||||
description = S("Empty Watering Can"),
|
||||
inventory_image = pf.modname .. "_empty_watering_can.png",
|
||||
groups = {watering_can = 1},
|
||||
liquids_pointable = true,
|
||||
stack_max = 1,
|
||||
on_use = function(itemstack, player, pointed_thing)
|
||||
-- KORRIGIERT: Greift direkt auf pointed_thing.under zu, um die Position zu erhalten.
|
||||
local pos = pointed_thing.under
|
||||
if not pos then return itemstack end
|
||||
local name = minetest.get_node(pos).name
|
||||
|
||||
if player:is_player() and pointed_thing.type == "node" and water_list[name] then
|
||||
itemstack:replace(pf.modname .. ":watering_can")
|
||||
local n = math.random(1, 2)
|
||||
minetest.sound_play("water-splash-0".. n, {pos=pos, gain=1.2})
|
||||
end
|
||||
|
||||
return itemstack
|
||||
|
||||
end,
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue