X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fmutators%2Fmutator%2Fbuffs%2Fsv_buffs.qc;h=367277e7f2159acb1adfca535c686131a79a0e00;hb=318c2deead2bdcdc9ff69d118f2ebc1ff0795c7a;hp=c2eb01618d5e62828b62b8246b48fb0e2088b2d0;hpb=81323b9fcb2819407b31451453e3651b9675f520;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc b/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc index c2eb01618..367277e7f 100644 --- a/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc +++ b/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc @@ -129,7 +129,7 @@ void buff_Waypoint_Spawn(entity e) if(autocvar_g_buffs_waypoint_distance <= 0) return; entity buff = e.buffdef; - entity wp = WaypointSprite_Spawn(WP_Buff, 0, autocvar_g_buffs_waypoint_distance, e, '0 0 1' * e.maxs.z, NULL, e.team, e, buff_waypoint, true, RADARICON_Buff); + entity wp = WaypointSprite_Spawn(WP_Buff, 0, autocvar_g_buffs_waypoint_distance, e, '0 0 1' * e.maxs.z, NULL, e.team_forced, e, buff_waypoint, true, RADARICON_Buff); wp.wp_extra = buff.m_id; WaypointSprite_UpdateTeamRadar(e.buff_waypoint, RADARICON_Buff, e.glowmod); e.buff_waypoint.waypointsprite_visible_for_player = buff_Waypoint_visible_for_player; @@ -204,7 +204,7 @@ void buff_Touch(entity this, entity toucher) if(!IS_PLAYER(toucher)) return; // incase mutator changed toucher - if((this.team && DIFF_TEAM(toucher, this)) + if((this.team_forced && toucher.team != this.team_forced) || (STAT(FROZEN, toucher)) || (toucher.vehicle) || (!this.buffdef) // TODO: error out or maybe reset type if this occurs? @@ -365,7 +365,7 @@ void buff_Think(entity this) if(this.buff_active) { - if(this.team && !this.buff_waypoint) + if(this.team_forced && !this.buff_waypoint) buff_Waypoint_Spawn(this); if(this.lifetime && time >= this.lifetime) @@ -399,7 +399,7 @@ void buff_Reset(entity this) bool buff_Customize(entity this, entity client) { entity player = WaypointSprite_getviewentity(client); - if((!this.buff_active || !this.buffdef) || (this.team && DIFF_TEAM(player, this))) + if((!this.buff_active || !this.buffdef) || (this.team_forced && player.team != this.team_forced)) { this.alpha = 0.3; if(this.effects & EF_FULLBRIGHT) { this.effects &= ~(EF_FULLBRIGHT); } @@ -425,8 +425,6 @@ void buff_Init(entity this) { if(!cvar("g_buffs")) { delete(this); return; } - if(!teamplay && this.team) { this.team = 0; } - entity buff = this.buffdef; if(!buff || !buff_Available(buff)) @@ -475,10 +473,13 @@ void buff_Init(entity this) void buff_Init_Compat(entity ent, entity replacement) { - if (ent.spawnflags & 2) - ent.team = NUM_TEAM_1; - else if (ent.spawnflags & 4) - ent.team = NUM_TEAM_2; + if (teamplay) + { + if (ent.spawnflags & 2) + ent.team_forced = NUM_TEAM_1; + else if (ent.spawnflags & 4) + ent.team_forced = NUM_TEAM_2; + } ent.buffdef = replacement; @@ -534,21 +535,6 @@ METHOD(Buff, m_remove, void(StatusEffects this, entity actor, int removal_type)) SUPER(Buff).m_remove(this, actor, removal_type); } -METHOD(Disabled, m_tick, void(StatusEffects this, entity actor)) -{ - if(time >= actor.disabled_effect_time) - { - Send_Effect(EFFECT_SMOKING, actor.origin + ((actor.mins + actor.maxs) * 0.5), '0 0 0', 1); - actor.disabled_effect_time = time + 0.5; - } - SUPER(Disabled).m_tick(this, actor); -} -METHOD(Disabled, m_remove, void(StatusEffects this, entity actor, int removal_type)) -{ - actor.disabled_effect_time = 0; - SUPER(Disabled).m_remove(this, actor, removal_type); -} - METHOD(AmmoBuff, m_apply, void(StatusEffects this, entity actor, float eff_time, float eff_flags)) { bool wasactive = (actor.statuseffects && (actor.statuseffects.statuseffect_flags[this.m_id] & STATUSEFFECT_FLAG_ACTIVE)); @@ -708,7 +694,7 @@ MUTATOR_HOOKFUNCTION(buffs, Damage_Calculate) if(StatusEffects_active(BUFF_DISABILITY, frag_attacker)) if(frag_target != frag_attacker) - StatusEffects_apply(STATUSEFFECT_Disabled, frag_target, time + autocvar_g_buffs_disability_slowtime, 0); + StatusEffects_apply(STATUSEFFECT_Stunned, frag_target, time + autocvar_g_buffs_disability_slowtime, 0); if(StatusEffects_active(BUFF_INFERNO, frag_target)) { @@ -743,19 +729,17 @@ MUTATOR_HOOKFUNCTION(buffs, Damage_Calculate) MUTATOR_HOOKFUNCTION(buffs, PlayerDamage_SplitHealthArmor) { + // NOTE: vampire PlayerDamage_SplitHealthArmor code is similar entity frag_attacker = M_ARGV(1, entity); entity frag_target = M_ARGV(2, entity); if(!StatusEffects_active(BUFF_VAMPIRE, frag_attacker)) return; float health_take = bound(0, M_ARGV(4, float), GetResource(frag_target, RES_HEALTH)); - if(!StatusEffects_active(STATUSEFFECT_SpawnShield, frag_target) && - frag_target != frag_attacker && - IS_PLAYER(frag_attacker) && - !IS_DEAD(frag_target) && !STAT(FROZEN, frag_target)) + if (!StatusEffects_active(STATUSEFFECT_SpawnShield, frag_target) && frag_target != frag_attacker + && IS_PLAYER(frag_attacker) && !IS_DEAD(frag_target) && !STAT(FROZEN, frag_target)) { - GiveResource(frag_attacker, RES_HEALTH, - autocvar_g_buffs_vampire_damage_steal * health_take); + GiveResource(frag_attacker, RES_HEALTH, autocvar_g_buffs_vampire_damage_steal * health_take); } } @@ -764,7 +748,7 @@ MUTATOR_HOOKFUNCTION(buffs, PlayerPhysics_UpdateStats) entity player = M_ARGV(0, entity); // these automatically reset, no need to worry - if(StatusEffects_active(STATUSEFFECT_Disabled, player)) + if(StatusEffects_active(STATUSEFFECT_Stunned, player)) STAT(MOVEVARS_HIGHSPEED, player) *= autocvar_g_buffs_disability_speed; } @@ -781,7 +765,7 @@ MUTATOR_HOOKFUNCTION(buffs, MonsterMove) { entity mon = M_ARGV(0, entity); - if(StatusEffects_active(STATUSEFFECT_Disabled, mon)) + if(StatusEffects_active(STATUSEFFECT_Stunned, mon)) { M_ARGV(1, float) *= autocvar_g_buffs_disability_speed; // run speed M_ARGV(2, float) *= autocvar_g_buffs_disability_speed; // walk speed @@ -918,7 +902,7 @@ MUTATOR_HOOKFUNCTION(buffs, WeaponRateFactor) { entity player = M_ARGV(1, entity); - if(StatusEffects_active(STATUSEFFECT_Disabled, player)) + if(StatusEffects_active(STATUSEFFECT_Stunned, player)) M_ARGV(0, float) *= autocvar_g_buffs_disability_rate; } @@ -926,7 +910,7 @@ MUTATOR_HOOKFUNCTION(buffs, WeaponSpeedFactor) { entity player = M_ARGV(1, entity); - if(StatusEffects_active(STATUSEFFECT_Disabled, player)) + if(StatusEffects_active(STATUSEFFECT_Stunned, player)) M_ARGV(0, float) *= autocvar_g_buffs_disability_weaponspeed; } @@ -964,14 +948,12 @@ MUTATOR_HOOKFUNCTION(buffs, PlayerRegen) if(StatusEffects_active(BUFF_MEDIC, player)) { - M_ARGV(2, float) = autocvar_g_buffs_medic_rot; // rot_mod + M_ARGV(3, float) = autocvar_g_buffs_medic_rot; // rot_mod M_ARGV(4, float) = M_ARGV(1, float) = autocvar_g_buffs_medic_max; // limit_mod = max_mod M_ARGV(2, float) = autocvar_g_buffs_medic_regen; // regen_mod } } -REPLICATE(cvar_cl_buffs_autoreplace, bool, "cl_buffs_autoreplace"); - MUTATOR_HOOKFUNCTION(buffs, BuildMutatorsString) { if(autocvar_g_buffs > 0) // only report as a mutator if they're enabled