]> de.git.xonotic.org Git - voretournament/voretournament.git/blobdiff - data/qcsrc/server/vore.qc
Show the predator's name on the stomach board.
[voretournament/voretournament.git] / data / qcsrc / server / vore.qc
index 40d84e720c38a9cd3c3e0870d129ea0a1d57ba96..c8806b9f98f32bb677919ebe139c33c069effa82 100644 (file)
@@ -1,9 +1,10 @@
 .float regurgitate_prepare;\r
-.float swallow_delay, digest_button_delay, regurgitate_button_delay;\r
+.float system_delay, swallow_delay, digest_button_delay, regurgitate_button_delay;\r
 .float complain_swallow;\r
 const float complain_delay = 1;\r
 const float button_delay = 0.5;\r
 const float steptime = 0.1;\r
+const float system_delay_time = 0.1;\r
 \r
 .float vore_oldmovetype, vore_oldsolid, vore_oldstomachload;\r
 \r
@@ -79,7 +80,6 @@ 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
        e.view_ofs_z /= 2; // best positioning for the stomach model\r
-       e.stat_eaten = TRUE;\r
 \r
        // drop keys (KH) and flags (CTF) when we get swallowed\r
        kh_Key_DropAll(e, FALSE);\r
@@ -94,6 +94,8 @@ void Vore_Swallow(entity e)
        e.eater.stomach_load += 1;\r
        e.eater.regurgitate_prepare = 0;\r
        Vore_Weight_apply(e.eater);\r
+\r
+       e.system_delay = e.eater.system_delay = time + system_delay_time;\r
 }\r
 \r
 void Vore_Regurgitate(entity e)\r
@@ -102,20 +104,17 @@ void Vore_Regurgitate(entity e)
        e.movetype = e.vore_oldmovetype;\r
        if(e.health > 0) // leave SOLID_NOT for dead bodies\r
                e.solid = e.vore_oldsolid;\r
-       e.alpha = 0; // best way of hiding / showing the eaten player\r
+       e.alpha = default_player_alpha; // best way of hiding / showing the eaten player\r
        e.view_ofs_z *= 2; // best positioning for the stomach model\r
-       e.stat_eaten = FALSE;\r
 \r
        // velocities\r
        local vector oldforward, oldright, oldup;\r
-       local float rand;\r
        oldforward = v_forward;\r
        oldright = v_right;\r
        oldup = v_up;\r
-       rand = random();\r
        makevectors(e.eater.v_angle);\r
-       e.velocity = v_forward * rand * cvar("g_balance_vore_regurgitate_force");\r
-       e.eater.velocity += -v_forward * rand * cvar("g_balance_vore_regurgitate_eaterforce");\r
+       e.velocity = v_forward * cvar("g_balance_vore_regurgitate_force");\r
+       e.eater.velocity += -v_forward * cvar("g_balance_vore_regurgitate_eaterforce");\r
        v_forward = oldforward;\r
        v_right = oldright;\r
        v_up = oldup;\r
@@ -125,7 +124,10 @@ void Vore_Regurgitate(entity e)
        pointparticles(particleeffectnum("regurgitate"), e.eater.origin, '0 0 0', 1);\r
        e.eater.stomach_load -= 1;\r
        e.eater.regurgitate_prepare = 0;\r
+       e.eater.swallow_delay = time + cvar("g_balance_vore_swallow_delay");\r
        Vore_Weight_apply(e.eater);\r
+\r
+       e.system_delay = e.eater.system_delay = time + system_delay_time;\r
        e.eater = world;\r
 }\r
 \r
@@ -137,7 +139,6 @@ void Vore_Disconnect()
        if(self.eater.classname == "player")\r
        {\r
                self.view_ofs_z += 25;\r
-               self.stat_eaten = FALSE;\r
                self.eater.stomach_load -= 1;\r
                Vore_Weight_apply(self.eater);\r
                self.eater = world;\r
@@ -168,7 +169,7 @@ void Vore_Digest()
                if (self.eater.digestsound_finished < time)\r
                {\r
                        self.eater.digestsound_finished = time + 0.5;\r
-                       sound (self.eater, CHAN_PLAYER, "player/digest.wav", VOL_BASE, ATTN_NORM);\r
+                       PlayerSound (self.eater, playersound_digest, CHAN_PLAYER, VOICETYPE_PLAYERSOUND);\r
                }\r
                self.eater.digestion_step = time;\r
        }\r
@@ -192,32 +193,65 @@ void Vore_Teamheal()
 .float stomachkick_delay;\r
 void Vore_StomachKick()\r
 {\r
-       // allows prey to kick the predator's stomach and do some damage, or bring the predator's digestion upon their self when there's no other option\r
+       // allows prey to kick the predator's stomach and do some damage / attempt to escape, or bring the predator's digestion upon their self when there's no other option\r
        if(self.eater.classname != "player")\r
                return;\r
 \r
-       // kick the predator's stomach and do damage\r
+       // kick the predator's stomach and do damage, or escape if we are lucky\r
        if(self.BUTTON_ATCK)\r
        if(time > self.stomachkick_delay)\r
        {\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.eater, self, self, damage, DEATH_STOMACHKICK, self.eater.origin, '0 0 0');\r
                sound(self.eater, CHAN_PROJECTILE, "weapons/stomachkick.ogg", VOL_BASE, ATTN_NORM);\r
+\r
+               if(cvar("g_balance_vore_kick_escapeprobability") >= random())\r
+                       Vore_Regurgitate(self);\r
+\r
                self.stomachkick_delay = time + cvar("g_balance_vore_kick_delay");\r
        }\r
 \r
        // start the predator's digestion\r
        if(self.BUTTON_ATCK2)\r
        {\r
-               centerprint(self.eater, strcat(self.netname, " triggered your digestion"));\r
+               centerprint(self.eater, strcat(self.netname, " has triggered your digestion"));\r
                self.eater.digesting = TRUE;\r
        }\r
 }\r
 \r
+.float gurglesound_finished, gurglesound_oldstomachload;\r
+void Vore_Gurglesound()\r
+{\r
+       if(time > self.gurglesound_finished || self.gurglesound_oldstomachload != self.stomach_load)\r
+       {\r
+               GlobalSound(self.playersound_gurgle, CHAN_TRIGGER, VOICETYPE_GURGLE);\r
+\r
+               self.gurglesound_finished = time + 11; // yes, hard coded sound length. I know it's bad but what can I do?\r
+               self.gurglesound_oldstomachload = self.stomach_load;\r
+       }\r
+}\r
+\r
 void Vore()\r
 {\r
+       // if we are free, show our stomach load on the HUD. Otherwise, show the predator's\r
+       string x;\r
+       if(self.eater != self && self.eater.classname == "player")\r
+       {\r
+               self.stat_stomachload = self.eater.stomach_load;\r
+               self.stat_eaten = num_for_edict(self.eater);\r
+               x = playername(self.eater);\r
+               //bprint(strcat(ftos(self.stat_eaten), "<<--------------------------\n"));\r
+       }\r
+       else\r
+       {\r
+               self.stat_stomachload = self.stomach_load;\r
+               self.stat_eaten = 0;\r
+               x = "NONE!";\r
+       }\r
+       //bprint(strcat(ftos(self.stat_eaten), "<<--------------------------\n"));\r
+       //bprint(strcat(playername(self), "<<--------------------------\n"));\r
+\r
        // skip the vore system under some circumstances\r
        if(time < game_starttime)\r
        {\r
@@ -226,6 +260,8 @@ void Vore()
        }\r
        if(self.spectatee_status)\r
                return;\r
+       if(time < self.system_delay)\r
+               return;\r
 \r
 // --------------------------------\r
 // Code that addresses predators:\r
@@ -290,6 +326,9 @@ void Vore()
                }\r
        }\r
 \r
+       if(cvar("g_vore_gurglesound"))\r
+               Vore_Gurglesound();\r
+\r
 // --------------------------------\r
 // Code that addresses the prey:\r
 // --------------------------------\r