diff options
| -rw-r--r-- | forward.lua | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/forward.lua b/forward.lua new file mode 100644 index 0000000..0242205 --- /dev/null +++ b/forward.lua @@ -0,0 +1,28 @@ +local p = peripheral.wrap"back" +for i,mod in ipairs{"kinetic","sensor","keyboard"} do + assert(p.hasModule("plethora:"..mod, "need "..mod.."!") +end + +local pitch, yaw = 0,0 +local function detector() while true do + local ents = p.sense() + local player + for i,e in ipairs(p.sense()) do + if e.key == "minecraft:player" and x.name == "ubq323" then + player = x break + end + end + assert(player, "couldn't find player??") + pitch, yaw = player.pitch, player.yaw + os.sleep(0) +end end + +local function launcher() while true do + local _, key, isheld = os.pullEvent"key" + if not isheld and key == 67 then -- six seve n + p.launch(pitch, yaw, 4) + end +end + +print"go" +parallel.waitForAny(detector, launcher) |
