diff options
author | cheapie <no-email-for-you@example.com> | 2018-09-01 07:57:57 -0500 |
---|---|---|
committer | cheapie <no-email-for-you@example.com> | 2018-09-01 07:57:57 -0500 |
commit | e23a308a1fe0c11ee45332c074ef2351f98c6e3d (patch) | |
tree | fae3e5795f7decaf4df72bce9c1840770b012ab9 | |
parent | ff236643afc815f42f41e2b7524dac385e25c817 (diff) | |
download | digistuff-e23a308a1fe0c11ee45332c074ef2351f98c6e3d.tar digistuff-e23a308a1fe0c11ee45332c074ef2351f98c6e3d.tar.gz digistuff-e23a308a1fe0c11ee45332c074ef2351f98c6e3d.tar.bz2 digistuff-e23a308a1fe0c11ee45332c074ef2351f98c6e3d.tar.xz digistuff-e23a308a1fe0c11ee45332c074ef2351f98c6e3d.zip |
Allow lights to be controlled by strings as well
-rw-r--r-- | init.lua | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -1039,8 +1039,9 @@ for i=0,14,1 do action = function(pos,node,channel,msg) local meta = minetest.get_meta(pos) if meta:get_string("channel") ~= channel then return end - if type(msg) ~= "number" or msg > 14 or msg < 0 then return end - node.name = "digistuff:light_"..math.floor(msg) + local value = tonumber(msg) + if (not value) or value > 14 or value < 0 then return end + node.name = "digistuff:light_"..math.floor(value) minetest.swap_node(pos,node) end }, |