Ejemplo n.º 1
0
def _initialize_players():
    for i in range(1, global_vars.max_clients + 1):
        try:
            edict = edict_from_index(i)
        except ValueError:
            pass
        else:
            baseplayer = BasePlayer(i)
            baseplayer._edict = edict
            baseplayer._userid = userid_from_edict(edict)
            baseplayer._name = playerinfo_from_edict(edict).name
            baseplayer._connected = True
            baseplayer._fake_client = playerinfo_from_edict(
                edict).is_fake_client()

            if baseplayer._fake_client:
                baseplayer._accountid = baseplayer._name
                baseplayer._steamid2 = 'BOT'
                baseplayer._uniqueid = f'BOT_{baseplayer.name}'
                baseplayer._authorized = True

                OnClientAuthorized.manager.notify(baseplayer)
            else:
                if engine_server.is_client_fully_authenticated(
                        baseplayer.edict):
                    _initialize(baseplayer)
                else:
                    _authenticate.add(baseplayer)
Ejemplo n.º 2
0
def pre_set_transmit(stack):
    if _game_models:
        inthandle = inthandle_from_pointer(stack[0])
        userid = _game_models.get(inthandle)

        if userid is not None:
            target = userid_from_edict(
                make_object(CheckTransmitInfo, stack[1]).client)

            if target == userid:
                return False
Ejemplo n.º 3
0
def _on_client_connect(allow_connect_ptr, edict, name, address, reject_msg_ptr, reject_msg_len):
    baseplayer = BasePlayer.from_edict(edict)
    baseplayer._edict = edict
    baseplayer._name = name

    if baseplayer.connected:
        _on_client_disconnect(baseplayer.index)

        baseplayer = BasePlayer.from_edict(edict)

    baseplayer._connected = True
    baseplayer._userid = userid_from_edict(edict)

    if not baseplayer._authorized:
        if baseplayer._fake_client:
            baseplayer._steamid2 = 'BOT'
            baseplayer._uniqueid = f'BOT_{name}'
            baseplayer._authorized = True
        else:
            _authenticate.add(baseplayer)

    OnClientConnect.manager.notify(baseplayer)
Ejemplo n.º 4
0
def pre_set_transmit(stack_data):
    """Hides 'point_worldtext' entities that are part of FloatingNumbers for
    everyone except the specified recipient.
    """
    index = index_from_pointer(stack_data[0])

    try:
        # Does this index belong to a FloatingNumber instance?
        floating_number = number_instances[index]
    except KeyError:
        # Nope, don't go further.
        return None

    info = CheckTransmitInfo._obj(stack_data[1])
    # Strip the FL_EDICT_ALWAYS flag from the 'point_worldtext'.
    floating_number.state_flags = floating_number.state_flags ^ FL_EDICT_ALWAYS

    # Is this the recipient of the FloatingNumber entity?
    if floating_number.recipient == userid_from_edict(info.client):
        # Show the entity.
        return None
    else:
        # If not, hide the entity.
        return False