From: Mario Date: Sun, 1 Nov 2020 11:30:44 +0000 (+1000) Subject: Remove medic buff team healing functionality, fixes #2492. Only apply vampire buff... X-Git-Tag: xonotic-v0.8.5~700 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=c200b268ee002da1ef1eda18e48b44c54d4242a5;p=xonotic%2Fxonotic-data.pk3dir.git Remove medic buff team healing functionality, fixes #2492. Only apply vampire buff health stealing to players and fix vampire mutator potentially stealing health from frozen players --- diff --git a/mutators.cfg b/mutators.cfg index 22797f5c0..c437868e3 100644 --- a/mutators.cfg +++ b/mutators.cfg @@ -334,9 +334,6 @@ set g_buffs_medic_survive_health 5 "amount of health player survives with after set g_buffs_medic_rot 0.2 "health rot rate multiplier" set g_buffs_medic_max 1.5 "stable health medic limit multiplier" set g_buffs_medic_regen 1.7 "health medic rate multiplier" -set g_buffs_medic_heal_amount 15 "health given to nearby players on a delay" -set g_buffs_medic_heal_range 400 "furthest away players can be from carrier to get healed by medic buff" -set g_buffs_medic_heal_delay 1 "delay between team healing" set g_buffs_vengeance 1 "vengeance buff: attackers also take damage" set g_buffs_vengeance_time 60 "vengeance buff carry time" set g_buffs_vengeance_damage_multiplier 0.4 "amount of damage dealt the attacker takes when hitting a target with vengeance" diff --git a/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc b/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc index 50b5d91b5..fe62c6737 100644 --- a/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc +++ b/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc @@ -1,22 +1,10 @@ #include "sv_buffs.qh" #include +#include #include #include -void buffs_DelayedInit(entity this); - -AUTOCVAR(g_buffs, int, -1, "Enable buffs, -1: enabled but no auto location or replacing powerups, 1: enabled and can replace them"); - -REGISTER_MUTATOR(buffs, autocvar_g_buffs) -{ - MUTATOR_ONADD - { - if(autocvar_g_buffs > 0) - InitializeEntity(NULL, buffs_DelayedInit, INITPRIO_FINDTARGET); - } -} - bool buffs_BuffModel_Customize(entity this, entity client) { entity player = WaypointSprite_getviewentity(client); @@ -443,25 +431,6 @@ void buff_Vengeance_DelayedDamage(entity this) return; } -// note: only really useful in teamplay -void buff_Medic_Heal(entity this) -{ - FOREACH_CLIENT(IS_PLAYER(it) && it != this && vdist(it.origin - this.origin, <=, autocvar_g_buffs_medic_heal_range), - { - if (DIFF_TEAM(it, this)) - { - continue; - } - float hp = GetResource(it, RES_HEALTH); - if(hp >= autocvar_g_balance_health_regenstable) - { - continue; - } - Send_Effect(EFFECT_HEALING, it.origin, '0 0 0', 1); - SetResource(it, RES_HEALTH, bound(0, hp + autocvar_g_buffs_medic_heal_amount, autocvar_g_balance_health_regenstable)); - }); -} - float buff_Inferno_CalculateTime(float damg, float offset_x, float offset_y, float intersect_x, float intersect_y, float base) { return offset_y + (intersect_y - offset_y) * logn(((damg - offset_x) * ((base - 1) / intersect_x)) + 1, base); @@ -557,32 +526,28 @@ MUTATOR_HOOKFUNCTION(buffs, Damage_Calculate) Fire_AddDamage(frag_target, frag_attacker, (frag_damage * autocvar_g_buffs_inferno_damagemultiplier), btime, DEATH_BUFF.m_id); } - // this... is ridiculous (TODO: fix!) - if(STAT(BUFFS, frag_attacker) & BUFF_VAMPIRE.m_itemid) - if(!frag_target.vehicle) - if(!ITEM_DAMAGE_NEEDKILL(frag_deathtype)) - if(!IS_DEAD(frag_target)) - if(IS_PLAYER(frag_target) || IS_MONSTER(frag_target)) - if(frag_attacker != frag_target) - if(!STAT(FROZEN, frag_target)) - if(frag_target.takedamage) - if(DIFF_TEAM(frag_attacker, frag_target)) - { - float amount = bound(0, frag_damage * autocvar_g_buffs_vampire_damage_steal, - GetResource(frag_target, RES_HEALTH)); - GiveResourceWithLimit(frag_attacker, RES_HEALTH, amount, g_pickup_healthsmall_max); - if (GetResource(frag_target, RES_ARMOR)) - { - amount = bound(0, frag_damage * autocvar_g_buffs_vampire_damage_steal, - GetResource(frag_target, RES_ARMOR)); - GiveResourceWithLimit(frag_attacker, RES_ARMOR, amount, g_pickup_armorsmall_max); - } - } - M_ARGV(4, float) = frag_damage; M_ARGV(6, vector) = frag_force; } +MUTATOR_HOOKFUNCTION(buffs, PlayerDamage_SplitHealthArmor) +{ + entity frag_attacker = M_ARGV(1, entity); + entity frag_target = M_ARGV(2, entity); + if(!(STAT(BUFFS, frag_attacker) & BUFF_VAMPIRE.m_itemid)) + return; + float health_take = bound(0, M_ARGV(4, float), GetResource(frag_target, RES_HEALTH)); + + if(time >= frag_target.spawnshieldtime && + 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); + } +} + MUTATOR_HOOKFUNCTION(buffs, PlayerSpawn) { entity player = M_ARGV(0, entity); @@ -903,13 +868,6 @@ MUTATOR_HOOKFUNCTION(buffs, PlayerPreThink) if((STAT(BUFFS, player) & BUFF_INVISIBLE.m_itemid) && (player.oldbuffs & BUFF_INVISIBLE.m_itemid)) player.alpha = ((autocvar_g_buffs_invisible_alpha) ? autocvar_g_buffs_invisible_alpha : -1); // powerups reset alpha, so we must enforce this (TODO) - if(STAT(BUFFS, player) & BUFF_MEDIC.m_itemid) - if(time >= player.buff_medic_healtime) - { - buff_Medic_Heal(player); - player.buff_medic_healtime = time + autocvar_g_buffs_medic_heal_delay; - } - #define BUFF_ONADD(b) if ( (STAT(BUFFS, player) & (b).m_itemid) && !(player.oldbuffs & (b).m_itemid)) #define BUFF_ONREM(b) if (!(STAT(BUFFS, player) & (b).m_itemid) && (player.oldbuffs & (b).m_itemid)) diff --git a/qcsrc/common/mutators/mutator/buffs/sv_buffs.qh b/qcsrc/common/mutators/mutator/buffs/sv_buffs.qh index b58581187..bc571261c 100644 --- a/qcsrc/common/mutators/mutator/buffs/sv_buffs.qh +++ b/qcsrc/common/mutators/mutator/buffs/sv_buffs.qh @@ -2,7 +2,18 @@ #include "buffs.qh" -#include "../instagib/_mod.qh" +void buffs_DelayedInit(entity this); + +AUTOCVAR(g_buffs, int, -1, "Enable buffs, -1: enabled but no auto location or replacing powerups, 1: enabled and can replace them"); + +REGISTER_MUTATOR(buffs, autocvar_g_buffs) +{ + MUTATOR_ONADD + { + if(autocvar_g_buffs > 0) + InitializeEntity(NULL, buffs_DelayedInit, INITPRIO_FINDTARGET); + } +} bool autocvar_g_buffs_effects; float autocvar_g_buffs_waypoint_distance; @@ -24,9 +35,6 @@ float autocvar_g_buffs_medic_survive_health; float autocvar_g_buffs_medic_rot; float autocvar_g_buffs_medic_max; float autocvar_g_buffs_medic_regen; -float autocvar_g_buffs_medic_heal_amount = 15; -float autocvar_g_buffs_medic_heal_delay = 1; -float autocvar_g_buffs_medic_heal_range = 400; float autocvar_g_buffs_vengeance_damage_multiplier; float autocvar_g_buffs_bash_force; float autocvar_g_buffs_bash_force_self; @@ -58,8 +66,6 @@ float autocvar_g_buffs_luck_damagemultiplier = 3; .int buff_ammo_prev_clipload; // invisible .float buff_invisible_prev_alpha; -// medic -.float buff_medic_healtime; // disability .float buff_disability_time; .float buff_disability_effect_time; diff --git a/qcsrc/common/mutators/mutator/vampire/sv_vampire.qc b/qcsrc/common/mutators/mutator/vampire/sv_vampire.qc index 12e4bdea4..f4562a99e 100644 --- a/qcsrc/common/mutators/mutator/vampire/sv_vampire.qc +++ b/qcsrc/common/mutators/mutator/vampire/sv_vampire.qc @@ -17,7 +17,7 @@ MUTATOR_HOOKFUNCTION(vampire, PlayerDamage_SplitHealthArmor) if(time >= frag_target.spawnshieldtime && frag_target != frag_attacker && IS_PLAYER(frag_attacker) && - !IS_DEAD(frag_target)) + !IS_DEAD(frag_target) && !STAT(FROZEN, frag_target)) { GiveResource(frag_attacker, RES_HEALTH, autocvar_g_vampire_factor * damage_take);