diff --git a/projects/assets/nodeworks/26.1/nodeworks/lang/en_us.json b/projects/assets/nodeworks/26.1/nodeworks/lang/en_us.json new file mode 100644 index 000000000000..2a011662d173 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/lang/en_us.json @@ -0,0 +1,110 @@ +{ + "block.nodeworks.antenna_segment": "Antenna Segment", + "block.nodeworks.breaker": "Breaker", + "block.nodeworks.broadcast_antenna": "Broadcast Antenna", + "block.nodeworks.budding_celestine": "Budding Celestine", + "block.nodeworks.celestine_block": "Block of Celestine", + "block.nodeworks.celestine_cluster": "Celestine Cluster", + "block.nodeworks.celestine_ore": "Deepslate Celestine Ore", + "block.nodeworks.co_processor": "Crafting Co-Processor", + "block.nodeworks.covered_pipe": "Covered Vacuum Pipe", + "block.nodeworks.craft_requester": "Craft Requester", + "block.nodeworks.crafting_core": "Crafting Core", + "block.nodeworks.crafting_storage": "Crafting Buffer", + "block.nodeworks.device_frame": "Device Frame", + "block.nodeworks.export_chest": "Export Chest", + "block.nodeworks.focus_node": "Focus Node", + "block.nodeworks.import_chest": "Import Chest", + "block.nodeworks.instruction_crafter": "Instruction Crafter", + "block.nodeworks.instruction_storage": "Instruction Storage", + "block.nodeworks.inventory_terminal": "Inventory Terminal", + "block.nodeworks.large_celestine_bud": "Large Celestine Bud", + "block.nodeworks.medium_celestine_bud": "Medium Celestine Bud", + "block.nodeworks.monitor": "Monitor", + "block.nodeworks.network_controller": "Network Controller", + "block.nodeworks.node": "Node", + "block.nodeworks.pipe": "Vacuum Pipe", + "block.nodeworks.placer": "Placer", + "block.nodeworks.processing_handler": "Processing Handler", + "block.nodeworks.processing_storage": "Processing Storage", + "block.nodeworks.receiver_antenna": "Receiver Antenna", + "block.nodeworks.small_celestine_bud": "Small Celestine Bud", + "block.nodeworks.stabilizer": "Crafting Coolant", + "block.nodeworks.storage_meter": "Storage Meter", + "block.nodeworks.substrate": "Crafting Substrate", + "block.nodeworks.terminal": "Scripting Terminal", + "block.nodeworks.user": "User", + "block.nodeworks.variable": "Variable", + "container.nodeworks.breaker": "Breaker Settings", + "container.nodeworks.broadcast_antenna": "Broadcast Antenna", + "container.nodeworks.card_programmer": "Card Programmer", + "container.nodeworks.card_settings": "Card Settings", + "container.nodeworks.craft_requester": "Craft Requester", + "container.nodeworks.crafting_core": "Crafting CPU", + "container.nodeworks.diagnostic": "Network Diagnostic", + "container.nodeworks.export_chest": "Export Chest", + "container.nodeworks.import_chest": "Import Chest", + "container.nodeworks.instruction_set": "Instruction Set", + "container.nodeworks.instruction_storage": "Instruction Storage", + "container.nodeworks.inventory_terminal": "Inventory Terminal", + "container.nodeworks.network_controller": "Network Controller", + "container.nodeworks.node_side": "Node, %s", + "container.nodeworks.placer": "Placer Settings", + "container.nodeworks.portable_inventory_terminal": "Portable Inventory Terminal", + "container.nodeworks.processing_handler": "Processing Handler", + "container.nodeworks.processing_set": "Processing Set", + "container.nodeworks.processing_storage": "Processing Storage", + "container.nodeworks.receiver_antenna": "Receiver Antenna", + "container.nodeworks.storage_card": "Storage Card", + "container.nodeworks.storage_meter": "Storage Meter", + "container.nodeworks.user": "User", + "container.nodeworks.variable": "Variable Settings", + "item.nodeworks.antenna_coil_assembly": "Antenna Coil Assembly", + "item.nodeworks.blank_card": "Blank Card", + "item.nodeworks.card_programmer": "Card Programmer", + "item.nodeworks.celestine_antenna_array": "Celestine Antenna Array", + "item.nodeworks.celestine_receiver_dish": "Celestine Receiver Dish", + "item.nodeworks.celestine_shard": "Celestine Shard", + "item.nodeworks.charged_beam_catalyst": "Charged Beam Catalyst", + "item.nodeworks.diagnostic_tool": "Diagnostic Tool", + "item.nodeworks.dimension_range_upgrade": "Dimension Range Upgrade", + "item.nodeworks.grapple_beam": "Grapple Beam", + "item.nodeworks.instruction_set": "Instruction Set", + "item.nodeworks.io_card": "IO Card", + "item.nodeworks.link_crystal": "Link Crystal", + "item.nodeworks.milky_soul_ball": "Milky Soul Ball", + "item.nodeworks.multi_dimension_range_upgrade": "Multi-Dimension Range Upgrade", + "item.nodeworks.network_wrench": "Network Wrench", + "item.nodeworks.nodeworks_book.tooltip": "Right-click to open the Nodeworks guide.", + "item.nodeworks.nodeworks_book": "Nodeworks Book", + "item.nodeworks.observer_card": "Observer Card", + "item.nodeworks.portable_inventory_terminal": "Portable Inventory Terminal", + "item.nodeworks.processing_set": "Processing Set", + "item.nodeworks.redstone_card": "Redstone Card", + "item.nodeworks.storage_card": "Storage Card", + "jei.nodeworks.category.soul_sand_infusion": "Soul Sand Infusion", + "message.nodeworks.card_reset": "Cleared.", + "message.nodeworks.connected": "Linked.", + "message.nodeworks.diagnostic_no_network": "No network block found", + "message.nodeworks.disconnected": "Unlinked.", + "message.nodeworks.duplicate_controller": "Linking would merge two networks with separate controllers.", + "message.nodeworks.duplicate_controller": "Network already has a controller.", + "message.nodeworks.endpoint_selected": "Selected Focus Node at (%s, %s, %s)", + "message.nodeworks.max_links": "One of the Focus Nodes is at its link cap.", + "message.nodeworks.no_controller": "Network has no controller.", + "message.nodeworks.no_line_of_sight": "No line of sight between Focus Nodes.", + "message.nodeworks.no_selection": "No selection. Shift + right-click a Focus Node's free face first.", + "message.nodeworks.not_focus_node": "Right-click a Focus Node to start a link, then right-click another Focus Node to finish.", + "message.nodeworks.same_endpoint": "Cannot link a Focus Node to itself.", + "message.nodeworks.selection_invalid": "Previously selected Focus Node no longer exists.", + "message.nodeworks.terminal_controller_conflict": "Network has no controller, or multiple controllers are conflicting.", + "message.nodeworks.terminal_in_use": "Terminal is already in use by %s.", + "message.nodeworks.terminal_no_network": "Terminal is not connected to a node network.", + "message.nodeworks.too_far": "Focus Nodes are too far apart (max %s blocks).", + "subtitle.nodeworks.grapple_beam.activate": "Grapple Beam latches", + "subtitle.nodeworks.grapple_beam.deactivate": "Grapple Beam releases", + "tooltip.nodeworks.covered_pipe.camo": "Disguised as %s", + "tooltip.nodeworks.instruction_set.input": "Input:", + "tooltip.nodeworks.instruction_set.output": "Output:", + "tooltip.nodeworks.missing_ingredients": "Missing ingredients in your inventory and network" +} \ No newline at end of file diff --git a/projects/assets/nodeworks/26.1/nodeworks/lang/zh_cn.json b/projects/assets/nodeworks/26.1/nodeworks/lang/zh_cn.json new file mode 100644 index 000000000000..14b695012045 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/lang/zh_cn.json @@ -0,0 +1,110 @@ +{ + "block.nodeworks.antenna_segment": "天线段", + "block.nodeworks.breaker": "破坏器", + "block.nodeworks.broadcast_antenna": "广播天线", + "block.nodeworks.budding_celestine": "天青石母岩", + "block.nodeworks.celestine_block": "天青石块", + "block.nodeworks.celestine_cluster": "天青石簇", + "block.nodeworks.celestine_ore": "深层天青石矿石", + "block.nodeworks.co_processor": "合成协处理器", + "block.nodeworks.covered_pipe": "覆层真空管道", + "block.nodeworks.craft_requester": "合成请求器", + "block.nodeworks.crafting_core": "合成核心", + "block.nodeworks.crafting_storage": "合成缓存器", + "block.nodeworks.device_frame": "设备框架", + "block.nodeworks.export_chest": "导出箱", + "block.nodeworks.focus_node": "焦准节点", + "block.nodeworks.import_chest": "导入箱", + "block.nodeworks.instruction_crafter": "指令合成器", + "block.nodeworks.instruction_storage": "指令存储器", + "block.nodeworks.inventory_terminal": "物品栏终端", + "block.nodeworks.large_celestine_bud": "大型天青石芽", + "block.nodeworks.medium_celestine_bud": "中型天青石芽", + "block.nodeworks.monitor": "监控器", + "block.nodeworks.network_controller": "网络控制器", + "block.nodeworks.node": "节点", + "block.nodeworks.pipe": "真空管道", + "block.nodeworks.placer": "放置器", + "block.nodeworks.processing_handler": "处理操作器", + "block.nodeworks.processing_storage": "处理存储器", + "block.nodeworks.receiver_antenna": "接收天线", + "block.nodeworks.small_celestine_bud": "小型天青石芽", + "block.nodeworks.stabilizer": "合成冷却器", + "block.nodeworks.storage_meter": "库存量表", + "block.nodeworks.substrate": "合成载件", + "block.nodeworks.terminal": "脚本终端", + "block.nodeworks.user": "使用器", + "block.nodeworks.variable": "变量器", + "container.nodeworks.breaker": "破坏器设置", + "container.nodeworks.broadcast_antenna": "广播天线", + "container.nodeworks.card_programmer": "卡片编程器", + "container.nodeworks.card_settings": "卡片设置", + "container.nodeworks.craft_requester": "合成请求器", + "container.nodeworks.crafting_core": "合成CPU", + "container.nodeworks.diagnostic": "网络诊断", + "container.nodeworks.export_chest": "导出箱", + "container.nodeworks.import_chest": "导入箱", + "container.nodeworks.instruction_set": "指令集", + "container.nodeworks.instruction_storage": "指令存储器", + "container.nodeworks.inventory_terminal": "物品栏终端", + "container.nodeworks.network_controller": "网络控制器", + "container.nodeworks.node_side": "节点,%s", + "container.nodeworks.placer": "放置器设置", + "container.nodeworks.portable_inventory_terminal": "便携式物品栏终端", + "container.nodeworks.processing_handler": "处理操作器", + "container.nodeworks.processing_set": "处理集", + "container.nodeworks.processing_storage": "处理存储器", + "container.nodeworks.receiver_antenna": "接收天线", + "container.nodeworks.storage_card": "存储卡", + "container.nodeworks.storage_meter": "库存量表", + "container.nodeworks.user": "使用器", + "container.nodeworks.variable": "变量器设置", + "item.nodeworks.antenna_coil_assembly": "天线线圈组", + "item.nodeworks.blank_card": "空白卡", + "item.nodeworks.card_programmer": "卡片编程器", + "item.nodeworks.celestine_antenna_array": "天青石天线阵列", + "item.nodeworks.celestine_receiver_dish": "天青石接收锅", + "item.nodeworks.celestine_shard": "天青石碎片", + "item.nodeworks.charged_beam_catalyst": "充能光束触媒", + "item.nodeworks.diagnostic_tool": "诊断工具", + "item.nodeworks.dimension_range_upgrade": "维度范围升级", + "item.nodeworks.grapple_beam": "抓钩光束", + "item.nodeworks.instruction_set": "指令集", + "item.nodeworks.io_card": "IO卡", + "item.nodeworks.link_crystal": "链接晶体", + "item.nodeworks.milky_soul_ball": "奶液灵魂球", + "item.nodeworks.multi_dimension_range_upgrade": "多维度范围升级", + "item.nodeworks.network_wrench": "网络扳手", + "item.nodeworks.nodeworks_book.tooltip": "右击打开节点工程指南。", + "item.nodeworks.nodeworks_book": "节点工程之书", + "item.nodeworks.observer_card": "侦测卡", + "item.nodeworks.portable_inventory_terminal": "便携式物品栏终端", + "item.nodeworks.processing_set": "处理集", + "item.nodeworks.redstone_card": "红石卡", + "item.nodeworks.storage_card": "存储卡", + "jei.nodeworks.category.soul_sand_infusion": "灵魂沙灌注", + "message.nodeworks.card_reset": "已清除。", + "message.nodeworks.connected": "已链接。", + "message.nodeworks.diagnostic_no_network": "未找到网络方块", + "message.nodeworks.disconnected": "已断开链接。", + "message.nodeworks.duplicate_controller": "链接会导致合并各有控制器的两个网络。", + "message.nodeworks.duplicate_controller": "网络中已有控制器。", + "message.nodeworks.endpoint_selected": "已选中(%s, %s, %s)处的焦准节点", + "message.nodeworks.max_links": "其中一个焦准节点已达到链接上限。", + "message.nodeworks.no_controller": "网络没有控制器。", + "message.nodeworks.no_line_of_sight": "焦准节点之间没有无遮挡直线路径。", + "message.nodeworks.no_selection": "未进行选择。请先Shift+右击焦准节点的临空面。", + "message.nodeworks.not_focus_node": "右击焦准节点以开始链接,再右击其他焦准节点以结束。", + "message.nodeworks.same_endpoint": "无法将焦准节点链接到自身。", + "message.nodeworks.selection_invalid": "先前选择的焦准节点已不存在。", + "message.nodeworks.terminal_controller_conflict": "网络没有控制器,或有多个冲突的控制器。", + "message.nodeworks.terminal_in_use": "%s正在使用终端。", + "message.nodeworks.terminal_no_network": "终端未连接至节点网络。", + "message.nodeworks.too_far": "焦准节点距离过远(最远%s格)。", + "subtitle.nodeworks.grapple_beam.activate": "抓钩光束:抓握", + "subtitle.nodeworks.grapple_beam.deactivate": "抓钩光束:释放", + "tooltip.nodeworks.covered_pipe.camo": "伪装为%s", + "tooltip.nodeworks.instruction_set.input": "输入:", + "tooltip.nodeworks.instruction_set.output": "输出:", + "tooltip.nodeworks.missing_ingredients": "你的物品栏和网络均缺少原材料" +} \ No newline at end of file diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/assets/examples/moving-items.lua b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/assets/examples/moving-items.lua new file mode 100644 index 000000000000..ccc145be1120 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/assets/examples/moving-items.lua @@ -0,0 +1,7 @@ +local input = network:get("input") +local output = network:get("output") + +local allItems = input:find("*") -- 抽取此容器中的所有物品 +if allItems then -- 如果找到了物品 + output:insert(allItems) +end diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/assets/images/inventory_terminal_gui.png b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/assets/images/inventory_terminal_gui.png new file mode 100644 index 000000000000..1c0f30f4803e Binary files /dev/null and b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/assets/images/inventory_terminal_gui.png differ diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/assets/images/inventory_terminal_gui_expanded.png b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/assets/images/inventory_terminal_gui_expanded.png new file mode 100644 index 000000000000..5077f57f44d0 Binary files /dev/null and b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/assets/images/inventory_terminal_gui_expanded.png differ diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/assets/images/node_gui.png b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/assets/images/node_gui.png new file mode 100644 index 000000000000..aea4b36f3afc Binary files /dev/null and b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/assets/images/node_gui.png differ diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/example-setups/automated-celestine-farm.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/example-setups/automated-celestine-farm.md new file mode 100644 index 000000000000..5f2fd0d69d58 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/example-setups/automated-celestine-farm.md @@ -0,0 +1,28 @@ +--- +navigation: + parent: example-setups/index.md + icon: celestine_shard + title: 天青石农场 +categories: + - example +--- + +# 天青石农场 + +可使用自动化。 + + + + + + +也可以用焦准节点连接各部分: + + + + + + +在破坏器的GUI中,将它们设为低红石模式,即无红石信号时运作。再将它们设为破坏。 + +它们会破坏长出的天青石簇,并将产物送入[网络存储](../nodeworks-mechanics/network-storage.md)。 \ No newline at end of file diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/example-setups/automated-smelting.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/example-setups/automated-smelting.md new file mode 100644 index 000000000000..77d29b194010 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/example-setups/automated-smelting.md @@ -0,0 +1,34 @@ +--- +navigation: + parent: example-setups/index.md + icon: minecraft:furnace + title: 自动化烧炼子网 +categories: + - example +--- + +# 自动化烧炼子网 + +你可以用桥接两个网络。此示例中的大网络会向熔炉阵列所在的小网络送出`#c:raw_material`物品,小网络再将产物送回大网络。 + + + + + + 蓝色网络导出箱,在GUI中设为向下方送出物品。 + + **这两个箱子之间没有连接,它们分属于两个网络。** + + + 绿色网络导出箱,在GUI中设为向上方送出物品。 + + **这两个箱子之间没有连接,它们分属于两个网络。** + + + 设为红色频道的存储卡,正被导出箱抽取;筛选器为`*`,即抽取所有资源 + + + 设为蓝色频道的存储卡,正被导入箱送入,模式为轮询 + + + diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/example-setups/cobble-gen.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/example-setups/cobble-gen.md new file mode 100644 index 000000000000..a6083147ca2e --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/example-setups/cobble-gen.md @@ -0,0 +1,35 @@ +--- +navigation: + parent: example-setups/index.md + icon: minecraft:cobblestone + title: 刷石机 +categories: + - example +--- + +# 刷石机 + +刷石机是最简单的应用方式。按下方示例在刷石机前放置破坏器 + + + + + + + + + +再将破坏器配置为破坏`minecraft:cobblestone`,将红石模式设为**低**以保持运作。 + +![破坏器GUI,破坏筛选器为圆石](../assets/images/breaker_cobblestone.png) + +若网络中有,则也可使用下方脚本达成相同功能,适用于多台破坏器。 + + +```lua +local breaker_1 = network:get("breaker_1") +scheduler:second(function() + breaker_1:mine() -- 一直挖掘 +end) +``` + \ No newline at end of file diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/example-setups/index.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/example-setups/index.md new file mode 100644 index 000000000000..f68f58343100 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/example-setups/index.md @@ -0,0 +1,9 @@ +--- +navigation: + title: 示例网络 + position: 50 +--- + +# 示例 + + \ No newline at end of file diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/example-setups/milky-soul-ball-farm.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/example-setups/milky-soul-ball-farm.md new file mode 100644 index 000000000000..57487bfe6dcb --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/example-setups/milky-soul-ball-farm.md @@ -0,0 +1,35 @@ +--- +navigation: + parent: example-setups/index.md + icon: milky_soul_ball + title: 奶液灵魂球农场 +categories: + - example +--- + +# 奶液灵魂球农场 + + + + + + + + + + + + + 使用器对牛使用空铁桶 + + + 使用器对灵魂沙使用奶桶,并将产出的奶液灵魂球和空铁桶送回网络存储 + + + 放置器在使用器前方放置灵魂沙 + + + +此农场中的会用空铁桶为奶牛挤奶,并将奶桶送回[网络存储](../nodeworks-mechanics/network-storage.md)。另一个使用器则会对放置的使用。 + +> **注意:**‌放置器和使用器的红石模式均为低,以让它们保持运作。 \ No newline at end of file diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/example-setups/moving-items.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/example-setups/moving-items.md new file mode 100644 index 000000000000..7c857ab59497 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/example-setups/moving-items.md @@ -0,0 +1,105 @@ +--- +navigation: + parent: example-setups/index.md + icon: minecraft:hopper + title: 移动物品 +categories: + - example +--- + +# 移动物品 + +节点工程网络最简单的功能,就是从容器中抽出物品送至网络存储。本页面会介绍两种方式,首先是基础方式,随后是经过筛选的同一设施。 + +--- + +## 使用导入/导出箱 + +### 将物品送入网络 + +放置在中的物品会被送入[网络存储](../nodeworks-mechanics/network-storage.md)。 + + + + + + + + + 导入箱的内容物品会被自动送入网络 + + + +### 从网络中抽取物品 + +可将网络存储中的物品抽到自身物品栏中。 + + + + + + + + + 导入箱的内容物品会被自动送入网络 + + + +--- + +## 使用脚本终端 + +### 抽取所有物品 + +将潜影盒中所有物品抽入网络,不进行筛选。 + + + + + + + + + 重命名为‌**“shulkerBox”**‌的 + + + +脚本: + + +```lua +importer + :from(shulkerBox) + :to(network) + :start() +``` + + +> **注意:**‌如需反转方向,可将`:from(shulkerBox)`和`:to(network)`改为`:from(network)`和`:to(shulkerBox)`。 + +运行此脚本时,所有抵达潜影盒的物品都会被送入网络存储(即未进行筛选的任意存储卡)。 + +## 筛选:按物品种类路由 + +同样的网络,其中一张存储卡设为原木,另一张设为圆石,还有一张接受所有其他资源。 + + + + + + **规则**:`#c:cobblestones` + + + + **规则**:`#c:logs` + + + + + + + 重命名为‌**“shulkerBox”**‌的 + + + +重用前一示例的脚本即可,区别仅在于存储卡各自有了[筛选器设置](../items-blocks/storage_card.md#筛选器)。 diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/example-setups/smeltery-subnet.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/example-setups/smeltery-subnet.md new file mode 100644 index 000000000000..003143deab16 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/example-setups/smeltery-subnet.md @@ -0,0 +1,37 @@ +--- +navigation: + parent: example-setups/index.md + icon: minecraft:furnace + title: 烧炼子网 +categories: + - example +--- + +# 烧炼子网 + +特化子网是委任网络功能和重用配方的好方法。 + + + + + + 红色存储卡,从熔炉中抽取产物 + + + 蓝色存储卡,管理处理操作器发来的输入 + + + 黄绿色存储卡,接受导入箱的轮询 + + + 启用轮询 + + 频道设为黄绿色 + + + +上方的**烧炼**子网示例正接受广播的。该配方网络可用链接,以便其他网络使用其中配方。 + +示例中还有三台分别绑定至网络中的三个处理集,且均会将输入物品为送至。导入箱设为轮询至指向熔炉顶面的存储卡所在的频道。红色的存储卡则均指向熔炉的底面。 + +详情参见[自动合成](../nodeworks-mechanics/autocrafting.md)页面。 \ No newline at end of file diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/getting-started.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/getting-started.md new file mode 100644 index 000000000000..e0b40383867a --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/getting-started.md @@ -0,0 +1,37 @@ +--- +navigation: + title: 新手入门 + position: 10 +--- + +# 新手入门 + +## 所需材料 + +节点工程网络的驱动力来自于的反射性质。 + +## 培育天青石 + +可以像培育一样培育天青石,此操作需要用到。 + +## 第一个节点工程网络 + +不涉及脚本的简单网络,只用于查看任意多个相连箱子中的物品,和使用物品栏终端类似。 + + + + + + +- 此网络包含: + - 1x + - 1x + - 若干,用于连接所有设备 + - 若干,用于将箱子等外部方块连接至网络 + - 1x ,放置于节点朝向箱子的一面 + +### 扩展你的节点工程网络 + +- [移动物品](./example-setups/moving-items.md) +- [自动合成](./nodeworks-mechanics/autocrafting.md) +- [示例设施](./example-setups/index.md) diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/index.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/index.md new file mode 100644 index 000000000000..1b413e98d189 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/index.md @@ -0,0 +1,29 @@ +--- +navigation: + title: 概览 + position: 0 +item_ids: +- nodeworks:nodeworks_book +--- + +# 节点工程 + +可编程的物流和自动化网络。 + + + + + + + +## 章节 + +- [新手入门](./getting-started.md) +- [脚本参考](./lua-api/index.md) +- [节点工程机制](./nodeworks-mechanics/index.md) +- [物品/方块](./items-blocks/index.md) +- [示例设施](./example-setups/index.md) + +在脚本终端的编辑器中,可以将鼠标悬停在任意有文档的标识符上,以查看其签名和描述。悬停时按下[ ]可打开相关页面。 + +有关添加文档的信息,参见[docs/authoring.md](https://github.com/damienfamed75/nodeworks/blob/main/docs/authoring.md)。 diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/antenna_coil_assembly.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/antenna_coil_assembly.md new file mode 100644 index 000000000000..eb305cb3d425 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/antenna_coil_assembly.md @@ -0,0 +1,21 @@ +--- +navigation: + parent: items-blocks/index.md + icon: antenna_coil_assembly + title: 天线线圈组 +categories: + - infrastructure +description: 的原材料 +item_ids: +- nodeworks:antenna_coil_assembly +--- + +# 天线线圈组 + +的原材料。 + + + +## 配方 + + \ No newline at end of file diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/blank_card.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/blank_card.md new file mode 100644 index 000000000000..2e5b68ecc1d4 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/blank_card.md @@ -0,0 +1,21 @@ +--- +navigation: + parent: items-blocks/index.md + icon: blank_card + title: 空白卡 +categories: + - card +description: 所有其他[卡片](../nodeworks-mechanics/cards.md)的基底 +item_ids: +- nodeworks:blank_card +--- + +# 空白卡 + +合成所有其他[卡片](../nodeworks-mechanics/cards.md)的基底。 + + + +## 配方 + + \ No newline at end of file diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/breaker.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/breaker.md new file mode 100644 index 000000000000..8bc76d61a721 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/breaker.md @@ -0,0 +1,58 @@ +--- +navigation: + parent: items-blocks/index.md + icon: breaker + title: 破坏器 +categories: + - device +description: 破坏并采集前方方块 +item_ids: +- nodeworks:breaker +--- + +# 破坏器 + +破坏器能花费一定时间摧毁前方的方块,并将掉落物路由回[网络存储](../nodeworks-mechanics/network-storage.md)(或路由至脚本handler)。品质为钻石,破坏耗时使用木镐的计算公式,因此硬方块花费的时间显著更长。 + + + +## 放置 + +破坏器的前部会朝向放置时的视线方向(和放置活塞与发射器一致)。该面前方的方块即是`:mine()`的挖掘目标。 + +## 目标筛选器 + +破坏器的GUI中有一个筛选器,用于限定应破坏哪种方块。留空为破坏前方一切事物,设置方块可限制为仅破坏该方块。 + +## 砍树 + +面朝树木基部的破坏器会砍倒整棵树。 + + + + + 砍伐最后一块支撑树木的原木会连带砍倒整棵树 + + + + + +## 红石 + +GUI的红石设定可控制破坏器的运作条件: + +- **高**:有信号时运作。 +- **低**:无信号时运作。 +- **忽略**:与红石信号无关。只会在脚本调用`:mine()`时触发。 + +## 频道 + +破坏器GUI中有名称和频道的设定器。有关频道限制脚本能否访问设备的详情,参见[选择频道](../lua-api/channel.md#选择频道)。 + +## 脚本 + +脚本API参见[BreakerHandle](../lua-api/breaker-handle.md)页面。 + +## 配方 + + diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/broadcast_antenna.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/broadcast_antenna.md new file mode 100644 index 000000000000..fa10872b353b --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/broadcast_antenna.md @@ -0,0 +1,47 @@ +--- +navigation: + parent: items-blocks/index.md + icon: broadcast_antenna + title: 广播天线 +categories: + - infrastructure +description: 广播网络控制器、处理存储器、导出箱的访问端口 +item_ids: +- nodeworks:broadcast_antenna +--- + +# 广播天线 + +有两种功能的方块,具体表现随放置位置而定: + +- 在上:广播网络的无线访问入口。与该天线配对的可在范围内读写网络。 +- 在上:广播该方块(和其他相接的)包含的,以供其他网络[自动合成](../nodeworks-mechanics/autocrafting.md)使用。 +- 在上:将该箱广播为无线出货口。另一网络中与之配对的会将箱中资源直接拉至该网络。 + + + + + + 两个处理存储器都被广播 + + + 向便携式物品栏终端广播 + + + 向配对的导入箱发送物品 + + + +## 配对 + +1. 打开广播天线的GUI。 +2. 向顶部槽位放入。 +3. 拿出晶体,该晶体便已被配对。 + +## 范围 + +默认情况下,广播天线的范围为128格。可用升级。 + +## 配方 + + \ No newline at end of file diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/budding_celestine.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/budding_celestine.md new file mode 100644 index 000000000000..13ccaf9cdfe9 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/budding_celestine.md @@ -0,0 +1,36 @@ +--- +navigation: + parent: items-blocks/index.md + icon: budding_celestine + title: 天青石母岩 +categories: + - misc +description: 表面上会长出天青石芽 +item_ids: +- nodeworks:budding_celestine +- nodeworks:celestine_cluster +- nodeworks:large_celestine_bud +- nodeworks:medium_celestine_bud +- nodeworks:small_celestine_bud +--- + +# 天青石母岩 + + + + + + +## 获取天青石母岩 + +若想要集中培育天青石母岩,可用附有精准采集的镐挖掘。母岩上会不断长出天青石芽。 + +## 出现地点 + + + + + + + +天青石母岩会自然出现在世界中的天青石晶洞内,这类晶洞和紫晶洞很相似。 diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/card_programmer.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/card_programmer.md new file mode 100644 index 000000000000..099b6133a193 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/card_programmer.md @@ -0,0 +1,34 @@ +--- +navigation: + parent: items-blocks/index.md + icon: card_programmer + title: 卡片编程器 +categories: + - tool +description: 用于从模板中复制[卡片](../nodeworks-mechanics/cards.md)设置 +item_ids: +- nodeworks:card_programmer +--- + +# 卡片编程器 + +卡片编程器用于从模板[卡片](../nodeworks-mechanics/cards.md)中复制设置。 + + + +## 使用方法 + +手持右击打开GUI,其中有两个槽位。 + +- **模板(左侧):**‌放入希望复制的[卡片](../nodeworks-mechanics/cards.md)(不会被消耗)。 +- **目标(右侧):**‌放入需要配置的卡片,目标的设置会变为与模板一致。 + +![](../assets/images/card_programmer_gui.png) + +还有两个切换按钮,用于控制是否复制模板的名称和频道。 + +> **注意:**‌直接放入或Shift点击进入“目标”槽位的卡片会在复制完成后立即返回你的物品栏。 + +## 配方 + + \ No newline at end of file diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/celestine_antenna_array.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/celestine_antenna_array.md new file mode 100644 index 000000000000..c56e916da901 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/celestine_antenna_array.md @@ -0,0 +1,21 @@ +--- +navigation: + parent: items-blocks/index.md + icon: celestine_antenna_array + title: 天青石天线阵列 +categories: + - infrastructure +description: 的原材料 +item_ids: +- nodeworks:celestine_antenna_array +--- + +# 天青石天线阵列 + +的原材料。 + + + +## 配方 + + \ No newline at end of file diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/celestine_block.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/celestine_block.md new file mode 100644 index 000000000000..3fb584d6a0b9 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/celestine_block.md @@ -0,0 +1,21 @@ +--- +navigation: + parent: items-blocks/index.md + icon: celestine_block + title: 天青石块 +categories: + - misc +description: 天青石装饰性方块 +item_ids: +- nodeworks:celestine_block +--- + +# 天青石块 + + + +出现于[天青石晶洞](./budding_celestine.md#出现地点),或合成自。 + +## 配方 + + \ No newline at end of file diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/celestine_ore.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/celestine_ore.md new file mode 100644 index 000000000000..08ebb8f2948e --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/celestine_ore.md @@ -0,0 +1,20 @@ +--- +navigation: + parent: items-blocks/index.md + icon: celestine_ore + title: 天青石矿石 +categories: + - misc +description: 出现于洞穴,可产出天青石碎片 +item_ids: +- nodeworks:celestine_ore +--- + +# 天青石矿石 + +天青石矿石会自然生成于Y小于0的位置。 + +如需要可再生的来源,参见[天青石母岩](./budding_celestine.md)。 + + + diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/celestine_receiver_dish.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/celestine_receiver_dish.md new file mode 100644 index 000000000000..00904bbd2070 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/celestine_receiver_dish.md @@ -0,0 +1,21 @@ +--- +navigation: + parent: items-blocks/index.md + icon: celestine_receiver_dish + title: 天青石接收锅 +categories: + - infrastructure +description: 的原材料 +item_ids: +- nodeworks:celestine_receiver_dish +--- + +# 天青石接收锅 + +的原材料。 + + + +## 配方 + + \ No newline at end of file diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/celestine_shard.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/celestine_shard.md new file mode 100644 index 000000000000..46a1895ef3da --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/celestine_shard.md @@ -0,0 +1,19 @@ +--- +navigation: + parent: items-blocks/index.md + icon: celestine_shard + title: 天青石碎片 +categories: + - ingredient +description: 表面上会长出天青石芽 +item_ids: +- nodeworks:celestine_shard +--- + +# 天青石碎片 + +参见[天青石母岩](./budding_celestine.md)。 + + + +天青石碎片是节点工程网络中许多方块和物品的核心原材料。 \ No newline at end of file diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/charged_beam_catalyst.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/charged_beam_catalyst.md new file mode 100644 index 000000000000..51ae7dded2fa --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/charged_beam_catalyst.md @@ -0,0 +1,23 @@ +--- +navigation: + parent: items-blocks/index.md + icon: charged_beam_catalyst + title: 充能光束触媒 +categories: + - ingredient +description: 用于合成抓钩光束 +item_ids: +- nodeworks:charged_beam_catalyst +--- + +# 充能光束触媒 + + + + + +用于合成。 + +## 配方 + + \ No newline at end of file diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/craft_requester.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/craft_requester.md new file mode 100644 index 000000000000..4ba5b4e5832f --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/craft_requester.md @@ -0,0 +1,48 @@ +--- +navigation: + parent: items-blocks/index.md + icon: craft_requester + title: 合成请求器 +categories: + - device +description: 收到红石信号时发起自动合成作业 +item_ids: +- nodeworks:craft_requester +--- + +# 合成请求器 + +合成请求器会在收到红石信号时发起自动合成作业。需为其指定所合成物品和单次数量。 + + + + + + + + + + + 红石信号激活合成请求器,合成所指定的物品 + + + +## 使用合成请求器 + +以物品右击可设置合成目标。空手再次右击可打开GUI,其中可设置单次数量和[输出频道](./craft_requester.md#频道)。 + +有红石信号时,它会持续发起合成作业并排队,一次合成的量即为单次数量。撤走红石信号即会停止发起。 + +与按钮配合使用,可进行单次合成;与配合,则可用于自动维持库存。量表会在库存量降低和回升时自行切换信号。 + +GUI底部的状态标签能反映请求器当前的行为。鼠标悬停以查看详情。 + +## 频道 + +合成请求器GUI中的频道选择器可用于选择产物去向的频道。 + +> **注意:**‌更多信息参见[选择频道](../lua-api/channel.md#选择频道)。 + +## 配方 + + diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/crafting_cpu.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/crafting_cpu.md new file mode 100644 index 000000000000..ea0b13b97fec --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/crafting_cpu.md @@ -0,0 +1,79 @@ +--- +navigation: + parent: items-blocks/index.md + icon: crafting_core + title: 合成CPU +categories: + - autocrafting +description: 网络内自动合成系统的大脑 +item_ids: +- nodeworks:crafting_core +- nodeworks:crafting_storage +- nodeworks:substrate +- nodeworks:stabilizer +- nodeworks:co_processor +--- + +# 合成CPU + +合成CPU是自动合成系统的大脑。它会从[存储器](./storage_blocks.md)(本地网络,广播子网的处理集)中读取配方,从网络内抽取原材料,执行合成,并将产物送回。具体如何*使用*搭建完成的CPU,参见[自动合成](../nodeworks-mechanics/autocrafting.md)。 + +## 搭建CPU + +CPU永远都只包含一个。不过仅靠核心还不够,CPU还需要至少有一个(即“缓存单元”)与之相贴。没有缓存器的CPU无法在合成中途暂存资源,也因此不会亮起。 + +CPU的放置相对自由。不需要扳手,也没有外形要求。放下核心,在任意一面放下一个缓存器,将核心接到节点上,它就会亮起。 + + + + + 会产热,应当配2个冷却器 + + + +> **提示:**‌开始时,建议合成CPU中放置两个相连,以确保**效率**至少为100%。 + +## 扩展CPU + +其他CPU方块可增大或加快CPU: + +- (**合成缓存器**):至少一个。缓存器越多,运行合成时容纳原材料和中间产物的空间就越多。每个缓存器产生**2点热量**。 +- (**合成协处理器**):每个追加一条并行合成上限。每个协处理器产生**3点热量**。 +- (**合成冷却器**):抵消热量。孤立的冷却器产出**1点制冷**,每有一个冷却器与之相贴则**额外产出1点**。周围有四个冷却器相贴的冷却器能产出**5点制冷**,可见冷却器集群要远强于孤立的冷却器。 +- (**合成载件**):速度拉杆。缓存器或协处理器每有一面与载件相贴,均能为CPU增速**10%**,上限为**4倍(400%)速度**。与核心、冷却器、其他载件相贴的面没有效用,可见在缓存器和协处理器之间放置载件效果最佳。 + +这些组件只需与核心相贴或通过已属于CPU的方块与核心相连。无需扳手交互,也无需GUI操作。放下方块,CPU就将在下一刻更新。 + +### 热量、制冷、速度 + +所有缓存器和协处理器都会产热,冷却器的任务就是从相贴的热源中吸走热量。组件的排布方式和数量都很重要: + +- 热源之间**每有一面**相贴**追加1点热量**,原有的热量不变。紧凑的缓存器和协处理器长方体产的热要远高于分散放置。 +- 每个冷却器集群产出一个总制冷值(孤立为1点,集群后点数更多)。该制冷值**在与冷却器相贴的各热源间均分**。夹在两个缓存器之间的冷却器会向两者各输出一半的制冷效力,而处在六个热源之中的冷却器几乎无法充分冷却任意一个。 +- CPU的总制冷无法抵消总热量时,其速度会成比例地**下降**,最低可至**25%**。CPU不会停止运作,只会不停地挣扎。 +- 冷却器只能抵消热量,它不会将速度增加到100%以上。唯一能做到这点的方块是载件,最高可为4×。 + + + + + + + + + + + + +> **提示:**‌方块过热时会有相应的视觉效果——颜色发黄/发橙/发红,冒烟。 + +实用建议:不要把大量的缓存器和协处理器堆到一起再在周围放冷却器。可以把冷却器搭成专门的墙面或鳍板(让冷却器相贴),再安放热源,尽量保证每个冷却器只与一到两个热源相贴。最后在剩下的缓存器/协处理器面上放置载件增速。 + +## 配方 + + + + + + + + diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/device_frame.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/device_frame.md new file mode 100644 index 000000000000..3300ef584e7d --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/device_frame.md @@ -0,0 +1,21 @@ +--- +navigation: + parent: items-blocks/index.md + icon: device_frame + title: 设备框架 +categories: + - device +description: 设备的主要原材料 +item_ids: +- nodeworks:device_frame +--- + +# 设备框架 + +所有[设备](../nodeworks-mechanics/devices.md)的原材料。 + + + +## 配方 + + \ No newline at end of file diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/diagnostic_tool.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/diagnostic_tool.md new file mode 100644 index 000000000000..5a725ba5e4af --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/diagnostic_tool.md @@ -0,0 +1,47 @@ +--- +navigation: + parent: items-blocks/index.md + icon: diagnostic_tool + title: 诊断工具 +categories: + - tool +description: 考察网络拓扑、CPU、脚本,以及最近的错误信息 +item_ids: +- nodeworks:diagnostic_tool +--- + +# 诊断工具 + +手持式节点工程网络考察诊断工具。右击网络中的任意方块可打开面板,其中会总结网络的组成和当前状态。 + + + +## 使用方法 + +右击目标网络的任意网络方块,、天线、存储器均可。也可点击[合成CPU](crafting_cpu.md)多方块(核心、缓存器、冷却器、载件、协处理器)的任意一处;工具会自行搜寻核心。 + +若所点击的方块不属于任何网络,工具便会通过叠加层消息告知,且不会打开面板。 + +## 显示内容 + +诊断面板会汇总网络公开的所有信息: + +- **拓扑**。网络中的所有方块及其位置、类型,和各方块详情。会列出各面的卡片与相邻的目标方块。 +- **网络身份**。控制器的名称和颜色,附带其红石模式、handler重试上限、区块加载启用与否的概览。 +- **CPU**。网络中的所有,其当前的合成作业(若有)、缓存使用、效率,以及多方块是否正常形成。 +- **终端**。网络中的所有及其脚本列、自动运行标记、运行状态,以及各运行中脚本注册的[处理集](recipe_sets.md#处理集)handler。 +- **可合成物品**。网络能自动合成的物品的完整列表,汇总自所有。 +- **近期报错**。最近10次来自网络内终端的错误信息,附带错误发生到现在的时间(刻)。 + +此视图只读。你在其中如何点击都不会影响网络,它只是为厘清位置和错误而存在。 + +## 何时使用 + +- 合成失败,不想前去周围也希望可以查看错误。 +- 你刚接手一个大型复杂网络,需要一份地图。 +- 你在尝试找出为何某配方无法自动合成;可合成物品列表会详尽显示网络实际知晓制作方式的物品。 +- 脚本好像跑不通;终端面板会显示其运行状态和注册的handler,无需手动查看每一个终端。 + +## 配方 + + diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/dimension_range_upgrade.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/dimension_range_upgrade.md new file mode 100644 index 000000000000..da334a4a2f98 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/dimension_range_upgrade.md @@ -0,0 +1,21 @@ +--- +navigation: + parent: items-blocks/index.md + icon: dimension_range_upgrade + title: 维度范围升级 +categories: + - infrastructure +description: 升级的范围 +item_ids: +- nodeworks:dimension_range_upgrade +--- + +# 维度范围升级 + +将的范围升级至可在同维度内任意一处访问。 + + + +## 配方 + + \ No newline at end of file diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/export_chest.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/export_chest.md new file mode 100644 index 000000000000..6d3b92221dde --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/export_chest.md @@ -0,0 +1,47 @@ +--- +navigation: + parent: items-blocks/index.md + icon: export_chest + title: 导出箱 +categories: + - infrastructure +description: 从网络存储中抽取物品保存于自身 +item_ids: +- nodeworks:export_chest +--- + +# 导出箱 + +有9个槽位的箱子,能从[网络存储](../nodeworks-mechanics/network-storage.md)中自动抽取物品缓存于自身。 + + + + + +## 筛选器 + +箱子的GUI接受一系列筛选规则,语法与所用的一致。所有匹配任意规则的物品都可被抽入箱中。筛选器为空时导出箱不会抽取,以免新放置的导出箱立即抽空网络。 + +## 输出面 + +在GUI中可挑选一个自动输出面,缓存的资源会被送入该面方向的容器。适合为漏斗、熔炉、机器供货而无需脚本。留空此设置相当于仅手动拿取。 + +## 频道 + +设置频道后,导出箱便只会抽取该频道下的存储卡。默认设置会从网络中的所有存储卡抽取。参见[选择频道](../lua-api/channel.md#选择频道)。 + +## 红石 + +GUI的红石设置限制了导出箱运作与否: + +- **高**:有信号时运作。 +- **低**:无信号时运作。 +- **忽略**:与红石信号无关。 + +## 无线 + +在导出箱上方放置,并将其与其他网络的配对。箱子抽出的物品会直接送至接收网络的网络存储。 + +## 配方 + + diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/grapple_beam.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/grapple_beam.md new file mode 100644 index 000000000000..51ba40b56a9c --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/grapple_beam.md @@ -0,0 +1,25 @@ +--- +navigation: + parent: items-blocks/index.md + icon: grapple_beam + title: 抓钩光束 +categories: + - tool +description: 天青石装饰性方块 +item_ids: +- nodeworks:grapple_beam +--- + +# 抓钩光束 + + + + + +可以用于把你自己扔来扔去 :) + +若你处于单人游戏,或是服务端允许,则也可用它抓取生物。 + +## 配方 + + \ No newline at end of file diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/import_chest.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/import_chest.md new file mode 100644 index 000000000000..77b1310d6b80 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/import_chest.md @@ -0,0 +1,49 @@ +--- +navigation: + parent: items-blocks/index.md + icon: import_chest + title: 导入箱 +categories: + - infrastructure +description: 将自身内容物送入网络存储 +item_ids: +- nodeworks:import_chest +--- + +# 导入箱 + +有9个槽位的箱子,会自动将自身内容物送入[网络存储](../nodeworks-mechanics/network-storage.md)。可以手动放入、漏斗送入、用其他模组的管道运入,无论如何,导入箱都会将内容物清空到网络中。 + + + + + +不被接受的物品(筛选限制、空间不足等)会留在箱中,方便查看为何会堵塞。 + +## 频道 + +在GUI中设置频道后,导入箱便只会向该频道下的存储卡发送。默认设置会向网络中的所有存储卡发送。参见[选择频道](../lua-api/channel.md#选择频道)。 + +## 轮询 + +在GUI中启用轮询后,导入箱会在多个目的存储卡间均分资源,而不会首先填充第一个。想要输入在多个存储目标间保持负载均衡时很好用。 + +## 刻间隔 + +GUI还会显示箱子尝试输入的间隔,默认为每秒一次。缩短可让输入更迅速,代价是网络负载上升;延长后网络空闲时间会增多。 + +## 红石 + +GUI的红石设置限制了导入箱运作与否: + +- **高**:有信号时运作。 +- **低**:无信号时运作。 +- **忽略**:与红石信号无关。 + +## 无线 + +在导入箱上放置,并将其与其他网络上方的配对。送入广播导出箱的物品会抵达本网络的导入箱,并随后和其他输入一样进入本地网络存储。 + +## 配方 + + diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/index.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/index.md new file mode 100644 index 000000000000..2f42e25f9955 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/index.md @@ -0,0 +1,36 @@ +--- +navigation: + title: 节点工程物品/方块 + position: 20 +--- + +# 物品/方块 + +## 原材料和杂项方块 + + + + +## 工具 + + + +## 卡片 + + + +## 基础设施 + + + +## 终端 + + + +## 设备 + + + +## 自动合成 + + diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/inventory_terminal.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/inventory_terminal.md new file mode 100644 index 000000000000..2d95e62005fc --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/inventory_terminal.md @@ -0,0 +1,46 @@ +--- +navigation: + parent: items-blocks/index.md + icon: inventory_terminal + title: 物品栏终端 +categories: + - terminal +description: "[网络存储](../nodeworks-mechanics/network-storage.md)的视窗" +item_ids: +- nodeworks:inventory_terminal +--- + +# 物品栏终端 + +物品栏终端是[网络存储](../nodeworks-mechanics/network-storage.md)的视窗。 + + + +## 浏览网络 + +![](../assets/images/inventory_terminal_gui_expanded.png) + +- 左击拿取一组 +- 右击拿取半组 +- 双击将所有同种物品汇至鼠标 +- 向方格放下鼠标上的物品堆叠可向[网络存储](../nodeworks-mechanics/network-storage.md)输入 +- 鼠标上有物品堆叠时对方格右击可输入一个 +- 按住`Alt`以显示网络中可自动合成的物品 + +左侧按钮为: + +- 改变布局 +- 排序方式 +- 筛选方式(库存、配方、两者) +- 资源类型(物品、流体、两者) +- 切换自动聚焦搜索框与否 + +中央为可收起的合成方格,方格旁的按钮为: + +- 自动从网络中抽取 +- 在方格中均分原材料 +- 将方格中的原材料送至网络存储 + +## 配方 + + \ No newline at end of file diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/io_card.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/io_card.md new file mode 100644 index 000000000000..fe05129c1258 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/io_card.md @@ -0,0 +1,45 @@ +--- +navigation: + parent: items-blocks/index.md + icon: io_card + title: IO卡 +categories: + - card +description: 用于通过脚本读写物品/流体容器 +item_ids: +- nodeworks:io_card +--- + +# IO卡 + +IO卡可让网络按需读写相邻方块的物品栏。安装IO卡后,脚本可查询方块的内容物,且能向其移入/从中移除物品和流体。 + + + +## 安装 + +IO卡需安装于的某一面。右击朝向需控制方块的节点面,将IO卡放入9个槽位中的任意一个。卡片的行为会应用于*该面*,也即同一节点可有多张IO卡在不同面控制不同相邻方块。 + +![](../assets/images/node_gui.png) + +## 功能 + +配有IO卡的方块会作为可被脚本访问的物品栏在网络中显示: + +- `card:find(filter)`返回相应内容物的[ItemsHandle](../lua-api/items-handle.md)。 +- `card:insert(items)`/`card:tryInsert(items)`尝试向其移入物品。 +- `card:count(filter)`统计匹配的物品(和流体,以mB计)。 + +和不同,IO卡对应方块**不是**[网络存储](../nodeworks-mechanics/network-storage.md)的成员。脚本需要显式对IO卡方块送入/取出物品,网络无法通过`network:find`查看这些方块的内容物,也不会列出它们。 + +## 频道 + +IO卡的GUI中有一个频道选择器。有关频道限制脚本与预设能否访问此卡片的详情,参见[选择频道](../lua-api/channel.md#选择频道)。 + +## 脚本 + +IO卡handle中可用方法的完整列表参见[CardHandle参考](../lua-api/card-handle.md#物品栏卡)。 + +## 配方 + + \ No newline at end of file diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/link_crystal.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/link_crystal.md new file mode 100644 index 000000000000..6d0e00b35492 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/link_crystal.md @@ -0,0 +1,25 @@ +--- +navigation: + parent: items-blocks/index.md + icon: link_crystal + title: 链接晶体 +categories: + - infrastructure +description: 用于链接广播天线 +item_ids: +- nodeworks:link_crystal +--- + +# 链接晶体 + +用于为配对。 + + + +## 使用方法 + +见[广播天线](./broadcast_antenna.md#配对)页面中的配对步骤。 + +## 配方 + + \ No newline at end of file diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/milky_soul_ball.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/milky_soul_ball.md new file mode 100644 index 000000000000..217976db8915 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/milky_soul_ball.md @@ -0,0 +1,25 @@ +--- +navigation: + parent: items-blocks/index.md + icon: milky_soul_ball + title: 奶液灵魂球 +categories: + - ingredient +description: 内有一独特灵魂,可用于合成 +item_ids: +- nodeworks:milky_soul_ball +--- + +# 奶液灵魂球 + +浸着奶液的灵魂,很是独特,可以直接用于合成。也可以朝着你最大的敌人丢过去,给予它凋零效果。:3 + + + +## 如何制作 + +手持右击方块。 + +## 配方 + + \ No newline at end of file diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/multi_dimension_range_upgrade.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/multi_dimension_range_upgrade.md new file mode 100644 index 000000000000..02977cef9828 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/multi_dimension_range_upgrade.md @@ -0,0 +1,21 @@ +--- +navigation: + parent: items-blocks/index.md + icon: multi_dimension_range_upgrade + title: 多维度范围升级 +categories: + - infrastructure +description: 升级的范围 +item_ids: +- nodeworks:multi_dimension_range_upgrade +--- + +# 多维度范围升级 + +将的范围升级至可在所有维度访问。 + + + +## 配方 + + \ No newline at end of file diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/network_controller.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/network_controller.md new file mode 100644 index 000000000000..b1b39b9f0a34 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/network_controller.md @@ -0,0 +1,38 @@ +--- +navigation: + parent: items-blocks/index.md + icon: network_controller + title: 网络控制器 +categories: + - infrastructure +description: 网络的心脏,每个网络都要有一个 +item_ids: +- nodeworks:network_controller +--- + +# 网络控制器 + +每一个节点工程网络都仅需要一个控制器。若没有控制器,网络中的[管道](pipe.md)和[节点](node.md)便都不会运作。 + + + + + + +放下控制器,从它所在位置延出管道,与管道相连的方块均会加入网络。 + +## 身份 + +在GUI中可为控制器命名和选色。名称仅作装饰,网络中的节点会和控制器保持同色,以便分辨距离较近的多个网络。 + +## 区块加载 + +GUI中可以切换区块加载与否,即是否强制加载网络占据的所有区块。适合给出远门时还要维持运作的自动合成设施使用。 + +## 每网络一个 + +连接到同一条管道的两个控制器会互相冲突,导致网络停机,直至去除其中一台才能恢复。 + +## 配方 + + diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/network_wrench.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/network_wrench.md new file mode 100644 index 000000000000..1e92048112bc --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/network_wrench.md @@ -0,0 +1,47 @@ +--- +navigation: + parent: items-blocks/index.md + icon: network_wrench + title: 网络扳手 +description: 切换管道连接与否,链接焦准节点 +item_ids: +- nodeworks:network_wrench +--- + +# 网络扳手 + +网络扳手是在不破坏方块时调整网络形状的工具。它能切换某段管道连接与否,也能远距链接。 + + + +## 切换管道连接 + +Shift+右击两个网络方块相连的面可切换其中有无管道连通。方块本身没有变化,只是网络会将该处视作没有管道。 + +这是扳手最常用的功能。下面是常见的使用场景: + +- 让相邻但不合并 +- 通过断开一条管道拆分网络 +- 阻止或设备与附近网络产生误连接 + +在同一处重复此操作可恢复连接。 + +## 链接焦准节点 + +是例外。扳手可将两个相距较远的焦准节点链接起来: + +1. Shift+右击焦准节点未接触网络方块的一面,以将其设为预定来源。选中的方块会以边框高亮。 +2. 右击另一个焦准节点以切换两者之间连接存在与否。 + +成功链接后对焦准节点的选择依然保留,可借此将多个焦准节点链接到一处,期间不需要重新选择。 + +### 规则 + +- 两焦准节点必须与选择位置位于**同一维度**。 +- 两方必须属于同一个**网络控制器**。扳手不会连通两个网络。 + +扳手会通过聊天栏消息告知哪一条规则未满足。 + +## 配方 + + diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/node.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/node.md new file mode 100644 index 000000000000..98abb10ea2f1 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/node.md @@ -0,0 +1,56 @@ +--- +navigation: + parent: items-blocks/index.md + icon: node + title: 节点 +categories: + - infrastructure +description: 管道网络中容纳和使用卡片的主体 +item_ids: +- nodeworks:node +- nodeworks:focus_node +--- + +# 节点 + +节点是能保有[卡片](../nodeworks-mechanics/cards.md)的方块。网络的连接通过[管道](pipe.md)传递,如需在某处通过卡片与相邻的方块交互,将该处的管道替换为节点即可。 + + + +## 面 + +节点每一面的功能都受相邻方块的影响。朝向其他网络方块的面会变为管道连接,同时禁用该面的卡片槽。朝向常规方块的面则可容纳卡片,并会以该方块为交互目标。 + +## 打开GUI + +右击非管道面以打开卡片方格。Shift+右击可打开*背侧*面,在背侧面被阻挡时很好用。管道面无法打开,界面中这些面的标签也会变暗。 + +![](../assets/images/node_gui.png) + +## 卡片 + +向设备面9个槽位中的任意一个放入一张卡片,可赋予该面相应能力: + +- :可让网络向相邻方块送入/从中移出物品。 +- :将相邻方块的物品栏标记为网络存储成员。 +- :从该面读取和向该面发出红石信号。 +- :读取所朝向方块的状态。 + +同一面中多张卡的能力可叠加。同时放有IO卡和红石卡的面能在该面上移动物品**和**发出红石信号。 + +## 焦准节点 + + + + + + +是为长距连接设计的变种节点。使用为两个焦准节点配对,网络即会将它们视作相连,即便中间没有管道。很适合用来连通管线缺口和跳过机器集群。 + +焦准节点六面的行为与常规的节点一致:同样的管道/设备/临空面交互模式,同样的卡片槽,同样的与相邻管道自动连接。扳手配对得到的链接叠加于相邻面功能之上,两者互不干扰。 + +## 配方 + + + + diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/observer_card.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/observer_card.md new file mode 100644 index 000000000000..97a5418ff842 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/observer_card.md @@ -0,0 +1,37 @@ +--- +navigation: + parent: items-blocks/index.md + icon: observer_card + title: 侦测卡 +categories: + - card +description: 读取节点面所朝方块的ID、属性、状态改变事件 +item_ids: +- nodeworks:observer_card +--- + +# 侦测卡 + +读取卡片所安装面方向上的方块。公开方块的ID,方块的所有状态属性(`age`、`facing`、`waterlogged`、`lit`……),以及一个状态改变回调函数。脚本可用回调函数在方块变化至特殊状态时立即作出反应。 + + + +## 用途 + +受生长状态限制的农场是最主要的使用场景。连接至原版侦测器的活塞会在每一次生长阶段变化时伸出一次,也即会直接破坏小型晶芽得到1个碎片,而不会等候长成晶簇的4个碎片。脚本可以通过侦测卡直接读取生长阶段,并只在方块进入最后阶段时向破坏器发出脉冲。 + +它也是读取非红石信号状态的恰当工具:活板门开关、门状态、蜂箱蜂蜜水平、滴水石锥填充、阳光探测器读数、甜浆果/海带/甘蔗生长状态、方块下方冰/雪的形成,以至于任何具有可比较`BlockState`属性的事物。 + +## 安装与脚本 + +安装方式与相同。详细步骤参见[IO卡安装](./io_card.md#安装)。侦测卡会读取*所处面*前方的方块。 + +所公开方法的详情参见[侦测卡脚本API](../lua-api/card-handle.md#侦测卡)。 + +## 频道 + +侦测卡的GUI中有一个频道选择器。有关频道限制脚本能否访问此卡片的详情,参见[选择频道](../lua-api/channel.md#选择频道)。 + +## 配方 + + diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/pipe.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/pipe.md new file mode 100644 index 000000000000..ff368687880f --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/pipe.md @@ -0,0 +1,47 @@ +--- +navigation: + parent: items-blocks/index.md + icon: pipe + title: 真空管道 +categories: + - infrastructure +description: 所有网络都需要的建筑方块 +item_ids: +- nodeworks:pipe +- nodeworks:covered_pipe +--- + +# 真空管道 + +节点工程网络的导线。管道能传输物品、信号,也能在网络的所有方块间进行路由。 + + + + + + +将管道相邻放置(或相邻任意网络方块放置)后,两者会自动连接。 + +## 隐藏管道 + +### 覆层管道 + +在工作台中央放一个方块,再在周围放入8根真空管道,即可制成覆层管道,将管道本身隐藏起来。 + + + + + + +### 焦准节点 + +可以借助穿过玻璃,也相当于能穿透墙壁。 + + + + + + +## 配方 + + diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/placer.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/placer.md new file mode 100644 index 000000000000..f2d25910d10a --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/placer.md @@ -0,0 +1,45 @@ +--- +navigation: + parent: items-blocks/index.md + icon: placer + title: 放置器 +categories: + - device +description: 网络范围内共享的放置器 +item_ids: +- nodeworks:placer +--- + +# 放置器 + +放置器能在自身前方放置具有方块形态的物品。脚本通过物品ID选择所用物品;也可通过传入[ItemsHandle](../lua-api/items-handle.md),匹配的物品会从[网络存储](../nodeworks-mechanics/network-storage.md)中抽出并放置。此操作是同步的,脚本会在请求的同一刻得到`true`/`false`的返回值。 + + + +## 放置 + +破坏器的前部会朝向放置时的视线方向(和放置活塞与发射器一致)。放置器会直接在该面前部放置方块。仅具有方块形态的物品有效,工具、食物、杂项物品均会导致放置调用失败。 + +## 方块筛选器 + +放置器的GUI中有一个筛选器,用于限定应放置哪种方块。匹配的物品会在每次放置器触发时从[网络存储](../nodeworks-mechanics/network-storage.md)中抽取。留空可让放置器停止在空闲状态,直至脚本请求。 + +## 红石 + +GUI的红石设定可控制放置器的运作条件: + +- **高**:有信号时运作。 +- **低**:无信号时运作。 +- **忽略**:与红石信号无关。放置器只会在脚本调用时触发。 + +## 频道 + +放置器GUI中有名称和频道的设定器。有关频道限制脚本能否访问设备的详情,参见[选择频道](../lua-api/channel.md#选择频道)。 + +## 脚本 + +脚本API参见[PlacerHandle](../lua-api/placer-handle.md)页面。 + +## 配方 + + diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/portable_inventory_terminal.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/portable_inventory_terminal.md new file mode 100644 index 000000000000..8fbb67de5d09 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/portable_inventory_terminal.md @@ -0,0 +1,50 @@ +--- +navigation: + parent: items-blocks/index.md + icon: portable_inventory_terminal + title: 便携式物品栏终端 +categories: + - tool +description: 所链接网络存储的便携式视窗 +item_ids: +- nodeworks:portable_inventory_terminal +--- + +# 便携式物品栏终端 + +手持式的。能通过配对于上方无线连接。 + + + +## 链接至网络 + +便携式物品栏终端与网络建立链接需要三样组件: + + + + + +- 目标网络中的 +- 该控制器上方的 +- 与该天线配对的*(不是和处理存储器配对)* + +



+ + +准备好经过配对的链接晶体,放入便携式物品栏终端右上方的槽位即可。 + +链接建立后,便携式终端的物品纹理会亮起网络的颜色。 + +
+ +## 范围 + +更多有关广播范围的信息参见页面。 + +## 使用终端 + +GUI中的所有内容与完全一致。 + +## 配方 + + \ No newline at end of file diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/processing_handler.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/processing_handler.md new file mode 100644 index 000000000000..0712c598f9f1 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/processing_handler.md @@ -0,0 +1,59 @@ +--- +navigation: + parent: items-blocks/index.md + icon: processing_handler + title: 处理操作器 +categories: + - autocrafting +description: 使用微型网络注册一个处理集handler +item_ids: +- nodeworks:processing_handler +--- + +# 处理操作器 + +适用于[处理集](./recipe_sets.md#处理集)配方的方块型handler。放置处理操作器,接入网络,再为其绑定配方,[合成CPU](./crafting_cpu.md)即会将配方的原材料路由到机器中,并将产物拉回网络,整个过程无需Lua脚本参与。 + + + + + + 指向熔炉顶面的蓝色频道存储卡 + + + 指向熔炉底面的红色频道存储卡 + + + +## 操作器的两个面 + +操作器区分前面和后面: + +- **后面**:接入包含的父网络。 +- **前面**:接入其自身组建,由管道、节点、存储卡组成的**微型网络**操作器相当于该网络的控制器,所以该网络无需(也不允许)加入。 + +将操作器的后面接回主网络,再从前面为实际处理配方的机器接线。 + +## 绑定配方 + +右击操作器打开GUI,在其中选择父网络处理存储器内的一张。处理集中的每一种原材料都各居一行,且各配有频道颜色,外加一行用于配方输出。 + +## 频道路由 + +操作器使用频道决定微型网络中哪些收到哪些物品: + +- **输入频道**(每种原材料各一个,默认蓝色)。CPU开始合成作业时,各项输入会被送至微型网络中频道匹配该原材料颜色的存储卡。 + - *若需要借助表达式、物品数据、可堆叠性等自定义路由:输入物品会遵守存储卡的筛选器* +- **输出频道**(共用同一个颜色,默认红色)。操作器会监测微型网络中在此频道下的存储卡,并将产物抽出送回父网络。 + +对于上方的熔炉示例场景:熔炉顶面的蓝色存储卡接收待烧炼的输入,熔炉进行加工,底部的红色存储卡则抽出产物。 + +若机器需要不同原材料进入不同槽位,也可让不同原材料使用不同的颜色。比如要求输入进入某一面,燃料进入另一面时。 + +## 与脚本handler对比 + +处理操作器是[`network:handle(...)`](../lua-api/network.md#handle)的无脚本版本。若配方形同“送原材料出产物”,则使用操作器;如需处理自定义时序或多步流程,请使用脚本handler。 + +## 配方 + + diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/receiver_antenna.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/receiver_antenna.md new file mode 100644 index 000000000000..152fc21e9540 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/receiver_antenna.md @@ -0,0 +1,34 @@ +--- +navigation: + parent: items-blocks/index.md + icon: receiver_antenna + title: 接收天线 +categories: + - infrastructure +description: 连接至已广播的处理存储器和导出箱 +item_ids: +- nodeworks:receiver_antenna +--- + +# 接收天线 + +用于将网络连接至其他[子网](../nodeworks-mechanics/subnets.md)。很适合用来把[处理集](./recipe_sets.md#处理集)配方拆分到多个网络中去,同时保留[自动合成](../nodeworks-mechanics/autocrafting.md)功能。 + + + + + + 从其他网络处接收处理集配方 + + + 从正在广播的导出箱处接收物品 + + + +## 无线接收物品 + +在上方放置接收天线,再与其他网络中上方的配对。送入正广播的导出箱的物品会抵达天线所在的导入箱,也即,在两个网络间无线传递物品。 + +## 配方 + + \ No newline at end of file diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/recipe_sets.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/recipe_sets.md new file mode 100644 index 000000000000..e8bc61c7991b --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/recipe_sets.md @@ -0,0 +1,76 @@ +--- +navigation: + parent: items-blocks/index.md + icon: instruction_set + title: 配方集 +categories: + - autocrafting +description: 存储[自动合成](../nodeworks-mechanics/autocrafting.md)需要的合成配方 +item_ids: +- nodeworks:instruction_set +- nodeworks:processing_set +--- + +# 配方集 + +配方集是用于存储[自动合成](../nodeworks-mechanics/autocrafting.md)所需配方的物品,分为两种。 + +配方集是模板物品,能存储单个配方供[自动合成](../nodeworks-mechanics/autocrafting.md)参考执行。配方集需在GUI中先行编写,再插入相应的[存储器](./storage_blocks.md)中去。 + +共有两种配方集,对应两类配方: + +- **指令集:**‌原版的3x3合成配方(有序、无序) +- **处理集:**‌所有其他配方(烧炼、模组机器、多输出加工流程、所有会超时的流程) + +--- + +## 指令集 + + + +3x3的合成模板。所有可在原版工作台中执行的配方均可。 + +### 创建配方 + +右击打开。拿起物品点击虚槽位留下虚影(无需消耗物品),点击空槽位可清除。产物槽会在输入匹配已知合成配方时自动填充。**清除全部**会重置方格。 + +GUI中还有一个**标签替换**切换按钮。启用时(默认),配方会接受与虚影在同一标签下的任意物品,所有标记为橡木木板的箱子也会接受白桦木板、云杉木板,或者其他任意在`#minecraft:planks`下的物品。禁用可限制为精确匹配物品ID。 + +> **提示:**‌JEI的‌**(+)**‌配方转移按钮在此GUI中有效,可以先在JEI中挑选合成配方,再点击(+)一次性填充。 + +### 部署 + +将编写完毕的指令集放入。相邻的指令集会形成集群。只要集群中*有一个*方块在网络中,集群内的其他指令集便都对CPU可见。 + +--- + +## 处理集 + + + +形式自由的配方,最多可有9个输入和3个输出,以及可选的每次合成超时时限。所有3×3方格无法处理的都能用处理集(烧炼、高炉烧炼、模组机器、多输出加工流程,或任意‌*“输出前需等待N刻”*‌的配方)。 + +### 创建配方 + +右击打开。GUI中有: + +- **输入方格**:(3×3)虚槽位,接受任意输出,位置随意。 +- **输出列**:(3个槽位)虚槽位,接受输出。 +- **超时字段**:0–999刻(0 = 无超时)。`+`可`-`按钮的调整步长为20,Shift点击的步长为100。 +- **串行切换**:启用时,CPU不会在运行此配方时重复并行运行。 +- **清除全部**:重置所有设置。 + +槽位内资源数量可用滚轮滚动调整(向上滚动+1,向下-1,在数量为1时向下滚动则清除)。 + +> **提示:**‌JEI的‌**(+)**‌也在此有效,且*普遍*有效。只要是JEI知晓的配方类别(烧炼/高炉烧炼/模组加工过程)均可。 + +### 部署 + +将编写完毕的处理集放入。和指令存储器类似,相邻的处理存储器也会形成集群。CPU会对实际执行配方的外部机器进行调度。 + +## 配方 + + + + + \ No newline at end of file diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/redstone_card.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/redstone_card.md new file mode 100644 index 000000000000..bc019c40b3fe --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/redstone_card.md @@ -0,0 +1,31 @@ +--- +navigation: + parent: items-blocks/index.md + icon: redstone_card + title: 红石卡 +categories: + - card +description: 读写所安装节点面处的红石信号 +item_ids: +- nodeworks:redstone_card +--- + +# 红石卡 + +在所安装的节点面处读写红石信号。 + + + +## 安装与脚本 + +安装方式与相同。详细步骤参见[IO卡安装](./io_card.md#安装)。红石卡会读写*所处面*的红石信号。 + +参见[红石卡脚本API](../lua-api/card-handle.md#红石卡),它与其他卡片的API有所不同。 + +## 频道 + +红石卡的GUI中有一个频道选择器。有关频道限制脚本能否访问此卡片的详情,参见[选择频道](../lua-api/channel.md#选择频道)。 + +## 配方 + + \ No newline at end of file diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/scripting_terminal.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/scripting_terminal.md new file mode 100644 index 000000000000..c753d48dbd9e --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/scripting_terminal.md @@ -0,0 +1,50 @@ +--- +navigation: + parent: items-blocks/index.md + icon: terminal + title: 脚本终端 +categories: + - terminal +description: 编写和运行控制网络所用Lua脚本的地方 +item_ids: +- nodeworks:terminal +--- + +# 脚本终端 + +脚本终端是编写和运行控制网络所用Lua脚本的地方。 + + + +## 打开编辑器 + +右击终端可打开。编辑器界面分为三个面板: + +- **侧边栏**,列出网络中的所有卡片和变量。点击可在光标处插入一行`network:get("…")`。 +- **脚本标签页**,`main`和所有你创建的模块。`main`会在点击开始时运行,其他标签页需通过[`require(name)`](../lua-api/index.md)加载。 +- **输出面板**,来自`print(…)`和脚本错误的输出。 + - 也可点击左侧的箭头以收起/展开该面板,或拖动分隔栏以调整面板尺寸。 + +![](../assets/images/terminal_gui.png) + +## 运行脚本 + +(所有脚本的功能——网络查询、合成、scheduler回调函数、变量等——参见[脚本API](../lua-api/index.md)参考。) + +点击开始可加载并运行当前的`main`标签页。除非通过注册回调函数持续运行,否则脚本会在`main`完成后退出。点击停止可终止脚本。 + +### 自动运行 + +启用编辑器中的自动运行可在终端加载时自动启动脚本。终端只会在所处区块被加载时加载,可见自动运行**并非**“服务器在线时不断运行”。需要玩家在区块范围内才能保证加载;或需要网络的启用区块加载,以便附近无人时保持加载。 + +![](../assets/images/autorun.png) + +### 红石 + +向终端发送红石脉冲可切换脚本运行与否。若脚本已停止,则脉冲启动;若已在运行中,则脉冲停止。所有上升沿都有效——可以是按下按钮,踩下压力板,或放置火把。 + +> 若脚本因为超出最大运行时限而被终止,红石也无法重新激活,直到你打开编辑器编辑脚本位置。此特例是为防止红石钟周期性触发有错误的脚本。 + +## 配方 + + \ No newline at end of file diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/storage_blocks.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/storage_blocks.md new file mode 100644 index 000000000000..4ce3045936d3 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/storage_blocks.md @@ -0,0 +1,45 @@ +--- +navigation: + parent: items-blocks/index.md + icon: instruction_storage + title: 配方存储器 +categories: + - autocrafting +description: 用于存储配方集,以供合成CPU查看 +item_ids: +- nodeworks:instruction_storage +- nodeworks:processing_storage +--- + +# 配方存储器 + +存储器是用于存放已编写完毕的[配方集](./recipe_sets.md)的地方,随后即可被读取供使用。右击打开,在槽位里放入配方集,这样就可以了。 + +每种配方集都有相应的存储器。 + +- **指令存储器:**‌存放指令集 +- **处理存储器:**‌存放处理集 + +## 工作方式 + +将存储器接至节点,其中存放的所有配方集便都可被CPU查看。 + + + + + **相连**的多个处理存储器会形成集群,其中的处理集均会导出 + + + +相邻放置的存储器会形成集群。只需为**其中一个**方块接线,剩下的可通过相贴的面一同加入网络。破坏连通两半的关键方块会拆分集群,每一个分别判断还能否连接至网络。方块的发光纹理会与所属网络的颜色保持一致,方便查看。 + +## 集群化配方存储器 + +若有一台配方存储器连接至网络,则与其相连的所有配方存储器会形成集群,并全部连接至网络。 + +## 配方 + + + + + \ No newline at end of file diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/storage_card.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/storage_card.md new file mode 100644 index 000000000000..fd2446ae75d9 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/storage_card.md @@ -0,0 +1,113 @@ +--- +navigation: + parent: items-blocks/index.md + icon: storage_card + title: 存储卡 +categories: + - card +description: 将相邻方块标记为网络存储的成员 +item_ids: +- nodeworks:storage_card +--- + +# 存储卡 + +存储卡会将相邻方块标记为[网络存储](../nodeworks-mechanics/network-storage.md)的成员。也即加入网络能查询、路由,物品栏终端能列出的共享式存储空间。 + + + +## 配置 + +手持**存储卡**右击可设置其优先级、频道、筛选器。 + +![](../assets/images/storage-card-gui.png) + +> **提示:**‌使用可复制卡片设置(也能复制名称和频道),可用它和模板卡片批量复制。 +> +> 也可以使用[`network:route()`](../lua-api/network.md#route)来批量设置,无需手动操作。 + +## 目标面 + +可以为存储卡设定与相邻方块的哪一面进行交互。默认情况下,卡片会和指向的面交互,通常也已足够。需要处理面敏感槽位时可专门指定,如处理熔炉(顶面输入、侧面燃料、底面输出)时。 + +## 频道 + +存储卡的GUI中有一个频道选择器。有关频道限制脚本、路由规则、预设能否访问此卡片的详情,参见[选择频道](../lua-api/channel.md#选择频道)。 + +## 筛选器 + +存储卡可配置为仅接受特定物品,以让包含多张卡片的网络正确分配。新合成的存储卡没有筛选器,会接受所有资源。 + +### 模式 + +存储卡GUI中的**模式**切换按钮会在如下规则中切换: + +- **白名单(Allow)**;仅接受匹配至少一条规则的物品 +- **黑名单(Deny)**:拒绝匹配至少一条规则的物品,允许所有其他资源通过 + +列表内没有规则时,模式无效力,但**可堆叠性**和**NBT**筛选器依然生效。仅所有三种筛选器均处于默认状态(无规则、可堆叠性任意、NBT任意)的卡片会接受所有资源。 + +### 规则 + +规则是单行的筛选器,有特定的语法,会在物品尝试通过卡片时求值: + +| 语法 | 匹配 | +| ----------------------- | ----------------------------- | +| `minecraft:cobblestone` | 精确物品ID | +| `#minecraft:logs` | 标签下所有物品 | +| `minecraft:*` | 来自该模组/命名空间的所有物品 | +| `/^.*_ore$/` | ID匹配此正则表达式的物品 | +| `*` | 所有物品/流体 | + +有三种添加规则的方法: + +1. 点击列表底部的‌**[+ 添加规则]**‌并输入。输入时自动补全功能会提示物品ID和标签。 +2. 从JEI中将物品拖放到规则列表。新增一条匹配物品ID的规则。 +3. 在脚本终端中使用[`network:route()`](../lua-api/network.md#route)为多张卡片一次性设置规则。 + +### 可堆叠性与NBT + +除去规则列表之外,存储卡还有两个切换按钮能缩小可接受资源的范围: + +- **可堆叠性**:在**任意**/**仅可堆叠**/**仅不可堆叠**间循环切换。无需单独列出每一个物品的ID,就能从大宗资源内分离出工具和盔甲。 +- **NBT**:在**任意**/**有数据**/**无数据**间循环切换。有NBT数据的物品(受损的工具,经命名的物品、附魔书)可从纯净的物品中分离出来。 + +这三项设置会相互叠加。物品仅在通过可堆叠性判断、NBT判断,且匹配于规则列表时才会被接受。设为`模式:白名单`、`可堆叠性:仅可堆叠`、`NBT:无数据`、规则`#minecraft:swords`的存储卡实际上不会接受任何东西。剑不可堆叠,因此在进行规则判断之前,可堆叠性判断就已排除了所有剑。设置时务必再三检查。 + +### 示例 + +**大宗圆石存储** + +> **模式:**‌白名单 +> +> **可堆叠性:**‌任意 +> +> **NBT:**‌任意 +> +> **规则:**‌#c:cobblestone + +接受`#c:cobblestones`标签下的所有圆石。 + +**仅不可堆叠** + +> **模式:**‌白名单 +> +> **可堆叠性:**‌仅不可堆叠 +> +> **NBT:**‌任意 +> +> **规则:**‌*留空* + +仅拒绝所有不可堆叠物品的存储卡不需要专门设定规则。 + +## 安装与脚本 + +安装方式与相同。放入面对方块的节点面即可。脚本API和IO卡完全一致(方法的完整列表参见[CardHandle](../lua-api/card-handle.md#物品栏卡))。 + +## 与IO卡的区别 + +的方块是脚本控制的物品栏,脚本必须显式对其送入/输出物品。存储卡则会将其方块*纳入*网络的共享存储空间:`network:find`能看见,能列出,合成配方也能自动从中拿取原材料。 + +## 配方 + + \ No newline at end of file diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/storage_meter.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/storage_meter.md new file mode 100644 index 000000000000..e0e9b926e3e9 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/storage_meter.md @@ -0,0 +1,62 @@ +--- +navigation: + parent: items-blocks/index.md + icon: storage_meter + title: 库存量表 +categories: + - device +description: 追踪所配置物品/流体的量 +item_ids: +- nodeworks:storage_meter +--- + +# 库存量表 + +库存量表会检测网络中的物品,并在其库存量低于所设阈值时发出红石信号。它还能发起自动合成作业以补货。 + + + + + + + + + + + 启用了自动合成,会自动为网络补充门 + + + +## 使用库存量表 + +用物品右击可设定监测目标。空手再次右击打开GUI以设置阈值和频道。 + +库存量低于所设阈值时,量表会发出一个红石信号。启用自动合成(默认)时,量表还会发起一个合成作业以进行补货。若想让信号控制发起合成,可关闭自动合成。 + +GUI底部的状态标签能反映量表当前的行为。鼠标悬停以查看详情。 + +## 子网示例 + + + + + 将烧炼为 + + + + + + + + +此例中,子网中的库存量表正检测箱子中的铁锭。存量低于阈值时,量表会向另一个网络发送红石信号,并触发使用的合成作业。 + +## 频道 + +库存量表的GUI中有一个频道选择器,可用于选择所合成物品的目的地,以及监测哪个频道下的网络存储。 + +> **注意:**‌更多信息参见[选择频道](../lua-api/channel.md#选择频道)。 + +## 配方 + + diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/user.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/user.md new file mode 100644 index 000000000000..34fe8b7088db --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/user.md @@ -0,0 +1,52 @@ +--- +navigation: + parent: items-blocks/index.md + icon: user + title: 使用器 +categories: + - device +description: 对前方方块右击使用物品 +item_ids: +- nodeworks:user +--- + +# 使用器 + +使用器会从[网络存储](../nodeworks-mechanics/network-storage.md)中抽取物品,并用其右击前方的任意方块。可用于骨粉施肥、刷扫可疑的方块、用打火石点燃TNT、流体装桶,或玩家通常用手能做到的其他事。 + + + +## 放置 + +使用器的前部会朝向放置时的视线方向(和放置活塞与发射器一致)。它会以自身面前两格内的首个非空气方块为目标,所以隔一格指向农作物的使用器仍能与农作物交互。 + +## 物品筛选器 + +使用器的GUI中有一个筛选器,用于限定应使用哪种物品。匹配的物品会在每次使用器触发时从网络存储中抽取,并在使用后归还。筛选器的语法与一致,也即ID原文、标签、通配符均可。 + +## 模式 + +使用器有两种模式: + +- **瞬时**:每次触发时右键单击。适用于单次操作,如施加骨粉或用打火石点火。 +- **保持**:按住右键直至达到释放时限。适用于需要长时间持握才能生效的工具,如刷子。保持动作会在30秒后自动释放。 + +## 红石 + +GUI的红石设定可控制使用器的运作条件: + +- **高**:有信号时运作。 +- **低**:无信号时运作。 +- **忽略**:与红石信号无关。使用器只会在脚本调用时触发。 + +## 频道 + +使用器GUI中有名称和频道的设定器。有关频道限制脚本能否访问设备的详情,参见[选择频道](../lua-api/channel.md#选择频道)。 + +## 脚本 + +脚本API参见[UserHandle](../lua-api/user-handle.md)页面。 + +## 配方 + + diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/variable.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/variable.md new file mode 100644 index 000000000000..b48dab9c2313 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/items-blocks/variable.md @@ -0,0 +1,50 @@ +--- +navigation: + parent: items-blocks/index.md + icon: variable + title: 变量器 +categories: + - device +description: 网络范围内共享的变量 +item_ids: +- nodeworks:variable +--- + +# 变量器 + +变量器用于容纳整个网络共享的值。 + + + +## 配置 + +将变量器接至网络后,可选择其**类型**,并为其**命名**。这两者在中寻找变量器时都非常有用。 + +![](../assets/images/variable_gui_count.png) + +此情况下,保存的是名为`count`的**number**。 + +打开同网络的任意时,侧边栏即会显示该变量,以供引用。 + +![](../assets/images/variable_in_terminal.png) + +### 类型 + +- **number**(数) + - 数值(整数或小数) +- **string**(字符串) + - 任意最长256字符的文本 +- **boolean**(布尔值) + - `true`或`false` + +## 频道 + +变量器GUI中有名称和频道的设定器。有关频道限制脚本能否访问设备的详情,参见[选择频道](../lua-api/channel.md#选择频道)。 + +## 脚本 + +脚本API参见[VariableHandle](../lua-api/variable-handle.md)页面。 + +## 配方 + + \ No newline at end of file diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/lua-api/breaker-handle.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/lua-api/breaker-handle.md new file mode 100644 index 000000000000..c919e086e460 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/lua-api/breaker-handle.md @@ -0,0 +1,127 @@ +--- +navigation: + parent: lua-api/index.md + title: BreakerHandle + icon: breaker +categories: + - api_types +description: 用于破坏其前方方块的设备 +--- + +# BreakerHandle + +`BreakerHandle`(破坏器句柄)是对网络中的引用,由[`network:get(name)`](network.md#get)返回。它能对破坏器前方的方块启动消耗多个刻的破坏操作,并能将掉落物送回网络(或至自定义的handler)。 + + + +破坏器的挖掘等级为钻石镐,破坏耗时使用木镐的计算公式,因此硬方块花费的时间显著更长。同一个破坏器在同一时刻仅能运行一个破坏操作,试图重叠调用`:mine()`相当于无操作。 + +## 属性 + +- **`.name`** + - 破坏器的别名(和终端侧边栏中的一致) + +## mine + +对破坏器前方的方块启动消耗多个刻的破坏操作。返回一个[BreakBuilder](./breaker-handle.md#breakbuilder),脚本可链式调用`:connect(fn)`以重定向掉落物。若不进行链式调用,掉落物会返回[网络存储](../nodeworks-mechanics/network-storage.md),使用标准的[存储卡](../items-blocks/storage_card.md)优先级规则。 + + +```lua +local breaker = network:get("quarry_1") +breaker:mine() -- 掉落物前往网络存储 +``` + + +若目标为空气、不可破坏,或破坏需要的品质高于破坏器,则`:mine()`会返回一个无操作builder,以免链式调用崩溃。 + +## cancel + +若有运行中的破坏操作,终止其运行。空闲时调用能保证安全。方块不会被破坏,也不会产出掉落物。 + + +```lua +local breaker = network:get("breaker_1") +breaker:mine() +if dangerous() then + breaker:cancel() -- 在完成前停止 +end +``` + + +## block + +返回破坏器前方方块的ID,规格与[`ObserverCard:block`](./card-handle.md#侦测卡)一致。适合用于破坏特定种类的方块。 + + +```lua +local breaker = network:get("breaker_1") +if breaker:block() == "minecraft:stone" then + breaker:mine() +end +``` + + +## state + +返回破坏器前方方块的属性表。规格与[`ObserverCard:state`](./card-handle.md#侦测卡)一致,方块的每一个`BlockState`属性(`age`、`facing`、`lit`、`waterlogged`……)都会变成单独的字段。 + + +```lua +local breaker = network:get("crop_breaker") +local state = breaker:state() +if state.age == 7 then + breaker:mine() -- 仅破坏长成的农作物 +end +``` + + +## isMining + +若当前正在进行破坏,返回`true`;空闲则返回`false`。可用于避免在破坏中途发起`:mine()`(虽然此时调用本来也相当于无操作,但`:isMining()`可让脚本的分支更明确)。 + + +```lua +local breaker = network:get("breaker_1") +if not breaker:isMining() then + breaker:mine() +end +``` + + +## progress + +返回`0`到`1`之间的数,代表当前破坏操作的进度。空闲则返回`0`。适合用于显示进度条,或用于管理后续操作的时序。 + + +```lua +local breaker = network:get("breaker_1") +print(string.format("%.0f%%", breaker:progress() * 100)) +``` + + +--- + +## BreakBuilder + +由[`Breaker:mine()`](./breaker-handle.md#mine)返回。可用于配置破坏完成后掉落物的去向。若不进行链式调用,掉落物会自动进入网络存储。链式调用`:connect(fn)`可将其导入脚本handler。 + +### connect + +将破坏的掉落物导入回调函数。每一个掉落的物品堆叠都会作为[ItemsHandle](./items-handle.md)传入handler,因此即便是只破坏一次会产生多项掉落的方块,也会多次调用handler。 + +handler可读取掉落物的`.id`、`.name`、`.count`、`.kind`,以此决定其去向。handler未路由的物品仍会使用默认路由,进入网络存储。 + + +```lua +local breaker = network:get("breaker_1") +local chest = network:get("ore_chest") +breaker:mine():connect(function(item: ItemsHandle) + if item.id == "minecraft:diamond" then + chest:insert(item) -- 钻石进入专用的箱子 + end + -- 所有其他产物进入网络存储 +end) +``` + + +> **注意:**‌破坏器的`:connect` handler会在破坏完成时运行,不是每刻都触发。handler内部的错误不会影响外部,出错的回调函数不会卡死破坏器。 diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/lua-api/card-handle.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/lua-api/card-handle.md new file mode 100644 index 000000000000..9f45189d720e --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/lua-api/card-handle.md @@ -0,0 +1,327 @@ +--- +navigation: + parent: lua-api/index.md + title: CardHandle + icon: blank_card +categories: + - api_types +description: 对网络中单张卡片的引用 +--- + +# CardHandle + +`CardHandle`(卡片句柄)是网络中单张卡片的引用。[`network:get(alias)`](network.md#get)或[`network:getAll(type)`](network.md#getAll)所返回[HandleList](handle-list.md)的返回值即为该类型。 + + + +--- + +## 属性 + +- **`.name`** + - 卡片的别名(和终端侧边栏中的一致) + +--- + +## 物品栏卡 + +*适用于IO卡和存储卡。*‌两者公开的Lua API一致,区别只在于网络如何对待与两者相连的方块。有关世界中的行为参见。 + +### face + +限制卡片为仅与相邻方块的特定面交互。当方块各面的物品栏不同时(熔炉输入/输出等)很有用。 + +默认情况下,卡片会选择它面对的面。 + + + + + `card:face("top")` + + + `card` + + + + +```lua +local card = network:get("io_1") +card:insert(coal) +card:face("top"):insert(inputItem) +``` + + +### slots + +按索引限制卡片为仅与物品栏的特定槽位交互(索引从1开始)。 + + + + + + + + + + + +```lua +local card = network:get("io_1") +card:slots(2, 4):find("*") -- 选择石头和闪长岩 +``` + + +### find + +扫描卡片的物品栏,搜索匹配筛选器的物品/流体。筛选器语法与[`network:find`](network.md#find)一致,区别仅在于作用域仅在卡片所对的槽位/流体容器,而不是网络中的所有存储卡。 + + +```lua +local coalInCard = card:find("minecraft:coal") +if coalInCard then + print("卡片中有", coalInCard.count, "个煤炭") +end +``` + + +### findEach + +与[find](./card-handle.md#find)一致,区别在于此方法会返回[ItemsHandle](./items-handle.md)列表,按物品ID和是否包含NBT数据去重。 + +若网络中有钻石剑,那么有魔咒的和无魔咒的会被分入不同条目。 + + + + + + + + + + + +```lua +local allItems = card:findEach("*") +for _, val in allItems do + print(val.name) +end +-- 圆石 +-- 橡木木板 +-- 木棍 +``` + + +### insert + +将物品或流体*移入*此卡片的物品栏。要么全部移动,要么不移动,永远不会只移动一部分。完整移动时返回`true`,无法移动时返回`false`。和[`network:insert`](network.md#insert)一致,区别在于作用域限制于这张卡片。 + + +```lua +local coal = network:find("minecraft:coal") +if coal and card:insert(coal, 32) then + print("已向卡片存储32个煤炭") +end +``` + + +### tryInsert + +与[`insert`](card-handle.md#insert)类似,但会按剩余空间移动,不只是全部移动或不移动。返回实际移动的数量(0到所请求数量)。无法传输的会留在来源中。若能接受部分移动,可使用此方法。 + + +```lua +local coal = network:find("minecraft:coal") +if coal then + local moved = card:tryInsert(coal) + print("移动了", coal.count, "个煤炭中的", moved, "个") +end +``` + + +### count + +返回此卡片所对物品栏中匹配筛选器的资源总数(流体以mB计)。 + +筛选器语法与[find](network.md#find)一致。 + + +```lua +print(card:count("#minecraft:coals")) +``` + + +--- + +## 红石卡 + +*仅适用于。*‌上文的物品栏方法无效,且红石卡的`card:find()`会返回`nil`。 + +### powered + +输入红石信号大于0时返回`true`。 + + + + + + + + + +```lua +local card = network:get("redstone_1") +print(card:powered()) +-- true +``` + + +### strength + +返回输入的红石信号强度,值在0到15之间。 + + + + + + + + + +```lua +local card = network:get("redstone_1") +print(card:strength()) +-- "14" +``` + + +### set + +发出红石信号。布尔值会映射为15和0,与类似。数则取上下限至0到15。 + + + + + 强度15 + + + + + + + + +```lua +local card = network:get("redstone_1") +card:set(true) -- 和拉杆类似,发出强度为15的信号 +card:set(false) -- 将输出信号的强度设为0 +``` + + +也可用数指定输出信号的强度。 + + + + + 强度3 + + + + + + + + +```lua +local card = network:get("redstone_1") +card:set(3) +``` + + +### onChange + +注册一个回调函数,在输入信号的强度变化时触发。 + + + + + + + + 红石钟/红石脉冲器 + + + + +```lua +local card = network:get("redstone_1") +-- 红石火把点燃或熄灭时打印"状态已改变" +local lastPowered = card:powered() +card:onChange(function(strength: number) + local powered = strength > 0 + if lastPowered == powered then + return + end + lastPowered = powered + print("状态已改变") +end) +``` + + +> **提示:**‌建议在使用`:onChange`时启用的[“自动运行”](../items-blocks/scripting_terminal.md#自动运行)。 + +![](../assets/images/autorun.png) + +## 侦测卡 + +*仅适用于。*‌上文的物品栏方法无效,且侦测卡的`card:find()`会返回`nil`。卡片会监测所安装面前方的方块,并公开其ID、属性、状态改变事件。 + +### block + +返回所监测位置方块的ID,形式为`"namespace:path"`字符串。 + + +```lua +local watcher = network:get("watcher_1") +print(watcher:block()) +-- "nodeworks:celestine_cluster" +``` + + +若所监测位置的区块未被加载,调用时仍能返回缓存的方块(Minecraft会加载区块以读取)。建议在大型脚本中使用`:onChange`,而不是每刻调用`:block()`。 + +### state + +返回所监测方块的属性表。键为方块的属性名(`age`、`facing`、`waterlogged`、`lit`、`axis`……)。根据属性种类的不同,返回值可为数、布尔值,以及全小写字符串。空气和其他无属性方块会返回空表。 + + +```lua +local s = network:get("watcher_1"):state() +if s.age == 3 then + print("已完全长成") +end +``` + + +不同方块公开的属性不同,`state()`的返回值完全取决于所监测的方块。如果需要对监测方块的种类分支,可先使用`:block()`。 + +### onChange + +注册一个回调函数,它会在所监测方块的ID或任意状态属性改变时触发。会替换同卡片已有的handler。handler会收到新方块的ID和新的属性表。 + + +```lua +local watcher = network:get("watcher_1") +local breaker = network:get("breaker_1") + +watcher:onChange(function(block: string, state: { [string]: any }) + if block == "nodeworks:celestine_cluster" then + breaker:set(true) + scheduler:delay(2, function() breaker:set(false) end) + end +end) +``` + + +注册后的第一次触发会静默使用“最后一次观察”得到的状态。若有方块在脚本重新启动前就已达到最终状态,脚本便不会触发伪事件。 + +> **提示:**‌和红石卡的`:onChange`类似,这种回调函数通常也需自动运行。可启用的[“自动运行”](../items-blocks/scripting_terminal.md#自动运行),以在不同游戏会话间不停触发handler。 diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/lua-api/channel.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/lua-api/channel.md new file mode 100644 index 000000000000..4bfc44b0e6ad --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/lua-api/channel.md @@ -0,0 +1,68 @@ +--- +navigation: + parent: lua-api/index.md + title: Channel + icon: io_card +categories: + - api_types +description: 按染料颜色分割的网络视图 +--- + +# Channel + +`Channel`(频道)是按染料颜色分割的网络视图。使用[`network:channel(color)`](network.md#channel)可以得到频道。在Channel下的查询仅能看见该颜色频道下的卡片、变量、设备,这些网络成员的频道需在各自的GUI中选择。多个子系统可共用一个网络,不同子系统间同样的卡片别名不会相互冲突。 + + +```lua +local red = network:channel("red") +local blue = network:channel("blue") +red:getAll("redstone"):set(true) -- 仅触发红色频道的活塞 +blue:getAll("redstone"):set(true) -- 仅触发蓝色频道的活塞 +``` + + +颜色名必须为原版的16种染料颜色之一(`white`、`red`、`blue`、`light_blue`、`light_gray`……)。未知的颜色会出错。 + +## 选择频道 + +在所有[卡片](../nodeworks-mechanics/cards.md)和[设备](../nodeworks-mechanics/devices.md)的GUI中,都有用于选择频道的组件。默认情况下,所有设备和卡片的初始频道为`white`。点击频道选择器可打开一个颜色列表以供挑选。 + +![](../assets/images/choose_channel.png) + +## get + +仅作用于此频道的别名查询。返回[CardHandle](card-handle.md)、[VariableHandle](variable-handle.md)、Breaker或Placer,命名空间与[`network:get`](network.md#get)一致。频道中没有成员匹配别名时会出错。 + + +```lua +local red = network:channel("red") +local counter = red:get("counter") -- 红色频道下名为“counter”的变量 +local door = red:get("door") -- 红色频道下名为“door”的卡片 +``` + + +## getAll + +返回一个[HandleList](handle-list.md),内有频道下的所有给定类别的成员。接受适用于[`network:getAll`](network.md#getAll)的类别:`"io"`、`"storage"`、`"redstone"`、`"observer"`、`"variable"`、`"breaker"`、`"placer"`。不传入参数可返回所有成员,不论类别。 + + +```lua +local red = network:channel("red") +red:getAll("observer"):onChange(function(block, state) + print("红石频道侦测卡已触发:", block) +end) +``` + + +## getFirst + +返回频道下给定类别的首个成员,无成员匹配时返回`nil`。适合在频道内只有一个成员,且不想处理HandleList时使用。 + + +```lua +local sensor = network:channel("blue"):getFirst("observer") +if sensor then + print(sensor.name, "是蓝色频道的侦测卡") +end +``` + diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/lua-api/craft-builder.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/lua-api/craft-builder.md new file mode 100644 index 000000000000..e5c8173ae120 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/lua-api/craft-builder.md @@ -0,0 +1,91 @@ +--- +navigation: + parent: lua-api/index.md + title: CraftBuilder + icon: minecraft:crafting_table +categories: + - api_types +description: 由[`network:craft`](network.md#craft)返回,用于配置产物的去向 +--- + +# CraftBuilder + +`CraftBuilder`(合成建造器)是[`network:craft`](network.md#craft)的返回值类型。它代表网络已经计划但还未收到产物的合成作业。默认情况下,合成完毕时产物会被送至[网络存储](../nodeworks-mechanics/network-storage.md)。若想要使用回调函数,可链式调用`:connect(fn)`。 + +合成作业本身可能同一刻内就结束(由网络存储供应原材料的原版配方),也可能需要许多刻(所有经由[`network:handle`](network.md#handle)、处理操作器、多阶段合成树的作业)。无论是哪一种,builder的API都完全一致。 + +> **注意:**‌`network:craft`必然返回一个builder,即便是无法计划合成作业(无配方、缺少原材料、没有合成CPU)也是如此。此类失效会作为`nil`进入`:connect`的回调函数。 + +## 默认:存储产物 + +若没有后续链式调用,产物会被自动送回网络存储,过程中使用常规的[存储卡](../items-blocks/storage_card.md)优先级和[`network:route`](network.md#route)规则。此后,可和网络存储中其他资源一样通过`network:find`进行查询。 + + +```lua +-- 发起后即不管:合成16根火把,最后会进入网络存储 +network:craft("minecraft:torch", 16) +``` + + +## connect + +将产物交由回调函数处理,**而不是**自动存储。调用`:connect`会禁用builder的默认行为:脚本运行时不会自动存储,产物归回调函数所有。 + +回调函数的参数为`ItemsHandle?`:成功合成时为[ItemsHandle](items-handle.md),失败时为`nil`。使用前务必检查。 + + +```lua +local oven = network:get("oven") +network:craft("minecraft:bread", 4):connect(function(items: ItemsHandle?) + if not items then + print("面包合成失败") + return + end + oven:insert(items) -- 产物面包直接进入oven +end) +``` + + +回调函数会在合成结束后立即触发。合成失效会变为`nil`: + +- 合成计划失败:无配方、缺少原材料、网络中没有合成CPU。 +- 异步超时:处理用handler未能发回输出。 +- CPU离线:合成CPU在合成中途损坏或被移除。 + +无论是哪一种失效,脚本运行时都会将CPU缓存送回网络存储,以免物品滞留。 + +### 移动物品需要你来操作 + +回调函数收到的handle是**合成CPU缓存中剩余物品的实时引用**。调用`card:insert(items)`/`network:insert(items)`可抽空缓存,将物品送入目的地。 + +回调函数返回时残留在缓存中的物品会**掉落在CPU的位置**,终端会同时记录错误。操作约定是“handle归你,移动物品也归你”,未能完成移动的错误不会静默消失。 + + +```lua +local chest = network:get("ore_chest") +network:craft("minecraft:iron_ingot", 8):connect(function(items: ItemsHandle?) + if not items then return end + if not chest:insert(items) then + -- 箱子已满:送至网络存储,避免掉落 + network:insert(items) + end +end) +``` + + +此行为和自动存储——必然送至无论存储卡(且只会在所有存储卡均拒绝时掉落)——不一样,是刻意为之。回调函数通过`:connect`来控制物品去向,而脚本运行时会信任你。 + +> **注意:**‌回调函数内抛出的错误会在终端处记录,但不会截停脚本的其他部分。 + +## 同步的connect + +原材料已备齐的原版配方作业会在发起的同一刻结束。回调函数依然会按同样路径在`:craft`调用的后一刻触发,以便`:connect`在解析前注册。无需为此设置特殊处理,API的表现在同步和异步合成作业中完全一致。 + + +```lua +-- 无论是立即完成的合成,还是需要30s的烧炼,connect的表现都相同 +network:craft("minecraft:iron_ingot", 8):connect(function(items: ItemsHandle?) + if items then chest:insert(items) end +end) +``` + diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/lua-api/handle-list.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/lua-api/handle-list.md new file mode 100644 index 000000000000..4635e52f75ed --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/lua-api/handle-list.md @@ -0,0 +1,75 @@ +--- +navigation: + parent: lua-api/index.md + title: HandleList + icon: minecraft:red_bundle +categories: + - api_types +description: getAll返回的卡片/变量列表,支持一次性广播 +--- + +# HandleList + +`HandleList`(句柄列表)是卡片与变量组成的列表,**会在所有成员间广播写方法**。[`network:getAll(type)`](network.md#getAll)和[`Channel:getAll(type)`](network.md#channel-getall)的返回值为此类型。 + +对列表调用写方法,相当于按顺序使用相同的参数对所有成员调用该方法。读方法均未公开,因为读方法的返回值才是最重要的,进行静默跳过只会给脚本埋下隐患。如需按成员读取,可调用`:list()`并遍历。 + + +```lua +-- 一次性触发所有红色频道下的活塞。 +network:channel("red"):getAll("redstone"):set(true) +-- 在一行内为所有侦测卡注册同一个onChange handler。 +network:getAll("observer"):onChange(function(block, state) + if block == "nodeworks:celestine_cluster" then + -- ... + end +end) +``` + + +## 哪些方法会被广播 + +只有**写方法**会对列表广播,也即只有调用位置不会在意其返回值的方法。`:powered()`、`:count()`、`:get()`、`:block()`等读方法均为刻意留空,以避免静默跳过某个成员的返回值。如需按成员读取,可调用`:list()`并依次操作。 + +每种类型的页面(如[RedstoneCard](card-handle.md#红石卡)、[VariableHandle](variable-handle.md))是判断方法是读还是写的标准来源。 + +## list + +类型逃生舱。返回内部的数组,以供按成员迭代、读取各成员,或应用不符合广播形式成员独有逻辑设置。 + + +```lua +local pistons = network:channel("red"):getAll("redstone") +for _, p in pistons:list() do + if p:powered() then + print(p.name, "当前已充能") + end +end +``` + + +## count + +列表中成员的数量。比`#list:list()`的开支小,因为它不需要建立数组。 + + +```lua +local watchers = network:getAll("observer") +print("网络中有", watchers:count(), "张侦测卡") +``` + + +## face + +返回一个新HandleList,其中卡片成员的访问面强制改为`name`。原本的列表不会受影响,强制修改仅作用于返回的副本。不是[CardHandle](card-handle.md)的成员(变量、破坏器、放置器等)不会受影响,这些handle类型会忽略face。 + +列表的强制修改会在传入预设([Importer](importer.md)/[Stocker](stocker.md))时保留。仅需一个表达式,通配符广播即可读写所有匹配卡片的非默认面。 + + +```lua +-- 从所有io_*卡片中抽取熔炉产物(底面)并送入输出箱 +importer:from(network:cards("io_*"):face("bottom")):to("output"):start() +``` + + +参数规格与[`CardHandle:face`](card-handle.md#face)一致,但会一次性作用于整个列表。 diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/lua-api/importer.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/lua-api/importer.md new file mode 100644 index 000000000000..c70b7d2ea1af --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/lua-api/importer.md @@ -0,0 +1,153 @@ +--- +navigation: + parent: lua-api/index.md + title: Importer + icon: minecraft:hopper +categories: + - api_types + - api_preset +description: 将物品从A移动到B,接受分配策略 +--- + +# Importer + +`importer`(导入器)全局变量能建造物品搬运器,从任意多个来源中抽取物品,再送到任意多个目标中去。在实现方式上,importer其实是scheduler任务,因此它会根据所配置的间隔运行,并在脚本停止或对handle调用`:stop()`时终止。 + +## from + + +```lua +Importer:from(...sources: string | CardHandle | network): ImporterBuilder +``` + + +importer链的起点。来源可为卡片别名、CardHandle对象,或`network`全局变量(代表整个网络存储)三者混用。至少需要指定一个来源。 + + +```lua +importer:from("farmChest") -- 名称来源 +importer:from(network) -- 网络存储作为来源 +importer:from("chestA", network, network:get("chestB")) -- 混用 +``` + + +## to + + +```lua +ImporterBuilder:to(...targets: string | CardHandle | network): ImporterBuilder +``` + + +设置目的地。多态行为和`:from`一致:卡片别名、CardHandle对象、指代网络存储的`network`。至少需要指定一个目标。 + + +```lua +importer:from("farm"):to("storage1", "storage2"):start() +importer:from("mobFarm"):to(network):start() -- 存入网络存储 +``` + + +## filter + + +```lua +ImporterBuilder:filter(pattern: string): ImporterBuilder +``` + + +按照筛选器限制可移动的物品(或流体)种类。‌**可选。**‌默认值为`*`,对应移动所有物品。筛选器的语法与[Network:find](network.md#find)一致,即包括`$item:id`、`$fluid:id`、`#tag`、`modname:*`、正则表达式。 + + +```lua +-- 仅移动圆石 +importer:from(network) + :filter("$item:minecraft:cobblestone") + :to("io_*") + :start() + +-- 移动所有c:ores物品 +importer:from("mobFarm"):filter("#c:ores"):to("storage"):start() +``` + + +## 分配 + +importer有两种分配调度目标的方式。默认为填充,需要显式指定是否使用轮询。 + +### 填充(默认) + +填充首个目标。填满后移出到下一个目标,以此类推。适合有优先级顺序且希望一个箱子积极补货、多余物品溢出到其他箱子的场景。 + + +```lua +importer:from("furnaceOutput") + :filter("$item:iron_ingot") + :to("mainChest", "overflow") + :start() +``` + + +### roundrobin + + +```lua +ImporterBuilder:roundrobin(step: number?): ImporterBuilder +``` + + +每刻在所有目标间均分资源。`step`是每刻送入每个目标的最大物品量(默认为1)。step=1时,来自来源的三个物品会在同一刻送入三个目标,每个目标各一个。如需大批量移动,可增加step或通过`:every(1)`增加计刻速度。 + + +```lua +importer:from("bufferChest") + :to("furnace1", "furnace2", "furnace3") + :roundrobin() + :every(10) + :start() +``` + + +轮询指针每刻前进一步;即便是来源货物不足、只有部分目标能拿到物品的情况下,也能维持分配的公平。 + +## 卡片别名的通配符 + +`:from`和`:to`都接受卡片名称中存在`*`通配符。`"io_*"`会扩展至importer解析快照时所有别名匹配该模式的卡片,并会在每次网络拓扑改变时重新进行扩展。 + + +```lua +-- 将单个箱子的内容物均分到所有名为“io_...”的卡片 +importer:from("input"):to("io_*"):roundrobin():start() + +-- 从一系列来源箱子中抽出汇总到单个输出位置 +importer:from("farm_*"):to("storage"):start() +``` + + +## 示例:两阶段烧炼阵列 + +矿石按轮询送入三个熔炉,产物收集至中央存储箱。 + + +```lua +-- 将矿石均分给三个熔炉 +importer:from("oreBuffer") + :filter("$item:iron_ore") + :to("furnace1", "furnace2", "furnace3") + :roundrobin() + :every(10) + :start() + +-- 从所有三台熔炉中抽取锭,并存入输出箱 +importer:from("furnace1", "furnace2", "furnace3") + :filter("$item:iron_ingot") + :to("outputChest") + :start() +``` + + +## 延伸阅读 + +* [通用预设方法](presets.md#通用方法)(`:every`、`:start`、`:stop`、`:isRunning`)。 +* [Stocker](stocker.md)(补货器),“维持库存量”样板。 +* [Network:find](network.md#find),筛选器语法详情。 diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/lua-api/index.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/lua-api/index.md new file mode 100644 index 000000000000..8a5d66116346 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/lua-api/index.md @@ -0,0 +1,32 @@ +--- +navigation: + title: 节点工程脚本API + position: 40 +--- + +# 节点工程脚本API + + + +节点工程使用[Lua](https://www.lua.org/docs.html)作为脚本语言,脚本编辑器还为脚本的编写引入了若干种QoL扩展: + +- **类型标注:**‌(`local x: CardHandle`、`function(xs: { CardHandle }): ItemsHandle`等) + - 告诉编辑器变量、参数、返回值的类型。如此便可获得准确的悬停提示、更好的自动补全,以及for循环内部的元素类型推断。 + +## 内置 + + + +- [clock()]():脚本开始运行至今的时间,单位为秒的几分之一。 +- [print(...)]():输出至终端输出。 +- [require(name)]():按名称从同一终端的另一个脚本标签页加载脚本。 + +## 预设 + +声明式的builder,能将常见的scheduler循环包装成单行的链式调用。通用模式参见[预设](presets.md)。 + + + +## 类型 + + diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/lua-api/input-items.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/lua-api/input-items.md new file mode 100644 index 000000000000..e7c0a0ee3f81 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/lua-api/input-items.md @@ -0,0 +1,51 @@ +--- +navigation: + parent: lua-api/index.md + title: InputItems + icon: minecraft:cobblestone +categories: + - api_types +description: "[network:handle回调函数](network.md#handle)需接受的第二个参数,是按配方打包的[`ItemsHandle`](items-handle.md),按配方输入槽位名称分入各字段" +--- + +# InputItems + +`InputItems`(输入物品)是[`network:handle`](network.md#handle)需接受的第二个参数。网络已经从网络存储中抽出了配方的原材料,汇总结果就是这张表,其中每个字段都对应着一个输出槽位。你需要做的,是把这些物品送到机器中去。 + +每一个字段都是完整的[ItemsHandle](items-handle.md)对象,可以像其他handle一样对其调用`:insert`、`:tryInsert`、`:count`等。 + +## 字段名称 + +字段名称为**驼峰命名(camelCase)的输入物品ID**。也即`minecraft:raw_iron`会变为`items.rawIron`,`minecraft:copper_ingot`会变为`items.copperIngot`。脚本编辑器会根据配方自动补全,无需专门记忆。 + + +```lua +local furnace = network:get("furnace") +network:handle("...", function(job: Job, items: InputItems) + furnace:face("top"):insert(items.rawIron) -- minecraft:raw_iron + job:pull(furnace:face("bottom")) +end) +``` + + +### 重复的原材料 + +若配方在多个槽位中的原材料相同,则第二次出现处加后缀`2`,第三次加`3`,以此类推。所以需要两个铜锭和一个金锭的配方会公开为`items.copperIngot`、`items.goldIngot`、`items.copperIngot2`。 + + +```lua +local press = network:get("press") +network:handle("...", function(job: Job, items: InputItems) + press:face("top"):insert(items.copperIngot) + press:face("top"):insert(items.copperIngot2) + press:face("north"):insert(items.goldIngot) + job:pull(press:face("bottom")) +end) +``` + + +## 必须全部使用 + +handler应当将所有输入都送入机器。若在handler返回时仍有资源残余在`items.`中,则网络会认为当次合成作业未完成,并在之后再次尝试。没有“跳过该输入”的方法,配方说需要N个铜锭,那就应当取走N个铜锭。 + +> **注意:**‌“使用”指的是将物品送到可被访问的地方,通过`network:insert`送回网络存储也可以。网络只会检查“脚本有没有完全消耗掉输入”,而不关心“输入有没有抵达正确的机器”。 diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/lua-api/items-handle.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/lua-api/items-handle.md new file mode 100644 index 000000000000..96811954ff93 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/lua-api/items-handle.md @@ -0,0 +1,227 @@ +--- +navigation: + parent: lua-api/index.md + title: ItemsHandle + icon: minecraft:bundle +categories: + - api_types +description: 附带数量、来源、传输操作的特定资源(物品或流体) +--- + +# ItemsHandle + +`ItemsHandle`(物品句柄)是**附带数量的资源种类**。问出“存储空间里有什么?”的时候,大多数网络和卡片方法的返回值都是这个类型;让同样的方法“把这个搬到其他地方去”的时候,它们也需要接受此类型的参数。 + +> **注意:**‌handle是在调用返回时拍摄的**快照**。`.count`不会因为后续物品出入而更新。如果需要新数值,可再次调用`:find`。 + +--- + +## handle代表了什么(以及没在代表什么) + +handle是**所查询位置所有匹配资源的聚合**,不是单一的物品栏堆叠。此性质有两个重要的影响: + +**同一类handle能处理物品和流体。**‌`.kind`字段存储了资源的类型。物品的数量为“个数”,流体的为毫桶(mB)。详情参见下文的[count](./items-handle.md#count)和[kind](./items-handle.md#kind)。 + +**count可以大于`maxStackSize`。**‌即便单个槽位内最多只能存下64个,`network:find("minecraft:coal")`也有可能会返回`count = 192`的handle。这个handle代表着“网络中任意位置的所有煤炭”,可以由多个槽位、多张存储卡、多个储罐汇总而来。[card:find](card-handle.md#find)也遵从这一点,即也会聚合卡片对应的槽位和储罐。 + +若需要各堆叠单独处理(如附魔的剑分离于未附魔的同ID剑),可换用[`findEach`](network.md#findEach)。它会按ID**和**NBT数据分割,每一种独特组合都会变成不同的handle。 + + +```lua +local allCoal = network:find("minecraft:coal") +print(allCoal.count) -- 192,网络内的总量 + +for _, h in network:findEach("minecraft:diamond_sword") do + print(h.name, h.hasData) -- 附魔的剑和未附魔的剑分属不同条目 +end +``` + + +--- + +## 属性 + +### id + +handle所指向资源的ID。两种资源类型的表现一致:物品可为`"minecraft:diamond"`,流体可为`"minecraft:water"`。 + + +```lua +local coal = network:find("minecraft:coal") +print(coal.id) -- "minecraft:coal" +``` + + +### name + +玩家在提示文本中看见的显示名称。经翻译、有格式,且可自定义(经过铁砧重命名的物品会显示重命名的字符串)。 + + +```lua +local sword = network:find("minecraft:diamond_sword") +print(sword.name) -- "钻石剑"(或者重命名过的话,"ex咖喱棒") +``` + + +### count + +handle所代表资源的数量。**物品的单位为“个数”**(按单独物品,不按组数),**流体的为mB**(毫桶,1000 mB = 1 桶)。 + + +```lua +local coal = network:find("minecraft:coal") +print(coal.count) -- 192(192个煤炭) +-- or for fluids +local water = network:find("minecraft:water") +print(water.count) -- 4000(4桶,合4000mB) +``` + + +### kind + +`"item"`或`"fluid"`。可在处理两类资源的脚本中用它作分支判断。 + + +```lua +for _, h in network:findEach("*") do + if h.kind == "fluid" then + print(h.count, "mB的", h.name) + else + print(h.count, "x", h.name) + end +end +``` + + +### stackable + +最大堆叠数大于1的物品(圆石、锭、木板……)返回`true`,工具、盔甲、各类独特物品(有自定义NBT的药水、成书)返回`false`。流体必然返回`false`,它们按体积计量,不按堆叠。 + + +```lua +for _, item in inputChest:findEach("*") do + if not item.stackable then + nonStackables:insert(item) + else + network:insert(item) + end +end +``` + + +此示例可将不可堆叠的物品移到网络外的某箱子。 + +### maxStackSize + +资源在单个物品栏槽位中能存放的最大数量。大多数物品都是`64`,雪球和末影珍珠是`16`,工具和盔甲是`1`。流体必然返回`1`,不具备实际意义。 + + +```lua +local coal = network:find("minecraft:coal") +print(coal.maxStackSize) -- 64 +``` + + +### hasData + +若堆叠的NBT不为默认值(魔咒、自定义名称、成书内容、盔甲染色、谜之炖菜效果等),则返回`true`。可用它将“特别”的物品从普通物品中分拣出去。 + + +```lua +for _, item in inputChest:findEach("*") do + if item.hasData then + enchantedItems:insert(item) + else + network:insert(item) + end +end +``` + + +--- + +## 方法 + +### hasTag + +若资源是所给标签的成员,返回`true`。标签ID开头有无`#`均可,即`"minecraft:logs"`和`"#minecraft:logs"`均可。 + + +```lua +for _, h in network:findEach("*") do + if h:hasTag("minecraft:logs") then + print(h.name, "是一种原木") + end +end +``` + + +标签成员的判定方式于Minecraft在合成配方和生物群系设置中所用的一致,即可作为原版配方中“任意原木”的资源均匹配本示例。 + +### matches + +若资源匹配所给筛选器,返回`true`。筛选器语法与[`network:find`](network.md#find)一致。适合用于路由谓词,以及跳过`:find`流程按物品分支。 + + +```lua +function smelt(item: ItemsHandle) + if item:matches("/_ore$/") then + machine:insert(item) + return + end + furnace:insert(item) +end +``` + + +--- + +## 向传输方法传入handle + +handle不只是只读值,也是**移动相应物品的来源**。大多数传输方法都需要handle作为参数,并会从各来源将资源移动到指定目的地。 + + +```lua +local coal = network:find("minecraft:coal") +if coal then + -- 全部搬到箱子里 + chest:insert(coal) +end +``` + + +按此方式使用handle的方法有: + +- [`card:insert`](card-handle.md#insert)/[`card:tryInsert`](card-handle.md#tryinsert),送入卡片对应的物品栏 +- [`network:insert`](network.md#insert)/[`network:tryInsert`](network.md#tryinsert),按路由规则送入网络存储 +- [`placer:place`](placer-handle.md#place),使用handle的`.id`挑选放置物 + +handle的`.count`也是这些方法的移动上限。传入可选的第二个参数可设置更小的上限,适用于空间较小的目的地,如熔炉燃料槽: + + +```lua +local coal = network:find("minecraft:coal") +furnace:insert(coal, 8) -- 向燃料槽补8个煤炭 +``` + + +> **注意:**‌`:insert`要么全部移动,要么不移动。若目的地无法容纳所移动的量,则什么都不会移动,且调用返回`false`。若能接受部分移动,可使用`:tryInsert`,也可提供第二个参数作为上限。 + +--- + +## 无物匹配时返回nil + +筛选器没有匹配的资源时,`:find`和`findEach`会返回`nil`。`count = 0`的handle不可能存在,查询结果为空时返回值也为空。链式调用时务必检查: + + +```lua +local coal = network:find("minecraft:coal") +if coal then + print(coal.count, "个煤炭可用") +else + print("网络存储中没有煤炭") +end +``` + + +编辑器的类型系统会记录这一性质,鼠标悬停在`coal`上会显示`ItemsHandle?`(`?`是“或nil”记号),在忘记检查时也会进行提示。 diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/lua-api/job.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/lua-api/job.md new file mode 100644 index 000000000000..7b7031a94b3e --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/lua-api/job.md @@ -0,0 +1,57 @@ +--- +navigation: + parent: lua-api/index.md + title: Job + icon: minecraft:paper +categories: + - api_types +description: "[network:handle回调函数](network.md#handle)需接受的第一个参数,代表实际的处理作业,handler需负责为其产出产物" +--- + +# Job + +`Job`(作业)是[`network:handle`](network.md#handle)需接受的第一个参数。每一次网络需要运行处理集配方时,它都会调用handler,并传入新建的`Job`和从网络存储中取出的[物品](input-items.md)。handler会将物品送入机器,并调用`job:pull(card)`告诉网络产物将抵达的位置。 + +## pull + +告诉网络产物将抵达的位置。传入任意多个[CardHandle](card-handle.md),网络便会监测它们,直到完整的产物到达。 + +若输出已经在其中一张卡片处(瞬时配方、无序合成),则合成作业会在同一刻结束。其他情况下,网络会每刻检查,并拿取卡片处已有的产物。对一次只产出一个锭的熔炉发送大批量作业也不会产生问题。 + + +```lua +local furnace = network:get("furnace") +network:handle("...", function(job: Job, items: InputItems) + furnace:face("top"):insert(items.rawIron) + -- 在烧炼完成时从底面抽取 + job:pull(furnace:face("bottom")) +end) +``` + + +### 多张来源卡片 + +若产物可能抵达多个位置,可传入多张卡片。网络会按序检查每张卡片,并抽出已有的物品。若产线下游有管道或漏斗根据物品分拣到不同箱子,可以使用此特性。 + + +```lua +local furnace = network:get("furnace") +local outboxA = network:get("outbox_a") +local outboxB = network:get("outbox_b") +network:handle("...", function(job: Job, items: InputItems) + furnace:face("top"):insert(items.rawIron) + -- 所得锭被分拣到两箱子中的一个,从任意一个抽取 + job:pull(outboxA, outboxB) +end) +``` + + +### 先放入物品 + +`:pull`只会处理输出。你仍需要亲自把[InputItems](input-items.md)送入机器。若在handler返回时仍有资源留在`items.`内,则该合成作业会被判定为未完成,网络会重新发起。 + +### 超时 + +若产物没能抵达输出位置,合成作业最终会超时,输入会被返还至网络存储。各处理集都有自身设定的超时时限(刻),可在GUI中调整,默认为15秒。在处理大批量烧炼、耗时较长的模组配方机器时,可延长时限。 + +> **注意:**‌handler内部的错误只会停止*该合成作业*,不会导致脚本崩溃。若合成作业因未知原因挂起,可检查终端的日志,错误信息会输出到那里。 diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/lua-api/network.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/lua-api/network.md new file mode 100644 index 000000000000..745b8f8d4ad4 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/lua-api/network.md @@ -0,0 +1,356 @@ +--- +navigation: + parent: lua-api/index.md + title: Network + icon: node +categories: + - api_builtin +description: 查询网络存储、路由物品、发起合成作业、注册handler +--- + +# Network + +`network`(网络)模块是指向所属节点工程网络的入口。它能查询存储空间,在多个handle之间路由物品,注册回调函数。 + +## get + +按名称获取网络中任意成员的引用,如等,通常在脚本的开头使用。卡片与变量名称冲突时选择卡片。 + +点击脚本终端的侧栏可以自动插入get行。 + +![点击前](../assets/images/click-to-add-card-01.png) ![点击后](../assets/images/click-to-add-card-02.png) + + + + + 重命名为‌**“chest”**‌ + + + 重命名为‌**“furnace”**‌ + + + + +```lua +local chest = network:get("chest") -- 获取存储卡 +local furnace = network:get("furnace") -- 获取IO卡 +local count = network:get("count") -- 获取名为“count”的变量 +``` + + +--- + +## getAll + +返回一个[HandleList](handle-list.md),内有所有匹配所给类型的卡片和变量。HandleList会对所有成员广播写方法(`:set`、`:onChange`……),用它激活多个活塞或为多个侦测卡注册handler均只需一行。如需按成员迭代,可调用`:list()`。 + + + + + + + + + + + + +```lua +-- 广播:一次性激活所有红石卡 +network:getAll("redstone"):set(true) +-- 若需分别使用读方法的返回值,应按成员迭代 +local storages = network:getAll("storage") +for _, storage in storages:list() do + print(storage.name) +end +-- "storage_0" +-- "storage_1" +``` + + +--- + +## cards + +返回一个[HandleList](handle-list.md),内有所有匹配所给名称的卡片。如需同时使用遵从同一命名惯例的所有卡片,可以使用此方法。 + + +```lua +local allPistonCards = network:cards("piston_*") +allPistonCards:set(true) -- 激活所有活塞 +``` + + +--- + +## channel + +将查询限制在单种染料颜色对应的频道。返回一个[`Channel`](./channel.md) handle,该对象的`:get`、`:getAll`、`:getFirst`只会返回相应频道中的卡片、变量、设备,频道筛选器的规则一致。遇到未知颜色名称时会出错。 + + +```lua +local red = network:channel("red") +red:getAll("redstone"):set(true) -- 仅红色频道的活塞 +local count = red:get("counter") -- 仅红色频道的变量 +``` + + +--- + +## channels + +返回网络中所有染料颜色频道组成的列表,即所有至少包含一个卡片、变量、破坏器,或放置器的颜色。顺序按`DyeColor` ID升序,所以对此列表迭代是稳定的。它可在运行时返回各频道,无需硬编码。 + +> **注意:**‌新成员的默认频道是`white`,所以大多数非空网络里都会有这个频道。 + + +```lua +for _, color in network:channels() do + print("正在使用", color) +end +-- 正在使用 "white" +-- 正在使用 "red" +-- 正在使用 "blue" +``` + + +常见用法:对所有活动频道使用同一个handler,无需考虑玩家选择了哪些频道。 + + +```lua +for _, color in network:channels() do + network:channel(color):getAll("redstone"):set(false) +end +``` + + +--- + +## find + +扫描整个[网络存储](../nodeworks-mechanics/network-storage.md),搜索匹配筛选器的物品/流体。返回聚合式handle‌*(按整个网络存储统计)*;若无资源匹配,则返回`nil`。 + + +```lua +local all = network:find("*") -- 返回所有物品和流体(若有) +local allItems = network:find("$item:*") -- 仅物品 +local allFluids = network:find("$fluid:*") -- 仅流体 +local allCoal = network:find("minecraft:coal") -- 物品ID +local allLogs = network:find("#minecraft:logs") -- 标签 +local allRaw = network:find("/^Raw.*/") -- 正则表达式 +``` + + +使用`:find`的返回值时,应当先检查是否为空。 + + +```lua +local allCoal = network:find("minecraft:coal") +if allCoal then + print("有煤炭") +end +``` + + +--- + +## findEach + +和[find](./network.md#find)类似,此方法也会扫描[网络存储](../nodeworks-mechanics/network-storage.md),搜索匹配筛选器的物品/流体。此方法会返回[ItemsHandle](./items-handle.md)列表,按物品ID和是否包含NBT数据去重。 + + +```lua +for _, items in network:findEach("$item:*") do + print(items.id, items.count, items.kind) +end +``` + + +若网络中有钻石剑,一部分有魔咒一部分没有,则这两者会被分成两个元素。 + + +```lua +for _, items in network:findEach("minecraft:diamond_sword") do + print(items.id, items.hasData) +end +-- "minecraft:diamond_sword" true +-- "minecraft:diamond_sword" false +``` + + +--- + +## count + +返回[网络存储](../nodeworks-mechanics/network-storage.md)中匹配筛选器资源的总数。(流体以mB计。) + +筛选器语法与[find](network.md#find)一致。 + + +```lua +print("剑:", network:count("minecraft:diamond_sword")) +print("圆石:", network:count("minecraft:cobblestone")) +print("总计:", network:count("*")) +-- "剑:" 3 +-- "圆石:" 256 +-- "总计:" 259 +``` + + +--- + +## insert + +参照标准的优先级规则,将一个[ItemsHandle](items-handle.md)插入[网络存储](../nodeworks-mechanics/network-storage.md)。需要网络能存下所有物品,否则便不会移动,并返回`false`。如希望尽力移动,可使用[tryInsert](./network.md#tryinsert)。 + + +```lua +local ok = network:insert(items) +if ok then + print("所有物品均已移动") +else + print("未移动物品,空间不足") +end +``` + + +--- + +## tryInsert + +与[`insert`](network.md#insert)类似,但会移动所有匹配的物品,而不是要么全部移动,要么不移动。返回实际移动的数量(0至所请求的量)。所有未能移动的物品将停留在来源中。若仅移动一部分不会产生影响,可使用此方法。 + + +```lua +local moved = network:tryInsert(items) +print("移动了" .. moved .. "个物品") -- 可为0到items.count +``` + + +--- + +## craft + +(参见[Auto-Crafting](../nodeworks-mechanics/autocrafting.md)) + +为所给物品发起合成作业,并为其排队,返回一个[CraftBuilder](./craft-builder.md)。默认情况下,合成得到的物品会在合成完毕后自动进入[网络存储](../nodeworks-mechanics/network-storage.md),无需链式调用: + + +```lua +-- 发起后即不管:面包会在合成完毕后进入网络存储 +network:craft("minecraft:bread", 4) +``` + + +在后方链式调用`:connect(fn)`可改变此行为。回调函数会收到一个[ItemsHandle?](items-handle.md),成功时不为`nil`,不成功(合成计划失败、异步超时、无CPU)时为`nil`。调用`:connect`会覆盖自动存储行为。 + + +```lua +local furnace = network:get("furnace") +network:craft("minecraft:charcoal"):connect(function(item: ItemsHandle?) + if item then + furnace:insert(item) + end +end) +``` + + +--- + +## shapeless + +立即使用[网络存储](../nodeworks-mechanics/network-storage.md)中的原材料进行无序合成。若配方无效或缺少原材料,则不会进行合成,且方法会返回`nil`。 + + +```lua +-- 合成一个打火石,产物自动进入网络存储。 +network:shapeless("minecraft:flint", 1, "minecraft:iron_ingot", 1) +``` + + +--- + +## handle + +(参见[自动合成](../nodeworks-mechanics/autocrafting.md)) + +为网络内的注册一个处理handler。该handler会随输入唤起,并且必须使用传入的[Job](job.md)以`pull`产物。所有来自[InputItems](input-items.md)的物品**必须**被handler接收。 + + + + + 重命名为‌**“furnace”**‌ + + + + + **➜** + + + + + + +```lua +local furnace = network:get("furnace") +-- 粗铁 -> 铁锭的handler +network:handle("…", function(job: Job, items: InputItems) + furnace:face("top"):insert(items.rawIron) + job:pull(furnace:face("bottom")) +end) +``` + + +--- + +## route + +批量编辑所有名称匹配的的[筛选器设置](../items-blocks/storage_card.md#筛选器)。返回一个builder,它的方法能链式调用,可在一行内写完整个规则集。各方法会在执行后立即生效于相应的卡片,和手动右击打开其GUI编辑的效果一样。 + +匹配模式为名称,接受`*`作为通配符。`cobblestone_*`可匹配`cobblestone_0`、`cobblestone_1`等。单独使用`*`则匹配网络中的所有存储卡。 + + +```lua +network:route("cobblestone_*") + :reset() + :rule("#c:cobblestones") + :noNbt() + :allow() +``` + + +### Builder方法 + +| 方法 | 效果 | +| ------------------------------------------------------ | ---------------------------------- | +| `:rule(filter)` | 附加一条规则(语法与GUI内的一致) | +| `:clearRules()` | 清空规则,模式不变 | +| `:allow()` / `:deny()` | 设置规则列表模式 | +| `:stackable()` / `:nonStackable()` / `:anyStackable()` | 设置可堆叠性筛选器 | +| `:hasNbt()` / `:noNbt()` / `:anyNbt()` | 设置NBT筛选器 | +| `:reset()` | 清空规则,设置为白名单、任意、任意 | + +调用时会返回同一个builder,也因此这些方法可以链式调用。设置的更改立即生效,且能在保存/加载间保持。 + +--- + +## debug + +打印网络拓扑的总概。 + + +```lua +network:debug() +-- === Network Debug === +-- Controller: BlockPos{x=-25, y=70, z=10} +-- Nodes: 1 +-- Node BlockPos{x=-25, y=70, z=9}: 1 cards +-- NORTH: cobblestone_storage (storage) +-- Terminals: 1 +-- BlockPos{x=-26, y=70, z=9} +-- CPUs: 0 +-- Crafters (Instruction Sets): 0 +-- Processing APIs: 0 +-- Variables: 0 +``` + \ No newline at end of file diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/lua-api/placer-handle.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/lua-api/placer-handle.md new file mode 100644 index 000000000000..cbfc221f9370 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/lua-api/placer-handle.md @@ -0,0 +1,76 @@ +--- +navigation: + parent: lua-api/index.md + title: PlacerHandle + icon: placer +categories: + - api_types +description: 用于在其前方放置方块的设备 +--- + +# PlacerHandle + +`PlacerHandle`(放置器句柄)是对网络中的引用,由[`network:get(name)`](network.md#get)返回。它会从[网络存储](../nodeworks-mechanics/network-storage.md)中抽取一个所选物品,并将其作为方块放置在自身前方的位置。 + + + +`:place(...)`为同步操作,它会在脚本调用的同一刻返回`true`/`false`。过程不会占用多个刻,不会返回builder对象,也不接受回调函数。只有`BlockItem`物品(有可放置的方块形态)能成功执行,对工具、食物,或任意无法放置的物品调用会立即失败。 + +## 属性 + +- **`.name`** + - 放置器的别名(和终端侧边栏中的一致) + +## place + +从网络存储中抽出一个所选物品,将其放在放置器前方的位置。成功放置返回`true`。 + +参数可以是物品ID字符串或[ItemsHandle](./items-handle.md)。若传入handle,放置器会读取其`.id`,并从网络存储中抽取一个*该物品*,方式与直接传入字符串一致。此方法不会抽取handle本身的来源,而是会向网络中的存储卡抽取。 + + +```lua +local placer = network:get("placer_1") +placer:place("minecraft:cobblestone") +``` + + +以下情况会返回`false`(且不进行放置): +- 网络中没有可用的匹配物品 +- 目标位置不是空气 +- 物品无法放置(如`minecraft:diamond`、`minecraft:stick`) + + +```lua +local placer = network:get("bridge_builder") +local ok = placer:place("minecraft:oak_planks") +if not ok then + print("未放置,网络存储中没有木板或目标位置已被阻挡") +end +``` + + +## block + +返回放置器前方方块的ID,规格与[`ObserverCard:block`](./card-handle.md#侦测卡)一致。适合用在`:place`前面,对“位置是否为空/是否是预期中的方块”进行判断。 + + +```lua +local placer = network:get("placer_1") +if placer:block() == "minecraft:air" then + placer:place("minecraft:torch") +end +``` + + +## isBlocked + +若目标位置不可被替换(不是空气,也不是矮草丛、雪等可被替换的方块),返回`true`;否则返回`false`。若只需要知道该处是否被阻挡,使用此方法的开支要小于调用`:place`再检查返回值。 + + +```lua +local placer = network:get("placer_1") +if not placer:isBlocked() then + placer:place("minecraft:cobblestone") +end +``` + diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/lua-api/presets.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/lua-api/presets.md new file mode 100644 index 000000000000..01921cae237f --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/lua-api/presets.md @@ -0,0 +1,92 @@ +--- +navigation: + parent: lua-api/index.md + title: 预设 + icon: terminal +categories: + - api_builtin +description: 声明式的builder(importer、stocker),是常见物品移动和补货操作的样板 +--- + +# 预设 + +预设是声明式的builder,适用于两种经常出现的脚本样板:**将物品从A移动到B**和**补充库存水平**。这两种预设都是链式方法调用,从左往右可直接按照自然语言读出,并用`:start()`结尾以启动。 + +预设基于现有的脚本API存在。它们也是Lua脚本,也按同样的方式使用卡片和筛选器,也同样会在脚本停止时停止。区别在于,1行预设就相当于大约15行的手动状态追踪scheduler循环。 + + +```lua +-- 将农场箱子中的圆石移动到网络存储,每秒一次 +importer:from("mobFarm"):filter("$item:cobblestone"):to(network):start() +-- 保证发射器中有64根箭,缺少时自动合成。 +stocker:ensure("minecraft:arrow"):to("dispenser"):keep(64):start() +``` + + +## 现有预设 + +* [Importer](importer.md)(导入器)会将物品从任意多个来源移动至任意多个目标。默认模式为填充(填满目标后再继续到下一个)。调用`:roundrobin()`可在目标间轮询。 +* [Stocker](stocker.md)(补货器)会按照`:keep(n)`水位线保证目标的库存量,可通过从网络存储中抽取、合成以达成,或两种方法均使用。达到水位线后不再抽取。 + +## 来源与目标的引用 + +预设接受三种形式的来源和目标: + +1. **string**(字符串)卡片别名:`"bufferChest"`。 +2. 来自`network:get(...)`的**CardHandle**。 +3. **`network`**‌全局变量本身,代表“整个网络存储”。 + + +```lua +-- 可以混用这三种形式。 +importer:from("farm", network:get("secondary"), network) + :to("output") + :start() +``` + + +卡片解析会在每次网络拓扑改变时进行,因此卡片被取出或同名替换时不会重启预设。预设会静默跳过缺失的卡片,直到它们返回为止。 + +## 通用方法 + +所有`ImporterBuilder`和`StockerBuilder`都使用同一种生命周期和控制方法。 + +### every + + +```lua +ImporterBuilder:every(ticks: number): ImporterBuilder +StockerBuilder:every(ticks: number): StockerBuilder +``` + + +设置预设重新运行的频率。默认为20刻(每秒一次)。运行中途改变频率会取消当前的scheduler任务,并按新间隔重新注册,所以`imp:every(5)`会立即生效。 + +### start / stop / isRunning + + +```lua +ImporterBuilder:start() +ImporterBuilder:stop() +ImporterBuilder:isRunning(): boolean +``` + + +`:start()`会注册链式调用并开始计刻。若builder已在运行则相当于无操作,因此重复调用能保证安全。`:stop()`会停止计刻,但能保留所有配置;后续再次使用`:start()`即可恢复同一个链式调用,其中也包括所有轮询目的位置。 + + +```lua +local imp = importer:from("src"):to("dst") +scheduler:second(function() + if someCondition() and not imp:isRunning() then + imp:start() + elseif imp:isRunning() and not someCondition() then + imp:stop() + end +end) +``` + + +## 脚本停止时清理 + +脚本终端停止时(手动或断开网络),脚本生命周期内注册的所有预设也会自动停止。悬空的builder(即创建后从未`:start()`)也会被清理。再次启动脚本会从头重建所有预设,因此无需在运行间隙更改链式代码时担心垃圾残余。 diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/lua-api/scheduler.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/lua-api/scheduler.md new file mode 100644 index 000000000000..4e8238626f6b --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/lua-api/scheduler.md @@ -0,0 +1,70 @@ +--- +navigation: + parent: lua-api/index.md + title: Scheduler + icon: minecraft:repeater +categories: + - api_builtin +description: 每刻运行/每秒运行/延迟回调函数 +--- + +# Scheduler + +`scheduler`(规划器)模块会注册周期性和延时式回调函数,计时基准为服务端刻(20 TPS)。每次注册会返回一个任务ID,可将其传入`:cancel`以停止。 + +> **提示:**‌若想要脚本不断运行[`scheduler:tick`](scheduler.md#tick)或[`scheduler:second`](scheduler.md#second),建议开启的[“自动运行”](../items-blocks/scripting_terminal.md#自动运行)。 + +![](../assets/images/autorun.png) + +## tick + +每服务端刻运行一次所给回调函数 + + +```lua +scheduler:tick(function() + -- 每秒运行20次 +end) +``` + + +## second + +每秒(20刻)运行一次所给回调函数 + + +```lua +scheduler:second(function() + -- 每秒运行1次 +end) +``` + + +## delay + +将回调函数延迟所给刻数。 + + +```lua +scheduler:delay(20, function() + -- 经过1秒再运行 +end) +``` + + +## cancel + +停止所给ID对应的任务。对已取消和已过期ID调用能保证安全。 + + +```lua +local task = scheduler:tick(function() + print("hello") +end) +-- 在1秒后取消scheduler:tick任务 +scheduler:delay(20, function() + scheduler:cancel(task) +end) +-- "hello"(x20) +``` + diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/lua-api/stocker.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/lua-api/stocker.md new file mode 100644 index 000000000000..f280d1006715 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/lua-api/stocker.md @@ -0,0 +1,155 @@ +--- +navigation: + parent: lua-api/index.md + title: Stocker + icon: minecraft:observer +categories: + - api_types + - api_preset +description: 通过抽取、合成,或两者并用保证目标存量足够 +--- + +# Stocker + +`stocker`(补货器)全局变量能建造库存水平维持器。设置好目标容器、`:keep(n)`水位线、来源(抽取、合成、两者并用)后,stocker就会在容器库存量低于水位线时进行补货。库存量超出水位线时不会抽出多余量,若玩家往里多放了些,多出的部分也不会被取走。 + +## 三种来源模式 + +stocker链以三种工厂方法之一起始,可根据物品来源选择其中一种。 + +### from + + +```lua +Stocker:from(...sources: string | CardHandle | network): StockerBuilder +``` + + +从卡片或网络存储中抽取。短缺时不会合成。适用于“只从这个缓存箱里抽取”和“从网络存储里抽取,缺少时等待”的场景。与[`:filter`](./stocker.md#filter)配合可匹配特定种类的物品,不指定筛选器时stocker会抽取任意物品直到达成`:keep(n)`的要求。 + + +```lua +-- 从指定的两个箱子里抽取箭 +stocker:from("chest1", "chest2"):filter("$item:arrow"):to("dispenser"):keep(64):start() + +-- 从网络存储抽取,抽空则等待 +stocker:from(network):filter("$item:arrow"):to("dispenser"):keep(64):start() +``` + + +### ensure + + +```lua +Stocker:ensure(itemId: string): StockerBuilder +``` + + +首先从网络存储中抽取,短缺时合成剩余部分。最常用的来源模式,适用于“确保有N个物品”的场景。需接受精确物品ID,因为合成计划本身需要有确切的产物。 + + +```lua +stocker:ensure("minecraft:arrow"):to("dispenser"):keep(64):start() +stocker:ensure("minecraft:iron_ingot"):to(network):keep(256):start() +``` + + +### craft + + +```lua +Stocker:craft(itemId: string): StockerBuilder +``` + + +只通过合成补货,不从现有存储空间中抽取。如需保证产物为新合成状态,或资源稀缺以至于合成优于抽取,可选择此来源模式。 + + +```lua +stocker:craft("minecraft:bread"):to("foodChest"):keep(16):start() +``` + + +## 必选方法 + +### to + + +```lua +StockerBuilder:to(target: string | CardHandle | network): StockerBuilder +``` + + +设置目标。接受卡片别名、CardHandle对象,以及代表“保证网络库存量”的`network`。stocker会统计目标中匹配物品的数量,使用`network`时,则统计所有存储卡。 + +### keep + + +```lua +StockerBuilder:keep(amount: number): StockerBuilder +``` + + +目标的库存量水平。stocker会补货至达到此值为止。若当前数量超出此值(玩家额外放入、其他脚本输入等),stocker也不会抽出。stocker只会送入,永远不会抽出。 + +## 可选方法 + +### filter + + +```lua +StockerBuilder:filter(pattern: string): StockerBuilder +``` + + +限制目标中`:keep(n)`统计的资源种类。默认为`*`(任意物品)。如需stocker在多种来源间仅统计特定种类的物品,可设置此值。**`:ensure`和`:craft`会自动设置此值**至相应的物品ID,因此仅有`:from`需要专门指定`:filter`。 + + +```lua +stocker:from("buffer") + :filter("$item:arrow") + :to("dispenser") + :keep(64) + :start() +``` + + +### batch + + +```lua +StockerBuilder:batch(size: number): StockerBuilder +``` + + +将合成请求聚合至该单次数量。默认为0,代表“缺多少补多少”(缺少3个时就合成3个,无论配方的消耗有多小)。设为`:batch(64)`可让stocker一次性合成64个;此设置适合设施开支大(多输入、多步骤)的配方使用,这些配方若以多个小作业的数量发出会严重拖慢CPU。 + + +```lua +stocker:craft("minecraft:iron_ingot"):to("chest"):keep(64):batch(32):start() +-- 短缺10个时合成32个,补货后目标可能能暂时性存有74个物品。 +``` + + +目标存量可能会因单次数量过大而超出`:keep(n)`,后续计刻时stocker便什么都不会做,直至库存量再次低于水位线为止。 + +## 示例:为发射器补充箭,缺少时合成 + + +```lua +stocker:ensure("minecraft:arrow") + :to("trapDispenser") + :keep(64) + :batch(16) + :every(20) + :start() +``` + + +每秒:若发射器中箭的数量少于64,则首先从网络存储抽取;若仍短缺,合成16个。重复至发射器补充完毕。 + +## 延伸阅读 + +* [通用预设方法](presets.md#通用方法)(`:every`、`:start`、`:stop`、`:isRunning`)。 +* [Importer](importer.md)(导入器),A到B的持续供货,与库存量无关。 +* [Network:craft](network.md#craft),合成原语详情。 diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/lua-api/user-handle.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/lua-api/user-handle.md new file mode 100644 index 000000000000..a693457560bd --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/lua-api/user-handle.md @@ -0,0 +1,126 @@ +--- +navigation: + parent: lua-api/index.md + title: UserHandle + icon: user +categories: + - api_types +description: 能使用物品右击其前方方块的设备 +--- + +# UserHandle + +`UserHandle`(使用器句柄)是对网络中的引用,由[`network:get(name)`](network.md#get)返回。它会从[网络存储](../nodeworks-mechanics/network-storage.md)中抽取一个物品,并用其右击前方方块。 + + + +使用器有两种模式。**瞬时**模式下,每次调用`:use()`会发起单次右击。**保持**模式下,则会按住鼠标右键,直至`:stop()`运行(或物品完成了操作,或超出了30秒时限)。筛选器语法与一致。 + +## 属性 + +- **`.name`** + - 使用器的别名(和终端侧边栏中的一致) +- **`.kind`** + - 必定是`"user"` + +## use + +触发使用器。**瞬时**模式下仅右击一次,并返回操作的执行地点。**保持**模式下则按住鼠标右键,返回是否进入按住右键状态。 + +若使用器正在使用、在冷却中、被筛选器阻止,或网络存储中没有匹配物品,或网络中没有控制器,则返回`false`(且不会触发)。 + + +```lua +local farmer = network:get("crop_farmer") +farmer:use() +``` + + +如需完全重启按住右键操作,可先调用`:stop()`。 + +## stop + +取消计划中的瞬时点击,或释放按住操作。空闲时调用能保证安全,即不会报错,且返回`false`。将物品送回网络存储的收缩动画无法取消。 + + +```lua +local user = network:get("user_1") +local watcher = network:get("observ_1") +user:setMode("hold") +user:use() -- 对可疑的方块使用刷子 +-- 方块变为普通的沙子和沙砾时,停止使用器 +watcher:onChange(function(block: BlockId, state: any) + if block == "minecraft:gravel" or block == "minecraft:sand" then + user:stop() + end +end) +``` + + +## isUsing + +正按住右键时返回`true`,否则返回`false`。 + + +```lua +local user = network:get("user_1") +if not user:isUsing() then + user:use() +end +``` + + +## mode + +以字符串形式返回当前模式,必定为`"instant"`或`"hold"`。 + + +```lua +local user = network:get("user_1") +print(user:mode()) -- "instant" +``` + + +## setMode + +设置使用器的模式。接受`"instant"`和`"hold"`(忽略大小写)。 + + +```lua +local user = network:get("crop_farmer") +user:setMode("hold") +``` + + +## filter + +以字符串形式返回当前筛选器规则,未设置时返回空值。 + + +```lua +local user = network:get("user_1") +print(user:filter()) -- "minecraft:bone_meal" +``` + + +## setFilter + +设置使用器是筛选器规则。筛选器语法与一致,也即物品ID、`#namespace:tag`、`minecraft:*`、`/正则表达式/`、`$item:`/`$fluid:`前缀均可用。 + + +```lua +local user = network:get("crop_farmer") +user:setFilter("minecraft:bone_meal") +``` + + +## facing + +以全小写字符串形式(`"north"`、`"south"`、`"east"`、`"west"`、`"up"`、`"down"`)返回使用器的朝向. + + +```lua +local user = network:get("user_1") +print(user:facing()) -- "north" +``` + diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/lua-api/variable-handle.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/lua-api/variable-handle.md new file mode 100644 index 000000000000..5250c8bc31df --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/lua-api/variable-handle.md @@ -0,0 +1,199 @@ +--- +navigation: + parent: lua-api/index.md + title: VariableHandle + icon: variable +categories: + - api_types +description: 对网络中的引用 +--- + +# VariableHandle + +`VariableHandle`(变量器句柄)是对网络中的引用,由[`network:get(name)`](network.md#get)(与卡片所用的访问端口相同)返回。handle会追踪变量器声明的类型。除去下文的通用核心API外,不同类型的变量还会获得相应的帮助方法。 + + + +> **注意:**‌所有修改操作均为原子操作。对同一个变量器调用的`:set`和`:cas`无法在中途退出。 + +## 属性 + +- **`.name`** + - 变量器的别名(和终端侧边栏中的一致) + +## 核心方法 + +### get / set + +获取和设置变量器的当前值。 + + +```lua +local myNumericVar = network:get("myNumericVar") +print(myNumericVar:get()) +myNumericVar:set(1) +print(myNumericVar:get()) +-- "0" +-- "1" +``` + + +### cas + +比较与交换(Compare-and-swap)。仅在变量器当前值等于`expected`时将其修改为`new`,否则保留当前值不变。成功交换返回`true`,若有其他来源修改了变量器则返回`false`。 + +每当需要**根据当前值**写入新值时,或会有多个脚本修改变量器时,都应使用此方法。`:set`不会对原值进行判断,相互竞争的两个脚本可能会破坏双方的运行过程。`:cas`只会在原值与预期一致时写入,其他情况均拒绝。 + + +```lua +-- 竞标:第一个读到""的脚本获胜 +if slot:cas("", "worker_A") then + print("我抢到了") +else + print("其他人抢到了") +end +``` + + +典型的读取-修改-写入循环中途出现值变动: + + +```lua +-- 仅在>0时递减,遇到竞态条件时重试 +while true do + local current = counter:get() + if current <= 0 then + break -- 不需再递减 + end + if counter:cas(current, current - 1) then + break -- 成功递减 + end + -- 其他脚本在:get和:cas之间修改了值,再试一遍 +end +``` + + +> **注意:**‌对于算术操作而言,[`increment和decrement`](variable-handle.md#increment--decrement)已经是原子操作了,而且它们更简洁。如果修改操作不只是加减一个数,应使用`:cas`。 + +### type + +以字符串形式返回此`VariableHandle`的“类型”。 + +- **`NumberVariableHandle`** + - `"number"` +- **`BoolVariableHandle`** + - `"bool"` +- **`StringVariableHandle`** + - `"string"` + + +```lua +local numberVar = network:get("numberVar") +local boolVar = network:get("boolVar") +local stringVar = network:get("stringVar") +print(numberVar:type()) +print(boolVar:type()) +print(stringVar:type()) +-- "number" +-- "bool" +-- "string" +``` + + +## BoolVariableHandle + +指向声明`bool`(布尔值)变量的的[`VariableHandle`](./variable-handle.md)。追加了仅适用于布尔值变量的方法。 + +### toggle + +翻转当前值(`true`变为`false`,`false`变为`true`)并返回新值。 + + +```lua +local lights = network:get("lights") +print(lights:get()) +lights:toggle() +print(lights:get()) +-- "false" +-- "true" +``` + + +> **注意:**‌可用作经由[`RedstoneCard:onChange`](./card-handle.md#onchange)接至红石按钮的“按下以切换”操作。 + +### tryLock / unlock + +复用为互斥锁的布尔值变量。`:tryLock()`会将变量从`false`原子地改为`true`,成功时返回`true`。若变量已经是`true`(有其他脚本锁定),则返回`false`,**且不进行锁定**。`:unlock()`可将其改回`false`。 + + +```lua +local mutex = network:get("job_mutex") -- 布尔值变量 +if mutex:tryLock() then + -- 干活 + mutex:unlock() +end +``` + + +> **重要:**‌若互斥锁已所得,`:tryLock`不会进行等待,而是会立即返回`false`。后续行为——无论是间隔一段时间再尝试([`scheduler:delay`](scheduler.md#delay)),或是直接跳过执行——都需由脚本本身实现。 +> +> 成功执行的`:tryLock`须与`:unlock`配对。临界区应如上方示例由`pcall`包起,这样代码出错时便不会死锁。 + +## NumberVariableHandle + +指向声明`number`(数)变量的的[`VariableHandle`](./variable-handle.md)。追加了仅适用于数变量的方法。 + +### increment / decrement + +对变量当前值进行加法或减法。两方法均需接受一个量,且均会返回新值。 + + +```lua +local counter = network:get("counter") +counter:set(0) +counter:increment(1) -- +1 -> 1 +counter:increment(5) -- +5 -> 6 +counter:decrement(2) -- -2 -> 4 +``` + + +### min / max + +- `:min(n)`将变量设为当前值和`n`之间的较小值。 +- `:max(n)`设为较大值。 + +两方法均会返回新值。 + + +```lua +local best = network:get("best_score") +best:set(42) +best:max(50) -- 42 vs 50 -> 50(新较大值) +best:max(35) -- 50 vs 35 -> 50(不变) +best:min(10) -- 50 vs 10 -> 10(新较小值) +``` + + +## StringVariableHandle + +指向声明`string`(字符串)变量的的[`VariableHandle`](./variable-handle.md)。追加了仅适用于字符串变量的方法。 + +### append / length / clear + +- `:append(str)`将`str`接到当前值后方,返回新字符串。 +- `:length()`返回当前值中字符串的数量。 +- `:clear()`清空变量(设为`""`)。 + + +```lua +local log = network:get("log") +log:clear() +log:append("开头 ") +log:append("中间 ") +log:append("结尾") +print(log:get()) +print(log:length()) +-- "开头 中间 结尾" +-- 16 +``` + \ No newline at end of file diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/nodeworks-mechanics/autocrafting.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/nodeworks-mechanics/autocrafting.md new file mode 100644 index 000000000000..e9b744572c15 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/nodeworks-mechanics/autocrafting.md @@ -0,0 +1,125 @@ +--- +navigation: + parent: nodeworks-mechanics/index.md + title: 自动合成 + icon: crafting_core +categories: + - mechanic +--- + +# 自动合成 + +自动合成是能将“我想要64个铁镐”转化成64个真正的铁镐的系统。你需要告诉网络哪些配方可用,网络会暂存原材料,并让进行自动合成。 + + + + + + +## 让它跑起来 + +你需要同一网络中有四样东西: + +1. **一个CPU。**‌放下一个,紧贴它放置一个,并将核心接至。缓存器、冷却器、载件等额外组件的信息,参见[合成CPU](../items-blocks/crafting_cpu.md)。 +2. **配方。**‌将各配方编码到(原版3×3合成)或(其余)中,再把它们放到中,并接入网络。 +3. **原材料。**‌所需原材料必须位于[网络存储](./network-storage.md)之中。所有通过接入的箱子均可。 +4. **提出请求的方法。**‌可以在中点选,或者通过中脚本调用`network:craft(...)`。 + +四样备齐之后,网络能制作的物品便会出现在物品栏终端内(可通过筛选器显示,也可按住左Alt显示加号),而`network:craft("...")`也会返回一个builder而非nil。 + +## 请求合成 + +### 通过物品栏终端 + +打开终端,找到物品,对其`Alt点击`。输入数量并确认。终端顶部的**合成队列**会显示所有排队的物品。合成完成时,产物会附带上一个标记,此时即可取出产物。不过下一次再次打开终端时,这些产物就将与其他资源汇合。 + +按住`Alt`可高亮网络知晓制作方式的所有可自动合成物品,即便库存量为0也会显示。 + +### 通过脚本 + +脚本可通过`network:craft`排队合成作业,并决定产物的去向: + + +```lua +-- 产物会在制作完成后自动存入网络存储 +network:craft("minecraft:door") +``` + + +或也可链式通过`:connect(fn)`在合成完成时执行自定义代码 + + +```lua +local furnace = network:get("someFurnaceCard") +network:craft("minecraft:charcoal"):connect(function(item: ItemsHandle?) + if item then + furnace:insert(item) + end +end) +``` + + +完整的API参见[network:craft](../lua-api/network.md#craft)和[CraftBuilder](../lua-api/craft-builder.md)。 + +## 取消合成 + +右击打开其GUI。**“取消”**‌按钮会在当前有合成作业时出现。点击可终止合成作业,将缓存的所有资源退还至网络存储,并释放CPU。 + +## 处理集需要handler + +配方仅凭自身即可工作。原版的3x3合成无需外部依赖,CPU清楚如何处理它们。 + +配方则不然。处理集只是*声明*了配方(“8个粗铁会变成8个铁锭”),但并不会提及这种转化**如何**发生。需要有东西来把粗铁放进熔炉,再把锭拿回来,这个东西就是**handler**。 + +handler有两种注册方式: + +### 通过处理操作器 + + + + + + 指向熔炉顶面的蓝色频道存储卡 + + + 指向熔炉底面的红色频道存储卡 + + + +放置并在其GUI中为其绑定配方。将其后部接至主网络,并从其前部出发将子网接至具体的机器。CPU会管理操作器,无需编写脚本。这也是基本上所有“一侧进原料,另一侧出产物”机器的恰当操作方法。 + +### 通过脚本handler + +对于需要控制时序、条件路由、多步流程的配方,可以在中编写一个Lua handler: + + +```lua +local furnace = network:get("someFurnaceCard") +network:handle("...", function(job: Job, inputs: InputItems) + -- 把粗铁送至熔炉顶面(类似于熔炉上接漏斗) + furnace:face("top"):insert(inputs.rawIron) + -- 等待产物,完成时从熔炉底面抽出(也和漏斗类似) + job:pull(furnace:face("bottom")) +end) +``` + + +若试图自动合成需要处理集又未注册handler的资源,那么合成会失败,并告知哪个配方缺少handler。 + +完整样例参见[network:handle](../lua-api/network.md#handle)、[Job](../lua-api/job.md)、[InputItems](../lua-api/input-items.md)。 + +## 出错时怎么做 + +合成失败时,会在其周围间歇性产生红色的红石粉粒子云。直至打开核心的GUI解除错误,或是发起能成功的新合成作业后,粒子云才会消失。排障时首先找红色粉状粒子,检查核心是最快获知CPU错误的方式。 + +![](../assets/images/crafting_cpu_erroring.png) + +CPU回报的具体消息: + +| 消息 | 意义 | +| ----------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ | +| (x, y, z)处的CPU未形成 | 核心未接触,或核心未接至网络。 | +| 缺少原材料:N× 某物品……没有可用配方且库存不足。 | 网络无法找到这些物品,也没有可以制作它们的配方。向接入网络的箱子补货,或是编写配方。 | +| 未注册handler:X。在相连终端的脚本内添加`network:handle("recipe", ...)`调用。 | X是缺少Lua handler驱动的处理集配方。参见上文[处理集需要handler](./autocrafting.md#处理集需要handler)。 | +| 合成需要使用N种物品,而CPU仅能存下M种。请追加缓存器或升级。 | CPU的数量不足以容纳合成中间步骤的所有物品种类。追加缓存器。 | +| 合成需要在缓存器内暂存至少N个某种物品,而CPU仅能存下M个。请为缓存器升级或进行追加。 | 问题相同但方向不同:合成作业中某一步超出了缓存器单类型的容量。 | diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/nodeworks-mechanics/cards.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/nodeworks-mechanics/cards.md new file mode 100644 index 000000000000..27b4b5feddaf --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/nodeworks-mechanics/cards.md @@ -0,0 +1,16 @@ +--- +navigation: + parent: nodeworks-mechanics/index.md + title: 卡片 + icon: blank_card +categories: + - mechanic +--- + +# 卡片 + +“卡片”通常指的是放在内部、可供网络交互的组件。 + +卡片列表如下: + + diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/nodeworks-mechanics/devices.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/nodeworks-mechanics/devices.md new file mode 100644 index 000000000000..1232a3b6a36a --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/nodeworks-mechanics/devices.md @@ -0,0 +1,14 @@ +--- +navigation: + parent: nodeworks-mechanics/index.md + title: 设备 + icon: variable +categories: + - mechanic +--- + +# 设备 + +“设备”指的是可连接至网络且可编写脚本的方块。 + + diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/nodeworks-mechanics/index.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/nodeworks-mechanics/index.md new file mode 100644 index 000000000000..a233cd508d73 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/nodeworks-mechanics/index.md @@ -0,0 +1,9 @@ +--- +navigation: + title: 节点工程机制 + position: 30 +--- + +# 节点工程机制 + + \ No newline at end of file diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/nodeworks-mechanics/network-storage.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/nodeworks-mechanics/network-storage.md new file mode 100644 index 000000000000..349c6ce71ca4 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/nodeworks-mechanics/network-storage.md @@ -0,0 +1,56 @@ +--- +navigation: + parent: nodeworks-mechanics/index.md + title: 网络存储 + icon: minecraft:chest +categories: + - mechanic +--- + +# 网络存储 + +网络存储是节点工程网络视为自身具有的物品/流体共享储存空间。所有安装有的方块均为该空间的成员。脚本可对其读写,能显示它和与它交互,合成系统则能从中取出原材料。 + + + + + 将此箱子纳入网络存储 + + + 将此箱子纳入网络存储 + + + 可以通过查看网络存储 + + + +## 网络存储空间的成员 + +绑定至的所有方块的所有内容物。若破坏了存储卡的节点连接,则相应方块会立即脱离网络存储。 + +### 非空间成员 + +对应的方块不是网络存储的成员。脚本需要显式对IO卡方块送入/取出物品。网络无法通过`network:find`查看这些方块的内容物,也不会列出它们。 + +## 优先级与路由 + +每一张都有其**优先级**,用于控制`network:insert`/`:tryInsert`的填充顺序。写操作会首先前往优先级最高、相匹配的卡片,并在填满后溢出到优先级较低的卡片。同优先级的卡片按连接顺序填充。 + +脚本可通过[`network:route`](../lua-api/network.md#route)注册路由而覆盖默认的优先级顺序。 + +可在卡片的GUI内直接设置其优先级,界面详情参见[存储卡](../items-blocks/storage_card.md#配置)。也可使用一次性为多张卡片复制优先级(以及所有其他卡片设置)。 + +## 与网络存储相关的脚本 + +与网络存储交互所用读写函数的完整列表参见[网络API](../lua-api/network.md)页面。 + +## 通过物品栏终端进行查看和管理 + + + + + + +是不依赖脚本查看网络存储和与之交互的主要方式。它们会在槽位方格内显示网络存储的内容,允许你搜索、从中取出物品、放入物品,以及请求合成。它们会向网络中的各存储卡实时获取内容。 + +界面详情参见[物品栏终端](../items-blocks/inventory_terminal.md)页面。 diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/nodeworks-mechanics/subnets.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/nodeworks-mechanics/subnets.md new file mode 100644 index 000000000000..9709930d50a5 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/_zh_cn/nodeworks-mechanics/subnets.md @@ -0,0 +1,51 @@ +--- +navigation: + parent: nodeworks-mechanics/index.md + title: 子网 + icon: broadcast_antenna +categories: + - networking + - mechanic +--- + +# 子网 + +子网本质上是独立的网络,只是会把自身的部分功能无线向其他网络公开。每一个子网都有其、存储空间、合成设施。它们通过配对的与主网交流。 + + + + + +## 为何要拆分网络 + +对于小型基地来说,单一网络就已足够;但随着机器和配方的不断加入,拆分就变成了很好的网络组织方式: + +- **特化**。使用专用于烧炼、酿造、矿物处理的子网,可将原本散落在基地各处的有关配方和机器汇总在一起。 +- **重用**。只需搭建一次烧炼子网,之后把所有配方和它配对即可。 +- **隔离**。子网的崩溃、卡顿、合成阻塞不会影响外部。每个网络都有自身的CPU、网络存储、脚本。 +- **整洁**。主网络只能看见子网广播的配方,从而将管道和机器隐藏起来。 + +## 公开处理配方 + +最常见的子网设施如下:子网内有一方块集群,其中有一系列配方;广播即可让其他网络在自动合成时取用它们。 + +1. 在子网中,搭建集群,放入子网应公开的各。 +2. 直接在集群内任意的上方放置。 +3. 在天线的GUI内使用进行配对。 +4. 在接收网络中,向网络接入,并在其GUI中放入同一块。 + +如此,接收网络即能看见子网处理存储器集群中的所有配方,如同网络在本地拥有这些配方一样。需用到这些配方的合成作业和其他自动合成的行为一致。 + +机器和原材料依然归子网所有。接收网络需要请求产物,并静待子网发来。 + +## 无线物品传输 + +在上方的配对后,子网还可通过该导出箱直接交换物品。配对方式参见导出箱和接收天线页面。 + +## 范围 + +天线的默认范围为128格。范围升级可将其扩展至跨更多区块和跨维度,所以子网不必紧邻主网搭建。常见的用法有: + +- 下界的烧炼子网向主世界的主基地供应产物。 +- 生物农场将掉落物广播至别处的分拣基地。 +- 共享式“图书馆”子网,提供通用配方给服务端内其他所有基地使用。 diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/assets/examples/moving-items.lua b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/assets/examples/moving-items.lua new file mode 100644 index 000000000000..8a6f5655c70c --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/assets/examples/moving-items.lua @@ -0,0 +1,7 @@ +local input = network:get("input") +local output = network:get("output") + +local allItems = input:find("*") -- get all the items in this container +if allItems then -- if we found any items + output:insert(allItems) +end diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/assets/images/inventory_terminal_gui.png b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/assets/images/inventory_terminal_gui.png new file mode 100644 index 000000000000..70652310a820 Binary files /dev/null and b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/assets/images/inventory_terminal_gui.png differ diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/assets/images/inventory_terminal_gui_expanded.png b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/assets/images/inventory_terminal_gui_expanded.png new file mode 100644 index 000000000000..895cf04b1ca0 Binary files /dev/null and b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/assets/images/inventory_terminal_gui_expanded.png differ diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/assets/images/node_gui.png b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/assets/images/node_gui.png new file mode 100644 index 000000000000..d7664f7e5bba Binary files /dev/null and b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/assets/images/node_gui.png differ diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/example-setups/automated-celestine-farm.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/example-setups/automated-celestine-farm.md new file mode 100644 index 000000000000..d5be622d9035 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/example-setups/automated-celestine-farm.md @@ -0,0 +1,29 @@ +--- +navigation: + parent: example-setups/index.md + icon: celestine_shard + title: Celestine Farm +categories: + - example +--- + +# Celestine Farm + + can be easily farmed using a and a . + + + + + + +Or optionally you can use Focus Nodes to connect everything together + + + + + + +Then in the GUIs of the Breakers you set them to Low redstone mode which keeps them +active without a redstone signal. And set each of them to break . + +They'll break the fully grown celestine clusters and insert them into [network storage](../nodeworks-mechanics/network-storage.md). \ No newline at end of file diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/example-setups/automated-smelting.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/example-setups/automated-smelting.md new file mode 100644 index 000000000000..820a372c3a48 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/example-setups/automated-smelting.md @@ -0,0 +1,37 @@ +--- +navigation: + parent: example-setups/index.md + icon: minecraft:furnace + title: Automated Smelting Subnet +categories: + - example +--- + +# Automated Smelting Subnet + +You can bridge two networks together using a and an . This example shows a network pushing its `#c:raw_material` items to a smaller network with an array of furnaces. That smaller network then pushes its cooked results back +to the original network. + + + + + + Export Chest from the Blue Network has items pushing Down set in its GUI. + + **These two chests don't connect to each other, they're part of two separate + networks.** + + + Export Chest from the Green Network is pushing its items Up which is set in its GUI. + + **These two chests don't connect to each other, they're part of two separate + networks.** + + + Storage Cards set to the Red Channel are being pulled from by the Export Chest using the filter `*` to grab everything + + + Storage Cards set to the Blue Channel is where the Import Chest is pushing items to using round-robin + + + diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/example-setups/cobble-gen.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/example-setups/cobble-gen.md new file mode 100644 index 000000000000..3a5543ea44e1 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/example-setups/cobble-gen.md @@ -0,0 +1,38 @@ +--- +navigation: + parent: example-setups/index.md + icon: minecraft:cobblestone + title: Cobblestone Generator +categories: + - example +--- + +# Cobblestone Generator + +Cobblestone generators is the simplest way to use a . +Place a Breaker in front of a cobblestone generator like the following + + + + + + + + + +Then you configure the Breaker to break `minecraft:cobblestone` with the redstone +mode set to **Low** to make it always active. + +![image of the breaker GUI with cobblestone set as its filter to break](../assets/images/breaker_cobblestone.png) + +Or if you had a in your network you can use the following +script to achieve the same thing but for many breakers. + + +```lua +local breaker_1 = network:get("breaker_1") +scheduler:second(function() + breaker_1:mine() -- always mine +end) +``` + \ No newline at end of file diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/example-setups/index.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/example-setups/index.md new file mode 100644 index 000000000000..3d500fa9d18e --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/example-setups/index.md @@ -0,0 +1,9 @@ +--- +navigation: + title: Example Networks + position: 50 +--- + +# Examples + + \ No newline at end of file diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/example-setups/milky-soul-ball-farm.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/example-setups/milky-soul-ball-farm.md new file mode 100644 index 000000000000..7141b2e08f9b --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/example-setups/milky-soul-ball-farm.md @@ -0,0 +1,36 @@ +--- +navigation: + parent: example-setups/index.md + icon: milky_soul_ball + title: Milky Soul Ball Farm +categories: + - example +--- + +# Milky Soul Ball Farm + + + + + + + + + + + + + User uses empty buckets on cows + + + User uses milk buckets on Soul Sand and puts the resulting Milky Soul Balls + and empty bucket back into Network Storage + + + Placer places soul sand in front of the User + + + +This farm has a milking cows using empty buckets and put the milk buckets into [Network Storage](../nodeworks-mechanics/network-storage.md). Then another User will use those s on the placed by a + +> **Note:** Placers and Users have redstone mode set to Low so they're all active \ No newline at end of file diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/example-setups/moving-items.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/example-setups/moving-items.md new file mode 100644 index 000000000000..c5950e343c78 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/example-setups/moving-items.md @@ -0,0 +1,111 @@ +--- +navigation: + parent: example-setups/index.md + icon: minecraft:hopper + title: Moving Items +categories: + - example +--- + +# Moving Items + +The simplest task a Nodeworks network can do: pull items from a container into +network storage. This page walks through two variations, the basic case first then +the same setup with filtering. + +--- + +## With Import/Export Chests + +### Inserting items into your network + +Anything placed inside an will be inserted into [Network Storage](../nodeworks-mechanics/network-storage.md) + + + + + + + + + Items placed inside the Import chest will + automatically be pulled into the network + + + +### Extracting items from your network + +s can pull items out of network storage into its inventory + + + + + + + + + Items placed inside the Import chest will + automatically be pulled into the network + + + +--- + +## With a Scripting Terminal + +### Pull all items + +Pull every item from a shulker box into network storage, no filtering. + + + + + + + + + Renamed to **"shulkerBox"** + + + +The script: + + +```lua +importer + :from(shulkerBox) + :to(network) + :start() +``` + + +> **Note:** Or if you want to reverse it, just swap the `:from(shulkerBox)` to `:from(network)` and `:to(shulkerBox)` + +When this script is ran, all items that enter the shulker box will get inserted +into the network's storage (any storage cards that haven't been filtered) + +## Filtering: route by item kind + +Same network but logs go into one storage card, cobblestone into another, and +everything else into the default + + + + + + **Rules**: `#c:cobblestones` + + + + **Rules**: `#c:logs` + + + + + + + Renamed to **"shulkerBox"** + + + +Reusing the same code as before but now each Storage Card has different [filter settings](../items-blocks/storage_card.md#filters). diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/example-setups/smeltery-subnet.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/example-setups/smeltery-subnet.md new file mode 100644 index 000000000000..29583b46a724 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/example-setups/smeltery-subnet.md @@ -0,0 +1,43 @@ +--- +navigation: + parent: example-setups/index.md + icon: minecraft:furnace + title: Smeltery Subnet +categories: + - example +--- + +# Smeltery Subnet + +Using specialized subnets is a good way to delegate responsibility in your network +and to reuse recipes. + + + + + + Red Storage Cards to pull finished items from the furnaces + + + Blue Storage Card for all Processing Handler input items + + + Lime Storage Cards that the Import Chest round-robins items to + + + RoundRobin is enabled + + Channel set to Lime + + + +Above is an example of a **smeltery** subnet with a block that's being broadcasted using a . Any +network can be connected to use its recipes using a . + +Then I have three devices bound to the three processing +sets in the network, all pushing their input items into the . +The Import Chest is set to round-robin into another channel which I've dedicated to Storage Cards +pointing at the top of the furnaces. +Then there are Red Storage Cards pointing at the bottom of the furnaces + +See the [Autocrafting](../nodeworks-mechanics/autocrafting.md) page for more details. \ No newline at end of file diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/getting-started.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/getting-started.md new file mode 100644 index 000000000000..f9198848a1a5 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/getting-started.md @@ -0,0 +1,39 @@ +--- +navigation: + title: Getting Started + position: 10 +--- + +# Getting Started + +## Required Materials + +Nodework networks are powered by the reflective properties of s + +## Growing Celestine + +Growing Celestine like s will grow from +a budding block, + +## First Nodeworks Network + +A simple network with no scripting involved, just viewing items into as many +connected chests as you'd like using an Inventory Terminal. + + + + + + +- This network contains the following: + - 1x + - 1x + - Some s to connect all devices together + - Some s to connect external blocks to the network such as chests + - 1x placed in the Node's face toward the chest + +### Expanding your Nodeworks Network + +- [Moving items](./example-setups/moving-items.md) +- [Autocrafting](./nodeworks-mechanics/autocrafting.md) +- [Example Setups](./example-setups/index.md) diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/index.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/index.md new file mode 100644 index 000000000000..dfd1e8ec80b6 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/index.md @@ -0,0 +1,31 @@ +--- +navigation: + title: Overview + position: 0 +item_ids: +- nodeworks:nodeworks_book +--- + +# Nodeworks + +A programmable logistics and automation network. + + + + + + + +## Sections + +- [Getting Started](./getting-started.md) +- [Scripting Reference](./lua-api/index.md) +- [Nodeworks Mechanics](./nodeworks-mechanics/index.md) +- [Items/Blocks](./items-blocks/index.md) +- [Example Setups](./example-setups/index.md) + +The Scripting Terminal's editor hovers any documented identifier with its signature and +short description, pressing [ ] while hovering opens the relevant page here. + +See [docs/authoring.md](https://github.com/damienfamed75/nodeworks/blob/main/docs/authoring.md) +for how to add to these docs. diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/antenna_coil_assembly.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/antenna_coil_assembly.md new file mode 100644 index 000000000000..09b9d331310f --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/antenna_coil_assembly.md @@ -0,0 +1,21 @@ +--- +navigation: + parent: items-blocks/index.md + icon: antenna_coil_assembly + title: Antenna Coil Assembly +categories: + - infrastructure +description: ingredient for the and +item_ids: +- nodeworks:antenna_coil_assembly +--- + +# Antenna Coil Assembly + +An ingredient for the and + + + +## Recipe + + \ No newline at end of file diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/blank_card.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/blank_card.md new file mode 100644 index 000000000000..d14ef6e7d48c --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/blank_card.md @@ -0,0 +1,21 @@ +--- +navigation: + parent: items-blocks/index.md + icon: blank_card + title: Blank Card +categories: + - card +description: base item for all other [Cards](../nodeworks-mechanics/cards.md) +item_ids: +- nodeworks:blank_card +--- + +# Blank Card + +This is the base item for all other [Cards](../nodeworks-mechanics/cards.md). + + + +## Recipe + + \ No newline at end of file diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/breaker.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/breaker.md new file mode 100644 index 000000000000..1d059fdc1f7f --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/breaker.md @@ -0,0 +1,69 @@ +--- +navigation: + parent: items-blocks/index.md + icon: breaker + title: Breaker +categories: + - device +description: mines and harvests blocks in front of it +item_ids: +- nodeworks:breaker +--- + +# Breaker Block + +The Breaker destroys the block at the position in front of itself over time +and routes the drops back to +[Network Storage](../nodeworks-mechanics/network-storage.md) (or to a +script-supplied handler). Diamond-pickaxe tier, with break duration that uses +the wooden-pickaxe formula so harder blocks take noticeably longer to break. + + + +## Placing + +The Breaker's front face points at whatever you were aiming at when you +placed it down (same shape as a piston or dispenser). The block in front of +that face is what `:mine()` will break. + +## Target filter + +The Breaker's GUI has a filter for which block it should break. Leave it +empty to break anything in front, or set a block to restrict the Breaker +to that target. + +## Tree Felling + +If you place a Breaker at the base of a tree it will fell the whole thing. + + + + + Cutting the last log holding the tree up fells the whole thing + + + + + +## Redstone + +The GUI's redstone setting controls when the Breaker is allowed to fire: + +- **High**: active while powered. +- **Low**: active while unpowered. +- **Ignored**: redstone does nothing. The Breaker only fires when a script + calls `:mine()`. + +## Channel + +The Breaker has a name and channel picker in its GUI. See +[Choosing a Channel](../lua-api/channel.md#choosing-a-channel) for how +channels scope which scripts can address this device. + +## Scripting + +See the [BreakerHandle](../lua-api/breaker-handle.md) page to see the scripting api. + +## Recipe + + diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/broadcast_antenna.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/broadcast_antenna.md new file mode 100644 index 000000000000..1c3b47a9a45a --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/broadcast_antenna.md @@ -0,0 +1,54 @@ +--- +navigation: + parent: items-blocks/index.md + icon: broadcast_antenna + title: Broadcast Antenna +categories: + - infrastructure +description: broadcasts access to Network Controllers, Processing Storage, and Export Chests +item_ids: +- nodeworks:broadcast_antenna +--- + +# Broadcast Antenna + +A block with two purposes, depending on what it's placed on top of: + +- On a : broadcasts wireless access to the +network. A paired to this antenna +can read/write to the network anywhere in range +- On a : broadcasts the block's (and any other +touching ) collection of s +which another network can use for [autocrafting](../nodeworks-mechanics/autocrafting.md) +- On an : broadcasts the chest as a wireless drop-off. +A paired on another network forwards anything +pushed into the chest straight into that network + + + + + + Both Processing Storage blocks are being broadcasted + + + Being broadcasted for Portable Inventory Terminals + + + Pushes items to paired import chests + + + +## Pairing + +1. Open the Broadcast antenna GUI +1. Place a into the top slot +1. Take the Crystal out, it's now paired + +## Range + +By default the range of a broadcasting antenna is 128 blocks. You can upgrade +the range with either a or + +## Recipe + + \ No newline at end of file diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/budding_celestine.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/budding_celestine.md new file mode 100644 index 000000000000..168b03f637a5 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/budding_celestine.md @@ -0,0 +1,38 @@ +--- +navigation: + parent: items-blocks/index.md + icon: budding_celestine + title: Budding Celestine +categories: + - misc +description: grows celestine buds on its surface +item_ids: +- nodeworks:budding_celestine +- nodeworks:celestine_cluster +- nodeworks:large_celestine_bud +- nodeworks:medium_celestine_bud +- nodeworks:small_celestine_bud +--- + +# Budding Celestine + + + + + + +## Obtaining Budding Celestine + +If you want to farm Budding Celestine you can grab it using a Silk Touch pickaxe +and it will forever grow Celestine buds. + +## Where to find + + + + + + + +Budding Celestine can be found in Celestine Geodes naturally around the world just +like Amethyst geodes diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/card_programmer.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/card_programmer.md new file mode 100644 index 000000000000..0c425bc84652 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/card_programmer.md @@ -0,0 +1,37 @@ +--- +navigation: + parent: items-blocks/index.md + icon: card_programmer + title: Card Programmer +categories: + - tool +description: used to copy [Card](../nodeworks-mechanics/cards.md) settings from a template +item_ids: +- nodeworks:card_programmer +--- + +# Card Programmer + +A Card Programmer is used to copy settings from a template [Card](../nodeworks-mechanics/cards.md). + + + +## Using it + +Right-click the item in your hand to open the GUI and you're greeted with two slots. + +- **Template (left):** drop in a [Card](../nodeworks-mechanics/cards.md) whose settings +you want to copy (the card isn't consumed) +- **Target (right):** drop in the card to configure, the target receives the template's +settings + +![](../assets/images/card_programmer_gui.png) + +You'll also notice two toggle buttons to copy the template's name and the channel. + +> **Note:** Any card that's dropped or shift+clicked into the "Target" slot +> will immediately return to your inventory after the copy is complete. + +## Recipe + + \ No newline at end of file diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/celestine_antenna_array.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/celestine_antenna_array.md new file mode 100644 index 000000000000..79c1823141d8 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/celestine_antenna_array.md @@ -0,0 +1,21 @@ +--- +navigation: + parent: items-blocks/index.md + icon: celestine_antenna_array + title: Celestine Antenna Array +categories: + - infrastructure +description: ingredient for the +item_ids: +- nodeworks:celestine_antenna_array +--- + +# Celestine Antenna Array + +An ingredient for the + + + +## Recipe + + \ No newline at end of file diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/celestine_block.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/celestine_block.md new file mode 100644 index 000000000000..e810c89bb78d --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/celestine_block.md @@ -0,0 +1,21 @@ +--- +navigation: + parent: items-blocks/index.md + icon: celestine_block + title: Block of Celestine +categories: + - misc +description: decorative block of celestine +item_ids: +- nodeworks:celestine_block +--- + +# Block of Celestine + + + +Found in [Celestine Geodes](./budding_celestine.md#where-to-find) or crafted from s. + +## Recipe + + \ No newline at end of file diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/celestine_ore.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/celestine_ore.md new file mode 100644 index 000000000000..ace970214605 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/celestine_ore.md @@ -0,0 +1,20 @@ +--- +navigation: + parent: items-blocks/index.md + icon: celestine_ore + title: Celestine Ore +categories: + - misc +description: found in caves and contains Celestine Shards +item_ids: +- nodeworks:celestine_ore +--- + +# Celestine Ore + +You can find Celestine Ore spawning naturally in the world below y level 0. + +For a regrowable supply, see [Budding Celestine](./budding_celestine.md) + + + diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/celestine_receiver_dish.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/celestine_receiver_dish.md new file mode 100644 index 000000000000..2bbfee527ac1 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/celestine_receiver_dish.md @@ -0,0 +1,21 @@ +--- +navigation: + parent: items-blocks/index.md + icon: celestine_receiver_dish + title: Celestine Receiver Dish +categories: + - infrastructure +description: ingredient for the +item_ids: +- nodeworks:celestine_receiver_dish +--- + +# Celestine Receiver Dish + +An ingredient for the + + + +## Recipe + + \ No newline at end of file diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/celestine_shard.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/celestine_shard.md new file mode 100644 index 000000000000..6b684ed89bfb --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/celestine_shard.md @@ -0,0 +1,19 @@ +--- +navigation: + parent: items-blocks/index.md + icon: celestine_shard + title: Celestine Shard +categories: + - ingredient +description: grows celestine buds on its surface +item_ids: +- nodeworks:celestine_shard +--- + +# Celestine Shard + +Also see [Budding Celestine](./budding_celestine.md) + + + +Celestine shards are a core ingredient to many blocks and items to Nodeworks networks. \ No newline at end of file diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/charged_beam_catalyst.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/charged_beam_catalyst.md new file mode 100644 index 000000000000..a02ee3a3ca53 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/charged_beam_catalyst.md @@ -0,0 +1,23 @@ +--- +navigation: + parent: items-blocks/index.md + icon: charged_beam_catalyst + title: Charged Beam Catalyst +categories: + - ingredient +description: used to craft the grapple beam +item_ids: +- nodeworks:charged_beam_catalyst +--- + +# Charged Beam Catalyst + + + + + +Used to craft the + +## Recipe + + \ No newline at end of file diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/craft_requester.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/craft_requester.md new file mode 100644 index 000000000000..4dfc2eb0c9b6 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/craft_requester.md @@ -0,0 +1,54 @@ +--- +navigation: + parent: items-blocks/index.md + icon: craft_requester + title: Craft Requester +categories: + - device +description: starts an autocrafting job given a redstone signal +item_ids: +- nodeworks:craft_requester +--- + +# Craft Requester + +The Craft Requester starts an autocrafting job when it receives a redstone +signal. Configure it with the item to craft and the batch size. + + + + + + + + + + + Redstone signal activates Craft Requester and crafts its configured item + + + +## Using the Craft Requester + +Right-click it with an item to set what it crafts. Right-click again with +an empty hand to open the GUI and pick the batch size and [output channel](./craft_requester.md#channel). + +Apply redstone and it'll keep queueing crafts while the signal stays on, +one batch at a time. Drop the signal and it stops. + +Pair it with a button for one-shot crafts or a +for autostock. The meter cycles its signal on its own as stock dips and +recovers. + +The status label at the bottom of the GUI tells you what it's doing. Hover it for +details. + +## Channel + +The Craft Requester uses a channel picker in its GUI to choose where the crafted item should go. + +> **Note:** See [Choosing a Channel](../lua-api/channel.md#choosing-a-channel) for more info. + +## Recipe + + diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/crafting_cpu.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/crafting_cpu.md new file mode 100644 index 000000000000..bc7743af0e52 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/crafting_cpu.md @@ -0,0 +1,119 @@ +--- +navigation: + parent: items-blocks/index.md + icon: crafting_core + title: Crafting CPU +categories: + - autocrafting +description: the brain of the autocrafting system in a network +item_ids: +- nodeworks:crafting_core +- nodeworks:crafting_storage +- nodeworks:substrate +- nodeworks:stabilizer +- nodeworks:co_processor +--- + +# Crafting CPU + +A Crafting CPU is the brain of the autocrafting system. It reads recipes out of +[Storage Blocks](./storage_blocks.md) (in network and in broadcasted sub-net Processing Sets) +and pulls ingredients out of the network, runs the craft, and puts the result back. +For how to actually *use* a built CPU to run crafts, see [Auto Crafting](../nodeworks-mechanics/autocrafting.md). + +## Forming the CPU + +A CPU always has exactly one at its heart. The +Core on its own isn't enough though, it needs at least one +(the "buffer") touching it somewhere. Without a buffer the CPU has no room to stash +items mid-craft, so it stays dark. + +Placement is freeform. You don't need a wrench, and there's no required shape. +Drop a Core down, stick a buffer on any face, wire the Core to a Node, and it lights up. + + + + + Generates heat and should be paired with 2 Coolant blocks + + + +> **Tip:** it's recommended for a starter Crafting CPU to have two +> blocks connected to the to ensure **Effiency** +> is at least 100% + +## Expanding the CPU + +The other CPU blocks let you make the same CPU bigger or faster: + +- (**Crafting Buffer**): required at least +once. More buffers means more room for ingredients and intermediates while +a craft is running. Each one carries **2 heat**. +- (**Crafting Co-Processor**): each one lets +the CPU run one additional craft in parallel. Each one carries **3 heat**. +- (**Crafting Coolant**): cancels heat. A lone +Coolant block puts out **1 cooling**, but every Coolant block touching it +adds **1 more**. A Coolant block surrounded by four other Coolant blocks +outputs **5 cooling**, so Coolant is much stronger in clusters than spread +out. +- (**Crafting Substrate**): the speed lever. +Every face of a Buffer or Co-Processor that touches a Substrate block +speeds the CPU up by **10%**, up to a cap of **4× (400%) speed**. +Substrate faces touching the Core, other Substrate, or Coolant do nothing, +so sandwich Substrate between Buffers and Co-Processors for the best +effect. + +All of these just need to touch the Core or chain off something that's already +part of the CPU. No wrench, no GUI step. Add blocks and they get absorbed on the +next tick. + +### Heat, cooling, and speed + +Every Buffer and Co-Processor you place is its own little furnace, and the Coolant +block's job is to soak up heat from the heart sources it physically touches. +The layout matters as much as the count: + +- Stacking heat sources face to face adds an extra **1 heat per shared face**, + on top of the heat those blocks already carry. A tight cube of Buffers and + Co-Processors runs much hotter than the same blocks spread out. +- Each Coolant block outputs a total cooling value (1 alone, higher in a + cluster). That output is **split evenly across the heat sources the + Coolant is touching**. A Coolant sandwiched between two Buffers gives + half its cooling to each, a Coolant sitting in the middle of six heat + sources is almost useless on any one of them. +- When the CPU's total cooling can't cover its total heat, speed **throttles + down** proportionally, all the way to a floor of **25%**. The CPU never + stops, it just crawls. +- Coolant only neutralizes heat, it never boosts speed above 100%. The only + block that does that is Substrate, up to the 4× cap. + + + + + + + + + + + + +> **Tip:** there's also a visual indication of a block overheating when it's tinted +> yellow/orange/red or smoking. + +The practical takeaway: don't try to smother a big pile of Buffers and +Co-Processors with a handful of Coolant blocks pressed against them. +Build Coolant into dedicated walls or fins (where Coolant blocks touch each +other), and arrange heat sources so each Coolant has only one or two +heat faces to deal with. Then add Substrate on the remaining Buffer/ +Co-Processor faces to crank the speed. + +## Recipes + + + + + + + + diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/device_frame.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/device_frame.md new file mode 100644 index 000000000000..768e79d528fe --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/device_frame.md @@ -0,0 +1,21 @@ +--- +navigation: + parent: items-blocks/index.md + icon: device_frame + title: Device Frame +categories: + - device +description: primary ingredient for devices +item_ids: +- nodeworks:device_frame +--- + +# Device Frame + +An ingredient for all [Devices](../nodeworks-mechanics/devices.md) + + + +## Recipe + + \ No newline at end of file diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/diagnostic_tool.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/diagnostic_tool.md new file mode 100644 index 000000000000..6c14c4550286 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/diagnostic_tool.md @@ -0,0 +1,73 @@ +--- +navigation: + parent: items-blocks/index.md + icon: diagnostic_tool + title: Diagnostic Tool +categories: + - tool +description: inspect a network's topology, CPUs, scripts, and recent errors +item_ids: +- nodeworks:diagnostic_tool +--- + +# Diagnostic Tool + +A handheld inspector for a Nodeworks network. Right-click any block on +a network to open a panel that summarises everything the network is +made of and everything it's currently doing. + + + +## How to use it + +Right-click any network block on the target network. A +, , +, antenna, or storage block all +work. You can also click any piece of a +[Crafting CPU](crafting_cpu.md) multiblock (Core, Buffer, Coolant, +Substrate, Co-Processor); the tool walks the cluster to find the Core +for you. + +If the block you click isn't on a network, the tool tells you so via an +overlay message and doesn't open. + +## What it shows + +The diagnostic panel pulls together everything the network exposes: + +- **Topology**. Every block on the network with its position, type, and + per-block details. s list the cards on each + face along with the adjacent block they target. +- **Network identity**. The controller's name and colour, with a quick + glance at its redstone mode, handler retry limit, and chunk-loading + toggle. +- **CPUs**. Each on the network, its + current craft (if any), buffer usage, efficiency, and whether the + multiblock is properly formed. +- **Terminals**. Every on the network with + its script list, autorun flag, running state, and which + [Processing Set](recipe_sets.md#processing-set) handlers each running + script has registered. +- **Craftable items**. The full list of items the network can + autocraft, gathered from every + and . +- **Recent errors**. The last 10 script errors from terminals on the + network, with the tick offset showing how long ago each one fired. + +The view is read-only. Nothing you click in the panel changes the +network, it's purely for figuring out what's where and what went +wrong. + +## When to reach for it + +- A craft failed and you want to see the error without standing next + to the . +- You inherited a sprawling network and need a map. +- You're trying to figure out why a recipe isn't autocraftable, the + craftable-item list shows what the network actually knows how to make. +- A script seems stuck, the terminal panel surfaces its running state + and registered handlers without opening every terminal manually. + +## Recipe + + diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/dimension_range_upgrade.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/dimension_range_upgrade.md new file mode 100644 index 000000000000..c05e7dc834a2 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/dimension_range_upgrade.md @@ -0,0 +1,22 @@ +--- +navigation: + parent: items-blocks/index.md + icon: dimension_range_upgrade + title: Dimension Range Upgrade +categories: + - infrastructure +description: upgrades range for the +item_ids: +- nodeworks:dimension_range_upgrade +--- + +# Dimension Range Upgrade + +Used to upgrade range for the to be accessible +across the same dimension the antenna is placed in. + + + +## Recipe + + \ No newline at end of file diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/export_chest.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/export_chest.md new file mode 100644 index 000000000000..d73e3c34f80b --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/export_chest.md @@ -0,0 +1,60 @@ +--- +navigation: + parent: items-blocks/index.md + icon: export_chest + title: Export Chest +categories: + - infrastructure +description: pulls items from network storage into its inventory +item_ids: +- nodeworks:export_chest +--- + +# Export Chest + +A 9-slot chest that automatically pulls items out of +[Network Storage](../nodeworks-mechanics/network-storage.md) and into its +own buffer. + + + + + +## Filter + +The chest's GUI takes a list of filter rules using the same pattern syntax +as the . Any item matching a rule is fair +game for export. An empty filter idles the chest so a fresh placement +doesn't immediately drain the network. + +## Push face + +Pick a face in the GUI to auto-drain the buffer into the inventory on +that side. Useful for feeding a hopper, furnace, or machine without +needing a script. Leave it unset to keep the buffer as a manual pickup +spot. + +## Channel + +Set a channel to restrict the pull to storage cards on that channel. The +default pulls from every storage card on the network. See +[Choosing a Channel](../lua-api/channel.md#choosing-a-channel). + +## Redstone + +The GUI's redstone setting gates whether the chest runs: + +- **High**: active while powered. +- **Low**: active while unpowered. +- **Ignored**: redstone does nothing. + +## Wireless + +Place a on top of the chest and pair +it with a on another network. Items +pushed into the chest get forwarded straight into the receiving +network's storage. + +## Recipe + + diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/grapple_beam.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/grapple_beam.md new file mode 100644 index 000000000000..982b8a5634bf --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/grapple_beam.md @@ -0,0 +1,25 @@ +--- +navigation: + parent: items-blocks/index.md + icon: grapple_beam + title: Grapple Beam +categories: + - tool +description: decorative block of celestine +item_ids: +- nodeworks:grapple_beam +--- + +# Grapple Beam + + + + + +Can be used to fling yourself around :) + +If your server allows for it or if you're singleplayer then you can also grab mobs with it. + +## Recipe + + \ No newline at end of file diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/import_chest.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/import_chest.md new file mode 100644 index 000000000000..7e02a87997dc --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/import_chest.md @@ -0,0 +1,63 @@ +--- +navigation: + parent: items-blocks/index.md + icon: import_chest + title: Import Chest +categories: + - infrastructure +description: pushes items into network storage from its inventory +item_ids: +- nodeworks:import_chest +--- + +# Import Chest + +A 9-slot chest that automatically pushes anything placed inside it into +[Network Storage](../nodeworks-mechanics/network-storage.md). Drop items +in by hand, with a hopper, or from another mod's pipes and the chest +clears itself into the network. + + + + + +Items that can't be accepted (filters, no space, etc.) stay in the chest +so you can see exactly what's stuck. + +## Channel + +Set a channel in the GUI to restrict the push to storage cards on that +channel. The default pushes to every storage card on the network. See +[Choosing a Channel](../lua-api/channel.md#choosing-a-channel). + +## Round robin + +Toggle round robin in the GUI to spread inserts across destination +storage cards instead of always filling the first one. Handy when you +want incoming items to load-balance across multiple storage targets. + +## Tick interval + +The GUI exposes how often the chest tries to insert, defaulting to once +per second. Lower for snappier intake at the cost of more network work, +higher for idle setups. + +## Redstone + +The GUI's redstone setting gates whether the chest runs: + +- **High**: active while powered. +- **Low**: active while unpowered. +- **Ignored**: redstone does nothing. + +## Wireless + +Place a on top of the chest and pair +it with a sitting on an + on another network. Items pushed into the +broadcasting Export Chest land in this chest, then route into the local +network's storage like any other intake. + +## Recipe + + diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/index.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/index.md new file mode 100644 index 000000000000..5236414cd9cb --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/index.md @@ -0,0 +1,36 @@ +--- +navigation: + title: Nodeworks Items/Blocks + position: 20 +--- + +# Items/Blocks + +## Ingredients & Misc Blocks + + + + +## Tools + + + +## Cards + + + +## Infrastructure + + + +## Terminals + + + +## Devices + + + +## Autocrafting + + diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/inventory_terminal.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/inventory_terminal.md new file mode 100644 index 000000000000..4b6c3a7393c8 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/inventory_terminal.md @@ -0,0 +1,46 @@ +--- +navigation: + parent: items-blocks/index.md + icon: inventory_terminal + title: Inventory Terminal +categories: + - terminal +description: a viewport into [Network Storage](../nodeworks-mechanics/network-storage.md) +item_ids: +- nodeworks:inventory_terminal +--- + +# Inventory Terminal + +The Inventory Terminal is a viewport into a [network's storage](../nodeworks-mechanics/network-storage.md). + + + +## Browsing the grid + +![](../assets/images/inventory_terminal_gui_expanded.png) + +- Left-click grabs a stack +- Right-click takes half a stack +- Double-click collects all matching items onto cursor +- Dropping a carried stack onto the grid inserts into [Network Storage](../nodeworks-mechanics/network-storage.md) +- Right-clicking a carried stack into the grid inserts one item +- Hold `Alt` to show auto-craftable items in the network + +The left side has buttons for: + +- Changing layouts +- Sorting the grid +- Filtering by (storage, recipes, or both) +- The kind (items, fluids, or both) +- Auto-focus search toggle + +And in the center is a collapsible crafting grid with buttons to: + +- Auto-pull from network +- Distribute ingredients evenly in the crafting grid +- Push ingredients in the crafting grid to the network storage + +## Recipes + + \ No newline at end of file diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/io_card.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/io_card.md new file mode 100644 index 000000000000..3a5556138ee6 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/io_card.md @@ -0,0 +1,59 @@ +--- +navigation: + parent: items-blocks/index.md + icon: io_card + title: IO Card +categories: + - card +description: used for reading and writing an inventory/tank from scripts +item_ids: +- nodeworks:io_card +--- + +# IO Card + +The IO Card lets a network read from and write to the inventory of an adjacent +block on demand. With an IO Card installed, scripts can query what's in the +block and move items or fluids to/from it. + + + +## Installing + +IO Cards go in the face slots of a . Right-click the +face of the node that's touching the block you want to control and drop an +IO Card into any of the 9 slots. The card's behavior applies to *that face*, +so the same node can have IO Cards on different faces controlling different +neighbors. + +![](../assets/images/node_gui.png) + +## What it does + +A block with an IO Card attached shows up on the network as a script-reachable +inventory: + +- `card:find(filter)` returns an [ItemsHandle](../lua-api/items-handle.md) for + matching contents. +- `card:insert(items)` / `card:tryInsert(items)` move items into it. +- `card:count(filter)` totals matching items (and fluids, in mB). + +Unlike a , an IO card's block is **not** part of +[Network Storage](../nodeworks-mechanics/network-storage.md). Scripts have to explicitly move items to or from it, +`network:find` across the whole network won't see its contents, and the + or won't list them. + +## Channel + +The IO Card has a channel picker in its GUI. See +[Choosing a Channel](../lua-api/channel.md#choosing-a-channel) for how channels +scope which scripts and presets can address this card. + +## Scripting + +See the [CardHandle reference](../lua-api/card-handle.md#inventory-cards) for the full set of +methods available on an IO Card's handle. + +## Recipe + + \ No newline at end of file diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/link_crystal.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/link_crystal.md new file mode 100644 index 000000000000..9b7b71318e4b --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/link_crystal.md @@ -0,0 +1,25 @@ +--- +navigation: + parent: items-blocks/index.md + icon: link_crystal + title: Link Crystal +categories: + - infrastructure +description: used to link to broadcast antennas +item_ids: +- nodeworks:link_crystal +--- + +# Link Crystal + +Used for to pair with + + + +## Usage + +See the pairing steps in the [Broadcast Antenna](./broadcast_antenna.md#pairing) page. + +## Recipe + + \ No newline at end of file diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/milky_soul_ball.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/milky_soul_ball.md new file mode 100644 index 000000000000..3597a92f0474 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/milky_soul_ball.md @@ -0,0 +1,26 @@ +--- +navigation: + parent: items-blocks/index.md + icon: milky_soul_ball + title: Milky Soul Ball +categories: + - ingredient +description: contains a unique soul for crafting +item_ids: +- nodeworks:milky_soul_ball +--- + +# Milky Soul Ball + +A unique and milky soul ready for crafting. Optionally you can throw them at your +worst enemies to inflict a Withering effect. :3 + + + +## How to Craft + +Grab a in your hand and right-click on a block of + +## Recipe + + \ No newline at end of file diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/multi_dimension_range_upgrade.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/multi_dimension_range_upgrade.md new file mode 100644 index 000000000000..c006ff5230bc --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/multi_dimension_range_upgrade.md @@ -0,0 +1,22 @@ +--- +navigation: + parent: items-blocks/index.md + icon: multi_dimension_range_upgrade + title: Multi-Dimension Range Upgrade +categories: + - infrastructure +description: upgrades range for the +item_ids: +- nodeworks:multi_dimension_range_upgrade +--- + +# Multi-Dimension Range Upgrade + +Used to upgrade range for the to be accessible +across any dimension. + + + +## Recipe + + \ No newline at end of file diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/network_controller.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/network_controller.md new file mode 100644 index 000000000000..6532c7d8504c --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/network_controller.md @@ -0,0 +1,45 @@ +--- +navigation: + parent: items-blocks/index.md + icon: network_controller + title: Network Controller +categories: + - infrastructure +description: the heart of a network, every network requires one +item_ids: +- nodeworks:network_controller +--- + +# Network Controller + +Every Nodeworks network needs exactly one Controller. Without it, the +[Pipes](pipe.md) and [Nodes](node.md) connected to it stay dormant. + + + + + + +Place a Controller, run pipes from it, and any block that connects to +those pipes joins the network. + +## Identity + +The Controller's GUI lets you name the network and pick a colour. The +name is cosmetic, the colour tints the node glows so multiple networks +in the same area stay easy to tell apart. + +## Chunk loading + +Toggling chunk loading in the GUI keeps every chunk that the network +touches forced-loaded. Useful for autocrafting setups that need to keep +running while you're far away. + +## One per network + +Two Controllers connected to the same pipe run will conflict and both +networks shut down until one is removed. + +## Recipe + + diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/network_wrench.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/network_wrench.md new file mode 100644 index 000000000000..beb972853748 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/network_wrench.md @@ -0,0 +1,59 @@ +--- +navigation: + parent: items-blocks/index.md + icon: network_wrench + title: Network Wrench +description: toggles pipe connections and links Focus Nodes +item_ids: +- nodeworks:network_wrench +--- + +# Network Wrench + +The Network Wrench is how you adjust the shape of a network without +breaking anything. It toggles individual pipe connections between blocks +and links s across distance. + + + +## Toggling pipe connections + +Shift + right-click any face where two network blocks are touching to +toggle the pipe stub between them. The blocks stay where they are, but +the network treats the side as if there's no pipe there. + +This is the everyday use of the wrench. A few common reasons to reach +for it: + +- Keep a sitting next to a + without the two merging into one network branch +- Split a single network into two by toggling off a single pipe face +- Stop a or device from picking up an + accidental adjacency to a neighbouring network + +Repeat the action on the same face to restore the connection. + +## Linking Focus Nodes + +s are the exception. Two Focus Nodes can be +wired across distance with the wrench: + +1. Shift + right-click a Focus Node on a face that isn't touching + another network block to select it as the pending source. The block + gains a border to show it's selected. +2. Right-click another Focus Node to toggle a link between the two. + +The selection sticks after a successful link so you can chain one source +to many targets without re-selecting between each. + +### Rules + +- Both Focus Nodes must be in the **same dimension** as the selection. +- They must belong to the **same network controller**. The wrench won't + bridge two separate networks. + +The wrench tells you which rule failed via a chat message. + +## Recipe + + diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/node.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/node.md new file mode 100644 index 000000000000..cc1dc5030e92 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/node.md @@ -0,0 +1,78 @@ +--- +navigation: + parent: items-blocks/index.md + icon: node + title: Node +categories: + - infrastructure +description: card host on a pipe network +item_ids: +- nodeworks:node +- nodeworks:focus_node +--- + +# Node + +A Node is the block that holds [Cards](../nodeworks-mechanics/cards.md). The +network's connectivity itself runs through [Pipes](pipe.md). A Node is what +you drop into a pipe run wherever you want cards to interact with a +neighbouring block. + + + +## Faces + +Each face adapts to whatever's next to it. A face touching another +network block becomes part of the pipe and disables its card slots. A +face touching a regular block hosts cards that target that neighbour. + +## Opening the GUI + +Right-click a non-Pipe face to open its card grid. Shift + right-click +opens the *opposite* face. Handy when the side you want is buried. Pipe +faces don't open; their tab in the side picker appears dimmed. + +![](../assets/images/node_gui.png) + +## Cards + +Drop a card into any of the 9 slots on a Device face to give that face +a capability: + +- : lets the + network move items in and out of the adjacent block. +- : + marks the adjacent block's inventory as Network Storage. +- : + reads and emits redstone signals from this face. +- : + reads the state of the block it's facing + +Multiple cards on one face stack. A face with both an IO card and a +Redstone card can move items AND emit a redstone signal from the same +side. + +## Focus Node + + + + + + +A is a Node variant for long-distance +connections. Pair two Focus Nodes with the + and the network treats them as +connected even when there's no continuous Pipe between them, useful for +bridging across gaps or jumping between separated machine clusters +without running a Pipe the whole way. + +Focus Nodes still behave like regular Nodes for their six faces: same +Pipe / Device / Free roles, same card slots, same auto-connection to +adjacent Pipes. The wrench-paired link is in addition to whatever +adjacency they pick up locally. + +## Recipe + + + + diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/observer_card.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/observer_card.md new file mode 100644 index 000000000000..9429d6c3f885 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/observer_card.md @@ -0,0 +1,52 @@ +--- +navigation: + parent: items-blocks/index.md + icon: observer_card + title: Observer Card +categories: + - card +description: reads the block at the installed node face, id, properties, and change events +item_ids: +- nodeworks:observer_card +--- + +# Observer Card + +Reads the block at the installed face. Exposes the block id, every state +property the block has (growth `age`, `facing`, `waterlogged`, `lit`, ...), +and a change callback so scripts can react the instant a block transitions +to the state you care about. + + + +## What it's for + +Stage-gated farms are the headline use case. A piston wired to a vanilla +observer fires on every growth transition, so it'll break a small bud for +1 shard instead of waiting for the full cluster's 4. With an Observer Card +the script can read the actual stage and only pulse the breaker when the +block becomes the final form. + +It's also the right tool for reads that aren't redstone signals: trapdoor +open / closed, door state, beehive honey level, dripstone fill, daylight +sensor reading, sweet berry / kelp / sugar cane growth, ice / snow forming +under a block, anything with a `BlockState` property you can compare against. + +## Installing and Scripting + +Installs in a Node face the same way an does. +See [IO Card installation](./io_card.md#installing) for the walkthrough. +The card reads the block in front of *that face*. + +See the [ObserverCard Scripting API](../lua-api/card-handle.md#observer-card) +for the methods it exposes. + +## Channel + +The Observer Card has a channel picker in its GUI. See +[Choosing a Channel](../lua-api/channel.md#choosing-a-channel) for how channels +scope which scripts can address this card. + +## Recipe + + diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/pipe.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/pipe.md new file mode 100644 index 000000000000..2b3830a5438e --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/pipe.md @@ -0,0 +1,50 @@ +--- +navigation: + parent: items-blocks/index.md + icon: pipe + title: Vacuum Pipe +categories: + - infrastructure +description: the building block of every network +item_ids: +- nodeworks:pipe +- nodeworks:covered_pipe +--- + +# Vacuum Pipe + +The wire of a Nodeworks network. Pipes carry items, signals, and routing +between every block on the network. + + + + + + +Place pipes next to each other (or next to any network block) and they +connect automatically. + +## Hiding Pipes + +### Covered Pipes + +You can also hide pipes by crafting Covered Pipe by taking one block and surrounding +it in 8 Vacuum Pipes in a crafting table. + + + + + + +### Focus Nodes + +You can also use s to go through glass as a way to get through walls + + + + + + +## Recipe + + diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/placer.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/placer.md new file mode 100644 index 000000000000..728aafe80ed9 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/placer.md @@ -0,0 +1,59 @@ +--- +navigation: + parent: items-blocks/index.md + icon: placer + title: Placer +categories: + - device +description: a shared network placer +item_ids: +- nodeworks:placer +--- + +# Placer Block + +The Placer places block-form items at the position in front of itself. The +script picks what to place by item id or by passing an +[ItemsHandle](../lua-api/items-handle.md), the matching item is then pulled +from [Network Storage](../nodeworks-mechanics/network-storage.md) and placed. +Synchronous, the script gets `true` / `false` in the same tick it asked. + + + +## Placing + +The Placer's front face points at whatever you were aiming at when you placed +it down (same shape as a piston or dispenser). Whatever block the Placer +spawns lands directly in front of that face. Only block-form items work, +tools, food, and miscellaneous items will fail the place call. + +## Block filter + +The Placer's GUI has a slot for the block it should place. The matching +item is pulled from +[Network Storage](../nodeworks-mechanics/network-storage.md) each time the +Placer fires. Leave it empty to idle until a script asks for something +specific. + +## Redstone + +The GUI's redstone setting controls when the Placer is allowed to fire: + +- **High**: active while powered. +- **Low**: active while unpowered. +- **Ignored**: redstone does nothing. The Placer only fires when a script + calls into it. + +## Channel + +The Placer has a name and channel picker in its GUI. See +[Choosing a Channel](../lua-api/channel.md#choosing-a-channel) for how +channels scope which scripts can address this device. + +## Scripting + +See the [PlacerHandle](../lua-api/placer-handle.md) page to see the scripting api. + +## Recipe + + diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/portable_inventory_terminal.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/portable_inventory_terminal.md new file mode 100644 index 000000000000..f34dee72b84d --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/portable_inventory_terminal.md @@ -0,0 +1,56 @@ +--- +navigation: + parent: items-blocks/index.md + icon: portable_inventory_terminal + title: Portable Inventory Terminal +categories: + - tool +description: a portable viewport into any linked network's storage +item_ids: +- nodeworks:portable_inventory_terminal +--- + +# Portable Inventory Terminal + +A portable + +A hanheld version of the . Connects wirelessly +via a paired to a +on top of a . + + + +## Linking it to a network + +The Portable Inventory Terminal reaches a network through three components you +need in place first: + + + + + +- A on the target network +- A placed on top of that Controller +- A paired to that antenna *(not to a Processing Storage)* + +



+ + +Then with the paired Link Crystal, you place it in the top-right slot of the Portable Inventory Terminal + +The Portable's item texture lights up with the network's color when the link +is live. + +
+ +## Range + +See the page for more info on broadcasting range + +## Using the terminal + +Everything inside the GUI works identically to the . + +## Recipe + + \ No newline at end of file diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/processing_handler.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/processing_handler.md new file mode 100644 index 000000000000..f85b0fe1f5f7 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/processing_handler.md @@ -0,0 +1,85 @@ +--- +navigation: + parent: items-blocks/index.md + icon: processing_handler + title: Processing Handler +categories: + - autocrafting +description: registers a processing set handler using a micro-network +item_ids: +- nodeworks:processing_handler +--- + +# Processing Handler + +A block-based handler for +[Processing Set](./recipe_sets.md#processing-set) recipes. Drop one on +the network, bind it to a recipe, and the +[Crafting CPU](./crafting_cpu.md) will route the recipe's ingredients +into your machine and pull the outputs back without you writing any Lua. + + + + + + Blue channel Storage Card pointing at the top of the furnace + + + Red channel Storage Card pointing at the bottom of the furnace + + + +## Two sides + +The Handler has a front face and a back face: + +- **Back face**: joins the parent network where your + and + live. +- **Front face**: anchors its own **micro-network** of pipes, nodes, and + storage cards. The Handler acts as the controller for this side, so + no is needed (or allowed) on the + front. + +Wire the back into your main network and run a small pipe loop off the +front to whatever machine actually carries out the recipe. + +## Binding a recipe + +Right-click the Handler to open its GUI and pick a + from the parent network's Processing +Storage. Each ingredient in the Set gets its own row in the GUI with a +channel colour, plus one channel colour for the recipe's outputs. + +## Channel routing + +The Handler uses channels to decide which + on the micro-network gets each item: + +- **Input channels** (one per ingredient, default blue). When the CPU + starts a craft, each input is pushed to a storage card on the + micro-network whose channel matches that ingredient's colour. + - *Input items also respect Storage Card filters if you need custom routing by + an expression, data on the item, or stackability* +- **Output channel** (one shared colour, default red). The Handler + watches storage cards on the micro-network with this channel and + pulls finished outputs back into the parent network. + +For the furnace example in the scene above: a blue storage card on top +of the furnace receives the raw input, the furnace processes it, and a +red storage card on the bottom collects the result. + +Different ingredients can use different colours when a single machine +needs them in different slots, like fuel on one side and input on +another. + +## Compared to a scripted handler + +A Processing Handler is the no-script equivalent of +[`network:handle(...)`](../lua-api/network.md#handle). Use the Handler when the recipe is "push inputs +in, pull outputs out." Use a scripted handler when you need custom +timing, or multi-step flows. + +## Recipe + + diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/receiver_antenna.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/receiver_antenna.md new file mode 100644 index 000000000000..af0490421608 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/receiver_antenna.md @@ -0,0 +1,40 @@ +--- +navigation: + parent: items-blocks/index.md + icon: receiver_antenna + title: Receiver Antenna +categories: + - infrastructure +description: connects to broadcasted processing storages and export chests +item_ids: +- nodeworks:receiver_antenna +--- + +# Receiver Antenna + +Used to connect one network to another [subnet](../nodeworks-mechanics/subnets.md). +This ends up being useful for splitting up [Processing Set](./recipe_sets.md#processing-set) recipes across different +networks for [autocrafting](../nodeworks-mechanics/autocrafting.md) + + + + + + Receiving processing set recipes from another network + + + Receives items from broadcasting export chests + + + +## Wireless item intake + +Place the Receiver Antenna on top of an and +pair it with a sitting on an + in another network. Items pushed into the +broadcasting Export Chest land in this Import Chest, giving you a wireless +conveyor between two networks. + +## Recipe + + \ No newline at end of file diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/recipe_sets.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/recipe_sets.md new file mode 100644 index 000000000000..f109f296948e --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/recipe_sets.md @@ -0,0 +1,96 @@ +--- +navigation: + parent: items-blocks/index.md + icon: instruction_set + title: Recipe Sets +categories: + - autocrafting +description: stores crafting recipes for [autocrafting](../nodeworks-mechanics/autocrafting.md) +item_ids: +- nodeworks:instruction_set +- nodeworks:processing_set +--- + +# Recipe Sets + +There are two types of recipe sets that are used to store crafting recipes used +in [autocrafting](../nodeworks-mechanics/autocrafting.md). + +Recipes Sets are template items that store a single recipe for the +[autocrafting](../nodeworks-mechanics/autocrafting.md) system to carry out. Each +Set is authored in its own GUI, then dropped into a matching [Storage Block](./storage_blocks.md) + +Two flavors exist, covering two kinds of recipes: + +- **Instruction Set:** vanilla 3x3 crafting recipes (shaped and shapeless) +- **Processing Set:** everything else (smelting, modded machines, multi-output processes, anything with a timeout) + +--- + +## Instruction Set + + + +A 3x3 crafting template. Anything that works in a vanilla crafting table works here. + +### Creating a recipe + +Right-click to open. Click a ghost slot with an item in hand to pin a ghost +copy there (no inventory consumption), click an empty slot again to clear. +The result slot auto-fills whenever the pattern matches a known crafting +recipe. **Clear All** resets the grid. + +The GUI also has a **tag substitutions** toggle. When on (the default), +the recipe accepts any item from the same tag as the pinned ingredient, +so an oak plank slot will happily use birch, spruce, or anything else in +`#minecraft:planks`. Turn it off to lock the recipe to exact item ids. + +> **Tip:** JEI's **(+)** recipe-transfer button works on this GUI so you can pick any crafting +> recipe in JEI and hit (+) to fill the grid in one step + +### Deploying it + +Drop the filled Set into an . Adjacent +Instruction Storages form a cluster. Every Set in the cluster is visible to +the CPU as long as *any* block in the cluster is on the network. + +--- + +## Processing Set + + + +A freeform recipe with up to 9 inputs and 3 outputs, plus an optional +per-craft timeout. Use it for anything the 3×3 grid can't express (smelting, +blasting, modded machine recipes, multi-output processes, or anything where +*"N ticks elapse before the output appears"*) + +### Creating a recipe + +Right-click to open. The GUI has: + +- **Input grid**: (3×3) ghost slots for any inputs, in any position. +- **Output column**: (3 slots) ghost slots for outputs. +- **Timeout field**: 0–999 ticks (0 = no timeout). `+` and `-` buttons step by 20, shift-click steps by 100. +- **Serial toggle**: when on, the CPU won't run this recipe in parallel with + itself. +- **Clear All**: resets everything. + +Per-slot counts are adjusted by scrolling over a filled slot (scroll up +1, +scroll down -1, scroll down at 1 clears). + +> **Tip:** JEI's **(+)** works here too, and it's *universal*. Any recipe category JEI +> knows about (smelting / blasting / modded) is fair game. + +### Deploying it + +Drop the filled Set into a . Like +Instruction Storage, adjacent Processing Storages form a cluster. The CPU +coordinates with whichever external machine actually carries out the recipe. + +## Recipes + + + + + \ No newline at end of file diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/redstone_card.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/redstone_card.md new file mode 100644 index 000000000000..edd16781e25b --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/redstone_card.md @@ -0,0 +1,36 @@ +--- +navigation: + parent: items-blocks/index.md + icon: redstone_card + title: Redstone Card +categories: + - card +description: reads and writes redstone signals at the installed node face +item_ids: +- nodeworks:redstone_card +--- + +# Redstone Card + +Reads and writes redstone signals at the installed face. + + + +## Installing and Scripting + +Installs in a Node face the same way an does. +See [IO Card installation](./io_card.md#installing) for the walkthrough. +The card reads and writes the redstone signal on *that face*. + +See the [RedstoneCard Scripting API](../lua-api/card-handle.md#redstone-card) +is different from the other cards. + +## Channel + +The Redstone Card has a channel picker in its GUI. See +[Choosing a Channel](../lua-api/channel.md#choosing-a-channel) for how channels +scope which scripts can address this card. + +## Recipe + + \ No newline at end of file diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/scripting_terminal.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/scripting_terminal.md new file mode 100644 index 000000000000..fe1866dc570e --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/scripting_terminal.md @@ -0,0 +1,65 @@ +--- +navigation: + parent: items-blocks/index.md + icon: terminal + title: Scripting Terminal +categories: + - terminal +description: where you write and run Lua scripts that control a network +item_ids: +- nodeworks:terminal +--- + +# Scripting Terminal + +The Scripting Terminal is where you write and run Lua scripts that control a network. + + + +## Opening the Editor + +Right-click the terminal to open. The editor has three panels: + +- **Sidebar**, lists every card and variable on the network. Click to insert a + `network:get("…")` line at your cursor. +- **Script tabs**, `main` plus any modules you create. `main` runs when you hit + Start, other tabs are loaded via [`require(name)`](../lua-api/index.md). +- **Output panel**, output from `print(…)`, plus any script errors. + - You can also click the left-hand arrow to expand/collapse the output or drag the separator bar to change its size + +![](../assets/images/terminal_gui.png) + +## Running Scripts + +(also see the [Scripting API](../lua-api/index.md) reference for everything scripts +can do, network queries, crafting, scheduler callbacks, variables.) + +Click Start to load and run the current `main` tab. The script exits once `main` +finishes unless it registers callbacks to keep running. Click Stop to end the +script. + +### AutoRun + +Toggle auto-run in the editor to have the script start automatically when the +terminal loads. The terminal only loads when its chunk is loaded, so auto-run +does NOT imply "runs whenever the server is up." A player needs to be in range +for the chunk to load, or the network's +needs chunk-loading enabled so the chunk stays loaded even when nobody is +nearby. + +![](../assets/images/autorun.png) + +### Redstone + +A redstone pulse on the terminal toggles its script. If the script is stopped, +the pulse starts it. If it's already running, the pulse stops it. Any rising +edge works, a button tap, a pressure plate step, or a freshly placed torch. + +> If a script gets killed by the wall-clock timeout, redstone can't restart it +> until you open the editor and edit the script. This stops a redstone clock +> pointed at a misbehaving terminal from re-triggering the same broken script +> every cycle. + +## Recipe + + \ No newline at end of file diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/storage_blocks.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/storage_blocks.md new file mode 100644 index 000000000000..99c133fa634a --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/storage_blocks.md @@ -0,0 +1,54 @@ +--- +navigation: + parent: items-blocks/index.md + icon: instruction_storage + title: Recipe Storage Blocks +categories: + - autocrafting +description: houses Recipe Sets so Crafting CPUs can see them +item_ids: +- nodeworks:instruction_storage +- nodeworks:processing_storage +--- + +# Recipe Storage Blocks + +Storage Blocks are where you keep your filled out [Recipe Sets](./recipe_sets.md) +once they're read for the to use. Righ-click to +open, drop the Recipe Sets into the slots, and you're done. + +Each type of Recipe Set has its own Storage Block + +- **Instruction Storage:** holds Instruction Sets +- **Processing Storage:** holds Processing Sets + +## How they work + +Wire a Storage Block to a Node and every Recipe Set inside becomes visible to +the CPU. + + + + + A cluster of **connected** Processing Storage all get exported together since they're touching + + + +Storage Blocks can also be placed right next to each other to form a cluster. +You only need to wire **one** block in a cluster, the rest tag along through +the shared faces. Break the block that bridges two halves and the group +splits back into two, each figuring out on its own whether it's still +reachable. The block's emissive glow matches the network colour of whichever +network it belongs to, so at a glance you can tell which group goes where. + +## Clustering Recipe Storage Blocks + +If you have one Recipe Storage Blocks connected to a network, any adjacent Recipe Storage Blockss +will cluster together and also connect to the network. + +## Recipes + + + + + \ No newline at end of file diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/storage_card.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/storage_card.md new file mode 100644 index 000000000000..43b49209e7ea --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/storage_card.md @@ -0,0 +1,146 @@ +--- +navigation: + parent: items-blocks/index.md + icon: storage_card + title: Storage Card +categories: + - card +description: marks the adjacent block as part of network storage +item_ids: +- nodeworks:storage_card +--- + +# Storage Card + +A Storage Card marks the adjacent block as part of [Network Storage](../nodeworks-mechanics/network-storage.md). The +shared pool the network queries, routes into, and lists in the Inventory +Terminal. + + + +## 配置 + +When you right-click with a **Storage Card** you can set the priority, channel, +and filters. + +![](../assets/images/storage-card-gui.png) + +> **Tip:** Use a to copy the card's settings +> (optionally name and channel as well) which lets you bulk set Card settings +> using a template. +> +> You can also use [`network:route()`](../lua-api/network.md#route) to bulk set card +> settings without even touching them. + +## Target face + +You can pick which face of the adjacent block the card talks to. By +default the card uses the face the node is pointed at, which is usually +what you want. Override it for blocks with side-specific slots like +furnaces, where the top accepts input, the side accepts fuel, and the +bottom yields output. + +## Channel + +The Storage Card's GUI also has a channel picker. See +[Choosing a Channel](../lua-api/channel.md#choosing-a-channel) for how channels +scope which scripts, routing rules, and presets see this card. + +## Filters + +Each Storage Card can be configured to accept only specific items so a network +with multiple cards routes incoming items to the right place. A fresh card has +no filters and accepts everything. + +### Mode + +The **Mode** toggle in the Storage Card GUI flips the rule list between + +- **Allow**: only items matching at least one rule are accepted +- **Deny**: items matching at least one rule are rejected, everything else passes through + +With no rules in the list, Mode has no effect, but the **Stackability** and +**NBT** filters below still apply on top. A card only accepts everything when +all three filters are at their defaults (no rules, Any Stackability, Any NBT). + +### Rules + +Each rule is a single line of filter syntax, evaluated against the item trying to +enter the card: + +| Syntax | Matches | +| ----------------------- | ---------------------------------------------- | +| `minecraft:cobblestone` | exact item id | +| `#minecraft:logs` | every item in this tag | +| `minecraft:*` | every item from this mod / namespace | +| `/^.*_ore$/` | items whose id matches this regular expression | +| `*` | every item/fluid | + +You can add rules three different ways: + +1. Click **[+ Add Rule]** at the bottom of the list and type into the new row. +Autocomplete suggests item ids and tags as you type +2. Drag any item from JEI onto the rule list. The item's id becomes a new rule +3. From a Scripting Terminal, use [`network:route()`](../lua-api/network.md#route) +to set rules across many cards at once + +### Stackability and NBT + +Two extra toggles narrow what the card accepts beyond the rule list: + +- **Stackability**: cycles through **Any** / **Stackable Only** / **Non-stackable only**. +Useful for separating tools and armor from bulk resources without listing every item id +- **NBT**: cycles through **Any** / **Has data** / **No data**. +Items with NBT (damaged tools, named items, enchanted books) can be split from their +pristine versions. + +All three settings combine. An item only enters the card if it passes +Stackability, passes NBT, and matches the rule list. A card with +`Mode: Allow`, `Stackability: Stackable only`, `NBT: No data`, and rule +`#minecraft:swords` accepts nothing in practice. Swords aren't stackable, +so the Stackability check rejects everything before the rule list is even +consulted. Pick settings that make sense together. + +### Examples + +**Bulk cobblestone storage** + +> **Mode:** Allow +> +> **Stackability:** Any +> +> **NBT:** Any +> +> **Rules:** #c:cobblestone + +Accepts any cobblestone in the `#c:cobblestones` tag + +**Non-stackable only** + +> **Mode:** Allow +> +> **Stackability:** Non-stackable only +> +> **NBT:** Any +> +> **Rules:** *Empty* + +A storage card that just accepts any non-stackable items doesn't require any rules + +## Installation and scripting + +Installed the same way an is. Slot into a face of +a node that's touching the block. The scripting API is identical to an IO +Card (see [CardHandle](../lua-api/card-handle.md#inventory-cards) for the full set of methods) + +## The difference from IO + +'s blocks are script-controlled inventories. +Scripts must explicitly move items to/from them. A Storage Card puts its +block *into* the network's shared pool: `network:find` sees it, the + and list it, and crafting recipes pull ingredients from it +automatically. + +## Recipe + + \ No newline at end of file diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/storage_meter.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/storage_meter.md new file mode 100644 index 000000000000..ad83c91a0cf7 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/storage_meter.md @@ -0,0 +1,69 @@ +--- +navigation: + parent: items-blocks/index.md + icon: storage_meter + title: Storage Meter +categories: + - device +description: tracks the amount of items/fluids its configured to watch +item_ids: +- nodeworks:storage_meter +--- + +# Storage Meter + +The Storage Meter watches an item in the network and emits a redstone +signal when its stock drops below your threshold. It can also start an autocraft +job to replenish the stock. + + + + + + + + + + + Has Autocraft enabled and replenishes the stock of doors in the network automatically + + + +## Using Storage Meters + +Right-click it with the item you want it to watch. Right-click again with +an empty hand to open the GUI and set the threshold and channel. + +It emits a redstone signal whenever the stock dips below the threshold. +With Autocraft on (the default), it'll also start a craft job to top up +the stock. Turn Autocraft off if you'd rather drive a + with the signal. + +The status label at the bottom of the GUI tells you what it's doing. Hover +it for details. + +## Subnet Example + + + + + Cooks to + + + + + + + + +This example shows a subnet with a Storage Meter watching a chest for iron ingots. When it's below it sends a redstone signal to another network's which triggers an autocrafting job using a . + +## Channel + +The Storage Meter uses a channel picker in its GUI to choose where the crafted item should go as well as the channel of the Network Storage being watched. + +> **Note:** See [Choosing a Channel](../lua-api/channel.md#choosing-a-channel) for more info. + +## Recipe + + diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/user.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/user.md new file mode 100644 index 000000000000..3ef0ed619dd9 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/user.md @@ -0,0 +1,69 @@ +--- +navigation: + parent: items-blocks/index.md + icon: user + title: User +categories: + - device +description: right-clicks with an item on the block in front of it +item_ids: +- nodeworks:user +--- + +# User Block + +The User pulls an item from +[Network Storage](../nodeworks-mechanics/network-storage.md) and +right-clicks with it on whatever's in front of the block. Use it for +bone-mealing crops, brushing suspicious blocks, lighting tnt with flint +and steel, filling buckets, or anything else a player would normally do +by hand. + + + +## Placing + +The User's front face points at whatever you were aiming at when you +placed it down (same shape as a piston or dispenser). It targets the +first non-air block up to two positions in front of itself, so a User +above an empty space above a crop still reaches the crop. + +## Item filter + +The User's GUI has a slot for the item it should use. The matching item +is pulled from Network Storage when the User fires and returned once the +action finishes. Filter syntax is the same as the +, so bare ids, tags, and wildcards all +work. + +## Mode + +The User runs in one of two modes: + +- **Instant**: a single right-click per fire. Good for one-shot actions + like applying bone meal or flint and steel. +- **Hold**: keeps the right-click held down across ticks until released. + Good for tools that need to be held to do their thing, like a brush. A hold auto-releases after 30 seconds. + +## Redstone + +The GUI's redstone setting controls when the User is allowed to fire: + +- **High**: active while powered. +- **Low**: active while unpowered. +- **Ignored**: redstone does nothing. The User only fires when a script + calls into it. + +## Channel + +The User has a name and channel picker in its GUI. See +[Choosing a Channel](../lua-api/channel.md#choosing-a-channel) for how +channels scope which scripts can address this device. + +## Scripting + +See the [UserHandle](../lua-api/user-handle.md) page for the scripting api. + +## Recipe + + diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/variable.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/variable.md new file mode 100644 index 000000000000..063c42beccf8 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/items-blocks/variable.md @@ -0,0 +1,54 @@ +--- +navigation: + parent: items-blocks/index.md + icon: variable + title: Variable +categories: + - device +description: a shared network variable +item_ids: +- nodeworks:variable +--- + +# Variable Block + +A Variable block is a value that can be shared across an entire network. + + + +## Configuration + +After connecting a Variable to a network you can selects its **type** and give it +a **name**. Both are important for seeing your variable in a . + +![](../assets/images/variable_gui_count.png) + +In this case, a **number** variable with the name `count` + +When you open any on the same network you'll see it displayed +in the sidebar where you can reference it. + +![](../assets/images/variable_in_terminal.png) + +### Types + +- **number** + - a numeric value (integer or decimal) +- **string** + - any text up to 256 characters +- **bool** + - `true` or `false` + +## Channel + +The Variable's GUI also has a channel picker. See +[Choosing a Channel](../lua-api/channel.md#choosing-a-channel) for how channels +scope which scripts can address this variable. + +## Scripting + +See the [VariableHandle](../lua-api/variable-handle.md) page to see the scripting api. + +## Recipe + + \ No newline at end of file diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/lua-api/breaker-handle.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/lua-api/breaker-handle.md new file mode 100644 index 000000000000..f32ea2cac3c3 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/lua-api/breaker-handle.md @@ -0,0 +1,158 @@ +--- +navigation: + parent: lua-api/index.md + title: Breaker Handle + icon: breaker +categories: + - api_types +description: a device used to break blocks in front of it +--- + +# BreakerHandle + +A `BreakerHandle` is a reference to a on the network, +returned by [`network:get(name)`](network.md#get). It starts a multi-tick break +of the block in front of the breaker and routes the drops back to the network +(or to a custom handler). + + + +The breaker mines at diamond-pickaxe tier and uses the wooden-pickaxe duration +formula, so harder blocks take noticeably longer to break than easier ones. +Only one break can be in progress at a time per breaker, calling `:mine()` +again while a break is running is a no-op. + +## Properties + +- **`.name`** + - the breaker's alias (same label shown in the terminal sidebar) + +## mine + +Starts a multi-tick break of the block at the breaker's facing position. +Returns a [BreakBuilder](./breaker-handle.md#breakbuilder) so the script can +chain `:connect(fn)` to redirect the drops. If no chain follows, the drops +flow into [Network Storage](../nodeworks-mechanics/network-storage.md) using +the standard [Storage Card](../items-blocks/storage_card.md) priority rules. + + +```lua +local breaker = network:get("quarry_1") +breaker:mine() -- drops go to network storage +``` + + +If the target is air, unbreakable, or above the breaker's tier, `:mine()` +returns a no-op builder so chained calls don't crash. + +## cancel + +Aborts the in-flight break, if any. Safe to call when idle. The block isn't +broken and no drops are produced. + + +```lua +local breaker = network:get("breaker_1") +breaker:mine() +if dangerous() then + breaker:cancel() -- stop before completion +end +``` + + +## block + +Returns the block id at the breaker's facing position, the same shape as +[`ObserverCard:block`](./card-handle.md#observer-card). Useful for gating a +break on the block's identity. + + +```lua +local breaker = network:get("breaker_1") +if breaker:block() == "minecraft:stone" then + breaker:mine() +end +``` + + +## state + +Returns a property table for the block at the breaker's facing position. Same +shape as [`ObserverCard:state`](./card-handle.md#observer-card), every +`BlockState` property the block has (growth `age`, `facing`, `lit`, +`waterlogged`, ...) becomes a field. + + +```lua +local breaker = network:get("crop_breaker") +local state = breaker:state() +if state.age == 7 then + breaker:mine() -- only break fully-grown crops +end +``` + + +## isMining + +Returns `true` while a break is in progress, `false` when idle. Use it to +avoid issuing a second `:mine()` mid-break (the second call is a no-op anyway, +but `:isMining()` lets the script branch cleanly). + + +```lua +local breaker = network:get("breaker_1") +if not breaker:isMining() then + breaker:mine() +end +``` + + +## progress + +Returns a fraction from `0` to `1` representing how far along the current +break is. `0` when idle. Useful for driving a progress display or pacing +follow-up actions. + + +```lua +local breaker = network:get("breaker_1") +print(string.format("%.0f%%", breaker:progress() * 100)) +``` + + +--- + +## BreakBuilder + +Returned by [`Breaker:mine()`](./breaker-handle.md#mine). Configures how the +drops route once the break completes. With no chain, drops flow to network +storage automatically. Chain `:connect(fn)` to redirect them to a script +handler instead. + +### connect + +Redirects the drops from this break to a callback. The handler receives one +[ItemsHandle](./items-handle.md)-shaped value per dropped stack, so a single +break of a multi-drop block (e.g. a fortune-affected ore) calls the handler +multiple times. + +The handler can read the drop's `.id`, `.name`, `.count`, and `.kind` to +decide what to do. Items the handler doesn't claim spill back into network +storage as the default routing. + + +```lua +local breaker = network:get("breaker_1") +local chest = network:get("ore_chest") +breaker:mine():connect(function(item: ItemsHandle) + if item.id == "minecraft:diamond" then + chest:insert(item) -- diamonds go to a dedicated chest + end + -- everything else falls through to network storage +end) +``` + + +> **Note:** The breaker's `:connect` handler runs on break completion, not on +> every tick. Errors inside the handler are swallowed so a bad callback can't +> jam the breaker. diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/lua-api/card-handle.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/lua-api/card-handle.md new file mode 100644 index 000000000000..f64190ae2372 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/lua-api/card-handle.md @@ -0,0 +1,359 @@ +--- +navigation: + parent: lua-api/index.md + title: CardHandle + icon: blank_card +categories: + - api_types +description: reference to a single card in a network +--- + +# CardHandle + +A reference to a single card on the network. You get one from [`network:get(alias)`](network.md#get) +or from a [HandleList](handle-list.md) returned by [`network:getAll(type)`](network.md#getAll). + + + +--- + +## Properties + +- **`.name`** + - the card's alias (same label shown in the terminal sidebar) + +--- + +## Inventory Cards + +*Applies to IO Cards and Storage Cards.* Both expose the same Lua API, the +difference is in how the network treats the block they're attached to. See + and for the in-world +behavior. + +### face + +Narrow to a specific face of the adjacent block. Useful when the block +has a different inventory on each side (furnace inputs vs outputs, etc.). + +By default a card will choose the face it's facing. + + + + + `card:face("top")` + + + `card` + + + + +```lua +local card = network:get("io_1") +card:insert(coal) +card:face("top"):insert(inputItem) +``` + + +### slots + +Narrow the card's inventory to specific slots using their indices (index starts at 1) + + + + + + + + + + + +```lua +local card = network:get("io_1") +card:slots(2, 4):find("*") -- selects Stone and Diorite +``` + + +### find + +Scans the card's inventory for items/fluids matching the filter. Filter syntax is +identical to [`network:find`](network.md#find), the only difference is the scope +is this card's slots/tanks instead of very storage card on the network. + + +```lua +local coalInCard = card:find("minecraft:coal") +if coalInCard then + print(coalInCard.count, "coal in this card") +end +``` + + +### findEach + +Identical to [find](./card-handle.md#find) except this returns a list of [ItemsHandle](./items-handle.md)'s. +Each entry is unique by its Item ID and if it contains NBT Data. + +If you had diamond sword in your network, some with enchantments and some without +they would be separated into different entries + + + + + + + + + + + +```lua +local allItems = card:findEach("*") +for _, val in allItems do + print(val.name) +end +-- Cobblestone +-- Oak Planks +-- Stick +``` + + +### insert + +Moves items or fluids *into* this card's inventory. Either the full amount fits and +moves or nothing moves at all. You never end up with a partial transfer. +Returns `true` when the full amount landed, `false` if it wouldn't fit. +Mirrors [`network:insert`](network.md#insert) except it's scoped to this card. + + +```lua +local coal = network:find("minecraft:coal") +if coal and card:insert(coal, 32) then + print("stored 32 coal in this card") +end +``` + + +### tryInsert + +Like [`insert`](card-handle.md#insert) but moves whatever fits instead of +all-or-nothing. Returns the count that actually landed (0 up to the requested amount). +Anything that didn't fit stays in the source. Use this when a partial move is fine. + + +```lua +local coal = network:find("minecraft:coal") +if coal then + local moved = card:tryInsert(coal) + print("moved", moved, "of", coal.count, "coal") +end +``` + + +### count + +Returns the total quantity in this card's inventory +that matches the filter. (Fluids count in mB) + +The filtering is the exact same syntax as [find](network.md#find) + + +```lua +print(card:count("#minecraft:coals")) +``` + + +--- + +## Redstone Card + +*Applies to 's only.* The inventory methods above don't apply, a +redstone card's `card:find()` is nil. + +### powered + +Returns `true` if the incoming redstone signal is greater than 0. + + + + + + + + + +```lua +local card = network:get("redstone_1") +print(card:powered()) +-- true +``` + + +### strength + +Returns the incoming redstone signal strength from 0 to 15. + + + + + + + + + +```lua +local card = network:get("redstone_1") +print(card:strength()) +-- "14" +``` + + +### set + +Emits a redstone signal. Boolean maps to 15 or 0 just like a . Number is clamped to 0 to 15. + + + + + 15 strength + + + + + + + + +```lua +local card = network:get("redstone_1") +card:set(true) -- emit a signal of 15 strength like a lever +card:set(false) -- set emitted signal to 0 +``` + + +You can use a number to specify the strength of the signal emitted + + + + + 3 strength + + + + + + + + +```lua +local card = network:get("redstone_1") +card:set(3) +``` + + +### onChange + +Registers a callback fired whenever the incoming redstone signal strength changes. + + + + + + + + redstone clock/pulser + + + + +```lua +local card = network:get("redstone_1") +-- print "state changed" when redstone torch turns on and off +local lastPowered = card:powered() +card:onChange(function(strength: number) + local powered = strength > 0 + if lastPowered == powered then + return + end + lastPowered = powered + print("state changed") +end) +``` + + +> **Tip:** It's also recommended to turn on the ["Autorun"](../items-blocks/scripting_terminal.md#autorun) of the +> when using `:onChange` + +![](../assets/images/autorun.png) + +## Observer Card + +*Applies to 's only.* The inventory methods above +don't apply. An observer card's `card:find()` is nil. The card watches the block +in front of the installed face and exposes its id, properties, and a change event. + +### block + +Returns the block id at the watched position as a `"namespace:path"` string. + + +```lua +local watcher = network:get("watcher_1") +print(watcher:block()) +-- "nodeworks:celestine_cluster" +``` + + +If the watched chunk isn't loaded the call still returns the cached block (Minecraft +will load the chunk to read it). For high-volume scripts prefer `:onChange` over +polling `:block()` every tick. + +### state + +Returns the property table for the watched block. Keys are the block's +property names (`age`, `facing`, `waterlogged`, `lit`, `axis`, ...). Values +come back as numbers, booleans, or lowercase strings depending on the +property's type. Air and other propertyless blocks return an empty table. + + +```lua +local s = network:get("watcher_1"):state() +if s.age == 3 then + print("fully grown") +end +``` + + +Different blocks expose different properties, what `state()` returns depends +entirely on what the watched block is. Use `:block()` first if you need to +branch on which block you're inspecting. + +### onChange + +Registers a callback that fires whenever the watched block id or any state +property changes. Replaces any previous handler on the same card. The handler +receives the new block id and the new property table. + + +```lua +local watcher = network:get("watcher_1") +local breaker = network:get("breaker_1") + +watcher:onChange(function(block: string, state: { [string]: any }) + if block == "nodeworks:celestine_cluster" then + breaker:set(true) + scheduler:delay(2, function() breaker:set(false) end) + end +end) +``` + + +The first poll after registration seeds the "last seen" state silently, a +script that restarts won't fire a phantom event for a block that was already +in its final form before the script came up. + +> **Tip:** Like the redstone `:onChange`, this is the kind of callback you'll +> usually want autorunning. Turn on ["Autorun"](../items-blocks/scripting_terminal.md#autorun) +> on the so the handler keeps firing across logins. diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/lua-api/channel.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/lua-api/channel.md new file mode 100644 index 000000000000..b35f77802a2a --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/lua-api/channel.md @@ -0,0 +1,84 @@ +--- +navigation: + parent: lua-api/index.md + title: Channel + icon: io_card +categories: + - api_types +description: a dye-color-scoped view of the network +--- + +# Channel + +A `Channel` is a dye-color-scoped view of the network. You get one from +[`network:channel(color)`](network.md#channel). Lookups through a Channel only +see cards, variables, and devices whose channel matches that color, the channel +is picked in each card or device's own GUI. Multiple subsystems can share one +network without their card aliases stepping on each other. + + +```lua +local red = network:channel("red") +local blue = network:channel("blue") +red:getAll("redstone"):set(true) -- only the red-channel pistons fire +blue:getAll("redstone"):set(true) -- only the blue-channel pistons fire +``` + + +The color name must be one of the 16 vanilla dye colors (`white`, `red`, +`blue`, `light_blue`, `light_gray`, …). An unknown color raises an error. + +## Choosing a Channel + +In all [Cards](../nodeworks-mechanics/cards.md) and [Devices](../nodeworks-mechanics/devices.md), there will be a way to pick a Channel. By default all +devices and Cards start on `white`. You can click to expand a list of colors to +pick one + +![](../assets/images/choose_channel.png) + +## get + +Alias lookup scoped to this channel. Returns a [CardHandle](card-handle.md), +[VariableHandle](variable-handle.md), Breaker, or Placer, the same name +namespace as [`network:get`](network.md#get). Errors when no member on the +channel matches the alias. + + +```lua +local red = network:channel("red") +local counter = red:get("counter") -- variable named "counter" on the red channel +local door = red:get("door") -- card named "door" on the red channel +``` + + +## getAll + +Returns a [HandleList](handle-list.md) of every member on this channel +matching the given type. Same type strings as +[`network:getAll`](network.md#getAll), `"io"`, `"storage"`, `"redstone"`, +`"observer"`, `"variable"`, `"breaker"`, `"placer"`. Pass nothing to get +every member on the channel regardless of type. + + +```lua +local red = network:channel("red") +red:getAll("observer"):onChange(function(block, state) + print("red-channel observer fired:", block) +end) +``` + + +## getFirst + +The first member on this channel of the given type, or `nil` when none match. +Useful when there's only ever one of something per channel and you don't want +to index into a HandleList. + + +```lua +local sensor = network:channel("blue"):getFirst("observer") +if sensor then + print(sensor.name, "is the blue-channel observer") +end +``` + diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/lua-api/craft-builder.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/lua-api/craft-builder.md new file mode 100644 index 000000000000..7fe5767d2930 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/lua-api/craft-builder.md @@ -0,0 +1,120 @@ +--- +navigation: + parent: lua-api/index.md + title: CraftBuilder + icon: minecraft:crafting_table +categories: + - api_types +description: returned by [`network:craft`](network.md#craft) and configures how the craft result is delivered once it completes +--- + +# CraftBuilder + +A `CraftBuilder` is what [`network:craft`](network.md#craft) hands back. It +represents a craft the network has planned but not yet delivered. By default +the result lands in [Network Storage](../nodeworks-mechanics/network-storage.md) +when the craft finishes. If you want a callback instead, chain `:connect(fn)`. + +The craft might finish on the same tick (vanilla recipes pulled together out +of storage) or take many ticks (anything routed through a +[`network:handle`](network.md#handle) processing handler, or a multi-stage +crafting tree). Either way, the builder's API is the same. + +> **Note:** `network:craft` always returns a builder, even when the craft +> can't be planned (no recipe, missing ingredients, no Crafting CPU). The +> failure surfaces through `:connect`'s callback as `nil`. + +## Default: stores the result + +If you don't chain anything, the finished items are pushed into Network +Storage automatically using the normal [Storage Card](../items-blocks/storage_card.md) +priority and [`network:route`](network.md#route) rules. After that you can +query them through `network:find` like anything else in the pool. + + +```lua +-- fire-and-forget: craft 16 torches, they land in storage +network:craft("minecraft:torch", 16) +``` + + +## connect + +Hands the finished items off to a callback **instead** of auto-storing. +Calling `:connect` flips the builder out of the default behavior, the +runtime won't auto-store, the callback owns the result. + +The callback's argument is `ItemsHandle?`, an [ItemsHandle](items-handle.md) +on success or `nil` on failure. Always check before using. + + +```lua +local oven = network:get("oven") +network:craft("minecraft:bread", 4):connect(function(items: ItemsHandle?) + if not items then + print("bread craft failed") + return + end + oven:insert(items) -- finished bread goes straight into the oven +end) +``` + + +The callback fires once when the craft resolves. Failure modes that surface +as `nil`: + +- Plan failure: no recipe, missing ingredients, no Crafting CPU on the network. +- Async timeout: a processing handler never delivered the outputs. +- CPU offline: the Crafting CPU was broken or removed mid-craft. + +In every failure case the runtime also releases any partial CPU buffer back +into Network Storage so items aren't stranded. + +### You're responsible for moving the items + +The handle the callback receives is a **live reference to the items still +sitting in the Crafting CPU's buffer**. Calling `card:insert(items)` / +`network:insert(items)` drains them out of the buffer into the destination. + +Anything still in the buffer when the callback returns is **dropped at the +CPU's position** and a terminal error is logged. The contract is "you took +the handle, you're responsible for moving the items," failing to drain it +isn't silent. + + +```lua +local chest = network:get("ore_chest") +network:craft("minecraft:iron_ingot", 8):connect(function(items: ItemsHandle?) + if not items then return end + if not chest:insert(items) then + -- chest full: fall back to network storage instead of dropping + network:insert(items) + end +end) +``` + + +This is intentionally different from auto-store, which always routes through +the network's storage cards (and only drops in-world if every storage card +refuses). With `:connect`, the callback decides where the items go, and the +runtime trusts you to actually move them. + +> **Note:** Errors thrown inside the callback are logged to the terminal but +> don't take down the rest of your script. + +## When connect runs synchronously + +Vanilla recipes whose ingredients are already in storage finish on the same +tick. The callback still fires through the same path, just one tick later +than the `:craft` call so that `:connect` has a chance to register before +resolution. You don't need to special-case this, the API behaves identically +for sync and async crafts. + + +```lua +-- works the same whether the craft is instant or takes 30s of smelting +network:craft("minecraft:iron_ingot", 8):connect(function(items: ItemsHandle?) + if items then chest:insert(items) end +end) +``` + diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/lua-api/handle-list.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/lua-api/handle-list.md new file mode 100644 index 000000000000..0cf659725f56 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/lua-api/handle-list.md @@ -0,0 +1,97 @@ +--- +navigation: + parent: lua-api/index.md + title: HandleList + icon: minecraft:red_bundle +categories: + - api_types +description: a fan-out list of cards or variables returned by getAll +--- + +# HandleList + +A `HandleList` is a list of cards or variables that **broadcasts write +methods across every member**. You get one from +[`network:getAll(type)`](network.md#getAll) or +[`Channel:getAll(type)`](network.md#channel-getall). + +Calling a write method on the list invokes that method on each member with +the same arguments, in order. Read methods aren't exposed on the list, their +return values are the whole point of calling them, and silently dropping +them across N members would be a footgun. To read per-member, call `:list()` +and iterate. + + +```lua +-- Toggle every red-channel piston on at once. +network:channel("red"):getAll("redstone"):set(true) +-- Register the same onChange handler on every observer in one line. +network:getAll("observer"):onChange(function(block, state) + if block == "nodeworks:celestine_cluster" then + -- ... + end +end) +``` + + +## Which methods broadcast + +Only **write methods** fan out across the list, ones whose call site doesn't +depend on the return value. Reads like `:powered()`, `:count()`, `:get()`, +`:block()` are intentionally absent so a return value isn't silently dropped +across N members. To read per-member, call `:list()` and inspect each member +individually. + +Each type's own page (e.g. [RedstoneCard](card-handle.md#redstone-card), +[VariableHandle](variable-handle.md)) is the source of truth for which of its +methods are reads versus writes. + +## list + +The escape hatch. Returns the underlying array so you can iterate per-member, +read individual values, or apply per-member logic that doesn't fit the +broadcast shape. + + +```lua +local pistons = network:channel("red"):getAll("redstone") +for _, p in pistons:list() do + if p:powered() then + print(p.name, "is currently powered") + end +end +``` + + +## count + +How many members the list has. Cheaper than `#list:list()` because it doesn't +build the array. + + +```lua +local watchers = network:getAll("observer") +print(watchers:count(), "observer cards on the network") +``` + + +## face + +Returns a new HandleList whose card members have their access face overridden +to `name`. The original list isn't modified, the override applies only to the +returned copy. Members that aren't [CardHandle](card-handle.md)'s (variables, +breakers, placers) pass through unchanged, those handle types ignore face. + +The override survives when the list is fed into a preset +([Importer](importer.md) / [Stocker](stocker.md)), so a wildcard fan-out can +read or write a non-default face on every matched card with one expression. + + +```lua +-- pull furnace outputs (bottom face) from every io_* card into the output chest +importer:from(network:cards("io_*"):face("bottom")):to("output"):start() +``` + + +Same shape as [`CardHandle:face`](card-handle.md#face), but applied across the +whole list at once. diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/lua-api/importer.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/lua-api/importer.md new file mode 100644 index 000000000000..7a1f4e6f0c50 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/lua-api/importer.md @@ -0,0 +1,174 @@ +--- +navigation: + parent: lua-api/index.md + title: Importer + icon: minecraft:hopper +categories: + - api_types + - api_preset +description: move items from A to B with a distribution strategy +--- + +# Importer + +The `importer` global builds movers that pull items from one or more sources +and deposit them into one or more targets. Every importer is a scheduled task +under the hood, so it keeps running at its configured interval until the +script stops or you call `:stop()` on the handle. + +## from + + +```lua +Importer:from(...sources: string | CardHandle | network): ImporterBuilder +``` + + +Starts an importer chain. Sources can be any mix of card aliases, CardHandle +objects, or the `network` global (meaning the whole Network Storage pool). +At least one source is required. + + +```lua +importer:from("farmChest") -- one named source +importer:from(network) -- network pool as source +importer:from("chestA", network, network:get("chestB")) -- mixed +``` + + +## to + + +```lua +ImporterBuilder:to(...targets: string | CardHandle | network): ImporterBuilder +``` + + +Sets the destinations. Same polymorphism as `:from`: card aliases, CardHandle +objects, or `network` for the pool. At least one target is required. + + +```lua +importer:from("farm"):to("storage1", "storage2"):start() +importer:from("mobFarm"):to(network):start() -- deposit into the pool +``` + + +## filter + + +```lua +ImporterBuilder:filter(pattern: string): ImporterBuilder +``` + + +Narrows the mover to items (or fluids) matching the filter. **Optional.** The +default is `*`, which moves every item. Use filter syntax from +[Network:find](network.md#find) including `$item:id`, `$fluid:id`, `#tag`, +`modname:*`, and regex. + + +```lua +-- Move only cobblestone +importer:from(network) + :filter("$item:minecraft:cobblestone") + :to("io_*") + :start() + +-- Move all c:ores items +importer:from("mobFarm"):filter("#c:ores"):to("storage"):start() +``` + + +## Distribution + +The importer has two ways of splitting items across targets. The default is +fill, you opt into round robin explicitly. + +### Fill (default) + +Fills the first target first. Once it's full, overflow goes to the next target, +and so on. Good when you have a priority order and want one chest to stay topped +up before any excess lands elsewhere. + + +```lua +importer:from("furnaceOutput") + :filter("$item:iron_ingot") + :to("mainChest", "overflow") + :start() +``` + + +### roundrobin + + +```lua +ImporterBuilder:roundrobin(step: number?): ImporterBuilder +``` + + +Distributes evenly across every target on every tick. `step` is the max items +delivered to each target per tick (default 1). With step=1, three items in +the source land as one in each of three targets in a single tick. For bulk +flow, raise the step or speed up the tick rate with `:every(1)`. + + +```lua +importer:from("bufferChest") + :to("furnace1", "furnace2", "furnace3") + :roundrobin() + :every(10) + :start() +``` + + +The round robin cursor rotates one position per tick so fairness holds even +when the source is running thin and only some targets get items that tick. + +## Wildcards in card aliases + +Both `:from` and `:to` accept `*` wildcards in card names. A single +`"io_*"` expands to every card whose alias matches the pattern at the +moment the importer resolves its snapshot, and re-expands any time the +network topology changes. + + +```lua +-- Fan out from one chest to every card named io_... +importer:from("input"):to("io_*"):roundrobin():start() + +-- Pull from a whole group of source chests into a single output +importer:from("farm_*"):to("storage"):start() +``` + + +## Example: two-stage smelter array + +Ores feed in round robin to three furnaces, outputs collect into a central +chest. + + +```lua +-- Feed ore evenly to three furnaces +importer:from("oreBuffer") + :filter("$item:iron_ore") + :to("furnace1", "furnace2", "furnace3") + :roundrobin() + :every(10) + :start() + +-- Collect ingots from all three into the output chest +importer:from("furnace1", "furnace2", "furnace3") + :filter("$item:iron_ingot") + :to("outputChest") + :start() +``` + + +## See also + +* [Shared preset methods](presets.md#shared-methods) (`:every`, `:start`, + `:stop`, `:isRunning`). +* [Stocker](stocker.md) for the "maintain a level" pattern. +* [Network:find](network.md#find) for filter syntax details. diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/lua-api/index.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/lua-api/index.md new file mode 100644 index 000000000000..9fda297fbf8a --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/lua-api/index.md @@ -0,0 +1,34 @@ +--- +navigation: + title: Nodeworks Scripting API + position: 40 +--- + +# Nodeworks Scripting API + + + +Nodeworks uses [Lua](https://www.lua.org/docs.html) as its scripting language, +with a few quality-of-life extensions the editor handles before the script runs: + +- **Type annotations:** ( `local x: CardHandle`, `function(xs: { CardHandle }): ItemsHandle`, etc. ) + - Tells the editor what a variable, parameter, or return value is. In return you get accurate hover tooltips, better autocompletion, and element-type inference inside for-loops + +## Built-ins + + + +- [clock()](): fractional seconds elapsed since the script started running +- [print(...)](): log to terminal output +- [require(name)](): load another script tab from the same terminal by name + +## Presets + +Declarative builders that wrap common scheduler loops in one-line chains. See +[Presets](presets.md) for the shared pattern. + + + +## Types + + diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/lua-api/input-items.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/lua-api/input-items.md new file mode 100644 index 000000000000..4975e7b36b43 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/lua-api/input-items.md @@ -0,0 +1,67 @@ +--- +navigation: + parent: lua-api/index.md + title: InputItems + icon: minecraft:cobblestone +categories: + - api_types +description: the second argument passed to [network:handle callbacks](network.md#handle) a per-recipe bag of [`ItemsHandle`](items-handle.md) fields keyed by the recipe's input slot names +--- + +# InputItems + +`InputItems` is the second argument your [`network:handle`](network.md#handle) +function receives. The network has already pulled the recipe's ingredients +out of storage for you, they're waiting on this table, one field per input +slot. Your job is to pump those items into the actual machine. + +Each field is a full [ItemsHandle](items-handle.md), so you call `:insert`, +`:tryInsert`, `:count`, etc. on it just like any other handle. + +## Field names + +The field names are **camelCased from the input item ids**. So +`minecraft:raw_iron` becomes `items.rawIron`, `minecraft:copper_ingot` +becomes `items.copperIngot`. The script editor autocompletes the right names +for whichever recipe you're handling, no need to memorise them. + + +```lua +local furnace = network:get("furnace") +network:handle("...", function(job: Job, items: InputItems) + furnace:face("top"):insert(items.rawIron) -- minecraft:raw_iron + job:pull(furnace:face("bottom")) +end) +``` + + +### Duplicate ingredients + +If the recipe has the same ingredient in more than one slot, the second +occurrence gets a `2` suffix, the third gets `3`, and so on. So a recipe +that takes two copper ingots and one gold ingot exposes them as +`items.copperIngot`, `items.goldIngot`, `items.copperIngot2`. + + +```lua +local press = network:get("press") +network:handle("...", function(job: Job, items: InputItems) + press:face("top"):insert(items.copperIngot) + press:face("top"):insert(items.copperIngot2) + press:face("north"):insert(items.goldIngot) + job:pull(press:face("bottom")) +end) +``` + + +## You must use everything + +The handler is expected to move every input into the machine. If anything's +left in `items.` when the handler returns, the network treats the +craft as incomplete and retries the recipe later. There's no "skip this +input" mode, the recipe says it needs N copper ingots and N copper ingots +have to land somewhere. + +> **Note:** "Use it" means insert it somewhere reachable, network storage +> via `network:insert` counts. The check is just "did the script consume +> the items it was given?", not "did they end up in the right machine." diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/lua-api/items-handle.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/lua-api/items-handle.md new file mode 100644 index 000000000000..0c253fa73640 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/lua-api/items-handle.md @@ -0,0 +1,272 @@ +--- +navigation: + parent: lua-api/index.md + title: ItemsHandle + icon: minecraft:bundle +categories: + - api_types +description: a specific resource (items or fluid) with count, source, and transfer ops. +--- + +# ItemsHandle + +An `ItemsHandle` is a **single resource type with a count attached**. It's +the value most network and card methods hand back when you ask "what's in +storage?" and the value those same methods accept when you say "move this +somewhere." + +> **Note:** A handle is a **snapshot** taken when the call returned. The +> `.count` doesn't update as items move in or out of storage afterwards. +> If you need a fresh count, call `:find` again. + +--- + +## What a handle represents (and doesn't) + +A handle is an **aggregate of every matching resource at the queried +location**, not a single inventory stack. Two important consequences: + +**The same handle covers both items and fluids.** The `.kind` field tells +you which one you're looking at. Counts are stack units for items and +millibuckets (mB) for fluids. Covered in detail under [count](./items-handle.md#count) and +[kind](./items-handle.md#kind). + +**The count can exceed `maxStackSize`.** `network:find("minecraft:coal")` +might return a handle with `count = 192` even though a single inventory +slot only holds 64. The handle is "every coal anywhere in the network", +which can be spread across many slots, many storage cards, or many tanks. +The same is true for [card:find](card-handle.md#find), which aggregates +across the card's slots and tanks. + +If you need each distinct stack separately (e.g. an enchanted sword +versus an un-enchanted one of the same id), use +[`findEach`](network.md#findEach) instead. It splits by id **and** +NBT data so each unique combination becomes its own handle. + + +```lua +local allCoal = network:find("minecraft:coal") +print(allCoal.count) -- 192, total across the whole network + +for _, h in network:findEach("minecraft:diamond_sword") do + print(h.name, h.hasData) -- enchanted vs plain swords as separate entries +end +``` + + +--- + +## Properties + +### id + +The resource id of what this handle points at. Same shape for both kinds: +`"minecraft:diamond"` for an item, `"minecraft:water"` for a fluid. + + +```lua +local coal = network:find("minecraft:coal") +print(coal.id) -- "minecraft:coal" +``` + + +### name + +The display name as the player sees it in tooltips. Translated, formatted, +and respects custom names (anvil-renamed items show the renamed string). + + +```lua +local sword = network:find("minecraft:diamond_sword") +print(sword.name) -- "Diamond Sword" (or "Excalibur" if renamed) +``` + + +### count + +How much of the resource the handle represents. **Items are in stack units** +(individual items, not stacks of 64). **Fluids are in mB** (millibuckets, +1000 mB = 1 bucket). + + +```lua +local coal = network:find("minecraft:coal") +print(coal.count) -- 192 (192 individual coal pieces) +-- or for fluids +local water = network:find("minecraft:water") +print(water.count) -- 4000 (4 buckets in mB) +``` + + +### kind + +`"item"` or `"fluid"`. Branch on this when a script handles both. + + +```lua +for _, h in network:findEach("*") do + if h.kind == "fluid" then + print(h.count, "mB of", h.name) + else + print(h.count, "x", h.name) + end +end +``` + + +### stackable + +`true` for items with a max stack size greater than 1 (cobblestone, +ingots, planks, ...), `false` for tools, armour, and anything unique +(potions with custom NBT, written books). Fluids are always `false` here, +they're tracked by volume not stacks. + + +```lua +for _, item in inputChest:findEach("*") do + if not item.stackable then + nonStackables:insert(item) + else + network:insert(item) + end +end +``` + + +Example of moving non-stacking items in another chest outside of your network + +### maxStackSize + +The largest stack the resource can occupy in a single inventory slot. +`64` for most items, `16` for snowballs and ender pearls, `1` for tools +and armour. Fluids report `1`, not meaningful. + + +```lua +local coal = network:find("minecraft:coal") +print(coal.maxStackSize) -- 64 +``` + + +### hasData + +`true` if the stack carries non-default NBT, enchantments, custom names, +written-book content, dyed armour, suspicious-stew effects, etc. Useful for +sorting "interesting" items away from plain bulk. + + +```lua +for _, item in inputChest:findEach("*") do + if item.hasData then + enchantedItems:insert(item) + else + network:insert(item) + end +end +``` + + +--- + +## Methods + +### hasTag + +Returns `true` if the resource is a member of the given tag. Accepts the tag +id with or without the leading `#`, both `"minecraft:logs"` and +`"#minecraft:logs"` work. + + +```lua +for _, h in network:findEach("*") do + if h:hasTag("minecraft:logs") then + print(h.name, "is a log type") + end +end +``` + + +Tag membership is the same set Minecraft uses for crafting recipes and +biome decisions, so anything that works in a vanilla "any log" recipe will +match here. + +### matches + +Returns `true` if the resource matches the given filter, using the same +filter syntax as [`network:find`](network.md#find). Useful for routing +predicates and per-item branching without needing a full `:find` round-trip. + + +```lua +function smelt(item: ItemsHandle) + if item:matches("/_ore$/") then + machine:insert(item) + return + end + furnace:insert(item) +end +``` + + +--- + +## Passing a handle into transfer methods + +A handle isn't just a read-only value, it's also the **source for moving +those items**. Most transfer methods take a handle as their argument and +move from wherever it came from into the new destination. + + +```lua +local coal = network:find("minecraft:coal") +if coal then + -- move all of it into the chest + chest:insert(coal) +end +``` + + +The methods that consume a handle this way: + +- [`card:insert`](card-handle.md#insert) / [`card:tryInsert`](card-handle.md#tryinsert), into the card's adjacent inventory +- [`network:insert`](network.md#insert) / [`network:tryInsert`](network.md#tryinsert), into network storage with routing rules +- [`placer:place`](placer-handle.md#place), uses the handle's `.id` to pick what to place + +The handle's `.count` is the maximum these methods will move. Pass an +optional second argument to cap the move at fewer, useful for small +destinations like a furnace's fuel slot: + + +```lua +local coal = network:find("minecraft:coal") +furnace:insert(coal, 8) -- top up the fuel slot with 8 coal +``` + + +> **Note:** `:insert` is all-or-nothing. If the destination can't fit the +> full amount you're trying to move, nothing moves and the call returns +> `false`. Use `:tryInsert` when a partial transfer is fine, or pass the +> second-arg cap so the move stays within the destination's capacity. + +--- + +## nil when nothing matches + +`:find` and `findEach`'s entries return `nil` when the filter has no match. +A handle with `count = 0` doesn't exist, the absence of a result is +expressed by absence. Always check before chaining: + + +```lua +local coal = network:find("minecraft:coal") +if coal then + print(coal.count, "coal available") +else + print("no coal in storage") +end +``` + + +The editor's type system tracks this, hovering `coal` shows +`ItemsHandle?` (the `?` is the "or nil" marker) so it'll prompt you when +you forget the check. diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/lua-api/job.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/lua-api/job.md new file mode 100644 index 000000000000..63af2cda696f --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/lua-api/job.md @@ -0,0 +1,78 @@ +--- +navigation: + parent: lua-api/index.md + title: Job + icon: minecraft:paper +categories: + - api_types +description: the first argument passed to a [network:handle callback](network.md#handle) and represents the in-flight processing job the handler is responsible for producing outputs for +--- + +# Job + +A `Job` is the first argument your [`network:handle`](network.md#handle) +function receives. Each time the network needs to run a recipe on your +Processing Set, it calls your handler with a fresh `Job` and the +[items](input-items.md) it pulled from storage. Your handler puts those items +into the machine, then calls `job:pull(card)` to tell the network where the +finished items will come out. + +## pull + +Tells the network where the finished items will come out. Pass one or more +[CardHandle](card-handle.md)s and the network watches them until the full +output count has been collected. + +If the outputs are already sitting in one of the cards (instant recipes, +shapeless crafts), the craft finishes on the same tick. Otherwise the network +keeps checking each tick and grabs whatever's in the card so far, so a +furnace that drips out one ingot at a time still works fine. + + +```lua +local furnace = network:get("furnace") +network:handle("...", function(job: Job, items: InputItems) + furnace:face("top"):insert(items.rawIron) + -- pull from the bottom face once the smelt completes + job:pull(furnace:face("bottom")) +end) +``` + + +### Multiple source cards + +Pass more than one card if the finished items could land in any of several +places. The network checks each card in order and grabs from whichever has +the items. Useful when you have downstream pipes or hoppers that route the +output into different chests depending on the item. + + +```lua +local furnace = network:get("furnace") +local outboxA = network:get("outbox_a") +local outboxB = network:get("outbox_b") +network:handle("...", function(job: Job, items: InputItems) + furnace:face("top"):insert(items.rawIron) + -- finished ingots get sorted into one of two chests, pull from either + job:pull(outboxA, outboxB) +end) +``` + + +### Put items in first + +`:pull` only handles the output side. You still have to insert the +[InputItems](input-items.md) into the machine yourself. If anything's left +in `items.` when your handler returns, the craft is considered +incomplete and the network will try the recipe again. + +### Timeout + +If the outputs never show up, the craft eventually times out and the inputs +are returned to storage. Each Processing Set has its own timeout (in ticks) +that you can tune in its GUI, defaults to 15 seconds. Bump it up for slow +machines like large smelting batches or modded multi-second recipes. + +> **Note:** An error inside your handler stops *that one craft* but doesn't +> take down the rest of your script. If a craft hangs unexpectedly, check the +> terminal log, the error will be there. diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/lua-api/network.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/lua-api/network.md new file mode 100644 index 000000000000..159920771536 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/lua-api/network.md @@ -0,0 +1,399 @@ +--- +navigation: + parent: lua-api/index.md + title: Network + icon: node +categories: + - api_builtin +description: query storage, route items, open craft jobs, register handlers +--- + +# Network + +The `network` module is the entry point into the live Nodeworks network the is +attached to. It queries storage, routes items between handles, and registers callbacks. + +## get + +Returns a reference to anything on the network addressed by name, any +, , , +, or , typically used at +the top of the script. Cards take priority on a name collision with a variable. + +You can click on the sidebar of the scripting terminal to auto-get them as well. + +![about to click item](../assets/images/click-to-add-card-01.png) ![after clicking item](../assets/images/click-to-add-card-02.png) + + + + + Renamed to **"chest"** + + + Renamed to **"furnace"** + + + + +```lua +local chest = network:get("chest") -- gets the Storage Card +local furnace = network:get("furnace") -- gets the IO Card +local count = network:get("count") -- gets a Variable named "count" +``` + + +--- + +## getAll + +Returns a [HandleList](handle-list.md) of every card or variable matching the +given type. The HandleList broadcasts write methods (`:set`, `:onChange`, …) +across every member, so toggling many pistons or registering a handler on +many observers takes one line. To iterate per-member, call `:list()`. + + + + + + + + + + + + +```lua +-- Broadcast: turn every redstone card on at once +network:getAll("redstone"):set(true) +-- Iterate per-member when you need the value of a read method +local storages = network:getAll("storage") +for _, storage in storages:list() do + print(storage.name) +end +-- "storage_0" +-- "storage_1" +``` + + +--- + +## cards + +Returns a [HandleList](handle-list.md) of the matching globbed card names. Useful +for when you want to interact with multiple cards at the same time with the same +naming convention. + + +```lua +local allPistonCards = network:cards("piston_*") +allPistonCards:set(true) -- turn on all pistons +``` + + +--- + +## channel + +Scopes lookups to a single dye-color channel. Returns a [`Channel`](./channel.md) handle whose +`:get`, `:getAll`, and `:getFirst` only see cards, variables, and devices set to +that color, the same channel filter applies. Errors on unknown color names. + + +```lua +local red = network:channel("red") +red:getAll("redstone"):set(true) -- only the red-channel pistons +local count = red:get("counter") -- variable on the red channel +``` + + +--- + +## channels + +Returns a list of every dye-color channel currently in use on the network, +any color that has at least one card, variable, breaker, or placer assigned +to it. Order is by `DyeColor` id ascending, so iteration is stable. Useful +for discovering channels at runtime instead of hard-coding the list. + +> **Note:** `white` is the default channel for new members, so it shows up +> here in almost any non-empty network. + + +```lua +for _, color in network:channels() do + print(color, "is in use") +end +-- "white" is in use +-- "red" is in use +-- "blue" is in use +``` + + +A common pattern: drive the same handler over every active channel without +caring which colors the player chose. + + +```lua +for _, color in network:channels() do + network:channel(color):getAll("redstone"):set(false) +end +``` + + +--- + +## find + +Scans all [Network Storage](../nodeworks-mechanics/network-storage.md) for +items/fluids matching the filter. Returns an aggregated handle *(count summed across storage)* +or `nil` if nothing matches. + + +```lua +local all = network:find("*") -- gets all items and fluids if any +local allItems = network:find("$item:*") -- only items +local allFluids = network:find("$fluid:*") -- only fluids +local allCoal = network:find("minecraft:coal") -- item id +local allLogs = network:find("#minecraft:logs") -- tags +local allRaw = network:find("/^Raw.*/") -- regular expressions +``` + + +When using items from `:find` you should check to see if you have any first + + +```lua +local allCoal = network:find("minecraft:coal") +if allCoal then + print("we have coal") +end +``` + + +--- + +## findEach + +Like [find](./network.md#find), scan all [Network Storage](../nodeworks-mechanics/network-storage.md) +for matching items/fluids matching the filter. But instead returns a list of [ItemsHandle](./items-handle.md)'s. +Each entry is unique by its Item ID and if it contains NBT Data. + + +```lua +for _, items in network:findEach("$item:*") do + print(items.id, items.count, items.kind) +end +``` + + +If you had diamond sword in your network, some with enchantments and some without +they would be separated into different entries + + +```lua +for _, items in network:findEach("minecraft:diamond_sword") do + print(items.id, items.hasData) +end +-- "minecraft:diamond_sword" true +-- "minecraft:diamond_sword" false +``` + + +--- + +## count + +Returns the total quantity in [Network Storage](../nodeworks-mechanics/network-storage.md) +that matches the filter. (Fluids count in mB) + +The filtering is the exact same syntax as [find](network.md#find) + + +```lua +print("swords:", network:count("minecraft:diamond_sword")) +print("cobblestone:", network:count("minecraft:cobblestone")) +print("all:", network:count("*")) +-- "swords:" 3 +-- "cobblestone:" 256 +-- "all:" 259 +``` + + +--- + +## insert + +Inserts an [ItemsHandle](items-handle.md) into [Network Storage](../nodeworks-mechanics/network-storage.md) using the standard + priority rules. Every single item has to fit otherwise +none are moved and the function returns `false`. If you want a best-effort insert then +use [tryInsert](./network.md#tryinsert) + + +```lua +local ok = network:insert(items) +if ok then + print("all items were moved") +else + print("no items were moved, not enough space") +end +``` + + +--- + +## tryInsert + +Like [`insert`](network.md#insert) but moves whatever fits instead of +all-or-nothing. Returns the count that actually landed (0 up to the requested amount). +Anything that didn't fit stays in the source. Use this when a partial move is fine. + + +```lua +local moved = network:tryInsert(items) +print(moved .. " items were moved") -- can be 0 to items.count +``` + + +--- + +## craft + +(also see [Auto-Crafting](../nodeworks-mechanics/autocrafting.md)) + +Queues a craft for the given item. Returns a [CraftBuilder](./craft-builder.md). +By default the finished items are auto-stored into +[Network Storage](../nodeworks-mechanics/network-storage.md) once the craft +completes, no chain needed: + + +```lua +-- fire-and-forget: bread lands in storage when ready +network:craft("minecraft:bread", 4) +``` + + +Chain `:connect(fn)` to receive the result yourself. The callback gets an +[ItemsHandle?](items-handle.md), non-nil on success, `nil` on failure (plan +failed, async timeout, no CPU). Calling `:connect` overrides the auto-store. + + +```lua +local furnace = network:get("furnace") +network:craft("minecraft:charcoal"):connect(function(item: ItemsHandle?) + if item then + furnace:insert(item) + end +end) +``` + + +--- + +## shapeless + +Instantly crafts a shapeless recipe with ingredients from [Network Storage](../nodeworks-mechanics/network-storage.md). +If the recipe is invalid or ingredients are missing then nothing is crafted and +the function returns `nil`. + + +```lua +-- craft a flint and steel, output automatically goes into network storage. +network:shapeless("minecraft:flint", 1, "minecraft:iron_ingot", 1) +``` + + +--- + +## handle + +(also see [Auto-Crafting](../nodeworks-mechanics/autocrafting.md)) + +Registers a processing handler for an in-network . +The handler is invoked with inputs and must use the passed [Job](job.md) to `pull` +outputs. All items given from the [InputItems](input-items.md) **must** be taken +by the handler. + + + + + Renamed to **"furnace"** + + + + + **➜** + + + + + + +```lua +local furnace = network:get("furnace") +-- handler for raw iron -> iron ingot +network:handle("…", function(job: Job, items: InputItems) + furnace:face("top"):insert(items.rawIron) + job:pull(furnace:face("bottom")) +end) +``` + + +--- + +## route + +Bulk-edits the [filter settings](../items-blocks/storage_card.md#filters) of every + whose name matches a pattern. Returns a builder +whose methods chain so the whole rule set for a row of cards can be written +in one call. Each method mutates the matching cards immediately, the same as +right-clicking each card and editing its GUI by hand. + +The pattern is a name with `*` as a wildcard. `cobblestone_*` matches `cobblestone_0`, +`cobblestone_1`, etc. `*` alone matches every Storage Card on the network. + + +```lua +network:route("cobblestone_*") + :reset() + :rule("#c:cobblestones") + :noNbt() + :allow() +``` + + +### Builder methods + +| Method | Effect | +| ------------------------------------------------------ | ------------------------------------------------- | +| `:rule(filter)` | Appends a rule (same syntax as the GUI rule list) | +| `:clearRules()` | Drops every rule, leaves modes alone | +| `:allow()` / `:deny()` | Sets the rule-list mode | +| `:stackable()` / `:nonStackable()` / `:anyStackable()` | Sets the Stackability filter | +| `:hasNbt()` / `:noNbt()` / `:anyNbt()` | Sets the NBT filter | +| `:reset()` | Clears rules, sets Allow + Any + Any | + +Calls return the same builder so they chain. Mutations are immediate and +persist across save/load. + +--- + +## debug + +Prints a summary of the network topology + + +```lua +network:debug() +-- === Network Debug === +-- Controller: BlockPos{x=-25, y=70, z=10} +-- Nodes: 1 +-- Node BlockPos{x=-25, y=70, z=9}: 1 cards +-- NORTH: cobblestone_storage (storage) +-- Terminals: 1 +-- BlockPos{x=-26, y=70, z=9} +-- CPUs: 0 +-- Crafters (Instruction Sets): 0 +-- Processing APIs: 0 +-- Variables: 0 +``` + \ No newline at end of file diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/lua-api/placer-handle.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/lua-api/placer-handle.md new file mode 100644 index 000000000000..1eafb4d22675 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/lua-api/placer-handle.md @@ -0,0 +1,91 @@ +--- +navigation: + parent: lua-api/index.md + title: PlacerHandle + icon: placer +categories: + - api_types +description: a device to place blocks in front of it +--- + +# PlacerHandle + +A `PlacerHandle` is a reference to a on the network, +returned by [`network:get(name)`](network.md#get). It pulls one of a chosen +item from [Network Storage](../nodeworks-mechanics/network-storage.md) and +places it as a block at the placer's facing position. + + + +`:place(...)` is synchronous, it returns `true` / `false` in the same tick the +script called it. No multi-tick progress, no builder, no callback. Only items +that are `BlockItem`s (have a placeable block form) succeed, the call fails +fast on tools, food, or anything non-placeable. + +## Properties + +- **`.name`** + - the placer's alias (same label shown in the terminal sidebar) + +## place + +Pulls one of the chosen item from network storage and places it at the +placer's facing position. Returns `true` on success. + +The argument can be either an item id string or an [ItemsHandle](./items-handle.md). +With a handle, the placer reads `.id` and pulls one of *that* item from the +network pool the same way it would for the bare-string form. The handle's own +source isn't drained, the network's storage cards are. + + +```lua +local placer = network:get("placer_1") +placer:place("minecraft:cobblestone") +``` + + +Returns `false` (and places nothing) when: +- the network has no matching item available +- the target position is non-air +- the item isn't a placeable block (e.g. `minecraft:diamond`, `minecraft:stick`) + + +```lua +local placer = network:get("bridge_builder") +local ok = placer:place("minecraft:oak_planks") +if not ok then + print("nothing placed, no planks in storage or target blocked") +end +``` + + +## block + +Returns the block id at the placer's facing position, the same shape as +[`ObserverCard:block`](./card-handle.md#observer-card). Useful for "is the +slot still empty / is it the block I expect" checks before calling `:place`. + + +```lua +local placer = network:get("placer_1") +if placer:block() == "minecraft:air" then + placer:place("minecraft:torch") +end +``` + + +## isBlocked + +Returns `true` if the target position can't be replaced (non-air and not a +replaceable block like grass or snow), `false` if a place would land. Cheaper +than calling `:place` and checking the return value when you only want to +know whether the slot is free. + + +```lua +local placer = network:get("placer_1") +if not placer:isBlocked() then + placer:place("minecraft:cobblestone") +end +``` + diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/lua-api/presets.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/lua-api/presets.md new file mode 100644 index 000000000000..b33b7d19556f --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/lua-api/presets.md @@ -0,0 +1,114 @@ +--- +navigation: + parent: lua-api/index.md + title: Presets + icon: terminal +categories: + - api_builtin +description: declarative builders (importer, stocker) for common item movement and stocking patterns +--- + +# Presets + +Presets are declarative builders for the two scripting patterns that show up most +often: **moving items from A to B** and **keeping a stock level topped up**. Each +preset is a chain of method calls that reads left to right like a sentence, and +ends in `:start()` to start it. + +Presets sit on top of the existing scripting API. They're still Lua, still use +cards and filters the same way, and they're still torn down when the script +stops. The difference is one line of preset replaces roughly 15 lines of a +scheduler loop with manual state tracking. + + +```lua +-- move cobblestone from a farm chest into Network Storage, once per second. +importer:from("mobFarm"):filter("$item:cobblestone"):to(network):start() +-- keep 64 arrows stocked in a dispenser, crafting more when short. +stocker:ensure("minecraft:arrow"):to("dispenser"):keep(64):start() +``` + + +## Current Presets + +* [Importer](importer.md) moves items from one or more sources to one or more + targets. Default is fill (exhaust each target before moving on). Call + `:roundrobin()` to cycle through targets instead. +* [Stocker](stocker.md) maintains a target's stock at a `:keep(n)` watermark by + pulling from storage, crafting, or both. Never extracts once the level is + reached. + +## Source and target references + +Everywhere a preset takes a source or target, it accepts three shapes: + +1. A **string** card alias: `"bufferChest"`. +2. A **CardHandle** from `network:get(...)`. +3. The **`network`** global itself, meaning "the whole Network Storage pool." + + +```lua +-- All three forms are valid and can be mixed. +importer:from("farm", network:get("secondary"), network) + :to("output") + :start() +``` + + +Card resolution happens by name every time the network topology changes, so a +card that gets broken and replaced under the same name keeps working without +restarting the preset. Missing cards are skipped silently until they return. + +## Shared methods + +Every `ImporterBuilder` and `StockerBuilder` understands the same lifecycle and +control methods. + +### every + + +```lua +ImporterBuilder:every(ticks: number): ImporterBuilder +StockerBuilder:every(ticks: number): StockerBuilder +``` + + +Sets how often the preset re-evaluates. Default is 20 ticks (once per second). +Changing the rate mid-run cancels the current scheduler task and re-registers +at the new interval, so `imp:every(5)` takes effect immediately. + +### start / stop / isRunning + + +```lua +ImporterBuilder:start() +ImporterBuilder:stop() +ImporterBuilder:isRunning(): boolean +``` + + +`:start()` validates the chain and begins ticking. It's a no op if the builder +is already running, so calling it repeatedly is safe. `:stop()` stops ticking +but keeps all configuration, so a later `:start()` resumes the same chain +including any round robin cursor position. + + +```lua +local imp = importer:from("src"):to("dst") +scheduler:second(function() + if someCondition() and not imp:isRunning() then + imp:start() + elseif imp:isRunning() and not someCondition() then + imp:stop() + end +end) +``` + + +## Cleanup on script stop + +When the Scripting Terminal stops (manually or from a network disconnect), +every preset registered during that script's lifetime is stopped automatically. +Dangling builders that were created but never `:start()` are also cleaned up. +Starting the script again rebuilds every preset from scratch, so you can +freely edit chain code between runs without worrying about leftover tasks. diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/lua-api/scheduler.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/lua-api/scheduler.md new file mode 100644 index 000000000000..7bb91fc215d2 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/lua-api/scheduler.md @@ -0,0 +1,72 @@ +--- +navigation: + parent: lua-api/index.md + title: Scheduler + icon: minecraft:repeater +categories: + - api_builtin +description: tick/second/delay callbacks +--- + +# Scheduler + +The `scheduler` module registers periodic and delayed callbacks that run on +the server tick (20 TPS). Every registration returns a task id you can pass +to `:cancel` to stop it. + +> **Tip:** It's also recommended to turn on the ["Autorun"](../items-blocks/scripting_terminal.md#autorun) of the if you want this to always run [`scheduler:tick`](scheduler.md#tick) or [`scheduler:second`](scheduler.md#second) + +![](../assets/images/autorun.png) + +## tick + +Runs a provided callback every server tick + + +```lua +scheduler:tick(function() + -- runs 20 times/second +end) +``` + + +## second + +Runs a provided callback every second (20 ticks) + + +```lua +scheduler:second(function() + -- runs once per second +end) +``` + + +## delay + +Delays a callback function by the provided number of ticks. + + +```lua +scheduler:delay(20, function() + -- runs after one second has passed +end) +``` + + +## cancel + +Stops a given task's ID. This is safe to call on already-cancelled or expired IDs. + + +```lua +local task = scheduler:tick(function() + print("hello") +end) +-- cancel the scheduler:tick task after one second +scheduler:delay(20, function() + scheduler:cancel(task) +end) +-- "hello" (x20) +``` + diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/lua-api/stocker.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/lua-api/stocker.md new file mode 100644 index 000000000000..8fdeb3aff6e4 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/lua-api/stocker.md @@ -0,0 +1,181 @@ +--- +navigation: + parent: lua-api/index.md + title: Stocker + icon: minecraft:observer +categories: + - api_types + - api_preset +description: keep a target topped up by pulling, crafting, or both +--- + +# Stocker + +The `stocker` global builds level maintainers. You set a target container, a +`:keep(n)` watermark, and a source (pull, craft, or both), and the stocker +tops the target up whenever it dips below the watermark. It never extracts +once the watermark is reached, if the player dumps extras in, they stay. + +## Three source modes + +A stocker chain starts with one of three factory methods, depending on where +you want items to come from. + +### from + + +```lua +Stocker:from(...sources: string | CardHandle | network): StockerBuilder +``` + + +Pull from specific cards or the network pool. Never crafts if short. Good for +"pull from this specific buffer chest" or "pull from the pool, wait if empty." +Pair with [`:filter`](./stocker.md#filter) to match only a specific item type, without a +filter the stocker tops up the target to `:keep(n)` worth of any items. + + +```lua +-- Pull arrows from two specific chests +stocker:from("chest1", "chest2"):filter("$item:arrow"):to("dispenser"):keep(64):start() + +-- Pull from the network pool, wait if the pool runs dry +stocker:from(network):filter("$item:arrow"):to("dispenser"):keep(64):start() +``` + + +### ensure + + +```lua +Stocker:ensure(itemId: string): StockerBuilder +``` + + +Pull from the network pool first, craft the rest if the pool is short. The +most common form, covers the "always have N of this" pattern. Takes an exact +item id because crafting needs a concrete output to plan against. + + +```lua +stocker:ensure("minecraft:arrow"):to("dispenser"):keep(64):start() +stocker:ensure("minecraft:iron_ingot"):to(network):keep(256):start() +``` + + +### craft + + +```lua +Stocker:craft(itemId: string): StockerBuilder +``` + + +Always craft to maintain the level. Never pulls from existing storage. Useful +when you want to guarantee fresh output or when an ingredient is scarce and +you'd rather top up by crafting than by pulling from a shared chest. + + +```lua +stocker:craft("minecraft:bread"):to("foodChest"):keep(16):start() +``` + + +## Required methods + +### to + + +```lua +StockerBuilder:to(target: string | CardHandle | network): StockerBuilder +``` + + +Sets the destination. Accepts a card alias, CardHandle object, or `network` +for "keep the level in the pool itself." The stocker counts matching items in +the target, when you use `network`, it counts across every storage card. + +### keep + + +```lua +StockerBuilder:keep(amount: number): StockerBuilder +``` + + +Target stock level. The stocker tops up to this count and stops. If the +current count ever exceeds this (player dumped extras in, another script +inserted, etc.), the stocker does nothing. It only ever fills, never drains. + +## Optional methods + +### filter + + +```lua +StockerBuilder:filter(pattern: string): StockerBuilder +``` + + +Narrows what the stocker counts toward `:keep(n)` in the target. Defaults to +`*` (any item). Set it when you want the stocker to only care about a specific +type of item pulled from a heterogeneous source. **`:ensure` and `:craft` set +this automatically** to their item id, so you only need `:filter` with +`:from`. + + +```lua +stocker:from("buffer") + :filter("$item:arrow") + :to("dispenser") + :keep(64) + :start() +``` + + +### batch + + +```lua +StockerBuilder:batch(size: number): StockerBuilder +``` + + +Coalesces craft requests into this batch size. Default 0 means "craft exactly +what's missing" (so a shortfall of 3 crafts 3, even if the recipe is cheap). +Setting `:batch(64)` makes the stocker craft 64 at a time, which is useful +for recipes with large setup cost (multi-input, multi-step) where many tiny +crafts would thrash the CPU. + + +```lua +stocker:craft("minecraft:iron_ingot"):to("chest"):keep(64):batch(32):start() +-- Shortfall of 10 crafts a full 32, target may temporarily hold 74 after delivery. +``` + + +The target can temporarily exceed `:keep(n)` by the batch leftover, subsequent +ticks do nothing until the stock drops below the watermark again. + +## Example: arrow dispenser with fallback crafting + + +```lua +stocker:ensure("minecraft:arrow") + :to("trapDispenser") + :keep(64) + :batch(16) + :every(20) + :start() +``` + + +Every second: if the dispenser has fewer than 64 arrows, pull from the pool +first, if still short, craft 16 more. Repeats until the dispenser is full. + +## See also + +* [Shared preset methods](presets.md#shared-methods) (`:every`, `:start`, + `:stop`, `:isRunning`). +* [Importer](importer.md) for continuous A-to-B movement without a level goal. +* [Network:craft](network.md#craft) for the underlying craft primitive. diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/lua-api/user-handle.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/lua-api/user-handle.md new file mode 100644 index 000000000000..61476e6f7536 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/lua-api/user-handle.md @@ -0,0 +1,143 @@ +--- +navigation: + parent: lua-api/index.md + title: UserHandle + icon: user +categories: + - api_types +description: a device that right-clicks with an item in front of it +--- + +# UserHandle + +A `UserHandle` is a reference to a on the network, +returned by [`network:get(name)`](network.md#get). It pulls one item from +[Network Storage](../nodeworks-mechanics/network-storage.md) and +right-clicks with it on whatever's in front of the block. + + + +The User has two modes. **Instant** fires a single right-click per +`:use()` call. **Hold** keeps the right-click held down across multiple +ticks until `:stop()` runs (or the held item finishes its action, or the +30-second timeout elapses). Filters use the same syntax as + rules. + +## Properties + +- **`.name`** + - the user's alias (same label shown in the terminal sidebar) +- **`.kind`** + - always `"user"` + +## use + +Fires the User. In **instant** mode it right-clicks once and returns +whether the action landed. In **hold** mode it starts a hold and returns +whether the hold entered the held state. + +Returns `false` (without firing) when the User is already using, on +cooldown, blocked by its filter, has nothing matching in storage, or +has no controller on the network. + + +```lua +local farmer = network:get("crop_farmer") +farmer:use() +``` + + +To restart a hold cleanly, call `:stop()` first. + +## stop + +Cancels a pending instant fire or releases an in-progress hold. Safe to +call when idle, returns `false` without erroring. The retract animation +that returns the reserved item to network storage is non-cancellable. + + +```lua +local user = network:get("user_1") +local watcher = network:get("observ_1") +user:setMode("hold") +user:use() -- start using a brush on a sus block +-- when the block changes to normal sand or gravel, stop the user +watcher:onChange(function(block: BlockId, state: any) + if block == "minecraft:gravel" or block == "minecraft:sand" then + user:stop() + end +end) +``` + + +## isUsing + +Returns `true` while a hold is active, `false` otherwise. + + +```lua +local user = network:get("user_1") +if not user:isUsing() then + user:use() +end +``` + + +## mode + +Returns the current mode as a string, either `"instant"` or `"hold"`. + + +```lua +local user = network:get("user_1") +print(user:mode()) -- "instant" +``` + + +## setMode + +Sets the User's mode. Accepts `"instant"` or `"hold"` (case-insensitive). + + +```lua +local user = network:get("crop_farmer") +user:setMode("hold") +``` + + +## filter + +Returns the current filter rule as a string, empty when nothing is set. + + +```lua +local user = network:get("user_1") +print(user:filter()) -- "minecraft:bone_meal" +``` + + +## setFilter + +Sets the User's filter rule. Uses the same syntax as + filters, so bare item ids, +`#namespace:tag`, `minecraft:*`, `/regex/`, and the `$item:` / `$fluid:` +prefixes all work. + + +```lua +local user = network:get("crop_farmer") +user:setFilter("minecraft:bone_meal") +``` + + +## facing + +Returns the direction the User is facing as a lowercase string +(`"north"`, `"south"`, `"east"`, `"west"`, `"up"`, `"down"`). + + +```lua +local user = network:get("user_1") +print(user:facing()) -- "north" +``` + diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/lua-api/variable-handle.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/lua-api/variable-handle.md new file mode 100644 index 000000000000..3f631b8bec5c --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/lua-api/variable-handle.md @@ -0,0 +1,219 @@ +--- +navigation: + parent: lua-api/index.md + title: VariableHandle + icon: variable +categories: + - api_types +description: reference to a in a network +--- + +# VariableHandle + +A `VariableHandle` is a reference to a in the +network, returned by [`network:get(name)`](network.md#get) (the same accessor +used for cards). The handle tracks the variable's declared type. Each type of +variable gains specific helpers on top of the shared core API below. + + + +> **Note:** All mutations are atomic. A second script calling `:set` or `:cas` +> on the same variable can never interleave mid-operation. + +## Properties + +- **`.name`** + - the variable's alias (same label shown in the terminal sidebar) + +## Core methods + +### get / set + +Retrieves and sets the variable's current value + + +```lua +local myNumericVar = network:get("myNumericVar") +print(myNumericVar:get()) +myNumericVar:set(1) +print(myNumericVar:get()) +-- "0" +-- "1" +``` + + +### cas + +Compare-and-swap. Sets the variable to `new` only if its current value equals +`expected`. Otherwise the current value is left untouched. Returns `true` if +the swap succeeded, `false` if something else had already changed the value. + +Use this whenever the new value you want to write **depends on the current value** +and more than one script might touch the variable. `:set` will happily overwrite +whatever is there, so two scripts racing each other can stomp each other's work. +`:cas` refuses to write unless the variable still looks like the value you think it is. + + +```lua +-- claim a job slot: only the first script that reads "" wins +if slot:cas("", "worker_A") then + print("i got the job") +else + print("someone else already claimed it") +end +``` + + +A typical read-modify-write loop when the value might change mid-flight: + + +```lua +-- decrement only while > 0, retrying on contention +while true do + local current = counter:get() + if current <= 0 then + break -- nothing left to take + end + if counter:cas(current, current - 1) then + break -- we got it + end + -- another script moved the value between :get and :cas, try again +end +``` + + +> **Note:** For straightforward arithmetic, [`increment / decrement`](variable-handle.md#increment--decrement) are already +> atomic and simpler. Use `:cas` when the transition isn't just "+/-" n + +### type + +Returns a string that represents the "type" of this `VariableHandle` + +- **`NumberVariableHandle`** + - `"number"` +- **`BoolVariableHandle`** + - `"bool"` +- **`StringVariableHandle`** + - `"string"` + + +```lua +local numberVar = network:get("numberVar") +local boolVar = network:get("boolVar") +local stringVar = network:get("stringVar") +print(numberVar:type()) +print(boolVar:type()) +print(stringVar:type()) +-- "number" +-- "bool" +-- "string" +``` + + +## BoolVariableHandle + +A [`VariableHandle`](./variable-handle.md) pointing at a declared +with the type `bool`. Adds methods that only work on bool variables. + +### toggle + +Flips the current value. (`true` becomes `false`, `false` becomes `true`) and +returns the new value. + + +```lua +local lights = network:get("lights") +print(lights:get()) +lights:toggle() +print(lights:get()) +-- "false" +-- "true" +``` + + +> **Note:** Useful as a "press to toggle" action wired to a redstone button via +> [`RedstoneCard:onChange`](./card-handle.md#onchange) + +### tryLock / unlock + +A bool variable doubles as a mutual-exclusion lock. `:tryLock()` atomically flips +the variable from `false` to `true` and returns `true` on success. If the bool variable +was already `true` (another script holds it), it returns `false` **without blocking**. +`:unlock()` flips it back to `false`. + + +```lua +local mutex = network:get("job_mutex") -- bool variable +if mutex:tryLock() then + -- do job + mutex:unlock() +end +``` + + +> **Important:** `:tryLock` doesn't wait if the lock is held. It'll return `false` immediately instead. Design your script to either retry later ([`scheduler:delay`](scheduler.md#delay)) or skip the work if it can't claim the lock. +> +> Always pair a successful `:tryLock` with `:unlock`. Wrap the critical section in `pcall` as above so the lock doesn't get stuck if your code errors out. + +## NumberVariableHandle + +A [`VariableHandle`](./variable-handle.md) pointing at a declared +with the type `number`. Adds methods that only work on number variables. + +### increment / decrement + +Adds or subtracts from the variable's current value. Both take an amount and returns +the new value. + + +```lua +local counter = network:get("counter") +counter:set(0) +counter:increment(1) -- +1 -> 1 +counter:increment(5) -- +5 -> 6 +counter:decrement(2) -- -2 -> 4 +``` + + +### min / max + +- `:min(n)` sets the variable to whichever is smaller: the current value or `n`. +- `:max(n)` sets it to whichever is larger. + +Both return the new value. + + +```lua +local best = network:get("best_score") +best:set(42) +best:max(50) -- 42 vs 50 -> 50 (new high) +best:max(35) -- 50 vs 35 -> 50 (unchanged) +best:min(10) -- 50 vs 10 -> 10 (capped) +``` + + +## StringVariableHandle + +A [`VariableHandle`](./variable-handle.md) pointing at a declared +with the type `string`. Adds methods that only work on string variables. + +### append / length / clear + +- `:append(str)` adds `str` to the end of the current value and returns the new +string. +- `:length()` returns how many characters are in the current value. +- `:clear()` empties the variable (sets it to `""`). + + +```lua +local log = network:get("log") +log:clear() +log:append("start ") +log:append("middle ") +log:append("end") +print(log:get()) +print(log:length()) +-- "start middle end" +-- 16 +``` + \ No newline at end of file diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/nodeworks-mechanics/autocrafting.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/nodeworks-mechanics/autocrafting.md new file mode 100644 index 000000000000..28f2c642f1f2 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/nodeworks-mechanics/autocrafting.md @@ -0,0 +1,160 @@ +--- +navigation: + parent: nodeworks-mechanics/index.md + title: Auto-Crafting + icon: crafting_core +categories: + - mechanic +--- + +# Auto-Crafting + +Auto-Crafting is what turns "I'd like 64 iron pickaxes" into 64 actual iron pickaxes. +You tell the network what recipes exist, the network stocks the ingredients, and +a does the work. + + + + + + +## Getting it working + +You need four things, all on the same network: + +1. **A CPU.** Drop a , stick at least one + on it, and wire the Core to a + . See [Crafting CPU](../items-blocks/crafting_cpu.md) + for extras like more buffers, coolant, and substrate. +2. **Recipes.** Author each recipe into an + (vanilla 3×3 crafting) or a + (anything else), then drop them into an + or + and wire that to the network. +3. **Ingredients.** The raw materials have to be somewhere in [Network Storage](./network-storage.md). Any chest plugged in with a counts. +4. **A way to ask.** Either an for you + to click on, or a script running on a that + calls `network:craft(...)`. + +Once all four are in place, items the network can make show up in the Inventory Terminal (can be shown through filters or by holding Left-Alt to show plus icons), and `network:craft("...")` returns a +builder instead of nil. + +## Requesting a craft + +### From the Inventory Terminal + +Open the terminal, find the item, and `Alt+click` it. Enter a quantity and confirm. +The **Craft Queue** at the top of the terminal shows all queued items. When the craft +finishes, the item will show with a small indicator and you can grab it. Next time +you open the terminal it'll show with the rest of the items instead. + +Holding `Alt` highlights every auto-craftable item in the network knows how to make, +even ones with zero in stock. + +### From a script + +A script can queue a craft with `network:craft` and decide where the result goes: + + +```lua +-- the result auto-stores into Network Storage when it's ready +network:craft("minecraft:door") +``` + + +Or chain `:connect(fn)` to run custom code the moment the craft completes + + +```lua +local furnace = network:get("someFurnaceCard") +network:craft("minecraft:charcoal"):connect(function(item: ItemsHandle?) + if item then + furnace:insert(item) + end +end) +``` + + +See [network:craft](../lua-api/network.md#craft) and [CraftBuilder](../lua-api/craft-builder.md) for the full API. + +## Cancelling a craft + +Right-click the to open its GUI. The **"Cancel"** +button shows up whenever there's a craft running. Clicking it aborts the craft, +returns everything in the buffer to Network Storage, and frees the CPU. + +## Processing Sets need a handler + + recipes just work. Vanilla 3x3 crafting is +self-contained, so the CPU knows exactly how to execute them. + + recipes don't. A Processing Set *declares* a +recipe ("8 raw iron becomes 8 raw iron ingots") but doesn't know **how** that +transformation actually happens. Somebody has to put the raw iron into a furnace +and pull the ingots back out, and that somebody is called a **handler**. + +You have two ways to register one: + +### With a Processing Handler block + + + + + + Blue channel Storage Card pointing at the top of the furnace + + + Red channel Storage Card pointing at the bottom of the furnace + + + +Drop a on the network and bind it to the +recipe in its GUI. Wire its back to the parent network, then run a small +subnet of pipes off its front to whatever machine carries out the recipe. +The CPU drives the machine for you, no scripting required. This is the +right pick for almost any "stuff in one side, stuff out the other" +machine. + +### With a scripted handler + +For recipes that need custom timing, conditional routing, or multi-step +flows you can write a Lua handler on a : + + +```lua +local furnace = network:get("someFurnaceCard") +network:handle("...", function(job: Job, inputs: InputItems) + -- put raw iron into the top face of the furnace (like a hopper on top of the furnace) + furnace:face("top"):insert(inputs.rawIron) + -- wait for the output to appear by pulling from the bottom of the furnace (like a hopper again) + job:pull(furnace:face("bottom")) +end) +``` + + +If you try to autocraft something that needs a Processing Set and no handler is registered, +the craft fails with a message telling you which recipe is missing a handler. + +See [network:handle](../lua-api/network.md#handle), [Job](../lua-api/job.md), and +[InputItems](../lua-api/input-items.md) for the full pattern. + +## When something goes wrong + +If a craft fails, the starts emitting red +redstone dust particles in a pulsing cloud around the block. It keeps +pulsing until you either open the Core's GUI and dismiss the error or +start a new craft that succeeds. Scan for the red dust first when +something's off, the Core itself is the fastest way to find which CPU +is complaining. + +![](../assets/images/crafting_cpu_erroring.png) + +The concrete messages the CPU reports: + +| Message | What it means | +| -------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Crafting CPU at (x, y, z) is not formed | The Core has no touching it, or the Core isn't wired to the network. | +| Missing ingredients: N× item, ... No recipe available and not enough in storage. | The network has no way to source those items, and no recipe produces them either. Stock them in a networked chest or write a recipe. | +| No handler registered for: X. Add a `network:handle("recipe", ...)` call in a connected Terminal's script. | X is a Processing Set recipe with no Lua handler to drive it. See [Processing Sets need a handler](./autocrafting.md#processing-sets-need-a-handler) above. | +| Craft needs N unique item types, CPU only holds M. Add more Buffer blocks or upgrade tiers. | Your CPU's count can't hold enough distinct item types for this craft's intermediates. Add buffers. | +| Craft requires up to N items of one type in buffer, CPU only holds M. Upgrade Buffer tiers or add more blocks. | Same problem, different axis: one step of the craft would overflow a buffer's per type capacity. | diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/nodeworks-mechanics/cards.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/nodeworks-mechanics/cards.md new file mode 100644 index 000000000000..e9b1d2fa9dc2 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/nodeworks-mechanics/cards.md @@ -0,0 +1,17 @@ +--- +navigation: + parent: nodeworks-mechanics/index.md + title: Cards + icon: blank_card +categories: + - mechanic +--- + +# Cards + +A "Card" typically refers to a component placed into a +that the Network can interact with. + +Here are the cards: + + diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/nodeworks-mechanics/devices.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/nodeworks-mechanics/devices.md new file mode 100644 index 000000000000..c1cc8ef3ca6d --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/nodeworks-mechanics/devices.md @@ -0,0 +1,14 @@ +--- +navigation: + parent: nodeworks-mechanics/index.md + title: Devices + icon: variable +categories: + - mechanic +--- + +# Devices + +A "Device" refers to a connectable block to a network that can be scripted + + diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/nodeworks-mechanics/index.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/nodeworks-mechanics/index.md new file mode 100644 index 000000000000..d318dca198f2 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/nodeworks-mechanics/index.md @@ -0,0 +1,9 @@ +--- +navigation: + title: Nodeworks Mechanics + position: 30 +--- + +# Nodeworks Mechanics + + \ No newline at end of file diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/nodeworks-mechanics/network-storage.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/nodeworks-mechanics/network-storage.md new file mode 100644 index 000000000000..d8d5538d5308 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/nodeworks-mechanics/network-storage.md @@ -0,0 +1,76 @@ +--- +navigation: + parent: nodeworks-mechanics/index.md + title: Network Storage + icon: minecraft:chest +categories: + - mechanic +--- + +# Network Storage + +Network Storage is the shared pool of items and fluids a Nodeworks network +treats as its own. Any block with a installed +joins this pool. Scripts read from and write to it, the + displays and interacts with it, and the +crafting system pulls ingredients from it. + + + + + includes this chest into Network Storage + + + includes this chest into Network Storage + + + You can use the to view inside Network Storage + + + +## What's in the Network Storage pool + +Everything inside every block attached to a . If you break a +Storage Card's node connection, that block drops out of the pool immediately. + +### Not in the pool + +'s blocks are NOT part of Network Storage. +Scripts have to explicitly move items to/from an IO-carded block. The +network won't see its contents via `network:find`, and the or won't list them. + +## Priority and routing + +Each has a **priority** that controls the order +`network:insert` / `:tryInsert` fill storage. Writes land in the highest-priority +matching card first and spill into lower-priority cards as each one fills up. +Two cards with the same priority are filled in connection order. + +Scripts can override the default priority order for specific items by registering +a route with [`network:route`](../lua-api/network.md#route). + +Set a card's priority directly in its GUI. See +[Storage Card](../items-blocks/storage_card.md#configuring-priority) for the interface, and +the for copying priority (and every other +card setting) across a batch of cards at once. + +## Scripting with Network Storage + +See the [Network API](../lua-api/network.md) page for the full set of read/write +functions scripts use to interact with the pool. + +## Viewing and managing through the Inventory Terminal + + + + + + +The and are the primary +ways to see and interact with Network Storage without writing scripts. +It shows the full pool in a searchable grid, lets you extract items into your +inventory, insert items back into storage, and request crafts. Everything it +displays is pulled live from the Storage Cards connected to this network. + +See the [Inventory Terminal](../items-blocks/inventory_terminal.md) page for +the interface details. diff --git a/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/nodeworks-mechanics/subnets.md b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/nodeworks-mechanics/subnets.md new file mode 100644 index 000000000000..a983999811e3 --- /dev/null +++ b/projects/assets/nodeworks/26.1/nodeworks/nodeworksguide/nodeworks-mechanics/subnets.md @@ -0,0 +1,82 @@ +--- +navigation: + parent: nodeworks-mechanics/index.md + title: Subnets + icon: broadcast_antenna +categories: + - networking + - mechanic +--- + +# Subnets + +A subnet is just a second network that exposes some of its capabilities +to another network wirelessly. Each subnet has its own +, its own storage, and its own +crafting setup. They communicate with the main network through paired +s and +s. + + + + + +## Why split a network + +A monolithic network works fine for small bases, but as you add more +machines and recipes, splitting things up becomes a useful organizing +tool: + +- **Specialization**. A subnet dedicated to smelting, brewing, or ore + processing keeps the recipes and machines for that job in one place + instead of scattered across the main base. +- **Reuse**. Build a smeltery subnet once, then pair its recipes with + every base you have. +- **Isolation**. A crash, lag spike, or stuck craft on one subnet + doesn't affect the rest. Each network runs its own CPU, storage, and + scripts. +- **Tidiness**. The main network only sees the recipes the subnet + broadcasts, not the pipes and machines behind them. + +## Exposing processing recipes + +The most common subnet setup: a subnet that owns a cluster of + blocks full of + recipes, broadcasting them so any +other network can pull from those recipes during autocrafting. + +1. On the subnet, build out the + cluster with whatever + s the subnet should provide. +2. Place a directly on top of any + in the cluster. +3. Pair it with a from the antenna's GUI. +4. On the receiving network, place a + wired into the network and slot + the same into its GUI. + +The receiving network now sees every recipe in the subnet's Processing +Storage cluster as if they were stored locally. Crafts that need those +recipes work like any other autocraft. + +The subnet still owns the machines and ingredients. The receiving +network just gets to ask for the output and trust the subnet to deliver. + +## Wireless item transfer + +Subnets can also exchange items directly using broadcasting +s paired to +s on top of +s. See the export chest and receiver +antenna pages for the pairing flow. + +## Range + +Antennas have a default range of 128 blocks. Range upgrades extend that +across chunks and dimensions, so a subnet doesn't have to be next to +the network using it. Common patterns: + +- A smeltery subnet in the Nether feeding a main base in the Overworld. +- A mob farm subnet broadcasting drops to a sorting base elsewhere. +- A shared "library" subnet of generic recipes that every other base + on the server consumes.