//Generic effects used for multiple weapons

ACTOR CAPuff : BulletPuff
{
	+NOBLOCKMAP
	+NOGRAVITY
	+ALLOWPARTICLES
	+RANDOMIZE
	+thruspecies
	+MTHRUSPECIES
	+puffonactors
	+bright
	+NOEXTREMEDEATH
	species "Player"
	RenderStyle Add
	Alpha 0.50
	VSpeed 0
	scale 0.20
	Mass 5
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 1
		TNT1 A 1		
	XDeath:
		TNT1 A 1
		TNT1 A 0 a_playsound ("blastmaster/PuffHit",CHAN_VOICE,0.8,0,1.5)	
		TNT1 A 0 a_setscale (0.90,0.90)
		MNSP ABCD 1
		stop
	Crash:
		BPK1 A 1 Bright
		BPK1 A 1
		TNT1 A 0 a_playsound ("blastmaster/ricochet",CHAN_VOICE,0.5,0,1.5)	
		TNT1 AA 0 a_spawnitemex ("CABulletSpark",5,0,0,Frandom(-200,200)/20.0,Frandom(-200,200)/20.0,Frandom(-200,200)/20.0,0,SXF_NOCHECKPOSITION,160)		
		BPK1 A 1 A_SetScale (scalex * frandom(1.20,1.40),scaley * frandom(1.20,1.40))
		BPK1 A 1 A_SetScale (scalex * frandom(0.70,0.80),scaley * frandom(0.70,0.80))
		BPK1 A 1 A_SetScale (scalex * frandom(0.20,0.40),scaley * frandom(0.20,0.40))
		Stop
	}
}

ACTOR CABulletSpark : Fastprojectile
{
	radius 3
	height 6
	speed 10
	scale 0.25
	projectile
	+nointeraction
	+FLOORCLIP
	+DONTSPLASH
	+thruactors
	+NOTELEPORT
	+clientsideonly
	+bright
	+hexenbounce
	bouncecount 2
	Renderstyle Add
	alpha 0.80
	missiletype "CABulletSparkTrail"
	Missileheight 9
	States
	{
	spawn:	
		TNT1 A 4
		goto death
	Death:
		TNT1 A 1
		stop
	}
}

actor CABulletSparkTrail
{
	+nointeraction
	+clientsideonly
	scale 0.25
	renderstyle add
	alpha 0.90
	states
	{
	spawn:
		PUFF A 1
		goto death
	death:
		PUFF A 1
		TNT1 A 0 a_fadeout (0.20)
		loop
	}
}



//Generic bullet projectile actors used for a few weapons

actor genkabullet : fastprojectile
{
	+notimefreeze
	projectile
    +FORCEXYBILLBOARD	
    +BLOODSPLATTER
	+thruspecies
	species "player"
	missiletype "CAbullettracer"
    missileheight 10
	height 4
	radius 4
	speed 300
	damage 2
    Scale 0.2
	Decal bulletchip
	alpha 0.55
	states
	{
	spawn:
		TNT1 A 1
		loop
	death:
		PUFF A 1 Bright
		BPK1 A 1
		TNT1 A 0 a_playsound ("blastmaster/ricochet",CHAN_VOICE,0.5,0,1.5)
		TNT1 AAA 0 a_spawnitemex ("CABulletSpark",4,0,0,Frandom(-200,200)/20.0,Frandom(-200,200)/20.0,Frandom(-200,200)/20.0,0,SXF_NOCHECKPOSITION)			BPK1 A 1 
		BPK1 A 1 A_SetScale (scalex * frandom(1.20,1.40),scaley * frandom(1.20,1.40))
		BPK1 A 1 A_SetScale (scalex * frandom(0.70,0.80),scaley * frandom(0.70,0.80))
		BPK1 A 1 A_SetScale (scalex * frandom(0.20,0.40),scaley * frandom(0.20,0.40))
		Stop
	xdeath:
		TNT1 A 0
		TNT1 A 0 a_playsound ("blastmaster/puffhit",CHAN_VOICE,0.60,0,1.5)
		TNT1 A 1
		stop
	}
}

actor bloodlessgenkabullet : genkabullet
{
    -BLOODSPLATTER
	+PAINLESS
}

actor genkabulletspray : genkabullet
{
	speed 80
}

actor Bloodlessgenkabulletspray : genkabulletspray
{
    -BLOODSPLATTER
	+PAINLESS
}




//CLIPS AND CASING EFFECTS
//Code shamelessly borrowed from Pillowblaster's Trailblazer
//Mod, with permission of course

ACTOR PistolClipDrop
{
	Radius 3
	Height 5
	Speed 0
	Scale 0.2
	PROJECTILE
	-NOGRAVITY
	+BOUNCEONACTORS
	Gravity 0.75
	BounceType Doom
	BounceCount 4
	BounceFactor 0.8
	+clientsideonly
	States
	{
	Spawn:
		CLP1 A 0
		CLP1 ABCDEFGH 1 A_JumpIf(floorz == z, "clipbounce")
		Loop
	clipbounce:
		TNT1 A 0 a_playsound ("Clip/pistol")
		CLP1 A 1 thrustthing (random(1,359),1,0,0)
		goto spawn
	Death:
		TNT1 A 0 a_jump (256, "dead1", "dead2")
		loop
	Dead1:
		TNT1 A 0 a_playsound ("Clip/pistol")
		CLP1 I 50
		CLP1 I 1 a_fadeout (0.01)
		wait
	Dead2:
		TNT1 A 0 a_playsound ("Clip/pistol")
		CLP1 J 50
		CLP1 J 1 a_fadeout (0.01)
		wait
   }
}



//MORE NICKED SHIT

ACTOR BulletCasingSpawner //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("BulletCasing",0,0,random(-100,-80),CMF_AIMDIRECTION,random(-15,15))
		Stop
	}
}

ACTOR BIGBulletCasingSpawner
{
	Speed 13
	PROJECTILE
	+NOCLIP
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 0 A_CustomMissile("BIGBulletCasing",0,0,random(-100,-80),CMF_AIMDIRECTION,random(-15,15))
		Stop
	}
}



ACTOR BulletCasing
{
	Radius 2
	Height 4
	Speed 8
	Scale 0.1
	PROJECTILE
	-NOGRAVITY
	+BOUNCEONACTORS
	+DONTSPLASH
	+DOOMBOUNCE
	+clientsideonly
	Gravity 0.75
	BounceCount 6
	BounceFactor 0.6  
	SeeSound "Casing/Bullet"
	DeathSound "Casing/Bullet"
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 0 A_PlaySound("silence", CHAN_VOICE)
		CAS1 ABCDEFGH 1 bright
		Goto rollingloop
	rollingloop:
		CAS1 ABCDEFGH 1 bright
		Loop
	Death:
		TNT1 A 0 a_jump (256, "dead1","dead2")
		loop
	dead1:
		CAS1 I 60 bright
		CAS1 I 1 bright a_fadeout (0.01)
		wait
 	dead2:
		CAS1 J 60 bright
		CAS1 J 1 bright a_fadeout (0.01)
		wait
	}
}

//------------------------------------------------
//------------------------------------------------
//Big ass casing for the .100% Tactical Pistol
//------------------------------------------------
//------------------------------------------------

ACTOR BIGBulletCasing
{
	Damage (60)
	+THRUSPECIES
	Species "Player"
	scale 1
	gravity 0.95
	bouncecount 8
	bouncefactor 1
	seesound "pipe/wall"
	Deathsound "pipe/wall"	
	Radius 5
	Height 8
	PROJECTILE
	-NOGRAVITY
	+BOUNCEONACTORS
	+DONTSPLASH
	+DOOMBOUNCE
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 0 A_PlaySound("silence", CHAN_VOICE)
		CAS1 ABCDEFGH 1 bright
		Goto rollingloop
	rollingloop:
		CAS1 ABCDEFGH 1 bright
		Loop
	Death:
		TNT1 A 0 a_jump (256, "dead1","dead2")
		TNT1 A 1
		loop
	dead1:
		CAS1 I 60 bright
		CAS1 I 1 bright a_fadeout (0.01)
		wait
 	dead2:
		CAS1 J 60 bright
		CAS1 J 1 bright a_fadeout (0.01)
		wait
	}
}
	


//=============================================================================================
//=============================================================================================
//SMOKE STUFF
//=============================================================================================
//=============================================================================================


ACTOR smashersmokespawner
{
	projectile
	RenderStyle Translucent
	speed 20
	-SOLID
	+NOBLOCKMAP
	+NOGRAVITY
	+NOCLIP
	+DONTSPLASH
	+NOTELEPORT
	+clientsideonly
	States
	{
	Spawn:
        TNT1 A 0
        TNT1 A 1 a_stop
        TNT1 AA 0 A_SpawnItemEx("smashersmoke",frandom(-0.1,0.1),frandom(-0.1,0.1),frandom(-1.5,-1.5),frandom(0.5,5),frandom(-0.5,0.5),frandom(-0.5,0.5),0,32)
        TNT1 A 1 A_SpawnItemEx("smashersmoke",frandom(-0.1,0.1),frandom(-0.1,0.1),frandom(-1.5,-1.5),frandom(0.5,5),frandom(-0.5,0.5),frandom(-0.5,0.5),0,32)
        TNT1 AA 0 A_SpawnItemEx("smashersmoke",frandom(-0.1,0.1),frandom(-0.1,0.1),frandom(-1.5,-1.5),frandom(0.5,5),frandom(-0.5,0.5),frandom(-0.5,0.5),0,32)
        TNT1 A 1 A_SpawnItemEx("smashersmoke",frandom(-0.1,0.1),frandom(-0.1,0.1),frandom(-1.5,-1.5),frandom(0.5,5),frandom(-0.5,0.5),frandom(-0.5,0.5),0,32)
		Stop
	}
}

actor Smashersmoke
{
    Radius 1
    Height 1
	Scale 0.10
	renderstyle add
	Alpha 0.80
    Projectile
	+FORCEXYBILLBOARD
	+clientsideonly
    +NOCLIP
    States
    {
   Spawn:
      TNT1 A 2
      SMOK ABCDEFGHIJKLMNOPQ 2 A_FadeOut(0.1)
      Stop
    }
}



actor MiniSmoke
{
    Radius 1
    Height 1
	Scale 0.05
	renderstyle add
	Alpha 0.80
    Projectile
	+FORCEXYBILLBOARD
	+clientsideonly
    +NOCLIP
    States
    {
   Spawn:
      TNT1 A 2
      SMOK ABCDEFGHIJKLMNOPQ 2 A_FadeOut(0.1)
      Stop
    }
}


//=============================================================================================
//=============================================================================================
//SHELL CASINGS
//=============================================================================================
//=============================================================================================


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:
		TNT1 A 0
		TNT1 A 0 thrustthingz (0,random(10,15),0,1)
		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
	}
}


//Harmless bullet puff actor to activate switches for projectile
//only weapons

actor flickpuff : bulletpuff
{
	renderstyle "normal"
	+FORCEXYBILLBOARD	
	+LOOKALLAROUND
	+bloodlessimpact
	+PUFFONACTORS
	-ALLOWPARTICLES
	states
	{
	spawn:
		TNT1 A 0
		stop
	}
}

