X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fserver%2Fg_damage.qc;h=7f5ffaf79bd64688327c5e24b1e5cd79dc539642;hp=6851f7cdfe3bb78af48a2a31dfe467aee8729528;hb=905ec2fbd2b610eeb2591cdddbf71ce24b7bb3ab;hpb=4472d52c145d0315144d833a7ce408bb1de52fa0;ds=sidebyside diff --git a/qcsrc/server/g_damage.qc b/qcsrc/server/g_damage.qc index 6851f7cdfe..7f5ffaf79b 100644 --- a/qcsrc/server/g_damage.qc +++ b/qcsrc/server/g_damage.qc @@ -33,7 +33,7 @@ void UpdateFrags(entity player, int f) void GiveFrags (entity attacker, entity targ, float f, int deathtype) { // TODO route through PlayerScores instead - if(gameover) return; + if(game_stopped) return; if(f < 0) { @@ -100,7 +100,7 @@ void GiveFrags (entity attacker, entity targ, float f, int deathtype) // after a frag, choose another random weapon set if (!(attacker.weapons & WepSet_FromWeapon(attacker.(weaponentity).m_weapon))) - W_SwitchWeapon_Force(attacker, w_getbestweapon(attacker), weaponentity); + W_SwitchWeapon_Force(attacker, w_getbestweapon(attacker, weaponentity), weaponentity); } // FIXME fix the mess this is (we have REAL points now!) @@ -117,14 +117,15 @@ void GiveFrags (entity attacker, entity targ, float f, int deathtype) string AppendItemcodes(string s, entity player) { - .entity weaponentity = weaponentities[0]; // TODO: unhardcode - - int w = player.(weaponentity).m_weapon.m_id; - //if(w == 0) - // w = player.switchweapon; - if(w == 0) - w = player.(weaponentity).cnt; // previous weapon! - s = strcat(s, ftos(w)); + for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + { + .entity weaponentity = weaponentities[slot]; + int w = player.(weaponentity).m_weapon.m_id; + if(w == 0) + w = player.(weaponentity).cnt; // previous weapon + if(w != 0 || slot == 0) + s = strcat(s, ftos(w)); + } if(time < player.strength_finished) s = strcat(s, "S"); if(time < player.invincible_finished) @@ -293,7 +294,6 @@ void Obituary(entity attacker, entity inflictor, entity targ, int deathtype) // Set final information for the death targ.death_origin = targ.origin; - if(targ != attacker) { targ.killer_origin = attacker.origin; } string deathlocation = (autocvar_notification_server_allows_location ? NearestLocation(targ.death_origin) : ""); #ifdef NOTIFICATIONS_DEBUG @@ -375,6 +375,8 @@ void Obituary(entity attacker, entity inflictor, entity targ, int deathtype) attacker.taunt_soundtime = time + 1; attacker.killcount = attacker.killcount + 1; + attacker.killsound += 1; + #define SPREE_ITEM(counta,countb,center,normal,gentle) \ case counta: \ { \ @@ -561,9 +563,17 @@ void Freeze (entity targ, float freeze_time, float frozen_type, float show_waypo Ice_Think(ice); - RemoveGrapplingHook(targ); + RemoveGrapplingHooks(targ); - FOREACH_CLIENT(IS_PLAYER(it) && it.hook.aiment == targ, LAMBDA(RemoveGrapplingHook(it))); + 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); + } + }); // add waypoint if(show_waypoint) @@ -590,7 +600,15 @@ void Unfreeze (entity targ) WaypointSprite_Kill(targ.waypointsprite_attached); - FOREACH_CLIENT(IS_PLAYER(it) && it.hook.aiment == targ, LAMBDA(RemoveGrapplingHook(it))); + 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); + } + }); // remove the ice block if(targ.iceblock) @@ -607,7 +625,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, int d mirrordamage = 0; mirrorforce = 0; - if (gameover || targ.killcount == FRAGS_SPECTATOR) + if (game_stopped || targ.killcount == FRAGS_SPECTATOR) return; damage_targ = targ; @@ -615,12 +633,6 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, int d damage_attacker = attacker; attacker_save = attacker; - if(IS_PLAYER(targ)) - if(targ.hook) - if(targ.hook.aiment) - if(targ.hook.aiment == attacker) - RemoveGrapplingHook(targ); // STOP THAT, you parasite! - // special rule: gravity bomb does not hit team mates (other than for disconnecting the hook) if(DEATH_ISWEAPON(deathtype, WEP_HOOK) || DEATH_ISWEAPON(deathtype, WEP_TUBA)) { @@ -718,11 +730,21 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, int d } // should this be changed at all? If so, in what way? - MUTATOR_CALLHOOK(PlayerDamage_Calculate, inflictor, attacker, targ, deathtype, damage, mirrordamage, force); + MUTATOR_CALLHOOK(Damage_Calculate, inflictor, attacker, targ, deathtype, damage, mirrordamage, force); damage = M_ARGV(4, float); mirrordamage = M_ARGV(5, float); force = M_ARGV(6, vector); + if(IS_PLAYER(targ) && damage > 0 && attacker) + { + for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + { + .entity weaponentity = weaponentities[slot]; + if(targ.(weaponentity).hook && targ.(weaponentity).hook.aiment == attacker) + RemoveHook(targ.(weaponentity).hook); + } + } + if(STAT(FROZEN, targ)) if(deathtype != DEATH_HURTTRIGGER.m_id && deathtype != DEATH_TEAMCHANGE.m_id && deathtype != DEATH_AUTOTEAMCHANGE.m_id) { @@ -1009,7 +1031,7 @@ float RadiusDamageForSource (entity inflictor, vector inflictororigin, vector in LOG_INFOF("THROUGHFLOOR: D=%f F=%f max(dD)=1/%f max(dF)=1/%f", finaldmg, vlen(force), mininv_d, mininv_f); - total = 0.25 * pow(max(mininv_f, mininv_d), 2); + total = 0.25 * (max(mininv_f, mininv_d) ** 2); if(autocvar_g_throughfloor_debug) LOG_INFOF(" steps=%f", total);