
ACTOR AbstractCivilianCorpse: FBD_CurbstompedMarine
{
	//$Sprite DCIVA0
	//$category "EDAY Civilian corpses"
	
	
	// archviles raise them as walkers (blood-red mummies with 40 health)
	
	+CORPSE
	-ISMONSTER
	+FLOORCLIP
	States
	{
		Spawn:
			// SpawnItem/SpawnItemEx always set target pointer to the function's caller,
			//  unless it is a monster -- an important reason for this family of corpses
			//  NOT to be monsters.
			// Do not run slaughtercheck scripts: we ape after our progenitor
			TNT1 A 0 NODELAY A_JumpIfInTargetInventory("IAmSfestMonster", 1, 1)
			Goto AfterSpawn
			// become autonomous from our spawner by eraseing our target pointer
			TNT1 A 0 A_GiveInventory("IAmSfestMonster", 1) 
			TNT1 A 0 A_RearrangePointers (AAPTR_NULL, AAPTR_DEFAULT, AAPTR_DEFAULT, 0)
		AfterSpawn:
			TNT1 AAAAA 0 A_CustomMissile ("SuperWallRedBlood", 10, 0, random (0, 360), CMF_AIMDIRECTION, random (5, 40))
			TNT1 AAAAAA 0 A_SpawnItemEx("Brutal_BloodSpot",random(64, -64),random(64, -64))
			TNT1 A 0 A_SpawnItem("MediumBloodSpot")
			TNT1 A 0 A_SetScale(random(0,1) ? -1.0 : 1.0, 1.0)
			TNT1 A 0 A_Jump(64, "MaybeSpawnFlies")
			TNT1 A 1 A_JumpIf(true, "Stay")
			Wait
		MaybeSpawnFlies:
			TNT1 A 0 A_SpawnItem("GoreFliesWsound", 0, random(0, 15))
			TNT1 AAA 0 A_SpawnItem("GoreFlies", 0, random(0, 15))
			TNT1 A 1 A_JumpIf(true, "Stay")
			Wait
			
		// custom sprite is defined in the state "Stay"
		Stay:
			DCIV A 1
			DCIV A -1
			
		Pain.Trample:
			"----" A 0
			"----" A 0 A_PlaySound("floorslimy")
			"----" A 0 ThrustThingZ(0,25,1,1)
			Goto StayPut
		
		Pain.Kick: // overriding ancestor's method since we don't have a sliding mechanism
		Pain.ExplosiveImpact:
		Pain.FriendlyExplosion:
			"----" A 0
			"----" A 0 ThrustThingZ(0,25,0,1)
		StayPut:
			"----" A 1
			"----" A -1
			
		Raise: // raiseable as walking corpses
			// 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
			
			// 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_ChangeFlag("SHOOTABLE", 1) // otherwise, informer won't work and will cause double-rez via fallback			
			"----" A 0 A_ChangeFlag("NORADIUSDMG", 0) // some corpses are immune to AOE damage preventing informer deleting them
			"----" A 0 A_SpawnItemEx ("FBD_Walker",0,0,0) // deliberately NOT using the nochackposition flag to fail if there is not enough space
			"----" A 10 // wait 10 tics to be destroyed by the spawned monster
			"----" A 0 A_ChangeFlag("SHOOTABLE", 0)
			//"----" A -1 ACS_NamedExecuteAlways("FallbackRez", 0, 23, 0, 0)//"FBD_Walker"
			"----" A -1 ACS_NamedExecuteWithResult("FallbackRezMkII", 307) // see _mob_list.xlsx, column "TrySpawn's idx"
			Stop	
	}
}


ACTOR AbstractCivilianCorpseSpawner // map things inherit from this
{
	//$Sprite DCIVA0
	+NOINTERACTION 
	States {
		Spawn:
			TNT1 A 1 A_Jump(256, "Man", "Man", "Man", "Manly", "Woman", "Woman", "Woman", "Guard", "Dancer", "Worker", "Scientist")
			Wait
		Stub:	
			TNT1 A 30 A_SpawnItemEx ("AbstractCivilianCorpse",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION)
			Stop
		Man:
			TNT1 A 30 A_SpawnItemEx ("DeadCivMale",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION)
			Stop
		Manly:
			TNT1 A 30 A_SpawnItemEx ("DeadCivManly",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION)
			Stop
		Woman:
			TNT1 A 30 A_SpawnItemEx ("DeadCivFemale",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION)
			Stop
		Dancer:
			TNT1 A 30 A_SpawnItemEx ("DeadCivDancer",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION)
			Stop
		Guard:
			TNT1 A 30 A_SpawnItemEx ("DeadCivGuard",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION)
			Stop
		Scientist:
			TNT1 A 30 A_SpawnItemEx ("DeadCivScientist",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION)
			Stop
		Worker:	
			TNT1 A 30 A_SpawnItemEx ("DeadCivWorker",0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION)
			Stop
	}
}


ACTOR DeadCivRandom: AbstractCivilianCorpseSpawner 17752
{
	//$Sprite DCIVA0
	States {
		Spawn:
			TNT1 A 1 A_Jump(256, "Man", "Scientist", "Woman", "Guard", "Worker")
			Wait
	}
}

ACTOR DeadCivManly: AbstractCivilianCorpse 17751
{
	//$Sprite CMC2C0
	States	{
		Stay:
			CMCC S 1 A_Jump(256, "Stay1", "Stay2", "Stay3")
		Stay1:	
			CMCC S -1
		Stay2:	
			CMC2 C -1
		Stay3:	
			CMCC Q -1			
	}
}

ACTOR DeadCivWorker: AbstractCivilianCorpse 17753
{
	//$Sprite CMCCL0
	States	{
		Stay:
			//***Che I fucked up scaling their sprites
			TNT1 A 0 A_SetScale(random(0,1) ? -0.8 : 0.8, 0.8)
			TNT1 A 1 A_Jump(256, "Stay1", "Stay2", "Stay3")
		Stay1:	
			CMCC K -1
		Stay2:	
			CMC2 L -1
		Stay3:	
			CMCC M -1			
	}	
}

ACTOR DeadCivStreet: AbstractCivilianCorpseSpawner 17754
{
	//$Sprite DCIVA0
	States {
		Spawn:
			TNT1 A 1 A_Jump(256, "Man", "Man", "Man", "Woman",  "Woman",  "Woman", "Manly", "Dancer", "Guard", "Worker")
			Wait
	}
}

ACTOR DeadCivScientist: AbstractCivilianCorpse 17755
{
	//$Sprite CMCCN0
	States
	{
		Stay:
			TNT1 A 1 A_Jump(256, "Stay1", "Stay2", "Stay3", "Stay4", "Stay5", "Stay6", "Stay7", "Stay8", "Stay9", "Stay10", "Stay11", "Stay12", "Stay13")
			Wait
		Stay1:	
			CMCC S -1
		Stay2:
			FSMS P -1
		Stay3:
			SCZ4 F -1
		Stay4:
			FS14 G -1
		Stay5:
			SCZ4 E -1
		Stay6:
			FSS7 H -1
		Stay7:
			CMCC N -1
		Stay8:
			CMC2 K -1
		Stay9:
			CMC2 L -1
		Stay10:
			CMC2 M -1
		Stay11:
			CMC2 N -1
		Stay12:
			CMC2 O -1
		Stay13:
			CMC2 P -1
	}
}

ACTOR DeadCivMale: AbstractCivilianCorpse 17756
{
	//$Sprite CMCCB0
	States {
		Stay:
			TNT1 A 1 A_Jump(256, "Stay1", "Stay2", "Stay3", "Stay4", "Stay5", "Stay6", "Stay7", "Stay8", "Stay9", "Stay10")
			Wait
		Stay1:	
			CMCC B -1
		Stay2:	
			CMCC G -1
		Stay3:
			CMCC A -1
		Stay4:
			CMCC I -1
		Stay5:
			CMCC Q -1
		Stay6:
			CMCC S -1
		Stay7:
			CMCC W -1
		Stay8:
			CMCC Z -1
		Stay9:
			CMC2 B -1
		Stay10:
			CMC2 E -1		
	}	
}

ACTOR DeadCivFemale: AbstractCivilianCorpse 17757
{
	//$Sprite CMCCD0
	States {
		Stay:
			TNT1 A 1 A_Jump(256, "Stay1", "Stay2", "Stay3", "Stay4", "Stay5", "Stay6", "Stay7", "Stay8", "Stay9", "Stay10")
			Wait
		Stay1:	
			CMCC E -1
		Stay2:	
			CMCC D -1
		Stay3:	
			CMCC O -1
		Stay4:	
			CMCC P -1
		Stay5:	
			CMCC X -1
		Stay6:	
			CMCC Y -1
		Stay7:	
			CMC2 A -1	
		Stay8:	
			CMC2 D -1	
		Stay9:	
			CMC2 H -1	
		Stay10:	
			CMC2 I -1	
	}	
}

ACTOR DeadCivDancer: AbstractCivilianCorpse 17758
{
	//$Sprite CMCCC0
	States
	{
		Stay:
			CMCC C 1 A_Jump(128, "Stay2")
			CMCC C -1
		Stay2:	
			CMCC R 1
			CMCC R -1
	}
}

ACTOR DeadCivGuard: AbstractCivilianCorpse 17759
{
	//$Sprite CMC2F0
	States{
		Stay:
			TNT1 A 1 A_Jump(256, "Stay1", "Stay2", "Stay3", "Stay4", "Stay5")
			Wait
		Stay1:	
			CMCC H -1
		Stay2:
			CMCC F -1
		Stay3:
			CMC2 F -1
		Stay4:
			CMC2 G -1
		Stay5:
			CMC2 J -1
	}
}

Actor CharredSkeleton: AbstractCivilianCorpse 17887
{
	-SHOOTABLE // not subject to AOE raising but still can be raised by vile stepping on it
	//$Sprite BURNV0
	States {
		Stay:
			BURN V -1
	}	
}



