Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'calculate_angles'
- require 'get_angles'
- local args = {...}
- local scanner = peripheral.wrap('playerDetector_0')
- local monitor = peripheral.wrap('monitor_0')
- local player_name = args[1]
- local x, y, z = args[2], args[3], args[4]
- local clutch_hor = peripheral.wrap('redstoneIntegrator_4')
- local clutch_vert = peripheral.wrap('redstoneIntegrator_5')
- local reverse_hor = peripheral.wrap('redstoneIntegrator_6')
- local reverse_vert = peripheral.wrap('redstoneIntegrator_7')
- while true do
- local target_pos = scanner.getPlayerPos(player_name)
- local target_angles = calculate_angles(x, y, z, target_pos['x'], target_pos['y'], target_pos['z'])
- local cannon_angles = get_angles()
- print("Target:", target_angles['horizontal'], target_angles['vertical'])
- print("Cannon:", cannon_angles['horizontal'], cannon_angles['vertical'])
- clutch_hor.setOutput('top', math.abs(target_angles['horizontal']-cannon_angles['horizontal']) < 3)
- clutch_vert.setOutput('top', math.abs(target_angles['vertical']-cannon_angles['vertical']) < 3)
- reverse_hor.setOutput('top', target_angles['horizontal'] > cannon_angles['horizontal'])
- reverse_vert.setOutput('top', target_angles['vertical'] > cannon_angles['vertical'])
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement