From c6ad781d5d77162e085109da22cc1e6d7125e4f3 Mon Sep 17 00:00:00 2001 From: Skaapdev <52762341+Skaapdev@users.noreply.github.com> Date: Tue, 23 Apr 2024 16:13:04 +0200 Subject: [PATCH] Add support to register grinder recipes in Crafting Guide Plus cg_plus mod support (https://github.com/random-geek/cg_plus/commit/6511eb8261cb1c292228e76c0906b642e26f2a16) --- .luacheckrc | 2 +- grinder.lua | 21 +++++++++++++++++++++ mod.conf | 1 + 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/.luacheckrc b/.luacheckrc index dd868e4..564579b 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -15,7 +15,7 @@ read_globals = { } files["ball.lua"] = {globals = {"boneworld.killxp"}} -files["grinder.lua"] = {read_globals = {"i3"}} +files["grinder.lua"] = {read_globals = {"cg", "i3"}} files["keypad.lua"] = {read_globals = {"signs_lib"}} files["machines_configuration.lua"] = {max_line_length = 190} files["mark.lua"] = {globals = {"machines"}} diff --git a/grinder.lua b/grinder.lua index 4800ab6..0c3cd8d 100644 --- a/grinder.lua +++ b/grinder.lua @@ -8,6 +8,7 @@ local machines_minstep = basic_machines.properties.machines_minstep local twodigits_float = basic_machines.twodigits_float local use_unified_inventory = minetest.global_exists("unified_inventory") local use_i3 = minetest.global_exists("i3") +local use_cg_plus = minetest.global_exists("cg") -- Skaapdev add support for cg_plus mod local use_default = basic_machines.use_default -- grinder recipes: -- ["in"] = {fuel cost, "out", quantity of material produced, quantity of material required for processing} @@ -26,6 +27,18 @@ elseif use_i3 then description = F(S("Grinding")), icon = "basic_machines_grinder.png" }) +elseif use_cg_plus then -- Skaapdev add support for cg_plus mod + cg.register_crafting_method("basic_machines_grinding", { + description = S("Grinding"), + arrow_icon = "basic_machines_grinder.png", + uses_crafting_grid = false, + get_grid_size = function() + return {x = 1, y = 1} + end, + get_infotext = function(craft) + return minetest.colorize("#FFFF00", S("Power: @1", craft.power)) + end + }) -- skaapdev end end local function register_recipe(name, def) @@ -58,6 +71,14 @@ local function register_recipe(name, def) result = def[2] .. " " .. def[3], items = {name .. " " .. def[4]} }) + elseif use_cg_plus then -- Skaapdev add support for cg_plus mod + cg.register_craft({ + method = "basic_machines_grinding", + width = 0, + items = {name .. " " .. def[4]}, + output = def[2] .. " " .. def[3], + power = def[1] + }) -- skaapdev end end end end diff --git a/mod.conf b/mod.conf index 8f07673..5e866f5 100644 --- a/mod.conf +++ b/mod.conf @@ -5,6 +5,7 @@ optional_depends = """ beerchat, boneworld, bucket, + cg_plus, baldcypress, bamboo,