]> git.lizzy.rs Git - Crafter.git/blobdiff - mods/redstone/functions.lua
Extreme redstone optimizations
[Crafter.git] / mods / redstone / functions.lua
index 0b03d1484bc25d80d7bc3388e3056dc1f669a482..638996f6cf94543449678e0b5eb9f5ba95f051c9 100644 (file)
@@ -1,7 +1,15 @@
 --this converts a vector into absolute value
-function vector.abs(vector)
-       vector.x = math.abs(vector.x)
-       vector.y = math.abs(vector.y)
-       vector.z = math.abs(vector.z)
-       return(vector)
+function vector.abs(v)
+       return {
+               x = math.abs(v.x),
+               y = math.abs(v.y),
+               z = math.abs(v.z)
+       }
+end
+
+--add a power signal to the position (i) that doesn't actually exist
+redstone.inject_power_signal = function(i)
+       if not r_index[i.x] then r_index[i.x] = {} end
+       if not r_index[i.x][i.y] then r_index[i.x][i.y] = {} end
+       r_index[i.x][i.y][i.z] = {torch = true,power=9}
 end