예제 #1
0
int CheckTarget( gedict_t * Target )
{
    int     r;

    if ( tg_data.sg_allow_find == TG_SG_FIND_IGNORE_ALL )
        return 0;
    if ( !Target )
        return 0;
    if ( Target == self )
        return 0;
    if ( Target->has_disconnected == 1 )
        return 0;
    if ( !Target->s.v.takedamage )
        return 0;
    if ( Target->is_feigning )
        return 0;
    if ( ( int ) Target->s.v.flags & FL_NOTARGET )
        return 0;
    if ( ( int ) Target->s.v.items & IT_INVISIBILITY )
        return 0;
    if ( !visible( Target ) )
        return 0;
    r = range( Target );
    if ( r == 3 )
        return 0;
    else
    {
        if ( r == 2 && !infront( Target ) )
            return 0;
    }

    if ( tg_data.sg_allow_find == TG_SG_FIND_IGNORE_OFF )
        return 1;

    if ( teamplay )
    {
        if (  self->team_no && TeamFortress_isTeamsAllied (Target->team_no , self->team_no) )
        {
            if ( tg_data.sg_allow_find == TG_SG_FIND_IGNORE_TEAM )
                return 0;
        }
        if ( self->team_no && TeamFortress_isTeamsAllied(Target->undercover_team , self->team_no))
        {
            if ( tg_data.sg_allow_find == TG_SG_FIND_IGNORE_TEAM )
                return 0;
        }
    }
    if ( Target == self->real_owner )
    {
        if ( tg_data.sg_allow_find == TG_SG_FIND_IGNORE_OWNER )
            return 0;
    }


    return 1;
}
예제 #2
0
파일: engineer.c 프로젝트: MrPnut/QHome
//=========================================================================
// Dispenser Touch function. Allows players to get stuff from the Dispenser.
void T_Dispenser(  )
{
    gedict_t *dist_checker;

    if ( strneq( other->s.v.classname, "player" ) )
	return;

    if ( other->team_no && !TeamFortress_isTeamsAllied (other->team_no , self->team_no) )
	CenterPrint( self->real_owner, "Enemies are using your dispenser!\n" );

    // Ignore any engineer working on this dispenser	
    if ( ( !other->building || other->building == world ) && other->building_wait < g_globalvars.time )
    {
        // Pop up the menu
	other->current_menu = MENU_DISPENSER;
	other->menu_count = MENU_REFRESH_RATE;

	other->building = self;

        // Start a Distance checker, which removes the menu if the player
	// gets too far away from the Dispenser.
	dist_checker = spawn(  );
	dist_checker->s.v.classname = "timer";
	dist_checker->s.v.owner = EDICT_TO_PROG( other );
	dist_checker->s.v.enemy = EDICT_TO_PROG( self );
	dist_checker->s.v.think = ( func_t ) CheckDistance;
	dist_checker->s.v.nextthink = g_globalvars.time + 0.3;
    }
}