Feature: In-game settings menu compatibility.
parent
e75da3eb98
commit
f91779479a
|
@ -0,0 +1 @@
|
|||
Adds durable building materials that won't break on a first dig.
|
|
@ -0,0 +1,52 @@
|
|||
-- Loading global config.
|
||||
dofile(minetest.get_modpath(minetest.get_current_modname()).."/config.lua")
|
||||
|
||||
-- Processing in-game settings. In-game settings are preferrable
|
||||
-- over global config.lua values.
|
||||
function minetest_hardcorebrix.load_minetest_settings_key(key,type)
|
||||
if type == "int" then
|
||||
if minetest.settings:get("minetest_hardcorebrix."..key) ~= nil then
|
||||
minetest_hardcorebrix[key] = tonumber(minetest.settings:get("minetest_hardcorebrix."..key))
|
||||
end
|
||||
elseif type == "bool" then
|
||||
if minetest.settings:get_bool("minetest_hardcorebrix."..key) ~= nil then
|
||||
minetest_hardcorebrix[key] = minetest.settings:get_bool("minetest_hardcorebrix."..key)
|
||||
end
|
||||
end
|
||||
end
|
||||
minetest_hardcorebrix.load_minetest_settings_key("ENABLE_INGAME_SETTINGS","bool")
|
||||
if minetest_hardcorebrix.ENABLE_INGAME_SETTINGS == true then
|
||||
minetest_hardcorebrix.log("In-game minetest settings are enabled. Loading them.")
|
||||
minetest_hardcorebrix.load_minetest_settings_key("RED_FIRED_CLAY_BRICK_DEFAULT_COOKING_TIME_SECONDS","int")
|
||||
minetest_hardcorebrix.load_minetest_settings_key("WHITE_FIRED_CLAY_BRICK_DEFAULT_COOKING_TIME_SECONDS","int")
|
||||
minetest_hardcorebrix.load_minetest_settings_key("CHANCE_OF_RED_FIREBRICK_BREAKING_BY_PICKAXE_PERCENTS","int")
|
||||
minetest_hardcorebrix.load_minetest_settings_key("CHANCE_OF_WHITE_FIREBRICK_BREAKING_BY_PICKAXE_PERCENTS","int")
|
||||
minetest_hardcorebrix.load_minetest_settings_key("WET_RED_FIREBRICK_DRYING_ATTEMPTS_ABM_INTERVAL_SECONDS","int")
|
||||
minetest_hardcorebrix.load_minetest_settings_key("WET_RED_FIREBRICK_DRYING_CHANCE_SURROUNDING_LIGHT_FACTOR","int")
|
||||
minetest_hardcorebrix.load_minetest_settings_key("WET_WHITE_FIREBRICK_DRYING_ATTEMPTS_ABM_INTERVAL_SECONDS","int")
|
||||
minetest_hardcorebrix.load_minetest_settings_key("WET_WHITE_FIREBRICK_DRYING_CHANCE_SURROUNDING_LIGHT_FACTOR","int")
|
||||
minetest_hardcorebrix.load_minetest_settings_key("CHANCE_OF_WET_RED_FIREBRICK_TO_START_DRYING_PROCESS_PERCENTS","int")
|
||||
minetest_hardcorebrix.load_minetest_settings_key("CHANCE_OF_WET_RED_FIREBRICK_DRYING_IN_THE_TOTAL_DARK_PERCENTS","int")
|
||||
minetest_hardcorebrix.load_minetest_settings_key("CHANCE_OF_WET_WHITE_FIREBRICK_TO_START_DRYING_PROCESS_PERCENTS","int")
|
||||
minetest_hardcorebrix.load_minetest_settings_key("CHANCE_OF_WET_WHITE_FIREBRICK_DRYING_IN_THE_TOTAL_DARK_PERCENTS","int")
|
||||
else
|
||||
minetest_hardcorebrix.log("In-game minetest settings are disabled. Ignoring them.")
|
||||
end
|
||||
|
||||
-- Processing world-specific config. World-specific values are preferrable
|
||||
-- over both global config and in-game settings.
|
||||
if file_exists(minetest_hardcorebrix.worldconfig) then
|
||||
minetest_hardcorebrix.log("Loading world-specific config: "..minetest_hardcorebrix.worldconfig)
|
||||
dofile(minetest_hardcorebrix.worldconfig)
|
||||
else
|
||||
minetest_hardcorebrix.log("Creating world-specific config: "..minetest_hardcorebrix.worldconfig)
|
||||
local new_world_config_contents =
|
||||
"-- World-specific config. Values are taken from `mods/minetest_hardcorebrix/config.lua`:\n"..
|
||||
"-- Please uncomment lines of your need and set the desired value.\n"
|
||||
for line in string.gmatch(file_get_contents(minetest.get_modpath(minetest.get_current_modname()).."/config.lua"), "[^\r\n]+") do
|
||||
if string.sub(line,0,string.len(minetest.get_current_modname())+1) == minetest.get_current_modname().."." then
|
||||
new_world_config_contents = new_world_config_contents.."-- "..line.."\n"
|
||||
end
|
||||
end
|
||||
file_put_contents(minetest_hardcorebrix.worldconfig,new_world_config_contents)
|
||||
end
|
|
@ -0,0 +1,3 @@
|
|||
function minetest_hardcorebrix.log(message)
|
||||
print("minetest_hardcorebrix: "..message)
|
||||
end
|
20
init.lua
20
init.lua
|
@ -1,8 +1,14 @@
|
|||
-- HARDCORE BRIX minetest mod [Hardcore °Bx]
|
||||
-- @link https://github.com/yetanotherusernamebecausegithubisbugged/minetest_hardcorebrix
|
||||
local modpath = minetest.get_modpath(minetest.get_current_modname())
|
||||
minetest_hardcorebrix = {}
|
||||
dofile(modpath.."/config.lua")
|
||||
dofile(modpath.."/init.functions.lua")
|
||||
dofile(modpath.."/init.red_firebrick.lua")
|
||||
dofile(modpath.."/init.white_firebrick.lua")
|
||||
-- @link https://github.com/aa6/minetest_hardcorebrix
|
||||
dofile(minetest.get_modpath(minetest.get_current_modname()).."/lib.file_exists.lua")
|
||||
dofile(minetest.get_modpath(minetest.get_current_modname()).."/lib.file_get_contents.lua")
|
||||
dofile(minetest.get_modpath(minetest.get_current_modname()).."/lib.file_put_contents.lua")
|
||||
minetest_hardcorebrix =
|
||||
{
|
||||
worldconfig = minetest.get_worldpath().."/mod_minetest_hardcorebrix_config.lua",
|
||||
}
|
||||
dofile(minetest.get_modpath(minetest.get_current_modname()).."/init.log.lua")
|
||||
dofile(minetest.get_modpath(minetest.get_current_modname()).."/init.config.lua")
|
||||
dofile(minetest.get_modpath(minetest.get_current_modname()).."/init.functions.lua")
|
||||
dofile(minetest.get_modpath(minetest.get_current_modname()).."/init.red_firebrick.lua")
|
||||
dofile(minetest.get_modpath(minetest.get_current_modname()).."/init.white_firebrick.lua")
|
|
@ -0,0 +1,4 @@
|
|||
function file_exists(name)
|
||||
local fd = io.open(name,"r")
|
||||
if fd ~= nil then io.close(fd) return true else return false end
|
||||
end
|
|
@ -0,0 +1,6 @@
|
|||
function file_get_contents(file)
|
||||
local fp = io.open(file,"r")
|
||||
local data = fp:read("*all")
|
||||
fp:close()
|
||||
return data
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
function file_put_contents(file,data)
|
||||
local fp = io.open(file,"w")
|
||||
fp:write(data)
|
||||
fp:close()
|
||||
end
|
|
@ -0,0 +1,38 @@
|
|||
# If this options is disabled, no other settings option will have effect over default global config values. In contrary, world-specific config values will be still preferred over this in-game settings.
|
||||
minetest_hardcorebrix.ENABLE_INGAME_SETTINGS (ENABLE ALL THE MOD SETTINGS BELOW) bool true
|
||||
|
||||
# Red fired clay brick default cooking time in seconds.
|
||||
minetest_hardcorebrix.RED_FIRED_CLAY_BRICK_DEFAULT_COOKING_TIME_SECONDS (Red brick cooking time in seconds) int 60
|
||||
|
||||
# Wet red firebrick ability to dry in ABM interval seconds.
|
||||
minetest_hardcorebrix.WET_RED_FIREBRICK_DRYING_ATTEMPTS_ABM_INTERVAL_SECONDS (Wet red firebrick ABM interval in seconds) int 30
|
||||
|
||||
# Chance of wet red firebrick to dry when exposed to light coefficient.
|
||||
minetest_hardcorebrix.WET_RED_FIREBRICK_DRYING_CHANCE_SURROUNDING_LIGHT_FACTOR (Wet red firebrick drying by light coefficient) int 2
|
||||
|
||||
# Chance of red firebrick to be broken by a pickaxe in percents.
|
||||
minetest_hardcorebrix.CHANCE_OF_RED_FIREBRICK_BREAKING_BY_PICKAXE_PERCENTS (Red firebrick pickaxe dig chance) int 20
|
||||
|
||||
# Chance of wet red firebrick to start drying in percents.
|
||||
minetest_hardcorebrix.CHANCE_OF_WET_RED_FIREBRICK_TO_START_DRYING_PROCESS_PERCENTS (Chance of wet red firebrick drying in percents) int 80
|
||||
|
||||
# Chance of wet red firebrick to start drying in darkness in percents.
|
||||
minetest_hardcorebrix.CHANCE_OF_WET_RED_FIREBRICK_DRYING_IN_THE_TOTAL_DARK_PERCENTS (Chance of wet red firebrick drying in darkness in percents) int 10
|
||||
|
||||
# White fired clay brick default cooking time in seconds.
|
||||
minetest_hardcorebrix.WHITE_FIRED_CLAY_BRICK_DEFAULT_COOKING_TIME_SECONDS (White brick cooking time in seconds) int 60
|
||||
|
||||
# Wet white firebrick ability to dry in ABM interval seconds.
|
||||
minetest_hardcorebrix.WET_WHITE_FIREBRICK_DRYING_ATTEMPTS_ABM_INTERVAL_SECONDS (Wet white firebrick ABM interval in seconds) int 30
|
||||
|
||||
# Chance of wet white firebrick to dry when exposed to light coefficient.
|
||||
minetest_hardcorebrix.WET_WHITE_FIREBRICK_DRYING_CHANCE_SURROUNDING_LIGHT_FACTOR (Wet white firebrick drying by light coefficient) int 2
|
||||
|
||||
# Chance of white firebrick to be broken by a pickaxe in percents.
|
||||
minetest_hardcorebrix.CHANCE_OF_WHITE_FIREBRICK_BREAKING_BY_PICKAXE_PERCENTS (White firebrick pickaxe dig chance) int 20
|
||||
|
||||
# Chance of wet white firebrick to start drying in percents.
|
||||
minetest_hardcorebrix.CHANCE_OF_WET_WHITE_FIREBRICK_TO_START_DRYING_PROCESS_PERCENTS (Chance of wet white firebrick drying in percents) int 80
|
||||
|
||||
# Chance of wet white firebrick to start drying in darkness in percents.
|
||||
minetest_hardcorebrix.CHANCE_OF_WET_WHITE_FIREBRICK_DRYING_IN_THE_TOTAL_DARK_PERCENTS (Chance of wet white firebrick drying in darkness in percents) int 10
|
BIN
util/version.png
BIN
util/version.png
Binary file not shown.
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.6 KiB |
Loading…
Reference in New Issue