Add support to register grinder recipes in Crafting Guide Plus

cg_plus mod support (6511eb8261)
This commit is contained in:
Skaapdev 2024-04-23 16:13:04 +02:00 committed by GitHub
parent f9431c5e09
commit c6ad781d5d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 23 additions and 1 deletions

View File

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

View File

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

View File

@ -5,6 +5,7 @@ optional_depends = """
beerchat,
boneworld,
bucket,
cg_plus,
baldcypress,
bamboo,