diff --git a/ROADMAP.md b/ROADMAP.md index 4687d1e..0b1faac 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -7,9 +7,10 @@ High Priority: - Mesecons compat Medium Priority -- inv_plus compatibility +- Lava Furnace inv_plus recpies - Autocrafter - Network Crafter +- Enable translation for all strings - Add crafting grid to Access Point Low Priority: diff --git a/api/access_point.lua b/api/access_point.lua index beb4ace..42a9949 100644 --- a/api/access_point.lua +++ b/api/access_point.lua @@ -62,7 +62,7 @@ minetest.register_on_player_receive_fields(logistica.on_receive_access_point_for -- `simpleName` is used for the description and for the name (can contain spaces) function logistica.register_access_point(desc, name, tiles) local lname = string.lower(name:gsub(" ", "_")) - local access_point_name = "logistica:access_point_"..lname + local access_point_name = "logistica:"..lname logistica.misc_machines[access_point_name] = true local grps = {oddly_breakable_by_hand = 3, cracky = 3 } grps[logistica.TIER_ALL] = 1 diff --git a/api/cables.lua b/api/cables.lua index c9e123b..05fb61d 100644 --- a/api/cables.lua +++ b/api/cables.lua @@ -1,31 +1,32 @@ --- todo: rework this to make tiers not tied to cable name and to be optional -- Main function to register a new cable of certain tier -function logistica.register_cable(tier, size) - local ltier = string.lower(tier) - local cable_name = "logistica:" .. ltier .. "_cable" - local cable_group = logistica.get_cable_group(ltier) - logistica.cables[cable_name] = tier - logistica.tiers[ltier] = true +-- customNodeBox can specify any of the fixed/connect_DIR - values will be overwritten per-item basis +function logistica.register_cable(desc, name, size, customNodeBox) + local lname = string.lower(name) + local cable_name = "logistica:" .. lname + local cable_group = logistica.get_cable_group(lname) + logistica.cables[cable_name] = name + logistica.tiers[lname] = true + local cnb = customNodeBox or {} local node_box = { type = "connected", - fixed = { -size, -size, -size, size, size, size }, - connect_top = { -size, -size, -size, size, 0.5, size }, -- y+ - connect_bottom = { -size, -0.5, -size, size, size, size }, -- y- - connect_front = { -size, -size, -0.5, size, size, size }, -- z- - connect_back = { -size, -size, size, size, size, 0.5 }, -- z+ - connect_left = { -0.5, -size, -size, size, size, size }, -- x- - connect_right = { -size, -size, -size, 0.5, size, size }, -- x+ + fixed = cnb.fixed or { -size, -size, -size, size, size, size }, + connect_top = cnb.connect_top or { -size, -size, -size, size, 0.5, size }, -- y+ + connect_bottom = cnb.connect_bottom or { -size, -0.5, -size, size, size, size }, -- y- + connect_front = cnb.connect_front or { -size, -size, -0.5, size, size, size }, -- z- + connect_back = cnb.connect_back or { -size, -size, size, size, size, 0.5 }, -- z+ + connect_left = cnb.connect_left or { -0.5, -size, -size, size, size, size }, -- x- + connect_right = cnb.connect_right or { -size, -size, -size, 0.5, size, size }, -- x+ } local def = { - description = tier .. " Cable", - tiles = { "logistica_" .. ltier .. "_cable.png" }, - inventory_image = "logistica_" .. ltier .. "_cable_inv.png", - wield_image = "logistica_" .. ltier .. "_cable_inv.png", + description = desc, + tiles = { "logistica_" .. lname .. "_cable.png" }, + inventory_image = "logistica_" .. lname .. "_cable_inv.png", + wield_image = "logistica_" .. lname .. "_cable_inv.png", groups = { cracky = 3, choppy = 3, @@ -35,10 +36,11 @@ function logistica.register_cable(tier, size) sounds = logistica.node_sound_metallic(), drop = cable_name, paramtype = "light", + paramtype2 = "facedir", sunlight_propagates = true, drawtype = "nodebox", node_box = node_box, - connects_to = { "group:" .. cable_group, "group:"..logistica.get_machine_group(ltier), logistica.GROUP_ALL }, + connects_to = { "group:" .. cable_group, "group:"..logistica.get_machine_group(lname), logistica.GROUP_ALL }, on_construct = function(pos) logistica.on_cable_change(pos, nil) end, after_destruct = function(pos, oldnode) logistica.on_cable_change(pos, oldnode) end, } @@ -47,10 +49,10 @@ function logistica.register_cable(tier, size) local def_broken = {} for k, v in pairs(def) do def_broken[k] = v end - def_broken.tiles = { "logistica_" .. ltier .. "_cable.png^logistica_broken.png" } - def_broken.inventory_image = "logistica_" .. ltier .. "_cable_inv.png^logistica_broken.png" + def_broken.tiles = { "logistica_" .. lname .. "_cable.png^logistica_broken.png" } + def_broken.inventory_image = "logistica_" .. lname .. "_cable_inv.png^logistica_broken.png" def_broken.groups = { cracky = 3, choppy = 3, oddly_breakable_by_hand = 2, not_in_creative_inventory = 1 } - def_broken.description = "Broken " .. tier .. " Cable" + def_broken.description = "Broken " .. desc def_broken.node_box = { type = "fixed", fixed = { -0.5, -size, -size, 0.5, size, size } } def_broken.selection_box = def_broken.node_box def_broken.connects_to = nil diff --git a/api/injector.lua b/api/injector.lua index fc621ec..0736f4e 100644 --- a/api/injector.lua +++ b/api/injector.lua @@ -116,7 +116,7 @@ minetest.register_on_player_receive_fields(on_player_receive_fields) -- transferRate is how many items per tick this injector can transfer, -1 for unlimited function logistica.register_injector(description, name, transferRate, tiles) local lname = string.lower(name:gsub(" ", "_")) - local injectorName = "logistica:injector_"..lname + local injectorName = "logistica:"..lname logistica.injectors[injectorName] = true local grps = {oddly_breakable_by_hand = 3, cracky = 3 } grps[logistica.TIER_ALL] = 1 diff --git a/api/item_storage.lua b/api/item_storage.lua index 77fb749..9404995 100644 --- a/api/item_storage.lua +++ b/api/item_storage.lua @@ -100,7 +100,7 @@ minetest.register_on_player_receive_fields(on_player_receive_fields) -- `simpleName` is used for the description and for the name (can contain spaces) function logistica.register_item_storage(desc, name, tiles) local lname = string.lower(name:gsub(" ", "_")) - local item_storage_name = "logistica:item_storage_"..lname + local item_storage_name = "logistica:"..lname logistica.item_storage[item_storage_name] = true local grps = {oddly_breakable_by_hand = 3, cracky = 3 } grps[logistica.TIER_ALL] = 1 diff --git a/api/mass_storage.lua b/api/mass_storage.lua index 19458ab..df8444a 100644 --- a/api/mass_storage.lua +++ b/api/mass_storage.lua @@ -331,7 +331,7 @@ minetest.register_on_player_receive_fields(on_receive_storage_formspec) function logistica.register_mass_storage(simpleName, description, numSlots, numItemsPerSlot, numUpgradeSlots, tiles) local lname = string.lower(string.gsub(simpleName, " ", "_")) - local storageName = "logistica:mass_storage_"..lname + local storageName = "logistica:"..lname local grps = {cracky = 1, choppy = 1, oddly_breakable_by_hand = 1} numUpgradeSlots = logistica.clamp(numUpgradeSlots, 0, 4) grps[logistica.TIER_ALL] = 1 diff --git a/api/requester.lua b/api/requester.lua index ac526cb..34dfc26 100644 --- a/api/requester.lua +++ b/api/requester.lua @@ -117,7 +117,7 @@ minetest.register_on_player_receive_fields(on_player_receive_fields) -- transferRate is how many items per tick this requester can transfer, -1 for unlimited function logistica.register_requester(description, name, transferRate, tiles) local lname = string.lower(name:gsub(" ", "_")) - local requester_name = "logistica:requester_"..lname + local requester_name = "logistica:"..lname logistica.requesters[requester_name] = true local grps = {oddly_breakable_by_hand = 3, cracky = 3 } grps[logistica.TIER_ALL] = 1 diff --git a/api/supplier.lua b/api/supplier.lua index da0913f..7258ce8 100644 --- a/api/supplier.lua +++ b/api/supplier.lua @@ -95,7 +95,7 @@ minetest.register_on_player_receive_fields(on_player_receive_fields) -- `inventorySize` should be 16 at max function logistica.register_supplier(desc, name, inventorySize, tiles) local lname = string.lower(name:gsub(" ", "_")) - local supplier_name = "logistica:passive_supplier_"..lname + local supplier_name = "logistica:"..lname logistica.suppliers[supplier_name] = true local grps = {oddly_breakable_by_hand = 3, cracky = 3 } grps[logistica.TIER_ALL] = 1 diff --git a/item/craft_item.lua b/item/craft_item.lua index 76aedc8..42cdce3 100644 --- a/item/craft_item.lua +++ b/item/craft_item.lua @@ -1,31 +1,53 @@ local S = logistica.TRANSLATOR +local L = function(str) return "logistica:"..str end logistica.craftitem.general = {} local items = logistica.craftitem.general -items["logistica:lava_unit"] = { +items[L("lava_unit")] = { description = S("A Unit of Lava\nUse in Lava Furnace or with Empty Bucket"), inventory_image = "logistica_lava_unit.png", stack_max = 1, } -items["logistica:silverin_slice"] = { +items[L("silverin_slice")] = { description = S("Silverin Slice"), inventory_image = "logistica_silverin_slice.png", stack_max = 99, } --- items["logistica:silverin_photonizer"] = { --- description = S("Silverin Phonizer"), --- inventory_image = "logistica_silverin_slice.png", --- stack_max = 99, --- } --- items["logistica:silverin_wavebox"] = { --- description = S("Standing-Wave State Maintainer"), --- inventory_image = "logistica_silverin_slice.png", --- stack_max = 99, --- } + +items[L("silverin_circuit")] = { + description = S("A Silverin Circuit"), + inventory_image = "logistica_silverin_circuit.png", + stack_max = 99, +} + +items[L("silverin_mirror_box")] = { + description = S("Silverin Mirror Box"), + inventory_image = "logistica_silverin_mirror_box.png", + stack_max = 99, +} + +items[L("photonizer")] = { + description = S("Photonizer\nE = M*C^2"), + inventory_image = "logistica_photonizer.png", + stack_max = 99, +} + +items[L("photonizer_reversed")] = { + description = S("Photonizer (Inverted Polarity)\nM = E/C^2"), + inventory_image = "logistica_photonizer_reversed.png", + stack_max = 99, +} + +items[L("standing_wave_box")] = { + description = S("Wave Function Maintainer"), + inventory_image = "logistica_standing_wave_box.png", + stack_max = 99, +} + for name, info in pairs(items) do minetest.register_craftitem(name, { diff --git a/item/craft_item_nodes.lua b/item/craft_item_nodes.lua index fc0cacd..9ecbc15 100644 --- a/item/craft_item_nodes.lua +++ b/item/craft_item_nodes.lua @@ -20,6 +20,7 @@ items["logistica:silverin"] = { }, drawtype = "nodebox", paramtype = "light", + paramtype2 = "facedir", node_box = { type = "fixed", fixed = { @@ -34,13 +35,30 @@ items["logistica:silverin"] = { stack_max = 99, } +items["logistica:silverin_plate"] = { + tiles = { "logistica_silverin_plate.png" }, + drawtype = "nodebox", + paramtype = "light", + paramtype2 = "facedir", + node_box = { + type = "fixed", + fixed = { + {-0.50, -0.50, -0.50, 0.50, -7/16, 0.50} + } + }, + groups = { cracky = 2 }, + sounds = logistica.node_sound_metallic(), + description = S("Silverin Plate"), + inventory_image = "logistica_silverin_plate_inv.png", + stack_max = 99, +} + -- items["logistica:silverin_block"] = { -- description = S("Silverin Block"), --- inventory_image = "logistica_storage_upgrade_1.png", +-- tiles = "logistica_silverin_plate.png", -- stack_max = 99, -- } - for name, def in pairs(items) do minetest.register_node(name, def) end \ No newline at end of file diff --git a/registration/item_recipes.lua b/registration/item_recipes.lua new file mode 100644 index 0000000..7e132d6 --- /dev/null +++ b/registration/item_recipes.lua @@ -0,0 +1,27 @@ + +local function L(s) return "logistica:"..s end +local SILV = L("silverin") +local SILV_SLICE = L("silverin_slice") + +minetest.register_craft({ + output = SILV_SLICE.." 8", + type = "shapeless", + recipe = { SILV }, +}) + +minetest.register_craft({ + output = SILV, + type = "shapeless", + recipe = { + SILV_SLICE, SILV_SLICE, SILV_SLICE, SILV_SLICE, + SILV_SLICE, SILV_SLICE, SILV_SLICE, SILV_SLICE + }, +}) + +-- minetest.register_craft({ +-- output = L("network_tool"), +-- recipe = { + +-- } +-- }) + diff --git a/registration/nodes.lua b/registration/machines_api_reg.lua similarity index 86% rename from registration/nodes.lua rename to registration/machines_api_reg.lua index 06d7721..136441a 100644 --- a/registration/nodes.lua +++ b/registration/machines_api_reg.lua @@ -2,7 +2,7 @@ -- Access Point -------------------------------- -logistica.register_access_point("Access Point", "base", { +logistica.register_access_point("Access Point", "access_point", { "logistica_access_point_top.png", "logistica_access_point_bottom.png", "logistica_access_point_side.png^[transformFX", @@ -16,8 +16,13 @@ logistica.register_access_point("Access Point", "base", { -------------------------------- local CABLE_SIZE = 1/16 -logistica.register_cable("Silver", CABLE_SIZE) - +logistica.register_cable("Optic cable", "optic", CABLE_SIZE) +-- 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 } +-- } +-- }) -------------------------------- -- Controller -------------------------------- @@ -73,14 +78,14 @@ local function imp_tiles(name) return { "logistica_"..name.."_injector_front.png", } end -logistica.register_injector("Slow Network Importer\nImports 10 items at a time", "slow", 10, imp_tiles("item")) -logistica.register_injector("Fast Network Importer\nImports 99 items at a time", "fast", 99, imp_tiles("stack")) +logistica.register_injector("Slow Network Importer\nImports 10 items at a time", "injector_slow", 10, imp_tiles("item")) +logistica.register_injector("Fast Network Importer\nImports 99 items at a time", "injector_fast", 99, imp_tiles("stack")) -------------------------------- -- Item Storage -------------------------------- -logistica.register_item_storage("Tool Box\nStores Tools Only", "simple", { +logistica.register_item_storage("Tool Box\nStores Tools Only", "item_storage", { "logistica_tool_box_top.png", "logistica_tool_box_bottom.png", "logistica_tool_box_side.png^[transformFX", @@ -93,7 +98,7 @@ logistica.register_item_storage("Tool Box\nStores Tools Only", "simple", { -- Mass Storage -------------------------------- -logistica.register_mass_storage("basic", "Mass Storage", 8, 1024, 4, { +logistica.register_mass_storage("mass_storage_basic", "Mass Storage", 8, 1024, 4, { "logistica_basic_mass_storage_top.png", "logistica_basic_mass_storage_top.png", "logistica_basic_mass_storage.png", "logistica_basic_mass_storage.png", "logistica_basic_mass_storage.png", "logistica_basic_mass_storage_front.png" @@ -112,14 +117,14 @@ local function ins_tiles(lname) return { "logistica_"..lname.."_requester_front.png", } end -logistica.register_requester("Item Request Inserter\nInserts 1 item at a time", "item", 1, ins_tiles("item")) -logistica.register_requester("Bulk Request Inserter\nInserts up to 64 items at a time", "stack", 64, ins_tiles("stack")) +logistica.register_requester("Item Request Inserter\nInserts 1 item at a time", "requester_item", 1, ins_tiles("item")) +logistica.register_requester("Bulk Request Inserter\nInserts up to 64 items at a time", "requester_stack", 64, ins_tiles("stack")) -------------------------------- -- Passive Supply Chest -------------------------------- -logistica.register_supplier("Passive Supplier Chest", "simple", 16, { +logistica.register_supplier("Passive Supplier Chest", "passive_supplier", 16, { "logistica_passive_supplier_top.png", "logistica_passive_supplier_bottom.png", "logistica_passive_supplier_side.png^[transformFX", diff --git a/registration/node_recipes.lua b/registration/node_recipes.lua new file mode 100644 index 0000000..6278165 --- /dev/null +++ b/registration/node_recipes.lua @@ -0,0 +1,4 @@ + +local SILV = "logistica:silverin" +local SILV_SLICE = "logistica:silverin_slice" + diff --git a/registration/registration.lua b/registration/registration.lua index 03208bb..ffaca7f 100644 --- a/registration/registration.lua +++ b/registration/registration.lua @@ -1,4 +1,6 @@ local path = logistica.MODPATH .. "/registration" -- once again, order is important -dofile(path.."/nodes.lua") +dofile(path.."/node_recipes.lua") +dofile(path.."/item_recipes.lua") +dofile(path.."/machines_api_reg.lua") dofile(path.."/lava_furnace_recipes.lua") diff --git a/textures/logistica_network_tool.png b/textures/logistica_hyperspanner.png similarity index 100% rename from textures/logistica_network_tool.png rename to textures/logistica_hyperspanner.png diff --git a/textures/logistica_silver_cable.png b/textures/logistica_optic_cable.png similarity index 100% rename from textures/logistica_silver_cable.png rename to textures/logistica_optic_cable.png diff --git a/textures/logistica_silver_cable_inv.png b/textures/logistica_optic_cable_inv.png similarity index 100% rename from textures/logistica_silver_cable_inv.png rename to textures/logistica_optic_cable_inv.png diff --git a/textures/logistica_photonizer.png b/textures/logistica_photonizer.png new file mode 100644 index 0000000..459bba0 Binary files /dev/null and b/textures/logistica_photonizer.png differ diff --git a/textures/logistica_photonizer_reversed.png b/textures/logistica_photonizer_reversed.png new file mode 100644 index 0000000..efb0d8a Binary files /dev/null and b/textures/logistica_photonizer_reversed.png differ diff --git a/textures/logistica_silverin_circuit.png b/textures/logistica_silverin_circuit.png new file mode 100644 index 0000000..d875bf0 Binary files /dev/null and b/textures/logistica_silverin_circuit.png differ diff --git a/textures/logistica_silverin_mirror_box.png b/textures/logistica_silverin_mirror_box.png new file mode 100644 index 0000000..0dafe0d Binary files /dev/null and b/textures/logistica_silverin_mirror_box.png differ diff --git a/textures/logistica_silverin_plate.png b/textures/logistica_silverin_plate.png new file mode 100644 index 0000000..59de553 Binary files /dev/null and b/textures/logistica_silverin_plate.png differ diff --git a/textures/logistica_silverin_plate_inv.png b/textures/logistica_silverin_plate_inv.png new file mode 100644 index 0000000..6f5db8f Binary files /dev/null and b/textures/logistica_silverin_plate_inv.png differ diff --git a/textures/logistica_standing_wave_box.png b/textures/logistica_standing_wave_box.png new file mode 100644 index 0000000..f7cb87e Binary files /dev/null and b/textures/logistica_standing_wave_box.png differ diff --git a/tools/tools.lua b/tools/tools.lua index b529ace..0f9ffb3 100644 --- a/tools/tools.lua +++ b/tools/tools.lua @@ -1,21 +1,20 @@ local S = logistica.TRANSLATOR -minetest.register_craftitem("logistica:network_tool",{ - description = S("Logistica Network Tool\nUse on a node to see network info"), - short_description = S("Logistica Network Tool"), - inventory_image = "logistica_network_tool.png", - wield_image = "logistica_network_tool.png", +minetest.register_craftitem("logistica:hyperspanner",{ + description = S("Hyperspanner\nA multipurpose engineering tool\nUse on nodes for network info.\nCan also reverse poliarity."), + short_description = S("Hyperspanner"), + inventory_image = "logistica_hyperspanner.png", + wield_image = "logistica_hyperspanner.png", stack_max = 1, on_place = function(itemstack, placer, pointed_thing) local pos = pointed_thing.under if not placer or not pos then return end local node = minetest.get_node_or_nil(pos) if not node or node.name:find("logistica:") == nil then return end - local network = logistica.get_network_name_or_nil(pos) or "" - -- minetest.chat_send_player(placer:get_player_name(), "Network: "..network) + local network = logistica.get_network_name_or_nil(pos) or S("") logistica.show_popup( placer:get_player_name(), - "("..pos.x..","..pos.y..","..pos.z..") Network: "..network + "("..pos.x..","..pos.y..","..pos.z..") .."..S("Network")..": "..network ) end })