mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-12-25 01:19:33 +01:00
Add wear to some fished items
This commit is contained in:
parent
d6f8da2ab4
commit
a9939b8e4b
1 changed files with 10 additions and 5 deletions
|
@ -11,6 +11,7 @@ minetest.register_tool("mcl_fishing:fishing_rod", {
|
||||||
if string.find(node.name, "mcl_core:water") then
|
if string.find(node.name, "mcl_core:water") then
|
||||||
local itemname
|
local itemname
|
||||||
local itemcount = 1
|
local itemcount = 1
|
||||||
|
local itemwear = 0
|
||||||
local r = math.random(1, 100)
|
local r = math.random(1, 100)
|
||||||
if r <= 85 then
|
if r <= 85 then
|
||||||
-- Fish
|
-- Fish
|
||||||
|
@ -30,12 +31,13 @@ minetest.register_tool("mcl_fishing:fishing_rod", {
|
||||||
if r <= 10 then
|
if r <= 10 then
|
||||||
itemname = "mcl_core:bowl"
|
itemname = "mcl_core:bowl"
|
||||||
elseif r <= 12 then
|
elseif r <= 12 then
|
||||||
-- TODO: Damaged
|
|
||||||
itemname = "mcl_fishing:fishing_rod"
|
itemname = "mcl_fishing:fishing_rod"
|
||||||
|
itemwear = math.random(6554, 65535) -- 10%-100% damaged
|
||||||
elseif r <= 22 then
|
elseif r <= 22 then
|
||||||
itemname = "mcl_mobitems:leather"
|
itemname = "mcl_mobitems:leather"
|
||||||
elseif r <= 32 then
|
elseif r <= 32 then
|
||||||
itemname = "3d_armor:boots_leather"
|
itemname = "3d_armor:boots_leather"
|
||||||
|
itemwear = math.random(6554, 65535) -- 10%-100% damaged
|
||||||
elseif r <= 42 then
|
elseif r <= 42 then
|
||||||
itemname = "mcl_mobitems:rotten_flesh"
|
itemname = "mcl_mobitems:rotten_flesh"
|
||||||
elseif r <= 47 then
|
elseif r <= 47 then
|
||||||
|
@ -58,14 +60,16 @@ minetest.register_tool("mcl_fishing:fishing_rod", {
|
||||||
-- Treasure
|
-- Treasure
|
||||||
r = math.random(1, 6)
|
r = math.random(1, 6)
|
||||||
if r == 1 then
|
if r == 1 then
|
||||||
-- TODO: Enchanted and damaged
|
-- TODO: Enchanted
|
||||||
itemname = "mcl_throwing:bow"
|
itemname = "mcl_throwing:bow"
|
||||||
|
itemwear = math.random(49144, 65535) -- 75%-100% damaged
|
||||||
elseif r == 2 then
|
elseif r == 2 then
|
||||||
-- TODO: Enchanted book
|
-- TODO: Enchanted book
|
||||||
itemname = "mcl_core:book"
|
itemname = "mcl_core:book"
|
||||||
elseif r == 3 then
|
elseif r == 3 then
|
||||||
-- TODO: Enchanted and damaged
|
-- TODO: Enchanted
|
||||||
itemname = "mcl_fishing:fishing_rod"
|
itemname = "mcl_fishing:fishing_rod"
|
||||||
|
itemwear = math.random(49144, 65535) -- 75%-100% damaged
|
||||||
elseif r == 4 then
|
elseif r == 4 then
|
||||||
itemname = "mobs:nametag"
|
itemname = "mobs:nametag"
|
||||||
elseif r == 5 then
|
elseif r == 5 then
|
||||||
|
@ -75,8 +79,9 @@ minetest.register_tool("mcl_fishing:fishing_rod", {
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local inv = user:get_inventory()
|
local inv = user:get_inventory()
|
||||||
if inv:room_for_item("main", {name=itemname, count=itemcount, wear=0, metadata=""}) then
|
local item = {name=itemname, count=itemcount, wear=itemwear, metadata=""}
|
||||||
inv:add_item("main", {name=itemname, count=itemcount, wear=0, metadata=""})
|
if inv:room_for_item("main", item) then
|
||||||
|
inv:add_item("main", item)
|
||||||
end
|
end
|
||||||
if not minetest.setting_get("creative_mode") then
|
if not minetest.setting_get("creative_mode") then
|
||||||
itemstack:add_wear(66000/65) -- 65 uses
|
itemstack:add_wear(66000/65) -- 65 uses
|
||||||
|
|
Loading…
Reference in a new issue