Fixed a T buying bug

Added the ability of the C4 Bomb to "explode"...
Added a random-bombguy selection thingie for the Ts.
This commit is contained in:
Marco Hladik 2016-12-07 01:57:17 +01:00
parent 4f7defcb98
commit 604bdff844
6 changed files with 47 additions and 15 deletions

View file

@ -96,6 +96,7 @@ string sCSPlayers[9] = {
"models/player/gign/gign.mdl" "models/player/gign/gign.mdl"
}; };
void Rules_RoundOver( int iTeamWon );
float Rules_BuyingPossible( void ); float Rules_BuyingPossible( void );
void Timer_Begin( float fTime, float fMode); void Timer_Begin( float fTime, float fMode);
void Spawn_RespawnClient( float fTeam ); void Spawn_RespawnClient( float fTeam );

View file

@ -66,7 +66,7 @@ void Game_CreateBuyZones( void ) {
entity eFind; entity eFind;
if ( iBuyRestriction == BUY_T || iBuyRestriction == BUY_BOTH ) { if ( iBuyRestriction == BUY_T || iBuyRestriction == BUY_BOTH ) {
eFind = findchain( classname, "info_player_start" ); eFind = findchain( classname, "info_player_deathmatch" );
while ( eFind ) { while ( eFind ) {
entity eBuyZoneT = spawn(); entity eBuyZoneT = spawn();

View file

@ -59,11 +59,11 @@ float Rules_BuyingPossible( void ) {
// Loop through all players and respawn them // Loop through all players and respawn them
void Rules_Restart( void ) { void Rules_Restart( void ) {
//localcmd( "restart_ents" ); //localcmd( "restart_ents" );
entity eOldSelf;
entity eFind = findchain( classname, "player" ); entity eFind = findchain( classname, "player" );
while ( eFind ) { while ( eFind ) {
entity eOldSelf = self; eOldSelf = self;
self = eFind; self = eFind;
if ( self.health > 0 ) { if ( self.health > 0 ) {
@ -76,6 +76,30 @@ void Rules_Restart( void ) {
eFind = eFind.chain; eFind = eFind.chain;
} }
// Select a random Terrorist for the bomb thing
if ( iBombZones > 0 ) {
int iRandomT = ceil( random() * iAlivePlayers_T );
int iPicked = 0;
eFind = findchain( classname, "player" );
while ( eFind ) {
if ( eFind.classname == "player" && eFind.team == TEAM_T ) {
iPicked++;
if ( iPicked == iRandomT ) {
eOldSelf = self;
self = eFind;
Weapon_AddItem( WEAPON_C4BOMB );
self = eOldSelf;
}
}
eFind = eFind.chain;
}
}
Timer_Begin( cvar( "mp_freezetime" ), GAME_FREEZE ); Timer_Begin( cvar( "mp_freezetime" ), GAME_FREEZE );
} }
@ -116,5 +140,9 @@ Also allows people to set the bomb placing radius incase you want to use info_bo
*/ */
.float buying; .float buying;
void info_map_parameters( void ) { void info_map_parameters( void ) {
iBuyRestriction = self.buying; if ( !self.buying ) {
self.buying = BUY_BOTH;
} else {
iBuyRestriction = self.buying;
}
} }

View file

@ -41,7 +41,7 @@ weaponinfo_t wptC4BOMB = {
0.0, // Attack-Delay 0.0, // Attack-Delay
0.0, // Reload-Delay 0.0, // Reload-Delay
iAmmo_9MM, // Caliber Pointer iAmmo_9MM, // Caliber Pointer
iAmmo_9MM, // Clip Pointer iAmmo_9MM, // Clip Pointer
1, // Accuracy Divisor 1, // Accuracy Divisor
1, // Accuracy Offset 1, // Accuracy Offset
1 // Max Inaccuracy 1 // Max Inaccuracy
@ -57,9 +57,21 @@ enum {
#ifdef SSQC #ifdef SSQC
void WeaponC4BOMB_Drop( vector vBombPos ) { void WeaponC4BOMB_Drop( vector vBombPos ) {
static void c4bomb_think( void ) {
if ( self.fAttackFinished < time ) {
Rules_RoundOver( TEAM_T );
remove( self );
return;
}
self.nextthink = time + 0.12;
}
entity eBomb = spawn(); entity eBomb = spawn();
setorigin( eBomb, vBombPos ); setorigin( eBomb, vBombPos );
setmodel( eBomb, "models/w_c4.mdl" ); setmodel( eBomb, "models/w_c4.mdl" );
eBomb.think = c4bomb_think;
eBomb.nextthink = time + 0.12;
eBomb.fAttackFinished = time + 45;
sound( world, CHAN_VOICE, "radio/bombpl.wav", 1.0, ATTN_NONE ); sound( world, CHAN_VOICE, "radio/bombpl.wav", 1.0, ATTN_NONE );
@ -69,8 +81,6 @@ void WeaponC4BOMB_Drop( vector vBombPos ) {
void WeaponC4BOMB_Draw( void ) { void WeaponC4BOMB_Draw( void ) {
#ifdef SSQC #ifdef SSQC
self.iCurrentClip = 0;
self.iCurrentCaliber = 0;
Client_SendEvent( self, EV_WEAPON_DRAW ); Client_SendEvent( self, EV_WEAPON_DRAW );
#else #else
View_PlayAnimation( ANIM_C4_DRAW ); View_PlayAnimation( ANIM_C4_DRAW );

View file

@ -124,6 +124,7 @@ void WeaponGLOCK18_Secondary( void ) {
// Tell the client that we switched modes, too // Tell the client that we switched modes, too
Client_SendEvent( self, EV_WEAPON_SECONDARYATTACK ); Client_SendEvent( self, EV_WEAPON_SECONDARYATTACK );
// TODO: Move to the clientside
if ( self.iMode_GLOCK18 == TRUE ) { if ( self.iMode_GLOCK18 == TRUE ) {
centerprint( self, "Switched to Burst-Fire mode" ); centerprint( self, "Switched to Burst-Fire mode" );
} else { } else {

View file

@ -18,14 +18,6 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
.int iClip_GLOCK18;
#ifdef SSQC
.int iMode_GLOCK18;
#else
int iWeaponMode_GLOCK18;
#endif
// Weapon Info // Weapon Info
weaponinfo_t wptKNIFE = { weaponinfo_t wptKNIFE = {
WEAPON_KNIFE, // Identifier WEAPON_KNIFE, // Identifier