X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=data%2Fqcsrc%2Fserver%2Fvore.qc;h=557b2e1bf0b4ab2b5ee085b84aeb3c01c12fb972;hb=65ebedb3627734e33d349eacf3d949cb96cf2707;hp=154817c831ed28b961979050e5ef1ca255b62aec;hpb=9760c1f5f73a265361ae226aac41259d6d861a58;p=voretournament%2Fvoretournament.git diff --git a/data/qcsrc/server/vore.qc b/data/qcsrc/server/vore.qc index 154817c8..557b2e1b 100644 --- a/data/qcsrc/server/vore.qc +++ b/data/qcsrc/server/vore.qc @@ -43,8 +43,8 @@ float Swallow_condition_check(entity prey) swallow_complain = "You cannot swallow your team mates\n"; else if(!cvar("g_vore_spawnshield") && prey.spawnshieldtime > time) swallow_complain = "You cannot swallow someone protected by the spawn shield\n"; - else if(self.stomach_load >= cvar("g_balance_vore_swallow_limit")) - swallow_complain = strcat("You cannot swallow more than ^2", cvar_string("g_balance_vore_swallow_limit"), "^7 players at a time\n"); + else if(self.stomach_load >= g_balance_vore_swallow_limit) + swallow_complain = strcat("You cannot swallow more than ^2", ftos(g_balance_vore_swallow_limit), "^7 players at a time\n"); else if(cvar("g_vore_biggergut") && prey.stomach_load > self.stomach_load) swallow_complain = "You cannot swallow someone with a bigger stomach than yours\n"; else if(cvar("g_vore_biggersize") && prey.scale > self.scale) @@ -96,19 +96,67 @@ float Vore_CanLeave() } // position the camera properly for prey -void Vore_SetCamera() +void Vore_SetPreyPositions() { - if not(self.stat_eaten) - return; + // self is the predator and head is the prey - self.view_ofs = PL_PREY_VIEW_OFS; + local entity head; + local vector origin_apply; + local float position_counter; - float prey_height; - if(self.fakeprey) - prey_height = (self.scale - self.fakepredator.scale) * cvar("g_healthsize_vore_pos"); - else - prey_height = (self.scale - self.predator.scale) * cvar("g_healthsize_vore_pos"); - self.view_ofs_z += prey_height; + // In order to allow prey to see each other in the stomach, we must position each occupant differently, + // else all players overlap in the center. To do this, we run a loop on all players in the same stomach. + // For each player, the origin is updated, then a new origin is used for the next player. + // This requires that no more than 9 players may be in the stomach at a time! + FOR_EACH_PLAYER(head) + { + if(head.predator == self) + { + switch(position_counter) + { + case 0: + origin_apply = '0 0 0'; // first occupant sits in the middle + break; + case 1: + origin_apply = '1 0 0'; // second occupant sits in the front + break; + case 2: + origin_apply = '-1 0 0'; // third occupant sits in the back + break; + case 3: + origin_apply = '0 1 0'; // fourth occupant sits in the right + break; + case 4: + origin_apply = '0 -1 0'; // fifth occupant sits in the left + break; + case 5: + origin_apply = '1 1 0'; // sixth occupant sits in the front-right + break; + case 6: + origin_apply = '-1 1 0'; // seventh occupant sits in the back-right + break; + case 7: + origin_apply = '1 -1 0'; // eigth occupant sits in the front-left + break; + case 8: + origin_apply = '-1 -1 0'; // ninth occupant sits in the back-left + break; + default: + break; + } + + // since prey have their predators set as an aiment, view_ofs will specify the real origin of prey, not just the view offset + head.view_ofs = PL_PREY_VIEW_OFS + origin_apply * cvar("g_vore_neighborprey_distance"); + head.view_ofs_z *= self.scale; // stomach center depends on predator scale + + // change prey height based on scale + float prey_height; + prey_height = (head.scale - self.scale) * cvar("g_healthsize_vore_pos"); + head.view_ofs_z += prey_height; + + position_counter += 1; + } + } } .float gurgle_oldstomachload; @@ -183,7 +231,7 @@ void Vore_Swallow(entity e) centerprint(e.predator, "^3You have swallowed a team mate, don't digest!"); } - PlayerSound(e.predator, playersound_swallow, CHAN_PAIN, VOICETYPE_PLAYERSOUND); + PlayerSound(e.predator, playersound_swallow, CHAN_VOICE, VOICETYPE_PLAYERSOUND); setanim(e.predator, e.predator.anim_pain1, FALSE, TRUE, TRUE); // looks good for swallowing / regurgitating e.predator.punchangle_x -= cvar("g_balance_vore_swallow_punchangle"); e.predator.stomach_load += 1; @@ -199,6 +247,27 @@ void Vore_Swallow(entity e) e.stomachkick_delay = time + cvar("g_balance_vore_kick_delay"); // don't kick immediately after being swallowed } +void Vore_SwallowStep(entity e) +{ + if(!cvar("g_balance_vore_swallow_speed_fill")) + { + Vore_Swallow(e); + return; + } + + // increase the progress value until it reaches 1, then swallow the player + if(e.swallow_progress_prey < 1) + e.swallow_progress_prey += cvar("g_balance_vore_swallow_speed_fill") * frametime; + else + { + Vore_Swallow(e); + e.swallow_progress_prey = 0; + } + + // the predator's progress is how much the prey got swallowed + self.swallow_progress_pred = e.swallow_progress_prey; +} + void Vore_Regurgitate(entity e) { // this player is being regurgitated by their predator, apply the proper changes @@ -223,7 +292,11 @@ void Vore_Regurgitate(entity e) e.pusher = e.predator; // allows us to frag players by regurgitating them in deadly pits e.pushltime = time + cvar("g_maxpushtime"); - PlayerSound(e.predator, playersound_regurgitate, CHAN_PAIN, VOICETYPE_PLAYERSOUND); + // regurgitated prey is given this amount of swallow progress, to simulate being more vulnerable + if(cvar("g_balance_vore_swallow_speed_fill")) + e.swallow_progress_prey = cvar("g_balance_vore_regurgitate_swallowprogress"); + + 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("regurgitate"), e.predator.origin, '0 0 0', 1); e.predator.punchangle_x += cvar("g_balance_vore_regurgitate_punchangle"); @@ -321,18 +394,32 @@ void Vore_Digest() { // apply digestion to prey - if(time > self.predator.digestion_step) + if(time > self.digestion_step) { - Damage(self, self.predator, self.predator, cvar("g_balance_vore_digestion_damage"), DEATH_DIGESTION, self.origin, '0 0 0'); + // if distributed digestion is enabled, reduce digestion strength by the number of prey in our stomach + float reduce; + if(cvar("g_balance_vore_digestion_distribute")) + reduce = self.predator.stomach_load; + else + reduce = 1; + + float damage; + damage = cvar("g_balance_vore_digestion_damage") / reduce; + + // apply player scale to digestion damage + if(cvar("g_balance_vore_digestion_playerscale")) + damage *= self.predator.scale; + + Damage(self, self.predator, self.predator, damage, DEATH_DIGESTION, self.origin, '0 0 0'); if(cvar("g_balance_vore_digestion_vampire") && self.predator.health < cvar("g_balance_vore_digestion_vampire_stable")) - self.predator.health += cvar("g_balance_vore_digestion_vampire"); + self.predator.health += cvar("g_balance_vore_digestion_vampire") / reduce; if (self.predator.digestsound_finished < time) { PlayerSound (self.predator, playersound_digest, CHAN_PLAYER, VOICETYPE_PLAYERSOUND); self.predator.digestsound_finished = time + 0.5; } - self.predator.digestion_step = time + steptime; + self.digestion_step = time + steptime; } if(self.deadflag != DEAD_NO) @@ -367,15 +454,25 @@ void Vore_StomachKick() if(time > self.stomachkick_delay) { float damage; + vector force; damage = ceil(random() * (cvar("g_balance_vore_kick_damage_max") - cvar("g_balance_vore_kick_damage_min")) + cvar("g_balance_vore_kick_damage_min")); + force = v_forward * cvar("g_balance_vore_kick_force"); - Damage(self.predator, self, self, damage, DEATH_STOMACHKICK, self.predator.origin, v_forward * cvar("g_balance_vore_kick_force")); - sound(self.predator, CHAN_PROJECTILE, "weapons/stomachkick.wav", VOL_BASE, ATTN_NORM); + // apply player scale to the damage / force of the kick + if(cvar("g_balance_vore_kick_playerscale")) + { + damage *= self.scale; + force *= self.scale; + } + + Damage(self.predator, self, self, damage, DEATH_STOMACHKICK, self.predator.origin, force); + sound(self.predator, CHAN_PROJECTILE, strcat("weapons/hit", ftos(floor(random() * 8)), ".wav"), VOL_BASE, ATTN_NORM); self.predator.punchangle_x -= cvar("g_balance_vore_kick_predator_punchangle"); self.punchangle_x += cvar("g_balance_vore_kick_prey_punchangle"); - if(random() < cvar("g_balance_vore_kick_escapeprobability")) - Vore_Regurgitate(self); + // abort the predator's scheduled regurgitation + if(random() < cvar("g_balance_vore_kick_cutregurgitate")) + self.predator.regurgitate_prepare = 0; self.stomachkick_delay = time + cvar("g_balance_vore_kick_delay"); } @@ -434,15 +531,41 @@ void Vore_AutoTaunt() void Vore_SetSbarRings() { - if(time <= self.action_delay) + // first clear the ring stats, then configure them if needed + self.stat_sbring1_type = self.stat_sbring1_clip = 0; + self.stat_sbring2_type = self.stat_sbring2_clip = 0; + + if(self.stat_eaten) { - self.stat_sbring1_type = 1; // ring shows vore action delay - self.stat_sbring1_clip = bound(0, (time / self.action_delay - 1) / ((self.action_delay - cvar("g_balance_vore_action_delay")) / self.action_delay - 1), 1); + if(time <= self.stomachkick_delay) + { + self.stat_sbring1_type = 3; // ring shows stomach kick delay, empties with progress + self.stat_sbring1_clip = bound(0, (time / self.stomachkick_delay - 1) / ((self.stomachkick_delay - cvar("g_balance_vore_kick_delay")) / self.stomachkick_delay - 1), 1); + } } else { - self.stat_sbring1_type = 0; - self.stat_sbring1_clip = 0; + if(self.swallow_progress_pred) + { + self.stat_sbring1_type = 1; // ring shows predator swallow progress, fills with progress + self.stat_sbring1_clip = bound(0, self.swallow_progress_pred, 1); + } + else if(time <= self.action_delay) + { + self.stat_sbring1_type = 2; // ring shows vore action delay, empties with progress + self.stat_sbring1_clip = bound(0, (time / self.action_delay - 1) / ((self.action_delay - cvar("g_balance_vore_action_delay")) / self.action_delay - 1), 1); + } + + if(self.swallow_progress_prey) + { + self.stat_sbring2_type = 1; // ring shows prey swallow progress, fills with progress + self.stat_sbring2_clip = bound(0, self.swallow_progress_prey, 1); + } + else if(time <= self.regurgitate_prepare) + { + self.stat_sbring2_type = 2; // ring shows regurgitation preparing, fills with progress + self.stat_sbring2_clip = 1 - bound(0, (time / self.regurgitate_prepare - 1) / ((self.regurgitate_prepare - cvar("g_balance_vore_regurgitate_delay")) / self.regurgitate_prepare - 1), 1); + } } } @@ -517,6 +640,23 @@ void Vore() } } + // the swallow progress of prey and preds idly decrease by this amount + if(cvar("g_balance_vore_swallow_speed_decrease")) + { + if(self.swallow_progress_pred) + { + self.swallow_progress_pred -= cvar("g_balance_vore_swallow_speed_decrease") * frametime; + if(self.swallow_progress_pred < 0) + self.swallow_progress_pred = 0; + } + if(self.swallow_progress_prey) + { + self.swallow_progress_prey -= cvar("g_balance_vore_swallow_speed_decrease") * frametime; + if(self.swallow_progress_prey < 0) + self.swallow_progress_prey = 0; + } + } + // apply delays and skip the vore system under some circumstances if(time < game_starttime || (time < warmup && !inWarmupStage)) // don't allow vore before a round begins { @@ -546,7 +686,7 @@ void Vore() self.stat_canswallow = 1; if(self.BUTTON_ATCK) - Vore_Swallow(prey); + Vore_SwallowStep(prey); } else if(prey != world) self.stat_canswallow = -1; @@ -599,7 +739,7 @@ void Vore() // Code that addresses the prey: // -------------------------------- - Vore_SetCamera(); + Vore_SetPreyPositions(); // keepdeadprey - detach dead prey if their predator died or got swallowed if(self.fakeprey)