diff options
Diffstat (limited to 'mesecons_gates/init.lua')
-rw-r--r-- | mesecons_gates/init.lua | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/mesecons_gates/init.lua b/mesecons_gates/init.lua index 57815ef..13e583b 100644 --- a/mesecons_gates/init.lua +++ b/mesecons_gates/init.lua @@ -54,10 +54,10 @@ local function update_gate(pos, node, link, newstate) end end -local function register_gate(name, inputnumber, assess, recipe) +local function register_gate(name, inputnumber, assess, recipe, description) local get_inputrules = inputnumber == 2 and gate_get_input_rules_twoinputs or gate_get_input_rules_oneinput - local description = "Mesecons Logic Gate: "..name + description = "Logic Gate: "..name local basename = "mesecons_gates:"..name mesecon.register_node(basename, { @@ -103,32 +103,39 @@ local function register_gate(name, inputnumber, assess, recipe) end register_gate("diode", 1, function (input) return input end, - {{"mesecons:mesecon", "mesecons_torch:mesecon_torch_on", "mesecons_torch:mesecon_torch_on"}}) + {{"mesecons:mesecon", "mesecons_torch:mesecon_torch_on", "mesecons_torch:mesecon_torch_on"}}, + "Diode") register_gate("not", 1, function (input) return not input end, - {{"mesecons:mesecon", "mesecons_torch:mesecon_torch_on", "mesecons:mesecon"}}) + {{"mesecons:mesecon", "mesecons_torch:mesecon_torch_on", "mesecons:mesecon"}}, + "NOT Gate") register_gate("and", 2, function (val1, val2) return val1 and val2 end, {{"mesecons:mesecon", "", ""}, {"", "mesecons_materials:silicon", "mesecons:mesecon"}, - {"mesecons:mesecon", "", ""}}) + {"mesecons:mesecon", "", ""}}, + "AND Gate") 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", "", ""}}) + {"mesecons:mesecon", "", ""}}, + "NAND Gate") 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", "", ""}}) + {"mesecons:mesecon", "", ""}}, + "XOR Gate") register_gate("nor", 2, function (val1, val2) return not (val1 or val2) end, {{"mesecons:mesecon", "", ""}, {"", "mesecons:mesecon", "mesecons_torch:mesecon_torch_on"}, - {"mesecons:mesecon", "", ""}}) + {"mesecons:mesecon", "", ""}}, + "NOR Gate") register_gate("or", 2, function (val1, val2) return (val1 or val2) end, {{"mesecons:mesecon", "", ""}, {"", "mesecons:mesecon", "mesecons:mesecon"}, - {"mesecons:mesecon", "", ""}}) + {"mesecons:mesecon", "", ""}}, + "OR Gate") |