Initial Commit

master
Aurailus 2018-02-10 23:11:38 -08:00
commit 745cf6859d
18 changed files with 1074 additions and 0 deletions

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2017 Flairieve
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

16
README.md Normal file
View File

@ -0,0 +1,16 @@
<h1>Machinery</h1>
The mod to improve the future of automation mods. Simple and powerful machines
at your disposal.
<h2>Credits:</h2>
<h3>Flairieve</h3>
Owner of the repository, made all the textures and the tools.
<h3>Aurailus</h3>
Major contributions and most of the code work for Machinery.
<h3>JumpingIntoMadness</h3>
Working on the Coal Generator.

1
depends.txt Normal file
View File

@ -0,0 +1 @@
default

1
description.txt Normal file
View File

@ -0,0 +1 @@
Machinery! The future of automation mods!

130
helpers.lua Normal file
View File

@ -0,0 +1,130 @@
--
-- SERIALIZATION FUNCTIONS
-- Turns position vector in string format, eg "10,25,-12" (x = 10, y = 25, z = -12)
--
function machinery.deserializepos(posString)
local x = posString:sub(1, posString:find(",", 1, true) - 1)
local y = posString:sub(x:len() + 2, posString:find(",", x:len() + 2) - 1, true)
local z = posString:sub(y:len() + 1 + x:len() + 2, posString:find(",", x:len() + 1 + y:len() + 2), true)
return vector.new(tonumber(x), tonumber(y), tonumber(z))
end
function machinery.serializepos(pos)
return pos.x..","..pos.y..","..pos.z
end
--
-- GET ADJACENT
-- Return adjacent nodes
--
function machinery.getAdjacent(pos)
return {
vector.new(pos.x, pos.y + 1, pos.z),
vector.new(pos.x, pos.y - 1, pos.z),
vector.new(pos.x + 1, pos.y, pos.z),
vector.new(pos.x - 1, pos.y, pos.z),
vector.new(pos.x, pos.y, pos.z + 1),
vector.new(pos.x, pos.y, pos.z - 1)
}
end
--
-- ME Functions
-- Functions to modify energy in wires
--
function machinery.pullAdjacentME(machineNode, amount)
local adj_nodes = machinery.getAdjacent(machineNode)
local systems = {}
--Find systems in adjacent nodes
for i = 1, #adj_nodes do
if minetest.get_node(adj_nodes[i]).name == "machinery:wire" or
minetest.get_node(adj_nodes[i]).name == "machinery:wire_controller" then
local system = minetest.get_meta(adj_nodes[i]):get_string("system")
if not system or system == "" then return false end
local found = false
for i = 1, #systems do
if machinery.serializepos(systems[i]) == system then found = true end
end
if not found then table.insert(systems, machinery.deserializepos(system)) end
end
end
--If system doesn't have the capacity then remove it
for i = 1, #systems do
if minetest.get_meta(systems[i]):get_int("system_me") < amount then
table.remove(systems, i)
end
end
--Pull power from system and return state
if #systems > 0 then
for i = 1, #systems do
minetest.get_meta(systems[i]):set_int("system_me", minetest.get_meta(systems[i]):get_int("system_me") - amount/#systems)
end
end
if amount > 0 then return amount end
return false
end
-- function machinery.pullNodeME
function machinery.pushAdjacentME(machineNode, amount)
local adj_nodes = machinery.getAdjacent(machineNode)
local systems = {}
--Find systems in adjacent nodes
for i = 1, #adj_nodes do
if minetest.get_node(adj_nodes[i]).name == "machinery:wire" or
minetest.get_node(adj_nodes[i]).name == "machinery:wire_controller" then
local system = minetest.get_meta(adj_nodes[i]):get_string("system")
if not system or system == "" then return false end
local found = false
for i = 1, #systems do
if machinery.serializepos(systems[i]) == system then found = true end
end
if not found then table.insert(systems, machinery.deserializepos(system)) end
end
end
--If system doesn't have the capacity then remove it
for i = 1, #systems do
if minetest.get_meta(systems[i]):get_int("me_capacity") - minetest.get_meta(systems[i]):get_int("system_me") < amount then
table.remove(systems, i)
end
end
--Push power from system and return state
if #systems > 0 then
for i = 1, #systems do
minetest.get_meta(systems[i]):set_int("system_me", minetest.get_meta(systems[i]):get_int("system_me") + amount/#systems)
end
end
if amount > 0 then return amount end
return false
end
function machinery.checkAdjacentME(machineNode)
local adj_nodes = machinery.getAdjacent(machineNode)
local systems = {}
--Find systems in adjacent nodes
for i = 1, #adj_nodes do
if minetest.get_node(adj_nodes[i]).name == "machinery:wire" or
minetest.get_node(adj_nodes[i]).name == "machinery:wire_controller" then
local system = minetest.get_meta(adj_nodes[i]):get_string("system")
if not system or system == "" then return false end
local found = false
for i = 1, #systems do
if machinery.serializepos(systems[i]) == system then found = true end
end
if not found then table.insert(systems, machinery.deserializepos(system)) end
end
end
--Calculate power
local power = 0
for i = 1, #systems do
power = power + minetest.get_meta(systems[i]):get_int("system_me")
end
return power
end

6
init.lua Normal file
View File

@ -0,0 +1,6 @@
machinery = {}
local path = minetest.get_modpath('machinery')
dofile(path .. "/wires/init.lua")
dofile(path .. "/helpers.lua")
dofile(path .. "/machines/init.lua")

18
machines/battery.lua Normal file
View File

@ -0,0 +1,18 @@
minetest.register_node("machinery:machinery_battery", {
description = "Battery",
tiles = {
"machinery_machine.png",
"machinery_machine.png",
"machinery_machine.png^machinery_battery.png",
"machinery_machine.png^machinery_battery.png",
"machinery_machine.png^machinery_battery.png",
"machinery_machine.png^machinery_battery.png",
},
paramtype2 = "facedir",
is_ground_content = true,
groups = {dig_immediate = 3, oddly_breakable_by_hand = 1, machine = 1},
sounds = default.node_sound_metal_defaults(),
machinery_update = function(pos)
machinery.pushAdjacentME(pos, 50)
end,
})

13
machines/init.lua Normal file
View File

@ -0,0 +1,13 @@
local path = minetest.get_modpath("machinery") .. "/machines"
dofile(path .. "/monitor.lua")
dofile(path .. "/battery.lua")
minetest.register_abm({
nodenames = {"group:machine"},
interval = 0.5,
chance = 1,
action = function(pos)
minetest.registered_nodes[minetest.get_node(pos).name].machinery_update(pos)
end,
})

20
machines/monitor.lua Normal file
View File

@ -0,0 +1,20 @@
minetest.register_node("machinery:machine_monitor", {
description = "Monitor",
tiles = {
"machinery_machine.png",
"machinery_machine.png",
"machinery_machine.png",
"machinery_machine.png",
"machinery_machine.png",
"machinery_machine.png^machinery_monitor.png",
},
paramtype2 = "facedir",
is_ground_content = true,
groups = {dig_immediate = 3, oddly_breakable_by_hand = 1, machine = 1},
sounds = default.node_sound_metal_defaults(),
machinery_update = function(pos)
local power = machinery.checkAdjacentME(pos)
if power == false then power = 0 end
minetest.get_meta(pos):set_string("infotext", "System Power: " .. power .. " ME")
end,
})

Binary file not shown.

After

Width:  |  Height:  |  Size: 385 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 652 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 346 B

BIN
textures/machinery_wire.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 481 B

28
wires/atomic.lua Normal file
View File

@ -0,0 +1,28 @@
machinery.wire.systems = {}
machinery.wire.systemfile = minetest.get_worldpath() .. "/machinery_systems.mt"
local input = io.open(machinery.wire.systemfile, "r")
local filedata = nil
if input then
filedata = input:read('*all')
end
if filedata and filedata ~= "" then
machinery.wire.systems = minetest.deserialize(filedata)
io.close(input)
end
function machinery.wire.save_systems()
local output = io.open(machinery.wire.systemfile, "w")
output:write(minetest.serialize(machinery.wire.systems))
io.close(output)
end
local function save_loop()
machinery.wire.save_systems()
minetest.after(2, save_loop)
end
minetest.after(0, save_loop)
minetest.register_on_shutdown(function()
machinery.wire.save_systems()
end)

19
wires/init.lua Normal file
View File

@ -0,0 +1,19 @@
machinery.wire = {};
local path = minetest.get_modpath("machinery") .. "/wires"
dofile(path .. "/model.lua")
dofile(path .. "/atomic.lua")
dofile(path .. "/logic.lua")
dofile(path .. "/nodes.lua")
--DEBUG--
--Disable in production
minetest.register_abm({
label = "DEBUG - Wires",
nodenames = {"group:wire"},
interval = 0.2,
chance = 1,
action = function(pos)
minetest.get_meta(pos):set_string("infotext", minetest.get_meta(pos):get_string("sys_id"))
end,
})

103
wires/logic.lua Normal file
View File

@ -0,0 +1,103 @@
function machinery.wire.constructWire(pos)
local update = machinery.getAdjacent(pos)
table.insert(update, pos)
for i = 1, #update do
if minetest.get_item_group(minetest.get_node(update[i]).name, "wire") > 0 then
machinery.wire.setModel(update[i])
end
end
machinery.wire.createWire(pos)
end
function machinery.wire.consumeSystem(newSys, oldSys)
if newSys and newSys ~= "" and oldSys and oldSys ~= "" and
machinery.wire.systems[newSys] ~= nil and machinery.wire.systems[oldSys] ~= nil then
local children = machinery.wire.systems[oldSys].children
machinery.wire.systems[oldSys] = nil
for spos,_ in pairs(children) do
pos = machinery.deserializepos(spos)
machinery.wire.systems[newSys].children[spos] = true
minetest.get_meta(pos):set_string("sys_id", newSys)
end
machinery.wire.save_systems()
return true
end
return false
end
function machinery.wire.createWire(pos)
--Check Adjacent Nodes
local adjacent = machinery.getAdjacent(pos)
local found = false
for i = 1, #adjacent do
local node = adjacent[i]
if minetest.get_item_group(minetest.get_node(node).name, "wire") > 0 then
local id = minetest.get_meta(node):get_string("sys_id")
if id and id ~= "" then
if not found then
print("the id that I JUST FOUND is " .. id)
minetest.get_meta(pos):set_string("sys_id", id)
machinery.wire.systems[id].children[machinery.serializepos(pos)] = true
machinery.wire.save_systems()
found = id
else
if id ~= found then
machinery.wire.consumeSystem(found, id)
end
end
end
end
end
if found then return true end
--No Adjacent Nodes to Pair to
local id = tostring(minetest.get_us_time())
minetest.get_meta(pos):set_string("sys_id", id)
machinery.wire.systems[id] = {
id = id,
children = {},
power = 0
}
machinery.wire.systems[id].children[machinery.serializepos(pos)] = true
machinery.wire.save_systems()
return true
end
function machinery.wire.removeWire(pos)
local id = minetest.get_meta(pos):get_string("sys_id")
minetest.after(0, function(pos, id)
local update = machinery.getAdjacent(pos)
for i = 1, #update do
if minetest.get_item_group(minetest.get_node(update[i]).name, "wire") > 0 then
machinery.wire.setModel(update[i])
end
end
if id and id ~= "" then
if machinery.wire.systems[id] ~= nil then
local children = machinery.wire.systems[id].children
children[machinery.serializepos(pos)] = nil
machinery.wire.systems[id] = nil
for spos,_ in pairs(children) do
pos = machinery.deserializepos(spos)
minetest.get_meta(pos):set_string("sys_id", "")
end
for spos,_ in pairs(children) do
pos = machinery.deserializepos(spos)
machinery.wire.createWire(pos)
end
machinery.wire.save_systems()
end
end
end, pos, id)
end

100
wires/model.lua Normal file
View File

@ -0,0 +1,100 @@
function machinery.wire.setModel(pos)
local wires = {}
local adjacent = machinery.getAdjacent(pos)
for i = 3, #adjacent do
if minetest.get_item_group(minetest.get_node(adjacent[i]).name, "wire") > 0 then
wires[i - 2] = true
else wires[i - 2] = false end
end
local suffix = ""
if minetest.get_item_group(minetest.get_node(adjacent[1]).name, "wire") > 0 then
if minetest.get_item_group(minetest.get_node(adjacent[2]).name, "wire") > 0 then
suffix = "_ud"
else suffix = "_u" end
elseif minetest.get_item_group(minetest.get_node(adjacent[2]).name, "wire") > 0 then
suffix = "_d"
end
print(suffix)
if dump(wires) == dump({false, false, false, false}) then --Dot
minetest.swap_node(pos, {name = "machinery:wire" .. suffix})
elseif dump(wires) == dump({true, true, false, false}) then --Line A
local facedir = minetest.dir_to_facedir(vector.new(0, 0, 1))
minetest.swap_node(pos, {name = "machinery:wire_line" .. suffix, param2 = facedir})
elseif dump(wires) == dump({false, false, true, true}) then --Line B
local facedir = minetest.dir_to_facedir(vector.new(1, 0, 0))
minetest.swap_node(pos, {name = "machinery:wire_line" .. suffix, param2 = facedir})
elseif dump(wires) == dump({true, true, true, true}) then --Cross
minetest.swap_node(pos, {name = "machinery:wire_cross" .. suffix})
elseif dump(wires) == dump({true, true, true, false}) then --Funnel Z-
local facedir = minetest.dir_to_facedir(vector.new(0, 0, -1))
minetest.swap_node(pos, {name = "machinery:wire_funnel" .. suffix, param2 = facedir})
elseif dump(wires) == dump({true, true, false, true}) then --Funnel Z+
local facedir = minetest.dir_to_facedir(vector.new(0, 0, 1))
minetest.swap_node(pos, {name = "machinery:wire_funnel" .. suffix, param2 = facedir})
elseif dump(wires) == dump({true, false, true, true}) then --Funnel X-
local facedir = minetest.dir_to_facedir(vector.new(-1, 0, 0))
minetest.swap_node(pos, {name = "machinery:wire_funnel" .. suffix, param2 = facedir})
elseif dump(wires) == dump({false, true, true, true}) then --Funnel X+
local facedir = minetest.dir_to_facedir(vector.new(1, 0, 0))
minetest.swap_node(pos, {name = "machinery:wire_funnel" .. suffix, param2 = facedir})
elseif dump(wires) == dump({true, false, false, false}) then --End X+
local facedir = minetest.dir_to_facedir(vector.new(0, 0, 1))
minetest.swap_node(pos, {name = "machinery:wire_end" .. suffix, param2 = facedir})
elseif dump(wires) == dump({false, true, false, false}) then --End X-
local facedir = minetest.dir_to_facedir(vector.new(0, 0, -1))
minetest.swap_node(pos, {name = "machinery:wire_end" .. suffix, param2 = facedir})
elseif dump(wires) == dump({false, false, true, false}) then --End Z+
local facedir = minetest.dir_to_facedir(vector.new(-1, 0, 0))
minetest.swap_node(pos, {name = "machinery:wire_end" .. suffix, param2 = facedir})
elseif dump(wires) == dump({false, false, false, true}) then --End Z-
local facedir = minetest.dir_to_facedir(vector.new(1, 0, 0))
minetest.swap_node(pos, {name = "machinery:wire_end" .. suffix, param2 = facedir})
elseif dump(wires) == dump({true, false, true, false}) then --Corner 1
local facedir = minetest.dir_to_facedir(vector.new(0, 0, -1))
minetest.swap_node(pos, {name = "machinery:wire_corner_1" .. suffix, param2 = facedir})
elseif dump(wires) == dump({true, false, false, true}) then --Corner 2
local facedir = minetest.dir_to_facedir(vector.new(-1, 0, 0))
minetest.swap_node(pos, {name = "machinery:wire_corner_1" .. suffix, param2 = facedir})
elseif dump(wires) == dump({false, true, true, false}) then --Corner 3
local facedir = minetest.dir_to_facedir(vector.new(1, 0, 0))
minetest.swap_node(pos, {name = "machinery:wire_corner_1" .. suffix, param2 = facedir})
elseif dump(wires) == dump({false, true, false, true}) then --Corner 4
local facedir = minetest.dir_to_facedir(vector.new(0, 0, 1))
minetest.swap_node(pos, {name = "machinery:wire_corner_1" .. suffix, param2 = facedir})
end
end

598
wires/nodes.lua Normal file
View File

@ -0,0 +1,598 @@
function machinery.register_wire(name, description)
--Inventory Node
minetest.register_node(name, {
description = description,
tiles = {"machinery_wire.png"},
is_ground_content = false,
groups = {dig_immediate = 3, oddly_breakable_by_hand = 1, wire = 1},
sounds = default.node_sound_metal_defaults(),
on_construct = machinery.wire.constructWire,
on_destruct = machinery.wire.removeWire,
paramtype2 = "facedir",
drawtype = "nodebox",
paramtype = "light",
node_box = {
type = "fixed",
fixed = {
{-0.125, -0.125, -0.125, 0.125, 0.125, 0.125},
}
},
drop = name
})
minetest.register_node(name .. "_end", {
description = description,
tiles = {"machinery_wire.png"},
is_ground_content = false,
groups = {dig_immediate = 3, oddly_breakable_by_hand = 1, wire = 1},
sounds = default.node_sound_metal_defaults(),
on_construct = machinery.wire.constructWire,
on_destruct = machinery.wire.removeWire,
paramtype2 = "facedir",
drawtype = "nodebox",
paramtype = "light",
node_box = {
type = "fixed",
fixed = {
{-0.125, -0.125, -0.125, 0.5, 0.125, 0.125}, -- NodeBox1
}
},
drop = name
})
minetest.register_node(name .. "_line", {
description = description,
tiles = {"machinery_wire.png"},
is_ground_content = false,
groups = {dig_immediate = 3, oddly_breakable_by_hand = 1, wire = 1},
sounds = default.node_sound_metal_defaults(),
on_construct = machinery.wire.constructWire,
on_destruct = machinery.wire.removeWire,
paramtype2 = "facedir",
drawtype = "nodebox",
paramtype = "light",
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.125, -0.125, 0.5, 0.125, 0.125}, -- NodeBox1
}
},
drop = name
})
minetest.register_node(name .. "_corner_1", {
description = description,
tiles = {"machinery_wire.png"},
is_ground_content = false,
groups = {dig_immediate = 3, oddly_breakable_by_hand = 1, wire = 1},
sounds = default.node_sound_metal_defaults(),
on_construct = machinery.wire.constructWire,
on_destruct = machinery.wire.removeWire,
paramtype2 = "facedir",
drawtype = "nodebox",
paramtype = "light",
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.125, -0.125, 0.125, 0.125, 0.125}, -- NodeBox1
{-0.125, -0.125, -0.5, 0.125, 0.125, 0.125}, -- NodeBox2
}
},
drop = name
})
minetest.register_node(name .. "_corner_2", {
description = description,
tiles = {"machinery_wire.png"},
is_ground_content = false,
groups = {dig_immediate = 3, oddly_breakable_by_hand = 1, wire = 1},
sounds = default.node_sound_metal_defaults(),
on_construct = machinery.wire.constructWire,
on_destruct = machinery.wire.removeWire,
paramtype2 = "facedir",
drawtype = "nodebox",
paramtype = "light",
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.125, -0.125, 0.125, 0.125, 0.125}, -- NodeBox1
{-0.125, -0.125, -0.125, 0.125, 0.125, 0.5}, -- NodeBox2
}
},
drop = name
})
minetest.register_node(name .. "_funnel", {
description = description,
tiles = {"machinery_wire.png"},
is_ground_content = false,
groups = {dig_immediate = 3, oddly_breakable_by_hand = 1, wire = 1},
sounds = default.node_sound_metal_defaults(),
on_construct = machinery.wire.constructWire,
on_destruct = machinery.wire.removeWire,
paramtype2 = "facedir",
drawtype = "nodebox",
paramtype = "light",
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.125, -0.125, 0.5, 0.125, 0.125}, -- NodeBox1
{-0.125, -0.125, -0.5, 0.125, 0.125, 0.125}, -- NodeBox2
}
},
drop = name
})
minetest.register_node(name .. "_cross", {
description = description,
tiles = {"machinery_wire.png"},
is_ground_content = false,
groups = {dig_immediate = 3, oddly_breakable_by_hand = 1, wire = 1},
sounds = default.node_sound_metal_defaults(),
on_construct = machinery.wire.constructWire,
on_destruct = machinery.wire.removeWire,
paramtype2 = "facedir",
drawtype = "nodebox",
paramtype = "light",
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.125, -0.125, 0.5, 0.125, 0.125}, -- NodeBox1
{-0.125, -0.125, -0.5, 0.125, 0.125, 0.5}, -- NodeBox2
}
},
drop = name
})
minetest.register_node(name .. "_d", {
description = description,
tiles = {"machinery_wire.png"},
is_ground_content = false,
groups = {dig_immediate = 3, oddly_breakable_by_hand = 1, wire = 1},
sounds = default.node_sound_metal_defaults(),
on_construct = machinery.wire.constructWire,
on_destruct = machinery.wire.removeWire,
paramtype2 = "facedir",
drawtype = "nodebox",
paramtype = "light",
node_box = {
type = "fixed",
fixed = {
{-0.125, -0.5, -0.125, 0.125, 0.125, 0.125}, -- NodeBox1
}
},
drop = name
})
minetest.register_node(name .. "_end_d", {
description = description,
tiles = {"machinery_wire.png"},
is_ground_content = false,
groups = {dig_immediate = 3, oddly_breakable_by_hand = 1, wire = 1},
sounds = default.node_sound_metal_defaults(),
on_construct = machinery.wire.constructWire,
on_destruct = machinery.wire.removeWire,
paramtype2 = "facedir",
drawtype = "nodebox",
paramtype = "light",
node_box = {
type = "fixed",
fixed = {
{-0.125, -0.125, -0.125, 0.5, 0.125, 0.125}, -- NodeBox1
{-0.125, -0.5, -0.125, 0.125, 0.125, 0.125}, -- NodeBox2
}
},
drop = name
})
minetest.register_node(name .. "_line_d", {
description = description,
tiles = {"machinery_wire.png"},
is_ground_content = false,
groups = {dig_immediate = 3, oddly_breakable_by_hand = 1, wire = 1},
sounds = default.node_sound_metal_defaults(),
on_construct = machinery.wire.constructWire,
on_destruct = machinery.wire.removeWire,
paramtype2 = "facedir",
drawtype = "nodebox",
paramtype = "light",
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.125, -0.125, 0.5, 0.125, 0.125}, -- NodeBox1
{-0.125, -0.5, -0.125, 0.125, 0.125, 0.125}, -- NodeBox2
}
},
drop = name
})
minetest.register_node(name .. "_corner_1_d", {
description = description,
tiles = {"machinery_wire.png"},
is_ground_content = false,
groups = {dig_immediate = 3, oddly_breakable_by_hand = 1, wire = 1},
sounds = default.node_sound_metal_defaults(),
on_construct = machinery.wire.constructWire,
on_destruct = machinery.wire.removeWire,
paramtype2 = "facedir",
drawtype = "nodebox",
paramtype = "light",
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.125, -0.125, 0.125, 0.125, 0.125}, -- NodeBox1
{-0.125, -0.125, -0.5, 0.125, 0.125, 0.125}, -- NodeBox2
{-0.125, -0.5, -0.125, 0.125, 0.125, 0.125}, -- NodeBox3
}
},
drop = name
})
minetest.register_node(name .. "_corner_2_d", {
description = description,
tiles = {"machinery_wire.png"},
is_ground_content = false,
groups = {dig_immediate = 3, oddly_breakable_by_hand = 1, wire = 1},
sounds = default.node_sound_metal_defaults(),
on_construct = machinery.wire.constructWire,
on_destruct = machinery.wire.removeWire,
paramtype2 = "facedir",
drawtype = "nodebox",
paramtype = "light",
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.125, -0.125, 0.125, 0.125, 0.125}, -- NodeBox1
{-0.125, -0.125, -0.125, 0.125, 0.125, 0.5}, -- NodeBox2
{-0.125, -0.5, -0.125, 0.125, 0.125, 0.125}, -- NodeBox3
}
},
drop = name
})
minetest.register_node(name .. "_funnel_d", {
description = description,
tiles = {"machinery_wire.png"},
is_ground_content = false,
groups = {dig_immediate = 3, oddly_breakable_by_hand = 1, wire = 1},
sounds = default.node_sound_metal_defaults(),
on_construct = machinery.wire.constructWire,
on_destruct = machinery.wire.removeWire,
paramtype2 = "facedir",
drawtype = "nodebox",
paramtype = "light",
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.125, -0.125, 0.5, 0.125, 0.125}, -- NodeBox1
{-0.125, -0.125, -0.5, 0.125, 0.125, 0.125}, -- NodeBox2
{-0.125, -0.5, -0.125, 0.125, 0.125, 0.125}, -- NodeBox3
}
},
drop = name
})
minetest.register_node(name .. "_cross_d", {
description = description,
tiles = {"machinery_wire.png"},
is_ground_content = false,
groups = {dig_immediate = 3, oddly_breakable_by_hand = 1, wire = 1},
sounds = default.node_sound_metal_defaults(),
on_construct = machinery.wire.constructWire,
on_destruct = machinery.wire.removeWire,
paramtype2 = "facedir",
drawtype = "nodebox",
paramtype = "light",
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.125, -0.125, 0.5, 0.125, 0.125}, -- NodeBox1
{-0.125, -0.125, -0.5, 0.125, 0.125, 0.5}, -- NodeBox2
{-0.125, -0.5, -0.125, 0.125, 0.125, 0.125}, -- NodeBox3
}
},
drop = name
})
minetest.register_node(name .. "_u", {
description = description,
tiles = {"machinery_wire.png"},
is_ground_content = false,
groups = {dig_immediate = 3, oddly_breakable_by_hand = 1, wire = 1},
sounds = default.node_sound_metal_defaults(),
on_construct = machinery.wire.constructWire,
on_destruct = machinery.wire.removeWire,
paramtype2 = "facedir",
drawtype = "nodebox",
paramtype = "light",
node_box = {
type = "fixed",
fixed = {
{-0.125, -0.125, -0.125, 0.125, 0.5, 0.125}, -- NodeBox1
}
},
drop = name
})
minetest.register_node(name .. "_end_u", {
description = description,
tiles = {"machinery_wire.png"},
is_ground_content = false,
groups = {dig_immediate = 3, oddly_breakable_by_hand = 1, wire = 1},
sounds = default.node_sound_metal_defaults(),
on_construct = machinery.wire.constructWire,
on_destruct = machinery.wire.removeWire,
paramtype2 = "facedir",
drawtype = "nodebox",
paramtype = "light",
node_box = {
type = "fixed",
fixed = {
{-0.125, -0.125, -0.125, 0.5, 0.125, 0.125}, -- NodeBox1
{-0.125, -0.125, -0.125, 0.125, 0.5, 0.125}, -- NodeBox1
}
},
drop = name
})
minetest.register_node(name .. "_line_u", {
description = description,
tiles = {"machinery_wire.png"},
is_ground_content = false,
groups = {dig_immediate = 3, oddly_breakable_by_hand = 1, wire = 1},
sounds = default.node_sound_metal_defaults(),
on_construct = machinery.wire.constructWire,
on_destruct = machinery.wire.removeWire,
paramtype2 = "facedir",
drawtype = "nodebox",
paramtype = "light",
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.125, -0.125, 0.5, 0.125, 0.125}, -- NodeBox1
{-0.125, -0.125, -0.125, 0.125, 0.5, 0.125}, -- NodeBox2
}
},
drop = name
})
minetest.register_node(name .. "_corner_1_u", {
description = description,
tiles = {"machinery_wire.png"},
is_ground_content = false,
groups = {dig_immediate = 3, oddly_breakable_by_hand = 1, wire = 1},
sounds = default.node_sound_metal_defaults(),
on_construct = machinery.wire.constructWire,
on_destruct = machinery.wire.removeWire,
paramtype2 = "facedir",
drawtype = "nodebox",
paramtype = "light",
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.125, -0.125, 0.125, 0.125, 0.125}, -- NodeBox1
{-0.125, -0.125, -0.5, 0.125, 0.125, 0.125}, -- NodeBox2
{-0.125, -0.125, -0.125, 0.125, 0.5, 0.125}, -- NodeBox3
}
},
drop = name
})
minetest.register_node(name .. "_corner_2_u", {
description = description,
tiles = {"machinery_wire.png"},
is_ground_content = false,
groups = {dig_immediate = 3, oddly_breakable_by_hand = 1, wire = 1},
sounds = default.node_sound_metal_defaults(),
on_construct = machinery.wire.constructWire,
on_destruct = machinery.wire.removeWire,
paramtype2 = "facedir",
drawtype = "nodebox",
paramtype = "light",
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.125, -0.125, 0.125, 0.125, 0.125}, -- NodeBox1
{-0.125, -0.125, -0.125, 0.125, 0.125, 0.5}, -- NodeBox2
{-0.125, -0.125, -0.125, 0.125, 0.5, 0.125}, -- NodeBox3
}
},
drop = name
})
minetest.register_node(name .. "_funnel_u", {
description = description,
tiles = {"machinery_wire.png"},
is_ground_content = false,
groups = {dig_immediate = 3, oddly_breakable_by_hand = 1, wire = 1},
sounds = default.node_sound_metal_defaults(),
on_construct = machinery.wire.constructWire,
on_destruct = machinery.wire.removeWire,
paramtype2 = "facedir",
drawtype = "nodebox",
paramtype = "light",
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.125, -0.125, 0.5, 0.125, 0.125}, -- NodeBox1
{-0.125, -0.125, -0.5, 0.125, 0.125, 0.125}, -- NodeBox2
{-0.125, -0.125, -0.125, 0.125, 0.5, 0.125}, -- NodeBox3
}
},
drop = name
})
minetest.register_node(name .. "_cross_u", {
description = description,
tiles = {"machinery_wire.png"},
is_ground_content = false,
groups = {dig_immediate = 3, oddly_breakable_by_hand = 1, wire = 1},
sounds = default.node_sound_metal_defaults(),
on_construct = machinery.wire.constructWire,
on_destruct = machinery.wire.removeWire,
paramtype2 = "facedir",
drawtype = "nodebox",
paramtype = "light",
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.125, -0.125, 0.5, 0.125, 0.125}, -- NodeBox1
{-0.125, -0.125, -0.5, 0.125, 0.125, 0.5}, -- NodeBox2
{-0.125, -0.125, -0.125, 0.125, 0.5, 0.125}, -- NodeBox3
}
},
drop = name
})
minetest.register_node(name .. "_ud", {
description = description,
tiles = {"machinery_wire.png"},
is_ground_content = false,
groups = {dig_immediate = 3, oddly_breakable_by_hand = 1, wire = 1},
sounds = default.node_sound_metal_defaults(),
on_construct = machinery.wire.constructWire,
on_destruct = machinery.wire.removeWire,
paramtype2 = "facedir",
drawtype = "nodebox",
paramtype = "light",
node_box = {
type = "fixed",
fixed = {
{-0.125, -0.5, -0.125, 0.125, 0.5, 0.125}, -- NodeBox1
}
},
drop = name
})
minetest.register_node(name .. "_end_ud", {
description = description,
tiles = {"machinery_wire.png"},
is_ground_content = false,
groups = {dig_immediate = 3, oddly_breakable_by_hand = 1, wire = 1},
sounds = default.node_sound_metal_defaults(),
on_construct = machinery.wire.constructWire,
on_destruct = machinery.wire.removeWire,
paramtype2 = "facedir",
drawtype = "nodebox",
paramtype = "light",
node_box = {
type = "fixed",
fixed = {
{-0.125, -0.125, -0.125, 0.5, 0.125, 0.125}, -- NodeBox1
{-0.125, -0.5, -0.125, 0.125, 0.5, 0.125}, -- NodeBox1
}
},
drop = name
})
minetest.register_node(name .. "_line_ud", {
description = description,
tiles = {"machinery_wire.png"},
is_ground_content = false,
groups = {dig_immediate = 3, oddly_breakable_by_hand = 1, wire = 1},
sounds = default.node_sound_metal_defaults(),
on_construct = machinery.wire.constructWire,
on_destruct = machinery.wire.removeWire,
paramtype2 = "facedir",
drawtype = "nodebox",
paramtype = "light",
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.125, -0.125, 0.5, 0.125, 0.125}, -- NodeBox1
{-0.125, -0.5, -0.125, 0.125, 0.5, 0.125}, -- NodeBox2
}
},
drop = name
})
minetest.register_node(name .. "_corner_1_ud", {
description = description,
tiles = {"machinery_wire.png"},
is_ground_content = false,
groups = {dig_immediate = 3, oddly_breakable_by_hand = 1, wire = 1},
sounds = default.node_sound_metal_defaults(),
on_construct = machinery.wire.constructWire,
on_destruct = machinery.wire.removeWire,
paramtype2 = "facedir",
drawtype = "nodebox",
paramtype = "light",
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.125, -0.125, 0.125, 0.125, 0.125}, -- NodeBox1
{-0.125, -0.125, -0.5, 0.125, 0.125, 0.125}, -- NodeBox2
{-0.125, -0.5, -0.125, 0.125, 0.5, 0.125}, -- NodeBox3
}
},
drop = name
})
minetest.register_node(name .. "_corner_2_ud", {
description = description,
tiles = {"machinery_wire.png"},
is_ground_content = false,
groups = {dig_immediate = 3, oddly_breakable_by_hand = 1, wire = 1},
sounds = default.node_sound_metal_defaults(),
on_construct = machinery.wire.constructWire,
on_destruct = machinery.wire.removeWire,
paramtype2 = "facedir",
drawtype = "nodebox",
paramtype = "light",
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.125, -0.125, 0.125, 0.125, 0.125}, -- NodeBox1
{-0.125, -0.125, -0.125, 0.125, 0.125, 0.5}, -- NodeBox2
{-0.125, -0.5, -0.125, 0.125, 0.5, 0.125}, -- NodeBox3
}
},
drop = name
})
minetest.register_node(name .. "_funnel_ud", {
description = description,
tiles = {"machinery_wire.png"},
is_ground_content = false,
groups = {dig_immediate = 3, oddly_breakable_by_hand = 1, wire = 1},
sounds = default.node_sound_metal_defaults(),
on_construct = machinery.wire.constructWire,
on_destruct = machinery.wire.removeWire,
paramtype2 = "facedir",
drawtype = "nodebox",
paramtype = "light",
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.125, -0.125, 0.5, 0.125, 0.125}, -- NodeBox1
{-0.125, -0.125, -0.5, 0.125, 0.125, 0.125}, -- NodeBox2
{-0.125, -0.5, -0.125, 0.125, 0.5, 0.125}, -- NodeBox3
}
},
drop = name
})
minetest.register_node(name .. "_cross_ud", {
description = description,
tiles = {"machinery_wire.png"},
is_ground_content = false,
groups = {dig_immediate = 3, oddly_breakable_by_hand = 1, wire = 1},
sounds = default.node_sound_metal_defaults(),
on_construct = machinery.wire.constructWire,
on_destruct = machinery.wire.removeWire,
paramtype2 = "facedir",
drawtype = "nodebox",
paramtype = "light",
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.125, -0.125, 0.5, 0.125, 0.125}, -- NodeBox1
{-0.125, -0.125, -0.5, 0.125, 0.125, 0.5}, -- NodeBox2
{-0.125, -0.5, -0.125, 0.125, 0.5, 0.125}, -- NodeBox3
}
},
drop = name
})
end
machinery.register_wire("machinery:wire", "Wire")