]> de.git.xonotic.org Git - voretournament/voretournament.git/blobdiff - data/qcsrc/server/vore.qc
Same for fake predator
[voretournament/voretournament.git] / data / qcsrc / server / vore.qc
index 6fa15248e59653384e05721116a88a844aef78a6..d755ddf5266ed339e4ddc14d38141b97d02f25c7 100644 (file)
@@ -12,11 +12,16 @@ entity Swallow_player_check()
 {\r
        // check if we can swallow a player instead of firing our weapon\r
 \r
+       float swallow_range;\r
        vector vore_w_shotorg, vore_w_shotdir;\r
-       vore_w_shotorg = self.origin + self.view_ofs;\r
+\r
+       swallow_range = cvar("g_balance_vore_swallow_range");\r
+       if(self.scale) // we can swallow from further or closer based on our size\r
+               swallow_range *= self.scale;\r
+       vore_w_shotorg = self.origin;\r
        vore_w_shotdir = v_forward;\r
 \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
+       WarpZone_traceline_antilag(self, vore_w_shotorg, vore_w_shotorg + vore_w_shotdir * swallow_range, FALSE, self, ANTILAG_LATENCY(self));\r
        if(trace_fraction < 1)\r
        if(trace_ent.classname == "player")\r
                return trace_ent;\r
@@ -67,6 +72,18 @@ float Swallow_condition_check(entity prey)
                        return FALSE;\r
                }\r
 \r
+               if(!cvar("g_vore_spawnshield"))\r
+               if(prey.spawnshieldtime > time)\r
+               {\r
+                       if(time > self.complain_vore && self.BUTTON_ATCK)\r
+                       {\r
+                               play2(self, "misc/forbidden.wav");\r
+                               sprint(self, "You cannot swallow someone protected by the spawn shield\n");\r
+                               self.complain_vore = time + complain_delay_time;\r
+                       }\r
+                       return FALSE;\r
+               }\r
+\r
                return TRUE;\r
        }\r
        return FALSE;\r
@@ -112,7 +129,7 @@ void Vore_CameraEffect_Set(entity e)
 }\r
 void Vore_CameraEffect_Apply()\r
 {\r
-       if(self.predator.classname != "player")\r
+       if not(self.predator.classname == "player" || self.fakeprey)\r
                return;\r
 \r
        if(self.cvar_cl_vore_cameraspeed)\r
@@ -129,7 +146,11 @@ void Vore_CameraEffect_Apply()
        else\r
                self.cameraeffect_current = self.cameraeffect_target;\r
 \r
-       self.view_ofs_z = PL_VIEW_OFS_z / self.cameraeffect_current;\r
+       self.view_ofs_z = PL_PREY_VIEW_OFS_z / self.cameraeffect_current;\r
+       if(self.predator.scale)\r
+               self.view_ofs_z *= self.predator.scale;\r
+       else if(self.fakepredator.scale)\r
+               self.view_ofs_z *= self.fakepredator.scale;\r
 }\r
 \r
 .float gurgle_oldstomachload;\r
@@ -305,20 +326,21 @@ void Vore_DeadPrey_Detach(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.deadflag != DEAD_NO && cvar("g_vore_keepdeadprey"))\r
+       if(pred_disconnect)\r
        {\r
-               // if keepdeadprey is enabled and the predator disconnected, detach the dead prey\r
-               if(pred_disconnect)\r
-               {\r
-                       if(e.fakeprey)\r
-                               Vore_DeadPrey_Detach(e);\r
-               }\r
+               if(e.fakeprey)\r
+                       Vore_DeadPrey_Detach(e);\r
                else\r
-                       Vore_DeadPrey_Configure(e);\r
+                       Vore_Regurgitate(e);\r
        }\r
        else\r
-               Vore_Regurgitate(e);\r
+       {\r
+               // if the keepdeadprey feature is on, don't spit a dead prey's carcass out\r
+               if(e.deadflag != DEAD_NO && random() < cvar("g_vore_keepdeadprey"))\r
+                       Vore_DeadPrey_Configure(e);\r
+               else\r
+                       Vore_Regurgitate(e);\r
+       }\r
 }\r
 \r
 void Vore_Disconnect()\r
@@ -487,8 +509,10 @@ void Vore()
                        self.colormod_z = 1;\r
        }\r
 \r
-       // set all vore related stats\r
-       if(self.predator.classname == "player")\r
+       // set all vore stats\r
+       if(self.fakeprey)\r
+               self.stat_eaten = num_for_edict(self.fakepredator);\r
+       else if(self.predator.classname == "player")\r
        {\r
                self.stat_stomachload = self.predator.stomach_load; // necessary for the stomach board\r
                self.stat_digesting = self.predator.digesting; // necessary for the stomach board\r
@@ -608,6 +632,8 @@ void Vore()
 // Code that addresses the prey:\r
 // --------------------------------\r
 \r
+       Vore_CameraEffect_Apply();\r
+\r
        // keepdeadprey - detach dead prey if their predator died or got swallowed\r
        if(self.fakepredator.classname == "player")\r
        if(self.fakepredator.deadflag != DEAD_NO || self.fakepredator.predator.classname == "player")\r
@@ -648,8 +674,6 @@ void Vore()
        if(self.BUTTON_JUMP)\r
                Vore_StomachLeave();\r
 \r
-       Vore_CameraEffect_Apply();\r
-\r
        // Ugly workaround for a Keyhunt issue. Your team's key can still be given to you while in the stomach\r
        // (at round start), which is pretty ugly and wrong. So attempt to drop keys each frame for prey\r
        kh_Key_DropAll(self, FALSE);\r