]> de.git.xonotic.org Git - voretournament/voretournament.git/blobdiff - data/qcsrc/server/vore.qc
Some fixes I forgot to self.deadflag in the vore code
[voretournament/voretournament.git] / data / qcsrc / server / vore.qc
index e5452e6a739c3775376955e8438afe1241da7d68..ac8d5b48d04d7687794a79cc62ba98436fd8ab7b 100644 (file)
@@ -12,11 +12,11 @@ entity Swallow_player_check()
 {\r
        // check if we can swallow a player instead of firing our weapon\r
 \r
-       vector w_shotorg, w_shotdir;\r
-       w_shotorg = self.origin + self.view_ofs;\r
-       w_shotdir = v_forward;\r
+       vector vore_w_shotorg, vore_w_shotdir;\r
+       vore_w_shotorg = self.origin + self.view_ofs;\r
+       vore_w_shotdir = v_forward;\r
 \r
-       WarpZone_traceline_antilag(self, w_shotorg, w_shotorg + w_shotdir * cvar("g_balance_vore_swallow_range"), FALSE, self, ANTILAG_LATENCY(self));\r
+       WarpZone_traceline_antilag(self, vore_w_shotorg, vore_w_shotorg + vore_w_shotdir * cvar("g_balance_vore_swallow_range"), FALSE, self, ANTILAG_LATENCY(self));\r
        if(trace_fraction < 1)\r
        if(trace_ent.classname == "player")\r
                return trace_ent;\r
@@ -35,9 +35,9 @@ float Swallow_condition_check(entity prey)
        {\r
                if(teams_matter && prey.team == self.team && !cvar("g_vore_teamvore"))\r
                {\r
-                       if(time > self.complain_vore)\r
+                       if(time > self.complain_vore && self.BUTTON_ATCK)\r
                        {\r
-                               play2(self, "misc/unavailable.wav");\r
+                               play2(self, "misc/forbidden.wav");\r
                                sprint(self, "You cannot swallow your team mates\n");\r
                                self.complain_vore = time + complain_delay_time;\r
                        }\r
@@ -46,9 +46,9 @@ float Swallow_condition_check(entity prey)
 \r
                if(self.stomach_load >= cvar("g_balance_vore_swallow_limit"))\r
                {\r
-                       if(time > self.complain_vore)\r
+                       if(time > self.complain_vore && self.BUTTON_ATCK)\r
                        {\r
-                               play2(self, "misc/unavailable.wav");\r
+                               play2(self, "misc/forbidden.wav");\r
                                sprint(self, strcat("You cannot swallow more than ^2", cvar_string("g_balance_vore_swallow_limit"), "^7 players at a time\n"));\r
                                self.complain_vore = time + complain_delay_time;\r
                        }\r
@@ -58,9 +58,9 @@ float Swallow_condition_check(entity prey)
                if(cvar("g_vore_biggergut"))\r
                if(prey.stomach_load > self.stomach_load)\r
                {\r
-                       if(time > self.complain_vore)\r
+                       if(time > self.complain_vore && self.BUTTON_ATCK)\r
                        {\r
-                               play2(self, "misc/unavailable.wav");\r
+                               play2(self, "misc/forbidden.wav");\r
                                sprint(self, "You cannot swallow someone with a bigger stomach than yours\n");\r
                                self.complain_vore = time + complain_delay_time;\r
                        }\r
@@ -201,13 +201,15 @@ void Vore_Swallow(entity e)
 \r
        if(teams_matter && e.team == e.predator.team)\r
        {\r
-               centerprint(e, "^3You have been swallowed by a team mate, don't kick!");\r
-               centerprint(e.predator, "^3You have swallowed a team mate, use caution!");\r
+               if(cvar("g_vore_kick"))\r
+                       centerprint(e, "^3You have been swallowed by a team mate, don't kick!");\r
+               if(cvar("g_vore_digestion"))\r
+                       centerprint(e.predator, "^3You have swallowed a team mate, don't digest!");\r
        }\r
 \r
        PlayerSound(e.predator, playersound_swallow, CHAN_PAIN, VOICETYPE_PLAYERSOUND);\r
        setanim(e.predator, e.predator.anim_pain1, FALSE, TRUE, TRUE); // looks good for swallowing / regurgitating\r
-       e.predator.punchangle_x -= e.predator.cvar_cl_vore_punchangle;\r
+       e.predator.punchangle_x -= cvar("g_balance_vore_swallow_punchangle");\r
        e.predator.stomach_load += 1;\r
        e.predator.regurgitate_prepare = 0;\r
        e.predator.spawnshieldtime = 0; // lose spawn shield when we vore\r
@@ -248,7 +250,7 @@ void Vore_Regurgitate(entity e)
        PlayerSound(e.predator, playersound_regurgitate, CHAN_PAIN, VOICETYPE_PLAYERSOUND);\r
        setanim(e.predator, e.predator.anim_pain1, FALSE, TRUE, TRUE); // looks good for swallowing / regurgitating\r
        pointparticles(particleeffectnum("regurgitate"), e.predator.origin, '0 0 0', 1);\r
-       e.predator.punchangle_x += e.predator.cvar_cl_vore_punchangle;\r
+       e.predator.punchangle_x += cvar("g_balance_vore_regurgitate_punchangle");\r
        e.predator.stomach_load -= 1;\r
        e.predator.regurgitate_prepare = 0;\r
        e.predator.swallow_delay = time + cvar("g_balance_vore_swallow_delay");\r
@@ -284,7 +286,7 @@ void Vore_DeadPrey_Configure(entity e)
        e.aiment = e.fakepredator;\r
 \r
        // completely remove the dead body\r
-       e.alpha = -1;\r
+       e.modelindex = 0;\r
 }\r
 \r
 void Vore_DeadPrey_Detach(entity e)\r
@@ -296,22 +298,24 @@ void Vore_DeadPrey_Detach(entity e)
                return;\r
 \r
        e.fakepredator = world;\r
+       e.fakeprey = FALSE;\r
        e.aiment = world;\r
-\r
-       if(!e.deadflag)\r
-               e.fakeprey = FALSE;\r
+       e.movetype = MOVETYPE_TOSS;\r
 }\r
 \r
-void Vore_PreyRelease(entity e)\r
+void Vore_PreyRelease(entity e, float pred_disconnect)\r
 {\r
        // if the keepdeadprey feature is on, don't spit a dead prey's carcass out\r
-       if(e.health <= 0 && cvar("g_vore_keepdeadprey"))\r
+       if(e.deadflag != DEAD_NO && cvar("g_vore_keepdeadprey"))\r
        {\r
-               Vore_DeadPrey_Configure(e);\r
-\r
                // if keepdeadprey is enabled and the predator disconnected, detach the dead prey\r
-               if(e.fakepredator.classname != "player")\r
-                       Vore_DeadPrey_Detach(e);\r
+               if(pred_disconnect)\r
+               {\r
+                       if(e.fakeprey)\r
+                               Vore_DeadPrey_Detach(e);\r
+               }\r
+               else\r
+                       Vore_DeadPrey_Configure(e);\r
        }\r
        else\r
                Vore_Regurgitate(e);\r
@@ -323,19 +327,16 @@ void Vore_Disconnect()
 \r
        // prey disconnects or goes spectating while inside someone's belly\r
        if(self.predator.classname == "player")\r
-               Vore_PreyRelease(self);\r
+               Vore_PreyRelease(self, TRUE);\r
 \r
        // pred disconnects or goes spectating with players in their belly\r
-       else if(self.stomach_load > 0)\r
+       entity head;\r
+       FOR_EACH_PLAYER(head)\r
        {\r
-               entity head;\r
-               FOR_EACH_PLAYER(head)\r
-               {\r
-                       if(head.predator == self)\r
-                               Vore_PreyRelease(head);\r
-               }\r
-               Vore_GurgleSound(); // stop the gurgling sound\r
+               if(head.predator == self || head.fakepredator == self)\r
+                       Vore_PreyRelease(head, TRUE);\r
        }\r
+       Vore_GurgleSound(); // stop the gurgling sound\r
 \r
        self.stomach_load = self.gravity = 0; // prevents a bug\r
 }\r
@@ -359,7 +360,7 @@ void Vore_Digest()
                self.predator.digestion_step = time + steptime;\r
        }\r
 \r
-       if(self.health <= 0)\r
+       if(self.deadflag != DEAD_NO)\r
        if(stov(cvar_string("g_vore_regurgitatecolor_digest")))\r
                self.colormod = stov(cvar_string("g_vore_regurgitatecolor_digest"));\r
 }\r
@@ -374,6 +375,13 @@ void Vore_Teamheal()
        {\r
                self.health += cvar("g_balance_vore_teamheal");\r
                self.teamheal_step = time + steptime;\r
+\r
+               // play beep sound when a team mate was healed to the maximum amount, to both the prey and the predator\r
+               if(self.health >= cvar("g_balance_vore_teamheal_stable"))\r
+               {\r
+                       play2(self, "misc/beep.wav");\r
+                       play2(self.predator, "misc/beep.wav");\r
+               }\r
        }\r
 }\r
 \r
@@ -386,9 +394,11 @@ void Vore_StomachKick()
        {\r
                float damage;\r
                damage = ceil(random() * (cvar("g_balance_vore_kick_damage_max") - cvar("g_balance_vore_kick_damage_min")) + cvar("g_balance_vore_kick_damage_min"));\r
+\r
                Damage(self.predator, self, self, damage, DEATH_STOMACHKICK, self.predator.origin, v_forward * cvar("g_balance_vore_kick_force"));\r
-               sound(self.predator, CHAN_PROJECTILE, "weapons/stomachkick.ogg", VOL_BASE, ATTN_NORM);\r
-               self.predator.punchangle_x -= self.predator.cvar_cl_vore_kick_punchangle;\r
+               sound(self.predator, CHAN_PROJECTILE, "weapons/stomachkick.wav", VOL_BASE, ATTN_NORM);\r
+               self.predator.punchangle_x -= cvar("g_balance_vore_kick_predator_punchangle");\r
+               self.punchangle_x += cvar("g_balance_vore_kick_prey_punchangle");\r
 \r
                if(random() < cvar("g_balance_vore_kick_escapeprobability"))\r
                        Vore_Regurgitate(self);\r
@@ -405,7 +415,7 @@ void Vore_StomachLeave()
                Vore_Regurgitate(self);\r
        else if(time > self.complain_vore)\r
        {\r
-               play2(self, "misc/unavailable.wav");\r
+               play2(self, "misc/forbidden.wav");\r
                sprint(self, strcat("You cannot get out of ", self.predator.netname, "\n"));\r
                self.complain_vore = time + complain_delay_time;\r
        }\r
@@ -547,6 +557,8 @@ void Vore()
                if(self.BUTTON_ATCK)\r
                        Vore_Swallow(prey);\r
        }\r
+       else if(prey != world)\r
+               self.stat_canswallow = -1;\r
 \r
        // toggle digestion, if the player has someone in their stomach\r
        if(self.BUTTON_DIGEST && cvar("g_vore_digestion"))\r
@@ -561,7 +573,7 @@ void Vore()
                }\r
                else if(time > self.complain_vore)\r
                {\r
-                       play2(self, "misc/unavailable.wav");\r
+                       play2(self, "misc/forbidden.wav");\r
                        sprint(self, "There is nothing to digest\n");\r
                        self.complain_vore = time + complain_delay_time;\r
                }\r
@@ -583,7 +595,7 @@ void Vore()
                }\r
                else if(time > self.complain_vore)\r
                {\r
-                       play2(self, "misc/unavailable.wav");\r
+                       play2(self, "misc/forbidden.wav");\r
                        sprint(self, "There is nothing to regurgitate\n");\r
                        self.complain_vore = time + complain_delay_time;\r
                }\r
@@ -604,13 +616,13 @@ void Vore()
        if(self.predator.classname != "player")\r
                return;\r
 \r
-       if(self.deadflag)\r
+       if(self.deadflag != DEAD_NO)\r
        {\r
-               Vore_PreyRelease(self);\r
+               Vore_PreyRelease(self, FALSE);\r
                return;\r
        }\r
 \r
-       if(self.predator.deadflag)\r
+       if(self.predator.deadflag != DEAD_NO)\r
                Vore_Regurgitate(self);\r
        else if(vlen(self.predator.velocity) > cvar("g_balance_vore_regurgitate_speedcap"))\r
                Vore_Regurgitate(self);\r