//This goes into frenzy_turrets.wad, replacing the DECORATE lump
actor TeslaCoil
{
	obituary "%o was zapped by a tesla coil."
	health 750
	radius 16
	height 56
	mass 10000
	speed 0
	MONSTER
	-ISMONSTER //Makes it spawnable where ever you want it to be spawned
	
	+FLOORCLIP
	+FASTER
	+FRIENDLY
	+NOBLOOD
	+LOOKALLAROUND
	+SHORTMISSILERANGE
	+NEVERRESPAWN
	
	// protect from marine damage
	damagefactor "MarineFire", 0.0
	damageFactor "MarineFire2", 0.0

	//Make spawnable inside monsters
	-SOLID
	
	states
	{
		Spawn:
			TESL A 1 A_Look
			NULL A 0 A_JumpIfHealthLower(300,"Spawn2")
			TESL A 0 A_PlaySoundEx ("Tesla/Loop", "SoundSlot5", 1)
			goto Spawn
		Spawn2:
			NULL A 0 A_SpawnItem("Smoke",0,56)
			TESL A 1 A_Look
			TESL A 0 A_PlaySoundEx ("Tesla/Loop", "SoundSlot5", 1)
			TESL A 1 A_Look
			TESL A 0 A_PlaySoundEx ("Tesla/Loop", "SoundSlot5", 1)
			TESL A 1 A_Look
			TESL A 0 A_PlaySoundEx ("Tesla/Loop", "SoundSlot5", 1)
			TESL A 1 A_Look
			TESL A 0 A_PlaySoundEx ("Tesla/Loop", "SoundSlot5", 1)
			TESL A 1 A_Look
			TESL A 0 A_PlaySoundEx ("Tesla/Loop", "SoundSlot5", 1)
			
			goto Spawn2
		See:
			NULL A 0 A_JumpIfHealthLower(300,"See2")
			TESL AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 1 A_Chase
			TESL A 0 A_PlaySoundEx ("Tesla/Loop", "SoundSlot5", 1)
			goto See
		See2:
			NULL A 0 A_SpawnItem("Smoke",0,56)
			TESL AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 1 A_Chase
			TESL A 0 A_PlaySoundEx ("Tesla/Loop", "SoundSlot5", 1)
			goto See2

		Missile:
			TESL A 9 A_FaceTarget
			TESL A 1 bright
			TESL A 0 bright A_PlaySound ("Tesla/Attack")
			TESL A 0 bright A_SpawnItem ("TeslaZapper", 0, 60)
			TESL A 1 bright
			TESL A 59
			goto See
		Death:
			TESL A 1 bright A_SpawnItemEx ("Boom", 0, 0, 60, 0, 0, 0, 0, 160)
			TESL A 0 bright A_StopSoundEx ("SoundSlot5")
			TESL A 0 bright A_PlaySound ("weapons/rocklx")
                        NULL A 0 A_NoBlocking
			TESL B -1
			stop
	}
}

actor TeslaZapper
{
  obituary "%o was zapped by a tesla coil."
  radius 2
  height 2
  //Decal "CrossbowScorch2"
  +NOGRAVITY
  +LOOKALLAROUND
  +NOCLIP
  +INVULNERABLE
  states
  {
  Spawn:
    TNT1 A 1 A_FaceTarget
  Missile:
    TNT1 AAAAA 0 bright A_CustomRailgun (20, 0, none, lightblue, 1, 0, 1000, "InvisiblePuff")
    TNT1 AAAAA 0 bright A_CustomRailgun (20, 0, none, white, 1, 0, 1000, "InvisiblePuff")
    stop
  }
}

actor Boom
{
  Radius 11
  Height 8
  Speed 0
  Damage 0
  damagetype "MarineFire"
  Projectile
  renderstyle Add
  +NOINTERACTION
  States
  {
  Spawn:
    MISL B 8 bright
    MISL C 6 bright
    MISL D 4 bright
    stop
  }
}

ACTOR TurretBullet
{
	obituary "%o was shot up by a Bullet Turret."
	health 450
	radius 16
	height 56
	mass 10000
	speed 0
	MONSTER
	-ISMONSTER //Makes it spawnable where ever you want it to be spawned
	+FLOORCLIP
	+FRIENDLY
	+FASTER
	+NOBLOOD
	+LOOKALLAROUND
	+SHORTMISSILERANGE
	+NEVERRESPAWN
	PainSound "turret/pain"
	
	// protect from marine damage
	damagefactor "MarineFire", 0.0
	damageFactor "MarineFire2", 0.0

	//Make spawnable inside monsters
	-SOLID
	
	states
	{
		Spawn:
			TRT2 A 1 A_Look
			NULL A 0 A_JumpIfHealthLower(300,"Spawn2")
			TRT2 A 10  A_PlaySound("turret/active", CHAN_AUTO, 6)
			goto Spawn
		Spawn2:
			NULL A 0 A_SpawnItem("Smoke",0,56)
			TESL A 1 A_Look
			TESL A 0 A_PlaySoundEx ("Tesla/Loop", "SoundSlot5", 1)
			TESL A 1 A_Look
			TESL A 0 A_PlaySoundEx ("Tesla/Loop", "SoundSlot5", 1)
			TESL A 1 A_Look
			TESL A 0 A_PlaySoundEx ("Tesla/Loop", "SoundSlot5", 1)
			TESL A 1 A_Look
			TESL A 0 A_PlaySoundEx ("Tesla/Loop", "SoundSlot5", 1)
			TESL A 1 A_Look
			TESL A 0 A_PlaySoundEx ("Tesla/Loop", "SoundSlot5", 1)
			
			goto Spawn2

		See:
			NULL A 0 A_JumpIfhealthLower(200,"See2")
			TRT2 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 1 A_Chase
			TRT2 A 5  A_PlaySound("turret/active", CHAN_AUTO, 6)
			goto See
		See2:
			NULL A 0 A_SpawnItem("Smoke",0,56)
			TRT2 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 1 A_Chase
			TRT2 A 5  A_PlaySound("turret/active", CHAN_AUTO, 6)
			goto See2
		Missile:
			TRT2 A 2 A_FaceTarget
			TRT2 A 1 A_PlaySound("turret/sight", CHAN_AUTO)
			TRT2 ABCD 1 bright
			TRT2 E 1 A_CustomBulletAttack (22.5, 0, 1, random(1,5) * 3, "BulletPuffTurret", 0, 2)
			TNT1 A 0 A_PlaySound("weapons/pistol")
			TRT2 D 1 A_CustomMissile("splatBulletCasing", 32, 2, 45+random(-8,8), 0, 3)
			TRT2 E 1 bright A_CustomBulletAttack (22.5, 0, 1, random(1,5) * 3, "BulletPuffTurret", 0, 2)
			TNT1 A 0 A_PlaySound("weapons/pistol")
			TRT2 D 1 A_CustomMissile("splatBulletCasing", 32, 2, 45+random(-8,8), 0, 3)
			TRT2 E 1 bright A_CustomBulletAttack (22.5, 0, 1, random(1,5) * 3, "BulletPuffTurret", 0, 2)
			TNT1 A 0 A_PlaySound("weapons/pistol")
			TRT2 D 1 A_CustomMissile("splatBulletCasing", 32, 2, 45+random(-8,8), 0, 3)
			TRT2 E 1 bright A_CustomBulletAttack (22.5, 0, 1, random(1,5) * 3, "BulletPuffTurret", 0, 2)
			TNT1 A 0 A_PlaySound("weapons/pistol")
			TRT2 D 1 A_CustomMissile("splatBulletCasing", 32, 2, 45+random(-8,8), 0, 3)
			TRT2 E 1 bright A_CustomBulletAttack (22.5, 0, 1, random(1,5) * 3, "BulletPuffTurret", 0, 2)
			TNT1 A 0 A_PlaySound("weapons/pistol")
			TRT2 D 1 A_CustomMissile("splatBulletCasing", 32, 2, 45+random(-8,8), 0, 3)
			TRT2 E 1 bright A_CustomBulletAttack (22.5, 0, 1, random(1,5) * 3, "BulletPuffTurret", 0, 2)
			TNT1 A 0 A_PlaySound("weapons/pistol")
			TRT2 D 1 A_CustomMissile("splatBulletCasing", 32, 2, 45+random(-8,8), 0, 3)
			TRT2 E 1 bright A_CustomBulletAttack (22.5, 0, 1, random(1,5) * 3, "BulletPuffTurret", 0, 2)
			TNT1 A 0 A_PlaySound("weapons/pistol")
			TRT2 D 1 A_CustomMissile("splatBulletCasing", 32, 2, 45+random(-8,8), 0, 3)
			TRT2 E 1 bright A_CustomBulletAttack (22.5, 0, 1, random(1,5) * 3, "BulletPuffTurret", 0, 2)
			TNT1 A 0 A_PlaySound("weapons/pistol")
			TRT2 D 1 A_CustomMissile("splatBulletCasing", 32, 2, 45+random(-8,8), 0, 3)
			TRT2 E 1 bright A_CustomBulletAttack (22.5, 0, 1, random(1,5) * 3, "BulletPuffTurret", 0, 2)
			TNT1 A 0 A_PlaySound("weapons/pistol")
			TRT2 D 1 A_CustomMissile("splatBulletCasing", 32, 2, 45+random(-8,8), 0, 3)
			TRT2 E 1 bright A_CustomBulletAttack (22.5, 0, 1, random(1,5) * 3, "BulletPuffTurret", 0, 2)
			TNT1 A 0 A_PlaySound("weapons/pistol")
			TRT2 D 1 A_CustomMissile("splatBulletCasing", 32, 2, 45+random(-8,8), 0, 3)
			TRT2 E 1 bright A_CustomBulletAttack (22.5, 0, 1, random(1,5) * 3, "BulletPuffTurret", 0, 2)
			TNT1 A 0 A_PlaySound("weapons/pistol")
			TRT2 D 1 A_CustomMissile("splatBulletCasing", 32, 2, 45+random(-8,8), 0, 3)
			TRT2 E 1 bright A_CustomBulletAttack (22.5, 0, 1, random(1,5) * 3, "BulletPuffTurret", 0, 2)
			TNT1 A 0 A_PlaySound("weapons/pistol")
			TRT2 D 1 A_CustomMissile("splatBulletCasing", 32, 2, 45+random(-8,8), 0, 3)
			TRT2 E 1 bright A_CustomBulletAttack (22.5, 0, 1, random(1,5) * 3, "BulletPuffTurret", 0, 2)
			TNT1 A 0 A_PlaySound("weapons/pistol")
			TRT2 D 1 A_CustomMissile("splatBulletCasing", 32, 2, 45+random(-8,8), 0, 3)
			TRT2 E 1 bright A_CustomBulletAttack (22.5, 0, 1, random(1,5) * 3, "BulletPuffTurret", 0, 2)
			TNT1 A 0 A_PlaySound("weapons/pistol")
			TRT2 D 1 A_CustomMissile("splatBulletCasing", 32, 2, 45+random(-8,8), 0, 3)
			TRT2 E 1 bright A_CustomBulletAttack (22.5, 0, 1, random(1,5) * 3, "BulletPuffTurret", 0, 2)
			TNT1 A 0 A_PlaySound("weapons/pistol")
			TRT2 D 1 A_CustomMissile("splatBulletCasing", 32, 2, 45+random(-8,8), 0, 3)
			TRT2 E 1 bright A_CustomBulletAttack (22.5, 0, 1, random(1,5) * 3, "BulletPuffTurret", 0, 2)
			TNT1 A 0 A_PlaySound("weapons/pistol")
			TRT2 D 1 A_CustomMissile("splatBulletCasing", 32, 2, 45+random(-8,8), 0, 3)
			TRT2 E 1 bright A_CustomBulletAttack (22.5, 0, 1, random(1,5) * 3, "BulletPuffTurret", 0, 2)
			TNT1 A 0 A_PlaySound("weapons/pistol")
			TRT2 D 1 A_CustomMissile("splatBulletCasing", 32, 2, 45+random(-8,8), 0, 3)
			TRT2 E 1 bright A_CustomBulletAttack (22.5, 0, 1, random(1,5) * 3, "BulletPuffTurret", 0, 2)
			TNT1 A 0 A_PlaySound("weapons/pistol")
			TRT2 D 1 A_CustomMissile("splatBulletCasing", 32, 2, 45+random(-8,8), 0, 3)
			TRT2 E 1 bright A_CustomBulletAttack (22.5, 0, 1, random(1,5) * 3, "BulletPuffTurret", 0, 2)
			TNT1 A 0 A_PlaySound("weapons/pistol")
			TRT2 D 1 A_CustomMissile("splatBulletCasing", 32, 2, 45+random(-8,8), 0, 3)
			TRT2 E 1 bright A_CustomBulletAttack (22.5, 0, 1, random(1,5) * 3, "BulletPuffTurret", 0, 2)
			TNT1 A 0 A_PlaySound("weapons/pistol")
			TRT2 D 1 A_CustomMissile("splatBulletCasing", 32, 2, 45+random(-8,8), 0, 3)
			TRT2 E 1 bright A_CustomBulletAttack (22.5, 0, 1, random(1,5) * 3, "BulletPuffTurret", 0, 2)
			TNT1 A 0 A_PlaySound("weapons/pistol")
			TRT2 D 1 A_CustomMissile("splatBulletCasing", 32, 2, 45+random(-8,8), 0, 3)
			TRT2 E 1 bright A_CustomBulletAttack (22.5, 0, 1, random(1,5) * 3, "BulletPuffTurret", 0, 2)
			TNT1 A 0 A_PlaySound("weapons/pistol")
			TRT2 D 1 A_CustomMissile("splatBulletCasing", 32, 2, 45+random(-8,8), 0, 3)
			TRT2 E 1 bright A_CustomBulletAttack (22.5, 0, 1, random(1,5) * 3, "BulletPuffTurret", 0, 2)
			TNT1 A 0 A_PlaySound("weapons/pistol")
			TRT2 D 1 A_CustomMissile("splatBulletCasing", 32, 2, 45+random(-8,8), 0, 3)
			TRT2 E 1 A_CustomBulletAttack (22.5, 0, 1, random(1,5) * 3, "BulletPuffTurret", 0, 2)
			TNT1 A 0 A_PlaySound("weapons/pistol")
			TRT2 D 1 A_CustomMissile("splatBulletCasing", 32, 2, 45+random(-8,8), 0, 3)
			TRT2 E 1 bright A_CustomBulletAttack (22.5, 0, 1, random(1,5) * 3, "BulletPuffTurret", 0, 2)
			TNT1 A 0 A_PlaySound("weapons/pistol")
			TRT2 D 1 A_CustomMissile("splatBulletCasing", 32, 2, 45+random(-8,8), 0, 3)
			TRT2 E 1 bright A_CustomBulletAttack (22.5, 0, 1, random(1,5) * 3, "BulletPuffTurret", 0, 2)
			TNT1 A 0 A_PlaySound("weapons/pistol")
			TRT2 D 1 A_CustomMissile("splatBulletCasing", 32, 2, 45+random(-8,8), 0, 3)
			TRT2 E 1 bright A_CustomBulletAttack (22.5, 0, 1, random(1,5) * 3, "BulletPuffTurret", 0, 2)
			TNT1 A 0 A_PlaySound("weapons/pistol")
			TRT2 D 1 A_CustomMissile("splatBulletCasing", 32, 2, 45+random(-8,8), 0, 3)
			TRT2 E 1 bright A_CustomBulletAttack (22.5, 0, 1, random(1,5) * 3, "BulletPuffTurret", 0, 2)
			TNT1 A 0 A_PlaySound("weapons/pistol")
			TRT2 D 1 A_CustomMissile("splatBulletCasing", 32, 2, 45+random(-8,8), 0, 3)
			TRT2 E 1 bright A_CustomBulletAttack (22.5, 0, 1, random(1,5) * 3, "BulletPuffTurret", 0, 2)
			TNT1 A 0 A_PlaySound("weapons/pistol")
			TRT2 D 1 A_CustomMissile("splatBulletCasing", 32, 2, 45+random(-8,8), 0, 3)
			TRT2 E 1 bright A_CustomBulletAttack (22.5, 0, 1, random(1,5) * 3, "BulletPuffTurret", 0, 2)
			TNT1 A 0 A_PlaySound("weapons/pistol")
			TRT2 D 1 A_CustomMissile("splatBulletCasing", 32, 2, 45+random(-8,8), 0, 3)
			TRT2 E 1 bright A_CustomBulletAttack (22.5, 0, 1, random(1,5) * 3, "BulletPuffTurret", 0, 2)
			TNT1 A 0 A_PlaySound("weapons/pistol")
			TRT2 D 1 A_CustomMissile("splatBulletCasing", 32, 2, 45+random(-8,8), 0, 3)
			TRT2 A 1 bright
			TRT2 A 2
			goto See
		Pain:
			TRT2 A 1
			TRT2 A 1 A_Pain
			goto See
		Death:
			TRT2 A 1 bright A_SpawnItemEx ("Boom", 0, 0, 60, 0, 0, 0, 0, 160)
			TRT2 A 0 bright A_StopSoundEx ("SoundSlot5")
                        NULL A 0 A_NoBlocking
			TRT2 A 0 bright A_PlaySound ("weapons/rocklx")
			TESL B -1
			stop
	}
}

ACTOR TurretRocket
{
	obituary "%o was blown up by a Rocket Turret."
	health 450
	radius 16
	height 56
	mass 10000
	speed 0
	MONSTER
	-ISMONSTER //Makes it spawnable where ever you want it to be spawned
	+FLOORCLIP
	+FRIENDLY
	+FASTER
	+NOBLOOD
	+LOOKALLAROUND
	+SHORTMISSILERANGE
	+NEVERRESPAWN
	PainSound "turret/pain"
	
	// protect from marine damage
	damagefactor "MarineFire", 0.0
	damageFactor "MarineFire2", 0.0

	//Make spawnable inside monsters
	-SOLID
	
	states
	{
		Spawn:
			TRT2 A 1 A_Look
			TRT2 A 5  A_PlaySound("turret/active", CHAN_AUTO, 6)
			goto Spawn
		See:
			TRT2 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 1 A_Chase
			TRT2 A 5  A_PlaySound("turret/active", CHAN_AUTO, 6)
			goto See
		Missile:
			TRT2 A 2 A_FaceTarget
			TRT2 A 1 A_PlaySound("turret/sight", CHAN_AUTO)
			TRT2 ABCD 1 bright
			TRT2 E 1 bright A_CustomMissile("RocketFromTurret", 56)
			TRT2 A 2 bright
			TRT2 A 3
			goto See
		Pain:
			TRT2 A 1
			TRT2 A 1 A_Pain
			goto See
		Death:
			TRT2 A 1 bright A_SpawnItemEx ("Boom", 0, 0, 60, 0, 0, 0, 0, 160)
			TRT2 A 0 bright A_StopSoundEx ("SoundSlot5")
                        NULL A 0 A_NoBlocking
			TRT2 A 0 bright A_PlaySound ("weapons/rocklx")
			TESL B -1
			stop
	}
}

ACTOR TurretPlasma
{
	obituary "%o was blasted by a Plasma Turret."
	health 450
	radius 16
	height 56
	mass 10000
	speed 0
	MONSTER
	-ISMONSTER //Makes it spawnable where ever you want it to be spawned
	+FLOORCLIP
	+FRIENDLY
	+FASTER
	+NOBLOOD
	+LOOKALLAROUND
	+SHORTMISSILERANGE
	+NEVERRESPAWN
	PainSound "turret/pain"
	
	// protect from marine damage
	damagefactor "MarineFire", 0.0
	damageFactor "MarineFire2", 0.0

	//Make spawnable inside monsters
	-SOLID
	
	states
	{
		Spawn:
			TRT1 A 1 A_Look
			TRT1 A 5  A_PlaySound("turret/active", CHAN_AUTO, 6)
			loop
		See:
			TRT1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 1 A_Chase
			TRT1 A 5  A_PlaySound("turret/active", CHAN_AUTO, 6)
			loop
		Missile:
			TRT1 A 1 A_FaceTarget
			TRT1 A 1 A_PlaySound("turret/sight", CHAN_AUTO)
			TRT1 ABCD 1 bright
			TRT1 E 5 bright A_CustomMissile("PlasmaFromTurret", 56)
			TRT1 D 1
			TRT1 E 5 bright A_CustomMissile("PlasmaFromTurret", 56)
			TRT1 D 1
			TRT1 E 5 bright A_CustomMissile("PlasmaFromTurret", 56)
			TRT1 D 1
			TRT1 E 5 bright A_CustomMissile("PlasmaFromTurret", 56)
			TRT1 D 1
			TRT1 E 5 bright A_CustomMissile("PlasmaFromTurret", 56)
			TRT1 D 1
			TRT1 E 5 bright A_CustomMissile("PlasmaFromTurret", 56)
			TRT1 D 1
			TRT1 E 5 bright A_CustomMissile("PlasmaFromTurret", 56)
			TRT1 D 1
			TRT1 E 5 bright A_CustomMissile("PlasmaFromTurret", 56)
			TRT1 D 1
			TRT1 E 5 bright A_CustomMissile("PlasmaFromTurret", 56)
			TRT1 D 1
			TRT1 E 5 bright A_CustomMissile("PlasmaFromTurret", 56)
			TRT1 D 1
			TRT1 A 1 bright
			TRT1 A 1
			goto See
		Pain:
			TRT1 A 1
			TRT1 A 1 A_Pain
			goto See
		Death:
			TRT1 A 1 bright A_SpawnItemEx ("Boom", 0, 0, 60, 0, 0, 0, 0, 160)
			TRT1 A 0 bright A_StopSoundEx ("SoundSlot5")
                        NULL A 0 A_NoBlocking
			TRT1 A 0 bright A_PlaySound ("weapons/rocklx")
			TESL B -1
			stop
	}
}

ACTOR TurretShotgun
{
	obituary "%o was splattered by a Shotgun Turret."
	health 750
	radius 16
	height 56
	mass 10000
	speed 0
	MONSTER
	-ISMONSTER //Makes it spawnable where ever you want it to be spawned
	+FLOORCLIP
	+FRIENDLY
	+FASTER
	+NOBLOOD
	+LOOKALLAROUND
	+SHORTMISSILERANGE
	+NEVERRESPAWN
	PainSound "turret/pain"
	
	// protect from marine damage
	damagefactor "MarineFire", 0.0
	damageFactor "MarineFire2", 0.0

	//Make spawnable inside monsters
	-SOLID
	
	states
	{
		Spawn:
			TRT1 A 1 A_Look
			TRT1 A 5  A_PlaySound("turret/active", CHAN_AUTO, 6)
			loop
		See:
			TRT1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 1 A_Chase
			TRT1 A 5  A_PlaySound("turret/active", CHAN_AUTO, 6)
			loop
		Missile:
			TRT1 A 2 A_FaceTarget
			TRT1 A 1 A_PlaySound("turret/sight", CHAN_AUTO)
			TRT1 ABCD 1 bright
			TRT1 E 1 bright A_CustomBulletAttack(22.5, 0, 3, 5, "BulletPuffTurret")
			TNT1 A 0 A_PlaySound("w2/fire")
			TRT1 D 1 A_CustomMissile("splatShellCasing", 32, 2, 45+random(-8,8), 0, 3)
			TRT1 E 1 bright A_CustomBulletAttack(22.5, 0, 3, 5, "BulletPuffTurret")
			TNT1 A 0 A_PlaySound("w2/fire")
			TRT1 D 1 A_CustomMissile("splatShellCasing", 32, 2, 45+random(-8,8), 0, 3)
			TRT1 E 1 bright A_CustomBulletAttack(22.5, 0, 3, 5, "BulletPuffTurret")
			TNT1 A 0 A_PlaySound("w2/fire")
			TRT1 D 1 A_CustomMissile("splatShellCasing", 32, 2, 45+random(-8,8), 0, 3)
			TRT1 E 1 bright A_CustomBulletAttack(22.5, 0, 3, 5, "BulletPuffTurret")
			TNT1 A 0 A_PlaySound("w2/fire")
			TRT1 D 1 A_CustomMissile("splatShellCasing", 32, 2, 45+random(-8,8), 0, 3)
			TRT1 E 1 bright A_CustomBulletAttack(22.5, 0, 3, 5, "BulletPuffTurret")
			TNT1 A 0 A_PlaySound("w2/fire")
			TRT1 D 1 A_CustomMissile("splatShellCasing", 32, 2, 45+random(-8,8), 0, 3)
			TRT1 E 1 bright A_CustomBulletAttack(22.5, 0, 3, 5, "BulletPuffTurret")
			TNT1 A 0 A_PlaySound("w2/fire")
			TRT1 D 1 A_CustomMissile("splatShellCasing", 32, 2, 45+random(-8,8), 0, 3)
			TRT1 E 1 bright A_CustomBulletAttack(22.5, 0, 3, 5, "BulletPuffTurret")
			TNT1 A 0 A_PlaySound("w2/fire")
			TRT1 D 1 A_CustomMissile("splatShellCasing", 32, 2, 45+random(-8,8), 0, 3)
			TRT1 E 1 bright A_CustomBulletAttack(22.5, 0, 3, 5, "BulletPuffTurret")
			TNT1 A 0 A_PlaySound("w2/fire")
			TRT1 D 1 A_CustomMissile("splatShellCasing", 32, 2, 45+random(-8,8), 0, 3)
			TRT1 E 1 bright A_CustomBulletAttack(22.5, 0, 3, 5, "BulletPuffTurret")
			TNT1 A 0 A_PlaySound("w2/fire")
			TRT1 D 1 A_CustomMissile("splatShellCasing", 32, 2, 45+random(-8,8), 0, 3)
			TRT1 E 1 bright A_CustomBulletAttack(22.5, 0, 3, 5, "BulletPuffTurret")
			TNT1 A 0 A_PlaySound("w2/fire")
			TRT1 D 1 A_CustomMissile("splatShellCasing", 32, 2, 45+random(-8,8), 0, 3)
			TRT1 E 1 bright A_CustomBulletAttack(22.5, 0, 3, 5, "BulletPuffTurret")
			TNT1 A 0 A_PlaySound("w2/fire")
			TRT1 D 1 A_CustomMissile("splatShellCasing", 32, 2, 45+random(-8,8), 0, 3)
			TNT1 A 0 A_PlaySound("w2/fire")
			TRT1 A 1 bright
			TRT1 A 22
			goto See
		Pain:
			TRT1 A 1
			TRT1 A 1 A_Pain
			goto See
		Death:
			TRT1 A 1 bright A_SpawnItemEx ("Boom", 0, 0, 60, 0, 0, 0, 0, 160)
			TRT1 A 0 bright A_StopSoundEx ("SoundSlot5")
                        NULL A 0 A_NoBlocking
			TRT1 A 0 bright A_PlaySound ("weapons/rocklx")
			TESL B -1
			stop
	}
}

ACTOR TurretFlame
{
	obituary "%o was burnt by a Flame Turret."
	health 750
	radius 16
	height 56
	mass 10000
	speed 0
	MONSTER
	-ISMONSTER //Makes it spawnable where ever you want it to be spawned
	+FLOORCLIP
	+FRIENDLY
	+FASTER
	+NOBLOOD
	+LOOKALLAROUND
	+SHORTMISSILERANGE
	+NEVERRESPAWN
	PainSound "turret/pain"

	//Make spawnable inside monsters
	-SOLID
	
	// protect from marine damage
	damagefactor "MarineFire", 0.0
	damageFactor "MarineFire2", 0.0
	
	states
	{
		Spawn:
			NULL A 0 A_JumpIfHealthLower(300,"Spawn2")
			TRT1 A 1 A_Look
			TRT1 A 5  A_PlaySound("turret/active", CHAN_AUTO, 6)
			loop
		Spawn2:
			TRT1 A 1 A_Look
			NULL A 0 A_SpawnItem("Smoke",0,56)
			TRT1 A 5  A_PlaySound("turret/active", CHAN_AUTO, 6)
			loop
			
		See:
			NULL A 0 A_JumpIfHealthLower(500,"See2")
			TRT1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 1 A_Chase
			TRT1 A 5  A_PlaySound("turret/active", CHAN_AUTO, 6)
			loop
		See2:
			TRT1 AAAAAAAAAAA 1 A_Chase
			NULL A 0 A_SpawnItem("Smoke",0,56)
			TRT1 AAAAAAAAAAA 1 A_Chase
			NULL A 0 A_SpawnItem("Smoke",0,56)
			TRT1 AAAAAAAAAAA 1 A_Chase
			NULL A 0 A_SpawnItem("Smoke",0,56)
			TRT1 AAAAAAAAAAA 1 A_Chase
			NULL A 0 A_SpawnItem("Smoke",0,56)
			TRT1 A 5  A_PlaySound("turret/active", CHAN_AUTO, 6)
			loop

		Missile:
			TRT1 A 2 A_FaceTarget
			TRT1 A 1 A_PlaySound("turret/sight", CHAN_AUTO)
			TRT1 ABCD 1 bright
			TRT1 E 1 bright A_CustomMissile ("FlamerShot",56)
			TRT1 E 1 bright A_CustomMissile ("FlamerShot",56)
			TRT1 E 1 bright A_CustomMissile ("FlamerShot",56)
			TRT1 E 1 bright A_CustomMissile ("FlamerShot",56)
			TRT1 E 1 bright A_CustomMissile ("FlamerShot",56)
			TRT1 E 1 bright A_CustomMissile ("FlamerShot",56)
			TRT1 A 22
			goto See
		Pain:
			TRT1 A 1
			TRT1 A 1 A_Pain
			goto See
		Death:
			TRT1 A 1 bright A_SpawnItemEx ("Boom", 0, 0, 60, 0, 0, 0, 0, 160)
			TRT1 A 0 bright A_StopSoundEx ("SoundSlot5")
                        NULL A 0 A_NoBlocking
			TRT1 A 0 bright A_PlaySound ("weapons/rocklx")
			TESL B -1
			stop
	}
}

ACTOR TurretRail
{
	obituary "%o was blasted by a Rail Turret."
	health 450
	radius 16
	height 56
	mass 10000
	speed 0
	MONSTER
	-ISMONSTER //Makes it spawnable where ever you want it to be spawned
	+FLOORCLIP
	+FRIENDLY
	+FASTER
	+NOBLOOD
	+LOOKALLAROUND
	+SHORTMISSILERANGE
	+NEVERRESPAWN
	PainSound "turret/pain"
	
	// protect from marine damage
	damagefactor "MarineFire", 0.0
	damageFactor "MarineFire2", 0.0

	//Make spawnable inside monsters
	-SOLID
	
	states
	{
		Spawn:
			TRT1 A 1 A_Look
			TRT1 A 5  A_PlaySound("turret/active", CHAN_AUTO, 6)
			loop
		See:
			TRT1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 1 A_Chase
			TRT1 A 5  A_PlaySound("turret/active", CHAN_AUTO, 6)
			loop
		Missile:
			TRT1 A 2 A_FaceTarget
			TRT1 A 1 A_PlaySound("turret/sight", CHAN_AUTO)
			TRT1 ABCD 1 bright
			TRT1 E 1 bright A_CustomRailgun (50, 0, "FF 00 00", "F6 F6 F6", 0, 1, 0, "InvisiblePuff")
			TRT1 E 1 bright A_CustomRailgun (50, 0, "FF 00 00", "F6 F6 F6", 0, 1, 0, "InvisiblePuff")
			TRT1 E 1 bright A_CustomRailgun (50, 0, "FF 00 00", "F6 F6 F6", 0, 1, 0, "InvisiblePuff")
			TRT1 A 1 bright
			TRT1 A 22
			goto See
		Pain:
			TRT1 A 1
			TRT1 A 1 A_Pain
			goto See
		Death:
			TRT1 A 1 bright A_SpawnItemEx ("Boom", 0, 0, 60, 0, 0, 0, 0, 160)
			TRT1 A 0 bright A_StopSoundEx ("SoundSlot5")
                        NULL A 0 A_NoBlocking
			TRT1 A 0 bright A_PlaySound ("weapons/rocklx")
			TESL B -1
			stop
	}
}

//Protecting players from being damaged by turrets and drones and other weapons and preventing rocket turrets from commiting suicide thx to players

actor RocketFromTurret : Rocket { damagetype "MarineFire" }

actor PlasmaFromTurret : PlasmaBall { damagetype "MarineFire" }

actor BulletPuffTurret : BulletPuff { damagetype "MarineFire" }

actor InvisiblePuff { damagetype "MarineFire" }





//////////////////
// INVENTORY MANAGEMENT

ACTOR TurretBullet_Build : Inventory
{
	radius 64
	height 32
	
	inventory.pickupmessage "You have activated the build protocol!"
	
	//+COUNTITEM
	inventory.amount 0
inventory.amount 0
	
	renderstyle add
	
	states
	{
		Spawn:
			TNT1 A 0
			TNT1 A 0 A_GiveInventory("build_check")
			TNT1 A 0 A_SpawnItem("TurretBullet_Building")
		Spawn2:
			BULD A 1 A_SpawnItem("BuildableMarker")
			loop
	}
}

ACTOR TurretBullet_Building : BuildBase
{
	renderstyle add
	
	states
	{
		Spawn2:
			BULD ABCDEFGHI 40
			BULD I 0 A_SpawnItem ("TurretBullet", 0, 128, 0, 0)
                        BULD I 1 A_SpawnItem ("splatEmitter_CFX", 0, 128, 0, 0)
			stop
	}
}

ACTOR TurretRocket_Build : Inventory
{
	radius 64
	height 32
	
	inventory.pickupmessage "You have activated the build protocol!"
	
	//+COUNTITEM
	inventory.amount 0
	
	renderstyle add
	
	states
	{
		Spawn:
			TNT1 A 0
			TNT1 A 0 A_GiveInventory("build_check")
			TNT1 A 0 A_SpawnItem("TurretRocket_Building")
		Spawn2:
			BULD A 1 A_SpawnItem("BuildableMarker")
			loop
	}
}

ACTOR TurretRocket_Building : BuildBase
{
	renderstyle add
	
	states
	{
		Spawn2:
			BULD ABCDEFGHI 40
			BULD I 0 A_SpawnItem ("TurretRocket", 0, 128, 0, 0)
                        BULD I 1 A_SpawnItem ("splatEmitter_CFX", 0, 128, 0, 0)
			stop
	}
}


ACTOR TurretPlasma_Build : Inventory
{
	radius 64
	height 32
	
	inventory.pickupmessage "You have activated the build protocol!"
	
	//+COUNTITEM
	inventory.amount 0
	
	renderstyle add
	
	states
	{
		Spawn:
			TNT1 A 0
			TNT1 A 0 A_GiveInventory("build_check")
			TNT1 A 0 A_SpawnItem("TurretPlasma_Building")
		Spawn2:
			BULD A 1 A_SpawnItem("BuildableMarker")
			loop
	}
}

ACTOR TurretPlasma_Building : BuildBase
{
	renderstyle add
	
	states
	{
		Spawn2:
			BULD ABCDEFGHI 40
			BULD I 0 A_SpawnItem ("TurretPlasma", 0, 128, 0, 0)
                        BULD I 1 A_SpawnItem ("splatEmitter_CFX", 0, 128, 0, 0)
			stop
	}
}

ACTOR TurretRail_Build : Inventory
{
	radius 64
	height 32
	
	inventory.pickupmessage "You have activated the build protocol!"
	
	//+COUNTITEM
	inventory.amount 0
	
	renderstyle add
	
	states
	{
		Spawn:
			TNT1 A 0
			TNT1 A 0 A_GiveInventory("build_check")
			TNT1 A 0 A_SpawnItem("TurretRail_Building")
		Spawn2:
			BULD A 1 A_SpawnItem("BuildableMarker")
			loop
	}
}

ACTOR TurretRail_Building : BuildBase
{
	renderstyle add
	
	states
	{
		Spawn2:
			BULD ABCDEFGHI 40
			BULD I 0 A_SpawnItem ("TurretRail", 0, 128, 0, 0)
                        BULD I 1 A_SpawnItem ("splatEmitter_CFX", 0, 128, 0, 0)
			stop
	}
}

ACTOR TurretShotgun_Build : Inventory
{
	radius 64
	height 32
	
	inventory.pickupmessage "You have activated the build protocol!"
	
	//+COUNTITEM
	inventory.amount 0
	
	renderstyle add
	
	states
	{
		Spawn:
			TNT1 A 0
			TNT1 A 0 A_GiveInventory("build_check")
			TNT1 A 0 A_SpawnItem("TurretShotgun_Building")
		Spawn2:
			BULD A 1 A_SpawnItem("BuildableMarker")
			loop
	}
}

ACTOR TurretShotgun_Building : BuildBase
{
	renderstyle add
	
	states
	{
		Spawn2:
			BULD ABCDEFGHI 40
			BULD I 0 A_SpawnItem ("TurretShotgun", 0, 128, 0, 0)
                        BULD I 1 A_SpawnItem ("splatEmitter_CFX", 0, 128, 0, 0)
			stop
	}
}

ACTOR TurretTesla_Build : Inventory
{
	radius 64
	height 32
	
	inventory.pickupmessage "You have activated the build protocol!"
	
	//+COUNTITEM
	inventory.amount 0
	
	renderstyle add
	
	states
	{
		Spawn:
			TNT1 A 0
			TNT1 A 0 A_GiveInventory("build_check")
			TNT1 A 0 A_SpawnItem("TurretTesla_Building")
		Spawn2:
			BULD A 1 A_SpawnItem("BuildableMarker")
			loop
	}
}

ACTOR TurretTesla_Building : BuildBase
{
	renderstyle add
	
	states
	{
		Spawn2:
			BULD ABCDEFGHI 40
			BULD I 0 A_SpawnItem ("TeslaCoil", 0, 128, 0, 0)
                        BULD I 1 A_SpawnItem ("splatEmitter_CFX", 0, 128, 0, 0)
			stop
	}
}

ACTOR TurretFlame_Build : Inventory
{
	radius 64
	height 32
	
	inventory.pickupmessage "You have activated the build protocol!"
	
	//+COUNTITEM
	inventory.amount 0
	
	renderstyle add
	
	states
	{
		Spawn:
			TNT1 A 0
			TNT1 A 0 A_GiveInventory("build_check")
			TNT1 A 0 A_SpawnItem("TurretFlame_Building")
		Spawn2:
			BULD A 1 A_SpawnItem("BuildableMarker")
			loop
	}
}

ACTOR TurretFlame_Building : BuildBase
{
	renderstyle add
	
	states
	{
		Spawn2:
			BULD ABCDEFGHI 40
			BULD I 0 A_SpawnItem ("TurretFlame", 0, 128, 0, 0)
                        BULD I 1 A_SpawnItem ("splatEmitter_CFX", 0, 128, 0, 0)
			stop
	}
}



ACTOR BuildableMarker : MapMarker
{
	scale 0.1
	renderstyle add
	states
	{
		Spawn:
			BULD A 2
			Stop
	}
}

// MOVE TO RIGHT ONE IF ITS WROONG

ACTOR Smoke
{
  RenderStyle Translucent
  Alpha 0.5
  VSpeed 1
  +NOBLOCKMAP 
  +NOGRAVITY 
  +DONTSPLASH
  +NOTELEPORT
  States
  {
  Spawn:
    RSMK A 0 A_Jump(32,"A")
	RSMK A 0 A_Jump(32,"B")
	RSMK A 0 A_Jump(32,"C")
	RSMK A 0 A_Jump(32,"D")
	RSMK A 1
	loop
    A:
    RSMK A 1 A_FadeOut(0.01)
	loop
	B:
    RSMK B 1 A_FadeOut(0.01)
	loop
	C:
    RSMK C 1 A_FadeOut(0.01)
	loop
	D:
    RSMK D 1 A_FadeOut(0.01)
	loop
	
  }
}