From 5989c9ce22f4ccb488f48cdaec811291b893d9d0 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 5 May 2022 07:35:56 +0200 Subject: [PATCH] Expose more settings in settingtypes.txt --- mods/rp_ambiance/init.lua | 1 + mods/rp_hunger/init.lua | 1 + mods/rp_music/init.lua | 1 + settingtypes.txt | 24 ++++++++++++++++++++++++ 4 files changed, 27 insertions(+) diff --git a/mods/rp_ambiance/init.lua b/mods/rp_ambiance/init.lua index 4f5a68c..e660ab3 100644 --- a/mods/rp_ambiance/init.lua +++ b/mods/rp_ambiance/init.lua @@ -122,6 +122,7 @@ ambiance.sounds["flowing_water"] = { } local ambiance_volume = tonumber(minetest.settings:get("ambiance_volume")) or 1.0 +ambiance_volume = math.max(0.0, math.min(1.0, ambiance_volume)) if minetest.settings:get_bool("ambiance_enable") == true then local soundspec = {} diff --git a/mods/rp_hunger/init.lua b/mods/rp_hunger/init.lua index a1ac527..bd8c6cc 100644 --- a/mods/rp_hunger/init.lua +++ b/mods/rp_hunger/init.lua @@ -22,6 +22,7 @@ local saving = false -- Seconds per hunger update, 2.0 is slightly fast local timer_interval = tonumber(minetest.settings:get("hunger_step")) or 3.0 +timer_interval = math.max(0, timer_interval) local timer = 0 local function save_hunger() diff --git a/mods/rp_music/init.lua b/mods/rp_music/init.lua index aee9984..469b5e5 100644 --- a/mods/rp_music/init.lua +++ b/mods/rp_music/init.lua @@ -17,6 +17,7 @@ music.tracks = { } music.volume = tonumber(minetest.settings:get("music_volume")) or 1.0 +music.volume = math.max(0.0, math.min(1.0, music.volume)) -- Array of music players diff --git a/settingtypes.txt b/settingtypes.txt index a2b1931..96d8269 100644 --- a/settingtypes.txt +++ b/settingtypes.txt @@ -15,6 +15,16 @@ give_initial_enable (Enable initial items) bool false # Comma-separated list of initial items to give to new players. You must use itemstrings as the item identifiers. This only works if give_initial_enable is active. give_initial_items (Initial items) string rp_default:pick_stone,rp_default:torch_weak 10 +# If enabled, players will get hungry over time. +# Otherwise, the hunger level won’t reduce at all. +hunger_enable (Enable hunger) bool true + +# This number specifies the interval in seconds +# at which the hunger of players is updated. +# The lower this number, the faster players get hungry. +# Very low numbers might cause performance problems! +hunger_step (Hunger speed) float 3.0 0.1 + [World] # If enabled, the weather will change from time to time. weather_enable (Enable dynamic weather) bool true @@ -38,6 +48,17 @@ bed_enable (Enable sleeping in beds) bool true # If disabled, music players will stay silent. music_enable (Enable music player playback) bool true +# Volume of music players. +music_volume (Music player volume) float 1.0 0.0 1.0 + +# If enabled, locks (like those on locked chests) +# won’t protect anything. +locks_all_unlocked (Unlock all locks) bool false + +# Number of seconds a locked block stays unlocked +# after cracking the lock open. +locks_picked_time (Picked lock time) float 15 1.0 + [Mobs] # If enabled, only peaceful, non-hostile mobs will appear. Hostile mobs will disappear and cannot be spawned at all. # This setting is only read at startup. @@ -64,3 +85,6 @@ mobs_enable_blood (Enable blood) bool false # Enables ambient sounds, such as birds, crickets, etc. ambiance_enable (Enable ambient sounds) bool true + +# Volume of ambient sounds. +ambiance_volume (Ambient volume) float 1.0 0.0 1.0