+ if((last_health <= 0 && getstati(STAT_HEALTH) > 0) || (!spectatee_status && last_spectatee)) // also cover switching from a spectator to a player instantly\r
+ if not(spectatee_status && last_spectatee != spectatee_status) // not if we switched players and that detects a different health\r
+ respawned = TRUE; // stays true for one frame\r
+\r
+ // helper system\r
+ if(cvar("cl_helper"))\r
+ {\r
+ if(intermission || respawned || spectatee_status < 0 || getstati(STAT_HEALTH) <= 0 || getstati(STAT_VORE_EATEN))\r
+ {\r
+ // Set these helper messages as having been triggered, so that the player must first reach them before they complain.\r
+ // Otherwise, if you don't have any start armor for instance, the helper will complain about low armor when we spawn.\r
+ helper_health = TRUE;\r
+ helper_armor = TRUE;\r
+ }\r
+ else if(helper_pause <= time)\r
+ {\r
+ // health helper\r
+ if(getstati(STAT_HEALTH) <= cvar("cl_helper_item_health"))\r
+ {\r
+ if(!helper_health)\r
+ {\r
+ sound(self, CHAN_VOICE, strcat("helper/", cvar_string("cl_helper_voice"), "/health_low.wav"), VOL_BASEVOICE, ATTN_NONE);\r
+ helper_health = TRUE;\r
+ helper_pause = time + cvar("cl_helper_pause");\r
+ helper_ammo = time + cvar("cl_helper_pause");\r
+ }\r
+ }\r
+ else if(helper_health)\r
+ helper_health = FALSE;\r
+\r
+ // armor helper\r
+ if(getstati(STAT_ARMOR) <= cvar("cl_helper_item_armor"))\r
+ {\r
+ if(!helper_armor)\r
+ {\r
+ sound(self, CHAN_VOICE, strcat("helper/", cvar_string("cl_helper_voice"), "/armor_low.wav"), VOL_BASEVOICE, ATTN_NONE);\r
+ helper_armor = TRUE;\r
+ helper_pause = time + cvar("cl_helper_pause");\r
+ }\r
+ }\r
+ else if(helper_armor)\r
+ helper_armor = FALSE;\r
+\r
+ // ammo helper\r
+ if(getstati(STAT_FUEL) <= cvar("cl_helper_item_ammo_fuel"))\r
+ {\r
+ if(!helper_ammo)\r
+ {\r
+ sound(self, CHAN_VOICE, strcat("helper/", cvar_string("cl_helper_voice"), "/ammo_low.wav"), VOL_BASEVOICE, ATTN_NONE);\r
+ helper_ammo = TRUE;\r
+ helper_pause = time + cvar("cl_helper_pause");\r
+ }\r
+ }\r
+ else if(helper_ammo)\r
+ helper_ammo = FALSE;\r
+\r
+ // speed helper\r
+ if(vlen(pmove_vel) >= cvar("cl_helper_item_speed"))\r
+ {\r
+ if(!helper_speed)\r
+ {\r
+ sound(self, CHAN_VOICE, strcat("helper/", cvar_string("cl_helper_voice"), "/speed_fast.wav"), VOL_BASEVOICE, ATTN_NONE);\r
+ helper_speed = TRUE;\r
+ helper_pause = time + cvar("cl_helper_pause");\r
+ }\r
+ }\r
+ else if(helper_speed)\r
+ helper_speed = FALSE;\r
+\r
+ // stomach load helper\r
+ if(getstati(STAT_VORE_LOAD) / getstati(STAT_VORE_MAXLOAD) >= cvar("cl_helper_item_stomachload"))\r
+ {\r
+ if(!helper_stomachload)\r
+ {\r
+ sound(self, CHAN_VOICE, strcat("helper/", cvar_string("cl_helper_voice"), "/stomach_load.wav"), VOL_BASEVOICE, ATTN_NONE);\r
+ helper_stomachload = TRUE;\r
+ helper_pause = time + cvar("cl_helper_pause");\r
+ }\r
+ }\r
+ else if(helper_stomachload)\r
+ helper_stomachload = FALSE;\r
+ }\r
+ }\r
+\r
+ // event chase camera\r
+ if(cvar("chase_active") <= 0) // greater than 0 means it's enabled manually, and this code is skipped\r
+ {\r
+ if(!getstati(STAT_VORE_EATEN) && spectatee_status >= 0 && (cvar("cl_eventchase_death") && getstati(STAT_HEALTH) <= 0 && !intermission))\r
+ {\r
+ // We must enable chase_active to get a third person view (weapon viewmodel hidden and own player model showing).\r
+ // Ideally, there should be another way to enable third person cameras, such as through R_SetView()\r
+ if(!cvar("chase_active"))\r
+ cvar_set("chase_active", "-1"); // -1 enables chase_active while marking it as set by this code, and not by the user (which would be 1)\r
+\r
+ // make the camera smooth back\r
+ if(cvar("cl_eventchase_speed") && eventchase_current_distance < cvar("cl_eventchase_distance"))\r
+ eventchase_current_distance += cvar("cl_eventchase_speed") * (cvar("cl_eventchase_distance") - eventchase_current_distance) * frametime; // slow down the further we get\r
+ else if(eventchase_current_distance != cvar("cl_eventchase_distance"))\r
+ eventchase_current_distance = cvar("cl_eventchase_distance");\r
+\r
+ vector eventchase_target_origin;\r
+ makevectors(view_angles);\r
+ // pass 1, used to check where the camera would go and obtain the trace_fraction\r
+ eventchase_target_origin = pmove_org - v_forward * eventchase_current_distance;\r
+\r
+ traceline(pmove_org, eventchase_target_origin, MOVE_WORLDONLY, self);\r
+ // pass 2, also multiplying view_forward with trace_fraction, to prevent the camera from going through walls\r
+ // The 0.1 subtraction is to not limit the camera precisely at the wall surface, as that allows the view to poke through\r
+ eventchase_target_origin = pmove_org - v_forward * eventchase_current_distance * (trace_fraction - 0.1);\r
+\r
+ R_SetView(VF_ORIGIN, eventchase_target_origin);\r
+ R_SetView(VF_ANGLES, view_angles);\r
+ }\r
+ else if(cvar("chase_active") < 0) // time to disable chase_active if it was set by this code\r
+ {\r
+ cvar_set("chase_active", "0");\r
+ eventchase_current_distance = 0; // start from 0 next time\r
+ }\r
+ }\r
+\r