From f8e8538b6e0793d6610ff73d2762fe156144e44f Mon Sep 17 00:00:00 2001 From: Evert Prants Date: Fri, 22 Jun 2018 14:51:27 +0300 Subject: [PATCH] Some file tree changes --- elepower_dynamics/crafting.lua | 1 + elepower_dynamics/worldgen.lua | 11 -- elepower_fapi/transfer.lua | 145 ++---------------- elepower_machines/bases/init.lua | 4 - .../{register.lua => crafting.lua} | 127 ++------------- elepower_machines/init.lua | 12 +- .../{special => machines}/accumulator.lua | 0 elepower_machines/machines/alloy_furnace.lua | 22 +++ .../{ => machines}/bases/crafter.lua | 0 .../{ => machines}/bases/generator.lua | 0 elepower_machines/machines/bases/init.lua | 4 + .../{ => machines}/bases/storage.lua | 0 elepower_machines/machines/furnace.lua | 22 +++ elepower_machines/machines/generator.lua | 21 +++ elepower_machines/machines/init.lua | 9 ++ elepower_machines/machines/pulverizer.lua | 23 +++ elepower_machines/machines/sawmill.lua | 16 ++ elepower_machines/machines/storage.lua | 14 ++ elepower_machines/nodes.lua | 1 - elepower_machines/special/init.lua | 2 - .../textures/elepower_sawmill.png | Bin 6724 -> 7130 bytes elepower_papi/network.lua | 55 +++---- 22 files changed, 180 insertions(+), 309 deletions(-) delete mode 100644 elepower_machines/bases/init.lua rename elepower_machines/{register.lua => crafting.lua} (58%) rename elepower_machines/{special => machines}/accumulator.lua (100%) create mode 100644 elepower_machines/machines/alloy_furnace.lua rename elepower_machines/{ => machines}/bases/crafter.lua (100%) rename elepower_machines/{ => machines}/bases/generator.lua (100%) create mode 100644 elepower_machines/machines/bases/init.lua rename elepower_machines/{ => machines}/bases/storage.lua (100%) create mode 100644 elepower_machines/machines/furnace.lua create mode 100644 elepower_machines/machines/generator.lua create mode 100644 elepower_machines/machines/init.lua create mode 100644 elepower_machines/machines/pulverizer.lua create mode 100644 elepower_machines/machines/sawmill.lua create mode 100644 elepower_machines/machines/storage.lua delete mode 100644 elepower_machines/special/init.lua diff --git a/elepower_dynamics/crafting.lua b/elepower_dynamics/crafting.lua index 3e4699f..835424a 100644 --- a/elepower_dynamics/crafting.lua +++ b/elepower_dynamics/crafting.lua @@ -3,6 +3,7 @@ -- Overrides -- --------------- +-- Remove iron_lump -> steel_ingot, because dynamics adds iron ingot minetest.clear_craft({type = "cooking", output = "default:steel_ingot"}) ----------- diff --git a/elepower_dynamics/worldgen.lua b/elepower_dynamics/worldgen.lua index c4b23be..7e81e46 100644 --- a/elepower_dynamics/worldgen.lua +++ b/elepower_dynamics/worldgen.lua @@ -40,17 +40,6 @@ minetest.register_ore({ -- Nickel -minetest.register_ore({ - ore_type = "scatter", - ore = "elepower_dynamics:stone_with_nickel", - wherein = "default:stone", - clust_scarcity = 28 * 28 * 28, - clust_num_ores = 5, - clust_size = 3, - y_max = 31000, - y_min = -31000, -}) - minetest.register_ore({ ore_type = "scatter", ore = "elepower_dynamics:stone_with_nickel", diff --git a/elepower_fapi/transfer.lua b/elepower_fapi/transfer.lua index ee6f8bf..a5bd1df 100644 --- a/elepower_fapi/transfer.lua +++ b/elepower_fapi/transfer.lua @@ -1,7 +1,5 @@ -- Network graphs are built eminating from provider nodes. - --- Network cache -elefluid.graphcache = {nodes = {}} +-- TODO: Caching --------------------- -- Graph Functions -- @@ -14,9 +12,6 @@ end local function add_node(nodes, pos, pnodeid) local node_id = minetest.hash_node_position(pos) - if elefluid.graphcache.nodes[node_id] == "" then - elefluid.graphcache.nodes[node_id] = pnodeid - end if nodes[node_id] then return false end @@ -40,8 +35,7 @@ local function check_node(targets, all_nodes, pos, p_pos, pnodeid, queue) return end - if not ele.helpers.get_item_group(node.name, "fluid_container") and - not ele.helpers.get_item_group(node.name, "fluidity_tank") then + if not ele.helpers.get_item_group(node.name, "fluid_container") then return end @@ -64,12 +58,7 @@ end local function fluid_targets(p_pos, pos) local provider = minetest.get_node(p_pos) local pnodeid = minetest.pos_to_string(p_pos) ---[[ - if elefluid.graphcache[pnodeid] then - local cached = elefluid.graphcache[pnodeid] - return cached.targets - end -]] + local targets = {} local queue = {} local all_nodes = {} @@ -77,8 +66,7 @@ local function fluid_targets(p_pos, pos) local node = minetest.get_node(pos) if node and ele.helpers.get_item_group(node.name, "elefluid_transport") then add_duct_node(all_nodes, pos, pnodeid, queue) - elseif node and (ele.helpers.get_item_group(node.name, "fluid_container") or - ele.helpers.get_item_group(node.name, "fluidity_tank")) then + elseif node and ele.helpers.get_item_group(node.name, "fluid_container") then queue = {p_pos} end @@ -90,14 +78,9 @@ local function fluid_targets(p_pos, pos) queue = to_visit end - local prov_id = minetest.hash_node_position(p_pos) - elefluid.graphcache.nodes[prov_id] = pnodeid - targets = ele.helpers.flatten(targets) all_nodes = ele.helpers.flatten(all_nodes) - elefluid.graphcache[pnodeid] = {all_nodes = all_nodes, targets = targets} - return targets end @@ -107,10 +90,10 @@ end minetest.register_abm({ nodenames = {"group:elefluid_transport_source"}, - label = "elefluidFluidGraphSource", - interval = 1, - chance = 1, - action = function(pos, node, active_object_count, active_object_count_wider) + label = "elepower Fluid Transfer Tick", + interval = 1, + chance = 1, + action = function(pos, node, active_object_count, active_object_count_wider) local meta = minetest.get_meta(pos) local meta1 = nil @@ -120,7 +103,6 @@ minetest.register_abm({ local tpos = vector.add(minetest.facedir_to_dir(node.param2), pos) local tname = minetest.get_node(tpos).name if not ele.helpers.get_item_group(tname, "elefluid_transport") and - not ele.helpers.get_item_group(tname, "fluidity_tank") and not ele.helpers.get_item_group(tname, "fluid_container") then minetest.forceload_free_block(pos) return @@ -145,8 +127,7 @@ minetest.register_abm({ end -- Make sure source node is a registered fluid container - if not ele.helpers.get_item_group(srcnode.name, "fluid_container") and - not ele.helpers.get_item_group(srcnode.name, "fluidity_tank") then + if not ele.helpers.get_item_group(srcnode.name, "fluid_container") then return end @@ -201,113 +182,7 @@ minetest.register_abm({ end, }) -local function check_connections(pos) - local connections = {} - local positions = { - {x=pos.x+1, y=pos.y, z=pos.z}, - {x=pos.x-1, y=pos.y, z=pos.z}, - {x=pos.x, y=pos.y+1, z=pos.z}, - {x=pos.x, y=pos.y-1, z=pos.z}, - {x=pos.x, y=pos.y, z=pos.z+1}, - {x=pos.x, y=pos.y, z=pos.z-1}} - - for _,connected_pos in pairs(positions) do - local name = minetest.get_node(connected_pos).name - if ele.helpers.get_item_group(name, "elefluid_transport") or - ele.helpers.get_item_group(name, "elefluid_transport_source") or - ele.helpers.get_item_group(name, "fluid_container") or - ele.helpers.get_item_group(name, "fluidity_tank") then - table.insert(connections, connected_pos) - end - end - return connections -end - function elefluid.clear_networks(pos) + -- TODO: Fluid network cache return end - ---[[ --- Update networks when a node has been placed or removed -function elefluid.clear_networks(pos) - local node = minetest.get_node(pos) - local meta = minetest.get_meta(pos) - local name = node.name - local placed = name ~= "air" - local positions = check_connections(pos) - if #positions < 1 then return end - local dead_end = #positions == 1 - for _,connected_pos in pairs(positions) do - local net = elefluid.graphcache.nodes[minetest.hash_node_position(connected_pos)] or minetest.pos_to_string(connected_pos) - if net and elefluid.graphcache[net] then - if dead_end and placed then - -- Dead end placed, add it to the network - -- Get the network - local node_at = minetest.get_node(positions[1]) - local network_id = elefluid.graphcache.nodes[minetest.hash_node_position(positions[1])] or minetest.pos_to_string(positions[1]) - - if not network_id or not elefluid.graphcache[network_id] then - -- We're evidently not on a network, nothing to add ourselves to - return - end - local c_pos = minetest.string_to_pos(network_id) - local network = elefluid.graphcache[network_id] - - -- Actually add it to the (cached) network - -- This is similar to check_node_subp - elefluid.graphcache.nodes[minetest.hash_node_position(pos)] = network_id - pos.visited = 1 - - if ele.helpers.get_item_group(name, "elefluid_transport") then - table.insert(network.all_nodes, pos) - end - - if ele.helpers.get_item_group(name, "fluid_container") or - ele.helpers.get_item_group(name, "fluidity_tank") then - table.insert(network.targets, pos) - end - elseif dead_end and not placed then - -- Dead end removed, remove it from the network - -- Get the network - local network_id = elefluid.graphcache.nodes[minetest.hash_node_position(positions[1])] or minetest.pos_to_string(positions[1]) - if not network_id or not elefluid.graphcache[network_id] then - -- We're evidently not on a network, nothing to remove ourselves from - return - end - local network = elefluid.graphcache[network_id] - - -- The network was deleted. - if network_id == minetest.pos_to_string(pos) then - for _,v in ipairs(network.all_nodes) do - local pos1 = minetest.hash_node_position(v) - clear_networks_from_node(v) - elefluid.graphcache.nodes[pos1] = nil - end - elefluid.graphcache[network_id] = nil - return - end - - -- Search for and remove device - elefluid.graphcache.nodes[minetest.hash_node_position(pos)] = nil - for tblname,table in pairs(network) do - if type(table) == "table" then - for devicenum,device in pairs(table) do - if vector.equals(device, pos) then - table[devicenum] = nil - end - end - end - end - else - -- Not a dead end, so the whole network needs to be recalculated - for _,v in ipairs(elefluid.graphcache[net].all_nodes) do - local pos1 = minetest.hash_node_position(v) - clear_networks_from_node(v) - elefluid.graphcache.nodes[pos1] = nil - end - elefluid.graphcache[net] = nil - end - end - end -end -]] diff --git a/elepower_machines/bases/init.lua b/elepower_machines/bases/init.lua deleted file mode 100644 index b2dd317..0000000 --- a/elepower_machines/bases/init.lua +++ /dev/null @@ -1,4 +0,0 @@ - -dofile(elepm.modpath.."/bases/crafter.lua") -dofile(elepm.modpath.."/bases/generator.lua") -dofile(elepm.modpath.."/bases/storage.lua") diff --git a/elepower_machines/register.lua b/elepower_machines/crafting.lua similarity index 58% rename from elepower_machines/register.lua rename to elepower_machines/crafting.lua index 3c262cc..f34584b 100644 --- a/elepower_machines/register.lua +++ b/elepower_machines/crafting.lua @@ -1,13 +1,12 @@ +--*****************-- +-- MACHINE RECIPES -- +--*****************-- + -------------- -- Alloying -- -------------- -elepm.register_craft_type("alloy", { - description = "Alloying", - inputs = 2, -}) - local alloy_recipes = { { recipe = { "elepower_dynamics:iron_ingot", "elepower_dynamics:coal_dust 4" }, @@ -21,6 +20,10 @@ local alloy_recipes = { { recipe = { "default:iron_ingot 3", "elepower_dynamics:nickel_ingot" }, output = "elepower_dynamics:invar_ingot 4", + }, + { + recipe = { "default:gold_ingot 2", "elepower_dynamics:invar_ingot" }, + output = "elepower_dynamics:electrum_ingot 3", } } @@ -34,32 +37,10 @@ for _,i in pairs(alloy_recipes) do }) end -elepm.register_crafter("elepower_machines:alloy_furnace", { - description = "Alloy Furnace", - craft_type = "alloy", - ele_active_node = true, - tiles = { - "elepower_machine_top.png", "elepower_machine_base.png", "elepower_machine_side.png", - "elepower_machine_side.png", "elepower_machine_side.png", "elepower_alloy_furnace.png", - }, - ele_active_nodedef = { - tiles = { - "elepower_machine_top.png", "elepower_machine_base.png", "elepower_machine_side.png", - "elepower_machine_side.png", "elepower_machine_side.png", "elepower_alloy_furnace_active.png", - }, - }, - groups = {oddly_breakable_by_hand = 1} -}) - -------------- -- Grinding -- -------------- -elepm.register_craft_type("grind", { - description = "Grinding", - inputs = 1, -}) - local keywords = { _ingot = 1, _lump = 2, _block = 9, block = 9 } for mat, data in pairs(elepd.registered_dusts) do local kwfound = nil @@ -90,55 +71,10 @@ for mat, data in pairs(elepd.registered_dusts) do end end -elepm.register_crafter("elepower_machines:pulverizer", { - description = "Pulverizer", - craft_type = "grind", - ele_active_node = true, - ele_usage = 32, - tiles = { - "elepower_machine_top.png", "elepower_machine_base.png", "elepower_machine_side.png", - "elepower_machine_side.png", "elepower_machine_side.png", "elepower_grinder.png", - }, - ele_active_nodedef = { - tiles = { - "elepower_machine_top.png", "elepower_machine_base.png", "elepower_machine_side.png", - "elepower_machine_side.png", "elepower_machine_side.png", "elepower_grinder_active.png", - }, - }, - groups = {oddly_breakable_by_hand = 1} -}) - -------------- --- Furnace -- -------------- - -elepm.register_crafter("elepower_machines:furnace", { - description = "Powered Furnace", - craft_type = "cooking", - ele_active_node = true, - ele_usage = 32, - tiles = { - "elepower_machine_top.png", "elepower_machine_base.png", "elepower_machine_side.png", - "elepower_machine_side.png", "elepower_machine_side.png", "elepower_furnace.png", - }, - ele_active_nodedef = { - tiles = { - "elepower_machine_top.png", "elepower_machine_base.png", "elepower_machine_side.png", - "elepower_machine_side.png", "elepower_machine_side.png", "elepower_furnace_active.png", - }, - }, - groups = {oddly_breakable_by_hand = 1} -}) - ------------- -- Sawmill -- ------------- -elepm.register_craft_type("saw", { - description = "Sawmilling", - inputs = 1, -}) - -- Register all logs as sawable, if we can find a planks version minetest.after(0.2, function () local wood_nodes = {} @@ -171,56 +107,11 @@ minetest.after(0.2, function () end end) -elepm.register_crafter("elepower_machines:sawmill", { - description = "Sawmill", - craft_type = "saw", - ele_usage = 32, - tiles = { - "elepower_machine_top.png", "elepower_machine_base.png", "elepower_machine_side.png", - "elepower_machine_side.png", "elepower_machine_side.png", "elepower_sawmill.png", - }, - groups = {oddly_breakable_by_hand = 1} -}) - ----------------------- --- Power Generation -- ----------------------- - -elepm.register_fuel_generator("elepower_machines:generator", { - description = "Coal-fired Generator", - ele_active_node = true, - ele_capacity = 6400, - tiles = { - "elepower_machine_top.png", "elepower_machine_base.png", "elepower_machine_side.png", - "elepower_machine_side.png", "elepower_machine_side.png", "elepower_generator.png", - }, - ele_active_nodedef = { - tiles = { - "elepower_machine_top.png", "elepower_machine_base.png", "elepower_machine_side.png", - "elepower_machine_side.png", "elepower_machine_side.png", "elepower_generator_active.png", - } - }, - groups = {oddly_breakable_by_hand = 1} -}) - -------------------- --- Power Storage -- -------------------- - -elepm.register_storage("elepower_machines:power_cell", { - description = "Power Cell", - ele_capacity = 16000, - tiles = { - "elepower_machine_top.png", "elepower_machine_base.png", "elepower_machine_side.png", - "elepower_machine_side.png", "elepower_machine_side.png", "elepower_power_cell.png", - }, - groups = {oddly_breakable_by_hand = 1} -}) - --******************-- -- CRAFTING RECIPES -- --******************-- +-- Machine block minetest.register_craft({ output = "elepower_machines:machine_block", recipe = { diff --git a/elepower_machines/init.lua b/elepower_machines/init.lua index 88a9f46..8bb03c9 100644 --- a/elepower_machines/init.lua +++ b/elepower_machines/init.lua @@ -6,9 +6,15 @@ local modpath = minetest.get_modpath(minetest.get_current_modname()) elepm = rawget(_G, "elepm") or {} elepm.modpath = modpath +-- Utility dofile(modpath.."/craft.lua") dofile(modpath.."/formspec.lua") -dofile(modpath.."/bases/init.lua") + +-- Machines +dofile(modpath.."/machines/init.lua") + +-- Other dofile(modpath.."/nodes.lua") -dofile(modpath.."/special/init.lua") -dofile(modpath.."/register.lua") + +-- Crafting recipes +dofile(modpath.."/crafting.lua") diff --git a/elepower_machines/special/accumulator.lua b/elepower_machines/machines/accumulator.lua similarity index 100% rename from elepower_machines/special/accumulator.lua rename to elepower_machines/machines/accumulator.lua diff --git a/elepower_machines/machines/alloy_furnace.lua b/elepower_machines/machines/alloy_furnace.lua new file mode 100644 index 0000000..ed80b64 --- /dev/null +++ b/elepower_machines/machines/alloy_furnace.lua @@ -0,0 +1,22 @@ + +elepm.register_craft_type("alloy", { + description = "Alloying", + inputs = 2, +}) + +elepm.register_crafter("elepower_machines:alloy_furnace", { + description = "Alloy Furnace", + craft_type = "alloy", + ele_active_node = true, + tiles = { + "elepower_machine_top.png", "elepower_machine_base.png", "elepower_machine_side.png", + "elepower_machine_side.png", "elepower_machine_side.png", "elepower_alloy_furnace.png", + }, + ele_active_nodedef = { + tiles = { + "elepower_machine_top.png", "elepower_machine_base.png", "elepower_machine_side.png", + "elepower_machine_side.png", "elepower_machine_side.png", "elepower_alloy_furnace_active.png", + }, + }, + groups = {oddly_breakable_by_hand = 1} +}) diff --git a/elepower_machines/bases/crafter.lua b/elepower_machines/machines/bases/crafter.lua similarity index 100% rename from elepower_machines/bases/crafter.lua rename to elepower_machines/machines/bases/crafter.lua diff --git a/elepower_machines/bases/generator.lua b/elepower_machines/machines/bases/generator.lua similarity index 100% rename from elepower_machines/bases/generator.lua rename to elepower_machines/machines/bases/generator.lua diff --git a/elepower_machines/machines/bases/init.lua b/elepower_machines/machines/bases/init.lua new file mode 100644 index 0000000..f40366f --- /dev/null +++ b/elepower_machines/machines/bases/init.lua @@ -0,0 +1,4 @@ + +dofile(elepm.modpath.."/machines/bases/crafter.lua") +dofile(elepm.modpath.."/machines/bases/generator.lua") +dofile(elepm.modpath.."/machines/bases/storage.lua") diff --git a/elepower_machines/bases/storage.lua b/elepower_machines/machines/bases/storage.lua similarity index 100% rename from elepower_machines/bases/storage.lua rename to elepower_machines/machines/bases/storage.lua diff --git a/elepower_machines/machines/furnace.lua b/elepower_machines/machines/furnace.lua new file mode 100644 index 0000000..ab5b528 --- /dev/null +++ b/elepower_machines/machines/furnace.lua @@ -0,0 +1,22 @@ + +------------- +-- Furnace -- +------------- + +elepm.register_crafter("elepower_machines:furnace", { + description = "Powered Furnace", + craft_type = "cooking", + ele_active_node = true, + ele_usage = 32, + tiles = { + "elepower_machine_top.png", "elepower_machine_base.png", "elepower_machine_side.png", + "elepower_machine_side.png", "elepower_machine_side.png", "elepower_furnace.png", + }, + ele_active_nodedef = { + tiles = { + "elepower_machine_top.png", "elepower_machine_base.png", "elepower_machine_side.png", + "elepower_machine_side.png", "elepower_machine_side.png", "elepower_furnace_active.png", + }, + }, + groups = {oddly_breakable_by_hand = 1} +}) diff --git a/elepower_machines/machines/generator.lua b/elepower_machines/machines/generator.lua new file mode 100644 index 0000000..35c11ce --- /dev/null +++ b/elepower_machines/machines/generator.lua @@ -0,0 +1,21 @@ + +---------------------- +-- Power Generation -- +---------------------- + +elepm.register_fuel_generator("elepower_machines:generator", { + description = "Coal-fired Generator", + ele_active_node = true, + ele_capacity = 6400, + tiles = { + "elepower_machine_top.png", "elepower_machine_base.png", "elepower_machine_side.png", + "elepower_machine_side.png", "elepower_machine_side.png", "elepower_generator.png", + }, + ele_active_nodedef = { + tiles = { + "elepower_machine_top.png", "elepower_machine_base.png", "elepower_machine_side.png", + "elepower_machine_side.png", "elepower_machine_side.png", "elepower_generator_active.png", + } + }, + groups = {oddly_breakable_by_hand = 1} +}) diff --git a/elepower_machines/machines/init.lua b/elepower_machines/machines/init.lua new file mode 100644 index 0000000..1a9666d --- /dev/null +++ b/elepower_machines/machines/init.lua @@ -0,0 +1,9 @@ + +dofile(elepm.modpath.."/machines/bases/init.lua") +dofile(elepm.modpath.."/machines/accumulator.lua") +dofile(elepm.modpath.."/machines/furnace.lua") +dofile(elepm.modpath.."/machines/alloy_furnace.lua") +dofile(elepm.modpath.."/machines/pulverizer.lua") +dofile(elepm.modpath.."/machines/sawmill.lua") +dofile(elepm.modpath.."/machines/generator.lua") +dofile(elepm.modpath.."/machines/storage.lua") diff --git a/elepower_machines/machines/pulverizer.lua b/elepower_machines/machines/pulverizer.lua new file mode 100644 index 0000000..f129de5 --- /dev/null +++ b/elepower_machines/machines/pulverizer.lua @@ -0,0 +1,23 @@ + +elepm.register_craft_type("grind", { + description = "Grinding", + inputs = 1, +}) + +elepm.register_crafter("elepower_machines:pulverizer", { + description = "Pulverizer", + craft_type = "grind", + ele_active_node = true, + ele_usage = 32, + tiles = { + "elepower_machine_top.png", "elepower_machine_base.png", "elepower_machine_side.png", + "elepower_machine_side.png", "elepower_machine_side.png", "elepower_grinder.png", + }, + ele_active_nodedef = { + tiles = { + "elepower_machine_top.png", "elepower_machine_base.png", "elepower_machine_side.png", + "elepower_machine_side.png", "elepower_machine_side.png", "elepower_grinder_active.png", + }, + }, + groups = {oddly_breakable_by_hand = 1} +}) diff --git a/elepower_machines/machines/sawmill.lua b/elepower_machines/machines/sawmill.lua new file mode 100644 index 0000000..a98c534 --- /dev/null +++ b/elepower_machines/machines/sawmill.lua @@ -0,0 +1,16 @@ + +elepm.register_craft_type("saw", { + description = "Sawmilling", + inputs = 1, +}) + +elepm.register_crafter("elepower_machines:sawmill", { + description = "Sawmill", + craft_type = "saw", + ele_usage = 32, + tiles = { + "elepower_machine_top.png", "elepower_machine_base.png", "elepower_machine_side.png", + "elepower_machine_side.png", "elepower_machine_side.png", "elepower_sawmill.png", + }, + groups = {oddly_breakable_by_hand = 1} +}) diff --git a/elepower_machines/machines/storage.lua b/elepower_machines/machines/storage.lua new file mode 100644 index 0000000..a05569a --- /dev/null +++ b/elepower_machines/machines/storage.lua @@ -0,0 +1,14 @@ + +------------------- +-- Power Storage -- +------------------- + +elepm.register_storage("elepower_machines:power_cell", { + description = "Power Cell", + ele_capacity = 16000, + tiles = { + "elepower_machine_top.png", "elepower_machine_base.png", "elepower_machine_side.png", + "elepower_machine_side.png", "elepower_machine_side.png", "elepower_power_cell.png", + }, + groups = {oddly_breakable_by_hand = 1} +}) diff --git a/elepower_machines/nodes.lua b/elepower_machines/nodes.lua index 9395743..7abaf48 100644 --- a/elepower_machines/nodes.lua +++ b/elepower_machines/nodes.lua @@ -1,5 +1,4 @@ -- Nodes other than machines. --- Machines are registered in `register.lua`! minetest.register_node("elepower_machines:machine_block", { description = "Machine Block\nSafe for decoration", diff --git a/elepower_machines/special/init.lua b/elepower_machines/special/init.lua deleted file mode 100644 index 4b085c8..0000000 --- a/elepower_machines/special/init.lua +++ /dev/null @@ -1,2 +0,0 @@ - -dofile(elepm.modpath.."/special/accumulator.lua") diff --git a/elepower_machines/textures/elepower_sawmill.png b/elepower_machines/textures/elepower_sawmill.png index 3a014acc0bd11c22d24d193845b409ba4539730d..f2089cb4e3250a242cbe45519bdc39274471e978 100644 GIT binary patch delta 2157 zcmV-z2$J{2G}R5h(K29lVpDV?$7HUw>BJgaoWEO-QUetW%$IWBWLmC;h}^3F1dm> z;K>d!sl?-LNECgr#l}YT^Tze(-%p;K?YdI_Lh03`FY+g*%>;CRa5sj+)qa$dJmlt? z(#hMCGU)F!TSsQonE%kn`)fFGG$E2uI7 z-q-y%cy(Y&7EcO^Pfc``15nOH(?Vu=VR~}JpIsqVp2LflvfdL!H2?er|*+e1$ znLtp1>+C!qpoK)Z!AbVc1(1U*fNhM4G*wx6iBSkagt%Z_1UK0gkmbD~exgr^p(0Ma zhy;m}Bufb{j0}GZA%;;=OLWmki6O?AVvfZmmwb{GQcNl3R5E9WiYpoUm{ZQV6c{a- zxnOjGLMaCy?(l~k;fO~%@=+?A>Z-3&Lya}nTubBT8uGY>7F%k$m6J|{(&7mD-dN#dWtSPN;*Ke>!${J6mhGM)}gEW7}Jq3+&B7-w9#-2cU91M^% z%!4zV$a@~l4bE(4WQ8!CltE6T!5A3yC$V(8xO*@s24(cG@Mb^+{|)BMpzar#d*|&F zYpu+x=O#lV4F{;!A^T3|RPbl5l-a{Z>V-V2Jd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N!ZxeTz6k6J+#kDXwJ#zIbz)m$VrY&vyR|! zhr?|yD5yS*+Rm&Pe0fft5bHt5gusMQ)qQ_Luq*MGiL?^i*gUyAwswq7&7uIn9nVbU z8(81NQy0E?!g&khbRXV2P<>UmAAqF>uD2Qa1%yYd`t$`qeu<;)s#^7&*Mg0oFsV)D z|HBf`tyS&a@4Gz3=jmEr6Q&lrvWnO}kK&JK^`lkzRvf`66Y1kw_-nzrAMqcyP2mkQ zE2@71|I_9N=*?>KlfDHaPD#rRfKUj#Gle4nMa6Z5%e#4S|5#t5ZPKrd>n>R)!UY)~ zN3;g{!`ez6J7dD3FeG(*eLltKWCK@V1;qQSs`3CbVievG9}l(w01|_n+a24YJ`L;#rpnE=M6kQ(HZn;9So5()z~k^yL|lfxM(e~U>( zK~y-)b&|nu(?Af0zuDMUBpg{ZK}Ez?;oJiU;34t|yeVg%p}AAp>rk~w5d;ZW@eGG# zH+BMZ*|BH-|J%`ytX3-%5mXfs;XF4p%xqM1&c&WYRVm9701+WXX!hQ-TrNkoV7S?A zaKYI*7mFdh_f*9e?>)l^y{d}ie=Gv2u4}4dJEHz8T%Zpdnx>&Dwk+mX7u4Yh08Uj= z)o5@oUd*qkiY;|rV`kAPK$9d%P*vKty|`YMrU1NoeGNQNdnn5iGh@HsA6}vFd)l@g z%^T=nzTPn}UhwJtyOT*Xh9r+KpK#*%IZ3&F?xQ$MQ{I-Z_|`lEkftd&e^m)Itg{IK zUEd)eK7X`DJ_q2}pB=Z){gFl#hPWT#*V%+_-;p4I2$(UO=B(Ml_lF~GEDU6T*)*ry zbtD)tc*1B>H{4Vu_x0(@vuQq>-!PKn_KZx1_)^nY zm`(GM*iOj95pv-$!qe{`BZn?wbauNg&MHVehyVTp$8X3>cMchO00000NkvXXu0mjf Dw}g 0 then + local user_meta = minetest.get_meta(ndv) + user_meta:set_int("storage", user_storage + user_gets) + -- Set timer on this node local t = minetest.get_node_timer(ndv) if not t:is_started() then @@ -289,7 +275,7 @@ local function check_connections(pos) {x=pos.x, y=pos.y, z=pos.z+1}, {x=pos.x, y=pos.y, z=pos.z-1}} - for _,connected_pos in pairs(positions) do + for _,connected_pos in ipairs(positions) do local name = minetest.get_node(connected_pos).name if ele.helpers.get_item_group(name, "ele_conductor") or ele.helpers.get_item_group(name, "ele_machine") then table.insert(connections, connected_pos) @@ -306,8 +292,9 @@ function ele.clear_networks(pos) local placed = name ~= "air" local positions = check_connections(pos) if #positions < 1 then return end + local hash_pos = minetest.hash_node_position(pos) local dead_end = #positions == 1 - for _,connected_pos in pairs(positions) do + for _,connected_pos in ipairs(positions) do local networks = ele.graphcache.devices[minetest.hash_node_position(connected_pos)] or {minetest.pos_to_string(connected_pos)} @@ -328,17 +315,15 @@ function ele.clear_networks(pos) for _, int_net in ipairs(network_ids) do if ele.graphcache[int_net] then - local c_pos = minetest.string_to_pos(int_net) local network = ele.graphcache[int_net] -- Actually add it to the (cached) network - if not ele.graphcache.devices[minetest.hash_node_position(pos)] then - ele.graphcache.devices[minetest.hash_node_position(pos)] = {} + if not ele.graphcache.devices[hash_pos] then + ele.graphcache.devices[hash_pos] = {} end - local t = ele.graphcache.devices[minetest.hash_node_position(pos)] - if not table_has_string(t, int_net) then - table.insert(t, int_net) + if not table_has_string(ele.graphcache.devices[hash_pos], int_net) then + table.insert(ele.graphcache.devices[hash_pos], int_net) end if ele.helpers.get_item_group(name, "ele_conductor") then @@ -379,7 +364,7 @@ function ele.clear_networks(pos) ele.graphcache[int_net] = nil else -- Search for and remove device - ele.graphcache.devices[minetest.hash_node_position(pos)] = nil + ele.graphcache.devices[hash_pos] = nil for tblname, table in pairs(network) do if type(table) == "table" then for devicenum, device in pairs(table) do