From: Samual Date: Thu, 5 Jan 2012 21:33:20 +0000 (-0500) Subject: 2 new features: Don't switch away from a weapon if one of its modes can still fire... X-Git-Tag: xonotic-v0.6.0~188^2~22^2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=9c9fd6173f9cdedd12218b8fb83c8450568ef051;p=xonotic%2Fxonotic-data.pk3dir.git 2 new features: Don't switch away from a weapon if one of its modes can still fire (excluding rocketlauncher detonation and nexgun zoom, those aren't real fire modes), and a feature for electro combo to ONLY allow firing of the secondary if the primary still has enough ammo after that. --- diff --git a/balance25.cfg b/balance25.cfg index 8dc874e7f..2374897b7 100644 --- a/balance25.cfg +++ b/balance25.cfg @@ -437,6 +437,7 @@ set g_balance_electro_combo_force 200 set g_balance_electro_combo_radius 250 set g_balance_electro_combo_comboradius 0 set g_balance_electro_combo_speed 2000 +set g_balance_electro_combo_safeammocheck 0 set g_balance_electro_reload_ammo 0 //default: 20 set g_balance_electro_reload_time 2 // }}} diff --git a/balanceFruitieX.cfg b/balanceFruitieX.cfg index 8568cc41a..8a0bbc043 100644 --- a/balanceFruitieX.cfg +++ b/balanceFruitieX.cfg @@ -437,6 +437,7 @@ set g_balance_electro_combo_force 80 set g_balance_electro_combo_radius 250 set g_balance_electro_combo_comboradius 0 set g_balance_electro_combo_speed 400 +set g_balance_electro_combo_safeammocheck 1 set g_balance_electro_reload_ammo 0 //default: 20 set g_balance_electro_reload_time 2 // }}} diff --git a/balanceXPM.cfg b/balanceXPM.cfg index 4bc6d041f..a866d7524 100644 --- a/balanceXPM.cfg +++ b/balanceXPM.cfg @@ -437,6 +437,7 @@ set g_balance_electro_combo_force 120 set g_balance_electro_combo_radius 175 set g_balance_electro_combo_comboradius 275 set g_balance_electro_combo_speed 2000 +set g_balance_electro_combo_safeammocheck 0 set g_balance_electro_reload_ammo 0 //default: 20 set g_balance_electro_reload_time 2 // }}} diff --git a/balanceXonotic.cfg b/balanceXonotic.cfg index 4bea6c3b1..b4e368a28 100644 --- a/balanceXonotic.cfg +++ b/balanceXonotic.cfg @@ -437,6 +437,7 @@ set g_balance_electro_combo_force 120 set g_balance_electro_combo_radius 175 set g_balance_electro_combo_comboradius 275 set g_balance_electro_combo_speed 2000 +set g_balance_electro_combo_safeammocheck 1 set g_balance_electro_reload_ammo 0 //default: 20 set g_balance_electro_reload_time 2 // }}} diff --git a/qcsrc/server/autocvars.qh b/qcsrc/server/autocvars.qh index 0d794da2e..a57590204 100644 --- a/qcsrc/server/autocvars.qh +++ b/qcsrc/server/autocvars.qh @@ -197,6 +197,7 @@ float autocvar_g_balance_electro_combo_edgedamage; float autocvar_g_balance_electro_combo_force; float autocvar_g_balance_electro_combo_radius; float autocvar_g_balance_electro_combo_speed; +float autocvar_g_balance_electro_combo_safeammocheck; float autocvar_g_balance_electro_lightning; float autocvar_g_balance_electro_primary_ammo; float autocvar_g_balance_electro_primary_animtime; diff --git a/qcsrc/server/cl_weaponsystem.qc b/qcsrc/server/cl_weaponsystem.qc index e049ef858..4a35f481b 100644 --- a/qcsrc/server/cl_weaponsystem.qc +++ b/qcsrc/server/cl_weaponsystem.qc @@ -878,7 +878,17 @@ void W_SwitchToOtherWeapon(entity pl) if(ww) W_SwitchWeapon_Force(pl, ww); } + +string PrimaryOrSecondary(float secondary) +{ + if(secondary) + return "secondary"; + else + return "primary"; +} + .float prevdryfire; +.float prevwarntime; float weapon_prepareattack_checkammo(float secondary) { if not(self.items & IT_UNLIMITED_WEAPON_AMMO) @@ -896,7 +906,19 @@ float weapon_prepareattack_checkammo(float secondary) self.prevdryfire = time; } - W_SwitchToOtherWeapon(self); + if(weapon_action(self.weapon, WR_CHECKAMMO2 - secondary)) // check if the other firing mode has enough ammo + { + if(time - self.prevwarntime > 1) + { + sprint(self, strcat("^2", W_Name(self.weapon), " ", PrimaryOrSecondary(secondary), "^7 is unable to fire, but its ^2", PrimaryOrSecondary(1 - secondary), "^7 can.\n")); + } + self.prevwarntime = time; + } + else // this weapon is totally unable to fire, switch to another one + { + W_SwitchToOtherWeapon(self); + } + return FALSE; } return TRUE; diff --git a/qcsrc/server/w_electro.qc b/qcsrc/server/w_electro.qc index ec333cc72..9b1b96e56 100644 --- a/qcsrc/server/w_electro.qc +++ b/qcsrc/server/w_electro.qc @@ -525,8 +525,16 @@ float w_electro(float req) } else if (req == WR_CHECKAMMO2) { - ammo_amount = self.ammo_cells >= autocvar_g_balance_electro_secondary_ammo; - ammo_amount += self.(weapon_load[WEP_ELECTRO]) >= autocvar_g_balance_electro_secondary_ammo; + if(autocvar_g_balance_electro_combo_safeammocheck) // true if you can fire at least one secondary blob AND one primary shot after it, otherwise false. + { + ammo_amount = self.ammo_cells >= autocvar_g_balance_electro_secondary_ammo + autocvar_g_balance_electro_primary_ammo; + ammo_amount += self.(weapon_load[WEP_ELECTRO]) >= autocvar_g_balance_electro_secondary_ammo + autocvar_g_balance_electro_primary_ammo; + } + else + { + ammo_amount = self.ammo_cells >= autocvar_g_balance_electro_secondary_ammo; + ammo_amount += self.(weapon_load[WEP_ELECTRO]) >= autocvar_g_balance_electro_secondary_ammo; + } return ammo_amount; } else if (req == WR_RESETPLAYER) diff --git a/qcsrc/server/w_minelayer.qc b/qcsrc/server/w_minelayer.qc index afe37b56f..3ec50da50 100644 --- a/qcsrc/server/w_minelayer.qc +++ b/qcsrc/server/w_minelayer.qc @@ -267,7 +267,7 @@ void W_Mine_Attack (void) if(W_Mine_Count(self) >= autocvar_g_balance_minelayer_limit) { // the refire delay keeps this message from being spammed - sprint(self, strcat("You cannot place more than ^2", ftos(autocvar_g_balance_minelayer_limit), " ^7mines at a time\n") ); + sprint(self, strcat("minelayer: You cannot place more than ^2", ftos(autocvar_g_balance_minelayer_limit), " ^7mines at a time\n") ); play2(self, "weapons/unavailable.wav"); return; } diff --git a/qcsrc/server/w_nex.qc b/qcsrc/server/w_nex.qc index 3f47b48fd..cdcabc866 100644 --- a/qcsrc/server/w_nex.qc +++ b/qcsrc/server/w_nex.qc @@ -221,10 +221,17 @@ float w_nex(float req) } else if (req == WR_CHECKAMMO2) { - // don't allow charging if we don't have enough ammo - ammo_amount = self.ammo_cells >= autocvar_g_balance_nex_secondary_ammo; - ammo_amount += self.(weapon_load[WEP_NEX]) >= autocvar_g_balance_nex_secondary_ammo; - return ammo_amount; + if(autocvar_g_balance_nex_secondary) + { + // don't allow charging if we don't have enough ammo + ammo_amount = self.ammo_cells >= autocvar_g_balance_nex_secondary_ammo; + ammo_amount += self.(weapon_load[WEP_NEX]) >= autocvar_g_balance_nex_secondary_ammo; + return ammo_amount; + } + else + { + return FALSE; // zoom is not a fire mode + } } else if (req == WR_RELOAD) {