//Attention to those who want to use this for their own mod for any reason:
//This system wouldn't be possible without the combined efforts of Terminusest13
//and Yholl, I owe them my uneding thanks for helping me create a system
//That works with GZDoom and Zandronum 3.0, so make sure to credit them
//If you use this.
//ALL HAIL YHOLL, KING CRIMERA HAXFUCKER

//For the main weapon spawns below, I use an extra graphic in the spawn1 state
//Seeing as I cannot make the disguise sprites blink, you don't have to do this
//Obviously, but I like my shit fancy.

//===UPGRADE ITEMS===//
//These replace the standard doom weapons and give each character
//Unique abilities or items to further enhance their moveset


//The foundation of the "disguise" sprites, these are purely cosmetic
//sprites that act as the visual indicator for the player
actor GMOTAweaponsprite
{
	projectile
	Scale 1
	+NOCLIP
	+NOINTERACTION
	+CLIENTSIDEONLY
	+Dontblast
    -SOLID
    +DONTGIB
}

	
//==CHAINSAW==
//For Blaz, his item is now a book that grants him a powerful finishing
//strike that hits multiple times
//Doomslayer gets Sunder, a saw gauntlet that allows him to punch a monster
//for heavy damage and causes ammo gems to spill out, with a long cooldown afterwards

Actor GMOTAChainsaw : custominventory replaces chainsaw
{
	Radius 14
	Height 14
	+quiet
    +DONTGIB
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 1
        TNT1 A 0 a_custommissile ("BlazbookSprite",0,0,0,CMF_AIMDIRECTION)
        TNT1 A 0 a_custommissile ("DoomslayerSawSprite",0,0,0,CMF_AIMDIRECTION)
	spawn1:
		ITRO ABCDEFGH 1 Bright
		loop
	Pickup:
		TNT1 A 0
		TNT1 A 0 A_JumpIfInventory ("IamLordBlaz",1,"Blazbook")
		TNT1 A 0 A_JumpIfInventory ("IamDoomSlayer",1,"DoomSlayerSaw")
		TNT1 A 1
		stop
	Blazbook:
		TNT1 A 0
		TNT1 A 0
		TNT1 A 0 ACS_NamedExecuteAlways("WeaponLog",0,0,0,0)	
		TNT1 A 0 a_setblend (FFFF00,0.1,5)
		TNT1 A 0 a_playsound ("powerups/upgrade",CHAN_ITEM)
		TNT1 A 0 a_jumpifinventory ("slashbook", 1, "nohelpblaz")
		TNT1 A 0 a_print ("Sword combo ends with a powerful fifth strike!")
	nohelpblaz:
		TNT1 A 0
		TNT1 A 0 a_giveinventory ("slashbook", 1)
		TNT1 A 1 a_giveinventory ("arcaneforce", 3)
		stop
	Doomslayersaw:
		TNT1 A 0
		TNT1 A 0 ACS_NamedExecuteAlways("WeaponLog",0,0,0,0)	
		TNT1 A 0 a_playsound ("misc/w_pkup",CHAN_ITEM)
		TNT1 A 0 a_setblend (FFFF00,0.1,5)
		TNT1 A 0 a_giveinventory ("sawglove",1)
		TNT1 A 0 a_giveinventory ("GotSunder",1)
		TNT1 A 1
		stop
	}
}

actor slashbook : inventory
{inventory.maxamount 1}

actor GotSunder : inventory
{
	+UNTOSSABLE
	inventory.maxamount 1
}



actor BlazBookSprite : GMOTAweaponsprite
{
    VisibleToPlayerClass LordBlaz
    States
    {
	spawn:
		TNT1 A 0
		SBOK 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)
		SBOK A 1 bright
		goto death
	death:
		TNT1 A 1
		stop
    }
}



actor DoomSlayerSawSprite : GMOTAweaponsprite 
{
    VisibleToPlayerClass Doomslayer
    States
    {
	spawn:
		TNT1 A 0
		GNPU 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)
		goto death
	death:
		TNT1 A 1
		stop
    }
}

