Actor PicoRifle : Weapon 
{
	+INVENTORY.UNTOSSABLE
	+INVENTORY.UNDROPPABLE
	+Weapon.noalert
	
	+WEAPON.PRIMARY_USES_BOTH
	+Weapon.ammo_optional
	Weapon.SlotNumber 2
	Inventory.RestrictedTo "Pico"
	Inventory.Pickupmessage "Step one is done, It's go time!"
	Weapon.AmmoType1 "PicoRifleMag"
	Weapon.AmmoType2 "PicoRifleAmmount"
	Tag "Janitors Rifle"
	Weapon.UpSound "Picorifle/equip"
	STATES
	{
	Ready:
		P2FL A 1 A_weaponready(WRF_ALLOWRELOAD)
		Loop
	Select:
		P2FL A 1 A_Raise
		Loop
	Deselect:
		Tnt1 A 0 A_takeinventory("BYOCCurrentlyReloading",1)
		P2FL A 1 A_Lower
		Loop
	Fire:
		P2FL A 0 A_Jumpifinventory("PicoRifleMag",1,1)
		Goto Reload
		P2FL B 2 Bright
		TNT1 A 0 A_Alertmonsters
		TNT1 A 0 A_FireBullets(2.2, 2, 1, 12, "PicoBulletPuffRifle",FBF_NORANDOM)
		TNT1 A 0 a_gunflash("ViewMover")
		TNT1 A 0 a_quake(1,4,0,128,"NoSound")
		TNT1 A 0 A_TakeInventory("PicoRifleMag",1,TIF_NOTAKEINFINITE) 
		TNT1 A 0 A_PlaySound("PicoRifle/fire", CHAN_WEAPON)	
		P2FL C 1
		P2FL A 2 OFFSET(0,30) 
		P2FL A 1
		PRLF A 0 A_Refire("HTFire")
		P2FL A 1
		GOTO Ready
	HTFire:
		P2FL A 0 A_Jumpifinventory("PicoRifleMag",1,1)
		Goto Reload
		P2FL B 2 Bright
		TNT1 A 0 A_Alertmonsters
		TNT1 A 0 A_FireBullets(2.2, 2, 1, 10, "PicoBulletPuffRifle",FBF_NORANDOM)
		TNT1 A 0 a_gunflash("ViewMover")
		TNT1 A 0 a_quake(1,4,0,128,"NoSound")
		TNT1 A 0 A_TakeInventory("PicoRifleMag",1,TIF_NOTAKEINFINITE) 
		TNT1 A 0 A_PlaySound("PicoRifle/fire", CHAN_WEAPON)	
		P2FL C 1
		P2FL A 2 OFFSET(0,30) 
		P2FL A 1 
		PRLF A 0 A_Refire("Fire")
		P2FL A 1 
		GOTO Ready
	Altfire:
		"####" "#" 0 A_jumpifInventory("PicoMeterCountdown",0,1)
		Goto Click
		"####" "#"1 Offset(4,34) 
		"####" "#"1 Offset(9,36)
		"####" "#"1 Offset(15,40)
		"####" "#"1 Offset(15,40)
		"####" "#"1 Offset(22,48)
		"####" "#"1 Offset(30,54)
		"####" "#"1 Offset(39,65)
		"####" "#"1 Offset(45,72)
	Weed:
		TNT1 A 0 Offset(-1,32)
		TNT1 A 0 A_takeinventory("PicoAnxyStack",100)
		TNT1 A 0 A_takeinventory("PowerSlowdown",1)
		TNT1 A 0 A_takeinventory("PowerSlowerdown",1)
		TNT1 A 0 A_takeinventory("PowerSlowestdown",1)
		TNT1 A 0 A_takeinventory("PowerPicoDamage",1)
		TNT1 A 0 A_takeinventory("PowerPicoDamage1",1)
		TNT1 A 0 A_takeinventory("PowerPicoDamage2",1)
		TNT1 A 0 A_Giveinventory("PicoWeedCoolDown",1)
		TNT1 A 0 A_takeinventory("PowerPicoVulnerability",1)
		TNT1 A 0 A_takeinventory("PowerPicoVulnerability1",1)
		TNT1 A 0 A_takeinventory("PowerPicoVulnerability2",1)
		P2WD A 1 OFFSET(0,36) A_takeinventory("PicoMeterCountdown",256)
		P2WD A 1 OFFSET(0,33) Healthing(15,100)
		P2WD A 2 OFFSET(0,32)
		P2WD BCD 4
		P2WD E 2
		P2WD E 1 Offset(0,34)
		P2WD E 1 Offset(0,38)
		Goto Select
	Reload:
		TNT1 A 0 A_Jumpifinventory("PicoRifleMag",0,"Click")
		TNT1 A 0 A_Jumpifinventory("PicoRifleAmmount",1,1)
		Goto Click
		Tnt1 A 0 A_giveinventory("BYOCCurrentlyReloading",1)
		P2FL A 2 OFFset(5,32) 
		P2RR C 2 Offset(-3,32)
		P2RR C 2 Offset(0,32) 
		P2RR A 2 Offset(0,40) A_Playsound("Picorifle/reload1", Chan_Weapon)
		P2RR A 25 Offset(0,36)
		P2RR B 2 Offset(0,33) A_playsound("Picorifle/reload2", Chan_weapon)
		
	RefilLoop:
		TNT1 A 0 A_GiveInventory("PicoRifleMag",1)
		TNT1 A 0 A_TakeInventory("PicoRifleAmmount",1,TIF_NOTAKEINFINITE)
		TNT1 A 0 A_jumpifinventory("PicoRifleMag",0,"ContinueReloading")
		TNT1 A 0 A_jumpifinventory("PicoRifleAmmount",1,"RefilLoop")
		
	ContinueReloading:
		Tnt1 A 0 A_takeinventory("BYOCCurrentlyReloading",1)
		P2RR B 2 Offset(0,32) 
		P2RR C 2 Offset(-4,32)
		P2FL A 2 Offset(-1,32)
		P2FL A 1
		Goto Ready
	Click:
		P2FL A 1 OFFSET(0,48) A_playsound("Pico/WeaponClick")
		P2FL A 1 OFFset(0,47)
		P2FL A 1 OFFset(0,36)
		P2FL A 1 OFFset(0,32)
		P2FL A 5 A_weaponReady(WRF_NOFIRE)
		Goto Ready
	Spawn:
		TNT1 A -1
		Stop
	ViewMover:
		TNT1 A 1 A_SetPitch(pitch-0.5) 
		TNT1 A 1 A_SetPitch(pitch-0.5)
		TNT1 A 1 A_SetPitch(pitch+0.25)
		TNT1 A 1 A_SetPitch(pitch+0.25)
		TNT1 A 1 A_SetPitch(pitch+0.25)
		TNT1 A 1 A_SetPitch(pitch+0.25)
		stop 
	}
}