From eebd5c031ce46eba91dc25675e2bc2e2bc7670a2 Mon Sep 17 00:00:00 2001 From: AliasAlreadyTaken Date: Sun, 27 Jun 2021 01:51:29 +0200 Subject: [PATCH 1/5] Enable or disable crafting recipes for coins --- config.lua | 2 ++ craftitems.lua | 44 ++++++++++++++++++++++++++++---------------- settingtypes.txt | 3 +++ 3 files changed, 33 insertions(+), 16 deletions(-) create mode 100644 settingtypes.txt diff --git a/config.lua b/config.lua index b980fc3..be8e507 100644 --- a/config.lua +++ b/config.lua @@ -27,3 +27,5 @@ end -- Show Map Tools stuff in creative inventory (1 or 0): setting("integer", "hide_from_creative_inventory", 1) +-- Enable crafting recipes for coins (true or false) +setting("bool", "enable_coin_crafting", false) \ No newline at end of file diff --git a/craftitems.lua b/craftitems.lua index 3bc72bb..5fe0673 100644 --- a/craftitems.lua +++ b/craftitems.lua @@ -16,11 +16,15 @@ minetest.register_craftitem("maptools:copper_coin", { stack_max = 10000, }) -minetest.register_craft({ - output = "maptools:copper_coin 10", - type = "shapeless", - recipe = { "default:copper_ingot", "default:copper_ingot" } -}) +if maptools.config and maptools.config.enable_coin_crafting then + + minetest.register_craft({ + output = "maptools:copper_coin 10", + type = "shapeless", + recipe = { "default:copper_ingot", "default:copper_ingot" } + }) + +end minetest.register_craftitem("maptools:silver_coin", { description = S("Silver Coin"), @@ -29,12 +33,16 @@ minetest.register_craftitem("maptools:silver_coin", { stack_max = 10000, }) -if minetest.get_modpath("moreores") then - minetest.register_craft({ - output = "maptools:silver_coin 10", - type = "shapeless", - recipe = { "moreores:silver_ingot", "moreores:silver_ingot" } - }) +if maptools.config and maptools.config.enable_coin_crafting then + + if minetest.get_modpath("moreores") then + minetest.register_craft({ + output = "maptools:silver_coin 10", + type = "shapeless", + recipe = { "moreores:silver_ingot", "moreores:silver_ingot" } + }) + end + end minetest.register_craftitem("maptools:gold_coin", { @@ -44,11 +52,15 @@ minetest.register_craftitem("maptools:gold_coin", { stack_max = 10000, }) -minetest.register_craft({ - output = "maptools:gold_coin 10", - type = "shapeless", - recipe = { "default:gold_ingot", "default:gold_ingot" } -}) +if maptools.config and maptools.config.enable_coin_crafting then + + minetest.register_craft({ + output = "maptools:gold_coin 10", + type = "shapeless", + recipe = { "default:gold_ingot", "default:gold_ingot" } + }) + +end minetest.register_craftitem("maptools:infinitefuel", { description = S("Infinite Fuel"), diff --git a/settingtypes.txt b/settingtypes.txt new file mode 100644 index 0000000..2bf6b9f --- /dev/null +++ b/settingtypes.txt @@ -0,0 +1,3 @@ +# If true enables coin crafting recipes. If false or omitted, disables coin crafting recipes +# Takes effect only during loadtime. +maptools.enable_coin_crafting (Enable crafting recipes for coins) bool false \ No newline at end of file From 0355401aafdd24f7402ace8ddabb84d0c3ea3814 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Tue, 29 Jun 2021 00:24:12 +0200 Subject: [PATCH 2/5] Apply suggestions from code review --- settingtypes.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/settingtypes.txt b/settingtypes.txt index 2bf6b9f..b389e4f 100644 --- a/settingtypes.txt +++ b/settingtypes.txt @@ -1,3 +1,3 @@ -# If true enables coin crafting recipes. If false or omitted, disables coin crafting recipes +# If `true`, enables coin crafting recipes. If `false`, disables coin crafting recipes. # Takes effect only during loadtime. -maptools.enable_coin_crafting (Enable crafting recipes for coins) bool false \ No newline at end of file +maptools.enable_coin_crafting (Enable crafting recipes for coins) bool false From 53428c5fdbcbbe88a302162f02e42b5f56154478 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Tue, 29 Jun 2021 00:25:38 +0200 Subject: [PATCH 3/5] Apply suggestions from code review --- config.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.lua b/config.lua index be8e507..b5b27cb 100644 --- a/config.lua +++ b/config.lua @@ -28,4 +28,4 @@ end -- Show Map Tools stuff in creative inventory (1 or 0): setting("integer", "hide_from_creative_inventory", 1) -- Enable crafting recipes for coins (true or false) -setting("bool", "enable_coin_crafting", false) \ No newline at end of file +setting("bool", "enable_coin_crafting", false) From 2b5b2387ef0de2502f04b7ecbe0304ad1cdd7353 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Tue, 29 Jun 2021 00:28:01 +0200 Subject: [PATCH 4/5] Apply suggestions from code review --- craftitems.lua | 6 ------ 1 file changed, 6 deletions(-) diff --git a/craftitems.lua b/craftitems.lua index 5fe0673..ae9e4cd 100644 --- a/craftitems.lua +++ b/craftitems.lua @@ -17,13 +17,11 @@ minetest.register_craftitem("maptools:copper_coin", { }) if maptools.config and maptools.config.enable_coin_crafting then - minetest.register_craft({ output = "maptools:copper_coin 10", type = "shapeless", recipe = { "default:copper_ingot", "default:copper_ingot" } }) - end minetest.register_craftitem("maptools:silver_coin", { @@ -34,7 +32,6 @@ minetest.register_craftitem("maptools:silver_coin", { }) if maptools.config and maptools.config.enable_coin_crafting then - if minetest.get_modpath("moreores") then minetest.register_craft({ output = "maptools:silver_coin 10", @@ -42,7 +39,6 @@ if maptools.config and maptools.config.enable_coin_crafting then recipe = { "moreores:silver_ingot", "moreores:silver_ingot" } }) end - end minetest.register_craftitem("maptools:gold_coin", { @@ -53,13 +49,11 @@ minetest.register_craftitem("maptools:gold_coin", { }) if maptools.config and maptools.config.enable_coin_crafting then - minetest.register_craft({ output = "maptools:gold_coin 10", type = "shapeless", recipe = { "default:gold_ingot", "default:gold_ingot" } }) - end minetest.register_craftitem("maptools:infinitefuel", { From 410aa018cd1d8da1e2f6ced81cd9706c5d7566b6 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Tue, 29 Jun 2021 00:29:27 +0200 Subject: [PATCH 5/5] Apply suggestions from code review --- settingtypes.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/settingtypes.txt b/settingtypes.txt index b389e4f..d820301 100644 --- a/settingtypes.txt +++ b/settingtypes.txt @@ -1,3 +1,3 @@ # If `true`, enables coin crafting recipes. If `false`, disables coin crafting recipes. -# Takes effect only during loadtime. +# Takes effect only at load-time; runtime changes to this setting are ignored. maptools.enable_coin_crafting (Enable crafting recipes for coins) bool false