From 6885943d0491db83268f8bb4743bfd82ed725ea2 Mon Sep 17 00:00:00 2001 From: Vanessa Ezekowitz Date: Tue, 14 Mar 2017 00:04:17 -0400 Subject: update coloredwood, digilines, technic, gloopblocks, homedecor, mesecons, pipeworks, player_textures, signs_lib, unifieddyes, and worldedit --- technic/README.md | 8 ++ technic/locale/it.txt | 48 ++++----- technic/machines/HV/quarry.lua | 13 ++- technic/machines/init.lua | 1 + technic/machines/other/constructor.lua | 2 +- technic/machines/power_monitor.lua | 67 +++++++++++++ technic/machines/register/cables.lua | 108 ++++++++++++++++++++- technic/machines/supply_converter.lua | 61 +++++++++++- technic/machines/switching_station.lua | 79 ++++++++++----- ...echnic_hv_nuclear_reactor_siren_danger_loop.ogg | Bin 13059 -> 36524 bytes .../textures/technic_power_monitor_bottom_back.png | Bin 0 -> 506 bytes technic/textures/technic_power_monitor_front.png | Bin 0 -> 428 bytes technic/textures/technic_power_monitor_sides.png | Bin 0 -> 456 bytes technic/tools/mining_drill.lua | 26 ++--- 14 files changed, 346 insertions(+), 67 deletions(-) create mode 100644 technic/machines/power_monitor.lua create mode 100644 technic/textures/technic_power_monitor_bottom_back.png create mode 100644 technic/textures/technic_power_monitor_front.png create mode 100644 technic/textures/technic_power_monitor_sides.png (limited to 'technic') diff --git a/technic/README.md b/technic/README.md index b6aa05f..e5adf31 100644 --- a/technic/README.md +++ b/technic/README.md @@ -25,3 +25,11 @@ RealBadAngel: (WTFPL) * Everything else. CC BY-SA 3.0: + +Sound licenses: + +veikk0 (Veikko Mäkelä) (CC BY-SA 4.0): + * technic_hv_nuclear_reactor_siren_danger_loop.ogg + * Derived from "Nuclear alarm.wav" by Freesound.org user rene___ from . Originally licensed under CC0 1.0 + +CC BY-SA 4.0: \ No newline at end of file diff --git a/technic/locale/it.txt b/technic/locale/it.txt index 59ba7f6..a092a53 100644 --- a/technic/locale/it.txt +++ b/technic/locale/it.txt @@ -26,8 +26,8 @@ Graphite = Lastra in graffite Carbon Cloth = Fibra di carbonio Raw Latex = Latex grezzo Rubber Fiber = Fibra di gomma -%.1f%%-Fissile Uranium Ingot = -%.1f%%-Fissile Uranium Block = +%.1f%%-Fissile Uranium Ingot = %.1f%%-Lingotto di uranio fissile +%.1f%%-Fissile Uranium Block = %.1f%%-Blocco di uranio fissile ## Machine misc Machine cannot be removed because it is not empty = La macchina non può essere rimossa perchè non è vuota @@ -36,7 +36,7 @@ Inventory move disallowed due to protection = Impossibile muovere l'inventario a @1 Active (@2 EU) = @1 Attivo (@2 EU) %s Active = %s Attivo %s Disabled = %s Disabilitato -%s Enabled = +%s Enabled = %s Abilitato %s Idle = %s Inattivo %s Improperly Placed = %s Piazzato impropiamente %s Unpowered = %s Non alimentato @@ -46,18 +46,18 @@ Inventory move disallowed due to protection = Impossibile muovere l'inventario a %s Finished = %s Finito Enable/Disable = Abilita/Disabilita Range = Raggio -Upgrade Slots = +Upgrade Slots = Alloggi di aggiornamento In: = Ingresso: Out: = Uscita: -Slot %d = +Slot %d = Alloggio %d Itemwise = Singolo elemento Stackwise = pila completa -Owner: = -Unlocked = -Locked = -Radius: = -Enabled = -Disabled = +Owner: = Proprietario: +Unlocked = Non chiuso a chiave +Locked = Chiuso a chiave +Radius: = Raggio: +Enabled = Abilitato +Disabled = Disabilitato ## Machine names # $1: Tier @@ -84,10 +84,10 @@ Self-Contained Injector = Ignettore Constructor Mk%d = Costruttore Mk%d Frame = Cornice Frame Motor = Cornice del motore -Template = -Template (replacing) = Template (rimpiazzato) -Template Motor = -Template Tool = +Template = Sagoma +Template (replacing) = Sagoma (di rimpiazzo) +Template Motor = Motore per sagome +Template Tool = Strumento per sagome Battery Box = Box batterie Supply Converter = Trasformatore Switching Station = Stazione di controllo @@ -96,7 +96,7 @@ Fuel-Fired Furnace = Fornace a carbone Wind Mill Frame = Pala eolica Forcefield = Campo di forza Nuclear Reactor Rod Compartment = Compartimento combustibile nucleare -Administrative World Anchor = +Administrative World Anchor = Ancora-mondo amministrativa ## Machine-specific # $1: Pruduced EU @@ -111,12 +111,12 @@ Production at %d%% = Produzione a %d%% Choose Milling Program: = Scegliere un programma di Fresatura Slim Elements half / normal height: = Metà elementi sottili / altezza normale: Current track %s = Traccia corrente %s -Stopped = -Keeping %d/%d map blocks loaded = -Digging not started = -Digging finished = -Digging %d m above machine = -Digging %d m below machine = +Stopped = Fermato +Keeping %d/%d map blocks loaded = Mantenimento di %d/%d blocchi mappa caricati +Digging not started = Scavo non iniziato +Digging finished = Scavo finito +Digging %d m above machine = Scavo di %d m sopra la macchina +Digging %d m below machine = Scavo di %d m sotto la macchina ## CNC Cylinder = Cilindro @@ -174,10 +174,10 @@ Talinite = Talinite Tin = Stagno Wrought Iron = Ferro Battuto Zinc = Zinco -%.1f%%-Fissile Uranium = +%.1f%%-Fissile Uranium = %.1f%%-Uranio fissile ## Tools -RE Battery = +RE Battery = Batteria RE Water Can = Serbatoio d'acqua Lava Can = Serbatoio di lava Chainsaw = Motosega diff --git a/technic/machines/HV/quarry.lua b/technic/machines/HV/quarry.lua index 8255676..8d87b65 100644 --- a/technic/machines/HV/quarry.lua +++ b/technic/machines/HV/quarry.lua @@ -12,6 +12,7 @@ minetest.register_craft({ local quarry_dig_above_nodes = 3 -- How far above the quarry we will dig nodes local quarry_max_depth = 100 local quarry_demand = 10000 +local quarry_eject_dir = vector.new(0, 1, 0) local function set_quarry_formspec(meta) local radius = meta:get_int("size") @@ -83,7 +84,7 @@ local function quarry_handle_purge(pos) if stack then local item = stack:to_table() if item then - technic.tube_inject_item(pos, pos, vector.new(0, 1, 0), item) + technic.tube_inject_item(pos, pos, quarry_eject_dir, item) stack:clear() inv:set_stack("cache", i, stack) break @@ -217,6 +218,16 @@ minetest.register_node("technic:quarry", { connect_sides = {"bottom", "front", "left", "right"}, tube = { connect_sides = {top = 1}, + -- lower priority than other tubes, so that quarries will prefer any + -- other tube to another quarry, which could lead to server freezes + -- in certain quarry placements (2x2 for example would never eject) + priority = 10, + can_go = function(pos, node, velocity, stack) + -- always eject the same, even if items came in another way + -- this further mitigates loops and generally avoids random sideway movement + -- that can be expected in certain quarry placements + return { quarry_eject_dir } + end }, on_construct = function(pos) local meta = minetest.get_meta(pos) diff --git a/technic/machines/init.lua b/technic/machines/init.lua index ad79eab..f2e31c9 100644 --- a/technic/machines/init.lua +++ b/technic/machines/init.lua @@ -8,6 +8,7 @@ dofile(path.."/MV/init.lua") dofile(path.."/HV/init.lua") dofile(path.."/switching_station.lua") +dofile(path.."/power_monitor.lua") dofile(path.."/supply_converter.lua") dofile(path.."/other/init.lua") diff --git a/technic/machines/other/constructor.lua b/technic/machines/other/constructor.lua index 3396ac7..9c64051 100644 --- a/technic/machines/other/constructor.lua +++ b/technic/machines/other/constructor.lua @@ -21,7 +21,7 @@ local function deploy_node(inv, slot_name, pos, node, machine_node) end if remove_to then for i = 1, remove_to do - inv:remove_item(drops[i]) + inv:remove_item(slot_name, drops[i]) end else minetest.remove_node(pos) diff --git a/technic/machines/power_monitor.lua b/technic/machines/power_monitor.lua new file mode 100644 index 0000000..4306693 --- /dev/null +++ b/technic/machines/power_monitor.lua @@ -0,0 +1,67 @@ +-- POWER MONITOR +-- The power monitor can be used to monitor how much power is available on a network, +-- similarly to the old "slave" switching stations. + +local S = technic.getter + +minetest.register_craft({ + output = "technic:power_monitor", + recipe = { + {"", "", ""}, + {"", "technic:machine_casing", "default:copper_ingot"}, + {"technic:lv_cable", "technic:lv_cable", "technic:lv_cable"} + } +}) + +minetest.register_node("technic:power_monitor",{ + description = S("Power Monitor"), + tiles = { + "technic_power_monitor_sides.png", + "technic_power_monitor_bottom_back.png", + "technic_power_monitor_sides.png", + "technic_power_monitor_sides.png", + "technic_power_monitor_bottom_back.png", + "technic_power_monitor_front.png" + }, + paramtype2 = "facedir", + groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, technic_all_tiers=1, technic_machine=1}, + connect_sides = {"bottom", "back"}, + sounds = default.node_sound_wood_defaults(), + on_construct = function(pos) + local meta = minetest.get_meta(pos) + meta:set_string("infotext", S("Power Monitor")) + end, +}) + +minetest.register_abm({ + nodenames = {"technic:power_monitor"}, + label = "Power Monitor", + interval = 1, + chance = 1, + action = function(pos, node, active_object_count, active_object_count_wider) + local meta = minetest.get_meta(pos) + local network_hash = technic.cables[minetest.hash_node_position(pos)] + local network = network_hash and minetest.get_position_from_hash(network_hash) + local sw_pos = network and {x=network.x,y=network.y+1,z=network.z} + local timeout = 0 + for tier in pairs(technic.machines) do + timeout = math.max(meta:get_int(tier.."_EU_timeout"),timeout) + end + if timeout > 0 and sw_pos and minetest.get_node(sw_pos).name == "technic:switching_station" then + local sw_meta = minetest.get_meta(sw_pos) + local supply = sw_meta:get_int("supply") + local demand = sw_meta:get_int("demand") + meta:set_string("infotext", + S("Power Monitor. Supply: @1 Demand: @2", + technic.pretty_num(supply), technic.pretty_num(demand))) + else + meta:set_string("infotext",S("Power Monitor Has No Network")) + end + end, +}) + +for tier in pairs(technic.machines) do + -- RE in order to use the "timeout" functions, although it consumes 0 power + technic.register_machine(tier, "technic:power_monitor", "RE") +end + diff --git a/technic/machines/register/cables.lua b/technic/machines/register/cables.lua index 28984c0..165db98 100644 --- a/technic/machines/register/cables.lua +++ b/technic/machines/register/cables.lua @@ -11,8 +11,110 @@ function technic.get_cable_tier(name) return cable_tier[name] end -local function clear_networks() - technic.networks = {} +local function check_connections(pos) + -- Build a table of all machines + local machines = {} + for tier,list in pairs(technic.machines) do + for k,v in pairs(list) do + machines[k] = v + end + end + 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 machines[name] or technic.get_cable_tier(name) then + table.insert(connections,connected_pos) + end + end + return connections +end + +local function clear_networks(pos) + local node = minetest.get_node(pos) + local meta = minetest.get_meta(pos) + local placed = node.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 = technic.cables[minetest.hash_node_position(connected_pos)] + if net and technic.networks[net] then + if dead_end and placed then + -- Dead end placed, add it to the network + -- Get the network + local network_id = technic.cables[minetest.hash_node_position(positions[1])] + if not network_id then + -- We're evidently not on a network, nothing to add ourselves to + return + end + local sw_pos = minetest.get_position_from_hash(network_id) + sw_pos.y = sw_pos.y + 1 + local network = technic.networks[network_id] + local tier = network.tier + + -- Actually add it to the (cached) network + -- This is similar to check_node_subp + technic.cables[minetest.hash_node_position(pos)] = network_id + pos.visited = 1 + if technic.is_tier_cable(name, tier) then + table.insert(network.all_nodes,pos) + elseif technic.machines[tier][node.name] then + meta:set_string(tier.."_network",minetest.pos_to_string(sw_pos)) + if technic.machines[tier][node.name] == technic.producer then + table.insert(network.PR_nodes,pos) + elseif technic.machines[tier][node.name] == technic.receiver then + table.insert(network.RE_nodes,pos) + elseif technic.machines[tier][node.name] == technic.producer_receiver then + table.insert(network.PR_nodes,pos) + table.insert(network.RE_nodes,pos) + elseif technic.machines[tier][node.name] == "SPECIAL" and + (pos.x ~= sw_pos.x or pos.y ~= sw_pos.y or pos.z ~= sw_pos.z) and + from_below then + table.insert(network.SP_nodes,pos) + elseif technic.machines[tier][node.name] == technic.battery then + table.insert(network.BA_nodes,pos) + end + end + elseif dead_end and not placed then + -- Dead end removed, remove it from the network + -- Get the network + local network_id = technic.cables[minetest.hash_node_position(positions[1])] + if not network_id then + -- We're evidently not on a network, nothing to add ourselves to + return + end + local network = technic.networks[network_id] + + -- Search for and remove machine + technic.cables[minetest.hash_node_position(pos)] = nil + for tblname,table in pairs(network) do + if tblname ~= "tier" then + for machinenum,machine in pairs(table) do + if machine.x == pos.x + and machine.y == pos.y + and machine.z == pos.z then + table[machinenum] = nil + end + end + end + end + else + -- Not a dead end, so the whole network needs to be recalculated + for _,v in pairs(technic.networks[net].all_nodes) do + local pos1 = minetest.hash_node_position(v) + technic.cables[pos1] = nil + end + technic.networks[net] = nil + end + end + end end function technic.register_cable(tier, size) @@ -55,7 +157,7 @@ end local function clear_nets_if_machine(pos, node) for tier, machine_list in pairs(technic.machines) do if machine_list[node.name] ~= nil then - return clear_networks() + return clear_networks(pos) end end end diff --git a/technic/machines/supply_converter.lua b/technic/machines/supply_converter.lua index 32597de..15c761d 100644 --- a/technic/machines/supply_converter.lua +++ b/technic/machines/supply_converter.lua @@ -9,12 +9,62 @@ local S = technic.getter +local function set_supply_converter_formspec(meta) + local formspec = "size[5,2.25]".. + "field[0.3,0.5;2,1;power;"..S("Input Power")..";"..meta:get_int("power").."]" + -- The names for these toggle buttons are explicit about which + -- state they'll switch to, so that multiple presses (arising + -- from the ambiguity between lag and a missed press) only make + -- the single change that the user expects. + if meta:get_int("mesecon_mode") == 0 then + formspec = formspec.."button[0,1;5,1;mesecon_mode_1;"..S("Ignoring Mesecon Signal").."]" + else + formspec = formspec.."button[0,1;5,1;mesecon_mode_0;"..S("Controlled by Mesecon Signal").."]" + end + if meta:get_int("enabled") == 0 then + formspec = formspec.."button[0,1.75;5,1;enable;"..S("%s Disabled"):format(S("Supply Converter")).."]" + else + formspec = formspec.."button[0,1.75;5,1;disable;"..S("%s Enabled"):format(S("Supply Converter")).."]" + end + meta:set_string("formspec", formspec) +end + +local supply_converter_receive_fields = function(pos, formname, fields, sender) + local meta = minetest.get_meta(pos) + local power = nil + if fields.power then + power = tonumber(fields.power) or 0 + power = 100 * math.floor(power / 100) + power = math.max(power, 0) + power = math.min(power, 10000) + if power == meta:get_int("power") then power = nil end + end + if power then meta:set_int("power", power) end + if fields.enable then meta:set_int("enabled", 1) end + if fields.disable then meta:set_int("enabled", 0) end + if fields.mesecon_mode_0 then meta:set_int("mesecon_mode", 0) end + if fields.mesecon_mode_1 then meta:set_int("mesecon_mode", 1) end + set_supply_converter_formspec(meta) +end + +local mesecons = { + effector = { + action_on = function(pos, node) + minetest.get_meta(pos):set_int("mesecon_effect", 1) + end, + action_off = function(pos, node) + minetest.get_meta(pos):set_int("mesecon_effect", 0) + end + } +} + local run = function(pos, node) - local demand = 10000 local remain = 0.9 -- Machine information local machine_name = S("Supply Converter") local meta = minetest.get_meta(pos) + local enabled = meta:get_int("enabled") ~= 0 and (meta:get_int("mesecon_mode") == 0 or meta:get_int("mesecon_effect") ~= 0) + local demand = enabled and meta:get_int("power") or 10000 local pos_up = {x=pos.x, y=pos.y+1, z=pos.z} local pos_down = {x=pos.x, y=pos.y-1, z=pos.z} @@ -53,12 +103,19 @@ minetest.register_node("technic:supply_converter", { technic_machine=1, technic_all_tiers=1}, connect_sides = {"top", "bottom"}, sounds = default.node_sound_wood_defaults(), + on_receive_fields = supply_converter_receive_fields, on_construct = function(pos) local meta = minetest.get_meta(pos) meta:set_string("infotext", S("Supply Converter")) - meta:set_float("active", false) + meta:set_int("power", 10000) + meta:set_int("enabled", 1) + meta:set_int("mesecon_mode", 0) + meta:set_int("mesecon_effect", 0) + set_supply_converter_formspec(meta) end, + mesecons = mesecons, technic_run = run, + technic_on_disable = run, }) minetest.register_craft({ diff --git a/technic/machines/switching_station.lua b/technic/machines/switching_station.lua index f7ec0b6..f925817 100644 --- a/technic/machines/switching_station.lua +++ b/technic/machines/switching_station.lua @@ -32,6 +32,7 @@ -- This way the supplies are separated per network. technic.networks = {} +technic.cables = {} local S = technic.getter @@ -57,6 +58,11 @@ minetest.register_node("technic:switching_station",{ meta:set_string("infotext", S("Switching Station")) meta:set_string("active", 1) end, + after_dig_node = function(pos) + minetest.forceload_free_block(pos) + pos.y = pos.y - 1 + minetest.forceload_free_block(pos) + end, }) -------------------------------------------------- @@ -64,7 +70,8 @@ minetest.register_node("technic:switching_station",{ -------------------------------------------------- -- Add a wire node to the LV/MV/HV network -local add_new_cable_node = function(nodes, pos) +local add_new_cable_node = function(nodes, pos, network_id) + technic.cables[minetest.hash_node_position(pos)] = network_id -- Ignore if the node has already been added for i = 1, #nodes do if pos.x == nodes[i].x and @@ -78,31 +85,31 @@ local add_new_cable_node = function(nodes, pos) end -- Generic function to add found connected nodes to the right classification array -local check_node_subp = function(PR_nodes, RE_nodes, BA_nodes, SP_nodes, all_nodes, pos, machines, tier, sw_pos, from_below) +local check_node_subp = function(PR_nodes, RE_nodes, BA_nodes, SP_nodes, all_nodes, pos, machines, tier, sw_pos, from_below, network_id) technic.get_or_load_node(pos) local meta = minetest.get_meta(pos) local name = minetest.get_node(pos).name if technic.is_tier_cable(name, tier) then - add_new_cable_node(all_nodes, pos) + add_new_cable_node(all_nodes, pos,network_id) elseif machines[name] then --dprint(name.." is a "..machines[name]) + meta:set_string(tier.."_network",minetest.pos_to_string(sw_pos)) if machines[name] == technic.producer then - add_new_cable_node(PR_nodes, pos) + add_new_cable_node(PR_nodes, pos, network_id) elseif machines[name] == technic.receiver then - add_new_cable_node(RE_nodes, pos) + add_new_cable_node(RE_nodes, pos, network_id) elseif machines[name] == technic.producer_receiver then - add_new_cable_node(PR_nodes, pos) - add_new_cable_node(RE_nodes, pos) + add_new_cable_node(PR_nodes, pos, network_id) + add_new_cable_node(RE_nodes, pos, network_id) elseif machines[name] == "SPECIAL" and (pos.x ~= sw_pos.x or pos.y ~= sw_pos.y or pos.z ~= sw_pos.z) and from_below then -- Another switching station -> disable it - add_new_cable_node(SP_nodes, pos) + add_new_cable_node(SP_nodes, pos, network_id) meta:set_int("active", 0) - meta:set_string("active_pos", minetest.serialize(sw_pos)) elseif machines[name] == technic.battery then - add_new_cable_node(BA_nodes, pos) + add_new_cable_node(BA_nodes, pos, network_id) end meta:set_int(tier.."_EU_timeout", 2) -- Touch node @@ -110,7 +117,7 @@ local check_node_subp = function(PR_nodes, RE_nodes, BA_nodes, SP_nodes, all_nod end -- Traverse a network given a list of machines and a cable type name -local traverse_network = function(PR_nodes, RE_nodes, BA_nodes, SP_nodes, all_nodes, i, machines, tier, sw_pos) +local traverse_network = function(PR_nodes, RE_nodes, BA_nodes, SP_nodes, all_nodes, i, machines, tier, sw_pos, network_id) local pos = all_nodes[i] local positions = { {x=pos.x+1, y=pos.y, z=pos.z}, @@ -121,7 +128,7 @@ local traverse_network = function(PR_nodes, RE_nodes, BA_nodes, SP_nodes, all_no {x=pos.x, y=pos.y, z=pos.z-1}} --print("ON") for i, cur_pos in pairs(positions) do - check_node_subp(PR_nodes, RE_nodes, BA_nodes, SP_nodes, all_nodes, cur_pos, machines, tier, sw_pos, i == 3) + check_node_subp(PR_nodes, RE_nodes, BA_nodes, SP_nodes, all_nodes, cur_pos, machines, tier, sw_pos, i == 3, network_id) end end @@ -153,11 +160,11 @@ local get_network = function(sw_pos, pos1, tier) local all_nodes = {pos1} repeat traverse_network(PR_nodes, RE_nodes, BA_nodes, SP_nodes, all_nodes, - i, technic.machines[tier], tier, sw_pos) + i, technic.machines[tier], tier, sw_pos, minetest.hash_node_position(pos1)) i = i + 1 until all_nodes[i] == nil technic.networks[minetest.hash_node_position(pos1)] = {tier = tier, PR_nodes = PR_nodes, - RE_nodes = RE_nodes, BA_nodes = BA_nodes, SP_nodes = SP_nodes} + RE_nodes = RE_nodes, BA_nodes = BA_nodes, SP_nodes = SP_nodes, all_nodes = all_nodes} return PR_nodes, BA_nodes, RE_nodes end @@ -183,27 +190,30 @@ minetest.register_abm({ local BA_nodes local RE_nodes local machine_name = S("Switching Station") + + -- Which kind of network are we on: + pos1 = {x=pos.x, y=pos.y-1, z=pos.z} + --Disable if necessary if meta:get_int("active") ~= 1 then - meta:set_int("active", 1) - local active_pos = minetest.deserialize(meta:get_string("active_pos")) - if active_pos then - local meta1 = minetest.get_meta(active_pos) - meta:set_string("infotext", S("%s (Slave)"):format(meta1:get_string("infotext"))) - end + minetest.forceload_free_block(pos) + minetest.forceload_free_block(pos1) + meta:set_string("infotext",S("%s Already Present"):format(machine_name)) return end - - -- Which kind of network are we on: - pos1 = {x=pos.x, y=pos.y-1, z=pos.z} local name = minetest.get_node(pos1).name local tier = technic.get_cable_tier(name) if tier then + -- Forceload switching station + minetest.forceload_block(pos) + minetest.forceload_block(pos1) PR_nodes, BA_nodes, RE_nodes = get_network(pos, pos1, tier) else --dprint("Not connected to a network") meta:set_string("infotext", S("%s Has No Network"):format(machine_name)) + minetest.forceload_free_block(pos) + minetest.forceload_free_block(pos1) return end @@ -291,6 +301,10 @@ minetest.register_abm({ S("@1. Supply: @2 Demand: @3", machine_name, technic.pretty_num(PR_eu_supply), technic.pretty_num(RE_eu_demand))) + -- Data that will be used by the power monitor + meta:set_int("supply",PR_eu_supply) + meta:set_int("demand",RE_eu_demand) + -- If the PR supply is enough for the RE demand supply them all if PR_eu_supply >= RE_eu_demand then --dprint("PR_eu_supply"..PR_eu_supply.." >= RE_eu_demand"..RE_eu_demand) @@ -352,6 +366,7 @@ minetest.register_abm({ meta1 = minetest.get_meta(pos1) meta1:set_int(eu_input_str, 0) end + end, }) @@ -374,6 +389,7 @@ minetest.register_abm({ interval = 1, chance = 1, action = function(pos, node, active_object_count, active_object_count_wider) + local meta = minetest.get_meta(pos) for tier, machines in pairs(technic.machines) do if machines[node.name] and switching_station_timeout_count(pos, tier) then local nodedef = minetest.registered_nodes[node.name] @@ -392,6 +408,23 @@ minetest.register_abm({ end, }) +--Re-enable disabled switching station if necessary, similar to the timeout above +minetest.register_abm({ + nodenames = {"technic:switching_station"}, + interval = 1, + chance = 1, + action = function(pos, node, active_object_count, active_object_count_wider) + local meta = minetest.get_meta(pos) + local pos1 = {x=pos.x,y=pos.y-1,z=pos.z} + local tier = technic.get_cable_tier(minetest.get_node(pos1).name) + if not tier then return end + if switching_station_timeout_count(pos, tier) then + local meta = minetest.get_meta(pos) + meta:set_int("active",1) + end + end, +}) + for tier, machines in pairs(technic.machines) do -- SPECIAL will not be traversed technic.register_machine(tier, "technic:switching_station", "SPECIAL") diff --git a/technic/sounds/technic_hv_nuclear_reactor_siren_danger_loop.ogg b/technic/sounds/technic_hv_nuclear_reactor_siren_danger_loop.ogg index 3d290b0..1f21a16 100644 Binary files a/technic/sounds/technic_hv_nuclear_reactor_siren_danger_loop.ogg and b/technic/sounds/technic_hv_nuclear_reactor_siren_danger_loop.ogg differ diff --git a/technic/textures/technic_power_monitor_bottom_back.png b/technic/textures/technic_power_monitor_bottom_back.png new file mode 100644 index 0000000..c857039 Binary files /dev/null and b/technic/textures/technic_power_monitor_bottom_back.png differ diff --git a/technic/textures/technic_power_monitor_front.png b/technic/textures/technic_power_monitor_front.png new file mode 100644 index 0000000..b0db568 Binary files /dev/null and b/technic/textures/technic_power_monitor_front.png differ diff --git a/technic/textures/technic_power_monitor_sides.png b/technic/textures/technic_power_monitor_sides.png new file mode 100644 index 0000000..a6df4f3 Binary files /dev/null and b/technic/textures/technic_power_monitor_sides.png differ diff --git a/technic/tools/mining_drill.lua b/technic/tools/mining_drill.lua index 8a25abe..bc426e7 100644 --- a/technic/tools/mining_drill.lua +++ b/technic/tools/mining_drill.lua @@ -71,20 +71,21 @@ local function drill_dig_it1 (player) end local function drill_dig_it2 (pos,player) + pos.y=pos.y+1 drill_dig_it0 (pos,player) pos.z=pos.z+1 drill_dig_it0 (pos,player) pos.z=pos.z-2 drill_dig_it0 (pos,player) pos.z=pos.z+1 - pos.y=pos.y+1 + pos.y=pos.y-1 drill_dig_it0 (pos,player) pos.z=pos.z+1 drill_dig_it0 (pos,player) pos.z=pos.z-2 drill_dig_it0 (pos,player) pos.z=pos.z+1 - pos.y=pos.y-2 + pos.y=pos.y-1 drill_dig_it0 (pos,player) pos.z=pos.z+1 drill_dig_it0 (pos,player) @@ -93,20 +94,21 @@ local function drill_dig_it2 (pos,player) end local function drill_dig_it3 (pos,player) + pos.y=pos.y+1 drill_dig_it0 (pos,player) pos.x=pos.x+1 drill_dig_it0 (pos,player) pos.x=pos.x-2 drill_dig_it0 (pos,player) pos.x=pos.x+1 - pos.y=pos.y+1 + pos.y=pos.y-1 drill_dig_it0 (pos,player) pos.x=pos.x+1 drill_dig_it0 (pos,player) pos.x=pos.x-2 drill_dig_it0 (pos,player) pos.x=pos.x+1 - pos.y=pos.y-2 + pos.y=pos.y-1 drill_dig_it0 (pos,player) pos.x=pos.x+1 drill_dig_it0 (pos,player) @@ -252,10 +254,9 @@ local function mining_drill_mk2_setmode(user,itemstack) mode=mode+1 if mode>=5 then mode=1 end minetest.chat_send_player(player_name, S("Mining Drill Mk%d Mode %d"):format(2, mode)..": "..mining_drill_mode_text[mode][1]) - item["name"]="technic:mining_drill_mk2_"..mode + itemstack:set_name("technic:mining_drill_mk2_"..mode); meta["mode"]=mode - item["metadata"]=minetest.serialize(meta) - itemstack:replace(item) + itemstack:set_metadata(minetest.serialize(meta)) return itemstack end @@ -276,10 +277,9 @@ local function mining_drill_mk3_setmode(user,itemstack) mode=mode+1 if mode>=6 then mode=1 end minetest.chat_send_player(player_name, S("Mining Drill Mk%d Mode %d"):format(3, mode)..": "..mining_drill_mode_text[mode][1]) - item["name"]="technic:mining_drill_mk3_"..mode + itemstack:set_name("technic:mining_drill_mk3_"..mode); meta["mode"]=mode - item["metadata"]=minetest.serialize(meta) - itemstack:replace(item) + itemstack:set_metadata(minetest.serialize(meta)) return itemstack end @@ -296,7 +296,7 @@ local function mining_drill_mk2_handler(itemstack, user, pointed_thing) end local charge_to_take = cost_to_use(2, meta.mode) if meta.charge >= charge_to_take then - local pos = minetest.get_pointed_thing_position(pointed_thing, above) + local pos = minetest.get_pointed_thing_position(pointed_thing, false) drill_dig_it(pos, user, meta.mode) if not technic.creative_mode then meta.charge = meta.charge - charge_to_take @@ -319,7 +319,7 @@ local function mining_drill_mk3_handler(itemstack, user, pointed_thing) end local charge_to_take = cost_to_use(3, meta.mode) if meta.charge >= charge_to_take then - local pos = minetest.get_pointed_thing_position(pointed_thing, above) + local pos = minetest.get_pointed_thing_position(pointed_thing, false) drill_dig_it(pos, user, meta.mode) if not technic.creative_mode then meta.charge = meta.charge - charge_to_take @@ -348,7 +348,7 @@ minetest.register_tool("technic:mining_drill", { end local charge_to_take = cost_to_use(1, 1) if meta.charge >= charge_to_take then - local pos = minetest.get_pointed_thing_position(pointed_thing, above) + local pos = minetest.get_pointed_thing_position(pointed_thing, false) drill_dig_it(pos, user, 1) if not technic.creative_mode then meta.charge = meta.charge - charge_to_take -- cgit v1.2.3