actor Victim replaces DeadDoomImp
{
	Game Doom
	Radius 16
	Height 50
	health 1
	Mass 1000
	painchance 75
	speed 0
	Monster
	+LOOKALLAROUND
	+MOVEWITHSECTOR
	+SOLID
	+NOTARGET
	AttackSound "BURSOPEN"
	BloodType "ATRedBlood"
	BloodColor "Red"
	States
	{
	Spawn:
		COCO A 1 A_look
		loop
	See:
	    COCO b 0 A_playsound("Killme")
		COCO b 4 
		COCO c 4
		COCO d 4
		COCO c 150
		TNT1 A 0 A_JumpIf(ACS_ExecuteWithResult(506,0,0,0) <= 80, "Melee")
		TNT1 A 0 A_Chase("") 
		loop
	Melee:
        TNT1 A 0 A_ChangeFlag("NOPAIN", True)
	    TNT1 A 0 A_JumpIfInventory("ChestOpen", 1, "Burster_Attack")
		COCO d 0 A_playsound("BURSOPEN")
		COCO d 3 A_FaceTarget
		COCO e 3
		COCO d 3
		COCO e 3
		COCO e 3
		COCO f 3
		COCO f 3
		COCO g 3
		COCO g 3
		COCO h 3
		COCO h 3
		TNT1 A 0 A_GiveInventory("ChestOpen", 1)
		TNT1 A 0 A_ChangeFlag("NOPAIN", False)
		Goto Burster_Attack
    Burster_Attack:
		COCO H 6 A_FaceTarget
		COCO H 6 A_SpawnItemEx("chestburster",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION)
		TNT1 A 0 A_GiveInventory("ChestAttack", 1)
		TNT1 A 0 A_Die
		Goto See		
	Pain:
		COCO e 5 A_Pain
		Goto See	
	Death:
	    TNT1 A 0 A_JumpIfInventory("ChestOpen", 1, "Death_Open")
		COCO e 2 A_Scream
		COCO n 2
		COCO o 2
		COCO p 2
		COCO q 2 A_NoBlocking
        COCO q -1
	    Stop
	Death_Open:
		COCO h 4 A_Scream
		COCO h 4 A_NoBlocking
        COCO h -1
	    Stop



	}
}

Actor ChestOpen : Inventory { Inventory.MaxAmount 1 }
Actor ChestAttack : Inventory { Inventory.MaxAmount 1 }

Actor BursterAttack
{
	Radius 20
	Height 30
	Speed 4
	Damage (2)
	Projectile
	Scale 0.65
	Gravity 0.10
	-NOGRAVITY
	DamageType "chestburster"
	States
	{
	Spawn:
 	    BURS A 4  
		BURS B 4
		Looping:
	    BURS EFG 4
		Loop
	Death:
		TNT1 A 0 A_SpawnItemEx("chestburster", 0, 0, 0, 0, 0, 0, 0, SXF_NOCHECKPOSITION)
		Stop
	XDeath:
	    TNT1 A 1
		Stop	
	}
}

ACTOR livechester3 : Victim replaces GibbedMarineExtra
{
}

ACTOR chestspawner: RandomSpawner
{
  DropItem "chestburster"
}

ACTOR bloodspurt
{
	Radius 0
	Height 0
	Damage 0
	Alpha 1
	+MOVEWITHSECTOR
	-noclip
	-nogravity
	States
	{
	Spawn:
		MET2 UVWXY 3
	Death:
		MET2 Y 2
		loop
	}
}