
/*Developer's note: I just want to say right now that this is quite possibly
the dumbest weapon I've made ever since I started doom modding, it also 
probably one of the most complex. To those of you wanting to pick apart
at this weapon to use elsewhere, I apologize in advance because I'm sure there's
far cleaner ways to implment this thing.

To anyone that possibly suffers from irrecoverable mental trauma from how dumb
this weapon is, I am deeply, deeply sorry.
*/ 

actor TSBrick : weapon
{
	+NOALERT
	+floatbob
	+AMMO_OPTIONAL
	+cheatnotweapon
	//+STRIFEDAMAGE
	Weapon.SelectionOrder 20
	Inventory.PickupSound "ZTweapons/flareclose"
	Inventory.PickupMessage "You got the Plakanomicon! Wield ancient brick magic!"
	Weapon.Kickback 100
	states
	{
	spawn:
		BNPU A 15
		BNPU A 4 bright
		loop
	select:
		TNT1 A 0
		TNT1 A 0 a_playsound ("brickbook/draw",0)
	draw:	
		TNT1 A 0
		LSBR FFFF 0 A_Raise
		LSBR F 1 A_Raise
		loop
	deselect:
		TNT1 A 0
		TNT1 A 0 a_jumpifhealthlower (1, "deadlower")
		LSBR CDEF 2
		TNT1 A 0 a_playsound ("brickbook/holster",0)
	holster:
		TNT1 A 0
		LSBR F 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:
		TNT1 A 0
		TNT1 A 0
		TNT1 A 0 a_jumpifinventory ("wallstack", 1, "prewallready")
		TNT1 A 0 a_jumpifinventory ("javelinstack", 3, "prejavelinready3")
		TNT1 A 0 a_jumpifinventory ("javelinstack", 2, "prejavelinready2")
		TNT1 A 0 a_jumpifinventory ("javelinstack", 1, "prejavelinready1")
		TNT1 A 0 a_jumpifinventory ("brickstack", 3, "prebrickready4")
		TNT1 A 0 a_jumpifinventory ("brickstack", 2, "prebrickready3")
		TNT1 A 0 a_jumpifinventory ("brickstack", 1, "prebrickready2")
		LSBR FEDDA 1
	Brickready1:
		LSBR AAAA 1 a_weaponready
		LSBR BBBBBB 1 a_weaponready
		LSBR CCCCCC 1 a_weaponready
		LSBR BBBBBB 1 a_weaponready
		loop
	Prebrickready2:
		LSBR FGHI 2 a_weaponready (WRF_NOSECONDARY)
		goto brickready2		
	brickready2:
		LSBR JJJJJ 1 a_weaponready
		LSBR KKK 1 a_weaponready
		LSBR LLL 1 a_weaponready
		LSBR MMMMM 1 a_weaponready
		loop
	Prebrickready3:
		LSBR TUVWX 2 a_weaponready (WRF_NOSECONDARY)
		goto brickready3		
	brickready3:
		LSBR XXXXXX 1 a_weaponready
		LSBR YYYYY 1 a_weaponready
		LSBR ZZZZZ 1 a_weaponready
		loop
	Prebrickready4:
		LSB1 HIJK 2 a_weaponready (WRF_NOSECONDARY)
		LSB1 P 1 a_weaponready (WRF_NOSECONDARY)
		goto Brickready4
	brickready4:
		LSB1 NNNN 1 a_weaponready
		LSB1 OOOOOO 1 a_weaponready
		LSB1 PPPPPP 1 a_weaponready
		loop
	Prejavelinready1:
		BRJV FEDDA 1
		goto javelinready1
	JavelinReady1:
		BRJV AAAA 1 a_weaponready
		BRJV BBBBBB 1 a_weaponready
		BRJV CCCCCC 1 a_weaponready
		BRJV BBBBBB 1 a_weaponready
		loop
	Prejavelinready2:
		BRJV FGHI 2 a_weaponready (WRF_NOSECONDARY)
		goto javelinready2
	Javelinready2:
		BRJV JJJJJ 1 a_weaponready
		BRJV KKK 1 a_weaponready
		BRJV LLL 1 a_weaponready
		BRJV MMMMM 1 a_weaponready
		loop		
	Prejavelinready3:
		BRJV TUVWX 2 a_weaponready (WRF_NOSECONDARY)
		goto javelinready3		
	Javelinready3:
		BRJV XXXXXX 1 a_weaponready
		BRJV YYYYY 1 a_weaponready
		BRJV ZZZZZ 1 a_weaponready
		loop
	PreJavelinready4:
		BRJ1 HIJK 2 a_weaponready (WRF_NOSECONDARY)
		BRJ1 P 1 a_weaponready (WRF_NOSECONDARY)
		goto Brickready4
	Javelinready4:
		BRJ1 NNNN 1 a_weaponready 
		BRJ1 OOOOOO 1 a_weaponready 
		BRJ1 PPPPPPP 1 a_weaponready
		loop
	PreWallready:
		BRW1 Z 1
		BRW2 ABC 1
		goto Wallready
	WallReady:
		BRW2 CC 1 a_weaponready (WRF_NOSECONDARY)
		BRW2 DD 1 a_weaponready (WRF_NOSECONDARY)
		BRW2 EE 1 a_weaponready (WRF_NOSECONDARY)
		BRW2 FF 1 a_weaponready (WRF_NOSECONDARY)
		BRW2 GG 1 a_weaponready	(WRF_NOSECONDARY)
		loop
	fire:
		TNT1 A 0
		TNT1 A 0
		TNT1 A 0 a_jumpifinventory ("wallstack", 1, "wallcast")
		TNT1 A 0 a_jumpifinventory ("javelinstack", 1, "Javelincast")
		LSB2 PQRST 1
		TNT1 A 0 a_jumpifinventory ("brickstack", 3, "BrickLV4")
		TNT1 A 0 a_jumpifinventory ("brickstack", 2, "BrickLV3")
		TNT1 A 0 a_jumpifinventory ("brickstack", 1, "BrickLV2")
		TNT1 A 0 a_takeinventory ("brickstack", 99)
	BrickLV1:
		LSB2 T 1
		TNT1 A 0 a_playsound ("brickbook/brickthrow",0)
		LSB2 UVW 1
		LSB2 Y 2 a_firecustommissile ("normalbrick")
		LSB2 Y 2
		LSB2 Z 1
		LSB3 ABC 2
		LSB2 T 1
		LSB2 TSRQQP 1
		LSBR FEEDDA 2 a_weaponready		
		goto brickready1
	BrickLV2:
		LSB2 T 1
		TNT1 A 0 a_playsound ("brickbook/brickthrow",0)
		LSB2 UVW 1
		TNT1 A 0 a_takeinventory ("brickstack", 99)
		TNT1 A 0 A_FireCustomMissile("normalbrick", Frandom(-7,7),0,0,0,0,Frandom(-7,7))
		LSB2 Y 2 A_FireCustomMissile("normalbrick", Frandom(-5,5),0,0,0,0,Frandom(-5,5))
		LSB2 Y 2
		LSB2 Z 1
		LSB3 ABC 2
		LSB2 T 1
		LSB2 TSRQQP 1
		LSBR FEEDDA 2 a_weaponready			
		goto brickready1
	BrickLV3:
		LSB2 T 1
		TNT1 A 0 a_playsound ("brickbook/brickthrow",0)
		LSB2 UVW 1
		TNT1 A 0 a_takeinventory ("brickstack", 99)
		TNT1 A 0 A_FireCustomMissile("normalbrick", Frandom(-9,9),0,0,0,0,Frandom(-9,9))
		TNT1 A 0 A_FireCustomMissile("normalbrick", Frandom(-7,7),0,0,0,0,Frandom(-7,7))
		LSB2 Y 2 A_FireCustomMissile("normalbrick", Frandom(-5,5),0,0,0,0,Frandom(-5,5))
		LSB2 Y 2
		LSB2 Z 1
		LSB3 ABC 2
		LSB2 T 1
		LSB2 TSRQQP 1
		LSBR FEEDDA 2 a_weaponready			
		goto brickready1
	BrickLV4:
		LSB2 T 1
		TNT1 A 0 a_playsound ("brickbook/brickthrow",0)
		LSB2 UVW 1
		TNT1 A 0 a_takeinventory ("brickstack", 99)
		TNT1 A 0 A_FireCustomMissile("normalbrick", Frandom(-11,11),0,0,0,0,Frandom(-11,11))
		TNT1 A 0 A_FireCustomMissile("normalbrick", Frandom(-9,9),0,0,0,0,Frandom(-9,9))
		TNT1 A 0 A_FireCustomMissile("normalbrick", Frandom(-7,7),0,0,0,0,Frandom(-7,7))
		LSB2 Y 2 A_FireCustomMissile("normalbrick", Frandom(-5,5),0,0,0,0,Frandom(-5,5))
		LSB2 Y 2
		LSB2 Z 1
		LSB3 ABC 2
		LSB2 T 1
		LSB2 TSRQQP 1
		LSBR FEEDDA 2 a_weaponready			
		goto brickready1
	Javelincast:
		BRJ2 PQRST 1
		TNT1 A 0 a_jumpifinventory ("javelinstack", 4, "javelinLV4")
		TNT1 A 0 a_jumpifinventory ("javelinstack", 3, "javelinLV3")
		TNT1 A 0 a_jumpifinventory ("javelinstack", 2, "javelinLV2")
	JavelinLV1:
		BRJ2 T 1
		TNT1 A 0 a_playsound ("brickbook/javthrow", 0)
		TNT1 A 0 a_takeinventory ("javelinstack", 99)
		BRJ2 UVW 1
		BRJ2 Y 2 a_firecustommissile ("brickjavelin")
		BRJ2 Y 2
		BRJ2 Z 1
		BRJ3 ABC 2
		BRJ2 T 1
		BRJ2 TSRQQP 1
		goto brickdown
	JavelinLV2:
		BRJ2 T 1
		TNT1 A 0 a_playsound ("brickbook/javthrow", 0)
		TNT1 A 0 a_takeinventory ("javelinstack", 99)
		BRJ2 UVW 1
		BRJ2 Y 2 a_firecustommissile ("brickjavelinLV2")
		BRJ2 Y 2
		BRJ2 Z 1
		BRJ3 ABC 2
		BRJ2 T 1
		BRJ2 TSRQQP 1
		goto brickdown
	JavelinLV3:
		BRJ2 T 1
		TNT1 A 0 a_playsound ("brickbook/javthrow", 0)
		TNT1 A 0 a_takeinventory ("javelinstack", 99)
		BRJ2 UVW 1
		BRJ2 Y 2 a_firecustommissile ("brickjavelinLV3")
		BRJ2 Y 2
		BRJ2 Z 1
		BRJ3 ABC 2
		BRJ2 T 1
		BRJ2 TSRQQP 1
		goto brickdown
	JavelinLV4:
		BRJ2 T 1
		TNT1 A 0 a_playsound ("brickbook/javthrow", 0)
		BRJ2 UVW 1
		TNT1 A 0 a_takeinventory ("javelinstack", 99)
		BRJ2 Y 2 a_firecustommissile ("brickjavelinLV4")
		BRJ2 Y 2
		BRJ2 Z 1
		BRJ3 ABC 2
		BRJ2 T 1
		BRJ2 TSRQQP 1
		goto brickdown
	Wallcast:
		BRW2 PQRST 1
		BRW2 T 1
		TNT1 A 0 a_takeinventory ("wallstack", 99)
		BRW2 UVW 1
		BRW2 Y 2 a_firecustommissile ("brickwall")
		BRW2 Y 2
		BRW2 Z 1
		BRW3 ABC 2
		BRW2 T 1
		BRW2 TSRQQP 1
		goto brickdown
	brickdown:
		TNT1 A 0
		TNT1 A 0
		TNT1 A 0 a_playsound ("brickbook/pageturn",0)
		LSB2 KLMNO 2
		goto ready
	altfire:
		TNT1 A 0
		TNT1 A 0
		TNT1 A 0 a_jumpifinventory ("javelinstack", 4, "WallUp")
		TNT1 A 0 a_jumpifinventory ("javelinstack", 3, "4JavelinUp")
		TNT1 A 0 a_jumpifinventory ("javelinstack", 2, "3JavelinUp")
		TNT1 A 0 a_jumpifinventory ("javelinstack", 1, "2JavelinUp")
		TNT1 A 0 a_jumpifinventory ("brickstack", 3, "1JavelinUp")
		TNT1 A 0 a_jumpifinventory ("brickstack", 2, "4Brickup")
		TNT1 A 0 a_jumpifinventory ("brickstack", 1, "3Brickup")
		TNT1 A 0 a_playsound ("brickbook/brickup",0)
		LSBR BCDEF 2
		LSB2 ABB 1 //LSB2 A and B are used for lowering and raising the fist
		LSB2 B 1
		TNT1 A 0 a_giveinventory ("brickstack", 1)
		LSBR FGHI 2 a_weaponready 
		goto brickready2
	3Brickup:
		TNT1 A 0
		TNT1 A 0
		TNT1 A 0 a_playsound ("brickbook/brickup",0)
		LSBR NOPQRS 2
		LSB2 ABB 1
		LSB2 B 1
		TNT1 A 0 a_giveinventory ("brickstack", 1)
		LSBR TUVWX 2 a_weaponready 
		goto Brickready3
	4Brickup:
		TNT1 A 0
		TNT1 A 0
		TNT1 A 0 a_playsound ("brickbook/brickup",0)
		LSBR W 1
		LSB1 BCEFG 2
		LSB2 ABB 1
		LSB2 B 1
		TNT1 A 0 a_giveinventory ("brickstack", 1)
		LSB1 HIJK 2 a_weaponready 
		LSB1 P 1 a_weaponready
		goto Brickready4
	1JavelinUp:
		TNT1 A 0
		TNT1 A 0
		TNT1 A 0 a_playsound ("brickbook/spellup",0)
		LSB1 P 1
		TNT1 A 0 a_takeinventory ("brickstack", 99)
		TNT1 A 0 a_giveinventory ("javelinstack",1)
		TNT1 A 0 a_playsound ("brickbook/javspell",0)
		LSB1 QRSTUVWXYZ 1
		LSB2 ABB 1
		TNT1 A 0 a_playsound ("brickbook/pageturn",0)
		BRJ2 KLMNO 2
		BRJ2 B 1
		BRJV FEDDA 1
		goto javelinready1
	2JavelinUp:
		TNT1 A 0
		TNT1 A 0
		TNT1 A 0 a_playsound ("brickbook/brickup",0)
		BRJV BCDEF 2
		BRJ2 ABB 1 //LSB2 A and B are used for lowering and raising the fist
		BRJ2 B 1
		TNT1 A 0 a_giveinventory ("javelinstack", 1)
		BRJV FGHI 2 a_weaponready 
		goto javelinready2
	3JavelinUp:
		TNT1 A 0
		TNT1 A 0
		TNT1 A 0 a_playsound ("brickbook/brickup",0)
		BRJV NOPQRS 2
		BRJ2 ABB 1
		BRJ2 B 1
		TNT1 A 0 a_giveinventory ("javelinstack", 1)
		BRJV TUVWX 2 a_weaponready 
		goto Javelinready3
	4JavelinUp:
		TNT1 A 0
		TNT1 A 0
		TNT1 A 0 a_playsound ("brickbook/brickup",0)
		BRJV W 1
		BRJ1 BCEFG 2
		BRJ2 ABB 1
		BRJ2 B 1
		TNT1 A 0 a_giveinventory ("javelinstack", 1)
		BRJ1 HIJK 2 a_weaponready (WRF_NOSECONDARY)
		BRJ1 P 1 a_weaponready  (WRF_NOSECONDARY)
		goto Javelinready4
	WallUp:
		TNT1 A 0
		TNT1 A 0
		TNT1 A 0 a_playsound ("brickbook/spellup",0)
		BRJ1 P 1
		TNT1 A 0 a_takeinventory ("javelinstack", 99)
		TNT1 A 0 a_giveinventory ("Wallstack",1)
		TNT1 A 0 a_playsound ("brickbook/wallspell",0)
		BRJ1 QRSTUVWXYZ 1
		BRJ2 ABB 1
		TNT1 A 0 a_playsound ("brickbook/pageturn",0)
		BRW2 KLMNO 2
		BRW2 B 1
		goto Wallready
	}
}


actor normalbrick
{
	Radius 7
	Height 9
	scale 0.15
	Speed 35
	+bright
	+thruspecies
	species "player"
	Damage 12
	Projectile
	gravity 1.30
	-NOGRAVITY
	+doombounce
	BounceCount 2
	projectilekickback 1000
	seesound "brickbook/brickbounce"
	deathsound "brickbook/brickbreak"
	states
	{
	spawn:
		TNT1 A 0
		TNT1 A 0
		TNT1 A 0 A_PlaySound("silence", CHAN_VOICE)
		TNT1 A 0 thrustthingz (0,10,0,1)
	fly:
		CYTB ABCD 2
		loop
	xdeath:
		TNT1 A 0
		TNT1 A 0
		TNT1 A 0 a_playsound ("brickbook/brickhit",0)
		TNT1 A 0 a_spawnitem ("dedbrick")
		TNT1 AAA 0 A_SpawnItemEx("brickshrapnel",0,0,0,random(-20,20),random(-20,20),random(5,10),random(0,359),32)
		stop				
	death:
		TNT1 A 0
		TNT1 A 0
		TNT1 A 0 a_spawnitem ("dedbrick")
		TNT1 AAA 0 A_SpawnItemEx("brickshrapnel",0,0,0,random(-20,20),random(-20,20),random(5,10),random(0,359),32)
		stop		
	}
}

actor brickjavelin
{
    +notimefreeze
	+BLOODSPLATTER
	+FORCEXYBILLBOARD	
	+thruspecies
	+ripper
	+bright
	species "player"
	Radius 11
	Height 8
	Speed 30
	gravity 0.40
	Damage (30)
	Projectile
	states
	{
	spawn:	
		BJAV AAAAAA 2
		BJAV A 1 a_changeflag ("nogravity", 0)
	falling:
		BJAV A 1
		loop
	death:
		TNT1 A 0
		TNT1 A 0
		TNT1 A 0 A_playsound ("ZTweapons/flareexplode",0,0.65)
		TNT1 A 0 A_playsound ("brickbook/javbreak",0,1,0,0.70)
		TNT1 A 0 a_changeflag ("nogravity", 1)
		TNT1 A 0 radius_quake (1,8,0,20,0)
		TNT1 AAAAA 0 A_SpawnItemEx("Brickdebris",0,0,3,random(-6,6),random(-6,6),random(6,12),random(0,359),32)
		TNT1 AAAAA 0 A_SpawnItemEx("Brickdebris",0,0,3,random(-6,6),random(-6,6),random(6,12),random(0,359),32)
		TNT1 A 0 a_explode (60,50,1,0,50)
		MIS3 ABCDEFGH 2 Bright
		stop
	}
}

actor brickjavelinLV2 : brickjavelin
{
	speed 50
	damage (70)
	states
	{
	spawn:	
		BJAV AAAAAAAA 2
		BJAV A 1 a_changeflag ("nogravity", 0)
	falling:
		BJAV A 1
		loop
	death:
		TNT1 A 0
		TNT1 A 0
		TNT1 A 0 a_changeflag ("nogravity", 1)
		TNT1 A 0 A_playsound ("ZTweapons/flareexplode",0,0.65)
		TNT1 A 0 A_playsound ("brickbook/javbreak",0,1,0,0.70)
		TNT1 A 0 radius_quake (2,4,0,20,0)
		TNT1 AAAAA 0 A_SpawnItemEx("Brickdebris",0,0,3,random(-6,6),random(-6,6),random(6,12),random(0,359),32)
		TNT1 AAAAA 0 A_SpawnItemEx("Brickdebris",0,0,3,random(-6,6),random(-6,6),random(6,12),random(0,359),32)
		TNT1 A 0 a_explode (80,80,1,0,80)
		MIS3 ABCDEFGH 2 Bright
		stop
	}
}

actor brickjavelinLV3 : brickjavelin
{
	speed 75
	damage (100)
	states
	{
	spawn:	
		BJAV AAAAAAAAAA 2
		BJAV A 1 a_changeflag ("nogravity", 0)
	falling:
		BJAV A 1
		loop
	death:
		TNT1 A 0
		TNT1 A 0
		TNT1 A 0 a_changeflag ("nogravity", 1)
		TNT1 A 0 A_playsound ("ZTweapons/flareexplode",0,0.65)
		TNT1 A 0 A_playsound ("brickbook/javbreak",0,1,0,0.70)
		TNT1 A 0 radius_quake (2,8,0,20,0)
		TNT1 AAAAA 0 A_SpawnItemEx("Brickdebris",0,0,3,random(-6,6),random(-6,6),random(6,12),random(0,359),32)
		TNT1 AAAAA 0 A_SpawnItemEx("Brickdebris",0,0,3,random(-6,6),random(-6,6),random(6,12),random(0,359),32)
		TNT1 A 0 a_explode (100,120,1,0,120)
		MIS3 ABCDEFGH 2 Bright
		stop
	}
}

actor brickjavelinLV4 : brickjavelin
{
	speed 100
	damage (150)
	states
	{
	spawn:	
		BJAV A 1
		loop
	death:
		TNT1 A 0
		TNT1 A 0
		TNT1 A 0 radius_quake (3,8,0,20,0)
		TNT1 A 0 A_playsound ("ZTweapons/flareexplode",0,0.65)
		TNT1 A 0 A_playsound ("brickbook/javbreak",0,1,0,0.70)
		TNT1 AAAAA 0 A_SpawnItemEx("Brickdebris",0,0,3,random(-6,6),random(-6,6),random(6,12),random(0,359),32)
		TNT1 AAAAA 0 A_SpawnItemEx("Brickdebris",0,0,3,random(-6,6),random(-6,6),random(6,12),random(0,359),32)
		TNT1 A 0 a_explode (165,160,1,0,160)
		MIS3 ABCDEFGH 2 Bright
		stop
	}
}

actor brickwall
{
	projectile
	+noblood
	+shootable
	+ripper
	+bloodlessimpact
	+floorhugger
	+thruspecies
	+bright
	+notargetswitch
	+NORADIUSDMG
	+dontblast
	-bloodsplatter
	-noblockmap
	Radius 30
	Height 60
	mass 99999
	Speed 20
	Damage (10)
	species "player"
	alpha 0.60
	Scale 1
	Decal RailScorchLower
	states
	{
	spawn:	
		TNT1 A 0
		TNT1 A 0 a_playsound ("brickbook/wallslide", 6,1,1,0.7)
	sliding:
		TNT1 A 0 a_jumpifinventory ("walltimer", 35, "death")
		TNT1 A 0 A_SpawnItemEx("brickshrapnel",0,0,0,random(-20,20),random(-20,20),random(5,10),random(0,359),32)
		TNT1 AA 0 a_spawnitemex ("wallparticle", Frandom(-30,30),Frandom(-30,30))
		TNT1 A 0 a_radiusthrust (600,100)
		VXWA A 1
		TNT1 A 0 a_spawnitemex ("wallparticle", Frandom(-30,30),Frandom(-30,30))
		TNT1 A 0 A_SpawnItemEx("brickshrapnel",0,0,0,random(-20,20),random(-20,20),random(5,10),random(0,359),32)
		TNT1 A 0 radius_quake (2,6,0,15,0)
		TNT1 A 0 a_giveinventory ("walltimer", 1)
		loop
	death:
		TNT1 A 0
		TNT1 A 0 a_stopsound (6)
		TNT1 A 0 a_playsound ("cygnus/rocketboom",0)
		TNT1 A 0 a_playsound ("brickbook/wallexplode",0)
		TNT1 A 0 radius_quake (3,6,0,15,0)
		TNT1 AAAAAAA 0 A_SpawnItemEx("normalbrick",0,0,0,random(-40,40),random(-40,40),random(10,20),random(0,359),32)
		TNT1 AAAAAAAAAAAAAAAAA 0 A_SpawnItemEx("lavalazersmoke",0,0,3,random(-8,8),random(-10,10),random(4,10),random(0,359),32)
		TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAA 0 A_SpawnItemEx("lavalazersmoke2",0,0,3,random(-8,8),random(-10,10),random(4,10),random(0,359),32)
		TNT1 A 0 a_spawnitemex ("wallsmoke")
		stop
	}
}


ACTOR Brickshrapnel
{
	Damage 5
	Speed 12
	Radius 6
	Height 3
	Scale 0.5
	Gravity 0.7
	PROJECTILE
	-NOGRAVITY
	+DONTBLAST
	+bright
	+thruspecies
	+hexenbounce
	BounceCount 4
	seesound "brickbook/stonebounce"
	species "player"
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 0
		TNT1 A 0 a_playsound ("silence",CHAN_VOICE)
	rollin:
		ESTN A 1	  
		Loop
	Death:
		TNT1 A 0
		TNT1 A 0
		TNT1 A 0 a_playsound ("brickbook/stonebreak",0)
		ESTN B 3
		TNT1 AAA 0 A_SpawnItemEx("Brickdebris",0,0,3,random(-1,1),random(-1,1),random(2,4),random(0,359),32)
		Stop
	}
}


ACTOR Brickdebris
{
	Speed 8
	Radius 2
	Height 2
	Scale 0.2
	Gravity 0.6
	PROJECTILE
	-NOGRAVITY
	+bright
	+DONTBLAST
	+thruspecies
	species "player"
	States
	{
	Spawn:
		ESTN C 1	  
		Loop
	Death:
		TNT1 A 0
		Stop
	}
}


actor dedbrick
{
	+NOBLOCKMAP
	+DONTSPLASH
	+nogravity
	+dontfall
	+NOTELEPORT
	+bright
	+thruactors
	+clientsideonly
	+thruspecies
	species "player"
	scale 0.50
	States
	{
	spawn: 
		ESTN AB 2
		goto death
	death:
		TNT1 A 0
		TNT1 A 0
		TNT1 AAA 0 A_SpawnItemEx("Brickdebris",0,0,3,random(-1,1),random(-1,1),random(2,4),random(0,359),32)
		TNT1 AA 0 A_SpawnItemEx("lavalazersmoke",0,0,3,random(-1,1),random(-1,1),random(0,1),random(0,359),32)
		stop
	}
}

actor wallsmoke
{
	+NOBLOCKMAP
	+DONTSPLASH
	+nogravity
	+dontfall
	+NOTELEPORT
	+bright
	+thruactors
	+clientsideonly
	+thruspecies
	RenderStyle add
	alpha 0.60
	species "player"
	scale 3
	States
	{
	spawn:
		WLXP ABCDEFGHI 1
		WLXP JKLMNOP 1 a_fadeout (0.05)
		stop
	death:
		TNT1 A 0
		TNT1 A 0
		stop
	}
}

actor droppedbrick
{
	+notimefreeze
	renderstyle ADD
	alpha 0.50
	states
	{
	spawn:
		BNPU A 60
		goto death
	death:
		TNT1 A 0
		TNT1 A 0 a_spawnitemex ("bricktoken")
		stop
	}
}

actor bricktoken : custominventory
{
	+notimefreeze
	+floatbob
	Inventory.PickupSound "brickbook/pickup"
	Inventory.PickupMessage "You got the Plakanomicon! Wield ancient brick magic!"
	states
	{
	spawn:
		BNPU A 8 bright
		BNPU A 5
		loop
	pickup:
		TNT1 A 0
		TNT1 A 0 a_jumpifinventory ("flaregun", 1, "dropflare")
		TNT1 A 0 a_jumpifinventory ("havocrebounder", 1, "droprebounder")
		TNT1 A 0 a_giveinventory ("tsbrick", 1)
		stop
	dropflare:
		TNT1 A 0
		TNT1 A 0 a_spawnitemex ("droppedflare", 1)
		TNT1 A 0 a_takeinventory ("flaregun", 1)
		TNT1 A 0 a_giveinventory ("tsbrick", 1)
		stop
	droprebounder:
		TNT1 A 0
		TNT1 A 0 a_spawnitemex ("droppedrebounder", 1)
		TNT1 A 0 a_takeinventory ("havocrebounder", 1)
		TNT1 A 0 a_giveinventory ("tsbrick", 1)
		stop
	}
}
		
		 

actor brickstack : inventory
{inventory.maxamount 5}

actor javelinstack : inventory
{inventory.maxamount 5}

actor Wallstack : inventory
{inventory.maxamount 1}
