/*
CREDITS:
Sprite - Valve (Half-Life)

Sounds:
Up, hit - ?
Bounce, pickup, toss, superluck - ID (RTCW)
*/

ACTOR Satcheler : Weapon
{
   Tag "Ammo Satchels"
   Inventory.PickupSound "misc/w_pkup"
   Inventory.PickupMessage "ERECTIN' A DISPENSER! (1)"
   Obituary "%o was overweighted, thanks to %k's ammunition."
   Weapon.UpSound "Weapons/SatchelUp"
   Weapon.SelectionOrder 99
   Weapon.AmmoGive 0
   Weapon.AmmoType1 "SatchelAmmo"
   Weapon.AmmoUse1 20
   Weapon.AmmoType2 "SatchelAmmo"
   Weapon.AmmoUse2 20
   Weapon.SlotNumber 1
   AttackSound ""
   Scale 0.35
   +NOAUTOFIRE
   +NOALERT
   +AMMO_OPTIONAL
   +ALT_AMMO_OPTIONAL
   +WEAPON.CHEATNOTWEAPON
   States
   {
   Spawn:
	STCP A -1
	Loop
   Ready:
	STCG A 1 A_WeaponReady
	Loop
   SatchelOn:
	STCG A 0 A_ClearReFire
	STCG HGFEDCBA 1
	Goto Ready
   Deselect:
	STCG A 1 A_Lower
	STCG A 0 A_Lower
	Loop
   Select:
	STCG A 1 A_Raise
	STCG A 0 A_Raise
	Loop
   Fire:
	STCG A 0 A_JumpIfNoAmmo("Ready")
	STCG ABCDEFGH 1
	STCG HGF 1
	TNT1 A 0 A_PlayWeaponSound("Weapons/SatchelToss")
	TNT1 A 0 A_FireCustomMissile("SatchelSpawner",0,1,-20,0)
	STCF ABCDEFGH 1
	TNT1 A 10
	TNT1 A 10 A_ReFire
	Goto SatchelOn
   Hold:
	STCG A 0 A_JumpIfNoAmmo("SatchelOn")
	STCG HGF 1
	TNT1 A 0 A_PlayWeaponSound("Weapons/SatchelToss")
	TNT1 A 0 A_FireCustomMissile("SatchelSpawner",0,1,-20,0)
	STCF ABCDEFGH 1
	TNT1 A 10
	TNT1 A 10 A_ReFire
	Goto SatchelOn
   AltFire:
	STCG A 0 A_JumpIfNoAmmo("Ready")
	STCG ABCDEFGH 1
	TNT1 A 2 A_ReFire
	TNT1 A 0 A_PlayWeaponSound("Weapons/SatchelToss")
	TNT1 A 0 A_PlaySoundEx("Weapons/SatchelOof","Voice")
	TNT1 A 0 A_FireCustomMissile("SatchelBlaster",0,1,20,0)
	HNDG IJKLMNOP 1
	TNT1 A 9 A_ReFire
	TNT1 A 1
	Goto SatchelOn
   AltHold:
	TNT1 A 1
	TNT1 A 0 A_ReFire
	TNT1 A 0 A_PlayWeaponSound("Weapons/SatchelToss")
	TNT1 A 0 A_PlaySoundEx("Weapons/SatchelOof","Voice")
	TNT1 A 0 A_FireCustomMissile("SatchelBlaster",0,1,20,0)
	HNDG IJKLMNOP 1
	TNT1 A 15
	Goto SatchelOn
   }
}

ACTOR SatchelAmmo : Ammo
{
Inventory.Amount 1
Inventory.MaxAmount 100
Ammo.BackpackAmount 0
Ammo.BackpackMaxAmount 100
Inventory.Icon STCPA0
}

actor SatchelSpawner
{
  Radius 7
  Height 9
  Speed 10
  Damage 0
  Projectile
  -NOGRAVITY
  BounceType Doom
  BounceCount 3
  SeeSound ""
  DeathSound ""
  BounceSound "Weapons/SatchelBounce"
  States
  {
  Spawn:
    STCP ABCD 4
    loop
  Death:
    STCP A 0 A_NoBlocking
    STCP A 1 A_SpawnItem("AmmoeySatchel",0,0)
    stop
  }
}

actor AmmoeySatchel : CustomInventory
{
  inventory.pickupmessage "Picked up an ammo satchel."
  Inventory.PickupSound "Weapons/SatchelPick"
  -COUNTITEM
  +INVENTORY.AUTOACTIVATE
  +INVENTORY.ALWAYSPICKUP
  states
  {
  Pickup:
  TNT1 A 0 A_GiveInventory("Boolet",30)
  TNT1 A 0 A_GiveInventory("ErasusAmmo",5)
  TNT1 A 0 A_GiveInventory("RawketAmmo",8)
  TNT1 A 0 A_GiveInventory("100MMAmmo",6)
  TNT1 A 0 A_GiveInventory("StickyAmmo",2)
  TNT1 A 0 A_GiveInventory("NukeCellAmmo",10)
  TNT1 A 0 A_GiveInventory("IonAmmo",5)
  TNT1 A 0 A_GiveInventory("PlasmaAmmo",25)
  TNT1 A 0 A_GiveInventory("VoidAmmo",15)
  TNT1 A 0 A_GiveInventory("VearAmmo",15)

  TNT1 A 0 A_Jump(1,"SheerLuck")
  stop
  SheerLuck:
  TNT1 A 0 A_Print("Looks like you just got some sheer luck and encountered ultimate satchel, filled with shitload of stuff!")
  TNT1 A 0 A_PlaySound("Inventory/SuperPack",5,1.0,0,ATTN_NONE)
  TNT1 A 0 A_GiveInventory("Backpack")
  TNT1 A 0 A_GiveInventory("Boolet",1000)
  TNT1 A 0 A_GiveInventory("ErasusAmmo",999)
  TNT1 A 0 A_GiveInventory("RawketAmmo",999)
  TNT1 A 0 A_GiveInventory("100MMAmmo",999)
  TNT1 A 0 A_GiveInventory("StickyAmmo",99)
  TNT1 A 0 A_GiveInventory("NukeCellAmmo",999)
  TNT1 A 0 A_GiveInventory("PlasmaAmmo",999)
  TNT1 A 0 A_GiveInventory("IonAmmo",999)
  TNT1 A 0 A_GiveInventory("VearAmmo",999)
  TNT1 A 0 A_GiveInventory("VoidAmmo",999)

  TNT1 A 0 A_GiveInventory("BasicUpgrade")
  TNT1 A 0 A_GiveInventory("CaliberUpgrade")
  TNT1 A 0 A_GiveInventory("NukerUpgrade")
  TNT1 A 0 A_GiveInventory("QuadUpgrade")

  TNT1 A 0 A_GiveInventory("EnvirospherePickup",1)
  TNT1 A 0 A_GiveInventory("Trocky",2)
  TNT1 A 0 A_GiveInventory("Stalin",2)
  TNT1 A 0 A_GiveInventory("Lenin",2)
  TNT1 A 0 A_GiveInventory("MegaMap")
  TNT1 A 0 A_GiveInventory("HindenburgBeacon",1)
  TNT1 A 0 A_GiveInventory("ShitStormDevice",2)
  TNT1 A 0 A_GiveInventory("Redeemer",2)
  TNT1 A 0 A_GiveInventory("HunterSeekerPickup",1)
  TNT1 A 0 A_GiveInventory("Weegeesphere",2)
  TNT1 A 0 A_GiveInventory("JetThruster",25)

  TNT1 A 0 A_GiveInventory("SalvationPickup")
  TNT1 A 0 A_GiveInventory("SupremeHp")
  TNT1 A 0 A_GiveInventory("ConquerorShield")
  stop
  Spawn:
  STCP A 600
  Goto FadeOut
  FadeOut:
  STCP AAAAAAAAAAAAAAAAAAAA 1 A_FadeOut(0.05)
  Stop
  }
}

//Alt-Fire

actor SatchelBlaster
{
  Radius 7
  Height 9
  Speed 40
  Damage 50
  Projectile
  -NOGRAVITY
  BounceType Doom
  BounceCount 4
  BounceFactor 0.75
  SeeSound ""
  DeathSound ""
  BounceSound "Weapons/SatchelBounce"
  Obituary "%o was slammed in the face by %k's ammunition."
  States
  {
  Spawn:
    STCP ABCD 2
    loop
  Death:
    STCP A 0 A_NoBlocking
    STCP A 1 A_SpawnItem("AmmoeySatchel",0,0)
    stop
  XDeath:
    STCP A 0 A_NoBlocking
    STCP A 0 A_PlaySound("Weapons/SatchelHit")
    STCP A 1 A_SpawnItem("AmmoeySatchel",0,0)
    stop
  }
}
