Use self.stat_eaten instead of checking self.predator.classname. Also adjust the...
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Tue, 3 May 2011 13:10:58 +0000 (16:10 +0300)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Tue, 3 May 2011 13:10:58 +0000 (16:10 +0300)
13 files changed:
data/qcsrc/server/bot/havocbot/havocbot.qc
data/qcsrc/server/bot/havocbot/vore_ai.qc
data/qcsrc/server/cl_client.qc
data/qcsrc/server/cl_physics.qc
data/qcsrc/server/cl_player.qc
data/qcsrc/server/cl_weapons.qc
data/qcsrc/server/cl_weaponsystem.qc
data/qcsrc/server/g_grabber.qc
data/qcsrc/server/g_violence.qc
data/qcsrc/server/g_world.qc
data/qcsrc/server/tturrets/system/system_main.qc
data/qcsrc/server/vore.qc
data/qcsrc/server/w_grabber.qc

index faca874..1e29e53 100644 (file)
@@ -16,7 +16,7 @@ void havocbot_ai()
 
        // execute the vore AI for bots
        Vore_AI();
-       if(self.predator.classname == "player")
+       if(self.stat_eaten)
                return; // an eaten bot has nothing to do outside of the vore AI
 
        if (bot_strategytoken == self)
index 4bbd421..1d4b08a 100644 (file)
@@ -22,7 +22,7 @@ void Vore_AI_Teamheal(entity prey)
 
        if not(teams_matter && cvar("g_balance_vore_teamheal") && cvar("g_vore_teamvore"))
                return;
-       if(self.deadflag != DEAD_NO || self.predator.classname == "player" || self.flagcarried || self.digesting) // a flag carrier can't waste time on team healing
+       if(self.deadflag != DEAD_NO || self.stat_eaten || self.flagcarried || self.digesting) // a flag carrier can't waste time on team healing
        {
                self.status_teamhealing = 0;
                return;
@@ -97,7 +97,7 @@ void Vore_AI()
 // Predator bot behavior:
 // --------------------------------
 
-       if(self.predator.classname != "player")
+       if(!self.stat_eaten)
        {
                // finding and swallowing a player
 
@@ -170,7 +170,7 @@ void Vore_AI()
 // Prey bot behavior:
 // --------------------------------
 
-       if(self.predator.classname == "player" && time > self.decide_prey)
+       if(self.stat_eaten && time > self.decide_prey)
        {
                // all we can do in the stomach is kick and do some damage / try to escape, or leave if the circumstances allow it and we should
 
index 3379047..eb1b144 100644 (file)
@@ -528,7 +528,7 @@ float Client_customizeentityforclient()
        }\r
 \r
        Client_setmodel(setmodel_state());\r
-       if not(self.predator.classname == "player" || self.fakeprey)\r
+       if not(self.stat_eaten || self.fakeprey)\r
                self.alpha = default_player_alpha;\r
        else\r
                self.alpha = -1; // hide all prey\r
@@ -829,7 +829,7 @@ void PutClientInServer (void)
                RemoveGrabber(self); // Wazat's Grabber\r
 \r
                Vore_DeadPrey_Detach(self);\r
-               self.fakeprey = 0; // completely clear the fakeprey status\r
+               self.fakeprey = FALSE; // clear the fakeprey status\r
 \r
                self.classname = "player";\r
                self.wasplayer = TRUE;\r
@@ -1612,7 +1612,7 @@ void ChatBubbleThink()
                remove(self);\r
                return;\r
        }\r
-       if ((self.owner.BUTTON_CHAT && !self.owner.deadflag && self.owner.predator.classname != "player" && self.owner.fakepredator.classname != "player")\r
+       if ((self.owner.BUTTON_CHAT && !self.owner.deadflag && !self.owner.stat_eaten && self.owner.fakepredator.classname != "player")\r
 #ifdef TETRIS\r
                || self.owner.tetris_on\r
 #endif\r
@@ -1655,7 +1655,7 @@ void TeamBubbleThink()
                return;\r
        }\r
 //     setorigin(self, self.owner.origin + '0 0 15' + self.owner.maxs_z * '0 0 1');  // bandwidth hog. setattachment does this now\r
-       if (self.owner.BUTTON_CHAT || self.owner.deadflag || self.owner.killindicator || self.owner.predator.classname == "player" || self.owner.fakepredator.classname == "player")\r
+       if (self.owner.BUTTON_CHAT || self.owner.deadflag || self.owner.killindicator || self.owner.stat_eaten)\r
                self.model = "";\r
        else\r
        {\r
@@ -2287,13 +2287,13 @@ void ApplyHealthSize()
        if(self.crouch)\r
        {\r
                //setsize (self, PL_CROUCH_MIN * self.scale, PL_CROUCH_MAX * self.scale);\r
-               if not(self.predator.classname == "player" || self.fakeprey > 1)\r
+               if(!self.stat_eaten)\r
                        self.view_ofs = PL_CROUCH_VIEW_OFS * self.scale;\r
        }\r
        else\r
        {\r
                //setsize (self, PL_MIN * self.scale, PL_MAX * self.scale);\r
-               if not(self.predator.classname == "player" || self.fakeprey > 1)\r
+               if(!self.stat_eaten)\r
                        self.view_ofs = PL_VIEW_OFS * self.scale;\r
        }\r
 }\r
index 9c2a82d..d8a18fd 100644 (file)
@@ -774,7 +774,7 @@ void SV_PlayerPhysics()
                }\r
        }\r
 \r
-       if(self.predator.classname == "player" || self.fakepredator.classname == "player")\r
+       if(self.stat_eaten)\r
                return;\r
 \r
        if (self.movetype == MOVETYPE_NONE)\r
@@ -980,7 +980,7 @@ void SV_PlayerPhysics()
                        PM_Accelerate(wishdir, wishspeed, wishspeed, sv_accelerate*maxspd_mod, 1, 0);\r
                }\r
        }\r
-       else if ((self.items & IT_JETPACK) && self.BUTTON_JETPACK && (!cvar("g_jetpack_fuel") || self.ammo_fuel >= 0.01 || self.items & IT_UNLIMITED_WEAPON_AMMO) && self.predator.classname != "player")\r
+       else if ((self.items & IT_JETPACK) && self.BUTTON_JETPACK && (!cvar("g_jetpack_fuel") || self.ammo_fuel >= 0.01 || self.items & IT_UNLIMITED_WEAPON_AMMO) && !self.stat_eaten)\r
        {\r
                //makevectors(self.v_angle_y * '0 1 0');\r
                makevectors(self.v_angle);\r
@@ -1082,7 +1082,7 @@ void SV_PlayerPhysics()
        else if (self.flags & FL_ONGROUND)\r
        {\r
                // we get here if we ran out of ammo\r
-               if((self.items & IT_JETPACK) && self.BUTTON_JETPACK && !(buttons_prev & 32) && self.predator.classname != "player")\r
+               if((self.items & IT_JETPACK) && self.BUTTON_JETPACK && !(buttons_prev & 32) && !self.stat_eaten)\r
                        sprint(self, "You don't have any fuel for the ^2Jetpack\n");\r
 \r
                // walking\r
@@ -1143,7 +1143,7 @@ void SV_PlayerPhysics()
        {\r
                float wishspeed0;\r
                // we get here if we ran out of ammo\r
-               if((self.items & IT_JETPACK) && self.BUTTON_JETPACK && !(buttons_prev & 32) && self.predator.classname != "player")\r
+               if((self.items & IT_JETPACK) && self.BUTTON_JETPACK && !(buttons_prev & 32) && !self.stat_eaten)\r
                        sprint(self, "You don't have any fuel for the ^2Jetpack\n");\r
 \r
                if(maxspd_mod < 1)\r
index c3bde6c..8519256 100644 (file)
@@ -749,7 +749,7 @@ void UpdateSelectedPlayer()
        selected = world;\r
        selected_score = 0.95; // 18 degrees\r
 \r
-       if(self.predator.classname == "player")\r
+       if(self.stat_eaten)\r
        {\r
                if(!self.dropweapon_check)\r
                if(self.predator.team != self.team) // don't disarm team mates when swallowing them\r
@@ -1233,7 +1233,7 @@ void GlobalSound(string sample, float chan, float voicetype)
                                        {\r
                                                if(msg_entity.cvar_cl_voice_directional == 1)\r
                                                {\r
-                                                       if(self.predator.classname == "player")\r
+                                                       if(self.stat_eaten)\r
                                                                soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE * bound(0, cvar("g_vore_soundocclusion"), 1), ATTN_MIN);\r
                                                        else\r
                                                                soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_MIN);\r
@@ -1252,7 +1252,7 @@ void GlobalSound(string sample, float chan, float voicetype)
                                        {\r
                                                if(msg_entity.cvar_cl_voice_directional == 1)\r
                                                {\r
-                                                       if(self.predator.classname == "player")\r
+                                                       if(self.stat_eaten)\r
                                                                soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE * bound(0, cvar("g_vore_soundocclusion"), 1), ATTN_MIN);\r
                                                        else\r
                                                                soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_MIN);\r
@@ -1271,7 +1271,7 @@ void GlobalSound(string sample, float chan, float voicetype)
                                {\r
                                        if(msg_entity.cvar_cl_voice_directional == 1)\r
                                        {\r
-                                               if(self.predator.classname == "player")\r
+                                               if(self.stat_eaten)\r
                                                        soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE * bound(0, cvar("g_vore_soundocclusion"), 1), ATTN_MIN);\r
                                                else\r
                                                        soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_MIN);\r
@@ -1292,7 +1292,7 @@ void GlobalSound(string sample, float chan, float voicetype)
                                if (tauntrand < msg_entity.cvar_cl_autotaunt)\r
                                if (msg_entity.cvar_cl_voice_directional >= 1)\r
                                {\r
-                                       if(self.predator.classname == "player")\r
+                                       if(self.stat_eaten)\r
                                                soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE * bound(0, cvar("g_vore_soundocclusion"), 1), bound(ATTN_MIN, msg_entity.cvar_cl_voice_directional_taunt_attenuation, ATTN_MAX));\r
                                        else\r
                                                soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, bound(ATTN_MIN, msg_entity.cvar_cl_voice_directional_taunt_attenuation, ATTN_MAX));\r
@@ -1312,7 +1312,7 @@ void GlobalSound(string sample, float chan, float voicetype)
                        {\r
                                if (msg_entity.cvar_cl_voice_directional >= 1)\r
                                {\r
-                                       if(self.predator.classname == "player")\r
+                                       if(self.stat_eaten)\r
                                                soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE * bound(0, cvar("g_vore_soundocclusion"), 1), bound(ATTN_MIN, msg_entity.cvar_cl_voice_directional_taunt_attenuation, ATTN_MAX));\r
                                        else\r
                                                soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, bound(ATTN_MIN, msg_entity.cvar_cl_voice_directional_taunt_attenuation, ATTN_MAX));\r
@@ -1321,7 +1321,7 @@ void GlobalSound(string sample, float chan, float voicetype)
                                        soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_NONE);\r
                        }\r
                case VOICETYPE_PLAYERSOUND:\r
-                       if(self.predator.classname == "player")\r
+                       if(self.stat_eaten)\r
                                sound(self, chan, sample, VOL_BASE * bound(0, cvar("g_vore_soundocclusion"), 1), ATTN_NORM);\r
                        else\r
                                sound(self, chan, sample, VOL_BASE, ATTN_NORM);\r
index cd5b1da..255072f 100644 (file)
@@ -274,7 +274,7 @@ void W_ThrowWeapon(vector velo, vector delta, float doreduce)
        w = self.weapon;\r
        if (w == 0)\r
                return; // just in case\r
-       if(self.predator.classname == "player" && self.dropweapon_check)\r
+       if(self.stat_eaten && self.dropweapon_check)\r
                return; // can't drop weapons from the stomach\r
        if (g_lms)\r
                return;\r
index 66ad0f7..09cbacc 100644 (file)
@@ -566,7 +566,7 @@ void CL_Weaponentity_Think()
 \r
        if(self.owner.alpha == default_player_alpha)\r
                self.alpha = default_weapon_alpha;\r
-       else if(self.owner.alpha != 0 && self.owner.predator.classname != "player")\r
+       else if(self.owner.alpha != 0 && !self.owner.stat_eaten)\r
                self.alpha = self.owner.alpha;\r
        else\r
                self.alpha = 1;\r
@@ -1585,7 +1585,7 @@ void W_DecreaseAmmo(.float ammo_type, float ammo_use, float ammo_reload)
 void W_ReloadedAndReady()\r
 {\r
        // if we are inside the stomach, don't allow reloading, and schedule the weapon to reload once when we're out\r
-       if(self.predator.classname == "player")\r
+       if(self.stat_eaten)\r
        {\r
                self.clip_load = self.weapon_load[self.weapon] = -1;\r
                w_ready(); // don't keep executing each frame\r
@@ -1621,7 +1621,7 @@ void W_ReloadedAndReady()
 void W_Reload(float sent_ammo_min, float sent_ammo_amount, float sent_time, string sent_sound)\r
 {\r
        // if we are inside the stomach, don't allow reloading\r
-       if(self.predator.classname == "player")\r
+       if(self.stat_eaten)\r
                return;\r
 \r
        // set global values to work with\r
index 4df1ad5..f8ce6c0 100644 (file)
@@ -131,7 +131,7 @@ void GrabberThink()
                WarpZone_RefSys_AddIncrementally(self, self.aiment);\r
 \r
        // prevent the grabber from sticking to a player that has been swallowed\r
-       if(self.aiment.predator.classname == "player")\r
+       if(self.aiment.stat_eaten)\r
        {\r
                // if the grabber is linked to a player that we swallowed, disconnect it (or the grabber will stick to us / the player inside us)\r
                // otherwise, link the grabber to the player who ate our linked player\r
index 769b19d..5665ff4 100644 (file)
@@ -13,7 +13,7 @@ float Violence_GibSplash_SendEntity(entity to, float sf)
 // TODO maybe convert this to a TE?\r
 void Violence_GibSplash_At(vector org, vector dir, float type, float amount, entity gibowner, entity attacker)\r
 {\r
-       if(gibowner.predator.classname == "player" || gibowner.fakeprey > 1)\r
+       if(gibowner.stat_eaten)\r
                return; // you can't bleed or gib outside of the stomach\r
 \r
        entity e;\r
index 7a065d4..c677643 100644 (file)
@@ -49,7 +49,7 @@ void OtherPLReport_Think()
        WriteByte(MSG_BROADCAST, SVC_TEMPENTITY);\r
        WriteByte(MSG_BROADCAST, TE_CSQC_OTHERPLREPORT);\r
        WriteByte(MSG_BROADCAST, self.cnt);\r
-       if(e.predator.classname == "player") // tempt hackers less by only sending the info of eaten players\r
+       if(e.stat_eaten) // tempt hackers less by only sending the info of eaten players\r
        {\r
                if(cvar("g_vore_showhealth"))\r
                        WriteByte(MSG_BROADCAST, e.health);\r
index e7dd022..85bd30b 100644 (file)
@@ -464,7 +464,7 @@ float turret_validate_target(entity e_turret,entity e_target,float validate_flag
     if not (e_target)\r
         return -2;\r
 \r
-       if(e_target.predator.classname == "player") // don't shoot someone from the belly\r
+       if(e_target.stat_eaten) // don't shoot someone in the belly\r
                return -3;\r
 \r
        if(g_onslaught)\r
index 4adbd90..23fdeb7 100644 (file)
@@ -33,8 +33,8 @@ float Swallow_condition_check(entity prey)
        // checks the necessary conditions for swallowing a player\r
 \r
        if(prey != self)\r
-       if(prey.classname == "player" && prey.predator.classname != "player" && prey.deadflag == DEAD_NO) // we can't swallow someone who's already in someone else's stomach\r
-       if(self.classname == "player" && self.predator.classname != "player" && self.deadflag == DEAD_NO) // we can't swallow players while inside someone's stomach ourselves\r
+       if(prey.classname == "player" && !prey.stat_eaten && prey.deadflag == DEAD_NO) // we can't swallow someone who's already in someone else's stomach\r
+       if(self.classname == "player" && !self.stat_eaten && self.deadflag == DEAD_NO) // we can't swallow players while inside someone's stomach ourselves\r
        if(!self.BUTTON_REGURGITATE && self.swallow_delay < time)\r
        if not(vlen(self.velocity) > cvar("g_balance_vore_regurgitate_speedcap"))\r
        {\r
@@ -83,7 +83,7 @@ float Stomach_TeamMates_check(entity pred)
 \r
 float Vore_CanLeave()\r
 {\r
-       if(self.predator.classname == "player")\r
+       if(self.stat_eaten)\r
        {\r
                if(!cvar("g_vore_kick")) // you are defenseless in the stomach if you can't kick, so allow leaving\r
                        return TRUE;\r
@@ -98,13 +98,13 @@ float Vore_CanLeave()
 // position the camera properly for prey\r
 void Vore_SetCamera()\r
 {\r
-       if not(self.predator.classname == "player" || self.fakeprey > 1)\r
+       if not(self.stat_eaten)\r
                return;\r
 \r
        self.view_ofs = PL_PREY_VIEW_OFS;\r
 \r
        float prey_height;\r
-       if(self.fakeprey > 1)\r
+       if(self.fakeprey)\r
                prey_height = (self.scale - self.fakepredator.scale) * cvar("g_healthsize_vore_pos");\r
        else\r
                prey_height = (self.scale - self.predator.scale) * cvar("g_healthsize_vore_pos");\r
@@ -241,12 +241,12 @@ void Vore_DeadPrey_Configure(entity e)
 {\r
        // ran when the keepdeadprey feature is enabled and prey stays inside the stomach after dying\r
 \r
-       if(e.fakeprey || e.predator.classname != "player") // already configured\r
+       if(e.fakeprey || !e.stat_eaten) // we already configured everything\r
                return;\r
 \r
        // this entity is like e.predator but for dead prey, to avoid conflicts\r
        e.fakepredator = e.predator;\r
-       e.fakeprey = 2; // is fakeprey in a stomach\r
+       e.fakeprey = TRUE;\r
 \r
        // first release the prey from the predator, as dead prey needs to be attached differently\r
        // the predator's stomach load is also decreased, as dead prey doesn't count any more\r
@@ -270,7 +270,7 @@ void Vore_DeadPrey_Detach(entity e)
                return;\r
 \r
        e.fakepredator = world;\r
-       e.fakeprey = 1; // was fakeprey but is now detached\r
+       e.fakeprey = TRUE; // keep fakeprey status\r
        e.aiment = world;\r
        e.movetype = MOVETYPE_TOSS;\r
 }\r
@@ -279,7 +279,7 @@ void Vore_PreyRelease(entity e, float pred_disconnect)
 {\r
        if(pred_disconnect)\r
        {\r
-               if(e.fakeprey > 1)\r
+               if(e.fakeprey)\r
                        Vore_DeadPrey_Detach(e);\r
                else\r
                        Vore_Regurgitate(e);\r
@@ -299,7 +299,7 @@ void Vore_Disconnect()
        // frees prey from their predators when someone disconnects or goes spectating, or in other circumstances\r
 \r
        // prey disconnects or goes spectating while inside someone's belly\r
-       if(self.predator.classname == "player")\r
+       if(self.stat_eaten)\r
                Vore_PreyRelease(self, TRUE);\r
 \r
        // pred disconnects or goes spectating with players in their belly\r
@@ -416,7 +416,7 @@ void Vore_AutoTaunt()
        }\r
 \r
        // prey taunts\r
-       if(self.predator.classname == "player" && !(teams_matter && self.team == self.predator.team))\r
+       if(self.stat_eaten && !(teams_matter && self.team == self.predator.team))\r
        {\r
                if(!self.taunt_soundtime) // taunt_soundtime becomes 0 once the taunt has played\r
                {\r
@@ -444,7 +444,7 @@ void Vore()
        Vore_AutoTaunt();\r
 \r
        // wash the goo away from players once they leave the stomach\r
-       if(self.predator.classname != "player")\r
+       if(!self.stat_eaten)\r
        if(stov(cvar_string("g_vore_regurgitatecolor_release")))\r
        if(self.colormod)\r
        if(cvar("g_vore_regurgitatecolor_release_fade"))\r
@@ -461,7 +461,7 @@ void Vore()
        }\r
 \r
        // set all vore stats\r
-       if(self.fakeprey > 1)\r
+       if(self.fakepredator.classname == "player")\r
                self.stat_eaten = num_for_edict(self.fakepredator);\r
        else if(self.predator.classname == "player")\r
        {\r
@@ -480,7 +480,7 @@ void Vore()
        // don't allow a player inside a player inside another player :)\r
        // prevent this by checking if such has happened, and taking the proper measures\r
        // this code has a high priority and must not be stopped by any delay, so run it here\r
-       if(self.predator.predator.classname == "player")\r
+       if(self.predator.stat_eaten)\r
        {\r
                entity target_predator, target_predator_predator, oldself;\r
                target_predator = self.predator;\r
@@ -586,11 +586,11 @@ void Vore()
        Vore_SetCamera();\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
+       if(self.fakeprey)\r
+       if(self.fakepredator.deadflag != DEAD_NO || self.fakepredator.stat_eaten)\r
                Vore_DeadPrey_Detach(self);\r
 \r
-       if(self.predator.classname != "player")\r
+       if(!self.stat_eaten)\r
                return;\r
 \r
        if(self.deadflag != DEAD_NO)\r
index 30d7131..ba0afe7 100644 (file)
@@ -62,7 +62,7 @@ void spawnfunc_weapon_grabber (void)
 \r
 float w_grabber(float req)\r
 {\r
-       if(self.predator.classname == "player") // we can't use weapons while in the stomach\r
+       if(self.stat_eaten) // we can't use weapons while in the stomach\r
        {\r
                self.grabber_state |= GRABBER_REMOVING;\r
                return FALSE;\r