//////////////////////////////////////////////////////////////
///														   ///
///				  Freezebot	in hand		       			   ///
///				  								   		   ///
//////////////////////////////////////////////////////////////

//Freezebot projectile
Actor FreezebotInactive
{
Radius 8
Height 5
Mass 1000000
Health 20
Damage 0
Damagetype ice
SeeSound "BEP"
DONTHURTSHOOTER
Speed 30
+NOBLOOD
-SHOOTABLE
+MISSILE
+DOOMBOUNCE
+BOUNCEONFLOORS
+BOUNCEONWALLS
+BOUNCEONCEILINGS
BounceFactor 0.5
+THRUSPECIES
+THRUGHOST
	States
	{
	Spawn:
		FZBL A 0 A_Gravity
		FZBL AAA 4
		Loop
	Death:
		FZBL A 0 A_ChangeVelocity(0 ,0 ,10)
		FZBL AA 4 A_Playsound("CELPIK")
		TNT1 AAAA 0 A_SpawnItemEx("MiniCryoSmoke1", 0, 0, -5, random(10, 30)*0.1, 0, random(0, 10)*0.1, random(-1,-360), SXF_CLIENTSIDE|SXF_NOCHECKPOSITION)
		TNT1 AAAA 0 A_SpawnItemEx("FreezerTrailSparksSmall", 0, 0, -5, random(10, 30)*0.1, 0, random(0, 10)*0.1, random(-1,-360), SXF_CLIENTSIDE|SXF_NOCHECKPOSITION)
		TNT1 A 0 A_SpawnItemEx("Freezebot",0,0,0,0,0,0,0,288)
		Stop
	}
}
//Freezebot weapon
ACTOR HandFreezebot : BrutalWeapon
{
	Weapon.AmmoUse1 1
	Weapon.AmmoGive1 0
	Weapon.SelectionOrder 99999
	Weapon.AmmoType1 "FreezebotAmmo"
	Obituary "%o was frozen by %k's Freezebot."
    AttackSound "None"
    Inventory.PickupSound "AmmoAPIN"
	Inventory.Pickupmessage "You got a Freezebot!  (Slot 0)"
	
    +WEAPON.NOAUTOAIM
    +WEAPON.NOALERT
	+WEAPON.NOAUTOFIRE
	//+INVENTORY.UNDROPPABLE
    Scale 0.3
	States
	{
	
	Ready:
	Ready3:
	    TNT1 A 0
		TNT1 A 0 A_GunFlash
		TNT1 A 0 A_JumpIfInventory("FreezebotAmmo", 1, 1)
		
		Goto NoGrenades
		FZBW AB 1
		Goto Steady
		
	Steady:
		FZBW B 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
		TNT1 A 0 A_JumpIfInventory("Kicking",1,"DoKick")
        TNT1 A 0 A_JumpIfInventory("Taunting",1,"Taunt")
		TNT1 A 0 A_JumpIfInventory("Salute1", 1, "Salute")
		TNT1 A 0 A_JumpIfInventory("Salute2", 1, "Salute")
		FZBW A 0 A_JumpIfInventory("IsRunning",1,"CheckSprint")
		Loop
	
	NoGrenades:
		TNT1 A 1 A_WeaponReady
		Goto Ready
	
	Deselect:
		TNT1 A 0
		TNT1 A 0 A_JumpIfInventory("FiredGrenade", 1, "DropGrenade")
		TNT1 A 1 A_Lower
		Wait
	
	DropGrenade:
		TNT1 A 0
		TNT1 A 0 A_TakeInventory("FiredGrenade", 1)
		TNT1 A 0 A_FireCustomMissile("FreezebotInactive", random(-2,2), 1, 0, 0, 0, 0)
		Goto Deselect
		
	Select:
		FZBW A 1 A_Raise
		Loop
	Fire:
	    FZBW BCDEF 2
		TNT1 A 0 A_PlaySound ("BEP")
		TNT1 A 0 A_GiveInventory("FiredGrenade", 1)
		FZBW GH 4
		FZBW IJKL 2
	Hold:
	    TNT1 A 1
		TNT1 A 1 A_Refire
		TNT1 A 0 A_PlaySound ("BEP")
		FZBW M 1
		TNT1 A 0 A_FireCustomMissile("FreezebotInactive", random(-2,2), 1, 0, 0, 0, 0)
	    TNT1 A 0 A_TakeInventory("FiredGrenade", 1)
		FZBW NO 1
		TNT1 A 3 
		Goto Ready
	
 	Spawn:
		FZBL A -1
		Stop
		
	CheckSprint:
		FZBW A 1 A_WeaponReady(WRF_NOFIRE)
		FZBW F 0 A_JumpIfInventory("IsStandingStill", 1, "Ready3")
		FZBW F 0 A_JumpIfInventory("IsTacticalClass", 1, "StartSprint")
		Goto Ready
		
	StartSprint:
		FZBW A 1 A_WeaponReady(WRF_NOFIRE)
		FZBW A 0 A_JumpIfInventory("UsedStamina", 40, "StopSprintTired")
		
	Sprinting:	
		PISP A 0 offset(-9,32) 
		FZBW A 0 offset(-9,32) A_JumpIfInventory("IsStandingStill", 1, "Ready3")
		FZBW A 0 offset(-9,32) A_JumpIfInventory("UsedStamina", 100, "StopSprintTired")
		PLAY A 0 offset(-9,32) ACS_ExecuteAlways(852, 0, 0, 0, 0)//Makes player faster.
		FZBW A 0 offset(-9,32) A_JumpIfInventory("PowerStrength", 1, 2)
		FZBW A 0 offset(-9,32) A_GiveInventory("UsedStamina", 2)
		FZBW A 0 offset(-9,32)
		FZBW A 1 offset(-9,34) A_SetPitch(pitch -0.5)
		FZBW A 1 offset(-6,36) A_SetPitch(pitch -0.5)
		FZBW A 1 offset(-3,38) A_SetPitch(pitch -0.5)
		FZBW A 1 offset(0,38) A_SetPitch(pitch -0.5)
		FZBW A 1 offset(3,36) A_SetPitch(pitch -0.5)
		FZBW A 1 offset(6,34) A_SetPitch(pitch -0.5)
		FZBW A 1 offset(9,32) A_SetPitch(pitch -0.5)
		FZBW A 0 offset(9,32) A_WeaponReady(WRF_NOBOB)
		FZBW A 0 A_JumpIfInventory("Kicking",1,"DoKick")
        FZBW A 0 A_JumpIfInventory("Taunting",1,"Taunt")
		FZBW A 0 offset(-9,32) A_GiveInventory("UsedStamina", 3)
		FZBW A 0 offset(9,33) A_SpawnItemEx("FootStep", 0, 0, 2, 0, 0, -4)
		FZBW A 1 offset(9,34) A_SetPitch(pitch +0.5)
		FZBW A 1 offset(6,36) A_SetPitch(pitch +0.5)
		FZBW A 1 offset(3,38) A_SetPitch(pitch +0.5)
		FZBW A 1 offset(0,38) A_SetPitch(pitch +0.5)
		FZBW A 1 offset(-3,36) A_SetPitch(pitch +0.5)
		FZBW A 1 offset(-6,34) A_SetPitch(pitch +0.5)
		FZBW A 1 offset(-9,32) A_SetPitch(pitch +0.5)
		FZBW A 0 offset(-9,32) A_WeaponReady(WRF_NOBOB)
		FZBW A 0 offset(-9,32) A_JumpIfInventory("IsRunning", 1, "Sprinting")
		
		Goto StopSprint
	StopSprintTired:
		FZBW A 1
		PLAY A 0 ACS_ExecuteAlways(853, 0, 0, 0, 0)//Makes player slower.
		FZBW F 0 A_PlaySound("Tired", 2)
		FZBW F 0 A_TakeInventory("UsedStamina", 2)
		FZBW A 5 A_WeaponReady
		FZBW F 0 A_TakeInventory("UsedStamina", 2)
		FZBW A 5 A_WeaponReady
		FZBW F 0 A_TakeInventory("UsedStamina", 2)
		FZBW A 5 A_WeaponReady
		FZBW F 0 A_TakeInventory("UsedStamina", 2)
		FZBW A 5 A_WeaponReady
		FZBW F 0 A_TakeInventory("UsedStamina", 2)
		FZBW A 5 A_WeaponReady
		Goto Ready
	StopSprint:
		FZBW A 1
		FZBW F 0 A_JumpIfInventory("UsedStamina", 60, "StopSprintTired")
		FZBW A 0 ACS_ExecuteAlways(853, 0, 0, 0, 0)//Makes player slower.
		Goto Ready		
	}
}


Actor FreezebotAmmo : Ammo
{
Radius 10
Inventory.Amount 1
Inventory.MaxAmount 1
Ammo.BackpackAmount 0
Ammo.BackpackMaxAmount 2
Inventory.PickupMessage "Picked up a Freezebot ! (slot 0)"
Inventory.Icon ""
Inventory.PickupSound "GRNPIN"
Scale 0.9
States
{
Spawn:
	FZBL A 2 A_SpawnItemEx("FreezerTrailSparksSmall", 0, 0, -5, random(10, 30)*0.1, 0, random(0, 10)*0.1, random(-1,-360), SXF_CLIENTSIDE|SXF_NOCHECKPOSITION)
	FZBL A 10
	Loop
}
}