X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=data%2Fqcsrc%2Fserver%2Ft_items.qc;h=d7decefe8472e4a95aecdedb31a70d774a14c323;hb=375402630bde3b43c7b1eb5735db5f7424191d46;hp=975ea4ffdae9fc5b667497fd5c7f218a1f55ffc2;hpb=971a9e96365bd8051a705ec38834420b8ba0d393;p=voretournament%2Fvoretournament.git diff --git a/data/qcsrc/server/t_items.qc b/data/qcsrc/server/t_items.qc index 975ea4ff..d7decefe 100644 --- a/data/qcsrc/server/t_items.qc +++ b/data/qcsrc/server/t_items.qc @@ -174,7 +174,7 @@ void Item_RespawnCountdown (void) WaypointSprite_Spawn(name, 0, 0, self, '0 0 64', world, 0, self, waypointsprite_attached, TRUE); if(self.waypointsprite_attached) { - WaypointSprite_UpdateTeamRadar(self.waypointsprite_attached, RADARICON_POWERUP, rgb); + WaypointSprite_UpdateRadar(self.waypointsprite_attached, RADARICON_POWERUP, rgb); //WaypointSprite_UpdateMaxHealth(self.waypointsprite_attached, ITEM_RESPAWN_TICKS + 1); WaypointSprite_UpdateBuildFinished(self.waypointsprite_attached, time + ITEM_RESPAWN_TICKS); } @@ -221,7 +221,6 @@ void Item_ScheduleInitialRespawn(entity e) .float inithealth, initdmg; .float item_digestion_step; -void Item_Consumable_Remove(entity e, float regurgitate); void Item_Consumable_Think() { if(self.predator.regurgitate_prepare && time > self.predator.regurgitate_prepare) @@ -240,7 +239,7 @@ void Item_Consumable_Think() self.scale = self.health / self.inithealth; // scale matches the item's digestion progress self.dmg = self.initdmg * self.scale; - if(self.health < 1) + if(self.health <= 0) { // this item is done Item_Consumable_Remove(self, FALSE); @@ -256,11 +255,14 @@ void Item_Consumable_Think() damage_offset = 1; if(cvar("g_balance_vore_digestion_distribute")) // apply distributed digestion damage - damage_offset /= self.predator.stomach_load / self.predator.stomach_maxload; + damage_offset /= (1 - (self.predator.stomach_load / self.predator.stomach_maxload) * bound(0, cvar("g_balance_vore_digestion_distribute"), 1)); damage = ceil(cvar("g_balance_vore_digestion_damage_item") / damage_offset); self.health -= damage; - self.predator.health += damage; + if(self.predator.health + damage <= self.max_health) + self.predator.health += damage; + else if(self.predator.health < self.max_health) + self.predator.health = self.max_health; self.predator.pauserothealth_finished = max(self.predator.pauserothealth_finished, time + cvar("g_balance_pause_health_rot")); self.item_digestion_step = time + vore_steptime; @@ -290,11 +292,17 @@ void Item_Consumable_Remove(entity e, float regurgitate) { if(regurgitate) { + float scalediff, sz; + sz = e.scale ? e.scale : 1; // the line below does not work if I define this directly (fteqcc bug?) + scalediff = cvar("g_healthsize") ? sz / e.predator.scale : sz; // the tighter the gut, the greater the velocity + // 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"); + pointparticles(particleeffectnum("vore_regurgitate"), e.predator.origin, '0 0 0', floor(scalediff * PARTICLE_MULTIPLIER)); + e.predator.punchangle_x = crandom() * cvar("g_balance_vore_regurgitate_predator_punchangle_item") * scalediff; + e.predator.punchangle_y = crandom() * cvar("g_balance_vore_regurgitate_predator_punchangle_item") * scalediff; + e.predator.punchangle_z = crandom() * cvar("g_balance_vore_regurgitate_predator_punchangle_item") * scalediff; e.predator.regurgitate_prepare = 0; e.predator.action_delay = time + cvar("g_balance_vore_action_delay"); @@ -309,6 +317,7 @@ void Item_Consumable_Remove(entity e, float regurgitate) void Item_Consumable_Spawn(entity e, entity pl) { entity item; + item = spawn(); item.owner = e; item.classname = "consumable"; @@ -332,7 +341,8 @@ void Item_Consumable_Spawn(entity e, entity pl) item.aiment = pl; item.view_ofs_x = CONSUMABLE_VIEW_OFS_x + crandom() * cvar("g_vore_neighborprey_distance_item"); item.view_ofs_y = CONSUMABLE_VIEW_OFS_y + crandom() * cvar("g_vore_neighborprey_distance_item"); - item.view_ofs_z = CONSUMABLE_VIEW_OFS_z; + item.view_ofs_z = CONSUMABLE_VIEW_OFS_z + crandom() * cvar("g_vore_neighborprey_distance_item"); + item.angles = randomvec() * 360; item.customizeentityforclient = Item_Consumable_Customizeentityforclient; item.think = Item_Consumable_Think; @@ -341,13 +351,19 @@ void Item_Consumable_Spawn(entity e, entity pl) if(stov(cvar_string("g_vore_regurgitatecolor_color_normal"))) item.colormod = stov(cvar_string("g_vore_regurgitatecolor_color_normal")); + float scalediff, sz; + sz = e.scale ? e.scale : 1; // the line below does not work if I define this directly (fteqcc bug?) + scalediff = cvar("g_healthsize") ? sz / pl.scale : sz; // the tighter the gut, the greater the velocity + // predator effects, some common to those in Vore_Swallow PlayerSound(pl, playersound_swallow, CHAN_VOICE, VOICETYPE_PLAYERSOUND); setanim(pl, pl.anim_pain1, FALSE, TRUE, TRUE); // looks good for swallowing / regurgitating - pl.punchangle_x -= cvar("g_balance_vore_swallow_predator_punchangle_item"); + pl.punchangle_x = crandom() * cvar("g_balance_vore_swallow_predator_punchangle_item") * scalediff; + pl.punchangle_y = crandom() * cvar("g_balance_vore_swallow_predator_punchangle_item") * scalediff; + pl.punchangle_z = crandom() * cvar("g_balance_vore_swallow_predator_punchangle_item") * scalediff; pl.regurgitate_prepare = 0; pl.action_delay = time + cvar("g_balance_vore_action_delay"); - Vore_AutoDigest(pl); + pl.last_pickup = time; } void Item_DroppedConsumable_Touch() @@ -356,7 +372,8 @@ void Item_DroppedConsumable_Touch() return; // give the consumable item to the player touching it - if(other.stomach_load + self.dmg <= other.stomach_maxload) + if not(other.stomach_load + self.dmg > other.stomach_maxload || other.stomach_load + self.initdmg > other.stomach_maxload) + if not(!cvar("g_balance_health_consumable_alwayspickup") && other.health >= self.max_health) { Item_Consumable_Spawn(self, other); remove(self); @@ -380,17 +397,60 @@ void Item_DroppedConsumable_Spawn(entity e) item.scale = e.scale; item.colormod = e.colormod; + if(cvar("g_nodepthtestitems")) + item.effects |= EF_NODEPTHTEST; + + float scalediff, sz; + sz = e.scale ? e.scale : 1; // the line below does not work if I define this directly (fteqcc bug?) + scalediff = cvar("g_healthsize") ? sz / e.predator.scale : sz; // the tighter the gut, the greater the velocity + setorigin(item, e.predator.origin); item.angles_y = e.predator.angles_y; 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"); - + item.velocity = v_forward * cvar("g_balance_vore_regurgitate_force") * scalediff; + e.predator.velocity += -v_forward * cvar("g_balance_vore_regurgitate_predatorforce") * scalediff; item.touch = Item_DroppedConsumable_Touch; item.cnt = time + 1; // 1 second delay SUB_SetFade(item, time + 20, 1); } +float Item_Swallow(entity item, entity player) +{ + float pickedup, usage; + pickedup = FALSE; + if(item.dmg && cvar("g_vore")) + { + if(player.stomach_load + item.dmg <= player.stomach_maxload) + if not(!cvar("g_balance_health_consumable_alwayspickup") && player.health >= item.max_health) + usage = 2; // consumable item, only if the vore system is enabled + } + else if (player.health < item.max_health) + usage = 1; // normal item + if(!usage) + return FALSE; + + item.swallow_progress_prey = item.swallow_progress_prey + cvar("g_balance_vore_swallow_speed_item_fill") * (player.health / item.health); + player.swallow_progress_pred = item.swallow_progress_prey; + if(item.swallow_progress_prey < 1) + return FALSE; // swallow progress not full yet + + if(usage > 1) + { + pickedup = TRUE; + item.swallow_progress_prey = player.swallow_progress_pred = 0; + Item_Consumable_Spawn(item, player); + } + else + { + pickedup = TRUE; + item.swallow_progress_prey = player.swallow_progress_pred = 0; + player.health = min(player.health + item.health, item.max_health); + player.pauserothealth_finished = max(player.pauserothealth_finished, time + cvar("g_balance_pause_health_rot")); + } + + return pickedup; +} + float Item_GiveTo(entity item, entity player) { float _switchweapon; @@ -473,22 +533,7 @@ float Item_GiveTo(entity item, entity player) } if (item.health) - { - if(item.dmg) // consumable item - { - if(player.stomach_load + item.dmg <= player.stomach_maxload) - { - pickedup = TRUE; - Item_Consumable_Spawn(self, player); - } - } - else if (player.health < item.max_health) - { - pickedup = TRUE; - player.health = min(player.health + item.health, item.max_health); - player.pauserothealth_finished = max(player.pauserothealth_finished, time + cvar("g_balance_pause_health_rot")); - } - } + pickedup = Item_Swallow(item, player); if (item.armorvalue) if (player.armorvalue < item.max_armorvalue) { @@ -514,6 +559,17 @@ float Item_GiveTo(entity item, entity player) return 1; } +void Item_Think() +{ + self.nextthink = time; + + if(!self.swallow_progress_prey) + return; + + self.swallow_progress_prey = max(0, self.swallow_progress_prey - 0.01); + self.alpha = 1 / self.swallow_progress_prey; +} + void Item_Touch (void) { entity e, head; @@ -698,7 +754,6 @@ float commodity_pickupevalfunc(entity player, entity item) return item.bot_pickupbasevalue * c; }; - .float is_item; void StartItem (string itemmodel, string pickupsound, float defaultrespawntime, float defaultrespawntimejitter, string itemname, float itemid, float weaponid, float itemflags, float(entity player, entity item) pickupevalfunc, float pickupbasevalue) { @@ -851,6 +906,8 @@ void StartItem (string itemmodel, string pickupsound, float defaultrespawntime, self.weapons = weaponid; self.flags = FL_ITEM | itemflags; self.touch = Item_Touch; + self.think = Item_Think; + self.nextthink = time; setmodel (self, self.mdl); // precision set below self.effects |= EF_LOWPRECISION; if((itemflags & FL_POWERUP) || self.health || self.armorvalue) @@ -1072,12 +1129,6 @@ void spawnfunc_item_health_large (void) { } void spawnfunc_item_health_mega (void) { - if(!cvar("g_powerup_superhealth")) - return; - - if((g_arena || g_ca) && !cvar("g_arena_powerups")) - return; - if(!self.max_health) self.max_health = g_pickup_healthmega_max; if(!self.health)