Beispiel #1
0
  def _define_methods(self):
    d = self._define_proxy_method
    r = self._control.server

    d(frostbite.commands.Version, r.version, filter=lambda r: r.split(" "))
    d(frostbite.commands.ServerInfo, r.info, filter=lambda i: ServerState.from_dict(i).to_packet_array())
    d(frostbite.commands.AdminListPlayers, r.list_all_players, filter=lambda p: PlayerCollection.from_dict(p).to_packet_array())
    d(frostbite.commands.FrostbiteVariable, r.get_variable, filter=lambda v: [v], extract_args=lambda m:[m.words[0]])
    d(frostbite.commands.MapListList, r.list_maps, filter=lambda m: MapList.from_dict(m).to_packet_array())
    d(frostbite.commands.MapListGetMapIndices, r.get_map_indices)
    d(frostbite.commands.MapListRestartRound, r.restart_round)
    d(frostbite.commands.MapListRunNextRound, r.next_round)
    d(frostbite.commands.MapListEndRound, r.end_round, extract_args=lambda m:[m.winning_team])
    d(frostbite.commands.AdminSay, r.say, extract_args=lambda m:[m.message])

    for var in frostbite.commands.variable_types:
      type = frostbite.commands.variable_types[var]
      self._command_to_method[type] = self._command_to_method[frostbite.commands.FrostbiteVariable]