]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Disabled giving random start weapons in Instagib and Overkill.
authorLyberta <lyberta@lyberta.net>
Sat, 13 Jan 2018 06:15:53 +0000 (09:15 +0300)
committerLyberta <lyberta@lyberta.net>
Sat, 13 Jan 2018 06:15:53 +0000 (09:15 +0300)
qcsrc/common/mutators/mutator/instagib/sv_instagib.qc
qcsrc/common/mutators/mutator/overkill/sv_overkill.qc
qcsrc/server/client.qc
qcsrc/server/mutators/events.qh

index 473e36e1057589e689c3f961645f7721126231e1..d3ec61868487d23b9a6d6fa0ceb58ef1ab39cf7e 100644 (file)
@@ -178,6 +178,11 @@ MUTATOR_HOOKFUNCTION(mutator_instagib, MakePlayerObserver)
        instagib_stop_countdown(player);
 }
 
+MUTATOR_HOOKFUNCTION(mutator_instagib, ShouldGiveRandomStartWeapons)
+{
+       return true;
+}
+
 MUTATOR_HOOKFUNCTION(mutator_instagib, PlayerSpawn)
 {
        entity player = M_ARGV(0, entity);
index 5eef8f2e37b4b49c96bce413c564cf2ebcbf9b28..44d52f1a7c7936e8e0735b6cea6561ddbcd71044 100644 (file)
@@ -167,6 +167,11 @@ MUTATOR_HOOKFUNCTION(ok, PlayerPreThink)
        PHYS_INPUT_BUTTON_ATCK2(player) = false;
 }
 
+MUTATOR_HOOKFUNCTION(ok, ShouldGiveRandomStartWeapons)
+{
+       return true;
+}
+
 MUTATOR_HOOKFUNCTION(ok, PlayerWeaponSelect)
 {
        entity player = M_ARGV(0, entity);
index adfa40aeb6050de44535abf2368ba6dfe901f2ef..60304838794bd24c6c895d506652698cf2095be3 100644 (file)
@@ -558,8 +558,11 @@ void PutPlayerInServer(entity this)
                this.health = start_health;
                this.armorvalue = start_armorvalue;
                this.weapons = start_weapons;
-               GiveRandomWeapons(this, random_start_weapons_count,
-                       autocvar_g_random_start_weapons, random_start_ammo);
+               if (MUTATOR_CALLHOOK(ShouldGiveRandomStartWeapons, this) == false)
+               {
+                       GiveRandomWeapons(this, random_start_weapons_count,
+                               autocvar_g_random_start_weapons, random_start_ammo);
+               }
        }
        SetSpectatee_status(this, 0);
 
index 6e3448066e5d49c7d43aac261bb8cf0a6a2f5148..eae1a3ad3d9744354bb517285fa6706ef0738f11 100644 (file)
@@ -24,6 +24,12 @@ MUTATOR_HOOKABLE(PutClientInServer, EV_PutClientInServer);
     /**/
 MUTATOR_HOOKABLE(ForbidSpawn, EV_ForbidSpawn);
 
+/** called when player spawns to determine whether to give them random start weapons. Return true to forbid giving them. */
+#define EV_ShouldGiveRandomStartWeapons(i, o) \
+       /** player */ i(entity, MUTATOR_ARGV_0_entity) \
+    /**/
+MUTATOR_HOOKABLE(ShouldGiveRandomStartWeapons, EV_ShouldGiveRandomStartWeapons);
+
 /** called when a player spawns as player, after shared setup, before his weapon is chosen (so items may be changed in here) */
 #define EV_PlayerSpawn(i, o) \
        /** player spawning */ i(entity, MUTATOR_ARGV_0_entity) \