return; } sessionid = getint(p); player1->clientnum = mycn; if(getint(p) > 0) conoutf(_("INFO: this server is password protected")); sendintro(); break; } ''' mt = MessageType("SV_SERVINFO", Field(name="clientnum", type="int"), Field(name="protocol_version", type="int"), Field(name="sessionid", type="int"), Field(name="haspwd", type="int")) stream_spec.add_message_type(message_types.SV_SERVINFO, mt) ''' case SV_WELCOME: joining = getint(p); player1->resetspec(); resetcamera(); break; ''' mt = MessageType("SV_WELCOME", Field(name="joining", type="int")) stream_spec.add_message_type(message_types.SV_WELCOME, mt) ''' case SV_CLIENT:
from StreamSpecification import Field, FieldCollection, IteratedFieldCollection, TerminatedFieldCollection from StreamSpecification import ConditionalFieldCollection from StreamSpecification import MessageType, StreamStateModifierType, StreamSpecification from StreamSpecification import StreamContainerType, RawField stream_spec = StreamSpecification(CubeDataStream, type_method_mapping, {}, "int") from .constants import message_types, weapon_types mt = MessageType("N_SERVINFO", Field(name="clientnum", type="int"), Field(name="protocol_version", type="int"), Field(name="sessionid", type="int"), Field(name="haspwd", type="int"), Field(name="description", type="string")) stream_spec.add_message_type(message_types.N_SERVINFO, mt) mt = MessageType("N_WELCOME", Field(name="hasmap", type="int")) stream_spec.add_message_type(message_types.N_WELCOME, mt) mt = MessageType("N_PONG", Field(name="cmillis", type="int")) stream_spec.add_message_type(message_types.N_PONG, mt) mt = MessageType("N_SERVMSG", Field(name="text", type="string")) stream_spec.add_message_type(message_types.N_SERVMSG, mt) mt = MessageType("N_PAUSEGAME", Field(name="value", type="int"))
'float': CubeDataStream.getfloat } from StreamSpecification import Field, FieldCollection, IteratedFieldCollection, TerminatedFieldCollection from StreamSpecification import MessageType, StreamStateModifierType, StreamSpecification from StreamSpecification import StreamContainerType, RawField sauerbraten_stream_spec = StreamSpecification(CubeDataStream, type_method_mapping, {}, "int") from Constants import message_types mt = MessageType("N_CONNECT", Field(name="name", type="string"), Field(name="pwdhash", type="string"), Field(name="playermodel", type="int")) sauerbraten_stream_spec.add_message_type(message_types.N_CONNECT, mt) mt = MessageType("N_TELEPORT", Field(name="clientnum", type="int"), Field(name="teleport", type="int"), Field(name="teledest", type="int")) sauerbraten_stream_spec.add_message_type(message_types.N_TELEPORT, mt) mt = MessageType("N_JUMPPAD", Field(name="clientnum", type="int"), Field(name="jumppad", type="int")) sauerbraten_stream_spec.add_message_type( message_types.N_JUMPPAD, mt) mt = MessageType("N_CHECKMAPS") sauerbraten_stream_spec.add_message_type(message_types.N_CHECKMAPS, mt)