From: MirceaKitsune Date: Tue, 2 Aug 2011 16:24:10 +0000 (+0300) Subject: Ammo helper X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=828f0da1e656690f8f57b14636d86e8a470032e9;p=voretournament%2Fvoretournament.git Ammo helper --- diff --git a/data/defaultVT.cfg b/data/defaultVT.cfg index e60ce318..d0c83f28 100644 --- a/data/defaultVT.cfg +++ b/data/defaultVT.cfg @@ -679,6 +679,7 @@ seta cl_helper_voice default "name of the helper you wish to use from data/sound seta cl_helper_pause 2 "number of seconds that must pass before the helper system can be triggered again" seta cl_helper_health_value 25 "the helper will warn you when going below this amount of health" seta cl_helper_armor_value 25 "the helper will warn you when going below this amount of armor" +seta cl_helper_ammo_fuel 25 "the helper will warn you when going below this amount of ammo" seta cl_eventchase_death 1 "camera goes into 3rd person mode when the player is dead" seta cl_eventchase_distance 140 "final camera distance" diff --git a/data/qcsrc/client/View.qc b/data/qcsrc/client/View.qc index 87b8f15c..0b4bde25 100644 --- a/data/qcsrc/client/View.qc +++ b/data/qcsrc/client/View.qc @@ -318,6 +318,7 @@ void CSQC_UpdateView(float w, float h) sound(self, CHAN_VOICE, strcat("helper/", cvar_string("cl_helper_voice"), "/health_low.wav"), VOL_BASEVOICE, ATTN_NONE); helper_health = TRUE; helper_pause = time + cvar("cl_helper_pause"); + helper_ammo = time + cvar("cl_helper_pause"); } } else if(helper_health) @@ -335,6 +336,19 @@ void CSQC_UpdateView(float w, float h) } else if(helper_armor) helper_armor = FALSE; + + // ammo helper + if(getstati(STAT_FUEL) <= cvar("cl_helper_ammo_fuel")) + { + if(!helper_ammo) + { + sound(self, CHAN_VOICE, strcat("helper/", cvar_string("cl_helper_voice"), "/ammo_low.wav"), VOL_BASEVOICE, ATTN_NONE); + helper_ammo = TRUE; + helper_pause = time + cvar("cl_helper_pause"); + } + } + else if(helper_ammo) + helper_ammo = FALSE; } } diff --git a/data/qcsrc/client/miscfunctions.qc b/data/qcsrc/client/miscfunctions.qc index 994cf71c..39fc32f8 100644 --- a/data/qcsrc/client/miscfunctions.qc +++ b/data/qcsrc/client/miscfunctions.qc @@ -183,6 +183,7 @@ void Announcer_Precache () { precache_sound (strcat("helper/", cvar_string("cl_helper_voice"), "/health_low.wav")); precache_sound (strcat("helper/", cvar_string("cl_helper_voice"), "/armor_low.wav")); + precache_sound (strcat("helper/", cvar_string("cl_helper_voice"), "/ammo_low.wav")); } void AuditLists()