ACTOR LaserTripAmmo : Ammo
{
  Inventory.PickupMessage "$D3D_TRIPBOMB"
  Inventory.Amount 1
  Inventory.MaxAmount 10
  Inventory.Icon "TNT1A0"
  Ammo.BackPackAmount 2
  Ammo.BackPackMaxAmount 10
  Scale 0.15
  +INVENTORY.IGNORESKILL
  States
  {
  Spawn:
    TRIP D -1
    Loop
  }
}

ACTOR LaserTripAmmoPickup : ZCustomInventoryWeapon 19320
{
  Inventory.PickupMessage "$D3D_TRIPBOMB"
  Inventory.MaxAmount 10
  Inventory.Amount 1
  Scale 0.15
  +INVENTORY.AUTOACTIVATE
  Inventory.PickupSound "misc/backpack"
  States
  {
  Spawn:
    TRIP D -1
    Stop
  Pickup:
    SHTP A 0 ACS_ExecuteWithResult(506,3)
    TNT1 A 1
    stop
  Use:
    SHTP A 0
    SHTP A 0 ACS_ExecuteAlways(506,0,4,0,0)
    TNT1 A 1
    Stop
  }
}

ACTOR RocketAmmoSpawner : RandomSpawner Replaces RocketAmmo 19321
{
  DropItem "PipebombAmmoPickup", 256, 192
  DropItem "LaserTripAmmoPickup", 256, 64
}

Actor TossTripBomb : Inventory
{
  inventory.maxamount 1
}

ACTOR LaserTrip : DefaultDukeWeapon 19322
{
  Weapon.SelectionOrder 34
  Weapon.AmmoUse 1
  Weapon.AmmoGive 1
  Weapon.AmmoType "LaserTripAmmo"
  Obituary "%o tripped %k's laser."
  Inventory.PickupMessage "$D3D_TRIPBOMB"
  Inventory.PickupSound "misc/backpack"
  Scale 0.15
  decal bulletchip
  +NOALERT
  Tag " "
  States
  {
  RReady2:
    TNT1 A 0 A_JumpIfInventory("LaserTripAmmo",1,2)
    TRIP X 1 A_WeaponReady
    goto RReady
    TRIP A 1 A_WeaponReady
    goto RReady
  Deselect:
    TNT1 A 0 A_JumpIfInventory("LaserTripAmmo",1,2)
    TRIP X 0
    goto Super::Deselect
    TRIP A 0
    goto Super::Deselect
  Select:
    TNT1 A 0 A_JumpIfInventory("LaserTripAmmo",1,2)
    TRIP X 0
    goto Super::Select
    TRIP A 0
    goto Super::Select
  Fire:
    TRIP A 1 OffSet(0,120)
    TRIP A 1 OffSet(0,100)
    TRIP A 1 OffSet(0,80)
    TRIP A 1 OffSet(0,60)
    TRIP A 1 OffSet(0,40) 
    TRIP A 1 OffSet(0,15)     
    TRIP A 0 A_FireCustomMissile("ThrownLaserTripBomb",0,1,0,0)
    TRIP A 0 A_TakeInventory("Waiting",10)
    TRIP BBB 1
    TRIP C 1 OffSet(0,25)
    TRIP C 1 OffSet(0,30)
    TRIP C 1 OffSet(0,35)
    TRIP C 1 OffSet(0,40)
    TRIP C 1 OffSet(0,60)
    TRIP C 1 OffSet(0,80)
    TRIP C 1 OffSet(0,100)
    TRIP C 1 OffSet(0,110)
    TNT1 A 5 OffSet(0,110)
    TNT1 A 0 A_ForceReFire
    TNT1 A 0 A_JumpIfInventory("LaserTripAmmo",1,10)
    TRIP X 1 OffSet(0,120)
    TRIP X 1 OffSet(0,100)
    TRIP X 1 OffSet(0,80)
    TRIP X 1 OffSet(0,60)
    TRIP X 1 OffSet(0,40)
    Goto RReady
    TRIP A 1 OffSet(0,120)
    TRIP A 1 OffSet(0,100)
    TRIP A 1 OffSet(0,80)
    TRIP A 1 OffSet(0,60)
    TRIP A 1 OffSet(0,40) 
    Goto RReady
  AltFire:
    TNT1 A 0 A_JumpIfInventory("LaserTripAmmo", 1, 1)
    Goto RReady
    TRIP A 1 OffSet(0,120)
    TRIP A 1 OffSet(0,100)
    TRIP A 1 OffSet(0,80)
    TRIP A 1 OffSet(0,60)
    TRIP A 1 OffSet(0,40) 
    TRIP A 1 OffSet(0,15)     
    TRIP A 0 A_FireCustomMissile("ThrownMineTripBomb",0,0,0,0)
    TNT1 A 0 A_TakeInventory("LaserTripAmmo", 1)
    TRIP A 0 A_TakeInventory("Waiting",10)
    TRIP BBB 1
    TRIP C 1 OffSet(0,25)
    TRIP C 1 OffSet(0,30)
    TRIP C 1 OffSet(0,35)
    TRIP C 1 OffSet(0,40)
    TRIP C 1 OffSet(0,60)
    TRIP C 1 OffSet(0,80)
    TRIP C 1 OffSet(0,100)
    TRIP C 1 OffSet(0,110)
    TNT1 A 5 OffSet(0,110)
    TNT1 A 0 A_ForceReFire
    TNT1 A 0 A_JumpIfInventory("LaserTripAmmo",1,10)
    TRIP X 1 OffSet(0,120)
    TRIP X 1 OffSet(0,100)
    TRIP X 1 OffSet(0,80)
    TRIP X 1 OffSet(0,60)
    TRIP X 1 OffSet(0,40)
    Goto RReady
    TRIP A 1 OffSet(0,120)
    TRIP A 1 OffSet(0,100)
    TRIP A 1 OffSet(0,80)
    TRIP A 1 OffSet(0,60)
    TRIP A 1 OffSet(0,40) 
    Goto RReady
  Spawn:
    TRIP D -1
    Stop
  }
}

ACTOR ThrownLaserTripBomb : ZLaserTripBombMissile
{
  Radius 2
  Height 6
  Speed 30
  Damage 0
  Mass 0x7FFFFFFF
  Obituary "%o tripped %k's laser."
  DamageType "Explosion"
  Scale 0.15
  Gravity 0.7
  +BLOODLESSIMPACT
  +MISSILE
  +NOTELEPORT
  +NOTARGET
  +NOBLOOD
  +NODECAL
  +FORCERADIUSDMG
  +NOICEDEATH
  +GHOST
  +THRUGHOST
  -SOLID
  +THRUSPECIES
  Species "Dukes"
  ThruBits 1
  States
  {
  Spawn:
    TRIP F 1
    Loop
  Death:
    TNT1 A 0 A_NoGravity
    TNT1 A 0 A_Stop
    TNT1 A 0 A_SpawnTripBomb("LaserTripBomb")
    TNT1 A 1
    Stop
  }
}

ACTOR ThrownMineTripBomb : ThrownLaserTripBomb
{
}

ACTOR LaserTripBomb : ZLaserTripBomb 19323
{
  +FOILINVUL
  Radius 3
  Height 6
  Speed 8
  Damage 0
  Mass 0x7FFFFFFF
  Health 1
  Obituary "%o tripped %k's laser."
  DamageType "Explosion"
  Scale 0.15
  +NOTARGET
  +NEVERTARGET
  +NOGRAVITY
  +NOTAUTOAIMED
  +SHOOTABLE
  +NOBLOOD
  +NOTELEPORT
  +NOTARGET
  +FORCERADIUSDMG
  +NOICEDEATH
  -SOLID
  +MOVEWITHSECTOR
  SpriteRotation 180
  States
  {
  Spawn:
    TNT1 A 0
    TNT1 A 0 A_ChangeFlag("NODAMAGE",1)
    TNT1 A 0 A_SetAngle( angle+180 )
    TNT1 A 0 A_PlaySound("LaserTripBomb/Place",5)
    TNT1 A 0 A_AlertMonsters(50)
    TRIP F 26
    TNT1 A 0 A_ChangeFlag("NODAMAGE",0)
  Spawn2:
    TRIP F random(1,3) A_TripbombActive(3, true)
    TRIP F random(1,3) A_TripbombActive(2, false, false)
    TRIP F random(1,3) A_TripbombActive(5)
    TRIP F random(1,3) A_TripbombActive(5)
    TRIP F random(1,3) A_TripbombActive(5)
    TRIP F random(1,3) A_TripbombActive(5)
    TRIP F random(1,3) A_TripbombActive(5)
    TRIP F random(1,3) A_TripbombActive(5)
    Loop
  Death:
    TRIP F 1 A_PlaySound("LaserTripBomb/Detecte",11)
    TNT1 AAAAAAAAA 0 A_CustomMissile ("ExplosionParticleHeavy", 0, 0, random[RIDFX](0, 360), 2, random[RIDFX](0, 180))
    TNT1 AAAAAAAAAAAAAAAAAA 0 A_CustomMissile ("ExplosionParticleHeavy", 0, 0, random[RIDFX](0, 360), 2, random[RIDFX](0, 360))
    TNT1 AAAAAAAAA 0 A_CustomMissile ("ExplosionParticleVeryFast", 0, 0, random[RIDFX](0, 360), 2, random[RIDFX](0, 360))
    TNT1 A 0 A_CustomMissile ("RPGExplosion", 0, 0, random[RIDFX](0, 360), 2, random[RIDFX](0, 360))
    TNT1 AAAAA 0 A_CustomMissile ("ExplosionSmokeFast22", 0, 0, random[RIDFX](0, 360), 2, random[RIDFX](0, 360))
    TNT1 A 0 A_SpawnItem("BigRicoChet")
    TNT1 A 0 A_SPawnItem("ExplosionAirDisplacementEffect")
    TNT1 A 0 A_PlaySound("rpg/blowup")
    TNT1 A 0 A_PlayWeaponSound("rpg/blowup")
    TNT1 A 0 Radius_Quake(2, 8, 0, 12, 0)
    TNT1 A 2
    TNT1 A 0 A_AlertMonsters
    TNT1 A 0 A_Explode(160,200,XF_EXPLICITDAMAGETYPE,0,0,0,0,"None","Explosion")
    TNT1 A 0 A_Explode(160,200,XF_EXPLICITDAMAGETYPE|XF_HURTSOURCE,0,0,0,0,"None","Explosion")
    TNT1 A 10
    Stop
  }
}

ACTOR LaserTripBombFake
{
  Radius 1
  Height 1
  Mass 1
  Scale 0.15
  +NOCLIP
  +DROPOFF 
  +DONTMORPH
  +FRIENDLY
  +NOBLOCKMONST
  +NOTELEPORT
  +NOGRAVITY
  +NOBLOCKMAP
  +NOINTERACTION
  +NOTAUTOAIMED
  +NOTONAUTOMAP
  -SOLID
  +GHOST
  +THRUGHOST
  +THRUACTORS
  +NOBLOOD
  -SHOOTABLE
  +NONSHOOTABLE
  +INVULNERABLE
  +NODAMAGE
  +NOPAIN
  -COUNTKILL
  +NOTARGET
  +NEVERTARGET
  SpriteRotation 180
  ThruBits 1
  states
  {
  Spawn:
    TRIP F 1
    loop
  Death:
    TNT1 A 1
    Stop
  }
}

ACTOR LaserTripPuff
{
  Mass 0
  Radius 1
  Height 2
  Scale 0.25
  +NOBLOCKMAP
  +NOGRAVITY
  +BLOODLESSIMPACT
  +PUFFONACTORS
  +DONTSPLASH
  +NOTRIGGER
  +FORCEXYBILLBOARD
  +NOTONAUTOMAP
  +ALWAYSPUFF
  +PAINLESS
  States
  {
    Spawn:
      TNT1 A 0
      TRIP E 1 BRIGHT
      Stop
  }
}