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




ACTOR FBD_Labguy: FBD_RifleZombie 17691
{
	//$category "FBD Monsters"
	//$Sprite SCZAA1
	
	//***Che radius, height and maxdropoffheight (n/a for flying ones) MUST be kept consistent with FBD_TrySpawn in FBD_CORE.acs!
	
	Game Doom
	Health 50
	Radius 16
	Height 44
    Speed 12
	FastSpeed 14
	PainChance 190
	MaxTargetRange 100
	+NOBLOCKMONST
	+DROPOFF
	Obituary "%o has been cut down by a zombie labworker."
	damagefactor "Taunt", 1.0
	DropItem "none"
	AttackSound "none"
	Tag "$LABGUY" // "Civilian Zombie";
	Obituary "$LABGUY_O" //  "%o was axe-murdered.";
	
	DamageFactor "ExtremePunches", 2.0
	
	//***Che: disable inherited grenades-related animations:
	DamageFactor "HardGrenade1", 0.0
	DamageFactor "HardGrenade2", 0.0
	DamageFactor "HardGrenade3", 0.0
	DamageFactor "FireInTheHole", 0.0
	DamageFactor "HurrDurrMeHazGrenaed", 0.0

	damagefactor "Leg", 1.0 // subscribe to lift the default immunity
	
	damagefactor "Killme", 1.0 // AOE inflicted by captured marines
	PainChance "Killme", 255	
	
	PainChance "Ice", 255
	
	//***Che this damage type is now for subscribers only
	damagefactor "Stealth", 1.0
	PainChance "Stealth", 255	
	
	
	States
	{
		Pain.Ice:
			"----" A 20 A_Pain
			Goto See
		
		WaitTargetsFatalityOut:
			TNT1 A 0 A_PlaySound("grunt/sight", CHAN_VOICE)
			SCZA B 6 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 3, 3, 41)
			SCZA A 6 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 7, 4, 39)
			SCZA B 6 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 3, 3, 41)
			SCZA A 6 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 7, 4, 39)
			SCZA B 6 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 3, 3, 41)
			SCZA A 6 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 7, 4, 39)
			SCZA B 6 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 3, 3, 41)			
			Goto See
		
		Possession: //***Che I got no idea what this state is for :(
			TNT1 A 0 A_SetInvulnerable
			SCZA G 3 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", -10, -6, 41)
			SCZA G 3 A_Pain
			"####" "#" 35 ACS_NamedExecuteAlways("Pos - Flicker effect")
			TNT1 A 0 A_UnSetInvulnerable
			Goto See
		Raise:
			//POSS K 5 // doom2 zombieman frames!!!!
			//POSS JIH 5
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII") // should not have a headbox by now -- but what if?
			TNT1 A 0 A_SpawnItemEx("StandaloneRezSfx",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 0 A_GiveInventory("TargetIsAFormerHuman", 1) //used by AOE DOT inflictors to reward players with soul ammo -- otherwise untraceable
			SCZA LKJIH 5
			TNT1 A 0 ACS_NamedExecuteWithResult("FBD_CustomizeOnRez") // it runs OnRezMapScript
				// if the map prpvides one
			Goto See	

		FallbackRaise: // we were put into this state by the superarchvile AOE raising, our height is hopelessly kaput and we have to spawn a substitute
			"----" A 0 A_GiveInventory("RezzingNow")
			"----" A 0 A_ChangeFlag("CORPSE", 0)
			"----" A 0 A_ChangeFlag("COUNTKILL", 0)
			"----" A 0 A_ChangeFlag("SHOOTABLE", 0)
			"----" A -1 ACS_NamedExecuteWithResult("FallbackRezMkII", 2003) // see _mob_list.xlsx
			Stop
			
		FallbackRezSuccess:
			TNT1 A 0 A_SpawnItemEx("StandaloneRezSfx",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30
			Stop			
		
		Spawn:
		
			SCZA B 1 NODELAY ACS_NamedExecuteWithResult("FBD_RunMonster", 5) // 5 = default headbox 
			TNT1 A 0 A_GiveInventory("TargetIsAFormerHuman", 1) //used by AOE DOT inflictors to reward players with soul ammo -- otherwise untraceable
			SCZA B 7 // slaughtermap init takes 5 tics
			Goto Stand		
			
		Stand:
			//TNT1 A 0 A_SpawnItem ("LegTarget100", 10)
			TNT1 A 0
			
			///TNT1 A 0 A_JumpIf(user_serverside_sfchk >= 4, "StandSfestExtreme") // extreme slaughtermap optimization
			
			//***Che: dumbing it down to b frame only, because headbox positions too different
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 3, 3, 41)
			SCZA BBBB 10 A_Look
			"----" A 0 A_JumpIf(!user_head_tid, "StandSfestExtreme")
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 7, 4, 39)
			SCZA AAAA 10 A_Look
			Loop
			
		StandSfestExtreme:
			SCZA BB 14 A_Look
			Loop
			
		
		Idle:
			TNT1 A 0
			TNT1 A 0 A_GiveInventory("SKLabGuy", 1)
			TNT1 A 0 A_GiveInventory("TypeZombieMan", 1)
			TNT1 A 0 A_TakeInventory("ZombiemanAmmo", 20)
			TNT1 A 0 A_GiveInventory("ZombieManAmmo", random(1,10))
			
			SCZA B 1
			Goto SearchForPlayer //Stand
		
			
		WalkAround:
			TNT1 A 0 A_TakeInventory("SKLabGuy", 1)

			TNT1 A 0 A_SpawnItemEx("FootStep", 0, 0, 10, 0, 0)
	
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 7, 4, 39)
			SCZA A 2 A_Look
			
			SCZA A 2 A_Wander
			
			TNT1 A 0 A_Recoil(-1)
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 3, 3, 41)
			SCZA B 2 A_Look
			
			SCZA B 2 A_Wander
			TNT1 A 0 A_PlaySound("humans/step",3)

			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 7, -2, 41)
			SCZA D 2 A_Look
			
			SCZA D 2 A_Wander
			TNT1 A 0 A_PlaySound("humans/step",4)
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 6, 2, 39)
			SCZA C 2 A_Look

			SCZA C 2 A_Wander
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 7, -2, 41)
			SCZA D 2 A_Look
			
			SCZA D 2 A_Wander
			TNT1 A 0 A_PlaySound("humans/step",4)
		
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 3, 3, 41)
			SCZA B 2 A_Look

			SCZA B 2 A_Wander
			TNT1 A 0 A_PlaySound("humans/step",4)

			TNT1 A 0 A_Jump(32, "Stand")
			Loop
			
		
		SearchForPlayer:
			TNT1 A 0 A_JumpIfHealthLower(1, "Death")
			TNT1 A 0 A_ClearTarget
			TNT1 A 0 A_TakeInventory("EnemyMemory", 30)
			TNT1 A 0 A_GiveInventory("SKLabGuy", 1)
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 7, 4, 39)
			SCZA A 10 A_Look
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 3, 3, 41)
			SCZA B 10 A_Look
			TNT1 A 0 A_SetAngle(angle - 40)

			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 7, 4, 39)
			SCZA A 10 A_Look

			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 6, 2, 39)
			SCZA C 10 A_Look
			TNT1 A 0 A_SetAngle(angle + 40)

			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 7, 4, 39)
			SCZA A 10 A_Look

			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 7, -2, 41)
			SCZA D 10 A_Look

			TNT1 A 0 A_SetAngle(angle + 40)
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 7, 4, 39)
			SCZA A 10 A_Look
			
			SCZA A 4 A_Look
			
			
			//***Che: THE HEAVY MOBS FALLING OFF LEDGES BUG
			// No, you *cannot* use A_Recoil to simulate slow movement
			// A) happily ignores "block monsters"
			// B) happily ignores height difference
			// Result: show up then walk away causin the monster to enter this mode.
			// When you return there's about 90% chance he will be stuck in the deepest pit available.
			// Most notorious for revenants across the entirety of EDAY placed atop cargo containers
			//   (and revenants on high ledges in map 31, Peak of the gods).
			//   They fall off with 100% reliability.
			// Also very prominent on maps generated using Oblige 6.x
			//   where you find most revenants, knights and barons down in lava pits.
			
			// im replacing all 0s with 1s for A_Wander and commenting a_recoil out
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 3, 3, 41)
			TNT1 A 0 A_Wander
			//TNT1 A 0 A_Recoil(-1)
			SCZA B 4 A_Look
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 6, 2, 39)
			TNT1 A 0 A_Wander
			//TNT1 A 0 A_Recoil(-1)
			SCZA C 4 A_Look
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 7, -2, 41)
			TNT1 A 0 A_Wander
			//TNT1 A 0 A_Recoil(-1)
			SCZA D 4 A_Look
			
			TNT1 A 0 A_Wander
			//TNT1 A 0 A_Recoil(-1)
			
			TNT1 A 0 A_Jump(128, "Idle")
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 7, 4, 39)
			SCZA A 4 A_Look
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 3, 3, 41)
			TNT1 A 0 A_Wander
			//TNT1 A 0 A_Recoil(-1)
			SCZA B 4 A_Look
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 6, 2, 39)
			TNT1 A 0 A_Wander
			//TNT1 A 0 A_Recoil(-1)
			SCZA C 4 A_Look
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 7, -2, 41)
			TNT1 A 0 A_Wander
			//TNT1 A 0 A_Recoil(-1)
			SCZA D 4 A_Look
			
			TNT1 A 0 A_Wander
			//TNT1 A 0 A_Recoil(-1)
			Loop
					
		FallBack:
			TNT1 A 0 A_CheckSight("Advance")
			TNT1 A 0 A_ChangeFLag("NODROPOFF", 1)
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 7, -2, 41)
			SCZA D 2 A_FaceTarget
			SCZA D 2 A_Recoil(2)
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 6, 2, 39)
			SCZA C 2 A_FaceTarget
			SCZA C 2 A_Recoil(2)
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 3, 3, 41)
			SCZA B 2 A_FaceTarget
			SCZA B 2 A_Recoil(2)
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 7, 4, 39)
			SCZA A 2 A_FaceTarget
			SCZA A 2 A_Recoil(2)
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 7, -2, 41)
			SCZA D 2 A_FaceTarget
			SCZA D 2 A_Recoil(2)
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 6, 2, 39)
			SCZA C 2 A_FaceTarget
			SCZA C 2 A_Recoil(2)
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 3, 3, 41)
			SCZA B 2 A_FaceTarget
			SCZA B 2 A_Recoil(2)
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 7, 4, 39)
			SCZA A 2 A_FaceTarget
			SCZA A 2 A_Recoil(2)
			GOto SeeContinue
		
		See:
			TNT1 A 0 A_JumpIfHealthLower(1, "Death")
			TNT1 A 0 A_ChangeFLag("NODROPOFF", 0)
			TNT1 A 0 A_TakeInventory("SKLabGuy", 1)
			TNT1 A 0 A_TakeInventory("EnemyMemory", 15)
			TNT1 A 0 A_CheckSight("SeeNeverSeen")
			Goto SeeContinue
		
		SeeContinue:
			TNT1 A 0 A_JumpIfHealthLower(1, "Death")
			//TNT1 A 0 A_JumpIfCloser(200, "FallBack")
			Advance:
			TNT1 A 0 A_ChangeFLag("NODROPOFF", 0)
			TNT1 A 0 A_SpawnItemEx("FootStep", 0, 0, 10, 0, 0)
			TNT1 A 0 A_JumpIfInventory("EnemyMemory", 15, "SearchForPlayer")
			TNT1 A 0 A_GiveInventory("EnemyMemory", 1)
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 7, 4, 39)
			SCZA AA 2 A_Chase
			//TNT1 A 0 A_Recoil(-1)
			TNT1 A 0 A_TakeInventory("SKLabGuy", 1)
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 3, 3, 41)
			SCZA BB 2 A_Chase
			TNT1 A 0 A_PlaySound("humans/step",3)
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 6, 2, 39)
			SCZA CC 2 A_Chase
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 7, -2, 41)
			SCZA DD 2 A_Chase
			TNT1 A 0 A_PlaySound("humans/step",3)
			Loop
			
		SeeNeverSeen:
			//TNT1 A 0 A_JumpIfCloser(200, "FallBack")
			Advance:
			TNT1 A 0 A_ChangeFLag("NODROPOFF", 0)
			TNT1 A 0 A_SpawnItemEx("FootStep", 0, 0, 10, 0, 0)
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 7, 4, 39)
			SCZA AA 2 A_Chase
			TNT1 A 0 A_Recoil(-1)
			TNT1 A 0 A_TakeInventory("SKLabGuy", 1)
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 3, 3, 41)
			SCZA BB 2 A_Chase
			TNT1 A 0 A_PlaySound("humans/step",3)
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 6, 2, 39)
			SCZA CC 2 A_Chase
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 7, -2, 41)
			SCZA DD 2 A_Chase
			TNT1 A 0 A_PlaySound("humans/step",3)
			Loop
			
		Pain.Taunt:
			TNT1 A 0
			POSS B 0 A_Pain
			TNT1 A 0 A_ChangeFlag("FASTER", 1)
			TNT1 A 0 A_ChangeFlag("MISSILEMORE", 1)
			TNT1 A 0 A_ChangeFlag("MISSILEEVENMORE", 1)
			TNT1 A 0 A_PlaySound("grunt/sight", CHAN_VOICE)
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 7, 4, 39)
			SCZA A 1 A_FaceTarget
			SCZA A 1
			TNT1 A 0 A_GiveInventory("Enraged", 1)
			TNT1 A 0 A_PlaySound("grunt/sight", CHAN_WEAPON)
			Goto SeeContinue
			
		Melee:
		Missile:
		
			TNT1 A 0 A_JumpIfInTargetInventory("GoFatality", 1, "WaitTargetsFatalityOut")
			
			TNT1 A 0 A_JumpIfInTargetInventory("IsLTGPlayer", 1, "LTGCheck")
		MeleeContinueAfterLTGCheck:		
			

			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 2, 1, 40)

			SCZA E 1 A_FaceTarget
			TNT1 A 0 A_Recoil(-5)
			SCZA E 6 A_FaceTarget
			TNT1 A 0 A_PlaySound("skeleton/swing", CHAN_WEAPON)
			TNT1 A 0 A_CustomMissile("ZombieAxeAttack",10,0,0,0)
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 9, 5, 38)
			SCZA F 6 A_FaceTarget
			SCZA E 6 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 2, 1, 40)
			Goto See

		
		Pain.Taunt:
		Pain.KillMe:
			TNT1 A 0
			TNT1 A 0 HealThing(1)
			Goto See
			
		Death.KillMe:
		Death.Taunt:
		Death.Avoid:
			TNT1 A 0
			Goto Death
			//TNT1 A 0 A_ChangeFlag("SOLID", 0)
			//TNT1 A 0 A_SpawnItem("FBD_Labguy")
			//TNT1 A 0
			//Stop

		Pain:
		Pain.Cut:
		Pain.Head:
		Pain.Decaptate:
			TNT1 A 0 A_JumpIfInventory ("IsDown", 1, "PainDown")//7)
			
			TNT1 A 0 A_CustomMissile ("FBD_FlyingBlood", 35, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			SCZA G 3 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", -10, -6, 41)
			
			SCZA G 3 A_Pain
			Goto See
		PainDown:	
			TNT1 A 0
			// flat on the back, head should not be visible
			FSD1 G 4 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", -15, 0, 1)
			TNT1 A 0 A_Pain
			FS11 SSS 10
			FS11 T 10 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 0, 21)
			TNT1 A 0 A_TakeInventory("IsDown", 1)
			Goto See
			

		Pain.Argent:
			TNT1 A 0
			
			//TNT1 A 0 A_ClearTarget
			TNT1 A 0 A_GiveInventory("Enraged", 1)
			TNT1 A 0 A_Pain
			TNT1 A 0 HealThing(15,70)
			
			
			TNT1 A 0 A_JumpIfInventory ("IsDown", 1, "PainArgentDown")//7)
			TNT1 A 0 ACS_NamedExecuteWithResult("DisplayArgentDischarge", 10, 40, 0)	
			TNT1 A 0 A_CustomMissile ("FBD_FlyingBlood", 35, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			SCZA G 3 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", -10, -6, 41)
			
			SCZA GGGG 8 A_Pain
			Goto See
		PainArgentDown:	
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DisplayArgentDischarge", 10, 20, 0)	
			// flat on the back, head should not be visible
			FSD1 G 4 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", -15, 0, 1)
			FSD1 GGGG 8 A_Pain
			FS11 SSS 10
			FS11 T 10 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 0, 21)
			TNT1 A 0 A_TakeInventory("IsDown", 1)
			Goto See			
			

		Pain.Melee:
			TNT1 A 0 A_JumpIfInventory ("IsDown", 1, "PainDown")//7)
			TNT1 A 0 A_JumpIfInventory ("SKLabguy", 1, "StealthKill")
			
			TNT1 A 0 A_CustomMissile ("FBD_FlyingBlood", 35, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			SCZA G 3
			
			SCZA G 3 A_Pain
			Goto See
			
		Pain.Stealth:
			TNT1 A 0
			TNT1 A 0 A_Pain
			TNT1 A 0 A_JumpIfInventory ("SKLabguy", 1, "StealthKill")
			TNT1 A 0 A_JumpIfInventory ("IsDown", 1, "GroundExecution")
			Goto See
			
		GroundExecution:
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_GiveToTarget("ExecuteDownedZombieman", 1)
			TNT1 A 0 A_GiveToTarget("GoSpecial", 1)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop	

			
		Pain.ExplosiveImpact:
		Pain.FriendlyExplosion:
		Pain.Explosive:
		Pain.Bfg10k: //***Che changed damage type from extreme to custom
			TNT1 A 0
			TNT1 A 0 A_Pain
			TNT1 A 0 A_JumpIfInventory ("IsDown", 1, "Pain")
			TNT1 A 0 A_TakeInventory("SKLabguy", 1)
			TNT1 A 0 A_GiveInventory("IsDown", 1)
			TNT1 A 0 ThrustThingZ(0,40,0,1)
			// flying after impact, head not visible
			FS11 G 8 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", -15, 0, 27)
			FS11 H 8 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", -15, 0, 17) 
			Goto FallingAfterImpact
			
		Pain.Kick:
		Pain.Stomp:
		Pain.ExtremePunches:
		Pain.BlackHole:
			TNT1 A 0
			FS11 G 1 A_Pain
			TNT1 A 0 A_JumpIfInventory ("IsDown", 1, "Pain")
			TNT1 A 0 A_TakeInventory("SKLabguy", 1)
			TNT1 A 0 A_GiveInventory("IsDown", 1)
			TNT1 A 0 ThrustThingZ(0,30,0,1)
			//ID11 E 1 A_Chase ("","")
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", -15, 0, 27)
			FS11 G 1 A_facetarget
			FS11 G 6 ThrustThing(angle*256/360+128, 10, 0, 0)
			FS11 H 8 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", -15, 0, 17)
			Goto FallingAfterImpact
			
		FallingAfterImpact:
			FS11 H 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", -15, 0, 17) 
			FS11 H 1 A_GiveInventory ("Fallingheight", 1)
			FS11 H 1 A_CheckFloor ("GetUp")
			NULL A 0 A_JumpIf (momz == 0, "GetUp")
			Loop
			
		GetUp:
			TNT1 A 0
			TNT1 A 0 A_JumpIfInventory ("FallingHeight", 5, "FallingDie")
			TNT1 A 0 A_PlaySound("BODYF",6)
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", -15, 0, 1)
			FS11 SSSSSSS 5 A_JumpIf(momz < 0, "FallingAfterImpact")
			TNT1 A 0 A_TakeInventory("Fallingheight", 100)
			TNT1 A 0 A_TakeInventory("IsDown", 1)
			FS11 T 10 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 0, 21)
			Goto See
			 
		FallingDie:
			TNT1 A 0
			TNT1 A 0 A_ChangeFlag("COUNTKILL", 0)
			TNT1 A 0 A_ChangeFlag("SHOOTABLE", 0)
			TNT1 A 0 A_SpawnItem("SplatteredSmall")
			TNT1 A 0 A_JumpIfInventory ("FallingHeight", 15, "Death.Stomp")
			TNT1 A 0 A_JumpIfInventory ("FallingHeight", 10, "FallingSuperDeath")
			TNT1 A 0 A_JumpIfInventory ("FallingHeight", 5, "FallingDeath")
		FallingDeath:
			TNT1 A 0
			TNT1 A 0 A_Explode(200, 2, 1)
			TNT1 A 0 A_Scream
			TNT1 A 0 A_NoBLocking
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 AAAA 0 A_CustomMissile ("XDeath1", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (50, 130))
			FS11 GH 2
			TNT1 A 0 A_PlaySound("BODYF",6)
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			TNT1 A 0 A_Custommissile("BloodyAxe", 32, 0, random (0, 360), 2, random (50, 130))
			TNT1 A 0 A_SpawnItemEx ("DeadFormerScientist",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
		
		FallingSuperDeath:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_Explode(200, 2, 1)
			TNT1 A 0 A_XScream
			TNT1 A 0 A_NoBLocking
			TNT1 A 0 A_SpawnItem ("BigBloodSpot")
			Goto Death.ExplosiveImpact //+1
		

		Death.Melee:
			TNT1 A 0 A_JumpIfInventory ("IsDown", 1, "Death.Down")
			TNT1 A 0 A_JumpIfInventory ("SKLabguy", 1, "StealthKill")
		Death.Kick:
			TNT1 A 0 ThrustThingZ(0,30,0,1)
			TNT1 A 0 A_Scream
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_FaceTarget
			TNT1 A 0 A_Recoil (8)
			FS11 GH 8
			TNT1 A 0 A_Custommissile("BloodyAxe", 32, 0, random (0, 360), 2, random (50, 130))
			TNT1 A 0 A_PlaySound("BODYF",6)
			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.Down:
			POSS I 0 A_Scream
			POSS J 0 A_NoBlocking
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			FSMS L 1
			TNT1 A 0 A_Custommissile("BloodyAxe", 32, 0, random (0, 360), 2, random (50, 130))
			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.Shotgun:
			TNT1 A 0 A_JumpIfCloser(90, "Death.Blast")
			TNT1 A 0 A_JumpIfCloser(200, "Death.Shotgunontheface")
			Goto Death
			
		Death.Shotgunontheface:	
			
			TNT1 A 0
			TNT1 A 0 A_Jump(128, "Death.Arm", "Death.Leg")
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 ThrustThingZ(0,40,0,1)
			TNT1 A 0 A_CustomMissile ("MuchBlood2", 35, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_Scream
			TNT1 A 0 A_NoBlocking
			 FS11 GH 8
			TNT1 A 0 A_PlaySound("BODYF",6)
			TNT1 A 0 A_Custommissile("BloodyAxe", 32, 0, random (0, 360), 2, random (50, 130))
			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.Blast:
			TNT1 A 0
			TNT1 A 0 A_FaceTarget
			TNT1 A 0 A_Jump(12, "Death.Arm")
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_XScream
			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 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 AA 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))
			SCZ4 A 6 A_Stop
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			TNT1 A 0 A_Custommissile("BloodyAxe", 32, 0, random (0, 360), 2, random (50, 130))
			SCZ4 BBBBBBBBBB 3 A_CustomMissile ("Brutal_LiquidBlood2", 26, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 60))
			SCZ4 CCC 3 A_CustomMissile ("Brutal_LiquidBlood2", 26, 0, random (0, 360), CMF_AIMDIRECTION, random (10, 40))
			SCZ4 DD 3 A_CustomMissile ("Brutal_LiquidBlood2", 6, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 60))
			TNT1 A 0 A_PlaySound("BODYF",7)
			TNT1 A 0 A_SpawnItemEx ("DeadLabguySCZ4E",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
			 
			 
			 
		StealthKill:
			TNT1 A 1
			TNT1 A 0 A_StopSound(CHAN_VOICE)
			TNT1 A 0 A_GiveToTarget("GoFatality", 1)
			TNT1 A 0 A_GiveToTarget("GoSpecial", 1)
			TNT1 A 0 A_GiveToTarget("SKLabguy", 1)
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_Die("Stealthy")
			// everything after A_Die is moot, yes?
			TNT1 A 0 A_Fall
			TNT1 A 1
			Stop
		
		Death.Stealthy:
			TNT1 A 0
			TNT1 A 0 A_NoBlocking
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop

		Death:
			TNT1 A 0
			TNT1 A 0 A_JumpIfInventory ("IsDown", 1, "Death.Down")
			TNT1 A 0 A_JumpIfInventory("HitLeg", 3, "Death.LegMassacre") 
			TNT1 A 0 A_JumpIfInventory("HitLeg", 1, "Death.Leg") 
			
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 AA 0 A_CustomMissile ("FBD_FlyingBlood", 7, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_Jump(96, "Death.Arm", "DeathNoGuts")
		DeathSimple:	
			TNT1 A 0 A_Jump(128, "DeathMirror")
			FSMS H 5
			FSMS I 5 A_Scream
			FSMS J 5 A_NoBlocking
			FSMS K 5
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			TNT1 A 0 A_PlaySound("BODYF",6)
			TNT1 A 0 A_Custommissile("BloodyAxe", 32, 0, random (0, 360), 2, random (50, 130))
			TNT1 A 0 A_SpawnItemEx ("DeadFormerScientist",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
		
		DeathMirror:
			FSMS M 5
			FSMS N 5 A_Scream
			FSMS O 5 A_NoBlocking
			FSMS P 5
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			TNT1 A 0 A_Custommissile("BloodyAxe", 32, 0, random (0, 360), 2, random (50, 130))
			TNT1 A 0 A_PlaySound("BODYF",6)
			TNT1 A 0 A_SpawnItemEx ("DeadLabguyFSMSP",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
			
		Death.Electric:				
			TNT1 A 0
			TNT1 A 0 A_SpawnItem("BarrelExplosionSmokeColumn")
			Goto DeathSimple				
			
		DeathNoGuts:
			TNT1 A 0 A_CustomMissile ("MuchBlood", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("XDeath1", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAA 0 A_CustomMissile ("Guts", 28, 0, random (150, 210), CMF_AIMDIRECTION, random (0, 40))
				SCZA H 5 A_Scream
				TNT1 A 0 A_NoBlocking
				TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			TNT1 A 0 A_PlaySound("BODYF",6)
			TNT1 A 0 A_Custommissile("BloodyAxe", 32, 0, random (0, 360), 2, random (50, 130))
			TNT1 A 0 A_SpawnItemEx ("ZombieScientistDyingGuts",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
			
		Death.Arm:
			TNT1 A 0
			TNT1 A 0 A_CustomMissile ("XDeathArm1", 35, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("MuchBlood2", 35, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_Custommissile("BloodyAxe", 32, 0, random (0, 360), 2, random (50, 130))
			FSD2 A 10 A_Scream
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_SpawnItemEx ("DyingFormerScientistNoArm",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop



		Death.Leg:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")			
			TNT1 A 0 A_CustomMissile ("MuchBlood2", 15, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeath1", 15, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_Custommissile("BloodyAxe", 32, 0, random (0, 360), 2, random (50, 130))
			//TNT1 A 0 A_SpawnItem ("Labguy_NoLeg")
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_SpawnItemEx ("DyingFormerScientistNoLeg",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop

	   

		Death.cut:
			TNT1 A 0
			TNT1 A 0 A_JumpIfInventory("HitLeg", 3, "Death.LegMassacre") 
			TNT1 A 0 A_JumpIfInventory("HitLeg", 1, "Death.Leg") 
			
			TNT1 A 0 A_Jump(32, "Death.Arm", "Death")
			Goto Death.Tear

		Death.SniperBullet:
		Death.Bullet792:
		Death.Minigun:
			TNT1 A 0
			TNT1 A 0 A_JumpIfInventory ("IsDown", 1, "Death.Down")
			TNT1 A 0 A_JumpIfInventory("HitLeg", 3, "Death.LegMassacre") 
			TNT1 A 0 A_JumpIfInventory("HitLeg", 1, "Death.Leg") 			
			TNT1 A 0 A_Jump(32, "Death")
			TNT1 A 0 A_Jump(32, "Death.Arm")
			Goto Death.Massacre
			
		Death.Massacre:
			TNT1 A 0
			TNT1 A 0 A_FaceTarget
			TNT1 A 0 A_Scream
			TNT1 O 0 A_NoBlocking
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			
			TNT1 A 0 A_SpawnItemEx ("BrutalizedFormerScientist1",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 0 A_Custommissile("BloodyAxe", 32, 0, random (0, 360), 2, random (50, 130))
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
			
		Death.LegMassacre:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_CustomMissile ("MuchBlood2", 15, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			//TNT1 A 0 A_SpawnItem ("Labguy_Noleg")
			FSS7 B 1 A_Scream
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_Custommissile("BloodyAxe", 32, 0, random (0, 360), 2, random (50, 130))
			TNT1 A 0 A_SpawnItemEx ("BrutalizedFormerScientistLeg",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop

		Death.Tear:
		Death.Saw:
			TNT1 A 0
			TNT1 A 0 A_JumpIfInventory("HitLeg", 3, "Death.LegMassacre") 
			TNT1 A 0 A_JumpIfInventory("HitLeg", 1, "Death.Leg") 			
			TNT1 A 0 A_Jump(128, "Death.Arm")
			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 O 0 A_NoBlocking
			TNT1 A 0 A_CustomMissile ("RipLabguy", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			FSD1 FG 9
		  //  TNT1 A 0 A_SpawnItem ("DeadLabguy_Half")
			TNT1 A 0 A_PlaySound("BODYF",6)
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			TNT1 A 0 A_SpawnItemEx ("DeadLabguyFSD1H",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 0 A_Custommissile("BloodyAxe", 32, 0, random (0, 360), 2, random (50, 130))
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop


			 

		Death.Fatality:
			TNT1 A 0
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_FaceTarget
			//TNT1 A 0 A_SpawnItemEx("HealthPlusFatalityBonus", 0,0,20, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			//TNT1 A 0 A_SpawnItemEx("ArmorShardFatalityBonus", 0,0,20, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			TNT1 A 0 ACS_NamedExecuteAlways("DropFatalityBonuses", 0, 5, 5, 0) // 0, health, armor, 0 -- rounded down to nearest 2
			TNT1 A 0 A_GiveToTarget("GoFatality", 1)
			
			TNT1 A 0 A_Jump(256,"Death.Fatality1", "Death.Fatality2", "Death.Fatality3")
			Goto Death.Fatality1
		
		Death.Fatality1:
			TNT1 A 0 A_Scream
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_GiveToTarget("LabGuyToken1", 1)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // without at least 8 tics delay, the bonus drop script runs ownerless
			Stop
			
		Death.Fatality2:
			TNT1 A 0 A_Scream
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_GiveToTarget("LabGuyToken2", 1)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // without at least 8 tics delay, the bonus drop script runs ownerless
			Stop
			
		Death.Fatality3:
			TNT1 A 0 A_Scream
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_GiveToTarget("LabGuyToken3", 1)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // without at least 8 tics delay, the bonus drop script runs ownerless
			Stop
		
			
		Death.HelperMarineFatallity:
			TNT1 A 0 A_Scream
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_GiveToTarget("LabGuyToken3", 1)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // without at least 8 tics delay, the bonus drop script runs ownerless
			Stop	
			
		HeadExploder:
			TNT1 A 0 A_Jump(72, "Death.HeadExplode")
			Goto Death.HeadMinor
			
		Death.Head:
			TNT1 A 0 A_JumpIfInTargetInventory("HasPlasmaWeapon", 1, "Death.Plasma")
			TNT1 A 0 A_JumpIfInTargetInventory("HasCutingWeapon", 1, "Death.Decaptate")
			TNT1 A 0 A_JumpIfHealthLower(-50, "Death.HeadExplode")
			TNT1 A 0 A_JumpIfInTargetInventory("RandomHeadExploder", 1, "HeadExploder")
		Death.MinorHead:
		Death.HeadMinor:
			TNT1 A 0
			TNT1 A 0 A_Playsound("MinorHeadshot", CHAN_AUTO)
			TNT1 A 0 A_Jump (128, "DeathMinorhead2")
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_Scream
			TNT1 A 0 A_Custommissile("BloodyAxe", 32, 0, random (0, 360), 2, random (50, 130))
			FSSH U 5 A_CustomMissile ("MuchBlood", 40, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			FSSH V 5
			TNT1 AA 0 A_CustomMissile ("SmallBrainPiece", random (45, 55), random (5, -5), random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 A 0 A_CustomMissile ("SmallBrainPiece", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("SuperWallRedBlood", 46, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			FSSH W 5 A_NoBlocking
			FSSH XY 5
			TNT1 A 0 A_PlaySound("BODYF",6)
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			TNT1 A 0 A_SpawnItemEx ("FacelessLabguy",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // without at least 8 tics delay, scripts runs ownerless
			Stop
			
		DeathMinorHead2:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			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))
			TNT1 A 0 A_Custommissile("BloodyAxe", 32, 0, random (0, 360), 2, random (50, 130))
			FSD5 A 6 A_CustomMissile ("MuchBlood", 40, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			FSD5 CB 8
			
			TNT1 A 0 A_Scream
			FSD5 D 6 A_NoBlocking
			
			TNT1 A 0 A_PlaySound("BODYF",6)
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			TNT1 A 0 A_SpawnItemEx ("DeadLabguySCZAL",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
			
		//***Che:
		Death.Psionic:
		
		Death.HeadExplode:
			TNT1 A 0
			TNT1 A 0 A_PlaySound("misc/xdeath4", 1)
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_PlaySound("gore/headshot", CHAN_VOICE)
			TNT1 A 0 A_CustomMissile ("MuchBlood2", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			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 ("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))
			
			ZMAD B 0 A_XScream
			ZMAD C 0 A_NoBlocking
			
			TNT1 A 0 A_Jump(32, "Deathchickenhead")
			TNT1 A 0 A_Custommissile("BloodyAxe", 32, 0, random (0, 360), 2, random (50, 130))
			FSAD ABBC 10 A_CustomMissile ("MuchBlood", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			FSAD DE 6
			TNT1 A 0 A_PlaySound("BODYF",6)
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			TNT1 A 0 A_SpawnItemEx ("DeadLabguyFSADE",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
			
		DeathChickenHead:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_PlaySound("misc/xdeath2c", CHAN_VOICE)
			FSAD FGH 4 A_SpawnItem ("Blood", 0, 56)
			
					TNT1 A 0 A_PlaySound("misc/xdeath2c", CHAN_VOICE)
			FSAD FGH 4 A_SpawnItem ("Blood", 0, 56)
			
					TNT1 A 0 A_PlaySound("misc/xdeath2c", CHAN_VOICE)
			FSAD FGH 4 A_SpawnItem ("Blood", 0, 56)
			
					TNT1 A 0 A_PlaySound("misc/xdeath2c", CHAN_VOICE)
			FSAD FGH 4 A_SpawnItem ("Blood", 0, 56)
			
					TNT1 A 0 A_PlaySound("misc/xdeath2c", CHAN_VOICE)
			FSAD FGH 4 A_SpawnItem ("Blood", 0, 56)
			
							TNT1 A 0 A_PlaySound("misc/xdeath2c", CHAN_VOICE)
			FSAD FGH 4 A_SpawnItem ("Blood", 0, 56)
			
							TNT1 A 0 A_PlaySound("misc/xdeath2c", CHAN_VOICE)
			FSAD FGH 4 A_SpawnItem ("Blood", 0, 56)
			
			
			TNT1 A 0 A_PlaySound("misc/xdeath2c", CHAN_VOICE)
			TNT1 A 0 A_Custommissile("BloodyAxe", 32, 0, random (0, 360), 2, random (50, 130))
			FSAD ABBC 10 A_CustomMissile ("MuchBlood", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			FSAD DE 6
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			TNT1 A 0 A_PlaySound("BODYF",6)
			TNT1 A 0 A_SpawnItemEx ("DeadLabguyFSADE",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop

		Death.decaptate:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_CustomMissile ("LabguyHead", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("MuchBlood2", 40, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_Custommissile("BloodyAxe", 32, 0, random (0, 360), 2, random (50, 130))
			FSAD A 15 A_CustomMissile ("MuchBlood", 40, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			FSAD B 9 A_XScream
			FSAD C 9 A_NoBlocking
			FSAD DE 5
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			TNT1 A 0 A_PlaySound("BODYF",6)
			TNT1 A 0 A_SpawnItemEx ("DeadLabguyFSADE",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop

		Death.fire:
		Death.Flames:
			TNT1 A 0 A_Scream
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_Custommissile("BloodyAxe", 32, 0, random (0, 360), 2, random (50, 130))
			//TNT1 A 3 A_SpawnItemEx("BurningZombie",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			//***Che: had to, otherwise he respawns as a zombieman
			TNT1 A 0 A_SpawnItemEx("BurningLabguy",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
		  
		Death.Desintegrate:
			TNT1 A 0 A_Jump(112, "AcidGuy")
			TNT1 A 0 A_Scream
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_SpawnItemEx("DesintegratedHuman",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 3 A_Custommissile("BloodyAxe", 32, 0, random (0, 360), 2, random (50, 130))
			
			TNT1 A -1 //***Che: Gibbed monsters -- ONLY the gibbed monsters -- may use this
				//   to auto-respawn on nightmare and be raised by viles.
				// Employing this on a destructible corpse results in that corpse
				//   respawning on nightmare as a corpse (or worse, as a burning hollering demon)
				// If a monster's death state spawns a destructible corpse,
				//   the respawning/raising is relegated to that corpse
				//   and the monster MUST use Stop instead
			Stop
		  
		 

		Death.Plasma: 
		Xeath.Electric:
		Death.Plasma2:
		Death.HeadPlasma:
			PBR1 A 6 A_Scream
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_Custommissile("BloodyAxe", 32, 0, random (0, 360), 2, random (50, 130))
			TNT1 AAAAAAAAAAAAAAAAAA 0 A_CustomMissile ("Ashes1", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 180))
			TNT1 AAAAAAAAAAAAAAAAAA 0 A_CustomMissile ("Ashes2", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 180))
			TNT1 AAAA 0 A_CustomMissile ("BluePlasmaFireNonStatic", 32, 0, random (0, 360), 2, random (0, 180))
			PBR1 B 6 A_NoBlocking
			PBR1 CDEFGH 6 A_CustomMissile ("Blood", 10, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			PBR1 HHHHHHHHHHHHHHHHHHHHHH 8 A_CustomMissile ("PlasmaSmoke", 10, 0, random (0, 360), 2, random (0, 160))
			PBR1 H -1 //***Che: Gibbed monsters -- ONLY the gibbed monsters -- may use this
				//   to auto-respawn on nightmare and be raised by viles.
				// Employing this on a destructible corpse results in that corpse
				//   respawning on nightmare as a corpse (or worse, as a burning hollering demon)
				// If a monster's death state spawns a destructible corpse,
				//   the respawning/raising is relegated to that corpse
				//   and the monster MUST use Stop instead
			Stop
		
		Death.SuperPlasma: // total destruction, no body left
			TNT1 A 0
			TNT1 A 0 A_XScream
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			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_Custommissile("BloodyAxe", 32, 0, random (0, 360), 2, random (50, 130))

			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))
			
			TNT1 A -1 //***Che: Gibbed monsters -- ONLY the gibbed monsters -- may use this
				//   to auto-respawn on nightmare and be raised by viles.
				// Employing this on a destructible corpse results in that corpse
				//   respawning on nightmare as a corpse (or worse, as a burning hollering demon)
				// If a monster's death state spawns a destructible corpse,
				//   the respawning/raising is relegated to that corpse
				//   and the monster MUST use Stop instead
			Stop
			
			
		Death.GreenFire: // total destruction, no body left
			TNT1 A 0
			TNT1 A 0 A_XScream
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			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_Custommissile("BloodyAxe", 32, 0, random (0, 360), 2, random (50, 130))
			
			EXPL AAAAAAAAAAAAAAAAAAAAAAAA 0 A_CustomMissile ("GreenFlameTrails", 50, 0, random (0, 360), 2, random (0, 360))
			XBRN AAAA 2 BRIGHT A_SpawnItem("GreenFlare",0,43)
			
			TNT1 A -1 //***Che: Gibbed monsters -- ONLY the gibbed monsters -- may use this
				//   to auto-respawn on nightmare and be raised by viles.
				// Employing this on a destructible corpse results in that corpse
				//   respawning on nightmare as a corpse (or worse, as a burning hollering demon)
				// If a monster's death state spawns a destructible corpse,
				//   the respawning/raising is relegated to that corpse
				//   and the monster MUST use Stop instead
			Stop

		Death.ExtremePunches:
		Death.DHFT:
			TNT1 A 0
			//TNT1 A 0 A_JumpIfInTargetInventory("HeavyStrikeRight", 1, "HeavyPunchRight")
			//TNT1 A 0 A_JumpIfInTargetInventory("HeavyStrikeLeft", 1, "HeavyPunchLeft") 
			//TNT1 A 0 A_JumpIfInTargetInventory("HeavyStrikeUpper", 1, "HeavyPunchUpper")
			TNT1 A 0 A_Scream
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_FaceTarget
			TNT1 A 0 A_CustomMissile ("ExtremePunchedZombieCivilian", 8, 0, random (175, 185), 2, random (10, 20))
			TNT1 A 0 A_Custommissile("BloodyAxe", 32, 0, random (0, 360), 2, random (50, 130))
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
			 
		Death.SSG:
		Death.Railgun:
			TNT1 A 0
			TNT1 A 0 A_JumpIfInventory("HitLeg", 3, "Death.LegMassacre") 
			TNT1 A 0 A_JumpIfInventory("HitLeg", 1, "Death.Leg") 
			FSD1 D 1 A_Pain
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			FSD1 D 1 A_FaceTarget
			//TNT1 A 0 A_CustomMissile ("MeatDeath", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			//TNT1 AAA 0 A_CustomMissile ("XDeath1", 32, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AA 0 A_CustomMissile ("XDeath1", 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 AAA 0 A_CustomMissile ("BloodMistBig", 40, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 90))
			TNT1 AA 0 A_CustomMissile ("XDeathArm1", 32, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 A 0 A_CustomMissile ("LabguyHead", 32, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 A 0 A_XScream
			TNT1 A 0 A_NoBlocking
			FSD1 DEEFFGH 6
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			TNT1 A 0 A_PlaySound("BODYF",6)
			TNT1 A 0 A_SpawnItemEx ("DeadLabguyFSD1H",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 0 A_Custommissile("BloodyAxe", 32, 0, random (0, 360), 2, random (50, 130))
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
			
			
		XDeath:
		Death.QuadBlast:
		Death.Bfg10k: //***Che changed damage type from extreme to custom
			TNT1 A 0 A_JumpIfInTargetInventory("SSGSelected", 1, "Death.SSG")
			TNT1 A 0 A_XScream
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_CustomMissile ("SargeXDeath", 2, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_Custommissile("BloodyAxe", 32, 0, random (0, 360), 2, random (50, 130))
			
			TNT1 A -1 //***Che: Gibbed monsters -- ONLY the gibbed monsters -- may use this
				//   to auto-respawn on nightmare and be raised by viles.
				// Employing this on a destructible corpse results in that corpse
				//   respawning on nightmare as a corpse (or worse, as a burning hollering demon)
				// If a monster's death state spawns a destructible corpse,
				//   the respawning/raising is relegated to that corpse
				//   and the monster MUST use Stop instead
			Stop
		
		Death.Stomp:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_Explode(200, 2, 1)
			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 A 0 bright A_CustomMissile ("XDeath2", 55, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 180))
			TNT1 AAA 0 A_CustomMissile ("XDeath2", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
				TNT1 AAAAAA 0 A_CustomMissile ("XDeath4", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 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 0 A_Custommissile("BloodyAxe", 32, 0, random (0, 360), 2, random (50, 130))
			TNT1 A 1
			TNT1 A 1 A_XScream
			TNT1 A 1 A_NoBlocking
			
			TNT1 A -1 //***Che: Gibbed monsters -- ONLY the gibbed monsters -- may use this
				//   to auto-respawn on nightmare and be raised by viles.
				// Employing this on a destructible corpse results in that corpse
				//   respawning on nightmare as a corpse (or worse, as a burning hollering demon)
				// If a monster's death state spawns a destructible corpse,
				//   the respawning/raising is relegated to that corpse
				//   and the monster MUST use Stop instead
			Stop
		
		Death.Shrapnel:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_JumpIfHealthLower(-50, 4)
			TNT1 A 0 A_SpawnItem("MuchBlood", 0, 32)
			TNT1 A 0 ThrustThingZ(0, 30, 0, 0)
			TNT1 A 0 A_Jump(128, "Death.Head")
			Goto Death
			TNT1 AA 0
			TNT1 A 0 A_Jump(256, "Death.ExplosiveImpact", "Death.Leg")
			Goto Death
		
		Death.ExplosiveImpact:
		Death.FriendlyExplosion:
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_ChangeFlag("NOBLOCKMONST", 1)
			TNT1 A 0 A_Jump(130,"Death.LandMine")
			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 ("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 AAAAAAAAAAA 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 AAAA 0 A_CustomMissile ("XDeath2", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
				TNT1 AAAAAAAAA 0 A_CustomMissile ("XDeath4", 32, 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 ("XDeathSargeLeg1", 32, 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))
			TNT1 A 0 ThrustThingZ(0,30,0,1)
			TNT1 A 0 A_Custommissile("BloodyAxe", 32, 0, random (0, 360), 2, random (50, 130))
			FS14 AB 5
			FS14 CDEF 5 A_CheckFloor ("Dead.ExplosiveImpact")
			FS14 FFFFFFFFFF 5 A_CheckFloor ("Dead.ExplosiveImpact")
			TNT1 A 0 A_PlaySound("BODYF",6)
			TNT1 A 0 A_SpawnItemEx ("DeadLabguyFS14G",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
			
		Death.LandMine:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 AA 0 A_CustomMissile ("SuperWallRedBlood", 46, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AAAAAAAAAAA 0 A_CustomMissile ("BrainBlood", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			//TNT1 A 0 A_CustomMissile ("Labguy_NoLeg", 32, 0, random (0, 360), 2, random (0, 160))
			TNT1 A 0 A_CustomMissile ("GibHand", 42, 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))
			TNT1 A 0 ThrustThingZ(0,50,0,1)
			FS14 A 1 A_Scream
			FS16 A 9
			FS16 BCD 9 A_CheckFloor("Dead.Landmine")
			FS16 DDDDD 9 A_CheckFloor("Dead.Landmine")
			TNT1 A 0 A_PlaySound("BODYF",6)
			TNT1 A 0 A_SpawnItemEx ("DeadLabguyFS14G",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 0 A_Custommissile("BloodyAxe", 32, 0, random (0, 360), 2, random (50, 130))
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
			
		Dead.ExplosiveImpact:
			TNT1 AAAA 0 A_SpawnItem ("Blood")
			TNT1 A 0 A_PlaySound("BODYF",6)
			TNT1 A 0 A_SpawnItemEx ("DeadLabguyFS14G",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 0 A_Custommissile("BloodyAxe", 32, 0, random (0, 360), 2, random (50, 130))
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
			
		Dead.Landmine:
			TNT1 AAAA 0 A_SpawnItem ("Blood")
			TNT1 A 0 A_PlaySound("BODYF",6)
			TNT1 A 0 A_SpawnItemEx ("DeadLabguyFS14G",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 0 A_Custommissile("BloodyAxe", 32, 0, random (0, 360), 2, random (50, 130))
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop

		Death.PussyGrab:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_Pain
			//TNT1 A 0 A_Chase("","") // can jump to Idle!
			TNT1 A 0 A_Pain
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_GiveToTarget("GrabbedAZombieCivilian", 1)
			TNT1 A 0 A_GiveToTarget("SoulAmmo", 1)
			TNT1 A 0 A_Custommissile("BloodyAxe", 32, 0, random (0, 360), 2, random (50, 130))
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop	
			
		LTGCheckExtreme: // extreme outfits, 25% chance to treat the player as naked on each attack.
			TNT1 A 0 A_JumpIfInTargetInventory("LTGExtreme", 1, 1)
			Goto MeleeContinueAfterLTGCheck
			TNT1 A 0 A_Jump(64, "LTGCheckB")
			Goto MeleeContinueAfterLTGCheck
		LTGCheck:
			TNT1 A 0 A_JumpIfInTargetInventory("IsDressed", 1, "LTGCheckExtreme")
		LTGCheckB:
			TNT1 A 0 A_JumpIfInventory("AlreadyPerformedLTGCatCall", 1, "LTGCheck2")
			
			TNT1 A 0 A_GiveInventory("AlreadyPerformedLTGCatCall", 1)
			TNT1 A 0 A_PlaySound("grunt/catcall", CHAN_VOICE)

			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 7, 4, 39)
			SCZA AAAAAAAA 15 A_FaceTarget // idle animation
			Goto See

		LTGCheck2:
			TNT1 A 0 A_PlaySound("grunt/catcall", CHAN_VOICE)
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 7, 4, 39)
			SCZA AAAAA 15 A_FaceTarget
			TNT1 A 0 A_JumpIfTargetInLOS("MeleeContinueAfterLTGCheck")
			Goto See

		Death.Ice: //***Che: this death was missing
		Death.Freeze:
		Death.Frost:
		Death.IOS_Frost: // no permafrost for him
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_SpawnItemEx("FrozenLabGuy",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 0 A_GiveToTarget("SoulAmmo", 1)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
	}
}

ACTOR LabguyRaisedByVile: FBD_Labguy {
	States {
		Spawn: 
			TNT1 A 0 NODELAY ACS_NamedExecuteWithResult("FBD_RunMonster", 5)
			
			TNT1 A 0 A_ChangeFlag("NOPAIN", 1)
			TNT1 A 0 A_GiveInventory("TargetIsAFormerHuman", 1) //used by AOE DOT inflictors to reward players with soul ammo -- otherwise untraceable
			//POSS KJIH 5
			TNT1 A 0 A_SetScale(0.7, 0.7) // ID50 sprites
			ID50 GFEDCB 3 // desintegrated human, gore flowing up into a human shape
			TNT1 A 0 A_SetScale(1.0, 1.0)
			FSMS H 8
			TNT1 A 0 A_ChangeFlag("NOPAIN", 0)
			TNT1 A 0 ACS_NamedExecuteWithResult("FBD_CustomizeOnRez") // it runs OnRezMapScript
				// if the map prpvides one
			Goto See		

	}
}

ACTOR ZombieAxeAttack
{
	Radius 10
	Height 18
	Projectile 
	+RANDOMIZE
	DamageType Rip
    Damage 4
	+FORCEXYBILLBOARD
    +THRUGHOST
    +BLOODSPLATTER 
	RenderStyle Add
	Alpha 0.6
	HitObituary "$OB_IMPHIT"
    Obituary "$OB_IMPHIT"
	+DONTHURTSPECIES

	SeeSound "None"
	DeathSound "none"
	Decal "none"
    Speed 20
	States
	{
		Spawn:
			TNT1 A 4 BRIGHT
			Stop
			
		Death: // hit a wall
		Crash: // hit a non-bleeding actor
			TNT1 A 0
			Stop
		XDeath: // hit a bleeding actor
			TNT1 A 0
			TNT1 A 0 A_PlaySound("AxeHit")
			TNT1 A 0 BRIGHT
			Stop
	}
}





/////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////







Actor DeadFormerScientist : FBD_DeadShotgunGuy1
{
	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", 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	
		
		//***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
			FSMS L 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
			FSMS L 30
			TNT1 A 0 A_JumpIf(user_floor_is_lava, "LandOnLava")		
			FSMS L -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop
    }
}


Actor AbstractDyingLabguyWithHeadbox: DeadFormerScientist {

	//***Che: switching to being a monster (required by headboxes),
	//	paying for that with inability to inherit progenitor's sfest status.
	//  have to run a sfest detection script

	
	//+ISMONSTER
	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;
	
	DamageFactor "Head", 10.0 
	DamageFactor "HeadStun", 10.0 
	DamageFactor "HeadPlasma", 10.0

	// prevent explosive impact throwing his corpse up (has no required states)
	+NOPAIN
	
	// otherwise the headbox auto-terminates immediately
	// upd: switched to specialized headbox
	//+SOLID
	-CORPSE
	
	States {
		LandOnLava:
			TNT1 A 0
			TNT1 A 0 A_StopSound(CHAN_VOICE)
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_SpawnItemEx("CharredMeatsplosionIntoGoryAshes",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			
			//***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:
		Crush:
		Death.Bfg10k:
			TNT1 A 0
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_StopSound(CHAN_VOICE)
			TNT1 A 0 A_SpawnItem("GibsZ")
			TNT1 A 0 A_CustomMissile ("XDeath1", 5, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeath2", 5, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("XDeath2", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAAA 0 A_CustomMissile ("XDeath4", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeath3", 5, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeath4", 5, 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 DyingFormerScientistNoArm: AbstractDyingLabguyWithHeadbox //DeadFormerScientist
{
    Radius 16 //12
    Height 32
    Health 50
    damagefactor "Head", 10.0
	States
    {
		Spawn:
			TNT1 A 0 NODELAY ACS_NamedExecuteWithResult("FBD_RunMonster", 12) // dying guy headbox
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 3, 32, 1)
		
			TNT1 A 0 A_PlaySound("BURNZOM", CHAN_VOICE)
			//TNT1 A 0 A_SpawnItem ("HeadshotTarget4", 5, 32,0)
			FSD2 BEBEBEBEBEBE 10 //SpawnItem ("HeadshotTarget10", 5, 32,0)
			FSD2 C 6 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_ChangeFlag("SHOOTABLE", 0)
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 ACS_NamedExecuteAlways("FBD_CheckFloorIsLava_V", 0, 0, 0, 0) // also spawns smoke for 30 tics if succeeds
			FSD3 D 30
			TNT1 A 0 A_JumpIf(user_floor_is_lava, "LandOnLava")
			
			//***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)
			FSD3 D -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop
		Death:
			FSD2 C 6 A_ChangeFlag("SHOOTABLE", 0)
			TNT1 A 0 A_PlaySound("grunt/death", CHAN_VOICE)
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
		
			//***Che
			TNT1 A 0 ACS_NamedExecuteAlways("FBD_CheckFloorIsLava_V", 0, 0, 0, 0) // also spawns smoke for 30 tics if succeeds
			FSD3 D 30
			TNT1 A 0 A_JumpIf(user_floor_is_lava, "LandOnLava")

			//***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)			
			FSD3 D -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop
	
		Death.Head:
		Death.MinorHead:
		Death.HeadStun:
		Death:HeadPlasma:
		Death.Decaptate:
		Death.CCFT:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			//TNT1 A 0 A_SpawnItemEx("HealthPlusFatalityBonus", 0,0,0, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION) //A_SpawnItem ("CrueltyBonus5Health")
			TNT1 A 0 ACS_NamedExecuteAlways("DropFatalityBonuses", 0, 5, 0, 0) // 0, health, armor, 0 -- rounded down to nearest 2
			TNT1 A 0 A_CustomMissile ("MuchBlood2", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("Brains1", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("Brains2", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("Brains3", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("Brains4", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("Brains5", 30, 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))
			FSD2 B 2
			TNT1 A 0 A_PlaySound("misc/gibbed", CHAN_VOICE)
			FSD3 G 7
			TNT1 A 0 A_ChangeFlag("SHOOTABLE", 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)
			FSD3 H -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop
		
			Stop
    }
}


Actor DyingFormerScientistNoLeg: AbstractDyingLabguyWithHeadbox //DeadFormerScientist
{
    Radius 12
    Height 32
    Health 50
    damagefactor "Head", 10.0
	States
	{
		Spawn:
			TNT1 A 0 NODELAY ACS_NamedExecuteWithResult("FBD_RunMonster", 12) // dying guy headbox
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 0, 24, 1)
			
			TNT1 A 0 A_PlaySound("BURNZOM", CHAN_VOICE)
			//TNT1 A 0 A_SpawnItem ("HeadshotTarget4", 5, 32,0)
			FSS7 ABC 5
			FSS7 DEDEDEDEDEDE 10 //A_SpawnItem ("HeadshotTarget10", 5, 32,0)
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			FSS7 GH 5
			TNT1 A 0 A_ChangeFlag("SHOOTABLE", 0)
			TNT1 A 0 A_NoBlocking
			
			//***Che
			TNT1 A 0 ACS_NamedExecuteAlways("FBD_CheckFloorIsLava_V", 0, 0, 0, 0) // also spawns smoke for 30 tics if succeeds
			FSS7 F 30
			TNT1 A 0 A_JumpIf(user_floor_is_lava, "LandOnLava")			
			
			//***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)
			FSS7 F -1
			Stop
		Death:
			TNT1 A 0 A_PlaySound("grunt/death", CHAN_VOICE)
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			FSS7 GH 5
			TNT1 A 0 A_ChangeFlag("SHOOTABLE", 0)
			TNT1 A 0 A_NoBlocking
			
			//***Che
			TNT1 A 0 ACS_NamedExecuteAlways("FBD_CheckFloorIsLava_V", 0, 0, 0, 0) // also spawns smoke for 30 tics if succeeds
			FSS7 F 30
			TNT1 A 0 A_JumpIf(user_floor_is_lava, "LandOnLava")
		
			//***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)
			FSS7 F -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop
		
		Death.Head:
		Death.MinorHead:
		Death.HeadStun:
		Death.HeadPlasma:
		Death.Decaptate:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			//TNT1 A 0 A_SpawnItemEx("HealthPlusFatalityBonus", 0,0,0, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION) //A_SpawnItem ("CrueltyBonus5Health")
			TNT1 A 0 ACS_NamedExecuteAlways("DropFatalityBonuses", 0, 5, 0, 0) // 0, health, armor, 0 -- rounded down to nearest 2
			TNT1 A 0 A_CustomMissile ("MuchBlood2", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("Brains1", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("Brains2", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("Brains3", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("Brains4", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("Brains5", 30, 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 A 0 A_PlaySound("misc/gibbed", CHAN_VOICE)
			FSS7 IJ 5
			TNT1 A 0 A_ChangeFlag("SHOOTABLE", 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)
			FSS7 F -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop
    }
}


ACTOR BrutalizedFormerScientist1 : DeadFormerScientist
{
	Game Doom
	Radius 16
	Height 50
	Health 70
	bloodtype "DeadBlood"
		PainSound "grunt/pain"
		PainChance 255
		Mass 999999
	-SOLID
	+SHOOTABLE
	+NORADIUSDMG
	+FLOORCLIP
	Scale 1.0
	States
	{
		Death.Fatality:
		Death.SuperPunch:
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_GiveToTarget("HasZManShield", 1)
			TNT1 A 0 A_GiveToTarget("GotMeatShield", 1)
			Stop
				
		Spawn:
			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:
			FSD1 A 15
			Goto DieNow
		
		DieNow:
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_SpawnItemEx ("BrutalizedFormerScientistStop",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 ("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 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(2)
			TNT1 A 0
			TNT1 A 0 A_SpawnItemEx ("BrutalizedFormerScientist2",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
	}
}

actor BrutalizedFormerScientistStop: DeadFormerScientist
{
    States
    {
		//***Che // this is a descendant of FBD_CurbstompedMarine, which is neither a missile nor a monster
		Spawn:
			TNT1 A 0 
			FSD2 ABCD 5 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
			FSD3 D 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
			FSD3 D 30
			TNT1 A 0 A_JumpIf(user_floor_is_lava, "LandOnLava")	
			
			//***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)
			FSD3 D -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop
	}
}

ACTOR BrutalizedFormerScientist2: BrutalizedFormerScientist1
{
	States
	{
		Spawn:
		Pain:
			FSD1 B 15
			Goto DieNow
		
		DieNow:
			TNT1 A 0
			TNT1 A 0 A_SpawnItemEx ("BrutalizedFormerScientistStop2",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,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 A 0 A_NoBlocking
			TNT1 A 0 A_SpawnItemEx ("BrutalizedFormerScientist3",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
	}
}

actor BrutalizedFormerScientistStop2: DeadFormerScientist
{
    States
    {
		//***Che // this is a descendant of FBD_CurbstompedMarine, which is neither a missile nor a monster
		Spawn:
			TNT1 A 0
			FSD4 AB 6 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
			FSD4 B 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
			FSD4 B 30
			TNT1 A 0 A_JumpIf(user_floor_is_lava, "LandOnLava")
			
			//***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)
			FSD4 B -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop
	}
}

ACTOR BrutalizedFormerScientist3: BrutalizedFormerScientist1
{
	States
	{
		Spawn:
		Pain:
			FSD1 C 15
			Goto DieNow
		
		DieNow:
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_SpawnItemEx ("BrutalizedFormerScientistStop3",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 AAA 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 A 0 A_CustomMissile ("XDeath3", 40, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeath2", 40, 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) //A_SpawnItem ("CrueltyBonus5Health")
			TNT1 A 0 ACS_NamedExecuteAlways("DropFatalityBonuses", 0, 5, 0, 0) // 0, health, armor, 0 -- rounded down to nearest 2
			FSD1 EFGH 6
			TNT1 A 0 A_SpawnItemEx ("DeadLabguyFSD1H",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
	}
}


actor BrutalizedFormerScientistStop3: DeadFormerScientist
{
    States
    {
		//***Che // this is a descendant of FBD_CurbstompedMarine, which is neither a missile nor a monster
		Spawn:
			TNT1 A 0 
			FSD3 ABC 6 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
			FSD3 C 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
			FSD3 C 30
			TNT1 A 0 A_JumpIf(user_floor_is_lava, "LandOnLava")	
			//***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)
			FSD3 C -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop
	}
}


actor LabguyBeatenDown: DeadFormerScientist
{
    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
			FSF1 L 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
			FSF1 L 30
			TNT1 A 0 A_JumpIf(user_floor_is_lava, "LandOnLava")	
			//***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)
			FSF1 L -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop
	}
}	
	
ACTOR BrutalizedFormerScientistLeg: BrutalizedFormerScientist1
{
	States
	{
		Spawn:
		Pain:
			FSS7 A 15
			Goto DieNow
			
		DieNow:
			FSS7 BCD 5
		
			//***Che
			FSS7 F 30
			TNT1 A 0 ACS_NamedExecuteAlways("BDCheckFloorType", 0, 0, 0, 0)
			FSS7 F 3
			TNT1 A 0 A_JumpIfInventory("IsOverLava", 1, "LandOnLava")			
			//***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)
			FSS7 F -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)	
			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 ("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 AAAAAAAA 0 A_CustomMissile ("BrainBlood", 50, 0, random (0, 360), 2, 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 ("VeryFuckedUpBrutalizedFormerScientistLeg",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
	}
}

//FS14 G -1
actor DeadLabguyFS14G: DeadFormerScientist
{
    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
			FS14 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
			FS14 G 30
			TNT1 A 0 A_JumpIf(user_floor_is_lava, "LandOnLava")	
			//***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)
			FS14 G -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop    
	}
}

actor DeadLabguyFSADE: DeadFormerScientist
{
    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
			FSAD E 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
			FSAD E 30
			TNT1 A 0 A_JumpIf(user_floor_is_lava, "LandOnLava")

			//***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)
			FSAD E -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop
	}
}
		
actor DeadLabguySCZAL: DeadFormerScientist
{
    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
			SCZA L 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
			SCZA L 30
			TNT1 A 0 A_JumpIf(user_floor_is_lava, "LandOnLava")

			//***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)
			SCZA L -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop
	}
}

actor DeadLabguyFSD1H: DeadFormerScientist
{
    States
    {
		Spawn:
		//***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
			FSD1 H 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
			FSD1 H 30
			TNT1 A 0 A_JumpIf(user_floor_is_lava, "LandOnLava")

			//***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)
			FSD1 H -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop    
	}
}


actor DeadLabguySCZ4E: DeadFormerScientist
{
    States
    {
		Spawn:
		//***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 
			SCZ4 E 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
			SCZ4 E 30
			TNT1 A 0 A_JumpIf(user_floor_is_lava, "LandOnLava")

			//***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)
			SCZ4 E -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop    
	}
}

actor DeadLabguyFSMSP: DeadFormerScientist
{
    States
    {
		Spawn:
		//***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
			FSMS P 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
			FSMS P 30
			TNT1 A 0 A_JumpIf(user_floor_is_lava, "LandOnLava")
			//***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)
			FSMS P -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop    
	}
}	


ACTOR VeryFuckedUpBrutalizedFormerScientistLeg: DeadFormerScientist
{
	Health 200 
	DamageFactor "ExplosiveImpact", 10.0
	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
			ID13 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
			ID13 G 30
			TNT1 A 0 A_JumpIf(user_floor_is_lava, "LandOnLava")	
			//***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)
			ID13 G -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop
		Death.ExplosiveImpact:	
			TNT1 A 0 ThrustThingZ(0,30,0,1)
			ID13 ABCDEF 5
			TNT1 A 0 A_SpawnItem ("VeryFuckedUpBrutalizedFormerScientistLeg")
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
			Stop
	}
}
		  
ACTOR VeryFuckedUpBrutalizedFormerScientistLeg2: VeryFuckedUpBrutalizedFormerScientistLeg
{
	Health 200 
	States{
		Spawn:
		//***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
			ID15 E 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
			ID15 E 30
			TNT1 A 0 A_JumpIf(user_floor_is_lava, "LandOnLava")	
			//***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)
			ID15 E -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop
	}
}
		
ACTOR AxeSplitLabGuy: DeadFormerScientist
{
  States
    {
		//***Che // this is a descendant of FBD_CurbstompedMarine, which is neither a missile nor a monster
		Spawn:
			F1CR A 6 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
			F1CR A 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
			F1CR A 30
			TNT1 A 0 A_JumpIf(user_floor_is_lava, "LandOnLava")			
			//***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)
			F1CR A -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop    
	}
}
	   
	   
Actor FacelessLabguy: DeadFormerScientist
{
  States
    {
		//***Che // this is a descendant of FBD_CurbstompedMarine, which is neither a missile nor a monster
		Spawn:
			FSSH Z 6 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
			FSSH Z 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
			FSSH Z 30
			TNT1 A 0 A_JumpIf(user_floor_is_lava, "LandOnLava")			
			//***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)
			FSSH Z -1
			Stop    
	}
}

Actor LabGuyHead
{
	bouncefactor 0.25
	speed 7
	seesound None//""
	+DOOMBOUNCE
	+MISSILE
	+MOVEWITHSECTOR
	+CLIENTSIDEONLY
	+NOBLOCKMAP
	+NOTELEPORT
	+THRUACTORS

	states
	{
		Spawn:
			TNT1 A 0
			FSHD BC 4
			loop
		Death:
			FSDH A 1
			FSHD A-1
			stop
	}
}
	
Actor BloodyAxe
{
	bouncefactor 0.1
	speed 5
	seesound None //""
	+DOOMBOUNCE
	+MISSILE
    +MOVEWITHSECTOR
    +NOBLOCKMAP
    +NOTELEPORT
	+THRUACTORS
	-SOLID
	states
	{
		Spawn:
			AXE1 A 6
			loop
		Death:
			AXE1 A 1
			TNT1 A 0 A_SpawnItem("BrutalAxe")
			stop
	}
}
	
ACTOR RipLabguy
{
    Radius 1
    Height 1
    Scale 0.8
	Speed 0
	Mass 1
	Decal BloodSuper
	BounceFactor 0.5
	+DOOMBOUNCE
	+MISSILE
    +NOBLOCKMAP
    +NOTELEPORT
    +MOVEWITHSECTOR
    +NOGRAVITY
    +NOCLIP
    +DONTSPLASH
    States
    {
		Spawn:
			TNT1 AAA 0 A_CustomMissile ("FBD_FlyingBlood", 40, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathHalfLabguy", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAA 0 A_CustomMissile ("Guts2", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
		Death:
			TNT1 A 0
			Stop
    }
}

ACTOR XDeathHalfLabguy
{
    Radius 8
    Height 8
    Scale 1.0
	Speed 6
	Mass 4
	Decal BrutalBloodSplat
	BounceFactor 0.4
	+DOOMBOUNCE
	+MISSILE
    +MOVEWITHSECTOR
    +CLIENTSIDEONLY
    +NOBLOCKMAP
    +NOTELEPORT
    States
    {
		Spawn:
			TNT1 A 0 A_SpawnItem("brutal_BloodSpot",0,0,0,1)
			SCZ4 F 12
			Loop
		Death:
			TNT1 A 0 A_SpawnItem("brutal_BloodSpot",0,0,0,1)
			SCZ4 F 1 A_SpawnItem("Gib_HalfLabGuy",0,0,0,1)
			TNT1 A 0
			Stop
    }
}

actor Gib_HalfLabGuy: BigGibBase
{
    States
    {
		Spawn:
		
			//***Che
			SCZ4 F 30 A_SpawnItem("Brutal_BloodSpot",0,0,0,1)
			TNT1 A 0 ACS_NamedExecuteAlways("BDCheckFloorType", 0, 0, 0, 0)
			SCZ4 F 3
			TNT1 A 0 A_JumpIfInventory("IsOverLava", 1, "LandOnLava")		
		
			SCZ4 F 1900 A_SpawnItem("Brutal_BloodSpot",0,0,0,1)
			Loop   
		LandOnLava: 
			TNT1 A 0
			TNT1 A 0 A_SpawnItem("CharredMeatsplosionIntoGoryAshes")
			TNT1 A 0
			Stop		   

	}
}

/* //***Che: this was never used	
Actor DeadLabguy_Half
{
	Mass 300 
	Health 200 
	States{
		Spawn:
		
			//***Che
			FSD1 H 30
			TNT1 A 0 ACS_NamedExecuteAlways("BDCheckFloorType", 0, 0, 0, 0)
			FSD1 H 3
			TNT1 A 0 A_JumpIfInventory("IsOverLava", 1, "LandOnLava")
			
			FSD1 H -1
			Stop
		LandOnLava: 
			TNT1 A 0
			TNT1 A 0 A_SpawnItem("CharredMeatsplosionIntoGoryAshes")
			TNT1 A 0
			Stop				
        Death:
			TNT1 A 0 A_SpawnItem("GibsZ")

			TNT1 AAA 0 A_CustomMissile ("XDeath1", 5, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("XDeath1", 5, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeath3", 5, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAA 0 A_CustomMissile ("XDeath4", 5, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			Stop
        Death.Cut:
        Death.Cutless:
        Goto Death}}
*/		
		
Actor Labguy_NoLeg: DeadShotgunGuy_NoLeg
{
	Alpha 1.0
	Mass 300 
	Health 200 
	States{
		Spawn:
			//***Che
			FSS7 F 30
			TNT1 A 0 ACS_NamedExecuteAlways("BDCheckFloorType", 0, 0, 0, 0)
			FSS7 F 3
			TNT1 A 0 A_JumpIfInventory("IsOverLava", 1, "LandOnLava")	
			
			//***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)
			FSS7 F -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:
			TNT1 A 0 A_SpawnItem("GibsZ")

			TNT1 AAA 0 A_CustomMissile ("XDeath1", 5, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("XDeath1", 5, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeath3", 5, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAA 0 A_CustomMissile ("XDeath4", 5, 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.Cut:
        Death.Cutless:
			Goto Death
	}
}
