ACTOR BionicRifle : Weapon
{
	Weapon.SelectionOrder 60
	Weapon.AmmoUse 1
	Weapon.AmmoType "Clip"
	Weapon.SlotNumber 2
	weapon.bobstyle smooth
	weapon.bobrangex 0.1
	weapon.bobrangey 0.6
	weapon.bobspeed 2
	Inventory.PickupMessage "You picked up the Bionic Rifle!"
	Obituary "%k blasted %o."
	Inventory.RestrictedTo "Artificer"
	+WEAPON.AMMO_OPTIONAL
	+undroppable
	+cheatnotweapon
	+noautofire	
	Tag "Bionic Rifle"
	states
	{
	Select:
		TNT1 A 0
		TNT1 A 0
	Riseup:
		D3UP AA 0 a_raise
		D3UP AAAAA 0 a_raise
		BRF1 A 1
		loop
	
	Ready:
		TNT1 A 0
		BRF1 A 1 a_weaponready
		loop
	Deselect:
		TNT1 A 0
		TNT1 A 0 a_jumpifhealthlower (1, "deadlower")
	holster:
		TNT1 A 0
		BRF1 A 1 a_lower
		TNT1 AAA 0 a_lower
		BRF1 A 1 a_lower
		loop

	deadlower:
		TNT1 A 0
		TNT1 A 0
		TNT1 AAAAAAAAAAAAA 0 a_lower
		TNT1 A 1 a_lower
		wait	
	Fire:
		TNT1 A 0
		TNT1 A 0
		TNT1 A 0 a_jumpifinventory ("Clip",1,"normalshot")
		goto BackupShot
	NormalShot:
		TNT1 A 0
		TNT1 A 0 a_playsound ("BionicRifle/JoeShot",CHAN_WEAPON)
		TNT1 A 0 a_firebullets (0,0,1,0,"flickpuff",FBF_NOFLASH)
		BRF1 B 1 bright a_firecustommissile ("SuperJoeBullet",0,1)
		TNT1 A 0 A_Quake(1, 4, 0, 32,"ArtiSilence")
		BRF1 C 1 bright
		BRF1 DE 1
		TNT1 A 0 a_refire ("MachineGunningCheck")
		BRF1 F 2 a_weaponready (WRF_NOBOB)
		BRF1 A 1 a_weaponready
		goto ready
	MachineGunning:
		TNT1 A 0
		TNT1 A 0 a_playsound ("BionicRifle/JoeShot",CHAN_WEAPON)
		TNT1 A 0 a_firebullets (0,0,1,0,"flickpuff",FBF_NOFLASH)
		BRF1 B 1 bright a_firecustommissile ("SuperJoeBullet",random(-6,6),1)
		TNT1 A 0 A_Quake(1, 4, 0, 32,"ArtiSilence")
		BRF1 C 1 bright
		BRF1 DE 1
		TNT1 A 0 a_refire ("MachineGunningCheck")
		BRF1 F 2 a_weaponready (WRF_NOBOB)
		BRF1 A 1 a_weaponready
		goto ready
	MachineGunningCheck:
		TNT1 A 0
		BRF1 A 1 a_jumpifinventory ("Clip",1,"MachineGunning")
		goto backupshot

		
	BackupShot:
		TNT1 A 0
		TNT1 A 0 a_playsound ("BionicRifle/RadShot",CHAN_WEAPON)
		TNT1 A 0 a_firebullets (0,0,1,0,"flickpuff",FBF_NOFLASH)
		BRF2 A 1 bright a_firecustommissile ("RadBullet",0,0)
		TNT1 A 0 A_Quake(1, 4, 0, 32,"ArtiSilence")
		BRF2 B 1 bright
		BRF2 CD 2 a_weaponready (WRF_NOBOB)
		BRF2 E 2 a_weaponready (WRF_NOBOB)
		BRF1 A 1 
		TNT1 A 0 a_refire
		goto ready
	Altfire:
		TNT1 A 0
		BRW1 A 2 
		TNT1 A 0 a_jumpifinventory ("powerstrength",1,"superwirethrow")
		TNT1 A 0 a_playsound ("BionicRifle/WireThrow",0)
		BRW1 BCD 2
		BRW1 E 2 a_firecustommissile ("BionicClaw")
		BRW1 FGHIJ 2 a_weaponready (WRF_NOBOB|WRF_NOSECONDARY)
		TNT1 A 0 a_refire
		goto ready
	SuperWireThrow:
		TNT1 A 0
		TNT1 A 0 a_playsound ("BionicRifle/WireThrow",0)
		BRW1 BCD 2
		BRW1 E 2 a_firecustommissile ("BionicPowerClaw")
		BRW1 FGHIJ 2 a_weaponready (WRF_NOBOB|WRF_NOSECONDARY)
		TNT1 A 0 a_refire
		goto ready
		
	}
}

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++



//The bullets

actor SuperJoeBullet
{
	Radius 10
	Height 3
	Speed 40
	Damage (18)
	Projectile
	species "Player"
	+thruspecies
	+dontblast
	+bright
	scale 2
	Decal ArtiDecal
	projectilekickback 200
	states
	{
	Spawn:
		B1BL A 1
		loop
	Death:
		TNT1 A 0
		TNT1 A 0 a_setscale (1,1)
		TNT1 A 0 a_playsound ("BionicRifle/Miss",0)
		B1BL FGHI 1
		stop
	Xdeath:
		TNT1 A 0 a_setscale (1,1)
		TNT1 A 0 a_playsound ("BionicRifle/Hit",0)
		B1BL BCDE 2
		stop
	}
}

Actor RadBullet : SuperJoeBullet
{
	speed 35
	damage (14)
	states
	{
	Spawn:
		B2BL A 1
		loop
	Death:
		TNT1 A 0
		TNT1 A 0 a_setscale (1,1)
		TNT1 A 0 a_playsound ("BionicRifle/Miss",0)
		B2BL FGHI 1
		stop
	Xdeath:
		TNT1 A 0 a_setscale (1,1)
		TNT1 A 0 a_playsound ("BionicRifle/Hit",0)
		B2BL BCDE 2
		stop
	}
}


//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

//Bionic Wire stuff


Actor BionicClaw : fastprojectile
{
	Speed 80
	Damage (15)
	radius 8
	height 9
	+NOGRAVITY
	+NOTELEPORT
	+FORCEXYBILLBOARD
	+dontblast
	+BRIGHT
	//+SKYEXPLODE
	+NOEXTREMEDEATH
	+HITTRACER
	+forcepain
	species "Player"
	+thruspecies
	projectilekickback 400
	scale 1.5
	states
	{
	spawn:
		TNT1 A 0
		TNT1 A 0 a_jumpifinventory ("ClawTimer", 5,"clawstop")
		B1HK A 1 a_spawnitemex ("BionicWire")
		TNT1 A 0 a_giveinventory ("ClawTimer",1)
		loop
	Xdeath:
		TNT1 A 0
		TNT1 A 0 a_giveinventory ("BionicHookMelee",1,AAPTR_TRACER)
		TNT1 A 0 A_PlaySound("BionicRifle/WireMelee", CHAN_AUTO)
		TNT1 A 0 radius_quake (1,4,0,8,0)
		TNT1 A 0 a_spawnitemex ("BionicMeleeHitEffect",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION)
		TNT1 A 0 a_jumpifcloser (50,"catch")
		TNT1 A 0 a_custommissile ("BionicClawReturn",0,0,0,0)
		TNT1 A 1 
		stop
	Death:
		TNT1 A 0
		TNT1 A 0 a_takeinventory ("ClawTimer",999)
		TNT1 A 0 A_JumpIf(floorz == z, "FloorHit")
		TNT1 A 0 a_playsound ("BionicRifle/WireGrab",0)
		TNT1 A 0 a_checkceiling ("CeilingGrapple")
		//TNT1 A 0 a_jump (256,"FloorHit") //<-------------Adding this for the pizza tower version, nerfs wire
		TNT1 A 0 a_jumpifcloser (50,"WallCatch")
		TNT1 A 0 a_giveinventory ("grapplebooster",1,AAPTR_TARGET)
	WallWaiting:	
		B1HK A 1 a_spawnitemex ("BionicWire",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION)
		TNT1 A 0 a_jumpifcloser (50,"Catch")
		TNT1 A 0 a_giveinventory ("ClawTimer",1)
		TNT1 A 0 a_jumpifinventory ("Clawtimer", 18, "Clawstop")
		Loop
		
	ClawStop:
		TNT1 A 0
		TNT1 A 1 a_custommissile ("BionicClawReturn",0,0,0,0)
		stop
	FloorHit:
		TNT1 A 0
		TNT1 A 0 a_playsound ("BionicRifle/WireMiss",0)
		TNT1 A 1 a_custommissile ("BionicClawReturn",0,0,0,0)
		stop
	catch:
		TNT1 A 0
        TNT1 A 1 
		stop
	WallCatch:
		TNT1 A 0
		TNT1 A 1 a_giveinventory ("WallBooster",1,AAPTR_TARGET)
		stop
	CeilingGrapple:
		TNT1 A 0
		TNT1 A 1 a_giveinventory ("CeilingBooster",1,AAPTR_TARGET)
	CeilingWaiting:
		B3HK A 1 a_spawnitemex ("BionicWire",0,0,-12,0,0,0,0,SXF_NOCHECKPOSITION)
		TNT1 A 0 a_jumpifcloser (50,"Catch")
		TNT1 A 0 a_giveinventory ("ClawTimer",1)
		TNT1 A 0 a_jumpifinventory ("Clawtimer", 18, "Clawstop")
		loop
	}
}

Actor BionicPowerClaw : BionicClaw
{
	speed 100
	damage (25)
	states
	{
	spawn:
		TNT1 A 0
		TNT1 A 0 a_jumpifinventory ("ClawTimer", 10,"clawstop")
		B1HK A 1 a_spawnitemex ("BionicWire")
		TNT1 A 0 a_giveinventory ("ClawTimer",1)
		loop
	}
}
	

Actor BionicClawReturn 
{
	radius 10
	height 10
	speed 40
	damage (0)
	scale 1.5
	PROJECTILE
	species "Player"
	+thruspecies
	+bright
	+DONTBLAST
	+RIPPER
	+NOCLIP
	+SKYEXPLODE
	+NOINTERACTION
	+FORCEXYBILLBOARD
	+SEEINVISIBLE
	states
	{
	spawn:
		TNT1 A 0
		TNT1 A 0
		B2HK A 1 A_JumpIfCloser (64,"catch")
		TNT1 A 0 a_facetarget
		TNT1 A 0 a_custommissile ("BionicWire",0,0,0,0)
		B2HK A 1 A_JumpIfCloser (64,"catch")
		TNT1 A 0 a_facetarget
		TNT1 A 0 a_custommissile ("BionicWire",0,0,0,0)
		TNT1 A 0 A_FaceTarget
		TNT1 A 1 a_custommissile ("BionicClawReturn",0,0,0,0)
		stop
	death:
		TNT1 A 0		
		TNT1 A 0 a_custommissile ("BionicClawReturn",0,0,0,0)
		TNT1 A 1
		stop
	crash:
		TNT1 A 0
		TNT1 A 0		
		TNT1 A 0 a_custommissile ("BionicClawReturn",0,0,0,0)
		TNT1 A 1
		stop
	catch:
		TNT1 A 0
		TNT1 A 3
		stop
	}
}
	

Actor BionicWire
{
	projectile
	+notimefreeze
	+skyexplode
	+HITTRACER
	+dontblast
	+bright
    -SOLID
    +NOCLIP
	+SEEINVISIBLE
	+FORCEXYBILLBOARD
	+painless
	radius 10
	height 8
	damage (0)
	speed 40
	scale 0.40
	states
	{
	spawn:
		TNT1 A 0
		TNT1 A 1
		TNT1 A 0 A_JumpIfCloser(64, "Death")
		TNT1 A 0 A_SpawnItemEx("BionicWireSprite")
		TNT1 A 0 A_CustomMissile("BionicWire", 0, 0, 0, 0)
		Stop
	death:
		TNT1 A 0
		TNT1 A 1
		stop
	}
}


Actor BionicWireSprite 
{
	+NOINTERACTION
	scale 1
	+bright
	+FORCEXYBILLBOARD
	States
	{
	Spawn:
		TNT1 A 1
		TNT1 A 0 A_JumpIfCloser(64, "Death")
		BW1R A 2 
		TNT1 A 0 A_JumpIfCloser(64, "Death")
		stop
	Death:
		TNT1 A 0
		TNT1 A 1
		stop
	}
}



ACTOR GrappleBooster : CustomInventory
{
	+AUTOACTIVATE
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 1
		Stop
	Use:
		TNT1 A 0
		TNT1 A 0
		TNT1 A 0 thrustthingz (0,35,0,0)
		TNT1 A 1 A_recoil(-25)
		Stop
	}
}

ACTOR WallBooster : CustomInventory
{
	+AUTOACTIVATE
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 1
		Stop
	Use:
		TNT1 A 0 thrustthingz (0,65,0,0)
		TNT1 A 1 A_recoil(-20)
		Stop
	}
}

ACTOR CeilingBooster : CustomInventory
{
	+AUTOACTIVATE
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 1
		Stop
	Use:
		TNT1 A 0 thrustthingz (0,95,0,0)
		TNT1 A 1 A_recoil(-15)
		Stop
	}
}

ACTOR BionicHookMelee : CustomInventory
{
	+AUTOACTIVATE
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 1
		Stop
	Use:
		TNT1 A 0 a_facetarget
		TNT1 A 0 ThrustThing(angle * 256 / 360 + 128, 20, 0, 0)
		TNT1 A 0 thrustthingz (0,25,0,0)
		TNT1 A 1 
		Stop
	}
}


Actor BionicMeleeHitEffect
{
	+NOINTERACTION
	+NOCLIP
    +BRIGHT
	Radius 1
	Height 1
	Renderstyle Add
	Alpha 0.90
	Scale 1.20
	states
	{
	spawn:
		TNT1 A 0
		B1BL B 1
		B1BL B 1 a_setscale (1.80,1.80)
		B1BL B 2 a_setscale (2.20,2.20)
		stop
	death:
		TNT1 A 1
		stop
	}
}


//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++



//Tokens
actor ClawTimer : inventory
{inventory.maxamount 40}
