diff --git a/gameconfig.lua b/gameconfig.lua index 68d72f2..f072aaa 100644 --- a/gameconfig.lua +++ b/gameconfig.lua @@ -68,49 +68,76 @@ function tsm_railcorridors.get_default_treasure(pr) if pr:next(0,1000) < 30 then return "farming:bread "..pr:next(1,3) elseif pr:next(0,1000) < 50 then - -- Seeds and saplings. - -- This includes saplings which are normally unobtainable in v6. :-) - + -- Seeds local r = pr:next(0,1000) - -- 25% - if r < 250 then + -- 50% + if r < 500 then return "farming:seed_cotton "..pr:next(1,5) - -- 25% - 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% + -- 50% else - return "default:acacia_bush_sapling "..pr:next(1,4) + return "farming:seed_wheat "..pr:next(1,5) end elseif pr:next(0,1000) < 5 then 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 - 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 local r = pr:next(0, 1000) if r < 400 then - return "default:steel_ingot "..pr:next(1,5) + return "default:steel_ingot "..pr:next(1,7) elseif r < 700 then - return "default:gold_ingot "..pr:next(1,3) + return "default:gold_ingot "..pr:next(1,4) elseif r < 900 then return "default:mese_crystal "..pr:next(1,3) else return "default:diamond "..pr:next(1,2) end - elseif pr:next(0,1000) < 30 then - return "default:torch "..pr:next(1,16) + elseif pr:next(0,1000) < 2 then + 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 return "default:coal_lump "..pr:next(3,8) else @@ -118,4 +145,3 @@ function tsm_railcorridors.get_default_treasure(pr) end end - diff --git a/init.lua b/init.lua index d90c2a2..33ae0ae 100644 --- a/init.lua +++ b/init.lua @@ -60,7 +60,7 @@ if setting then end -- 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")) if setting then probability_cart = P(setting) @@ -105,13 +105,15 @@ local chaos_mode = minetest.settings:get_bool("tsm_railcorridors_chaos") or fals -- End of parameters -- 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) -- Mostly used for corridor gen. pr = PseudoRandom(seed) -- Separate randomizer for carts because spawning carts is very timing-dependent 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 webperlin_major = PerlinNoise(934, 3, 0.6, 500) webperlin_minor = PerlinNoise(834, 3, 0.6, 50) @@ -305,20 +307,20 @@ end local function rci() if(minetest.get_modpath("treasurer") ~= nil) then 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) - elseif pr:next(0,100) < 5 then + elseif pr_treasures: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 + elseif pr_treasures:next(0,1000) < 5 then if minetest.get_modpath("tnt") then - return "tnt:tnt "..pr:next(1,3) + return "tnt:tnt "..pr_treasures:next(1,3) end - elseif pr:next(0,1000) < 3 then - if pr:next(0,1000) < 800 then + elseif pr_treasures:next(0,1000) < 3 then + if pr_treasures:next(0,1000) < 800 then treasures = treasurer.select_random_treasures(1,3,6,"mineral") else treasures = treasurer.select_random_treasures(1,5,9,"mineral") @@ -335,7 +337,7 @@ local function rci() return "" end else - return tsm_railcorridors.get_default_treasure(pr) + return tsm_railcorridors.get_default_treasure(pr_treasures) end end diff --git a/settingtypes.txt b/settingtypes.txt index 9f88cf1..8cd03b0 100644 --- a/settingtypes.txt +++ b/settingtypes.txt @@ -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. #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. -#Note that cart spawning is experimental, carts often fail to spawn even if they should. -tsm_railcorridors_probability_cart (Cart probability) float 0.10 0.0 1.0 +#NOTE: Due to a bug in Minetest +#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. #Currently, cobwebs are only supported with the Mobs Redo mod.