Fixed a double override

This commit is contained in:
ChocoTaco 2018-11-13 21:39:50 -05:00
parent cef798bd5c
commit 953b7386af
2 changed files with 29 additions and 24 deletions

View file

@ -1,16 +1,32 @@
//Amount of players on a team to enable turrets
//$Host::EnableTurretPlayerCount = 10;
//
//Disable MortarTurret
//$Host::EnableMortarTurret = 0;
//
//Disable = 0
//Enable = 1
package antiTurret {
package antiTurret
{
function TurretData::selectTarget(%this, %turret)
{
if( !$Host::TournamentMode && $TotalTeamPlayerCount < $Host::EnableTurretPlayerCount ) {
%turret.clearTarget();
}
else {
Parent::selectTarget(%this, %turret);
}
if( !$Host::TournamentMode && $TotalTeamPlayerCount < $Host::EnableTurretPlayerCount )
{
%turret.clearTarget();
}
else if( $Host::EnableMortarTurret )
{
Parent::selectTarget(%this, %turret);
}
//No possibility of mortar turret working if map already has it and its banned.
else if( %turret.initialBarrel !$= "MortarBarrelLarge" )
{
Parent::selectTarget(%this, %turret);
}
}
};

View file

@ -3,9 +3,11 @@
//
//Disable = 0
//Enable = 1
//
// ban mortar turret from inventory in main gametypes
if( !$Host::EnableMortarTurret ) {
if( !$Host::EnableMortarTurret )
{
$InvBanList[CTF, "MortarBarrelPack"] = 1;
$InvBanList[CnH, "MortarBarrelPack"] = 1;
@ -13,18 +15,5 @@ if( !$Host::EnableMortarTurret ) {
}
package noMortarTurret {
// if a mortar turret somehow makes it into the game, keep it from working
function TurretData::selectTarget(%this, %turret) {
if( %turret.initialBarrel !$= "MortarBarrelLarge" ) {
Parent::selectTarget(%this, %turret);
}
}
};
// Prevent package from being activated if it is already
if (!isActivePackage(noMortarTurret))
activatePackage(noMortarTurret);
//Initial mortar turret barrel code moved to antiTurret.cs
//to avoid double override.