X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fdamage.qc;h=44bce18a823533eeaf494f6b0dc654d5903bec68;hb=d11599b4c85bbd41163ebd3308642f9c491b4a3c;hp=3cbc07c57d3dddb989bd6b954ad58df86e6186f0;hpb=2131fc86c8a55826aa6a424f3ffe6b2d09f28b7a;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/damage.qc b/qcsrc/server/damage.qc index 3cbc07c57..44bce18a8 100644 --- a/qcsrc/server/damage.qc +++ b/qcsrc/server/damage.qc @@ -245,8 +245,10 @@ void Obituary(entity attacker, entity inflictor, entity targ, int deathtype, .en if (MUTATOR_CALLHOOK(ClientObituary, inflictor, attacker, targ, deathtype, attacker.(weaponentity))) { CS(targ).killcount = 0; return; } notif_anonymous = M_ARGV(5, bool); + // TODO: Replace "???" with a translatable "Anonymous player" string + // https://gitlab.com/xonotic/xonotic-data.pk3dir/-/issues/2839 if(notif_anonymous) - attacker_name = "Anonymous player"; + attacker_name = "???"; #ifdef NOTIFICATIONS_DEBUG Debug_Notification( @@ -531,11 +533,11 @@ void Freeze(entity targ, float revivespeed, int frozen_type, bool show_waypoint) FOREACH_CLIENT(IS_PLAYER(it), { for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) - { - .entity weaponentity = weaponentities[slot]; - if(it.(weaponentity).hook.aiment == targ) - RemoveHook(it.(weaponentity).hook); - } + { + .entity weaponentity = weaponentities[slot]; + if(it.(weaponentity).hook.aiment == targ) + RemoveHook(it.(weaponentity).hook); + } }); // add waypoint @@ -565,11 +567,11 @@ void Unfreeze(entity targ, bool reset_health) FOREACH_CLIENT(IS_PLAYER(it), { for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) - { - .entity weaponentity = weaponentities[slot]; - if(it.(weaponentity).hook.aiment == targ) - RemoveHook(it.(weaponentity).hook); - } + { + .entity weaponentity = weaponentities[slot]; + if(it.(weaponentity).hook.aiment == targ) + RemoveHook(it.(weaponentity).hook); + } }); // remove the ice block @@ -608,7 +610,7 @@ void Damage(entity targ, entity inflictor, entity attacker, float damage, int de // These are ALWAYS lethal // No damage modification here - // Instead, prepare the victim for his death... + // Instead, prepare the victim for their death... if(deathtype == DEATH_TEAMCHANGE.m_id || deathtype == DEATH_AUTOTEAMCHANGE.m_id) { SetResourceExplicit(targ, RES_ARMOR, 0); @@ -710,11 +712,11 @@ void Damage(entity targ, entity inflictor, entity attacker, float damage, int de if(IS_PLAYER(targ) && damage > 0 && attacker) { for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) - { - .entity went = weaponentities[slot]; - if(targ.(went).hook && targ.(went).hook.aiment == attacker) - RemoveHook(targ.(went).hook); - } + { + .entity went = weaponentities[slot]; + if(targ.(went).hook && targ.(went).hook.aiment == attacker) + RemoveHook(targ.(went).hook); + } } if(STAT(FROZEN, targ) && !ITEM_DAMAGE_NEEDKILL(deathtype) @@ -931,11 +933,9 @@ float RadiusDamageForSource (entity inflictor, vector inflictororigin, vector in float dist = max(0, vlen(diff) - bound(MIN_DAMAGEEXTRARADIUS, targ.damageextraradius, MAX_DAMAGEEXTRARADIUS)); if (dist <= rad) { - float power = 1; - if (rad > 0) - power -= (dist / rad); - // at this point power can't be < 0 or > 1 - float finaldmg = coredamage * power + edgedamage * (1 - power); + float f = (rad > 0) ? 1 - (dist / rad) : 1; + // at this point f can't be < 0 or > 1 + float finaldmg = coredamage * f + edgedamage * (1 - f); if (finaldmg > 0) { float a; @@ -950,7 +950,7 @@ float RadiusDamageForSource (entity inflictor, vector inflictororigin, vector in center = CENTER_OR_VIEWOFS(targ); force = normalize(center - myblastorigin); - force = force * (finaldmg / coredamage) * forceintensity; + force = force * (finaldmg / max(coredamage, edgedamage)) * forceintensity; hitloc = nearest; // apply special scaling along the z axis if set @@ -1020,14 +1020,15 @@ float RadiusDamageForSource (entity inflictor, vector inflictororigin, vector in if(autocvar_g_throughfloor_debug) LOG_INFOF(" D=%f F=%f", finaldmg, vlen(force)); + + /*if (targ == attacker) + { + print("hits ", ftos(hits), " / ", ftos(total)); + print(" finaldmg ", ftos(finaldmg), " force ", ftos(vlen(force))); + print(" (", vtos(force), ") (", ftos(a), ")\n"); + }*/ } - //if (targ == attacker) - //{ - // print("hits ", ftos(hits), " / ", ftos(total)); - // print(" finaldmg ", ftos(finaldmg), " force ", vtos(force)); - // print(" (", ftos(a), ")\n"); - //} if(finaldmg || force) { if(targ.iscreature) @@ -1052,14 +1053,14 @@ float RadiusDamageForSource (entity inflictor, vector inflictororigin, vector in RadiusDamage_running = 0; if(!DEATH_ISSPECIAL(deathtype)) - accuracy_add(attacker, DEATH_WEAPONOF(deathtype), 0, min(coredamage, stat_damagedone)); + accuracy_add(attacker, DEATH_WEAPONOF(deathtype), 0, min(max(coredamage, edgedamage), stat_damagedone)); return total_damage_to_creatures; } float RadiusDamage(entity inflictor, entity attacker, float coredamage, float edgedamage, float rad, entity cantbe, entity mustbe, float forceintensity, int deathtype, .entity weaponentity, entity directhitentity) { - return RadiusDamageForSource(inflictor, (inflictor.origin + (inflictor.mins + inflictor.maxs) * 0.5), inflictor.velocity, attacker, coredamage, edgedamage, rad, + return RadiusDamageForSource(inflictor, (inflictor.origin + (inflictor.mins + inflictor.maxs) * 0.5), inflictor.velocity, attacker, coredamage, edgedamage, rad, cantbe, mustbe, false, forceintensity, 1, deathtype, weaponentity, directhitentity); }