overhaul crafting recipies

This commit is contained in:
theFox6 2023-11-04 18:00:17 +01:00
parent 8e86685f5b
commit 8955264b6b
No known key found for this signature in database
GPG Key ID: 810803FF29A86CCC
19 changed files with 144 additions and 43 deletions

@ -26,7 +26,7 @@ function microexpansion.register_oredef(ore, defs)
end end
for _,d in ipairs(defs) do for _,d in ipairs(defs) do
d.ore = "microexpansion:"..ore d.ore = ore
minetest.register_ore(d) minetest.register_ore(d)
end end
end end

@ -1,2 +1,3 @@
default default
pipeworks? pipeworks?
basic_materials?

@ -11,9 +11,12 @@ microexpansion.gui_bg = "bgcolor[#080808BB;true]background[5,5;1,1;gui_formbg.pn
microexpansion.gui_slots = "listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]" microexpansion.gui_slots = "listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]"
microexpansion.settings = { microexpansion.settings = {
huge_stacks = minetest.settings:get_bool("microexpansion_huge_stacks") huge_stacks = minetest.settings:get_bool("microexpansion_huge_stacks"),
simple_craft = minetest.settings:get_bool("microexpansion_simple_craft")
} }
microexpansion.uinv_category_enabled = minetest.global_exists("unified_inventory") and unified_inventory.add_category_item and true or false
-- logger -- logger
function microexpansion.log(content, log_type) function microexpansion.log(content, log_type)
assert(content, "microexpansion.log: missing content") assert(content, "microexpansion.log: missing content")

@ -1,4 +1,4 @@
name = microexpansion name = microexpansion
description = A storage managing solution to get an overview over all your items. description = A storage managing solution to get an overview over all your items.
depends = default depends = default
optional_depends = pipeworks optional_depends = pipeworks,basic_materials

@ -1,6 +1,6 @@
shared = true
network = true network = true
power = false power = false
storage = true storage = true
ores = true ores = true
item_transfer = true item_transfer = true
crafting = true

@ -0,0 +1,37 @@
---
-- craftitems that offer alternative craft recipes
local me = microexpansion
--TODO: build specialized integrated circuits / chips out of the ic and other stuff that are required to build the devices / machines instead of the control unit being an alternative
---
-- [Microexpansion Control Unit]
-- a different logic chip that uses gold, quartz and wood
-- for use instead of basic_materials:ic that requires sand, coal and copper
me.register_item("logic_chip", {
description = "Control Unit",
recipe = {
{ 2,
{
{"basic_materials:gold_wire"},
{"basic_materials:silicon"},
{"basic_materials:plastic_sheet"}
},
},
{ 2,
{
{"basic_materials:gold_wire"},
{"microexpansion:quartz_crystal"},
{"basic_materials:plastic_sheet"}
},
},
{ 2,
{
{"microexpansion:gold_wire"},
{"microexpansion:quartz_crystal"},
{"group:wood"}
},
},
},
})

@ -0,0 +1,8 @@
local module_path = microexpansion.get_module_path("crafting")
-- basic_materials replacements
dofile(module_path.."/materials.lua")
-- shared items used for various machine recipes
dofile(module_path.."/shared.lua")
-- items that allow for alternative recipes
dofile(module_path.."/alternatives.lua")

@ -0,0 +1,19 @@
---
-- Craft materials, that are normally registered by basic_materials
local me = microexpansion
local substitute_basic_materials = microexpansion.settings.simple_craft == true or not minetest.get_modpath("basic_materials")
-- [register item] Gold Wire
me.register_item("gold_wire", {
description = "Gold Wire",
groups = { wire = 1 },
recipe = substitute_basic_materials and {
{ 2, {
{"default:gold_ingot", "default:stick"},
{"default:stick", ""}
},
},
} or nil,
})

@ -1,9 +1,8 @@
-- shared/init.lua -- crafting/shared.lua
local me = microexpansion local me = microexpansion
-- This mostly contains items that are used by multiple modules and -- custom items that are used by multiple devices
-- don't really fit with anything else.
-- [register item] Steel Infused Obsidian Ingot -- [register item] Steel Infused Obsidian Ingot
me.register_item("steel_infused_obsidian_ingot", { me.register_item("steel_infused_obsidian_ingot", {
@ -28,28 +27,3 @@ me.register_item("machine_casing", {
}, },
}, },
}) })
-- [register item] Gold Wire
me.register_item("gold_wire", {
description = "Gold Wire",
recipe = {
{ 2, {
{"default:gold_ingot", "default:stick"},
{"default:stick", ""}
},
},
},
})
-- [register item] Control Unit
me.register_item("logic_chip", {
description = "Control Unit",
recipe = {
{ 2, {
{"microexpansion:gold_wire"},
{"microexpansion:quartz_crystal"},
{"group:wood"}
},
},
},
})

@ -23,6 +23,7 @@ local function exporter_timer(pos, elapsed)
end end
local max_count = math.pow(2, upgrades.bulk or 0) local max_count = math.pow(2, upgrades.bulk or 0)
microexpansion.move_inv({inv=net:get_inventory(),name="main",huge=true}, {inv=inv,name=list}, max_count, export_filter) microexpansion.move_inv({inv=net:get_inventory(),name="main",huge=true}, {inv=inv,name=list}, max_count, export_filter)
--TODO: perhaps call allow_insert and on_insert callbacks
end end
return true return true
end end
@ -50,6 +51,12 @@ item_transfer.register_io_device("exporter", {
}, },
connect_sides = { "left" }, connect_sides = { "left" },
recipe = { recipe = {
{ 1, {
{"", "basic_materials:ic", "default:steel_ingot" },
{"", "microexpansion:cable", "group:shovel" },
{"", "", "default:steel_ingot" },
},
},
{ 1, { { 1, {
{"", "microexpansion:logic_chip", "default:steel_ingot" }, {"", "microexpansion:logic_chip", "default:steel_ingot" },
{"", "microexpansion:cable", "group:shovel" }, {"", "microexpansion:cable", "group:shovel" },
@ -81,4 +88,6 @@ item_transfer.register_io_device("exporter", {
end end
}) })
if me.uinv_category_enabled then
unified_inventory.add_category_item("storage", "microexpansion:exporter")
end

@ -58,6 +58,12 @@ item_transfer.register_io_device("importer", {
}, },
connect_sides = { "left" }, connect_sides = { "left" },
recipe = { recipe = {
{ 1, {
{"", "basic_materials:ic", "default:steel_ingot" },
{"", "microexpansion:cable", "group:hoe" },
{"", "", "default:steel_ingot" },
},
},
{ 1, { { 1, {
{"", "microexpansion:logic_chip", "default:steel_ingot" }, {"", "microexpansion:logic_chip", "default:steel_ingot" },
{"", "microexpansion:cable", "group:hoe" }, {"", "microexpansion:cable", "group:hoe" },
@ -89,4 +95,6 @@ item_transfer.register_io_device("importer", {
end end
}) })
if me.uinv_category_enabled then
unified_inventory.add_category_item("storage", "microexpansion:importer")
end

@ -22,6 +22,11 @@ me.register_item("upgrade_bulk", {
description = "Bulk Upgrade", description = "Bulk Upgrade",
usedfor = "upgrades components to process more at the same time", usedfor = "upgrades components to process more at the same time",
recipe = { recipe = {
{ 1, {
{"basic_materials:gold_wire"},
{"microexpansion:upgrade_base"}
},
},
{ 1, { { 1, {
{"microexpansion:gold_wire"}, {"microexpansion:gold_wire"},
{"microexpansion:upgrade_base"} {"microexpansion:upgrade_base"}
@ -48,6 +53,11 @@ me.register_item("upgrade_control", {
description = "Control Upgrade", description = "Control Upgrade",
usedfor = "allows more fine tuned control over components", usedfor = "allows more fine tuned control over components",
recipe = { recipe = {
{ 1, {
{"basic_materials:ic"},
{"microexpansion:upgrade_base"}
},
},
{ 1, { { 1, {
{"microexpansion:logic_chip"}, {"microexpansion:logic_chip"},
{"microexpansion:upgrade_base"} {"microexpansion:upgrade_base"}

@ -251,3 +251,9 @@ me.register_machine("cable", {
type = "conductor", type = "conductor",
}, },
}) })
if me.uinv_category_enabled then
unified_inventory.add_category_item("storage", "microexpansion:ctrl")
unified_inventory.add_category_item("storage", "microexpansion:cable")
end

@ -35,13 +35,13 @@ me.register_node("quartz", {
type = "ore", type = "ore",
groups = { cracky=3, stone=1 }, groups = { cracky=3, stone=1 },
drop = "microexpansion:quartz_crystal", drop = "microexpansion:quartz_crystal",
oredef = { oredef = {{
ore_type = "blob", ore_type = "scatter",
wherein = "default:stone", wherein = "default:stone",
clust_scarcity = 4*4*4, clust_scarcity = 10*10*10,
clust_num_ores = 4, clust_num_ores = 6,
clust_size = 3, clust_size = 5,
y_min = -3000, y_min = -31000,
y_max = -50, y_max = -5,
} }}
}) })

@ -2,6 +2,8 @@
local BASENAME = "microexpansion" local BASENAME = "microexpansion"
--FIXME: either consolidate or forbid crafting with filled cells
-- [function] register cell -- [function] register cell
function microexpansion.register_cell(itemstring, def) function microexpansion.register_cell(itemstring, def)
if not def.inventory_image then if not def.inventory_image then
@ -26,6 +28,10 @@ function microexpansion.register_cell(itemstring, def)
if def.recipe then if def.recipe then
microexpansion.register_recipe(BASENAME..":"..itemstring, def.recipe) microexpansion.register_recipe(BASENAME..":"..itemstring, def.recipe)
end end
if microexpansion.uinv_category_enabled then
unified_inventory.add_category_item("storage", BASENAME..":"..itemstring)
end
end end
-- [function] Get cell size -- [function] Get cell size
@ -81,4 +87,4 @@ function microexpansion.move_inv(inv1, inv2, max)
end end
end end
end end
]] ]]

@ -405,3 +405,7 @@ microexpansion.register_node("drive", {
me.send_event(pos,"items",{net=network}) me.send_event(pos,"items",{net=network})
end, end,
}) })
if me.uinv_category_enabled then
unified_inventory.add_category_item("storage", "microexpansion:drive")
end

@ -305,3 +305,7 @@ microexpansion.register_node("term", {
end end
end, end,
}) })
if me.uinv_category_enabled then
unified_inventory.add_category_item("storage", "microexpansion:term")
end

@ -5,6 +5,15 @@
local me = microexpansion local me = microexpansion
local power = me.power local power = me.power
if me.uinv_category_enabled and unified_inventory.registered_categories then
if not unified_inventory.registered_categories["storage"] then
unified_inventory.register_category("storage", {
symbol = "default:chest",
label = "Storage"
})
end
end
-- [function] Register machine -- [function] Register machine
function me.register_machine(itemstring, def) function me.register_machine(itemstring, def)
-- Set after_place_node -- Set after_place_node

@ -1,2 +1,5 @@
#Stack items in networks higher than their max size. #Stack items in networks higher than their max size.
microexpansion_huge_stacks (huge stacks) bool true microexpansion_huge_stacks (huge stacks) bool true
#Enable the "simple" craft recipes that do not require basic_materials even if basic_materials is present.
microexpansion_simple_craft (simple craft recipes) bool false