Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local tr_port = 22866 -- Порт передатчика(это устройсто)
- local rc_port = 53646 -- Порт приемника
- local mod_st = 8 -- Изначальная сила модема
- local slot_selected = 1
- local m = component.proxy(component.list('modem')())
- local drone = component.proxy(component.list("drone")())
- drone.select(slot_selected)
- if not m.open(tr_port) and not m.isOpen(tr_port) then
- error('Не удалось открыть порт '..tr_port)
- end
- m.setWakeMessage('Power On!')
- m.setStrength(mod_st)
- function send(...)
- m.broadcast(rc_port,...)
- end
- local invsize = drone.inventorySize()
- while true do
- local a = {computer.pullSignal(0.5)}
- if a[1] == 'modem_message' then
- if a[6] == 'Accel' then
- drone.setAcceleration(a[7])
- elseif a[6] == 'Slot' then
- slot_selected = a[7]
- drone.select(slot_selected)
- elseif a[6] == 'Streng' then
- m.setStrength(a[7])
- elseif a[6] == 'move' then
- drone.move(a[7],a[8],a[9])
- elseif a[6] == 'Power Off!' then
- computer.shutdown(false)
- end
- end
- local comp_eng = math.floor(computer.energy()/computer.maxEnergy()*100 + 0.5)
- local accel = drone.getAcceleration()
- local stack_in_slot = drone.count()
- local mod_st = m.getStrength()
- send('Info',comp_eng,accel,invsize,slot_selected,stack_in_slot,mod_st)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement