From cd1a06d4ac8b6b68e225c617c73615035549c1ef Mon Sep 17 00:00:00 2001 From: MirceaKitsune Date: Sat, 19 Nov 2011 15:07:22 +0200 Subject: [PATCH] Allow consumable items to be dropped instead of disappearing. Currently cannot be picked up again --- data/qcsrc/server/cl_client.qc | 6 +--- data/qcsrc/server/t_items.qc | 58 +++++++++++++++++++++++++--------- data/qcsrc/server/vore.qc | 8 ----- 3 files changed, 44 insertions(+), 28 deletions(-) diff --git a/data/qcsrc/server/cl_client.qc b/data/qcsrc/server/cl_client.qc index 9b26c490..51d03fcb 100644 --- a/data/qcsrc/server/cl_client.qc +++ b/data/qcsrc/server/cl_client.qc @@ -855,11 +855,7 @@ void PutClientInServer (void) { // remove consumable items when we respawn if(e.predator == self) - { - e.nextthink = 0; - remove(e); - e = world; - } + Item_Consumable_Remove(e, FALSE); } self.classname = "player"; diff --git a/data/qcsrc/server/t_items.qc b/data/qcsrc/server/t_items.qc index 75bac5bf..80baa83a 100644 --- a/data/qcsrc/server/t_items.qc +++ b/data/qcsrc/server/t_items.qc @@ -219,27 +219,27 @@ void Item_ScheduleInitialRespawn(entity e) Item_ScheduleRespawnIn(e, game_starttime - time + ITEM_RESPAWNTIME_INITIAL(e)); } -void Item_Consumable_Remove(); +void Item_Consumable_Remove(entity e, float regurgitate); void Item_Consumable_Think() { if(self.predator.regurgitate_prepare && time > self.predator.regurgitate_prepare) { self.predator.regurgitate_prepare = 0; self.predator.complain_vore = time + complain_delay_time; // prevent complaining the next frame if this empties our stomach - Item_Consumable_Remove(); + Item_Consumable_Remove(self, TRUE); return; } if(self.predator.classname != "player") { // no longer a player, remove consumable items - Item_Consumable_Remove(); + Item_Consumable_Remove(self, TRUE); return; } if(self.predator.stat_eaten) { // prey can't hold consumable items - Item_Consumable_Remove(); + Item_Consumable_Remove(self, TRUE); return; } @@ -259,19 +259,25 @@ float Item_Consumable_Customizeentityforclient() return TRUE; } -void Item_Consumable_Remove() +void Item_DroppedConsumable_Spawn(entity e); +void Item_Consumable_Remove(entity e, float regurgitate) { - // predator effects, some common to those in Vore_Regurgitate - PlayerSound(self.predator, playersound_regurgitate, CHAN_VOICE, VOICETYPE_PLAYERSOUND); - setanim(self.predator, self.predator.anim_pain1, FALSE, TRUE, TRUE); // looks good for swallowing / regurgitating - pointparticles(particleeffectnum("vore_regurgitate"), self.predator.origin, '0 0 0', 1); - self.predator.punchangle_x += cvar("g_balance_vore_regurgitate_predator_punchangle_item"); - self.predator.regurgitate_prepare = 0; - self.predator.action_delay = time + cvar("g_balance_vore_action_delay"); + if(regurgitate) + { + // predator effects, some common to those in Vore_Regurgitate + PlayerSound(e.predator, playersound_regurgitate, CHAN_VOICE, VOICETYPE_PLAYERSOUND); + setanim(e.predator, e.predator.anim_pain1, FALSE, TRUE, TRUE); // looks good for swallowing / regurgitating + pointparticles(particleeffectnum("vore_regurgitate"), e.predator.origin, '0 0 0', 1); + e.predator.punchangle_x += cvar("g_balance_vore_regurgitate_predator_punchangle_item"); + e.predator.regurgitate_prepare = 0; + e.predator.action_delay = time + cvar("g_balance_vore_action_delay"); + + Item_DroppedConsumable_Spawn(e); + } - self.nextthink = 0; - remove(self); - self = world; + e.nextthink = 0; + remove(e); + e = world; } void Item_Consumable_Spawn(entity e, entity pl) @@ -306,6 +312,28 @@ void Item_Consumable_Spawn(entity e, entity pl) Vore_AutoDigest(pl); } +void Item_DroppedConsumable_Spawn(entity e) +{ + entity item; + item = spawn(); + item.owner = world; + item.classname = "droppedconsumable"; + item.movetype = MOVETYPE_TOSS; + item.solid = SOLID_TRIGGER; + setmodel(item, e.model); + item.health = e.health; + item.max_health = e.max_health; + item.dmg = e.dmg; + item.scale = e.scale; + item.colormod = e.colormod; + + setorigin(item, e.predator.origin); + item.angles = e.angles; + makevectors(e.predator.v_angle); + item.velocity = v_forward * cvar("g_balance_vore_regurgitate_force"); + e.predator.velocity += -v_forward * cvar("g_balance_vore_regurgitate_predatorforce"); +} + float Item_GiveTo(entity item, entity player) { float _switchweapon; diff --git a/data/qcsrc/server/vore.qc b/data/qcsrc/server/vore.qc index aac9eda2..56f60da1 100644 --- a/data/qcsrc/server/vore.qc +++ b/data/qcsrc/server/vore.qc @@ -375,17 +375,9 @@ void Vore_Regurgitate(entity e) } // apply velocities - local vector oldforward, oldright, oldup; - oldforward = v_forward; - oldright = v_right; - oldup = v_up; makevectors(e.predator.v_angle); e.velocity = v_forward * cvar("g_balance_vore_regurgitate_force"); e.predator.velocity += -v_forward * cvar("g_balance_vore_regurgitate_predatorforce"); - v_forward = oldforward; - v_right = oldright; - v_up = oldup; - e.pusher = e.predator; // allows us to frag players by regurgitating them in deadly pits e.pushltime = time + cvar("g_maxpushtime"); -- 2.39.2