// --------------------------------------------------------------------------
//
//	Tokens
//
// --------------------------------------------------------------------------

ACTOR FireSeq : Inventory { Inventory.MaxAmount 2 }//Used for weapons that alternates between fire animations, like the Revenant Launchers
ACTOR WeapSpecial : Inventory { Inventory.MaxAmount 1 }//Gived to the player when using the WeaponSpecial-key
ACTOR MonsterHaveSeenPlayer : Inventory { Inventory.MaxAmount 1 }//Used for monsters that play an animation upon seeing the player the first time
ACTOR ChainsawCrueltyBonus : Inventory { Inventory.MaxAmount 150 }//Gived to the player when using the chainsaw, higher amount equals greater bonus
ACTOR IdleCounter : Inventory { Inventory.MaxAmount 200 }//Checks if the player is idle
ACTOR DummyToken : Inventory { Inventory.MaxAmount 999 }//Used for item pickups so that they work properly in multiplayer. Also used for misc. stuff
ACTOR PlayerIsABot : Inventory { Inventory.MaxAmount 1 }//Item given to bots so that they use weapon secondary fires
ACTOR BD21graphics : Inventory { Inventory.MaxAmount 2 }//Checks what sprites to use for the weapon
ACTOR IsShakin : Inventory { Inventory.MaxAmount 1 }//Related to shotgun strap animation
ACTOR ShakeMore : Inventory { Inventory.MaxAmount 1 }//Related to shotgun strap animation
ACTOR WasFiring : Inventory { Inventory.MaxAmount 1 }//Used for unmaker fire animation
ACTOR SmokeToken : Inventory { Inventory.MaxAmount 20 }//More tokens = more weapon smoke
ACTOR DualFireState : Inventory { Inventory.MaxAmount 10 }
ACTOR DualRightFire : Inventory { Inventory.MaxAmount 1 }
ACTOR DualLeftFire : Inventory { Inventory.MaxAmount 1 }
ACTOR RevolverDummyToken : Inventory { Inventory.MaxAmount 1 }
ACTOR Levelcounter : Inventory { Inventory.MaxAmount 32 }//Counts how many maps have been played
ACTOR IsRandomlevel : Inventory { Inventory.MaxAmount 1 }//Used for the random level script
ACTOR PlayingRandomlevels : Inventory { Inventory.MaxAmount 1 }//Playing random levels or not?
ACTOR PlayerWasRunning : Inventory { Inventory.MaxAmount 1 }//Used for slidekick. Running gives a longer/faster slide
ACTOR SlideKicking : Inventory { Inventory.MaxAmount 15 }//Counts how long the player has been kick sliding
ACTOR KnifeCharge : Inventory { Inventory.MaxAmount 60 }//Used for charged knife attack. More tokens = more damage
ACTOR SSGZombieFatality : Inventory { Inventory.MaxAmount 1 }//Used for SSG-zombie fatality
ACTOR PistolSelected : Inventory { Inventory.MaxAmount 1 }//Related to the pistol flashlight
ACTOR FlashlightState : Inventory { Inventory.MaxAmount 10 }//Used for the flashlight flashstate

ACTOR TE_BackPack : Ammo //Ammo token to detect if player has backpack.
{
	+INVENTORY.IGNORESKILL
	Inventory.Amount 0
	Inventory.MaxAmount 1
	Ammo.BackpackAmount 1
	Ammo.BackpackMaxAmount 1
   	Inventory.Icon "TNT1A0"
}

// --------------------------------------------------------------------------
//
//	Dual Weapon Tokens
//		Keeps track of if the player have picked up a second weapon that enables dual wielding
//
// --------------------------------------------------------------------------

ACTOR TE_Pistols : Ammo
{
	Inventory.Amount 1
	Inventory.MaxAmount 2
	Ammo.BackpackAmount 0
	Ammo.BackpackMaxAmount 2
	Inventory.Icon "TNT1A0"
	Inventory.PickupMessage ""
	States
	{
	Spawn:
		TNT1 A -1
		Stop
	}
}

ACTOR TE_Revolvers : Ammo
{
	Inventory.Amount 1
	Inventory.MaxAmount 2
	Ammo.BackpackAmount 0
	Ammo.BackpackMaxAmount 2
	Inventory.Icon "TNT1A0"
	Inventory.PickupMessage ""
	States
	{
	Spawn:
		TNT1 A -1
		Stop
	}
}

ACTOR TE_SMGs : Ammo
{
	Inventory.Amount 1
	Inventory.MaxAmount 2
	Ammo.BackpackAmount 0
	Ammo.BackpackMaxAmount 2
	Inventory.Icon "TNT1A0"
	Inventory.PickupMessage ""
	States
	{
	Spawn:
		TNT1 A -1
		Stop
	}
}

ACTOR TE_Rifles : Ammo
{
	Inventory.Amount 1
	Inventory.MaxAmount 2
	Ammo.BackpackAmount 0
	Ammo.BackpackMaxAmount 2
	Inventory.Icon "TNT1A0"
	Inventory.PickupMessage ""
	States
	{
	Spawn:
		TNT1 A -1
		Stop
	}
}

ACTOR TE_PlasmaRifles : Ammo
{
	Inventory.Amount 1
	Inventory.MaxAmount 2
	Ammo.BackpackAmount 0
	Ammo.BackpackMaxAmount 2
	Inventory.Icon "TNT1A0"
	Inventory.PickupMessage ""
	States
	{
	Spawn:
		TNT1 A -1
		Stop
	}
}


// --------------------------------------------------------------------------
//
//	Marines
//
// --------------------------------------------------------------------------

//ACTOR U_MarineRifle: Marine_Rifle Replaces Marine_Rifle
//{
//	DropItem "RifleDrop"
//}
ACTOR U_MarineShotgun: Marine_Shotgun Replaces Marine_Shotgun
{
	DropItem "ShotgunDrop"
}
ACTOR U_MarineMinigun: Marine_Minigun Replaces Marine_Minigun
{
	DropItem "U_MiniGun"
}
ACTOR U_MarinePlasmaRifle: Marine_PlasmaGun Replaces Marine_PlasmaGun
{
	DropItem "U_PlasmaRifle"
}
ACTOR U_EvilMarinePlasma : EvilMarinePlasma replaces EvilMarinePlasma
{
	DropItem "U_PlasmaRifle"
}


// --------------------------------------------------------------------------
//
//	Other random stuffs
//
// --------------------------------------------------------------------------

ACTOR PleaseKillMe
{
	Radius 10
	Height 10
	DamageType KillMe
	+NOTARGET
	+NOGRAVITY
	+NOTELEPORT
	+NODAMAGETHRUST
	+THRUGHOST
	+NORADIUSDMG
	+NOEXTREMEDEATH
	+FORCERADIUSDMG
	-BLOODSPLATTER
	+BLOODLESSIMPACT
	+DEHEXPLOSION
	+ACTIVATEMCROSS
	PROJECTILE
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 0 A_Explode(100,10)
		Stop
	}
}

ACTOR TE_UseAttack
{
	Projectile 
	+FORCEXYBILLBOARD
	+NOEXTREMEDEATH
	+NOPAIN
	+PAINLESS
	+THRUGHOST
	+GHOST
	-ACTIVATEIMPACT
	+BLOODLESSIMPACT
	+NOCLIP
	RenderStyle Add
	Obituary "none"
	SeeSound "none"
	DeathSound "none"
	Decal "none"
	Damage (random(1,1))
	DamageType Use
	Speed 4
	Radius 4
	Height 4
	Scale 0.10
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 1
		TNT1 A 0 A_ChangeFlag("NOCLIP", 0)
		TNT1 AAAAAA 1
		//PBAL ABABAB 1 BRIGHT
		Stop
	Death:
	XDeath:
		TNT1 A 0
		Stop
	}
}

ACTOR TE_StealthAttack : TE_UseAttack
{
	-NOPAIN
	-PAINLESS
	DamageType Stealth
}

ACTOR SpawnShot2 replaces SpawnShot
{
	Radius 6
	Height 32
	Speed 10
	Damage 3
	Projectile
	+NOCLIP
	-ACTIVATEPCROSS
	+RANDOMIZE
	SeeSound "brain/spit"
	DeathSound "brain/cubeboom"
	States
	{
	Spawn:
		ORBB A 2 BRIGHT A_SpawnSound
		ORBB BCDEF 2 BRIGHT
		Loop
	}
}

ACTOR U_FireBall : FireBall_ Replaces DoomImpBall
{
	DamageType Fire
}

ACTOR U_Archvile: TehArchvile Replaces Archvile
{
	DamageType Fire
}


// --------------------------------------------------------------------------
//
//	Misc Decorations
//
// --------------------------------------------------------------------------

ACTOR U_HeadCandles : HeadCandles replaces Headcandles
{
	+GHOST
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 0 A_Jump(256,"Spawn1","Spawn2")
		Goto Spawn1
	Spawn1:
		POL3 ABCDCB 4 Bright
		loop
	Spawn2:
		POL3 EFGHGF 4 Bright
		loop
	}
}

ACTOR U_FloatingSkull : FloatingSkull replaces FloatingSkull
{
	+GHOST
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 0 A_SpawnItemEx("TE_MapEvidenceChecker",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION)
	Stand1:
		FSKX ABCDEF 4 Bright
		TNT1 A 0 A_Jump(64,"Stand2","Stand3","Stand4")
		Loop
	Stand2:
		FSKX EDCBCDEF 4 Bright
		TNT1 A 0 A_Jump(64,"Stand3","Stand4")
		Goto Stand1
	Stand3:
		FSKX ABCBABCDEF 4 Bright
		TNT1 A 0 A_Jump(64,"Stand2","Stand4")
		Goto Stand1
	Stand4:
		FSKX EDCBAFEDCB 4 Bright
		Goto Stand1
	}
}

ACTOR U_Evileye : Evileye replaces Evileye
{
	+GHOST
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 0 A_SpawnItem("Candlestick")
		TNT1 A 0 A_Jump(256,1,2,3,4,5,6)
	Spawn0:
		SEYE ABCDEF 4 Bright
		TNT1 A 0 A_Jump(64,"Spawn1","Spawn2","Spawn3")
		Loop
	Spawn1:
		SEYE AGHDEF 4 Bright
		TNT1 A 0 A_Jump(64,"Spawn2","Spawn3")
		Goto Spawn0
	Spawn2:
		SEYE ABCDIJ 4 Bright
		TNT1 A 0 A_Jump(64,"Spawn2","Spawn3")
		Goto Spawn0
	Spawn3:
		SEYE AGHDIJ 4 Bright
		TNT1 A 0 A_Jump(64,"Spawn2","Spawn3")
		Goto Spawn0
	}
}

Actor U_Candlestick : Candlestick replaces Candlestick
{
	+RANDOMIZE
	scale 0.7
	states
	{
	Vanilla:
		TNT1 A 0 A_NoBlocking
		TNT1 A 0 A_SpawnItem("CandleVanilla")
		Stop
	Spawn:
		TNT1 A 0
		TNT1 A 0 ACS_NamedExecuteAlways("BDCheckDecorations",0,0,0,0)//Check if advanced decorations are disabled.
		TNT1 A 0 A_SpawnItemEx("CandleStick1Flare",0,0,20)
	Stay1:
		CAND ABC 2 Bright
		TNT1 A 0 A_Jump(256,"Stay2","Stay3","Stay4")
	Stay2:
		CAND DEF 2 Bright
		TNT1 A 0 A_Jump(256,"Stay1","Stay3","Stay4")
	Stay3:
		CAND EDC 2 Bright
		TNT1 A 0 A_Jump(256,"Stay2","Stay1","Stay4")
	Stay4:
		CAND BAF 2 Bright
		TNT1 A 0 A_Jump(256,"Stay2","Stay3","Stay1")
	}
}

ACTOR TE_MapEvidenceChecker
{
	+THRUACTORS
	+NOCLIP
	+NOBLOCKMAP
	Radius 1
	Height 1
	States
	{
	Spawn:
		TNT1 A 0 //Map26
		TNT1 A 0 A_JumpIf(x == 212 && y == -1156, "Scythe2")
		TNT1 A 0 A_JumpIf(x == 1240 && y == -920, "Scythe2")
		TNT1 A 0 A_JumpIf(x == 1760 && y == 368, "Scythe2")
		TNT1 A 0 //Map27
		TNT1 A 0 A_JumpIf(x == -652 && y == 2320, "Scythe2")
		TNT1 A 0 A_JumpIf(x == -1296 && y == 2596, "Scythe2")
		TNT1 A 0 A_JumpIf(x == -1080 && y == 2596, "Scythe2")
		TNT1 A 0 //Map28
		TNT1 A 0 A_JumpIf(x == 648 && y == 2168, "Scythe2")
		TNT1 A 0 A_JumpIf(x == 16 && y == 860, "Scythe2")
		TNT1 A 0 A_JumpIf(x == -1430 && y == -520, "Scythe2")
		TNT1 A 0 //Map29
		TNT1 A 0 A_JumpIf(x == 320 && y == 22, "Scythe2")
		TNT1 A 0 A_JumpIf(x == 438 && y == 70, "Scythe2")
		TNT1 A 0 A_JumpIf(x == 536 && y == -4, "Scythe2")
		TNT1 A 0 //Map30
		TNT1 A 0 A_JumpIf(x == 2824 && y == 2500, "Scythe2")
		TNT1 A 0 A_JumpIf(x == 2594 && y == 3248, "Scythe2")
		TNT1 A 0 A_JumpIf(x == 2654 && y == 3214, "Scythe2")
		TNT1 A 1
		Stop
		
	Scythe2:
		TNT1 A 0
		TNT1 A 0 A_PrintBold("Scythe2 detected")
		TNT1 A 0 ACS_NamedExecuteAlways("TE_Scythe2Detected")
		TNT1 A 1
		Stop
	}
}