From 62d89c288f3a3e64665e52e7ed6e2dad4f11e9e4 Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 15 Mar 2020 17:34:59 +1000 Subject: [PATCH] Add an option (disabled by default) to drop off-hand weapons while dual wielding in the pinata mutator --- mutators.cfg | 6 ++++++ qcsrc/common/mutators/mutator/pinata/sv_pinata.qc | 4 ++++ xonotic-server.cfg | 1 - 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/mutators.cfg b/mutators.cfg index b6ad3468e0..abf689625a 100644 --- a/mutators.cfg +++ b/mutators.cfg @@ -522,3 +522,9 @@ set g_smneg_cooldown_factor 0.25 "Stale-move negation: penalty cooldown factor" set g_random_items 0 "Whether to enable random items." set g_random_loot 0 "Whether to enable random loot." exec randomitems-xonotic.cfg + +// =============== +// pinata +// =============== +set g_pinata 0 "if set to 1 you will not only drop your current weapon when you are killed, but you will drop all weapons that you possessed" +set g_pinata_offhand 0 "if enabled, the second weapon will drop as well while dual wielding" diff --git a/qcsrc/common/mutators/mutator/pinata/sv_pinata.qc b/qcsrc/common/mutators/mutator/pinata/sv_pinata.qc index 779e562b4a..fa8045101e 100644 --- a/qcsrc/common/mutators/mutator/pinata/sv_pinata.qc +++ b/qcsrc/common/mutators/mutator/pinata/sv_pinata.qc @@ -1,6 +1,7 @@ #include "sv_pinata.qh" string autocvar_g_pinata; +bool autocvar_g_pinata_offhand; REGISTER_MUTATOR(pinata, expr_evaluate(autocvar_g_pinata) && !MUTATOR_IS_ENABLED(mutator_instagib) && !MUTATOR_IS_ENABLED(ok)); MUTATOR_HOOKFUNCTION(pinata, PlayerDies) @@ -14,6 +15,9 @@ MUTATOR_HOOKFUNCTION(pinata, PlayerDies) if(frag_target.(weaponentity).m_weapon == WEP_Null) continue; + if(slot > 0 && !autocvar_g_pinata_offhand) + break; + FOREACH(Weapons, it != WEP_Null, { if(STAT(WEAPONS, frag_target) & WepSet_FromWeapon(it)) if(frag_target.(weaponentity).m_weapon != it) diff --git a/xonotic-server.cfg b/xonotic-server.cfg index a128a801d8..843a83d3d6 100644 --- a/xonotic-server.cfg +++ b/xonotic-server.cfg @@ -191,7 +191,6 @@ set g_antilag_nudge 0 "don't touch" set g_shootfromeye 0 "shots are fired from your eye/crosshair; visual gun position can still be influenced by cl_gunalign 1 and 2" set g_shootfromcenter 0 "weapon gets moved to the center, shots still come from the barrel of your weapon; visual gun position can still be influenced by cl_gunalign 1 and 2" set g_shootfromfixedorigin "" "if set to a string like 0 y z, the gun is moved to the given y and z coordinates. If set to a string like x y z, the whole shot origin is used" -set g_pinata 0 "if set to 1 you will not only drop your current weapon when you are killed, but you will drop all weapons that you possessed" set g_weapon_stay 0 "1: ghost weapons can be picked up but give no ammo, thrown guns have ammo 2: ghost weapons can be picked up and refill ammo to one pickup size, thrown guns have no ammo (to prevent infinite ammo abuse)" set g_weapon_throwable 1 "if set to 1, weapons can be dropped" set g_powerups -1 "if set to 0 the strength and shield (invincibility) will not spawn on the map, if 1 they will spawn in all game modes, -1 is game mode default" -- 2.39.2