summaryrefslogtreecommitdiff
path: root/mesecons
diff options
context:
space:
mode:
Diffstat (limited to 'mesecons')
-rw-r--r--mesecons/init.lua26
-rw-r--r--mesecons/presets.lua13
-rw-r--r--mesecons/textures/jeija_microcontroller_LED_A.pngbin0 -> 1240 bytes
-rw-r--r--mesecons/textures/jeija_microcontroller_LED_B.pngbin0 -> 1239 bytes
-rw-r--r--mesecons/textures/jeija_microcontroller_LED_C.pngbin0 -> 1240 bytes
-rw-r--r--mesecons/textures/jeija_microcontroller_LED_D.pngbin0 -> 1239 bytes
-rw-r--r--mesecons/util.lua5
7 files changed, 14 insertions, 30 deletions
diff --git a/mesecons/init.lua b/mesecons/init.lua
index 7da3583..83e611b 100644
--- a/mesecons/init.lua
+++ b/mesecons/init.lua
@@ -3,7 +3,7 @@
-- | \/ | |___ ____ |___ | | | | \ | |____
-- | | | | | | | | | \ | |
-- | | |___ ____| |___ |____ |____| | \| ____|
--- by Jeija, Uberi (Temperest), sfan5, VanessaE
+-- by Jeija, Uberi (Temperest), sfan5, VanessaE, Hawk777 and contributors
--
--
--
@@ -11,7 +11,7 @@
-- See the documentation on the forum for additional information, especially about crafting
--
--
--- For developer documentation see the Developers' section on mesecons.TK
+-- For basic development resources, see http://mesecons.net/developers.html
--
--
--
@@ -74,17 +74,7 @@ mesecon.queue:add_function("receptor_on", function (pos, rules)
rules = rules or mesecon.rules.default
- -- if area (any of the rule targets) is not loaded, keep trying and call this again later
- for _, rule in ipairs(mesecon.flattenrules(rules)) do
- local np = vector.add(pos, rule)
- -- if area is not loaded, keep trying
- if minetest.get_node_or_nil(np) == nil then
- mesecon.queue:add_action(pos, "receptor_on", {rules}, nil, rules)
- return
- end
- end
-
- -- execute action
+ -- Call turnon on all linking positions
for _, rule in ipairs(mesecon.flattenrules(rules)) do
local np = vector.add(pos, rule)
local rulenames = mesecon.rules_link_rule_all(pos, rule)
@@ -103,15 +93,7 @@ end
mesecon.queue:add_function("receptor_off", function (pos, rules)
rules = rules or mesecon.rules.default
- -- if area (any of the rule targets) is not loaded, keep trying and call this again later
- for _, rule in ipairs(mesecon.flattenrules(rules)) do
- local np = vector.add(pos, rule)
- if minetest.get_node_or_nil(np) == nil then
- mesecon.queue:add_action(pos, "receptor_off", {rules}, nil, rules)
- return
- end
- end
-
+ -- Call turnoff on all linking positions
for _, rule in ipairs(mesecon.flattenrules(rules)) do
local np = vector.add(pos, rule)
local rulenames = mesecon.rules_link_rule_all(pos, rule)
diff --git a/mesecons/presets.lua b/mesecons/presets.lua
index 2f2f643..8c3ed67 100644
--- a/mesecons/presets.lua
+++ b/mesecons/presets.lua
@@ -41,12 +41,19 @@ mesecon.rules.alldirs =
mesecon.rules.buttonlike_get = function(node)
local rules = mesecon.rules.buttonlike
- if node.param2 == 2 then
+ local dir = minetest.facedir_to_dir(node.param2)
+ if dir.x == 1 then
+ -- No action needed
+ elseif dir.z == -1 then
rules=mesecon.rotate_rules_left(rules)
- elseif node.param2 == 3 then
+ elseif dir.x == -1 then
rules=mesecon.rotate_rules_right(mesecon.rotate_rules_right(rules))
- elseif node.param2 == 0 then
+ elseif dir.z == 1 then
rules=mesecon.rotate_rules_right(rules)
+ elseif dir.y == -1 then
+ rules=mesecon.rotate_rules_up(rules)
+ elseif dir.y == 1 then
+ rules=mesecon.rotate_rules_down(rules)
end
return rules
end
diff --git a/mesecons/textures/jeija_microcontroller_LED_A.png b/mesecons/textures/jeija_microcontroller_LED_A.png
new file mode 100644
index 0000000..64526cf
--- /dev/null
+++ b/mesecons/textures/jeija_microcontroller_LED_A.png
Binary files differ
diff --git a/mesecons/textures/jeija_microcontroller_LED_B.png b/mesecons/textures/jeija_microcontroller_LED_B.png
new file mode 100644
index 0000000..1f7b451
--- /dev/null
+++ b/mesecons/textures/jeija_microcontroller_LED_B.png
Binary files differ
diff --git a/mesecons/textures/jeija_microcontroller_LED_C.png b/mesecons/textures/jeija_microcontroller_LED_C.png
new file mode 100644
index 0000000..399cc2c
--- /dev/null
+++ b/mesecons/textures/jeija_microcontroller_LED_C.png
Binary files differ
diff --git a/mesecons/textures/jeija_microcontroller_LED_D.png b/mesecons/textures/jeija_microcontroller_LED_D.png
new file mode 100644
index 0000000..506389c
--- /dev/null
+++ b/mesecons/textures/jeija_microcontroller_LED_D.png
Binary files differ
diff --git a/mesecons/util.lua b/mesecons/util.lua
index c9ba7fc..39f5696 100644
--- a/mesecons/util.lua
+++ b/mesecons/util.lua
@@ -231,11 +231,6 @@ local function hash_blockpos(pos)
})
end
--- convert block hash --> node position
-local function unhash_blockpos(hash)
- return vector.multiply(minetest.get_position_from_hash(hash), BLOCKSIZE)
-end
-
-- Maps from a hashed mapblock position (as returned by hash_blockpos) to a
-- table.
--