]> de.git.xonotic.org Git - voretournament/voretournament.git/blobdiff - data/qcsrc/server/vore.qc
I think Jump is a more appropriate key for getting out than Alt Fire. Also don't...
[voretournament/voretournament.git] / data / qcsrc / server / vore.qc
index 1296b01595e5af5ed57d0f3194cf31a59f37af32..102ce98b43a16b77a921b44533804d5c8b1f8ad8 100644 (file)
@@ -56,6 +56,13 @@ float Swallow_condition_check(entity prey)
        return FALSE;\r
 }\r
 \r
+float Vore_PreyCanLeave()\r
+{\r
+       if(teams_matter && self.team == self.eater.team)\r
+               return TRUE;\r
+       return FALSE;\r
+}\r
+\r
 // make the camera smoothly lower itself when we get swallowed\r
 // the target we are going for is from normal view offset to half of the view offset (because half is the best positioning of the view for the stomach model)\r
 .float cameraeffect_current, cameraeffect_target;\r
@@ -97,6 +104,8 @@ void Vore_Weight_apply(entity e)
        e.vore_oldstomachload = e.stomach_load;\r
 }\r
 \r
+.entity pusher;\r
+.float pushltime;\r
 void Vore_Swallow(entity e)\r
 {\r
        // this player is beening swallowed by another player, apply the proper changes\r
@@ -112,18 +121,21 @@ void Vore_Swallow(entity e)
        e.alpha = -1; // best way of hiding / showing the eaten player\r
        e.aiment = e.eater; // follow the predator. Is automatically unset\r
 \r
-       Vore_CameraEffect_Set(e);\r
-\r
        // drop keys (KH) and flags (CTF) when we get swallowed\r
        kh_Key_DropAll(e, FALSE);\r
        if(e.flagcarried)\r
                DropFlag(e.flagcarried, world, e.eater);\r
 \r
+       Vore_CameraEffect_Set(e);\r
+\r
        if(stov(cvar_string("g_vore_regurgitatecolor_released")))\r
                e.colormod = stov(cvar_string("g_vore_regurgitatecolor_released"));\r
 \r
-       if(e.eater.team == e.team && teamplay)\r
-               centerprint(e.eater, "^4You have swallowed a team mate, use caution!");\r
+       if(e.team == e.eater.team && teamplay)\r
+       {\r
+               centerprint(e, "^3You have been swallowed by a team mate, don't kick!");\r
+               centerprint(e.eater, "^3You have swallowed a team mate, use caution!");\r
+       }\r
 \r
        PlayerSound(e.eater, playersound_swallow, CHAN_PAIN, VOICETYPE_PLAYERSOUND);\r
        setanim(e.eater, e.eater.anim_pain1, FALSE, TRUE, TRUE); // looks good for swallowing / regurgitating\r
@@ -158,6 +170,9 @@ void Vore_Regurgitate(entity e)
        v_right = oldright;\r
        v_up = oldup;\r
 \r
+       e.pusher = e.eater; // so we can frag players by regurgitating them in deadly pits\r
+       e.pushltime = time + cvar("g_maxpushtime");\r
+\r
        PlayerSound(e.eater, playersound_regurgitate, CHAN_PAIN, VOICETYPE_PLAYERSOUND);\r
        setanim(e.eater, e.eater.anim_pain1, FALSE, TRUE, TRUE); // looks good for swallowing / regurgitating\r
        pointparticles(particleeffectnum("regurgitate"), e.eater.origin, '0 0 0', 1);\r
@@ -166,6 +181,8 @@ void Vore_Regurgitate(entity e)
        e.eater.swallow_delay = time + cvar("g_balance_vore_swallow_delay");\r
        Vore_Weight_apply(e.eater);\r
 \r
+       // block firing for a small amount of time when getting regurgitated, or we'll be firing the next frame\r
+       e.weapon_delay = time + button_delay;\r
        e.system_delay = e.eater.system_delay = time + system_delay_time;\r
        e.eater = world;\r
 }\r
@@ -252,6 +269,20 @@ void Vore_StomachKick()
        }\r
 }\r
 \r
+void Vore_StomachLeave()\r
+{\r
+       // allows players to get out of their predator at will in some circumstances, such as team mates\r
+\r
+       if(Vore_PreyCanLeave())\r
+               Vore_Regurgitate(self);\r
+       else if(time > self.complain_swallow)\r
+       {\r
+               play2(self, "weapons/unavailable.wav");\r
+               sprint(self, strcat("You can't willingly get out of ", self.eater.netname, "\n"));\r
+               self.complain_swallow = time + complain_delay;\r
+       }\r
+}\r
+\r
 .float gurglesound_finished, gurglesound_oldstomachload;\r
 void Vore_Gurglesound()\r
 {\r
@@ -332,7 +363,7 @@ void Vore()
                        if(time > self.regurgitate_button_delay)\r
                        {\r
                                self.regurgitate_prepare = time + cvar("g_balance_vore_regurgitate_delay");\r
-                               PlayerSound(self, playersound_regurgitate_prepare, CHAN_PAIN, VOICETYPE_PLAYERSOUND);\r
+                               PlayerSound(self, playersound_regurgitate_prepare, CHAN_VOICE, VOICETYPE_PLAYERSOUND);\r
                                self.regurgitate_button_delay = time + button_delay;\r
                        }\r
                }\r
@@ -389,6 +420,10 @@ void Vore()
 \r
        if(self.BUTTON_ATCK)\r
                Vore_StomachKick();\r
+       else if(self.BUTTON_JUMP)\r
+               Vore_StomachLeave();\r
+\r
+       self.stat_canleave = Vore_PreyCanLeave();\r
 \r
        Vore_CameraEffect_Apply();\r
 }
\ No newline at end of file