forked from VoxeLibre/VoxeLibre
Use Minecraft-like treasures in mineshaft chests
This commit is contained in:
parent
fb9f98191a
commit
be5547336b
|
@ -1,4 +1,5 @@
|
||||||
# Railway corridors for Treasurer [`tsm_railcorridors`]
|
# Railway corridors [`tsm_railcorridors`]
|
||||||
|
MineClone 2 adaption. NO TREASURER SUPPORT!
|
||||||
|
|
||||||
* Current version 0.11.0
|
* Current version 0.11.0
|
||||||
|
|
||||||
|
|
|
@ -3,4 +3,3 @@ mcl_util
|
||||||
mcl_core
|
mcl_core
|
||||||
mcl_tnt
|
mcl_tnt
|
||||||
mcl_farming
|
mcl_farming
|
||||||
treasurer?
|
|
||||||
|
|
|
@ -24,30 +24,76 @@ tsm_railcorridors.nodes = {
|
||||||
-- only if the Treasurer mod is not found.
|
-- only if the Treasurer mod is not found.
|
||||||
-- pr: A PseudoRandom object
|
-- pr: A PseudoRandom object
|
||||||
function tsm_railcorridors.get_default_treasure(pr)
|
function tsm_railcorridors.get_default_treasure(pr)
|
||||||
if pr:next(0,1000) < 30 then
|
-- UNUSED IN MINECLONE 2!
|
||||||
return "mcl_farming:bread "..pr:next(1,3)
|
end
|
||||||
elseif pr:next(0,1000) < 50 then
|
|
||||||
if pr:next(0,1000) < 500 then
|
-- MineClone 2's treasure function. Gets all treasures for a single chest.
|
||||||
return "mcl_farming:pumpkin_seeds "..pr:next(1,5)
|
-- Based on information from Minecraft Wiki.
|
||||||
|
function tsm_railcorridors.get_treasures(pr)
|
||||||
|
local r1 = pr:next(1,71)
|
||||||
|
local r2 = pr:next(1,83)
|
||||||
|
local r3 = pr:next(1,50)
|
||||||
|
|
||||||
|
local items = {}
|
||||||
|
-- First roll
|
||||||
|
if r1 <= 30 then
|
||||||
|
table.insert(items, "mobs:nametag")
|
||||||
|
elseif r1 <= 50 then
|
||||||
|
table.insert(items, "mcl_core:apple_gold")
|
||||||
|
elseif r1 <= 60 then
|
||||||
|
-- TODO: Enchanted Book
|
||||||
|
table.insert(items, "mcl_books:book")
|
||||||
|
elseif r1 <= 65 then
|
||||||
|
-- Nothing!
|
||||||
|
elseif r1 <= 70 then
|
||||||
|
table.insert(items, "mcl_tools:pick_iron")
|
||||||
else
|
else
|
||||||
return "mcl_farming:melon_seeds "..pr:next(1,5)
|
-- TODO: Enchanted Golden Apple
|
||||||
|
table.insert(items, "mcl_core:apple_gold")
|
||||||
end
|
end
|
||||||
elseif pr:next(0,1000) < 5 then
|
|
||||||
return "mcl_tools:pick_iron"
|
-- Second roll
|
||||||
elseif pr:next(0,1000) < 3 then
|
local r2stacks = pr:next(2,4)
|
||||||
local r = pr:next(0, 1000)
|
for i=1, r2stacks do
|
||||||
if r < 400 then
|
if r2 <= 15 then
|
||||||
return "mcl_core:iron_ingot "..pr:next(1,5)
|
table.insert(items, "mcl_farming:bread "..pr:next(1,3))
|
||||||
elseif r < 800 then
|
elseif r2 <= 25 then
|
||||||
return "mcl_core:gold_ingot "..pr:next(1,3)
|
table.insert(items, "mcl_core:coal_lump "..pr:next(3,8))
|
||||||
|
elseif r2 <= 35 then
|
||||||
|
table.insert(items, "mcl_farming:beetroot_seeds "..pr:next(2,4))
|
||||||
|
elseif r2 <= 45 then
|
||||||
|
table.insert(items, "mcl_farming:melon_seeds "..pr:next(2,4))
|
||||||
|
elseif r2 <= 55 then
|
||||||
|
table.insert(items, "mcl_farming:pumpkin_seeds "..pr:next(2,4))
|
||||||
|
elseif r2 <= 65 then
|
||||||
|
table.insert(items, "mcl_core:iron_ingot "..pr:next(1,5))
|
||||||
|
elseif r2 <= 70 then
|
||||||
|
table.insert(items, "mcl_dye:blue "..pr:next(4,9))
|
||||||
|
elseif r2 <= 75 then
|
||||||
|
table.insert(items, "mesecons:redstone "..pr:next(4,9))
|
||||||
|
elseif r2 <= 80 then
|
||||||
|
table.insert(items, "mcl_core:gold_ingot "..pr:next(1,3))
|
||||||
else
|
else
|
||||||
return "mcl_core:diamond "..pr:next(1,2)
|
table.insert(items, "mcl_core:diamond "..pr:next(1,2))
|
||||||
end
|
end
|
||||||
elseif pr:next(0,1000) < 30 then
|
end
|
||||||
return "mcl_torches:torch "..pr:next(1,16)
|
|
||||||
elseif pr:next(0,1000) < 20 then
|
-- Third roll
|
||||||
return "mcl_core:coal_lump "..pr:next(3,8)
|
for i=1, 3 do
|
||||||
|
if r3 <= 20 then
|
||||||
|
table.insert(items, "mcl_minecarts:rail "..pr:next(4,8))
|
||||||
|
elseif r3 <= 35 then
|
||||||
|
table.insert(items, "mcl_torches:torch "..pr:next(1,16))
|
||||||
|
elseif r3 <= 40 then
|
||||||
|
-- TODO: Activator Rail
|
||||||
|
table.insert(items, "mcl_minecarts:rail "..pr:next(1,4))
|
||||||
|
elseif r3 <= 45 then
|
||||||
|
-- TODO: Detector Rail
|
||||||
|
table.insert(items, "mcl_minecarts:rail "..pr:next(1,4))
|
||||||
else
|
else
|
||||||
return ""
|
table.insert(items, "mcl_minecarts:golden_rail "..pr:next(1,4))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
return items
|
||||||
|
end
|
||||||
|
|
|
@ -197,49 +197,15 @@ end
|
||||||
|
|
||||||
-- Random chest items
|
-- Random chest items
|
||||||
-- Zufälliger Kisteninhalt
|
-- Zufälliger Kisteninhalt
|
||||||
local function rci()
|
|
||||||
if(minetest.get_modpath("treasurer") ~= nil) then
|
|
||||||
local treasures
|
|
||||||
if pr:next(0,100) < 3 then
|
|
||||||
treasures = treasurer.select_random_treasures(1,2,4)
|
|
||||||
elseif pr:next(0,100) < 5 then
|
|
||||||
if pr:next(0,100) < 50 then
|
|
||||||
treasures = treasurer.select_random_treasures(1,2,4,"seed")
|
|
||||||
else
|
|
||||||
treasures = treasurer.select_random_treasures(1,2,4,"seed")
|
|
||||||
end
|
|
||||||
elseif pr:next(0,1000) < 5 then
|
|
||||||
if minetest.get_modpath("tnt") then
|
|
||||||
return "tnt:tnt "..pr:next(1,3)
|
|
||||||
end
|
|
||||||
elseif pr:next(0,1000) < 3 then
|
|
||||||
if pr:next(0,1000) < 800 then
|
|
||||||
treasures = treasurer.select_random_treasures(1,3,6,"mineral")
|
|
||||||
else
|
|
||||||
treasures = treasurer.select_random_treasures(1,5,9,"mineral")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if(treasures ~= nil) then
|
|
||||||
if(#treasures>=1) then
|
|
||||||
return treasures[1]:get_name()
|
|
||||||
else
|
|
||||||
return ""
|
|
||||||
end
|
|
||||||
else
|
|
||||||
return ""
|
|
||||||
end
|
|
||||||
else
|
|
||||||
return tsm_railcorridors.get_default_treasure(pr)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
-- chests
|
-- chests
|
||||||
local function Place_Chest(pos, param2)
|
local function Place_Chest(pos, param2)
|
||||||
if SetNodeIfCanBuild(pos, {name=tsm_railcorridors.nodes.chest, param2=param2}) then
|
if SetNodeIfCanBuild(pos, {name=tsm_railcorridors.nodes.chest, param2=param2}) then
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
for i=1, inv:get_size("main") do
|
local items = tsm_railcorridors.get_treasures(pr)
|
||||||
inv:set_stack("main", i, ItemStack(rci()))
|
for i=1, math.min(#items, inv:get_size("main")) do
|
||||||
|
inv:set_stack("main", i, ItemStack(items[i]))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue