diff options
author | Vanessa Ezekowitz <vanessaezekowitz@gmail.com> | 2016-04-01 21:00:20 -0400 |
---|---|---|
committer | Vanessa Ezekowitz <vanessaezekowitz@gmail.com> | 2016-04-01 21:10:04 -0400 |
commit | 888b0ebfec8c2eff9015163549a7e47443cb8665 (patch) | |
tree | 915080159bfaa6ba6e226087c7ce0e8d5464b518 /digilines/digilines | |
parent | da66780a569712c23ae4f2996cfb4608a9f9d69d (diff) | |
download | dreambuilder_modpack-888b0ebfec8c2eff9015163549a7e47443cb8665.tar dreambuilder_modpack-888b0ebfec8c2eff9015163549a7e47443cb8665.tar.gz dreambuilder_modpack-888b0ebfec8c2eff9015163549a7e47443cb8665.tar.bz2 dreambuilder_modpack-888b0ebfec8c2eff9015163549a7e47443cb8665.tar.xz dreambuilder_modpack-888b0ebfec8c2eff9015163549a7e47443cb8665.zip |
"explode" all modpacks into their individual components
(you can't have a modpack buried inside a modpack)
Diffstat (limited to 'digilines/digilines')
-rw-r--r-- | digilines/digilines/depends.txt | 1 | ||||
-rw-r--r-- | digilines/digilines/init.lua | 25 | ||||
-rw-r--r-- | digilines/digilines/internal.lua | 92 | ||||
-rw-r--r-- | digilines/digilines/presetrules.lua | 15 | ||||
-rw-r--r-- | digilines/digilines/textures/digiline_std.png | bin | 446 -> 0 bytes | |||
-rw-r--r-- | digilines/digilines/textures/digiline_std_bump.png | bin | 410 -> 0 bytes | |||
-rw-r--r-- | digilines/digilines/textures/digiline_std_inv.png | bin | 196 -> 0 bytes | |||
-rw-r--r-- | digilines/digilines/textures/digiline_std_vertical.png | bin | 378 -> 0 bytes | |||
-rw-r--r-- | digilines/digilines/util.lua | 67 | ||||
-rw-r--r-- | digilines/digilines/wire_std.lua | 118 | ||||
-rw-r--r-- | digilines/digilines/wires_common.lua | 88 |
11 files changed, 0 insertions, 406 deletions
diff --git a/digilines/digilines/depends.txt b/digilines/digilines/depends.txt deleted file mode 100644 index 4ad96d5..0000000 --- a/digilines/digilines/depends.txt +++ /dev/null @@ -1 +0,0 @@ -default diff --git a/digilines/digilines/init.lua b/digilines/digilines/init.lua deleted file mode 100644 index 92f916d..0000000 --- a/digilines/digilines/init.lua +++ /dev/null @@ -1,25 +0,0 @@ -digiline = {} -dofile(minetest.get_modpath("digilines").."/presetrules.lua") -dofile(minetest.get_modpath("digilines").."/util.lua") -dofile(minetest.get_modpath("digilines").."/internal.lua") -dofile(minetest.get_modpath("digilines").."/wires_common.lua") -dofile(minetest.get_modpath("digilines").."/wire_std.lua") - -function digiline:receptor_send(pos, rules, channel, msg) - local checked = {} - checked[tostring(pos.x).."_"..tostring(pos.y).."_"..tostring(pos.z)] = true -- exclude itself - for _,rule in ipairs(rules) do - if digiline:rules_link(pos, digiline:addPosRule(pos, rule)) then - digiline:transmit(digiline:addPosRule(pos, rule), channel, msg, checked) - end - end -end - -minetest.register_craft({ - output = 'digilines:wire_std_00000000 2', - recipe = { - {'mesecons_materials:fiber', 'mesecons_materials:fiber', 'mesecons_materials:fiber'}, - {'mesecons_insulated:insulated_off', 'mesecons_insulated:insulated_off', 'default:gold_ingot'}, - {'mesecons_materials:fiber', 'mesecons_materials:fiber', 'mesecons_materials:fiber'}, - } -})
\ No newline at end of file diff --git a/digilines/digilines/internal.lua b/digilines/digilines/internal.lua deleted file mode 100644 index f29cc8d..0000000 --- a/digilines/digilines/internal.lua +++ /dev/null @@ -1,92 +0,0 @@ -function digiline:getspec(node) - if not minetest.registered_nodes[node.name] then return false end - return minetest.registered_nodes[node.name].digiline -end - -function digiline:importrules(spec, node) - if type(spec) == 'function' then - return spec(node) - elseif spec then - return spec - else - return digiline.rules.default - end -end - -function digiline:getAnyInputRules(pos) - local node = minetest.get_node(pos) - local spec = digiline:getspec(node) - if not spec then return end - - if spec.wire then - return digiline:importrules(spec.wire.rules, node) - end - if spec.effector then - return digiline:importrules(spec.effector.rules, node) - end - - return rules -end - -function digiline:getAnyOutputRules(pos) - local node = minetest.get_node(pos) - local spec = digiline:getspec(node) - if not spec then return end - - if spec.wire then - return digiline:importrules(spec.wire.rules, node) - end - if spec.receptor then - return digiline:importrules(spec.receptor.rules, node) - end -end - -function digiline:rules_link(output, input) - local outputrules = digiline:getAnyOutputRules(output) - local inputrules = digiline:getAnyInputRules (input) - - if not outputrules or not inputrules then return false end - - - for _, orule in ipairs(outputrules) do - if digiline:cmpPos(digiline:addPosRule(output, orule), input) then - for _, irule in ipairs(inputrules) do - if digiline:cmpPos(digiline:addPosRule(input, irule), output) then - return true - end - end - end - end - return false -end - -function digiline:rules_link_anydir(output, input) - return digiline:rules_link(output, input) - or digiline:rules_link(input, output) -end - -function digiline:transmit(pos, channel, msg, checked) - local checkedid = tostring(pos.x).."_"..tostring(pos.y).."_"..tostring(pos.z) - if checked[checkedid] then return end - checked[checkedid] = true - - local node = minetest.get_node(pos) - local spec = digiline:getspec(node) - if not spec then return end - - - -- Effector actions --> Receive - if spec.effector then - spec.effector.action(pos, node, channel, msg) - end - - -- Cable actions --> Transmit - if spec.wire then - local rules = digiline:importrules(spec.wire.rules, node) - for _,rule in ipairs(rules) do - if digiline:rules_link(pos, digiline:addPosRule(pos, rule)) then - digiline:transmit(digiline:addPosRule(pos, rule), channel, msg, checked) - end - end - end -end diff --git a/digilines/digilines/presetrules.lua b/digilines/digilines/presetrules.lua deleted file mode 100644 index 8d5e35b..0000000 --- a/digilines/digilines/presetrules.lua +++ /dev/null @@ -1,15 +0,0 @@ -digiline.rules = {} - -digiline.rules.default = -{{x=0, y=0, z=-1}, -{x=1, y=0, z=0}, -{x=-1, y=0, z=0}, -{x=0, y=0, z=1}, -{x=1, y=1, z=0}, -{x=1, y=-1, z=0}, -{x=-1, y=1, z=0}, -{x=-1, y=-1, z=0}, -{x=0, y=1, z=1}, -{x=0, y=-1, z=1}, -{x=0, y=1, z=-1}, -{x=0, y=-1, z=-1}} diff --git a/digilines/digilines/textures/digiline_std.png b/digilines/digilines/textures/digiline_std.png Binary files differdeleted file mode 100644 index 721797c..0000000 --- a/digilines/digilines/textures/digiline_std.png +++ /dev/null diff --git a/digilines/digilines/textures/digiline_std_bump.png b/digilines/digilines/textures/digiline_std_bump.png Binary files differdeleted file mode 100644 index 068a4a9..0000000 --- a/digilines/digilines/textures/digiline_std_bump.png +++ /dev/null diff --git a/digilines/digilines/textures/digiline_std_inv.png b/digilines/digilines/textures/digiline_std_inv.png Binary files differdeleted file mode 100644 index f66f6c7..0000000 --- a/digilines/digilines/textures/digiline_std_inv.png +++ /dev/null diff --git a/digilines/digilines/textures/digiline_std_vertical.png b/digilines/digilines/textures/digiline_std_vertical.png Binary files differdeleted file mode 100644 index 1de0ead..0000000 --- a/digilines/digilines/textures/digiline_std_vertical.png +++ /dev/null diff --git a/digilines/digilines/util.lua b/digilines/digilines/util.lua deleted file mode 100644 index d138d63..0000000 --- a/digilines/digilines/util.lua +++ /dev/null @@ -1,67 +0,0 @@ -function digiline:addPosRule(p, r) - return {x = p.x + r.x, y = p.y + r.y, z = p.z + r.z} -end - -function digiline:cmpPos(p1, p2) - return (p1.x == p2.x and p1.y == p2.y and p1.z == p2.z) -end - ---Rules rotation Functions: -function digiline:rotate_rules_right(rules) - local nr={} - for i, rule in ipairs(rules) do - nr[i]={} - nr[i].z=rule.x - nr[i].x=-rule.z - nr[i].y=rule.y - end - return nr -end - -function digiline:rotate_rules_left(rules) - local nr={} - for i, rule in ipairs(rules) do - nr[i]={} - nr[i].z=-rules[i].x - nr[i].x=rules[i].z - nr[i].y=rules[i].y - end - return nr -end - -function digiline:rotate_rules_down(rules) - local nr={} - for i, rule in ipairs(rules) do - nr[i]={} - nr[i].y=rule.x - nr[i].x=-rule.y - nr[i].z=rule.z - end - return nr -end - -function digiline:rotate_rules_up(rules) - local nr={} - for i, rule in ipairs(rules) do - nr[i]={} - nr[i].y=-rule.x - nr[i].x=rule.y - nr[i].z=rule.z - end - return nr -end - -function digiline:tablecopy(table) -- deep table copy - if type(table) ~= "table" then return table end -- no need to copy - local newtable = {} - - for idx, item in pairs(table) do - if type(item) == "table" then - newtable[idx] = digiline:tablecopy(item) - else - newtable[idx] = item - end - end - - return newtable -end diff --git a/digilines/digilines/wire_std.lua b/digilines/digilines/wire_std.lua deleted file mode 100644 index 71bbd0f..0000000 --- a/digilines/digilines/wire_std.lua +++ /dev/null @@ -1,118 +0,0 @@ --- naming scheme: wire:(xp)(zp)(xm)(zm)_on/off --- The conditions in brackets define whether there is a digiline at that place or not --- 1 = there is one; 0 = there is none --- y always means y+ - -box_center = {-1/16, -.5, -1/16, 1/16, -.5+1/16, 1/16} -box_bump1 = { -2/16, -8/16, -2/16, 2/16, -13/32, 2/16 } -box_bump2 = { -3/32, -13/32, -3/32, 3/32, -12/32, 3/32 } - -box_xp = {1/16, -.5, -1/16, 8/16, -.5+1/16, 1/16} -box_zp = {-1/16, -.5, 1/16, 1/16, -.5+1/16, 8/16} -box_xm = {-8/16, -.5, -1/16, -1/16, -.5+1/16, 1/16} -box_zm = {-1/16, -.5, -8/16, 1/16, -.5+1/16, -1/16} - -box_xpy = {.5-1/16, -.5+1/16, -1/16, .5, .4999+1/16, 1/16} -box_zpy = {-1/16, -.5+1/16, .5-1/16, 1/16, .4999+1/16, .5} -box_xmy = {-.5, -.5+1/16, -1/16, -.5+1/16, .4999+1/16, 1/16} -box_zmy = {-1/16, -.5+1/16, -.5, 1/16, .4999+1/16, -.5+1/16} - -for xp=0, 1 do -for zp=0, 1 do -for xm=0, 1 do -for zm=0, 1 do -for xpy=0, 1 do -for zpy=0, 1 do -for xmy=0, 1 do -for zmy=0, 1 do - if (xpy == 1 and xp == 0) or (zpy == 1 and zp == 0) - or (xmy == 1 and xm == 0) or (zmy == 1 and zm == 0) then break end - - local groups - local nodeid = tostring(xp )..tostring(zp )..tostring(xm )..tostring(zm ).. - tostring(xpy)..tostring(zpy)..tostring(xmy)..tostring(zmy) - - if nodeid == "00000000" then - groups = {dig_immediate = 3} - wiredesc = "Digiline" - else - groups = {dig_immediate = 3, not_in_creative_inventory = 1} - end - - local nodebox = {} - local adjx = false - local adjz = false - if xp == 1 then table.insert(nodebox, box_xp) adjx = true end - if zp == 1 then table.insert(nodebox, box_zp) adjz = true end - if xm == 1 then table.insert(nodebox, box_xm) adjx = true end - if zm == 1 then table.insert(nodebox, box_zm) adjz = true end - if xpy == 1 then table.insert(nodebox, box_xpy) end - if zpy == 1 then table.insert(nodebox, box_zpy) end - if xmy == 1 then table.insert(nodebox, box_xmy) end - if zmy == 1 then table.insert(nodebox, box_zmy) end - - if adjx and adjz and (xp + zp + xm + zm > 2) then - table.insert(nodebox, box_bump1) - table.insert(nodebox, box_bump2) - tiles = { - "digiline_std_bump.png", - "digiline_std_bump.png", - "digiline_std_vertical.png", - "digiline_std_vertical.png", - "digiline_std_vertical.png", - "digiline_std_vertical.png" - } - else - table.insert(nodebox, box_center) - tiles = { - "digiline_std.png", - "digiline_std.png", - "digiline_std_vertical.png", - "digiline_std_vertical.png", - "digiline_std_vertical.png", - "digiline_std_vertical.png" - } - end - - if nodeid == "00000000" then - nodebox = {-8/16, -.5, -1/16, 8/16, -.5+1/16, 1/16} - end - - minetest.register_node("digilines:wire_std_"..nodeid, { - description = wiredesc, - drawtype = "nodebox", - tiles = tiles, - inventory_image = "digiline_std_inv.png", - wield_image = "digiline_std_inv.png", - paramtype = "light", - paramtype2 = "facedir", - sunlight_propagates = true, - digiline = - { - wire = - { - basename = "digilines:wire_std_", - use_autoconnect = true - } - }, - selection_box = { - type = "fixed", - fixed = {-.5, -.5, -.5, .5, -.5+1/16, .5} - }, - node_box = { - type = "fixed", - fixed = nodebox - }, - groups = groups, - walkable = false, - stack_max = 99, - drop = "digilines:wire_std_00000000" - }) -end -end -end -end -end -end -end -end diff --git a/digilines/digilines/wires_common.lua b/digilines/digilines/wires_common.lua deleted file mode 100644 index c5f761b..0000000 --- a/digilines/digilines/wires_common.lua +++ /dev/null @@ -1,88 +0,0 @@ -minetest.register_on_placenode(function(pos, node) - if minetest.registered_nodes[node.name].digiline then - digiline:update_autoconnect(pos) - end -end) - -minetest.register_on_dignode(function(pos, node) - if minetest.registered_nodes[node.name] and minetest.registered_nodes[node.name].digiline then --- need to make sure that node exists (unknown nodes!) - digiline:update_autoconnect(pos) - end -end) - -function digiline:update_autoconnect(pos, secondcall) - local xppos = {x=pos.x+1, y=pos.y, z=pos.z} - local zppos = {x=pos.x, y=pos.y, z=pos.z+1} - local xmpos = {x=pos.x-1, y=pos.y, z=pos.z} - local zmpos = {x=pos.x, y=pos.y, z=pos.z-1} - local xpympos = {x=pos.x+1, y=pos.y-1, z=pos.z} - local zpympos = {x=pos.x, y=pos.y-1, z=pos.z+1} - local xmympos = {x=pos.x-1, y=pos.y-1, z=pos.z} - local zmympos = {x=pos.x, y=pos.y-1, z=pos.z-1} - local xpypos = {x=pos.x+1, y=pos.y+1, z=pos.z} - local zpypos = {x=pos.x, y=pos.y+1, z=pos.z+1} - local xmypos = {x=pos.x-1, y=pos.y+1, z=pos.z} - local zmypos = {x=pos.x, y=pos.y+1, z=pos.z-1} - - if secondcall == nil then - digiline:update_autoconnect(xppos, true) - digiline:update_autoconnect(zppos, true) - digiline:update_autoconnect(xmpos, true) - digiline:update_autoconnect(zmpos, true) - - digiline:update_autoconnect(xpypos, true) - digiline:update_autoconnect(zpypos, true) - digiline:update_autoconnect(xmypos, true) - digiline:update_autoconnect(zmypos, true) - - digiline:update_autoconnect(xpympos, true) - digiline:update_autoconnect(zpympos, true) - digiline:update_autoconnect(xmympos, true) - digiline:update_autoconnect(zmympos, true) - end - - local def = minetest.registered_nodes[minetest.get_node(pos).name] - local digilinespec = def and def.digiline - if not (digilinespec and digilinespec.wire and - digilinespec.wire.use_autoconnect) then - return nil - end - - local zmg = digiline:rules_link_anydir(pos, zmpos) - local zmymg = digiline:rules_link_anydir(pos, zmympos) - local xmg = digiline:rules_link_anydir(pos, xmpos) - local xmymg = digiline:rules_link_anydir(pos, xmympos) - local zpg = digiline:rules_link_anydir(pos, zppos) - local zpymg = digiline:rules_link_anydir(pos, zpympos) - local xpg = digiline:rules_link_anydir(pos, xppos) - local xpymg = digiline:rules_link_anydir(pos, xpympos) - - - local xpyg = digiline:rules_link_anydir(pos, xpypos) - local zpyg = digiline:rules_link_anydir(pos, zpypos) - local xmyg = digiline:rules_link_anydir(pos, xmypos) - local zmyg = digiline:rules_link_anydir(pos, zmypos) - - local zm, xm, zp, xp, xpy, zpy, xmy, zmy - if zmg or zmymg then zm = 1 else zm = 0 end - if xmg or xmymg then xm = 1 else xm = 0 end - if zpg or zpymg then zp = 1 else zp = 0 end - if xpg or xpymg then xp = 1 else xp = 0 end - - if xpyg then xpy = 1 else xpy = 0 end - if zpyg then zpy = 1 else zpy = 0 end - if xmyg then xmy = 1 else xmy = 0 end - if zmyg then zmy = 1 else zmy = 0 end - - if xpy == 1 then xp = 1 end - if zpy == 1 then zp = 1 end - if xmy == 1 then xm = 1 end - if zmy == 1 then zm = 1 end - - local nodeid = tostring(xp )..tostring(zp )..tostring(xm )..tostring(zm ).. - tostring(xpy)..tostring(zpy)..tostring(xmy)..tostring(zmy) - - - minetest.set_node(pos, {name = digilinespec.wire.basename..nodeid}) -end |