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=904447c218418c936f5f933cce7cf13062813c61;hb=468b023e4b41cbd40bae363aa136b102a63fc811;hpb=530e29e1a8395e12b8b8b44ac1030a84546eb903 diff --git a/qcsrc/server/player.qc b/qcsrc/server/player.qc index 904447c21..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" @@ -323,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 @@ -357,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; @@ -386,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); @@ -490,6 +486,7 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage, valid_damage_for_weaponstats = 0; Weapon awep = WEP_Null; + .entity weaponentity = weaponentities[0]; // TODO: unhardcode if(vbot || IS_REAL_CLIENT(this)) if(abot || IS_REAL_CLIENT(attacker)) @@ -497,7 +494,7 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage, if(DIFF_TEAM(this, attacker)) { if(DEATH_ISSPECIAL(deathtype)) - awep = PS(attacker).m_weapon; + awep = attacker.(weaponentity).m_weapon; else awep = DEATH_WEAPONOF(deathtype); valid_damage_for_weaponstats = 1; @@ -507,7 +504,7 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage, da = da - max(this.armorvalue, 0); if(valid_damage_for_weaponstats) { - WeaponStats_LogDamage(awep.m_id, abot, PS(this).m_weapon.m_id, vbot, dh + da); + WeaponStats_LogDamage(awep.m_id, abot, this.(weaponentity).m_weapon.m_id, vbot, dh + da); } if (damage) { @@ -526,7 +523,7 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage, } if(valid_damage_for_weaponstats) - WeaponStats_LogKill(awep.m_id, abot, PS(this).m_weapon.m_id, vbot); + WeaponStats_LogKill(awep.m_id, abot, this.(weaponentity).m_weapon.m_id, vbot); if(autocvar_sv_gentle < 1) if(sound_allowed(MSG_BROADCAST, attacker)) @@ -565,16 +562,14 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage, MUTATOR_CALLHOOK(PlayerDies, inflictor, attacker, this, deathtype, damage); excess = M_ARGV(4, float); - Weapon wep = PS(this).m_weapon; - /*for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + Weapon wep = this.(weaponentity).m_weapon; + for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) { - .entity weaponentity = weaponentities[slot]; - wep.wr_playerdeath(wep, this, weaponentity); - }*/ - .entity weaponentity = weaponentities[0]; // TODO: unhardcode - wep.wr_playerdeath(wep, this, weaponentity); + .entity went = weaponentities[slot]; + wep.wr_playerdeath(wep, this, went); + } - RemoveGrapplingHook(this); + RemoveGrapplingHooks(this); Portal_ClearAllLater(this); @@ -596,7 +591,11 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage, // clear waypoints WaypointSprite_PlayerDead(this); // throw a weapon - SpawnThrownWeapon(this, this.origin + (this.mins + this.maxs) * 0.5, PS(this).m_switchweapon.m_id); + for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + { + .entity went = weaponentities[slot]; + SpawnThrownWeapon(this, this.origin + (this.mins + this.maxs) * 0.5, this.(went).m_switchweapon.m_id, went); + } // become fully visible this.alpha = default_player_alpha; @@ -704,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) { @@ -881,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) @@ -914,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 @@ -925,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 { @@ -942,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); @@ -952,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 { @@ -961,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)); } }