Exemple #1
0
void VoteYes()
{
	int votes;

	if( !get_votes( OV_ELECT ) )
		return;

	if( self->v.elect_type != etNone ) {
		G_sprint(self, 2, "You cannot vote for yourself\n");
		return;
	}

	if( self->v.elect ) {
		G_sprint(self, 2, "--- your vote is still good ---\n");
		return;
	}

// register the vote
	self->v.elect = 1;

	G_bprint(2, "%s gives %s vote\n", self->s.v.netname, g_his( self ));

// calculate how many more votes are needed
	if ( (votes = get_votes_req( OV_ELECT, true )) )
		G_bprint(2, "\x90%d\x91 more vote%s needed\n", votes, count_s( votes ));

	vote_check_elect ();
}
Exemple #2
0
void ReadyThink ()
{
    float i1;
	char *txt, *gr;
    gedict_t *p=NULL, *p2=NULL;

    p2 = PROG_TO_EDICT( self->s.v.owner );
	
    if(    ( p2->ct == ctPlayer && !( p2->ready ) ) // forcestart breaked via break command
		|| ( p2->ct == ctSpec && !k_force )	// forcestart breaked via forcebreak command (spectator admin)
	  )
    {
        k_force = 0;

        G_bprint(2, "%s interrupts countdown\n", p2->netname );

        ent_remove ( self );

        return;
    }

	k_attendees = CountPlayers();

	if ( !isCanStart(NULL, true) ) {
        k_force = 0;

        G_bprint(2, "Forcestart canceled\n");

        ent_remove ( self );

        return;
	}


    self->attack_finished--;

    i1 = self->attack_finished;

    if( i1 <= 0 )
    {
        k_force = 0;

        AdminMatchStart();

        ent_remove ( self );

        return;
    }

	txt = va( "%s second%s left before game starts", dig3( i1 ), ( i1 == 1 ? "" : "s") );
	gr  = va( "\n%s!", redtext("Get ready") );

    for( p = world; (p = find_client( p )); )
		if ( p->ct == ctPlayer )
			G_centerprint(p, "%s%s", txt, (p->ready ? "" : gr));
		else
			G_centerprint(p, "%s", txt);

    self->s.v.nextthink = g_globalvars.time + 1;
}
Exemple #3
0
// { votecoop
void vote_check_coop ()
{
	int veto;

	if ( ( deathmatch && match_in_progress ) || intermission_running || match_over )
		return;

	if ( !get_votes( OV_COOP ) )
		return;

	veto = is_admins_vote( OV_COOP );

	if( veto || !get_votes_req( OV_COOP, true ) )
	{
		vote_clear( OV_COOP );

		// toggle coop mode
		cvar_fset( "coop", coop = !cvar("coop") );
		// set appropriate deathmatch
		cvar_fset( "deathmatch", deathmatch = !coop );

		if ( veto )
			G_bprint( 2, "%s\n", redtext(va("Coop mode %s by admin veto", OnOff(cvar("coop")))) );
		else
			G_bprint( 2, "%s\n", redtext(va("Coop mode %s by majority vote", OnOff(cvar("coop")))) );

		// and reload map
		if ( cvar("k_bloodfest") )
			changelevel( coop ? g_globalvars.mapname : cvar_string( "k_defmap" ) );
		else
			changelevel( coop ? "start" : g_globalvars.mapname );
			
		return;
	}
}
Exemple #4
0
void AdminMatchStart ()
{
    gedict_t *p;
    int i = 0;

    for( p = world; (p = find_plr( p )); )
    {
		if( p->ready ) {
			i++;
		}
		else
		{
			G_bprint(2, "%s was kicked by admin forcestart\n", p->netname);
			G_sprint(p, 2, "Bye bye! Pay attention next time.\n");

			stuffcmd(p, "disconnect\n"); // FIXME: stupid way
		}
	}

    k_attendees = i;

    if( k_attendees ) {
        StartTimer();
	}
    else
    {
        G_bprint(2, "Can't start! More players needed.\n");
		EndMatch( 1 );
    }
}
Exemple #5
0
// !!! do not confuse rpickup and pickup
void vote_check_pickup ()
{
	gedict_t *p;
	int veto;

	if ( match_in_progress || k_captains )
		return;

	if ( !get_votes( OV_PICKUP ) )
		return;

	veto = is_admins_vote( OV_PICKUP );

	if( veto || !get_votes_req( OV_PICKUP, true ) ) {
		vote_clear( OV_PICKUP );

		if ( veto )
			G_bprint(2, "console: admin veto for pickup\n");
		else
			G_bprint(2, "console: a pickup game it is then\n");

		for( p = world;	(p = find_plr( p )); ) {

			stuffcmd_flags(p, STUFFCMD_IGNOREINDEMO,
						"break\n"
						"color 0\n"
						"team \"\"\n"
						"skin base\n");
		}

		return;
	}
}
Exemple #6
0
void ToggleMapLock ()
{
    float tmp;

    if( !is_adm( self ) )
        return;

    tmp = cvar( "k_lockmap" );

    if( tmp )
    {
		cvar_fset( "k_lockmap", 0 );

        if( !match_in_progress )
            G_bprint(2, "%s unlocks map\n", self->netname);
        else
            G_sprint(self, 2, "Map unlocked\n");

        return;
    }

	cvar_fset( "k_lockmap", 1 );

    if( !match_in_progress )
        G_bprint(2, "%s locks map\n", self->netname);
    else
        G_sprint(self, 2, "Map is locked\n");
}
Exemple #7
0
qbool DoKick(gedict_t *victim, gedict_t *kicker)
{
	if (!victim || !kicker)
		return false;

	if( victim == kicker )
	{
		G_bprint(2, "%s kicked %s\n", getname(kicker), g_himself( kicker ));

		// hehe
		G_sprint(kicker, 2, "Say \"bye\" and then type \"disconnect\" next time\n");

		stuffcmd(kicker, "disconnect\n");  // FIXME: stupid way

		if ( !FTE_sv )
			localcmd( "addip %s ban +30\n", cl_ip( victim ) ); // BAN for 30 seconds
	}
	else
	{
		if ( !is_can_kick(victim, kicker) )
			return false;

		G_bprint(2, "%s was kicked by %s\n", getname(victim), getname(kicker));

		G_sprint(victim, 2, "You were kicked from the server\n");

		stuffcmd(victim, "disconnect\n"); // FIXME: stupid way

		if ( !FTE_sv )
			localcmd( "addip %s ban +30\n", cl_ip( victim ) ); // BAN for 30 seconds
	}

	return true;
}
Exemple #8
0
void vote_check_antilag ()
{
	int veto;

	if ( match_in_progress || intermission_running || match_over )
		return;

	if ( !get_votes( OV_ANTILAG ) )
		return;

	veto = is_admins_vote( OV_ANTILAG );

	if( veto || !get_votes_req( OV_ANTILAG, true ) )
	{
		vote_clear( OV_ANTILAG );

		// toggle antilag mode.
		trap_cvar_set_float( "sv_antilag", (float)(cvar( "sv_antilag" ) ? 0 : 2));

		if ( veto )
			G_bprint(2, "%s\n", redtext(va("Antilag mode %s by admin veto", OnOff(2 == cvar("sv_antilag")))));
		else
			G_bprint(2, "%s\n", redtext(va("Antilag mode %s by majority vote", OnOff(2 == cvar("sv_antilag")))));

		return;
	}
}
Exemple #9
0
Fichier : vote.c Projet : deurk/ktx
void vote_check_teamoverlay ()
{
	int veto;

	if ( match_in_progress || intermission_running || match_over )
		return;

	if ( !get_votes( OV_TEAMOVERLAY ) )
		return;

	veto = is_admins_vote( OV_TEAMOVERLAY );

	if( veto || !get_votes_req( OV_TEAMOVERLAY, true ) )
	{
		vote_clear( OV_TEAMOVERLAY );

		// Toggle teamoverlay.
		cvar_fset("k_teamoverlay", !cvar("k_teamoverlay"));

		if ( veto )
			G_bprint(2, "%s\n", redtext(va("Teamoverlay %s by admin veto", OnOff(cvar("k_teamoverlay")))));
		else
			G_bprint(2, "%s\n", redtext(va("Teamoverlay %s by majority vote", OnOff(cvar("k_teamoverlay")))));

		return;
	}
}
Exemple #10
0
// !!! do not confuse rpickup and pickup
void vote_check_rpickup ()
{
	float frnd;
    int i, tn, pl_cnt, pl_idx;
	gedict_t *p;
	int veto;

	if ( match_in_progress || k_captains )
		return;

	if ( !get_votes( OV_RPICKUP ) )
		return;

   	// Firstly obtain the number of players we have in total on server
   	pl_cnt = CountPlayers();

	if ( pl_cnt < 4 )
		return;

	veto = is_admins_vote( OV_RPICKUP );

	if( veto || !get_votes_req( OV_RPICKUP, true ) ) {
		vote_clear( OV_RPICKUP );

		for( p = world; (p = find_plr( p )); )
			p->k_teamnumber = 0;

		for( tn = 1; pl_cnt > 0; pl_cnt-- ) {
			frnd = g_random(); // bound is macros - so u _can't_ put g_random inside bound
			pl_idx = bound(0, (int)( frnd * pl_cnt ), pl_cnt-1 ); // select random player between 0 and pl_cnt

			for( i = 0, p = world; (p = find_plr( p )); ) {
				if ( p->k_teamnumber )
					continue;

				if ( i == pl_idx ) {
					p->k_teamnumber = tn;
					tn = (tn == 1 ? 2 : 1); // next random player will be in other team

            		if( p->k_teamnumber == 1 )
                		stuffcmd_flags(p, STUFFCMD_IGNOREINDEMO, "break\ncolor  4\nskin \"\"\nteam red\n");
            		else
                		stuffcmd_flags(p, STUFFCMD_IGNOREINDEMO, "break\ncolor 13\nskin \"\"\nteam blue\n");

					break;
				}

				i++;
			}
		}

		if ( veto )
			G_bprint(2, "console: admin veto for %s\n", redtext("random pickup"));
		else
    		G_bprint(2, "console: %s game it is then\n", redtext("random pickup"));

		return;
	}
}
Exemple #11
0
int BotImpulseMenu()
{
	int     subItem = 0;

	subItem = self->nextimpulse;
	self->nextimpulse = 0;
	switch ( self->current_menu )
	{
	case MENU_TEAM:
	        if( self->bot_lastmenu == MENU_TEAM )
	        {
	                if( self->bot_lastmenucount++ > 5) 
	                {
	                        G_bprint(2,"%s :cannot join team %d\n",self->s.v.netname, self->bot_team);
	                        botDisconnect( self );
	                        return 0;
	                }
	        }else
	        {
	                self->bot_lastmenu = MENU_TEAM;
	                self->bot_lastmenucount = 1;
	        }
		return self->bot_team;
	case MENU_CLASS:
	        if( self->bot_lastmenu == MENU_CLASS )
	        {
	                if( self->bot_lastmenucount++ > 5) 
	                {
	                        G_bprint(2,"%s :cannot select class %d\n",self->s.v.netname, self->bot_skin);
	                        botDisconnect( self );
	                        return 0;
	                }
	        }else
	        {
	                self->bot_lastmenu = MENU_CLASS;
	                self->bot_lastmenucount = 1;
	        }
		return self->bot_skin;
	case MENU_SPY:
		return 4;
	case MENU_SPY_SKIN:
		return 8;
	case MENU_SPY_COLOR:
		return self->bot_team;
	case MENU_ENGINEER:
		return ( subItem ) ? subItem : 4;
	case MENU_ENGINEER_FIX_SENTRYGUN:
		return ( subItem ) ? ( self->s.v.button0 = 0, subItem ) : 5;
	case MENU_DISPENSER:
		return 3;
	default:
		return self->s.v.impulse;
	}
}
Exemple #12
0
void sv_lock ()
{
	int lock_time = 15;

	if ( !k_sv_locktime ) {
		G_bprint(2, "%s %s for %s seconds\n", 
				getname(self), redtext("locked server"), dig3(lock_time));
		k_sv_locktime = g_globalvars.time + lock_time;
	}
	else {
		G_bprint(2, "%s %s\n", getname(self), redtext("unlocked server"));
		k_sv_locktime = 0;
	}
}
Exemple #13
0
void Vote_Elect_Yes()
{
	int 		f1, needed_votes;
	gedict_t* 	p = world;

	if(!k_vote) return;

	if(self->k_voted) {
		G_sprint(self, 2, "--- your vote is still good ---\n");
		return;
	}

// register the vote
	k_vote ++;
	G_bprint(2, "%s gives his vote\n",self->s.v.netname);
	f1 = CountPlayers();
	needed_votes = (int)(f1 * elect_percentage / 100)+1 - k_vote;

	//if(  elect_percentage * f1 < 100 * k_vote ) 
	if( needed_votes < 1)
	{
		k_vote = 0;
		current_vote = -1;
        	while((p = trap_find(p, FOFS(s.v.classname), "player"))) 
        	{
			if( p->s.v.netname[0] ) p->k_voted = 0;
		}

		p = trap_find(world, FOFS(s.v.classname), "voteguard");
		if(p) {
			p->s.v.classname  = "";
		 dremove(p);
		}
		G_bprint(2,  "%s ηαιξσ αδνιξ στατυσ!\n", elect_player->s.v.netname);
		G_sprint(elect_player, 2, "Type γνδ αδνιξ for admin commands.\n");
		elect_player->is_admin = elect_level;
		return;	
	}

// calculate how many more votes are needed
	self->k_voted = 1;

	if( needed_votes > 1)
		G_bprint(2, "%d‘ total votes needed\nType ", needed_votes);
	else
		G_bprint(2, "%d‘ total vote needed\nType ", needed_votes);


}
Exemple #14
0
static void BotMoveTowardsLinkedMarker(gedict_t* self, vec3_t dir_move) {
	vec3_t temp;
	gedict_t* goalentity_ = &g_edicts[self->s.v.goalentity];
	gedict_t* linked = self->fb.linked_marker;
	qbool onGround = ((int)self->s.v.flags & FL_ONGROUND);
	qbool curlJump = ((int)self->fb.path_state & BOTPATH_CURLJUMP_HINT);

	VectorAdd(linked->s.v.absmin, linked->s.v.view_ofs, temp);
	VectorSubtract(temp, self->s.v.origin, temp);
	normalize(temp, dir_move);

	if (curlJump && (onGround || self->s.v.velocity[2] > 0)) {
		vec3_t up = { 0, 0, 1 };

		if (self->isBot && self->fb.debug_path) {
			G_bprint (PRINT_HIGH, "%3.2f: Moving %3d > %3d, dir %3.1f %3.1f %3.1f\n", g_globalvars.time, self->fb.touch_marker->fb.index + 1, self->fb.linked_marker->fb.index + 1, PASSVEC3 (dir_move));
		}

		RotatePointAroundVector (dir_move, up, dir_move, self->fb.angle_hint);

		if (self->isBot && self->fb.debug_path) {
			G_bprint (PRINT_HIGH, "%3.2f: Rotating %d, %3.1f %3.1f %3.1f\n", g_globalvars.time, self->fb.angle_hint, PASSVEC3 (dir_move));
		}
	}

	if (self->isBot && self->fb.debug_path) {
		//G_bprint (PRINT_HIGH, "%3.2f: Moving %3d > %3d, dir %3.1f %3.1f %3.1f\n", g_globalvars.time, self->fb.touch_marker->fb.index + 1, self->fb.linked_marker->fb.index + 1, PASSVEC3 (dir_move));
	}

	if (self->fb.path_state & DELIBERATE_BACKUP) {
		if (linked->fb.arrow_time > g_globalvars.time) {
			VectorInverse (dir_move);
		}
		else {
			self->fb.path_state &= ~DELIBERATE_BACKUP;
		}
	}
	else if (linked == self->fb.touch_marker) {
		if (goalentity_ == self->fb.touch_marker) {
			if (WaitingToRespawn(self->fb.touch_marker)) {
				VectorClear(dir_move);
			}
		}
		else {
			VectorClear(dir_move);
		}
	}
}
Exemple #15
0
void FlagThink()
{
	if ( !isCTF() )
		return;

	self->s.v.nextthink = g_globalvars.time + 0.1;

	if (self->cnt == FLAG_AT_BASE)
		return;

	if (self->cnt == FLAG_DROPPED)
	{
		self->cnt2 += 0.1;
		if ( g_globalvars.time > self->super_time )
		{
			RegenFlag( self );
			G_bprint( 2, "The %s flag has been returned\n", redtext( ( (int) self->s.v.items & IT_KEY1) ? "BLUE" : "RED" ) );
		}
		return;
	}

	if (self->cnt == FLAG_RETURNED)
	{
		setorigin( self, PASSVEC3(self->s.v.oldorigin) );
		self->cnt = FLAG_AT_BASE;
		return;
	}

	self->cnt2 += 0.1;
}
Exemple #16
0
void nospecs( )
{
    int votes;
	
	if ( match_in_progress )
	{
        G_sprint(self, 2, "%s mode %s\n", redtext("No spectators"), OnOff(cvar("_k_nospecs")));
        return;
	}

	// admin may turn this status alone on server...
	if ( !is_adm( self ) )
	{
		// Dont need to bother if less than 2 players
		if ( CountPlayers() < 2 )
		{
			G_sprint(self, 2, "You need at least 2 players to do this.\n");
			return;
		}
	}

	self->v.nospecs = !self->v.nospecs;

	G_bprint(2, "%s %s!%s\n", self->s.v.netname, 
			(self->v.nospecs ? redtext(va("votes for nospecs %s", OnOff(!cvar("_k_nospecs")))) : 
							   redtext(va("withdraws %s nospecs vote", g_his(self)))),
			((votes = get_votes_req( OV_NOSPECS, true )) ? va(" (%d)", votes) : ""));

	vote_check_nospecs ();
}
Exemple #17
0
Fichier : vote.c Projet : deurk/ktx
void teamoverlay( )
{
    int votes;

    if ( match_in_progress )
    {
        G_sprint(self, 2, "%s %s\n", redtext("Teamoverlay"), OnOff(cvar("k_teamoverlay")));
        return;
    }

	// admin may turn this status alone on server...
	if ( !is_adm( self ) )
	{
		// Dont need to bother if less than 2 players
		if ( CountPlayers() < 2 )
		{
			G_sprint(self, 2, "You need at least 2 players to do this.\n");
			return;
		}
	}

	self->v.teamoverlay = !self->v.teamoverlay;

	G_bprint(2, "%s %s!%s\n", self->netname, 
			(self->v.teamoverlay ? redtext(va("votes for teamoverlay %s", OnOff(!cvar("k_teamoverlay")))) : 
							       redtext(va("withdraws %s teamoverlay vote", g_his(self)))),
			((votes = get_votes_req( OV_TEAMOVERLAY, true )) ? va(" (%d)", votes) : ""));

    vote_check_teamoverlay ();
}
Exemple #18
0
////////////////
// GlobalParams:
// self
///////////////
void SpectatorDisconnect()
{
	gedict_t *p;

	if ( self->k_accepted )
	{
		for ( p = world; (p = ( match_in_progress == 2 && !cvar("k_ann") ) ? find_spc( p ) : find_client( p )); )	
			G_sprint( p, PRINT_HIGH, "Spectator %s left the game\n", self->s.v.netname );
	}

// s: added conditional function call here
	if( self->v.elect_type != etNone ) {

		if ( match_in_progress != 2 )
			G_bprint(2, "Election aborted\n");

		AbortElect();
	}

	if ( self->wizard ) {
		ent_remove( self->wizard );
		self->wizard = NULL;
	}

	if( self->k_kicking )
		ExitKick( self );

	self->s.v.classname = ""; // Cenobite, so we clear out any specs as they leave
	self->k_accepted  = 0;
	self->ct = ctNone;
}
Exemple #19
0
void antilag( )
{
    int votes;
	
	if ( match_in_progress )
	{
        G_sprint(self, 2, "%s mode %s\n", redtext("Antilag"), OnOff(2 == cvar("sv_antilag")));
        return;
	}

	// admin may turn this status alone on server...
	if ( !is_adm( self ) )
	{
		// Dont need to bother if less than 2 players
		if ( CountPlayers() < 2 )
		{
			G_sprint(self, 2, "You need at least 2 players to do this.\n");
			return;
		}
	}

	self->v.antilag = !self->v.antilag;

	G_bprint(2, "%s %s!%s\n", self->s.v.netname, 
			(self->v.antilag ? redtext(va("votes for antilag %s", OnOff(!(2 == cvar("sv_antilag"))))) : 
							   redtext(va("withdraws %s antilag vote", g_his(self)))),
			((votes = get_votes_req( OV_ANTILAG, true )) ? va(" (%d)", votes) : ""));

	vote_check_antilag ();
}
Exemple #20
0
////////////////
// GlobalParams:
// time
// self
// params
///////////////
void SpectatorConnect()
{
	G_bprint( PRINT_MEDIUM, "Spectator %s entered the game\n", self->s.v.netname );

	self->s.v.goalentity = EDICT_TO_PROG( world );	// used for impulse 1 below

}
Exemple #21
0
void tdeath_touch(  )
{
//      gedict_t *spot;

	if ( other == PROG_TO_EDICT( self->s.v.owner ) )
		return;

	if ( streq( other->s.v.classname, "player" ) )
	{
		if ( other->invincible_finished > g_globalvars.time )
		{
			self->s.v.classname = "teledeath2";
		}
		if ( strneq( PROG_TO_EDICT( self->s.v.owner )->s.v.classname, "player" ) )
		{
			T_Damage( PROG_TO_EDICT( self->s.v.owner ), self, self, 5000 );
			return;
		}
	}
	if ( other->s.v.health )
	{
		T_Damage( other, self, self, 5000 );
	}

	if ( other->s.v.think == ( func_t ) TeamFortress_DetpackExplode )
	{
		other->s.v.solid = SOLID_NOT;
		other->s.v.nextthink = g_globalvars.time + 1 + g_random(  ) * 2;
		dremove( other->oldenemy );
		G_bprint( 1, "%s's detpack was telefragged by %s\n",
			  other->real_owner->s.v.netname, PROG_TO_EDICT( self->s.v.owner )->s.v.netname );
	}
}
Exemple #22
0
void AdminForceBreak ()
{
    if( is_adm( self ) && self->ct != ctPlayer && !match_in_progress )
    {
        k_force = 0;
        return;
    }

    if( !is_adm( self ) || !match_in_progress )
        return;

    if( self->ct != ctPlayer && match_in_progress == 1 )
    {
        k_force = 0;
        StopTimer( 1 );

        return;
    }

    if( k_oldmaxspeed ) // huh???
        cvar_fset( "sv_maxspeed", k_oldmaxspeed );

    G_bprint(2, "%s forces a break!\n", self->netname);

    EndMatch( 0 );
}
Exemple #23
0
void ElectThink()
{
	G_bprint(2, "The voting has timed out.\n"
				"Election aborted\n");
	self->s.v.nextthink = -1;

	AbortElect();
}
Exemple #24
0
void FixNoSpecs( void )
{
	// turn off "no specs" mode if there no players left
	if ( g_globalvars.time > 10 && !match_in_progress && !CountPlayers() && cvar("_k_nospecs") )
	{
		G_bprint(2,	"%s mode turned off\n", redtext("No spectators"));
		cvar_set("_k_nospecs", "0");
	}
}
Exemple #25
0
void vote_check_nospecs ()
{
	int veto;

	if ( match_in_progress || intermission_running || match_over )
		return;

	if ( !get_votes( OV_NOSPECS ) )
		return;

	veto = is_admins_vote( OV_NOSPECS );

	if( veto || !get_votes_req( OV_NOSPECS, true ) )
	{
		vote_clear( OV_NOSPECS );

		// set no specs mode
		cvar_fset("_k_nospecs", !cvar("_k_nospecs"));

		if ( veto )
			G_bprint(2, "%s\n", redtext(va("No spectators mode %s by admin veto", OnOff(cvar("_k_nospecs")))));
		else
			G_bprint(2, "%s\n", redtext(va("No spectators mode %s by majority vote", OnOff(cvar("_k_nospecs")))));

		// kick specs
		if ( cvar("_k_nospecs") )
		{
			gedict_t *spec;

			for ( spec = world; (spec = find_spc( spec )); )
			{
				if ( VIP( spec ) & ALLOWED_NOSPECS_VIPS )
					continue; // don't kick this VIP
    
				if ( is_real_adm(spec) )
					continue; // don't kick real admin
    
				stuffcmd(spec, "disconnect\n");  // FIXME: stupid way
			}
		}

		return;
	}
}
Exemple #26
0
// Called when the bot has a touch marker set
static void BotTouchMarkerLogic()
{
	TargetEnemyLogic(self);

	if (PAST(goal_refresh_time)) {
		UpdateGoal(self);
	}

	if (self->fb.path_state & BOTPATH_RJ_IN_PROGRESS) {
		if (self->s.v.velocity[2] <= 0) {
			self->fb.path_state &= ~BOTPATH_RJ_IN_PROGRESS;
		}
	}

	if (! (self->fb.path_state & BOTPATH_RJ_IN_PROGRESS)) {
		if (PAST (linked_marker_time)) {
			self->fb.old_linked_marker = NULL;
		}

		if (self->fb.old_linked_marker != self->fb.touch_marker) {
			ProcessNewLinkedMarker (self);
		}
	}

	if (FUTURE(arrow_time)) {
		if (self->isBot && self->fb.debug_path) {
			G_bprint(PRINT_HIGH, "%3.2f: arrow_time is %3.2f\n", g_globalvars.time, self->fb.arrow_time);
		}
		if (FUTURE(arrow_time2)) {
			if (g_random() < 0.5) {
				SetLinkedMarker (self, self->fb.touch_marker, "BotTouchMarkerLogic");
				self->fb.old_linked_marker = self->fb.linked_marker;
				self->fb.path_state = 0;
				self->fb.linked_marker_time = g_globalvars.time + 0.3;
			}
		}
	}
	else if (self->fb.linked_marker) {
		vec3_t dir_move;

		BotMoveTowardsLinkedMarker(self, dir_move);
		BotOnGroundMovement(self, dir_move);

		SetDirectionMove (self, dir_move, ((int)self->s.v.flags & FL_ONGROUND) ? "OnGround" : "InAir");
	}
	else {
		// The map is, imo, broken at this point, but some old fbca maps are missing links
		//   and at this point would use 'world'
		// Deliberately don't move and hope that the fall gets us somewhere
		vec3_t dir_move = { 0, 0, 0 };

		SetDirectionMove(self, dir_move, "NoLinkedMarker!");
	}

	SelectWeapon();
}
Exemple #27
0
void BecomeAdmin(gedict_t *p, int adm_flags)
{
	G_bprint(2, "%s %s!\n", p->netname, redtext("gains admins status"));
	G_sprint(p, 2, "Please give up admin rights when you're done\n"
				   "Type %s for info\n", redtext("commands"));

	p->k_admin |= adm_flags;

	on_admin( p );
}
Exemple #28
0
void Vote_ChangeMap_Yes()
{
	int 		f1, f2;
	gedict_t* 	p = world;

	if(!k_vote) return;

	if(self->k_voted) {
		G_sprint(self, 2, "--- your vote is still good ---\n");
		return;
	}

// register the vote
	k_vote ++;
	G_bprint(2, "%s votes for mapchange\n",self->s.v.netname);
	f1 = CountPlayers();
	f2 = f1 / 2 + 1;
	if(k_vote >= f2) {
		G_bprint(3, "Map changed by majority vote\n");
		k_vote = 0;
		current_vote = -1;
        	while((p = trap_find(p, FOFS(s.v.classname), "player"))) 
        	{
			if(p->s.v.netname[0] ) p->k_voted = 0;
		}

		p = trap_find(world, FOFS(s.v.classname), "voteguard");
		if(p) {
			p->s.v.classname  = "";
		 dremove(p);
		}
		NextLevel();
		return;
	}

// calculate how many more votes are needed
	self->k_voted = 1;
	f1 = f2 - k_vote;
	if(f1>1)
		G_bprint(2, "%d‘ more votes needed\n",f1);
	else
		G_bprint(2, "%d‘ more vote needed\n",f1);	
}
Exemple #29
0
void q_touch()
{
//gedict_t*    stemp;
//float     best;

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

	self->mdl = self->s.v.model;

	sound( other, CHAN_VOICE, self->s.v.noise, 1, ATTN_NORM );
	stuffcmd( other, "bf\n" );

	self->s.v.solid = SOLID_NOT;
	other->s.v.items = ( ( int ) other->s.v.items ) | IT_QUAD;
	self->s.v.model = "";

	if ( deathmatch == 4 )
	{
		other->s.v.armortype = 0;
		other->s.v.armorvalue = 0 * 0.01;
		other->s.v.ammo_cells = 0;
	}
// do the apropriate action
	other->super_time = 1;
	other->super_damage_finished = self->cnt;

	if ( deathmatch == 4 )
		G_bprint( PRINT_LOW,
			  "%s recovered an OctaPower with %d seconds remaining!\n",
			  other->s.v.netname,
			  ( int ) ( other->super_damage_finished - g_globalvars.time ) );
	else
		G_bprint( PRINT_LOW, "%s recovered a Quad with %d seconds remaining!\n",
			  other->s.v.netname,
			  ( int ) ( other->super_damage_finished - g_globalvars.time ) );


	activator = other;
	SUB_UseTargets();	// fire all targets / killtargets
}
Exemple #30
0
void BotPathCheck (gedict_t* self, gedict_t* touch_marker)
{
	if (self->fb.debug_path && self->fb.fixed_goal == touch_marker) {
		G_bprint (2, "at goal, path complete.  %4.3f seconds\n", g_globalvars.time - self->fb.debug_path_start);
		self->fb.fixed_goal = NULL;
		self->fb.debug_path = false;
		self->fb.debug_path_start = 0;
		cvar_fset (FB_CVAR_DEBUG, 0);
	}
}