From 99d6f97cbb95a9c4828acd216e99189e0b30c904 Mon Sep 17 00:00:00 2001 From: ChocoTaco Date: Fri, 28 Feb 2020 16:36:38 -0500 Subject: [PATCH] Flag Escort Fix Incorrect code involving Flag Escorting --- Classic/scripts/autoexec/FlagEscortFix.cs | 48 +++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 Classic/scripts/autoexec/FlagEscortFix.cs diff --git a/Classic/scripts/autoexec/FlagEscortFix.cs b/Classic/scripts/autoexec/FlagEscortFix.cs new file mode 100644 index 0000000..ed15d4b --- /dev/null +++ b/Classic/scripts/autoexec/FlagEscortFix.cs @@ -0,0 +1,48 @@ +package FlagEscortFix +{ + +function CTFGame::onClientDamaged(%game, %clVictim, %clAttacker, %damageType, %implement, %damageLoc) +{ + parent::onClientDamaged(%game, %clVictim, %clAttacker, %damageType, %implement, %damageLoc); + //if victim is carrying a flag and is not on the attackers team, mark the attacker as a threat for x seconds(for scoring purposes) + if ((%clVictim.player.holdingFlag !$= "") && (%clVictim.team != %clAttacker.team)) + { + %clAttacker.dmgdFlagCarrier = true; + cancel(%clAttacker.threatTimer); //restart timer + %clAttacker.threatTimer = schedule(%game.TIME_CONSIDERED_FLAGCARRIER_THREAT,0,"dmgFlagReset",%clAttacker); + } +} + +function SCtFGame::onClientDamaged(%game, %clVictim, %clAttacker, %damageType, %implement, %damageLoc) +{ + parent::onClientDamaged(%game, %clVictim, %clAttacker, %damageType, %implement, %damageLoc); + //if victim is carrying a flag and is not on the attackers team, mark the attacker as a threat for x seconds(for scoring purposes) + if ((%clVictim.player.holdingFlag !$= "") && (%clVictim.team != %clAttacker.team)) + { + %clAttacker.dmgdFlagCarrier = true; + cancel(%clAttacker.threatTimer); //restart timer + %clAttacker.threatTimer = schedule(%game.TIME_CONSIDERED_FLAGCARRIER_THREAT,0,"dmgFlagReset",%clAttacker); + } +} + +function PracticeCTFGame::onClientDamaged(%game, %clVictim, %clAttacker, %damageType, %implement, %damageLoc) +{ + parent::onClientDamaged(%game, %clVictim, %clAttacker, %damageType, %implement, %damageLoc); + //if victim is carrying a flag and is not on the attackers team, mark the attacker as a threat for x seconds(for scoring purposes) + if ((%clVictim.player.holdingFlag !$= "") && (%clVictim.team != %clAttacker.team)) + { + %clAttacker.dmgdFlagCarrier = true; + cancel(%clAttacker.threatTimer); //restart timer + %clAttacker.threatTimer = schedule(%game.TIME_CONSIDERED_FLAGCARRIER_THREAT,0,"dmgFlagReset",%clAttacker); + } +} + +}; + +function dmgFlagReset(%clAttacker){ + %clAttacker.dmgdFlagCarrier = false; +} + +// Prevent package from being activated if it is already +if (!isActivePackage(FlagEscortFix)) + activatePackage(FlagEscortFix); \ No newline at end of file