//======================================================
// FLAMING ZOMBIE CORE
// All flaming zombies should inherit this actor
//======================================================
ACTOR FlamingZombie
{
	Monster
	Speed 6
	Radius 4
	Height 8
	Health 300
	+NOPAIN
	PainChance 0
	DamageFactor "Fire", 0.0
	States
	{
		Spawn:
			TNT1 A 0
			TNT1 A 0 A_JumpIfInventory("BurnFX",1,"StartWandering")
			Goto InitFlame
		InitFlame:
			TNT1 A 0
			TNT1 A 0 A_GiveInventory("IgnoreHeadshot",1)
			TNT1 A 0 ACS_NamedExecuteAlways("FlameFXClient",0,2)
			TNT1 A -1 A_Jump(256, "StartWandering")
			Wait
		StartWandering:
			TNT1 A 0
			TNT1 A -1 A_Jump(256, "Wandering")
			Wait
		Wandering:
			TNT1 A 16 A_Wander
			Goto Ouch
		Ouch:
			TNT1 A 0 ACS_NamedExecuteAlways("FlameOuch", 0)
			TNT1 A -1 A_Jump(256, "Wandering")
			Wait
		Death:
			TNT1 A 4
			Stop
	}
}

//======================================================
// FLAMING ZOMBIE CORPSE
// This is CLIENTSIDED to improve performance, not destructible
//======================================================

ACTOR FlamingCorpse
{
	var int user_decay;
	Radius 24
	Height 1
	+THRUACTORS
	-SOLID
	+CLIENTSIDEONLY
	+FLOORCLIP
	+MOVEWITHSECTOR
	States
	{
		Spawn:
			TNT1 A 0
			TNT1 A 0 A_PlaySoundEx("flame/smolder","Body",true)
			TNT1 A -1 A_Jump(256, "SetSprite")
			Wait
			
		SetSprite:
			TNT1 A 0
			Goto Burning
			
		Burning:
			"####" "####" 0 A_SpawnItemEx("TinyFlamePuff",random(-(radius/2),radius/2),random(-(radius/2),radius/2), random(2,4))
			"####" "#" 2
			Goto Decay
			
		Decay:
			"####" "#" 0 A_SetUserVar("user_decay", user_decay+2)
			"####" "#" 0 A_JumpIf(user_decay >= 200, "Decayed")
			Goto Burning
			
		// All burnt up
		Decayed:
			"####" "#" 0 A_StopSoundEx("Body")
			"####" "#" 0 A_PlaySoundEx("flame/smolderstop", "Body")
			"####" "#" -1 A_Jump(256, "SetCharredSprite")
			Wait
			
		SetCharredSprite:
			TNT1 A 0
			Goto Charred
			
		Charred:
			"####" "#" 300
			"####" "#" 0 A_CheckSight("Vanish")
			Loop
			
		Vanish:
			TNT1 A 1
			Stop
	}
}

//======================================================

// -- BASIC BURNER

ACTOR Flaming_BaseZombie : FlamingZombie
{
	Speed 4
	Radius 20
	Height 56
	Health 200
	States
	{
		StartWandering:
			VZOF A 0 A_PlaySoundEx("trent/burning", "Voice", true)
			Goto Wandering
			
		Wandering:
			BSZF AABBCCDD 1 bright A_Wander
			Goto Super::Ouch
		
		Death:
			VZOF K 0 A_StopSoundEx("Voice")
			VZOF A 0 A_PlaySoundEx("trent/burnt", "Voice", true)
			VZOF K 0 A_NoBlocking
			VZOF K 0 A_UnsetShootable
			BSZF EEEFFFFGGGHHIJ 1 bright
			BSZF K 0 A_ChangeVelocity(0,0,momz+2)
			BSZF KKKKLLM 1 bright
			BSZF M 0 A_SpawnItemEx("Flaming_BaseZombieCorpse",0,0,0)
			Stop
	}
}

ACTOR Flaming_BaseZombieCorpse : FlamingCorpse
{
	States
	{
		SetSprite:
			BSZF M 0
			Goto Super::Burning
			
		SetCharredSprite:
			BSZF N 0
			Goto Super::Charred
	}
}

//======================================================

// -- EVISCERATOR BURNER

ACTOR Flaming_Eviscerator : FlamingZombie
{
	Speed 2
	Radius 20
	Height 57
	States
	{
		StartWandering:
			VZOF A 0 A_PlaySoundEx("eviscerator/burn", "Voice", true)
			Goto Wandering
			
		Wandering:
			BCGN A 0 A_PlaySoundEx("eviscerator/step","SoundSlot5")
			BCGN AAAAABBBBB 1 bright A_Wander
			BCGN A 0 A_PlaySoundEx("eviscerator/step","SoundSlot5")
			BCGN CCCCCDDDDD 1 bright A_Wander
			Goto Super::Ouch
		
		Death:
			VZOF K 0 A_StopSoundEx("Voice")
			VZOF A 0 A_PlaySoundEx("eviscerator/burnt", "Voice", true)
			BCGN K 0 A_NoBlocking
			BCGN K 0 A_UnsetShootable
			BCGN EEFFGGHHHHIIJ 1 bright
			BCGN J 0 A_SpawnItemEx("Flaming_EvisceratorCorpse",0,0,0)
			Stop
	}
}

ACTOR Flaming_EvisceratorCorpse : FlamingCorpse
{
	Radius 40
	Height 20
	States
	{
		SetSprite:
			BCGN J 0
			Goto Super::Burning
			
		SetCharredSprite:
			BCGN L 0
			Goto Super::Charred
	}
}

//======================================================

// -- DOGGY BURNER

ACTOR Flaming_Doggy : FlamingZombie
{
	Speed 2
	Radius 20
	Height 30
	Health 150
	States
	{
		StartWandering:
			VZOF A 0 A_PlaySoundEx("zdog/burning", "Voice", true)
			Goto Wandering
			
		Wandering:
			DOGB AAAABBBBCCCCDDDD 1 bright A_Wander
			Goto Super::Ouch
		
		Death:
			VZOF K 0 A_StopSoundEx("Voice")
			VZOF A 0 A_PlaySoundEx("zdog/burnt", "Voice", true)
			DOGB E 0 A_NoBlocking
			DOGB E 0 A_UnsetShootable
			DOGB EEFFFGGGGHHIIJJK 1 bright
			BCGN J 0 A_SpawnItemEx("Flaming_DoggyCorpse",0,0,0)
			Stop
	}
}

ACTOR Flaming_DoggyCorpse : FlamingCorpse
{
	Radius 20
	Height 30
	States
	{
		SetSprite:
			DOGB K 0
			Goto Super::Burning
			
		SetCharredSprite:
			DOGB L 0
			Goto Super::Charred
	}
}


//======================================================

// -- FACEMAW BURNER

ACTOR Flaming_Vagina : FlamingZombie
{
	Speed 6
	Radius 20
	Height 74
	States
	{
		StartWandering:
			VZOF A 0 A_PlaySoundEx("facemaw/burn", "Voice", true)
			Goto Wandering
			
		Wandering:
			VZOF AAABBBCCCDDDEEEFFF 1 bright A_Wander
			Goto Super::Ouch
	
		Death:
			VZOF K 0 A_StopSoundEx("Voice")
			VZOF A 0 A_PlaySoundEx("facemaw/burnt", "Voice", true)
			VZOF K 0 A_NoBlocking
			VZOF K 0 A_UnsetShootable
			VZOF M 2 bright
			VZOF N 3 bright
			VZOF O 4 bright
			VZOF P 3 bright
			VZOF Q 2 bright
			VZOF R 1 bright
			VZOF S 2 bright
			VZOF T 3 bright
			BSZF M 0 A_SpawnItemEx("Flaming_VaginaCorpse",0,0,0)
			Stop
	}
}

ACTOR Flaming_VaginaCorpse : FlamingCorpse
{
	States
	{
		SetSprite:
			VZOF U 0
			Goto Super::Burning
			
		SetCharredSprite:
			VZOF V 0
			Goto Super::Charred
	}
}