// BirtEffect originally resided in jm_assets, but I moved it here as admin
// stuff uses it
ACTOR BirtEffect : PowerFlight
{
	Powerup.Duration 0x7FFFFFFD
}

ACTOR AdminNoClipper : DoomPlayer
{
	+NOCLIP
	Player.ForwardMove 2.2
	Player.SideMove 2.2
	species "jumper"
	+INVULNERABLE
	+NODAMAGE
	+BRIGHT
	+NOSKIN
	Player.DisplayName "Admin"
	var int user_flying;
	States
	{
	  Spawn:
        PLY2  A 0 A_JumpIfInventory("BirtEffect", 1, "CanFly")
		PLY2  A 0 A_GiveInventory("BirtEffect")
     CanFly:
		PLY2  A -1
		Loop
	  See:
		PLY2  ABCD 4
		PLY2  A 0 
		Loop
	Missile:
		PLY2  E 12 
		Goto Spawn
	Melee:
		PLY2  F 6 BRIGHT
		Goto Missile
	Pain:
		PLY2  G 4 
		PLY2  G 4 A_Pain
		Goto Spawn
	Death:
		PLY2  H 0 A_PlayerSkinCheck("AltSkinDeath")
	Death1:
		PLY2  H 10
		PLY2  I 10 A_PlayerScream
		PLY2  J 10 A_NoBlocking
		PLY2  KLM 10
		PLY2  N -1
		Stop
	XDeath:
		PLY2  O 0 A_PlayerSkinCheck("AltSkinXDeath")
	XDeath1:
		PLY2  O 5
		PLY2  P 5 A_XScream
		PLY2  Q 5 A_NoBlocking
		PLY2  RSTUV 5
		PLY2  W -1
		Stop
	AltSkinDeath:
		PLY2  H 6
		PLY2  I 6 A_PlayerScream
		PLY2  JK 6
		PLY2  L 6 A_NoBlocking
		PLY2  MNO 6
		PLY2  P -1
		Stop
	AltSkinXDeath:
		PLY2  Q 5 A_PlayerScream
		PLY2  R 0 A_NoBlocking
		PLY2  R 5 A_SkullPop
		PLY2  STUVWX 5
		PLY2  Y -1
		Stop
	}
}

ACTOR TranslucentScript : CustomInventory
{
	+INVENTORY.UNDROPPABLE
	+AUTOACTIVATE
	Inventory.MaxAmount 0
	States
	{
		Spawn:
		TNT1 A 0
		Stop
		Pickup:
		TNT1 A 0 ACS_ExecuteAlways(693, 0, 0, 0, 0)
		Stop
	}
}

ACTOR AdminPower : CustomInventory
{
	+COUNTITEM
	+INVENTORY.INVBAR
	+INVENTORY.UNDROPPABLE
    Inventory.PickupMessage "You got admin power!"
	states
	{
	Spawn:
		TNT1 ABCD 6
		Loop
	Pickup:
        TNT1 A 0 A_ChangeFlag("INVULNERABLE", TRUE)
        TNT1 A 0 A_ChangeFlag("NOCLIP", TRUE)
        TNT1 A 0 A_ChangeFlag("NODAMAGE", TRUE)
        TNT1 A 0 A_ChangeFlag("BRIGHT", TRUE)
        TNT1 A 0 A_GiveInventory("BirtEffect")
        Stop
	}
}

ACTOR AdminDePower : CustomInventory
{
	+COUNTITEM
	+INVENTORY.INVBAR
	+INVENTORY.UNDROPPABLE
    Inventory.PickupMessage "Clearing admin power"
	states
	{
	Spawn:
		TNT1 ABCD 6
		Loop
	Pickup:
        TNT1 A 0 A_ChangeFlag("INVULNERABLE", FALSE)
        TNT1 A 0 A_ChangeFlag("NOCLIP", FALSE)
        TNT1 A 0 A_ChangeFlag("NODAMAGE", FALSE)
        TNT1 A 0 A_ChangeFlag("BRIGHT", FALSE)
        TNT1 A 0 A_TakeInventory("BirtEffect")
        Stop
	}
}

ACTOR PersonalTeleport : DoomWeapon
{
	Weapon.SelectionOrder 10
	Weapon.SlotNumber 1
	States
	{
		Spawn: // This state is entered when you drop the weapon.
			PTPT A -1
			Stop
		Ready: // This state is entered when you have this weapon selected.
			PTPT A 1 A_WeaponReady
			Loop 
		Deselect: // This state is entered when you deselect the current selected weapon.
			PTPT A 1 A_Lower
			Loop 
		Select: // This state is entered when you select this weapon.
			PTPT A 1 A_Raise
			Loop 
		Fire: // The firing state.
			PTPT A 1
			PTPT B 1 acs_executealways(833,0,0,0,0)
			PTPT C 1 
			PTPT D 1 
			PTPT E 1
			PTPT F 15 
			PTPT A 15 
			Goto Ready
		Flash: // The weapons flash.
			USGF F 1 
			Stop
		}
}

ACTOR ReButton : DoomWeapon //for custom behaviour
{
	Weapon.SelectionOrder 10
	Weapon.SlotNumber 1
	States
	{
		Spawn: // This state is entered when you drop the weapon.
			PTPT A -1
			Stop
		Ready: // This state is entered when you have this weapon selected.
			PTPT A 1 A_WeaponReady
			Loop 
		Deselect: // This state is entered when you deselect the current selected weapon.
			PTPT A 1 A_Lower
			Loop 
		Select: // This state is entered when you select this weapon.
			PTPT A 1 A_Raise
			Loop 
		Fire: // The firing state.
			PTPT A 1
			PTPT B 1 acs_executealways(832,0,0,0,0)
			PTPT C 1 
			PTPT D 1 
			PTPT E 1
			PTPT F 15 
			PTPT A 15 
			Goto Ready
		Flash: // The weapons flash.
			USGF F 1 
			Stop
		}
}
