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






Actor VolcabusBossCubeSpawner: MancubusBossCubeSpawner
{
	Height 62	
	States
	{
		DoSummon:	
			TNT1 A 0 A_GiveInventory("SummonsCount", 1, AAPTR_TRACER)
			TNT1 A 0 A_SpawnItemEx("ThiccTeleportFog")
			TNT1 A 1 A_SpawnItemEx("FBD_Volcabus",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0,user_stid)
			Stop
	}
}

Actor FBD_Volcabus : FBD_Mancubus 17611 //  2543
{
	
	//***Che radius, height and maxdropoffheight (n/a for flying ones) MUST be kept consistent with FBD_TrySpawn in FBD_CORE.acs!
	
	// see ACTOR BD_Volcabus: FBD_Volcabus 2543 {} in Doom_Replacements.txt
	
	//$category "FBD Monsters"
	Health 2500
	Scale 1.5
	Mass 1000
	SeeSound "Volcabus/sight"
	PainSound "Volcabus/pain"
	DeathSound "Volcabus/death"
	ActiveSound "fatso/active"
	Height 62
	Tag "$VOLCABUS"
	Obituary "$VOLCABUS_O" //"%o squashed by a Volcabus."
	
	PainChance "Bullet792", 40 // machineguns and snip[er rifles not aimed
	PainChance "SniperBullet", 100 // sniper rifle aimed	
	
	damagefactor "Killme", 1.0 // AOE inflicted by captured marines
	PainChance "Killme", 255	
	
	PainChance "Ice", 40
	
	States
	{
		Pain.Ice:
			"----" A 20 A_Pain
			Goto See
			
		WaitTargetsFatalityOut:
			TNT1 A 0 A_PlaySound("Volcabus/sight", CHAN_VOICE)
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 6, 0, 74)
			FAT2 B Random(24,48)
			Goto See
		Spawn:
			FAT2 B 0 NODELAY ACS_NamedExecuteWithResult("FBD_RunMonster", 8) // volcabus headbox
			FAT2 B 2 
			FAT2 B 5 A_Look
		
		Stand:
			TNT1 A 0
			TNT1 A 0 A_JumpIf(user_serverside_sfchk >= 4, 2) // extreme slaughtermap optimization
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 6, 0, 74)
			TNT1 A 0 A_CheckSight("Stand2")	
			FAT2 B 15 A_Look
			Loop
			
		Raise:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII") // should not have a headbox by now -- but what if?
			TNT1 A 0 A_SetUserVar("user_head_type", 8) // volcabus headbox
			TNT1 A 0 A_SpawnItemEx("StandaloneRezSfx",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			FAT2 RQPONMLK 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", 2020) // see _mob_list.xlsx
			Stop			
			
		Stand2:
			FAT2 B 15 A_Look
			Goto Stand
		  
		Pain.Killme:
			TNT1 A 0 HealThing(1)
			Goto Missile
		Pain.Taunt:
			TNT1 A 0
			SPOS B 0 A_Pain
			TNT1 A 0 HealThing(1)
			TNT1 A 0 A_ChangeFlag("FASTER", 1)
			TNT1 A 0 A_ChangeFlag("NOPAIN", 1)
			TNT1 A 0 A_ChangeFlag("MISSILEMORE", 1)
			TNT1 A 0 A_ChangeFlag("MISSILEEVENMORE", 1)
			TNT1 A 0 A_PlaySound("Volcabus/attack", CHAN_VOICE)

			TNT1 A 0 A_JumpIfInventory("Enraged", 1, "Missile")

			F4T2 TUV 4 A_FaceTarget
			F4T2 WVUT 6
			TNT1 A 0 A_GiveInventory("Enraged", 1)
			Goto See	  
		 
		Idle:
		LookingForPlayer:
			TNT1 A 0 A_GiveInventory("SKImp", 1)
			
			TNT1 A 0 A_GiveInventory("LookingForPlayer", 1) // up to 30
			
			TNT1 A 0 A_SetUserVar("user_sleeping", 1)
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 6, 0, 74)
			
			FAT2 BBB 10 A_Look
			TNT1 A 0 A_SetAngle(angle - 40)
			
			FAT2 BBB 10 A_Look
			TNT1 A 0 A_SetAngle(angle + 40)
			
			FAT2 BBB 10 A_Look
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 12, 0, 69)
			FAT2 A 2 A_Wander
			FAT2 AA 2 A_Look
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 6, 0, 74)
			FAT2 B 2 A_Wander
			FAT2 BB 2 A_Look
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 12, -6, 74)
			FAT2 C 2 A_Wander
			FAT2 CC 2 A_Look
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 12, 0, 69)
			FAT2 D 2 A_Wander
			FAT2 DD 2 A_Look
			
			TNT1 A 0 A_jump(128, "LookingForPlayer")
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 6, 0, 74)
			FAT2 E 10 A_Look
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 12, 6, 74)
			FAT2 F 10 A_Look
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 12, 0, 69)
			FAT2 A 2 A_Wander
			FAT2 AA 2 A_Look
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 6, 0, 74)
			FAT2 B 2 A_Wander
			FAT2 BB 2 A_Look
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 12, -6, 74)
			FAT2 C 2 A_Wander
			FAT2 CC 2 A_Look
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 12, 0, 69)
			FAT2 D 2 A_Wander
			FAT2 DD 2 A_Look
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 6, 0, 74)
			FAT2 E 2 A_Wander
			FAT2 EE 2 A_Look
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 12, 6, 74)
			FAT2 F 2 A_Wander
			FAT2 FF 2 A_Look
			
			Goto LookingForPlayer
			
			
			
		ForgetTarget:
			TNT1 A 0 A_ClearTarget
			TNT1 A 0 A_TakeInventory("EnemyMemory", 25)
			TNT1 A 0 A_GiveInventory("LookingForPlayer", 1)
			Goto LookingForPlayer
			
		See:
			
			// slaughtermap manage
			TNT1 A 0 A_JumpIf(!user_sleeping, 3) // forgo the expensive sight check if already awake
			TNT1 A 0 A_CheckSight(2)
			TNT1 A 0 A_SetUserVar("user_sleeping", 0)
			TNT1 A 0 A_JumpIf(user_serverside_sfchk != -1, 3) // -1 means ACS commands us to do the radiusgive
			// A_RadiusGive is:
			//  1. serverside-only: the call is skipped on the client; only if a player is involved, a network command to update his item count is sent, otherwise the item count only increases on the server
			//  2. iterates over all actors in an infinitely tall square column checking their flags and coordinates
			//  3. performs expensive precision radius calculation (using a square root) unless RGF_CUBE is given (which results in cheaper delta per-coordinate comparison)
			//  4. performs expensive sight check, for each thing that passes flag and radius checks, unless RGF_NOSIGHT is given
			TNT1 A 0 A_RadiusGive("SfestCounterServerside", 500, RGF_MONSTERS | RGF_CUBE | RGF_NOSIGHT, 2) // count us as two	
			TNT1 A 0 A_SetUserVar("user_serverside_sfchk", 1) // reply that we did the deed
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 12, 0, 69)
			FAT2 AA 4 A_Chase
			TNT1 A 0 A_PlaySound("knight/step",5)
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 6, 0, 74)
			FAT2 BB 4 A_Chase
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 12, -6, 74)
			FAT2 CC 4 A_Chase
			TNT1 A 0 A_JumpIfCloser(200, "StompAttack")
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 12, 0, 69)
			FAT2 DD 4 A_Chase
			TNT1 A 0 A_PlaySound("knight/step",CHAN_AUTO) // 8) //***Che: there is no such channel, max is 7 
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 6, 0, 74)
			FAT2 EE 4 A_Chase
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 12, 6, 74)
			FAT2 FF 4 A_Chase
			TNT1 A 0 A_JumpIfCloser(200, "StompAttack")
			
			TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), "ForgetFaster")
			TNT1 A 0 A_CheckSight("CheckIdle")
			TNT1 A 0 A_TakeInventory("EnemyMemory", 5)
			Loop
			
		CheckIdle:	
			TNT1 A 0
			TNT1 A 0 A_GiveInventory("EnemyMemory", 1)
			TNT1 A 0 A_JumpIfInventory("EnemyMemory", 25, "LookingForPlayer")
			Goto See
		ForgetFaster:
			TNT1 A 0
			TNT1 A 0 A_GiveInventory("EnemyMemory", 5)
			TNT1 A 0 A_JumpIfInventory("EnemyMemory", 25, "LookingForPlayer")
			Goto See			
			Loop
     
		Missile:
			TNT1 A 0
			
			// slaughtermap manage - warming the headbox up
			TNT1 A 0 A_JumpIf(!user_sleeping, 4) // forgo the expensive sight check if already awake
			TNT1 A 0 A_JumpIfInTargetInventory("IsPlayer", 1, 2) // bypass the sight check 
			TNT1 A 0 A_CheckSight(2) // out of sight of any player, AND attacking another monster, keep slumbering
			TNT1 A 0 A_SetUserVar("user_sleeping", 0)	

			TNT1 A 0 A_JumpIfCloser(200, "StompAttack")
			
			// Kinslayer check:	
			TNT1 A 0 A_JumpIf(!CheckClass("Volcabus", AAPTR_TARGET, true), 2)
			TNT1 A 0 ACS_NamedExecuteWithResult("FBD_InfightFriendlyFireOn")
			TNT1 A 0
			
		MissileContinueCannotStomp:	
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 21, 0, 66)
			
			TNT1 A 0 A_FaceTarget //***Che: adjust aim early, to miss better at the invisible and fire past their cover at the hidey cowards
			
			TNT1 A 0 A_JumpIfInventory("Enraged", 1, "Missile2")
			
			FAT2 G 10 A_PlaySound("Volcabus/attack", CHAN_VOICE)
			
			TNT1 A 0 A_Jump(100, "Missile2")
			
//			TNT1 A 0 A_JumpIfInventory("IAmSfestMonster", 1, "MissileSfest")


				//***Che: do NOT adjust aim if target goes out of sight or is invisible
				TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), 4)
				TNT1 A 0 A_JumpIfTargetInLOS(2)
				TNT1 A 0 A_Jump(256, 2)
				TNT1 A 0 A_FaceTarget
			
			
			FAT2 G 8 //A_FaceTarget
			TNT1 A 0 A_Playsound("Volcabus/cannon")
				TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), 2)
				TNT1 A 0 A_JumpIfTargetInLOS(4)
				// the version with auto-aim disabled (invisible or no LOS):
				TNT1 A 0 A_CustomMissile("VolcabusBall",30,-25,10 + angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
				TNT1 A 0 A_CustomMissile("VolcabusBall",30,25,angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
				TNT1 A 0 A_Jump(256, 3)
				// the auto-aimed version:
				TNT1 A 0 A_CustomMissile("VolcabusBall",30,-25,10,0)
				TNT1 A 0 A_CustomMissile("VolcabusBall",30,25,0,0)				
			FAT2 H 8 BRIGHT

				//***Che: do NOT adjust aim if target goes out of sight or is invisible
				TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), 4)
				TNT1 A 0 A_JumpIfTargetInLOS(2)
				TNT1 A 0 A_Jump(256, 2)
				TNT1 A 0 A_FaceTarget
			
			
			FAT2 I 4 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 43, -5, 61)
			
				//***Che: do NOT adjust aim if target goes out of sight or is invisible
				TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), 4)
				TNT1 A 0 A_JumpIfTargetInLOS(2)
				TNT1 A 0 A_Jump(256, 2)
				TNT1 A 0 A_FaceTarget			
			
			FAT2 G 4 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 21, 0, 66) //A_FaceTarget
			
			TNT1 A 0 A_Playsound("Volcabus/cannon")
			
				TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), 2)
				TNT1 A 0 A_JumpIfTargetInLOS(4)
				// the version with auto-aim disabled (invisible or no LOS):
				TNT1 A 0 A_CustomMissile("VolcabusBall",30,-25,angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
				TNT1 A 0 A_CustomMissile("VolcabusBall",30,25,-10 + angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
				TNT1 A 0 A_Jump(256, 3)
				// the auto-aimed version:
				TNT1 A 0 A_CustomMissile("VolcabusBall",30,-25,0,0)
				TNT1 A 0 A_CustomMissile("VolcabusBall",30,25,-10,0)			
			
			FAT2 H 8 BRIGHT
			
				//***Che: do NOT adjust aim if target goes out of sight or is invisible
				TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), 4)
				TNT1 A 0 A_JumpIfTargetInLOS(2)
				TNT1 A 0 A_Jump(256, 2)
				TNT1 A 0 A_FaceTarget
			
			
			FAT2 I 4 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 43, -5, 61)
			
				//***Che: do NOT adjust aim if target goes out of sight or is invisible
				TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), 4)
				TNT1 A 0 A_JumpIfTargetInLOS(2)
				TNT1 A 0 A_Jump(256, 2)
				TNT1 A 0 A_FaceTarget			
			
			FAT2 G 4 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 21, 0, 66) //A_FaceTarget
			TNT1 A 0 A_Playsound("Volcabus/cannon")
			
				TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), 2)
				TNT1 A 0 A_JumpIfTargetInLOS(4)
				// the version with auto-aim disabled (invisible or no LOS):
				TNT1 A 0 A_CustomMissile("VolcabusBall",30,-25,4 + angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
				TNT1 A 0 A_CustomMissile("VolcabusBall",30,25,-4 + angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
				TNT1 A 0 A_Jump(256, 3)
				// the auto-aimed version:
				TNT1 A 0 A_CustomMissile("VolcabusBall",30,-25,4,0)
				TNT1 A 0 A_CustomMissile("VolcabusBall",30,25,-4,0)			
			
			FAT2 H 10 BRIGHT
			
			FAT2 IG 4
			TNT1 A 0 A_ChangeFlag("NOPAIN", 0)
			Goto See
			
		Missile2:
		
			//***Che: note: the "I" frames here are too short for the headbox to follow,
			// using a static position for frames GH for the entire firing sequence
			
			TNT1 A 0 
//			TNT1 A 0 A_JumpIfInventory("IAmSfestMonster", 1, "Missile2Sfest")
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 21, 0, 66)
			
				// Missile2 is only invoked from Missile, with A_FaceTarget already called
				
				//***Che: do NOT adjust aim if target goes out of sight or is invisible
				TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), 4)
				TNT1 A 0 A_JumpIfTargetInLOS(2)
				TNT1 A 0 A_Jump(256, 2)
				TNT1 A 0 A_FaceTarget	
			
			FAT2 G 5 A_FaceTarget
			TNT1 A 0 A_Playsound("Volcabus/cannon")
			
				TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), 2)
				TNT1 A 0 A_JumpIfTargetInLOS(3)
				// the version with auto-aim disabled (invisible or no LOS):
				TNT1 A 0 A_CustomMissile("VolcabusBall",30,25,angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
				TNT1 A 0 A_Jump(256, 2)
				// the auto-aimed version:
				TNT1 A 0 A_CustomMissile("VolcabusBall",30,25,0,0)

			FAT2 H 4 BRIGHT
			
			FAT2 IG 1 //A_FaceTarget
			
				//***Che: do NOT adjust aim if target goes out of sight or is invisible
				TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), 4)
				TNT1 A 0 A_JumpIfTargetInLOS(2)
				TNT1 A 0 A_Jump(256, 2)
				TNT1 A 0 A_FaceTarget	
			
			TNT1 A 0 A_Playsound("Volcabus/cannon")
			
				TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), 2)
				TNT1 A 0 A_JumpIfTargetInLOS(3)
				// the version with auto-aim disabled (invisible or no LOS):
				TNT1 A 0 A_CustomMissile("VolcabusBall",30,-25,angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
				TNT1 A 0 A_Jump(256, 2)
				// the auto-aimed version:
				TNT1 A 0 A_CustomMissile("VolcabusBall",30,-25,0,0)
			
			FAT2 H 4 BRIGHT
			
			FAT2 IG 1 //A_FaceTarget
			
				//***Che: do NOT adjust aim if target goes out of sight or is invisible
				TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), 4)
				TNT1 A 0 A_JumpIfTargetInLOS(2)
				TNT1 A 0 A_Jump(256, 2)
				TNT1 A 0 A_FaceTarget				
			
			TNT1 A 0 A_Playsound("Volcabus/cannon")
			
			//***Che:: Both to the left...? Adjusting the sequence to 6 instead of 4, with a different spread
			
				TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), 2)
				TNT1 A 0 A_JumpIfTargetInLOS(3)
				// the version with auto-aim disabled (invisible or no LOS):
				TNT1 A 0 A_CustomMissile("VolcabusBall",30,25,4 + angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
				TNT1 A 0 A_Jump(256, 2)
				// the auto-aimed version:
				TNT1 A 0 A_CustomMissile("VolcabusBall",30,25,4,0) //-4,0)
			FAT2 H 4 BRIGHT
			
			FAT2 IG 1 //A_FaceTarget
			
				//***Che: do NOT adjust aim if target goes out of sight or is invisible
				TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), 4)
				TNT1 A 0 A_JumpIfTargetInLOS(2)
				TNT1 A 0 A_Jump(256, 2)
				TNT1 A 0 A_FaceTarget				
			
			TNT1 A 0 A_Playsound("Volcabus/cannon")
				TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), 2)
				TNT1 A 0 A_JumpIfTargetInLOS(3)
				// the version with auto-aim disabled (invisible or no LOS):
				TNT1 A 0 A_CustomMissile("VolcabusBall",30,-25,-4 + angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
				TNT1 A 0 A_Jump(256, 2)
				// the auto-aimed version:
				TNT1 A 0 A_CustomMissile("VolcabusBall",30,-25,-4,0)
			FAT2 H 4 BRIGHT
			
			
			
			//***Che The third pair added by ChebMaster
			
			FAT2 IG 1 //A_FaceTarget
			
				//***Che: do NOT adjust aim if target goes out of sight or is invisible
				TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), 4)
				TNT1 A 0 A_JumpIfTargetInLOS(2)
				TNT1 A 0 A_Jump(256, 2)
				TNT1 A 0 A_FaceTarget				
			
			TNT1 A 0 A_Playsound("Volcabus/cannon")
				TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), 2)
				TNT1 A 0 A_JumpIfTargetInLOS(3)
				// the version with auto-aim disabled (invisible or no LOS):
				TNT1 A 0 A_CustomMissile("VolcabusBall",30,25,-4 + angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
				TNT1 A 0 A_Jump(256, 2)
				// the auto-aimed version:
				TNT1 A 0 A_CustomMissile("VolcabusBall",30,25,-4,0)
			FAT2 H 4 BRIGHT
			FAT2 IG 1 //A_FaceTarget
			
				//***Che: do NOT adjust aim if target goes out of sight or is invisible
				TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), 4)
				TNT1 A 0 A_JumpIfTargetInLOS(2)
				TNT1 A 0 A_Jump(256, 2)
				TNT1 A 0 A_FaceTarget				
			
			TNT1 A 0 A_Playsound("Volcabus/cannon")
				TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), 2)
				TNT1 A 0 A_JumpIfTargetInLOS(3)
				// the version with auto-aim disabled (invisible or no LOS):
				TNT1 A 0 A_CustomMissile("VolcabusBall",30,-25,4 + angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
				TNT1 A 0 A_Jump(256, 2)
				// the auto-aimed version:
				TNT1 A 0 A_CustomMissile("VolcabusBall",30,-25,4,0)
			FAT2 H 4 BRIGHT			
			FAT2 IG 4
			TNT1 A 0 A_ChangeFlag("NOPAIN", 0)
			Goto See
/*			
		MissileSfest:
		
			TNT1 A 0
				//***Che: do NOT adjust aim if target goes out of sight or is invisible
				TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), 4)
				TNT1 A 0 A_JumpIfTargetInLOS(2)
				TNT1 A 0 A_Jump(256, 2)
				TNT1 A 0 A_FaceTarget
			
			
			FAT2 G 8 //A_FaceTarget
			TNT1 A 0 A_Playsound("Volcabus/cannon")
			
				TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), 2)
				TNT1 A 0 A_JumpIfTargetInLOS(4)
				// the version with auto-aim disabled (invisible or no LOS):
				TNT1 A 0 A_CustomMissile("VolcabusBallSfest",30,-25,10 + angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
				TNT1 A 0 A_CustomMissile("VolcabusBallSfest",30,25,angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
				TNT1 A 0 A_Jump(256, 3)
				// the auto-aimed version:
				TNT1 A 0 A_CustomMissile("VolcabusBallSfest",30,-25,10,0)
				TNT1 A 0 A_CustomMissile("VolcabusBallSfest",30,25,0,0)			
			
			FAT2 H 8 BRIGHT

				//***Che: do NOT adjust aim if target goes out of sight or is invisible
				TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), 4)
				TNT1 A 0 A_JumpIfTargetInLOS(2)
				TNT1 A 0 A_Jump(256, 2)
				TNT1 A 0 A_FaceTarget
			
			
			FAT2 I 4 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 43, -5, 61)
			
				//***Che: do NOT adjust aim if target goes out of sight or is invisible
				TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), 4)
				TNT1 A 0 A_JumpIfTargetInLOS(2)
				TNT1 A 0 A_Jump(256, 2)
				TNT1 A 0 A_FaceTarget			
			
			FAT2 G 4 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 21, 0, 66) //A_FaceTarget
			
			TNT1 A 0 A_Playsound("Volcabus/cannon")
			
				TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), 2)
				TNT1 A 0 A_JumpIfTargetInLOS(4)
				// the version with auto-aim disabled (invisible or no LOS):
				TNT1 A 0 A_CustomMissile("VolcabusBallSfest",30,-25,angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
				TNT1 A 0 A_CustomMissile("VolcabusBallSfest",30,25,-10 + angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
				TNT1 A 0 A_Jump(256, 3)
				// the auto-aimed version:
				TNT1 A 0 A_CustomMissile("VolcabusBallSfest",30,-25,0,0)
				TNT1 A 0 A_CustomMissile("VolcabusBallSfest",30,25,-10,0)			
			
			FAT2 H 8 BRIGHT
			
				//***Che: do NOT adjust aim if target goes out of sight or is invisible
				TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), 4)
				TNT1 A 0 A_JumpIfTargetInLOS(2)
				TNT1 A 0 A_Jump(256, 2)
				TNT1 A 0 A_FaceTarget
			
			
			FAT2 I 4 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 43, -5, 61)
			
				//***Che: do NOT adjust aim if target goes out of sight or is invisible
				TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), 4)
				TNT1 A 0 A_JumpIfTargetInLOS(2)
				TNT1 A 0 A_Jump(256, 2)
				TNT1 A 0 A_FaceTarget			
			
			FAT2 G 4 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 21, 0, 66) //A_FaceTarget
			TNT1 A 0 A_Playsound("Volcabus/cannon")
			
				TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), 2)
				TNT1 A 0 A_JumpIfTargetInLOS(4)
				// the version with auto-aim disabled (invisible or no LOS):
				TNT1 A 0 A_CustomMissile("VolcabusBallSfest",30,-25,4 + angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
				TNT1 A 0 A_CustomMissile("VolcabusBallSfest",30,25,-4 + angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
				TNT1 A 0 A_Jump(256, 3)
				// the auto-aimed version:
				TNT1 A 0 A_CustomMissile("VolcabusBallSfest",30,-25,4,0)
				TNT1 A 0 A_CustomMissile("VolcabusBallSfest",30,25,-4,0)			
			
			FAT2 H 10 BRIGHT
			
			FAT2 IG 4
			TNT1 A 0 A_ChangeFlag("NOPAIN", 0)
			Goto See		
			
		Missile2Sfest:
		
			// note: the "I" frames here are too short for the headbox to follow,
			// using a static position for frames GH for the entire firing sequence
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 21, 0, 66)
			
				// Missile2 is only invoked from Missile, with A_FaceTarget already called
				
				//***Che: do NOT adjust aim if target goes out of sight or is invisible
				TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), 4)
				TNT1 A 0 A_JumpIfTargetInLOS(2)
				TNT1 A 0 A_Jump(256, 2)
				TNT1 A 0 A_FaceTarget	
			
			FAT2 G 5 A_FaceTarget
			TNT1 A 0 A_Playsound("Volcabus/cannon")
			
				TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), 2)
				TNT1 A 0 A_JumpIfTargetInLOS(3)
				// the version with auto-aim disabled (invisible or no LOS):
				TNT1 A 0 A_CustomMissile("VolcabusBallSfest",30,25,angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
				TNT1 A 0 A_Jump(256, 2)
				// the auto-aimed version:
				TNT1 A 0 A_CustomMissile("VolcabusBallSfest",30,25,0,0)

			FAT2 H 4 BRIGHT
			
			FAT2 IG 1 //A_FaceTarget
			
				//***Che: do NOT adjust aim if target goes out of sight or is invisible
				TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), 4)
				TNT1 A 0 A_JumpIfTargetInLOS(2)
				TNT1 A 0 A_Jump(256, 2)
				TNT1 A 0 A_FaceTarget	
			
			TNT1 A 0 A_Playsound("Volcabus/cannon")
			
				TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), 2)
				TNT1 A 0 A_JumpIfTargetInLOS(3)
				// the version with auto-aim disabled (invisible or no LOS):
				TNT1 A 0 A_CustomMissile("VolcabusBallSfest",30,-25,angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
				TNT1 A 0 A_Jump(256, 2)
				// the auto-aimed version:
				TNT1 A 0 A_CustomMissile("VolcabusBallSfest",30,-25,0,0)
			
			FAT2 H 4 BRIGHT
			
			FAT2 IG 1 //A_FaceTarget
			
				//***Che: do NOT adjust aim if target goes out of sight or is invisible
				TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), 4)
				TNT1 A 0 A_JumpIfTargetInLOS(2)
				TNT1 A 0 A_Jump(256, 2)
				TNT1 A 0 A_FaceTarget				
			
			TNT1 A 0 A_Playsound("Volcabus/cannon")
			
			//***Che:: Both to the left...? Adjusting the sequence to 6 instead of 4, with a different spread
			
				TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), 2)
				TNT1 A 0 A_JumpIfTargetInLOS(3)
				// the version with auto-aim disabled (invisible or no LOS):
				TNT1 A 0 A_CustomMissile("VolcabusBallSfest",30,25,4 + angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
				TNT1 A 0 A_Jump(256, 2)
				// the auto-aimed version:
				TNT1 A 0 A_CustomMissile("VolcabusBallSfest",30,25,4,0) //-4,0)
			FAT2 H 4 BRIGHT
			
			FAT2 IG 1 //A_FaceTarget
			
				//***Che: do NOT adjust aim if target goes out of sight or is invisible
				TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), 4)
				TNT1 A 0 A_JumpIfTargetInLOS(2)
				TNT1 A 0 A_Jump(256, 2)
				TNT1 A 0 A_FaceTarget				
			
			TNT1 A 0 A_Playsound("Volcabus/cannon")
				TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), 2)
				TNT1 A 0 A_JumpIfTargetInLOS(3)
				// the version with auto-aim disabled (invisible or no LOS):
				TNT1 A 0 A_CustomMissile("VolcabusBallSfest",30,-25,-4 + angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
				TNT1 A 0 A_Jump(256, 2)
				// the auto-aimed version:
				TNT1 A 0 A_CustomMissile("VolcabusBallSfest",30,-25,-4,0)
			FAT2 H 4 BRIGHT
			
			
			
			//***Che The third pair added by ChebMaster
			
			FAT2 IG 1 //A_FaceTarget
			
				//***Che: do NOT adjust aim if target goes out of sight or is invisible
				TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), 4)
				TNT1 A 0 A_JumpIfTargetInLOS(2)
				TNT1 A 0 A_Jump(256, 2)
				TNT1 A 0 A_FaceTarget				
			
			TNT1 A 0 A_Playsound("Volcabus/cannon")
				TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), 2)
				TNT1 A 0 A_JumpIfTargetInLOS(3)
				// the version with auto-aim disabled (invisible or no LOS):
				TNT1 A 0 A_CustomMissile("VolcabusBallSfest",30,25,-4 + angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
				TNT1 A 0 A_Jump(256, 2)
				// the auto-aimed version:
				TNT1 A 0 A_CustomMissile("VolcabusBallSfest",30,25,-4,0)
			FAT2 H 4 BRIGHT
			FAT2 IG 1 //A_FaceTarget
			
				//***Che: do NOT adjust aim if target goes out of sight or is invisible
				TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), 4)
				TNT1 A 0 A_JumpIfTargetInLOS(2)
				TNT1 A 0 A_Jump(256, 2)
				TNT1 A 0 A_FaceTarget				
			
			TNT1 A 0 A_Playsound("Volcabus/cannon")
				TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), 2)
				TNT1 A 0 A_JumpIfTargetInLOS(3)
				// the version with auto-aim disabled (invisible or no LOS):
				TNT1 A 0 A_CustomMissile("VolcabusBallSfest",30,-25,4 + angle, CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH)
				TNT1 A 0 A_Jump(256, 2)
				// the auto-aimed version:
				TNT1 A 0 A_CustomMissile("VolcabusBallSfest",30,-25,4,0)
			FAT2 H 4 BRIGHT			
			FAT2 IG 4
			TNT1 A 0 A_ChangeFlag("NOPAIN", 0)
			Goto See
*/
			
		NoStomp:
			TNT1 A 0
			TNT1 A 0 A_Log("Volcabus: target is too high up, aborting stomp.")
			Goto MissileContinueCannotStomp		
		Melee:	
		StompAttack:	
			TNT1 A 0
			
			TNT1 A 0 A_JumpIfInTargetInventory("GoFatality", 1, "WaitTargetsFatalityOut")
			
			// Kinslayer check:	
			TNT1 A 0 A_JumpIf(!CheckClass("Volcabus", AAPTR_TARGET, true), 3)
			TNT1 A 0 ACS_NamedExecuteWithResult("FBD_InfightFriendlyFireOn")
			TNT1 A 0 A_JumpIfCloser(100, "Missile2InsteadOfStomp")
			
			//TNT1 A 0 A_CustomMissile("FBD_CheckIfTargetIsAbove60")
			"----" A 0 A_JumpIf(CallAcs("GetZDeltaToTarget") > 60, "NoStomp")
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 21, 0, 66)
			FAT2 G 4 A_PlaySound("Volcabus/attack", CHAN_VOICE)
			
			//TNT1 A 0 A_JumpIfInventory("TargetIsAbove", 1, "NoStomp")
			
			
			TNT1 A 0 A_FaceTarget
			FATO A 4 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 21, 0, 71)
			FATO B 4 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 21, 0, 63)
			FATO A 2 A_FaceTarget
			TNT1 A 0 ThrustThingZ(0,50,0,1)
			TNT1 A 0 A_Recoil(-8)
			TNT1 A 0 A_ChangeFlag("NOPAIN", 1)
			FATO C 1 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 21, 0, 75)
			Goto InAirStomp
			
		InAirStomp:
			FATO C 5 A_JumpIf(momz == 0, "DoStomp")
			Loop
		
		DoStomp:
			TNT1 A 0
			TNT1 A 0
			TNT1 A 0 A_CustomMissile("CyberStomp",10,0,0,0)
			TNT1 A 0 A_Stop
			FATO B 4 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 21, 0, 63)
			FATO A 4 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 21, 0, 71)
			TNT1 A 0 A_ChangeFlag("NOPAIN", 0)
			Goto See
			
		Missile2InsteadOfStomp:
			FATO A 4 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 21, 0, 71)
			FATO B 4 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 21, 0, 63)
			FATO A 2 A_FaceTarget
			TNT1 A 0 ThrustThingZ(0,25,0,1)
			TNT1 A 0 A_Recoil(8)
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 21, 0, 75)
			FATO CCCCCCCCCCC 3 A_CheckFloor("Missile2")
			Goto Missile2			
	  
		Pain:
			
			FAT2 J 3 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 15, 8, 61)
			FAT2 J 3 A_Pain
			Goto See
			
		Pain.Argent:

			TNT1 A 0
			TNT1 A 0 HealThing(150)
			TNT1 A 0 ACS_NamedExecuteWithResult("DisplayArgentDischarge", 30, 65, 0)

			FAT2 J 3 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 15, 8, 61)
			FAT2 J 3 A_Pain

			Goto Pain.Taunt // results in furious spraying in a random direction if target is out of sight
			
		Pain.SuperKick:
		Pain.Explosive:
		Pain.ExtremePunches:
		Pain.SSG:
		Pain.Bfg10k: //***Che changed damage type from extreme to custom
			TNT1 A 0 A_FaceTarget
			TNT1 A 0 A_Recoil(2)
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 15, 8, 61)
			
			FAT2 J 9 A_Pain  
			
			FAT2 J 8
			Goto See
			
		Pain.Decaptate:
		Pain.HeadStun:
			TNT1 A 0
			TNT1 A 0 A_SetUserVar("user_bleeding_angle", random(-110, 110))
			
			// becomes unflinchable until completes any of his attacks
			TNT1 A 0 A_ChangeFlag("NOPAIN", 1)
			
			TNT1 A 0 A_FaceTarget
			TNT1 A 0 A_Recoil(2)
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 15, 8, 61)
			
			FAT2 J 1 A_Pain  
			FAT2 JJJJJJ 3 A_CustomMissile ("Brutal_LiquidBlood2", 70, 8, angle + user_bleeding_angle + random (-15, 15), CMF_ABSOLUTEANGLE | CMF_ABSOLUTEPITCH, random (25, 45))
			
			FAT2 J 1 A_Pain  
			FAT2 JJJJ 4  A_CustomMissile ("Brutal_LiquidBlood2", 70, 8, angle + user_bleeding_angle + random (-15, 15), CMF_ABSOLUTEANGLE | CMF_ABSOLUTEPITCH, random (0, 25))
			
			// one second or two seconds stun with 50% probability 
			TNT1 A 0 A_Jump(128, "See")
			
			FAT2 J 1 A_Pain  
			FAT2 JJJJ 5  A_CustomMissile ("Brutal_LiquidBlood2", 70, 8, angle + user_bleeding_angle + random (-15, 15), CMF_ABSOLUTEANGLE | CMF_ABSOLUTEPITCH, random (-25, 0))

			FAT2 J 1 A_Pain  
			FAT2 JJJ 6  A_CustomMissile ("Brutal_LiquidBlood2", 70, 8, angle + user_bleeding_angle + random (-15, 15), CMF_ABSOLUTEANGLE | CMF_ABSOLUTEPITCH, random (-45, -25))
			
			TNT1 A 0 A_GiveInventory("Enraged", 1)
			TNT1 A 0 A_JumpIfTargetInLOS("Missile")
			Goto See
		
		
		Death:
			TNT1 A 0 A_Jump(128, "Death2", "Death3")
		Death1:
			F5T2 A 7 
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			F5T2 B 7 A_Scream
			F5T2 C 7 //A_NoBlocking
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_Jump(44, "Suffer")
			F5T2 DEF 6 A_CustomMissile ("MuchBlood", 15, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			F5T2 F 1 A_BossDeath    
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			F5T2 F -1
			Stop
			
		//Brutalize animation
		Suffer:
			TNT1 A 0 A_SpawnItemEx ("DyingVolcabus",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
			
		Death2:
			TNT1 A 0 A_Scream
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_BossDeath
			F4T2 F 7 
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			F4T2 G 7 
			F4T2 H 7 
			F4T2 IJK 6 A_CustomMissile ("MuchBlood", 15, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			F4T2 LMNO 5
			F4T2 O -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
			
		Death3:
			F4T2 A 7 
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			F4T2 B 7 A_Scream
			F4T2 C 7 A_NoBlocking
			F4T2 DE 6
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			F4T2 E 1 A_BossDeath
			F4T2 E -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.SniperBullet:
		Death.Bullet792:
		Death.Minigun:
		Death.cutless:
			TNT1 A 0 A_Jump(128, "Death3")
			TNT1 A 0 A_Jump(80,"Death1", "Death2")
		Death.Cut:
		Death.Saw:
		Death.Tear:
			F6T2 K 6 
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			F6T2 L 5 A_Scream
			TNT1 A 0 A_CustomMissile ("FBD_FlyingBlood", 75, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			F6T2 M 5 A_NoBlocking
			TNT1 A 0 A_BossDeath
			TNT1 AA 0 A_CustomMissile ("XDeath1", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			F6T2 NOP 4 A_CustomMissile ("FBD_FlyingBlood", 75, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("XDeath3", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("RipGuts", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("XDeath2", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAAA 0 A_CustomMissile ("Guts", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))	
			F6T2 QRST 4 A_CustomMissile ("FBD_FlyingBlood", 75, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAAAAAA 0 A_CustomMissile ("MuchBlood", 48, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))	 
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			F6T2 T -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
    
		//Blasted Chest Open
		Death.SSG:
		Death.Blast:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 AA 0 A_CustomMissile ("XDeath1", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAA 0 A_CustomMissile ("xdeath2", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAA 0 A_CustomMissile ("RipGuts", 25, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("FBD_FlyingBlood", 32, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AAAA 0 A_CustomMissile ("Brutal_FlyingBloodFaster", 32, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AAAA 0 A_CustomMissile ("Brutal_FlyingBloodMuchFaster", 32, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AAAA 0 A_CustomMissile ("SuperWallRedBlood", 32, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AAAA 0 A_CustomMissile ("SuperWallRedBlood", 46, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			F8T2 AAAA 2 A_CustomMissile ("Brutal_LiquidBlood2", 40, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 60))
			
			F8T2 B 6 A_Scream
			TNT1 A 0 A_CustomMissile ("MuchBlood", 25, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			F8T2 C 6 A_NoBlocking
			F8T2 D 6 A_CustomMissile ("MuchBlood", 15, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			F8T2 E 6 A_BossDeath
			F8T2 EEEEEEEEE 2 A_CustomMissile ("Brutal_LiquidBlood2", 8, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 60))
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			F8T2 E -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
	
	
		//***Che
		Death.FriendlyExplosion:
	
		//Gibbed to pieces
		XDeath:
		Death.QuadBlast:
		Death.Explosives:
		Death.ExplosiveImpact:
		Death.Landmine:
		Death.Bfg10k: //***Che changed damage type from extreme to custom
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 AAAA 0 A_CustomMissile ("FBD_FlyingBlood", 75, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("XDeath1", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAA 0 A_CustomMissile ("XDeath2", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("XDeath1", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAAA 0 A_CustomMissile ("XDeath2b", 20, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAAA 0 A_CustomMissile ("XDeath3b", 20, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAA 0 A_CustomMissile ("MuchBlood2", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_PlaySound("misc/gibbed")
			FA72 A 6 A_Scream
			TNT1 AAAA 0 A_CustomMissile ("FBD_FlyingBlood", 75, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathVolcabusArm", 20, 0, random (0, 360), CMF_AIMDIRECTION, random (50, 130))	
			TNT1 AA 0 A_CustomMissile ("FBD_FlyingBlood", 65, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("XDeath1", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("XDeath2", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("XDeath2", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			FA72 B 6 A_NoBlocking
			TNT1 AAAA 0 A_CustomMissile ("FBD_FlyingBlood", 65, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("RipGuts", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("XDeath2", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			FA72 C 6 A_BossDeath
			TNT1 AA 0 A_CustomMissile ("FBD_FlyingBlood", 55, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("XDeath3", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAAA 0 A_CustomMissile ("Guts", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))	
			TNT1 AAAAAAAA 0 A_CustomMissile ("MuchBlood", 48, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))	
			FA72 DE 8
			FA72 E -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
	  
	  
	  
		//Head exploding death
		
			
		Death.Psionic:	//***Che
		
		Death.minorhead:
		Death.head:
		Death.HeadStun:
		Death.HeadPlasma:
				
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 AAAAAA 0 A_CustomMissile ("Xdeath1", 68, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAAAA 0 A_CustomMissile ("Brains1", 68, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAA 0 A_CustomMissile ("Brains2", 68, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("Brains3", 68, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAAA 0 A_CustomMissile ("Brains6", 68, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("Brains7", 68, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("XDeath3", 68, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("Brains3", 62, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_Scream
			TNT1 A 0 A_Jump(66, "ChickenHead")
			FA72 FFFFF 2 A_CustomMissile ("Brutal_LiquidBlood3", 71, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			FA72 GGG 2 A_CustomMissile ("Brutal_LiquidBlood2", 67, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			FA72 HHH 2 A_CustomMissile ("FBD_FlyingBlood", 58, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("MuchBlood", 58, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			FA72 III 2 A_CustomMissile ("FBD_FlyingBlood", 44, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_PlaySound("knight/step", CHAN_AUTO)//8)
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_BossDeath
			TNT1 AA 0 A_CustomMissile ("XDeath1", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			FA72 JJJJJJJJJJJJJJJJJJ 2 A_CustomMissile ("Brutal_LiquidBlood2", 21, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			FA72 J -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
		
		ChickenHead:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_PlaySound("misc/xdeath2c", CHAN_VOICE)
			FA72 FFFFKKKK 2 A_CustomMissile ("Brutal_LiquidBlood2", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (10, 90))
			
			TNT1 A 0 A_PlaySound("misc/xdeath2c", CHAN_VOICE)
			FA72 FFFFKKKK 2 A_CustomMissile ("Brutal_LiquidBlood2", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (10, 90))
			
			TNT1 A 0 A_PlaySound("misc/xdeath2c", CHAN_VOICE)
			FA72 FFFFKKKK 2 A_CustomMissile ("Brutal_LiquidBlood2", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (10, 90))
			
			TNT1 A 0 A_PlaySound("misc/xdeath2c", CHAN_VOICE)
			FA72 FFFFKKKK 2 A_CustomMissile ("Brutal_LiquidBlood2", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (10, 90))
		
			TNT1 A 0 A_PlaySound("misc/xdeath2c", CHAN_VOICE)
			FA72 FFFFKKKK 2 A_CustomMissile ("Brutal_LiquidBlood2", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (10, 90))
			
			TNT1 A 0 A_PlaySound("misc/xdeath2c", CHAN_VOICE)
			FA72 FFFFKKKK 2 A_CustomMissile ("Brutal_LiquidBlood2", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (10, 90))
					
			FA72 GGG 2 A_CustomMissile ("Brutal_LiquidBlood2", 67, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			FA72 HHH 2 A_CustomMissile ("FBD_FlyingBlood", 58, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("MuchBlood", 58, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			FA72 III 2 A_CustomMissile ("FBD_FlyingBlood", 44, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_PlaySound("knight/step",CHAN_AUTO)//8)
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_BossDeath
			TNT1 AA 0 A_CustomMissile ("XDeath1", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			FA72 JJJJJJJJJJJJJJJJJJ 2 A_CustomMissile ("Brutal_LiquidBlood2", 21, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			FA72 J -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.Desintegrate:
		Death.Plasma:
		XDeath.Electric:		
		Death.Plasma2:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_BossDeath
			TNT1 A 0 A_Scream
			TNT1 A 0 A_NoBlocking
			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 AAAAA 0 A_CustomMissile ("FBD_FlyingBlood", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			F7T2 A 6 BRIGHT
			TNT1 AAA 0 A_CustomMissile ("FBD_FlyingBlood", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("XDeathBurnedMeat3", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("XDeathBurnedMeat2", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			F7T2 B 4 BRIGHT A_SpawnItem("BlueFlare",0,43)
			EXPL AAAAAA 0 A_CustomMissile ("ExplosionSmoke", 32, 0, random (0, 360), 2, random (0, 360))
			F7T2 CD 4 BRIGHT A_SpawnItem("BlueFlare",0,43)
			//***Che detaching smoke emittinf from burned corpses
			// because archvile would otherwise only rez the corpse after it stopped smoking
			TNT1 A 0 A_SpawnItemEx("FBD_CorpseSmoke",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0,0)
			//F7T2 EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE 10 A_CustomMissile ("SmallSmoke", 1, 0, random (0, 360), 2, random (0, 160))
			F7T2 E -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:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_BossDeath
			TNT1 A 0 A_XScream
			TNT1 A 0 A_NoBlocking
			TNT1 AAAAAAAA 0 A_CustomMissile ("FBD_Blood", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAAAA 0 A_CustomMissile ("XDeathBurnedMeat", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAAAA 0 A_CustomMissile ("XDeathBurnedMeat2", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAA 0 A_CustomMissile ("XDeathBurnedMeat3", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("FBD_Blood", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("XDeathBurnedMeat", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAA 0 A_CustomMissile ("XDeathBurnedMeat2", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("XDeathBurnedMeat3", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			XBRN BB 2 BRIGHT A_SpawnItem("BlueFlare",0,43)
			TNT1 A 0 A_CustomMissile ("FBD_Blood", 30, 0, random (0, 360), 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:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_XScream
			TNT1 A 0 A_BossDeath
			TNT1 A 0 A_NoBlocking
			TNT1 AAAA 0 A_CustomMissile ("FBD_Blood", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAAA 0 A_CustomMissile ("XDeathBurnedMeat", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAAA 0 A_CustomMissile ("XDeathBurnedMeat2", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAA 0 A_CustomMissile ("XDeathBurnedMeat3", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("FBD_Blood", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("XDeathBurnedMeat", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAA 0 A_CustomMissile ("XDeathBurnedMeat2", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("XDeathBurnedMeat3", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			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.Fatality:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_FaceTarget
			//TNT1 AAA 0 A_SpawnItemEx("HealthPlusFatalityBonus", 0,0,20, random (-1, 1),random (-1, 1),8, 0, SXF_ABSOLUTEVELOCITY | SXF_NOCHECKPOSITION)
			//TNT1 AAA 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, 15, 15, 0) // 0, health, armor, 0 -- rounded down to nearest 2
			TNT1 A 0 A_Jump(256, "Fatality2")
		//Mark-sensei says: Good enough animation
		Fatality2:
			TNT1 A 0 A_GiveToTarget("GoFatality", 1)
			TNT1 A 0 A_GiveToTarget("VolcabusFatality2", 1)
			TNT1 A 1 A_BossDeath
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // without at least 8 tics delay, the bonus drop script runs ownerless
			Stop
			
		//Mark-sensei says: Needs improvement, currently unused
		//Which means it will forever be unused in FBD
		Fatality1:
			TNT1 A 0 A_GiveToTarget("GoFatality", 1)
			TNT1 A 0 A_GiveToTarget("VolcabusFatality", 1)
			TNT1 A 1 A_BossDeath
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // without at least 8 tics delay, the bonus drop script runs ownerless
			Stop
		  
			
		//***Che: he was using burning mancubus sprites despite having his own art!	
		Death.Fire: 
		Death.Burn: 
		Death.Flames:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
		
			F7T2 FFF 2 BRIGHT A_CustomMissile ("BurnParticles", 57, 0, random (0, 180), 2, random (0, 180))
			TNT1 A 0 A_Pain
			F7T2 GGG 2 BRIGHT A_CustomMissile ("BurnParticles", 57, 0, random (0, 180), 2, random (0, 180))
			F7T2 HHH 2 BRIGHT A_CustomMissile ("BurnParticles", 57, 0, random (0, 180), 2, random (0, 180))
			F7T2 GGG 2 BRIGHT A_CustomMissile ("BurnParticles", 57, 0, random (0, 180), 2, random (0, 180))
			
			F7T2 FFF 2 BRIGHT A_CustomMissile ("BurnParticles", 57, 0, random (0, 180), 2, random (0, 180))
			TNT1 A 0 A_Pain
			F7T2 GGG 2 BRIGHT A_CustomMissile ("BurnParticles", 57, 0, random (0, 180), 2, random (0, 180))
			F7T2 HHH 2 BRIGHT A_CustomMissile ("BurnParticles", 57, 0, random (0, 180), 2, random (0, 180))
			F7T2 GGG 2 BRIGHT A_CustomMissile ("BurnParticles", 57, 0, random (0, 180), 2, random (0, 180))
			TNT1 AA 0 A_SpawnItemEx("TinyBurningPiece", random (-15, 15), random (-15, 15))
			TNT1 FFF 0 A_SpawnItemEx("TinyBurningPiece2", random (-35, 35), random (-35, 35))
			TNT1 FFF 0 A_SpawnItemEx("TinyBurningPiece3", random (-45, 45), random (-45, 35))
			F7T2 FFF 2 BRIGHT A_CustomMissile ("BurnParticles", 57, 0, random (0, 180), 2, random (0, 180))
			TNT1 A 0 A_Pain
			F7T2 GGG 2 BRIGHT A_CustomMissile ("BurnParticles", 57, 0, random (0, 180), 2, random (0, 180))
			F7T2 HHH 2 BRIGHT A_CustomMissile ("BurnParticles", 57, 0, random (0, 180), 2, random (0, 180))
			F7T2 GGG 2 BRIGHT A_CustomMissile ("BurnParticles", 57, 0, random (0, 180), 2, random (0, 180))
			
			F7T2 FFF 2 BRIGHT A_CustomMissile ("BurnParticles", 57, 0, random (0, 180), 2, random (0, 180))
			TNT1 A 0 A_Pain
			F7T2 GGG 2 BRIGHT A_CustomMissile ("BurnParticles", 57, 0, random (0, 180), 2, random (0, 180))
			F7T2 HHH 2 BRIGHT A_CustomMissile ("BurnParticles", 57, 0, random (0, 180), 2, random (0, 180))
			F7T2 GGG 2 BRIGHT A_CustomMissile ("BurnParticles", 57, 0, random (0, 180), 2, random (0, 180))
			TNT1 A 0 A_SpawnItemEx ("DetectFloorCraterSmall",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 0 A_BossDeath
			TNT1 A 0 A_SpawnItem("BarrelExplosionSmokeColumn")
			TNT1 AA 0 A_SpawnItemEx("TinyBurningPiece", random (-15, 15), random (-15, 15))
			TNT1 AAA 0 A_SpawnItemEx("TinyBurningPiece2", random (-35, 35), random (-35, 35))
			TNT1 AAA 0 A_SpawnItemEx("TinyBurningPiece3", random (-45, 45), random (-45, 35))
			
			//BF4T DEF 4 A_CustomMissile ("BurnParticles", 12, 0, random (0, 180), 2, random (50, 90))
			
			
			//***Che: lacks falling burned sprites, using sprite scaling as an substituting ersatz (ewwww!)
			/*
			P.S. I cannot look at this stravesty of mine. Let us just use mancubus falling frames.
			TNT1 A 0 A_CustomMissile ("BurnParticles", 12, 0, random (0, 180), 2, random (50, 90))
			F7T2 G 4 A_SetScale(1.3, 1.5)
			TNT1 A 0 A_CustomMissile ("BurnParticles", 12, 0, random (0, 180), 2, random (50, 90))
			F7T2 H 4 A_SetScale(1.1, 1.5)
			TNT1 A 0 A_CustomMissile ("BurnParticles", 12, 0, random (0, 180), 2, random (50, 90))
			F7T2 I 4 A_SetScale(0.9, 1.5)
			TNT1 A 0 A_SetScale(1.5, 1.5)
			*/
			
			// mancubus, not volcabus :(
			BF4T DEF 4 A_CustomMissile ("BurnParticles", 12, 0, random (0, 180), 2, random (50, 90))
			
			
			F7T2 EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE 10 A_CustomMissile ("BurnParticles", 12, 0, random (0, 180), 2, random (50, 90))
			F7T2 E -1 //***Che: Gibbed monsters -- ONLY the gibbed monsters -- may use this
			Stop
		Death.Ice:
		Death.Freeze:
		Death.Frost:
			TNT1 A 0
			TNT1 A 0 A_StopSound(CHAN_VOICE)
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_NoBlocking // freeze death is permanent
			TNT1 A 0 A_SpawnItemEx ("FrozenVolcabus",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the scripts and actors time to run and access us
			Stop

		Death.IOS_Frost:
			TNT1 A 0
			TNT1 A 0 A_StopSound(CHAN_VOICE)
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_SpawnItemEx ("PermafrostVolcabus",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop			
	
   }
}

Actor VolcabusRaisedByVile: FBD_Volcabus {
	States {
		Spawn:
			TNT1 A 0 NODELAY ACS_NamedExecuteWithResult("FBD_RunMonster", 8) // volcabus headbox
			
			TNT1 A 0 A_ChangeFlag("NOPAIN", 1)
			FAT2 RQPONMLK 5
			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 AbstractDeadVolcabus: DeadMancubusBugFixBase {
	Scale 1.5
	Radius 39
	Height 33
	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", 2020), "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 ("VolcabusRaisedByVile",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, 19, 0, 0) // "VolcabusRaisedByVile"
			"----" A -1 ACS_NamedExecuteWithResult("FallbackRezMkII", 2020) // see _mob_list.xlsx
			Stop
		Death:
			TNT1 AAAA 0 A_CustomMissile ("FBD_FlyingBlood", 45, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("XDeath1", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAA 0 A_CustomMissile ("XDeath2", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("XDeath1", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAAA 0 A_CustomMissile ("XDeath2b", 20, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAAA 0 A_CustomMissile ("XDeath3b", 20, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAA 0 A_CustomMissile ("MuchBlood2", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_PlaySound("misc/gibbed")
			TGIB H 6 A_Scream
			TNT1 AAAA 0 A_CustomMissile ("FBD_FlyingBlood", 75, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathVolcabusArm", 20, 0, random (0, 360), CMF_AIMDIRECTION, random (50, 130))	
			TNT1 AA 0 A_CustomMissile ("FBD_FlyingBlood", 65, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("XDeath1", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("XDeath2", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("XDeath2", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TGIB J 6 A_NoBlocking
			TNT1 AAAA 0 A_CustomMissile ("FBD_FlyingBlood", 65, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("RipGuts", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("XDeath2", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TGIB M 6 A_BossDeath
			TNT1 AA 0 A_CustomMissile ("FBD_FlyingBlood", 55, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("XDeath3", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAAA 0 A_CustomMissile ("Guts", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))	
			TNT1 AAAAAAAA 0 A_CustomMissile ("MuchBlood", 48, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))	
			TGIB NO 8
			
			TNT1 A 0 A_ChangeFlag("CORPSE", 1)
			TNT1 A 0 A_ChangeFlag("ISMONSTER", 0)
			TGIB Q -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop		
		
		Death.flames:
		Death.burn:
		Death.Fire:
		LandOnLava:
			TNT1 A 0
			TNT1 A 0 A_Scream
			TNT1 A 0 A_NoBlocking
			TNT1 AAA 0 A_CustomMissile ("FBD_FlyingBlood", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_SpawnItemEx ("CharredVolcabus",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
	}
}

/* unused
Actor FatalizedVolcabus
{
	Radius 39
	Height 33
	Scale 1.2
	-SHOOTABLE
	-SOLID
	+NOTELEPORT
	+MOVEWITHSECTOR
	+CORPSE
	-DONTGIB
	-TELESTOMP
	States
	{
		Spawn:
			TNT1 AAAA 0 A_CustomMissile ("FBD_FlyingBlood", 75, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("XDeath1", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAAA 0 A_CustomMissile ("XDeath2", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("XDeath1", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			FA72 A 8 A_Scream
			TNT1 AAAA 0 A_CustomMissile ("FBD_FlyingBlood", 75, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 A_CustomMissile ("XDeathVolcabusArm", 20, 0, random (0, 360), CMF_AIMDIRECTION, random (50, 130))	
			TNT1 AA 0 A_CustomMissile ("FBD_FlyingBlood", 65, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("XDeath1", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("XDeath2", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("XDeath2", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			FA72 B 8 A_NoBlocking
			TNT1 AAAA 0 A_CustomMissile ("FBD_FlyingBlood", 65, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("RipGuts", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("XDeath2", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			FA72 C 8 A_BossDeath
			TNT1 AA 0 A_CustomMissile ("FBD_FlyingBlood", 55, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("XDeath3", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAAA 0 A_CustomMissile ("Guts", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))	
			TNT1 AAAAAAAA 0 A_CustomMissile ("MuchBlood", 48, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))	
			FA72 DE 8
			FA72 E -1
}}
*/

Actor CharredVolcabus: CharredMancubus {
	Scale 1.5
	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", 2020), "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 ("VolcabusRaisedByVile",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, 19, 0, 0) // "VolcabusRaisedByVile"
			"----" A -1 ACS_NamedExecuteWithResult("FallbackRezMkII", 2020) // see _mob_list.xlsx
			Stop
		Spawn:
			TNT1 A 0
			Goto Death
		Death:
			TNT1 AA 0 A_CustomMissile ("XDeathBurnedMeat3", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("XDeathBurnedMeat2", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			EXPL AAAAAA 0 A_CustomMissile ("ExplosionSmoke", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 360))
			//***Che detaching smoke emittinf from burned corpses
			// because archvile would otherwise only rez the corpse after it stopped smoking
			TNT1 A 0 A_SpawnItemEx("FBD_CorpseSmoke",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0,0)
			//CARB RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR 10 A_CustomMissile ("SmallSmoke", 1, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			CARB R -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)			
	}

}

Actor FatalizedVolcabus2 : AbstractDeadVolcabus
{
	Radius 39
	Height 33
	Scale 1.2
	-SHOOTABLE
	-SOLID
	+NOTELEPORT
	+MOVEWITHSECTOR
	+CORPSE
	-DONTGIB
	-TELESTOMP
	States
	{
		//***Che // this is a descendant of FBD_CurbstompedMarine, which is neither a missile nor a monster
		Spawn:
			TNT1 AA 0 A_CustomMissile ("XDeath1", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			F6T2 NOP 4 A_CustomMissile ("FBD_FlyingBlood", 75, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("XDeath3", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("RipGuts", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AA 0 A_CustomMissile ("XDeath2", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAAA 0 A_CustomMissile ("Guts", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))	
			F6T2 QRST 4 A_CustomMissile ("FBD_FlyingBlood", 75, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAAAAAA 0 A_CustomMissile ("MuchBlood", 48, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))	 
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
		Stay: // ancestor's Pain.Kick, Pain.ExplosiveImpact and Pain.Trample redirect here after z-thrusting the actor
			F6T2 S 5 
			F6T2 T 5 A_CheckFloor("Slide")
			TNT1 A 0 A_CheckFloor("Slide")  // if this goes before the non-zero frame, we have an infinite loop!
			Loop
		Slide:
			F6T2 T 5
			TNT1 A 0 A_JumpIf(momx != 0 || momy != 0, "Slide") // 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
			F6T2 T 30
			TNT1 A 0 A_JumpIf(user_floor_is_lava, "LandOnLava")			
			F6T2 T -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop
	}
}

ACTOR DyingVolcabus: AbstractDeadVolcabus
{
	Scale 1.08
    Radius 32
    Height 35
    Speed 0
	Health 90
	Mass 1400
	PainSound "skeleton/pain"
	DeathSound "skeleton/death"
	+SHOOTABLE
    +LOOKALLAROUND
	+FRIGHTENED
	+SOLID
	+FLOORCLIP
	DamageFactor "Kick", 6.0
	DamageFactor "ExtremePunches", 6.0
	DamageFactor "SuperKick", 6.0
	DamageFactor "trample", 2.0
	DamageFactor "bloodsplasher", 0.0    DamageFactor "tinybloodsplasher", 0.0    DamageFactor "superbloodsplasher", 0.0    DamageFactor "smallbloodsplasher", 0.0
	PainChance "Kick", 255
	PainChance "SuperKick", 255
	DamageFactor "Leg", 0.0
	DamageFactor "BlueBloodSplasher", 0.0
    DamageFactor "BlueSuperBloodSplasher", 0.0
    States
    {
		//***Che // this is a descendant of FBD_CurbstompedMarine, which is neither a missile nor a monster
		Spawn:
			F5T2 D 8
			TNT1 A 0 A_CustomMissile ("Brutal_LiquidBlood3", 28, 1, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			F5T2 G 8 A_PlaySound("Volcabus/pain", CHAN_VOICE)
			TNT1 A 0 A_CustomMissile ("Brutal_LiquidBlood3", 28, -1, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			F5T2 D 8
			TNT1 A 0 A_CustomMissile ("Brutal_LiquidBlood3", 28, 1, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			F5T2 G 8
			TNT1 A 0 
			TNT1 A 0 A_CustomMissile ("Brutal_LiquidBlood3", 28, -1, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			F5T2 D 8
			TNT1 A 0 A_CustomMissile ("Brutal_LiquidBlood3", 28, 1, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			F5T2 G 8
			TNT1 A 0 A_CustomMissile ("Brutal_LiquidBlood3", 28, -1, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			F5T2 D 8
			TNT1 A 0 A_CustomMissile ("Brutal_LiquidBlood3", 28, 1, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			F5T2 G 8 A_PlaySound("Volcabus/pain", CHAN_VOICE)
			TNT1 A 0 A_CustomMissile ("Brutal_LiquidBlood3", 28, -1, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			F5T2 D 8
			TNT1 A 0 A_CustomMissile ("Brutal_LiquidBlood3", 28, 1, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			F5T2 G 8
			TNT1 A 0 A_CustomMissile ("Brutal_LiquidBlood3", 28, -1, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			F5T2 D 8
			TNT1 A 0 A_CustomMissile ("Brutal_LiquidBlood3", 28, 1, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			F5T2 G 8 A_PlaySound("Volcabus/pain", CHAN_VOICE)
			TNT1 A 0 A_CustomMissile ("Brutal_LiquidBlood3", 28, -1, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			F5T2 D 8
			TNT1 A 0 A_CustomMissile ("Brutal_LiquidBlood3", 28, 1, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			F5T2 G 8
			TNT1 A 0 A_CustomMissile ("Brutal_LiquidBlood3", 28, -1, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			F5T2 D 4
			Goto collapse
		Stay: // ancestor's Pain.Kick, Pain.ExplosiveImpact and Pain.Trample redirect here after z-thrusting the actor
			TNT1 A 0
			Goto Collapse
 		Collapse:
			TNT1 A 0
			TNT1 A 0 A_ChangeFlag("Shootable", 0)
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_ChangeFlag("CORPSE", 1)
			TNT1 A 0 A_PlaySound("Volcabus/death", CHAN_VOICE)
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			TNT1 A 0 ACS_NamedExecuteAlways("FBD_CheckFloorIsLava_V", 0, 0, 0, 0) // also spawns smoke for 30 tics if succeeds
			F5T2 F 30
			TNT1 A 0 A_JumpIf(user_floor_is_lava, "LandOnLava")	

			TNT1 A 0 A_ChangeFlag("CORPSE", 1)
			TNT1 A 0 A_ChangeFlag("ISMONSTER", 0)
			F5T2 F -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop

		Death:
			TNT1 A 0 A_XScream
			TNT1 A 0 A_NoBlocking
			TNT1 AAAAAA 0 A_CustomMissile ("Brains1", 28, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAA 0 A_CustomMissile ("Brains2", 28, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("Brains3", 28, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAAA 0 A_CustomMissile ("Brains6", 28, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("Brains7", 28, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAA 0 A_CustomMissile ("XDeath1", 26, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 360))
			TNT1 AAA 0 A_CustomMissile ("XDeath1", 27, 0, random (0, 360), CMF_AIMDIRECTION, random (30, 150))
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			F5T2 HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH 2 A_CustomMissile ("Brutal_LiquidBlood3", 10, 12, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 A 0 ACS_NamedExecuteAlways("FBD_CheckFloorIsLava_V", 0, 0, 0, 0) // also spawns smoke for 30 tics if succeeds
			F5T2 H 30
			TNT1 A 0 A_JumpIf(user_floor_is_lava, "LandOnLava")

			TNT1 A 0 A_ChangeFlag("CORPSE", 1)
			TNT1 A 0 A_ChangeFlag("ISMONSTER", 0)			
			F5T2 H -1 ACS_NamedExecuteAlways("RespawnCorpseAfter60sIfNightmare", 0, 0, 0, 0)
			Stop
	}
}

ACTOR VolcabusBall
{
	Game Doom
	Radius 6
	Height 6
	Speed 27
    Fastspeed 32
	Damage (random(100,100))
	Projectile 
    Scale 0.85
	+FORCEXYBILLBOARD
	+THRUGHOST
	RenderStyle Translucent
    DamageType ExplosiveImpact
	ExplosionRadius 150
	ExplosionDamage 8
	Alpha 1
	Decal "Scorch"
	SeeSound "Volcabus/Cannon"
	DeathSound "Monster/hadsit"
	
	//***Che
	-NOBLOCKMAP // without this, A_RadiusGive does not see them 
	 // and so projectile-destroying effects do not work
	 // see Demon EleTech gun's ligtning element alt fire. 			
	
	States
	{
		Spawn:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteAlways("BDCheckJanitor", 0, 0, 0, 0)//Check Effects
		
		Spawn1:
			TNT1 A 0 A_JumpIfInventory("lowgraphicsmode", 1, "SpawnCheap")
			S4BA A 1 BRIGHT A_SpawnItem("RedFlare22")
			//TNT1 A 0 A_SpawnItemEx ("ObeliskTrailSpark",random(5,-5), random(5,-5),0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			S4BA A 1 BRIGHT A_SpawnItem("RedFlare22")
			//TNT1 A 0 A_SpawnItemEx ("ObeliskTrailSpark",random(5,-5), random(5,-5),0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			
			S4BA B 1 BRIGHT A_SpawnItem("RedFlare22")
			//TNT1 A 0 A_SpawnItemEx ("ObeliskTrailSpark",random(5,-5), random(5,-5),0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			
			S4BA B 1 BRIGHT A_SpawnItem("RedFlare22")
			//TNT1 A 0 A_SpawnItemEx ("ObeliskTrailSpark",random(5,-5), random(5,-5),0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			Loop
			
		SpawnCheap:
			S4BA AB 2 BRIGHT A_SpawnItem("RedFlare22")
			Loop	
			
		Death:
			TNT1 A 0 A_ChangeFlag("NOGRAVITY", 0)
			TNT1 A 0 A_Explode(14, 55, 0)
			Goto ExplosionEffect
		
		ExplosionEffect:
			TNT1 A 0
			TNT1 AAAA 0 A_SpawnItemEx ("ExplosionFlareSpawner",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 0 BRIGHT A_SpawnItem("RedFlare22")
			TNT1 A 0 A_SpawnItem("WhiteShockwaveSmall")
			EXPL A 0 A_CustomMissile ("ExplosionSmoke", 0, 0, random (0, 360), 2, random (0, 360))
			TNT1 A 0 A_SpawnItemEx ("UnderwaterExplosion",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 0 A_SpawnItemEx ("DetectFloorCrater",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 0 A_SpawnItemEx ("DetectCeilCrater",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 0 A_SpawnItemEx ("ExplosionFlareSpawner",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 AAA 0 A_CustomMissile ("BDExplosionparticlesSmall", 10, 0, random (0, 180), 2, random (40, 90))
			EXPL A 0
			TNT1 AAAA 0 A_CustomMissile ("SmallExplosionFlames", 0, 0, random (0, 360), 2, random (0, 360))
			Stop
		
	}
}

/*
Actor VolcabusBallSfest: VolcabusBall
{
	//TODO: implement!
}
*/










ACTOR XDeathVolcabusArm: XDeathArm1
{
    +SKYEXPLODE
	-CLIENTSIDEONLY
    Scale 1.2
    Speed 9
	Gravity 0.4
	BounceFactor 0.4
    States
    {
		Spawn:
			TNT1 A 0 A_JumpIf(waterlevel > 1, "Death")
			VOLA ABCDEFGH 3
			Loop
		Death:
			TNT1 A 0 A_SpawnItem("Brutal_BloodSpot",0,0,0,1)
			VOLA I -1
			Stop
    }
}
