]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Clean up the need to check for "body".
authorRudolf Polzer <divVerent@gmail.com>
Tue, 13 Jun 2023 14:38:33 +0000 (10:38 -0400)
committerRudolf Polzer <divVerent@gmail.com>
Tue, 13 Jun 2023 14:38:33 +0000 (10:38 -0400)
Also, clean up mutators that replace respawn logic so they conflict with this mutator.

qcsrc/common/gamemodes/gamemode/clanarena/sv_clanarena.qc
qcsrc/common/gamemodes/gamemode/lms/sv_lms.qc
qcsrc/common/gamemodes/gamemode/survival/sv_survival.qc
qcsrc/common/mutators/mutator/killers_spawn_faster/sv_respawntime.qc

index f0a793afd50f4d39aa2d28fe1e3bfc313e438e43..177818330d466186a911860e852800cd99f778bd 100644 (file)
@@ -495,7 +495,7 @@ MUTATOR_HOOKFUNCTION(ca, PlayerDamage_SplitHealthArmor)
                GameRules_scoring_add_float2int(scorer, SCORE, scorer_damage, ca_damage_counter, autocvar_g_ca_damage2score);
 }
 
-MUTATOR_HOOKFUNCTION(ca, CalculateRespawnTime)
+MUTATOR_HOOKFUNCTION(ca, CalculateRespawnTime, CBC_ORDER_EXCLUSIVE)
 {
        // no respawn calculations needed, player is forced to spectate anyway
        return true;
index 348262e76c231cd7d60d1ebe68bc3b8edd8e68ed..226f495544524ecb06f36f2c3731ffae295b9051 100644 (file)
@@ -562,7 +562,7 @@ MUTATOR_HOOKFUNCTION(lms, PlayerDied)
                lms_UpdateLeaders();
 }
 
-MUTATOR_HOOKFUNCTION(lms, CalculateRespawnTime)
+MUTATOR_HOOKFUNCTION(lms, CalculateRespawnTime, CBC_ORDER_EXCLUSIVE)
 {
        entity player = M_ARGV(0, entity);
        player.respawn_flags |= RESPAWN_FORCE;
index cfdc948c04748576a07bc9a345cf5ffd12145882..006049dd469a5e65dee66c67c89eaa306c934287 100644 (file)
@@ -431,7 +431,7 @@ MUTATOR_HOOKFUNCTION(surv, AddPlayerScore)
                M_ARGV(1, float) = 0; // don't report that the player has killed or been killed, that would out them as a hunter!
 }
 
-MUTATOR_HOOKFUNCTION(surv, CalculateRespawnTime)
+MUTATOR_HOOKFUNCTION(surv, CalculateRespawnTime, CBC_ORDER_EXCLUSIVE)
 {
        // no respawn calculations needed, player is forced to spectate anyway
        return true;
index 10ec7e428f62d76529399919fa664a189e934493..00cc7edcd35b97a9d141fa1f92b37d1a298b4766 100644 (file)
@@ -28,12 +28,13 @@ MUTATOR_HOOKFUNCTION(mutator_killers_spawn_faster, ClientConnect) {
        LOG_DEBUGF("Newly spawned player %i with respawntime factor %f", player, player.killers_spawn_faster_factor);
 }
 
-MUTATOR_HOOKFUNCTION(mutator_killers_spawn_faster, PlayerDies) {
+MUTATOR_HOOKFUNCTION(mutator_killers_spawn_faster, GiveFragsForKill, CBC_ORDER_FIRST) {
        // Note: this runs BEFORE CalculateRespawnTime.
-       entity attacker = M_ARGV(1, entity);
-       entity target = M_ARGV(2, entity);
-       if (target.classname == "body") {
-               error("WAT");
+       entity attacker = M_ARGV(0, entity);
+       float frags = M_ARGV(2, float);
+       if (frags < 0) {
+               // Suicide, teamkill or similar.
+               // As the frags amount is an inout parameter, this must be CBC_ORDER_FIRST.
                return false;
        }
        attacker.killers_spawn_faster_factor = killers_spawn_faster_adjust(
@@ -53,10 +54,6 @@ MUTATOR_HOOKFUNCTION(mutator_killers_spawn_faster, CalculateRespawnTime) {
 MUTATOR_HOOKFUNCTION(mutator_killers_spawn_faster, PlayerDied) {
        // Note: this runs AFTER CalculateRespawnTime.
        entity player = M_ARGV(0, entity);
-       if (player.classname == "body") {
-               error("WAT");
-               return false;
-       }
        player.killers_spawn_faster_factor = killers_spawn_faster_adjust(
                player.killers_spawn_faster_factor,
                autocvar_g_killers_spawn_faster_death_modifier);