summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeija <norrepli@gmail.com>2012-08-10 18:58:21 +0200
committerJeija <norrepli@gmail.com>2012-08-10 18:58:21 +0200
commit8fa68949531430456cece238ca585dfd235ca76e (patch)
tree9db5ce2236009cbcc60f28042a6a047a8578989a
parentfe6c9f3e09b317a9b5d6e20f4d91ff7699e75918 (diff)
downloadmesecons-8fa68949531430456cece238ca585dfd235ca76e.tar
mesecons-8fa68949531430456cece238ca585dfd235ca76e.tar.gz
mesecons-8fa68949531430456cece238ca585dfd235ca76e.tar.bz2
mesecons-8fa68949531430456cece238ca585dfd235ca76e.tar.xz
mesecons-8fa68949531430456cece238ca585dfd235ca76e.zip
Consistency improvement and remove dead code
-rw-r--r--mesecons/init.lua27
-rw-r--r--mesecons/internal_api.lua10
2 files changed, 11 insertions, 26 deletions
diff --git a/mesecons/init.lua b/mesecons/init.lua
index b67e88a..7142e8a 100644
--- a/mesecons/init.lua
+++ b/mesecons/init.lua
@@ -138,8 +138,6 @@ minetest.register_craft({
}
})
-mesecon:register_conductor("mesecons:mesecon_on", "mesecons:mesecon_off")
-
-- API API API API API API API API API API API API API API API API API API
function mesecon:add_receptor_node(nodename, rules, get_rules) --rules table is optional; if rules depend on param2 pass (nodename, nil, function get_rules)
@@ -207,6 +205,16 @@ function mesecon:register_on_signal_change(action)
mesecon.actions_change[i]=action
end
+function mesecon:register_conductor (onstate, offstate)
+ local i=0
+ while mesecon.conductors[i]~=nil do
+ i=i+1
+ end
+ mesecon.conductors[i]={}
+ mesecon.conductors[i].on=onstate
+ mesecon.conductors[i].off=offstate
+end
+
mesecon:add_rules("default",
{{x=0, y=0, z=-1},
{x=1, y=0, z=0},
@@ -223,17 +231,4 @@ mesecon:add_rules("default",
print("[MESEcons] Main mod Loaded!")
---minetest.register_on_newplayer(function(player)
- --local i=1
- --while mesecon.wireless_receivers[i]~=nil do
- -- pos=mesecon.wireless_receivers[i].pos
- -- request=mesecon.wireless_receivers[i].requested_state
- -- inverting=mesecon.wireless_receivers[i].inverting
- -- if request==inverting then
- -- mesecon:receptor_off(pos)
- -- end
- -- if request~=inverting then
- -- mesecon:receptor_on(pos)
- -- end
- --end
---end)
+mesecon:register_conductor("mesecons:mesecon_on", "mesecons:mesecon_off")
diff --git a/mesecons/internal_api.lua b/mesecons/internal_api.lua
index ef0c3df..f2b097a 100644
--- a/mesecons/internal_api.lua
+++ b/mesecons/internal_api.lua
@@ -117,16 +117,6 @@ end
--Conductor system stuff
-function mesecon:register_conductor(onstate, offstate)
- local i=0
- while mesecon.conductors[i]~=nil do
- i=i+1
- end
- mesecon.conductors[i]={}
- mesecon.conductors[i].on=onstate
- mesecon.conductors[i].off=offstate
-end
-
function mesecon:get_conductor_on(offstate)
local i=0
while mesecon.conductors[i]~=nil do