diff --git a/api/cables.lua b/api/cables.lua index 0d3f877..1057342 100644 --- a/api/cables.lua +++ b/api/cables.lua @@ -3,12 +3,13 @@ local SIZE = logistica.settings.cable_size -- Main function to register a new cable of certain tier -- customNodeBox can specify any of the fixed/connect_DIR - values will be overwritten per-item basis -function logistica.register_cable(desc, name, customNodeBox) +function logistica.register_cable(desc, name, customNodeBox, customTiles, customInvImage) local lname = string.lower(name) local cable_name = "logistica:" .. lname local cable_group = logistica.TIER_ALL logistica.cables[cable_name] = name local cnb = customNodeBox or {} + local tiles = customTiles or { "logistica_" .. lname .. ".png" } local node_box = { type = "connected", @@ -23,9 +24,7 @@ function logistica.register_cable(desc, name, customNodeBox) local def = { description = desc, - tiles = { "logistica_" .. lname .. ".png" }, - inventory_image = "logistica_" .. lname .. "_inv.png", - wield_image = "logistica_" .. lname .. "_inv.png", + tiles = tiles, groups = { cracky = 3, choppy = 3, @@ -49,15 +48,23 @@ function logistica.register_cable(desc, name, customNodeBox) _mcl_blast_resistance = 10 } + if not customInvImage then + def.inventory_image = "logistica_" .. lname .. "_inv.png" + def.wield_image = "logistica_" .. lname .. "_inv.png" + elseif type(customInvImage) == "string" then + def.inventory_image = customInvImage + def.wield_image = customInvImage + end + minetest.register_node(cable_name, def) local def_broken = {} for k, v in pairs(def) do def_broken[k] = v end - def_broken.tiles = { "logistica_" .. lname .. ".png^logistica_broken.png" } + def_broken.tiles = logistica.table_map(tiles, function(s) return s.."^logistica_broken.png" end) def_broken.inventory_image = "logistica_" .. lname .. "_inv.png^logistica_broken.png" def_broken.groups = { cracky = 3, choppy = 3, oddly_breakable_by_hand = 2, pickaxey = 1, axey = 1, handy = 1, not_in_creative_inventory = 1 } def_broken.description = "Broken " .. desc - def_broken.node_box = { type = "fixed", fixed = { -0.5, -SIZE, -SIZE, 0.5, SIZE, SIZE } } + def_broken.node_box = { type = "fixed", fixed = cnb.fixed or { -0.5, -SIZE, -SIZE, 0.5, SIZE, SIZE } } def_broken.selection_box = def_broken.node_box def_broken.connects_to = nil def_broken.on_construct = nil diff --git a/item/craft_item_nodes.lua b/item/craft_item_nodes.lua index 38233c4..bc00336 100644 --- a/item/craft_item_nodes.lua +++ b/item/craft_item_nodes.lua @@ -3,12 +3,6 @@ local S = logistica.TRANSLATOR logistica.craftitem.nodes = {} local items = logistica.craftitem.nodes -local crystalGroups = { - oddly_breakable_by_hand = 1, cracky = 3, handy = 1, pickaxey = 1 -} - -local sounds = logistica.sound_mod.node_sound_glass_defaults() - items["logistica:silverin"] = { tiles = { "logistica_silverin_nodebox.png", @@ -28,8 +22,8 @@ items["logistica:silverin"] = { } }, use_texture_alpha = "blend", - groups = crystalGroups, - sounds = sounds, + groups = { oddly_breakable_by_hand = 1, cracky = 3, handy = 1, pickaxey = 1 }, + sounds = logistica.sound_mod.node_sound_glass_defaults(), description = S("Silverin Crystal"), inventory_image = "logistica_silverin.png", stack_max = logistica.stack_max, @@ -88,4 +82,4 @@ items["logistica:silverin_plate"] = { for name, def in pairs(items) do minetest.register_node(name, def) -end \ No newline at end of file +end diff --git a/registration/machines_api_reg.lua b/registration/machines_api_reg.lua index 3e092c8..e0bd654 100644 --- a/registration/machines_api_reg.lua +++ b/registration/machines_api_reg.lua @@ -26,13 +26,23 @@ logistica.register_autocrafter("Autocrafter", "autocrafter", { -------------------------------- -- regular -logistica.register_cable("Optic cable", "optic_cable") --- TODO: plate + cable = masked cable --- logistica.register_cable("Optic cable", "optic_wall", CABLE_SIZE, { --- fixed = { --- { -CABLE_SIZE, -CABLE_SIZE, -CABLE_SIZE, CABLE_SIZE, CABLE_SIZE, CABLE_SIZE } --- } --- }) +logistica.register_cable("Optic Cable", "optic_cable") + +-- full-block cable +logistica.register_cable("Embedded Optic Cable", "optic_cable_block", + { + fixed = { + { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 } + }, + connect_top = {}, connect_bottom = {}, + connect_front = {}, connect_back = {}, + connect_left = {}, connect_right = {}, + }, + { + "logistica_silverin_plate.png^logistica_cable_connection_overlay.png" + }, + -1 +) -- toggleable logistica.register_cable_toggleable("Toggleable Cable", "optic_cable_toggleable", diff --git a/registration/misc.lua b/registration/misc.lua new file mode 100644 index 0000000..ec29bab --- /dev/null +++ b/registration/misc.lua @@ -0,0 +1,14 @@ +-- mostly decorative things that don't fit anywhere else +local S = logistica.TRANSLATOR +local function L(s) return "logistica:"..s end + +minetest.register_node(L("silverin_block"), { + drawtype = "normal", + tiles = {"logistica_silverin_plate.png"}, + paramtype2 = "facedir", + groups = { cracky = 2, pickaxey = 2 }, + sounds = logistica.node_sound_metallic(), + stack_max = logistica.stack_max, + _mcl_hardness = 1.5, + _mcl_blast_resistance = 40 +}) diff --git a/registration/node_recipes.lua b/registration/node_recipes.lua index cc053b9..efd942c 100644 --- a/registration/node_recipes.lua +++ b/registration/node_recipes.lua @@ -175,3 +175,19 @@ minetest.register_craft({ {L("silverin_plate"), itemstrings.clay, L("silverin_plate")}, } }) + +minetest.register_craft({ + output = L("optic_cable_block"), + recipe = { + {L("silverin_plate")}, + {L("optic_cable")}, + {L("silverin_plate")}, + } +}) + +minetest.register_craft({ + output = L("silverin_block"), + recipe = { + {L("silverin_plate"), L("silverin_plate"), L("silverin_plate")} + } +}) diff --git a/registration/registration.lua b/registration/registration.lua index 73ae6ef..55f1667 100644 --- a/registration/registration.lua +++ b/registration/registration.lua @@ -4,5 +4,6 @@ dofile(path.."/node_recipes.lua") dofile(path.."/item_recipes.lua") dofile(path.."/machines_api_reg.lua") dofile(path.."/lava_furnace_recipes.lua") +dofile(path.."/misc.lua") dofile(path.."/compat_unified_inv.lua") dofile(path.."/compat_i3.lua") diff --git a/textures/logistica_cable_connection_overlay.png b/textures/logistica_cable_connection_overlay.png new file mode 100644 index 0000000..0ab499d Binary files /dev/null and b/textures/logistica_cable_connection_overlay.png differ