Compare commits

...

5 Commits

Author SHA1 Message Date
aa6 09adf1dc83 Fix: minetest.settings:get() doesn't return actual value when unset. 2022-02-22 22:24:24 +03:00
aa6 d149752f86 Fix: Screenshot added. 2022-02-15 09:46:46 +03:00
aa6 f91779479a Feature: In-game settings menu compatibility. 2022-02-15 00:25:41 +03:00
aa6 e75da3eb98 Fix: Block names typo. 2022-02-14 21:35:45 +03:00
aa6 febf2f0a5f Fix: Minor version increment. 2022-02-14 21:34:03 +03:00
14 changed files with 137 additions and 14 deletions

View File

@ -1 +1 @@
0.2.10
0.4.2

View File

@ -1,14 +1,19 @@
-- World-specific configs are available. To create world-specific config,
-- copy this file to `worlds/<worldname>/mod_minetest_hardcorebrix_config.lua`
-- Common config values.
minetest_hardcorebrix.ENABLE_INGAME_SETTINGS = true
-- Red firebrick configuration
minetest_hardcorebrix.RED_FIRED_CLAY_BRICK_DEFAULT_COOKING_TIME_SECONDS = 60
minetest_hardcorebrix.WET_RED_FIREBRICK_DRYING_ATTEMPTS_ABM_INTERVAL_SECONDS = 30
minetest_hardcorebrix.WET_RED_FIREBRICK_DRYING_CHANCE_SURROUNDING_LIGHT_FACTOR = 2
minetest_hardcorebrix.CHANCE_OF_RED_FIREBRICK_BREAKING_BY_PICKAXE_PERCENTS = 20
minetest_hardcorebrix.CHANCE_OF_RED_FIREBRICK_BREAKING_BY_PICKAXE_PERCENTS = 9
minetest_hardcorebrix.CHANCE_OF_WHITE_FIREBRICK_BREAKING_BY_PICKAXE_PERCENTS = 13
minetest_hardcorebrix.CHANCE_OF_WET_RED_FIREBRICK_TO_START_DRYING_PROCESS_PERCENTS = 80
minetest_hardcorebrix.CHANCE_OF_WET_RED_FIREBRICK_DRYING_IN_THE_TOTAL_DARK_PERCENTS = 10
-- White firebrick configuration
minetest_hardcorebrix.WHITE_FIRED_CLAY_BRICK_DEFAULT_COOKING_TIME_SECONDS = minetest_hardcorebrix.RED_FIRED_CLAY_BRICK_DEFAULT_COOKING_TIME_SECONDS
minetest_hardcorebrix.WET_WHITE_FIREBRICK_DRYING_ATTEMPTS_ABM_INTERVAL_SECONDS = minetest_hardcorebrix.WET_RED_FIREBRICK_DRYING_ATTEMPTS_ABM_INTERVAL_SECONDS
minetest_hardcorebrix.WET_WHITE_FIREBRICK_DRYING_CHANCE_SURROUNDING_LIGHT_FACTOR = minetest_hardcorebrix.WET_RED_FIREBRICK_DRYING_CHANCE_SURROUNDING_LIGHT_FACTOR
minetest_hardcorebrix.CHANCE_OF_WHITE_FIREBRICK_BREAKING_BY_PICKAXE_PERCENTS = minetest_hardcorebrix.CHANCE_OF_RED_FIREBRICK_BREAKING_BY_PICKAXE_PERCENTS
minetest_hardcorebrix.CHANCE_OF_WET_WHITE_FIREBRICK_TO_START_DRYING_PROCESS_PERCENTS = minetest_hardcorebrix.CHANCE_OF_WET_RED_FIREBRICK_TO_START_DRYING_PROCESS_PERCENTS
minetest_hardcorebrix.CHANCE_OF_WET_WHITE_FIREBRICK_DRYING_IN_THE_TOTAL_DARK_PERCENTS = minetest_hardcorebrix.CHANCE_OF_WET_RED_FIREBRICK_DRYING_IN_THE_TOTAL_DARK_PERCENTS

1
description.txt Normal file
View File

@ -0,0 +1 @@
Adds durable building materials that won't break on a first dig.

54
init.config.lua Normal file
View File

@ -0,0 +1,54 @@
-- 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.
-- Warning: minetest.settings:get() and minetest.settings:get_bool()
-- return `nil` value when not set, instead of actual default value.
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

3
init.log.lua Normal file
View File

@ -0,0 +1,3 @@
function minetest_hardcorebrix.log(message)
print("minetest_hardcorebrix: "..dump(message))
end

View File

@ -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")

View File

@ -43,7 +43,7 @@ function minetest_hardcorebrix.on_white_firebrick_node_dig(pos,node,digger)
end
------------------------------------------------------------------------
-- Looks for red firebrick nodes around pos and exclude from numbers_left
-- Looks for firebrick nodes around pos and exclude from numbers_left
-- these which already present nearly. This is used to avoid tile repeating.
------------------------------------------------------------------------
function minetest_hardcorebrix.analyze_surrounding_white_firebricks_and_return_best_nodebox_number(pos)
@ -250,7 +250,7 @@ for index,nodeboxBox in pairs(nodeboxes) do
minetest.register_node(
"minetest_hardcorebrix:node_white_firebrick_dry_damaged_3_nodebox"..index,
{
description = "Red Firebrick Block (Damaged 3 times)",
description = "White Firebrick Block (Damaged 3 times)",
drop = "",
tiles = { "minetest_hardcorebrix_node_white_firebrick_dry_damaged_2.png" },
groups = { cracky = 1, stone = 1 },
@ -298,7 +298,7 @@ for index,nodeboxBox in pairs(nodeboxes) do
minetest.register_node(
"minetest_hardcorebrix:node_white_firebrick_dry_damaged_4_nodebox"..index,
{
description = "Red Firebrick Block (Damaged 4 times)",
description = "White Firebrick Block (Damaged 4 times)",
drop = "",
tiles = { "minetest_hardcorebrix_node_white_firebrick_dry_damaged_2.png" },
groups = { cracky = 1, stone = 1 },
@ -346,7 +346,7 @@ for index,nodeboxBox in pairs(nodeboxes) do
minetest.register_node(
"minetest_hardcorebrix:node_white_firebrick_dry_damaged_5_nodebox"..index,
{
description = "Red Firebrick Block (Damaged 5 times)",
description = "White Firebrick Block (Damaged 5 times)",
drop = "",
tiles = { "minetest_hardcorebrix_node_white_firebrick_dry_damaged_2.png" },
groups = { cracky = 1, stone = 1 },

4
lib.file_exists.lua Normal file
View File

@ -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

View File

@ -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

View File

@ -0,0 +1,5 @@
function file_put_contents(file,data)
local fp = io.open(file,"w")
fp:write(data)
fp:close()
end

1
mod.conf Normal file
View File

@ -0,0 +1 @@
name = minetest_hardcorebrix

BIN
screenshot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

38
settingtypes.txt Normal file
View File

@ -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 30
# 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 30
# 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 9
# 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 13
# 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
# 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 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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB