New default treasures
parent
c82726c9f1
commit
b17cd9294f
|
@ -68,49 +68,76 @@ function tsm_railcorridors.get_default_treasure(pr)
|
||||||
if pr:next(0,1000) < 30 then
|
if pr:next(0,1000) < 30 then
|
||||||
return "farming:bread "..pr:next(1,3)
|
return "farming:bread "..pr:next(1,3)
|
||||||
elseif pr:next(0,1000) < 50 then
|
elseif pr:next(0,1000) < 50 then
|
||||||
-- Seeds and saplings.
|
-- Seeds
|
||||||
-- This includes saplings which are normally unobtainable in v6. :-)
|
|
||||||
|
|
||||||
local r = pr:next(0,1000)
|
local r = pr:next(0,1000)
|
||||||
-- 25%
|
-- 50%
|
||||||
if r < 250 then
|
if r < 500 then
|
||||||
return "farming:seed_cotton "..pr:next(1,5)
|
return "farming:seed_cotton "..pr:next(1,5)
|
||||||
-- 25%
|
-- 50%
|
||||||
elseif r < 500 then
|
|
||||||
return "farming:seed_wheat "..pr:next(1,5)
|
|
||||||
-- 20%
|
|
||||||
elseif r < 700 then
|
|
||||||
return "default:sapling "..pr:next(1,4)
|
|
||||||
-- 13%
|
|
||||||
elseif r < 830 then
|
|
||||||
return "default:acacia_sapling "..pr:next(1,2)
|
|
||||||
-- 13%
|
|
||||||
elseif r < 960 then
|
|
||||||
return "default:aspen_sapling "..pr:next(1,3)
|
|
||||||
-- 2.5%
|
|
||||||
elseif r < 985 then
|
|
||||||
return "default:bush_sapling "..pr:next(1,4)
|
|
||||||
-- 1.5%
|
|
||||||
else
|
else
|
||||||
return "default:acacia_bush_sapling "..pr:next(1,4)
|
return "farming:seed_wheat "..pr:next(1,5)
|
||||||
end
|
end
|
||||||
elseif pr:next(0,1000) < 5 then
|
elseif pr:next(0,1000) < 5 then
|
||||||
return "tnt:tnt "..pr:next(1,3)
|
return "tnt:tnt "..pr:next(1,3)
|
||||||
|
elseif pr:next(0,1000) < 10 then
|
||||||
|
return "carts:cart"
|
||||||
|
elseif pr:next(0,1000) < 13 then
|
||||||
|
local r = pr:next(0,1000)
|
||||||
|
if r < 100 then
|
||||||
|
return "carts:brakerail "..pr:next(4, 16)
|
||||||
|
elseif r < 433 then
|
||||||
|
return "carts:powerrail "..pr:next(3, 8)
|
||||||
|
else
|
||||||
|
return "carts:rail "..pr:next(2,16)
|
||||||
|
end
|
||||||
elseif pr:next(0,1000) < 5 then
|
elseif pr:next(0,1000) < 5 then
|
||||||
return "default:pick_steel"
|
local r = pr:next(0,1000)
|
||||||
|
if r < 600 then
|
||||||
|
return "default:pick_steel"
|
||||||
|
elseif r < 950 then
|
||||||
|
return "default:pick_bronze"
|
||||||
|
else
|
||||||
|
return "default:pick_mese 1 "..(pr:next(0, 6400)*5)
|
||||||
|
end
|
||||||
|
elseif pr:next(0,1000) < 25 then
|
||||||
|
-- Saplings. This includes saplings which are normally unobtainable in v6. :-)
|
||||||
|
local r = pr:next(0,1000)
|
||||||
|
-- 40%
|
||||||
|
if r < 400 then
|
||||||
|
return "default:sapling "..pr:next(1,4)
|
||||||
|
-- 26%
|
||||||
|
elseif r < 660 then
|
||||||
|
return "default:acacia_sapling "..pr:next(1,2)
|
||||||
|
-- 26%
|
||||||
|
elseif r < 920 then
|
||||||
|
return "default:aspen_sapling "..pr:next(1,3)
|
||||||
|
-- 5%
|
||||||
|
elseif r < 970 then
|
||||||
|
return "default:bush_sapling "..pr:next(1,4)
|
||||||
|
-- 3%
|
||||||
|
else
|
||||||
|
return "default:acacia_bush_sapling "..pr:next(1,4)
|
||||||
|
end
|
||||||
elseif pr:next(0,1000) < 3 then
|
elseif pr:next(0,1000) < 3 then
|
||||||
local r = pr:next(0, 1000)
|
local r = pr:next(0, 1000)
|
||||||
if r < 400 then
|
if r < 400 then
|
||||||
return "default:steel_ingot "..pr:next(1,5)
|
return "default:steel_ingot "..pr:next(1,7)
|
||||||
elseif r < 700 then
|
elseif r < 700 then
|
||||||
return "default:gold_ingot "..pr:next(1,3)
|
return "default:gold_ingot "..pr:next(1,4)
|
||||||
elseif r < 900 then
|
elseif r < 900 then
|
||||||
return "default:mese_crystal "..pr:next(1,3)
|
return "default:mese_crystal "..pr:next(1,3)
|
||||||
else
|
else
|
||||||
return "default:diamond "..pr:next(1,2)
|
return "default:diamond "..pr:next(1,2)
|
||||||
end
|
end
|
||||||
elseif pr:next(0,1000) < 30 then
|
elseif pr:next(0,1000) < 2 then
|
||||||
return "default:torch "..pr:next(1,16)
|
local r = pr:next(0,1000)
|
||||||
|
if r < 900 then
|
||||||
|
return "default:shovel_steel"
|
||||||
|
else
|
||||||
|
return "default:shovel_bronze"
|
||||||
|
end
|
||||||
|
elseif pr:next(0,1000) < 2 then
|
||||||
|
return "default:torch "..pr:next(4,99)
|
||||||
elseif pr:next(0,1000) < 20 then
|
elseif pr:next(0,1000) < 20 then
|
||||||
return "default:coal_lump "..pr:next(3,8)
|
return "default:coal_lump "..pr:next(3,8)
|
||||||
else
|
else
|
||||||
|
@ -118,4 +145,3 @@ function tsm_railcorridors.get_default_treasure(pr)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
20
init.lua
20
init.lua
|
@ -60,7 +60,7 @@ if setting then
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Probability for every part of a corridor to contain a cart
|
-- Probability for every part of a corridor to contain a cart
|
||||||
local probability_cart = P(0.1)
|
local probability_cart = P(0.05)
|
||||||
setting = tonumber(minetest.settings:get("tsm_railcorridors_probability_cart"))
|
setting = tonumber(minetest.settings:get("tsm_railcorridors_probability_cart"))
|
||||||
if setting then
|
if setting then
|
||||||
probability_cart = P(setting)
|
probability_cart = P(setting)
|
||||||
|
@ -105,13 +105,15 @@ local chaos_mode = minetest.settings:get_bool("tsm_railcorridors_chaos") or fals
|
||||||
-- End of parameters
|
-- End of parameters
|
||||||
|
|
||||||
-- Random Perlin noise generators
|
-- Random Perlin noise generators
|
||||||
local pr, pr_carts, webperlin_major, webperlin_minor
|
local pr, pr_carts, pr_treasures, webperlin_major, webperlin_minor
|
||||||
|
|
||||||
local function InitRandomizer(seed)
|
local function InitRandomizer(seed)
|
||||||
-- Mostly used for corridor gen.
|
-- Mostly used for corridor gen.
|
||||||
pr = PseudoRandom(seed)
|
pr = PseudoRandom(seed)
|
||||||
-- Separate randomizer for carts because spawning carts is very timing-dependent
|
-- Separate randomizer for carts because spawning carts is very timing-dependent
|
||||||
pr_carts = PseudoRandom(seed-654)
|
pr_carts = PseudoRandom(seed-654)
|
||||||
|
-- Chest contents randomizer
|
||||||
|
pr_treasures = PseudoRandom(seed+777)
|
||||||
-- Used for cobweb generation, both noises have to reach a high value for cobwebs to appear
|
-- Used for cobweb generation, both noises have to reach a high value for cobwebs to appear
|
||||||
webperlin_major = PerlinNoise(934, 3, 0.6, 500)
|
webperlin_major = PerlinNoise(934, 3, 0.6, 500)
|
||||||
webperlin_minor = PerlinNoise(834, 3, 0.6, 50)
|
webperlin_minor = PerlinNoise(834, 3, 0.6, 50)
|
||||||
|
@ -305,20 +307,20 @@ end
|
||||||
local function rci()
|
local function rci()
|
||||||
if(minetest.get_modpath("treasurer") ~= nil) then
|
if(minetest.get_modpath("treasurer") ~= nil) then
|
||||||
local treasures
|
local treasures
|
||||||
if pr:next(0,100) < 3 then
|
if pr_treasures:next(0,100) < 3 then
|
||||||
treasures = treasurer.select_random_treasures(1,2,4)
|
treasures = treasurer.select_random_treasures(1,2,4)
|
||||||
elseif pr:next(0,100) < 5 then
|
elseif pr_treasures:next(0,100) < 5 then
|
||||||
if pr:next(0,100) < 50 then
|
if pr:next(0,100) < 50 then
|
||||||
treasures = treasurer.select_random_treasures(1,2,4,"seed")
|
treasures = treasurer.select_random_treasures(1,2,4,"seed")
|
||||||
else
|
else
|
||||||
treasures = treasurer.select_random_treasures(1,2,4,"seed")
|
treasures = treasurer.select_random_treasures(1,2,4,"seed")
|
||||||
end
|
end
|
||||||
elseif pr:next(0,1000) < 5 then
|
elseif pr_treasures:next(0,1000) < 5 then
|
||||||
if minetest.get_modpath("tnt") then
|
if minetest.get_modpath("tnt") then
|
||||||
return "tnt:tnt "..pr:next(1,3)
|
return "tnt:tnt "..pr_treasures:next(1,3)
|
||||||
end
|
end
|
||||||
elseif pr:next(0,1000) < 3 then
|
elseif pr_treasures:next(0,1000) < 3 then
|
||||||
if pr:next(0,1000) < 800 then
|
if pr_treasures:next(0,1000) < 800 then
|
||||||
treasures = treasurer.select_random_treasures(1,3,6,"mineral")
|
treasures = treasurer.select_random_treasures(1,3,6,"mineral")
|
||||||
else
|
else
|
||||||
treasures = treasurer.select_random_treasures(1,5,9,"mineral")
|
treasures = treasurer.select_random_treasures(1,5,9,"mineral")
|
||||||
|
@ -335,7 +337,7 @@ local function rci()
|
||||||
return ""
|
return ""
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
return tsm_railcorridors.get_default_treasure(pr)
|
return tsm_railcorridors.get_default_treasure(pr_treasures)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -23,8 +23,9 @@ tsm_railcorridors_probability_chest (Chest probability) float 0.05 0.0 1.0
|
||||||
#Probability (0.0 to 1.0) for every part of a rail corridor to include a cart.
|
#Probability (0.0 to 1.0) for every part of a rail corridor to include a cart.
|
||||||
#Note: The rail may still be subject to rail damage, so the probability
|
#Note: The rail may still be subject to rail damage, so the probability
|
||||||
#of finding a cart in rail corridors with high rail damage will be lower.
|
#of finding a cart in rail corridors with high rail damage will be lower.
|
||||||
#Note that cart spawning is experimental, carts often fail to spawn even if they should.
|
#NOTE: Due to a bug in Minetest <https://github.com/minetest/minetest/issues/4759>
|
||||||
tsm_railcorridors_probability_cart (Cart probability) float 0.10 0.0 1.0
|
#carts often fail to spawn even if they should.
|
||||||
|
tsm_railcorridors_probability_cart (Cart probability) float 0.05 0.0 1.0
|
||||||
|
|
||||||
#If enabled, cobwebs may be placed in some corridors.
|
#If enabled, cobwebs may be placed in some corridors.
|
||||||
#Currently, cobwebs are only supported with the Mobs Redo mod.
|
#Currently, cobwebs are only supported with the Mobs Redo mod.
|
||||||
|
|
Loading…
Reference in New Issue