Added !grab (Issue 135)
Added nobuild for hovels while wallwalking, g_wwNoHovelBuild cvar (Issue 136)
This commit is contained in:
1 parent
456216fc3c
commit
f25c7cb807
6 files changed
+111
-2
No files matched your search
@@ -1613,6 +1613,16 @@ void ClientThink_real( gentity_t *ent )
|
||||
{
|
||||
ent->client->ps.gravity = ent->client->pers.cusgravlvl;
|
||||
}
|
||||
|
||||
if( client->pers.grabbed ){
|
||||
vec3_t clear;
|
||||
clear[0] = 0;
|
||||
clear[1] = 0;
|
||||
clear[2] = 0;
|
||||
VectorCopy( clear, ent->client->ps.velocity );
|
||||
VectorCopy( ent->client->pers.grabber->s.origin, ent->client->ps.origin );
|
||||
}
|
||||
|
||||
|
||||
if( BG_InventoryContainsUpgrade( UP_MEDKIT, client->ps.stats ) &&
|
||||
BG_UpgradeIsActive( UP_MEDKIT, client->ps.stats ) )
|
||||
|
||||
@@ -150,6 +150,11 @@ g_admin_cmd_t g_admin_cmds[ ] =
|
||||
"cause a player to explode. Caution: damages surrounding players and structures.",
|
||||
"[^3name|slot#^7]"
|
||||
},
|
||||
|
||||
{"grab", G_admin_grab, "Q",
|
||||
"Grab a player as a spectator and make him move around.",
|
||||
"[^3name|slot#^7]"
|
||||
},
|
||||
|
||||
{"flag", G_admin_flag, "f",
|
||||
"add an admin flag to a player, prefix flag with '-' to disallow",
|
||||
@@ -7774,3 +7779,71 @@ qboolean G_admin_nobuildsave( gentity_t *ent, int skiparg )
|
||||
return qtrue;
|
||||
}
|
||||
|
||||
qboolean G_admin_grab( gentity_t *ent, int skiparg )
|
||||
{
|
||||
int pids[ MAX_CLIENTS ];
|
||||
char name[ MAX_NAME_LENGTH ], err[ MAX_STRING_CHARS ];
|
||||
int minargc;
|
||||
gentity_t *vic;
|
||||
int i;
|
||||
|
||||
if( !ent )
|
||||
{
|
||||
ADMP( "^3!grab: ^7console cannot use this command\n" );
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
minargc = 2 + skiparg;
|
||||
|
||||
if( G_SayArgc() < minargc )
|
||||
{
|
||||
ADMP( "^3!grab: ^7usage: !grab [name|slot#|clear]\n" );
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
G_SayArgv( 1 + skiparg, name, sizeof( name ) );
|
||||
|
||||
if( !strcmp( name, "clear") ){
|
||||
|
||||
for( i = 0; i < level.maxclients; i++ )
|
||||
{
|
||||
vic = &g_entities[ i ];
|
||||
if( !vic->client )
|
||||
continue;
|
||||
if( vic->client->pers.connected != CON_CONNECTED )
|
||||
continue;
|
||||
if( vic->client->pers.grabbed )
|
||||
{
|
||||
vic->client->pers.grabbed = qfalse;
|
||||
}
|
||||
}
|
||||
return qtrue;
|
||||
}
|
||||
|
||||
if( G_ClientNumbersFromString( name, pids ) != 1 )
|
||||
{
|
||||
G_MatchOnePlayer( pids, err, sizeof( err ) );
|
||||
ADMP( va( "^3!grab: ^7%s\n", err ) );
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
if( !admin_higher( ent, &g_entities[ pids[ 0 ] ] ) )
|
||||
{
|
||||
ADMP( "^3!grab: ^7sorry, but your intended victim has a higher admin"
|
||||
" level than you\n" );
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
vic = &g_entities[ pids[ 0 ] ];
|
||||
|
||||
if( vic->client->pers.grabbed ){
|
||||
ADMP( "^3!grab: ^7grabbing has been disabled.\n" );
|
||||
vic->client->pers.grabbed = qfalse;
|
||||
}
|
||||
else{
|
||||
vic->client->pers.grabber = ent;
|
||||
vic->client->pers.grabbed = qtrue;
|
||||
ADMP( "^3!grab: ^7grabbing has been enabled.\n" );
|
||||
}
|
||||
return qtrue;
|
||||
}
|
||||
@@ -271,6 +271,7 @@ qboolean G_admin_outlaw( gentity_t *ent, int skiparg );
|
||||
qboolean G_admin_fireworks( gentity_t *ent, int skiparg );
|
||||
qboolean G_admin_nobuild( gentity_t *ent, int skiparg );
|
||||
qboolean G_admin_nobuildsave( gentity_t *ent, int skiparg );
|
||||
qboolean G_admin_grab( gentity_t *ent, int skiparg );
|
||||
|
||||
void G_admin_print( gentity_t *ent, char *m );
|
||||
void G_admin_buffer_print( gentity_t *ent, char *m );
|
||||
|
||||
+17
-2
@@ -3173,6 +3173,13 @@ itemBuildError_t G_CanBuild( gentity_t *ent, buildable_t buildable, int distance
|
||||
if( ent->client->ps.stats[ STAT_PTEAM ] == PTE_ALIENS )
|
||||
{
|
||||
//alien criteria
|
||||
|
||||
//This is here to give that nice little red colored buildable to display that you cannot build there
|
||||
if( buildable == BA_A_HOVEL && ( ent->client->ps.stats[ STAT_STATE ] & SS_WALLCLIMBING ) && g_wwNoHovelBuild.integer ||
|
||||
buildable == BA_A_HOVEL && ( ent->client->ps.stats[ STAT_STATE ] & SS_WALLCLIMBINGCEILING ) && g_wwNoHovelBuild.integer )
|
||||
{
|
||||
reason = IBE_HOVELEXIT;
|
||||
}
|
||||
|
||||
if( buildable == BA_A_HOVEL )
|
||||
{
|
||||
@@ -3715,7 +3722,15 @@ qboolean G_BuildIfValid( gentity_t *ent, buildable_t buildable )
|
||||
vec3_t origin;
|
||||
|
||||
dist = BG_FindBuildDistForClass( ent->client->ps.stats[ STAT_PCLASS ] );
|
||||
|
||||
|
||||
//This is only here to report the reason why you cannot build the hovel
|
||||
if( buildable == BA_A_HOVEL && ( ent->client->ps.stats[ STAT_STATE ] & SS_WALLCLIMBING ) && g_wwNoHovelBuild.integer ||
|
||||
buildable == BA_A_HOVEL && ( ent->client->ps.stats[ STAT_STATE ] & SS_WALLCLIMBINGCEILING ) && g_wwNoHovelBuild.integer )
|
||||
{
|
||||
trap_SendServerCommand( ent-g_entities, va( "print \"You cannot build a hovel while wallwalking.\n\"" ) );
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
switch( G_CanBuild( ent, buildable, dist, origin ) )
|
||||
{
|
||||
case IBE_NONE:
|
||||
@@ -3821,7 +3836,7 @@ qboolean G_BuildIfValid( gentity_t *ent, buildable_t buildable )
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
|
||||
@@ -410,6 +410,9 @@ typedef struct
|
||||
char chat[ CHAT_MAXCHAN ][ CHAT_MAXPASS ];
|
||||
qboolean ignoreAdminWarnings;
|
||||
int lastTeamStatus;
|
||||
|
||||
qboolean grabbed;
|
||||
gentity_t *grabber;
|
||||
|
||||
qboolean firstConnect;
|
||||
} clientPersistant_t;
|
||||
@@ -1450,6 +1453,8 @@ extern vmCvar_t g_teamStatusTime; // Allow the use of /teamstatus
|
||||
extern vmCvar_t g_AllStats;
|
||||
extern vmCvar_t g_AllStatsTime;
|
||||
|
||||
extern vmCvar_t g_wwNoHovelBuild;
|
||||
|
||||
void trap_Printf( const char *fmt );
|
||||
void trap_Error( const char *fmt );
|
||||
int trap_Milliseconds( void );
|
||||
|
||||
@@ -249,6 +249,9 @@ vmCvar_t g_instantBuild;
|
||||
vmCvar_t g_AllStats;
|
||||
vmCvar_t g_AllStatsTime;
|
||||
|
||||
vmCvar_t g_wwNoHovelBuild;
|
||||
|
||||
|
||||
static cvarTable_t gameCvarTable[ ] =
|
||||
{
|
||||
// don't override the cheat state set by the system
|
||||
@@ -479,6 +482,8 @@ static cvarTable_t gameCvarTable[ ] =
|
||||
|
||||
{ &g_AllStats, "g_AllStats", "", CVAR_ARCHIVE, 0, qfalse },
|
||||
{ &g_AllStatsTime, "g_AllStatsTime", "", CVAR_ARCHIVE, 0, qfalse },
|
||||
|
||||
{ &g_wwNoHovelBuild, "g_wwNoHovelBuild", "0", CVAR_ARCHIVE, 0, qfalse }
|
||||
};
|
||||
|
||||
static int gameCvarTableSize = sizeof( gameCvarTable ) / sizeof( gameCvarTable[ 0 ] );
|
||||
|
||||
Reference in new issue
Block a user