Added stubs for all of the IMC packets. Also re-named the event.

This commit is contained in:
Greg Taylor 2009-04-11 07:26:58 +00:00
parent 191f49ff4c
commit 4428fbd336
2 changed files with 505 additions and 41 deletions

View file

@ -8,26 +8,25 @@ from src import scheduler
from src.imc2 import connection as imc2_conn
from src.imc2.packets import *
class IEvt_IMC2_KeepAlive(events.IntervalEvent):
class IEvt_IMC2_IsAlive(events.IntervalEvent):
"""
Event: Send periodic keepalives to network neighbors. This lets the other
games know that our game is still up and connected to the network. Also
provides some useful information about the client game.
"""
name = 'IEvt_IMC2_KeepAlive'
name = 'IEvt_IMC2_IsAlive'
# Send keep-alive packets every 15 minutes.
interval = 900
description = "Send an IMC2 keepalive packet."
description = "Send an IMC2 is-alive packet."
def event_function(self):
"""
This is the function that is fired every self.interval seconds.
"""
packet = IMC2PacketIsAlive()
imc2_conn.IMC2_PROTOCOL_INSTANCE.send_packet(packet)
imc2_conn.IMC2_PROTOCOL_INSTANCE.send_packet(IMC2PacketIsAlive())
def add_events():
"""
Adds the IMC2 events to the scheduler.
"""
scheduler.add_event(IEvt_IMC2_KeepAlive())
scheduler.add_event(IEvt_IMC2_IsAlive())