actor BitchinPellet : FastProjectile
{
	+notimefreeze
    +FORCEXYBILLBOARD	
	+thruspecies
	obituary "%o got SMACKED THE FUCK UP by %k's badass shotgun."
	damage (random(10,11))
	species "player"
	missiletype "bullettracer"
    missileheight 1
	speed 1
	height 1
	radius 1
	gravity 0.01
    Scale 1
	alpha 0.95
	-NOGRAVITY
	+BLOODSPLATTER
	+NOEXTREMEDEATH
	decal "BulletChip"
	states
	{
	Spawn:
		TNT1 A 1
		TNT1 A 1 A_ScaleVelocity(600)
	Spawn2:
		TNT1 A 35 A_ScaleVelocity(0.98)
		loop
	Death:
		TNT1 A 1 A_SpawnItem("BulletPuff")
		stop
	XDeath:
		TNT1 A 0
		TNT1 A 0
		TNT1 A 0 a_jumpifintargetinventory ("daibatana", 1, "givecharge")
		TNT1 A 1
		stop
	givecharge:
		TNT1 A 0
		TNT1 A 0
		TNT1 A 0 a_jump (60, "nothing")
		TNT1 A 0 a_giveinventory ("batcharge", 1, AAPTR_TARGET)
		stop
	nothing:
		TNT1 A 0
		TNT1 A 5 
		stop
	}
}

actor BitchinShotgun : Shotgun replaces Shotgun
{
	weapon.slotnumber 3
	+WEAPON.NOALERT
	Inventory.PickupMessage "You got the Whiplash shotgun!"
	states
	{
	spawn:
		ESHT A -1
		stop
	select:
		TNT1 A 0
		TNT1 A 0 a_playsound ("shotgun/draw",0)
	draw:	
		TNT1 A 0
		ESHG AAAA 0 A_Raise
		ESHG A 1 A_Raise
		loop
	deselect:
		TNT1 A 0
		TNT1 A 0 a_jumpifhealthlower (1, "deadlower")
		TNT1 A 0 a_playsound ("shotgun/holster",0)
	holster:
		TNT1 A 0
		ESHG A 1 a_lower
		TNT1 A 0 a_takeinventory ("secretaction", 99)
		TNT1 AA 0 a_lower
		loop
	deadlower:
		TNT1 A 0
		TNT1 A 0
		TNT1 AAAAAAAAAAAAA 0 a_lower
		TNT1 A 1 a_lower
		wait		
	Ready:
		ESHG A 1 A_WeaponReady
		wait
	Fire:
		TNT1 A 0 a_gunflash
		ESHG B 0 Bright A_PlaySound("shotgun/fire", 1)
		ESHG B 1 Bright A_FireCustomMissile("BitchinPellet", Frandom(-1500, 1500) / 1000.0, 1, 0, 8, 0, Frandom(-1200, 1200) / 1000.0)
		ESHG BBBBBBBB 0 Bright A_FireCustomMissile("BitchinPellet", Frandom(-1500, 1500) / 1000.0, 0, 0, 8, 0, Frandom(-1200, 1200) / 1000.0)
		TNT1 A 0 offset (0,50)
		ESHG C 1 A_Quake(2, 5, 0, 32)
		ESHG D 1 offset (0,55)
		ESHG A 1 offset (0,50)
		ESHG A 1 offset (0,45)
		ESHG A 1 offset (0,35)
		ESHG EF 2
		ESHG G 3 
		ESHG HI 2 a_playsound ("shotgun/pump1",0)
		TNT1 A 0 a_alertmonsters
		D3PS C 0 A_FireCustomMissile("Shellcasingspawner",0,0,-3,2)
		ESHG J 4
		TNT1 A 0  a_playsound ("shotgun/pump2",0)
		ESHG HGFE 2
		ESHG A 4 offset (0,32)
		ESHG A 4 A_ReFire
		Goto Ready
	altfire:
		ESHG A 1 a_jumpifinventory ("shell", 4, "whiplashshot")
		goto ready
	whiplashshot:
		ESHG E 1  A_PlaySound("pipe/swing")
		ESHG FG 1
		CRAM AABBCDD 1
		//CRAM D 1 
		CRAM EFGH 1
		TNT1 A 0 A_playsound ("shotgun/shellcram")
		CRAM I 2 A_spawnitemex("Shellcasing",15,0,40,random (-5,5),random (-5,5),random (-5,5))
		CRAM IIIIII 0 A_spawnitemex("Shellcasing",15,0,40,random (-5,5),random (-5,5),random (-5,5))
		CRAM J 2
		ESHG HI 2 a_playsound ("shotgun/pump1",0)
		ESHG J 6
		TNT1 A 0  a_playsound ("shotgun/pump2",0)
		ESHG HGFE 2
		TNT1 A 0 a_refire ("holdthatgun")
		goto whiplashfinish
	Holdthatgun:
		TNT1 A 0
		ESHG A 1
		TNT1 A 0 a_refire ("stillholding")
		goto whiplashfinish
	stillholding:
		TNT1 A 0
		ESHG A 1 
		TNT1 A 0 A_Quake(1, 2, 0, 5, 0)
		TNT1 A 0 a_refire ("holdthatgun")
		goto whiplashfinish
	whiplashfinish: 
		ESHG B 0 Bright A_PlaySound("shotgun/superfire", 0)
		TNT1 A 0 a_alertmonsters
		TNT1 A 0 a_takeinventory ("shell",4)
		ESHG B 2 Bright A_FireCustomMissile("BitchinPellet", Frandom(-1500, 1500) / 1000.0, 1, 0, 8, 0, Frandom(-1200, 1200) / 1000.0)
		TNT1 A 0 offset (0,60)
		TNT1 A 0 ThrustThingZ (0, 15, 0, 0)	
		TNT1 A 0 A_ChangeVelocity(Cos(Pitch)*-30,0,Sin(Pitch)*20,1)
		ESHG BBBBBBBBBBBBBBBBBBBBBBBBBB 0 Bright A_FireCustomMissile("BitchinPellet", Frandom(-1500, 1500) / 1000.0, 0, 0, 8, 0, Frandom(-1200, 1200) / 1000.0)
		D3PS BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB 0 A_firecustommissile ("genkabulletspray",Frandom(6, -6), 0, -1, 1, 0, Frandom(6, -6))
		ESHG C 2  A_Quake(5, 10, 0, 32)
		TNT1 A 0 offset (0,65)
		TNT1 A 0 offset (0,55)
		ESHG D 2
		TNT1 A 0 offset (0,50)
		ESHG A 1 offset (0,45)
		ESHG A 1 offset (0,40)
		ESHG A 1 offset (0,35)
		ESHG A 3		
		ESHG EF 2
		ESHG G 3 
		ESHG HI 2 a_playsound ("shotgun/pump1",0)
		D3PS CCCCCC 0 A_FireCustomMissile("Shellcasingspawner",0,0,-3,2)
		ESHG J 5
		TNT1 A 0  a_playsound ("shotgun/pump2",0)
		ESHG HGFE 2
		ESHG A 5
		Goto Ready
	Flash:
		TNT1 A 2 Bright A_Light(3)
		TNT1 A 2 Bright A_Light2
		TNT1 A 2 Bright A_Light1
		Goto LightDone
	}
}


actor Blockorb : FastProjectile
{
    Radius 32
    Height 32
    Health 2
    Speed 64
    Damage 0
    PainChance 255
    RadiusDamageFactor 0.0
    Projectile
	species "Player"
	+THRUSPECIES
    +SHOOTABLE
    +NOBLOOD
    +BLOODLESSIMPACT
    +DONTSPLASH
    +NODAMAGE
	+DONTBLAST
    -NOBLOCKMAP
    States
    {
    Spawn:
        TNT1 AA 1
        Stop
    Pain:
        TNT1 A 0
        TNT1 A 0 A_Stop
        TNT1 A 1
        stop
    Death:
        TNT1 A 0
        TNT1 A 0 A_Stop
		TNT1 A 1
        Stop
    }
}


ACTOR ShellCasingSpawner //Shamelessly stolen from probably one of Weasel's mods, yoink. (Then taken by me, double yoink)
{
	Speed 13
	PROJECTILE
	+NOCLIP
	States
	{
	Spawn:
		TNT1 AA 0 A_CustomMissile("ShellCasing",0,0,random(-100,-80),CMF_AIMDIRECTION,random(-15,15))
		Stop
	}
}

ACTOR ShellCasing
{
	Radius 2
	Height 4
	Speed 8
	Scale 0.2
	PROJECTILE
	-NOGRAVITY
	+BOUNCEONACTORS
	+DONTSPLASH
	Gravity 0.75
	BounceType Doom
	BounceCount 6
	BounceFactor 0.6  
	+clientsideonly
	States
	{
	Spawn:
		CAS2 ABCDEFGH 1 bright
		Goto rollingloop
	rollingloop:
		TNT1 A 0 a_playsound ("Casing/Shotgun",0,1,0,1.6)
		CAS2 A 0 A_Jump(128,1,3,5,7)
		CAS2 ABCDEFGH 1 bright
		Loop
	Death:
		TNT1 A 0 a_jump (256, "dead1","dead2")
		loop
	dead1:
		TNT1 A 0 a_playsound ("Casing/Shotgun",0,1,0,1.6)
		CAS2 I 60 bright
		CAS2 I 1 bright a_fadeout (0.01)
		wait
 	dead2:
		TNT1 A 0 a_playsound ("Casing/Shotgun",0,1,0,1.6)
		CAS2 J 60 bright
		CAS2 J 1 bright a_fadeout (0.01)
		wait
	}
}

actor Pipewall : Inventory
{
	inventory.maxamount 1
}

actor pipehit : inventory 
{
	inventory.maxamount 1
}
