From 49da4f417bd8566635b06dd1d1fdc8c75aa2a19b Mon Sep 17 00:00:00 2001 From: Lyberta Date: Sat, 13 Jan 2018 09:15:53 +0300 Subject: [PATCH] Disabled giving random start weapons in Instagib and Overkill. --- qcsrc/common/mutators/mutator/instagib/sv_instagib.qc | 5 +++++ qcsrc/common/mutators/mutator/overkill/sv_overkill.qc | 5 +++++ qcsrc/server/client.qc | 7 +++++-- qcsrc/server/mutators/events.qh | 6 ++++++ 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/qcsrc/common/mutators/mutator/instagib/sv_instagib.qc b/qcsrc/common/mutators/mutator/instagib/sv_instagib.qc index 473e36e10..d3ec61868 100644 --- a/qcsrc/common/mutators/mutator/instagib/sv_instagib.qc +++ b/qcsrc/common/mutators/mutator/instagib/sv_instagib.qc @@ -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); diff --git a/qcsrc/common/mutators/mutator/overkill/sv_overkill.qc b/qcsrc/common/mutators/mutator/overkill/sv_overkill.qc index 5eef8f2e3..44d52f1a7 100644 --- a/qcsrc/common/mutators/mutator/overkill/sv_overkill.qc +++ b/qcsrc/common/mutators/mutator/overkill/sv_overkill.qc @@ -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); diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index adfa40aeb..603048387 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -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); diff --git a/qcsrc/server/mutators/events.qh b/qcsrc/server/mutators/events.qh index 6e3448066..eae1a3ad3 100644 --- a/qcsrc/server/mutators/events.qh +++ b/qcsrc/server/mutators/events.qh @@ -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) \ -- 2.39.2