actor Colt45 : Weapon
{
  Game Doom
  Weapon.SelectionOrder 700
  weapon.ammotype "Colt45Clip"
  weapon.ammouse 1
  weapon.ammogive2 999
  weapon.ammogive1 999
  weapon.ammotype2 "Colt45Ammo"
  Obituary "$OB_MPPISTOL" // "%o was tickled by %k's pea shooter."
  Inventory.Pickupmessage "$PICKUP_PISTOL_DROPPED" // "Picked up a pistol."
  States
  {
  Ready:
	M1GE A 0 A_JumpIfInventory("thrownade",1,"ThrowGrenade")
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
	AK47 A 0 A_JumpIfInventory("Kinfeammo",1,"UseKnife")
    CO45 A 1 A_WeaponReady
    Loop
  Deselect:
    CO45 A 0 A_Lower
    CO45 A 0 A_Lower
    CO45 A 1 A_Lower
    Loop
  Select:
    CO45 A 0 A_Raise
    CO45 A 0 A_Raise
    CO45 A 1 A_Raise
    Loop
  Fire:
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    CO45 A 0 A_jumpifinventory("deadshot",1,"Fire_deadshot")
    CO45 A 0 A_jumpifinventory("Doubletap",1,"Fire_Doubletap")
    CO45 A 0 A_jumpifnoammo("Reload")
    CO45 A 3
    CO45 B 1
	CO45 B 0 A_playsound("Colt/fire")
    CO45 B 0 A_FireBullets(2,2,1,random(250,250),"bulletPuff")
	TNTT A 0 A_FireCustomMissile("BulletCasingSpawner",0,0,-6,2)
	CO45 C 3
	CO45 D 3
    CO45 A 0 A_jumpifnoammo("Reload")
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
	CO45 C 3 A_Refire
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    CO45 A 0 A_jumpifnoammo("Reload")
    Goto Ready
  Fire_deadshot:
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    CO45 A 0 A_jumpifinventory("Doubletap",1,"Fire_Doubletapdeadshot")
    CO45 A 0 A_jumpifnoammo("Reload")
    CO45 A 3
    CO45 B 1
	CO45 B 0 A_playsound("Colt/fire")
    CO45 B 0 A_FireBullets(0.5,0.7,1,random(250,250),"bulletPuff")
	TNTT A 0 A_FireCustomMissile("BulletCasingSpawner",0,0,-6,2)
	CO45 C 3
	CO45 D 3
    CO45 A 0 A_jumpifnoammo("Reload")
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
	CO45 C 3 A_Refire
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    CO45 A 0 A_jumpifnoammo("Reload")
    Goto Ready
  Fire_Doubletapdeadshot:
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    CO45 A 0 A_jumpifnoammo("Reload")
    CO45 A 1
    CO45 B 1
	CO45 B 0 A_playsound("Colt/fire")
    CO45 B 0 A_FireBullets(0.5,0.7,1,random(250,250),"bulletPuff")
	TNTT A 0 A_FireCustomMissile("BulletCasingSpawner",0,0,-6,2)
	CO45 C 2
	CO45 D 1
    CO45 A 0 A_jumpifnoammo("Reload")
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
	CO45 C 2 A_Refire
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    CO45 A 0 A_jumpifnoammo("Reload")
    Goto Ready
  Fire_Doubletap:
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    CO45 A 0 A_jumpifnoammo("Reload")
    CO45 A 1
    CO45 B 1
	CO45 B 0 A_playsound("Colt/fire")
    CO45 B 0 A_FireBullets(2,2,1,random(250,250),"bulletPuff")
	TNTT A 0 A_FireCustomMissile("BulletCasingSpawner",0,0,-6,2)
	CO45 C 2
	CO45 D 1
    CO45 A 0 A_jumpifnoammo("Reload")
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
	CO45 C 2 A_Refire
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    CO45 A 0 A_jumpifnoammo("Reload")
    Goto Ready
  Reload:	
    PIRE A 0 A_takeinventory("IsReloading",1)
    CORE A 0 A_jumpifinventory("Speedcola",1,"Reload_Speed")
    CORE A 0 A_jumpifinventory("Colt45clip",8,"Ready")
    CORE A 0 A_jumpifinventory("Colt45ammo",1,1)
	goto ready+1
	CORE A 0 A_playsound("Colt/clipout")
    CORE ABCDE 2
	CORE E 20
	goto Reload2
  Reload2:
	CORE E 0 A_GiveInventory("Colt45Clip",1)
    CORE E 0 A_TakeInventory("Colt45ammo",1)
	CORE E 0 A_jumpifinventory("Colt45clip",8,"Reloaddone")
	CORE E 0 A_jumpifinventory("Colt45ammo",1,"Reload2")
	goto Reloaddone
  Reloaddone:
    CORE E 0 A_playsound("Colt/clipin")
	CORE E 15 
    CORE E 0 A_playsound("Colt/bolt")
	CORE E 7
	CORE EDCBA 2
	Goto Ready
  Reload_Speed:
    CORE A 0 A_jumpifinventory("Colt45clip",8,"Ready")
    CORE A 0 A_jumpifinventory("Colt45ammo",1,1)
	goto ready+1
	CORE A 0 A_playsound("Colt/clipout")
    CORE ABCDE 1
	CORE E 10
	goto Reload2_Speed
  Reload2_Speed:
	CORE E 0 A_GiveInventory("Colt45Clip",1)
    CORE E 0 A_TakeInventory("Colt45ammo",1)
	CORE E 0 A_jumpifinventory("Colt45clip",8,"Reloaddone_Speed")
	CORE E 0 A_jumpifinventory("Colt45ammo",1,"Reload2_Speed")
	goto Reloaddone_Speed
  Reloaddone_Speed:
    CORE E 0 A_playsound("Colt/clipin")
	CORE E 7 
    CORE E 0 A_playsound("Colt/bolt")
	CORE E 4
	CORE EDCBA 1
	Goto Ready
  ThrowGrenade:
     HNDG BCD 1
     HNDG E 1 A_PlaySound("weapons/grenadepin")
     HNDG FGHH 1
     HNDG I 1 A_PlaySound("weapons/grenadethr") 
     HNDG J 0 A_FireCustomMissile("ThrownGrenade",0,0,0,0)
     HNDG J 0 A_PlaySound("weapons/grenadethr")
     HNDG JKLMNOPQ 1
     HNDG Q 0 A_TakeInventory("thrownade")
     Goto Ready
  Useknife:
     KNFG A 0 A_jumpifinventory("Machete",1,"UseMachete")
     KNFG ABC 2
	 KNFG C 0 A_CustomPunch (110,1,0,"KnifePuff")
	 KNFG DEF 2
	 KNFG F 0 A_TakeInventory("Kinfeammo")
	 goto ready
  UseMachete:
     MHT4 ABC 2
	 MHT4 C 0 A_CustomPunch (450,1,0,"Machetepuff")
	 MHT4 DEFG 2
	 MHT4 G 0 A_TakeInventory("Kinfeammo")
	 goto ready
  Flash:
    TNTT A 0
	stop
  Spawn:
    COSP A -1
	stop
  }
}


actor Colt45Clip : Ammo
{
    inventory.icon "CLIPA0"
    inventory.amount 0
    inventory.maxamount 8
    ammo.backpackamount 0
    ammo.backpackmaxamount 8
    +IGNORESKILL
}

actor Colt45Ammo : Ammo
{
    inventory.icon "CLIPA0"
    inventory.amount 8
    inventory.maxamount 88
    ammo.backpackamount 8
    ammo.backpackmaxamount 8
    +IGNORESKILL
    inventory.pickupmessage "Got Colt45 rounds!"  
    States
    {
    Spawn:
      CLIP A -1
      Stop
    }
}

actor PAPColt45 : Weapon
{
  Game Doom
  Weapon.SelectionOrder 1900
  weapon.ammotype "PAPColt45Clip"
  weapon.ammouse 1
  weapon.ammogive2 999
  weapon.ammogive1 999
  weapon.ammotype2 "PAPColt45Ammo"
  Obituary "$OB_MPPISTOL" // "%o was tickled by %k's pea shooter."
  Inventory.Pickupmessage "$PICKUP_PISTOL_DROPPED" // "Picked up a pistol."
  States
  {
  Ready:
	M1GE A 0 A_JumpIfInventory("thrownade",1,"ThrowGrenade")
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
	AK47 A 0 A_JumpIfInventory("Kinfeammo",1,"UseKnife") 
    CO45 A 1 A_WeaponReady
    Loop
  Deselect:
    CO45 A 0 A_Lower
    CO45 A 0 A_Lower
    CO45 A 1 A_Lower
    Loop
  Select:
    CO45 A 0 A_Raise
    CO45 A 0 A_Raise
    CO45 A 1 A_Raise
    Loop
  Useknife:
     KNFG A 0 A_jumpifinventory("Machete",1,"UseMachete")
     KNFG ABC 2
	 KNFG C 0 A_CustomPunch (110,1,0,"KnifePuff")
	 KNFG DEF 2
	 KNFG F 0 A_TakeInventory("Kinfeammo")
	 goto ready
  UseMachete:
     MHT4 ABC 2
	 MHT4 C 0 A_CustomPunch (450,1,0,"Machetepuff")
	 MHT4 DEFG 2
	 MHT4 G 0 A_TakeInventory("Kinfeammo")
	 goto ready
  Fire:
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    CO45 A 0 A_jumpifinventory("Doubletap",1,"Fire_Doubletap")
    CO45 A 0 A_jumpifnoammo("Reload")
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    CO45 A 3
    CO45 B 1
	CO45 B 0 A_playsound("Colt/fire")
    CO45 B 0 A_FireCustomMissile("FireGrenade",0,1,0,0)
	CO45 C 3
	CO45 D 20
    CO45 A 0 A_jumpifnoammo("Reload")
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
	CO45 C 3 A_Refire
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    CO45 A 0 A_jumpifnoammo("Reload")
    Goto Ready
  Fire_Doubletap:
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    CO45 A 0 A_jumpifnoammo("Reload")
    CO45 A 1
    CO45 B 1
	CO45 B 0 A_playsound("Colt/fire")
    CO45 B 0 A_FireCustomMissile("FireGrenade",0,1,0,0)
	CO45 C 2
	CO45 D 10
    CO45 A 0 A_jumpifnoammo("Reload")
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
	CO45 C 2 A_Refire
    AUG1 A 0 A_JumpIfInventory("IsReloading",1,"Reload") 
    CO45 A 0 A_jumpifnoammo("Reload")
    Goto Ready
  Reload:	
    PIRE A 0 A_takeinventory("IsReloading",1)
    CORE A 0 A_jumpifinventory("Speedcola",1,"Reload_Speed")
    CORE A 0 A_jumpifinventory("PAPColt45clip",6,"Ready")
    CORE A 0 A_jumpifinventory("PAPColt45ammo",1,1)
	goto ready+1
	CORE A 0 A_playsound("Colt/clipout")
    CORE ABCDE 2
	CORE E 20
	goto Reload2
  Reload2:
	CORE E 0 A_GiveInventory("PAPColt45Clip",1)
    CORE E 0 A_TakeInventory("PAPColt45ammo",1)
	CORE E 0 A_jumpifinventory("PAPColt45clip",6,"Reloaddone")
	CORE E 0 A_jumpifinventory("PAPColt45ammo",1,"Reload2")
	goto Reloaddone
  Reloaddone:
    CORE E 0 A_playsound("Colt/clipin")
	CORE E 15 
    CORE E 0 A_playsound("Colt/bolt")
	CORE E 7
	CORE EDCBA 2
	Goto Ready
  Reload_Speed:
    CORE A 0 A_jumpifinventory("PAPColt45clip",6,"Ready")
    CORE A 0 A_jumpifinventory("PAPColt45ammo",1,1)
	goto ready+1
	CORE A 0 A_playsound("Colt/clipout")
    CORE ABCDE 1
	CORE E 10
	goto Reload2_Speed
  Reload2_Speed:
	CORE E 0 A_GiveInventory("PAPColt45Clip",1)
    CORE E 0 A_TakeInventory("PAPColt45ammo",1)
	CORE E 0 A_jumpifinventory("PAPColt45clip",6,"Reloaddone_Speed")
	CORE E 0 A_jumpifinventory("PAPColt45ammo",1,"Reload2_Speed")
	goto Reloaddone_Speed
  Reloaddone_Speed:
    CORE E 0 A_playsound("Colt/clipin")
	CORE E 7 
    CORE E 0 A_playsound("Colt/bolt")
	CORE E 4
	CORE EDCBA 1
	Goto Ready
  ThrowGrenade:
     HNDG BCD 1
     HNDG E 1 A_PlaySound("weapons/grenadepin")
     HNDG FGHH 1
     HNDG I 1 A_PlaySound("weapons/grenadethr") 
     HNDG J 0 A_FireCustomMissile("ThrownGrenade",0,0,0,0)
     HNDG J 0 A_PlaySound("weapons/grenadethr")
     HNDG JKLMNOPQ 1
     HNDG Q 0 A_TakeInventory("thrownade")
     Goto Ready
  Flash:
    TNTT A 0
	stop
  Spawn:
    COSP A -1
	stop
  }
}


actor PAPColt45Clip : Ammo
{
    inventory.icon "CLIPA0"
    inventory.amount 0
    inventory.maxamount 6
    ammo.backpackamount 0
    ammo.backpackmaxamount 6
    +IGNORESKILL
}


actor PAPColt45Ammo : Ammo
{
    inventory.icon "CLIPA0"
    inventory.amount 6
    inventory.maxamount 60
    ammo.backpackamount 6
    ammo.backpackmaxamount 60
    +IGNORESKILL
    inventory.pickupmessage "Got Colt45 rounds!"  
    States
    {
    Spawn:
      CLIP A -1
      Stop
    }
}

ACTOR FireGrenade
{
   Radius 5
   Height 5
   Speed 15
   Damage 500
   Scale 0.3
   Damagetype PHD
   
   PROJECTILE
   -NOGRAVITY
   +LOWGRAVITY
   States
   {
   Spawn:
      HGRN A 0
      HGRN A 4 A_AlertMonsters
      HGRN BCDEFABCDEFABCDEF 4
      Goto Death
   Death:
      HGRN G 0 A_PlaySound("weapons/grnexplode")
      HGRN G 0 A_Explode
      HGRN GHIJ 3 Bright
      Stop
   }
}