From: Mario Date: Sat, 7 Feb 2015 17:17:16 +0000 (+1100) Subject: If health or armor are above set limits, send items to piggybacker X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=7d00bf4e902089d7e2b4452352e8286ed5e5947f;p=xonotic%2Fxonotic-data.pk3dir.git If health or armor are above set limits, send items to piggybacker --- 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; }