diff options
Diffstat (limited to 'src/game/g_cmds.c')
-rw-r--r-- | src/game/g_cmds.c | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index 840fc3bb..4491cd77 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -1503,20 +1503,26 @@ void Cmd_Buy_f( gentity_t *ent ) //special case to keep norf happy if( weapon == WP_NONE && upgrade == UP_AMMO ) + buyingEnergyAmmo = BG_FindUsesEnergyForWeapon( ent->client->ps.weapon ); + + if( buyingEnergyAmmo ) { - //if we're buying ammo, there is a reactor/repeater in range and - //our current weapon uses energy - if( ( G_BuildableRange( ent->client->ps.origin, 100, BA_H_REACTOR ) || - G_BuildableRange( ent->client->ps.origin, 100, BA_H_REPEATER ) ) && - BG_FindUsesEnergyForWeapon( ent->client->ps.weapon ) ) - buyingEnergyAmmo = qtrue; + //no armoury nearby + if( ( !G_BuildableRange( ent->client->ps.origin, 100, BA_H_REACTOR ) && + !G_BuildableRange( ent->client->ps.origin, 100, BA_H_REPEATER ) ) ) + { + G_SendCommandFromServer( ent-g_entities, va( "print \"You must be near a reactor or repeater\n\"" ) ); + return; + } } - - //no armoury nearby - if( !G_BuildableRange( ent->client->ps.origin, 100, BA_H_ARMOURY ) && !buyingEnergyAmmo ) + else { - G_SendCommandFromServer( ent-g_entities, va( "print \"You must be near a powered armoury\n\"" ) ); - return; + //no armoury nearby + if( !G_BuildableRange( ent->client->ps.origin, 100, BA_H_ARMOURY ) ) + { + G_SendCommandFromServer( ent-g_entities, va( "print \"You must be near a powered armoury\n\"" ) ); + return; + } } if( weapon != WP_NONE ) @@ -1918,7 +1924,8 @@ Cmd_Reload_f */ void Cmd_Reload_f( gentity_t *ent ) { - ent->client->ps.pm_flags |= PMF_WEAPON_RELOAD; + if( ent->client->ps.weaponstate != WEAPON_RELOADING ) + ent->client->ps.pm_flags |= PMF_WEAPON_RELOAD; } /* |