Seperated settings

Seperated crafting into basic_craft and advanced_craft.

  (for servers who just want basic to be craftable, but advanced could
still be prohibited from being crafted)

  > Also doesn't allow just advanced (since basic is needed to craft
advanced)
This commit is contained in:
Apollo 2022-01-25 21:17:22 -05:00
parent 1fafd2569f
commit 80edfbfad1
3 changed files with 26 additions and 20 deletions

View File

@ -17,7 +17,7 @@ With a basic glove just look at say some nodes (like a tree), then just rapidly
All you need to do to allow crafting is:
1. Add `climb_crafting = true` to your `minetest.conf` file
1. Add `climb_craft_basic = true` to your `minetest.conf` file (and if you want the advanced one too, `climb_craft_advanced = true`)
2. (Restart if running, else enjoy)
## Credits

View File

@ -77,23 +77,24 @@ minetest.register_tool("climb_glove:adv_glove", {
})
-- Crafting
local allow_crafts = minetest.settings.get_bool("climb_crafting") or false
if allow_crafts == true then
local gm = climb.game_mode()
local empty = ""
local iron = ""
local gold = ""
local diamond = ""
local glove = "climb_glove:basic_glove" -- Used in making a advanced glove
if gm == "MTG" then
iron = "default:steel_ingot"
gold = "default:gold_ingot"
diamond = "default:diamond"
elseif gm == "MCL" then
iron = "mcl_core:iron_ingot"
gold = "mcl_core:gold_ingot"
diamond = "mcl_core:diamond"
end
local basic_craft = minetest.settings.get_bool("climb_craft_basic") or false
local adv_craft = minetest.settings.get_bool("climb_craft_advanced") or false
local gm = climb.game_mode()
local empty = ""
local iron = ""
local gold = ""
local diamond = ""
local glove = "climb_glove:basic_glove" -- Used in making a advanced glove
if gm == "MTG" then
iron = "default:steel_ingot"
gold = "default:gold_ingot"
diamond = "default:diamond"
elseif gm == "MCL" then
iron = "mcl_core:iron_ingot"
gold = "mcl_core:gold_ingot"
diamond = "mcl_core:diamond"
end
if basic_craft then -- only allow if basic crafting is allowed
minetest.register_craft({
output = "climb_glove:basic_glove",
recipe = {
@ -102,6 +103,8 @@ if allow_crafts == true then
{gold, gold, empty}
}
})
end
if basic_craft and adv_craft then -- only allow if both basic crafting an advanced crafting
minetest.register_craft({
output = "climb_glove:adv_glove",
recipe = {

View File

@ -1,5 +1,8 @@
# https://github.com/minetest/minetest/blob/master/builtin/settingtypes.txt#L1
# Can anyone craft climbing gloves (also includes upgrading the basic to advanced)
climb_crafting (Climb Glove - Crafting) bool false
# Can anyone craft a basic climbing glove
climb_craft_basic (Climb Glove - Basic) bool false
# Can anyone craft a advanced climbing glove (requires basic to also be true)
climb_craft_advanced (Climb Glove - Advanced) bool false