]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add a mutator hook to skip respawn time calculations (fixes a reference to CA)
authorMario <mario@smbclan.net>
Mon, 26 Feb 2018 12:35:38 +0000 (22:35 +1000)
committerMario <mario@smbclan.net>
Mon, 26 Feb 2018 12:35:38 +0000 (22:35 +1000)
qcsrc/server/mutators/events.qh
qcsrc/server/mutators/mutator/gamemode_ca.qc
qcsrc/server/player.qc

index fb452c3399b9bb4ab39721abb574ec32944ccff4..6853c04a15641dc69bd6e52f7da39615a41610a4 100644 (file)
@@ -1065,3 +1065,9 @@ MUTATOR_HOOKABLE(PlayerPhysics_UpdateStats, EV_PlayerPhysics_UpdateStats);
     /** bot */ i(entity, MUTATOR_ARGV_0_entity) \
     /**/
 MUTATOR_HOOKABLE(HavocBot_Aim, EV_HavocBot_Aim);
+
+/** return true to skip respawn time calculations */
+#define EV_CalculateRespawnTime(i, o) \
+    /** player */ i(entity, MUTATOR_ARGV_0_entity) \
+    /**/
+MUTATOR_HOOKABLE(CalculateRespawnTime, EV_CalculateRespawnTime);
index 67b999e61171b1748313eea22e1bee37b5fad9a8..43ed39aea4924cee57ed841d68e0fe883f4e8429 100644 (file)
@@ -373,6 +373,12 @@ MUTATOR_HOOKFUNCTION(ca, PlayerDamage_SplitHealthArmor)
                GameRules_scoring_add_team(frag_attacker, SCORE, (frag_damage - excess) * autocvar_g_ca_damage2score_multiplier);
 }
 
+MUTATOR_HOOKFUNCTION(ca, CalculateRespawnTime)
+{
+       // no respawn calculations needed, player is forced to spectate anyway
+       return true;
+}
+
 MUTATOR_HOOKFUNCTION(ca, PlayerRegen)
 {
        // no regeneration in CA
index 27c11b1e216c986f21eb96aaa9cf3958c6357d94..06bdb1428f869439244afd76f9e836eef8000945 100644 (file)
@@ -220,7 +220,7 @@ void PlayerCorpseDamage(entity this, entity inflictor, entity attacker, float da
 
 void calculate_player_respawn_time(entity this)
 {
-       if(g_ca)
+       if(MUTATOR_CALLHOOK(CalculateRespawnTime, this))
                return;
 
        float gametype_setting_tmp;