From: MirceaKitsune Date: Tue, 2 Aug 2011 16:16:07 +0000 (+0300) Subject: Armor helper X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=0f46276186bcfe7b3ee9f35a2d277ac211a77de7;p=voretournament%2Fvoretournament.git Armor helper --- diff --git a/data/defaultVT.cfg b/data/defaultVT.cfg index 18eceece..e60ce318 100644 --- a/data/defaultVT.cfg +++ b/data/defaultVT.cfg @@ -678,6 +678,7 @@ seta cl_helper 1 "enable helper system" seta cl_helper_voice default "name of the helper you wish to use from data/sound/helper" 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_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 5d91a7ef..87b8f15c 100644 --- a/data/qcsrc/client/View.qc +++ b/data/qcsrc/client/View.qc @@ -258,7 +258,7 @@ float stomachsplash_alpha; float volume_modify_1, volume_modify_2, volume_modify_default_1, volume_modify_default_2; float volume_modify_changed_1, volume_modify_changed_2; float eventchase_current_distance; -float helper_pause, helper_health; +float helper_pause, helper_health, helper_armor, helper_ammo; vector myhealth_gentlergb; vector liquidcolor_prev; vector damage_blurpostprocess, content_blurpostprocess; @@ -300,20 +300,42 @@ void CSQC_UpdateView(float w, float h) // helper system if(cvar("cl_helper")) - if(helper_pause <= time) - if(!intermission && !respawned && spectatee_status >= 0 && getstati(STAT_HEALTH) > 0 && !getstati(STAT_VORE_EATEN)) { - if(getstati(STAT_HEALTH) <= cvar("cl_helper_health_value")) + if(intermission || respawned || spectatee_status < 0 || getstati(STAT_HEALTH) <= 0 || getstati(STAT_VORE_EATEN)) { - if(!helper_health) + // Set these helper messages as having been triggered, so that the player must first reach them before they complain. + // Otherwise, if you don't have any start armor for instance, the helper will complain about low armor when we spawn. + helper_health = TRUE; + helper_armor = TRUE; + } + else if(helper_pause <= time) + { + // health helper + if(getstati(STAT_HEALTH) <= cvar("cl_helper_health_value")) { - 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"); + if(!helper_health) + { + 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"); + } + } + else if(helper_health) + helper_health = FALSE; + + // armor helper + if(getstati(STAT_ARMOR) <= cvar("cl_helper_armor_value")) + { + if(!helper_armor) + { + sound(self, CHAN_VOICE, strcat("helper/", cvar_string("cl_helper_voice"), "/armor_low.wav"), VOL_BASEVOICE, ATTN_NONE); + helper_armor = TRUE; + helper_pause = time + cvar("cl_helper_pause"); + } } + else if(helper_armor) + helper_armor = FALSE; } - else if(helper_health) - helper_health = FALSE; } // event chase camera diff --git a/data/qcsrc/client/miscfunctions.qc b/data/qcsrc/client/miscfunctions.qc index 1c3da912..994cf71c 100644 --- a/data/qcsrc/client/miscfunctions.qc +++ b/data/qcsrc/client/miscfunctions.qc @@ -182,6 +182,7 @@ void Announcer_Precache () { precache_sound (strcat("announcer/", cvar_string("cl_announcer"), "/narrowly.wav")); precache_sound (strcat("helper/", cvar_string("cl_helper_voice"), "/health_low.wav")); + precache_sound (strcat("helper/", cvar_string("cl_helper_voice"), "/armor_low.wav")); } void AuditLists() diff --git a/data/sound/helper/default/armor_low.wav b/data/sound/helper/default/armor_low.wav new file mode 100644 index 00000000..f25888a5 Binary files /dev/null and b/data/sound/helper/default/armor_low.wav differ