]> 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 63139a5b7b2f22c17c9aa9cc3c41513372445905..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
@@ -124,8 +131,11 @@ void Vore_Swallow(entity e)
        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
+       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
@@ -171,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
@@ -257,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
@@ -394,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