コード例 #1
0
ファイル: g_target.c プロジェクト: boutetnico/ETrun
/*QUAKED target_print (1 0 0) (-8 -8 -8) (8 8 8) redteam blueteam private
"message"	text to print
If "private", only the activator gets the message.  If no checks, all clients get the message.
*/
void Use_Target_Print(gentity_t *ent, gentity_t *other, gentity_t *activator) {
	// Nico, silent GCC
	(void)other;

	if (ent->spawnflags & 4) {
		if (!activator) {
			G_Error("Use_Target_Print: call to client only target_print with no activator\n");
		}

		if (activator->client) {
			trap_SendServerCommand(activator - g_entities, va("cp \"%s\"", ent->message));
			return;
		}
	}

	if (ent->spawnflags & 3) {
		if (ent->spawnflags & 1) {
			G_TeamCommand(TEAM_AXIS, va("cp \"%s\"", ent->message));
		}
		if (ent->spawnflags & 2) {
			G_TeamCommand(TEAM_ALLIES, va("cp \"%s\"", ent->message));
		}
		return;
	}

	trap_SendServerCommand(-1, va("cp \"%s\"", ent->message));
}
コード例 #2
0
ファイル: g_svcmds.c プロジェクト: redrumrobot/r-unlimited-cz
static void Svcmd_AdmitDefeat_f( void )
{
  int  team;
  char teamNum[ 2 ];

  if( trap_Argc( ) != 2 )
  {
    G_Printf("admitdefeat: must provide a team\n");
    return;
  }
  trap_Argv( 1, teamNum, sizeof( teamNum ) );
  team = G_TeamFromString( teamNum );
  if( team == TEAM_ALIENS )
  {
    G_TeamCommand( TEAM_ALIENS, "cp \"Hivemind Link Broken\" 1");
    trap_SendServerCommand( -1, "print \"Alien team has admitted defeat\n\"" );
  }
  else if( team == TEAM_HUMANS )
  {
    G_TeamCommand( TEAM_HUMANS, "cp \"Life Support Terminated\" 1");
    trap_SendServerCommand( -1, "print \"Human team has admitted defeat\n\"" );
  }
  else
  {
    G_Printf("admitdefeat: invalid team\n");
    return;
  }
  level.surrenderTeam = team;
  G_BaseSelfDestruct( team );
}
コード例 #3
0
ファイル: g_target.c プロジェクト: Justasic/RTCW-SP
/*QUAKED target_print (1 0 0) (-8 -8 -8) (8 8 8) redteam blueteam private
"message"   text to print
If "private", only the activator gets the message.  If no checks, all clients get the message.
*/
void Use_Target_Print(gentity_t *ent, gentity_t *other, gentity_t *activator)
{
    if(activator->client && (ent->spawnflags & 4))
    {
        trap_SendServerCommand(activator - g_entities, va("cp \"%s\"", ent->message));
        return;
    }

    if(ent->spawnflags & 3)
    {
        if(ent->spawnflags & 1)
        {
            G_TeamCommand(TEAM_RED, va("cp \"%s\"", ent->message));
        }

        if(ent->spawnflags & 2)
        {
            G_TeamCommand(TEAM_BLUE, va("cp \"%s\"", ent->message));
        }

        return;
    }

    trap_SendServerCommand(-1, va("cp \"%s\"", ent->message));
}
コード例 #4
0
ファイル: g_target.c プロジェクト: SHOVELL/Unvanquished
/*QUAKED target_print (1 0 0) (-8 -8 -8) (8 8 8) humanteam alienteam private
"message" text to print
If "private", only the activator gets the message.  If no checks, all clients get the message.
*/
void Use_Target_Print( gentity_t *ent, gentity_t *other, gentity_t *activator )
{
	if ( activator->client && ( ent->spawnflags & 4 ) )
	{
		G_SendCommandFromServer( activator - g_entities, va( "cp \"%s\"", ent->message ) );
		return;
	}

	if ( ent->spawnflags & 3 )
	{
		if ( ent->spawnflags & 1 )
		{
			G_TeamCommand( PTE_HUMANS, va( "cp \"%s\"", ent->message ) );
		}

		if ( ent->spawnflags & 2 )
		{
			G_TeamCommand( PTE_ALIENS, va( "cp \"%s\"", ent->message ) );
		}

		return;
	}

	G_SendCommandFromServer( -1, va( "cp \"%s\"", ent->message ) );
}
コード例 #5
0
/*
=================================================================================

target_print

=================================================================================
*/
void target_print_act( gentity_t *self, gentity_t *other, gentity_t *activator )
{
	if ( self->spawnflags & 4 )
	{
		if ( activator && activator->client )
		{
			trap_SendServerCommand( activator - g_entities, va( "cp %s", Quote( self->message ) ) );
		}

		return;
	}

	if ( self->spawnflags & 3 )
	{
		if ( self->spawnflags & 1 )
		{
			G_TeamCommand( TEAM_HUMANS, va( "cp %s", Quote( self->message ) ) );
		}

		if ( self->spawnflags & 2 )
		{
			G_TeamCommand( TEAM_ALIENS, va( "cp %s", Quote( self->message ) ) );
		}

		return;
	}

	trap_SendServerCommand( -1, va( "cp %s", Quote( self->message ) ) );
}
コード例 #6
0
ファイル: g_svcmds.c プロジェクト: Sixthly/Unvanquished
static void Svcmd_TeamMessage_f( void )
{
	char   teamNum[ 2 ];
	team_t team;
	char   *arg;

	if ( trap_Argc() < 3 )
	{
		G_Printf( "usage: say_team <team> <message>\n" );
		return;
	}

	trap_Argv( 1, teamNum, sizeof( teamNum ) );
	team = G_TeamFromString( teamNum );

	if ( team == NUM_TEAMS )
	{
		G_Printf( "say_team: invalid team \"%s\"\n", teamNum );
		return;
	}

	arg = ConcatArgs( 2 );
	G_TeamCommand( team, va( "chat -1 %d %s", SAY_TEAM, Quote( arg ) ) );
	G_LogPrintf( "SayTeam: -1 \"console\": %s\n", arg );
}
コード例 #7
0
ファイル: g_svcmds_ext.c プロジェクト: sookee/oa-mod
/*
============
Svcmd_TeamMessage_f
Sends a Chat Message to a Team from the Console
============
*/
void Svcmd_TeamMessage_f( void )
{
  char   teamNum[ 2 ];
  const char*   prefix;
  team_t team;

  if( trap_Argc( ) < 3 )
  {
    G_Printf( "usage: say_team <team> <message>\n" );
    return;
  }

  trap_Argv( 1, teamNum, sizeof( teamNum ) );
  team = G_TeamFromString( teamNum );

  if( team == TEAM_NUM_TEAMS )
  {
    G_Printf( "say_team: invalid team \"%s\"\n", teamNum );
    return;
  }

  prefix = BG_TeamName( team );
  prefix = va( "[%c] ", toupper( *prefix ) );

  G_TeamCommand( team, va( "tchat \"(console): " S_COLOR_CYAN "%s\"", ConcatArgs( 2 ) ) );
  G_LogPrintf( "sayteam: %sconsole: " S_COLOR_CYAN "%s\n", prefix, ConcatArgs( 2 ) );
}
コード例 #8
0
	virtual void execute( GameEntity *other, GameEntity *activator ) 
	{
		if( activator->client_ && ( self_->spawnflags_ & 4 ) ) 
		{
			SV_GameSendServerCommand( activator->s.number, va("cp \"%s\"", self_->message_ ));
			return;
		}

		if( self_->spawnflags_ & 3 ) 
		{
			if ( self_->spawnflags_ & 1 ) 
				G_TeamCommand( ClientBase::TEAM_RED, va("cp \"%s\"", self_->message_) );
			if ( self_->spawnflags_ & 2 ) 
				G_TeamCommand( ClientBase::TEAM_BLUE, va("cp \"%s\"", self_->message_) );
			return;
		}

		SV_GameSendServerCommand( -1, va("cp \"%s\"", self_->message_ ));
	}
コード例 #9
0
ファイル: g_target.c プロジェクト: norfenstein/umbra
/*QUAKED target_print (1 0 0) (-8 -8 -8) (8 8 8) humanteam alienteam private
"message" text to print
If "private", only the activator gets the message.  If no checks, all clients get the message.
*/
void Use_Target_Print( gentity_t *ent, gentity_t *other, gentity_t *activator )
{
  if( ent->spawnflags & 4 )
  {
    if( activator && activator->client )
      trap_SendServerCommand( activator-g_entities, va( "cp \"%s\"", ent->message ) );
    return;
  }

  if( ent->spawnflags & 3 )
  {
    if( ent->spawnflags & 1 )
      G_TeamCommand( TEAM_HUMANS, va( "cp \"%s\"", ent->message ) );
    if( ent->spawnflags & 2 )
      G_TeamCommand( TEAM_ALIENS, va( "cp \"%s\"", ent->message ) );

    return;
  }

  trap_SendServerCommand( -1, va("cp \"%s\"", ent->message ) );
}
コード例 #10
0
ファイル: g_target.c プロジェクト: SinSiXX/Rogue-Reborn
/*QUAKED target_print (1 0 0) (-8 -8 -8) (8 8 8) red_only blue_only private
"message"	text to print
If "private", only the activator gets the message.  If no checks, all clients get the message.
*/
void Use_Target_Print(gentity_t * ent, gentity_t * other, gentity_t * activator)
{
	if(activator->client && ent->priv)
	{
		trap_SendServerCommand(activator - g_entities, va("cp \"%s\"", ent->message));
		return;
	}

	if(ent->red_only)
	{
		G_TeamCommand(TEAM_RED, va("cp \"%s\"", ent->message));
		return;
	}
	if(ent->blue_only)
	{
		G_TeamCommand(TEAM_BLUE, va("cp \"%s\"", ent->message));
		return;
	}

	trap_SendServerCommand(-1, va("cp \"%s\"", ent->message));
}
コード例 #11
0
/*QUAKED target_print (1 0 0) (-8 -8 -8) (8 8 8) redteam blueteam private
"message"	text to print
"wait"		don't fire off again if triggered within this many milliseconds ago
If "private", only the activator gets the message.  If no checks, all clients get the message.
*/
void Use_Target_Print (gentity_t *ent, gentity_t *other, gentity_t *activator)
{
	if (!ent || !ent->inuse)
	{
		Com_Printf("ERROR: Bad ent in Use_Target_Print");
		return;
	}

	if (ent->wait)
	{
		if (ent->genericValue14 >= level.time)
		{
			return;
		}
		ent->genericValue14 = level.time + ent->wait;
	}

#ifndef FINAL_BUILD
	if (!ent || !ent->inuse)
	{
		Com_Error(ERR_DROP, "Bad ent in Use_Target_Print");
	}
	else if (!activator || !activator->inuse)
	{
		Com_Error(ERR_DROP, "Bad activator in Use_Target_Print");
	}

	/*if (ent->genericValue15 > level.time) // lol wtf is this bullshit
	{
		Com_Printf("TARGET PRINT ERRORS:\n");
		if (activator && activator->classname && activator->classname[0])
		{
			Com_Printf("activator classname: %s\n", activator->classname);
		}
		if (activator && activator->target && activator->target[0])
		{
			Com_Printf("activator target: %s\n", activator->target);
		}
		if (activator && activator->targetname && activator->targetname[0])
		{
			Com_Printf("activator targetname: %s\n", activator->targetname);
		}
		if (ent->targetname && ent->targetname[0])
		{
			Com_Printf("print targetname: %s\n", ent->targetname);
		}
		Com_Error(ERR_DROP, "target_print used in quick succession, fix it! See the console for details.");
	}
	ent->genericValue15 = level.time + 5000;*/
#endif

	G_ActivateBehavior(ent,BSET_USE);
	if ( ( ent->spawnflags & 4 ) ) 
	{//private, to one client only
		if (!activator || !activator->inuse)
		{
			Com_Printf("ERROR: Bad activator in Use_Target_Print");
		}
		if ( activator && activator->client )
		{//make sure there's a valid client ent to send it to
			if (ent->message[0] == '@' && ent->message[1] != '@')
			{
				trap_SendServerCommand( activator-g_entities, va("cps \"%s\"", ent->message ));
			}
			else
			{
				trap_SendServerCommand( activator-g_entities, va("cp \"%s\"", ent->message ));
			}
		}
		//NOTE: change in functionality - if there *is* no valid client ent, it won't send it to anyone at all
		return;
	}

	if ( ent->spawnflags & 3 ) {
		if ( ent->spawnflags & 1 ) {
			if (ent->message[0] == '@' && ent->message[1] != '@')
			{
				G_TeamCommand( TEAM_RED, va("cps \"%s\"", ent->message) );
			}
			else
			{
				G_TeamCommand( TEAM_RED, va("cp \"%s\"", ent->message) );
			}
		}
		if ( ent->spawnflags & 2 ) {
			if (ent->message[0] == '@' && ent->message[1] != '@')
			{
				G_TeamCommand( TEAM_BLUE, va("cps \"%s\"", ent->message) );
			}
			else
			{
				G_TeamCommand( TEAM_BLUE, va("cp \"%s\"", ent->message) );
			}
		}
		return;
	}

	if (ent->message[0] == '@' && ent->message[1] != '@')
	{
		trap_SendServerCommand( -1, va("cps \"%s\"", ent->message ));
	}
	else
	{
		trap_SendServerCommand( -1, va("cp \"%s\"", ent->message ));
	}
}
コード例 #12
0
ファイル: g_combat.c プロジェクト: Gireen/Unvanquished
/**
 * @brief Log deconstruct/destroy events
 * @param self
 * @param actor
 * @param mod
 */
void G_LogDestruction( gentity_t *self, gentity_t *actor, int mod )
{
	buildFate_t fate;

	switch ( mod )
	{
		case MOD_DECONSTRUCT:
			fate = BF_DECONSTRUCT;
			break;

		case MOD_REPLACE:
			fate = BF_REPLACE;
			break;

		case MOD_NOCREEP:
			fate = ( actor->client ) ? BF_UNPOWER : BF_AUTO;
			break;

		default:
			if ( actor->client )
			{
				if ( actor->client->pers.team ==
				     BG_Buildable( self->s.modelindex )->team )
				{
					fate = BF_TEAMKILL;
				}
				else
				{
					fate = BF_DESTROY;
				}
			}
			else
			{
				fate = BF_AUTO;
			}

			break;
	}

	G_BuildLogAuto( actor, self, fate );

	// don't log when marked structures are removed
	if ( mod == MOD_REPLACE )
	{
		return;
	}

	G_LogPrintf( S_COLOR_YELLOW "Deconstruct: %d %d %s %s: %s %s by %s\n",
	             ( int )( actor - g_entities ),
	             ( int )( self - g_entities ),
	             BG_Buildable( self->s.modelindex )->name,
	             modNames[ mod ],
	             BG_Buildable( self->s.modelindex )->humanName,
	             mod == MOD_DECONSTRUCT ? "deconstructed" : "destroyed",
	             actor->client ? actor->client->pers.netname : "<world>" );

	// No-power deaths for humans come after some minutes and it's confusing
	//  when the messages appear attributed to the deconner. Just don't print them.
	if ( mod == MOD_NOCREEP && actor->client &&
	     actor->client->pers.team == TEAM_HUMANS )
	{
		return;
	}

	if ( actor->client && actor->client->pers.team ==
	     BG_Buildable( self->s.modelindex )->team )
	{
		G_TeamCommand( (team_t) actor->client->pers.team,
		               va( "print_tr %s %s %s", mod == MOD_DECONSTRUCT ? QQ( N_("$1$ ^3DECONSTRUCTED^7 by $2$\n") ) :
						   QQ( N_("$1$ ^3DESTROYED^7 by $2$\n") ),
		                   Quote( BG_Buildable( self->s.modelindex )->humanName ),
		                   Quote( actor->client->pers.netname ) ) );
	}
}
コード例 #13
0
/*QUAKED target_print (1 0 0) (-8 -8 -8) (8 8 8) redteam blueteam private
"message"	text to print
"wait"		don't fire off again if triggered within this many milliseconds ago
If "private", only the activator gets the message.  If no checks, all clients get the message.
*/
void Use_Target_Print (gentity_t *ent, gentity_t *other, gentity_t *activator)
{
	if (!ent || !ent->inuse)
	{
		Com_Printf("ERROR: Bad ent in Use_Target_Print");
		return;
	}

	if (ent->wait)
	{
		if (ent->genericValue14 >= level.time)
		{
			return;
		}
		ent->genericValue14 = level.time + ent->wait;
	}

#ifndef FINAL_BUILD
	if (!ent || !ent->inuse)
	{
		Com_Error(ERR_DROP, "Bad ent in Use_Target_Print");
	}
	else if (!activator || !activator->inuse)
	{
		Com_Error(ERR_DROP, "Bad activator in Use_Target_Print");
	}
#endif

	G_ActivateBehavior(ent,BSET_USE);
	if ( ( ent->spawnflags & 4 ) ) 
	{//private, to one client only
		if (!activator || !activator->inuse)
		{
			Com_Printf("ERROR: Bad activator in Use_Target_Print");
		}
		if ( activator && activator->client )
		{//make sure there's a valid client ent to send it to
			if (ent->message[0] == '@' && ent->message[1] != '@')
			{
				trap->SendServerCommand( activator-g_entities, va("cps \"%s\"", ent->message ));
			}
			else
			{
				trap->SendServerCommand( activator-g_entities, va("cp \"%s\"", ent->message ));
			}
		}
		//NOTE: change in functionality - if there *is* no valid client ent, it won't send it to anyone at all
		return;
	}

	if ( ent->spawnflags & 3 ) {
		if ( ent->spawnflags & 1 ) {
			if (ent->message[0] == '@' && ent->message[1] != '@')
			{
				G_TeamCommand( TEAM_RED, va("cps \"%s\"", ent->message) );
			}
			else
			{
				G_TeamCommand( TEAM_RED, va("cp \"%s\"", ent->message) );
			}
		}
		if ( ent->spawnflags & 2 ) {
			if (ent->message[0] == '@' && ent->message[1] != '@')
			{
				G_TeamCommand( TEAM_BLUE, va("cps \"%s\"", ent->message) );
			}
			else
			{
				G_TeamCommand( TEAM_BLUE, va("cp \"%s\"", ent->message) );
			}
		}
		return;
	}

	if (ent->message[0] == '@' && ent->message[1] != '@')
	{
		trap->SendServerCommand( -1, va("cps \"%s\"", ent->message ));
	}
	else
	{
		trap->SendServerCommand( -1, va("cp \"%s\"", ent->message ));
	}
}