From: AriosJentu Date: Fri, 16 Aug 2019 16:12:18 +0000 (+1000) Subject: Add parameter for removing loot in unlimited ammo mode X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=9ed4180805535e7477d99292f194c1a6500060ca;p=xonotic%2Fxonotic-data.pk3dir.git Add parameter for removing loot in unlimited ammo mode --- 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