From: Lyberta Date: Sat, 13 Jan 2018 06:15:53 +0000 (+0300) Subject: Disabled giving random start weapons in Instagib and Overkill. X-Git-Tag: xonotic-v0.8.5~2379^2~3 X-Git-Url: http://de.git.xonotic.org/?a=commitdiff_plain;h=49da4f417bd8566635b06dd1d1fdc8c75aa2a19b;p=xonotic%2Fxonotic-data.pk3dir.git Disabled giving random start weapons in Instagib and Overkill. --- 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) \