]> git.rm.cloudns.org Git - voretournament/voretournament.git/commitdiff
Allow consumable items to be dropped instead of disappearing. Currently cannot be...
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Sat, 19 Nov 2011 13:07:22 +0000 (15:07 +0200)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Sat, 19 Nov 2011 13:07:22 +0000 (15:07 +0200)
data/qcsrc/server/cl_client.qc
data/qcsrc/server/t_items.qc
data/qcsrc/server/vore.qc

index 9b26c49053f7410aff10121ce544780ff009365c..51d03fcb5235183023b7e22508b658e6b4da74ec 100644 (file)
@@ -855,11 +855,7 @@ void PutClientInServer (void)
                {\r
                        // remove consumable items when we respawn\r
                        if(e.predator == self)\r
-                       {\r
-                               e.nextthink = 0;\r
-                               remove(e);\r
-                               e = world;\r
-                       }\r
+                               Item_Consumable_Remove(e, FALSE);\r
                }\r
 \r
                self.classname = "player";\r
index 75bac5bfab3bfb33e40a639363f42b358c75012f..80baa83a91489c77d4ad8b77328957597bda2d0e 100644 (file)
@@ -219,27 +219,27 @@ void Item_ScheduleInitialRespawn(entity e)
        Item_ScheduleRespawnIn(e, game_starttime - time + ITEM_RESPAWNTIME_INITIAL(e));\r
 }\r
 \r
-void Item_Consumable_Remove();\r
+void Item_Consumable_Remove(entity e, float regurgitate);\r
 void Item_Consumable_Think()\r
 {\r
        if(self.predator.regurgitate_prepare && time > self.predator.regurgitate_prepare)\r
        {\r
                self.predator.regurgitate_prepare = 0;\r
                self.predator.complain_vore = time + complain_delay_time; // prevent complaining the next frame if this empties our stomach\r
-               Item_Consumable_Remove();\r
+               Item_Consumable_Remove(self, TRUE);\r
                return;\r
        }\r
 \r
        if(self.predator.classname != "player")\r
        {\r
                // no longer a player, remove consumable items\r
-               Item_Consumable_Remove();\r
+               Item_Consumable_Remove(self, TRUE);\r
                return;\r
        }\r
        if(self.predator.stat_eaten)\r
        {\r
                // prey can't hold consumable items\r
-               Item_Consumable_Remove();\r
+               Item_Consumable_Remove(self, TRUE);\r
                return;\r
        }\r
 \r
@@ -259,19 +259,25 @@ float Item_Consumable_Customizeentityforclient()
        return TRUE;\r
 }\r
 \r
-void Item_Consumable_Remove()\r
+void Item_DroppedConsumable_Spawn(entity e);\r
+void Item_Consumable_Remove(entity e, float regurgitate)\r
 {\r
-       // predator effects, some common to those in Vore_Regurgitate\r
-       PlayerSound(self.predator, playersound_regurgitate, CHAN_VOICE, VOICETYPE_PLAYERSOUND);\r
-       setanim(self.predator, self.predator.anim_pain1, FALSE, TRUE, TRUE); // looks good for swallowing / regurgitating\r
-       pointparticles(particleeffectnum("vore_regurgitate"), self.predator.origin, '0 0 0', 1);\r
-       self.predator.punchangle_x += cvar("g_balance_vore_regurgitate_predator_punchangle_item");\r
-       self.predator.regurgitate_prepare = 0;\r
-       self.predator.action_delay = time + cvar("g_balance_vore_action_delay");\r
+       if(regurgitate)\r
+       {\r
+               // predator effects, some common to those in Vore_Regurgitate\r
+               PlayerSound(e.predator, playersound_regurgitate, CHAN_VOICE, VOICETYPE_PLAYERSOUND);\r
+               setanim(e.predator, e.predator.anim_pain1, FALSE, TRUE, TRUE); // looks good for swallowing / regurgitating\r
+               pointparticles(particleeffectnum("vore_regurgitate"), e.predator.origin, '0 0 0', 1);\r
+               e.predator.punchangle_x += cvar("g_balance_vore_regurgitate_predator_punchangle_item");\r
+               e.predator.regurgitate_prepare = 0;\r
+               e.predator.action_delay = time + cvar("g_balance_vore_action_delay");\r
+\r
+               Item_DroppedConsumable_Spawn(e);\r
+       }\r
 \r
-       self.nextthink = 0;\r
-       remove(self);\r
-       self = world;\r
+       e.nextthink = 0;\r
+       remove(e);\r
+       e = world;\r
 }\r
 \r
 void Item_Consumable_Spawn(entity e, entity pl)\r
@@ -306,6 +312,28 @@ void Item_Consumable_Spawn(entity e, entity pl)
        Vore_AutoDigest(pl);\r
 }\r
 \r
+void Item_DroppedConsumable_Spawn(entity e)\r
+{\r
+       entity item;\r
+       item = spawn();\r
+       item.owner = world;\r
+       item.classname = "droppedconsumable";\r
+       item.movetype = MOVETYPE_TOSS;\r
+       item.solid = SOLID_TRIGGER;\r
+       setmodel(item, e.model);\r
+       item.health = e.health;\r
+       item.max_health = e.max_health;\r
+       item.dmg = e.dmg;\r
+       item.scale = e.scale;\r
+       item.colormod = e.colormod;\r
+\r
+       setorigin(item, e.predator.origin);\r
+       item.angles = e.angles;\r
+       makevectors(e.predator.v_angle);\r
+       item.velocity = v_forward * cvar("g_balance_vore_regurgitate_force");\r
+       e.predator.velocity += -v_forward * cvar("g_balance_vore_regurgitate_predatorforce");\r
+}\r
+\r
 float Item_GiveTo(entity item, entity player)\r
 {\r
        float _switchweapon;\r
index aac9eda24ddff885d53a0d5becc9b8a197ec2987..56f60da1763fb8eb30331a4d8c75109f7a2338b4 100644 (file)
@@ -375,17 +375,9 @@ void Vore_Regurgitate(entity e)
        }\r
 \r
        // apply velocities\r
-       local vector oldforward, oldright, oldup;\r
-       oldforward = v_forward;\r
-       oldright = v_right;\r
-       oldup = v_up;\r
        makevectors(e.predator.v_angle);\r
        e.velocity = v_forward * cvar("g_balance_vore_regurgitate_force");\r
        e.predator.velocity += -v_forward * cvar("g_balance_vore_regurgitate_predatorforce");\r
-       v_forward = oldforward;\r
-       v_right = oldright;\r
-       v_up = oldup;\r
-\r
        e.pusher = e.predator; // allows us to frag players by regurgitating them in deadly pits\r
        e.pushltime = time + cvar("g_maxpushtime");\r
 \r