actor golampistol:MSXWeapon{
	weapon.selectionorder 130
	inventory.pickupsound "weapons/gp_slide"
	inventory.pickupmessage "'Golem' GW35B Assault Pistol"
	scale 0.31
	weapon.ammotype "golamclip"
	weapon.ammotype2 "pistol_ammo"
	weapon.ammouse 1
	weapon.ammouse2 0
	weapon.ammogive1 0
	weapon.ammogive2 6
	weapon.kickback 100
	weapon.bobstyle inverse
	weapon.bobrangeX 0.4
	weapon.bobrangeY 0.6
	weapon.bobspeed 2.5
	+AMMO_OPTIONAL
	+NOALERT
	+WEAPON.NOAUTOAIM
	States{
	Spawn:
		GAPW A -1
    	loop
	Select:
		TNT1 A 0 A_JumpIf(GetCVar("MSfiXd_QuickSwap")==1,"SeLoop")
		TNT1 A 5
	 SeLoop:
		TNT1 AAAAAAAAAA 0 A_Raise
		TNT1 A 1 A_Raise
		Loop
	Deselect:
		TNT1 A 0 {A_TakeInventory("GolamBurst");
			A_PlaySound("weapons/gp_deselect",CHAN_WEAPON);
			A_TakeInventory("xhair_switch",1);
			A_TakeInventory("pistol_acc",80);}
		GAPU ABCDEF 1
		TNT1 AAAAAAAAAA 0 A_Lower
		TNT1 A 1 A_Lower 
		Wait
	Ready:
		GAPU F 1 {A_SetCrosshair(10);
			A_PlaySound("weapons/gp_select",CHAN_WEAPON);}
		GAPU EDCBA 1
		TNT1 A 0 A_GiveInventory("xhair_switch",1)
	Idle:		
		GAPI A 1 A_WeaponReady(WRF_ALLOWRELOAD|WRF_ALLOWZOOM|WRF_ALLOWUSER1|WRF_ALLOWUSER2|WRF_ALLOWUSER3|WRF_ALLOWUSER4)
		"####" "#" 0 A_JumpIfInventory("SprintingPlayer",1,"Sprint")
		Loop
	Sprint:
		"####" "#" 0 A_JumpIf(GetCVar("MSfiXd_SprintStaminaUse")==0,"SprStart")
		TNT1 A 0 A_JumpIfInventory("PlayerStamina",1,"SprStart")
		TNT1 A 0 A_TakeInventory("SprintingPlayer",1)
		Goto Idle
	SprStart:
		TNT1 A 0 A_JumpIf(GetCVar("MSfiXd_SprintHands")==1,"SprStart_HandWeapon")
		TNT1 A 0 {A_TakeInventory("xhair_switch",1);
			A_PlaySound("sfx/sprintstart",CHAN_AUTO);
			ACS_NamedExecute("Player-ChangeSpeed",0,GetCVar("MSfiXd_SprintSpeed"),0,0);
			A_SetBlend("49 99 0",0.4,15);
			A_Recoil(-15);}
		GASS ABCDE 1
		"####" "#" 0 A_JumpIfInventory("SprintingPlayer",1,"SprLoop1")
		Goto SprEnd
	SprStart_HandWeapon:
		GAPU A 1{A_PlaySound("weapons/gp_deselect",CHAN_WEAPON);
			A_TakeInventory("xhair_switch",1);
			A_TakeInventory("pistol_acc",80);}
		GAPU CE 1
		TNT1 A 1 A_GiveInventory("SprintHands")
		TNT1 A 0 A_Jump(256,"SprStart_Hands")
		Goto SprStart_Hands
	SprEnd:
		TNT1 A 0 {A_WeaponReady(WRF_NOFIRE|WRF_NOSWITCH);
			ACS_NamedExecute("Player-ChangeSpeed",0,100,0,0);
			A_PlaySound("sfx/sprintend",CHAN_AUTO);}
		GASS EDCBA 1
		TNT1 A 0 A_GiveInventory("xhair_switch",1)
		Goto Idle
	SprEnd_HandWeapon:
		TNT1 A 0 {A_WeaponReady(WRF_NOFIRE|WRF_NOSWITCH);
			ACS_NamedExecute("Player-ChangeSpeed",0,100,0,0);
			A_PlaySound("sfx/sprintend",CHAN_AUTO);}
		GAPU E 1 {A_TakeInventory("SprintHands");
			A_SetCrosshair(10);
			A_PlaySound("weapons/gp_select",CHAN_WEAPON);}
		GAPU CA 1
		TNT1 A 0 A_GiveInventory("xhair_switch",1)
		Goto Idle
	Fire:
		TNT1 A 0 A_JumpIfInventory("GolamBurst",1,"FireBurst")
		TNT1 A 0 A_JumpIfInventory("golamclip",1,"FireCont")
		GAPO A 6 A_PlaySound("weapons/noammo",CHAN_WEAPON)
		Goto Idle
	FireCont:
		TNT1 A 0 {A_PlayWeaponSound("weapons/gp_fire");
			A_AlertMonsters;
			A_GunFlash;}
		TNT1 A 1 {A_FireBullets(CountInv("pistol_acc")*0.175,CountInv("pistol_acc")*0.15,-1,56+random(0,8),"pistol_impact",FBF_NORANDOM|FBF_USEAMMO,0,"none",CountInv("MSXPlayerViewHeight"));
			A_GiveInventory("pistol_acc",22);}
		GAPI D 1 {ACS_NamedExecute("Weapon-Recoil",0,15,random(-13,13),0);
			A_FireCustomMissile("pcasing_spawner",0,0,0,8,0);}
		GAPI DCB 1
		TNT1 A 0 A_JumpIfInventory("golamclip",1,3)
		TNT1 A 0 A_JumpIf(GetCVar("MSfiXd_AutoReloads")==2,"Reload")
		TNT1 A 0 A_JumpIf((GetCVar("MSfiXd_AutoReloads")==1)&&(GetCVar("MSfiXd_GolamAutoReloads"))==1,"Reload")
		GAPI A 1 A_Refire
		Goto Idle
	FireBurst:
		TNT1 A 0 A_JumpIfInventory("GolamClip",3,"Burstin")
		TNT1 A 0 A_JumpIfInventory("GolamClip",2,"TwoBurstin")
		TNT1 A 0 A_JumpIf(CountInv("GolamClip")<1,1)
		Goto Fire+3
		GAPO A 6 A_PlaySound("weapons/noammo",CHAN_WEAPON)
		Goto Idle
	 TwoBurstin:
		TNT1 A 0 A_GiveInventory("GolamBurstCount",1)
	 Burstin:
		TNT1 A 0 {A_GiveInventory("GolamBurstCount",1);
			A_PlayWeaponSound("weapons/gp_fire");
			A_AlertMonsters;
			A_GunFlash;}
		TNT1 A 1 {A_FireBullets(CountInv("pistol_acc")*0.2,CountInv("pistol_acc")*0.175,-1,56+random(0,8),"pistol_impact",FBF_NORANDOM|FBF_USEAMMO,0,"none",CountInv("MSXPlayerViewHeight"));
			A_GiveInventory("pistol_acc",50);}
		TNT1 A 0 {ACS_NamedExecute("Weapon-Recoil",0,15,random(-13,13),0);
			A_FireCustomMissile("pcasing_spawner",0,0,0,8,0);}
		GAPI BA 1
		TNT1 A 0 A_JumpIfInventory("GolamBurstCount",0,1)
		Loop
		TNT1 A 0 A_TakeInventory("GolamBurstCount")
		TNT1 A 0 A_JumpIfInventory("GolamClip",1,3)
		TNT1 A 0 A_JumpIf(GetCVar("MSfiXd_AutoReloads")==2,"Reload")
		TNT1 A 0 A_JumpIf((GetCVar("MSfiXd_AutoReloads")==1)&&(GetCVar("MSfiXd_GolamAutoReloads"))==1,"Reload")
	 BurstinHold:
		GAPI A 1 A_WeaponReady(WRF_NOFIRE|WRF_NOSWITCH)
		TNT1 A 0 A_JumpIf(GetPlayerInput(INPUT_BUTTONS)&(BT_ATTACK),"BurstinHold")
		Goto Idle
	Hold:
		GAPI A 1 A_WeaponReady
		GAPI A 0 A_Refire
		Goto Idle
	Flash:
		TNT1 A 0 A_Jump(256,3,2,1)
		GAPF A 0 A_Jump(256,3)
		GAPF B 0 A_Jump(256,2)
		GAPF C 0
		"####" "#" 1 BRIGHT A_Light1
		TNT1 A 1 A_Light0
		Stop
	Zoom:
		TNT1 A 0 A_JumpIfInventory("GolamBurst",1,"BurstOff")
		GAPO A 1 A_WeaponReady(WRF_NOFIRE|WRF_NOSWITCH)
		TNT1 A 0 {A_GiveInventory("GolamBurst");
			A_Print("Golam Burst Activated");
			A_PlaySound("weapons/hs_bolt",CHAN_WEAPON,0.75);}
		GAPR A 1 A_WeaponReady(WRF_NOFIRE|WRF_NOSWITCH)
		Goto BurstHold
	 BurstOff:
		GAPO A 1 A_WeaponReady(WRF_NOFIRE|WRF_NOSWITCH)
		TNT1 A 0 {A_TakeInventory("GolamBurst");
			A_Print("Golam Burst Deactivated");
			A_PlaySound("weapons/hs_bolt",CHAN_WEAPON,0.75);}
		GAPR A 1 A_WeaponReady(WRF_NOFIRE|WRF_NOSWITCH)
	 BurstHold:
		GAPI A 1 A_WeaponReady(WRF_NOFIRE|WRF_NOSWITCH)
		TNT1 A 0 A_JumpIf(GetPlayerInput(INPUT_BUTTONS)&(BT_ZOOM),"BurstHold")
		Goto Idle
	Reload:
		TNT1 A 0 A_JumpIf(CountInv("GolamClip")<9,1)
		Goto Idle
		TNT1 A 0 A_JumpIfInventory("pistol_ammo",1,1)
		Goto Idle
		TNT1 A 0 A_GiveInventory("pistol_acc",45)
		TNT1 A 0 A_GiveInventory("xhair_hold",1)
		GAPR ABC 1
		GAPR D 1 A_PlaySound("weapons/gp_clipout",CHAN_WEAPON)	
		GAPR EFG 1
		GAPR H 10
		GAPR I 1
		GAPR J 1 A_PlaySound("weapons/gp_clipin",CHAN_WEAPON)
		GAPR K 1
		GAPR L 3
		GAPR MN 1
		GAPR O 1 A_PlaySound("weapons/gp_clipin2",CHAN_WEAPON)
	Reload_FillClip:
		TNT1 A 0 A_TakeInventory("pistol_ammo",1)
		TNT1 A 0 A_GiveInventory("golamclip",1)
		TNT1 A 0 A_JumpIfInventory("golamclip",9,"ReloadFinish")
		TNT1 A 0 A_JumpIfInventory("pistol_ammo",1,"Reload_FillClip")
	ReloadFinish:	
		GAPR P 1
		GAPR Q 1
		GAPR R 3
		TNT1 A 0 A_TakeInventory("xhair_hold",1)
		GAPR PST 1
		GAPR U 1 A_PlaySound("weapons/gp_slide",CHAN_WEAPON) 
		GAPR VWXY 1
		Goto Idle
	User1:
		TNT1 A 0 A_JumpIfInventory("grenades",1,1)
		Goto Idle
		GAPU A 1 {A_TakeInventory("xhair_switch",1);
			A_PlaySound("weapons/gp_deselect",CHAN_WEAPON);
			A_TakeInventory("pistol_acc",80);}
		GAPU BCDEF 1
		TNT1 A 0 A_Jump(256,"GrenadeStart")
		Goto GrenadeStart
	GrenadeEnd:
		GAPU F 1 {A_TakeInventory("GrenadeHold");
			A_SetCrosshair(10);
			A_PlaySound("weapons/gp_select",CHAN_WEAPON);}
		GAPU EDCBA 1
		TNT1 A 0 A_GiveInventory("xhair_switch",1)
		Goto Idle
	// Health Stim Stuff //
	Stim_HolsterCheck:
		TNT1 A 0 A_JumpIf(GetCVar("MSfiXd_HolsterWeapForItems")==0,"Stimulate")
		TNT1 A 0 {A_PlaySound("weapons/gp_deselect",CHAN_WEAPON);
			A_TakeInventory("xhair_switch",1);
			A_TakeInventory("pistol_acc",80);}
		GAPU ABCDEF 1
		TNT1 A 0 A_Jump(256,"Stimulate")
		Goto Stimulate
	StimulateEnd:
		TNT1 A 0 A_JumpIf(GetCVar("MSfiXd_HolsterWeapForItems")==0,"StimulateEnd_Quick")
		GAPU F 1 {A_SetCrosshair(10);
			A_PlaySound("weapons/gp_select",CHAN_WEAPON);}
		GAPU EDCBA 1
		TNT1 A 0 A_GiveInventory("xhair_switch",1)
		Goto Idle
	StimulateEnd_Quick:
		GAPI A 1 A_WeaponReady(WRF_NOFIRE|WRF_NOSWITCH)
		TNT1 A 0 A_JumpIf(GetPlayerInput(INPUT_BUTTONS)&(BT_USER2),"StimulateEnd_Quick")
		Goto Idle
	// Shield Booster Stuff //
	Boost_HolsterCheck:
		TNT1 A 0 A_JumpIf(GetCVar("MSfiXd_HolsterWeapForItems")==0,"Boostify")
		TNT1 A 0 {A_PlaySound("weapons/gp_deselect",CHAN_WEAPON);
			A_TakeInventory("xhair_switch",1);
			A_TakeInventory("pistol_acc",80);}
		GAPU ABCDEF 1
		TNT1 A 0 A_Jump(256,"Boostify")
		Goto Boostify
	BoostifyEnd:
		TNT1 A 0 A_JumpIf(GetCVar("MSfiXd_HolsterWeapForItems")==0,"BoostifyEnd_Quick")
		GAPU F 1 {A_SetCrosshair(10);
			A_PlaySound("weapons/gp_select",CHAN_WEAPON);}
		GAPU EDCBA 1
		TNT1 A 0 A_GiveInventory("xhair_switch",1)
		Goto Idle
	BoostifyEnd_Quick:
		GAPI A 1 A_WeaponReady(WRF_NOFIRE|WRF_NOSWITCH)
		TNT1 A 0 A_JumpIf(GetPlayerInput(INPUT_BUTTONS)&(BT_USER3),"BoostifyEnd_Quick")
		Goto Idle
	// Jetpack Stuff //
	User4:
		TNT1 A 0 A_JumpIfInventory("Jetpack",1,1)
		Goto Idle
		GAPU A 1 {A_PlaySound("weapons/gp_deselect",CHAN_WEAPON);
			A_TakeInventory("xhair_switch",1);
			A_TakeInventory("pistol_acc",80);}
		GAPU BCDEF 1
		TNT1 A 0 A_Jump(256,"JetpackStart")
		Goto JetpackStart
	WeaponJetEnd:
		GAPU F 1 A_PlaySound("weapons/gp_select",CHAN_WEAPON)
		GAPU EDCBA 1
		TNT1 A 0 {A_SetCrosshair(10);
			A_GiveInventory("xhair_switch",1);}
		Goto Idle
	MeleeRepeat:
		TNT1 A 0 {A_Recoil(-4);
			A_PlayWeaponSound("sfx/meleeswing");}
		Goto Altfire+2
	AltFire:
		GAPM B 1 A_Recoil(-6)
		TNT1 A 0 A_PlayWeaponSound("sfx/meleeswing")
		GAPM DFH 1
		GAPM J 9 A_CustomPunch((164+random(1,32)),1,CPF_DAGGER|CPF_NOTURN,"Golam_MeleePuff",88)
		GAPM IHGFE 1
		TNT1 A 2
		TNT1 A 0 A_JumpIf(GetPlayerInput(INPUT_BUTTONS)&(BT_ALTATTACK),"MeleeRepeat")
		GAPM DCBA 1	
		Goto Idle}}
////////////////////////////////////////////////////////////////////////////////
ACTOR GolamBurst:Inventory{}
ACTOR GolamBurstCount:Inventory{Inventory.MaxAmount 3}
actor golamclip:Ammo{Inventory.MaxAmount 9}
actor pistol_ammo:ammo{
	radius 16
	height 8
	scale 0.23
	inventory.pickupmessage "Pack of .50 AE ammo for Assault Pistol"
	inventory.amount 6
	inventory.maxamount 90
	inventory.pickupsound "weapons/gp_clipin"
	ammo.backpackamount 9
	ammo.backpackmaxamount 180
	states{
	Spawn:
		GBUL A -1
		stop}}
actor pistol_acc:Inventory{
	Inventory.PickupSound ""
	-INVBAR
	Inventory.icon ""
	Inventory.Amount 1
	Inventory.MaxAmount 45}
ACTOR Golam_MeleePuff:MeleePuff{DamageType "GOLAM_Melee"}
actor pistol_impact{		
	Radius 1
	Height 1
	Alpha 1
	DamageType "GOLAM_Bullet"
	RenderStyle ADD
	Scale 0.38
	+NOGRAVITY
	+NOBLOCKMAP
	+FLOORCLIP
	+NOTELEPORT
	+FORCEXYBILLBOARD
	+NOEXTREMEDEATH
	+NOINTERACTION
	+PUFFONACTORS
	+PUFFGETSOWNER
	Decal "BulletChip"
	States{
	Spawn:
		TNT1 A 0 NoDelay {A_Explode(24,20,0);
			A_PlaySound("sfx/bulletric");
			A_SpawnItemEx("pistimp_flash",0,0,0,0,0,0,0);}
		TNT1 AAAAAA 0 A_SpawnItemEx("pistimp_spark",0,0,0,frandom(0.5,1.0),random(1,3),random(0,4),random(0,180))
		TNT1 AAAA 0 A_SpawnItemEx("pistimp_spark2",0,0,0,frandom(0.5,1.0),random(1,3),random(0,4),random(0,180))
		TNT1 AAAA 0 A_SpawnItemEx("pistimp_smoke",0,0,0,0,frandom(-0.35,0.35),frandom(0,0.45),random(0,180))
	 SetFrame:
		TNT1 A 0 A_Jump(256,1,2,3,4,5)
		EXP6 A 0 A_Jump(256,5)
		EXP7 A 0 A_Jump(256,4)
		EXP8 A 0 A_Jump(256,3)
		EXP9 A 0 A_Jump(256,2)
		EXP0 A 0
		"####" AABCDEFGH 1 BRIGHT A_SetScale(scaleX*1.06,scaleY*1.06)
		Stop
	XDeath:
		TNT1 A 0
		TNT1 A 0 A_SpawnItemEx("pistimp_flash",0,0,0,0,0,0,0)
		Goto SetFrame}}
actor pistol_impactB:pistol_impact{
	DamageType normal
	States{
	Spawn:
		TNT1 A 0 NoDelay {A_PlaySound("sfx/bulletric");
			A_SpawnItemEx("pistimp_flash",0,0,0,0,0,0,0);}
		TNT1 AAAAAA 0 A_SpawnItemEx("pistimp_spark",0,0,0,frandom(0.5,1.0),random(1,3),random(0,4),random(0,180))
		TNT1 AAAA 0 A_SpawnItemEx("pistimp_spark2",0,0,0,frandom(0.5,1.0),random(1,3),random(0,4),random(0,180))
		TNT1 AAAA 0 A_SpawnItemEx("pistimp_smoke",0,0,0,0,frandom(-0.35,0.35),frandom(0,0.45),random(0,180))
		Goto Super::SetFrame}}
actor pistimp_flash{
	scale 0.4
	alpha 1.0
	renderstyle add
	+FORCEXYBILLBOARD
	+NOTELEPORT
	+NOINTERACTION
	states{
	spawn:
		TNT1 A 0 NoDelay A_Jump(256,1,2,3,4)
		IPF3 A 0 A_Jump(256,4)
		IPF3 B 0 A_Jump(256,3)
		IPF3 C 0 A_Jump(256,2)
		IPF3 D 0
		"####" "#" 2 BRIGHT
		Stop}}
actor pistimp_spark{
	radius 2
	height 2
	alpha 1
	scale 0.025
	gravity 0.4
	renderstyle add
	+NOTELEPORT
	+FLOORCLIP
	+FORCEXYBILLBOARD
	bouncetype "doom"
	bouncefactor 0.2
	states{
	spawn:
		SPRK A 10 bright
		"####" "#" 1 bright A_FadeOut(0.1)
		Wait}}
actor pistimp_spark2:pistimp_spark{
	scale 0.04
	gravity 0.3
	states{
	spawn:
		SPRK C 15 bright
		Goto Super::Spawn+1}}
actor pistimp_smoke{
	scale 0.1
	alpha 0.35
	renderstyle translucent
	+NOTELEPORT
	+FORCEXYBILLBOARD
	+NOINTERACTION
	states{
	spawn:
		TNT1 A 5
		TNT1 A 0 A_Jump(256,1,2,3,4,5,6)
		SMK1 A 0 A_Jump(256,6)
		SMK1 B 0 A_Jump(256,5)
		SMK1 C 0 A_Jump(256,4)
		SMK1 D 0 A_Jump(256,3)
		SMK1 E 0 A_Jump(256,2)
		SMK1 F 0
		"####" "#" 2 {A_SetScale(ScaleX * 1.04,ScaleY * 1.04);
			A_Fadeout(0.015);}
		Wait}}
actor pistol_casing{
	scale 0.13
	radius 2
	height 2
	speed 6
	mass 4
	bouncefactor 0.6
	PROJECTILE
	+DOOMBOUNCE
	+NODROPOFF
	+FORCEXYBILLBOARD
	+NOTELEPORT
	+FLOORCLIP
	-NOGRAVITY
	-NOBLOCKMAP
	seesound "casings/gp_casing"
	states{
	spawn:
		PBCS ABCDEF 2
		loop
	death:
		TNT1 A 0 A_Jump(256,1,2,3)
		PBCS F 0 A_Jump(256,3)
		PBCS C 0 A_Jump(256,2)
		PBCS E 0
		"####" "#" 400
		"####" "#" 1 A_FadeOut(0.1)
		Wait}}
actor pcasing_spawner{
	speed 15
	PROJECTILE
	+NOCLIP
	states{
	spawn:
		TNT1 A 1 NoDelay A_SpawnItemEx("pistol_casing",0,10,3,1,random(4,5),random(1,2),0,SXF_TRANSFERPOINTERS) 
		stop}}