forked from VoxeLibre/VoxeLibre
The mod mcl_fishing now uses mcl_loot API
This commit is contained in:
parent
1cdc98e03b
commit
09753ae57a
|
@ -1,2 +1,3 @@
|
||||||
mcl_core
|
mcl_core
|
||||||
mcl_sounds
|
mcl_sounds
|
||||||
|
mcl_loot
|
||||||
|
|
|
@ -12,73 +12,59 @@ local go_fishing = function(itemstack, user, pointed_thing)
|
||||||
local itemname
|
local itemname
|
||||||
local itemcount = 1
|
local itemcount = 1
|
||||||
local itemwear = 0
|
local itemwear = 0
|
||||||
local r = math.random(1, 100)
|
-- FIXME: Maybe use a better seeding
|
||||||
|
local pr = PseudoRandom(os.time() * math.random(1, 100))
|
||||||
|
local r = pr:next(1, 100)
|
||||||
if r <= 85 then
|
if r <= 85 then
|
||||||
-- Fish
|
-- Fish
|
||||||
r = math.random(1, 100)
|
items = mcl_loot.get_loot({
|
||||||
if r <= 60 then
|
items = {
|
||||||
itemname = "mcl_fishing:fish_raw"
|
{ itemstring = "mcl_fishing:fish_raw", weight = 60 },
|
||||||
elseif r <= 85 then
|
{ itemstring = "mcl_fishing:salmon_raw", weight = 25 },
|
||||||
itemname = "mcl_fishing:salmon_raw"
|
{ itemstring = "mcl_fishing:clownfish_raw", weight = 2 },
|
||||||
elseif r <= 87 then
|
{ itemstring = "mcl_fishing:pufferfish_raw", weight = 13 },
|
||||||
itemname = "mcl_fishing:clownfish_raw"
|
}
|
||||||
else
|
}, pr)
|
||||||
itemname = "mcl_fishing:pufferfish_raw"
|
|
||||||
end
|
|
||||||
elseif r <= 95 then
|
elseif r <= 95 then
|
||||||
-- Junk
|
-- Junk
|
||||||
r = math.random(1, 83)
|
items = mcl_loot.get_loot({
|
||||||
if r <= 10 then
|
items = {
|
||||||
itemname = "mcl_core:bowl"
|
{ itemstring = "mcl_core:bowl", weight = 10 },
|
||||||
elseif r <= 12 then
|
{ itemstring = "mcl_fishing:fishing_rod", weight = 2, wear_min = 6554, wear_max = 65535 }, -- 10%-100% damage
|
||||||
itemname = "mcl_fishing:fishing_rod"
|
{ itemstring = "mcl_mobitems:leather", weight = 10 },
|
||||||
itemwear = math.random(6554, 65535) -- 10%-100% damaged
|
{ itemstring = "3d_armor:boots_leather", weight = 10, wear_min = 6554, wear_max = 65535 }, -- 10%-100% damage
|
||||||
elseif r <= 22 then
|
{ itemstring = "mcl_mobitems:rotten_flesh", weight = 10 },
|
||||||
itemname = "mcl_mobitems:leather"
|
{ itemstring = "mcl_core:stick", weight = 5 },
|
||||||
elseif r <= 32 then
|
{ itemstring = "mcl_mobitems:string", weight = 5 },
|
||||||
itemname = "3d_armor:boots_leather"
|
{ itemstring = "mcl_potions:potion_water", weight = 10 },
|
||||||
itemwear = math.random(6554, 65535) -- 10%-100% damaged
|
{ itemstring = "mcl_mobitems:bone", weight = 10 },
|
||||||
elseif r <= 42 then
|
{ itemstring = "mcl_dye:black", weight = 1, amount_min = 10, amount_max = 10 },
|
||||||
itemname = "mcl_mobitems:rotten_flesh"
|
{ itemstring = "mcl_mobitems:string", weight = 10 }, -- TODO: Tripwire Hook
|
||||||
elseif r <= 47 then
|
}
|
||||||
itemname = "mcl_core:stick"
|
}, pr)
|
||||||
elseif r <= 52 then
|
|
||||||
itemname = "mcl_mobitems:string"
|
|
||||||
elseif r <= 62 then
|
|
||||||
itemname = "mcl_potions:potion_water"
|
|
||||||
elseif r <= 72 then
|
|
||||||
itemname = "mcl_mobitems:bone"
|
|
||||||
elseif r <= 73 then
|
|
||||||
itemname = "mcl_dye:black"
|
|
||||||
itemcount = 10
|
|
||||||
else
|
|
||||||
-- TODO: Tripwire hook
|
|
||||||
itemname = "mcl_mobitems:string"
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
-- Treasure
|
-- Treasure
|
||||||
r = math.random(1, 6)
|
items = mcl_loot.get_loot({
|
||||||
if r == 1 then
|
items = {
|
||||||
-- TODO: Enchanted bow
|
-- TODO: Enchanted Bow
|
||||||
itemname = "mcl_throwing:bow"
|
{ itemstring = "mcl_throwing:bow", wear_min = 49144, wear_max = 65535 }, -- 75%-100% damage
|
||||||
itemwear = math.random(49144, 65535) -- 75%-100% damaged
|
-- TODO: Enchanted Book
|
||||||
elseif r == 2 then
|
{ itemstring = "mcl_books:book" },
|
||||||
-- TODO: Enchanted book
|
-- TODO: Enchanted Fishing Rod
|
||||||
itemname = "mcl_books:book"
|
{ itemstring = "mcl_fishing:fishing_rod", wear_min = 49144, wear_max = 65535 }, -- 75%-100% damage
|
||||||
elseif r == 3 then
|
{ itemstring = "mobs:nametag", },
|
||||||
-- TODO: Enchanted fishing rod
|
{ itemstring = "mcl_mobitems:saddle", },
|
||||||
itemname = "mcl_fishing:fishing_rod"
|
{ itemstring = "mcl_flowers:waterlily", },
|
||||||
itemwear = math.random(49144, 65535) -- 75%-100% damaged
|
}
|
||||||
elseif r == 4 then
|
}, pr)
|
||||||
itemname = "mobs:nametag"
|
end
|
||||||
elseif r == 5 then
|
local item
|
||||||
itemname = "mcl_mobitems:saddle"
|
if #items >= 1 then
|
||||||
elseif r == 6 then
|
item = ItemStack(items[1])
|
||||||
itemname = "mcl_flowers:waterlily"
|
else
|
||||||
end
|
item = ItemStack()
|
||||||
end
|
end
|
||||||
local inv = user:get_inventory()
|
local inv = user:get_inventory()
|
||||||
local item = {name=itemname, count=itemcount, wear=itemwear, metadata=""}
|
|
||||||
if inv:room_for_item("main", item) then
|
if inv:room_for_item("main", item) then
|
||||||
inv:add_item("main", item)
|
inv:add_item("main", item)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue