// UTILITY GUN
actor MenuSelection : Inventory {inventory.maxamount 3}
actor MenuSelection2 : Inventory {inventory.maxamount 10}
actor MenuHorPos : Inventory {inventory.maxamount 1}
actor GotAdvTurrets : Inventory {inventory.maxamount 1}
actor GotMoreTurrets : Inventory {inventory.maxamount 1}
actor CannotBuild : Inventory {inventory.maxamount 1}
actor NoMechs : Inventory {inventory.maxamount 1}
actor PortalsEnabled : Inventory {inventory.maxamount 1}

actor UtilityGun : AOWWeapon {
    Weapon.BobSpeed 1.75
    Weapon.BobRangeX 0.2
    Weapon.BobRangeY 0.4
    Weapon.BobStyle Alpha
	Inventory.PickupSound "misc/w_pkup"
	DropItem "EngineerPack"
	Weapon.AmmoType "Utility_Percent"
	Weapon.AmmoUse 0
	Weapon.Kickback 0
	Weapon.PreferredSkin "MarineBFG10k"
	Weapon.UpSound "weapons/up/utilgun"
	States {
	Spawn:
		TNT1 A 0 
		stop
	Select:
		UTIG A 0 ACS_ExecuteAlways (980, 0)
		UTIG A 1 offset (-90,100)
		UTIG A 1 offset (-80,89)
		UTIG A 1 offset (-70,79)
		UTIG A 1 offset (-60,70)
		UTIG A 1 offset (-50,62)
		UTIG A 1 offset (-40,55)
		UTIG A 1 offset (-30,49)
		UTIG A 1 offset (-20,44)
		UTIG A 1 offset (-15,40)
		UTIG A 1 offset (-10,37)
		UTIG A 1 offset (-5,34)
		UTIG A 1 offset (0,0)
		TNT1 A 0 A_TakeInventory("SelectAnimation",1)
		goto ready
	Deselect:
		UTIG A 0 ACS_ExecuteAlways (980, 0, 1)
		UTIG A 0 A_TakeInventory("Utility_Percent",100)
		UTIG A 0 A_JumpIfHealthLower (1, 2)
		UTIG A 0 A_JumpIfInventory ("InMenu", 1, "Ready")
		UTIG A 0 A_StopSoundEx("Weapon")
	    TNT1 A 0 A_TakeInventory("ActionFragGrenade",1)	
        TNT1 A 0 A_TakeInventory("ActionFlashbang",1)
        TNT1 A 0 A_TakeInventory("ActionRemoteC4",1)	
        TNT1 A 0 A_TakeInventory("ActionMeleeAttack",1)
		TNT1 A 0 A_TakeInventory("ActionReload",1)	
		UTIG A 1 offset (-4,34)
		UTIG A 1 offset (-8,40)
		UTIG A 1 offset (-16,49)
		UTIG A 1 offset (-24,62)
		UTIG A 1 offset (-32,79)
		UTIG A 1 offset (-40,100)
		TNT1 A 0 offset (-1, 33)
		TNT1 A 0 A_Lower
		wait
	RejectedWait:
		UTIG A 0 A_StopSound (CHAN_WEAPON)
		UTIG A 20
		goto Ready
	Ready:
		UTIG A 0 ACS_ExecuteAlways (370, 0)
		TNT1 A 0 A_JumpIfInventory("SelectAnimation",1,"Select")
		UTIG A 0 A_TakeInventory ("Utility_Percent", 2)
		TNT1 A 0 A_JumpIfInventory("ActionFragGrenade",1,"UseFragGrenade")
		TNT1 A 0 A_JumpIfInventory("ActionFlashbang",1,"UseFlashbang")
		TNT1 A 0 A_JumpIfInventory("ActionRemoteC4",1,"UseRemoteC4")
		TNT1 A 0 A_JumpIfInventory("ActionMeleeAttack",1,"UseMeleeAttack")
		TNT1 A 0 A_TakeInventory("ActionReload",1)
		UTIG A 5 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("ActionFragGrenade",1,"UseFragGrenade")
		TNT1 A 0 A_JumpIfInventory("ActionFlashbang",1,"UseFlashbang")
		TNT1 A 0 A_JumpIfInventory("ActionRemoteC4",1,"UseRemoteC4")
		TNT1 A 0 A_JumpIfInventory("ActionMeleeAttack",1,"UseMeleeAttack")
		TNT1 A 0 A_TakeInventory("ActionReload",1)
		UTIG A 5 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("ActionFragGrenade",1,"UseFragGrenade")
		TNT1 A 0 A_JumpIfInventory("ActionFlashbang",1,"UseFlashbang")
		TNT1 A 0 A_JumpIfInventory("ActionRemoteC4",1,"UseRemoteC4")
		TNT1 A 0 A_JumpIfInventory("ActionMeleeAttack",1,"UseMeleeAttack")
		TNT1 A 0 A_TakeInventory("ActionReload",1)
		UTIG A 5 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("ActionFragGrenade",1,"UseFragGrenade")
		TNT1 A 0 A_JumpIfInventory("ActionFlashbang",1,"UseFlashbang")
		TNT1 A 0 A_JumpIfInventory("ActionRemoteC4",1,"UseRemoteC4")
		TNT1 A 0 A_JumpIfInventory("ActionMeleeAttack",1,"UseMeleeAttack")
		TNT1 A 0 A_TakeInventory("ActionReload",1)
		UTIG A 5 A_WeaponReady
		UTIG A 0 A_StopSound (CHAN_WEAPON)
		loop
	Fire:
		UTIG A 0 A_JumpIfInventory ("InMenu", 1, "RejectedWait")
		UTIG A 0 ACS_ExecuteAlways(370, 0)
		UTIG A 0 A_PlaySound ("utility/work", CHAN_WEAPON, 1.0, true)
		UTIG A 0 A_JumpIfInventory("MenuSelection",3,"Fire.Geometry")
		UTIG A 0 A_JumpIfInventory("MenuSelection",2,"Fire.Defenses")
		UTIG A 0 A_JumpIfInventory("MenuSelection",1,"Fire.Pickups")
		goto Fire.Caches
	Fire.Caches:
		UTIG A 0 A_JumpIfInventory("MenuSelection2",6,"Create.PowerGenerator")
		UTIG A 0 A_JumpIfInventory("MenuSelection2",5,"Create.RegenAmmo")
		UTIG A 0 A_JumpIfInventory("MenuSelection2",4,"Create.Regen")
		UTIG A 0 A_JumpIfInventory("MenuSelection2",3,"Create.MiniRef")
		UTIG A 0 A_JumpIfInventory("MenuSelection2",2,"Create.SuperCache")
		UTIG A 0 A_JumpIfInventory("MenuSelection2",1,"Create.MedicalCache")
		goto Create.AmmoCache
	Fire.Pickups:
		UTIG A 0 A_JumpIfInventory("MenuSelection2",7,"Create.WolfMech")
		UTIG A 0 A_JumpIfInventory("MenuSelection2",6,"Create.RavenMech")
		UTIG A 0 A_JumpIfInventory("MenuSelection2",5,"Create.ChemProof")
		UTIG A 0 A_JumpIfInventory("MenuSelection2",4,"Create.FireProof")
		UTIG A 0 A_JumpIfInventory("MenuSelection2",3,"Create.MachineGun")
		UTIG A 0 A_JumpIfInventory("MenuSelection2",2,"Create.Rifle")
		UTIG A 0 A_JumpIfInventory("MenuSelection2",1,"Create.FullRefill")
		goto Create.C4Box
	Fire.Defenses:
		TNT1 A 0 A_JumpIfInventory("IsInSpawnRoom",1,"Ready")
		UTIG A 0 A_JumpIfInventory("MenuSelection2",9,"Create.ChemTurret")
		UTIG A 0 A_JumpIfInventory("MenuSelection2",8,"Create.FlameTurret")
		UTIG A 0 A_JumpIfInventory("MenuSelection2",7,"Create.ArtilleryTurret")
		UTIG A 0 A_JumpIfInventory("MenuSelection2",6,"Create.RepairTurret")
		UTIG A 0 A_JumpIfInventory("MenuSelection2",5,"Create.PrecisionTurret")
		UTIG A 0 A_JumpIfInventory("MenuSelection2",4,"Create.KlaxonTurret")
		UTIG A 0 A_JumpIfInventory("MenuSelection2",3,"Create.MiniRaven")
		UTIG A 0 A_JumpIfInventory("MenuSelection2",2,"Create.Mines")
		UTIG A 0 A_JumpIfInventory("MenuSelection2",1,"Create.MechTurret")
		goto Create.GunTurret
	Fire.Geometry:
		TNT1 A 0 A_JumpIfInventory("IsInSpawnRoom",1,"Ready")
		UTIG A 0 A_JumpIfInventory("MenuSelection2",9,"Create.StepDown3")
		UTIG A 0 A_JumpIfInventory("MenuSelection2",8,"Create.StepStraight3")
		UTIG A 0 A_JumpIfInventory("MenuSelection2",7,"Create.Step3")
		UTIG A 0 A_JumpIfInventory("MenuSelection2",6,"Create.StepDown")
		UTIG A 0 A_JumpIfInventory("MenuSelection2",5,"Create.StepStraight")
		UTIG A 0 A_JumpIfInventory("MenuSelection2",4,"Create.Step")
		UTIG A 0 A_JumpIfInventory("MenuSelection2",3,"Create.Platform")
		//UTIG A 0 A_JumpIfInventory("MenuSelection2",3,"Create.Barrel")
		UTIG A 0 A_JumpIfInventory("MenuSelection2",2,"Create.Portal")
		UTIG A 0 A_JumpIfInventory("MenuSelection2",1,"Create.Sandbags")
		goto Create.RazorWire
	Create.C4Box:
		UTIF A 0 A_JumpIfInventory ("Utility_Percent", 100, "Done.C4Box")
		UTIF A 0 Radius_Quake (1, 4, 0, 1, 0)
		UTIF A 0 A_SpawnItemEx ("Utility_C4BoxMarker", 64, 0, 32)
		UTIF A 10 BRIGHT A_GiveInventory ("Utility_Percent", 6)
		UTIG A 15
		UTIF A 0 A_Refire
		Goto EndFire
	Done.C4Box:
		UTIF A 0 A_SpawnItemEx ("Utility_C4BoxMarker", 64, 0, 32)
		UTIF A 0 A_SpawnItemEx ("C4Box", 64, 0, 32)
		UTIG A 0 A_StopSoundEx ("Weapon")
		UTIG A 35 BRIGHT Radius_Quake(1,4,0,1,0)
		UTIG A 35 A_TakeInventory("Utility_Percent",100)
		UTIF A 0 A_Refire
		Goto EndFire
	Create.FullRefill:
		UTIF A 0 A_JumpIfInventory("Utility_Percent",100,"Done.FullRefill")
		UTIF A 0 Radius_Quake(1,4,0,1,0)
		UTIF A 0 A_SpawnItemEx("Utility_FullRefillMarker",64,0,32)
		UTIF A 10 BRIGHT A_GiveInventory("Utility_Percent", 5)
		UTIG A 15
		UTIF A 0 A_Refire
		Goto EndFire
	Done.FullRefill:
		UTIF A 0 A_SpawnItemEx("Utility_FullRefillMarker",64,0,32)
		UTIF A 0 A_SpawnItemEx("FullRefillPack",64,0,32)
		UTIG A 0 A_StopSoundEx("Weapon")
		UTIG A 35 BRIGHT Radius_Quake(1,4,0,1,0)
		UTIG A 35 A_TakeInventory("Utility_Percent",100)
		UTIF A 0 A_Refire
		Goto EndFire
	Create.Rifle:
		UTIF A 0 A_JumpIfInventory("Utility_Percent",100,"Done.Rifle")
		UTIF A 0 Radius_Quake(1,4,0,1,0)
		UTIF A 0 A_SpawnItemEx("Utility_RifleMarker",64,0,32,0,0,0,0,32,0)
		UTIF A 10 BRIGHT A_GiveInventory("Utility_Percent",8)
		UTIG A 15
		UTIF A 0 A_Refire
		Goto EndFire
	Done.Rifle:
		UTIF A 0 A_SpawnItemEx("Utility_RifleMarker",64,0,32,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("Rifle",64,0,32,0,0,0,0,32,0)
		UTIG A 0 A_StopSoundEx("Weapon")
		UTIG A 35 BRIGHT Radius_Quake(1,4,0,1,0)
		UTIG A 35 A_TakeInventory("Utility_Percent",100)
		UTIF A 0 A_Refire
		Goto EndFire
	Create.MedicalCache:
		TNT1 A 0 A_JumpIfInventory("IsInSpawnRoom",1,"RejectedWait")
		UTIF A 0 A_JumpIfInventory("Utility_Percent",100,"Done.MedicalCache")
		UTIF A 0 Radius_Quake(1,4,0,1,0)
		UTIF A 0 A_SpawnItemEx("Utility_MedicalCacheMarker",96,0,0,0,0,0,0,32,0)
		UTIF A 10 BRIGHT A_GiveInventory("Utility_Percent",6)
		UTIG A 15
		UTIF A 0 A_Refire
		Goto EndFire
	Done.MedicalCache:
		UTIF A 0 A_SpawnItemEx("Utility_MedicalCacheMarker",96,0,0,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("MedicalCache",96,0,0,0,0,0,0,32,0)
		UTIG A 0 A_StopSoundEx("Weapon")
		UTIG A 35 BRIGHT Radius_Quake(1,4,0,1,0)
		UTIG A 35 A_TakeInventory("Utility_Percent",100)
		UTIF A 0 A_Refire
		Goto EndFire
	Create.AmmoCache:
		TNT1 A 0 A_JumpIfInventory("IsInSpawnRoom",1,"RejectedWait")
		UTIF A 0 A_JumpIfInventory("Utility_Percent",100,"Done.AmmoCache")
		UTIF A 0 Radius_Quake(1,4,0,1,0)
		UTIF A 0 A_SpawnItemEx("Utility_AmmoCacheMarker",96,0,0,0,0,0,0,32,0)
		UTIF A 10 BRIGHT A_GiveInventory("Utility_Percent",6)
		UTIG A 15
		UTIF A 0 A_Refire
		Goto EndFire
	Done.AmmoCache:
		UTIF A 0 A_SpawnItemEx("Utility_AmmoCacheMarker",96,0,0,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("AmmoCache",96,0,0,0,0,0,0,32,0)
		UTIG A 0 A_StopSoundEx("Weapon")
		UTIG A 35 BRIGHT Radius_Quake(1,4,0,1,0)
		UTIG A 35 A_TakeInventory("Utility_Percent",100)
		UTIF A 0 A_Refire
		Goto EndFire
	Create.MachineGun:
		UTIF A 0 A_JumpIfInventory("Utility_Percent",100,"Done.MachineGun")
		UTIF A 0 Radius_Quake(1,4,0,1,0)
		UTIF A 0 A_SpawnItemEx("Utility_MachineGunMarker",64,0,32,0,0,0,0,32,0)
		UTIF A 10 BRIGHT A_GiveInventory("Utility_Percent",6)
		UTIG A 15
		UTIF A 0 A_Refire
		Goto EndFire
	Done.MachineGun:
		UTIF A 0 A_SpawnItemEx("Utility_MachineGunMarker",64,0,32,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("MachineGun",64,0,32,0,0,0,0,32,0)
		UTIG A 0 A_StopSoundEx("Weapon")
		UTIG A 35 BRIGHT Radius_Quake(1,4,0,1,0)
		UTIG A 35 A_TakeInventory("Utility_Percent",100)
		UTIF A 0 A_Refire
		Goto EndFire
	Create.SuperCache:
		TNT1 A 0 A_JumpIfInventory("IsInSpawnRoom",1,"RejectedWait")
		UTIF A 0 A_JumpIfInventory("Utility_Percent",100,"Done.SuperCache")
		UTIF A 0 Radius_Quake(1,4,0,1,0)
		UTIF A 0 A_SpawnItemEx("Utility_SuperCacheMarker",96,0,0,0,0,0,0,32,0)
		UTIF A 10 BRIGHT A_GiveInventory("Utility_Percent",5)
		UTIG A 15
		UTIF A 0 A_Refire
		Goto EndFire
	Done.SuperCache:
		UTIF A 0 A_SpawnItemEx("Utility_SuperCacheMarker",96,0,0,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("SuperCache", 96)
		UTIG A 0 A_StopSoundEx("Weapon")
		UTIG A 35 BRIGHT Radius_Quake(1,4,0,1,0)
		UTIG A 35 A_TakeInventory("Utility_Percent",100)
		UTIF A 0 A_Refire
		Goto EndFire
	Create.RazorWire:
		TNT1 A 0 A_JumpIfInventory("IsInSpawnRoom",1,"RejectedWait")
		UTIF A 0 A_JumpIfInventory("Utility_Percent",100,"Done.RazorWire")
		UTIF A 0 Radius_Quake(1,4,0,1,0)
		UTIF A 0 A_SpawnItemEx("Utility_RazorWireMarker",96,0,0,0,0,0,0,32,0)
		UTIF A 10 BRIGHT A_GiveInventory("Utility_Percent",6)
		UTIG A 15
		UTIF A 0 A_Refire
		Goto EndFire
	Done.RazorWire:
		UTIF A 0 A_JumpIf(ACS_ExecuteWithResult(346,1) == 0, "Limit")
		UTIF A 0 A_SpawnItemEx ("Utility_RazorWireMarker", 96,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION)
		UTIF A 0 A_JumpIfInventory ("IsBlue", 1, "Done.RazorWireBlue")
		UTIF A 0 A_SpawnItemEx ("RazorWire", 96,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION)
		UTIF A 0 ACS_ExecuteAlways(344,0,1,0,0)
		UTIG A 0 A_StopSound (CHAN_WEAPON)
		UTIG A 35 BRIGHT Radius_Quake(1,4,0,1,0)
		UTIG A 35 A_TakeInventory("Utility_Percent",100)
		UTIF A 0 A_Refire
		Goto EndFire
	Done.RazorWireBlue:
		UTIF A 0 A_SpawnItemEx("RazorWireBlue",96,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
		UTIF A 0 ACS_ExecuteAlways(344,0,1,0,0)
		UTIG A 0 A_StopSound (CHAN_WEAPON)
		UTIG A 35 BRIGHT Radius_Quake(1,4,0,1,0)
		UTIG A 35 A_TakeInventory("Utility_Percent",100)
		UTIF A 0 A_Refire
		Goto EndFire
	Create.Sandbags:
		TNT1 A 0 A_JumpIfInventory("IsInSpawnRoom",1,"RejectedWait")
		UTIF A 0 A_JumpIfInventory("Utility_Percent",100,"Done.Sandbags")
		UTIF A 0 Radius_Quake(1,4,0,1,0)
		UTIF A 0 A_SpawnItemEx("Utility_SandbagsMarker",96,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION)
		UTIF A 10 BRIGHT A_GiveInventory("Utility_Percent",7)
		UTIG A 15
		UTIF A 0 A_Refire
		Goto EndFire
	Done.Sandbags:
		UTIF A 0 A_SpawnItemEx ("Utility_SandbagsMarker", 96,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION)
		UTIF A 0 A_SpawnItemEx ("SandbagWall", 96,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION)
		UTIG A 0 A_StopSound (CHAN_WEAPON)
		UTIG A 35 BRIGHT Radius_Quake(1,4,0,1,0)
		UTIG A 35 A_TakeInventory("Utility_Percent",100)
		UTIF A 0 A_Refire
		Goto EndFire
	Create.GunTurret:
		TNT1 A 0 A_JumpIfInventory("UtilityOutOfRange",1,"RejectedWait")
		TNT1 A 0 A_JumpIfInventory("IsInSpawnRoom",1,"RejectedWait")
		UTIF A 0 A_JumpIfInventory("Utility_Percent",100,"Done.GunTurret")
		UTIF A 0 Radius_Quake(1,4,0,1,0)
		UTIF A 0 A_SpawnItemEx("Utility_TurretMarker",96,0,0,0,0,0,0,32,0)
		UTIF A 10 BRIGHT A_GiveInventory("Utility_Percent",10)
		UTIG A 15
		UTIF A 0 A_Refire
		Goto EndFire
	Done.GunTurret:
		UTIF A 0 A_JumpIfInventory ("IsBlue", 1, "Done.GunTurretBlue")
		UTIF A 0 A_JumpIf(ACS_ExecuteWithResult(346,0,0,0) == 0, "Limit")
		UTIF A 0 A_JumpIf(ACS_ExecuteWithResult(695,0,0,0) == 0, "EndFire2")
		RPBL B 0 ACS_ExecuteAlways(344,0,0,0,0)
		UTIF A 0 A_SpawnItemEx("Utility_TurretMarker",96,0,0,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("Utility_GunTurretRed",96,0,0,0,0,0,0,32,0)
		UTIG A 0 A_StopSoundEx("Weapon")
		UTIG A 35 BRIGHT Radius_Quake(1,4,0,1,0)
		UTIG A 35 A_TakeInventory("Utility_Percent",100)
		UTIF A 0 A_Refire
		Goto EndFire
	Done.GunTurretBlue:
		UTIF A 0 A_JumpIf(ACS_ExecuteWithResult(346,0,1,0) == 0, "Limit")
		UTIF A 0 A_JumpIf(ACS_ExecuteWithResult(695,0,0,0) == 0, "EndFire2")
		RPBL B 0 ACS_ExecuteAlways(344,0,0,0,0)
		UTIF A 0 A_SpawnItemEx("Utility_TurretMarker",96,0,0,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("Utility_GunTurretBlue",96,0,0,0,0,0,0,32,0)
		UTIG A 0 A_StopSoundEx("Weapon")
		UTIG A 35 BRIGHT Radius_Quake(1,4,0,1,0)
		UTIG A 35 A_TakeInventory("Utility_Percent",100)
		UTIF A 0 A_Refire
		Goto EndFire
	Create.MechTurret:
		TNT1 A 0 A_JumpIfInventory("UtilityOutOfRange",1,"RejectedWait")
		TNT1 A 0 A_JumpIfInventory("IsInSpawnRoom",1,"RejectedWait")
		UTIF A 0 A_JumpIfInventory("Utility_Percent",100,"Done.MechTurret")
		UTIF A 0 Radius_Quake(1,4,0,1,0)
		UTIF A 0 A_SpawnItemEx("Utility_TurretMarker",96,0,0,0,0,0,0,32,0)
		UTIF A 10 BRIGHT A_GiveInventory("Utility_Percent",10)
		UTIG A 15
		UTIF A 0 A_Refire
		Goto EndFire
	Done.MechTurret:
		UTIF A 0 A_JumpIfInventory ("IsBlue", 1, "Done.MechTurretBlue")
		UTIF A 0 A_JumpIf(ACS_ExecuteWithResult(346,0,0,0) == 0, "Limit")
		UTIF A 0 A_JumpIf(ACS_ExecuteWithResult(695,3,0,0) == 0, "EndFire2")
		RPBL B 0 ACS_ExecuteAlways(344,0,4,0,0)
		UTIF A 0 A_SpawnItemEx("Utility_TurretMarker",96,0,0,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("Utility_MechTurretRed",96,0,0,0,0,0,0,32,0)
		UTIG A 0 A_StopSoundEx("Weapon")
		UTIG A 35 BRIGHT Radius_Quake(1,4,0,1,0)
		UTIG A 35 A_TakeInventory("Utility_Percent",100)
		UTIF A 0 A_Refire
		Goto EndFire
	Done.MechTurretBlue:
		UTIF A 0 A_JumpIf(ACS_ExecuteWithResult(346,0,1,0) == 0, "Limit")
		UTIF A 0 A_JumpIf(ACS_ExecuteWithResult(695,3,0,0) == 0, "EndFire2")
		RPBL B 0 ACS_ExecuteAlways(344,0,4,0,0)
		UTIF A 0 A_SpawnItemEx("Utility_TurretMarker",96,0,0,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("Utility_MechTurretBlue",96,0,0,0,0,0,0,32,0)
		UTIG A 0 A_StopSoundEx("Weapon")
		UTIG A 35 BRIGHT Radius_Quake(1,4,0,1,0)
		UTIG A 35 A_TakeInventory("Utility_Percent",100)
		UTIF A 0 A_Refire
		Goto EndFire
	Create.Step:
		TNT1 A 0 A_JumpIfInventory("IsInSpawnRoom",1,"RejectedWait")
		UTIF A 0 A_JumpIfInventory("Utility_Percent",100,"Done.Step")
		UTIF A 0 Radius_Quake(1,4,0,1,0)
		UTIF A 0 A_SpawnItemEx("Utility_StepMarker",64,0,0,0,0,0,0,32,0)
		UTIF A 10 BRIGHT A_GiveInventory("Utility_Percent",35)
		UTIG A 15
		UTIF A 0 A_Refire
		Goto EndFire
	Done.Step:
		UTIF A 0 A_SpawnItemEx("Utility_StepMarker",64,0,0,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("Step",64,0,0,0,0,0,0,32,0)
		UTIG A 0 A_StopSoundEx("Weapon")
		UTIG A 35 BRIGHT Radius_Quake(1,4,0,1,0)
		UTIG A 35 A_TakeInventory("Utility_Percent",100)
		UTIF A 0 A_Refire
		Goto EndFire
	Create.StepDown:
		TNT1 A 0 A_JumpIfInventory("IsInSpawnRoom",1,"RejectedWait")
		UTIF A 0 A_JumpIfInventory("Utility_Percent",100,"Done.StepDown")
		UTIF A 0 Radius_Quake(1,4,0,1,0)
		UTIF A 0 A_SpawnItemEx("Utility_StepMarker",64,0,-28,0,0,0,0,32,0)
		UTIF A 10 BRIGHT A_GiveInventory("Utility_Percent",35)
		UTIG A 15
		UTIF A 0 A_Refire
		Goto EndFire
	Done.StepDown:
		UTIF A 0 A_SpawnItemEx("Utility_StepMarker",64,0,-28,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("Step",64,0,-28,0,0,0,0,32,0)
		UTIG A 0 A_StopSoundEx("Weapon")
		UTIG A 35 BRIGHT Radius_Quake(1,4,0,1,0)
		UTIG A 35 A_TakeInventory("Utility_Percent",100)
		UTIF A 0 A_Refire
		Goto EndFire
	Create.StepStraight:
		TNT1 A 0 A_JumpIfInventory("IsInSpawnRoom",1,"RejectedWait")
		UTIF A 0 A_JumpIfInventory("Utility_Percent",100,"Done.StepStraight")
		UTIF A 0 Radius_Quake(1,4,0,1,0)
		UTIF A 0 A_SpawnItemEx("Utility_StepMarker",64,0,-12,0,0,0,0,32,0)
		UTIF A 10 BRIGHT A_GiveInventory("Utility_Percent",35)
		UTIG A 15
		UTIF A 0 A_Refire
		Goto EndFire
	Done.StepStraight:
		UTIF A 0 A_SpawnItemEx("Utility_StepMarker",64,0,-12,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("Step",64,0,-12,0,0,0,0,32,0)
		UTIG A 0 A_StopSoundEx("Weapon")
		UTIG A 35 BRIGHT Radius_Quake(1,4,0,1,0)
		UTIG A 35 A_TakeInventory("Utility_Percent",100)
		UTIF A 0 A_Refire
		Goto EndFire
	Create.Step3:
		TNT1 A 0 A_JumpIfInventory("IsInSpawnRoom",1,"RejectedWait")
		UTIF A 0 A_JumpIfInventory("Utility_Percent",100,"Done.Step3")
		UTIF A 0 Radius_Quake(1,4,0,1,0)
		UTIF A 0 A_SpawnItemEx("Utility_StepMarker",64,0,0,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("Utility_StepMarker",96,0,12,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("Utility_StepMarker",128,0,24,0,0,0,0,32,0)
		UTIF A 10 BRIGHT A_GiveInventory("Utility_Percent",35)
		UTIG A 15
		UTIF A 0 A_Refire
		Goto EndFire
	Done.Step3:
		UTIF A 0 A_SpawnItemEx("Utility_StepMarker",64,0,0,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("Utility_StepMarker",96,0,12,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("Utility_StepMarker",128,0,24,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("Step",64,0,0,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("Step",96,0,12,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("Step",128,0,24,0,0,0,0,32,0)
		UTIG A 0 A_StopSoundEx("Weapon")
		UTIG A 35 BRIGHT Radius_Quake(1,4,0,1,0)
		UTIG A 35 A_TakeInventory("Utility_Percent",100)
		UTIF A 0 A_Refire
		Goto EndFire
	Create.StepDown3:
		TNT1 A 0 A_JumpIfInventory("IsInSpawnRoom",1,"RejectedWait")
		UTIF A 0 A_JumpIfInventory("Utility_Percent",100,"Done.StepDown3")
		UTIF A 0 Radius_Quake(1,4,0,1,0)
		UTIF A 0 A_SpawnItemEx("Utility_StepMarker",64,0,-28,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("Utility_StepMarker",96,0,-40,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("Utility_StepMarker",128,0,-52,0,0,0,0,32,0)
		UTIF A 10 BRIGHT A_GiveInventory("Utility_Percent",35)
		UTIG A 15
		UTIF A 0 A_Refire
		Goto EndFire
	Done.StepDown3:
		UTIF A 0 A_SpawnItemEx("Utility_StepMarker",64,0,-28,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("Utility_StepMarker",96,0,-40,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("Utility_StepMarker",128,0,-52,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("Step",64,0,-28,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("Step",96,0,-40,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("Step",128,0,-52,0,0,0,0,32,0)
		UTIG A 0 A_StopSoundEx("Weapon")
		UTIG A 35 BRIGHT Radius_Quake(1,4,0,1,0)
		UTIG A 35 A_TakeInventory("Utility_Percent",100)
		UTIF A 0 A_Refire
		Goto EndFire
	Create.StepStraight3:
		TNT1 A 0 A_JumpIfInventory("IsInSpawnRoom",1,"RejectedWait")
		UTIF A 0 A_JumpIfInventory("Utility_Percent",100,"Done.StepStraight3")
		UTIF A 0 Radius_Quake(1,4,0,1,0)
		UTIF A 0 A_SpawnItemEx("Utility_StepMarker",64,0,-12,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("Utility_StepMarker",96,0,-12,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("Utility_StepMarker",128,0,-12,0,0,0,0,32,0)
		UTIF A 10 BRIGHT A_GiveInventory("Utility_Percent",35)
		UTIG A 15
		UTIF A 0 A_Refire
		Goto EndFire
	Done.StepStraight3:
		UTIF A 0 A_SpawnItemEx("Utility_StepMarker",64,0,-12,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("Utility_StepMarker",96,0,-12,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("Utility_StepMarker",128,0,-12,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("Step",64,0,-12,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("Step",96,0,-12,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("Step",128,0,-12,0,0,0,0,32,0)
		UTIG A 0 A_StopSoundEx("Weapon")
		UTIG A 35 BRIGHT Radius_Quake(1,4,0,1,0)
		UTIG A 35 A_TakeInventory("Utility_Percent",100)
		UTIF A 0 A_Refire
		Goto EndFire
	// MINIREF
	Create.MiniRef:
		TNT1 A 0 A_JumpIfInventory("IsInSpawnRoom",1,"RejectedWait")
		UTIF A 0 A_JumpIfInventory("Utility_Percent",100,"Done.MiniRef")
		UTIF A 0 Radius_Quake(1,4,0,1,0)
		UTIF A 0 A_SpawnItemEx("Utility_MiniRefCacheMarker",128,0,0,0,0,0,0,32,0)
		UTIF A 10 BRIGHT A_GiveInventory("Utility_Percent",1)
		UTIG A 15
		UTIF A 0 A_Refire
		Goto EndFire
	Done.MiniRef:
		UTIF A 0 A_JumpIfInventory ("IsBlue", 1, "Done.MiniRefBlue")
		UTIF A 0 A_JumpIf(ACS_ExecuteWithResult(346,3,0,0) == 0, "Limit")
		UTIF A 0 A_JumpIf(ACS_ExecuteWithResult(695,2,0,0) == 0, "EndFire2")
		UTIF A 0 ACS_ExecuteAlways(344, 0, 3, 0, 0)
		UTIF A 0 A_SpawnItemEx ("Utility_MiniRefCacheMarker",128,0,0,0,0,0,0,32)
		UTIF A 0 A_SpawnItemEx ("Utility_MiniRefCacheRed",128)
		UTIG A 0 A_StopSoundEx ("Weapon")
		UTIG A 35 BRIGHT Radius_Quake(1,4,0,1,0)
		UTIG A 35 A_TakeInventory("Utility_Percent",100)
		UTIF A 0 A_Refire
		Goto EndFire
	Done.MiniRefBlue:
		UTIF A 0 A_JumpIf(ACS_ExecuteWithResult(346,3,1,0) == 0, "Limit")
		UTIF A 0 A_JumpIf(ACS_ExecuteWithResult(695,2,0,0) == 0, "EndFire2")
		UTIF A 0 ACS_ExecuteAlways(344, 0, 3, 0, 0)
		UTIF A 0 A_SpawnItemEx("Utility_MiniRefCacheMarker",128,0,0,0,0,0,0,32)
		UTIF A 0 A_SpawnItemEx("Utility_MiniRefCacheBlue",128)
		UTIG A 0 A_StopSoundEx("Weapon")
		UTIG A 35 BRIGHT Radius_Quake(1,4,0,1,0)
		UTIG A 35 A_TakeInventory("Utility_Percent",100)
		UTIF A 0 A_Refire
		Goto EndFire
	// HEALTH REGENERATOR
	Create.Regen:
		TNT1 A 0 A_JumpIfInventory("IsInSpawnRoom",1,"RejectedWait")
		UTIF A 0 A_JumpIfInventory("Utility_Percent",100,"Done.Regen")
		UTIF A 0 Radius_Quake(1,4,0,1,0)
		UTIF A 0 A_SpawnItemEx("Utility_CacheMarker",96,0,0,0,0,0,0,32,0)
		UTIF A 10 BRIGHT A_GiveInventory("Utility_Percent",1)
		UTIG A 15
		UTIF A 0 A_Refire
		Goto EndFire
	Done.Regen:
		UTIF A 0 A_JumpIfInventory ("IsBlue", 1, "Done.RegenBlue")
		UTIF A 0 A_JumpIf(ACS_ExecuteWithResult(346,4,0,0) == 0, "Limit")
		UTIF A 0 A_JumpIf(ACS_ExecuteWithResult(695,7,0,0) == 0, "EndFire2")
		RPBL B 0 ACS_ExecuteAlways(344,0,6,1,0)
		UTIF A 0 A_SpawnItemEx("Utility_CacheMarker",96,0,0,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("Utility_GlobalMedicCacheRed",96,0,0,0,0,0,0,0,0)
		UTIG A 0 A_StopSoundEx("Weapon")
		UTIG A 35 BRIGHT Radius_Quake(1,4,0,1,0)
		UTIG A 35 A_TakeInventory("Utility_Percent",100)
		UTIF A 0 A_Refire
		Goto EndFire
	Done.RegenBlue:
		UTIF A 0 A_JumpIf(ACS_ExecuteWithResult(346,4,1,0) == 0, "Limit")
		UTIF A 0 A_JumpIf(ACS_ExecuteWithResult(695,7,0,0) == 0, "EndFire2")
		RPBL B 0 ACS_ExecuteAlways(344,0,6,1,0)
		UTIF A 0 A_SpawnItemEx("Utility_CacheMarker",96,0,0,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("Utility_GlobalMedicCacheBlue",96,0,0,0,0,0,0,0,0)
		UTIG A 0 A_StopSoundEx("Weapon")
		UTIG A 35 BRIGHT Radius_Quake(1,4,0,1,0)
		UTIG A 35 A_TakeInventory("Utility_Percent",100)
		UTIF A 0 A_Refire
		Goto EndFire
	// AMMO REGENERATOR
	Create.RegenAmmo:
		TNT1 A 0 A_JumpIfInventory("IsInSpawnRoom",1,"RejectedWait")
		UTIF A 0 A_JumpIfInventory("Utility_Percent",100,"Done.RegenAmmo")
		UTIF A 0 Radius_Quake(1,4,0,1,0)
		UTIF A 0 A_SpawnItemEx("Utility_CacheMarker",96,0,0,0,0,0,0,32,0)
		UTIF A 10 BRIGHT A_GiveInventory("Utility_Percent",1)
		UTIG A 15
		UTIF A 0 A_Refire
		Goto EndFire
	Done.RegenAmmo:
		UTIF A 0 A_JumpIfInventory ("IsBlue", 1, "Done.RegenAmmoBlue")
		UTIF A 0 A_JumpIf(ACS_ExecuteWithResult(346,6,0,0) == 0, "Limit")
		UTIF A 0 A_JumpIf(ACS_ExecuteWithResult(695,7,0,0) == 0, "EndFire2")
		RPBL B 0 ACS_ExecuteAlways(344,0,8,1,0)
		UTIF A 0 A_SpawnItemEx("Utility_CacheMarker",96,0,0,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("Utility_GlobalAmmoCacheRed",96,0,0,0,0,0,0,0,0)
		UTIG A 0 A_StopSoundEx("Weapon")
		UTIG A 35 BRIGHT Radius_Quake(1,4,0,1,0)
		UTIG A 35 A_TakeInventory("Utility_Percent",100)
		UTIF A 0 A_Refire
		Goto EndFire
	Done.RegenAmmoBlue:
		UTIF A 0 A_JumpIf(ACS_ExecuteWithResult(346,6,1,0) == 0, "Limit")
		UTIF A 0 A_JumpIf(ACS_ExecuteWithResult(695,7,0,0) == 0, "EndFire2")
		RPBL B 0 ACS_ExecuteAlways(344,0,8,1,0)
		UTIF A 0 A_SpawnItemEx("Utility_CacheMarker",96,0,0,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("Utility_GlobalAmmoCacheBlue",96,0,0,0,0,0,0,0,0)
		UTIG A 0 A_StopSoundEx("Weapon")
		UTIG A 35 BRIGHT Radius_Quake(1,4,0,1,0)
		UTIG A 35 A_TakeInventory("Utility_Percent",100)
		UTIF A 0 A_Refire
		Goto EndFire
	// MINES
	Create.Mines:
		TNT1 A 0 A_JumpIfInventory("IsInSpawnRoom",1,"RejectedWait")
		UTIF A 0 A_JumpIfInventory("Utility_Percent",100,"Done.Mines")
		UTIF A 0 Radius_Quake(1,4,0,1,0)
		UTIF A 0 A_SpawnItemEx("Utility_MinesMarker",64,0,0,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("Utility_MinesMarker",96,0,0,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("Utility_MinesMarker",128,0,0,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("Utility_MinesMarker",96,-32,0,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("Utility_MinesMarker",96,32,0,0,0,0,0,32,0)
		UTIF A 10 BRIGHT A_GiveInventory("Utility_Percent",10)
		UTIG A 15
		UTIF A 0 A_Refire
		Goto EndFire
	Done.Mines:
		UTIF A 0 A_JumpIfInventory ("IsBlue", 1, "Done.MinesBlue")
		UTIF A 0 A_JumpIf(ACS_ExecuteWithResult(346,2,0,0) == 0, "Limit")
		UTIF A 0 A_JumpIf(ACS_ExecuteWithResult(695,4,0,0) == 0, "EndFire2")
		RPBL B 0 ACS_ExecuteAlways(344,0,5,0,0)
		UTIF A 0 A_SpawnItemEx("Utility_MinesMarker",64,0,0,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("Utility_MinesMarker",96,0,0,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("Utility_MinesMarker",128,0,0,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("Utility_MinesMarker",96,-32,0,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("Utility_MinesMarker",96,32,0,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("ProxyMineRed", 64,0,0, 0,0,0, 0, SXF_SETMASTER|SXF_NOCHECKPOSITION)
		UTIF A 0 A_SpawnItemEx("ProxyMineRed", 96,0,0, 0,0,0, 0, SXF_SETMASTER|SXF_NOCHECKPOSITION)
		UTIF A 0 A_SpawnItemEx("ProxyMineRed", 128,0,0, 0,0,0, 0, SXF_SETMASTER|SXF_NOCHECKPOSITION)
		UTIF A 0 A_SpawnItemEx("ProxyMineRed", 96,-32,0, 0,0,0, 0, SXF_SETMASTER|SXF_NOCHECKPOSITION)
		UTIF A 0 A_SpawnItemEx("ProxyMineRed", 96,32,0, 0,0,0, 0, SXF_SETMASTER|SXF_NOCHECKPOSITION)
		UTIG A 0 A_StopSoundEx("Weapon")
		UTIG A 35 BRIGHT Radius_Quake(1,4,0,1,0)
		UTIG A 35 A_TakeInventory("Utility_Percent",100)
		UTIF A 0 A_Refire
		Goto EndFire
	Done.MinesBlue:
		UTIF A 0 A_JumpIf(ACS_ExecuteWithResult(346,2,1,0) == 0, "Limit")
		UTIF A 0 A_JumpIf(ACS_ExecuteWithResult(695,4,0,0) == 0, "EndFire2")
		RPBL B 0 ACS_ExecuteAlways(344,0,5,0,0)
		UTIF A 0 A_SpawnItemEx("Utility_MinesMarker",64,0,0,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("Utility_MinesMarker",96,0,0,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("Utility_MinesMarker",128,0,0,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("Utility_MinesMarker",96,-32,0,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("Utility_MinesMarker",96,32,0,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("ProxyMineBlue", 64,0,0, 0,0,0, 0, SXF_SETMASTER|SXF_NOCHECKPOSITION)
		UTIF A 0 A_SpawnItemEx("ProxyMineBlue", 96,0,0, 0,0,0, 0, SXF_SETMASTER|SXF_NOCHECKPOSITION)
		UTIF A 0 A_SpawnItemEx("ProxyMineBlue", 128,0,0, 0,0,0, 0, SXF_SETMASTER|SXF_NOCHECKPOSITION)
		UTIF A 0 A_SpawnItemEx("ProxyMineBlue", 96,-32,0, 0,0,0, 0, SXF_SETMASTER|SXF_NOCHECKPOSITION)
		UTIF A 0 A_SpawnItemEx("ProxyMineBlue", 96,32,0, 0,0,0, 0, SXF_SETMASTER|SXF_NOCHECKPOSITION)
		UTIG A 0 A_StopSoundEx("Weapon")
		UTIG A 35 BRIGHT Radius_Quake(1,4,0,1,0)
		UTIG A 35 A_TakeInventory("Utility_Percent",100)
		UTIF A 0 A_Refire
		Goto EndFire
	// REPAIR TURRET
	Create.RepairTurret:
		TNT1 A 0 A_JumpIfInventory("UtilityOutOfRange",1,"RejectedWait")
		TNT1 A 0 A_JumpIfInventory("IsInSpawnRoom",1,"RejectedWait")
		TNT1 A 0 A_JumpIf (ACS_ExecuteWithResult (971, 0) == 1, "RejectedWait")
		TNT1 A 0 A_JumpIfInventory("HasClass",1,1)
		goto Ready
		UTIF A 0 A_JumpIfInventory("Utility_Percent",100,"Done.RepairTurret")
		UTIF A 0 Radius_Quake(1,4,0,1,0)
		UTIF A 0 A_SpawnItemEx("Utility_TurretMarker",96,0,0,0,0,0,0,32,0)
		UTIF A 10 BRIGHT A_GiveInventory("Utility_Percent", 5)
		UTIG A 15
		UTIF A 0 A_Refire
		Goto EndFire
	Done.RepairTurret:
		UTIF A 0 A_JumpIfInventory ("IsBlue", 1, "Done.RepairTurretBlue")
		UTIF A 0 A_JumpIf(ACS_ExecuteWithResult(346,0,0,0) == 0, "Limit")
		UTIF A 0 A_JumpIf(ACS_ExecuteWithResult(695,5,0,0) == 0, "EndFire2")
		RPBL B 0 ACS_ExecuteAlways(344,0,4,0,0)
		UTIF A 0 A_SpawnItemEx("Utility_TurretMarker",96,0,0,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("Utility_RepairGunTurretRed",96,0,0,0,0,0,0,32,0)
		UTIG A 0 A_StopSoundEx("Weapon")
		UTIG A 35 BRIGHT Radius_Quake(1,4,0,1,0)
		UTIG A 35 A_TakeInventory("Utility_Percent",100)
		UTIF A 0 A_Refire
		Goto EndFire
	Done.RepairTurretBlue:
		UTIF A 0 A_JumpIf(ACS_ExecuteWithResult(346,0,1,0) == 0, "Limit")
		UTIF A 0 A_JumpIf(ACS_ExecuteWithResult(695,5,0,0) == 0, "EndFire2")
		RPBL B 0 ACS_ExecuteAlways(344,0,4,0,0)
		UTIF A 0 A_SpawnItemEx("Utility_TurretMarker",96,0,0,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("Utility_RepairGunTurretBlue",96,0,0,0,0,0,0,32,0)
		UTIG A 0 A_StopSoundEx("Weapon")
		UTIG A 35 BRIGHT Radius_Quake(1,4,0,1,0)
		UTIG A 35 A_TakeInventory("Utility_Percent",100)
		UTIF A 0 A_Refire
		Goto EndFire
	// KLAXON TURRET
	Create.KlaxonTurret:
		TNT1 A 0 A_JumpIfInventory("UtilityOutOfRange",1,"RejectedWait")
		TNT1 A 0 A_JumpIf (ACS_ExecuteWithResult (971, 0) == 1, "RejectedWait")
		TNT1 A 0 A_JumpIfInventory("IsInSpawnRoom",1,"RejectedWait")
		UTIF A 0 A_JumpIfInventory("Utility_Percent",100,"Done.KlaxonTurret")
		UTIF A 0 Radius_Quake(1,4,0,1,0)
		UTIF A 0 A_SpawnItemEx("Utility_TurretMarker",96,0,0,0,0,0,0,32,0)
		UTIF A 10 BRIGHT A_GiveInventory("Utility_Percent", 5)
		UTIG A 15
		UTIF A 0 A_Refire
		Goto EndFire
	Done.KlaxonTurret:
		UTIF A 0 A_JumpIfInventory ("IsBlue", 1, "Done.KlaxonTurretBlue")
		UTIF A 0 A_JumpIf(ACS_ExecuteWithResult(346,0,0,0) == 0, "Limit")
		UTIF A 0 A_JumpIf(ACS_ExecuteWithResult(695,6,0,0) == 0, "EndFire2")
		RPBL B 0 ACS_ExecuteAlways(344,0,4,0,0)
		UTIF A 0 A_SpawnItemEx("Utility_TurretMarker",96,0,0,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("Utility_KlaxonRed",96,0,0,0,0,0,0,32,0)
		UTIG A 0 A_StopSoundEx("Weapon")
		UTIG A 35 BRIGHT Radius_Quake(1,4,0,1,0)
		UTIG A 35 A_TakeInventory("Utility_Percent",100)
		UTIF A 0 A_Refire
		Goto EndFire
	Done.KlaxonTurretBlue:
		UTIF A 0 A_JumpIf(ACS_ExecuteWithResult(346,0,1,0) == 0, "Limit")
		UTIF A 0 A_JumpIf(ACS_ExecuteWithResult(695,6,0,0) == 0, "EndFire2")
		RPBL B 0 ACS_ExecuteAlways(344,0,4,0,0)
		UTIF A 0 A_SpawnItemEx("Utility_TurretMarker",96,0,0,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("Utility_KlaxonBlue",96,0,0,0,0,0,0,32,0)
		UTIG A 0 A_StopSoundEx("Weapon")
		UTIG A 35 BRIGHT Radius_Quake(1,4,0,1,0)
		UTIG A 35 A_TakeInventory("Utility_Percent",100)
		UTIF A 0 A_Refire
		Goto EndFire
	// FIREPROOF
	Create.FireProof:
		UTIF A 0 A_JumpIfInventory("Utility_Percent",100,"Done.FireProof")
		UTIF A 0 Radius_Quake(1,4,0,1,0)
		UTIF A 0 A_SpawnItemEx("Utility_ArmourMarker",64,0,32,0,0,0,0,32,0)
		UTIF A 10 BRIGHT A_GiveInventory("Utility_Percent",4)
		UTIG A 15
		UTIF A 0 A_Refire
		Goto EndFire
	Done.FireProof:
		UTIF A 0 A_JumpIf(ACS_ExecuteWithResult(695,6,0,0) == 0, "EndFire2")
		UTIF A 0 A_SpawnItemEx("Utility_ArmourMarker",64,0,32,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("FireArmor", 64,0,32)
		UTIG A 0 A_StopSoundEx("Weapon")
		UTIG A 35 BRIGHT Radius_Quake(1,4,0,1,0)
		UTIG A 35 A_TakeInventory("Utility_Percent",100)
		UTIF A 0 A_Refire
		Goto EndFire
	// CHEMPROOF
	Create.ChemProof:
		UTIF A 0 A_JumpIfInventory("Utility_Percent",100,"Done.ChemProof")
		UTIF A 0 Radius_Quake(1,4,0,1,0)
		UTIF A 0 A_SpawnItemEx("Utility_ArmourMarker",64,0,32,0,0,0,0,32,0)
		UTIF A 10 BRIGHT A_GiveInventory("Utility_Percent",4)
		UTIG A 15
		UTIF A 0 A_Refire
		Goto EndFire
	Done.ChemProof:
		UTIF A 0 A_JumpIf(ACS_ExecuteWithResult(695,6,0,0) == 0, "EndFire2")
		UTIF A 0 A_SpawnItemEx("Utility_ArmourMarker",64,0,32,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("ChemicalArmor", 64,0,32)
		UTIG A 0 A_StopSoundEx("Weapon")
		UTIG A 35 BRIGHT Radius_Quake(1,4,0,1,0)
		UTIG A 35 A_TakeInventory("Utility_Percent",100)
		UTIF A 0 A_Refire
		Goto EndFire
	// RAVEN
	Create.RavenMech:
		TNT1 A 0 A_JumpIfInventory("IsInSpawnRoom",1,"RejectedWait")
		UTIF A 0 A_JumpIfInventory("Utility_Percent",100,"Done.RavenMech")
		UTIF A 0 Radius_Quake(1,4,0,1,0)
		UTIF A 0 A_SpawnItemEx("Utility_RavenMarker",128,0,0,0,0,0,0,32,0)
		UTIF A 10 BRIGHT A_GiveInventory("Utility_Percent",2)
		UTIG A 15
		UTIF A 0 A_Refire
		Goto EndFire
	Done.RavenMech:
		UTIF A 0 A_JumpIf(ACS_ExecuteWithResult(695,8,0,0) == 0, "EndFire2")
		UTIF A 0 A_SpawnItemEx("Utility_RavenMarker",128,0,0,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("Utility_Raven",128,0,0,0,0,0,0,32,0)
		UTIG A 0 A_StopSoundEx("Weapon")
		UTIG A 35 BRIGHT Radius_Quake(1,4,0,1,0)
		UTIG A 35 A_TakeInventory("Utility_Percent",100)
		UTIF A 0 A_Refire
		Goto EndFire
	// WOLVERINE
	Create.WolfMech:
		TNT1 A 0 A_JumpIfInventory("IsInSpawnRoom",1,"RejectedWait")
		UTIF A 0 A_JumpIfInventory("Utility_Percent",100,"Done.WolfMech")
		UTIF A 0 Radius_Quake(1,4,0,1,0)
		UTIF A 0 A_SpawnItemEx("Utility_WolfMarker",128,0,0,0,0,0,0,32,0)
		UTIF A 10 BRIGHT A_GiveInventory("Utility_Percent",2)
		UTIG A 15
		UTIF A 0 A_Refire
		Goto EndFire
	Done.WolfMech:
		UTIF A 0 A_JumpIf(ACS_ExecuteWithResult(695,11,0,0) == 0, "EndFire2")
		UTIF A 0 A_SpawnItemEx("Utility_WolfMarker",128,0,0,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("Utility_Wolverine",128,0,0,0,0,0,0,32,0)
		UTIG A 0 A_StopSoundEx("Weapon")
		UTIG A 35 BRIGHT Radius_Quake(1,4,0,1,0)
		UTIG A 35 A_TakeInventory("Utility_Percent",100)
		UTIF A 0 A_Refire
		Goto EndFire
	// RIFLE/PRECISION TURRET
	Create.PrecisionTurret:
		TNT1 A 0 A_JumpIfInventory("IsInSpawnRoom",1,"RejectedWait")
		TNT1 A 0 A_JumpIfInventory("UtilityOutOfRange",1,"RejectedWait")
		TNT1 A 0 A_JumpIf (ACS_ExecuteWithResult (971, 0) == 1, "RejectedWait")
		UTIF A 0 A_JumpIfInventory("Utility_Percent",100,"Done.PrecisionTurret")
		UTIF A 0 Radius_Quake(1,4,0,1,0)
		UTIF A 0 A_SpawnItemEx("Utility_TurretMarker",96,0,0,0,0,0,0,32,0)
		UTIF A 10 BRIGHT A_GiveInventory("Utility_Percent", 5)
		UTIG A 15
		UTIF A 0 A_Refire
		Goto EndFire
	Done.PrecisionTurret:
		UTIF A 0 A_JumpIfInventory ("IsBlue", 1, "Done.PrecisionTurretBlue")
		UTIF A 0 A_JumpIf(ACS_ExecuteWithResult(346,0,0,0) == 0, "Limit")
		UTIF A 0 A_JumpIf(ACS_ExecuteWithResult(695,5,0,0) == 0, "EndFire2")
		RPBL B 0 ACS_ExecuteAlways(344,0,4,0,0)
		UTIF A 0 A_SpawnItemEx("Utility_TurretMarker",96,0,0,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("Utility_PrecisionTurretRed",96,0,0,0,0,0,0,32,0)
		UTIG A 0 A_StopSoundEx("Weapon")
		UTIG A 35 BRIGHT Radius_Quake(1,4,0,1,0)
		UTIG A 35 A_TakeInventory("Utility_Percent",100)
		UTIF A 0 A_Refire
		Goto EndFire
	Done.PrecisionTurretBlue:
		UTIF A 0 A_JumpIf(ACS_ExecuteWithResult(346,0,1,0) == 0, "Limit")
		UTIF A 0 A_JumpIf(ACS_ExecuteWithResult(695,5,0,0) == 0, "EndFire2")
		RPBL B 0 ACS_ExecuteAlways(344,0,4,0,0)
		UTIF A 0 A_SpawnItemEx("Utility_TurretMarker",96,0,0,0,0,0,0,32,0)
		UTIG A 0 A_SpawnItemEx("Utility_PrecisionTurretBlue",96,0,0,0,0,0,0,32,0)
		UTIG A 0 A_StopSoundEx("Weapon")
		UTIG A 35 BRIGHT Radius_Quake(1,4,0,1,0)
		UTIG A 35 A_TakeInventory("Utility_Percent",100)
		UTIF A 0 A_Refire
		Goto EndFire
	// ANNOYING NOSY EVERYWHERE FOLLOWING BIRDIE
	Create.MiniRaven:
		TNT1 A 0 A_JumpIfInventory("IsInSpawnRoom",1,"RejectedWait")
		TNT1 A 0 A_JumpIfInventory("UtilityOutOfRange",1,"RejectedWait")
		UTIF A 0 A_JumpIfInventory("Utility_Percent",100,"Done.MiniRaven")
		UTIF A 0 Radius_Quake(1,4,0,1,0)
		UTIF A 0 A_SpawnItemEx("Utility_MiniRavenMarker",96,0,0,0,0,0,0,32,0)
		UTIF A 10 BRIGHT A_GiveInventory("Utility_Percent",3)
		UTIG A 15
		UTIF A 0 A_Refire
		Goto EndFire
	Done.MiniRaven:
		UTIF A 0 A_JumpIfInventory ("IsBlue", 1, "Done.MiniRavenBlue")
		UTIF A 0 A_JumpIf(ACS_ExecuteWithResult(346,5,0,0) == 0, "Limit")
		UTIF A 0 A_JumpIf(ACS_ExecuteWithResult(695,9,0,0) == 0, "EndFire2")
		RPBL B 0 ACS_ExecuteAlways(344,0,7,0,0)
		UTIF A 0 A_SpawnItemEx("Utility_MiniRavenMarker",96,0,0,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("Utility_MiniRavenRed",96,0,0,0,0,0,0,32,0)
		UTIG A 0 A_StopSoundEx("Weapon")
		UTIG A 35 BRIGHT Radius_Quake(1,4,0,1,0)
		UTIG A 35 A_TakeInventory("Utility_Percent",100)
		UTIF A 0 A_Refire
		Goto EndFire
	Done.MiniRavenBlue:
		UTIF A 0 A_JumpIf(ACS_ExecuteWithResult(346,5,1,0) == 0, "Limit")
		UTIF A 0 A_JumpIf(ACS_ExecuteWithResult(695,9,0,0) == 0, "EndFire2")
		RPBL B 0 ACS_ExecuteAlways(344,0,7,0,0)
		UTIF A 0 A_SpawnItemEx("Utility_MiniRavenMarker",96,0,0,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("Utility_MiniRavenBlue",96,0,0,0,0,0,0,32,0)
		UTIG A 0 A_StopSoundEx("Weapon")
		UTIG A 35 BRIGHT Radius_Quake(1,4,0,1,0)
		UTIG A 35 A_TakeInventory("Utility_Percent",100)
		UTIF A 0 A_Refire
		Goto EndFire
	Create.ArtilleryTurret:
		TNT1 A 0 A_JumpIfInventory("IsInSpawnRoom",1,"RejectedWait")
		TNT1 A 0 A_JumpIfInventory("UtilityOutOfRange",1,"RejectedWait")
		TNT1 A 0 A_JumpIf (ACS_ExecuteWithResult (971, 0) == 1, "RejectedWait")
		UTIF A 0 A_JumpIfInventory("Utility_Percent",100,"Done.ArtilleryTurret")
		UTIF A 0 Radius_Quake(1,4,0,1,0)
		UTIF A 0 A_SpawnItemEx("Utility_ArtilleryTurretMarker",96,0,0,0,0,0,0,32,0)
		UTIF A 10 BRIGHT A_GiveInventory("Utility_Percent", 3)
		UTIG A 15
		UTIF A 0 A_Refire
		Goto EndFire
	Done.ArtilleryTurret:
		UTIF A 0 A_JumpIfInventory ("IsBlue", 1, "Done.ArtilleryTurretBlue")
		UTIF A 0 A_JumpIf(ACS_ExecuteWithResult(346,0,0,0) == 0, "Limit")
		UTIF A 0 A_JumpIf(ACS_ExecuteWithResult(695,10,0,0) == 0, "EndFire2")
		RPBL B 0 ACS_ExecuteAlways(344,0,9,0,0)
		UTIF A 0 A_SpawnItemEx("Utility_ArtilleryTurretMarker",96,0,0,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("Utility_ArtilleryTurretRed",96,0,0,0,0,0,0,32,0)
		UTIG A 0 A_StopSoundEx("Weapon")
		UTIG A 35 BRIGHT Radius_Quake(1,4,0,1,0)
		UTIG A 35 A_TakeInventory("Utility_Percent",100)
		UTIF A 0 A_Refire
		Goto EndFire
	Done.ArtilleryTurretBlue:
		UTIF A 0 A_JumpIf(ACS_ExecuteWithResult(346,0,1,0) == 0, "Limit")
		UTIF A 0 A_JumpIf(ACS_ExecuteWithResult(695,10,0,0) == 0, "EndFire2")
		RPBL B 0 ACS_ExecuteAlways(344,0,9,0,0)
		UTIF A 0 A_SpawnItemEx("Utility_ArtilleryTurretMarker",96,0,0,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("Utility_ArtilleryTurretBlue",96,0,0,0,0,0,0,32,0)
		UTIG A 0 A_StopSoundEx("Weapon")
		UTIG A 35 BRIGHT Radius_Quake(1,4,0,1,0)
		UTIG A 35 A_TakeInventory("Utility_Percent",100)
		UTIF A 0 A_Refire
		Goto EndFire
	Create.FlameTurret:
		TNT1 A 0 A_JumpIfInventory("IsInSpawnRoom",1,"RejectedWait")
		TNT1 A 0 A_JumpIfInventory("UtilityOutOfRange",1,"RejectedWait")
		TNT1 A 0 A_JumpIf (ACS_ExecuteWithResult (971, 0) == 1, "RejectedWait")
		UTIF A 0 A_JumpIfInventory("Utility_Percent",100,"Done.FlameTurret")
		UTIF A 0 Radius_Quake(1,4,0,1,0)
		UTIF A 0 A_SpawnItemEx("Utility_FlameTurretMarker",96,0,0,0,0,0,0,32,0)
		UTIF A 10 BRIGHT A_GiveInventory("Utility_Percent", 3)
		UTIG A 15
		UTIF A 0 A_Refire
		Goto EndFire
	Done.FlameTurret:
		UTIF A 0 A_JumpIfInventory ("IsBlue", 1, "Done.FlameTurretBlue")
		UTIF A 0 A_JumpIf(ACS_ExecuteWithResult(346,0,0,0) == 0, "Limit")
		UTIF A 0 A_JumpIf(ACS_ExecuteWithResult(695,12,0,0) == 0, "EndFire2")
		RPBL B 0 ACS_ExecuteAlways(344,0,10,0,0)
		UTIF A 0 A_SpawnItemEx("Utility_FlameTurretMarker",96,0,0,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("Utility_FlameTurretRed",96,0,0,0,0,0,0,32,0)
		UTIG A 0 A_StopSoundEx("Weapon")
		UTIG A 35 BRIGHT Radius_Quake(1,4,0,1,0)
		UTIG A 35 A_TakeInventory("Utility_Percent",100)
		UTIF A 0 A_Refire
		Goto EndFire
	Done.FlameTurretBlue:
		UTIF A 0 A_JumpIf(ACS_ExecuteWithResult(346,0,1,0) == 0, "Limit")
		UTIF A 0 A_JumpIf(ACS_ExecuteWithResult(695,12,0,0) == 0, "EndFire2")
		RPBL B 0 ACS_ExecuteAlways(344,0,10,0,0)
		UTIF A 0 A_SpawnItemEx("Utility_ChemTurretMarker",96,0,0,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("Utility_FlameTurretBlue",96,0,0,0,0,0,0,32,0)
		UTIG A 0 A_StopSoundEx("Weapon")
		UTIG A 35 BRIGHT Radius_Quake(1,4,0,1,0)
		UTIG A 35 A_TakeInventory("Utility_Percent",100)
		UTIF A 0 A_Refire
		Goto EndFire
		
	Create.ChemTurret:
		TNT1 A 0 A_JumpIfInventory("IsInSpawnRoom",1,"RejectedWait")
		TNT1 A 0 A_JumpIfInventory("UtilityOutOfRange",1,"RejectedWait")
		TNT1 A 0 A_JumpIf (ACS_ExecuteWithResult (971, 0) == 1, "RejectedWait")
		UTIF A 0 A_JumpIfInventory("Utility_Percent",100,"Done.ChemTurret")
		UTIF A 0 Radius_Quake(1,4,0,1,0)
		UTIF A 0 A_SpawnItemEx("Utility_ChemTurretMarker",96,0,0,0,0,0,0,32,0)
		UTIF A 10 BRIGHT A_GiveInventory("Utility_Percent", 3)
		UTIG A 15
		UTIF A 0 A_Refire
		Goto EndFire
	Done.ChemTurret:
		UTIF A 0 A_JumpIfInventory ("IsBlue", 1, "Done.ChemTurretBlue")
		UTIF A 0 A_JumpIf(ACS_ExecuteWithResult(346,0,0,0) == 0, "Limit")
		UTIF A 0 A_JumpIf(ACS_ExecuteWithResult(695,12,0,0) == 0, "EndFire2")
		RPBL B 0 ACS_ExecuteAlways(344,0,10,0,0)
		UTIF A 0 A_SpawnItemEx("Utility_ChemTurretMarker",96,0,0,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("Utility_ChemTurretRed",96,0,0,0,0,0,0,32,0)
		UTIG A 0 A_StopSoundEx("Weapon")
		UTIG A 35 BRIGHT Radius_Quake(1,4,0,1,0)
		UTIG A 35 A_TakeInventory("Utility_Percent",100)
		UTIF A 0 A_Refire
		Goto EndFire
	Done.ChemTurretBlue:
		UTIF A 0 A_JumpIf(ACS_ExecuteWithResult(346,0,1,0) == 0, "Limit")
		UTIF A 0 A_JumpIf(ACS_ExecuteWithResult(695,12,0,0) == 0, "EndFire2")
		RPBL B 0 ACS_ExecuteAlways(344,0,10,0,0)
		UTIF A 0 A_SpawnItemEx("Utility_ChemTurretMarker",96,0,0,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("Utility_ChemTurretBlue",96,0,0,0,0,0,0,32,0)
		UTIG A 0 A_StopSoundEx("Weapon")
		UTIG A 35 BRIGHT Radius_Quake(1,4,0,1,0)
		UTIG A 35 A_TakeInventory("Utility_Percent",100)
		UTIF A 0 A_Refire
		Goto EndFire	
	
	// POWER GENERATOR
	Create.PowerGenerator:
		TNT1 A 0 A_JumpIfInventory("IsInSpawnRoom",1,"RejectedWait")
		UTIF A 0 A_JumpIfInventory("Utility_Percent",100,"Done.PowerGenerator")
		UTIF A 0 Radius_Quake(1,4,0,1,0)
		UTIF A 0 A_SpawnItemEx("Utility_CacheMarker",96,0,0,0,0,0,0,32,0)
		UTIF A 10 BRIGHT A_GiveInventory("Utility_Percent",1)
		UTIG A 15
		UTIF A 0 A_Refire
		Goto EndFire
	Done.PowerGenerator:
		UTIF A 0 A_JumpIfInventory ("IsBlue", 1, "Done.PowerGeneratorBlue")
		UTIF A 0 A_JumpIf(ACS_ExecuteWithResult(346,20,0,0) == 0, "Limit")
		UTIF A 0 A_JumpIf(ACS_ExecuteWithResult(695,7,0,0) == 0, "EndFire2")
		RPBL B 0 ACS_ExecuteAlways(344,0,20)
		UTIF A 0 A_SpawnItemEx("Utility_CacheMarker",96,0,0,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("Utility_PowerGeneratorRed",96,0,0,0,0,0,0,0,0)
		UTIG A 0 A_StopSoundEx("Weapon")
		UTIG A 35 BRIGHT Radius_Quake(1,4,0,1,0)
		UTIG A 35 A_TakeInventory("Utility_Percent",100)
		UTIF A 0 A_Refire
		Goto EndFire
	Done.PowerGeneratorBlue:
		UTIF A 0 A_JumpIf(ACS_ExecuteWithResult(346,20,1,0) == 0, "Limit")
		UTIF A 0 A_JumpIf(ACS_ExecuteWithResult(695,7,0,0) == 0, "EndFire2")
		RPBL B 0 ACS_ExecuteAlways(344,0,20)
		UTIF A 0 A_SpawnItemEx("Utility_CacheMarker",96,0,0,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("Utility_PowerGeneratorBlue",96,0,0,0,0,0,0,0,0)
		UTIG A 0 A_StopSoundEx("Weapon")
		UTIG A 35 BRIGHT Radius_Quake(1,4,0,1,0)
		UTIG A 35 A_TakeInventory("Utility_Percent",100)
		UTIF A 0 A_Refire
		Goto EndFire
	// PLATFORM
	Create.Platform:
		TNT1 A 0 A_JumpIfInventory("IsInSpawnRoom",1,"RejectedWait")
		UTIF A 0 A_JumpIfInventory ("Utility_Percent", 100, "Done.Platform")
		UTIF A 0 Radius_Quake(1,4,0,1,0)
		UTIF A 0 A_SpawnItemEx("Utility_PlatformMarker",128)
		UTIF A 10 BRIGHT A_GiveInventory("Utility_Percent", 3)
		UTIG A 15
		UTIF A 0 A_Refire
		Goto EndFire
	Done.Platform:
		UTIF A 0 A_JumpIf(ACS_ExecuteWithResult(694,150,0,0) == 0, "EndFire2")
		UTIF A 0 A_SpawnItemEx("Utility_PlatformMarker",128)
		UTIF A 0 A_SpawnItemEx("FloatingPlatform", 128)
		UTIG A 0 A_StopSoundEx("Weapon")
		UTIG A 35 BRIGHT Radius_Quake(1,4,0,1,0)
		UTIG A 35 A_TakeInventory("Utility_Percent",100)
		UTIF A 0 A_Refire
		Goto EndFire
	// PORTAL
	Create.Portal:
		TNT1 A 0 A_JumpIfInventory("IsInSpawnRoom",1,"RejectedWait")
		UTIF A 0 A_JumpIfInventory("Utility_Percent",100,"Done.Portal")
		UTIF A 0 Radius_Quake(1,4,0,1,0)
		UTIF A 0 A_SpawnItemEx("Utility_PortalStandMarker",224,80,0,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("Utility_PortalStandMarker",224,-80,0,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("Utility_PortalSphereMarker",224,80,56,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("Utility_PortalSphereMarker",224,-80,56,0,0,0,0,32,0)
		UTIF A 10 BRIGHT A_GiveInventory("Utility_Percent", 3)
		UTIG A 15
		UTIF A 0 A_Refire
		Goto EndFire
	Done.Portal:
		UTIF A 0 A_JumpIfInventory ("IsBlue", 1, "Done.PortalBlue")
		UTIF A 0 A_JumpIf(ACS_ExecuteWithResult(346,21,1) == 0, "Limit")
		UTIF A 0 A_JumpIf(ACS_ExecuteWithResult(694,250) == 0, "EndFire2")
		UTIF A 2 ACS_ExecuteAlways (SC_TELENODE_INIT, 0)
		UTIF A 0 A_SpawnItemEx("Utility_PortalStandMarker",224,80,0,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("Utility_PortalStandMarker",224,-80,0,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("Utility_PortalSphereMarker",224,80,56,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("Utility_PortalSphereMarker",224,-80,56,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("TeleporterNodeRed",224,0,0,0,0,0,0,32,0)
		UTIG A 0 A_StopSoundEx("Weapon")
		UTIG A 35 BRIGHT Radius_Quake(1,4,0,1,0)
		UTIG A 35 A_TakeInventory("Utility_Percent",100)
		UTIF A 0 A_Refire
		Goto EndFire
	Done.PortalBlue:
		UTIF A 0 A_JumpIf(ACS_ExecuteWithResult(346,21,0) == 0, "Limit")
		UTIF A 0 A_JumpIf(ACS_ExecuteWithResult(694,250) == 0, "EndFire2")
		UTIF A 2 ACS_ExecuteAlways (SC_TELENODE_INIT, 0)
		UTIF A 0 A_SpawnItemEx("Utility_PortalStandMarker",224,80,0,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("Utility_PortalStandMarker",224,-80,0,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("Utility_PortalSphereMarker",224,80,56,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("Utility_PortalSphereMarker",224,-80,56,0,0,0,0,32,0)
		UTIF A 0 A_SpawnItemEx("TeleporterNodeBlue",224,0,0,0,0,0,0,32,0)
		UTIG A 0 A_StopSoundEx("Weapon")
		UTIG A 35 BRIGHT Radius_Quake(1,4,0,1,0)
		UTIG A 35 A_TakeInventory("Utility_Percent",100)
		UTIF A 0 A_Refire
		Goto EndFire
	/*Create.Barrel:
		TNT1 A 0 A_JumpIfInventory("IsInSpawnRoom",1,"Ready")
		goto Ready
		UTIF A 0 A_JumpIfInventory ("Utility_Percent", 100, "Done.Barrel")
		UTIF A 0 Radius_Quake (1 ,4 ,0, 1, 0)
		UTIF A 0 A_SpawnItemEx ("Utility_BarrelMarker", 96,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION)
		UTIF A 10 BRIGHT A_GiveInventory("Utility_Percent", 8)
		UTIG A 15
		UTIF A 0 A_Refire
		Goto EndFire
	Done.Barrel:
		UTIF A 0 A_SpawnItemEx ("Utility_BarrelMarker", 96,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION)
		UTIF A 0 A_SpawnItemEx ("Utility_Barrel", 96)
		UTIG A 0 A_StopSound (CHAN_WEAPON)
		UTIG A 35 BRIGHT Radius_Quake (1, 4, 0, 1, 0)
		UTIG A 35 A_TakeInventory ("Utility_Percent", 100)
		UTIF A 0 A_Refire
		Goto EndFire*/
	EndFire:
		UTIG A 15 A_StopSoundEx("Weapon")
		Goto Ready
	EndFire2:
		UTIG A 0 ACS_ExecuteAlways(347, 0, 1)
		UTIG A 35 A_StopSoundEx("Weapon")
		Goto Ready
	Limit:
		UTIG A 35 ACS_ExecuteAlways(347, 0)
		goto EndFire
	AltFire:
		UTIG A 0 A_JumpIfInventory ("InMenu", 1, "AltRejected")
		UTIG A 4
		UTIG A 0 ACS_ExecuteAlways (970, 0, MENU_UTIL)
		UTIG A 35
		goto Ready
	AltRejected:
		// This should happen if the player is coming out of the util menu
		// Therefore, longer delay to avoid altfire activating again to
		// throw the player back to the menu
		UTIG A 10
		UTIG A 0 ACS_ExecuteAlways (980, 0)
		UTIG A 20 A_WeaponReady (WRF_NOSECONDARY)
		goto Ready
	}
}

actor Utility_Percent : Ammo {
	inventory.amount 0
	inventory.maxamount 100
	Ammo.BackpackAmount 0
	Ammo.BackpackMaxAmount 0
}

// This actor is used to clear places like War Factory hanger doors, teleport
// destinations and the like from utility items
actor AntiUtilityExplosion {
	+NOGRAVITY +NOBLOCKMAP
	+NOINTERACTION +NODAMAGETHRUST
	+BLOODLESSIMPACT
	damagetype "Deconstruction"
	states {
	Spawn:
		TNT1 A 0
		TNT1 A 0 A_Explode (999999, 160)
		stop
	}
}

// [SG] This takes care of garbage like remote C4s 

actor AntiUtilityExplosionDisarm : AntiUtilityExplosion { damagetype "Disarm" }

actor PowerupCacheMapSpawned 21490 {
	states {
	Spawn:
		TNT1 A 0
		stop
	}
}
