forked from Mirrorlandia_minetest/digistuff
Add receivers, insulated digilines, and vertical digilines
This commit is contained in:
parent
0e61a770c9
commit
6e3f9d4c11
14
README
14
README
@ -23,6 +23,12 @@ How to use digimese:
|
|||||||
It conducts digilines signals (like digilines) in all directions (like mese). That's about it, really.
|
It conducts digilines signals (like digilines) in all directions (like mese). That's about it, really.
|
||||||
|
|
||||||
|
|
||||||
|
How to use vertical/insulated digilines:
|
||||||
|
These work exactly like the mesecons equivalents, that is:
|
||||||
|
Vertical digilines will automatically connect to other vertical digilines directly above or below them, and form "plates" on each end of the stack. Signals can only be conducted into or out of the stack at these "plates".
|
||||||
|
Insulated digilines conduct like regular digilines, but only into/out of the ends of the "wire".
|
||||||
|
|
||||||
|
|
||||||
How to use the digilines player detector:
|
How to use the digilines player detector:
|
||||||
Set a channel and radius (radius must be a number >0 and <10 - anything invalid will be ignored and "6" used instead).
|
Set a channel and radius (radius must be a number >0 and <10 - anything invalid will be ignored and "6" used instead).
|
||||||
Every second while a player is within the radius, a table listing the players in range will be sent via digilines on the chosen channel.
|
Every second while a player is within the radius, a table listing the players in range will be sent via digilines on the chosen channel.
|
||||||
@ -39,3 +45,11 @@ Send a digilines signal with the URL you want to download. The HTTPRequestResult
|
|||||||
How to use the camera:
|
How to use the camera:
|
||||||
Set the channel, distance, and radius. The camera will search for a node "distance" meters away and up to 10m down.
|
Set the channel, distance, and radius. The camera will search for a node "distance" meters away and up to 10m down.
|
||||||
Every second while a player is within "radius" meters of that point, a table listing the players in range will be sent via digilines on the chosen channel.
|
Every second while a player is within "radius" meters of that point, a table listing the players in range will be sent via digilines on the chosen channel.
|
||||||
|
|
||||||
|
|
||||||
|
How to use the dimmable lights:
|
||||||
|
After setting the channel, send a number from 0 to 14 to set the light level.
|
||||||
|
|
||||||
|
How to use the junction box:
|
||||||
|
These are just plain digilines conductors (like digimese) but can skip over one node to another junction box or certain other nodes.
|
||||||
|
As in, [digiline][junction box][dirt][junction box][digiline] will work to transmit signals "through" the dirt.
|
||||||
|
61
button.lua
61
button.lua
@ -1,9 +1,22 @@
|
|||||||
digistuff.button_turnoff = function (pos)
|
digistuff.button_turnoff = function (pos)
|
||||||
local node = minetest.get_node(pos)
|
local node = minetest.get_node(pos)
|
||||||
if node.name=="digistuff:button_on" then --has not been dug
|
|
||||||
minetest.swap_node(pos, {name = "digistuff:button_off", param2=node.param2})
|
minetest.swap_node(pos, {name = "digistuff:button_off", param2=node.param2})
|
||||||
if minetest.get_modpath("mesecons") then minetest.sound_play("mesecons_button_pop", {pos=pos}) end
|
if minetest.get_modpath("mesecons") then minetest.sound_play("mesecons_button_pop", {pos=pos}) end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
digistuff.button_get_rules = function(node)
|
||||||
|
local rules = {
|
||||||
|
{x = 1,y = 0,z = 0},
|
||||||
|
{x = -1,y = 0,z = 0},
|
||||||
|
{x = 0,y = 1,z = 0},
|
||||||
|
{x = 0,y = -1,z = 0},
|
||||||
|
{x = 0,y = 0,z = 1},
|
||||||
|
{x = 0,y = 0,z = -1},
|
||||||
|
{x = 0,y = 0,z = 2},
|
||||||
|
}
|
||||||
|
local dir = minetest.facedir_to_dir(node.param2)
|
||||||
|
rules = digistuff.rotate_rules(rules,dir)
|
||||||
|
return rules
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node("digistuff:button", {
|
minetest.register_node("digistuff:button", {
|
||||||
@ -34,23 +47,28 @@ minetest.register_node("digistuff:button", {
|
|||||||
},
|
},
|
||||||
digiline =
|
digiline =
|
||||||
{
|
{
|
||||||
receptor = {}
|
receptor = {},
|
||||||
|
wire = {
|
||||||
|
rules = digistuff.button_get_rules,
|
||||||
},
|
},
|
||||||
groups = {dig_immediate=2},
|
},
|
||||||
|
groups = {dig_immediate = 2,digiline_receiver = 1,},
|
||||||
description = "Digilines Button",
|
description = "Digilines Button",
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
meta:set_string("formspec","size[8,4;]field[1,1;6,2;channel;Channel;${channel}]field[1,2;6,2;msg;Message;${msg}]button_exit[2.25,3;3,1;submit;Save]")
|
meta:set_string("formspec","size[8,4;]field[1,1;6,2;channel;Channel;${channel}]field[1,2;6,2;msg;Message;${msg}]button_exit[2.25,3;3,1;submit;Save]")
|
||||||
end,
|
end,
|
||||||
|
after_place_node = digistuff.place_receiver,
|
||||||
|
after_destruct = digistuff.remove_receiver,
|
||||||
on_receive_fields = function(pos, formname, fields, sender)
|
on_receive_fields = function(pos, formname, fields, sender)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
if fields.channel and fields.msg and fields.channel ~= "" and fields.msg ~= "" then
|
if fields.channel and fields.channel ~= "" then
|
||||||
meta:set_string("channel",fields.channel)
|
meta:set_string("channel",fields.channel)
|
||||||
meta:set_string("msg",fields.msg)
|
meta:set_string("msg",fields.msg)
|
||||||
meta:set_string("formspec","")
|
meta:set_string("formspec","")
|
||||||
minetest.swap_node(pos, {name = "digistuff:button_off", param2=minetest.get_node(pos).param2})
|
minetest.swap_node(pos, {name = "digistuff:button_off", param2=minetest.get_node(pos).param2})
|
||||||
else
|
else
|
||||||
minetest.chat_send_player(sender:get_player_name(),"Channel and message must both be set!")
|
minetest.chat_send_player(sender:get_player_name(),"Please set a channel!")
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
sounds = default and default.node_sound_stone_defaults(),
|
sounds = default and default.node_sound_stone_defaults(),
|
||||||
@ -84,17 +102,21 @@ minetest.register_node("digistuff:button_off", {
|
|||||||
},
|
},
|
||||||
digiline =
|
digiline =
|
||||||
{
|
{
|
||||||
receptor = {}
|
receptor = {},
|
||||||
|
wire = {
|
||||||
|
rules = digistuff.button_get_rules,
|
||||||
},
|
},
|
||||||
groups = {dig_immediate=2, not_in_creative_inventory=1},
|
},
|
||||||
|
groups = {dig_immediate = 2,not_in_creative_inventory = 1,digiline_receiver = 1,},
|
||||||
drop = "digistuff:button",
|
drop = "digistuff:button",
|
||||||
|
after_destruct = digistuff.remove_receiver,
|
||||||
description = "Digilines Button (off state - you hacker you!)",
|
description = "Digilines Button (off state - you hacker you!)",
|
||||||
on_rightclick = function (pos, node, clicker)
|
on_rightclick = function (pos, node, clicker)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
digiline:receptor_send(pos, digiline.rules.default, meta:get_string("channel"), meta:get_string("msg"))
|
digiline:receptor_send(pos, digistuff.button_get_rules(node), meta:get_string("channel"), meta:get_string("msg"))
|
||||||
minetest.swap_node(pos, {name = "digistuff:button_on", param2=node.param2})
|
minetest.swap_node(pos, {name = "digistuff:button_on", param2=node.param2})
|
||||||
if minetest.get_modpath("mesecons") then minetest.sound_play("mesecons_button_push", {pos=pos}) end
|
if minetest.get_modpath("mesecons") then minetest.sound_play("mesecons_button_push", {pos=pos}) end
|
||||||
minetest.after(0.5, digistuff.button_turnoff, pos)
|
minetest.get_node_timer(pos):start(0.25)
|
||||||
end,
|
end,
|
||||||
sounds = default and default.node_sound_stone_defaults(),
|
sounds = default and default.node_sound_stone_defaults(),
|
||||||
})
|
})
|
||||||
@ -128,28 +150,25 @@ minetest.register_node("digistuff:button_on", {
|
|||||||
},
|
},
|
||||||
digiline =
|
digiline =
|
||||||
{
|
{
|
||||||
receptor = {}
|
receptor = {},
|
||||||
|
wire = {
|
||||||
|
rules = digistuff.button_get_rules,
|
||||||
},
|
},
|
||||||
groups = {dig_immediate=2, not_in_creative_inventory=1},
|
},
|
||||||
|
on_timer = digistuff.button_turnoff,
|
||||||
|
groups = {dig_immediate = 2,not_in_creative_inventory = 1,digiline_receiver = 1,},
|
||||||
drop = 'digistuff:button',
|
drop = 'digistuff:button',
|
||||||
|
after_destruct = digistuff.remove_receiver,
|
||||||
on_rightclick = function (pos, node, clicker)
|
on_rightclick = function (pos, node, clicker)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
digiline:receptor_send(pos, digiline.rules.default, meta:get_string("channel"), meta:get_string("msg"))
|
digiline:receptor_send(pos, digistuff.button_get_rules(node), meta:get_string("channel"), meta:get_string("msg"))
|
||||||
if minetest.get_modpath("mesecons") then minetest.sound_play("mesecons_button_push", {pos=pos}) end
|
if minetest.get_modpath("mesecons") then minetest.sound_play("mesecons_button_push", {pos=pos}) end
|
||||||
|
minetest.get_node_timer(pos):start(0.25)
|
||||||
end,
|
end,
|
||||||
description = "Digilines Button (on state - you hacker you!)",
|
description = "Digilines Button (on state - you hacker you!)",
|
||||||
sounds = default and default.node_sound_stone_defaults(),
|
sounds = default and default.node_sound_stone_defaults(),
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
output = "digistuff:digimese",
|
|
||||||
recipe = {
|
|
||||||
{"digilines:wire_std_00000000","digilines:wire_std_00000000","digilines:wire_std_00000000"},
|
|
||||||
{"digilines:wire_std_00000000","default:mese","digilines:wire_std_00000000"},
|
|
||||||
{"digilines:wire_std_00000000","digilines:wire_std_00000000","digilines:wire_std_00000000"}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "digistuff:button",
|
output = "digistuff:button",
|
||||||
recipe = {
|
recipe = {
|
||||||
|
439
conductors.lua
439
conductors.lua
@ -1,3 +1,59 @@
|
|||||||
|
digistuff.remove_receiver = function(pos,node)
|
||||||
|
local dir = minetest.facedir_to_dir(node.param2)
|
||||||
|
local rpos = vector.add(pos,vector.multiply(dir,2))
|
||||||
|
local rnode = minetest.get_node(rpos)
|
||||||
|
if rnode.name == "digistuff:receiver" then
|
||||||
|
rnode.name = "digilines:wire_std_00000000"
|
||||||
|
minetest.remove_node(rpos)
|
||||||
|
minetest.place_node(rpos,rnode)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
digistuff.place_receiver = function(pos)
|
||||||
|
local node = minetest.get_node(pos)
|
||||||
|
local dir = minetest.facedir_to_dir(node.param2)
|
||||||
|
if dir.y == 0 then
|
||||||
|
local nodebehind = minetest.get_node(vector.add(pos,dir))
|
||||||
|
if nodebehind.name == "digistuff:digimese" then return end
|
||||||
|
local rpos = vector.add(pos,vector.multiply(dir,2))
|
||||||
|
local rnode = minetest.get_node(rpos)
|
||||||
|
if string.find(rnode.name,"^digilines:wire_std_") then
|
||||||
|
minetest.remove_node(rpos)
|
||||||
|
local newrnode = {pos = rpos,name = "digistuff:receiver",param2 = node.param2,}
|
||||||
|
minetest.set_node(rpos,newrnode)
|
||||||
|
digilines.update_autoconnect(rpos)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local old_update_autoconnect = digilines.update_autoconnect
|
||||||
|
|
||||||
|
digilines.update_autoconnect = function(pos,secondcall)
|
||||||
|
if not secondcall then
|
||||||
|
local node = minetest.get_node(pos)
|
||||||
|
if string.find(node.name,"^digilines:wire_std_") then
|
||||||
|
local checkdirs = {
|
||||||
|
{x = 1,y = 0,z = 0},
|
||||||
|
{x = -1,y = 0,z = 0},
|
||||||
|
{x = 0,y = 0,z = 1},
|
||||||
|
{x = 0,y = 0,z = -1},
|
||||||
|
}
|
||||||
|
local found = false
|
||||||
|
for _,i in ipairs(checkdirs) do
|
||||||
|
if not found then
|
||||||
|
local checkpos = vector.add(pos,vector.multiply(i,2))
|
||||||
|
local group = minetest.get_item_group(minetest.get_node(checkpos).name,"digiline_receiver")
|
||||||
|
if group and group > 0 then
|
||||||
|
digistuff.place_receiver(checkpos)
|
||||||
|
if minetest.get_node(pos).name == "digistuff:receiver" then found = true end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
old_update_autoconnect(pos,secondcall)
|
||||||
|
end
|
||||||
|
|
||||||
minetest.register_node("digistuff:digimese", {
|
minetest.register_node("digistuff:digimese", {
|
||||||
description = "Digimese",
|
description = "Digimese",
|
||||||
tiles = {"digistuff_digimese.png"},
|
tiles = {"digistuff_digimese.png"},
|
||||||
@ -52,6 +108,330 @@ minetest.register_node("digistuff:junctionbox", {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
digistuff.receiver_get_rules = function(node)
|
||||||
|
local rules = {
|
||||||
|
{x = 0,y = 0,z = -2},
|
||||||
|
{x = 0,y = 0,z = 1},
|
||||||
|
}
|
||||||
|
return digistuff.rotate_rules(rules,minetest.facedir_to_dir(node.param2))
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_node("digistuff:receiver", {
|
||||||
|
description = "Digilines Receiver (you hacker you!)",
|
||||||
|
tiles = {"digistuff_digiline_full.png"},
|
||||||
|
paramtype = "light",
|
||||||
|
groups = {dig_immediate = 3,not_in_creative_inventory = 1,},
|
||||||
|
drop = "digilines:wire_std_00000000",
|
||||||
|
is_ground_content = false,
|
||||||
|
paramtype = "light",
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
drawtype = "nodebox",
|
||||||
|
node_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
{-0.05,-0.05,-1.49,0.05,0.05,-0.5},
|
||||||
|
{-0.2,-0.2,-0.5,0.2,0.2,-0.4},
|
||||||
|
{-0.0625,-0.5,-0.5,0.0625,-0.2,-0.4},
|
||||||
|
{-0.0625,-0.5,-0.4,0.0625,-0.4375,0.5},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
digiline = {
|
||||||
|
receptor = {},
|
||||||
|
wire = {
|
||||||
|
rules = digistuff.receiver_get_rules,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
digistuff.vertical_autoconnect = function(pos)
|
||||||
|
local node = minetest.get_node(pos)
|
||||||
|
if minetest.get_item_group(node.name,"vertical_digiline") == 0 then return end
|
||||||
|
local uppos = vector.add(pos,vector.new(0,1,0))
|
||||||
|
local dnpos = vector.add(pos,vector.new(0,-1,0))
|
||||||
|
local upnode = minetest.get_node(uppos)
|
||||||
|
local dnnode = minetest.get_node(dnpos)
|
||||||
|
local shouldbe = "digistuff:vertical_bottom"
|
||||||
|
if minetest.get_item_group(dnnode.name,"vertical_digiline") > 0 then
|
||||||
|
if minetest.get_item_group(upnode.name,"vertical_digiline") > 0 then
|
||||||
|
shouldbe = "digistuff:vertical_middle"
|
||||||
|
else
|
||||||
|
shouldbe = "digistuff:vertical_top"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if shouldbe ~= node.name or upnode.name == "digistuff:vertical_bottom" or dnnode.name == "digistuff:vertical_top" then
|
||||||
|
node.name = shouldbe
|
||||||
|
minetest.set_node(pos,node)
|
||||||
|
digilines.update_autoconnect(pos)
|
||||||
|
digistuff.vertical_autoconnect(uppos)
|
||||||
|
digistuff.vertical_autoconnect(dnpos)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
digistuff.vertical_remove = function(pos)
|
||||||
|
local uppos = vector.add(pos,vector.new(0,1,0))
|
||||||
|
local dnpos = vector.add(pos,vector.new(0,-1,0))
|
||||||
|
digistuff.vertical_autoconnect(uppos)
|
||||||
|
digistuff.vertical_autoconnect(dnpos)
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_node("digistuff:vertical_bottom", {
|
||||||
|
description = "Vertical Digiline",
|
||||||
|
tiles = {"digistuff_digiline_full.png"},
|
||||||
|
paramtype = "light",
|
||||||
|
groups = {dig_immediate = 3,vertical_digiline = 1,},
|
||||||
|
is_ground_content = false,
|
||||||
|
paramtype = "light",
|
||||||
|
drawtype = "nodebox",
|
||||||
|
node_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
{-0.5,-0.5,-0.5,0.5,-0.4375,0.5},
|
||||||
|
{-0.05,-0.4375,-0.05,0.05,0.5,0.05},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
after_place_node = digistuff.vertical_autoconnect,
|
||||||
|
after_destruct = digistuff.vertical_remove,
|
||||||
|
digiline = {
|
||||||
|
receptor = {},
|
||||||
|
wire = {
|
||||||
|
rules = {
|
||||||
|
{x = 1,y = 0,z = 0},
|
||||||
|
{x = -1,y = 0,z = 0},
|
||||||
|
{x = 0,y = 0,z = 1},
|
||||||
|
{x = 0,y = 0,z = -1},
|
||||||
|
{x = 0,y = 1,z = 0},
|
||||||
|
{x = 0,y = 2,z = 0},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("digistuff:vertical_middle", {
|
||||||
|
description = "Vertical Digiline (middle - you hacker you!)",
|
||||||
|
tiles = {"digistuff_digiline_full.png"},
|
||||||
|
paramtype = "light",
|
||||||
|
groups = {dig_immediate = 3,not_in_creative_inventory = 1,vertical_digiline = 1,},
|
||||||
|
drop = "digistuff:vertical_bottom",
|
||||||
|
is_ground_content = false,
|
||||||
|
paramtype = "light",
|
||||||
|
drawtype = "nodebox",
|
||||||
|
node_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
{-0.05,-0.5,-0.05,0.05,0.5,0.05},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
after_place_node = digistuff.vertical_autoconnect,
|
||||||
|
after_destruct = digistuff.vertical_remove,
|
||||||
|
digiline = {
|
||||||
|
receptor = {},
|
||||||
|
wire = {
|
||||||
|
rules = {
|
||||||
|
{x = 0,y = 1,z = 0},
|
||||||
|
{x = 0,y = -1,z = 0},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("digistuff:vertical_top", {
|
||||||
|
description = "Vertical Digiline (top - you hacker you!)",
|
||||||
|
tiles = {"digistuff_digiline_full.png"},
|
||||||
|
paramtype = "light",
|
||||||
|
groups = {dig_immediate = 3,not_in_creative_inventory = 1,vertical_digiline = 1,},
|
||||||
|
drop = "digistuff:vertical_bottom",
|
||||||
|
is_ground_content = false,
|
||||||
|
paramtype = "light",
|
||||||
|
drawtype = "nodebox",
|
||||||
|
node_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
{-0.5,-0.5,-0.5,0.5,-0.4375,0.5},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
after_place_node = digistuff.vertical_autoconnect,
|
||||||
|
after_destruct = digistuff.vertical_remove,
|
||||||
|
digiline = {
|
||||||
|
receptor = {},
|
||||||
|
wire = {
|
||||||
|
rules = {
|
||||||
|
{x = 1,y = 0,z = 0},
|
||||||
|
{x = -1,y = 0,z = 0},
|
||||||
|
{x = 0,y = 0,z = 1},
|
||||||
|
{x = 0,y = 0,z = -1},
|
||||||
|
{x = 0,y = -1,z = 0},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("digistuff:insulated_straight", {
|
||||||
|
description = "Insulated Digiline (straight)",
|
||||||
|
tiles = {
|
||||||
|
"digistuff_insulated_full.png",
|
||||||
|
"digistuff_insulated_full.png",
|
||||||
|
"digistuff_insulated_edge.png",
|
||||||
|
"digistuff_insulated_edge.png",
|
||||||
|
"digistuff_insulated_full.png",
|
||||||
|
"digistuff_insulated_full.png",
|
||||||
|
},
|
||||||
|
paramtype = "light",
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
on_rotate = minetest.get_modpath("screwdriver") and screwdriver.rotate_simple,
|
||||||
|
groups = {dig_immediate = 3,},
|
||||||
|
is_ground_content = false,
|
||||||
|
paramtype = "light",
|
||||||
|
drawtype = "nodebox",
|
||||||
|
node_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
{-0.5,-0.5,-0.1,0.5,-0.4,0.1},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
after_place_node = digilines.update_autoconnect,
|
||||||
|
after_destruct = digilines.update_autoconnect,
|
||||||
|
digiline = {
|
||||||
|
receptor = {},
|
||||||
|
wire = {
|
||||||
|
rules = function(node)
|
||||||
|
local rules = {
|
||||||
|
{x = 1,y = 0,z = 0},
|
||||||
|
{x = -1,y = 0,z = 0},
|
||||||
|
}
|
||||||
|
return digistuff.rotate_rules(rules,minetest.facedir_to_dir(node.param2))
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("digistuff:insulated_tjunction", {
|
||||||
|
description = "Insulated Digiline (T junction)",
|
||||||
|
tiles = {
|
||||||
|
"digistuff_insulated_full.png",
|
||||||
|
"digistuff_insulated_full.png",
|
||||||
|
"digistuff_insulated_edge.png",
|
||||||
|
"digistuff_insulated_edge.png",
|
||||||
|
"digistuff_insulated_full.png",
|
||||||
|
"digistuff_insulated_edge.png",
|
||||||
|
},
|
||||||
|
paramtype = "light",
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
on_rotate = minetest.get_modpath("screwdriver") and screwdriver.rotate_simple,
|
||||||
|
groups = {dig_immediate = 3,},
|
||||||
|
is_ground_content = false,
|
||||||
|
paramtype = "light",
|
||||||
|
drawtype = "nodebox",
|
||||||
|
node_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
{-0.5,-0.5,-0.1,0.5,-0.4,0.1},
|
||||||
|
{-0.1,-0.5,-0.5,0.1,-0.4,-0.1},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
after_place_node = digilines.update_autoconnect,
|
||||||
|
after_destruct = digilines.update_autoconnect,
|
||||||
|
digiline = {
|
||||||
|
receptor = {},
|
||||||
|
wire = {
|
||||||
|
rules = function(node)
|
||||||
|
local rules = {
|
||||||
|
{x = 1,y = 0,z = 0},
|
||||||
|
{x = -1,y = 0,z = 0},
|
||||||
|
{x = 0,y = 0,z = -1},
|
||||||
|
}
|
||||||
|
return digistuff.rotate_rules(rules,minetest.facedir_to_dir(node.param2))
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("digistuff:insulated_corner", {
|
||||||
|
description = "Insulated Digiline (corner)",
|
||||||
|
tiles = {
|
||||||
|
"digistuff_insulated_full.png",
|
||||||
|
"digistuff_insulated_full.png",
|
||||||
|
"digistuff_insulated_full.png",
|
||||||
|
"digistuff_insulated_edge.png",
|
||||||
|
"digistuff_insulated_full.png",
|
||||||
|
"digistuff_insulated_edge.png",
|
||||||
|
},
|
||||||
|
paramtype = "light",
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
on_rotate = minetest.get_modpath("screwdriver") and screwdriver.rotate_simple,
|
||||||
|
groups = {dig_immediate = 3,},
|
||||||
|
is_ground_content = false,
|
||||||
|
paramtype = "light",
|
||||||
|
drawtype = "nodebox",
|
||||||
|
node_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
{-0.1,-0.5,-0.5,0.1,-0.4,0.1},
|
||||||
|
{-0.5,-0.5,-0.1,0.1,-0.4,0.1},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
after_place_node = digilines.update_autoconnect,
|
||||||
|
after_destruct = digilines.update_autoconnect,
|
||||||
|
digiline = {
|
||||||
|
receptor = {},
|
||||||
|
wire = {
|
||||||
|
rules = function(node)
|
||||||
|
local rules = {
|
||||||
|
{x = -1,y = 0,z = 0},
|
||||||
|
{x = 0,y = 0,z = -1},
|
||||||
|
}
|
||||||
|
return digistuff.rotate_rules(rules,minetest.facedir_to_dir(node.param2))
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("digistuff:insulated_fourway", {
|
||||||
|
description = "Insulated Digiline (four-way junction)",
|
||||||
|
tiles = {
|
||||||
|
"digistuff_insulated_full.png",
|
||||||
|
"digistuff_insulated_full.png",
|
||||||
|
"digistuff_insulated_edge.png",
|
||||||
|
"digistuff_insulated_edge.png",
|
||||||
|
"digistuff_insulated_edge.png",
|
||||||
|
"digistuff_insulated_edge.png",
|
||||||
|
},
|
||||||
|
paramtype = "light",
|
||||||
|
groups = {dig_immediate = 3,},
|
||||||
|
is_ground_content = false,
|
||||||
|
paramtype = "light",
|
||||||
|
drawtype = "nodebox",
|
||||||
|
node_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
{-0.5,-0.5,-0.1,0.5,-0.4,0.1},
|
||||||
|
{-0.1,-0.5,-0.5,0.1,-0.4,-0.1},
|
||||||
|
{-0.1,-0.5,0.1,0.1,-0.4,0.5},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
after_place_node = digilines.update_autoconnect,
|
||||||
|
after_destruct = digilines.update_autoconnect,
|
||||||
|
digiline = {
|
||||||
|
receptor = {},
|
||||||
|
wire = {
|
||||||
|
rules = {
|
||||||
|
{x = 1,y = 0,z = 0},
|
||||||
|
{x = -1,y = 0,z = 0},
|
||||||
|
{x = 0,y = 0,z = -1},
|
||||||
|
{x = 0,y = 0,z = 1},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "digistuff:digimese",
|
||||||
|
recipe = {
|
||||||
|
{"digilines:wire_std_00000000","digilines:wire_std_00000000","digilines:wire_std_00000000"},
|
||||||
|
{"digilines:wire_std_00000000","default:mese","digilines:wire_std_00000000"},
|
||||||
|
{"digilines:wire_std_00000000","digilines:wire_std_00000000","digilines:wire_std_00000000"}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "digistuff:junctionbox",
|
output = "digistuff:junctionbox",
|
||||||
recipe = {
|
recipe = {
|
||||||
@ -60,3 +440,62 @@ minetest.register_craft({
|
|||||||
{"homedecor:plastic_sheeting","digilines:wire_std_00000000","homedecor:plastic_sheeting",},
|
{"homedecor:plastic_sheeting","digilines:wire_std_00000000","homedecor:plastic_sheeting",},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if minetest.get_modpath("mesecons_materials") then
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "digistuff:insulated_straight 3",
|
||||||
|
recipe = {
|
||||||
|
{"mesecons_materials:fiber","mesecons_materials:fiber","mesecons_materials:fiber",},
|
||||||
|
{"digilines:wire_std_00000000","digilines:wire_std_00000000","digilines:wire_std_00000000",},
|
||||||
|
{"mesecons_materials:fiber","mesecons_materials:fiber","mesecons_materials:fiber",},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "digistuff:vertical_bottom 3",
|
||||||
|
recipe = {
|
||||||
|
{"digilines:wire_std_00000000",},
|
||||||
|
{"digilines:wire_std_00000000",},
|
||||||
|
{"digilines:wire_std_00000000",},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "digistuff:insulated_corner 3",
|
||||||
|
recipe = {
|
||||||
|
{"digistuff:insulated_straight","digistuff:insulated_straight",},
|
||||||
|
{"","digistuff:insulated_straight",},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "digistuff:insulated_tjunction 4",
|
||||||
|
recipe = {
|
||||||
|
{"digistuff:insulated_straight","digistuff:insulated_straight","digistuff:insulated_straight",},
|
||||||
|
{"","digistuff:insulated_straight","",},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "digistuff:insulated_fourway 5",
|
||||||
|
recipe = {
|
||||||
|
{"","digistuff:insulated_straight","",},
|
||||||
|
{"digistuff:insulated_straight","digistuff:insulated_straight","digistuff:insulated_straight",},
|
||||||
|
{"","digistuff:insulated_straight","",},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
for _,item in ipairs({"digistuff:insulated_corner","digistuff:insulated_tjunction","digistuff:insulated_fourway",}) do
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "digistuff:insulated_straight",
|
||||||
|
type = "shapeless",
|
||||||
|
recipe = {item},
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "digilines:wire_std_00000000",
|
||||||
|
type = "shapeless",
|
||||||
|
recipe = {"digistuff:vertical_bottom"},
|
||||||
|
})
|
||||||
|
@ -2,3 +2,4 @@ default?
|
|||||||
digilines
|
digilines
|
||||||
mesecons?
|
mesecons?
|
||||||
mesecons_mvps?
|
mesecons_mvps?
|
||||||
|
screwdriver?
|
||||||
|
3
init.lua
3
init.lua
@ -1,6 +1,8 @@
|
|||||||
digistuff = {}
|
digistuff = {}
|
||||||
|
|
||||||
local components = {
|
local components = {
|
||||||
|
"internal",
|
||||||
|
"conductors",
|
||||||
"touchscreen",
|
"touchscreen",
|
||||||
"light",
|
"light",
|
||||||
"noteblock",
|
"noteblock",
|
||||||
@ -9,7 +11,6 @@ local components = {
|
|||||||
"panel",
|
"panel",
|
||||||
"piezo",
|
"piezo",
|
||||||
"detector",
|
"detector",
|
||||||
"conductors",
|
|
||||||
"piston",
|
"piston",
|
||||||
}
|
}
|
||||||
for _,name in ipairs(components) do
|
for _,name in ipairs(components) do
|
||||||
|
44
internal.lua
Normal file
44
internal.lua
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
digistuff.rotate_rules = function(rulesin,dir)
|
||||||
|
local rules = {}
|
||||||
|
for k,v in ipairs(rulesin) do rules[k] = v end
|
||||||
|
if dir.z > 0 then
|
||||||
|
return rules
|
||||||
|
elseif dir.z < 0 then
|
||||||
|
for _,i in ipairs(rules) do
|
||||||
|
i.x = -i.x
|
||||||
|
i.z = -i.z
|
||||||
|
end
|
||||||
|
return rules
|
||||||
|
elseif dir.x > 0 then
|
||||||
|
for _,i in ipairs(rules) do
|
||||||
|
local z = i.x
|
||||||
|
i.x = i.z
|
||||||
|
i.z = -z
|
||||||
|
end
|
||||||
|
return rules
|
||||||
|
elseif dir.x < 0 then
|
||||||
|
for _,i in ipairs(rules) do
|
||||||
|
local z = i.x
|
||||||
|
i.x = -i.z
|
||||||
|
i.z = z
|
||||||
|
end
|
||||||
|
return rules
|
||||||
|
elseif dir.y > 0 then
|
||||||
|
for _,i in ipairs(rules) do
|
||||||
|
local z = i.y
|
||||||
|
i.y = i.z
|
||||||
|
i.z = z
|
||||||
|
end
|
||||||
|
return rules
|
||||||
|
elseif dir.y < 0 then
|
||||||
|
for _,i in ipairs(rules) do
|
||||||
|
local z = i.y
|
||||||
|
i.y = -i.z
|
||||||
|
i.z = -z
|
||||||
|
end
|
||||||
|
return rules
|
||||||
|
else
|
||||||
|
minetest.log("warning",string.format("digistuff.rotate_rules() called with invalid direction %s,%s,%s",dir.x,dir.y,dir.z))
|
||||||
|
return {}
|
||||||
|
end
|
||||||
|
end
|
BIN
textures/digistuff_digiline_full.png
Normal file
BIN
textures/digistuff_digiline_full.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
BIN
textures/digistuff_insulated_edge.png
Normal file
BIN
textures/digistuff_insulated_edge.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
BIN
textures/digistuff_insulated_full.png
Normal file
BIN
textures/digistuff_insulated_full.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
Loading…
Reference in New Issue
Block a user