Actor SSTCaco : Cacodemon //replaces cacodemon
{
damagefactor "RedPaint", 0.3
damagefactor "OrangePaint", 0.3
damagefactor "YellowPaint", 0.3
damagefactor "GreenPaint", 0.3
damagefactor "BluePaint", 0.3
damagefactor "PurplePaint", 0.3
damagefactor "WhitePaint", 0.3
damagefactor "BlackPaint", 0.3
  PainChance "ShotgunWeak", 32

activesound "caco/active"
painsound "caco/pain"
bloodtype "CacoBlood"//"Onegative"
Bloodcolor "00 00 FF"
    deathheight 48
	+FORCEXYBILLBOARD
states
 {
    Crush:
	TNT1 A 0 A_SpawnItemEx ("Gibs", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION|SXF_USEBLOODCOLOR|SXF_CLIENTSIDE)
	TNT1 AAAAAAAA 0 A_SpawnItemEx ("SuperDuperClientsideBloodSpotSpawner", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION|SXF_USEBLOODCOLOR|SXF_CLIENTSIDE)
    TNT1 AAAAAAAA 1 A_SpawnItemEx ("Bloodsquirt3", 0,0,0, 0,0,0, random(-180,180), SXF_USEBLOODCOLOR|SXF_CLIENTSIDE|SXF_NOCHECKPOSITION)
    TNT1 A -1
    Stop
  Death.Plasma:
    TNT1 A 0 ACS_ExecuteAlways(926,0, 10,0,0)
	NULL O 0 A_SpawnItemEx ("PlasmaDeathFX", 0,0,0, momx,momy,momz, 0, SXF_NOCHECKPOSITION|SXF_CLIENTSIDE|SXF_ABSOLUTEMOMENTUM)
	goto Death
 Death:
   HEAD G 4 A_SetSolid
   HEAD G 4 //A_SetShootable
   HEAD H 8 A_Scream
 Falling:
   HEAD H 1
    HEAD H 0 A_JumpIf(waterlevel == 3, "Crash")
    HEAD H 0 A_JumpIf(waterlevel == 2, "Crash")
    //HEAD H 0 A_JumpIf(waterlevel == 1, "Crash")
   Loop
 Crash:
   HEAD I 4 A_PlaySound ("cacodemon/splat")
   HEAD J 4
   HEAD K 2 A_NoBlocking
   HEAD K 1 A_UnsetSolid
   HEAD K 1 A_UnSetShootable
   HEAD L 1 A_SetFloorClip
   HEAD M 5
   HEAD N 6
   HEAD O 7
   HEAD P 8
   HEAD Q -1
   stop
 Raise:
   HEAD P 4 A_UnSetFloorClip
   HEAD ONMLKJIHG 4
   goto See
     Pain.GreenPaint:
    TNT1 A 0 ACS_ExecuteAlways(926,0, 0,0,0)
	Goto Pain
  Pain.BluePaint:
    TNT1 A 0 ACS_ExecuteAlways(926,0, 1,0,0)
	Goto Pain
  Pain.RedPaint:
    TNT1 A 0 ACS_ExecuteAlways(926,0, 2,0,0)
	Goto Pain
  Pain.OrangePaint:
    TNT1 A 0 ACS_ExecuteAlways(926,0, 3,0,0)
	Goto Pain
  Pain.PurplePaint:
    TNT1 A 0 ACS_ExecuteAlways(926,0, 4,0,0)
	Goto Pain
  Pain.WhitePaint:
    TNT1 A 0 ACS_ExecuteAlways(926,0, 5,0,0)
	Goto Pain
  Pain.YellowPaint:
    TNT1 A 0 ACS_ExecuteAlways(926,0, 6,0,0)
	Goto Pain
  Pain.BlackPaint:
    TNT1 A 0 ACS_ExecuteAlways(926,0, 7,0,0)
	Goto Pain
 }
}

actor SSTCacodemonBall : Cacodemonball replaces cacodemonball
{
  Game Doom
  SpawnID 126
  Radius 6
  Height 8
  Speed 10
  FastSpeed 20
  Damage 5
  SeeSound "caco/attack"
  DeathSound "caco/shotx"
  Projectile
  +RANDOMIZE
	+FORCEXYBILLBOARD
  Renderstyle Add
  Alpha 1
  damagetype "plasma"
  States
  {
  Spawn:
    BAL2 A 1 bright
	NULL A 0 A_SpawnItemEx ("CacodemonBallTrail1", 0, random(-4,4), random(-4,4), velx/random(3,5), vely/random(3,5), velz/random(3,5), 0, SXF_ABSOLUTEVELOCITY|SXF_NOCHECKPOSITION|SXF_CLIENTSIDE) 
	NULL A 0 A_SpawnItemEx ("CacoBallCrackleSpawner", 0, random(-1,1), random(-1,1), 0, 0, 0, 0, 160) 
    BAL2 A 1 bright
	NULL A 0 A_SpawnItemEx ("CacodemonBallTrail2", 0, random(-4,4), random(-4,4), velx/random(3,5), vely/random(3,5), velz/random(3,5), 0, SXF_ABSOLUTEVELOCITY|SXF_NOCHECKPOSITION|SXF_CLIENTSIDE) 
	NULL A 0 A_SpawnItemEx ("CacoBallCrackleSpawner", 0, random(-1,1), random(-1,1), 0, 0, 0, 0, 160) 
    BAL2 A 1 bright
	NULL A 0 A_SpawnItemEx ("CacodemonBallTrail3", 0, random(-4,4), random(-4,4), velx/random(3,5), vely/random(3,5), velz/random(3,5), 0, SXF_ABSOLUTEVELOCITY|SXF_NOCHECKPOSITION|SXF_CLIENTSIDE) 
	NULL A 0 A_SpawnItemEx ("CacoBallCrackleSpawner", 0, random(-1,1), random(-1,1), 0, 0, 0, 0, 160) 
    BAL2 A 1 bright
	NULL A 0 A_SpawnItemEx ("CacodemonBallTrail4", 0, random(-4,4), random(-4,4), velx/random(3,5), vely/random(3,5), velz/random(3,5), 0, SXF_ABSOLUTEVELOCITY|SXF_NOCHECKPOSITION|SXF_CLIENTSIDE) 
	NULL A 0 A_SpawnItemEx ("CacoBallCrackleSpawner", 0, random(-1,1), random(-1,1), 0, 0, 0, 0, 160) 
    BAL2 B 1 bright
	NULL A 0 A_SpawnItemEx ("CacodemonBallTrail1", 0, random(-4,4), random(-4,4), velx/random(3,5), vely/random(3,5), velz/random(3,5), 0, SXF_ABSOLUTEVELOCITY|SXF_NOCHECKPOSITION|SXF_CLIENTSIDE) 
	NULL A 0 A_SpawnItemEx ("CacoBallCrackleSpawner", 0, random(-1,1), random(-1,1), 0, 0, 0, 0, 160) 
    BAL2 B 1 bright
	NULL A 0 A_SpawnItemEx ("CacodemonBallTrail2", 0, random(-4,4), random(-4,4), velx/random(3,5), vely/random(3,5), velz/random(3,5), 0, SXF_ABSOLUTEVELOCITY|SXF_NOCHECKPOSITION|SXF_CLIENTSIDE) 
	NULL A 0 A_SpawnItemEx ("CacoBallCrackleSpawner", 0, random(-1,1), random(-1,1), 0, 0, 0, 0, 160) 
    BAL2 B 1 bright
	NULL A 0 A_SpawnItemEx ("CacodemonBallTrail3", 0, random(-4,4), random(-4,4), velx/random(3,5), vely/random(3,5), velz/random(3,5), 0, SXF_ABSOLUTEVELOCITY|SXF_NOCHECKPOSITION|SXF_CLIENTSIDE) 
	NULL A 0 A_SpawnItemEx ("CacoBallCrackleSpawner", 0, random(-1,1), random(-1,1), 0, 0, 0, 0, 160) 
    BAL2 B 1 bright
	NULL A 0 A_SpawnItemEx ("CacodemonBallTrail4", 0, random(-4,4), random(-4,4), velx/random(3,5), vely/random(3,5), velz/random(3,5), 0, SXF_ABSOLUTEVELOCITY|SXF_NOCHECKPOSITION|SXF_CLIENTSIDE) 
	NULL A 0 A_SpawnItemEx ("CacoBallCrackleSpawner", 0, random(-1,1), random(-1,1), 0, 0, 0, 0, 160) 
    loop
  Death:
	NULL A 0 A_SpawnItemEx ("BlueParticleShroom", 0,0,0, 0,0,0, 0, 160) 
    BAL2 CDE 6 bright
    stop
  }
}

ACTOR CacodemonBallTrail1
{
   Radius 1
   Height 1
   PROJECTILE
   +NOCLIP
	+FORCEXYBILLBOARD
   Scale 0.04
   Speed 0
   Renderstyle Add
   Translation FF0000
   ALPHA 0.33
   States
   {
   Spawn:
    	TNT1 A 0 Thing_ChangeTID (0, 1330) 
    	TNT1 A 0 Thing_ChangeTID (0, 1330) 
      TNT1 A 0 A_Jump(128, "Spawn2", "Spawn3")
      N0VA AAAAAAAAAAAAAAAAAAAAAA 1 BRIGHT A_Fadeout(0.015)
      Stop
   Spawn2:
	  N0VA AAAAAAAAAAA 1 BRIGHT A_Fadeout(0.03)
      Stop
   Spawn3:
      N0VA AAAAAAAAAAAAAAAAA 1 BRIGHT A_Fadeout(0.02)
      Stop
   }
}

ACTOR CacodemonBallTrail2
{
   Radius 1
   Height 1
   PROJECTILE
   +NOCLIP
	+FORCEXYBILLBOARD
   Scale 0.04
   Speed 0
   Renderstyle Add
   Translation FF0000
   ALPHA 0.33
   States
   {
   Spawn:
    	TNT1 A 0 Thing_ChangeTID (0, 1330) 
    	TNT1 A 0 Thing_ChangeTID (0, 1330) 
      TNT1 A 0 A_Jump(128, "Spawn2", "Spawn3")
      N0VA BBBBBBBBBBBBBBBBBBBBBB 1 BRIGHT A_Fadeout(0.015)
      Stop
   Spawn2:
      N0VA BBBBBBBBBBB 1 BRIGHT A_Fadeout(0.03)
      Stop
   Spawn3:
      N0VA BBBBBBBBBBBBBBBBB 1 BRIGHT A_Fadeout(0.02)
      Stop
   }
}

ACTOR CacodemonBallTrail3
{
   Radius 1
   Height 1
   PROJECTILE
   +NOCLIP
	+FORCEXYBILLBOARD
   Scale 0.04
   Speed 0
   Renderstyle Add
   Translation FF0000
   ALPHA 0.33
   States
   {
   Spawn:
    	TNT1 A 0 Thing_ChangeTID (0, 1330) 
    	TNT1 A 0 Thing_ChangeTID (0, 1330) 
      TNT1 A 0 A_Jump(128, "Spawn2", "Spawn3")
      N0VA CCCCCCCCCCCCCCCCCCCCCC 1 BRIGHT A_Fadeout(0.015)
      Stop
   Spawn2:
      N0VA CCCCCCCCCCC 1 BRIGHT A_Fadeout(0.03)
      Stop
   Spawn3:
      N0VA CCCCCCCCCCCCCCCCC 1 BRIGHT A_Fadeout(0.02)
      Stop
   }
}
ACTOR CacodemonBallTrail4
{
   Radius 1
   Height 1
   PROJECTILE
   +NOCLIP
	+FORCEXYBILLBOARD
   Scale 0.04
   Speed 0
   Renderstyle Add
   Translation FF0000
   ALPHA 0.33
   States
   {
   Spawn:
    	TNT1 A 0 Thing_ChangeTID (0, 1330) 
    	TNT1 A 0 Thing_ChangeTID (0, 1330) 
      TNT1 A 0 A_Jump(128, "Spawn2", "Spawn3")
      N0VA DDDDDDDDDDDDDDDDDDDDDD 1 BRIGHT A_Fadeout(0.015)
      Stop
   Spawn2:
      N0VA DDDDDDDDDDD 1 BRIGHT A_Fadeout(0.03)
      Stop
   Spawn3:
      N0VA DDDDDDDDDDDDDDDDD 1 BRIGHT A_Fadeout(0.02)
      Stop
   }
}
ACTOR CacoBallCrackleSpawner
{
	+NOTELEPORT
  Radius 1
  Height 1
  +NOBLOCKMAP
  +NOTELEPORT
  +NOGRAVITY
  +NOCLIP
  -SOLID
  -SHOOTABLE
  RENDERSTYLE NONE
  States
  {
  Spawn:
    TNT1 A 0
      TNT1 A 0 Bright A_CustomMissile("CacoBallCrackle1",0,0,random(-180,180),2,random(-90,90))
      TNT1 A 0 Bright A_CustomMissile("CacoBallCrackle2",0,0,random(-180,180),2,random(-90,90))
      Stop
  }
}
ACTOR CacoBallCrackle1
{
  Radius 1
  Height 1
  Speed 5
  Damage 0
  Projectile
  -RANDOMIZE
  +NOCLIP
	+FORCEXYBILLBOARD
  RenderStyle Add
  Alpha 0.85
  scale 0.01
  States
  {
  Spawn:
    	TNT1 A 0 Thing_ChangeTID (0, 1330) 
    	TNT1 A 0 Thing_ChangeTID (0, 1330) 
    N0VA ABCDABCD 1 bright A_FadeOut(0.1)
    stop
  }
}
ACTOR CacoBallCrackle2
{
  Radius 1
  Height 1
  Speed 4
  Damage 0
  Projectile
  -RANDOMIZE
  +NOCLIP
	+FORCEXYBILLBOARD
  RenderStyle Add
  Alpha 0.8
  scale 0.02
  States
  {
  Spawn:
    	TNT1 A 0 Thing_ChangeTID (0, 1330) 
    	TNT1 A 0 Thing_ChangeTID (0, 1330) 
    N0VA ABCDABCD 1 bright A_FadeOut(0.1)
    stop
  }
}
actor SSTDeadCacodemon : DeadCacodemon replaces DeadCacodemon
{
	States
	{
	Spawn:
		HEAD Q 1
		HEAD Q -1
		stop
	}
}