From 9ed4180805535e7477d99292f194c1a6500060ca Mon Sep 17 00:00:00 2001 From: AriosJentu Date: Sat, 17 Aug 2019 02:12:18 +1000 Subject: [PATCH] Add parameter for removing loot in unlimited ammo mode --- mutators.cfg | 3 ++- .../mutator/unlimitedammo/sv_unlimitedammo.qc | 13 +++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/mutators.cfg b/mutators.cfg index c4737519a..2bc34462a 100644 --- a/mutators.cfg +++ b/mutators.cfg @@ -524,4 +524,5 @@ exec randomitems-xonotic.cfg // ================ // unlimited ammo // ================ -set g_unlimitedammo 0 "Enable unlimited ammo for game" \ No newline at end of file +set g_unlimitedammo 0 "Enable unlimited ammo for game" +set g_unlimitedammo_remove_loot 0 "Remove dropping loot from players after they dies when unlimited ammo mode is on" \ No newline at end of file diff --git a/qcsrc/common/mutators/mutator/unlimitedammo/sv_unlimitedammo.qc b/qcsrc/common/mutators/mutator/unlimitedammo/sv_unlimitedammo.qc index c77f720ea..fd0a47a57 100644 --- a/qcsrc/common/mutators/mutator/unlimitedammo/sv_unlimitedammo.qc +++ b/qcsrc/common/mutators/mutator/unlimitedammo/sv_unlimitedammo.qc @@ -1,12 +1,17 @@ #include "sv_unlimitedammo.qh" -bool autocvar_g_unlimitedammo; +bool autocvar_g_unlimitedammo_remove_loot; REGISTER_MUTATOR(unlimitedammo, cvar("g_unlimitedammo")); - MUTATOR_HOOKFUNCTION(unlimitedammo, SetStartItems) { - if (autocvar_g_unlimitedammo) { - start_items |= IT_UNLIMITED_AMMO; + start_items |= IT_UNLIMITED_AMMO; +} + +MUTATOR_HOOKFUNCTION(unlimitedammo, FilterItem) +{ + entity item = M_ARGV(0, entity); + if (Item_IsLoot(item) && autocvar_g_unlimitedammo_remove_loot) { + remove(item); } } \ No newline at end of file -- 2.39.2