From 7d00bf4e902089d7e2b4452352e8286ed5e5947f Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 8 Feb 2015 04:17:16 +1100 Subject: [PATCH] If health or armor are above set limits, send items to piggybacker --- qcsrc/server/mutators/mutator_piggyback.qc | 37 +++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/qcsrc/server/mutators/mutator_piggyback.qc b/qcsrc/server/mutators/mutator_piggyback.qc index ea8cbfad3..f596dbfa0 100644 --- a/qcsrc/server/mutators/mutator_piggyback.qc +++ b/qcsrc/server/mutators/mutator_piggyback.qc @@ -251,11 +251,12 @@ MUTATOR_HOOKFUNCTION(pb_PlayerDies) MUTATOR_HOOKFUNCTION(pb_ItemTouch) { + entity p = other; if(self.weapon) if(other.piggybacker) if(other.weapons & self.weapons) { - entity p = other; + p = other; while(p.piggybacker) { p = p.piggybacker; @@ -267,6 +268,40 @@ MUTATOR_HOOKFUNCTION(pb_ItemTouch) } } + if(self.health || self.armorvalue) + if(other.piggybacker) + { + if(self.health) + if(other.health > start_health) + { + p = other; + while(p.piggybacker) + { + p = p.piggybacker; + if(p.health < start_health) + { + other = p; + break; + } + } + } + + if(self.armorvalue) + if(other.armorvalue > 50) // can't use start value here, as players don't start with armor + { + p = other; + while(p.piggybacker) + { + p = p.piggybacker; + if(p.armorvalue < 50) + { + other = p; + break; + } + } + } + } + return false; } -- 2.39.2