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


#include SYNTH_mon.txt
#include FBD_Uberzoldat.txt



Actor NaziBoltActionTracer: ZombieManTracer
{
	DamageType "Bullet792"
	damage (random(35,35))
	Speed 300
}

//***TODO: will be reborn as a synth monster
/*
ACTOR ZandronumWolfensteinSS
{
	Game Doom
	SpawnID 116
	Health 50
	Radius 20
	Height 56
	Speed 8
	PainChance 170
	Monster
	+FLOORCLIP
	SeeSound "wolfss/sight"
	PainSound "wolfss/pain"
	DeathSound "wolfss/death"
	ActiveSound "wolfss/active"
	AttackSound "wolfss/attack"
	Obituary "$OB_WOLFSS"
	Dropitem "Clip"
	States
	{
	Spawn:
		SSWV AB 10 A_Look
		Loop
	See:
		SSWV AABBCCDD 3 A_Chase
		Loop
	Missile:
		SSWV E 10 A_FaceTarget
		SSWV F 10 A_FaceTarget
		SSWV G 4 BRIGHT A_CPosAttack
		SSWV F 6 A_FaceTarget
		SSWV G 4 BRIGHT A_CPosAttack
		SSWV F 1 A_CPosRefire
		Goto Missile+1
	Pain:
		SSWV H 3
		SSWV H 3 A_Pain
		Goto See
	Death:
		SSWV I 5
		SSWV J 5 A_Scream
		SSWV K 5 A_NoBlocking
		SSWV L 5
		SSWV M -1
		Stop
	XDeath:
		SSWV N 5 
		SSWV O 5 A_XScream
		SSWV P 5 A_NoBlocking
		SSWV QRSTU 5
		SSWV V -1
		Stop
	Raise:
		SSWV M 5
		SSWV LKJI 5
		Goto See 
	}
}
*/
ACTOR Nazi: AbstractSynthMonster 2549 //ZandronumWolfensteinSS 2549
{
	//***Che radius, height and maxdropoffheight (n/a for flying ones) MUST be kept consistent with FBD_TrySpawn in FBD_CORE.acs!
	
	//$category "FBD Monsters"
	Game Doom
	Health 50
    GibHealth 35
	Radius 16
	Height 44
	Mass 100
	Speed 6
	PainChance 170
	Monster
	+FLOORCLIP
	+MISSILEMORE
	-FASTER
	Species "Nazis"
	-DONTHURTSPECIES
    BloodType "FBD_Blood", "BloodSPlatterReplacer", "FBD_SawBlood" 
	SeeSound "nazi/sight"
	AttackSound "MP40"
	PainSound "nazi/pain" //"none"
	DeathSound "nazi/death"
	Tag "$FBD_NAZI" // "Nazi";
	Obituary "$FBD_NAZI_O" //"%o was terminated by a Nazi.";
	DamageFactor "ExtremePunches", 2.0
	DropItem "None"
	DamageFactor "Melee", 2.0
	DamageFactor "KillMe", 0.0 // ignore captured marines
	DamageFactor "SSG", 10.0
	PainChance "Melee", 255 PainChance "Stealth", 255
	damagefactor "PussyGrab", 50.0
	DamageFactor "CauseSplash", 0.0 DamageFactor "CauseObjectsToSplashSlime", 0.0 DamageFactor "CauseObjectsToSplashNukage", 0.0
	DamageFactor "CauseObjectsToSplashBlood", 0.0 DamageFactor "CauseObjectsToSplashLava", 0.0
	MaxStepHeight 24
	MaxDropOffHeight 32
	DeathHeight 4
	BurnHeight 0
	damagefactor "Blood", 0.0 damagefactor "BlueBlood", 0.0 damagefactor "GreenBlood", 0.0
	
	//***Che : i was testing map 42 Wolfenstein when they suddenly started dropping like flies after teleporting!
	damagefactor "GibRemoving", 0.0
	damagefactor "TeleportRemover", 0.0

/*
	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; 
*/	
	/* 
		a packed value: 
		bits 0..7 =x+128, clamped to -128..127
		bits 8..15 =y+128, clamped to -128..127
		bits 16..23 =z, clamped to 1..255
		bit 29 is a command to assume an unique TID, used in monster-on-monster headshotting
		A zero value is a command to terminate
	*/			
	//var int user_sleeping;
	//var int user_item_no;
	//var int user_serverside_sfchk;
	
	
	
	PainChance "Argent", 255
	DamageFactor "Argent", 1.0
	PainChance "PlummetAaah", 0 // bottomless pits in Chebskies-EDAY
	DamageFactor "PlummetAaah", 50.0 // doesn't scream, just dies		
	
	PainChance "Ice", 64
	
	//***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
		
		Death.PlummetAaah:
			TNT1 A 0 A_StopSound(CHAN_VOICE)
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_CustomMissile ("FBD_ThrowedNazi", 0, 0, 0, CMF_AIMDIRECTION, -90)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0) // give the scripts and actors time to run and access us
			Stop		
		WaitTargetsFatalityOut:
			NAZI AAA 10 A_SetAngle(angle + Random(-35, 35))
			Goto See
		Spawn:
			NAZI A 2 
			"----" A 0 A_JumpIf(CallAcs("GetIsEDAY") && !CallAcs("GetPotPourri"), "SpawnNormally") // in Chebskies-EDAY, no variations
		SpawnVaried:
			"----" A 0 A_Jump(32, "UberSniperSwap")
			Goto SpawnNormally
		UberSniperSwap:
			TNT1 A 0 A_JumpIf(CallAcs("GetIsEDAY") && !CallAcs("GetPotPourri"), 2)
			TNT1 A 0 A_Jump(16, "UberZoldatSwap")
			TNT1 A 0 A_ChangeFlag("THRUACTORS", 1)
			TNT1 A 0 A_ChangeFlag("COUNTKILL", 0)
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_SpawnItemEx ("FBD_UberSniper",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION | SXF_TRANSFERAMBUSHFLAG | SXF_TRANSFERPOINTERS | SXF_TRANSFERSPECIAL | SXF_CLEARCALLERSPECIAL | SXF_CLEARCALLERTID  ,0, tid)
			TNT1 A 30
			Stop
		UberZoldatSwap:
			TNT1 A 0 A_ChangeFlag("THRUACTORS", 1)
			TNT1 A 0 A_ChangeFlag("COUNTKILL", 0)
			//***Che: A_NoBlocking makes it drop items! Which we do not want in this case. Replacing with resetting flags manually:
			//TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_ChangeFlag("SHOOTABLE", 0)
			TNT1 A 0 A_ChangeFlag("SOLID", 0)
			TNT1 A 0 A_SpawnItemEx ("FBD_UberZoldat",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION | SXF_TRANSFERAMBUSHFLAG | SXF_TRANSFERPOINTERS | SXF_TRANSFERSPECIAL | SXF_CLEARCALLERSPECIAL | SXF_CLEARCALLERTID  ,0, tid)
			TNT1 A 30
			Stop
		
		SpawnNormally:
			"----" A 0 ACS_NamedExecuteWithResult("FBD_RunMonster", 5) // uses default headbox
			"----" A 0 A_GiveInventory("TargetIsAFormerHuman", 1) //used by AOE DOT inflictors to reward players with soul ammo -- otherwise untraceable
			"----" A 0 A_SetUserVar("user_default_weapon", 34) // a regular mp-40 nazi
			"----" A 0 A_SetUserVar("user_melee_weapon", 34)
			
			Goto SetupDefaults	
		
		SetupDefaults:
			"----" A 0
			// uses default headbox
			"----" A 0 A_SetUserVar("user_nag_period", 0) // never use
			"----" A 0 A_SetUserVar("user_footstep_mask", 2 | 8) // footsteps on synth frames 2 and 4
			"----" A 0 A_SetUserVar("user_speed_limit", 6) // strafing speed, map units per tic. May overshoot it briefly. It's meaningles to set it below monster's Speed because when monster detects he's moving too fast he'd switch to using A_Wander sideways, which makes him move at precisely Speed map units per tic.
			
			"----" A 1
			"----" A 0 A_ChangeFlag("NOPAIN", 0)
			Goto WeaponSwitch // will proceed to Stand			
		
		Stand:
			NAZI A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 6, 1, 42)
			NAZI AAAAAAAA 10 A_Look
			Loop
		
		Idle: // without this, the game engine puts him into his Spawn state when he loses target 
				//-- and that wrecks havok with the init scripts!
			TNT1 A 0
			TNT1 A 0 A_ClearTarget
			TNT1 A 0 A_GiveInventory("SKNazi", 1)
			Goto SynthIdle

		AnimFrameJ:
			NAZW A 1 
			Goto WeaponPhase
		AnimFrame1:
			NAZW A 1
			Goto WeaponPhase
		AnimFrame2:
			NAZW B 1
			Goto WeaponPhase
		AnimFrame3:
			NAZW C 1
			Goto WeaponPhase
		AnimFrame4:
			NAZW D 1
			Goto WeaponPhase

		WpnFire_MonsterDefined:
			"----" A 0 A_SpawnItemEx("PlayerMuzzle2", 28,6,user_muzzle_z, 0,0,0, 0,SXF_NOCHECKPOSITION)
			
			"----" A 0 A_PlaySound("MP40", CHAN_WEAPON)
			"----" A 0 A_SpawnItem ("RifleCaseSpawn", 0, 30,0)

			"----" A 0 A_CustomMissile("ZombieManTracer", user_muzzle_z, 0, angle + 0.1 * Random(-20, 20), CMF_ABSOLUTEANGLE | (user_best_d ? CMF_AIMDIRECTION : CMF_OFFSETPITCH) | CMF_SAVEPITCH, (user_best_d ? user_best_p * 0.005493164 : 0) + 0.1 * Random(-20, 20)) 
			"----" A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), "WeaponAfterFiring")
			"----" A 0 A_JumpIfTargetInLOS(1, 0, JLOSF_DEADNOJUMP) 
			Goto WeaponAfterFiring
			"----" A 0 A_Jump(96, "OneMoreShot")
			Goto WeaponAfterFiring	

		Pain_MonsterDefined:
			"----" A 0
			"----" A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", -4, -3, 41)
			"----" A 0 A_PlaySOund("nazi/pain", CHAN_VOICE)
			"----" A 0 A_TakeInventory("SKNazi", 1)
			NAZI G 6 A_Pain			
			Goto PainContinue

		Pain.Argent:
			"----" A 0
			"----" A 0 HealThing(100)
			"----" A 0 ACS_NamedExecuteWithResult("DisplayArgentDischarge", 10, 40, 0)
			Goto PainActually
			
			
	
			


/*
		See:
			NAZI A 0
			NAZI A 0 A_TakeInventory("SKNazi", 1)
			TNT1 A 0 A_Jump(64, "See2")
			TNT1 A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), "MaybeLoseInvisibleTarget")
			TNT1 A 0 A_JumpIfTargetInLOS("ChaseAggressively")
			//TNT1 A 0 A_CheckSight("See2") // this controlled by having LOS to players, not to target.
			Goto See2
		MaybeLoseInvisibleTarget:
			TNT1 A 0
			TNT1 A 0 A_Jump(32, "Idle")
			Goto See2
		ChaseAggressively:	
			TNT1 A 0 A_Jump(32, "MissileWalkingFrontWard")
			
			// walking with weapon held at ready
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 3, 3, 38)
			TNT1 A 0 A_SpawnItemEx("FootStep", 0, 0, 20, 0, 0)
			
			NAZW A 1 A_FaceTarget
			NAZW A 2 A_Chase("","") //A_Recoil(-1)
			NAZW A 0 A_Chase
			
			
			NAZW B 1 A_FaceTarget
			NAZW B 2 A_Chase("","") //A_Recoil(-1)
			NAZW A 0 A_Chase
			
			TNT1 A 0 A_SpawnItemEx("FootStep", 0, 0, 20, 0, 0)
			
			NAZW C 1 A_FaceTarget
			NAZW C 2 A_Recoil(-1)
			NAZW A 0 A_Chase
			
			
			NAZW D 1 A_FaceTarget
			NAZW D 2 A_Chase("","") //A_Recoil(-1)
			NAZW A 0 A_Chase
			
			TNT1 A 0 A_ChangeFlag("NODROPOFF", 0)
			
			Loop
			
		See2:
		
			// walking with weapon held at ease
		
			TNT1 A 0 A_TakeInventory("SKNazi", 1)
			TNT1 A 0 A_SpawnItemEx("FootStep", 0, 0, 20, 0, 0)
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 6, 1, 42)
			NAZI AAAA 1 A_Chase("","")
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 7, 2, 43)
			NAZI BBBB 1 A_Chase("","")
			
			TNT1 A 0 A_SpawnItemEx("FootStep", 0, 0, 20, 0, 0)
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 5, 1, 42)
			NAZI CCCC 1 A_Chase("","")
			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 7, 2, 43)
			NAZI BBBBB 1 A_Chase
			
			TNT1 A 0 A_ChangeFlag("NODROPOFF", 0)
			
			Goto See
			
		Missile:
			TNT1 A 0 A_TakeInventory("SKNazi", 1)
			
			TNT1 A 0 A_JumpIfInTargetInventory("GoFatality", 1, "WaitTargetsFatalityOut")
			
			TNT1 A 0 A_JumpIfInventory("IsASniper", 1, "Missile_Sniper")
			
			
			TNT1 A 0 A_Jump(32, "MissileWalkingFrontWard")
			TNT1 A 0 A_Jump(64, "MissileWalkingRight", "MissileWalkingLeft")
			
			// a bobblehead, he is not. Holds his gun and his head perfectly steady
			// while walking in this posture
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 3, 3, 36)
			
			NAZI E 8 A_FaceTarget
			
			NAZI F 2 BRIGHT A_CustomMissile("ZombieManTracer", 38, 0, random(-2, 2), 1)
			TNT1 A 0 A_PlaySound("MP40")
			
			TNT1 A 0 A_SpawnItem ("RifleCaseSpawn", 0, 30,0)
			NAZI E 2 A_FaceTarget
			
			NAZI F 2 BRIGHT A_CustomMissile("ZombieManTracer", 38, 0, random(-2, 2), 1)
			TNT1 A 0 A_PlaySound("MP40")
			
			TNT1 A 0 A_SpawnItem ("RifleCaseSpawn", 0, 30,0)
			NAZI E 2 A_FaceTarget
			
			NAZI F 2 BRIGHT A_CustomMissile("ZombieManTracer", 38, 0, random(-2, 2), 1)
			TNT1 A 0 A_PlaySound("MP40")
			
			TNT1 A 0 A_SpawnItem ("RifleCaseSpawn", 0, 30,0)
			NAZI E 2 A_FaceTarget
			
			NAZI F 2 BRIGHT A_CustomMissile("ZombieManTracer", 38, 0, random(-2, 2), 1)
			TNT1 A 0 A_PlaySound("MP40")
			
			TNT1 A 0 A_SpawnItem ("RifleCaseSpawn", 0, 30,0)
			NAZI E 6 A_FaceTarget
			Goto See
			
		MissileWalkingFrontward:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 3, 3, 38)
			TNT1 A 0 A_ChangeFlag("NODROPOFF", 0)		
			TNT1 A 0 A_SpawnItemEx("FootStep", 0, 0, 20, 0, 0)
			
			//**Che: Im not adjusting firing algorithms here because these bursts are too *short*.
			// 4 tics per bullet, 16 tics burst length -- it's half a second. 
			// You can't change your movement direction  meaningfully in half a second.
			
			NAZW A 1 A_FaceTarget
			NAZW A 1 A_Chase("","") //A_Recoil(-1) //In Zandronum, A_Wander has no parameters so its behavior cannot be adjusted because it supports NO flags.
			TNT1 A 0 A_PlaySound("MP40")
			NAZW F 1 BRIGHT A_CustomMissile("ZombieManTracer", 38, 0, random(-2, 2), 1)
			TNT1 A 0 A_SpawnItem ("RifleCaseSpawn", 0, 30,0)
			NAZW F 1 BRIGHT A_Chase("","") //A_Recoil(-1)
			TNT1 A 0 A_SpawnItemEx("FootStep", 0, 0, 20, 0, 0)
			
			NAZW C 1 A_FaceTarget
			NAZW C 1 A_Chase("","") //A_Recoil(-1)
			TNT1 A 0 A_PlaySound("MP40")
			NAZW E 1 BRIGHT A_CustomMissile("ZombieManTracer", 38, 0, random(-2, 2), 1)
			TNT1 A 0 A_SpawnItem ("RifleCaseSpawn", 0, 30,0)
			NAZW E 1 BRIGHT A_Chase("","") //A_Recoil(-1)
			
			TNT1 A 0 A_SpawnItemEx("FootStep", 0, 0, 20, 0, 0)
			
			NAZW A 1 A_FaceTarget
			NAZW A 1 A_Chase("","") //A_Recoil(-1)
			TNT1 A 0 A_PlaySound("MP40")
			NAZW F 1 BRIGHT A_CustomMissile("ZombieManTracer", 38, 0, random(-2, 2), 1)
			TNT1 A 0 A_SpawnItem ("RifleCaseSpawn", 0, 30,0)
			NAZW F 1 BRIGHT A_Recoil(-1)
			TNT1 A 0 A_SpawnItemEx("FootStep", 0, 0, 20, 0, 0)
			
			NAZW C 1 A_FaceTarget
			NAZW C 1 A_Chase("","") //A_Recoil(-1)
			TNT1 A 0 A_PlaySound("MP40")
			NAZW E 1 BRIGHT A_CustomMissile("ZombieManTracer", 38, 0, random(-2, 2), 1)
			TNT1 A 0 A_SpawnItem ("RifleCaseSpawn", 0, 30,0)
			NAZW E 1 BRIGHT A_Chase("","") //A_Recoil(-1)
			Goto See
			
			
		MissileWalkingLeft:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 3, 3, 38)
			TNT1 A 0 A_ChangeFlag("NODROPOFF", 1)
			TNT1 A 0 A_SpawnItemEx("FootStep", 0, 0, 20, 0, 0)
			
			NAZW A 1 A_FaceTarget
			TNT1 A 0 ThrustThing(angle*256/360+192, 2, 0, 0)
			NAZW A 1 A_Recoil(-1)
			TNT1 A 0 A_PlaySound("MP40")
			NAZW F 1 BRIGHT A_CustomMissile("ZombieManTracer", 38, 0, random(-4, 4), 1)
			TNT1 A 0 A_SpawnItem ("RifleCaseSpawn", 0, 30,0)
			TNT1 A 0 ThrustThing(angle*256/360+192, 2, 0, 0)
			NAZW F 1 BRIGHT A_Recoil(-1)
			TNT1 A 0 A_SpawnItemEx("FootStep", 0, 0, 20, 0, 0)
			
			NAZW C 1 A_FaceTarget
			TNT1 A 0 ThrustThing(angle*256/360+192, 2, 0, 0)
			NAZW C 1 A_Recoil(-1)
			TNT1 A 0 A_PlaySound("MP40")
			NAZW E 1 BRIGHT A_CustomMissile("ZombieManTracer", 38, 0, random(-4, 4), 1)
			TNT1 A 0 A_SpawnItem ("RifleCaseSpawn", 0, 30,0)
			TNT1 A 0 ThrustThing(angle*256/360+192, 2, 0, 0)
			NAZW E 1 BRIGHT A_Recoil(-1)
			
			TNT1 A 0 A_SpawnItemEx("FootStep", 0, 0, 20, 0, 0)
			
			NAZW A 1 A_FaceTarget
			TNT1 A 0 ThrustThing(angle*256/360+192, 2, 0, 0)
			NAZW A 1 A_Recoil(-1)
			TNT1 A 0 A_PlaySound("MP40")
			NAZW F 1 BRIGHT A_CustomMissile("ZombieManTracer", 38, 0, random(-4, 4), 1)
			TNT1 A 0 A_SpawnItem ("RifleCaseSpawn", 0, 30,0)
			NAZW F 1 BRIGHT A_Recoil(-1)
			TNT1 A 0 A_SpawnItemEx("FootStep", 0, 0, 20, 0, 0)
			
			NAZW C 1 A_FaceTarget
			TNT1 A 0 ThrustThing(angle*256/360+192, 2, 0, 0)
			NAZW C 1 A_Recoil(-1)
			TNT1 A 0 A_PlaySound("MP40")
			NAZW E 1 BRIGHT A_CustomMissile("ZombieManTracer", 38, 0, random(-4, 4), 1)
			TNT1 A 0 A_SpawnItem ("RifleCaseSpawn", 0, 30,0)
			TNT1 A 0 ThrustThing(angle*256/360+192, 2, 0, 0)
			NAZW E 1 BRIGHT A_Recoil(-1)
			Goto See	
			
		MissileWalkingRight:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 3, 3, 38)
			TNT1 A 0 A_ChangeFlag("NODROPOFF", 1)
			TNT1 A 0 A_SpawnItemEx("FootStep", 0, 0, 20, 0, 0)
			
			NAZW A 1 A_FaceTarget
			TNT1 A 0 ThrustThing(angle*256/360+64, 2, 0, 0)
			NAZW A 1 A_Recoil(-1)
			TNT1 A 0 A_PlaySound("MP40")
			NAZW F 1 BRIGHT A_CustomMissile("ZombieManTracer", 38, 0, random(-4, 4), 1)
			TNT1 A 0 A_SpawnItem ("RifleCaseSpawn", 0, 30,0)
			TNT1 A 0 ThrustThing(angle*256/360+64, 2, 0, 0)
			NAZW F 1 BRIGHT A_Recoil(-1)
			TNT1 A 0 A_SpawnItemEx("FootStep", 0, 0, 20, 0, 0)
			
			NAZW C 1 A_FaceTarget
			TNT1 A 0 ThrustThing(angle*256/360+64, 2, 0, 0)
			NAZW C 1 A_Recoil(-1)
			TNT1 A 0 A_PlaySound("MP40")
			NAZW E 1 BRIGHT A_CustomMissile("ZombieManTracer", 38, 0, random(-4, 4), 1)
			TNT1 A 0 A_SpawnItem ("RifleCaseSpawn", 0, 30,0)
			TNT1 A 0 ThrustThing(angle*256/360+64, 2, 0, 0)
			NAZW E 1 BRIGHT A_Recoil(-1)
			
			TNT1 A 0 A_SpawnItemEx("FootStep", 0, 0, 20, 0, 0)
			
			NAZW A 1 A_FaceTarget
			TNT1 A 0 ThrustThing(angle*256/360+64, 2, 0, 0)
			NAZW A 1 A_Recoil(-1)
			TNT1 A 0 A_PlaySound("MP40")
			NAZW F 1 BRIGHT A_CustomMissile("ZombieManTracer", 38, 0, random(-4, 4), 1)
			TNT1 A 0 A_SpawnItem ("RifleCaseSpawn", 0, 30,0)
			NAZW F 1 BRIGHT A_Recoil(-1)
			TNT1 A 0 A_SpawnItemEx("FootStep", 0, 0, 20, 0, 0)
			
			NAZW C 1 A_FaceTarget
			TNT1 A 0 ThrustThing(angle*256/360+64, 2, 0, 0)
			NAZW C 1 A_Recoil(-1)
			TNT1 A 0 A_PlaySound("MP40")
			NAZW E 1 BRIGHT A_CustomMissile("ZombieManTracer", 38, 0, random(-4, 4), 1)
			TNT1 A 0 A_SpawnItem ("RifleCaseSpawn", 0, 30,0)
			TNT1 A 0 ThrustThing(angle*256/360+64, 2, 0, 0)
			NAZW E 1 BRIGHT A_Recoil(-1)
			Goto See

		Missile_Sniper:
			// while walking in this posture
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 3, 3, 36)
			
			NAZI E 8 A_FaceTarget
			
			NAZI F 2 BRIGHT A_CustomMissile("NaziBoltActionTracer", 38, 0, 0.1 * random(-6, 6), 1)
			TNT1 A 0 A_PlaySound("m14FIRE", CHAN_WEAPON)
			TNT1 A 0 A_PlaySound("FARM14")
		
			NAZI E 6 A_FaceTarget

			NAZI C 8 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 5, 1, 42)
			TNT1 A 0 A_PlaySound("RELO4")
			TNT1 A 0 A_SpawnItem ("RifleCaseSpawn", 0, 30,0)			
			
			Goto See			
*/			
			
		Pain:
			TNT1 A 0
			TNT1 A 0 A_ChangeFlag(GHOST, 0)
			TNT1 A 0 A_TakeInventory("SKNazi", 1)
			Goto SynthPain
/*			
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", -4, -3, 41)
			TNT1 A 0 A_PlaySOund("nazi/pain", CHAN_VOICE)
			TNT1 A 0 A_TakeInventory("SKNazi", 1)
			NAZI G 3 A_Pain
			
			//***Che: was causing them shooting into a wall if something else hurt them when target was out of sight
			TNT1 A 0 A_Jump(128, "MaybeRetaliate") //"MissileWalkingRight", "MissileWalkingLeft")
			NAZI G 3 
			//TNT1 A 0 A_Jump(128, "Respawned") //***Che: this was commented out as far back as BD18a.
			TNT1 A 0
			Goto See
			
		MaybeRetaliate:
			TNT1 A 0 A_JumpIfTargetInLOS(1)
			Goto See
			TNT1 A 0 A_Jump(256, "MissileWalkingRight", "MissileWalkingLeft")
			Wait
*/		
		//***Che	
		Pain.Argent:
			TNT1 A 0
			TNT1 A 0 A_ChangeFlag(GHOST, 0)
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", -4, -3, 41)
			TNT1 A 0 A_PlaySOund("nazi/pain", CHAN_VOICE)
			TNT1 A 0 A_TakeInventory("SKNazi", 1)
			
			TNT1 A 0 HealThing(15)
			
			NAZI GG 8 A_Pain
			//TNT1 A 0 A_Jump(64, "Missile") // results in spraying in a random direction if target is out of sight
			
			Goto See
/*	//***Che: unused since BD18a or earlier, commenting this out.	
		Respawned:
			TNT1 A 0 
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_ChangeFlag(FRIENDLY, 1)
			TNT1 A 0 A_SpawnItem("NaziChecker")
			TNT1 A 0
			Stop
*/			
		
		Pain.Killme:
		Pain.Taunt:
			TNT1 A 0
			TNT1 A 0 HealThing(1)
			Goto Missile
			
		Pain.Melee:
		Pain.Fatality:
			TNT1 A 0 A_ChangeFlag(GHOST, 0)
			NAZI G 3 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", -4, -3, 41)
			TNT1 A 0 A_JumpIfInventory ("SKNazi", 1, "StealthKill")
			
			Goto SynthPain
/*			
			NAZI G 3 A_Pain
			Goto See
*/			
		
		Pain.Stealth:
			TNT1 A 0
			TNT1 A 0 A_Pain
			TNT1 A 0 A_JumpIfInventory ("SKNazi", 1, "StealthKill")
			TNT1 A 0 A_JumpIfInventory ("IsDown", 1, "GroundExecution")
			Goto See
			
		GroundExecution:
			TNT1 A 0 A_NoBlocking
			//TNT1 A 0 A_GiveToTarget("ExecuteDownedNazi", 1)
			TNT1 A 0 A_GiveToTarget("GoSpecial", 1)
			Stop
		
		Death:
			TNT1 A 0
			TNT1 A 0 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			NAZI H 5
			NAZI I 5 A_Scream
		DeathContinue:	
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")			
			NAZI J 5 A_NoBlocking
			NAZI K 5 A_SpawnItem("MP40Drop")
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			NAZI L -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.Electric:				
			TNT1 A 0
			TNT1 A 0 A_SpawnItem("BarrelExplosionSmokeColumn")
			Goto DeathContinue				
			
			
			
		Death.Melee:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_JumpIfInventory ("SKNazi", 1, "StealthKill")
			NAZI H 5
			NAZI I 5 A_Scream
			NAZI J 5 A_NoBlocking
			NAZI K 5 A_SpawnItem("MP40Drop")
			NAZI L -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.Psionic:
		
		Death.head:
		Death.HeadStun:
		Death.Decaptate:
		Death.CCFT:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")		
			TNT1 A 0 A_SpawnItem("NaziHeadExplode", 0, 50)
			TNT1 A 0 A_NoBlocking
			NAZH AAAAABBBBBBBBBBCCCCC 2 A_CustomMissile ("Brutal_LiquidBlood2", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (60, 120))
			NAZH DDDDEEEE 2 A_CustomMissile ("Brutal_LiquidBlood2", 10, 0, random (0, 360), CMF_AIMDIRECTION, random (60, 120))
			TNT1 A 0 A_SpawnItem("MP40Drop")
			NAZH EEEEEEEEEE 2 A_CustomMissile ("Brutal_LiquidBlood2", 5, 0, random (0, 360), CMF_AIMDIRECTION, random (10, 40))
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			NAZH 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.Stomp: //***Che
		XDeath.Stomp:
			// if 15% random chance or the cyberdemon is below us, be catapulted violently
			TNT1 A 0 A_JumpIf(Random(0,100) < 15 || CallAcs("GetZDeltaToTarget") < - 32, "Death.ExtremePunches") 
		XDeath:
		Death.Bfg10k: //***Che changed damage type from extreme to custom		
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")		
			TNT1 A 0 A_XScream
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_SpawnItem("MP40Drop")
			TNT1 A 0 A_CustomMissile ("SargeXDeath", 0, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("MuchBlood2", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			TNT1 AAA 0 A_CustomMissile ("MuchBlood", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
			
			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_NoBlocking
			TNT1 A 0 A_SpawnItem("MP40Drop")
			TNT1 AAAA 0 A_CustomMissile ("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))
			
			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.Desintegrate:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")		
			TNT1 A 0 A_XScream
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_SpawnItemEx("DesintegratedHuman", 0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION)
			TNT1 A 0 A_Stop
			TNT1 A 0 A_GiveToTarget("SoulAmmo", 1)
			TNT1 A 0 A_SpawnItem("MP40Drop")
			TGIB ABCDEFGHIJKLMNOPQ 3
			TGIB Q -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: 
		Death.Plasma2:
		XDeath.Electric:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_Stop
			PBR1 A 6 A_XScream
			TNT1 AAAA 0 A_CustomMissile ("BluePlasmaFireNonStatic", 42, 0, random (0, 360), 2, random (0, 180))
			TNT1 AAA 0 A_CustomMissile ("Blood", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 180))
			TNT1 AAAAAA 0 A_CustomMissile ("SuperGoreMistSmall", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (10, 90))
			TNT1 AAA 0 A_CustomMissile ("FBD_FlyingBlood", 32, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 180))
			PBR1 B 6 A_NoBlocking
			TNT1 A 0 A_SpawnItemEx ("DetectFloorCraterSmall",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 0 A_SpawnItem("BarrelExplosionSmokeColumn")
			TNT1 A 0 A_SpawnItemEx("TinyBurningPiece", random (-15, 15), random (-15, 15))
			TNT1 AA 0 A_SpawnItemEx("TinyBurningPiece2", random (-35, 35), random (-35, 35))
			TNT1 AA 0 A_SpawnItemEx("TinyBurningPiece3", random (-45, 45), random (-45, 35))
			TNT1 A 0 A_SpawnItem("MP40Drop")
			PBR1 CCDD 3 A_CustomMissile ("BluePlasmaFireNonStatic", 32, 0, random (0, 360), 2, random (0, 180))
			PBR1 EEFF 3
			PBR1 GG 3
			TNT1 A 0 A_GiveToTarget("SoulAmmo", 1)
			
			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	
		XDeath.Plasma:
		Death.SuperPlasma:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_XScream
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_SpawnItem("MP40Drop")
			XBRN AA 2 BRIGHT A_SpawnItem("BlueFlare",0,43)
			TNT1 AAAA 0 A_CustomMissile ("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))

			XBRN BB 2 BRIGHT A_SpawnItem("BlueFlare",0,43)
			TNT1 A 0 A_CustomMissile ("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_NoBlocking
			TNT1 A 0 A_SpawnItem("MP40Drop")
			TNT1 AAAA 0 A_CustomMissile ("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))
			
			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.Fire:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")		
			TNT1 A 0 A_PlaySound("BIGSCREA", CHAN_VOICE)
			BURN W 6 //A_Scream
			BURN X 6 A_NoBlocking
			TNT1 A 0 A_SpawnItem("MP40Drop")
			BUR2 ABCD 6 BRIGHT A_CustomMissile ("PlasmaSmoke", 8, 0, random (0, 180), 2, random (0, 180))
			BURN FGHIJKL 6 BRIGHT A_CustomMissile ("PlasmaSmoke", 8, 0, random (0, 180), 2, random (0, 180))
			BURN MNOPQRSTUV 6 BRIGHT A_CustomMissile ("PlasmaSmoke", 8, 0, random (0, 180), 2, random (0, 180))
			BURN VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV 6 A_CustomMissile ("PlasmaSmoke", 8, 0, random (0, 180), 2, random (0, 180))
			BURN V -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
		  
		Raise:
			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)
			NAZI L 5
			NAZI KJIH 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", 2012) // 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			
			
		Crush:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 AAAA 0 A_SpawnItemEx ("BodyRemovalThing",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
			TNT1 A 1 A_XScream
			TNT1 A -1 // be raiseable 
			Stop

		Pain.Killme:
		Pain.Taunt:
			TNT1 A 0
			TNT1 A 0 HealThing(1)
			Goto Missile
			
		Pain.Slide: // player backslide
			"----" A 0 A_Pain
			"----" A 0 A_SetUserVar("user_charge", 0)
			"----" A 0 A_SetUserVar("user_shots", 0)
			"----" A 0 A_SetUserVar("user_ambush", 0)
			"----" A 0 A_SetUserVar("user_shot_cooldown", 0)
			"----" A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", -3, -3, 42)
			
			"----" A 0 ThrustThingZ(0,50,0,1)
			TNT1 A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", -4, -3, 41)
			NAZI G 1 A_FaceTarget
			NAZI G 3 A_Recoil (-6)
			
			// without this, they reach Low Earth Orbit then splatter on landing
			"----" A 0 A_ChangeVelocity(velx, vely, 0, CVF_REPLACE)
			
			SAZI N 20 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 0, 30)
			SAZI NNNNNNNNNNNNNNNNNNNNNNN 5 A_CheckFloor("LandFromBackslide")
		LandFromBackslide:
			SAZI NNNO 6
			SAZI M 6 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 0, 37)
			Goto See

		Pain.Kick:
		Pain.Extremepunches:
		Pain.BlackHole: // ancient arachnotron
			"----" A 0
			"----" A 0 A_ChangeFlag("NODROPOFF", 0) // the *only* case he could be thrown off a cliff!			
			"----" A 0 A_Pain
			"----" A 0 A_SetUserVar("user_charge", 0)
			"----" A 0 A_SetUserVar("user_shots", 0)
			"----" A 0 A_SetUserVar("user_ambush", 0)
			"----" A 0 A_SetUserVar("user_shot_cooldown", 0)
			"----" A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", -3, -3, 42)
			"----" A 0 A_FaceTarget
			"----" A 0 A_Recoil(5)
			"----" A 0 ThrustThingZ(0, 30, 0, 1)
			SAZI M 16 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 0, 37)
			NAZI G 30 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", -4, -3, 41)
			
			"----" A 0 A_ChangeFlag("NODROPOFF", 1)
			Goto See			
		
		Death.Eat:
			TNT1 A 0 A_GiveToTarget("EatMe",1)
			Goto DeathContinue //Death+3
			Stop
			
		Death.ExtremePunches:
		Death.DHFT:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			//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 A_FaceTarget
			TNT1 A 0 A_CustomMissile ("ExtremePunchedNazi", 8, 0, random (175, 185), 2, random (10, 20))
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
			 
		Death.Blast:
		Death.SSG:
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")		
			SZD1 E 1 A_Pain
			TNT1 A 0 A_SpawnItem("Muchblood2", 0, 40)
			SZD1 E 1 A_FaceTarget
			
			TNT1 AAA 0 bright A_CustomMissile ("SuperGoreSpawner", 35, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			//TNT1 A 0 A_CustomMissile ("MeatDeath", 0, 0, random (0, 360), 2, random (0, 160))
			TNT1 AAAA 0 A_CustomMissile ("XDeath1", 32, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 A 0 A_CustomMissile ("XDeath2", 32, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 A 0 A_CustomMissile ("XDeath3", 32, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AAAA 0 A_CustomMissile ("FBD_FlyingBlood", 32, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AAA 0 A_CustomMissile ("Guts", 32, 0, random (150, 210), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AAAA 0 A_CustomMissile ("Brutal_FlyingBloodFaster", 32, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AAAA 0 A_CustomMissile ("Brutal_FlyingBloodMuchFaster", 32, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AAAA 0 A_CustomMissile ("SuperWallRedBlood", 32, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AAAA 0 A_CustomMissile ("SuperWallRedBlood", 46, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 AA 0 A_CustomMissile ("XDeathArm1", 32, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 A 0 A_CustomMissile ("XDeathSergeantHead", 32, 0, random (170, 190), CMF_AIMDIRECTION, random (0, 40))
			TNT1 A 0 A_XScream
			TNT1 A 0 A_SpawnItem("MP40Drop")
			TNT1 A 0 A_NoBlocking
			SZD1 EEFFGH 6
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			TNT1 A 0 A_SpawnItem("DeadShotgunguySZD1HNonRaiseable") //black clad legs only so you can't tell these are from a shotgun guy
			
			TNT1 A -1 // stay invisibly, be raiseable instead of the legs
			Stop
		
		StealthKill:
			TNT1 A 0
			TNT1 A 0 A_GiveToTarget("GoFatality", 1)
			TNT1 A 0 A_GiveToTarget("GoSpecial", 1)
			TNT1 A 0 A_GiveToTarget("SKNazi", 1)
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_Die("Stealthy")
			TNT1 A 0 A_Fall
			TNT1 A 0 A_SpawnItem("MP40Drop")
			TNT1 A 1
			Stop
		Death.Stealthy:
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			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("","")
			TNT1 A 0 A_Pain
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_GiveToTarget("GrabbedANazi", 1)
			TNT1 A 0 A_GiveToTarget("SoulAmmo", 1)
			TNT1 A 30 A_ChangeFlag("CORPSE", 0)
			Stop
			
		Death.Fatality:
			//***Che: was never implemented in BD21.
			// ersatz fatality: doomguy punches, we asplode, doomguy flexes
			TNT1 A 0 
			TNT1 A 0 A_NoBlocking
			
			TNT1 A 0 A_GiveToTarget("GoFatality", 1)
			TNT1 A 0 A_GiveToTarget("ErsatzFatality", 1)	
			
			// after exactly 15 tics, asplode
			
			NAZI G 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", -4, -3, 41)
			NAZI G 6 A_FaceTarget
			NAZI G 9 A_Pain
			
			TNT1 A 0 A_StopSound(CHAN_VOICE)
			
			TNT1 A 0 ACS_NamedExecuteAlways("DropFatalityBonuses", 0, 10, 15, 0) // 0, health, armor, 0
						
			Goto Death.SSG	

		Death.Ice: //***Che: this death was missing
		Death.Freeze:
		Death.Frost:
		Death.IOS_Frost: // has no permafrost
			TNT1 A 0
			TNT1 A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_SpawnItemEx("FrozenNazi",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 NaziRaisedByVile: Nazi {
	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
		
			NAZI LKJIH 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	
	
	}
}

/*	//***Che: unused since BD18a or earlier, commenting this out.

ACTOR NaziChecker: Nazi //Replaces WolfensteinSS
{
	// you need the code, look for the original BD21
}


ACTOR NaziSurrendered: Nazi
{
	// you need the code, look for the original BD21
}

*/