crashtest-r0ket/tools/game/simpletest.py

28 lines
648 B
Python
Raw Normal View History

2011-12-12 17:02:24 +00:00
import r0ketrem0te.rem0te
2011-12-14 16:59:32 +00:00
import r0ketrem0te.packets
2011-12-12 17:02:24 +00:00
import time
2011-12-14 16:59:32 +00:00
import Queue
announcequeue = Queue.Queue()
r = r0ketrem0te.rem0te.Bridge('/dev/ttyACM0')
r.registerQueue(announcequeue)
a = r0ketrem0te.packets.Announce(0,2,(1,2,3,2,1), 81, 1, 0, "testgame")
aq = r0ketrem0te.rem0te.QueuePacket(81, (1,2,3,2,1), False, a)
aq.priority = 4
2011-12-12 17:02:24 +00:00
while True:
2011-12-14 16:59:32 +00:00
r.putInQueue(announcequeue, aq)
for i in range(1,1000):
if r.gotPacket():
packet = r.getPacket()
if isinstance(packet, r0ketrem0te.packets.Join):
r.sendPacket(r0ketrem0te.packets.Ack(packet.id, packet.ctr, 1))
time.sleep(.001)
2011-12-12 17:02:24 +00:00