X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fserver%2Fg_damage.qc;h=7f5ffaf79bd64688327c5e24b1e5cd79dc539642;hp=ab487eac20f142712f702bcd94b2f6bcd1151f45;hb=905ec2fbd2b610eeb2591cdddbf71ce24b7bb3ab;hpb=599624ecf86d1ca148e2292f16a3b1f7d1010800;ds=sidebyside diff --git a/qcsrc/server/g_damage.qc b/qcsrc/server/g_damage.qc index ab487eac20..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) { @@ -58,13 +58,15 @@ void GiveFrags (entity attacker, entity targ, float f, int deathtype) PlayerScore_Add(targ, SP_DEATHS, 1); + .entity weaponentity = weaponentities[0]; // TODO: unhardcode + if(targ != attacker) // not for suicides if(g_weaponarena_random) { // after a frag, exchange the current weapon (or the culprit, if detectable) by a new random weapon Weapon culprit = DEATH_WEAPONOF(deathtype); - if(!culprit) culprit = PS(attacker).m_weapon; - else if(!(attacker.weapons & (culprit.m_wepset))) culprit = PS(attacker).m_weapon; + if(!culprit) culprit = attacker.(weaponentity).m_weapon; + else if(!(attacker.weapons & (culprit.m_wepset))) culprit = attacker.(weaponentity).m_weapon; if(g_weaponarena_random_with_blaster && culprit == WEP_BLASTER) // WEAPONTODO: Shouldn't this be in a mutator? { @@ -97,8 +99,8 @@ void GiveFrags (entity attacker, entity targ, float f, int deathtype) } // after a frag, choose another random weapon set - if (!(attacker.weapons & WepSet_FromWeapon(PS(attacker).m_weapon))) - W_SwitchWeapon_Force(attacker, w_getbestweapon(attacker)); + if (!(attacker.weapons & WepSet_FromWeapon(attacker.(weaponentity).m_weapon))) + W_SwitchWeapon_Force(attacker, w_getbestweapon(attacker, weaponentity), weaponentity); } // FIXME fix the mess this is (we have REAL points now!) @@ -115,12 +117,15 @@ void GiveFrags (entity attacker, entity targ, float f, int deathtype) string AppendItemcodes(string s, entity player) { - int w = PS(player).m_weapon.m_id; - //if(w == 0) - // w = player.switchweapon; - if(w == 0) - w = player.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) @@ -558,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) @@ -587,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) @@ -604,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; @@ -612,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)) { @@ -715,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) { @@ -1006,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);