X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fserver%2Fplayer.qc;h=50708f33eb9b1aa53b0c7ceb7640198990a5df11;hp=25ad24686d77d063bffe3ba38146384172f4306e;hb=468b023e4b41cbd40bae363aa136b102a63fc811;hpb=a3d9634886e52c442bd9d68a86b8df77e6ed26ed diff --git a/qcsrc/server/player.qc b/qcsrc/server/player.qc index 25ad24686..50708f33e 100644 --- a/qcsrc/server/player.qc +++ b/qcsrc/server/player.qc @@ -24,6 +24,7 @@ #include "../common/effects/qc/all.qh" #include "../common/mutators/mutator/waypoints/waypointsprites.qh" #include "../common/triggers/include.qh" +#include "../common/wepent.qh" #include "weapons/weaponstats.qh" @@ -62,6 +63,8 @@ void CopyBody(entity this, float keepvelocity) clone.iscreature = this.iscreature; clone.teleportable = this.teleportable; clone.damagedbycontents = this.damagedbycontents; + if(clone.damagedbycontents) + IL_PUSH(g_damagedbycontents, clone); clone.angles = this.angles; clone.v_angle = this.v_angle; clone.avelocity = this.avelocity; @@ -212,6 +215,8 @@ void PlayerCorpseDamage(entity this, entity inflictor, entity attacker, float da this.alpha = -1; this.solid = SOLID_NOT; // restore later this.takedamage = DAMAGE_NO; // restore later + if(this.damagedbycontents) + IL_REMOVE(g_damagedbycontents, this); this.damagedbycontents = false; } } @@ -319,6 +324,9 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage, damage /= sqrt(bound(1.0, attacker.cvar_cl_handicap, 100.0)); } + if (time < this.spawnshieldtime && autocvar_g_spawnshield_blockdamage < 1) + damage *= 1 - max(0, autocvar_g_spawnshield_blockdamage); + if(DEATH_ISWEAPON(deathtype, WEP_TUBA)) { // tuba causes blood to come out of the ears @@ -353,7 +361,6 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage, else Violence_GibSplash_At(hitloc, force, 2, bound(0, damage, 200) / 16, this, attacker); - v = healtharmor_applydamage(this.armorvalue, autocvar_g_balance_armor_blockpercent, deathtype, damage); take = v.x; save = v.y; @@ -382,13 +389,6 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage, this.istypefrag = 0; } - if (time < this.spawnshieldtime && autocvar_g_spawnshield_blockdamage < 1) - { - vector v = healtharmor_applydamage(this.armorvalue, max(0, autocvar_g_spawnshield_blockdamage), deathtype, damage); - take = v.x; - save = v.y; - } - MUTATOR_CALLHOOK(PlayerDamage_SplitHealthArmor, inflictor, attacker, this, force, take, save, deathtype, damage); take = bound(0, M_ARGV(4, float), this.health); save = bound(0, M_ARGV(5, float), this.armorvalue); @@ -506,9 +506,9 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage, { WeaponStats_LogDamage(awep.m_id, abot, this.(weaponentity).m_weapon.m_id, vbot, dh + da); } - if (dh + da) + if (damage) { - MUTATOR_CALLHOOK(PlayerDamaged, attacker, this, dh, da, hitloc, deathtype); + MUTATOR_CALLHOOK(PlayerDamaged, attacker, this, dh, da, hitloc, deathtype, damage); } if (this.health < 1) @@ -565,8 +565,8 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage, Weapon wep = this.(weaponentity).m_weapon; for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) { - .entity wepent = weaponentities[slot]; - wep.wr_playerdeath(wep, this, wepent); + .entity went = weaponentities[slot]; + wep.wr_playerdeath(wep, this, went); } RemoveGrapplingHooks(this); @@ -593,8 +593,8 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage, // throw a weapon for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) { - .entity wepent = weaponentities[slot]; - SpawnThrownWeapon(this, this.origin + (this.mins + this.maxs) * 0.5, this.(wepent).m_switchweapon.m_id, wepent); + .entity went = weaponentities[slot]; + SpawnThrownWeapon(this, this.origin + (this.mins + this.maxs) * 0.5, this.(went).m_switchweapon.m_id, went); } // become fully visible @@ -703,7 +703,7 @@ int Say(entity source, int teamsay, entity privatesay, string msgin, bool floodc teamsay = false; } - if(intermission_running) + if(gameover) teamsay = false; if (!source) { @@ -880,9 +880,9 @@ int Say(entity source, int teamsay, entity privatesay, string msgin, bool floodc if (!privatesay && source && !IS_PLAYER(source)) { - if (!intermission_running) - if(teamsay || (autocvar_g_chat_nospectators == 1) || (autocvar_g_chat_nospectators == 2 && !(warmup_stage || gameover))) - teamsay = -1; // spectators + if (!gameover) + if (teamsay || (autocvar_g_chat_nospectators == 1) || (autocvar_g_chat_nospectators == 2 && !warmup_stage)) + teamsay = -1; // spectators } if(flood) @@ -913,6 +913,9 @@ int Say(entity source, int teamsay, entity privatesay, string msgin, bool floodc ret = 1; } + MUTATOR_CALLHOOK(ChatMessage, source, ret); + ret = M_ARGV(1, int); + if(sourcemsgstr != "" && ret != 0) { if(ret < 0) // faked message, because the player is muted @@ -924,16 +927,19 @@ int Say(entity source, int teamsay, entity privatesay, string msgin, bool floodc else if(privatesay) // private message, between 2 people only { sprint(source, sourcemsgstr); - sprint(privatesay, msgstr); if (!autocvar_g_chat_tellprivacy) { dedicated_print(msgstr); } // send to server console too if "tellprivacy" is disabled - if(cmsgstr != "") - centerprint(privatesay, cmsgstr); + if(!MUTATOR_CALLHOOK(ChatMessageTo, privatesay, source)) + { + sprint(privatesay, msgstr); + if(cmsgstr != "") + centerprint(privatesay, cmsgstr); + } } else if ( teamsay && source.active_minigame ) { sprint(source, sourcemsgstr); dedicated_print(msgstr); // send to server console too - FOREACH_CLIENT(IS_REAL_CLIENT(it) && it != source && it.active_minigame == source.active_minigame, sprint(it, msgstr)); + FOREACH_CLIENT(IS_REAL_CLIENT(it) && it != source && it.active_minigame == source.active_minigame && !MUTATOR_CALLHOOK(ChatMessageTo, it, source), sprint(it, msgstr)); } else if(teamsay > 0) // team message, only sent to team mates { @@ -941,7 +947,7 @@ int Say(entity source, int teamsay, entity privatesay, string msgin, bool floodc dedicated_print(msgstr); // send to server console too if(sourcecmsgstr != "") centerprint(source, sourcecmsgstr); - FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it) && it != source && it.team == source.team, { + FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it) && it != source && it.team == source.team && !MUTATOR_CALLHOOK(ChatMessageTo, it, source), { sprint(it, msgstr); if(cmsgstr != "") centerprint(it, cmsgstr); @@ -951,7 +957,7 @@ int Say(entity source, int teamsay, entity privatesay, string msgin, bool floodc { sprint(source, sourcemsgstr); dedicated_print(msgstr); // send to server console too - FOREACH_CLIENT(!IS_PLAYER(it) && IS_REAL_CLIENT(it) && it != source, sprint(it, msgstr)); + FOREACH_CLIENT(!IS_PLAYER(it) && IS_REAL_CLIENT(it) && it != source && !MUTATOR_CALLHOOK(ChatMessageTo, it, source), sprint(it, msgstr)); } else { @@ -960,7 +966,7 @@ int Say(entity source, int teamsay, entity privatesay, string msgin, bool floodc dedicated_print(msgstr); // send to server console too MX_Say(strcat(playername(source), "^7: ", msgin)); } - FOREACH_CLIENT(IS_REAL_CLIENT(it) && it != source, sprint(it, msgstr)); + FOREACH_CLIENT(IS_REAL_CLIENT(it) && it != source && !MUTATOR_CALLHOOK(ChatMessageTo, it, source), sprint(it, msgstr)); } }