X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fserver%2Fg_damage.qc;h=809df9ecbd892b5d6037f4cb5b07670818a3ba27;hp=45962bee7b3e69cb94513c8b57eccb36ba225446;hb=91fbfb86a93dcfb66d563d792837d8de67c14d18;hpb=b42a2b0a6c12ccbb208bd8cafb0a8405adbc3ae0 diff --git a/qcsrc/server/g_damage.qc b/qcsrc/server/g_damage.qc index 45962bee7b..809df9ecbd 100644 --- a/qcsrc/server/g_damage.qc +++ b/qcsrc/server/g_damage.qc @@ -88,11 +88,11 @@ float IsFlying(entity a) vector GetHeadshotMins(entity targ) { - return '0.6 0 0' * targ.mins_x + '0 0.6 0' * targ.mins_y + '0 0 1' * (1.3 * targ.view_ofs_z - 0.3 * targ.maxs_z); + return '-0.5 0 0' * PL_HEAD_x + '0 -0.5 0' * PL_HEAD_y + '0 0 1' * (targ.maxs_z - PL_HEAD_z); } vector GetHeadshotMaxs(entity targ) { - return '0.6 0 0' * targ.maxs_x + '0 0.6 0' * targ.maxs_y + '0 0 1' * targ.maxs_z; + return '0.5 0 0' * PL_HEAD_x + '0 0.5 0' * PL_HEAD_y + '0 0 1' * targ.maxs_z; } void UpdateFrags(entity player, float f) @@ -278,7 +278,7 @@ void Send_CSQC_Centerprint(entity e, string s1, string s2, float msg, float type void Obituary (entity attacker, entity inflictor, entity targ, float deathtype) { string s, a, msg; - float p, w, type; + float w, type; if (targ.classname == "player" || targ.classname == "corpse") { @@ -342,7 +342,6 @@ void Obituary (entity attacker, entity inflictor, entity targ, float deathtype) } else { - string blood_message, victim_message; if (!checkrules_firstblood) { checkrules_firstblood = TRUE; @@ -364,11 +363,12 @@ void Obituary (entity attacker, entity inflictor, entity targ, float deathtype) // TODO: fix this? if (deathtype == DEATH_CUSTOM) - msg = strcat(deathmessage, " by ^1", msg); - else if (deathtype == DEATH_HURTTRIGGER && inflictor.message2 != "") - { - msg = ftos(strstrofs(inflictor.message2, "#", 0)); - } + msg = deathmessage; + else + msg = inflictor.message2; + + if(strstrofs(msg, "%", 0) < 0) + msg = strcat("%s ", msg, " by %s"); Send_KillNotification(a, s, msg, deathtype, MSG_KILL); @@ -435,6 +435,8 @@ void Obituary (entity attacker, entity inflictor, entity targ, float deathtype) msg = inflictor.message; else if (deathtype == DEATH_CUSTOM) msg = deathmessage; + if(strstrofs(msg, "%", 0) < 0) + msg = strcat("%s ", msg); GiveFrags(targ, targ, -1); if(PlayerScore_Add(targ, SP_SCORE, 0) == -5) { @@ -750,6 +752,8 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float if(deathtype & HITTYPE_HEADSHOT) headshot = 1; } + if(g_ca) + PlayerScore_Add(attacker, SP_SCORE, damage * cvar("g_ca_damage2score_multiplier")); } } else @@ -847,20 +851,6 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float } } -vector NearestPointOnBox(entity box, vector org) -{ - vector m1, m2, nearest; - - m1 = box.mins + box.origin; - m2 = box.maxs + box.origin; - - nearest_x = bound(m1_x, org_x, m2_x); - nearest_y = bound(m1_y, org_y, m2_y); - nearest_z = bound(m1_z, org_z, m2_z); - - return nearest; -} - void Damage_RecordDamage(entity attacker, float deathtype, float damage) { float weaponid; @@ -1003,6 +993,39 @@ float RadiusDamage (entity inflictor, entity attacker, float coredamage, float e finaldmg = finaldmg * a; a = bound(0, tfloorforce + (1-tfloorforce) * hitratio, 1); force = force * a; + + // laser force adjustments :P + if(DEATH_WEAPONOF(deathtype) == WEP_LASER) + { + vector vel; + + float force_zscale; + float force_velocitybiasramp; + float force_velocitybias; + + force_velocitybiasramp = cvar("sv_maxspeed"); + if(deathtype & HITTYPE_SECONDARY) + { + force_zscale = cvar("g_balance_laser_secondary_force_zscale"); + force_velocitybias = cvar("g_balance_laser_secondary_force_velocitybias"); + } + else + { + force_zscale = cvar("g_balance_laser_primary_force_zscale"); + force_velocitybias = cvar("g_balance_laser_primary_force_velocitybias"); + } + + vel = targ.velocity; + vel_z = 0; + vel = normalize(vel) * bound(0, vlen(vel) / force_velocitybiasramp, 1) * force_velocitybias; + force = + vlen(force) + * + normalize(normalize(force) + vel); + + force_z *= force_zscale; + } + //if (targ == attacker) //{ // print("hits ", ftos(hits), " / ", ftos(total)); @@ -1165,9 +1188,7 @@ void Fire_ApplyDamage(entity e) if not(Fire_IsBurning(e)) return; - o = e.owner; - while(o.owner) - o = o.owner; + for(t = 0, o = e.owner; o.owner && t < 16; o = o.owner, ++t); if(clienttype(o) == CLIENTTYPE_NOTACLIENT) o = e.fire_owner;