-- File: codersea/settings.lua -- Purpose: CoderSea settings processor -- Credits: See "codersea.md" -- Licenses: See "LICENSE" -- =================================================================== -- numeric settings -- =================================================================== -- "numeric_settings" defines all of the "minetest.conf" numeric set- -- tings supported by this mod, including alternate spellings and de- -- fault values. -- "numeric_settings" is a list of lists. -- Each entry, i.e., inner list, in "numeric_settings" is a list of -- one or more spellings for a particular setting followed by an inte- -- ger. -- The integer may be negative, zero, or positive. It specifies the -- default value for the setting. -- The first spelling in a given entry doubles as the name of a global -- variable. The variable will end up holding the retrieved value of -- the associated setting. -- "codersea.conf", the internal mod configuration file, only supports -- the first spelling for each setting. -- =================================================================== local numeric_settings = { -- =================================================================== -- Misc. numeric settings. { "codersea_light" , 14 , } , { "codersea_decipercent_algae" , 8 , } , { "codersea_decipercent_plant" , 12 , } , { "codersea_decipercent_glass" , 10 , } , { "codersea_decipercent_stone" , 10 , } , { "codersea_interval_cvtsoil" , 20 , } , { "codersea_chance_cvtsoil" , 10 , } , { "codersea_abm02_interval" , 20 , } , { "codersea_abm02_chance" , 10 , } , { "codersea_abm03_interval" , 20 , } , { "codersea_abm03_chance" , 3 , } , { "codersea_interval_growback" , 8 , } , { "codersea_chance_growback" , 2 , } , -- =================================================================== -- Individual-mob "aoc" settings. { "codersea_aoc_dolidro" , "codersea_aoc_dolidrosauri" , "codersea_aoc_dolidrosaurus" , "codersea_aoc_dolidrosauruses" , 1 , } , { "codersea_aoc_fish" , "codersea_aoc_fishes" , 4 , } , { "codersea_aoc_jellyfish" , 4 , } , { "codersea_aoc_lobster" , "codersea_aoc_lobsters" , 1 , } , { "codersea_aoc_octopus" , "codersea_aoc_octopuses" , "codersea_aoc_octopi" , 1 , } , { "codersea_aoc_seahorse" , "codersea_aoc_seahorses" , 4 , } , { "codersea_aoc_shark" , "codersea_aoc_sharks" , 1 , } , { "codersea_aoc_turtle" , "codersea_aoc_turtles" , 1 , } , { "codersea_aoc_urchin" , 4 , } , -- =================================================================== -- Individual-mob "chance" settings. -- There are about six types of regular small fish (carp, butterfish, -- trout, etc.) as opposed to other sealife such as jellyfish, sea- -- horse, shark, etc. -- "codersea_chance_fish" applies to the various types of regular -- small fish independently. -- Similarly, there are three types of sharks and "codersea_chance_ -- shark" applies to the three types independently. -- So, decreases to these settings may add proportionately far more -- mobs than decreases to other "chance" settings. -- It's suggested that you set "codersea_chance_fish" to at least 6 -- times the chance setting that you'd use for a single regular small -- fish species. You might need to increase the number further to give -- other mobs a chance to spawn. -- "codersea_chance_shark" should be set to 3 times the chance setting -- that you'd use for a single shark species. { "codersea_chance_dolidro" , "codersea_chance_dolidrosauri" , "codersea_chance_dolidrosaurus" , "codersea_chance_dolidrosauruses" , 30000 , } , { "codersea_chance_fish" , "codersea_chance_fishes" , 12000 , } , { "codersea_chance_jellyfish" , 4000 , } , { "codersea_chance_lobster" , "codersea_chance_lobsters" , 8000 , } , { "codersea_chance_octopus" , "codersea_chance_octopuses" , "codersea_chance_octopi" , 30000 , } , { "codersea_chance_seahorse" , "codersea_chance_seahorses" , 6000 } , { "codersea_chance_shark" , "codersea_chance_sharks" , 95000 } , { "codersea_chance_turtle" , "codersea_chance_turtles" , 5000 , } , { "codersea_chance_urchin" , 3000 , } , -- =================================================================== -- End of "numeric_settings". } -- =================================================================== -- boolean settings -- =================================================================== -- "boolean_settings" defines all of the "minetest.conf" boolean set- -- tings supported by this mod, including alternate spellings. -- Each entry, i.e., inner list, in "boolean_settings" is a list of -- one or more spellings for a particular setting. -- The first spelling in a given entry doubles as the name of a global -- variable. The variable will end up holding the retrieved value of -- the associated setting. -- The default value, for all of the boolean settings, is false. -- "codersea.conf", the internal mod configuration file, only supports -- the first spelling for each setting. -- =================================================================== local boolean_settings = { -- =================================================================== -- Misc. boolean settings. { "codersea_disable_mobs" , } , { "codersea_reset" , } , { "codersea_disable_shine" , } , { "codersea_disable_stairs" , } , { "codersea_disable_waving" , } , { "codersea_disable_shipwrecks" , "codersea_disable_shipwreck" , } , { "codersea_drowning" , "codersea_drown" , } , { "codersea_disable_seastone" , } , -- =================================================================== -- Individual-mob "disable" flags. { "codersea_disable_dolidro" , "codersea_disable_dolidrosauri" , "codersea_disable_dolidrosaurus" , "codersea_disable_dolidrosauruses" , } , { "codersea_disable_fish" , "codersea_disable_fishes" , } , { "codersea_disable_jellyfish" , } , { "codersea_disable_lobster" , "codersea_disable_lobsters" , } , { "codersea_disable_octopus" , "codersea_disable_octopuses" , "codersea_disable_octopi" , } , { "codersea_disable_seahorse" , "codersea_disable_seahorses" , } , { "codersea_disable_shark" , "codersea_disable_sharks" , } , { "codersea_disable_turtle" , "codersea_disable_turtles" , } , { "codersea_disable_urchin" , } , -- =================================================================== -- Individual-mob "monster" flags. { "codersea_monster_dolidro" , "codersea_monster_dolidrosauri" , "codersea_monster_dolidrosaurus" , "codersea_monster_dolidrosauruses" , } , { "codersea_monster_jellyfish" , } , { "codersea_monster_urchin" , } , { "codersea_monster_octopus" , "codersea_monster_octopuses" , "codersea_monster_octopi" , } , { "codersea_monster_shark" , "codersea_monster_sharks" , } , -- =================================================================== -- End of "boolean_settings". } -- =================================================================== -- process boolean-settings table -- =================================================================== for _,namelist in pairs (boolean_settings) do local firstname local cmdbuf = "" for k,name in pairs (namelist) do if firstname == nil then firstname = name cmdbuf = firstname .. '=' else cmdbuf = cmdbuf .. ' or ' end cmdbuf = cmdbuf .. 'has_bool ("' .. name .. '")' end f = loadstring (cmdbuf) f() end -- =================================================================== -- process numeric-settings table -- =================================================================== for _,namelist in pairs (numeric_settings) do local firstname local cmdbuf = "" for k,name in pairs (namelist) do if firstname == nil then firstname = name cmdbuf = firstname .. '=' else cmdbuf = cmdbuf .. ' or ' end if (name..""):find ("^[%d-]+$") == nil then cmdbuf = cmdbuf .. 'numset ("' .. name .. '")' else cmdbuf = cmdbuf .. name end end f = loadstring (cmdbuf) f() end -- =================================================================== -- load "codersea.conf" settings -- =================================================================== local function localconf() dofile (codersea.modpath .. "/codersea.conf"); end pcall (localconf) -- =================================================================== -- "reset" flag affects other flags -- =================================================================== if codersea_reset then codersea_disable_mobs = true codersea_disable_seastone = true codersea_disable_shine = true codersea_disable_stairs = true end -- =================================================================== -- "decipercent" checks -- =================================================================== if codersea_decipercent_algae < 0 or codersea_decipercent_algae > 100 then codersea_decipercent_algae = 10 end if codersea_decipercent_glass < 0 or codersea_decipercent_glass > 100 then codersea_decipercent_glass = 10 end if codersea_decipercent_plant < 0 or codersea_decipercent_plant > 100 then codersea_decipercent_plant = 10 end if codersea_decipercent_stone < 0 or codersea_decipercent_stone > 100 then codersea_decipercent_stone = 10 end -- =================================================================== -- misc. parameters -- =================================================================== codersea.default_spawn_nodes = { "codersea:water_source" , "default:river_water_source" , "default:water_source" , "default:water_gel" , } codersea.default_spawn_near = { "codersea:water_flowing" , "codersea:water_source" , "default:river_water_flowing" , "default:river_water_source" , "default:water_flowing" , "default:water_source" , } -- =================================================================== -- End of file.