}\r
else\r
{\r
- if(g_ghost_items && self.respawntime > 0) // if respawntime is -1, this item does not respawn\r
+ if(g_ghost_items)\r
{\r
self.colormod = stov(cvar_string("g_ghost_items_color"));\r
self.glowmod = self.colormod;\r
\r
e.spawnshieldtime = 1;\r
}\r
- else if((e.flags & FL_WEAPON) && (g_weapon_stay == 3 && self.respawntime > 0)) // if respawntime is -1, this item does not respawn\r
+ else if((e.flags & FL_WEAPON) && (g_weapon_stay == 3))\r
{\r
// make the item translucent green and not touchable\r
e.model = e.mdl;\r
\r
e.spawnshieldtime = 0; // field indicates whether picking it up may give you anything other than the weapon\r
}\r
- else if(g_ghost_items && self.respawntime > 0) // if respawntime is -1, this item does not respawn\r
+ else if(g_ghost_items)\r
{\r
// make the item translucent green and not touchable\r
e.model = e.mdl;\r
sound (self, CHAN_TRIGGER, "misc/itemrespawn.wav", VOL_BASE, ATTN_NORM); // play respawn sound\r
setorigin (self, self.origin);\r
\r
- //pointparticles(particleeffectnum("item_respawn"), self.origin + self.mins_z * '0 0 1' + '0 0 48', '0 0 0', 1);\r
pointparticles(particleeffectnum("item_respawn"), self.origin + 0.5 * (self.mins + self.maxs), '0 0 0', 1);\r
}\r
\r
Item_Show(e, 0);\r
if(e.respawntime > 0) // if respawntime is -1, this item does not respawn\r
Item_ScheduleRespawnIn(e, ITEM_RESPAWNTIME(e));\r
+ else\r
+ remove(e);\r
}\r
\r
void Item_ScheduleInitialRespawn(entity e)\r
Item_ScheduleRespawnIn(e, game_starttime - time + ITEM_RESPAWNTIME_INITIAL(e));\r
}\r
\r
+.float inithealth, initdmg;\r
+.float item_digestion_step;\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(self, TRUE);\r
+ return;\r
+ }\r
+ if(self.predator.stat_eaten)\r
+ {\r
+ // prey can't hold consumable items\r
+ Item_Consumable_Remove(self, TRUE);\r
+ return;\r
+ }\r
+\r
+ self.scale = self.health / self.inithealth; // scale matches the item's digestion progress\r
+ self.dmg = self.initdmg * self.scale;\r
+ if(self.health <= 0)\r
+ {\r
+ // this item is done\r
+ Item_Consumable_Remove(self, FALSE);\r
+ return;\r
+ }\r
+\r
+ if(self.predator.digesting)\r
+ {\r
+ if(time > self.item_digestion_step)\r
+ {\r
+ // if distributed digestion is enabled, reduce digestion strength by the amount of prey in our stomach\r
+ float damage, damage_offset;\r
+\r
+ damage_offset = 1;\r
+ if(cvar("g_balance_vore_digestion_distribute")) // apply distributed digestion damage\r
+ damage_offset /= (1 - (self.predator.stomach_load / self.predator.stomach_maxload) * bound(0, cvar("g_balance_vore_digestion_distribute"), 1));\r
+ damage = cvar("g_balance_vore_digestion_damage_item") / damage_offset;\r
+\r
+ self.health -= damage;\r
+ if(self.predator.health + damage <= self.max_health)\r
+ self.predator.health += damage;\r
+ else if(self.predator.health < self.max_health)\r
+ self.predator.health = self.max_health;\r
+ self.predator.pauserothealth_finished = max(self.predator.pauserothealth_finished, time + cvar("g_balance_pause_health_rot"));\r
+\r
+ self.item_digestion_step = time + vore_steptime;\r
+ }\r
+\r
+ if(stov(cvar_string("g_vore_regurgitatecolor_color_digest")))\r
+ self.colormod = stov(cvar_string("g_vore_regurgitatecolor_color_digest"));\r
+ }\r
+\r
+ self.nextthink = time;\r
+}\r
+\r
+float Item_Consumable_Customizeentityforclient()\r
+{\r
+ if(cvar("g_vore_neighborprey_distance_item") && self.predator == other.predator && !(other.cvar_chase_active || other.classname == "observer"))\r
+ {\r
+ self.alpha = default_player_alpha; // allow seeing neighboring items\r
+ self.effects |= EF_NODEPTHTEST; // don't hide behind the stomach's own EF_NODEPTHTEST\r
+ }\r
+ else\r
+ self.alpha = -1; // hide item\r
+ return TRUE;\r
+}\r
+\r
+void Item_DroppedConsumable_Spawn(entity e);\r
+void Item_Consumable_Remove(entity e, float regurgitate)\r
+{\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
+ e.nextthink = 0;\r
+ remove(e);\r
+ e = world;\r
+}\r
+\r
+void Item_Consumable_Spawn(entity e, entity pl)\r
+{\r
+ entity item;\r
+ item = spawn();\r
+ item.owner = e;\r
+ item.classname = "consumable";\r
+ item.movetype = MOVETYPE_FOLLOW;\r
+ item.solid = SOLID_NOT;\r
+ setmodel(item, e.model);\r
+ item.health = e.health;\r
+ if(e.inithealth)\r
+ {\r
+ item.inithealth = e.inithealth;\r
+ item.initdmg = e.initdmg;\r
+ }\r
+ else\r
+ {\r
+ item.inithealth = e.health;\r
+ item.initdmg = e.dmg;\r
+ }\r
+ item.max_health = e.max_health;\r
+\r
+ item.predator = pl;\r
+ item.aiment = pl;\r
+ item.view_ofs_x = CONSUMABLE_VIEW_OFS_x + crandom() * cvar("g_vore_neighborprey_distance_item");\r
+ item.view_ofs_y = CONSUMABLE_VIEW_OFS_y + crandom() * cvar("g_vore_neighborprey_distance_item");\r
+ item.view_ofs_z = CONSUMABLE_VIEW_OFS_z + crandom() * cvar("g_vore_neighborprey_distance_item");\r
+ item.angles = randomvec() * 360;\r
+\r
+ item.customizeentityforclient = Item_Consumable_Customizeentityforclient;\r
+ item.think = Item_Consumable_Think;\r
+ item.nextthink = time;\r
+\r
+ if(stov(cvar_string("g_vore_regurgitatecolor_color_normal")))\r
+ item.colormod = stov(cvar_string("g_vore_regurgitatecolor_color_normal"));\r
+\r
+ // predator effects, some common to those in Vore_Swallow\r
+ PlayerSound(pl, playersound_swallow, CHAN_VOICE, VOICETYPE_PLAYERSOUND);\r
+ setanim(pl, pl.anim_pain1, FALSE, TRUE, TRUE); // looks good for swallowing / regurgitating\r
+ pl.punchangle_x -= cvar("g_balance_vore_swallow_predator_punchangle_item");\r
+ pl.regurgitate_prepare = 0;\r
+ pl.action_delay = time + cvar("g_balance_vore_action_delay");\r
+}\r
+\r
+void Item_DroppedConsumable_Touch()\r
+{\r
+ if(time < self.cnt)\r
+ return;\r
+\r
+ // give the consumable item to the player touching it\r
+ if not(other.stomach_load + self.dmg > other.stomach_maxload || other.stomach_load + self.initdmg > other.stomach_maxload)\r
+ if not(!cvar("g_balance_health_consumable_alwayspickup") && other.health >= self.max_health)\r
+ {\r
+ Item_Consumable_Spawn(self, other);\r
+ remove(self);\r
+ self = world;\r
+ }\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.inithealth = e.inithealth;\r
+ item.initdmg = e.initdmg;\r
+ item.max_health = e.max_health;\r
+ item.scale = e.scale;\r
+ item.colormod = e.colormod;\r
+\r
+ setorigin(item, e.predator.origin);\r
+ item.angles_y = e.predator.angles_y;\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
+ item.touch = Item_DroppedConsumable_Touch;\r
+ item.cnt = time + 1; // 1 second delay\r
+ SUB_SetFade(item, time + 20, 1);\r
+}\r
+\r
float Item_GiveTo(entity item, entity player)\r
{\r
float _switchweapon;\r
}\r
\r
if (item.health)\r
- if (player.health < item.max_health)\r
{\r
- pickedup = TRUE;\r
- player.health = min(player.health + item.health, item.max_health);\r
- player.pauserothealth_finished = max(player.pauserothealth_finished, time + cvar("g_balance_pause_health_rot"));\r
+ if(item.dmg) // consumable item\r
+ {\r
+ if(player.stomach_load + item.dmg <= player.stomach_maxload)\r
+ if not(!cvar("g_balance_health_consumable_alwayspickup") && player.health >= item.max_health)\r
+ {\r
+ pickedup = TRUE;\r
+ Item_Consumable_Spawn(self, player);\r
+ }\r
+ }\r
+ else if (player.health < item.max_health)\r
+ {\r
+ pickedup = TRUE;\r
+ player.health = min(player.health + item.health, item.max_health);\r
+ player.pauserothealth_finished = max(player.pauserothealth_finished, time + cvar("g_balance_pause_health_rot"));\r
+ }\r
}\r
if (item.armorvalue)\r
if (player.armorvalue < item.max_armorvalue)\r
if(!Item_GiveTo(self, other))\r
return;\r
\r
+ other.last_pickup = time;\r
+\r
pointparticles(particleeffectnum("item_pickup"), self.origin, '0 0 0', 1);\r
\r
if (self.classname == "droppedweapon")\r
\r
weaponsInMap |= weaponid;\r
\r
- if(g_lms || g_ca)\r
+ if(g_lms)\r
{\r
startitem_failed = TRUE;\r
remove(self);\r
self.max_health = g_pickup_healthsmall_max;\r
if(!self.health)\r
self.health = g_pickup_healthsmall;\r
+ self.dmg = g_pickup_healthsmall_consumable;\r
StartItem ("models/items/g_h1.md3", "misc/minihealth.wav", g_pickup_respawntime_short, g_pickup_respawntimejitter_short, "5 Health", IT_5HP, 0, 0, commodity_pickupevalfunc, BOT_PICKUP_RATING_LOW);\r
}\r
\r
self.max_health = g_pickup_healthmedium_max;\r
if(!self.health)\r
self.health = g_pickup_healthmedium;\r
+ self.dmg = g_pickup_healthmedium_consumable;\r
StartItem ("models/items/g_h25.md3", "misc/mediumhealth.wav", g_pickup_respawntime_short, g_pickup_respawntimejitter_short, "25 Health", IT_25HP, 0, 0, commodity_pickupevalfunc, BOT_PICKUP_RATING_MID);\r
}\r
\r
self.max_health = g_pickup_healthlarge_max;\r
if(!self.health)\r
self.health = g_pickup_healthlarge;\r
- StartItem ("models/items/g_h50.md3", "misc/mediumhealth.wav", g_pickup_respawntime_medium, g_pickup_respawntimejitter_medium, "50 Health", IT_25HP, 0, 0, commodity_pickupevalfunc, BOT_PICKUP_RATING_MID);\r
+ self.dmg = g_pickup_healthlarge_consumable;\r
+ StartItem ("models/items/g_h50.md3", "misc/largehealth.wav", g_pickup_respawntime_medium, g_pickup_respawntimejitter_medium, "50 Health", IT_25HP, 0, 0, commodity_pickupevalfunc, BOT_PICKUP_RATING_MID);\r
}\r
\r
void spawnfunc_item_health_mega (void) {\r
self.max_health = g_pickup_healthmega_max;\r
if(!self.health)\r
self.health = g_pickup_healthmega;\r
+ self.dmg = g_pickup_healthmega_consumable;\r
StartItem ("models/items/g_h100.md3", "misc/megahealth.wav", g_pickup_respawntime_long, g_pickup_respawntimejitter_long, "100 Health", IT_HEALTH, 0, 0, commodity_pickupevalfunc, BOT_PICKUP_RATING_HIGH);\r
}\r
\r
}\r
POSTGIVE_VALUE(e, strength_finished, 1, "misc/powerup.wav", "misc/poweroff.wav");\r
POSTGIVE_VALUE(e, invincible_finished, 1, "misc/powerup_shield.wav", "misc/poweroff.wav");\r
- POSTGIVE_VALUE_ROT(e, ammo_fuel, 1, pauserotfuel_finished, cvar("g_balance_pause_fuel_rot"), pauseregen_finished, cvar("g_balance_pause_fuel_regen"), "misc/itempickup.wav", string_null);\r
- POSTGIVE_VALUE_ROT(e, armorvalue, 1, pauserotarmor_finished, cvar("g_balance_pause_armor_rot"), pauseregen_finished, cvar("g_balance_pause_health_regen"), "misc/armor25.wav", string_null);\r
- POSTGIVE_VALUE_ROT(e, health, 1, pauserothealth_finished, cvar("g_balance_pause_health_rot"), pauseregen_finished, cvar("g_balance_pause_health_regen"), "misc/megahealth.wav", string_null);\r
+ POSTGIVE_VALUE_ROT(e, ammo_fuel, 1, pauserotfuel_finished, cvar("g_balance_pause_fuel_rot"), pauseregenhealth_finished, cvar("g_balance_pause_fuel_regen"), "misc/itempickup.wav", string_null);\r
+ POSTGIVE_VALUE_ROT(e, armorvalue, 1, pauserotarmor_finished, cvar("g_balance_pause_armor_rot"), pauseregenarmor_finished, cvar("g_balance_pause_armor_regen"), "misc/armor25.wav", string_null);\r
+ POSTGIVE_VALUE_ROT(e, health, 1, pauserothealth_finished, cvar("g_balance_pause_health_rot"), pauseregenhealth_finished, cvar("g_balance_pause_health_regen"), "misc/megahealth.wav", string_null);\r
\r
if(e.strength_finished <= 0)\r
e.strength_finished = 0;\r