diff options
author | Vanessa Ezekowitz <vanessaezekowitz@gmail.com> | 2016-04-01 20:02:19 -0400 |
---|---|---|
committer | Vanessa Ezekowitz <vanessaezekowitz@gmail.com> | 2016-04-01 21:09:33 -0400 |
commit | da66780a569712c23ae4f2996cfb4608a9f9d69d (patch) | |
tree | 217556029a78bc23ad4564720afc86de97228a04 /mesecons/mesecons_gates | |
parent | 615b22df4d423aded3613db7716943a2f389b047 (diff) | |
download | dreambuilder_modpack-da66780a569712c23ae4f2996cfb4608a9f9d69d.tar dreambuilder_modpack-da66780a569712c23ae4f2996cfb4608a9f9d69d.tar.gz dreambuilder_modpack-da66780a569712c23ae4f2996cfb4608a9f9d69d.tar.bz2 dreambuilder_modpack-da66780a569712c23ae4f2996cfb4608a9f9d69d.tar.xz dreambuilder_modpack-da66780a569712c23ae4f2996cfb4608a9f9d69d.zip |
copy all standard Dreambuilder mods in from the old subgame
(exactly as last supplied there, updates to these mods will follow later)
Diffstat (limited to 'mesecons/mesecons_gates')
32 files changed, 147 insertions, 0 deletions
diff --git a/mesecons/mesecons_gates/depends.txt b/mesecons/mesecons_gates/depends.txt new file mode 100644 index 0000000..f3e0392 --- /dev/null +++ b/mesecons/mesecons_gates/depends.txt @@ -0,0 +1,6 @@ +mesecons +mesecons_microcontroller +mesecons_delayer + +mesecons_torch +mesecons_materials diff --git a/mesecons/mesecons_gates/doc/and/description.html b/mesecons/mesecons_gates/doc/and/description.html new file mode 100644 index 0000000..eafbeda --- /dev/null +++ b/mesecons/mesecons_gates/doc/and/description.html @@ -0,0 +1 @@ +And gates power their output if both inputs (from left and right) are powered. diff --git a/mesecons/mesecons_gates/doc/and/preview.png b/mesecons/mesecons_gates/doc/and/preview.png Binary files differnew file mode 100644 index 0000000..b2b5301 --- /dev/null +++ b/mesecons/mesecons_gates/doc/and/preview.png diff --git a/mesecons/mesecons_gates/doc/and/recipe.png b/mesecons/mesecons_gates/doc/and/recipe.png Binary files differnew file mode 100644 index 0000000..ae6bf63 --- /dev/null +++ b/mesecons/mesecons_gates/doc/and/recipe.png diff --git a/mesecons/mesecons_gates/doc/diode/description.html b/mesecons/mesecons_gates/doc/diode/description.html new file mode 100644 index 0000000..174fd64 --- /dev/null +++ b/mesecons/mesecons_gates/doc/diode/description.html @@ -0,0 +1 @@ +Mesecon diodes, just like real ones, only transfer power (signals) in one direction only. diff --git a/mesecons/mesecons_gates/doc/diode/preview.png b/mesecons/mesecons_gates/doc/diode/preview.png Binary files differnew file mode 100644 index 0000000..ced541b --- /dev/null +++ b/mesecons/mesecons_gates/doc/diode/preview.png diff --git a/mesecons/mesecons_gates/doc/diode/recipe.png b/mesecons/mesecons_gates/doc/diode/recipe.png Binary files differnew file mode 100644 index 0000000..71086bf --- /dev/null +++ b/mesecons/mesecons_gates/doc/diode/recipe.png diff --git a/mesecons/mesecons_gates/doc/nand/description.html b/mesecons/mesecons_gates/doc/nand/description.html new file mode 100644 index 0000000..a520fd2 --- /dev/null +++ b/mesecons/mesecons_gates/doc/nand/description.html @@ -0,0 +1 @@ +Nand gates do not power their output if both inputs (from left and right) are powered, but power it in every other case. diff --git a/mesecons/mesecons_gates/doc/nand/preview.png b/mesecons/mesecons_gates/doc/nand/preview.png Binary files differnew file mode 100644 index 0000000..d8db780 --- /dev/null +++ b/mesecons/mesecons_gates/doc/nand/preview.png diff --git a/mesecons/mesecons_gates/doc/nand/recipe.png b/mesecons/mesecons_gates/doc/nand/recipe.png Binary files differnew file mode 100644 index 0000000..e6118b3 --- /dev/null +++ b/mesecons/mesecons_gates/doc/nand/recipe.png diff --git a/mesecons/mesecons_gates/doc/nor/description.html b/mesecons/mesecons_gates/doc/nor/description.html new file mode 100644 index 0000000..cfcd4c0 --- /dev/null +++ b/mesecons/mesecons_gates/doc/nor/description.html @@ -0,0 +1 @@ +Nor gates only power their output if none of their two inputs is powered. They are basically or gates with a not gate at their output. diff --git a/mesecons/mesecons_gates/doc/nor/preview.png b/mesecons/mesecons_gates/doc/nor/preview.png Binary files differnew file mode 100644 index 0000000..b6d2781 --- /dev/null +++ b/mesecons/mesecons_gates/doc/nor/preview.png diff --git a/mesecons/mesecons_gates/doc/nor/recipe.png b/mesecons/mesecons_gates/doc/nor/recipe.png Binary files differnew file mode 100644 index 0000000..a2063c7 --- /dev/null +++ b/mesecons/mesecons_gates/doc/nor/recipe.png diff --git a/mesecons/mesecons_gates/doc/not/description.html b/mesecons/mesecons_gates/doc/not/description.html new file mode 100644 index 0000000..8bd6795 --- /dev/null +++ b/mesecons/mesecons_gates/doc/not/description.html @@ -0,0 +1 @@ +Not gates invert signals, just like a mesecon torch does, but faster. The input is at the opposite side of the output. diff --git a/mesecons/mesecons_gates/doc/not/preview.png b/mesecons/mesecons_gates/doc/not/preview.png Binary files differnew file mode 100644 index 0000000..4a33cd1 --- /dev/null +++ b/mesecons/mesecons_gates/doc/not/preview.png diff --git a/mesecons/mesecons_gates/doc/not/recipe.png b/mesecons/mesecons_gates/doc/not/recipe.png Binary files differnew file mode 100644 index 0000000..ee1c0d6 --- /dev/null +++ b/mesecons/mesecons_gates/doc/not/recipe.png diff --git a/mesecons/mesecons_gates/doc/or/description.html b/mesecons/mesecons_gates/doc/or/description.html new file mode 100644 index 0000000..0a74abd --- /dev/null +++ b/mesecons/mesecons_gates/doc/or/description.html @@ -0,0 +1 @@ +Or gates power their output if either of their inputs (or both) are powered. You could basically get the same behaviour with two diodes, but or gates save some space. diff --git a/mesecons/mesecons_gates/doc/or/preview.png b/mesecons/mesecons_gates/doc/or/preview.png Binary files differnew file mode 100644 index 0000000..b7a8cdc --- /dev/null +++ b/mesecons/mesecons_gates/doc/or/preview.png diff --git a/mesecons/mesecons_gates/doc/or/recipe.png b/mesecons/mesecons_gates/doc/or/recipe.png Binary files differnew file mode 100644 index 0000000..b94169d --- /dev/null +++ b/mesecons/mesecons_gates/doc/or/recipe.png diff --git a/mesecons/mesecons_gates/doc/xor/description.html b/mesecons/mesecons_gates/doc/xor/description.html new file mode 100644 index 0000000..f52f3fc --- /dev/null +++ b/mesecons/mesecons_gates/doc/xor/description.html @@ -0,0 +1 @@ +XOR gates power their output if only one input is powered, they're off if either both or none of the inputs is powered. diff --git a/mesecons/mesecons_gates/doc/xor/preview.png b/mesecons/mesecons_gates/doc/xor/preview.png Binary files differnew file mode 100644 index 0000000..3d3941e --- /dev/null +++ b/mesecons/mesecons_gates/doc/xor/preview.png diff --git a/mesecons/mesecons_gates/doc/xor/recipe.png b/mesecons/mesecons_gates/doc/xor/recipe.png Binary files differnew file mode 100644 index 0000000..1e129bf --- /dev/null +++ b/mesecons/mesecons_gates/doc/xor/recipe.png diff --git a/mesecons/mesecons_gates/init.lua b/mesecons/mesecons_gates/init.lua new file mode 100644 index 0000000..f3d6f09 --- /dev/null +++ b/mesecons/mesecons_gates/init.lua @@ -0,0 +1,134 @@ +local nodebox = { + type = "fixed", + fixed = {{-8/16, -8/16, -8/16, 8/16, -7/16, 8/16 }}, +} + +local function gate_rotate_rules(node, rules) + for rotations = 0, node.param2 - 1 do + rules = mesecon.rotate_rules_left(rules) + end + return rules +end + +local function gate_get_output_rules(node) + return gate_rotate_rules(node, {{x=1, y=0, z=0}}) +end + +local function gate_get_input_rules_oneinput(node) + return gate_rotate_rules(node, {{x=-1, y=0, z=0}}) +end + +local function gate_get_input_rules_twoinputs(node) + return gate_rotate_rules(node, {{x=0, y=0, z=1, name="input1"}, + {x=0, y=0, z=-1, name="input2"}}) +end + +local function set_gate(pos, node, state) + local gate = minetest.registered_nodes[node.name] + + if mesecon.do_overheat(pos) then + minetest.remove_node(pos) + mesecon.receptor_off(pos, gate_get_output_rules(node)) + minetest.add_item(pos, gate.drop) + elseif state then + minetest.swap_node(pos, {name = gate.onstate, param2=node.param2}) + mesecon.receptor_on(pos, gate_get_output_rules(node)) + else + minetest.swap_node(pos, {name = gate.offstate, param2=node.param2}) + mesecon.receptor_off(pos, gate_get_output_rules(node)) + end +end + +local function update_gate(pos, node, link, newstate) + local gate = minetest.registered_nodes[node.name] + + if gate.inputnumber == 1 then + set_gate(pos, node, gate.assess(newstate == "on")) + elseif gate.inputnumber == 2 then + local meta = minetest.get_meta(pos) + meta:set_int(link.name, newstate == "on" and 1 or 0) + + local val1 = meta:get_int("input1") == 1 + local val2 = meta:get_int("input2") == 1 + set_gate(pos, node, gate.assess(val1, val2)) + end +end + +function register_gate(name, inputnumber, assess, recipe) + local get_inputrules = inputnumber == 2 and gate_get_input_rules_twoinputs or + gate_get_input_rules_oneinput + local description = "Mesecons Logic Gate: "..name + + local basename = "mesecons_gates:"..name + mesecon.register_node(basename, { + description = description, + inventory_image = "jeija_gate_off.png^jeija_gate_"..name..".png", + paramtype = "light", + paramtype2 = "facedir", + drawtype = "nodebox", + drop = basename.."_off", + selection_box = nodebox, + node_box = nodebox, + walkable = true, + sounds = default.node_sound_stone_defaults(), + assess = assess, + onstate = basename.."_on", + offstate = basename.."_off", + inputnumber = inputnumber + },{ + tiles = {"jeija_microcontroller_bottom.png^".."jeija_gate_off.png^".. + "jeija_gate_"..name..".png"}, + groups = {dig_immediate = 2, overheat = 1}, + mesecons = { receptor = { + state = "off", + rules = gate_get_output_rules + }, effector = { + rules = get_inputrules, + action_change = update_gate + }} + },{ + tiles = {"jeija_microcontroller_bottom.png^".."jeija_gate_on.png^".. + "jeija_gate_"..name..".png"}, + groups = {dig_immediate = 2, not_in_creative_inventory = 1, overheat = 1}, + mesecons = { receptor = { + state = "on", + rules = gate_get_output_rules + }, effector = { + rules = get_inputrules, + action_change = update_gate + }} + }) + + minetest.register_craft({output = basename.."_off", recipe = recipe}) +end + +register_gate("diode", 1, function (input) return input end, + {{"mesecons:mesecon", "mesecons_torch:mesecon_torch_on", "mesecons_torch:mesecon_torch_on"}}) + +register_gate("not", 1, function (input) return not input end, + {{"mesecons:mesecon", "mesecons_torch:mesecon_torch_on", "mesecons:mesecon"}}) + +register_gate("and", 2, function (val1, val2) return val1 and val2 end, + {{"mesecons:mesecon", "", ""}, + {"", "mesecons_materials:silicon", "mesecons:mesecon"}, + {"mesecons:mesecon", "", ""}}) + +register_gate("nand", 2, function (val1, val2) return not (val1 and val2) end, + {{"mesecons:mesecon", "", ""}, + {"", "mesecons_materials:silicon", "mesecons_torch:mesecon_torch_on"}, + {"mesecons:mesecon", "", ""}}) + +register_gate("xor", 2, function (val1, val2) return (val1 or val2) and not (val1 and val2) end, + {{"mesecons:mesecon", "", ""}, + {"", "mesecons_materials:silicon", "mesecons_materials:silicon"}, + {"mesecons:mesecon", "", ""}}) + +register_gate("nor", 2, function (val1, val2) return not (val1 or val2) end, + {{"mesecons:mesecon", "", ""}, + {"", "mesecons:mesecon", "mesecons_torch:mesecon_torch_on"}, + {"mesecons:mesecon", "", ""}}) + +register_gate("or", 2, function (val1, val2) return (val1 or val2) end, + {{"mesecons:mesecon", "", ""}, + {"", "mesecons:mesecon", "mesecons:mesecon"}, + {"mesecons:mesecon", "", ""}}) diff --git a/mesecons/mesecons_gates/textures/jeija_gate_and.png b/mesecons/mesecons_gates/textures/jeija_gate_and.png Binary files differnew file mode 100644 index 0000000..0ddc043 --- /dev/null +++ b/mesecons/mesecons_gates/textures/jeija_gate_and.png diff --git a/mesecons/mesecons_gates/textures/jeija_gate_diode.png b/mesecons/mesecons_gates/textures/jeija_gate_diode.png Binary files differnew file mode 100644 index 0000000..ffa403f --- /dev/null +++ b/mesecons/mesecons_gates/textures/jeija_gate_diode.png diff --git a/mesecons/mesecons_gates/textures/jeija_gate_nand.png b/mesecons/mesecons_gates/textures/jeija_gate_nand.png Binary files differnew file mode 100644 index 0000000..0e4294e --- /dev/null +++ b/mesecons/mesecons_gates/textures/jeija_gate_nand.png diff --git a/mesecons/mesecons_gates/textures/jeija_gate_nor.png b/mesecons/mesecons_gates/textures/jeija_gate_nor.png Binary files differnew file mode 100644 index 0000000..c4298e3 --- /dev/null +++ b/mesecons/mesecons_gates/textures/jeija_gate_nor.png diff --git a/mesecons/mesecons_gates/textures/jeija_gate_not.png b/mesecons/mesecons_gates/textures/jeija_gate_not.png Binary files differnew file mode 100644 index 0000000..939fb76 --- /dev/null +++ b/mesecons/mesecons_gates/textures/jeija_gate_not.png diff --git a/mesecons/mesecons_gates/textures/jeija_gate_off.png b/mesecons/mesecons_gates/textures/jeija_gate_off.png Binary files differnew file mode 100644 index 0000000..44017b0 --- /dev/null +++ b/mesecons/mesecons_gates/textures/jeija_gate_off.png diff --git a/mesecons/mesecons_gates/textures/jeija_gate_on.png b/mesecons/mesecons_gates/textures/jeija_gate_on.png Binary files differnew file mode 100644 index 0000000..47028a8 --- /dev/null +++ b/mesecons/mesecons_gates/textures/jeija_gate_on.png diff --git a/mesecons/mesecons_gates/textures/jeija_gate_or.png b/mesecons/mesecons_gates/textures/jeija_gate_or.png Binary files differnew file mode 100644 index 0000000..09f0661 --- /dev/null +++ b/mesecons/mesecons_gates/textures/jeija_gate_or.png diff --git a/mesecons/mesecons_gates/textures/jeija_gate_xor.png b/mesecons/mesecons_gates/textures/jeija_gate_xor.png Binary files differnew file mode 100644 index 0000000..afbd6ab --- /dev/null +++ b/mesecons/mesecons_gates/textures/jeija_gate_xor.png |