// *** MODIFIED BY CHEBMASTER
// I mark most important places modified by me with //***Che -- unless I forget to.






ACTOR DyingZombieman: AbstractDyingGuy
{
    Radius 12
    Height 16
    Speed 9
	Health 50
	PainSound "grunt/pain"
	DeathSound "grunt/death"
	damagefactor "Kick", 6.0
	PainChance "Kick", 255
	damagefactor "trample", 2.0
	DamageFactor "CauseSplash", 0.0 DamageFactor "CauseObjectsToSplashSlime", 0.0 DamageFactor "CauseObjectsToSplashNukage", 0.0
	DamageFactor "CauseObjectsToSplashBlood", 0.0 DamageFactor "CauseObjectsToSplashLava", 0.0
	damagefactor "Avoid", 0.0	damagefactor "Death.KickDowned", 100.0	damagefactor "Death.KickDownedAny", 100.0
	BloodType "FBD_Blood", "BloodSPlatterReplacer", "FBD_SawBlood"
	+SHOOTABLE
    +FLOORCLIP
	//+NOBLOCKMAP
    +LOOKALLAROUND
	+FRIGHTENED
	-SOLID
	+DONTSPLASH
	MONSTER
	+FRIENDLY//
	-COUNTKILL
	+GHOST
	+THRUGHOST
	Mass 500
	DeathHeight 4
	BurnHeight 0
    States
    {
		
		Pain.Kick:
			TNT1 A 0 A_CustomMissile ("Teeth", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("Blood", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("TeethNoBounce", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			//TNT1 A 0 A_SpawnItemEx("ArmorShardFatalityBonus2", 0,0,20, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			TNT1 A 0 ACS_NamedExecuteAlways("DropFatalityBonuses", 0, 0, 2, 0) // 0, health, armor, 0 -- rounded down to nearest 2
			TNT1 A 0 A_Pain
			TNT1 A 0 A_FaceTarget
			ZMAK ABA 4
			ZMAM A 20
			Goto See
		
		Death.Kick:
		Death.KickDowned:
		Death.Extremepunches:
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_GiveToTarget("GoFatality", 1)
			TNT1 A 0 A_GiveToTarget("GoSpecial", 1)
			//TNT1 AA 0 A_SpawnItemEx("ArmorShardFatalityBonus2", 0,0,20, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			//TNT1 AA 0 A_SpawnItemEx("HealthPlusFatalityBonus2", 0,0,20, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			TNT1 A 0 ACS_NamedExecuteAlways("DropFatalityBonuses", 0, 4, 4, 0) // 0, health, armor, 0 -- rounded down to nearest 2
			TNT1 A 0 A_GiveToTarget("IsCurbstompingZombieman", 1)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // without such huge margin ACS scripts run ownerless -- as if they could feel this actox expiring back in time
			Stop
		
		Spawn:
			TNT1 A 0
			TNT1 A 0  // makes the blood it emits go lo-res 
			  // if slaughtercount is over half the slaughter limit (i.e. 600) at the moment of spawning
			TNT1 A 0 A_GiveInventory("IsCrawling", 1)
			ZMAM A 1 A_Look
			Loop
		See:
			ZMAM ABAB 10 A_Chase
			ZMAM A 9 A_Pain
			TNT1 A 0 A_Jump(12, "LastStand")
			TNT1 A 0 A_SpawnItemEx("FBD_FlyingBlood", 0, 0, 10, 0, 0)
			
			TNT1 A 0 A_GiveInventory("DeathTimer1", 1)
			TNT1 A 0 A_JumpIfInventory("DeathTimer1", 12, "GotoDeath")
			Loop
			
		GotoDeath:
			TNT1 A 0
			TNT1 A 0 A_ChangeFlag("SHOOTABLE", 0)
			TNT1 A 0 A_ChangeFlag("FRIENDLY", 1)
		
			Goto Death
		Death:
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_Pain
			TNT1 A 0 A_SpawnItemEx ("FBD_DeadZombieManMinorHead",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0) 
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // without such huge margin ACS scripts run ownerless -- as if they could feel this actox expiring back in time
			Stop
			
		LastStand:
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_Pain
			TNT1 A 0 A_CHangeFlag("FRIENDLY", 0)
			TNT1 A 0 A_SpawnItemEx ("ZombiemanLastStand1",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0) 
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // without such huge margin ACS scripts run ownerless -- as if they could feel this actox expiring back in time
			Stop
		
		Death.Fire:
		Death.Flames:
		Death.Burn:
			TNT1 A 0 A_NoBlocking
			//TNT1 AA 0 A_SpawnItemEx("ArmorShardFatalityBonus2", 0,0,20, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			//TNT1 AA 0 A_SpawnItemEx("HealthPlusFatalityBonus2", 0,0,20, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			TNT1 A 0 ACS_NamedExecuteAlways("DropFatalityBonuses", 0, 4, 4, 0) // 0, health, armor, 0 -- rounded down to nearest 2
			TNT1 A 0 A_SpawnItemEx ("DyingZombiemanInFlames",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // without such huge margin ACS scripts run ownerless -- as if they could feel this actor expiring back in time
			Stop
		Death.Trample:	
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_CustomMissile ("MuchBlood2", 10, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("Brains1", 10, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("Brains2", 10, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("Brains3", 10, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("Brains4", 10, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("Brains5", 10, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("SmallBrainPieceFast", random (45, 55), random (5, -5), random (170, 190), CMF_AIMDIRECTION, random (-10, 10))
			TNT1 AAAA 0 A_CustomMissile ("SmallBrainPiece", 10, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_SpawnItemEx ("StompedZombieman",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			//TNT1 AA 0 A_SpawnItemEx("HealthPlusFatalityBonus2", 0,0,20, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			TNT1 A 0 ACS_NamedExecuteAlways("DropFatalityBonuses", 0, 4, 0, 0) // 0, health, armor, 0 -- rounded down to nearest 2
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // without such huge margin ACS scripts run ownerless -- as if they could feel this actor expiring back in time
			Stop
		
		Death.SSG:
		XDeath:
			TNT1 AAAAAA 0 bright A_CustomMissile ("SuperGoreSpawner", 5, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 180))
			TNT1 AAAAAA 0 bright A_CustomMissile ("XDeath1", 5, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 180))
			TNT1 AA 0 bright A_CustomMissile ("XDeath2", 55, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 180))
			TNT1 AA 0 bright A_CustomMissile ("XDeath3", 55, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 180))
			TNT1 A 0 A_SpawnItemEx ("CrushedRemains",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 1
			TNT1 A 1 A_XScream
			TNT1 A 1 A_NoBlocking
			//TNT1 A 0 A_SpawnItemEx("ArmorShardFatalityBonus2", 0,0,20, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			//TNT1 A 3 A_SpawnItemEx("HealthPlusFatalityBonus2", 0,0,20, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			TNT1 A 0 ACS_NamedExecuteAlways("DropFatalityBonuses", 0, 2, 2, 0) // 0, health, armor, 0 -- rounded down to nearest 2
			
			//***Che: prevent the game engine from auto-respawning this gibbed corpse on nightmare as a corpse
			// while allowiing archviles raising it (they only check for the CORPSE flag)
			// and respawning via script on nightmare
			TNT1 A 0 A_ChangeFlag("CORPSE", 1)
			TNT1 A 0 A_ChangeFlag("ISMONSTER", 0)
			TNT1 A -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop
		
		Death.Shotgun:
			TNT1 A 0 A_PlaySound("misc/xdeath4", CHAN_VOICE)
			TNT1 A 0 A_CustomMissile ("MuchBlood2", 20, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("Brains1", 20, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("Brains2", 20, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("Brains3", 20, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("Brains4", 20, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("Brains5", 20, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("SmallBrainPieceFast", random (45, 55), random (5, -5), random (170, 190), CMF_AIMDIRECTION, random (-10, 10))
			TNT1 AAAA 0 A_CustomMissile ("SmallBrainPiece", 20, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			
			ZMAD B 0 A_XScream
			//TNT1 A 0 A_SpawnItemEx("ArmorShardFatalityBonus2", 0,0,20, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			//TNT1 A 0 A_SpawnItemEx("HealthPlusFatalityBonus2", 0,0,20, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			TNT1 A 0 ACS_NamedExecuteAlways("DropFatalityBonuses", 0, 2, 2, 0) // 0, health, armor, 0 -- rounded down to nearest 2
			ZMAD C 0 A_NoBlocking
			TNT1 A 0 A_SpawnItemEx("FBD_DeadZombieMan_Noheadfront",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // without such huge margin ACS scripts run ownerless -- as if they could feel this actor expiring back in time
			Stop
			

		 Death.Stomp:
			TNT1 AAAAAAAAAAAAAAAAAAAAAAAAA 0 A_CustomMissile ("Brutal_FlyingBloodTrail8", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 360))
			TNT1 AAAAAA 0 bright A_CustomMissile ("SuperGoreSpawner", 5, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 180))
			TNT1 AAAAAA 0 bright A_CustomMissile ("XDeath1", 5, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 180))
			TNT1 AA 0 bright A_CustomMissile ("XDeath2", 55, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 180))
			TNT1 AA 0 bright A_CustomMissile ("XDeath3", 55, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 180))
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			TNT1 A 0 A_SpawnItemEx ("CrushedRemains",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 1
			TNT1 A 1 A_XScream
			TNT1 A 1 A_NoBlocking
			
			//***Che: prevent the game engine from auto-respawning this gibbed corpse on nightmare as a corpse
			// while allowiing archviles raising it (they only check for the CORPSE flag)
			// and respawning via script on nightmare
			TNT1 A 0 A_ChangeFlag("CORPSE", 1)
			TNT1 A 0 A_ChangeFlag("ISMONSTER", 0)
			TNT1 A -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop
			
		Crush:
			TNT1 A 0
			TNT1 A 1
			TNT1 A 0 A_SpawnItem("BodyRemovalThing")
			TNT1 A 1 A_XScream
			TNT1 A -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop	
	}
}



ACTOR ZombiemanFallingBeheaded: AbstractDyingGuy
{
    Radius 12
    Height 40
	Health 50
	damagefactor "trample", 0.0 	DamageFactor "CauseSplash", 0.0 DamageFactor "CauseObjectsToSplashSlime", 0.0 DamageFactor "CauseObjectsToSplashNukage", 0.0
	DamageFactor "CauseObjectsToSplashBlood", 0.0 DamageFactor "CauseObjectsToSplashLava", 0.0
	damagefactor "Avoid", 0.0 damagefactor "KillMe", 0.0 damagefactor "Head", 0.0
	BloodType "FBD_Blood", "BloodSPlatterReplacer", "FBD_SawBlood"
	DamageFactor "SSG", 55.0
	+SHOOTABLE    +FLOORCLIP	-SOLID	+DONTSPLASH	
	MONSTER
	+FRIENDLY	+GHOST	+THRUGHOST -COUNTKILL
	Mass 500
    States
    {
	
		Spawn:
			TNT1 A 0
			TNT1 A 0  // makes the blood it emits go lo-res 
			  // if slaughtercount is over half the slaughter limit (i.e. 600) at the moment of spawning
			TNT1 A 0 A_Jump(196, "Instant")
			TNT1 A 0 A_Jump(128, "Long")
			ZZD6 AABBCCDD 4 A_CustomMissile ("Brutal_LiquidBlood2", 40, 0, 120, 2, random (0, 60))
			ZZD6 EE 3 A_CustomMissile ("Brutal_LiquidBlood2", 40, 0, 120, 2, random (0, 60))
			TNT1 A 0 A_Noblocking
			TNT1 A 0 A_Scream
			ZZD6 FFGG 2 A_CustomMissile ("Brutal_LiquidBlood2", 40, 0, 120, 2, random (0, 60))
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			TNT1 A 0 A_SpawnItemEx ("FBD_DeadZombieMan_NoHeadFront",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 5 A_CustomMissile ("ArterialBloodSPray", 10, -10, 45, 2, random (0, 60))
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // without such huge margin ACS scripts run ownerless -- as if they could feel this actor expiring back in time
			Stop
			
		Long:
			ZZD6 AABBCCDD 3 A_CustomMissile ("Brutal_LiquidBlood2", 40, 0, 120, 2, random (0, 60))
			ZZD6 AABBCCDD 3 A_CustomMissile ("Brutal_LiquidBlood2", 40, 0, 120, 2, random (0, 60))
			ZZD6 AABBCCDD 3 A_CustomMissile ("Brutal_LiquidBlood2", 40, 0, 120, 2, random (0, 60))
			ZZD6 EE 3 A_CustomMissile ("Brutal_LiquidBlood2", 40, 0, 120, 2, random (0, 60))
			TNT1 A 0 A_Noblocking
			TNT1 A 0 A_Scream
			ZZD6 FFGG 2 A_CustomMissile ("Brutal_LiquidBlood2", 40, 0, 120, 2, random (0, 60))
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			TNT1 A 0 A_SpawnItemEx ("FBD_DeadZombieMan_NoHeadFront",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 5 A_CustomMissile ("ArterialBloodSPray", 10, -10, 45, 2, random (0, 60))
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // without such huge margin ACS scripts run ownerless -- as if they could feel this actor expiring back in time
			Stop
			
				
		Instant:
			ZZD6 I 8
			ZZD6 EEEEE 3 A_CustomMissile ("Brutal_LiquidBlood2", 40, 0, 120, 2, random (0, 60))
		Death:	
			TNT1 A 0 A_Noblocking
			TNT1 A 0 A_Scream
			ZZD6 FFGG 2 A_CustomMissile ("Brutal_LiquidBlood2", 40, 0, 120, 2, random (0, 60))
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			TNT1 A 0 A_SpawnItemEx ("FBD_DeadZombieMan_NoHeadFront",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 5 A_CustomMissile ("ArterialBloodSPray", 10, -10, 45, 2, random (0, 60))
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // without such huge margin ACS scripts run ownerless -- as if they could feel this actor expiring back in time
			Stop	
			
		Death.SSG:
		XDeath:
			TNT1 A 0
			TNT1 A 0 A_Recoil(2)
			//TNT1 AAA 0 bright A_CustomMissile ("SuperGoreSpawner", 35, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 180))
			TNT1 AAAA 0 A_CustomMissile ("Guts", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeath1", 40, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("XDeath3b", 40, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeath4", 40, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeath2b", 40, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("BloodMistBig", 40, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 90))
			TNT1 AAA 0 A_CustomMissile ("BloodMistBig", 40, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 90))
			TNT1 AA 0 A_CustomMissile ("XDeathArm1", 40, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("XDeathZombieLeg", 40, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			//TNT1 A 0 A_SpawnItemEx("ArmorShardFatalityBonus2", 0,0,20, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			//TNT1 A 0 A_SpawnItemEx("HealthPlusFatalityBonus2", 0,0,20, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			TNT1 A 0 ACS_NamedExecuteAlways("DropFatalityBonuses", 0, 2, 2, 0) // 0, health, armor, 0 -- rounded down to nearest 2
			TNT1 A 0 A_SpawnItem("BigBloodspot")
			
			//***Che: prevent the game engine from auto-respawning this gibbed corpse on nightmare as a corpse
			// while allowiing archviles raising it (they only check for the CORPSE flag)
			// and respawning via script on nightmare
			TNT1 A 0 A_ChangeFlag("CORPSE", 1)
			TNT1 A 0 A_ChangeFlag("ISMONSTER", 0)
			TNT1 A -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop
			
		Death.Shotgun:	
		Death.SSG:
		Death.SniperBullet:
		Death.Bullet792:
		Death.Minigun:
		Death.Cutless:
		Death.Cut:
			TNT1 A 0 A_Noblocking
			TNT1 A 0 A_Scream
			TNT1 AAA 0 A_CustomMissile ("BloodMistBig", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 90))
			TNT1 A 0 A_SpawnItemEx ("BrutalizedZombieMan2",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // without such huge margin ACS scripts run ownerless -- as if they could feel this actor expiring back in time
			Stop

    
	}
}



ACTOR ZombiemanFallingSplattered: AbstractDyingGuy
{
    Radius 12
    Height 40
	Health 10
	damagefactor "trample", 0.0 	DamageFactor "CauseSplash", 0.0 DamageFactor "CauseObjectsToSplashSlime", 0.0 DamageFactor "CauseObjectsToSplashNukage", 0.0
	DamageFactor "CauseObjectsToSplashBlood", 0.0 DamageFactor "CauseObjectsToSplashLava", 0.0
	damagefactor "Avoid", 0.0 damagefactor "KillMe", 0.0 damagefactor "Head", 0.0
	BloodType "FBD_Blood", "BloodSPlatterReplacer", "FBD_SawBlood"
	DamageFactor "SSG", 55.0
	+SHOOTABLE    +FLOORCLIP	-SOLID	+DONTSPLASH	
	MONSTER
	+NEVERRESPAWN
	+FRIENDLY	+GHOST	+THRUGHOST
	-COUNTKILL
	Mass 500
    States
    {
	
		Spawn:
			TNT1 A 0
			TNT1 A 0  // makes the blood it emits go lo-res 
			  // if slaughtercount is over half the slaughter limit (i.e. 600) at the moment of spawning	
			ZXZ2 A 1 A_Stop
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			ZXZ2 BBBBBBBBBBBBBBBBBBB 3 A_CustomMissile ("Brutal_LiquidBlood2", 26, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 60))
			TNT1 A 0 A_NoBlocking
			ZXZ2 CCC 3 A_CustomMissile ("Brutal_LiquidBlood2", 26, 10, -45, 2, random (0, 60))
			ZXZ2 DD 3 A_CustomMissile ("Brutal_LiquidBlood2", 12, 10, -45, 2, random (0, 60))
			TNT1 A 0 A_CustomMissile ("ArterialBloodSPray", 10, 10, -45, 2, random (0, 60))
			ZXZ1 E 0
			TNT1 A 0 A_SpawnItemEx("FBD_DeadZombieMan_Blasted",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // without such huge margin ACS scripts run ownerless -- as if they could feel this actor expiring back in time
			Stop
		
		Death:	
		Death.Shotgun:	
		Death.SSG:
		XDeath:
		   Death.SSG:
			TNT1 A 0
			TNT1 A 0 A_Stop
			ZZD1 E 1 A_Pain
			ZZD1 E 1 A_FaceTarget
			TNT1 AA 0 A_CustomMissile ("XDeath2", 32, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AA 0 A_CustomMissile ("XDeath3", 32, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 A 0 A_SpawnItem("Muchblood2", 0, 40)
			TNT1 AAA 0 A_CustomMissile ("Guts", 32, 0, random (150, 210), CMF_AIMDIRECTION, random (0, 40))
			TNT1 A 0 A_CustomMissile ("XDeathArm1", 32, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 A 0 A_CustomMissile ("XDeathZombieManHead", 32, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 A 0 A_XScream
			TNT1 A 0 A_NoBlocking
			ZZD1 EEFFGH 6
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			ZZD1 H 0
			TNT1 A 0 A_SpawnItemEx("FBD_DeadZombieManJustLegsAreLeft2",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // without such huge margin ACS scripts run ownerless -- as if they could feel this actor expiring back in time
			Stop
			
			
		Death.Desintegrate:
			TNT1 A 0 A_XScream
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_SpawnItemEx("DesintegratedHuman",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 0 A_Stop
			TNT1 A 0 A_GiveToTarget("SoulAmmo", 1)
			TGIB ABCDEFGHIJKLMNOPQ 3
			
			//***Che: prevent the game engine from auto-respawning this gibbed corpse on nightmare as a corpse
			// while allowiing archviles raising it (they only check for the CORPSE flag)
			// and respawning via script on nightmare
			TNT1 A 0 A_ChangeFlag("CORPSE", 1)
			TNT1 A 0 A_ChangeFlag("ISMONSTER", 0)
			TGIB Q -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop
			
		XDeath:
			TNT1 A 0 A_XScream
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_FaceTarget
			TNT1 AAA 0 A_CustomMissile ("XDeath1", 42, 0, random (0, 290), 2, random (10, 60))
			TNT1 AAA 0 A_CustomMissile ("XDeath3", 42, 0, random (0, 290), 2, random (10, 60))
			TNT1 A 0 A_CustomMissile ("XDeath2", 42, 0, random (0, 190), CMF_AIMDIRECTION, random (10, 60))
			TNT1 A 0 A_CustomMissile ("XDeath4", 42, 0, random (0, 190), CMF_AIMDIRECTION, random (10, 60))
			TNT1 A 0 A_CustomMissile ("ZombieXDeath", 2, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_GiveToTarget("SoulAmmo", 1)
			
			//***Che: prevent the game engine from auto-respawning this gibbed corpse on nightmare as a corpse
			// while allowiing archviles raising it (they only check for the CORPSE flag)
			// and respawning via script on nightmare
			TNT1 A 0 A_ChangeFlag("CORPSE", 1)
			TNT1 A 0 A_ChangeFlag("ISMONSTER", 0)
			TNT1 A -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop

		Death.Plasma: 
		Death.Plasma2:
		Death.Bfg10k: //***Che changed damage type from extreme to custom
			TNT1 A 0
			TNT1 A 0 A_Stop
			PBR1 A 6 A_XScream
			TNT1 AAAA 0 A_CustomMissile ("BluePlasmaFireNonStatic", 42, 0, random (0, 360), 2, random (0, 180))
			TNT1 AAA 0 A_CustomMissile ("Blood", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 180))
			TNT1 AAAAAA 0 A_CustomMissile ("SuperGoreMistSmall", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (10, 90))
			TNT1 AAA 0 A_CustomMissile ("FBD_FlyingBlood", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 180))
			PBR1 B 6 A_NoBlocking
			TNT1 A 0 A_SpawnItemEx ("DetectFloorCraterSmall",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 0 A_SpawnItem("BarrelExplosionSmokeColumn")
			TNT1 A 0 A_SpawnItemEx("TinyBurningPiece", random (-15, 15), random (-15, 15))
			TNT1 AA 0 A_SpawnItemEx("TinyBurningPiece2", random (-35, 35), random (-35, 35))
			TNT1 AA 0 A_SpawnItemEx("TinyBurningPiece3", random (-45, 45), random (-45, 35))
			PBR1 CCDD 3 A_CustomMissile ("BluePlasmaFireNonStatic", 32, 0, random (0, 360), 2, random (0, 180))
			PBR1 EEFF 3
			PBR1 GG 3
			TNT1 A 0 A_GiveToTarget("SoulAmmo", 1)
			
			//***Che: prevent the game engine from auto-respawning this gibbed corpse on nightmare as a corpse
			// while allowiing archviles raising it (they only check for the CORPSE flag)
			// and respawning via script on nightmare
			TNT1 A 0 A_ChangeFlag("CORPSE", 1)
			TNT1 A 0 A_ChangeFlag("ISMONSTER", 0)
			PBR1 H -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop	
    
	}
}





ACTOR ZombiemanFallingHoleOnStomach: AbstractDyingGuy
{
    Radius 12
    Height 40
	Health 10
	damagefactor "trample", 0.0 	DamageFactor "CauseSplash", 0.0 DamageFactor "CauseObjectsToSplashSlime", 0.0 DamageFactor "CauseObjectsToSplashNukage", 0.0
	DamageFactor "CauseObjectsToSplashBlood", 0.0 DamageFactor "CauseObjectsToSplashLava", 0.0
	damagefactor "Avoid", 0.0 damagefactor "KillMe", 0.0 damagefactor "Head", 0.0
	BloodType "FBD_Blood", "BloodSPlatterReplacer", "FBD_SawBlood"
	DamageFactor "SSG", 55.0
	+SHOOTABLE    +FLOORCLIP	-SOLID	+DONTSPLASH	
	MONSTER
	+NEVERRESPAWN
	+FRIENDLY	+GHOST	+THRUGHOST
	-COUNTKILL
	Mass 500
    States
    {
	
		Spawn:
			TNT1 A 0
			TNT1 A 0  // makes the blood it emits go lo-res 
			  // if slaughtercount is over half the slaughter limit (i.e. 600) at the moment of spawning	
			ZXZ1 A 1 A_Stop
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			ZXZ1 BBBBBBBBBBBBBBBBBBB 3 A_CustomMissile ("Brutal_LiquidBlood2", 26, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 60))
			TNT1 A 0 A_NoBlocking
			ZXZ1 CCC 3 A_CustomMissile ("Brutal_LiquidBlood2", 26, 0, random (0, 360), CMF_AIMDIRECTION, random (10, 40))
			ZXZ1 DD 3 A_CustomMissile ("Brutal_LiquidBlood2", 6, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 60))
			ZXZ1 E 0
			TNT1 A 0 A_SpawnItemEx("FBD_DeadZombieMan_StomachExploded",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
		
		Death:
			TNT1 A 0
			TNT1 A 0 A_XScream
			TNT1 A 0 A_FaceTarget
			TNT1 A 0 A_CustomMissile ("XDeathArm1", 42, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AAA 0 A_CustomMissile ("Guts", 32, 0, random (150, 210), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AAA 0 A_CustomMissile ("XDeath1", 32, 0, random (150, 210), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AAA 0 A_CustomMissile ("Xdeath3", 16, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AA 0 A_CustomMissile ("Xdeath2", 16, 0, random (130, 210), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AAAA 0 A_CustomMissile ("FBD_FlyingBlood", 32, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AAAA 0 A_CustomMissile ("Brutal_FlyingBloodFaster", 32, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AAAA 0 A_CustomMissile ("Brutal_FlyingBloodMuchFaster", 32, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AAAA 0 A_CustomMissile ("SuperWallRedBlood", 32, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AAAA 0 A_CustomMissile ("BloodMistBig", 40, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 90))
			TNT1 A 0 A_NoBlocking
			ZXZ2 A 6 A_Stop
			TNT1 A 0 A_SpawnItemEx("ZombiemanFallingSplattered",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
			
		Death.Desintegrate:
			TNT1 A 0 A_XScream
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_SpawnItemEx("DesintegratedHuman",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 0 A_Stop
			TNT1 A 0 A_GiveToTarget("SoulAmmo", 1)
			TGIB ABCDEFGHIJKLMNOPQ 3
			
			//***Che: prevent the game engine from auto-respawning this gibbed corpse on nightmare as a corpse
			// while allowiing archviles raising it (they only check for the CORPSE flag)
			// and respawning via script on nightmare
			TNT1 A 0 A_ChangeFlag("CORPSE", 1)
			TNT1 A 0 A_ChangeFlag("ISMONSTER", 0)
			TGIB Q -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop
			
		XDeath:
			TNT1 A 0 A_XScream
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_FaceTarget
			TNT1 AAA 0 A_CustomMissile ("XDeath1", 42, 0, random (0, 290), 2, random (10, 60))
			TNT1 AAA 0 A_CustomMissile ("XDeath3", 42, 0, random (0, 290), 2, random (10, 60))
			TNT1 A 0 A_CustomMissile ("XDeath2", 42, 0, random (0, 190), CMF_AIMDIRECTION, random (10, 60))
			TNT1 A 0 A_CustomMissile ("XDeath4", 42, 0, random (0, 190), CMF_AIMDIRECTION, random (10, 60))
			TNT1 A 0 A_CustomMissile ("ZombieXDeath", 2, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_GiveToTarget("SoulAmmo", 1)
			
			//***Che: prevent the game engine from auto-respawning this gibbed corpse on nightmare as a corpse
			// while allowiing archviles raising it (they only check for the CORPSE flag)
			// and respawning via script on nightmare
			TNT1 A 0 A_ChangeFlag("CORPSE", 1)
			TNT1 A 0 A_ChangeFlag("ISMONSTER", 0)
			TNT1 A -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop

		Death.Plasma: 
		Death.Electric:
		Death.Electric:
		Death.Plasma2:
		Death.Bfg10k: //***Che changed damage type from extreme to custom
			TNT1 A 0
			TNT1 A 0 A_Stop
			PBR1 A 6 A_XScream
			TNT1 AAAA 0 A_CustomMissile ("BluePlasmaFireNonStatic", 42, 0, random (0, 360), 2, random (0, 180))
			TNT1 AAA 0 A_CustomMissile ("Blood", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 180))
			TNT1 AAAAAA 0 A_CustomMissile ("SuperGoreMistSmall", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (10, 90))
			TNT1 AAA 0 A_CustomMissile ("FBD_FlyingBlood", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 180))
			PBR1 B 6 A_NoBlocking
			TNT1 A 0 A_SpawnItemEx ("DetectFloorCraterSmall",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 0 A_SpawnItem("BarrelExplosionSmokeColumn")
			TNT1 A 0 A_SpawnItemEx("TinyBurningPiece", random (-15, 15), random (-15, 15))
			TNT1 AA 0 A_SpawnItemEx("TinyBurningPiece2", random (-35, 35), random (-35, 35))
			TNT1 AA 0 A_SpawnItemEx("TinyBurningPiece3", random (-45, 45), random (-45, 35))
			PBR1 CCDD 3 A_CustomMissile ("BluePlasmaFireNonStatic", 32, 0, random (0, 360), 2, random (0, 180))
			PBR1 EEFF 3
			PBR1 GG 3
			TNT1 A 0 A_GiveToTarget("SoulAmmo", 1)
			
			//***Che: prevent the game engine from auto-respawning this gibbed corpse on nightmare as a corpse
			// while allowiing archviles raising it (they only check for the CORPSE flag)
			// and respawning via script on nightmare
			TNT1 A 0 A_ChangeFlag("CORPSE", 1)
			TNT1 A 0 A_ChangeFlag("ISMONSTER", 0)
			PBR1 H -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)		
			Stop	
    
	}
}







ACTOR SergeantFallingSplattered : AbstractCorpse
{
    Radius 16 //***Che //12
    Height 40
	Health 10
	damagefactor "trample", 0.0 	DamageFactor "CauseSplash", 0.0 DamageFactor "CauseObjectsToSplashSlime", 0.0 DamageFactor "CauseObjectsToSplashNukage", 0.0
	DamageFactor "CauseObjectsToSplashBlood", 0.0 DamageFactor "CauseObjectsToSplashLava", 0.0
	damagefactor "Avoid", 0.0 damagefactor "KillMe", 0.0 damagefactor "Head", 0.0
	BloodType "FBD_Blood", "BloodSPlatterReplacer", "FBD_SawBlood"
	DamageFactor "SSG", 55.0
	+SHOOTABLE    +FLOORCLIP	-SOLID	+DONTSPLASH	
	MONSTER
	//+NEVERRESPAWN
	+FRIENDLY	+GHOST	+THRUGHOST
	-COUNTKILL
	Mass 500
    States
    {
	
		Spawn:
			TNT1 A 0
			TNT1 A 0  // makes the blood it emits go lo-res 
			  // if slaughtercount is over half the slaughter limit (i.e. 600) at the moment of spawning	
			ZXZ6 A 1 A_Stop
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			ZXZ6 BBBBBBBBBBBBBBBBBBB 3 A_CustomMissile ("Brutal_LiquidBlood2", 26, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 60))
			TNT1 A 0 A_NoBlocking
			ZXZ6 CCC 3 A_CustomMissile ("Brutal_LiquidBlood2", 26, 10, -45, 2, random (0, 60))
			ZXZ6 DD 3 A_CustomMissile ("Brutal_LiquidBlood2", 12, 10, -45, 2, random (0, 60))
			TNT1 A 0 A_CustomMissile ("ArterialBloodSPray", 10, 10, -45, 2, random (0, 60))
			ZXZ6 E 0
			TNT1 A 0 A_SpawnItemEx("DeadShotgunguyZXZ6E",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
		Raise:
			// note: the frame letter of the "----" (keep previous) sprite is ignored
			"----" A 0
			"----" A 0 A_ChangeFlag("CORPSE", 0)
			"----" A 0 A_GiveInventory("RezzingNow")
			"----" A 0 A_NoBlocking // the raising code deep in C++ makes it solid
			"----" A 0 A_JumpIf(!CallAcs("EnoughSpaceToRezNormally", 2001), "FallbackRaise")
			// The vile had already copied his friendliness and target to this corpse.
			// A_SpawnItem(Ex) automatically copy friendliness
			//   and target, but only if both the spawner and the spawnee are monsters.
			"----" A 0 A_ChangeFlag("COUNTKILL", 0)
			"----" A 0 A_ChangeFlag("ISMONSTER", 1)
			"----" A 0 A_SpawnItemEx ("ShotgunGuyRaisedByVile",0,0,0, 0,0,0, 0,SXF_TRANSFERPOINTERS | SXF_NOCHECKPOSITION)
			"----" A 1 A_Jump(256, "OnRezSfx")
			Wait //Zandronum client repeats the last frame while it waits for a status update from the server
			
		FallbackRaise:
			"----" A 0 A_GiveInventory("RezzingNow")
			"----" A 0 A_ChangeFlag("CORPSE", 0)
			"----" A 0 A_ChangeFlag("SHOOTABLE", 0)
			//"----" A -1 ACS_NamedExecuteAlways("FallbackRez", 0, 9, 0, 0) //"ShotgunGuyRaisedByVile"
			"----" A -1 ACS_NamedExecuteWithResult("FallbackRezMkII", 2001) // see _mob_list.xlsx
			Stop		
		
		Death:	
		Death.Shotgun:	
		Death.SSG:
		XDeath:
		Death.SSG:
			TNT1 A 0
			TNT1 A 0 A_Stop
			ZZD1 E 1 A_Pain
			ZZD1 E 1 A_FaceTarget
			TNT1 AA 0 A_CustomMissile ("XDeath2", 32, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AA 0 A_CustomMissile ("XDeath3", 32, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 A 0 A_SpawnItem("Muchblood2", 0, 40)
			TNT1 AAA 0 A_CustomMissile ("Guts", 32, 0, random (150, 210), 2, random (0, 40))
			TNT1 A 0 A_CustomMissile ("XDeathArm1", 32, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 A 0 A_CustomMissile ("XDeathSergeantHead", 32, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 A 0 A_XScream
			TNT1 A 0 A_NoBlocking
			SZD1 CDEFG 5
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			ZZD1 H 0
			TNT1 A 0 A_SpawnItemEx("DeadShotgunguySZD1H",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
			
			
		Death.Desintegrate:
			TNT1 A 0 A_XScream
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_SpawnItemEx("DesintegratedHuman",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 0 A_Stop
			TNT1 A 0 A_GiveToTarget("SoulAmmo", 1)
			TGIB ABCDEFGHIJKLMNOPQ 3
			
			//***Che: prevent the game engine from auto-respawning this gibbed corpse on nightmare as a corpse
			// while allowiing archviles raising it (they only check for the CORPSE flag)
			// and respawning via script on nightmare
			TNT1 A 0 A_ChangeFlag("CORPSE", 1)
			TNT1 A 0 A_ChangeFlag("ISMONSTER", 0)
			TGIB Q -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)		
			Stop
			
		XDeath:
			TNT1 A 0 A_XScream
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_FaceTarget
			TNT1 AAA 0 A_CustomMissile ("XDeath1", 42, 0, random (0, 290), 2, random (10, 60))
			TNT1 AAA 0 A_CustomMissile ("XDeath3", 42, 0, random (0, 290), 2, random (10, 60))
			TNT1 A 0 A_CustomMissile ("XDeath2", 42, 0, random (0, 190), CMF_AIMDIRECTION, random (10, 60))
			TNT1 A 0 A_CustomMissile ("XDeath4", 42, 0, random (0, 190), CMF_AIMDIRECTION, random (10, 60))
			TNT1 A 0 A_CustomMissile ("SargeXDeath", 2, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_GiveToTarget("SoulAmmo", 1)
			
			//***Che: prevent the game engine from auto-respawning this gibbed corpse on nightmare as a corpse
			// while allowiing archviles raising it (they only check for the CORPSE flag)
			// and respawning via script on nightmare
			TNT1 A 0 A_ChangeFlag("CORPSE", 1)
			TNT1 A 0 A_ChangeFlag("ISMONSTER", 0)
			TNT1 A -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)		
			Stop

		Death.Plasma: 
		Death.Electric:
		Death.Plasma2:
		Death.Bfg10k: //***Che changed damage type from extreme to custom
			TNT1 A 0
			TNT1 A 0 A_Stop
			PBR1 A 6 A_XScream
			TNT1 AAAA 0 A_CustomMissile ("BluePlasmaFireNonStatic", 42, 0, random (0, 360), 2, random (0, 180))
			TNT1 AAA 0 A_CustomMissile ("Blood", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 180))
			TNT1 AAAAAA 0 A_CustomMissile ("SuperGoreMistSmall", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (10, 90))
			TNT1 AAA 0 A_CustomMissile ("FBD_FlyingBlood", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 180))
			PBR1 B 6 A_NoBlocking
			TNT1 A 0 A_SpawnItemEx ("DetectFloorCraterSmall",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 0 A_SpawnItem("BarrelExplosionSmokeColumn")
			TNT1 A 0 A_SpawnItemEx("TinyBurningPiece", random (-15, 15), random (-15, 15))
			TNT1 AA 0 A_SpawnItemEx("TinyBurningPiece2", random (-35, 35), random (-35, 35))
			TNT1 AA 0 A_SpawnItemEx("TinyBurningPiece3", random (-45, 45), random (-45, 35))
			PBR1 CCDD 3 A_CustomMissile ("BluePlasmaFireNonStatic", 32, 0, random (0, 360), 2, random (0, 180))
			PBR1 EEFF 3
			PBR1 GG 3
			TNT1 A 0 A_GiveToTarget("SoulAmmo", 1)
			
			//***Che: prevent the game engine from auto-respawning this gibbed corpse on nightmare as a corpse
			// while allowiing archviles raising it (they only check for the CORPSE flag)
			// and respawning via script on nightmare
			TNT1 A 0 A_ChangeFlag("CORPSE", 1)
			TNT1 A 0 A_ChangeFlag("ISMONSTER", 0)
			PBR1 H -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)		
			Stop	
    
	}
}





ACTOR SergeantFallingHoleOnStomach : AbstractCorpse
{
    Radius 16 //12
    Height 40
	Health 10
	damagefactor "trample", 0.0 	DamageFactor "CauseSplash", 0.0 DamageFactor "CauseObjectsToSplashSlime", 0.0 DamageFactor "CauseObjectsToSplashNukage", 0.0
	DamageFactor "CauseObjectsToSplashBlood", 0.0 DamageFactor "CauseObjectsToSplashLava", 0.0
	damagefactor "Avoid", 0.0 damagefactor "KillMe", 0.0 damagefactor "Head", 0.0
	BloodType "FBD_Blood", "BloodSPlatterReplacer", "FBD_SawBlood"
	DamageFactor "SSG", 55.0
	+SHOOTABLE    +FLOORCLIP	-SOLID	+DONTSPLASH	
	MONSTER
	+NEVERRESPAWN
	+FRIENDLY	+GHOST	+THRUGHOST
	-COUNTKILL
	Mass 500
    States
    {
	
		Spawn:
			TNT1 A 0
			TNT1 A 0  // makes the blood it emits go lo-res 
			  // if slaughtercount is over half the slaughter limit (i.e. 600) at the moment of spawning		
			ZXZ7 A 1 A_Stop
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			ZXZ7 BBBBBBBBBBBBBBBBBBB 3 A_CustomMissile ("Brutal_LiquidBlood2", 26, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 60))
			TNT1 A 0 A_NoBlocking
			ZXZ7 CCC 3 A_CustomMissile ("Brutal_LiquidBlood2", 26, 0, random (0, 360), CMF_AIMDIRECTION, random (10, 40))
			ZXZ7 DD 3 A_CustomMissile ("Brutal_LiquidBlood2", 6, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 60))
			ZXZ7 E 0
			TNT1 A 0 A_SpawnItemEx("DeadShotgunguyZXZ7E",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
		Raise:
			// note: the frame letter of the "----" (keep previous) sprite is ignored
			"----" A 0
			"----" A 0 A_ChangeFlag("CORPSE", 0)
			"----" A 0 A_GiveInventory("RezzingNow")
			"----" A 0 A_NoBlocking // the raising code deep in C++ makes it solid
			"----" A 0 A_JumpIf(!CallAcs("EnoughSpaceToRezNormally", 2001), "FallbackRaise")
			// The vile had already copied his friendliness and target to this corpse.
			// A_SpawnItem(Ex) automatically copy friendliness
			//   and target, but only if both the spawner and the spawnee are monsters.
			"----" A 0 A_ChangeFlag("COUNTKILL", 0)
			"----" A 0 A_ChangeFlag("ISMONSTER", 1)
			"----" A 0 A_SpawnItemEx ("ShotgunGuyRaisedByVile",0,0,0, 0,0,0, 0,SXF_TRANSFERPOINTERS | SXF_NOCHECKPOSITION)
			"----" A 1 A_Jump(256, "OnRezSfx")
			Wait //Zandronum client repeats the last frame while it waits for a status update from the server
			
		FallbackRaise:
			"----" A 0 A_GiveInventory("RezzingNow")
			"----" A 0 A_ChangeFlag("CORPSE", 0)
			"----" A 0 A_ChangeFlag("SHOOTABLE", 0)
			//"----" A -1 ACS_NamedExecuteAlways("FallbackRez", 0, 9, 0, 0) //"ShotgunGuyRaisedByVile"
			"----" A -1 ACS_NamedExecuteWithResult("FallbackRezMkII", 2001) // see _mob_list.xlsx
			Stop
		Death:
			TNT1 A 0
			TNT1 A 0 A_XScream
			TNT1 A 0 A_FaceTarget
			TNT1 A 0 A_CustomMissile ("XDeathArm1", 42, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AAA 0 A_CustomMissile ("Guts", 32, 0, random (150, 210), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AAA 0 A_CustomMissile ("XDeath1", 32, 0, random (150, 210), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AAA 0 A_CustomMissile ("Xdeath3", 16, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AA 0 A_CustomMissile ("Xdeath2", 16, 0, random (130, 210), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AAAA 0 A_CustomMissile ("FBD_FlyingBlood", 32, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AAAA 0 A_CustomMissile ("Brutal_FlyingBloodFaster", 32, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AAAA 0 A_CustomMissile ("Brutal_FlyingBloodMuchFaster", 32, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AAAA 0 A_CustomMissile ("SuperWallRedBlood", 32, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AAAA 0 A_CustomMissile ("BloodMistBig", 40, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 90))
			TNT1 A 0 A_NoBlocking
			ZXZ2 A 6 A_Stop
			TNT1 A 0 A_SpawnItemEx("SergeantFallingSplattered",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
			
			
		Death.Desintegrate:
			TNT1 A 0 A_XScream
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_SpawnItemEx("DesintegratedHuman",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 0 A_Stop
			TNT1 A 0 A_GiveToTarget("SoulAmmo", 1)
			TGIB ABCDEFGHIJKLMNOPQ 3
			
			//***Che: prevent the game engine from auto-respawning this gibbed corpse on nightmare as a corpse
			// while allowiing archviles raising it (they only check for the CORPSE flag)
			// and respawning via script on nightmare
			TNT1 A 0 A_ChangeFlag("CORPSE", 1)
			TNT1 A 0 A_ChangeFlag("ISMONSTER", 0)
			TGIB Q -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)		
			Stop
			
		XDeath:
			TNT1 A 0 A_XScream
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_FaceTarget
			TNT1 AAA 0 A_CustomMissile ("XDeath1", 42, 0, random (0, 290), 2, random (10, 60))
			TNT1 AAA 0 A_CustomMissile ("XDeath3", 42, 0, random (0, 290), 2, random (10, 60))
			TNT1 A 0 A_CustomMissile ("XDeath2", 42, 0, random (0, 190), CMF_AIMDIRECTION, random (10, 60))
			TNT1 A 0 A_CustomMissile ("XDeath4", 42, 0, random (0, 190), CMF_AIMDIRECTION, random (10, 60))
			TNT1 A 0 A_CustomMissile ("SargeXDeath", 2, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_GiveToTarget("SoulAmmo", 1)
			
			//***Che: prevent the game engine from auto-respawning this gibbed corpse on nightmare as a corpse
			// while allowiing archviles raising it (they only check for the CORPSE flag)
			// and respawning via script on nightmare
			TNT1 A 0 A_ChangeFlag("CORPSE", 1)
			TNT1 A 0 A_ChangeFlag("ISMONSTER", 0)
			TNT1 A -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)		
			Stop

		Death.Plasma: 
		Death.Electric:
		Death.Plasma2:
		Death.Bfg10k: //***Che changed damage type from extreme to custom
			TNT1 A 0
			TNT1 A 0 A_Stop
			PBR1 A 6 A_XScream
			TNT1 AAAA 0 A_CustomMissile ("BluePlasmaFireNonStatic", 42, 0, random (0, 360), 2, random (0, 180))
			TNT1 AAA 0 A_CustomMissile ("Blood", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 180))
			TNT1 AAAAAA 0 A_CustomMissile ("SuperGoreMistSmall", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (10, 90))
			TNT1 AAA 0 A_CustomMissile ("FBD_FlyingBlood", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 180))
			PBR1 B 6 A_NoBlocking
			TNT1 A 0 A_SpawnItemEx ("DetectFloorCraterSmall",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 0 A_SpawnItem("BarrelExplosionSmokeColumn")
			TNT1 A 0 A_SpawnItemEx("TinyBurningPiece", random (-15, 15), random (-15, 15))
			TNT1 AA 0 A_SpawnItemEx("TinyBurningPiece2", random (-35, 35), random (-35, 35))
			TNT1 AA 0 A_SpawnItemEx("TinyBurningPiece3", random (-45, 45), random (-45, 35))
			PBR1 CCDD 3 A_CustomMissile ("BluePlasmaFireNonStatic", 32, 0, random (0, 360), 2, random (0, 180))
			PBR1 EEFF 3
			PBR1 GG 3
			TNT1 A 0 A_GiveToTarget("SoulAmmo", 1)
			
			//***Che: prevent the game engine from auto-respawning this gibbed corpse on nightmare as a corpse
			// while allowiing archviles raising it (they only check for the CORPSE flag)
			// and respawning via script on nightmare
			TNT1 A 0 A_ChangeFlag("CORPSE", 1)
			TNT1 A 0 A_ChangeFlag("ISMONSTER", 0)
			PBR1 H -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)		
			Stop	
    
	}
}


ACTOR BrutalizedZombieMan1: AbstractDyingGuy
{
	Game Doom
	Radius 16
	Height 50
	Health 20
	bloodtype "DeadBlood"
	damagefactor "Head", 0.0 damagefactor "Leg", 0.0
	PainSound "grunt/pain"
	PainChance 255
	Mass 999999

	+SHOOTABLE
	+NORADIUSDMG
	+FLOORCLIP
	+DONTSPLASH
	+FRIENDLY//
	+GHOST
	-SOLID
	+THRUGHOST
	-COUNTKILL
	Scale 1.0
	Mass 500
	States
	{
				
		Spawn:
			TNT1 A 0
			TNT1 A 0 
			TNT1 A 0 A_Recoil(2)
			TNT1 A 0 A_CustomMissile ("XDeathArm1", 35, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("XDeath1", 40, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
		Pain:
			ZZD1 A 30
			Goto DieNow
		
		DieNow:
			TNT1 A 0
			TNT1 A 0 A_SpawnItemEx ("BrutalizedZombieManStop",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
		
		Death:
			TNT1 A 0
			TNT1 AAAA 0 A_CustomMissile ("Brains1", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("Brains2", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("Brains3", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("Brains4", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("Brains5", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("SmallBrainPieceFast", random (45, 55), random (5, -5), random (170, 190), CMF_AIMDIRECTION, random (-10, 10))
			TNT1 AAAA 0 A_CustomMissile ("SmallBrainPiece", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("SuperWallRedBlood", 46, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AAAAAAAA 0 A_CustomMissile ("BrainBlood", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeath1", 40, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_Recoil(4)
			ZZD1 B 4
			TNT1 A 0
			TNT1 A 0 A_SpawnItemEx ("BrutalizedZombieMan2",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
			
		Death.SSG:
		XDeath:
			TNT1 A 0 A_XScream
			
			TNT1 A 0 A_NoBlocking
			// zombiexdeath is a transient gore spawner
			TNT1 A 0 A_CustomMissile ("ZombieXDeath", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			
			//***Che: prevent the game engine from auto-respawning this gibbed corpse on nightmare as a corpse
			// while allowiing archviles raising it (they only check for the CORPSE flag)
			// and respawning via script on nightmare
			TNT1 A 0 A_ChangeFlag("CORPSE", 1)
			TNT1 A 0 A_ChangeFlag("ISMONSTER", 0)
			TNT1 A -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)		
			Stop
	}
}

actor AbstractZombiemanCorpse: FBD_CurbstompedMarine {
	States {
		//***Che
		Raise:
			// note: the frame letter of the "----" (keep previous) sprite is ignored
			"----" A 0
			"----" A 0 A_ChangeFlag("CORPSE", 0)
			"----" A 0 A_GiveInventory("RezzingNow")
			"----" A 0 A_NoBlocking // the raising code deep in C++ makes it solid
			"----" A 0 A_JumpIf(!CallAcs("EnoughSpaceToRezNormally", 2000), "FallbackRaise")
			// The vile had already copied his friendliness and target to this corpse.
			// A_SpawnItem(Ex) automatically copy friendliness
			//   and target, but only if both the spawner and the spawnee are monsters.
			"----" A 0 A_ChangeFlag("COUNTKILL", 0)
			"----" A 0 A_ChangeFlag("ISMONSTER", 1)
			"----" A 0 A_SpawnItemEx ("ZombiemanRaisedByVile",0,0,0, 0,0,0, 0,SXF_TRANSFERPOINTERS | SXF_NOCHECKPOSITION)
			"----" A 1 A_Jump(256, "OnRezSfx")
			Wait //Zandronum client repeats the last frame while it waits for a status update from the server
			
		FallbackRaise:
			"----" A 0 A_GiveInventory("RezzingNow")
			"----" A 0 A_ChangeFlag("CORPSE", 0)
			"----" A 0 A_ChangeFlag("SHOOTABLE", 0)
			//"----" A -1 ACS_NamedExecuteAlways("FallbackRez", 0, 6, 0, 0) // "ZombiemanRaisedByVile"
			"----" A -1 ACS_NamedExecuteWithResult("FallbackRezMkII", 2000) // see _mob_list.xlsx
			Stop
	}
}

actor BrutalizedZombieManStop: AbstractZombiemanCorpse //FBD_CurbstompedMarine
{
    States
    {
		//***Che // this is a descendant of FBD_CurbstompedMarine, which is neither a missile nor a monster
		Spawn:
			ZZD2 A 1
		Stay: // ancestor's Pain.Kick, Pain.ExplosiveImpact and Pain.Trample redirect here after z-thrusting the actor
			ZZD2 ABEC 5 A_SpawnItem("FBD_FlyingBlood",0,5,0,1)
			ZZD3 D 0
			TNT1 A 0 A_SpawnItemEx("FBD_DeadZombieMan_NoArmFront",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
	}
}

ACTOR BrutalizedZombieMan2: BrutalizedZombieMan1
{
	States
	{
		//***Che // this is a descendant of FBD_CurbstompedMarine, which is neither a missile nor a monster
		Spawn:
		Stay: // ancestor's Pain.Kick, Pain.ExplosiveImpact and Pain.Trample redirect here after z-thrusting the actor
		Pain:
			ZZD1 B 30
			Goto DieNow
		
		DieNow:
			TNT1 A 0
			TNT1 A 0 A_SpawnItemEx ("BrutalizedZombieManStop2",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
		
		Death:
			TNT1 A 0
			TNT1 A 0 A_Recoil(2)
			TNT1 A 0 A_CustomMissile ("XDeathArm1", 35, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeath1", 40, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("BloodMistBig", 40, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 90))
			TNT1 A 0
			TNT1 A 0 A_Recoil(4)
			
			ZZD1 C 6
			TNT1 A 0 A_SpawnItemEx ("BrutalizedZombieMan3",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
	}
}

actor BrutalizedZombieManStop2: AbstractZombiemanCorpse //FBD_CurbstompedMarine
{
    States
    {
		//***Che // this is a descendant of FBD_CurbstompedMarine, which is neither a missile nor a monster
		Spawn:
		Stay: // ancestor's Pain.Kick, Pain.ExplosiveImpact and Pain.Trample redirect here after z-thrusting the actor
			ZZD3 FG 6 A_SpawnItem("FBD_FlyingBlood",0,5,0,1)
			TNT1 A 0 A_SpawnItemEx("FBD_DeadZombieMan_NoHeadNoArm",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
	}
}

ACTOR BrutalizedZombieMan3: BrutalizedZombieMan1
{
	States
	{
		Spawn:
		Pain:
			TNT1 A 0
			TNT1 A 0 A_Jump(96, "DieNow")
			ZZD1 C 30
		
			Goto DieNow
		
		DieNow:
			TNT1 A 0
			TNT1 A 0 A_SpawnItemEx ("BrutalizedZombieManStop3",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // without such huge margin ACS scripts run ownerless -- as if they could feel this actor expiring back in time
			Stop
		
		Death:
			TNT1 A 0
			TNT1 A 0 A_Recoil(2)
			//TNT1 AAA 0 bright A_CustomMissile ("SuperGoreSpawner", 35, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 180))
			TNT1 A 0 A_SpawnItem("MeatDeath")
			TNT1 A 0 A_SpawnItem("RipGuts")
			//TNT1 A 0 A_SpawnItemEx("ArmorShardFatalityBonus2", 0,0,20, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			//TNT1 A 0 A_SpawnItemEx("HealthPlusFatalityBonus2", 0,0,20, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			TNT1 A 0 ACS_NamedExecuteAlways("DropFatalityBonuses", 0, 2, 2, 0) // 0, health, armor, 0 -- rounded down to nearest 2
			
			ZZD1 EFG 6
			TNT1 A 0 A_SpawnItem("BigBloodspot")
			TNT1 A 0 A_SpawnItemEx("FBD_DeadZombieManJustLegsAreLeft2",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // without such huge margin ACS scripts run ownerless -- as if they could feel this actor expiring back in time
			Stop
	}
}


actor BrutalizedZombieManStop3: AbstractZombiemanCorpse //FBD_CurbstompedMarine
{
    States
    {
		//***Che // this is a descendant of FBD_CurbstompedMarine, which is neither a missile nor a monster
		Spawn:
		Stay: // ancestor's Pain.Kick, Pain.ExplosiveImpact and Pain.Trample redirect here after z-thrusting the actorz-thrusting the actor
			ZZD4 AB 6 A_SpawnItem("FBD_FlyingBlood",0,5,0,1)
			TNT1 A 0 A_SpawnItemEx("FBD_DeadZombieMan_NoHeadNoArms",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // without such huge margin ACS scripts run ownerless -- as if they could feel this actor expiring back in time
			Stop
	}
}
	   
actor ZombieLegOnFoot: AbstractZombiemanCorpse //FBD_CurbstompedMarine
{
	Scale 1.0
	-SHOOTABLE
	-SOLID
    States
    {
		//***Che // this is a descendant of FBD_CurbstompedMarine, which is neither a missile nor a monster
		Spawn:
		Stay: // ancestor's Pain.Kick, Pain.ExplosiveImpact and Pain.Trample redirect here after z-thrusting the actorz-thrusting the actor
			TNT1 A 0 A_PlaySound("misc/xdeath2")
			LEG1 IJK 8
			TNT1 A 0 A_SpawnItemEx("Gib_ZombieLeg1",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // without such huge margin ACS scripts run ownerless -- as if they could feel this actor expiring back in time
			Stop
	}
}

ACTOR BrutalizedZombieManLeg: BrutalizedZombieMan1
{
	States
	{
		Spawn:
		Pain:
			POS7 A 5 
			Goto DieNow
		
		DieNow:
			POS7 BCD 5
			TNT1 A 0 A_SpawnItemEx ("FBD_DeadZombieMan_NoLeg",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // without such huge margin ACS scripts run ownerless -- as if they could feel this actor expiring back in time
			Stop
		
		Death:
			TNT1 A 0
			TNT1 A 0 A_Recoil(4)
			
			TNT1 AAAA 0 A_CustomMissile ("Brains1", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("Brains2", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("Brains3", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("Brains4", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("Brains5", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("SmallBrainPieceFast", random (45, 55), random (5, -5), random (170, 190), CMF_AIMDIRECTION, random (-10, 10))
			TNT1 AAAA 0 A_CustomMissile ("SmallBrainPiece", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("SuperWallRedBlood", 46, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			//TNT1 AAAAAAAA 0 A_CustomMissile ("BrainBlood", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathArm1", 35, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAA 0 A_CustomMissile ("XDeath1", 40, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 ThrustThingZ(0,30,0,1)
			ID13 ABCDEF 5
			TNT1 A 0 A_SpawnItemEx ("VeryFuckedUpBrutalizedZombiemanLeg",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // without such huge margin ACS scripts run ownerless -- as if they could feel this actor expiring back in time
			Stop
	}
}




ACTOR DyingSergeant: AbstractDyingGuy
{
	Game Doom
	Radius 16
	Height 28
	Health 50
	PainSound "grunt/pain"
	PainChance 255
	damagefactor "Blood", 0.0 damagefactor "BlueBlood", 0.0 damagefactor "GreenBlood", 0.0
    damagefactor "Avoid", 0.0
	damagefactor "Leg", 0.0
    damagefactor "Kick", 6.0	
	Mass 500
	+SHOOTABLE
	+FLOORCLIP
	+DONTSPLASH
	MONSTER
	+FRIENDLY//
	-COUNTKILL
	+GHOST
	+THRUGHOST
	//-SOLID
	
	-COUNTKILL
	
	//***Che: required for headboxes to work
	+ISMONSTER
	+NOTARGET
	-COUNTKILL
	//+SOLID // headboxes monitor this flag and auto-terminate if it is unset
	var int user_head_tid;
	var int user_head_type;
	var int user_head_rel;
	var int user_head_scale;
	var int user_head_xyzf;	
	var int user_sleeping;
	var int user_item_no;
	var int user_serverside_sfchk;	
	
	States
	{
		Death.fire:
		Death.Flames:
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			//TNT1 A 0 A_SpawnItemEx("ArmorShardFatalityBonus2", 0,0,20, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			//TNT1 A 0 A_SpawnItemEx("HealthPlusFatalityBonus2", 0,0,20, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			TNT1 A 0 ACS_NamedExecuteAlways("DropFatalityBonuses", 0, 2, 2, 0) // 0, health, armor, 0 -- rounded down to nearest 2
			TNT1 A 0 A_Scream
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_SpawnItemEx("BurningZombie",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the spawned corpse time to access our inventory
			Stop
			
		Spawn:
			TNT1 A 0 NODELAY ACS_NamedExecuteWithResult("FBD_RunMonster",12)
			TNT1 A 0 A_Pain
			TNT1 A 0 A_FaceTarget
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			TNT1 A 0 A_PlaySound ("BURNZOM", CHAN_VOICE)
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 0, 33, 1) // force create
			
			SPO5 AAAAA 2 A_CustomMissile ("Brutal_LiquidBlood", 20, 0, 90, 2, random (0, 45))
			TNT1 A 0 A_Jump(42, "Death")
			
			
			Goto Suffer
		Suffer:
			TNT1 A 0
			SPO5 BBBBB 2 A_CustomMissile ("Brutal_LiquidBlood", 20, 0, 90, 2, random (0, 45))
			SPO5 CCCCC 2 A_CustomMissile ("Brutal_LiquidBlood", 20, 0, 90, 2, random (0, 45))
			TNT1 A 0 A_Jump(12, "LastStand")  
			TNT1 A 0 A_GiveInventory("DeathTimer1", 1)
			TNT1 A 0 A_JumpIfInventory("DeathTimer1", 4, "GotoDeath")
			Loop
		GotoDeath:
			TNT1 A 0
			TNT1 A 0 A_ChangeFlag("SHOOTABLE", 0)
			Goto Death
			
		Death.Cut:
		Death.SniperBullet:
		Death.Bullet792:		
		Death.Minigun:
		Death:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			SPO5 D 8
			TNT1 A 0 A_PlaySound ("grunt/death", CHAN_VOICE)
			TNT1 A 0 A_SpawnItemEx ("DeadShotgunGuy_NoArm",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the spawned corpse time to access our inventory
			Stop

		Death.Head:
		Death.HeadStun:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_PlaySound("misc/xdeath4", CHAN_VOICE)
			TNT1 A 0 A_JumpIfInTargetInventory("HasPlasmaWeapon", 1, "Death.Plasma")
			TNT1 A 0 A_JumpIfInTargetInventory("HasCutingWeapon", 1, "Death.Decaptate")
			TNT1 A 0 A_SpawnItemEx("ShotgunguyHeadExplode",0,0,30,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 0 A_XScream
			//TNT1 A 0 A_SpawnItemEx("ArmorShardFatalityBonus2", 0,0,20, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			//TNT1 A 0 A_SpawnItemEx("HealthPlusFatalityBonus2", 0,0,20, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			TNT1 A 0 ACS_NamedExecuteAlways("DropFatalityBonuses", 0, 2, 2, 0) // 0, health, armor, 0 -- rounded down to nearest 2
			TNT1 AAAAAAAAAAA 0 A_CustomMissile ("BrainBlood", 37, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			SZD4 AAAAA 2 A_CustomMissile ("Brutal_LiquidBlood", 25, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 110))
			SZD4 BBBBBBBBBBBBBBBBBBBBBBBBB 1 A_CustomMissile ("Brutal_LiquidBlood", 10, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 110))
			TNT1 A 0 A_SpawnItemEx("DeadShotgunguySZD4D",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the spawned corpse time to access our inventory
			Stop
		
		Death.Decaptate:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_PlaySound("misc/xdeath4", CHAN_VOICE)
			TNT1 A 0 A_CustomMissile ("XDeathSergeantHead", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_XScream
			//TNT1 A 0 A_SpawnItemEx("ArmorShardFatalityBonus2", 0,0,20, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			//TNT1 A 0 A_SpawnItemEx("HealthPlusFatalityBonus2", 0,0,20, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			TNT1 A 0 ACS_NamedExecuteAlways("DropFatalityBonuses", 0, 2, 2, 0) // 0, health, armor, 0 -- rounded down to nearest 2
			TNT1 AAAAAAAAAAA 0 A_CustomMissile ("BrainBlood", 37, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_NoBlocking
			SZD4 AAAAA 2 A_CustomMissile ("Brutal_LiquidBlood", 25, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 110))
			SZD4 BBBBBBBBBBBBBBBBBBBBBBBBB 1 A_CustomMissile ("Brutal_LiquidBlood", 10, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 110))
			TNT1 A 0 A_SpawnItemEx("DeadShotgunguySZD4D",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the spawned corpse time to access our inventory
			Stop
		
		Death.Plasma:
		Death.Electric:
		Death.Plasma2:
		Death.HeadPlasma:
		Death.Bfg10k: //***Che changed damage type from extreme to custom
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 
			TNT1 A 0 A_XScream
			TNT1 A 0 A_NoBlocking
			XBRN AA 2 BRIGHT A_SpawnItem("BlueFlare",0,43)
			TNT1 AAAA 0 A_CustomMissile ("FBD_Blood", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			
			TNT1 A 0 A_CustomMissile ("XDeathBurnedArm", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathBurnedLeg", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathBurnedSkull", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathBurnedMeat", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathBurnedMeat2", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathBurnedMeat3", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			//TNT1 A 0 A_SpawnItemEx("ArmorShardFatalityBonus2", 0,0,20, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			//TNT1 A 0 A_SpawnItemEx("HealthPlusFatalityBonus2", 0,0,20, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			TNT1 A 0 ACS_NamedExecuteAlways("DropFatalityBonuses", 0, 2, 2, 0) // 0, health, armor, 0 -- rounded down to nearest 2
			XBRN BB 2 BRIGHT A_SpawnItem("BlueFlare",0,43)
			TNT1 A 0 A_CustomMissile ("FBD_Blood", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			XBRN CC 2 BRIGHT A_SpawnItem("BlueFlare",0,43)
			TNT1 AAAAA 0 A_CustomMissile ("PlasmaParticleX", 48, 0, random (0, 360), 2, random (0, 360))
			TNT1 AAA 0 A_CustomMissile ("BigPlasmaParticleX", 42, 0, random (0, 360), 2, random (0, 360))
			
			//***Che: prevent the game engine from auto-respawning this gibbed corpse on nightmare as a corpse
			// while allowiing archviles raising it (they only check for the CORPSE flag)
			// and respawning via script on nightmare
			TNT1 A 0 A_ChangeFlag("CORPSE", 1)
			TNT1 A 0 A_ChangeFlag("ISMONSTER", 0)
			TNT1 A -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)		
			Stop		 
			 
		Xdeath:
		Death.SuperPunch:
		Death.Blast:
		Death.SSG:
		Death.Shotgun:
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_FaceTarget
			TNT1 AAAA 0 A_CustomMissile ("XDeath1", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AAAA 0 A_CustomMissile ("BloodMistBig", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 90))
			TNT1 AA 0 A_CustomMissile ("XDeath2", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AA 0 A_CustomMissile ("XDeath3", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AAA 0 A_CustomMissile ("FBD_Bloodmist", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 40))
			TNT1 A 0 A_CustomMissile ("XDeathArm1", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 40))
			TNT1 A 0 A_CustomMissile ("XDeathSergeantHeadOnXDeath", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 40))
			TNT1 A 0 A_SpawnItem("RipGuts")
			TNT1 A 0 A_XScream
			TNT1 A 0 A_NoBlocking
			SZD1 EFGH 6
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			TNT1 A 0 A_SpawnItemEx("DeadShotgunguySZD1H",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // without such huge margin ACS scripts run ownerless -- as if they could feel this actor expiring back in time
			Stop	
			
		LastStand:
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_Pain
			TNT1 A 0 A_CHangeFlag("FRIENDLY", 0)
			TNT1 A 0 A_SpawnItemEx ("SergeantLastStand2",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // without such huge margin ACS scripts run ownerless -- as if they could feel this actor expiring back in time
			Stop

	}
}


ACTOR DeadShotgunguyNoHeadContinue: DyingSergeant
{
	Radius 16
	Height 28
	PainChance 0
	damagefactor "Head", 0.0	
	damagefactor "HeadStun", 0.0	
	damagefactor "HeadPlasma", 0.0
	
	States
	{
		Spawn:
			TNT1 A 0
			TNT1 A 0 			
			SPDH BBBBBBBBBBBBBBBBBBCCCCC 2 A_CustomMissile ("Brutal_LiquidBlood2", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (60, 120))
			
		Death:
			TNT1 A 0
			TNT1 A 0 A_ChangeFLag("SHOOTABLE", 0)
			TNT1 A 0 A_NoBlocking
			SPDH DDDD 2 A_CustomMissile ("Brutal_LiquidBlood2", 15, -10, 45, 2, random (60, 120))
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			TNT1 A 0 A_CustomMissile ("ArterialBloodSPray", 10, 10, -45, 2, random (0, 60))
			TNT1 A 0 A_SpawnItemEx("DeadShotgunguySPDHE",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // without such huge margin ACS scripts run ownerless -- as if they could feel this actor expiring back in time
			Stop
		
		Death.Plasma: 
		Death.Electric:
		Death.Plasma2:
		Death.Bfg10k: //***Che changed damage type from extreme to custom
			TNT1 A 0
			TNT1 A 0 A_XScream
			TNT1 A 0 A_NoBlocking
			XBRN AA 2 BRIGHT A_SpawnItem("BlueFlare",0,43)
			TNT1 AAAA 0 A_CustomMissile ("FBD_Blood", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			
			TNT1 A 0 A_CustomMissile ("XDeathBurnedArm", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathBurnedLeg", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathBurnedSkull", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathBurnedMeat", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathBurnedMeat2", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathBurnedMeat3", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			//TNT1 A 0 A_SpawnItemEx("ArmorShardFatalityBonus2", 0,0,20, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			//TNT1 A 0 A_SpawnItemEx("HealthPlusFatalityBonus2", 0,0,20, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			TNT1 A 0 ACS_NamedExecuteAlways("DropFatalityBonuses", 0, 2, 2, 0) // 0, health, armor, 0 -- rounded down to nearest 2
			XBRN BB 2 BRIGHT A_SpawnItem("BlueFlare",0,43)
			TNT1 A 0 A_CustomMissile ("FBD_Blood", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			XBRN CC 2 BRIGHT A_SpawnItem("BlueFlare",0,43)
			TNT1 AAAAA 0 A_CustomMissile ("PlasmaParticleX", 48, 0, random (0, 360), 2, random (0, 360))
			TNT1 AAA 0 A_CustomMissile ("BigPlasmaParticleX", 42, 0, random (0, 360), 2, random (0, 360))
			
			//***Che: prevent the game engine from auto-respawning this gibbed corpse on nightmare as a corpse
			// while allowiing archviles raising it (they only check for the CORPSE flag)
			// and respawning via script on nightmare
			TNT1 A 0 A_ChangeFlag("CORPSE", 1)
			TNT1 A 0 A_ChangeFlag("ISMONSTER", 0)
			TNT1 A -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)		
			Stop		 
			 
		Xdeath:
		Death.SuperPunch:
		Death.Blast:
		Death.SSG:
		Death.Cut:
		Death.Shotgun:
		Death.SniperBullet:
		Death.Bullet792:		
		Death.Minigun:
			TNT1 A 0 A_SpawnItemEx("MeatDeath",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 AA 0 A_CustomMissile ("XDeathArm1", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 40))
			TNT1 A 0 A_SpawnItem("RipGuts")
			TNT1 A 0 A_XScream
			TNT1 A 0 A_NoBlocking
			SZD1 EFGH 6
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			TNT1 A 0 A_SpawnItemEx("DeadShotgunguySZD1H",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // without such huge margin ACS scripts run ownerless -- as if they could feel this actor expiring back in time
			Stop	
		
	}
}



ACTOR DyingSergeantNoLeg: AbstractDyingGuy
{
    Radius 12
    Height 16
    Speed 9
	Health 50
	PainSound "grunt/pain"
	DeathSound "grunt/death"
	+SHOOTABLE
	+DONTSPLASH
    +FLOORCLIP
	//+NOBLOCKMAP
    +LOOKALLAROUND
	+FRIGHTENED
	+FRIENDLY//
	+GHOST
	+THRUGHOST
	-COUNTKILL
	-SOLID
	damagefactor "Kick", 6.0
	damagefactor "trample", 2.0
	PainChance "Kick", 255
	damagefactor "Leg", 0.0
	damagefactor "Death.KickDowned", 100.0
    States
    {
		//***Che adding headbox removal scripts because SergeantLastStand1 inherits from this!
		Pain.Kick:
			TNT1 A 0 A_CustomMissile ("Teeth", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("Blood", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("TeethNoBounce", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			//TNT1 A 0 A_SpawnItemEx("HealthPlusFatalityBonus2", 0,0,20, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			TNT1 A 0 ACS_NamedExecuteAlways("DropFatalityBonuses", 0, 2, 0, 0) // 0, health, armor, 0 -- rounded down to nearest 2
			TNT1 A 0 A_Pain
			TNT1 A 0 A_FaceTarget
			SMAK ABA 6
			SMAM A 15
			Goto See
		
		Death.Kick:
		Death.Extremepunches:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_StopSound(CHAN_VOICE)
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_GiveToTarget("GoFatality", 1)
			TNT1 A 0 A_GiveToTarget("GoSpecial", 1)
			//TNT1 AA 0 A_SpawnItemEx("ArmorShardFatalityBonus2", 0,0,20, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			//TNT1 AA 0 A_SpawnItemEx("HealthPlusFatalityBonus2", 0,0,20, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			TNT1 A 0 ACS_NamedExecuteAlways("DropFatalityBonuses", 0, 4, 4, 0) // 0, health, armor, 0 -- rounded down to nearest 2
			TNT1 A 0 A_GiveToTarget("IsCurbstompingSergeant", 1)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // without such huge margin ACS scripts run ownerless -- as if they could feel this actor expiring back in time
			Stop
	
		Spawn:
			SMAM A 1 A_Look
			Loop
		See:
			SMAM ABAB 10 A_Wander
			SMAM A 9 A_Pain
			TNT1 A 0 A_SpawnItemEx("FBD_FlyingBlood", 0, 0, 10, 0, 0,0,0,0,0)
			TNT1 A 0 A_Jump(12, "LastStand")
			TNT1 A 0 A_GiveInventory("DeathTimer1", 1)
			TNT1 A 0 A_JumpIfInventory("DeathTimer1", 4, "GotoDeath")
			Loop
			
		GotoDeath:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_ChangeFlag("SHOOTABLE", 0)
			TNT1 A 0 A_ChangeFlag("FRIENDLY", 1)
			Goto Death
		
		Death:
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_SpawnItemEx("DeadShotgunGuy_NoLeg",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // without such huge margin ACS scripts run ownerless -- as if they could feel this actor expiring back in time
			Stop
		
		Crush:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 1
			TNT1 A 0 A_SpawnItem("BodyRemovalThing")
			TNT1 A 1 A_XScream
			TNT1 A 0 A_ChangeFlag("CORPSE", 1)
			TNT1 A 0 A_ChangeFlag("ISMONSTER", 0)
			TNT1 A -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop
		
		
		Death.Plasma: 
		Death.Electric:
		Death.Plasma2:
		Death.Bfg10k: //***Che changed damage type from extreme to custom
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_XScream
			TNT1 A 0 A_NoBlocking
			XBRN AA 2 BRIGHT A_SpawnItem("BlueFlare",0,43)
			TNT1 AAAA 0 A_CustomMissile ("FBD_Blood", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			
			TNT1 A 0 A_CustomMissile ("XDeathBurnedArm", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathBurnedLeg", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathBurnedSkull", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathBurnedMeat", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathBurnedMeat2", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathBurnedMeat3", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			//TNT1 A 0 A_SpawnItemEx("ArmorShardFatalityBonus2", 0,0,20, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			//TNT1 A 0 A_SpawnItemEx("HealthPlusFatalityBonus2", 0,0,20, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			TNT1 A 0 ACS_NamedExecuteAlways("DropFatalityBonuses", 0, 2, 2, 0) // 0, health, armor, 0 -- rounded down to nearest 2
			XBRN BB 2 BRIGHT A_SpawnItem("BlueFlare",0,43)
			TNT1 A 0 A_CustomMissile ("FBD_Blood", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			XBRN CC 2 BRIGHT A_SpawnItem("BlueFlare",0,43)
			TNT1 AAAAA 0 A_CustomMissile ("PlasmaParticleX", 48, 0, random (0, 360), 2, random (0, 360))
			TNT1 AAA 0 A_CustomMissile ("BigPlasmaParticleX", 42, 0, random (0, 360), 2, random (0, 360))
			
			//***Che: prevent the game engine from auto-respawning this gibbed corpse on nightmare as a corpse
			// while allowiing archviles raising it (they only check for the CORPSE flag)
			// and respawning via script on nightmare
			TNT1 A 0 A_ChangeFlag("CORPSE", 1)
			TNT1 A 0 A_ChangeFlag("ISMONSTER", 0)
			TNT1 A -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)		
			Stop		 
		
		Death.Fire:
		Death.Flames:
		Death.Burn:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 //A_SpawnItemEx("ArmorShardFatalityBonus2", 0,0,20, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			//TNT1 A 0 A_SpawnItemEx("HealthPlusFatalityBonus2", 0,0,20, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			TNT1 A 0 ACS_NamedExecuteAlways("DropFatalityBonuses", 0, 2, 2, 0) // 0, health, armor, 0 -- rounded down to nearest 2
			TNT1 A 0 A_SpawnItemEx ("DyingSergeantNoLegInFlames",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // without such huge margin ACS scripts run ownerless -- as if they could feel this actor expiring back in time
			Stop
		
		Death.Trample:	
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_CustomMissile ("MuchBlood2", 10, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("Brains1", 10, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("Brains2", 10, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("Brains3", 10, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("Brains4", 10, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("Brains5", 10, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("SmallBrainPieceFast", random (45, 55), random (5, -5), random (170, 190), CMF_AIMDIRECTION, random (-10, 10))
			TNT1 AAAA 0 A_CustomMissile ("SmallBrainPieceFast", 10, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_SpawnItemEx ("StompedSergeant",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			//TNT1 A 0 A_SpawnItemEx("ArmorShardFatalityBonus2", 0,0,20, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			//TNT1 A 0 A_SpawnItemEx("HealthPlusFatalityBonus2", 0,0,20, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			TNT1 A 0 ACS_NamedExecuteAlways("DropFatalityBonuses", 0, 2, 2, 0) // 0, health, armor, 0 -- rounded down to nearest 2
			
			//***Che: prevent the game engine from auto-respawning this gibbed corpse on nightmare as a corpse
			// while allowiing archviles raising it (they only check for the CORPSE flag)
			// and respawning via script on nightmare
			TNT1 A 0 A_ChangeFlag("CORPSE", 1)
			TNT1 A 0 A_ChangeFlag("ISMONSTER", 0)
			TNT1 A -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)		
			Stop
			
		LastStand:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_Pain
			TNT1 A 0 A_CHangeFlag("FRIENDLY", 0)
			TNT1 A 0 A_SpawnItemEx ("SergeantLastStand1",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // without such huge margin ACS scripts run ownerless -- as if they could feel this actor expiring back in time
			Stop	
	
	}
}



ACTOR DyingSergeantLegBlewedOff: DyingSergeantNoLeg
{
	Game Doom
	Radius 16
	Height 28
	Health 50
	PainSound "grunt/pain"
	PainChance 255
	damagefactor "Blood", 0.0 damagefactor "BlueBlood", 0.0 damagefactor "GreenBlood", 0.0
    damagefactor "Avoid", 0.0
    damagefactor "Kick", 6.0	
	Mass 500
	-SOLID
	//+SOLID // headboxes monitor this flag and auto-terminate if it is unset
	+SHOOTABLE
	+GHOST
	+THRUGHOST
	-COUNTKILL
	
	//***Che: required for headboxes to work
	+ISMONSTER
	+NOTARGET
	-COUNTKILL
	var int user_head_tid;
	var int user_head_type;
	var int user_head_rel;
	var int user_head_scale;
	var int user_head_xyzf;	
	var int user_sleeping;
	var int user_item_no;
	var int user_serverside_sfchk;		
	
	States
	{
		Spawn:
			TNT1 A 0 NODELAY ACS_NamedExecuteWithResult("FBD_RunMonster",12)
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 0, 20, 1) // force create
			  
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			TNT1 A 0 A_PlaySound ("BURNZOM", CHAN_VOICE)
			SPO3 CCCCC 2 A_CustomMissile ("Brutal_LiquidBlood", 30, 0, random(0, 180), CMF_AIMDIRECTION, random (0, 35))
			TNT1 A 0 A_Jump(32, "Death")
			Goto Suffer
		
		Suffer:
			SPO3 DDDDD 2 A_CustomMissile ("Brutal_LiquidBlood", 12, 0, random(0, 180), CMF_AIMDIRECTION, random (0, 35))
			SPO3 EEEEE 2 A_CustomMissile ("Brutal_LiquidBlood", 12, 0, random(0, 180), CMF_AIMDIRECTION, random (0, 35))
			
			TNT1 A 0 A_SpawnItem ("BloodDying", 0, 20)
			TNT1 A 0 A_Jump(12, "LastStand")
			
			TNT1 A 0 A_GiveInventory("DeathTimer1", 1)
			TNT1 A 0 A_JumpIfInventory("DeathTimer1", 4, "GotoDeath")
			Loop
			
		GotoDeath:
			TNT1 A 0 A_ChangeFlag("SHOOTABLE", 0)
			TNT1 A 0 A_ChangeFlag("FRIENDLY", 1)
			
			TNT1 A 0
			Goto Death
			
		Death.Cut:
		Death.SniperBullet:
		Death.Bullet792:		
		Death.Minigun:
		Death:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")		
			SPO3 GH 6
			TNT1 A 0 A_PlaySound ("grunt/death", CHAN_VOICE)
			TNT1 A 0 A_SpawnItemEx ("DeadShotgunGuy_NoLeg",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the spawned corpse time to access our inventory
			Stop

		Death.Head:
		Death.Decaptate:
		Death.HeadStun:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_PlaySound("misc/xdeath4", CHAN_VOICE)
			TNT1 A 0 A_SpawnItem("ShotgunguyHeadExplode", 0, 30)
			TNT1 A 0 A_XScream
			//TNT1 A 0 A_SpawnItemEx("ArmorShardFatalityBonus2", 0,0,20, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			//TNT1 A 0 A_SpawnItemEx("HealthPlusFatalityBonus2", 0,0,20, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			TNT1 A 0 ACS_NamedExecuteAlways("DropFatalityBonuses", 0, 2, 2, 0) // 0, health, armor, 0 -- rounded down to nearest 2
			TNT1 AAAAAAAAAAA 0 A_CustomMissile ("BrainBlood", 37, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_NoBlocking
			SPO3 IJ 6
			TNT1 A 0 A_SpawnItemEx ("DeadShotgunguy_NoLeg",1,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the spawned corpse time to access our inventory
			Stop

		Death.Shotgun:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")		
			TNT1 A 0 A_CustomMissile ("MuchBlood2", 35, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_Scream
			TNT1 A 0 ThrustThingZ(0,30,0,1)
			TNT1 A 0 A_NoBlocking
			ID11 MN 15
			TNT1 A 0 A_SpawnItemEx ("DeadShotgunguy_NoLeg",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the spawned corpse time to access our inventory
			Stop
			 
			 
		Death.Plasma: 
		Death.Electric:
		Death.Plasma2:
		Death.HeadPlasma:
		Death.Bfg10k: //***Che changed damage type from extreme to custom
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_XScream
			TNT1 A 0 A_NoBlocking
			XBRN AA 2 BRIGHT A_SpawnItem("BlueFlare",0,43)
			TNT1 AAAA 0 A_CustomMissile ("FBD_Blood", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			
			TNT1 A 0 A_CustomMissile ("XDeathBurnedArm", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathBurnedLeg", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathBurnedSkull", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathBurnedMeat", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathBurnedMeat2", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathBurnedMeat3", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			//TNT1 A 0 A_SpawnItemEx("ArmorShardFatalityBonus2", 0,0,20, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			//TNT1 A 0 A_SpawnItemEx("HealthPlusFatalityBonus2", 0,0,20, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			TNT1 A 0 ACS_NamedExecuteAlways("DropFatalityBonuses", 0, 2, 2, 0) // 0, health, armor, 0 -- rounded down to nearest 2
			XBRN BB 2 BRIGHT A_SpawnItem("BlueFlare",0,43)
			TNT1 A 0 A_CustomMissile ("FBD_Blood", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			XBRN CC 2 BRIGHT A_SpawnItem("BlueFlare",0,43)
			TNT1 AAAAA 0 A_CustomMissile ("PlasmaParticleX", 48, 0, random (0, 360), 2, random (0, 360))
			TNT1 AAA 0 A_CustomMissile ("BigPlasmaParticleX", 42, 0, random (0, 360), 2, random (0, 360))
			
			//***Che: prevent the game engine from auto-respawning this gibbed corpse on nightmare as a corpse
			// while allowiing archviles raising it (they only check for the CORPSE flag)
			// and respawning via script on nightmare
			TNT1 A 0 A_ChangeFlag("CORPSE", 1)
			TNT1 A 0 A_ChangeFlag("ISMONSTER", 0)
			TNT1 A -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)		
			Stop		 
			 
		Xdeath:
		Death.SuperPunch:
		Death.Blast:
		Death.SSG:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")		
			//TNT1 A 0 A_CustomMissile ("MeatDeath", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("XDeath1", 32, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 A 0 A_CustomMissile ("XDeath2", 32, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 A 0 A_CustomMissile ("XDeath3", 32, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AAAA 0 A_CustomMissile ("FBD_FlyingBlood", 32, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AAAA 0 A_CustomMissile ("Brutal_FlyingBloodFaster", 32, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AAAA 0 A_CustomMissile ("Brutal_FlyingBloodMuchFaster", 32, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AAAA 0 A_CustomMissile ("SuperWallRedBlood", 32, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AAAA 0 A_CustomMissile ("SuperWallRedBlood", 46, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 A 0 A_CustomMissile ("XDeathArm1", 32, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 A 0 A_CustomMissile ("XDeathZombieManHead", 32, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 A 0 A_XScream
			TNT1 A 0 A_NoBlocking
			SZD1 EFGH 6
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			TNT1 A 0 A_SpawnItemEx("DeadShotgunguySZD1H",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the spawned corpse time to access our inventory
			Stop		 

	}
}






ACTOR BrutalizedSergeant1
{
	Game Doom
	Radius 16
	Height 50
	Health 20
	damagefactor "Head", 0.0 damagefactor "HeadStun", 0.0 damagefactor "HeadPlasma", 0.0 damagefactor "Leg", 0.0
	PainSound "grunt/pain"
	PainChance 255
	Mass 999999
	-SOLID
	+SHOOTABLE
	+FLOORCLIP
	+DONTSPLASH
	+GHOST
	+THRUGHOST
	-COUNTKILL
	Scale 1.0
	States
	{
		Spawn:
			TNT1 A 0
			TNT1 A 0 
			TNT1 A 0 A_Recoil(2)
			TNT1 A 0 A_CustomMissile ("XDeathArm1", 35, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("XDeath1", 40, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
		Pain:
			SZD1 A 30
			Goto DieNow
		
		DieNow:
			TNT1 A 0
			TNT1 A 0 A_NOBlocking
			TNT1 A 0 A_SpawnItemEx ("BrutalizedSergeantStop",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
		
		Death:
			TNT1 A 0
			TNT1 A 0 A_SpawnItem("ShotgunguyHeadExplode", 0, 30)
			TNT1 A 0 A_Recoil(2)
			SZD1 B 4
			TNT1 A 0
			TNT1 A 0 A_SpawnItemEx ("BrutalizedSergeant2",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
			
		Death.SSG:
		XDeath:
			TNT1 A 0 A_XScream
			
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_CustomMissile ("SargeXDeath", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			
			//***Che: prevent the game engine from auto-respawning this gibbed corpse on nightmare as a corpse
			// while allowiing archviles raising it (they only check for the CORPSE flag)
			// and respawning via script on nightmare
			TNT1 A 0 A_ChangeFlag("CORPSE", 1)
			TNT1 A 0 A_ChangeFlag("ISMONSTER", 0)
			TNT1 A -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop
		
		Death.Plasma: 
		Death.Electric:
		Death.Plasma2:
		Death.Bfg10k: //***Che changed damage type from extreme to custom
			TNT1 A 0
			TNT1 A 0 A_XScream
			TNT1 A 0 A_NoBlocking
			XBRN AA 2 BRIGHT A_SpawnItem("BlueFlare",0,43)
			TNT1 AAAA 0 A_CustomMissile ("FBD_Blood", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			
			TNT1 A 0 A_CustomMissile ("XDeathBurnedArm", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathBurnedLeg", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathBurnedSkull", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathBurnedMeat", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathBurnedMeat2", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathBurnedMeat3", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			//TNT1 A 0 A_SpawnItemEx("ArmorShardFatalityBonus2", 0,0,20, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			//TNT1 A 0 A_SpawnItemEx("HealthPlusFatalityBonus2", 0,0,20, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			TNT1 A 0 ACS_NamedExecuteAlways("DropFatalityBonuses", 0, 2, 2, 0) // 0, health, armor, 0 -- rounded down to nearest 2
			XBRN BB 2 BRIGHT A_SpawnItem("BlueFlare",0,43)
			TNT1 A 0 A_CustomMissile ("FBD_Blood", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			XBRN CC 2 BRIGHT A_SpawnItem("BlueFlare",0,43)
			TNT1 AAAAA 0 A_CustomMissile ("PlasmaParticleX", 48, 0, random (0, 360), 2, random (0, 360))
			TNT1 AAA 0 A_CustomMissile ("BigPlasmaParticleX", 42, 0, random (0, 360), 2, random (0, 360))
			
			//***Che: prevent the game engine from auto-respawning this gibbed corpse on nightmare as a corpse
			// while allowiing archviles raising it (they only check for the CORPSE flag)
			// and respawning via script on nightmare
			TNT1 A 0 A_ChangeFlag("CORPSE", 1)
			TNT1 A 0 A_ChangeFlag("ISMONSTER", 0)
			TNT1 A -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop
	}
}


actor AbstractSergeantCorpse: FBD_CurbstompedMarine {
	States {
		Raise:
			// note: the frame letter of the "----" (keep previous) sprite is ignored
			"----" A 0
			"----" A 0 A_ChangeFlag("CORPSE", 0)
			"----" A 0 A_GiveInventory("RezzingNow")
			"----" A 0 A_NoBlocking // the raising code deep in C++ makes it solid
			"----" A 0 A_JumpIf(!CallAcs("EnoughSpaceToRezNormally", 2001), "FallbackRaise")
			// The vile had already copied his friendliness and target to this corpse.
			// A_SpawnItem(Ex) automatically copy friendliness
			//   and target, but only if both the spawner and the spawnee are monsters.
			"----" A 0 A_ChangeFlag("COUNTKILL", 0)
			"----" A 0 A_ChangeFlag("ISMONSTER", 1)
			"----" A 0 A_SpawnItemEx ("ShotgunGuyRaisedByVile",0,0,0, 0,0,0, 0,SXF_TRANSFERPOINTERS | SXF_NOCHECKPOSITION)
			"----" A 1 A_Jump(256, "OnRezSfx")
			Wait //Zandronum client repeats the last frame while it waits for a status update from the server
			
		FallbackRaise:
			"----" A 0 A_GiveInventory("RezzingNow")
			"----" A 0 A_ChangeFlag("CORPSE", 0)
			"----" A 0 A_ChangeFlag("SHOOTABLE", 0)
			//"----" A -1 ACS_NamedExecuteAlways("FallbackRez", 0, 9, 0, 0) //"ShotgunGuyRaisedByVile"
			"----" A -1 ACS_NamedExecuteWithResult("FallbackRezMkII", 2001) // see _mob_list.xlsx
			Stop
	}
}


actor BrutalizedSergeantStop: AbstractSergeantCorpse //FBD_CurbstompedMarine
{
    States
    {
		//***Che // this is a descendant of FBD_CurbstompedMarine, which is neither a missile nor a monster
		Spawn:
		Stay: // ancestor's Pain.Kick, Pain.ExplosiveImpact and Pain.Trample redirect here after z-thrusting the actor
			SPO5 ABCD 5 A_SpawnItem("FBD_FlyingBlood",0,5,0,1)
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			TNT1 A 0 A_NOBlocking
			TNT1 A 0 A_SpawnItemEx("DeadShotgunGuy_NoArm",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the spawned corpse time to access our inventory but we do not want archviles raising us instead
			Stop    
	}
}

ACTOR BrutalizedSergeant2: BrutalizedSergeant1
{
	States
	{
		Spawn:
			TNT1 A 0
			TNT1 A 0 		
		Pain:
			SZD1 B 30
			Goto DieNow
		
		DieNow:
			TNT1 A 0
			TNT1 A 0 A_NOBlocking
			TNT1 A 0 A_SpawnItemEx ("BrutalizedSergeantStop2",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
		
		Death:
			TNT1 A 0
			TNT1 A 0 A_Recoil(2)
			SZD1 C 12
			TNT1 A 0 A_NOBlocking
			TNT1 A 0 A_CustomMissile ("XDeathArm1", 35, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAA 0 A_CustomMissile ("XDeath1", 40, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0
			TNT1 A 0 A_SpawnItemEx ("BrutalizedSergeant3",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
	}
}

actor BrutalizedSergeantStop2: AbstractSergeantCorpse //FBD_CurbstompedMarine
{
    States
    {
		//***Che // this is a descendant of FBD_CurbstompedMarine, which is neither a missile nor a monster
		Spawn:
		Stay: // ancestor's Pain.Kick, Pain.ExplosiveImpact and Pain.Trample redirect here after z-thrusting the actorz-thrusting the actor
			SZD4 ABC 6 A_SpawnItem("FBD_FlyingBlood",0,5,0,1)
			TNT1 A 0 A_NOBlocking
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			TNT1 A 0 A_SpawnItemEx("DeadShotgunguySZD4D",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop    
	}
}

ACTOR BrutalizedSergeant3: BrutalizedSergeant1
{
	States
	{
		Spawn:
			TNT1 A 0
			TNT1 A 0 		
		Pain:
			TNT1 A 0
			TNT1 A 0 A_Jump(96, "DieNow")
			SZD1 C 25
			Goto DieNow
		
		DieNow:
			TNT1 A 0
			TNT1 A 0 A_SpawnItemEx ("BrutalizedSergeantStop3",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
		
		Death:
			TNT1 A 0
			TNT1 A 0 A_Recoil(2)
			TNT1 A 0 A_SpawnItem("MeatDeath")
			TNT1 A 0 A_SpawnItem("RipGuts")
			//TNT1 A 0 A_SpawnItemEx("ArmorShardFatalityBonus2", 0,0,20, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			//TNT1 A 0 A_SpawnItemEx("HealthPlusFatalityBonus2", 0,0,20, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			TNT1 A 0 ACS_NamedExecuteAlways("DropFatalityBonuses", 0, 2, 2, 0) // 0, health, armor, 0 -- rounded down to nearest 2
			SZD1 EFGH 6
			TNT1 A 0 A_SpawnItemEx("DeadShotgunguySZD1H",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 0 A_SpawnItem("GrowingBloodPool")
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
	}
}


actor BrutalizedSergeantStop3: AbstractSergeantCorpse //FBD_CurbstompedMarine
{
    States
    {
		//***Che // this is a descendant of FBD_CurbstompedMarine, which is neither a missile nor a monster
		Spawn:
		Stay: // ancestor's Pain.Kick, Pain.ExplosiveImpact and Pain.Trample redirect here after z-thrusting the actorz-thrusting the actor
			SZD3 ABC 6 A_SpawnItem("FBD_FlyingBlood",0,5,0,1)
			TNT1 A 0 A_SpawnItemEx("DeadShotgunguySZD3C",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 0 A_SpawnItem("GrowingBloodPool")
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop   
}}
	   
	   
ACTOR StompedSergeant: AbstractSergeantCorpse //FBD_CurbstompedMarine
{
	Health 200 
	States{
		//***Che // this is a descendant of FBD_CurbstompedMarine, which is neither a missile nor a monster
		Spawn:
		Stay: // ancestor's Pain.Kick, Pain.ExplosiveImpact and Pain.Trample redirect here after z-thrusting the actor
			02CB F 5 
			TNT1 A 0 A_CheckFloor("Slide")  // if this goes before the non-zero frame, we have an infinite loop!
			Loop
		Slide:
			TNT1 A 0
			TNT1 A 0 A_JumpIf(momx != 0 || momy != 0, "Stay") // not until the actor stops sliding		
		Land:	
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteAlways("FBD_CheckFloorIsLava_V", 0, 0, 0, 0) // also spawns smoke for 30 tics if succeeds
			02CB F 30
			TNT1 A 0 A_JumpIf(user_floor_is_lava, "LandOnLava")	
			02CB F -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop	
		Death:
			TNT1 A 0 A_CustomMissile ("XDeathArm1", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("XDeath1", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			//TNT1 A 0 A_CustomMissile ("XDeath2", 32, 0, random (0, 360), 2, random (0, 160))
			//TNT1 A 0 A_CustomMissile ("XDeath3", 32, 0, random (0, 360), 2, random (0, 160))
			//TNT1 AA 0 A_CustomMissile ("XDeath4", 32, 0, random (0, 360), 2, random (0, 160))
			//TNT1 A 0 A_CustomMissile ("XDeath5", 32, 0, random (0, 360), 2, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("XDeath2b", 15, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("XDeath3b", 15, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathOrgan1", 24, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AA 0 A_SpawnItem("MeatDeathSmall", 0, 10)
			TNT1 A 0 A_CustomMissile ("XDeathOrgan2", 24, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathHalfShotgunguyNoArmNoHead", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAAAAA 0 A_CustomMissile ("Guts", 24, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathSargeLeg2", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("GibSargeBoot", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			
			//***Che: prevent the game engine from auto-respawning this gibbed corpse on nightmare as a corpse
			// while allowiing archviles raising it (they only check for the CORPSE flag)
			// and respawning via script on nightmare
			TNT1 A 0 A_ChangeFlag("CORPSE", 1)
			TNT1 A 0 A_ChangeFlag("ISMONSTER", 0)
			TNT1 A -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop
	}
}
		  
		  
ACTOR VeryFuckedUpBrutalizedSergeantLeg: AbstractSergeantCorpse //FBD_CurbstompedMarine
{
	Health 200 
	States{
		//***Che // this is a descendant of FBD_CurbstompedMarine, which is neither a missile nor a monster
		Spawn:
		Stay: // ancestor's Pain.Kick, Pain.ExplosiveImpact and Pain.Trample redirect here after z-thrusting the actor
			ID14 G 5 
			TNT1 A 0 A_CheckFloor("Slide")  // if this goes before the non-zero frame, we have an infinite loop!
			Loop
		Slide:
			TNT1 A 0
			TNT1 A 0 A_JumpIf(momx != 0 || momy != 0, "Stay") // not until the actor stops sliding		
		Land:	
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteAlways("FBD_CheckFloorIsLava_V", 0, 0, 0, 0) // also spawns smoke for 30 tics if succeeds
			ID14 G 30
			TNT1 A 0 A_JumpIf(user_floor_is_lava, "LandOnLava")	
			ID14 G -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop	
		Death:
			TNT1 AA 0 A_CustomMissile ("XDeath1", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			//TNT1 A 0 A_CustomMissile ("XDeath2", 32, 0, random (0, 360), 2, random (0, 160))
			//TNT1 A 0 A_CustomMissile ("XDeath3", 32, 0, random (0, 360), 2, random (0, 160))
			//TNT1 AA 0 A_CustomMissile ("XDeath4", 32, 0, random (0, 360), 2, random (0, 160))
			//TNT1 A 0 A_CustomMissile ("XDeath5", 32, 0, random (0, 360), 2, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("XDeath2b", 15, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("XDeath3b", 15, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathOrgan1", 24, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AA 0 A_SpawnItem("MeatDeathSmall", 0, 10)
			TNT1 A 0 A_CustomMissile ("XDeathOrgan2", 24, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathHalfShotgunguyNoArmNoHead", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAAAAA 0 A_CustomMissile ("Guts", 24, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathSargeLeg2", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			
			//***Che: prevent the game engine from auto-respawning this gibbed corpse on nightmare as a corpse
			// while allowiing archviles raising it (they only check for the CORPSE flag)
			// and respawning via script on nightmare
			TNT1 A 0 A_ChangeFlag("CORPSE", 1)
			TNT1 A 0 A_ChangeFlag("ISMONSTER", 0)
			TNT1 A -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop
	}
}


ACTOR BrutalizedSergeantLeg: BrutalizedSergeant1
{
	States
	{
		Spawn:
		Pain:
			SPO3 A 15
			Goto DieNow
		
		DieNow:
			SPO3 BCD 5
			TNT1 A 0 A_SpawnItemEx ("DeadShotgunguy_NoLeg",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
		
		Death:
			TNT1 A 0
			TNT1 A 0 A_Recoil(4)
			
			TNT1 A 0 A_SpawnItem("ShotgunguyHeadExplode", 0, 30)
			TNT1 A 0 ThrustThingZ(0,30,0,1)
			ID14 ABCDEF 5
			TNT1 A 0 A_SpawnItemEx ("VeryFuckedUpBrutalizedSergeantLeg",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
	}
}




ACTOR DyingZombiemanNoArm: DyingSergeant
{
	+FLOORCLIP
	+DONTSPLASH
	//+SOLID // headboxes monitor this flag and auto-terminate if it is unset
	States
	{
		Death.fire:
		Death.Flames:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			//TNT1 A 0 A_SpawnItemEx("ArmorShardFatalityBonus2", 0,0,20, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			//TNT1 A 0 A_SpawnItemEx("HealthPlusFatalityBonus2", 0,0,20, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			TNT1 A 0 ACS_NamedExecuteAlways("DropFatalityBonuses", 0, 2, 2, 0) // 0, health, armor, 0 -- rounded down to nearest 2
			TNT1 A 0 A_Scream
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_SpawnItemEx("BurningZombie",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
		
		Spawn:
			TNT1 A 0 NODELAY ACS_NamedExecuteWithResult("FBD_RunMonster",12)
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 0, 30, 1) // force create  
			
			ZZD2 A 1
			TNT1 A 0 A_FaceTarget
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			TNT1 A 0 A_PlaySound ("BURNZOM", CHAN_VOICE)
			ZZD2 AA 2 A_CustomMissile ("Brutal_LiquidBlood", 40, 0, 90, 2, random (0, 45))
			ZZD2 A 1
			TNT1 A 0 A_Jump(32, "Death")
			Goto Suffer
		Suffer:
			TNT1 A 0
			TNT1 A 0 A_FaceTarget
			ZZD2 AAAAAAAA 2 A_CustomMissile ("Brutal_LiquidBlood", 30, 0, 90, 2, random (0, 45))
			ZZD2 EEEEE 2 A_CustomMissile ("Brutal_LiquidBlood", 20, 0, 90, 2, random (0, 45))
			TNT1 A 0 A_FaceTarget
			ZZD2 BBBBB 2 A_CustomMissile ("Brutal_LiquidBlood2", 20, 0, 90, 2, random (0, 45))
			TNT1 A 0 A_Jump(128, "Death")
			TNT1 A 0 A_FaceTarget
			ZZD2 EEEEE 2 A_CustomMissile ("Brutal_LiquidBlood2", 20, 0, 90, 2, random (0, 45))
			TNT1 A 0 A_FaceTarget
			ZZD2 BBBBB 2 A_CustomMissile ("Brutal_LiquidBlood2", 20, 0, 90, 2, random (0, 45))
			TNT1 A 0 A_FaceTarget
			ZZD2 EEEEE 2 A_CustomMissile ("Brutal_LiquidBlood2", 20, 0, 90, 2, random (0, 45))
			TNT1 A 0 A_FaceTarget
			ZZD2 BBBBB 2 A_CustomMissile ("Brutal_LiquidBlood2", 20, 0, 90, 2, random (0, 45))
			TNT1 A 0 A_FaceTarget
			ZZD2 EEEEE 2 A_CustomMissile ("Brutal_LiquidBlood2", 20, 0, 90, 2, random (0, 45))
			TNT1 A 0 A_FaceTarget
			ZZD2 BBBBB 2 A_CustomMissile ("Brutal_LiquidBlood2", 20, 0, 90, 2, random (0, 45))
			TNT1 A 0 A_Jump(32, "LastStand")		    
			TNT1 A 0 A_FaceTarget
			ZZD2 EEEEE 2 A_CustomMissile ("Brutal_LiquidBlood2", 20, 0, 90, 2, random (0, 45))
			TNT1 A 0 A_FaceTarget
			ZZD2 BBBBB 2 A_CustomMissile ("Brutal_LiquidBlood2", 20, 0, 90, 2, random (0, 45))
			TNT1 A 0 A_FaceTarget
			ZZD2 EEEEE 2 A_CustomMissile ("Brutal_LiquidBlood2", 20, 0, 90, 2, random (0, 45))
			TNT1 A 0 A_FaceTarget
			ZZD2 BBBBB 2 A_CustomMissile ("Brutal_LiquidBlood2", 20, 0, 90, 2, random (0, 45))
			TNT1 A 0 A_Jump(32, "LastStand")
			Goto Death
			
		Death.Cut:
		Death.SniperBullet:
		Death.Bullet792:
		Death.Minigun:
		Death:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")		
			TNT1 A 0 A_FaceTarget
			ZZD2 CCCC 2 A_CustomMissile ("Brutal_LiquidBlood2", 15, 0, 90, 2, random (0, 45))
			TNT1 A 0 A_PlaySound ("grunt/death", CHAN_VOICE)
			TNT1 A 0 A_FaceTarget
			TNT1 A 0 A_SpawnItemEx ("FBD_DeadZombieMan_NoArmFront",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 2 A_CustomMissile ("Brutal_LiquidBlood2", 1, 0, 90, 2, random (10, 45))
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop

		Death.Head:
		Death.HeadStun:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_PlaySound("misc/xdeath4", CHAN_VOICE)
			TNT1 A 0 A_JumpIfInTargetInventory("HasPlasmaWeapon", 1, "Death.Plasma")
			TNT1 A 0 A_JumpIfInTargetInventory("HasCutingWeapon", 1, "Death.Decaptate")
			TNT1 A 0 A_SpawnItem("ZombiemanHeadExplode", 0, 30)
			TNT1 A 0 A_XScream
			TNT1 AAAAAAAAAAA 0 A_CustomMissile ("BrainBlood", 37, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_NoBlocking
			//TNT1 A 0 A_SpawnItemEx("ArmorShardFatalityBonus2", 0,0,20, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			//TNT1 A 0 A_SpawnItemEx("HealthPlusFatalityBonus2", 0,0,20, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			TNT1 A 0 ACS_NamedExecuteAlways("DropFatalityBonuses", 0, 2, 2, 0) // 0, health, armor, 0 -- rounded down to nearest 2
			ZZD3 FFF 2 A_CustomMissile ("Brutal_LiquidBlood", 35, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 90))
			ZZD3 GGG 2 A_CustomMissile ("Brutal_LiquidBlood", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 90))
			TNT1 A 0 A_SpawnItem("ArterialBloodSpray")
			TNT1 A 0 A_SpawnItemEx("FBD_DeadZombieMan_NoHeadNoArm",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the spawned corpse time to access our inventory
			Stop


		Death.Decaptate:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")	
			TNT1 A 0 A_PlaySound("misc/xdeath4", CHAN_VOICE)
			TNT1 A 0 A_CustomMissile ("XDeathZombiemanHead", 35, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 110))
			TNT1 A 0 A_XScream
			TNT1 A 0 A_NoBlocking
			//TNT1 A 0 A_SpawnItemEx("ArmorShardFatalityBonus2", 0,0,20, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			//TNT1 A 0 A_SpawnItemEx("HealthPlusFatalityBonus2", 0,0,20, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			TNT1 A 0 ACS_NamedExecuteAlways("DropFatalityBonuses", 0, 2, 2, 0) // 0, health, armor, 0 -- rounded down to nearest 2
			ZZD3 FFF 2 A_CustomMissile ("Brutal_LiquidBlood", 35, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 90))
			ZZD3 GGG 2 A_CustomMissile ("Brutal_LiquidBlood", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 90))
			TNT1 A 0 A_SpawnItem("ArterialBloodSpray")
			TNT1 A 0 A_SpawnItemEx("FBD_DeadZombieMan_NoHeadNoArm",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the spawned corpse time to access our inventory
			Stop

		Death.Plasma: 
		Death.Electric:
		Death.Plasma2:
		Death.HeadPlasma:
		Death.Bfg10k: //***Che changed damage type from extreme to custom
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")	
			TNT1 A 0 A_XScream
			TNT1 A 0 A_NoBlocking
			XBRN AA 2 BRIGHT A_SpawnItem("BlueFlare",0,43)
			TNT1 AAAA 0 A_CustomMissile ("FBD_Blood", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			
			TNT1 A 0 A_CustomMissile ("XDeathBurnedArm", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathBurnedLeg", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathBurnedSkull", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathBurnedMeat", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathBurnedMeat2", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathBurnedMeat3", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			//TNT1 A 0 A_SpawnItemEx("ArmorShardFatalityBonus2", 0,0,20, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			//TNT1 A 0 A_SpawnItemEx("HealthPlusFatalityBonus2", 0,0,20, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			TNT1 A 0 ACS_NamedExecuteAlways("DropFatalityBonuses", 0, 2, 2, 0) // 0, health, armor, 0 -- rounded down to nearest 2
			XBRN BB 2 BRIGHT A_SpawnItem("BlueFlare",0,43)
			TNT1 A 0 A_CustomMissile ("FBD_Blood", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			XBRN CC 2 BRIGHT A_SpawnItem("BlueFlare",0,43)
			TNT1 AAAAA 0 A_CustomMissile ("PlasmaParticleX", 48, 0, random (0, 360), 2, random (0, 360))
			TNT1 AAA 0 A_CustomMissile ("BigPlasmaParticleX", 42, 0, random (0, 360), 2, random (0, 360))
			
			
			//***Che: prevent the game engine from auto-respawning this gibbed corpse on nightmare as a corpse
			// while allowiing archviles raising it (they only check for the CORPSE flag)
			// and respawning via script on nightmare
			TNT1 A 0 A_ChangeFlag("CORPSE", 1)
			TNT1 A 0 A_ChangeFlag("ISMONSTER", 0)
			TNT1 A -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop

		Death.Kick:
		Death.Extremepunches:
		Death.Melee:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")			
			TNT1 A 0 A_CustomMissile ("MuchBlood2", 35, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_PlaySound ("grunt/death", CHAN_VOICE)
			TNT1 A 0 ThrustThingZ(0,30,0,1)
			TNT1 A 0 A_NoBlocking
			ID11 EF 15
			TNT1 A 0 A_SpawnItemEx ("FBD_DeadZombieMan_NoArm",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the spawned corpse time to access our inventory
			Stop

			 
			 
		Xdeath:
		Death.SuperPunch:
		Death.Blast:
		Death.SSG:
		Death.Shotgun:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")			
			TNT1 A 0 A_XScream
			TNT1 A 0 A_PlaySound ("misc/xdeath4", CHAN_VOICE)
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_FaceTarget
			TNT1 AAAA 0 A_CustomMissile ("XDeath1", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AAAA 0 A_CustomMissile ("BloodMistBig", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 90))
			TNT1 AAA 0 A_CustomMissile ("XDeath3", 42, 0, random (170, 190), CMF_AIMDIRECTION, random (10, 60))
			TNT1 A 0 A_CustomMissile ("XDeath2", 42, 0, random (170, 190), CMF_AIMDIRECTION, random (10, 60))
			TNT1 A 0 A_CustomMissile ("XDeath4", 42, 0, random (170, 190), CMF_AIMDIRECTION, random (10, 60))
			TNT1 A 0 A_CustomMissile ("ZombieXDeath", 2, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			
			//***Che: prevent the game engine from auto-respawning this gibbed corpse on nightmare as a corpse
			// while allowiing archviles raising it (they only check for the CORPSE flag)
			// and respawning via script on nightmare
			TNT1 A 0 A_ChangeFlag("CORPSE", 1)
			TNT1 A 0 A_ChangeFlag("ISMONSTER", 0)
			TNT1 A -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop	

		LastStand:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")			
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_Pain
			TNT1 A 0 A_CHangeFlag("FRIENDLY", 0)
			TNT1 A 0 A_SpawnItemEx ("ZombiemanLastStand2",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the spawned corpse time to access our inventory
			Stop
	}
}




ACTOR ZombieManDyingAfterFatality: DyingZombiemanNoArm
{
	-CANPASS
	//-SOLID
	//+SOLID // headboxes monitor this flag and auto-terminate if it is unset
	States
	{
		Death.cut:
		Death.saw:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")	
			TNT1 AA 0 A_CustomMissile ("MuchBlood2", 35, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_XScream
			//TNT1 A 0 A_SpawnItemEx("ArmorShardFatalityBonus2", 0,0,20, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			//TNT1 A 0 A_SpawnItemEx("HealthPlusFatalityBonus2", 0,0,20, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			TNT1 A 0 ACS_NamedExecuteAlways("DropFatalityBonuses", 0, 2, 2, 0) // 0, health, armor, 0 -- rounded down to nearest 2
			TNT1 O 0 A_NoBlocking
			TNT1 A 0 A_CustomMissile ("RipZombieMan", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("Brutal_LiquidBlood", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 40))
			POSX AABCDE 9 A_CustomMissile ("Brutal_LiquidBlood", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 40))
			TNT1 A 0 A_SpawnItemEx ("FBD_DeadZombieMan_Half",0,0,30,0,0,-4,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			POSX EEEEEEEEEEEEEEEEEEEEEE 1 A_CustomMissile ("Brutal_LiquidBlood", 12, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 90))
			TNT1 A 0 A_SpawnItemEx("FBD_DeadZombieManJustLegsAreLeft",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the spawned corpse time to access our inventory
			Stop

			
		Death.fire:
		Death.Flames:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")			
			//TNT1 A 0 A_SpawnItemEx("ArmorShardFatalityBonus2", 0,0,20, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			//TNT1 A 0 A_SpawnItemEx("HealthPlusFatalityBonus2", 0,0,20, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			TNT1 A 0 ACS_NamedExecuteAlways("DropFatalityBonuses", 0, 2, 2, 0) // 0, health, armor, 0 -- rounded down to nearest 2
			TNT1 A 0 A_Scream
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_SpawnItemEx("BurningZombie",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the spawned corpse time to access our inventory
			Stop
		
		Spawn:
			ZZD5 E 1 NODELAY ACS_NamedExecuteWithResult("FBD_RunMonster",12)
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 0, 28, 1) // force create
			TNT1 A 0 A_PlaySound ("BURNZOM", CHAN_VOICE)
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			Goto Suffer
		Suffer:
			TNT1 A 0
			ZZD5 EEEEE 2 A_CustomMissile ("Brutal_LiquidBlood", 20, 0, random(0, 360), 2, random (0, 45))
			TNT1 A 0 A_SpawnItem ("BloodDying", 0, 20)
			ZZD5 FFFFFEEEEEFFFFFEEEEEFFFFF 2 A_CustomMissile ("Brutal_LiquidBlood", 20, 0, random(0, 360), 2, random (0, 45))
			TNT1 A 0 A_SpawnItem ("BloodDying", 0, 20)
			ZZD5 EEEEEFFFFFEEEEEFFFFFEEEEEFFFFFEEEEEFFFFF 2 A_CustomMissile ("Brutal_LiquidBlood", 20, 0, random(0, 360), 2, random (0, 45))
			TNT1 A 0 A_SpawnItem ("BloodDying", 0, 20)
			ZZD5 EEEEE 2 A_CustomMissile ("Brutal_LiquidBlood", 20, 0, random(0, 360), 2, random (0, 45))
			TNT1 A 0 A_SpawnItem ("BloodDying", 0, 20)
			Goto Death

		Death.Head:
		Death.Minorhead:
		Death.HeadStun:
		Death.HeadPlasma:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")			
			TNT1 A 0 A_PlaySound("misc/xdeath4", CHAN_VOICE)
			TNT1 A 0 A_JumpIfInTargetInventory("HasPlasmaWeapon", 1, "Death.Plasma")
			TNT1 A 0 A_JumpIfInTargetInventory("HasCutingWeapon", 1, "Death.Decaptate")
			TNT1 A 0 A_SpawnItem("ZombiemanHeadExplode", 0, 30)
			TNT1 A 0 A_XScream
			TNT1 AAAAAAAAAAA 0 A_CustomMissile ("BrainBlood", 37, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_NoBlocking
			//TNT1 A 0 A_SpawnItemEx("ArmorShardFatalityBonus2", 0,0,20, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			//TNT1 A 0 A_SpawnItemEx("HealthPlusFatalityBonus2", 0,0,20, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			TNT1 A 0 ACS_NamedExecuteAlways("DropFatalityBonuses", 0, 2, 2, 0) // 0, health, armor, 0 -- rounded down to nearest 2
			ZZD5 HHHHIIII 2 A_CustomMissile ("Brutal_LiquidBlood", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 90))
			PP2X H 0 A_SpawnItemEx ("FBD_DeadZombieMan_NoHeadFront",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the spawned corpse time to access our inventory
			Stop


		Death.Decaptate:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")			
			TNT1 A 0 A_PlaySound("misc/xdeath4", CHAN_VOICE)
			TNT1 A 0 A_CustomMissile ("XDeathZombiemanHead", 35, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 110))
			TNT1 A 0 A_XScream
			TNT1 A 0 A_NoBlocking
			//TNT1 A 0 A_SpawnItemEx("ArmorShardFatalityBonus2", 0,0,20, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			//TNT1 A 0 A_SpawnItemEx("HealthPlusFatalityBonus2", 0,0,20, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			TNT1 A 0 ACS_NamedExecuteAlways("DropFatalityBonuses", 0, 2, 2, 0) // 0, health, armor, 0 -- rounded down to nearest 2
			ZZD5 HHH 2 A_CustomMissile ("Brutal_LiquidBlood", 35, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 90))
			PP2X H 0 A_SpawnItemEx ("FBD_DeadZombieMan_NoHeadFront",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the spawned corpse time to access our inventory
			Stop

		Death.Shotgun:
		Death.Kick:
		Death.Extremepunches:
		Death.Melee:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")			
			TNT1 A 0 A_CustomMissile ("MuchBlood2", 35, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_Scream
			TNT1 A 0 ThrustThingZ(0,30,0,1)
			TNT1 A 0 A_NoBlocking
			ID11 EF 15
			TNT1 A 0 A_SpawnItemEx ("FBD_DeadZombieMan1",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
			 
		Death.Fatality:
			Goto XDeath
	}
}


ACTOR ZombiemanGotHisLegBlowed: DyingZombiemanNoArm
{
	//+SOLID // headboxes monitor this flag and auto-terminate if it is unset
	States
	{

		Spawn:
			TNT1 A 0 NODELAY ACS_NamedExecuteWithResult("FBD_RunMonster",12)
			TNT1 A 0 A_PlaySound ("BURNZOM", CHAN_VOICE)
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 4, 43, 1) // force create
			POS7 AAAAABB 2 A_CustomMissile ("Brutal_LiquidBlood", 20, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 45))
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 0, 22) // this -- failing? Investigate
			POS7 CC 2 A_CustomMissile ("Brutal_LiquidBlood", 20, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 45))
			
			
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			TNT1 A 0 A_Jump(16, "GotoDeath")
			
			
			Goto Suffer
		Suffer:
			TNT1 A 0
			
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 0, 22)		
			POS7 EEEEE 2 A_CustomMissile ("Brutal_LiquidBlood", 12, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 45))
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 0, 22)
			POS7 FFFFF 2 A_CustomMissile ("Brutal_LiquidBlood", 12, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 45))
			
			TNT1 A 0 A_Jump(12, "LastStand")
			TNT1 A 0 A_Jump(24, "LeaveCrawling")
			
			TNT1 A 0 A_GiveInventory("DeathTimer1", 1)
			TNT1 A 0 A_JumpIfInventory("DeathTimer1", 4, "GotoDeath")
			Loop

		GotoDeath:
			TNT1 A 0 A_ChangeFlag("SHOOTABLE", 0)
			TNT1 A 0 A_ChangeFlag("FRIENDLY", 1)
			
			TNT1 A 0
			Goto Death
			
		Death.Cut:
		Death.SniperBullet:
		Death.Bullet792:
		Death.Minigun:
		Death:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_Scream
			TNT1 A 0 A_PlaySound ("grunt/death", CHAN_VOICE)
			TNT1 A 0 A_SpawnItemEx ("FBD_DeadZombieMan_NoLeg",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the spawned corpse time to access our inventory
			Stop
		
		LEaveCrawling:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")		
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_Scream
			TNT1 A 0 A_PlaySound ("grunt/death", CHAN_VOICE)
			TNT1 A 0 A_SpawnItemEx ("DyingZombieMan",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the spawned corpse time to access our inventory
			Stop
		
		LastStand:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")		
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_Pain
			TNT1 A 0 A_CHangeFlag("FRIENDLY", 0)
			TNT1 A 0 A_SpawnItemEx ("ZombiemanLastStand1",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the spawned corpse time to access our inventory
			Stop
		
		Death.Head:
		Death.HeadStun:
		Death.HeadPlasma:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_SpawnItem("ZombiemanHeadExplode", 0, 30)
			TNT1 A 0 A_Scream
			TNT1 A 0 A_NoBlocking
			POS7 GHI 6
			//TNT1 A 0 A_SpawnItemEx("HealthPlusFatalityBonus", 0,0,0, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			TNT1 A 0 ACS_NamedExecuteAlways("DropFatalityBonuses", 0, 5, 0, 0) // 0, health, armor, 0 -- rounded down to nearest 2
			TNT1 A 0 A_SpawnItemEx ("FBD_DeadZombieMan_NoLeg",1,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the spawned corpse time to access our inventory
			Stop
			
		Death.Decaptate:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")		 
			TNT1 A 0 A_PlaySound("misc/xdeath4", CHAN_VOICE)
			TNT1 AA 0 A_CustomMissile ("SmallBrainPiece", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathZombieManHead", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_Scream
			TNT1 A 0 A_NoBlocking
			POS7 GHI 6
			//TNT1 A 0 A_SpawnItemEx("HealthPlusFatalityBonus", 0,0,0, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			TNT1 A 0 ACS_NamedExecuteAlways("DropFatalityBonuses", 0, 5, 0, 0) // 0, health, armor, 0 -- rounded down to nearest 2
			TNT1 A 0 A_SpawnItemEx ("FBD_DeadZombieMan_NoLeg",1,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the spawned corpse time to access our inventory
			Stop	
			
		Death.Shotgun:
		Death.Kick:
		Death.Extremepunches:
		Death.Melee:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")		
			TNT1 A 0 A_CustomMissile ("MuchBlood2", 35, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_Scream
			TNT1 A 0 ThrustThingZ(0,30,0,1)
			TNT1 A 0 A_NoBlocking
			ID11 KL 15
			TNT1 A 0 A_SpawnItemEx ("FBD_DeadZombieMan_NoLeg",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the spawned corpse time to access our inventory
			Stop
	}
}
	







ACTOR SergeantFatalizedByBaron: TeleportFog
{
	Renderstyle Translucent
	Alpha 1.0
	States
	{
		Spawn:
			SP2X BCD 8
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			TNT1 A 0 A_SpawnItemEx ("DeadShotgunguy_Half",1,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
	}
}








ACTOR SergeantGotHisLegBlowed: DyingZombiemanNoArm
{
	//+SOLID // headboxes monitor this flag and auto-terminate if it is unset
	States
	{
		Spawn:
			TNT1 A 0 NODELAY ACS_NamedExecuteWithResult("FBD_RunMonster",12)
			TNT1 A 0 A_PlaySound ("BURNZOM", CHAN_VOICE)
			SPO3 D 1
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			TNT1 A 0 A_Jump(160, "GotoDeath")

			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 0, 21, 1) // force create
			Goto Suffer
		Suffer:
			TNT1 A 0
			SPO3 DDDDDEEEEE 2 A_CustomMissile ("Brutal_LiquidBlood", 12, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 45))

			TNT1 A 0 A_Jump(32, "LeaveCrawling")
			TNT1 A 0 A_Jump(16, "LastStand")
			
			TNT1 A 0 A_GiveInventory("DeathTimer1", 1)
			TNT1 A 0 A_JumpIfInventory("DeathTimer1", 12, "GotoDeath")
			Loop

		GotoDeath:
			TNT1 A 0 A_ChangeFlag("SHOOTABLE", 0)
			TNT1 A 0 A_ChangeFlag("FRIENDLY", 1)
			
			TNT1 A 0
			Goto Death
			
		Death.Cut:
		Death.SniperBullet:
		Death.Bullet792:
		Death.Minigun:
		Death:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")	
			SPO3 GH 5
			TNT1 A 0 A_PlaySound ("grunt/death", CHAN_VOICE)
			TNT1 A 0 A_SpawnItemEx ("DeadShotgunguy_NoLeg",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the spawned corpse time to access our inventory
			Stop
		
		LEaveCrawling:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")	
			TNT1 A 0 A_PlaySound ("grunt/death", CHAN_VOICE)
			TNT1 A 0 A_SpawnItemEx ("DyingSergeantNoLeg",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the spawned corpse time to access our inventory
			Stop

		Death.Head:
		Death.HeadStun:
		Death.HeadPlasma:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")	
			TNT1 A 0 A_SpawnItem("ShotgunguyHeadExplode", 0, 30)
			TNT1 A 0 A_Scream
			TNT1 A 0 A_NoBlocking
			//TNT1 A 0 A_SpawnItemEx("HealthPlusFatalityBonus", 0,0,0, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			TNT1 A 0 ACS_NamedExecuteAlways("DropFatalityBonuses", 0, 5, 0, 0) // 0, health, armor, 0 -- rounded down to nearest 2
			SPO3 IJ 5
			TNT1 A 0 A_SpawnItemEx ("DeadShotgunguy_NoLeg",1,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the spawned corpse time to access our inventory
			Stop	
		Death.Decaptate:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")			
			TNT1 A 0 A_PlaySound("misc/xdeath4", CHAN_VOICE)
			TNT1 A 0 A_CustomMissile ("XDeathSergeantHead", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 110))
			TNT1 A 0 A_Scream
			TNT1 AAAAAAAAAAA 0 A_CustomMissile ("BrainBlood", 37, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_NoBlocking
			//TNT1 A 0 A_SpawnItemEx("HealthPlusFatalityBonus", 0,0,0, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			TNT1 A 0 ACS_NamedExecuteAlways("DropFatalityBonuses", 0, 5, 0, 0) // 0, health, armor, 0 -- rounded down to nearest 2
			SPO3 IJ 5
			
			TNT1 A 0 A_SpawnItemEx ("DeadShotgunguy_NoLeg", 1,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the spawned corpse time to access our inventory
			Stop		

		Death.Shotgun:
		Death.Kick:
		Death.Extremepunches:
		Death.Melee:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")			
			TNT1 A 0 A_CustomMissile ("MuchBlood2", 35, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_Scream
			TNT1 A 0 ThrustThingZ(0,30,0,1)
			TNT1 A 0 A_NoBlocking
			ID11 GH 10
			TNT1 A 0 A_SpawnItemEx ("DeadShotgunguy_NoLeg",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the spawned corpse time to access our inventory 
			Stop
		
		LastStand:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")			
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_Pain
			TNT1 A 0 A_CHangeFlag("FRIENDLY", 0)
			TNT1 A 0 A_SpawnItemEx ("SergeantLastStand1",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the spawned corpse time to access our inventory
			Stop

		 XDeath:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")			 
			TNT1 A 0 A_XScream
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_FaceTarget
			TNT1 AAA 0 A_CustomMissile ("XDeath1", 42, 0, random (170, 190), CMF_AIMDIRECTION, random (10, 60))
			TNT1 AAA 0 A_CustomMissile ("XDeath3", 42, 0, random (170, 190), CMF_AIMDIRECTION, random (10, 60))
			TNT1 A 0 A_CustomMissile ("XDeath2", 42, 0, random (170, 190), CMF_AIMDIRECTION, random (10, 60))
			TNT1 A 0 A_CustomMissile ("XDeath4", 42, 0, random (170, 190), CMF_AIMDIRECTION, random (10, 60))
			TNT1 A 0 A_CustomMissile ("SargeXDeath", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			
			//***Che: prevent the game engine from auto-respawning this gibbed corpse on nightmare as a corpse
			// while allowiing archviles raising it (they only check for the CORPSE flag)
			// and respawning via script on nightmare
			TNT1 A 0 A_ChangeFlag("CORPSE", 1)
			TNT1 A 0 A_ChangeFlag("ISMONSTER", 0)
			TNT1 A -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop
	}
}





ACTOR FlyingImpaledSergeant
{
    Radius 8
    Height 8
    Speed 10
    Scale 1.2
	Mass 1
    +NOBLOCKMAP
	+MISSILE
    +NOTELEPORT
    +MOVEWITHSECTOR
    +CLIENTSIDEONLY
    +RIPPER
    +BLOODLESSIMPACT 
	-DONTSPLASH
	-COUNTKILL
	+THRUGHOST
	damagetype Blood
    SeeSound "misc/xdeath4"
    DeathSound "misc/xdeath1"
	Decal BrutalBloodSplat
	Mass 1
    States
    {
		Spawn:
			TNT1 A 0 A_JumpIf(waterlevel > 1, "Splash")
			TNT1 A 0 
			ID18 AA 3 A_CustomMissile ("Brutal_FlyingBloodTrail", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 360))
			ID11 GG 3 A_CustomMissile ("Brutal_FlyingBloodTrail", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 360))
			Goto Fall
		Fall:	
			ID11 H 3 A_CustomMissile ("Brutal_FlyingBloodTrail", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 360))
			Loop
		Death:
			TNT1 A 0 A_SpawnItem("GrowingBloodPool",0,0,0,1)
			TNT1 A 0 A_SpawnItemEx("DeadShotgunguy",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
			TNT1 A 1
		Splash:
			TNT1 A 0 A_SpawnItemEx("DeadShotgunguy",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
    }
}





ACTOR FBD_DyingImp
{
	Game Doom
	Radius 16
	Height 28
	Health 50
	PainSound "imp/pain"
	PainChance 255
	Mass 999999
	+SHOOTABLE
	//-SOLID
	
	+THRUACTORS
	-COUNTKILL
	+FLOORCLIP
	damagefactor "Crush", 50.0
	Scale 1.0
	
	//***Che: required for headboxes to work
	//+ISMONSTER
	+NOTARGET
	-COUNTKILL
	//+SOLID // headboxes monitor this flag and auto-terminate if it is unset
	var int user_head_tid;
	var int user_head_type;
	var int user_head_rel;
	var int user_head_scale;
	var int user_head_xyzf;	
	var int user_sleeping;
	var int user_item_no;
	var int user_serverside_sfchk;		
	
	//***Che: making it archvile-raiseable.
	//+CORPSE 
	//p.s. archvile requires -1 frame duration to raise -- so only the burn death state qualifies
	
	States
	{
		Raise:
			// note: the frame letter of the "----" (keep previous) sprite is ignored
			"----" A 0
			"----" A 0 A_ChangeFlag("CORPSE", 0)
			"----" A 0 A_GiveInventory("RezzingNow")
			"----" A 0 A_NoBlocking // the raising code deep in C++ makes it solid
			"----" A 0 A_JumpIf(!CallAcs("EnoughSpaceToRezNormally", 2005), "FallbackRaise")
			// The vile had already copied his friendliness and target to this corpse.
			// A_SpawnItem(Ex) automatically copy friendliness
			//   and target, but only if both the spawner and the spawnee are monsters.
			"----" A 0 A_ChangeFlag("COUNTKILL", 0)
			"----" A 0 A_ChangeFlag("ISMONSTER", 1)
			"----" A 0 A_SpawnItemEx ("ImpRaisedByVile",0,0,0, 0,0,0, 0,SXF_TRANSFERPOINTERS | SXF_NOCHECKPOSITION)
			"----" A 1 A_Jump(256, "OnRezSfx")
			Wait //Zandronum client repeats the last frame while it waits for a status update from the server
			
		FallbackRaise:
			"----" A 0 A_GiveInventory("RezzingNow")
			"----" A 0 A_ChangeFlag("CORPSE", 0)
			"----" A 0 A_ChangeFlag("SHOOTABLE", 0)
			//"----" A -1 ACS_NamedExecuteAlways("FallbackRez", 0, 7, 0, 0)//"ImpRaisedByVile"
			"----" A -1 ACS_NamedExecuteWithResult("FallbackRezMkII", 2005) // see _mob_list.xlsx
			Stop
		Spawn:
			TNT1 A 0 NODELAY ACS_NamedExecuteWithResult("FBD_RunMonster",12)
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 5, 24, 1) // force create
			IMPC BC 6
			//TNT1 A 0 A_Jump(160, "Death")
			Goto Suffer
		Suffer:
			TRO2 DDDDD 2 A_CustomMissile ("Brutal_LiquidBlood", 16, 0, random (0, 360), 2, random (0, 45))
			TRO2 D 2
			TRO2 EEEEE 2 A_CustomMissile ("Brutal_LiquidBlood", 16, 0, random (0, 360), 2, random (0, 45))
			TRO2 E 2 A_Pain
			TRO2 DDDDD 2 A_CustomMissile ("Brutal_LiquidBlood", 16, 0, random (0, 360), 2, random (0, 45))
			TRO2 D 2
			TRO2 EEEEE 2 A_CustomMissile ("Brutal_LiquidBlood", 16, 0, random (0, 360), 2, random (0, 45))
			TRO2 E 2 A_Pain
			TRO2 DDDDD 2 A_CustomMissile ("Brutal_LiquidBlood", 16, 0, random (0, 360), 2, random (0, 45))
			TRO2 D 2
			TRO2 EEEEE 2 A_CustomMissile ("Brutal_LiquidBlood", 16, 0, random (0, 360), 2, random (0, 45))
			TRO2 E 2 A_Pain
			TRO2 DDDDD 2 A_CustomMissile ("Brutal_LiquidBlood", 16, 0, random (0, 360), 2, random (0, 45))
			TRO2 D 2
			TRO2 EEEEE 2 A_CustomMissile ("Brutal_LiquidBlood", 16, 0, random (0, 360), 2, random (0, 45))
			TRO2 E 2 A_Pain
			Goto Death
		Death:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TRO2 FG 8 A_Noblocking
			TNT1 A 1 A_SpawnItemEx ("FBD_DeadImp_NoStomach", 5,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the spawned corpse time to access our inventory
			Stop

		Death.Head:
		Death.Decaptate:
		Death.MINORHead:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_PlaySound("misc/xdeath4", CHAN_VOICE)
			TNT1 A 0 A_SpawnItem("ImpHeadExplode", 0, 30)
			TNT1 A 0 A_XScream
			TNT1 A 0 A_FaceTarget
			TNT1 A 0 A_NoBlocking
			IMPC J 2
			TNT1 A 0 A_SpawnItemEx("FBD_DyingImpNoHeadContinue",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the spawned corpse time to access our inventory
			Stop

		Death.Plasma: 
		Death.Electric:
		Death.Plasma2:
		Death.Bfg10k: //***Che changed damage type from extreme to custom
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_XScream
			TNT1 A 0 A_NoBlocking
			XBRN AA 2 BRIGHT A_SpawnItem("BlueFlare",0,43)
			TNT1 AAAA 0 A_CustomMissile ("FBD_Blood", 30, 0, random (0, 360), 2, random (0, 160))
			
			TNT1 A 0 A_CustomMissile ("XDeathBurnedImpArm", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathBurnedImpLeg", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathBurnedMeat", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathBurnedMeat2", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathBurnedMeat3", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))

			XBRN BB 2 BRIGHT A_SpawnItem("BlueFlare",0,43)
			TNT1 A 0 A_CustomMissile ("FBD_Blood", 30, 0, random (0, 360), 2, random (0, 160))
			XBRN CC 2 BRIGHT A_SpawnItem("BlueFlare",0,43)
			XBRN DEF 4 BRIGHT
			
			//***Che: prevent the game engine from auto-respawning this gibbed corpse on nightmare as a corpse
			// while allowiing archviles raising it (they only check for the CORPSE flag)
			// and respawning via script on nightmare
			TNT1 A 0 A_ChangeFlag("CORPSE", 1)
			TNT1 A 0 A_ChangeFlag("ISMONSTER", 0)
			TNT1 A -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop
			
		Death.Fire:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_Scream
			TNT1 A 0 A_NoBlocking
			//TNT1 A 0 A_SpawnItemEx("HealthPlusFatalityBonus", 0,0,0, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			TNT1 A 0 ACS_NamedExecuteAlways("DropFatalityBonuses", 0, 5, 0, 0) // 0, health, armor, 0 -- rounded down to nearest 2
			TROO JJJJ 2 A_CustomMissile ("FlameTrails", 45, 0, random (0, 360), CMF_AIMDIRECTION, random (50, 130))
			TROO KKKK 2 A_CustomMissile ("FlameTrails", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (50, 130))
			TROO LLLL 2 A_CustomMissile ("FlameTrails", 25, 0, random (0, 360), CMF_AIMDIRECTION, random (50, 130))
			TNT1 A 0 A_Playsound("props/redfire")
			BOSB FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF 2 A_CustomMissile ("FlameTrails", 15, 0, random (0, 360), CMF_AIMDIRECTION, random (50, 130))
			//***Che detaching smoke emittinf from burned corpses
			// because archvile would otherwise only rez the corpse after it stopped smoking
			TNT1 A 0 A_SpawnItemEx("FBD_CorpseSmoke",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0,0)
			//BOSB FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF 10 A_CustomMissile ("SmallSmoke", 15, 0, random (0, 360), CMF_AIMDIRECTION, random (70, 110))
			
			//***Che: prevent the game engine from auto-respawning this gibbed corpse on nightmare as a corpse
			// while allowiing archviles raising it (they only check for the CORPSE flag)
			// and respawning via script on nightmare
			TNT1 A 0 A_ChangeFlag("CORPSE", 1)
			TNT1 A 0 A_ChangeFlag("ISMONSTER", 0)
			BOSB E -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop

		Death.cut:
		Death.SniperBullet:
		Death.Bullet792:
		Death.Minigun:
			TNT1 O 0 A_Jump(230, 1) //2)
			Goto Death
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_XScream
			TNT1 O 0 A_NoBlocking
			TNT1 A 0 A_CustomMissile ("XDeath1", 40, 0, random (0, 360), 2, random (0, 160))
			TROG A 2 A_CustomMissile ("RipImp", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TROG AAA 4 A_SpawnItem ("MuchBlood", 0, 30)
			//TNT1 A 0 A_SpawnItemEx("HealthPlusFatalityBonus", 0,0,0, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			TNT1 A 0 ACS_NamedExecuteAlways("DropFatalityBonuses", 0, 5, 0, 0) // 0, health, armor, 0 -- rounded down to nearest 2
			TROG BCDEFGH 8
			TNT1 A 1 A_SpawnItemEx ("FBD_DeadImp_Half", 5,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the spawned corpse time to access our inventory
			//TROG H -1
			Stop


		Death.SSG:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			//TNT1 A 0 A_CustomMissile ("MeatDeath", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			//TNT1 A 0 A_SpawnItemEx("HealthPlusFatalityBonus", 0,0,0, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			TNT1 A 0 ACS_NamedExecuteAlways("DropFatalityBonuses", 0, 5, 0, 0) // 0, health, armor, 0 -- rounded down to nearest 2
			TNT1 AA 0 A_CustomMissile ("XDeath1", 32, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 A 0 A_CustomMissile ("XDeath2", 32, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 A 0 A_CustomMissile ("XDeath3", 32, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AAAA 0 A_CustomMissile ("FBD_FlyingBlood", 32, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AAAA 0 A_CustomMissile ("Brutal_FlyingBloodFaster", 32, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AAAA 0 A_CustomMissile ("Brutal_FlyingBloodMuchFaster", 32, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AAAA 0 A_CustomMissile ("SuperWallRedBlood", 32, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AAAA 0 A_CustomMissile ("SuperWallRedBlood", 46, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AA 0 A_CustomMissile ("XDeathImpArm", 32, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 A 0 A_CustomMissile ("XDeathImpHead", 32, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AAAA 0 A_CustomMissile ("SuperGoreSpawner", 22, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 15))
			TNT1 A 0 A_XScream
			TNT1 A 0 A_NoBlocking
			IZD1 EFGH 6
			
			//***Che: prevent the game engine from auto-respawning this gibbed corpse on nightmare as a corpse
			// while allowiing archviles raising it (they only check for the CORPSE flag)
			// and respawning via script on nightmare
			TNT1 A 0 A_ChangeFlag("CORPSE", 1)
			TNT1 A 0 A_ChangeFlag("ISMONSTER", 0)
			IZD1 H -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			//TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			//TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the spawned gore time to access our inventory
			Stop
			
		Death.Shotgun:
		Death.Blast:
		Death.Railgun:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")		
			TNT1 A 0 A_XScream
			//TNT1 A 0 A_SpawnItemEx("HealthPlusFatalityBonus", 0,0,0, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			TNT1 A 0 ACS_NamedExecuteAlways("DropFatalityBonuses", 0, 5, 0, 0) // 0, health, armor, 0 -- rounded down to nearest 2
			TNT1 AAA 0 A_CustomMissile ("Guts", 32, 0, random (150, 210), 2, random (0, 40))
			TNT1 AAA 0 A_CustomMissile ("XDeath1", 32, 0, random (150, 210), 2, random (0, 40))
			TNT1 A 0 A_CustomMissile ("XDeathImpArm", 32, 0, random (150, 210), 2, random (0, 40))
			TNT1 A 0 A_CustomMissile ("XDeathImpHead", 32, 0, random (150, 210), 2, random (0, 40))
			TNT1 AAA 0 A_CustomMissile ("Xdeath3", 16, 0, random (170, 190), 2, random (0, 40))
			TNT1 AAAA 0 A_CustomMissile ("FBD_FlyingBlood", 32, 0, random (170, 190), 2, random (0, 40))
			TNT1 AAAA 0 A_CustomMissile ("Brutal_FlyingBloodFaster", 32, 0, random (170, 190), 2, random (0, 40))
			TNT1 AAAA 0 A_CustomMissile ("Brutal_FlyingBloodMuchFaster", 32, 0, random (170, 190), 2, random (0, 40))
			TNT1 AAAA 0 A_CustomMissile ("SuperWallRedBlood", 32, 0, random (170, 190), 2, random (0, 40))
			TNT1 AAA 0 A_CustomMissile ("BloodMistBig", 40, 0, random (0, 360), 2, random (30, 90))
			TRO3 A 6 A_Stop
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_SpawnItemEx ("FBD_DyingImpNoHeadNoArmContinue",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the spawned corpse time to access our inventory
			Stop
	}
}


ACTOR FBD_DyingImpNoHeadContinue: FBD_DyingImp
{
	Damagefactor "Head", 0.0
	States
	{
		Spawn:
			TNT1 A 0
			TNT1 A 0  // makes the blood it emits go lo-res 
			  // if slaughtercount is over half the slaughter limit (i.e. 600) at the moment of spawning			
			TNT1 A 0 A_XScream
			IMPC JJJJJJJJJJJJJJJJJJJ 2 A_CustomMissile ("Brutal_LiquidBlood", 32, 0, random (0, 360), 2, random (0, 45))
			IMPC KKKK 2 A_CustomMissile ("Brutal_LiquidBlood", 16, 0, random (0, 360), 2, random (0, 45))
			//TNT1 A 0 A_SpawnItemEx("HealthPlusFatalityBonus", 0,0,0, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			TNT1 A 0 ACS_NamedExecuteAlways("DropFatalityBonuses", 0, 5, 0, 0) // 0, health, armor, 0 -- rounded down to nearest 2
			IMPC LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL 2 A_CustomMissile ("Brutal_LiquidBlood", 12, 0, random (0, 360), 2, random (0, 45))
			TNT1 A 0 A_SpawnItemEx("FBD_DeadImp_NoStomachNoHead",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop

		Death.cut:
			TNT1 A 0
			TNT1 A 0 A_Jump(230, 1) // goto is not a frame //2)
			Goto Death
			TNT1 A 0 A_XScream
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_CustomMissile ("XDeath1", 40, 0, random (0, 360), 2, random (0, 160))
			TROG A 2 A_CustomMissile ("RipImp", 0, 0, random (0, 360), 2, random (0, 160))
			TROG AAA 4 A_SpawnItem ("MuchBlood", 0, 30)
			//TNT1 A 0 A_SpawnItemEx("HealthPlusFatalityBonus", 0,0,0, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			TNT1 A 0 ACS_NamedExecuteAlways("DropFatalityBonuses", 0, 5, 0, 0) // 0, health, armor, 0 -- rounded down to nearest 2
			TROG BCDEFGH 8
			TNT1 A 0 A_SpawnItemEx ("FBD_DeadImp_Half", 5,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			//TROG H -1
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop


		Death.SSG:
		Death.Shotgun:
		Death.Blast:
		Death.Railgun:
			TNT1 A 0
			//TNT1 A 0 A_CustomMissile ("MeatDeath", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			//TNT1 AA 0 A_SpawnItemEx("HealthPlusFatalityBonus", 0,0,0, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			TNT1 A 0 ACS_NamedExecuteAlways("DropFatalityBonuses", 0, 10, 0, 0) // 0, health, armor, 0 -- rounded down to nearest 2
			TNT1 AA 0 A_CustomMissile ("XDeath1", 32, 0, random (170, 190), 2, random (0, 40))
			TNT1 A 0 A_CustomMissile ("XDeath2", 32, 0, random (170, 190), 2, random (0, 40))
			TNT1 A 0 A_CustomMissile ("XDeath3", 32, 0, random (170, 190), 2, random (0, 40))
			TNT1 AAAA 0 A_CustomMissile ("FBD_FlyingBlood", 32, 0, random (170, 190), 2, random (0, 40))
			TNT1 AAAA 0 A_CustomMissile ("Brutal_FlyingBloodFaster", 32, 0, random (170, 190), 2, random (0, 40))
			TNT1 AAAA 0 A_CustomMissile ("Brutal_FlyingBloodMuchFaster", 32, 0, random (170, 190), 2, random (0, 40))
			TNT1 AAAA 0 A_CustomMissile ("SuperWallRedBlood", 32, 0, random (170, 190), 2, random (0, 40))
			TNT1 AAAA 0 A_CustomMissile ("SuperWallRedBlood", 46, 0, random (170, 190), 2, random (0, 40))
			TNT1 AA 0 A_CustomMissile ("XDeathImpArm", 32, 0, random (170, 190), 2, random (0, 40))
			TNT1 AAAA 0 A_CustomMissile ("SuperGoreSpawner", 22, 0, random (170, 190), 2, random (0, 15))
			TNT1 A 0 A_XScream
			TNT1 A 0 A_NoBlocking
			IZD1 E 1
			IZD1 FGH 6
			TNT1 A 0 A_SpawnItemEx("FBD_DeadImpIZD1H",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
			
		Death:
		Death.SniperBullet:
		Death.Bullet792:
		Death.Minigun:
		Death.Shotgun:
			TNT1 A 0
			TNT1 A 0 A_XScream
			//TNT1 A 0 A_SpawnItemEx("HealthPlusFatalityBonus", 0,0,0, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			TNT1 A 0 ACS_NamedExecuteAlways("DropFatalityBonuses", 0, 5, 0, 0) // 0, health, armor, 0 -- rounded down to nearest 2
			TNT1 AAA 0 A_CustomMissile ("Guts", 32, 0, random (150, 210), 2, random (0, 40))
			TNT1 AAA 0 A_CustomMissile ("XDeath1", 32, 0, random (150, 210), 2, random (0, 40))
			TNT1 A 0 A_CustomMissile ("XDeathImpArm", 32, 0, random (150, 210), 2, random (0, 40))
			TNT1 AAA 0 A_CustomMissile ("Xdeath3", 16, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AAAA 0 A_CustomMissile ("FBD_FlyingBlood", 32, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AAAA 0 A_CustomMissile ("Brutal_FlyingBloodFaster", 32, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AAAA 0 A_CustomMissile ("Brutal_FlyingBloodMuchFaster", 32, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AAAA 0 A_CustomMissile ("SuperWallRedBlood", 32, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AAA 0 A_CustomMissile ("BloodMistBig", 40, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 90))
			TRO3 A 6 A_Stop

			TRO3 B 1 A_NoBlocking
			TNT1 A 0 A_SpawnItemEx("FBD_DyingImpNoHeadNoArmContinue",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			Stop
			TRO3 BBBBBBBBBB 3 A_CustomMissile ("Brutal_LiquidBlood2", 26, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 60))
			TRO3 CCC 3 A_CustomMissile ("Brutal_LiquidBlood2", 26, 0, random (0, 360), CMF_AIMDIRECTION, random (10, 40))
			TRO3 DD 3 A_CustomMissile ("Brutal_LiquidBlood2", 6, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 60))
			TNT1 A 0 A_SpawnItemEx("FBD_DeadImpTRO3E",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
	}
}




ACTOR FBD_DyingImpNoHeadClean: FBD_DyingImp
{
	DamageFactor "Head", 0.0
	States
	{
		Spawn:
			TNT1 A 0
			TNT1 A 0  // makes the blood it emits go lo-res 
			  // if slaughtercount is over half the slaughter limit (i.e. 600) at the moment of spawning
			TNT1 A 0 A_XScream
			TROH CCCCCCCC 2 A_CustomMissile ("Brutal_LiquidBlood2", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (60, 120))
			TROH DDD 2 A_CustomMissile ("Brutal_LiquidBlood2", 20, 0, random (0, 360), CMF_AIMDIRECTION, random (60, 120)) 
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			TROH EEEEEEEEEEEEEEEEEEEEEEEEEEEEE 2 A_CustomMissile ("Brutal_LiquidBlood2", 15, 0, random (0, 360), CMF_AIMDIRECTION, random (15, 40))
			TNT1 A 0 A_SpawnItemEx("FBD_DeadImp_NoHead",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
		Death.SniperBullet:
		Death.Bullet792:			
		Death.Minigun:
			TNT1 A 0
			GOto Death.Shotgun
	}
}



ACTOR FBD_DyingImpHalfFace: FBD_DyingImp
{
	//+SOLID // headboxes monitor this flag and auto-terminate if it is unset
	//P.S. they now monitor the SHOOTABLE flag instead
	States
	{
		Spawn:
			TNT1 A 0 NODELAY ACS_NamedExecuteWithResult("FBD_RunMonster",12)
			//t6sw a 0 0 43
			//t6sw b 0 -2 34
			//t6sw cde 0 -5 23  
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 0, 43, 1) // force create  
			
			T6SW AAAA 2 A_CustomMissile ("Brutal_LiquidBlood2", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (60, 120))
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII",0,-2,34)
			T6SW BBBB 2 A_CustomMissile ("Brutal_LiquidBlood2", 40, 0, random (0, 360), CMF_AIMDIRECTION, random (60, 120))
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII",0,-2,23)
			T6SW CCCCDDDDDD 2 A_CustomMissile ("Brutal_LiquidBlood", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (60, 120))
			T6SW EEE 3 A_CustomMissile ("Brutal_LiquidBlood2", 20, 0, random (0, 360), CMF_AIMDIRECTION, random (60, 120)) 
			TNT1 A 0 A_PlaySound("imp/pain")
			T6SW DDDEEE 3 A_CustomMissile ("Brutal_LiquidBlood2", 20, 0, random (0, 360), CMF_AIMDIRECTION, random (60, 120)) 
			TNT1 A 0 A_PlaySound("imp/pain")
			T6SW DDDEEE 3 A_CustomMissile ("Brutal_LiquidBlood2", 20, 0, random (0, 360), CMF_AIMDIRECTION, random (60, 120)) 
			TNT1 A 0 A_PlaySound("imp/pain")
			T6SW DDD 3 A_CustomMissile ("Brutal_LiquidBlood2", 20, 0, random (0, 360), CMF_AIMDIRECTION, random (60, 120)) 
		Death:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_NoBlocking
			T6SW FF 2 A_CustomMissile ("Brutal_LiquidBlood2", 20, 0, random (0, 360), CMF_AIMDIRECTION, random (60, 120)) 
			T6SW GGGG 2 A_CustomMissile ("Brutal_LiquidBlood2", 10, 0, random (0, 360), CMF_AIMDIRECTION, random (15, 40))
			TNT1 A 0 A_SpawnItemEx("FBD_DeadImpNoFace",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the spawned corpse time to access our inventory
			Stop
		Death.SniperBullet:
		Death.Bullet792:			
		Death.Minigun:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			GOto Death.Shotgun	
	}
}


ACTOR FBD_DyingImpNoHeadLikeChicken: FBD_DyingImp
{
	States
	{
		Spawn:
			TNT1 A 0
			TNT1 A 0  // makes the blood it emits go lo-res 
			  // if slaughtercount is over half the slaughter limit (i.e. 600) at the moment of spawning
			  
			TNT1 A 0 A_PlaySound("misc/xdeath2c")
			TROH FFFGGGHHHIII 2 A_CustomMissile ("Brutal_LiquidBlood2", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (10, 90))

			TNT1 A 0 A_PlaySound("misc/xdeath2c")
			TROH FFFGGGHHHIII 2 A_CustomMissile ("Brutal_LiquidBlood2", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (10, 90))

			TNT1 A 0 A_PlaySound("misc/xdeath2c")
			TROH FFFGGGHHHIII 2 A_CustomMissile ("Brutal_LiquidBlood2", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (10, 90))

			TNT1 A 0 A_PlaySound("misc/xdeath2c")
			TROH FFFGGGHHHIII 2 A_CustomMissile ("Brutal_LiquidBlood2", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (10, 90))

			TNT1 A 0 A_PlaySound("misc/xdeath2c")
			TROH FFFGGGHHHIII 2 A_CustomMissile ("Brutal_LiquidBlood2", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (10, 90))

			TNT1 A 0 A_PlaySound("misc/xdeath2c")
			TROH FFFGGGHHHIII 2 A_CustomMissile ("Brutal_LiquidBlood2", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (10, 90))

			TNT1 A 0 A_NoBlocking
			TROH CCCCCCCC 2 A_CustomMissile ("Brutal_LiquidBlood2", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (60, 120))
			TROH DDD 2 A_CustomMissile ("Brutal_LiquidBlood2", 20, 0, random (0, 360), CMF_AIMDIRECTION, random (60, 120)) 
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			TROH EEEEEEEEEEEEEEEEEEEEEEEEEEEEE 2 A_CustomMissile ("Brutal_LiquidBlood2", 15, 0, random (0, 360), CMF_AIMDIRECTION, random (15, 40))
			TNT1 A 0 A_SpawnItemEx("FBD_DeadImp_NoHead",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
			
		Death:
		Death.SniperBullet:
		Death.Bullet792:		
		Death.Minigun:
		Death.Shotgun:
			TROH A 1
			TNT1 A 0 A_XScream
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_SpawnItem("RipGuts")
			TNT1 A 0 A_SpawnItemEx("FBD_DyingImpNoHeadContinue",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
	}
}


ACTOR FBD_DyingImpNoHeadNoArmContinue: FBD_DyingImp
{
	States
	{
		Spawn:
			TNT1 A 0
			TNT1 A 0 
			
			TRO3 BBBBBBBBBB 3 A_CustomMissile ("Brutal_LiquidBlood2", 26, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 60))
			TRO3 CCC 3 A_CustomMissile ("Brutal_LiquidBlood2", 26, 0, random (0, 360), CMF_AIMDIRECTION, random (10, 40))
			TRO3 DD 3 A_CustomMissile ("Brutal_LiquidBlood2", 6, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 60))
			TNT1 A 0 A_SpawnItemEx("FBD_DeadImpTRO3E",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop

		Death.cut:
		Death.SSG:
		Death.Shotgun:
		Death.Blast:
		Death.Railgun:
		Death.SniperBullet:
		Death.Bullet792:		
		Death.Minigun:
		Death:
		Death.Fatality:
		Death.SuperPunch:
		Death.ExtremePunches:
			TNT1 A 0
			TNT1 A 0 A_FaceTarget
			//TNT1 A 0 A_CustomMissile ("MeatDeath", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			//TNT1 AA 0 A_SpawnItemEx("HealthPlusFatalityBonus", 0,0,0, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			TNT1 A 0 ACS_NamedExecuteAlways("DropFatalityBonuses", 0, 5, 0, 0) // 0, health, armor, 0 -- rounded down to nearest 2
			TNT1 AA 0 A_CustomMissile ("XDeath1", 32, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 A 0 A_CustomMissile ("XDeath2", 32, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 A 0 A_CustomMissile ("XDeath3", 32, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AAAA 0 A_CustomMissile ("FBD_FlyingBlood", 32, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AAAA 0 A_CustomMissile ("Brutal_FlyingBloodFaster", 32, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AAAA 0 A_CustomMissile ("Brutal_FlyingBloodMuchFaster", 32, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AAAA 0 A_CustomMissile ("SuperWallRedBlood", 32, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AAAA 0 A_CustomMissile ("SuperWallRedBlood", 46, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 A 0 A_CustomMissile ("XDeathImpArm", 32, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AAAA 0 A_CustomMissile ("SuperGoreSpawner", 22, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 15))
			TNT1 A 0 A_XScream
			TNT1 A 0 A_NoBlocking
			IZD1 E 1
			IZD1 FGH 6
			TNT1 A 0 A_SpawnItemEx("FBD_DeadImpIZD1H",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
	}
}

ACTOR BrutalizedImp1
{
	Game Doom
	Radius 16
	Height 50
	Health 20
	damagefactor "Head", 0.0 damagefactor "Leg", 0.0
	PainSound "grunt/pain"
	PainChance 255
	Mass 999999
	-SOLID
	+SHOOTABLE
	+NORADIUSDMG
	-COUNTKILL
	Scale 1.0
	States
	{
		Spawn:
			TNT1 A 0
			TNT1 A 0 
			TNT1 A 0 A_Recoil(2)
			TNT1 A 0 A_CustomMissile ("XDeathImpArm", 35, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("XDeath1", 40, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
		Pain:
			IZD1 A 30
			Goto DieNow
		
		DieNow:
			TNT1 A 0
			TNT1 A 0 A_SpawnItemEx ("BrutalizedImpStop",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
			
		Death:
			TNT1 A 0
			TNT1 A 0 A_SpawnItem("ImpHeadExplode", 0, 50)
			TNT1 A 0 A_Recoil(2)
			IZD1 B 4
			TNT1 A 0
			TNT1 A 0 A_SpawnItemEx ("BrutalizedImp2",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
			
		Death.SSG:
		XDeath:
			TNT1 A 0 A_XScream
			
			TNT1 A 0 A_NoBlocking
			TNT1 A 3 A_CustomMissile ("ImpXDeath", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			
			//***Che: prevent the game engine from auto-respawning this gibbed corpse on nightmare as a corpse
			// while allowiing archviles raising it (they only check for the CORPSE flag)
			// and respawning via script on nightmare
			TNT1 A 0 A_ChangeFlag("CORPSE", 1)
			TNT1 A 0 A_ChangeFlag("ISMONSTER", 0)
			TNT1 A -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop
}}


actor AbstractImpCorpse: FBD_CurbstompedMarine {
	States
		{
		//***Che
		Raise:
			// note: the frame letter of the "----" (keep previous) sprite is ignored
			"----" A 0
			"----" A 0 A_ChangeFlag("CORPSE", 0)
			"----" A 0 A_GiveInventory("RezzingNow")
			"----" A 0 A_NoBlocking // the raising code deep in C++ makes it solid
			"----" A 0 A_JumpIf(!CallAcs("EnoughSpaceToRezNormally", 2005), "FallbackRaise")
			// The vile had already copied his friendliness and target to this corpse.
			// A_SpawnItem(Ex) automatically copy friendliness
			//   and target, but only if both the spawner and the spawnee are monsters.
			"----" A 0 A_ChangeFlag("COUNTKILL", 0)
			"----" A 0 A_ChangeFlag("ISMONSTER", 1)
			"----" A 0 A_SpawnItemEx ("ImpRaisedByVile",0,0,0, 0,0,0, 0,SXF_TRANSFERPOINTERS | SXF_NOCHECKPOSITION)
			"----" A 1 A_Jump(256, "OnRezSfx")
			Wait //Zandronum client repeats the last frame while it waits for a status update from the server
			
		FallbackRaise:
			"----" A 0 A_GiveInventory("RezzingNow")
			"----" A 0 A_ChangeFlag("CORPSE", 0)
			"----" A 0 A_ChangeFlag("SHOOTABLE", 0)
			//"----" A -1 ACS_NamedExecuteAlways("FallbackRez", 0, 7, 0, 0)//"ImpRaisedByVile"
			"----" A -1 ACS_NamedExecuteWithResult("FallbackRezMkII", 2005) // see _mob_list.xlsx
			Stop
	}
}

actor BrutalizedImpStop: AbstractImpCorpse //FBD_CurbstompedMarine
{
    damagefactor "Blood", 0.0
    damagefactor "Trample", 0.0
    damagefactor "Melee", 10.0
    damagefactor "Fatality", 10.0
	damagefactor "Kick", 10.0
    States
    {
		//***Che // this is a descendant of FBD_CurbstompedMarine, which is neither a missile nor a monster
		Spawn:
			IZD2 ABC 5 NODELAY A_SpawnItem("FBD_FlyingBlood",0,5,0,1)
		Stay: // ancestor's Pain.Kick, Pain.ExplosiveImpact and Pain.Trample redirect here after z-thrusting the actor
			IZD2 C 5 A_CheckFloor("Land")
		Land:	
			TNT1 A 0
			TNT1 A 0 A_SpawnItemEx("FBD_DeadImpIZD3D",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the spawned corpse time to access our inventory but we do not want archviles raising us instead
			Stop    
		Death.Fatality:
		Death.Melee:
		Death.Kick:
		Death.Extremepunches:
			TNT1 A 0
			TNT1 A 0
			TNT1 A 0 ThrustThingZ(0,30,0,1)
			//IZD2 B 7
			TNT1 A 0 A_SpawnItemEx ("BrutalizedImpStop", 5,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
	   
	}
}

ACTOR BrutalizedImp2: BrutalizedSergeant1
{
	States
	{
		Spawn:
			TNT1 A 0
			TNT1 A 0 	
		Pain:
			IZD1 B 30
			Goto DieNow
			
		DieNow:
			TNT1 A 0
			TNT1 A 0 A_SpawnItemEx ("BrutalizedImpStop2",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
		
		Death:
			TNT1 A 0
			TNT1 A 0 A_Recoil(2)
			TNT1 A 0 A_CustomMissile ("XDeathImpArm", 35, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("XDeath1", 40, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			IZD1 C 4
			TNT1 A 0 A_SpawnItemEx ("BrutalizedImp3",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
}}

actor BrutalizedImpStop2: BrutalizedImpStop
{
    States
    {
		//***Che // this is a descendant of FBD_CurbstompedMarine, which is neither a missile nor a monster
		Spawn:
			IZD4 A 6
		Stay: // ancestor's Pain.Kick, Pain.ExplosiveImpact and Pain.Trample redirect here after z-thrusting the actor
			IZD4 B 6 
			TNT1 A 0 A_CheckFloor("Slide")  // if this goes before the non-zero frame, we have an infinite loop!
			Loop
		Slide:
			TNT1 A 0
			TNT1 A 0 A_JumpIf(momx != 0 || momy != 0, "Stay") // not until the actor stops sliding		
		Land:	
			TNT1 A 0 A_SpawnItem("GrowingBloodPool")
			TNT1 A 0 A_SpawnItemEx("FBD_DeadImpIZD3D",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the spawned corpse time to access our inventory but we do not want archviles raising us instead
			Stop
			
		Death.Fatality:
		Death.Melee:
		Death.Kick:
		Death.Extremepunches:
			TNT1 A 0
			TNT1 A 0
			TNT1 A 0 ThrustThingZ(0,30,0,1)
			IZD4 A 7
			TNT1 A 0 A_SpawnItemEx ("BrutalizedImpStop2", 5,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
	   }}

ACTOR BrutalizedImp3: BrutalizedImp1
{
	States
	{
		Spawn:
			TNT1 A 0
			TNT1 A 0 		
		Pain:
			IZD1 C 25
			Goto DieNow
		
		DieNow:
			TNT1 A 0
			TNT1 A 0 A_SpawnItemEx ("BrutalizedImpStop3",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
		
		Death:
			TNT1 A 0
			TNT1 A 0 A_Recoil(2)
			TNT1 A 0 A_SpawnItem("MeatDeath")
			TNT1 A 0 A_SpawnItem("RipGuts")
			IZD1 EFGH 6
			//TNT1 A 0 A_SpawnItemEx("HealthPlusFatalityBonus", 0,0,0, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			TNT1 A 0 ACS_NamedExecuteAlways("DropFatalityBonuses", 0, 5, 0, 0) // 0, health, armor, 0 -- rounded down to nearest 2
			TNT1 A 0 A_SpawnItem("GrowingBloodPool")
			TNT1 A 0 A_SpawnItemEx("FBD_DeadImpIZD1H",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
	}
}


actor BrutalizedImpStop3: BrutalizedImpStop
{
    States
    {
		//***Che // this is a descendant of FBD_CurbstompedMarine, which is neither a missile nor a monster
		Spawn:
			IZD3 A 6
		Stay: // ancestor's Pain.Kick, Pain.ExplosiveImpact and Pain.Trample redirect here after z-thrusting the actor			
			IZD3 B 6
			TNT1 A 0 A_CheckFloor("Slide")  // if this goes before the non-zero frame, we have an infinite loop!
			Loop
		Slide:
			TNT1 A 0
			TNT1 A 0 A_JumpIf(momx != 0 || momy != 0, "Stay") // not until the actor stops sliding		
		Land:
			TNT1 A 0
			TNT1 A 0 A_SpawnItem("GrowingBloodPool")
			TNT1 A 0 A_SpawnItemEx("FBD_DeadImpIZD1H",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the spawned corpse time to access our inventory but we do not want archviles raising us instead
			Stop    

		Death.Fatality:
		Death.Melee:
		Death.Kick:
		Death.Extremepunches:
			TNT1 A 0
			TNT1 A 0
			TNT1 A 0 ThrustThingZ(0,15,0,1)
			TNT1 A 0 A_FaceTarget
			IZD3 B 7
			TNT1 A 0 A_SpawnItemEx ("BrutalizedImpStop3", 5,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
	}
}
	   
		
ACTOR ThisImpGotFuckedHard: FBD_DeadImpID17G
{
	Health 200 
}
		
	
	
ACTOR ImpBrutalizedWithNoLeg
{
	Game Doom
	Radius 16
	Height 50
	Health 20
	PainSound "grunt/pain"
	PainChance 255
	Mass 999999
	-SOLID
	+SHOOTABLE
	-COUNTKILL
	Scale 1.0
	States
	{
		
		Spawn:
			TNT1 A 0
			TNT1 A 0 		
			TR09 A 30
			Goto DieNow
		DieNow:
			TR09 BC 8
			TR09 DE 8
			TNT1 A 0 A_SpawnItemEx ("FBD_DeadImp_NoLeg",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop

		Death:
			TNT1 A 0
			TNT1 AAAA 0 A_CustomMissile ("Brains1", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("Brains3", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("Brains6", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("Brains7", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("SmallBrainPieceFast", random (45, 55), random (5, -5), random (170, 190), CMF_AIMDIRECTION, random (-10, 10))
			TNT1 AAAA 0 A_CustomMissile ("SmallBrainPiece", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("SuperWallRedBlood", 46, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AAAAAAA 0 A_CustomMissile ("BrainBlood", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathImpArm", 35, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeath3", 40, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathImpLeg", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("XDeath1", 40, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 ThrustThingZ(0,30,0,1)
			ID17 ABCDEF 5
			//TNT1 A 0 A_SpawnItemEx("ArmorShardFatalityBonus", 0,0,0, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			TNT1 A 0 ACS_NamedExecuteAlways("DropFatalityBonuses", 0, 5, 0, 0) // 0, health, armor, 0 -- rounded down to nearest 2
			TNT1 A 0 A_SpawnItemEx ("ThisImpGotFuckedHard",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
	}
}









ACTOR FBD_DyingImpNoArm
{
	Game Doom
	Radius 16
	Height 32
	Health 50
	PainSound "imp/pain"
	PainChance 255
	Mass 999999
	//-SOLID
	
	+SHOOTABLE
	//MONSTER
	+GHOST
	-COUNTKILL
	+THRUGHOST
	
	//***Che: required for headboxes to work
	//+ISMONSTER
	+NOTARGET
	-COUNTKILL
	//+SOLID // headboxes monitor this flag and auto-terminate if it is unset
	var int user_head_tid;
	var int user_head_type;
	var int user_head_rel;
	var int user_head_scale;
	var int user_head_xyzf;	
	var int user_sleeping;
	var int user_item_no;
	var int user_serverside_sfchk;		
	
	Scale 1.0
	States
	{
		Spawn:
			TR08 B 1
			TNT1 A 0 ACS_NamedExecuteWithResult("FBD_RunMonster",12)			
			//TNT1 A 0 A_Jump(128, "Death")
			Goto Suffer
		Suffer:
			// 27
			TNT1 A 0 A_SetUserVar("user_head_type", 12) // dying guy headbox, ignores the SOLID snd CORPSE flags
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 0, 27, 1) // force create
			TR08 BB 4 A_CustomMissile ("Brutal_LiquidBlood", 26, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 45))
			TR08 B 5
			TR08 CC 4 A_CustomMissile ("Brutal_LiquidBlood", 26, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 45))
			TR08 C 5 A_Pain
			TR08 BB 4 A_CustomMissile ("Brutal_LiquidBlood", 26, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 45))
			TR08 B 5
			TR08 CC 4 A_CustomMissile ("Brutal_LiquidBlood", 26, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 45))
			TR08 C 5 A_Pain
			TR08 BB 4 A_CustomMissile ("Brutal_LiquidBlood", 26, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 45))
			TR08 B 5
			TR08 CC 4 A_CustomMissile ("Brutal_LiquidBlood", 26, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 45))
			TR08 C 5 A_Pain
			TR08 BB 4 A_CustomMissile ("Brutal_LiquidBlood", 26, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 45))
			TR08 B 5
			TR08 CC 4 A_CustomMissile ("Brutal_LiquidBlood", 26, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 45))
			TR08 C 5 A_Pain
			TR08 BB 4 A_CustomMissile ("Brutal_LiquidBlood", 26, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 45))
			TR08 B 5
			TR08 CC 4 A_CustomMissile ("Brutal_LiquidBlood", 26, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 45))
			TR08 C 5 A_Pain
			Goto Death
			
		Death:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TR08 D 8
			TNT1 A 0 A_SpawnItemEx ("FBD_DeadImp_NoArm", 5,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the spawned corpse time to access our inventory
			Stop
			
		Death.Head:
		Death.Decaptate:
		Death.MINORHead:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")		
			TNT1 A 0 A_PlaySound("misc/xdeath4")
			TNT1 A 0 A_SpawnItem("ImpHeadExplode", 0, 30)
			TNT1 A 0 A_XScream
			TNT1 A 0 A_NoBlocking
			TR08 F 8
			//TNT1 A 0 A_SpawnItemEx("HealthPlusFatalityBonus", 0,0,0, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			TNT1 A 0 ACS_NamedExecuteAlways("DropFatalityBonuses", 0, 5, 0, 0) // 0, health, armor, 0 -- rounded down to nearest 2
			TNT1 A 0 A_SpawnItemEx ("FBD_DeadImp_NoArmNoHead", 1,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the spawned corpse time to access our inventory
			Stop

		XDeath:
		Death.Explosives:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")		
			TNT1 A 0 A_XScream
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_FaceTarget
			//TNT1 A 0 A_SpawnItemEx("HealthPlusFatalityBonus", 0,0,0, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			TNT1 A 0 ACS_NamedExecuteAlways("DropFatalityBonuses", 0, 5, 0, 0) // 0, health, armor, 0 -- rounded down to nearest 2
			TNT1 AAA 0 A_CustomMissile ("XDeath1", 42, 0, random (170, 190), CMF_AIMDIRECTION, random (10, 60))
			TNT1 AAA 0 A_CustomMissile ("XDeath3", 42, 0, random (170, 190), CMF_AIMDIRECTION, random (10, 60))
			TNT1 A 0 A_CustomMissile ("XDeath2", 42, 0, random (170, 190), CMF_AIMDIRECTION, random (10, 60))
			TNT1 A 0 A_CustomMissile ("XDeath4", 42, 0, random (170, 190), CMF_AIMDIRECTION, random (10, 60))
			TNT1 A 1 A_CustomMissile ("ImpXDeath", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			
			//***Che: prevent the game engine from auto-respawning this gibbed corpse on nightmare as a corpse
			// while allowiing archviles raising it (they only check for the CORPSE flag)
			// and respawning via script on nightmare
			TNT1 A 0 A_ChangeFlag("CORPSE", 1)
			TNT1 A 0 A_ChangeFlag("ISMONSTER", 0)
			TNT1 A -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop
			
		Death.SSG:
		Death.Shotgun:
		Death.Blast:
		Death.Railgun:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_XScream
			//TNT1 A 0 A_SpawnItemEx("HealthPlusFatalityBonus", 0,0,0, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			TNT1 A 0 ACS_NamedExecuteAlways("DropFatalityBonuses", 0, 5, 0, 0) // 0, health, armor, 0 -- rounded down to nearest 2
			TNT1 AAA 0 A_CustomMissile ("Guts", 32, 0, random (150, 210), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AAA 0 A_CustomMissile ("XDeath1", 32, 0, random (150, 210), CMF_AIMDIRECTION, random (0, 40))
			TNT1 A 0 A_CustomMissile ("XDeathImpHead", 32, 0, random (150, 210), CMF_AIMDIRECTION, random (0, 40))
			TNT1 A 0 A_CustomMissile ("XDeathImpArm", 32, 0, random (150, 210), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AAA 0 A_CustomMissile ("Xdeath3", 16, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AAAA 0 A_CustomMissile ("FBD_FlyingBlood", 32, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AAAA 0 A_CustomMissile ("Brutal_FlyingBloodFaster", 32, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AAAA 0 A_CustomMissile ("Brutal_FlyingBloodMuchFaster", 32, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AAAA 0 A_CustomMissile ("SuperWallRedBlood", 32, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AAA 0 A_CustomMissile ("BloodMistBig", 40, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 90))
			TROG A 6 A_Stop
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			TROG BBBBBBBBBB 3 A_CustomMissile ("Brutal_LiquidBlood2", 26, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 60))
			TROG CCC 3 A_CustomMissile ("Brutal_LiquidBlood2", 26, 0, random (0, 360), CMF_AIMDIRECTION, random (10, 40))
			TROG DD 3 A_CustomMissile ("Brutal_LiquidBlood2", 6, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 60))
			TNT1 A 0 A_SpawnItemEx("FBD_DeadImp_Half",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the spawned corpse time to access our inventory
			Stop
	}
}



ACTOR FBD_DyingImpNoLeg
{
	Game Doom
	Radius 16
	Height 32
	Health 50
	PainSound "imp/pain"
	PainChance 255
	Mass 999999
	//-SOLID
	
	+THRUACTORS
	-COUNTKILL
	+SHOOTABLE
	Scale 1.0
	
	//***Che: required for headboxes to work
	//+ISMONSTER
	+NOTARGET
	-COUNTKILL
	//+SOLID // headboxes monitor this flag and auto-terminate if it is unset
	var int user_head_tid;
	var int user_head_type;
	var int user_head_rel;
	var int user_head_scale;
	var int user_head_xyzf;	
	var int user_sleeping;
	var int user_item_no;
	var int user_serverside_sfchk;	
	
	States
	{
		Spawn:
			IMPC E 1
			TNT1 A 0
			TNT1 A 0 A_Jump(32, "Colapse")
			Goto Suffer

		Suffer:
			TNT1 A 0 //A_SetUserVar("user_head_type", 12) // dying guy headbox, ignores the SOLID snd CORPSE flags
			TNT1 A 0 ACS_NamedExecuteWithResult("FBD_RunMonster",12)
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 0, 23, 1) // force create
			
			TR09 DD 4 A_CustomMissile ("Brutal_LiquidBlood", 12, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 45))
			TR09 D 5 A_CustomMissile ("Brutal_LiquidBlood", 12, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 45))
			TR09 FF 4 A_CustomMissile ("Brutal_LiquidBlood", 12, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 45))
			TR09 F 5 A_Pain
			TR09 DD 4 A_CustomMissile ("Brutal_LiquidBlood", 12, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 45))
			TR09 D 5 A_CustomMissile ("Brutal_LiquidBlood", 12, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 45))
			TR09 FF 4 A_CustomMissile ("Brutal_LiquidBlood", 12, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 45))
			TR09 F 5 A_Pain
			TR09 DD 4 A_CustomMissile ("Brutal_LiquidBlood", 12, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 45))
			TR09 D 5 A_CustomMissile ("Brutal_LiquidBlood", 12, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 45))
			TR09 FF 4 A_CustomMissile ("Brutal_LiquidBlood", 12, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 45))
			TR09 F 5 A_Pain
			TR09 DD 4 A_CustomMissile ("Brutal_LiquidBlood", 12, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 45))
			TR09 D 5 A_CustomMissile ("Brutal_LiquidBlood", 12, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 45))
			TR09 FF 4 A_CustomMissile ("Brutal_LiquidBlood", 12, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 45))
			TR09 F 5 A_Pain
			Goto Colapse
			
		Death:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")		
			TNT1 A 0 A_PlaySound("imp/death")
			TR09 G 8
			TNT1 A 0 A_SpawnItemEx ("FBD_DeadImp_NoLeg", 5,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the spawned corpse time to access our inventory
			Stop
			
		Colapse:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")		
			TR09 H 8
			TNT1 A 0 A_SpawnItemEx ("FBD_DeadImp_NoLeg", 5,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the spawned corpse time to access our inventory
			Stop

		Death.Head:
		Death.Decaptate:
		Death.MINORHead:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")		
			TNT1 A 0 A_PlaySound("misc/xdeath4")
			TNT1 A 0 A_SpawnItem("ImpHeadExplode", 0, 30)
			TNT1 A 0 A_XScream
			TNT1 A 0 A_NoBlocking
			TR09 I 8
			TNT1 A 0 A_SpawnItemEx ("FBD_DeadImp_Noleg", 1,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			//TNT1 A 0 A_SpawnItemEx("HealthPlusFatalityBonus", 0,0,0, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			TNT1 A 0 ACS_NamedExecuteAlways("DropFatalityBonuses", 0, 5, 0, 0) // 0, health, armor, 0 -- rounded down to nearest 2
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the spawned corpse time to access our inventory
			Stop
	}
}





ACTOR ImpDyingOfBloodLoss : FBD_Imp
{
	Radius 16
	Height 28
	Health 10
	+NOPAIN
	-COUNTKILL
	+SHOOTABLE
	-COUNTKILL
	//+SOLID // headboxes monitor this flag and auto-terminate if it is unset
	Damagefactor "Stealth", 0.0
	States
	{
		Spawn:
			TROD E 1 NODELAY ACS_NamedExecuteWithResult("FBD_RunMonster",12)

			TNT1 A 0 A_ChangeFLag("USESPECIAL", 1)
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 7, 18, 1) // force create
			
			TROD EFEFEFEFEFEFEFEFEFEFEFEF 10 //A_SpawnItem ("HeadshotTarget10", 0, 28,0)
			Goto Colapse
		Death:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			Goto DeathNoGuts
		
		Death.Shotgun:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_JumpIfCloser(150, "Death.Shotgunontheface")
			Goto DeathNoGuts
			
		Colapse:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_ChangeFLag("USESPECIAL", 0)
			TNT1 A 0 A_NoBlocking
			TROD GHIJ 5
			TNT1 A 0 A_SpawnItemEx ("FBD_DeadImpBloodLoss", 5,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the spawned corpse time to access our inventory
			Stop
	}
}




//***Che: this opened a whole can of worms with him being shot:
// going into all sorts of pinky's pain states basically resurrected him!
ACTOR PoorPinkyLostHisArm: ArmlessDemon //Demon
{
	Health 50
	+NOPAIN
	-COUNTKILL
	+SHOOTABLE
	Scale 1.1
	States
	{
		PutAFight:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("FBD_RunMonster")
			Goto See
			
/*
			TNT1 A 0 A_NoBlocking
			// this one still can run around and bite!
			TNT1 A 0 A_SpawnItemEx ("ArmlessDemon",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			
			//***Che: whoopsnik, in this state he is NOT dead and remains shootable.
			// resulting in you shooting him spawning extra corpses!
		

			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
*/			
		Spawn:
			SAAR J 1
			TNT1 A 0 
			TNT1 A 0 A_Pain
			TNT1 A 0 A_Jump(32, "Colapse")
			SAAR JJJJ 4 A_CustomMissile ("Brutal_LiquidBlood", 42, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 45))
			TNT1 A 0 A_Jump(128, "PutAFight")
			SAAR JJJJ 4 A_CustomMissile ("Brutal_LiquidBlood", 42, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 45))
			TNT1 A 0 A_Pain
			SAAR JJJJJJJJ 4 A_CustomMissile ("Brutal_LiquidBlood", 42, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 45))
			TNT1 A 0 A_Pain
			SAAR JJJ 4 A_CustomMissile ("Brutal_LiquidBlood", 42, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 45))
			SAAR J 1 A_Die //***Che using the default death, which is identical to the Collapse state 
			//	-- except he is counted as DEAD so he won't go into pain state coming from it back to life
			//Goto Colapse
			Wait
			
		Death.Shotgun:
		Death.SniperBullet:
		Death.Bullet792:		
		Death.Minigun:
		Death:
		Death.Fatality:
			TNT1 A 0
			TNT1 A 0 A_FaceTarget
			
			TNT1 AAAA 0 A_CustomMissile ("SmallBrainPiece", 60, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("XDeath3", random (45, 55), random (5, -5), random (160, 200), 2, random (-10, 10))
			TNT1 AA 0 A_CustomMissile ("XDeath2", random (45, 55), random (5, -5), random (160, 200), 2, random (-10, 10))
			TNT1 A 0 A_CustomMissile ("MuchBlood", 60, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("pinkyheadpiece", 52, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			//TNT1 A 0 A_CustomMissile ("PinkyJaw", 52, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAAA 0 A_CustomMissile ("SmallBrainPieceFast", random (45, 55), random (5, -5), random (170, 190), CMF_AIMDIRECTION, random (-10, 10))
			TNT1 AAAA 0 A_CustomMissile ("BloodMistBig", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 90))
			SAAR GGGGGGG 2 A_CustomMissile ("Brutal_LiquidBlood", 40, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 110))
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_Scream 
			//TNT1 A 0 A_SpawnItemEx("HealthPlusFatalityBonus", 0,0,0, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			TNT1 A 0 ACS_NamedExecuteAlways("DropFatalityBonuses", 0, 5, 0, 0) // 0, health, armor, 0 -- rounded down to nearest 2
			SAAR HHHHHHHHH 2 A_CustomMissile ("Brutal_LiquidBlood", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 110))
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			SAAR IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII 2 A_CustomMissile ("Brutal_LiquidBlood", 20, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 110))
			TNT1 A 0 A_SpawnItemEx("DeadDemonSAARI",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
		
/*		
		Colapse:
			TNT1 A 0 A_Scream
			TNT1 A 0 A_NoBlocking
			SAAR BCDEF 5
			TNT1 A 0 A_SpawnItemEx ("DeadDemonNoArm", 5,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
*/			
	}
}





ACTOR BrutalizedCommando1
{
	Game Doom
	Radius 16
	Height 50
	Health 50
	damagefactor "Blood", 0.0 damagefactor "BlueBlood", 0.0 damagefactor "GreenBlood", 0.0
    damagefactor "Avoid", 0.0
	damagefactor "Shrapnel", 0.0
	damagefactor "KillMe", 0.0
	PainSound "grunt/pain"
	Mass 999999
	-SOLID
	+SHOOTABLE
	+FLOORCLIP
	+DONTSPLASH
	-COUNTKILL
	Scale 1.0
	States
	{
		Spawn:
			TNT1 A 0
			TNT1 A 0  // makes the blood it emits go lo-res 
			  // if slaughtercount is over half the slaughter limit (i.e. 600) at the moment of spawning
		Stay:
			CPOD JJJJJJJJJJ 10 A_SpawnItem ("DripingBlood", 0, 23)
			CPOD K 6
			TNT1 A 0 A_SpawnItemEx ("BrutalizedDeadCommando1",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
		
		Pain:
			CPOD J 1 A_Pain
			Goto Stay //Spawn

		Death:
			TNT1 A 0
			TNT1 A 0 A_CustomMissile ("MuchBlood", 1, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathChainArm", 45, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeath1", 45, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_PlaySound("chainguy/death")
			TNT1 A 0 A_SpawnItemEx ("BrutalizedCommando2",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
	}
}

ACTOR BrutalizedCommando2: BrutalizedCommando1
{
	States
	{
		Spawn:
			TNT1 A 0
			TNT1 A 0  // makes the blood it emits go lo-res 
			  // if slaughtercount is over half the slaughter limit (i.e. 600) at the moment of spawning			
		Stay:
			CPOD MMM 10 A_SpawnItem ("DripingBlood", 0, 23)
			CPOD NNNNN 10 A_SpawnItem ("DripingBlood", 0, 23)
			CPOD O 5
			TNT1 A 0 A_SpawnItemEx ("BrutalizedDeadChaingunGuy",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
		
		Pain:
			CPOD M 5 A_Pain
			Goto Stay //Spawn

		Death:
			TNT1 AAAA 0 A_CustomMissile ("Brains1", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("Brains3", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("Brains6", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("Brains7", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAAAA 0 A_CustomMissile ("BrainBlood", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("SmallBrainPiece", random (45, 55), random (5, -5), random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AAAA 0 A_CustomMissile ("SmallBrainPiece", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("SuperWallRedBlood", 46, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AA 0 A_CustomMissile ("XDeath1", 45, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_SpawnItemEx ("BrutalizedCommando3",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)

			Stop
	}
}


ACTOR BrutalizedCommando3: BrutalizedCommando1
{
	States
	{
		Spawn:
			TNT1 A 0
			TNT1 A 0  // makes the blood it emits go lo-res 
			  // if slaughtercount is over half the slaughter limit (i.e. 600) at the moment of spawning		
		Stay:
			CPOD P 5
			CPOD QQQQQQQQQQ 10 A_SpawnItem ("Blood", 0, 43)
			CPOD R 5
			TNT1 A 0 A_SpawnItemEx ("SuperBrutalizedDeadChaingunGuy",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
		
		Pain:
			CPOD P 5 A_Pain
			Goto Stay //Spawn

		Death:
			TNT1 A 0
			//TNT1 A 0 A_SpawnItemEx("HealthPlusFatalityBonus", 0,0,0, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			TNT1 A 0 ACS_NamedExecuteAlways("DropFatalityBonuses", 0, 5, 0, 0) // 0, health, armor, 0 -- rounded down to nearest 2
			TNT1 AA 0 A_CustomMissile ("XDeath1", 45, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeath2", 45, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeath3", 45, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			CPOD S 1
			TNT1 A 0 A_SpawnItemEx ("BrutalizedCommandoLegs",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
	}
}


ACTOR BrutalizedCommandoBlasted: BrutalizedCommando3
{
	+NOPAIN
	States
	{
		Spawn:
			TNT1 A 0
			TNT1 A 0  // makes the blood it emits go lo-res 
			  // if slaughtercount is over half the slaughter limit (i.e. 600) at the moment of spawning		
		Stay:
			MPSD AAAA 6 A_CustomMissile ("Brutal_LiquidBlood2", 64, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 60))
			MPSD BBBBCCCC 2 A_CustomMissile ("Brutal_LiquidBlood2", 34, 0, random (0, 60), 2, random (30, 60))
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			MPSD DDDDDDDDDDDDDDDDDDDDD 6 A_CustomMissile ("Brutal_LiquidBlood2", 16, 0, random (0, 60), 2, random (30, 60))
			TNT1 A 0 A_Noblocking
			TNT1 A 0 A_SpawnItemEx("DeadChaingunguyMPSDD",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
	}
}


ACTOR BrutalizedCommandoLostHead: BrutalizedCommando1
{
	+NOPAIN
	hEALTH 100
	States
	{
		Spawn:
			TNT1 A 0
			TNT1 A 0  // makes the blood it emits go lo-res 
			  // if slaughtercount is over half the slaughter limit (i.e. 600) at the moment of spawning	
			  
			CPHS BBB 2 A_CustomMissile ("Brutal_LiquidBlood2", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (60, 120))
			TNT1 A 0 A_XScream
			CPHS CCCCCCCCCCCCCCC 2 A_CustomMissile ("Brutal_LiquidBlood2", 40, 0, random (0, 360), CMF_AIMDIRECTION, random (60, 120))
			TNT1 A 0 A_NoBlocking
			CPHS DDDEEE 2 A_CustomMissile ("Brutal_LiquidBlood2", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (60, 120))
			
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			CPHS FFFFFFFFFFFFFFF 2 A_CustomMissile ("Brutal_LiquidBlood2", 5, 0, random (0, 360), CMF_AIMDIRECTION, random (10, 40))
			
			TNT1 A 0 A_SpawnItemEx ("DeadChaingunGuy_NoHeadExploded", 3,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
		Death:
			TNT1 A 0 A_CustomMissile ("XDeath2", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 90))
			TNT1 A 0 A_CustomMissile ("XDeath3", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 90))
			TNT1 AAA 0 A_CustomMissile ("FBD_FlyingBlood", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AA 0 A_CustomMissile ("Brutal_FlyingBloodFaster", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AA 0 A_CustomMissile ("Brutal_FlyingBloodMuchFaster", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AAA 0 A_CustomMissile ("Guts", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AAA 0 A_CustomMissile ("BloodMistBig", 40, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 90))
			TNT1 A 0 A_CustomMissile ("XDeathChainArm", 62, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_SpawnItemEx("BrutalizedCommandoBlasted",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
	}
}




ACTOR BrutalizedCommandoLostHead2: BrutalizedCommandoLostHead
{
	+NOPAIN
	hEALTH 100
	States
	{
		Spawn:
			TNT1 A 0
			TNT1 A 0  // makes the blood it emits go lo-res 
			  // if slaughtercount is over half the slaughter limit (i.e. 600) at the moment of spawning				
		
			CPHD BBB 2 A_CustomMissile ("Brutal_LiquidBlood2", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (60, 120))
			TNT1 A 0 A_XScream
			CPHD CCCCCCCCCCCCCCCCCCC 2 A_CustomMissile ("Brutal_LiquidBlood2", 40, 0, random (0, 360), CMF_AIMDIRECTION, random (60, 120))
			TNT1 A 0 A_NoBlocking
			CPHD DDDEEE 2 A_CustomMissile ("Brutal_LiquidBlood2", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (60, 120))
			
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			CPHD FFFFFFFFFFFFFFF 2 A_CustomMissile ("Brutal_LiquidBlood2", 5, 0, random (0, 360), CMF_AIMDIRECTION, random (10, 40))
			
			TNT1 A 0 A_SpawnItemEx ("DeadChaingunGuy_NoHead", 3,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
	}
}





ACTOR ZombiemanSaciLol: ZombiemanGotHisLegBlowed
{
	//MONSTER
	+GHOST
	+THRUGHOST
	-COUNTKILL
	//+SOLID // headboxes monitor this flag and auto-terminate if it is unset
	Speed 4
	Height 48
	States
	{
		Spawn:
			TNT1 A 0 ACS_NamedExecuteWithResult("FBD_RunMonster",12)
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 0, 38, 1) // force create			
			
			TNT1 A 0 A_PlaySound ("BURNZOM", CHAN_VOICE)
			Goto Suffer
		
		Suffer:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 0, 38)
			ZL1E ABC 3
			TNT1 A 0 A_SpawnItem ("BloodDying", 0, 30)
			
			// Is hopping on his single remaining leg.
			// Up and down he goes.
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 0, 46)
			ZL1E DDDD 1 A_Wander
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 0, 38)
			ZL1E ABC 3
			TNT1 A 0 A_SpawnItem ("BloodDying", 0, 30)
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 0, 46)
			ZL1E DDDD 1 A_Wander
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 0, 38)
			ZL1E ABC 3
			TNT1 A 0 A_SpawnItem ("BloodDying", 0, 30)
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 0, 46)
			ZL1E DDDD 1 A_Wander
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 0, 38)
			ZL1E ABC 3
			TNT1 A 0 A_SpawnItem ("BloodDying", 0, 30)
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 0, 46)
			ZL1E DDDD 1 A_Wander
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 0, 38)
			ZL1E ABC 3
			TNT1 A 0 A_SpawnItem ("BloodDying", 0, 30)
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 0, 46)
			ZL1E DDDD 1 A_Wander
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 0, 38)
			ZL1E ABC 3
			TNT1 A 0 A_SpawnItem ("BloodDying", 0, 30)
			ZL1E D 1 A_Wander
			
			TNT1 A 0
			TNT1 A 0 A_StopSound(CHAN_VOICE) //A_PlaySound ("none")
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_SpawnItemEx ("ZombiemanGotHisLegBlowed",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // without this, the headdelete script fails.
			Stop
		Death.Head:
		Death.HeadStun:
		Death.HeadPlasma:
		Death.Decaptate:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_SpawnItem("ZombiemanHeadExplode", 0, 30)
			ZMAD B 0 A_PlaySound("misc/xdeath", CHAN_VOICE)
			ZMAD C 0 A_NoBlocking
			Goto FallHead
		FallHead:
			//TNT1 A 0
			//TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")		
			ZL1E EFG 6
			TNT1 A 0 A_SpawnItemEx ("FBD_DeadZombieMan_NoLeg",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the spawned corpse time to access our inventory
			Stop
		
		Death:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_PlaySound("grunt/death", CHAN_VOICE)
			ZL1E HI 6
			TNT1 A 0 A_SpawnItemEx ("FBD_DeadZombieMan_NoLeg",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the spawned corpse time to access our inventory
			Stop
	}
}



ACTOR ImpSaciLol: FBD_DyingImpNoLeg
{
	//MONSTER
	+GHOST
	+THRUGHOST
	-COUNTKILL
	+SOLID // headboxes monitor this flag and auto-terminate if it is unset
	Speed 4
	Height 48
	States
	{

		Spawn:
			TNT1 A 0
			TNT1 A 0 A_PlaySound ("imp/pain", CHAN_VOICE)
			
			TNT1 A 0 ACS_NamedExecuteWithResult("FBD_RunMonster",12)
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 0, 38, 1) // force create	
			
			Goto Suffer
		
		Suffer:
			TNT1 A 0
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 0, 38)
			ZL3E ABC 3
			TNT1 A 0 A_SpawnItem ("BloodDying", 0, 30)
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 0, 44)
			ZL3E DDDD 1 A_Wander
			TNT1 A 0 A_PlaySound ("imp/pain", CHAN_VOICE)
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 0, 38)
			ZL3E ABC 3
			TNT1 A 0 A_SpawnItem ("BloodDying", 0, 30)
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 0, 44)
			ZL3E DDDD 1 A_Wander
			TNT1 A 0 A_PlaySound ("imp/pain", CHAN_VOICE)
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 0, 38)
			ZL3E ABC 3
			TNT1 A 0 A_SpawnItem ("BloodDying", 0, 30)
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 0, 44)
			ZL3E DDDD 1 A_Wander
			TNT1 A 0 A_PlaySound ("imp/pain", CHAN_VOICE)
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 0, 38)
			ZL3E ABC 3
			TNT1 A 0 A_SpawnItem ("BloodDying", 0, 30)
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 0, 44)
			ZL3E DDDD 1 A_Wander
			TNT1 A 0 A_PlaySound ("imp/pain", CHAN_VOICE)
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 0, 38)
			ZL3E ABC 3
			TNT1 A 0 A_SpawnItem ("BloodDying", 0, 30)
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 0, 44)
			ZL3E DDDD 1 A_Wander
			TNT1 A 0 A_PlaySound ("imp/pain", CHAN_VOICE)
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 0, 38)
			ZL3E ABC 3
			TNT1 A 0 A_SpawnItem ("BloodDying", 0, 30)
			ZL3E D 1 A_Wander
			TNT1 A 0 A_PlaySound ("imp/pain", CHAN_VOICE)
			
			TNT1 A 0
			TNT1 A 0 //A_PlaySound ("none")
			TR09 A 6
			TR09 A 3 
			TR09 B 3 
			TR09 C 3 A_NoBlocking
			TNT1 A 0 A_StopSound(CHAN_VOICE)
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_SpawnItemEx ("FBD_DyingImpNoLeg",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // without this, the headdelete script fails.
			Stop
		Death.Head:
		Death.HeadStun:
		Death.HeadPlasma:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")		
			TNT1 A 0 A_PlaySound("misc/xdeath", CHAN_VOICE)
			TNT1 A 0 A_SpawnItem("ImpHeadExplode", 0, 50)
			Goto FallHead
		FallHead:
			ZL3E EFG 7
			TNT1 A 0 A_SpawnItemEx ("FBD_DeadImp_NoLeg",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // without this, the headdelete script fails.
			Stop
		
		Death:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_PlaySound("imp/death", CHAN_VOICE)
			ZL3E HIJ 7
			TNT1 A 0 A_SpawnItemEx ("FBD_DeadImp_NoLeg",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the spawned corpse time to access our inventory
			Stop
	}
}















ACTOR PlayerChaingunguyVictim
{
	Game Doom
	Radius 16
	Height 50
	Health 70
	bloodtype "DeadBlood", "FBD_SawBlood"
	PainSound "grunt/pain"
	PainChance 255
	Mass 999999
	+SHOOTABLE
	+NORADIUSDMG
	+FLOORCLIP
	+DONTSPLASH
	-COUNTKILL
	Scale 1.0
	States
	{
		Spawn:
			TNT1 A 0
			XPL8 A 50
			Goto DieNow
		
		DieNow:
			TNT1 A 0
			PLAY JKL 5
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_Fall
			TNT1 A 0 A_ChangeFlag("SHOOTABLE", 0)
			PLAY L -1
			Stop
		
		Pain:
			TNT1 A 0
			TNT1 A 0 A_Jump(129, "Pain2")
			XPL8 B 2
			Goto Spawn
		
		Pain2:
			XPL8 C 3
			Goto Spawn
		
		Death:
			TNT1 A 0
			TNT1 A 0 A_SpawnItem("RipGuts")
			TNT1 A 0 A_CustomMissile ("XDeathHalfMarine", 50, 0, random (0, 360), 2, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), 2, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("XDeath1", 50, 0, random (0, 360), 2, random (0, 160))
			XPL2 A 10 A_XScream
			TNT1 AA 0 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), 2, random (0, 160))
			XPL2 B 20 A_NoBlocking
			TNT1 AA 0 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), 2, random (0, 160))
			XPL2 C 10 A_CustomMissile ("MuchBlood", 40, 0, random (0, 360), 2, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("MuchBlood", 30, 0, random (0, 360), 2, random (0, 160))
			XPL2 DE 10 A_CustomMissile ("MuchBlood", 20, 0, random (0, 360), 2, random (0, 160))
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			XPL2 E -1
			Stop
	}
}




















		
ACTOR DyingZombiemanLostTeeth: FBD_RifleZombie
{
    Radius 12
    Height 32
    Speed 0
	Health 40
	-COUNTKILL
	+GHOST
	+THRUGHOST
	+NOPAIN
	+FRIENDLY
	-COUNTKILL
	DropItem "None" 255
	Damagefactor "Stealth", 0.0
	+SOLID // headboxes monitor this flag and auto-terminate if it is unset
	
	
    States
    {
		Spawn:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("FBD_RunMonster",12)
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 0, 33, 1) // force create
		Pain.Head:
		SEE:
			TNT1 A 0
			TNT1 A 0 A_Pain
			TNT1 A 0 A_CustomMissile ("Brains7", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("Teeth", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("TeethNoBounce", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			
			ZZD5 A 6 A_CustomMissile ("MuchBlood", 40, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			ZZD5 CB 8
			ZZD5 CBCB 12 A_Pain
			
		Death:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_Scream
			
			ZZD5 D 6 A_NoBlocking
			
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			TNT1 A 0 A_SpawnItemEx("FBD_DeadZombieManFacingFront",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the spawned corpse time to access our inventory
			Stop
		
		Death.Head:
		Death.HeadStun:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			//TNT1 A 0 A_SpawnItemEx("ArmorShardFatalityBonus2", 0,0,0, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			TNT1 A 0 ACS_NamedExecuteAlways("DropFatalityBonuses", 0, 0, 2, 0) // 0, health, armor, 0 -- rounded down to nearest 2
			//TNT1 A 0 A_JumpIfInTargetInventory("HasPlasmaWeapon", 1, "Death.Plasma")
			//TNT1 A 0 A_JumpIfInTargetInventory("HasCutingWeapon", 1, "Death.Decaptate")
			TNT1 A 0 A_JumpIfHealthLower(-600, "XDeath")
			TNT1 A 0 A_JumpIfHealthLower(-250, "Death.SSGHead")
			Goto Death.HeadExplode
		
		Death.Shotgun:
			Goto DeathShotgunFly
		Death.SniperBullet:
		Death.Bullet792:		
		Death.Minigun:
			Goto Death.Saw
		
	}
}

		
ACTOR DyingShotgunguyHitInEye: FBD_ShotgunGuy
{
    Radius 12
    Height 32
    Speed 0
	Health 40
	-COUNTKILL
	+GHOST
	+THRUGHOST
	+NOPAIN
	+DONTSPLASH
	-COUNTKILL
	Damagefactor "Stealth", 0.0
	DropItem "None" 255
	//+SOLID // headboxes monitor this flag and auto-terminate if it is unset
    States
    {
		Spawn:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("FBD_RunMonster", 12) // dying guy headbox
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 0, 28, 1) // force create
		
			TNT1 AAAAA 0 A_CustomMissile ("Brutal_FlyingBloodTrail8", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 360))
			TNT1 AA 0 A_CustomMissile ("SmallBrainPieceFast", random (45, 55), random (5, -5), random (170, 190), CMF_AIMDIRECTION, random (-10, 10))
			TNT1 AAA 0 A_CustomMissile ("SmallBrainPiece", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeath1", 40, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("Brains3", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("Brains5", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			SPOS U 6 A_Scream
			SPOS V 6 
			SPOS VWVW 18 A_Pain
			SPOS VW 18 A_Pain 
			TNT1 A 0 A_NoBlocking
		Death:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")		
			SPOS XY 6
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_SpawnItemEx("DeadShotgunguySPOSZ",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the spawned corpse time to access our inventory
			Stop
		Death.Decaptate:
		Death.HeadPlasma:
			TNT1 A 0 
			Goto Death.HeadExplode
		Death.Head:
		Death.HeadStun:
		
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			//TNT1 A 0 A_SpawnItemEx("ArmorShardFatalityBonus2", 0,0,0, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			TNT1 A 0 ACS_NamedExecuteAlways("DropFatalityBonuses", 0, 0, 2, 0) // 0, health, armor, 0 -- rounded down to nearest 2
			//TNT1 A 0 A_JumpIfInTargetInventory("HasPlasmaWeapon", 1, "Death.Plasma")
			//TNT1 A 0 A_JumpIfInTargetInventory("HasCutingWeapon", 1, "Death.Decaptate")
			TNT1 A 0 A_JumpIfHealthLower(-600, "XDeath")
			TNT1 A 0 A_JumpIfHealthLower(-250, "Death.SSGHead")
			Goto Death.HeadExplode
		
		Death.Shotgun:
			Goto DeathShotgunFly
		Death.SniperBullet:
		Death.Bullet792:			
		Death.Minigun:
			Goto Death.Saw
	}
}




ACTOR ZombieScientistDyingGuts: DyingZombiemanNoArm
{
	//+SOLID // headboxes monitor this flag and auto-terminate if it is unset
	States
	{
		Death.fire:
		Death.Flames:
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_StopSound(CHAN_VOICE) //A_PlaySound("BLANKSND")
			//TNT1 AA 0 A_SpawnItemEx("HealthPlusFatalityBonus", 0,0,0, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			TNT1 A 0 ACS_NamedExecuteAlways("DropFatalityBonuses", 0, 10, 0, 0) // 0, health, armor, 0 -- rounded down to nearest 2
			//TNT1 A 0 A_Scream
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_SpawnItemEx("BurningZombie",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
		Spawn:
			FSD5 E 1 NODELAY ACS_NamedExecuteWithResult("FBD_RunMonster", 12) // dying guy headbox

			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 0, 28, 1) // force create
			
			TNT1 A 0 A_PlaySound ("BURNZOM", CHAN_VOICE)
			Goto Suffer
		Suffer:
			TNT1 A 0
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			
			FSD5 FFFFFEEEEEFFFFFEEEEEFFFFFEEEEEFFFFFEEEEEFFFFFEEEEEFFFFFEEEEE 2 A_CustomMissile ("Brutal_LiquidBlood", 20, 0, random(0, 360), CMF_AIMDIRECTION, random (0, 45))
			FSD5 E 10
			TNT1 A 0 A_SpawnItemEx ("BloodDying", 0, 0, 20,0,0,0,0,0,0)
			FSD5 FFFFFEEEEE 2 A_CustomMissile ("Brutal_LiquidBlood", 20, 0, random(0, 360), CMF_AIMDIRECTION, random (0, 45))
			Goto Death

		Death.Saw:
		Death.Cutless:
		Death:
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 //A_PlaySound("BLANKSND")
			TNT1 A 0 A_PlaySound("grunt/death", CHAN_VOICE)
			FSD5 G 8 A_NoBlocking
			TNT1 A 0 A_ChangeFlag("ISMONSTER", 0)
			TNT1 A 0 A_ChangeFlag("CORPSE", 1) // for vile raiseability
			SCZA L -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop
			
		Raise:
			// note: the frame letter of the "----" (keep previous) sprite is ignored
			"----" A 0
			"----" A 0 A_ChangeFlag("CORPSE", 0)
			"----" A 0 A_GiveInventory("RezzingNow")
			"----" A 0 A_NoBlocking // the raising code deep in C++ makes it solid
			"----" A 0 A_JumpIf(!CallAcs("EnoughSpaceToRezNormally", 2003), "FallbackRaise")
			// The vile had already copied his friendliness and target to this corpse.
			// A_SpawnItem(Ex) automatically copy friendliness
			//   and target, but only if both the spawner and the spawnee are monsters.
			"----" A 0 A_ChangeFlag("COUNTKILL", 0)
			"----" A 0 A_ChangeFlag("ISMONSTER", 1)
			"----" A 0 A_SpawnItemEx ("LabguyRaisedByVile",0,0,0, 0,0,0, 0,SXF_TRANSFERPOINTERS | SXF_NOCHECKPOSITION)
			"----" A 1 A_Jump(256, "OnRezSfx")
			Wait //Zandronum client repeats the last frame while it waits for a status update from the server
			
		FallbackRaise:
			"----" A 0 A_GiveInventory("RezzingNow")
			"----" A 0 A_ChangeFlag("CORPSE", 0)
			"----" A 0 A_ChangeFlag("SHOOTABLE", 0)
			//"----" A -1 ACS_NamedExecuteAlways("FallbackRez", 0, 17, 0, 0) //"LabguyRaisedByVile"
			"----" A -1 ACS_NamedExecuteWithResult("FallbackRezMkII", 2003) // see _mob_list.xlsx
			Stop			

		Death.Head:
		Death.Minorhead:
		Death.Decaptate:
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 //A_PlaySound("BLANKSND")
			TNT1 A 0 A_PlaySound("misc/xdeath4", CHAN_VOICE)
			TNT1 A 0 A_PlaySound("headex", 0)
			TNT1 A 0 A_CustomMissile ("ShotgunguyHeadExplode", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_XScream
			TNT1 A 0 A_NoBlocking
			//TNT1 A 0 A_SpawnItemEx("HealthPlusFatalityBonus", 0,0,0, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			TNT1 A 0 ACS_NamedExecuteAlways("DropFatalityBonuses", 0, 5, 0, 0) // 0, health, armor, 0 -- rounded down to nearest 2
			FSD5 HI 10
			TNT1 A 0 A_ChangeFlag("ISMONSTER", 0)
			TNT1 A 0 A_ChangeFlag("CORPSE", 1)
			FSAD E -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop

		Death.Shotgun:
		Death.Kick:
		Death.SuperKick:
		Death.Extremepunches:
		Death.Melee:
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 //A_PlaySound("BLANKSND")
			TNT1 A 0 A_CustomMissile ("MuchBlood2", 35, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_Scream
			TNT1 A 0 ThrustThingZ(0,30,0,1)
			TNT1 A 0 A_NoBlocking
			FS11 GH 15
			TNT1 A 0 A_SpawnItemEx ("DeadFormerScientist",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop

		Death.Fatality:
			Goto XDeath
	}
}
		
		
		



ACTOR DyingZManFatality5: DyingZombiemanNoArm // Doomguy ripped all the skin off his face
{
    Radius 12
    Height 32
    Speed 0
	Health 50
	-COUNTKILL
	+GHOST
	+THRUGHOST
	+NOPAIN
	+FRIENDLY
	Species "Marines"
	DropItem "None" 255
	//+SOLID // headboxes monitor this flag and auto-terminate if it is unset
    States
    {
		Spawn:
			FRAA A 0 NODELAY ACS_NamedExecuteAlways("FBD_RunMonster", 12) // dying guy headbox
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 0, 28, 1) // force create
			
			TNT1 A 0 A_PlaySound("BURNZOM", CHAN_VOICE)
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			
			FRAA FGHGFGHGFGHGFGHGFGHGFGHG 5 A_CustomMissile("Brutal_LiquidBlood2", 32 , 0, random (0, 360), CMF_AIMDIRECTION, random (40, 90))
			
		Death:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")		
			TNT1 A 0 A_Scream
			FRAA I 6 A_NoBlocking
			TNT1 A 0 A_SpawnItemEx("FBD_DeadZombieManFatality5",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the spawned corpse time to access our inventory
			Stop
		
		Death.Head:
		Death.HeadStun:
		Death.HeadPlasma:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			//TNT1 A 0 A_SpawnItemEx("ArmorShardFatalityBonus2", 0,0,0, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			TNT1 A 0 ACS_NamedExecuteAlways("DropFatalityBonuses", 0, 0, 2, 0) // 0, health, armor, 0 -- rounded down to nearest 2
			
			TNT1 A 0 A_JumpIfInTargetInventory("HasPlasmaWeapon", 1, "Death.Plasma")
			TNT1 A 0 A_JumpIfInTargetInventory("HasCutingWeapon", 1, "Death.Decaptate")
			TNT1 A 0 A_PlaySound("misc/xdeath4")
			TNT1 A 0 A_SpawnItem("ZombiemanHeadExplode", 0, 40)
			ZMAD B 0 A_XScream
			ZMAD C 0 A_NoBlocking
			TNT1 A 0 A_FaceTarget
			TNT1 A 0 A_GiveToTarget("SoulAmmo", 1)
			
			TNT1 A 0 A_SpawnItemEx ("Zombiemanfallingbeheaded",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the spawned corpse time to access our inventory
			Stop
		
		Death.Shotgun:
			Goto Death.SSG
		Death.SniperBullet:
		Death.Bullet792:			
		Death.Minigun:
			Goto Death.SSG
		
	}
}



Actor FatalizedSGGuy6: FBD_DeadShotgunGuy1
{
	Health 200 
	States{
		//***Che // this is a descendant of FBD_CurbstompedMarine, which is neither a missile nor a monster
		Spawn:
		Stay: // ancestor's Pain.Kick, Pain.ExplosiveImpact and Pain.Trample redirect here after z-thrusting the actorz-thrusting the actor
			FRSA HI 6 A_SpawnItemEx ("Blood", 0, 56,0,0,0,0,0,0)
			TNT1 A 0 A_PlaySound("misc/xdeath2c")
			TNT1 A 0 A_CheckFloor("Land")
			Loop
		Land:	
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteAlways("FBD_CheckFloorIsLava_V", 0, 0, 0, 0) // also spawns smoke for 30 tics if succeeds
			FRSA HI 6 A_SpawnItemEx ("Blood", 0, 56,0,0,0,0,0,0)
			TNT1 A 0 A_PlaySound("misc/xdeath2c")
			FRSA HI 6 A_SpawnItemEx ("Blood", 0, 56,0,0,0,0,0,0)
			TNT1 A 0 A_PlaySound("misc/xdeath2c")
			
			TNT1 A 0 A_JumpIf(user_floor_is_lava, "LandOnLava")	
			
			FRSA HI 6 A_SpawnItemEx ("Blood", 0, 56,0,0,0,0,0,0)
			TNT1 A 0 A_PlaySound("misc/xdeath2c")
			FRSA HI 6 A_SpawnItemEx ("Blood", 0, 56,0,0,0,0,0,0)
			TNT1 A 0 A_PlaySound("misc/xdeath2c")
			FRSA HI 6 A_SpawnItemEx ("Blood", 0, 56,0,0,0,0,0,0)
			TNT1 A 0 A_PlaySound("misc/xdeath2c")
			FRSA HI 6 A_SpawnItemEx ("Blood", 0, 56,0,0,0,0,0,0)
			TNT1 A 0 A_PlaySound("misc/xdeath2c")
			FRSA HI 6 A_SpawnItemEx ("Blood", 0, 56,0,0,0,0,0,0)
			TNT1 A 0 A_PlaySound("misc/xdeath2c")
			FRSA HI 6 A_SpawnItemEx ("Blood", 0, 56,0,0,0,0,0,0)
			TNT1 A 0 A_PlaySound("misc/xdeath2c")
			FRSA HJKL 5 A_SpawnItemEx ("Blood", 0, 50,0,0,0,0,0,0)
			TNT1 A 0 A_NoBlocking
			
			//***Che: prevent the game engine from auto-respawning this gibbed corpse on nightmare as a corpse
			// while allowiing archviles raising it (they only check for the CORPSE flag)
			// and respawning via script on nightmare
			TNT1 A 0 A_ChangeFlag("CORPSE", 1)
			TNT1 A 0 A_ChangeFlag("ISMONSTER", 0)
			FRSA L -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop	
		Death:
		Death.Saw:
		Death.Cutless:
			TNT1 A 0
			TNT1 A 0 A_SpawnItem("GibsZ")
			TNT1 AAA 0 A_CustomMissile ("XDeath1", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeath2", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAA 0 A_CustomMissile ("xdeath3", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAA 0 A_CustomMissile ("xdeath4", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeath3", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeath4", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			SGF8 N 1
			
			//***Che: prevent the game engine from auto-respawning this gibbed corpse on nightmare as a corpse
			// while allowiing archviles raising it (they only check for the CORPSE flag)
			// and respawning via script on nightmare
			TNT1 A 0 A_ChangeFlag("CORPSE", 1)
			TNT1 A 0 A_ChangeFlag("ISMONSTER", 0)
			SGF8 N -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop
	}
}