
Actor CAPlasmaRifle : custominventory replaces Plasmarifle
{
	Radius 14
	Height 14
	+quiet
	-DONTGIB
	-SPECIAL
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 1
		TNT1 A 0 a_jumpif(CallAcs("DroppedWeapon",0,0,0) == 0,"ThisWasDropped")
		TNT1 A 0 A_ChangeFlag ("SPECIAL", 1)
		TNT1 A 1 a_jump (256, "Spawn1")
		Goto Spawn1
	Spawn1:
		TNT1 A 0
        TNT1 A 0 a_custommissile ("BusterCarbineSprite",0,0,0,CMF_AIMDIRECTION)
        TNT1 A 0 a_custommissile ("BMPlasmaGunsprite",0,0,0,CMF_AIMDIRECTION)
        TNT1 A 0 a_custommissile ("PearlLaserSprite",0,0,0,CMF_AIMDIRECTION)
        TNT1 A 0 a_custommissile ("MagicalRodSprite",0,0,0,CMF_AIMDIRECTION)
		DSCR F -1 Bright
		Wait
	Pickup:
		TNT1 A 0
		TNT1 A 0 A_JumpIfInventory ("IamArtificer",1,"GiveArtificer")
		TNT1 A 0 A_JumpIfInventory ("IamBlastMaster",1,"GiveBlastMaster")
		TNT1 A 0 A_JumpIfInventory ("IamTechMonk",1,"GiveTechMonk")
		TNT1 A 0 A_JumpIfInventory ("IamPastLinked",1,"GivePastLinked")
		TNT1 A 1
		stop
		
//Artificer
	GiveArtificer:
		TNT1 A 0
		TNT1 A 0
		TNT1 A 0 a_jumpifinventory ("BusterCarbine",1,"CollabAmmocheck")
		TNT1 A 0 ACS_NamedExecuteAlways("WeaponLog",0,5,0,0)	
		TNT1 A 0 a_setblend (FFFF00,0.1,3)
		TNT1 A 0 a_playsound ("misc/weaponget",CHAN_ITEM)
		TNT1 A 0 a_giveinventory ("BusterCarbine", 1)
		TNT1 A 0 a_giveinventory ("Cell",40)
		stop
	CollabAmmocheck:
		TNT1 A 0
		TNT1 A 0
		TNT1 A 0 a_jumpifinventory ("Cell",0,"Noget")
		TNT1 A 0 ACS_NamedExecuteAlways("WeaponLog",0,5,0,0)	
		TNT1 A 0 a_setblend (FFFF00,0.1,3)
		TNT1 A 0 a_playsound ("misc/weaponget",CHAN_ITEM)
		TNT1 A 0 a_giveinventory ("BusterCarbine", 1)
		TNT1 A 0 a_giveinventory ("Cell",40)
		stop
		
//Blastmaster Mk. 2
	GiveBlastMaster:
		TNT1 A 0
		TNT1 A 0
		TNT1 A 0 a_jumpifinventory ("BMPlasmaGun",1,"BlastAmmocheck")
		TNT1 A 0 ACS_NamedExecuteAlways("WeaponLog",0,5,0,0)	
		TNT1 A 0 a_setblend (FFFF00,0.1,3)
		TNT1 A 0 a_playsound ("misc/weaponget",CHAN_ITEM)
		TNT1 A 0 a_giveinventory ("BMPlasmaGun", 1)
		TNT1 A 0 a_giveinventory ("Cell",40)
		stop
	BlastAmmocheck:
		TNT1 A 0
		TNT1 A 0
		TNT1 A 0 a_jumpifinventory ("Cell",0,"Noget")
		TNT1 A 0 ACS_NamedExecuteAlways("WeaponLog",0,5,0,0)	
		TNT1 A 0 a_setblend (FFFF00,0.1,3)
		TNT1 A 0 a_playsound ("misc/weaponget",CHAN_ITEM)
		TNT1 A 0 a_giveinventory ("BMPlasmaGun", 1)
		TNT1 A 0 a_giveinventory ("Cell",40)
		stop
	
//Tech Monk
	GiveTechMonk:
		TNT1 A 0
		TNT1 A 0
		TNT1 A 0 a_jumpifinventory ("PearlLaser",1,"MonkAmmocheck")
		TNT1 A 0 ACS_NamedExecuteAlways("WeaponLog",0,5,0,0)	
		TNT1 A 0 a_setblend (FFFF00,0.1,3)
		TNT1 A 0 a_playsound ("misc/weaponget",CHAN_ITEM)
		TNT1 A 0 a_giveinventory ("PearlLaser", 1)
		TNT1 A 0 a_giveinventory ("Cell",40)
		stop
	MonkAmmocheck:
		TNT1 A 0
		TNT1 A 0
		TNT1 A 0 a_jumpifinventory ("Cell",0,"Noget")
		TNT1 A 0 ACS_NamedExecuteAlways("WeaponLog",0,5,0,0)	
		TNT1 A 0 a_setblend (FFFF00,0.1,3)
		TNT1 A 0 a_playsound ("misc/weaponget",CHAN_ITEM)
		TNT1 A 0 a_giveinventory ("PearlLaser", 1)
		TNT1 A 0 a_giveinventory ("Cell",40)
		stop

//Past Linked
	GivePastLinked:
		TNT1 A 0
		TNT1 A 0
		TNT1 A 0 a_jumpifinventory ("MagicalRod",1,"LinkedAmmocheck")
		TNT1 A 0 ACS_NamedExecuteAlways("WeaponLog",0,5,0,0)	
		TNT1 A 0 a_setblend (FFFF00,0.1,3)
		TNT1 A 0 a_playsound ("misc/weaponget",CHAN_ITEM)
		TNT1 A 0 a_giveinventory ("MagicalRod", 1)
		TNT1 A 0 a_giveinventory ("Cell",40)
		stop
	LinkedAmmocheck:
		TNT1 A 0
		TNT1 A 0
		TNT1 A 0 a_jumpifinventory ("Cell",0,"Noget")
		TNT1 A 0 ACS_NamedExecuteAlways("WeaponLog",0,5,0,0)	
		TNT1 A 0 a_setblend (FFFF00,0.1,3)
		TNT1 A 0 a_playsound ("misc/weaponget",CHAN_ITEM)
		TNT1 A 0 a_giveinventory ("MagicalRod", 1)
		TNT1 A 0 a_giveinventory ("Cell",40)
		stop

	Noget:
		TNT1 A 0
		TNT1 A 0
		fail
	ThisWasDropped:
		TNT1 A 0
		TNT1 A 1 A_SpawnItemEx("CAPlasmaRifleDrop", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_TRANSFERPOINTERS, 0, tid)
		stop
	}
}


Actor CAPlasmaRifleDrop : CAPlasmaRifle
{
	+DROPPED
	+SPECIAL
	states
	{
	spawn:
		TNT1 A 0
		TNT1 A 1 a_jump (256, "Spawn1")
		goto Spawn1
//Artificer
	GiveArtificer:
		TNT1 A 0
		TNT1 A 0
		TNT1 A 0 a_jumpifinventory ("BusterCarbine",1,"CollabAmmocheck")
		TNT1 A 0 ACS_NamedExecuteAlways("WeaponLog",0,5,0,0)	
		TNT1 A 0 a_setblend (FFFF00,0.1,3)
		TNT1 A 0 a_playsound ("misc/weaponget",CHAN_ITEM)
		TNT1 A 0 a_giveinventory ("BusterCarbine", 1)
		TNT1 A 0 a_giveinventory ("Cell",20)
		stop
	CollabAmmocheck:
		TNT1 A 0
		TNT1 A 0
		TNT1 A 0 a_jumpifinventory ("Cell",0,"Noget")
		TNT1 A 0 ACS_NamedExecuteAlways("WeaponLog",0,5,0,0)	
		TNT1 A 0 a_setblend (FFFF00,0.1,3)
		TNT1 A 0 a_playsound ("misc/weaponget",CHAN_ITEM)
		TNT1 A 0 a_giveinventory ("BusterCarbine", 1)
		TNT1 A 0 a_giveinventory ("Cell",20)
		stop
		
//Blastmaster Mk. 2
	GiveBlastMaster:
		TNT1 A 0
		TNT1 A 0
		TNT1 A 0 a_jumpifinventory ("BMPlasmaGun",1,"BlastAmmocheck")
		TNT1 A 0 ACS_NamedExecuteAlways("WeaponLog",0,5,0,0)	
		TNT1 A 0 a_setblend (FFFF00,0.1,3)
		TNT1 A 0 a_playsound ("misc/weaponget",CHAN_ITEM)
		TNT1 A 0 a_giveinventory ("BMPlasmaGun", 1)
		TNT1 A 0 a_giveinventory ("Cell",20)
		stop
	BlastAmmocheck:
		TNT1 A 0
		TNT1 A 0
		TNT1 A 0 a_jumpifinventory ("Cell",0,"Noget")
		TNT1 A 0 ACS_NamedExecuteAlways("WeaponLog",0,5,0,0)	
		TNT1 A 0 a_setblend (FFFF00,0.1,3)
		TNT1 A 0 a_playsound ("misc/weaponget",CHAN_ITEM)
		TNT1 A 0 a_giveinventory ("BMPlasmaGun", 1)
		TNT1 A 0 a_giveinventory ("Cell",20)
		stop
	
//Tech Monk
	GiveTechMonk:
		TNT1 A 0
		TNT1 A 0
		TNT1 A 0 a_jumpifinventory ("PearlLaser",1,"MonkAmmocheck")
		TNT1 A 0 ACS_NamedExecuteAlways("WeaponLog",0,5,0,0)	
		TNT1 A 0 a_setblend (FFFF00,0.1,3)
		TNT1 A 0 a_playsound ("misc/weaponget",CHAN_ITEM)
		TNT1 A 0 a_giveinventory ("PearlLaser", 1)
		TNT1 A 0 a_giveinventory ("Cell",20)
		stop
	MonkAmmocheck:
		TNT1 A 0
		TNT1 A 0
		TNT1 A 0 a_jumpifinventory ("Cell",0,"Noget")
		TNT1 A 0 ACS_NamedExecuteAlways("WeaponLog",0,5,0,0)	
		TNT1 A 0 a_setblend (FFFF00,0.1,3)
		TNT1 A 0 a_playsound ("misc/weaponget",CHAN_ITEM)
		TNT1 A 0 a_giveinventory ("PearlLaser", 1)
		TNT1 A 0 a_giveinventory ("Cell",20)
		stop

//Past Linked
	GivePastLinked:
		TNT1 A 0
		TNT1 A 0
		TNT1 A 0 a_jumpifinventory ("MagicalRod",1,"LinkedAmmocheck")
		TNT1 A 0 ACS_NamedExecuteAlways("WeaponLog",0,5,0,0)	
		TNT1 A 0 a_setblend (FFFF00,0.1,3)
		TNT1 A 0 a_playsound ("misc/weaponget",CHAN_ITEM)
		TNT1 A 0 a_giveinventory ("MagicalRod", 1)
		TNT1 A 0 a_giveinventory ("Cell",20)
		stop
	LinkedAmmocheck:
		TNT1 A 0
		TNT1 A 0
		TNT1 A 0 a_jumpifinventory ("Cell",0,"Noget")
		TNT1 A 0 ACS_NamedExecuteAlways("WeaponLog",0,5,0,0)	
		TNT1 A 0 a_setblend (FFFF00,0.1,3)
		TNT1 A 0 a_playsound ("misc/weaponget",CHAN_ITEM)
		TNT1 A 0 a_giveinventory ("MagicalRod", 1)
		TNT1 A 0 a_giveinventory ("Cell",20)
		stop
	}
}

//===============================================================================
//===============================================================================
//WEAPON SPRITES
//===============================================================================
//===============================================================================


actor BusterCarbineSprite : CAWeaponSprite
{
    VisibleToPlayerClass Artificer
	scale 1
    States
    {
	spawn:
		TNT1 A 0
		BPU1 A 1 bright
		TNT1 A 0 a_warp (AAPTR_TARGET,0,0,0,0,WARPF_INTERPOLATE|WARPF_NOCHECKPOSITION)
		TNT1 A 0 a_checkflag ("SPECIAL","spawn",AAPTR_TARGET)
		BPU1 A 1 bright
		goto death
	death:
		TNT1 A 1
		stop
    }
}


actor BMPlasmaGunSprite : CAWeaponSprite
{
    renderstyle translucent
	XScale 1
	Yscale 0.70
	alpha 0.50
    VisibleToPlayerClass BlastMaster
    States
    {
	spawn:
		TNT1 A 0
		BMPL A 1 bright
		TNT1 A 0 a_warp (AAPTR_TARGET,0,0,0,0,WARPF_INTERPOLATE|WARPF_NOCHECKPOSITION)
		TNT1 A 0 a_checkflag ("SPECIAL","spawn",AAPTR_TARGET)
		BMPL A 1 bright
		goto death
	death:
		TNT1 A 1
		stop
    }
}

actor PearlLaserSprite : CAWeaponSprite
{
    VisibleToPlayerClass TechMonk
	scale 1
    States
    {
	spawn:
		TNT1 A 0
		TKPU E 1 bright
		TNT1 A 0 a_warp (AAPTR_TARGET,0,0,0,0,WARPF_INTERPOLATE|WARPF_NOCHECKPOSITION)
		TNT1 A 0 a_checkflag ("SPECIAL","spawn",AAPTR_TARGET)
		TKPU E 1 bright
		goto death
	death:
		TNT1 A 1
		stop
    }
}


actor MagicalRodSprite : CAWeaponSprite
{
    VisibleToPlayerClass PastLinked
	scale 1
    States
    {
	spawn:
		TNT1 A 0
		PLPU F 1 bright
		TNT1 A 0 a_warp (AAPTR_TARGET,0,0,0,0,WARPF_INTERPOLATE|WARPF_NOCHECKPOSITION)
		TNT1 A 0 a_checkflag ("SPECIAL","spawn",AAPTR_TARGET)
		PLPU F 1 bright
		goto death
	death:
		TNT1 A 1
		stop
    }
}


