
actor TempInvActor : ZTempInvActor
{
  Speed 0
  Radius 1
  Height 1
  Mass 1
  scale 0.75
  +NOCLIP
  +DROPOFF 
  +DONTMORPH
  +FLOORCLIP
  +FRIENDLY
  +NOBLOCKMONST
  +NOTELEPORT
  +NOGRAVITY
  +NOBLOCKMAP
  +INVISIBLE
  +NOINTERACTION
  +NOTAUTOAIMED
  +NOTONAUTOMAP
  Species "Dukes"
  +DONTHARMSPECIES
  +NOINFIGHTSPECIES
  +DONTHARMCLASS
  -HARMFRIENDS
  -SOLID
  +THRUACTORS
  +NOBLOOD
  -SHOOTABLE
  +NONSHOOTABLE
  +INVULNERABLE
  +NODAMAGE
  +NOPAIN
  -COUNTKILL
  States
  {
  Spawn:
    TNT1 A 0
    TNT1 A 0
  Idle:
    TNT1 A 5
    loop
  }
}

Actor JetPackPickup : CustomInventory 19173
{
  Inventory.PickupMessage "$D3D_JETPACK"
  Inventory.Amount 1
  Inventory.MaxAmount 1
  +INVENTORY.IGNORESKILL
  +COUNTITEM
  scale 0.7
  states
  {
  Spawn:
	JEPA A -1
	Stop
  Pickup:
	TNT1 A 0 A_JumpIfInventory("JetPack",100,3)
	TNT1 A 0 A_GiveInventory("JetPackDuration", 100)
	TNT1 A 1 A_GiveInventory("JetPack", 100)
	Stop
	TNT1 A 1
	Fail
  }
}

ACTOR JetPack : CustomInventory
{
  Inventory.Amount 100
  Inventory.MaxAmount 100
  Inventory.Icon "JETPACK"
  +INVENTORY.INVBAR
  +INVENTORY.IGNORESKILL
  Inventory.InterHubAmount 100
  +INVENTORY.PERSISTENTPOWER
  scale 0.7
  Tag "JetPack"
  States
  {
  Spawn:
	JEPA A -1
	Stop
  Use:
	TNT1 A 0 A_JumpIfInventory("JetPackActive",1,4)
	TNT1 A 0 { If(A_SpawnItemEX("JetPackTempInvActor",0,0,0,0,0,0,0,SXF_SETMASTER)==0) {Return state("NoSpawn");} else {Return state("");} }
	TNT1 A 0 A_GiveInventory("JetPackActive", 1)
	TNT1 A 1 A_PlaySound("JetPack/Use")
	Fail
	TNT1 A 1 A_GiveInventory("JetPackRetrieve", 1)
	Fail
  NoSpawn:
	TNT1 A 1
	Fail
  }
}

ACTOR JetPackON : PowerupGiver
{
	Powerup.Duration -1
	+INVENTORY.AUTOACTIVATE
	+INVENTORY.ALWAYSPICKUP
	-INVENTORY.INVBAR
	+INVENTORY.QUIET
	+DONTSPLASH
	Powerup.Type Flight
}

ACTOR JetPackDuration : Ammo
{
  +IGNORESKILL
  Inventory.Amount 1
  Inventory.MaxAmount 100
}

ACTOR JetPackActive : PuzzleItem
{  
  Inventory.InterHubAmount 0
  Inventory.MaxAmount 1    
  -INVENTORY.INVBAR  
}

ACTOR JetPackRetrieve : Inventory
{  
  Inventory.InterHubAmount 0
  Inventory.MaxAmount 1    
}

actor JetPackTempInvActor : TempInvActor
{
  States
  {
  Spawn:
    TNT1 A 0
    TNT1 A 0 A_BeginItem("JetPack", "JetPackON", "JetPackActive", "JetPackDuration", "JetPackRetrieve", 15, "JetPack/Active", 7, "JetPack/Off")
  Idle:
    TNT1 A 5
    loop
  }
}

Actor NVGPickup : CustomInventory replaces Infrared 19174
{
  Inventory.PickupMessage "$D3D_NVG"
  Inventory.Amount 1
  Inventory.MaxAmount 1
  +INVENTORY.IGNORESKILL
  +COUNTITEM
  scale 0.8
  states
  {
  Spawn:
	NIVI A -1
	Stop
  Pickup:
	TNT1 A 0 A_JumpIfInventory("Night_vision_glasses",100,3)
	TNT1 A 0 A_GiveInventory("NVGDuration", 100)
	TNT1 A 1 A_GiveInventory("Night_vision_glasses", 100)
	Stop
	TNT1 A 1
	Fail
  }
}

ACTOR Night_vision_glasses : CustomInventory
{
  Inventory.Amount 100
  Inventory.MaxAmount 100
  Inventory.Icon "NIGHVISO"
  +INVENTORY.INVBAR
  +INVENTORY.IGNORESKILL
  Inventory.InterHubAmount 100
  +INVENTORY.PERSISTENTPOWER
  scale 0.8
  Tag "Night vision glasses"
  States
  {
  Spawn:
	NIVI A -1
	Stop
  Use:
	TNT1 A 0 A_JumpIfInventory("NVGActive",1,4)
	TNT1 A 0 { If(A_SpawnItemEX("NVGTempInvActor",0,0,0,0,0,0,0,SXF_SETMASTER)==0) {Return state("NoSpawn");} else {Return state("");} }
	TNT1 A 0 A_GiveInventory("NVGActive", 1)
	TNT1 A 1 A_PlaySound("NightVision/Use")
	Fail
	TNT1 A 1 A_GiveInventory("NVGRetrieve", 1)
	Fail
  NoSpawn:
	TNT1 A 1
	Fail
  }
}

ACTOR NightVisorON : PowerupGiver
{
	Powerup.Duration -5
	+INVENTORY.AUTOACTIVATE
	+INVENTORY.ALWAYSPICKUP
	-INVENTORY.INVBAR
	+INVENTORY.QUIET
	+DONTSPLASH
	Powerup.Type LightAmp
}

ACTOR NVGDuration : Ammo
{
  +IGNORESKILL
  Inventory.Amount 1
  Inventory.MaxAmount 100
}

ACTOR NVGActive : PuzzleItem
{  
  Inventory.InterHubAmount 0
  Inventory.MaxAmount 1    
  -INVENTORY.INVBAR  
}

ACTOR NVGRetrieve : Inventory
{  
  Inventory.InterHubAmount 0
  Inventory.MaxAmount 1    
}

actor NVGTempInvActor : TempInvActor
{
  States
  {
  Spawn:
    TNT1 A 0
    TNT1 A 0 A_BeginItem("Night_vision_glasses", "NightVisorON", "NVGActive", "NVGDuration", "NVGRetrieve", 15, null, 0, "NightVision/Use")
  Idle:
    TNT1 A 5
    loop
  }
}

ACTOR SteroidsPickup : CustomInventory 19175
{
  Inventory.PickupMessage "$D3D_STEROIDS"
  Inventory.Amount 1
  Inventory.MaxAmount 1
  +INVENTORY.IGNORESKILL
  +COUNTITEM
  Scale 0.65
  States
  {
  Spawn:
    PILL A -1
    Stop
  Pickup:
	TNT1 A 0 A_JumpIfInventory("Steroids",100,3)
	TNT1 A 0 A_GiveInventory("SteroidsDuration", 100)
	TNT1 A 1 A_GiveInventory("Steroids", 100)
	Stop
	TNT1 A 1
	Fail
  }
}

ACTOR Steroids : CustomInventory
{
  Inventory.Amount 100
  Inventory.MaxAmount 100
  Inventory.Icon "PILLB0"
  +INVENTORY.INVBAR
  +INVENTORY.IGNORESKILL
  Inventory.InterHubAmount 100
  +INVENTORY.PERSISTENTPOWER
  Scale 0.65
  Tag "Steroids"
  States
  {
  Spawn:
    PILL A -1
    Stop
  Use:
    NIVI A 0 A_GiveInventory("SteroidsON",1)
    NIVI A 1 A_PlaySound("duke/ready")
    Stop

  Use:
	TNT1 A 0 A_JumpIfInventory("SteroidsActive",1,4)
	TNT1 A 0 { If(A_SpawnItemEX("SteroidsTempInvActor",0,0,0,0,0,0,0,SXF_SETMASTER)==0) {Return state("NoSpawn");} else {Return state("");} }
	TNT1 A 0 A_GiveInventory("SteroidsActive", 1)
	TNT1 A 1 A_PlaySound("Steroids/Use")
	Fail
	TNT1 A 1
	Fail
  NoSpawn:
	TNT1 A 1
	Fail
  }
}

ACTOR SteroidsON : CustomInventory
{
  +INVENTORY.AUTOACTIVATE
  +INVENTORY.ALWAYSPICKUP
  -INVENTORY.INVBAR
  +INVENTORY.IGNORESKILL
  States
  {
  Spawn:
    TNT1 A 0
    loop
  Pickup:
    TNT1 A 0 A_GiveInventory("SteroidsEffect1")
    TNT1 A 1 A_GiveInventory("SteroidsEffect2")
    Stop
  }
}

ACTOR SteroidsEffect1 : PowerupGiver
{
	Powerup.Duration -1
	+INVENTORY.AUTOACTIVATE
	+INVENTORY.ALWAYSPICKUP
	-INVENTORY.INVBAR
	+INVENTORY.QUIET
	+DONTSPLASH
	powerup.type TurboST
}

ACTOR SteroidsEffect2 : PowerupGiver 
{ 
	Powerup.Duration -1
	+INVENTORY.AUTOACTIVATE
	+INVENTORY.ALWAYSPICKUP
	-INVENTORY.INVBAR
	+INVENTORY.QUIET
	+DONTSPLASH 
	Powerup.Type HalfDamage
}

Actor PowerTurboST : PowerSpeed
{
  Speed 2.0
}

ACTOR PowerHalfDamage : PowerProtection 
{
  +DONTBLAST
  +DONTMORPH
  +DONTRIP
  +DONTSQUASH
  +NOPAIN
  +NORADIUSDMG
  +NOTELEOTHER
  DamageFactor "Normal", 0.5
}

ACTOR SteroidsDuration : Ammo
{
  +IGNORESKILL
  Inventory.Amount 1
  Inventory.MaxAmount 100
}

ACTOR SteroidsActive : PuzzleItem
{  
  Inventory.InterHubAmount 0
  Inventory.MaxAmount 1    
  -INVENTORY.INVBAR  
}

ACTOR SteroidsRetrieve : Inventory
{  
  Inventory.InterHubAmount 0
  Inventory.MaxAmount 1    
}

actor SteroidsTempInvActor : TempInvActor
{
  States
  {
  Spawn:
    TNT1 A 0
    TNT1 A 0 A_BeginItem("Steroids", "SteroidsON", "SteroidsActive", "SteroidsDuration", "SteroidsRetrieve", 10, "Steroids/Active", 6, null)
  Idle:
    TNT1 A 5
    loop
  }
}

actor BerserkSpawner : RandomSpawner Replaces Berserk 19176
{
  DropItem "SteroidsPickup", 256, 128
  DropItem "BootsPickup", 256, 128
}