X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fserver%2Fg_damage.qc;h=4cae47770ddfdc312e9ff249107dca8ae314ce2a;hp=5b310818c1319a0e57de122a528ff86ac563c804;hb=2c0e35d3ee9fe6652c9c56f29dbbf546da0043b0;hpb=1f988ad58a9fb5cef7ed843ad839b23dd23f6dc9 diff --git a/qcsrc/server/g_damage.qc b/qcsrc/server/g_damage.qc index 5b310818c1..4cae47770d 100644 --- a/qcsrc/server/g_damage.qc +++ b/qcsrc/server/g_damage.qc @@ -56,22 +56,6 @@ float damage_gooddamage; .float istypefrag; .float taunt_soundtime; - -float IsDifferentTeam(entity a, entity b) -{ - if(teamplay) - { - if(a.team == b.team) - return 0; - } - else - { - if(a == b) - return 0; - } - return 1; -} - float IsFlying(entity a) { if(a.flags & FL_ONGROUND) @@ -143,7 +127,7 @@ void GiveFrags (entity attacker, entity targ, float f, float deathtype) GiveFrags_randomweapons.classname = "GiveFrags_randomweapons"; } - if(inWarmupStage) + if(warmup_stage) GiveFrags_randomweapons.weapons = warmup_start_weapons; else GiveFrags_randomweapons.weapons = start_weapons; @@ -247,7 +231,7 @@ void Obituary_SpecialDeath( { if(deathent.death_msgmurder) { - Send_Notification_WOVA( + Send_Notification_WOCOVA( NOTIF_ONE, notif_target, MSG_MULTI, @@ -255,7 +239,7 @@ void Obituary_SpecialDeath( s1, s2, s3, "", f1, f2, f3, 0 ); - Send_Notification_WOVA( + Send_Notification_WOCOVA( NOTIF_ALL_EXCEPT, notif_target, MSG_INFO, @@ -269,7 +253,7 @@ void Obituary_SpecialDeath( { if(deathent.death_msgself) { - Send_Notification_WOVA( + Send_Notification_WOCOVA( NOTIF_ONE, notif_target, MSG_MULTI, @@ -277,7 +261,7 @@ void Obituary_SpecialDeath( s1, s2, s3, "", f1, f2, f3, 0 ); - Send_Notification_WOVA( + Send_Notification_WOCOVA( NOTIF_ALL_EXCEPT, notif_target, MSG_INFO, @@ -308,7 +292,7 @@ float Obituary_WeaponDeath( if(death_message) { - Send_Notification_WOVA( + Send_Notification_WOCOVA( NOTIF_ONE, notif_target, MSG_MULTI, @@ -316,7 +300,7 @@ float Obituary_WeaponDeath( s1, s2, s3, "", f1, f2, 0, 0 ); - Send_Notification_WOVA( + Send_Notification_WOCOVA( NOTIF_ALL_EXCEPT, notif_target, MSG_INFO, @@ -409,7 +393,7 @@ void Obituary(entity attacker, entity inflictor, entity targ, float deathtype) // ====== else if(IS_PLAYER(attacker)) { - if(!IsDifferentTeam(attacker, targ)) + if(SAME_TEAM(attacker, targ)) { LogDeath("tk", deathtype, attacker, targ); GiveFrags(attacker, targ, -1, deathtype); @@ -462,30 +446,51 @@ void Obituary(entity attacker, entity inflictor, entity targ, float deathtype) kill_count_to_target = 0; } - float verbose_allowed = (autocvar_notification_server_allows_frag_verbose && ((autocvar_notification_server_allows_frag_verbose == 2) || inWarmupStage)); if(targ.istypefrag) { - if(attacker.FRAG_VERBOSE && verbose_allowed) - Send_Notification(NOTIF_ONE, attacker, MSG_CENTER, CENTER_DEATH_MURDER_TYPEFRAG_VERBOSE, targ.netname, kill_count_to_attacker, (IS_BOT_CLIENT(targ) ? NO_MSG : targ.ping)); - else - Send_Notification(NOTIF_ONE, attacker, MSG_CENTER, CENTER_DEATH_MURDER_TYPEFRAG, targ.netname, kill_count_to_attacker); - - if(targ.FRAG_VERBOSE && verbose_allowed) - Send_Notification(NOTIF_ONE, targ, MSG_CENTER, CENTER_DEATH_MURDER_TYPEFRAGGED_VERBOSE, attacker.netname, kill_count_to_target, attacker.health, attacker.armorvalue, (IS_BOT_CLIENT(attacker) ? NO_MSG : attacker.ping)); - else - Send_Notification(NOTIF_ONE, targ, MSG_CENTER, CENTER_DEATH_MURDER_TYPEFRAGGED, attacker.netname, kill_count_to_target); + Send_Notification( + NOTIF_ONE, + attacker, + MSG_CHOICE, + CHOICE_TYPEFRAG, + targ.netname, + kill_count_to_attacker, + (IS_BOT_CLIENT(targ) ? NO_MSG : targ.ping) + ); + Send_Notification( + NOTIF_ONE, + targ, + MSG_CHOICE, + CHOICE_TYPEFRAGGED, + attacker.netname, + kill_count_to_target, + attacker.health, + attacker.armorvalue, + (IS_BOT_CLIENT(attacker) ? NO_MSG : attacker.ping) + ); } else { - if(attacker.FRAG_VERBOSE && verbose_allowed) - Send_Notification(NOTIF_ONE, attacker, MSG_CENTER, CENTER_DEATH_MURDER_FRAG_VERBOSE, targ.netname, kill_count_to_attacker, (IS_BOT_CLIENT(targ) ? NO_MSG : targ.ping)); - else - Send_Notification(NOTIF_ONE, attacker, MSG_CENTER, CENTER_DEATH_MURDER_FRAG, targ.netname, kill_count_to_attacker); - - if(targ.FRAG_VERBOSE && verbose_allowed) - Send_Notification(NOTIF_ONE, targ, MSG_CENTER, CENTER_DEATH_MURDER_FRAGGED_VERBOSE, attacker.netname, kill_count_to_target, attacker.health, attacker.armorvalue, (IS_BOT_CLIENT(attacker) ? NO_MSG : attacker.ping)); - else - Send_Notification(NOTIF_ONE, targ, MSG_CENTER, CENTER_DEATH_MURDER_FRAGGED, attacker.netname, kill_count_to_target); + Send_Notification( + NOTIF_ONE, + attacker, + MSG_CHOICE, + CHOICE_FRAG, + targ.netname, + kill_count_to_attacker, + (IS_BOT_CLIENT(targ) ? NO_MSG : targ.ping) + ); + Send_Notification( + NOTIF_ONE, + targ, + MSG_CHOICE, + CHOICE_FRAGGED, + attacker.netname, + kill_count_to_target, + attacker.health, + attacker.armorvalue, + (IS_BOT_CLIENT(attacker) ? NO_MSG : attacker.ping) + ); } if not(Obituary_WeaponDeath(targ, TRUE, deathtype, targ.netname, attacker.netname, deathlocation, targ.killcount, kill_count_to_attacker)) @@ -650,7 +655,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float if(DEATH_ISWEAPON(deathtype, WEP_HOOK) || DEATH_ISWEAPON(deathtype, WEP_TUBA)) { if(IS_PLAYER(targ)) - if not(IsDifferentTeam(targ, attacker)) + if(SAME_TEAM(targ, attacker)) { self = oldself; return; @@ -659,6 +664,10 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float if(deathtype == DEATH_KILL || deathtype == DEATH_TEAMCHANGE || deathtype == DEATH_AUTOTEAMCHANGE) { + // exit the vehicle before killing (fixes a crash) + if(IS_PLAYER(targ) && targ.vehicle) + vehicles_exit(VHEF_RELESE); + // These are ALWAYS lethal // No damage modification here // Instead, prepare the victim for his death... @@ -683,7 +692,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float damage = 0; force = '0 0 0'; } - else if(!IsDifferentTeam(attacker, targ)) + else if(SAME_TEAM(attacker, targ)) { if(autocvar_teamplay_mode == 1) damage = 0; @@ -802,7 +811,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float if(IS_PLAYER(victim) || victim.turrcaps_flags & TFL_TURRCAPS_ISTURRET || victim.flags & FL_MONSTER) { - if(IsDifferentTeam(victim, attacker)) + if(DIFF_TEAM(victim, attacker)) { if(damage > 0) {