More settings in config.lua, inc. minimum items

Moved all new settings into config, bumped declared version number, made
minimum number of items in a chest configurable.
master
Chris N 2014-08-06 14:37:35 -10:00
parent 7962a26072
commit 62d7c52760
3 changed files with 22 additions and 8 deletions

View File

@ -23,7 +23,9 @@ minetest.register_abm({
end,
})
local MAX_ITEMS = 5 --maximum number of items to put in chests - do not set to less than 2
local MIN_ITEMS = caverealms.config.min_items--2 --minimum number of items to put in chests - do not set to greater than MAX_ITEMS
local MAX_ITEMS = caverealms.config.max_items--5 --maximum number of items to put in chests - do not set to less than MIN_ITEMS
--table of itemstrings
local ITEMS = {
"default:diamond",
@ -46,7 +48,7 @@ minetest.register_abm({
minetest.set_node(pos, {name="default:chest", param2=oldparam})
minetest.after(1.0, function()
local inv = minetest.get_inventory({type="node", pos=pos})
local item_num = math.random(1, MAX_ITEMS)
local item_num = math.random(MIN_ITEMS, MAX_ITEMS)
for i = 1, item_num do
item_i = math.random(8) --if you add or subtract items from ITEMS, be sure to change this value to reflect it
inv:add_item("main", ITEMS[item_i])

View File

@ -43,3 +43,15 @@ setting("number", "myccha", 0.03) --chance of mycena mushrooms
setting("number", "wormcha", 0.02) --chance of glow worms
setting("number", "giantcha", 0.001) --chance of giant mushrooms
setting("number", "icicha", 0.035) --chance of icicles
setting("number", "flacha", 0.04) --chance of constant flames
setting("number", "founcha", 0.001) --chance of fountains
setting("number", "fortcha", 0.0003) --chance of fortresses
--realm limits for Dungeon Masters' Lair
setting("number", "dm_top", -4000) --upper limit
setting("number", "dm_bot", -5000) --lower limit
--minimum number of items in chests found in fortresses
setting("number", "min_items", 2)
--maximum number of items in chests found in fortresses
setting("number", "max_items", 5)

View File

@ -1,4 +1,4 @@
-- caverealms v.0.3 by HeroOfTheWinds
-- caverealms v.0.4 by HeroOfTheWinds
-- original cave code modified from paramat's subterrain
-- For Minetest 0.4.8 stable
-- Depends default
@ -38,12 +38,12 @@ local MYCCHA = caverealms.config.myccha --0.03 --chance of mycena mushrooms
local WORMCHA = caverealms.config.wormcha --0.03 --chance of glow worms
local GIANTCHA = caverealms.config.giantcha --0.001 -- chance of giant mushrooms
local ICICHA = caverealms.config.icicha --0.035 -- chance of icicles
local FLACHA = 0.04 --chance of constant flames
local FOUNCHA = 0.001 --chance of statue + fountain
local FORTCHA = 0.0003 --chance of DM Fortresses
local FLACHA = caverealms.config.flacha --0.04 --chance of constant flames
local FOUNCHA = caverealms.config.founcha --0.001 --chance of statue + fountain
local FORTCHA = caverealms.config.fortcha --0.0003 --chance of DM Fortresses
local DM_TOP = -4000 --level at which Dungeon Master Realms start to appear
local DM_BOT = -5000 --level at which "" ends
local DM_TOP = caverealms.config.dm_top -- -4000 --level at which Dungeon Master Realms start to appear
local DM_BOT = caverealms.config.dm_bot -- -5000 --level at which "" ends
-- 3D noise for caves