From da66780a569712c23ae4f2996cfb4608a9f9d69d Mon Sep 17 00:00:00 2001 From: Vanessa Ezekowitz Date: Fri, 1 Apr 2016 20:02:19 -0400 Subject: copy all standard Dreambuilder mods in from the old subgame (exactly as last supplied there, updates to these mods will follow later) --- mesecons/mesecons_gates/depends.txt | 6 + mesecons/mesecons_gates/doc/and/description.html | 1 + mesecons/mesecons_gates/doc/and/preview.png | Bin 0 -> 69906 bytes mesecons/mesecons_gates/doc/and/recipe.png | Bin 0 -> 2732 bytes mesecons/mesecons_gates/doc/diode/description.html | 1 + mesecons/mesecons_gates/doc/diode/preview.png | Bin 0 -> 72562 bytes mesecons/mesecons_gates/doc/diode/recipe.png | Bin 0 -> 2058 bytes mesecons/mesecons_gates/doc/nand/description.html | 1 + mesecons/mesecons_gates/doc/nand/preview.png | Bin 0 -> 63320 bytes mesecons/mesecons_gates/doc/nand/recipe.png | Bin 0 -> 2733 bytes mesecons/mesecons_gates/doc/nor/description.html | 1 + mesecons/mesecons_gates/doc/nor/preview.png | Bin 0 -> 27039 bytes mesecons/mesecons_gates/doc/nor/recipe.png | Bin 0 -> 2468 bytes mesecons/mesecons_gates/doc/not/description.html | 1 + mesecons/mesecons_gates/doc/not/preview.png | Bin 0 -> 70313 bytes mesecons/mesecons_gates/doc/not/recipe.png | Bin 0 -> 2083 bytes mesecons/mesecons_gates/doc/or/description.html | 1 + mesecons/mesecons_gates/doc/or/preview.png | Bin 0 -> 26286 bytes mesecons/mesecons_gates/doc/or/recipe.png | Bin 0 -> 2417 bytes mesecons/mesecons_gates/doc/xor/description.html | 1 + mesecons/mesecons_gates/doc/xor/preview.png | Bin 0 -> 70940 bytes mesecons/mesecons_gates/doc/xor/recipe.png | Bin 0 -> 2659 bytes mesecons/mesecons_gates/init.lua | 134 +++++++++++++++++++++ .../mesecons_gates/textures/jeija_gate_and.png | Bin 0 -> 233 bytes .../mesecons_gates/textures/jeija_gate_diode.png | Bin 0 -> 231 bytes .../mesecons_gates/textures/jeija_gate_nand.png | Bin 0 -> 251 bytes .../mesecons_gates/textures/jeija_gate_nor.png | Bin 0 -> 251 bytes .../mesecons_gates/textures/jeija_gate_not.png | Bin 0 -> 241 bytes .../mesecons_gates/textures/jeija_gate_off.png | Bin 0 -> 195 bytes mesecons/mesecons_gates/textures/jeija_gate_on.png | Bin 0 -> 195 bytes mesecons/mesecons_gates/textures/jeija_gate_or.png | Bin 0 -> 243 bytes .../mesecons_gates/textures/jeija_gate_xor.png | Bin 0 -> 245 bytes 32 files changed, 147 insertions(+) create mode 100644 mesecons/mesecons_gates/depends.txt create mode 100644 mesecons/mesecons_gates/doc/and/description.html create mode 100644 mesecons/mesecons_gates/doc/and/preview.png create mode 100644 mesecons/mesecons_gates/doc/and/recipe.png create mode 100644 mesecons/mesecons_gates/doc/diode/description.html create mode 100644 mesecons/mesecons_gates/doc/diode/preview.png create mode 100644 mesecons/mesecons_gates/doc/diode/recipe.png create mode 100644 mesecons/mesecons_gates/doc/nand/description.html create mode 100644 mesecons/mesecons_gates/doc/nand/preview.png create mode 100644 mesecons/mesecons_gates/doc/nand/recipe.png create mode 100644 mesecons/mesecons_gates/doc/nor/description.html create mode 100644 mesecons/mesecons_gates/doc/nor/preview.png create mode 100644 mesecons/mesecons_gates/doc/nor/recipe.png create mode 100644 mesecons/mesecons_gates/doc/not/description.html create mode 100644 mesecons/mesecons_gates/doc/not/preview.png create mode 100644 mesecons/mesecons_gates/doc/not/recipe.png create mode 100644 mesecons/mesecons_gates/doc/or/description.html create mode 100644 mesecons/mesecons_gates/doc/or/preview.png create mode 100644 mesecons/mesecons_gates/doc/or/recipe.png create mode 100644 mesecons/mesecons_gates/doc/xor/description.html create mode 100644 mesecons/mesecons_gates/doc/xor/preview.png create mode 100644 mesecons/mesecons_gates/doc/xor/recipe.png create mode 100644 mesecons/mesecons_gates/init.lua create mode 100644 mesecons/mesecons_gates/textures/jeija_gate_and.png create mode 100644 mesecons/mesecons_gates/textures/jeija_gate_diode.png create mode 100644 mesecons/mesecons_gates/textures/jeija_gate_nand.png create mode 100644 mesecons/mesecons_gates/textures/jeija_gate_nor.png create mode 100644 mesecons/mesecons_gates/textures/jeija_gate_not.png create mode 100644 mesecons/mesecons_gates/textures/jeija_gate_off.png create mode 100644 mesecons/mesecons_gates/textures/jeija_gate_on.png create mode 100644 mesecons/mesecons_gates/textures/jeija_gate_or.png create mode 100644 mesecons/mesecons_gates/textures/jeija_gate_xor.png (limited to 'mesecons/mesecons_gates') 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 new file mode 100644 index 0000000..b2b5301 Binary files /dev/null and b/mesecons/mesecons_gates/doc/and/preview.png differ diff --git a/mesecons/mesecons_gates/doc/and/recipe.png b/mesecons/mesecons_gates/doc/and/recipe.png new file mode 100644 index 0000000..ae6bf63 Binary files /dev/null and b/mesecons/mesecons_gates/doc/and/recipe.png differ 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 new file mode 100644 index 0000000..ced541b Binary files /dev/null and b/mesecons/mesecons_gates/doc/diode/preview.png differ diff --git a/mesecons/mesecons_gates/doc/diode/recipe.png b/mesecons/mesecons_gates/doc/diode/recipe.png new file mode 100644 index 0000000..71086bf Binary files /dev/null and b/mesecons/mesecons_gates/doc/diode/recipe.png differ 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 new file mode 100644 index 0000000..d8db780 Binary files /dev/null and b/mesecons/mesecons_gates/doc/nand/preview.png differ diff --git a/mesecons/mesecons_gates/doc/nand/recipe.png b/mesecons/mesecons_gates/doc/nand/recipe.png new file mode 100644 index 0000000..e6118b3 Binary files /dev/null and b/mesecons/mesecons_gates/doc/nand/recipe.png differ 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 new file mode 100644 index 0000000..b6d2781 Binary files /dev/null and b/mesecons/mesecons_gates/doc/nor/preview.png differ diff --git a/mesecons/mesecons_gates/doc/nor/recipe.png b/mesecons/mesecons_gates/doc/nor/recipe.png new file mode 100644 index 0000000..a2063c7 Binary files /dev/null and b/mesecons/mesecons_gates/doc/nor/recipe.png differ 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 new file mode 100644 index 0000000..4a33cd1 Binary files /dev/null and b/mesecons/mesecons_gates/doc/not/preview.png differ diff --git a/mesecons/mesecons_gates/doc/not/recipe.png b/mesecons/mesecons_gates/doc/not/recipe.png new file mode 100644 index 0000000..ee1c0d6 Binary files /dev/null and b/mesecons/mesecons_gates/doc/not/recipe.png differ 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 new file mode 100644 index 0000000..b7a8cdc Binary files /dev/null and b/mesecons/mesecons_gates/doc/or/preview.png differ diff --git a/mesecons/mesecons_gates/doc/or/recipe.png b/mesecons/mesecons_gates/doc/or/recipe.png new file mode 100644 index 0000000..b94169d Binary files /dev/null and b/mesecons/mesecons_gates/doc/or/recipe.png differ 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 new file mode 100644 index 0000000..3d3941e Binary files /dev/null and b/mesecons/mesecons_gates/doc/xor/preview.png differ diff --git a/mesecons/mesecons_gates/doc/xor/recipe.png b/mesecons/mesecons_gates/doc/xor/recipe.png new file mode 100644 index 0000000..1e129bf Binary files /dev/null and b/mesecons/mesecons_gates/doc/xor/recipe.png differ 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 new file mode 100644 index 0000000..0ddc043 Binary files /dev/null and b/mesecons/mesecons_gates/textures/jeija_gate_and.png differ diff --git a/mesecons/mesecons_gates/textures/jeija_gate_diode.png b/mesecons/mesecons_gates/textures/jeija_gate_diode.png new file mode 100644 index 0000000..ffa403f Binary files /dev/null and b/mesecons/mesecons_gates/textures/jeija_gate_diode.png differ diff --git a/mesecons/mesecons_gates/textures/jeija_gate_nand.png b/mesecons/mesecons_gates/textures/jeija_gate_nand.png new file mode 100644 index 0000000..0e4294e Binary files /dev/null and b/mesecons/mesecons_gates/textures/jeija_gate_nand.png differ diff --git a/mesecons/mesecons_gates/textures/jeija_gate_nor.png b/mesecons/mesecons_gates/textures/jeija_gate_nor.png new file mode 100644 index 0000000..c4298e3 Binary files /dev/null and b/mesecons/mesecons_gates/textures/jeija_gate_nor.png differ diff --git a/mesecons/mesecons_gates/textures/jeija_gate_not.png b/mesecons/mesecons_gates/textures/jeija_gate_not.png new file mode 100644 index 0000000..939fb76 Binary files /dev/null and b/mesecons/mesecons_gates/textures/jeija_gate_not.png differ diff --git a/mesecons/mesecons_gates/textures/jeija_gate_off.png b/mesecons/mesecons_gates/textures/jeija_gate_off.png new file mode 100644 index 0000000..44017b0 Binary files /dev/null and b/mesecons/mesecons_gates/textures/jeija_gate_off.png differ diff --git a/mesecons/mesecons_gates/textures/jeija_gate_on.png b/mesecons/mesecons_gates/textures/jeija_gate_on.png new file mode 100644 index 0000000..47028a8 Binary files /dev/null and b/mesecons/mesecons_gates/textures/jeija_gate_on.png differ diff --git a/mesecons/mesecons_gates/textures/jeija_gate_or.png b/mesecons/mesecons_gates/textures/jeija_gate_or.png new file mode 100644 index 0000000..09f0661 Binary files /dev/null and b/mesecons/mesecons_gates/textures/jeija_gate_or.png differ diff --git a/mesecons/mesecons_gates/textures/jeija_gate_xor.png b/mesecons/mesecons_gates/textures/jeija_gate_xor.png new file mode 100644 index 0000000..afbd6ab Binary files /dev/null and b/mesecons/mesecons_gates/textures/jeija_gate_xor.png differ -- cgit v1.2.3