right-click with fishing rod to bait with worm from inventory

master
TenPlus1 2019-03-18 08:50:38 +00:00
parent ff153c9c1f
commit d0ec4aa9a2
1 changed files with 18 additions and 1 deletions

View File

@ -48,11 +48,28 @@ minetest.register_craftitem("ethereal:worm", {
wield_image = "worm.png", wield_image = "worm.png",
}) })
-- Used when right-clicking with fishing rod to check for worm and bait rod
local rod_use = function(itemstack, placer, pointed_thing)
local inv = placer:get_inventory()
if inv:contains_item("main", "ethereal:worm") then
inv:remove_item("main", "ethereal:worm")
return ItemStack("ethereal:fishing_rod_baited")
end
end
-- Fishing Rod -- Fishing Rod
minetest.register_craftitem("ethereal:fishing_rod", { minetest.register_craftitem("ethereal:fishing_rod", {
description = S("Fishing Rod"), description = S("Fishing Rod (Right-Click with rod to bait with worm from inventory)"),
inventory_image = "fishing_rod.png", inventory_image = "fishing_rod.png",
wield_image = "fishing_rod.png", wield_image = "fishing_rod.png",
stack_max = 1,
on_place = rod_use,
on_secondary_use = rod_use
}) })
minetest.register_craft({ minetest.register_craft({