From 1204e14d0f06bdef3427cd08604364d6b30281fa Mon Sep 17 00:00:00 2001 From: MirceaKitsune Date: Sat, 19 Nov 2011 16:29:50 +0200 Subject: [PATCH] Implement digestible items and get them working properly --- data/qcsrc/server/t_items.qc | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/data/qcsrc/server/t_items.qc b/data/qcsrc/server/t_items.qc index 43756ab6..d351beeb 100644 --- a/data/qcsrc/server/t_items.qc +++ b/data/qcsrc/server/t_items.qc @@ -219,7 +219,7 @@ void Item_ScheduleInitialRespawn(entity e) Item_ScheduleRespawnIn(e, game_starttime - time + ITEM_RESPAWNTIME_INITIAL(e)); } -.float inithealth; +.float inithealth, initdmg; .float item_digestion_step; void Item_Consumable_Remove(entity e, float regurgitate); void Item_Consumable_Think() @@ -238,6 +238,15 @@ void Item_Consumable_Think() return; } + self.scale = self.health / self.inithealth; // scale matches the item's digestion progress + self.dmg = self.initdmg * self.scale; + if(self.health < 1) + { + // this item is done + Item_Consumable_Remove(self, FALSE); + return; + } + if(self.predator.digesting) { if(time > self.item_digestion_step) @@ -253,13 +262,12 @@ void Item_Consumable_Think() self.health -= damage; self.predator.health += damage; - self.scale = self.health / self.inithealth; // scale matches the item's digestion progress + + self.item_digestion_step = time + vore_steptime; } if(stov(cvar_string("g_vore_regurgitatecolor_color_digest"))) self.colormod = stov(cvar_string("g_vore_regurgitatecolor_color_digest")); - - self.item_digestion_step = time + vore_steptime; } self.nextthink = time; @@ -310,7 +318,7 @@ void Item_Consumable_Spawn(entity e, entity pl) item.health = e.health; item.inithealth = e.health; item.max_health = e.max_health; - item.dmg = e.dmg; + item.initdmg = e.dmg; item.predator = pl; item.aiment = pl; @@ -360,7 +368,7 @@ void Item_DroppedConsumable_Spawn(entity e) item.health = e.health; item.inithealth = e.inithealth; item.max_health = e.max_health; - item.dmg = e.dmg; + item.initdmg = e.initdmg; item.scale = e.scale; item.colormod = e.colormod; -- 2.39.2