diff --git a/api.lua b/api.lua index d4b466b..b6cc223 100644 --- a/api.lua +++ b/api.lua @@ -203,21 +203,21 @@ end modComputing.getTextNowDate = function() local totalDays = core.get_day_count() - local nowMount = (math.floor(totalDays/28)%4)+1 - local txtMounts3S = { + local nowMonth = (math.floor(totalDays/28)%4)+1 + local txtMonths3S = { modComputing.translate("SPR"), modComputing.translate("SUM"), modComputing.translate("AUT"), modComputing.translate("WIN"), } --SPRING, SUMMER, AUTUMN, WINTER local nowDay = math.floor(totalDays%28)+1 - --local nowDate = ("%04d-%3s-%02d"):format((nowYear+1), txtMounts3S[nowMount], nowDay) + --local nowDate = ("%04d-%3s-%02d"):format((nowYear+1), txtMonths3S[nowMonth], nowDay) local nowDate = modComputing.translate( "@1-@2", - ("%3s"):format(txtMounts3S[nowMount]), + ("%3s"):format(txtMonths3S[nowMonth]), ("%02d"):format(nowDay) ) - --:format((nowYear+1), txtMounts3S[nowMount], nowDay) + --:format((nowYear+1), txtMonths3S[nowMonth], nowDay) return nowDate end diff --git a/item_smartphone.lua b/item_smartphone.lua index d60009f..bfd301b 100644 --- a/item_smartphone.lua +++ b/item_smartphone.lua @@ -138,25 +138,37 @@ core.register_craftitem("computing:smartphone", { end, }) +modComputing.is_allow_smartphone_recipe = function(player) + if type(modComputing.strSmartphoneRecipe)~="boolean" then + modComputing.strSmartphoneRecipe = core.settings:get(modComputing.modname..".smartphone_recipe") + modComputing.strSmartphoneRecipe = type(modComputing.strSmartphoneRecipe)~="string" or (type(modComputing.strSmartphoneRecipe)=="string" and modComputing.strSmartphoneRecipe:lower() ~= "false") + --core.settings:set_bool(modComputing.modname..".smartphone_recipe", modComputing.strSmartphoneRecipe) + --core.settings:write() + end + return modComputing.strSmartphoneRecipe +end + --[[ ]] -if not minetest.get_modpath("components") then - core.register_craft({ - output = 'computing:smartphone', - recipe = { - {"default:obsidian_glass" ,"default:obsidian_glass" ,"default:book"}, - {"default:obsidian_glass" ,"default:obsidian_glass" ,"default:mese_crystal"}, - {"default:obsidian_glass" ,"default:obsidian_glass" ,"keys:skeleton_key"}, - } - }) -else - core.register_craft({ - output = 'computing:smartphone', - recipe = { - {"default:obsidian_glass" ,"default:obsidian_glass" ,"components:speaker"}, - {"default:obsidian_glass" ,"components:touch_screen" ,"components:computer"}, - {"default:obsidian_glass" ,"default:obsidian_glass" ,"components:power_cell"}, - } - }) +if modComputing.is_allow_smartphone_recipe() then + if not minetest.get_modpath("components") then + core.register_craft({ + output = 'computing:smartphone', + recipe = { + {"default:obsidian_glass" ,"default:obsidian_glass" ,"default:book"}, + {"default:obsidian_glass" ,"default:obsidian_glass" ,"default:mese_crystal"}, + {"default:obsidian_glass" ,"default:obsidian_glass" ,"keys:skeleton_key"}, + } + }) + else + core.register_craft({ + output = 'computing:smartphone', + recipe = { + {"default:obsidian_glass" ,"default:obsidian_glass" ,"components:speaker"}, + {"default:obsidian_glass" ,"components:touch_screen" ,"components:computer"}, + {"default:obsidian_glass" ,"default:obsidian_glass" ,"components:power_cell"}, + } + }) + end end --[[ ]] diff --git a/settingtypes.txt b/settingtypes.txt index c45f915..a42d31d 100644 --- a/settingtypes.txt +++ b/settingtypes.txt @@ -1,6 +1,14 @@ # COMPUTING SETTINGS # COMPUTING DEBUG: -# Allows you to print the debug information of this mod on the screen. +# Allows you to print the debug information +# of this mod on the screen. Feature used +# only by developers. # Default: false computing.debug (Show Computing Debug) bool false + +# SMARTPHONE RECIPE: +# Allows the smartphone to be crafted via +# recipe by normal players. +# Default: true +computing.smartphone_recipe (Smatphone Recipe) bool true