]> de.git.xonotic.org Git - voretournament/voretournament.git/blobdiff - data/qcsrc/server/cl_player.qc
Don't run copybody for dead players in the stomach
[voretournament/voretournament.git] / data / qcsrc / server / cl_player.qc
index eeb17956b88df8860ff55f0beabb44d7b350b9ad..3a89ad46a23e2236117cf37f871afa17632a1e6b 100644 (file)
@@ -103,6 +103,10 @@ void WeaponStats_LogKill(float awep, float vwep)
 \r
 void CopyBody(float keepvelocity)\r
 {\r
+       // don't copybody for players inside the stomach\r
+       if(self.fakepredator.classname == "player")\r
+               return;\r
+\r
        local entity oldself;\r
        if (self.effects & EF_NODRAW)\r
                return;\r
@@ -279,8 +283,13 @@ void player_setupanimsformodel()
        }\r
        else\r
                dprint("File ", animfilename, " not found, assuming legacy .zym model animation timings\n");\r
+\r
+       // the line below is disabled due to issues with the stomach model, which cannot be animated.\r
+       // customizeentityforclient cannot let this part of the code know whether it's the stomach model or normal\r
+       // player model we're using. Attempting to animate the stomach model causes BIG issues, and must not be allowed.\r
+\r
        // reset animstate now\r
-       setanim(self, self.anim_idle, TRUE, FALSE, TRUE);\r
+       //setanim(self, self.anim_idle, TRUE, FALSE, TRUE);\r
 };\r
 \r
 void player_anim (void)\r
@@ -388,7 +397,8 @@ void PlayerCorpseDamage (entity inflictor, entity attacker, float damage, float
                self.armorvalue = self.armorvalue - save;\r
                self.health = self.health - take;\r
                // pause regeneration for 5 seconds\r
-               self.pauseregen_finished = max(self.pauseregen_finished, time + cvar("g_balance_pause_health_regen"));\r
+               self.pauseregenhealth_finished = max(self.pauseregenhealth_finished, time + cvar("g_balance_pause_health_regen"));\r
+               self.pauseregenarmor_finished = max(self.pauseregenarmor_finished, time + cvar("g_balance_pause_armor_regen"));\r
        }\r
        self.dmg_save = self.dmg_save + save;//max(save - 10, 0);\r
        self.dmg_take = self.dmg_take + take;//max(take - 10, 0);\r
@@ -465,7 +475,8 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht
                        self.armorvalue = self.armorvalue - save;\r
                        self.health = self.health - take;\r
                        // pause regeneration for 5 seconds\r
-                       self.pauseregen_finished = max(self.pauseregen_finished, time + cvar("g_balance_pause_health_regen"));\r
+                       self.pauseregenhealth_finished = max(self.pauseregenhealth_finished, time + cvar("g_balance_pause_health_regen"));\r
+                       self.pauseregenarmor_finished = max(self.pauseregenarmor_finished, time + cvar("g_balance_pause_armor_regen"));\r
 \r
                        if (time > self.pain_finished)          //Don't switch pain sequences like crazy\r
                        {\r
@@ -481,14 +492,17 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht
                                        }\r
 \r
                                        if(sound_allowed(MSG_BROADCAST, attacker))\r
+                                       if(self.health > 1)\r
                                        {\r
-                                               if(self.health > 75) // TODO make a "gentle" version?\r
+                                               if(deathtype == DEATH_FALL)\r
+                                                       PlayerSound(self, playersound_fall, CHAN_PAIN, VOICETYPE_PLAYERSOUND);\r
+                                               else if(self.health > 75) // TODO make a "gentle" version?\r
                                                        PlayerSound(self, playersound_pain100, CHAN_PAIN, VOICETYPE_PLAYERSOUND);\r
                                                else if(self.health > 50)\r
                                                        PlayerSound(self, playersound_pain75, CHAN_PAIN, VOICETYPE_PLAYERSOUND);\r
                                                else if(self.health > 25)\r
                                                        PlayerSound(self, playersound_pain50, CHAN_PAIN, VOICETYPE_PLAYERSOUND);\r
-                                               else if(self.health > 1)\r
+                                               else\r
                                                        PlayerSound(self, playersound_pain25, CHAN_PAIN, VOICETYPE_PLAYERSOUND);\r
                                        }\r
                                }\r
@@ -741,11 +755,11 @@ void UpdateSelectedPlayer()
        selected = world;\r
        selected_score = 0.95; // 18 degrees\r
 \r
-       if(self.eater.classname == "player")\r
+       if(self.predator.classname == "player")\r
        {\r
                if(!self.dropweapon_check)\r
-               if(self.eater.team != self.team) // don't disarm team mates when swallowing them\r
-               if(random() < cvar("g_vore_dropweapon"))\r
+               if(self.predator.team != self.team) // don't disarm team mates when swallowing them\r
+               if(random() < cvar("g_balance_vore_swallow_dropweapon"))\r
                        SpawnThrownWeapon (self.origin + (self.mins + self.maxs) * 0.5, self.switchweapon);\r
                self.dropweapon_check = TRUE;\r
        }\r
@@ -1224,7 +1238,12 @@ void GlobalSound(string sample, float chan, float voicetype)
                                        if(clienttype(msg_entity) == CLIENTTYPE_REAL)\r
                                        {\r
                                                if(msg_entity.cvar_cl_voice_directional == 1)\r
-                                                       soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_MIN);\r
+                                               {\r
+                                                       if(self.predator.classname == "player")\r
+                                                               soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE * bound(0, cvar("g_vore_soundocclusion"), 1), ATTN_MIN);\r
+                                                       else\r
+                                                               soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_MIN);\r
+                                               }\r
                                                else\r
                                                        soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_NONE);\r
                                        }\r
@@ -1238,7 +1257,12 @@ void GlobalSound(string sample, float chan, float voicetype)
                                        if(clienttype(msg_entity) == CLIENTTYPE_REAL)\r
                                        {\r
                                                if(msg_entity.cvar_cl_voice_directional == 1)\r
-                                                       soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_MIN);\r
+                                               {\r
+                                                       if(self.predator.classname == "player")\r
+                                                               soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE * bound(0, cvar("g_vore_soundocclusion"), 1), ATTN_MIN);\r
+                                                       else\r
+                                                               soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_MIN);\r
+                                               }\r
                                                else\r
                                                        soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_NONE);\r
                                        }\r
@@ -1252,7 +1276,12 @@ void GlobalSound(string sample, float chan, float voicetype)
                                if(!teams_matter || msg_entity.team == self.team)\r
                                {\r
                                        if(msg_entity.cvar_cl_voice_directional == 1)\r
-                                               soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_MIN);\r
+                                       {\r
+                                               if(self.predator.classname == "player")\r
+                                                       soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE * bound(0, cvar("g_vore_soundocclusion"), 1), ATTN_MIN);\r
+                                               else\r
+                                                       soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_MIN);\r
+                                       }\r
                                        else\r
                                                soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_NONE);\r
                                }\r
@@ -1269,7 +1298,12 @@ void GlobalSound(string sample, float chan, float voicetype)
                                if (tauntrand < msg_entity.cvar_cl_autotaunt)\r
                                {\r
                                        if (msg_entity.cvar_cl_voice_directional >= 1)\r
-                                               soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, bound(ATTN_MIN, msg_entity.cvar_cl_voice_directional_taunt_attenuation, ATTN_MAX));\r
+                                       {\r
+                                               if(self.predator.classname == "player")\r
+                                                       soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE * bound(0, cvar("g_vore_soundocclusion"), 1), bound(ATTN_MIN, msg_entity.cvar_cl_voice_directional_taunt_attenuation, ATTN_MAX));\r
+                                               else\r
+                                                       soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, bound(ATTN_MIN, msg_entity.cvar_cl_voice_directional_taunt_attenuation, ATTN_MAX));\r
+                                       }\r
                                        else\r
                                                soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_NONE);\r
                                }\r
@@ -1285,12 +1319,26 @@ void GlobalSound(string sample, float chan, float voicetype)
                        FOR_EACH_REALCLIENT(msg_entity)\r
                        {\r
                                if (msg_entity.cvar_cl_voice_directional >= 1)\r
-                                       soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, bound(ATTN_MIN, msg_entity.cvar_cl_voice_directional_taunt_attenuation, ATTN_MAX));\r
+                               {\r
+                                       if(self.predator.classname == "player")\r
+                                               soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE * bound(0, cvar("g_vore_soundocclusion"), 1), bound(ATTN_MIN, msg_entity.cvar_cl_voice_directional_taunt_attenuation, ATTN_MAX));\r
+                                       else\r
+                                               soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, bound(ATTN_MIN, msg_entity.cvar_cl_voice_directional_taunt_attenuation, ATTN_MAX));\r
+                               }\r
                                else\r
                                        soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_NONE);\r
                        }\r
                case VOICETYPE_PLAYERSOUND:\r
-                       sound(self, chan, sample, VOL_BASE, ATTN_NORM);\r
+                       if(self.predator.classname == "player")\r
+                               sound(self, chan, sample, VOL_BASE * bound(0, cvar("g_vore_soundocclusion"), 1), ATTN_NORM);\r
+                       else\r
+                               sound(self, chan, sample, VOL_BASE, ATTN_NORM);\r
+                       break;\r
+               case VOICETYPE_GURGLE:\r
+                       if(self.stomach_load)\r
+                               sound(self, chan, sample, VOL_BASE * self.stomach_load / cvar("g_balance_vore_swallow_limit"), ATTN_NORM);\r
+                       else\r
+                               stopsound(self, chan);\r
                        break;\r
                default:\r
                        backtrace("Invalid voice type!");\r
@@ -1301,8 +1349,13 @@ void GlobalSound(string sample, float chan, float voicetype)
 void PlayerSound(entity player, .string samplefield, float chan, float voicetype)\r
 {\r
        string sample;\r
-       sample = player.samplefield;\r
+       entity oldself;\r
+\r
+       oldself = self;\r
+       self = player;\r
+       sample = self.samplefield;\r
        GlobalSound(sample, chan, voicetype);\r
+       self = oldself;\r
 }\r
 \r
 void VoiceMessage(string type, string msg)\r