ACTOR RailGun : BrutalWeapon
{
	Weapon.AmmoUse1 0
	Weapon.AmmoUse2 0
	Weapon.AmmoGive1 50
	Weapon.AmmoGive2 0
	Weapon.AmmoType1 "AmmoCell"
	Weapon.AmmoType2 "RailgunAmmo"
	Obituary "%o was pierced by %k's Railgun."
    Inventory.PickupSound "misc/w_pkup"
	Inventory.Pickupmessage "You got the Railgun!"
	+WEAPON.NOAUTOAIM
    +WEAPON.NOAUTOFIRE
	+WEAPON.NOALERT
	damagetype "Railgun"
	Weapon.SelectionOrder 2500
	States
	{
	
	SelectAnimation:
        RAIS ABC 1
        TNT1 AAA 0
		
	Ready:	
	Ready3:
        RAIL A 0 A_JumpIfInventory("Kicking",1,"DoKick")
        RAIL A 0 A_JumpIfInventory("Taunting",1,"GoTaunt")
		RAIL A 0 A_JumpIfInventory("Salute1", 1, "Salute")
		RAIL A 0 A_JumpIfInventory("Salute2", 1, "Salute")
		RAIL A 0 A_JumpIfInventory("Reloading",1,"Reload")
		RAIL A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
		RAIL A 0 A_JumpIfInventory("IsRunning",1,"CheckSprint")
		RAIL A 0 A_JumpIfInventory("Unloading",1,"Unload")
        RAIL A 0 A_JumpIfInventory("RailgunAmmo",1,2)
		RAIL A 0 A_JumpIfInventory("FiredPrimary",1,"Fire")
        Goto ReadyNoAmmo
        TNT1 AAAA 0
		RAIL ABC 1 A_WeaponReady(WRF_ALLOWRELOAD)
		Goto Ready
	Ready2:
		SNIP A 1 BRIGHT A_WeaponReady(WRF_ALLOWRELOAD)
		RAIL A 0 A_JumpIfInventory("Unloading",1,"Unload")
		RAIL A 0 A_JumpIfInventory("Kicking",1,"DoKick")
        RAIL A 0 A_JumpIfInventory("Taunting",1,"GoTaunt")
		RAIL A 0 A_JumpIfInventory("Salute1", 1, "Salute")
		RAIL A 0 A_JumpIfInventory("Salute2", 1, "Salute")
		RAIL A 0 A_JumpIfInventory("Reloading",1,"Reload")
		RAIL A 0 A_JumpIfInventory("IsRunning",1,"CheckSprint")
		RAIL A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
		RAIL A 0 A_JumpIfInventory("FiredPrimary",1,"Fire")
		Loop
		
	ReadyNoAmmo:
		RAIR B 1 A_WeaponReady(WRF_ALLOWRELOAD)
		RAIL A 0 A_JumpIfInventory("HasUnloadedRG", 1, "ReadyUnloaded")
		RAIL A 0 A_JumpIfInventory("IsRunning",1,"CheckSprint")
		RAIL A 0 A_JumpIfInventory("Kicking",1,"DoKick")
        RAIL A 0 A_JumpIfInventory("Taunting",1,"GoTaunt")
		RAIL A 0 A_JumpIfInventory("Salute1", 1, "Salute")
		RAIL A 0 A_JumpIfInventory("Salute2", 1, "Salute")
		RAIL A 0 A_JumpIfInventory("Reloading",1,"Reload")
		RAIL A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
		Loop	
	
	ReadyUnloaded:
		RAIR L 1 A_WeaponReady(WRF_ALLOWRELOAD)
		RAIL A 0 A_JumpIfInventory("IsRunning",1,"CheckSprint")
		RAIL A 0 A_JumpIfInventory("Kicking",1,"DoKick")
        RAIL A 0 A_JumpIfInventory("Taunting",1,"GoTaunt")
		RAIL A 0 A_JumpIfInventory("Salute1", 1, "Salute")
		RAIL A 0 A_JumpIfInventory("Salute2", 1, "Salute")
		RAIL A 0 A_JumpIfInventory("Reloading",1,"Reload")
		RAIL A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
		Loop	
		
	DontNeedToReload:
		RAIL A 0 A_JumpIfInventory("Zoomed",1,"Ready2")
	Goto Ready+6
	
	Deselect:
        RAIS CBA 1
		RAIL A 0 A_Takeinventory("PowerLightAmp", 1)
		RAIL A 0 A_Takeinventory("Zoomed",1)
        RAIL A 0 A_ZoomFactor(1.0)
		TNT1 AAAAAAAAAA 0 A_Lower
		TNT1 A 1 A_Lower
		Wait
	Select:
		RAIL A 0 A_Giveinventory("GoSpecial",1)
		RAIL A 0 A_Takeinventory("FistsSelected",1)
		RAIL A 0 A_Takeinventory("SawSelected",1)
		RAIL A 0 A_Takeinventory("ShotgunSelected",1)
		RAIL A 0 A_Takeinventory("SSGSelected",1)
		RAIL A 0 A_Takeinventory("MinigunSelected",1)
		RAIL A 0 A_Takeinventory("PlasmaGunSelected",1)
		//RAIL A 0 A_Giveinventory("RocketLauncherSelected",1)
		RAIL A 0 A_Takeinventory("RocketLauncherSelected",1)
		RAIL A 0 A_Takeinventory("GrenadeLauncherSelected",1)
		RAIL A 0 A_Takeinventory("BFGSelected",1)
		RAIL A 0 A_Takeinventory("BFG10kSelected",1)
		RAIL A 0 A_Giveinventory("RailGunSelected",1)
		RAIL A 0 A_Takeinventory("SubMachineGunSelected",1)
		RAIL A 0 A_Takeinventory("RevenantLauncherSelected",1)
		RAIL A 0 A_Takeinventory("LostSoulSelected",1)
		RAIL A 0 A_Takeinventory("FlameCannonSelected",1)
		RAIL A 0 A_Takeinventory("HasBarrel",1)
	    TNT1 A 1 A_Raise
		TNT1 AAAAAAAAAAA 0 A_Raise
		RAIL A 0 A_GunFlash
		Goto SelectAnimation
		
	Fire:
	    RAIL A 0
		RAIL A 0 A_JumpIfInventory("RailgunAmmo",10,2)
		Goto Reload
		TNT1 AA 0
		RAIL A 0 A_Takeinventory("RailgunAmmo",10)
			
		RAIL A 0 A_FireCustomMissile("RailgunTrailEffectMissile", 0, 0, 0, 0)
		RAIL A 0 A_FireCustomMissile("RailgunProjectile", 0, 1, 0, 0)
		RAIL A 0 A_RailAttack(400, 0, 0, "none", "none", RGF_FULLBRIGHT, 1, "RailgunPuff2")
		
		RAIL A 0 A_PlaySound("RAILF1", 1)
		RAIL A 0 A_SetPitch(-8.0 + pitch)
		RAIL A 0 A_ZoomFactor(0.7)
		
		RAIL A 0 A_JumpIfInventory("Zoomed",1,"ZoomedRecoil")
		
        RAIF A 1 BRIGHT A_AlertMonsters
		
		RAIL A 0 A_ZoomFactor(1.0)
		RAIL A 0 A_SetPitch(1.0 + pitch)
		RAIF BC 1 BRIGHT 
		
		RAIF DEFG 1 BRIGHT
		RAIL DDDDDDDD 1 A_SetPitch(1.0 + pitch)
		RAIL A 0 A_JumpIfInventory("RailgunAmmo",1,2)
		Goto Reload
		TNT1 AA 0
		RAIL DDDDD 2 A_WeaponReady(WRF_NOFIRE | WRF_NOBOB)
		RAIL A 0 A_PlaySound("RAILR1", 2)
		RAIL DDDDDDDDDDDDDDDD 2 A_WeaponReady(WRF_NOFIRE | WRF_NOBOB)
		RAIL A 0 A_PlaySound("BEPBEP", 2)
		RAIL A 0 A_JumpIfInventory("FiredPrimary",1,"Fire")
		RAIL A 0 A_Refire
        TNT1 AAAA 0
		Goto Ready3
		
	ZoomedRecoil:
		SNIP A 1 BRIGHT A_AlertMonsters
		RAIL A 0 A_ZoomFactor(5.0)
		RAIL A 0 A_SetPitch(1.0 + pitch)
		SNIP AAA 1 A_FireCustomMissile("SmokeSpawner",0,0,0,5)
		SNIP AAAAAAAA 1 A_SetPitch(1.0 + pitch)
		RAIL A 0 A_JumpIfInventory("RailgunAmmo",1,2)
		Goto Reload
		TNT1 AA 0
		SNIP AAAAAA 1 A_JumpifInventory("FiredSecondary", 1, "SuddenStopAim")
		RAIL A 0 A_PlaySound("RAILR1", 2)
		RAIL A 0 A_WeaponReady(WRF_NOFIRE | WRF_NOBOB)
		SNIP AAAAAAAAAAAAAAAA 2 A_JumpifInventory("FiredSecondary", 1, "SuddenStopAim2")
		RAIL A 0 A_PlaySound("BEPBEP", 2)
		SNIP A 1 A_Refire
		Goto Ready2
		
	
	SuddenStopAim:
		RAIL A 0
		RAIL A 0 A_ZoomFactor(1.0)
		RAIL A 0 A_Takeinventory("Zoomed",1)
		RAIL A 0 A_Takeinventory("PowerLightAmp", 1)
		RAIZ AB 1
		RAIL DDDDDD 1
		RAIL A 0 A_PlaySound("RAILR1", 2)
		RAIL DDDDDDDDDDDDDDDD 2
		RAIL A 0 A_PlaySound("BEPBEP", 2)
		Goto Ready
		
	SuddenStopAim2:
		RAIL A 0
		RAIL A 0 A_ZoomFactor(1.0)
		RAIL A 0 A_Takeinventory("Zoomed",1)
		RAIL A 0 A_Takeinventory("PowerLightAmp", 1)
		RAIZ AB 1
		RAIL DDDDDDDDDDDDDDDD 2
		RAIL A 0 A_PlaySound("BEPBEP", 2)
		Goto Ready	

    AltFire:
        RAIL A 0
		RAIL A 0 A_JumpIfInventory("Zoomed",1,"NoAim")
		RAIL A 0 A_Giveinventory("Zoomed",1)
        RAIL A 0 A_ZoomFactor(5.0)
		RAIL A 0 A_giveinventory("PowerLightAmp", 1)
        RAIZ AB 1 BRIGHT
        RAIL A 0 A_JumpIfInventory("FiredPrimary",1,"Fire")
		SNIP A 1 A_WeaponReady(WRF_ALLOWRELOAD)
		RAIL A 0 A_JumpIfInventory("FiredPrimary",1,"Fire")
		SNIP A 1 A_WeaponReady(WRF_ALLOWRELOAD)
		RAIL A 0 A_JumpIfInventory("FiredPrimary",1,"Fire")
		SNIP A 1 A_WeaponReady(WRF_ALLOWRELOAD)
		RAIL A 0 A_JumpIfInventory("FiredPrimary",1,"Fire")
		RAIL A 0 A_JumpIfInventory("FiredSecondary",1,"HoldAim")
        Goto Ready2
		
	   HoldAim:	
	    RAIL A 0 A_JumpIfInventory("FiredPrimary",1,"Fire")
		SNIP A 1 A_WeaponReady(WRF_ALLOWRELOAD)
		RAIL A 0 A_JumpIfInventory("FiredPrimary",1,"Fire")
		SNIP A 1 A_WeaponReady(WRF_ALLOWRELOAD)
		RAIL A 0 A_JumpIfInventory("FiredPrimary",1,"Fire")
		SNIP A 1 A_WeaponReady(WRF_ALLOWRELOAD)
		RAIL A 0 A_JumpIfInventory("FiredSecondary",1,"HoldAim")
	 NoAim:	
        RAIZ BA 1 BRIGHT
		RAIL A 0 A_Light0
		RAIL A 0 A_Takeinventory("Zoomed",1)
		RAIL A 0 A_Takeinventory("PowerLightAmp", 1)
        RAIL A 0 A_ZoomFactor(1.0)
        Goto Ready
		
		
      Reload:
	    RAIL A 0
		
		
        RAIL A 0 A_Takeinventory("Reloading",1)
		RAIL A 0 A_JumpIfInventory("RailgunAmmo",50,"DontNeedToReload")
		RAIL A 0 A_Takeinventory("Zoomed",1)
		RAIL A 0 A_Takeinventory("PowerLightAmp", 1)
		RAIL A 0 A_ZoomFactor(1.0)
        RAIL A 0 A_JumpIfInventory("AmmoCell",1,3)
        Goto Ready+6
        TNT1 AAAA 0
		
		
		RAIL A 0 A_JumpIfInventory("TurboReload", 1, "InsertBullets")
		RAIL A 0 A_JumpIfInventory("HasUnloadedRG",1, 17)
		RAIR AA 1
		RAIL A 0 A_PlaySound("PLREADY", 2)
		RAIR ABCDEF 1
		RAIL A 0 A_FireCustomMissile("PlasmaCaseSpawn",-30,0,-4,-4)
		RAIR GHIJKL 1
		RAIR L 20
		RAIR MNOP 1
		RAIR QRSTUVUUUUUUWX 1
		RAIL A 0 A_PlaySound("RAILR1", 2)
		RAIL D 30
		RAIL A 0 A_PlaySound("BEPBEP", 2)
		RAIL A 0 A_Takeinventory("HasUnloadedRG", 1)
	InsertBullets:	
		TNT1 AAAA 0
		RAIL A 0 A_JumpIfInventory("RailgunAmmo",50,"Ready")
		RAIL A 0 A_JumpIfInventory("AmmoCell",1,3)
		Goto Ready
        TNT1 AAAAAA 0
		RAIL A 0 A_Giveinventory("RailgunAmmo",1)
		RAIL A 0 A_Takeinventory("AmmoCell",1)
		Loop
		
		
		
	Unload:
	    RAIL A 0
		RAIL A 0 A_Takeinventory("PowerLightAmp", 1)
        RAIL A 0 A_Takeinventory("Unloading",1)
		RAIL A 0 A_JumpIfInventory("RailgunAmmo",1,2)
		Goto ReadyUnloaded
		TNT1 AA 0
		RAIL A 0 A_Takeinventory("Zoomed",1)
		RAIL A 0 A_ZoomFactor(1.0)
        RAIL A 0 A_JumpIfInventory("AmmoCell",1,3)
        Goto Ready+6
        TNT1 AAAA 0
		
		RAIR AA 1
		RAIL A 0 A_PlaySound("PLREADY", 2)
		RAIR ABCDEF 1
		RAIR GHIJKL 1
		RAIL A 0 A_Giveinventory("HasUnloadedRG",1)
		RAIL A 0 A_StopSound(2)
	RemoveBullets:	
		TNT1 AAAA 0
		RAIL A 0 A_JumpIfInventory("RailgunAmmo",1,3)
		Goto ReadyUnloaded
        TNT1 AAAAAA 0
		RAIL A 0 A_Takeinventory("RailgunAmmo",1)
		RAIL A 0 A_Giveinventory("AmmoCell",1)
		Loop	
		
 	Spawn:
		SRCG A -1
		Stop
		
	CheckSprint:
		RAIL A 1 A_WeaponReady(WRF_NOFIRE)
		RAIL A 0 A_JumpIfInventory("IsStandingStill", 1, "Ready3")
		RAIL A 0 A_JumpIfInventory("IsTacticalClass", 1, "StartSprint")
		Goto Ready3
		
	CheckSprint2:
		RI2G A 1 A_WeaponReady(WRF_NOFIRE)
		RAIL A 0 A_JumpIfInventory("IsStandingStill", 1, "Ready3")
		RAIL A 0 A_JumpIfInventory("IsTacticalClass", 1, "StartSprint")
		Goto Ready2	
		
	StartSprint:
		RAIL A 1 A_WeaponReady(WRF_NOFIRE)
		RAIL A 0 A_Takeinventory("Zoomed",1)
		RAIL A 0 A_Takeinventory("ADSmode",1)
		RAIL A 0 A_ZoomFactor(1.0)
		RAIL A 0 A_JumpIfInventory("UsedStamina", 40, "StopSprintTired")
		
	Sprinting:	
		RAIL A 0 offset(-9,32) 
		RAIL A 0 offset(-9,32) A_JumpIfInventory("IsStandingStill", 1, "Ready3")
		RAIL 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.
		RAIL A 0 offset(-9,32) A_JumpIfInventory("PowerStrength", 1, 2)
		RAIL A 0 offset(-9,32) A_GiveInventory("UsedStamina", 5)
		RAIL A 0 offset(-9,32)
		RAIL A 1 offset(-9,34) A_SetPitch(pitch -0.5)
		RAIL B 1 offset(-6,36) A_SetPitch(pitch -0.5)
		RAIL C 1 offset(-3,38) A_SetPitch(pitch -0.5)
		RAIL A 1 offset(0,38) A_SetPitch(pitch -0.5)
		RAIL B 1 offset(3,36) A_SetPitch(pitch -0.5)
		RAIL C 1 offset(6,34) A_SetPitch(pitch -0.5)
		RAIL A 1 offset(9,32) A_SetPitch(pitch -0.5)
		RAIL A 0 offset(9,32) A_WeaponReady(WRF_NOBOB)
		RAIL A 0 A_JumpIfInventory("Kicking",1,"DoKick")
        RAIL A 0 A_JumpIfInventory("Taunting",1,"GoTaunt")
        RAIL A 0 A_JumpIfInventory("Reloading",1,"Reload")
		RAIL A 0 offset(-9,32) A_GiveInventory("UsedStamina", 5)
		RAIL A 0 offset(9,33) A_SpawnItemEx("FootStep", 0, 0, 2, 0, 0, -4)
		RAIL B 1 offset(9,34) A_SetPitch(pitch +0.5)
		RAIL C 1 offset(6,36) A_SetPitch(pitch +0.5)
		RAIL A 1 offset(3,38) A_SetPitch(pitch +0.5)
		RAIL B 1 offset(0,38) A_SetPitch(pitch +0.5)
		RAIL C 1 offset(-3,36) A_SetPitch(pitch +0.5)
		RAIL A 1 offset(-6,34) A_SetPitch(pitch +0.5)
		RAIL B 1 offset(-9,32) A_SetPitch(pitch +0.5)
		RAIL A 0 offset(-9,32) A_WeaponReady(WRF_NOBOB)
		RAIL A 0 offset(-9,32) A_JumpIfInventory("IsRunning", 1, "Sprinting")
		
		Goto StopSprint
	StopSprintTired:
		RAIL A 1
		PLAY A 0 ACS_ExecuteAlways(853, 0, 0, 0, 0)//Makes player slower.
		RAIL A 0 A_PlaySound("Tired", 2)
		RAIL A 0 A_TakeInventory("UsedStamina", 2)
		RAIL A 5 A_WeaponReady
		RAIL A 0 A_TakeInventory("UsedStamina", 2)
		RAIL A 5 A_WeaponReady
		RAIL A 0 A_TakeInventory("UsedStamina", 2)
		RAIL A 5 A_WeaponReady
		RAIL A 0 A_TakeInventory("UsedStamina", 2)
		RAIL A 5 A_WeaponReady
		RAIL A 0 A_TakeInventory("UsedStamina", 2)
		RAIL A 5 A_WeaponReady
		Goto Ready3
	StopSprint:
		RAIL A 1
		RAIL A 0 A_JumpIfInventory("UsedStamina", 60, "StopSprintTired")
		PLAY A 0 ACS_ExecuteAlways(853, 0, 0, 0, 0)//Makes player slower.
		Goto Ready3	
		
	GoTaunt:
		RAIL A 0
		RAIL A 0 A_Light0
		RAIL A 0 A_Takeinventory("Zoomed",1)
		RAIL A 0 A_Takeinventory("PowerLightAmp", 1)
        RAIL A 0 A_ZoomFactor(1.0)
		Goto Taunt
	}
}


ACTOR RailgunProjectile
{
	
	Radius 2
	Height 2
	Speed 80
	Damage (random(400, 400))
    DamageType Railgun
	Decal "SmallerScorch"
	Projectile
	+RANDOMIZE
	+MISSILE
	+FORCERADIUSDMG
	+THRUACTORS
	Species "Marines"
	Scale 1.0
	var int user_railangle;
	
	renderstyle ADD
	alpha 0.90
	Scale 0.10
	DeathSound "weapons/plasmax"
	//SeeSound "PLSM9"
    SeeSound "None"
	Obituary "$OB_MPPLASMARIFLE"
	+BounceOnWalls
	+BounceOnFloors
	+BounceOnCeilings
	BounceFactor 1.0
	+USEBOUNCESTATE
	BounceCOunt 3
	//MissileType "WhiteShockwave"
	States
	{
	DM:
		RAIL A 0
		RAIL A 0 A_ChangeFLag("THRUSPECIES", 0)
		RAIL A 0 A_ChangeFLag("MTHRUSPECIES", 0)
		Goto Spawn1
	
	Spawn:
		RAIL A 0
		RAIL A 0 A_FaceTarget
		RAIL A 0 A_SetUserVar("user_railangle", angle)
		RAIL A 0 A_SpawnItem("WhiteShockwave")
		RAIL A 0 ACS_NamedExecuteAlways("CheckIfDM", 0, 0, 0, 0)//Check if Coop
		
		TNT1 C 1 BRIGHT A_SpawnItem("WhiteShockwave")
		

	Spawn1:
        TNT1 C 1 BRIGHT A_SpawnItem("WhiteShockwave")
		RAIL A 0 A_SpawnItem("WhiteShockwave")
		RAIL A 0 A_CheckFloor("Death")
		RAIL A 0 A_CustomMissile ("OldschoolRocketSmokeTrail2", 2, 0, random (160, 210), 2, random (-30, 30))
		Loop
	
	Bounce.Wall:
		RAIL A 0
		RAIL A 0 A_SetAngle(user_railangle)
		RAIL A 0 BRIGHT A_CustomMissile("RailgunPenetrator1", 0, 0, 180, 2, momz)
		Goto Death
		
	Bounce.Floor:
	Bounce.Ceiling:
		TNT1 A 1
		RAIL A 0 A_SetAngle(user_railangle)
		RAIL A 0 BRIGHT A_CustomMissile("RailgunPenetrator1b", 0, 0, 180, 2, -momz)
		Goto Death
		
	Death:
	Melee:
	Xdeath:
		TNT1 AAAA 0 A_SpawnItemEx("BluePlasmaParticleSpawner", 0, 0, 0, 0, 0, 0, 0, 128)
		TNT1 AA 0 A_SpawnItem("WhiteShockwave")
		RAIL A 0 A_Explode(120,5, 1)
        TNT1 AAAAAAAAA 0 A_CustomMissile ("ExplosionParticleHeavy", 0, 0, random (0, 360), 2, random (0, 180))
        TNT1 AAAAAAAAAAAAAAAAAA 0 A_CustomMissile ("ExplosionParticleHeavy", 0, 0, random (0, 360), 2, random (0, 360))
		TNT1 AAAAAAAAA 0 A_CustomMissile ("ExplosionParticleVeryFast", 0, 0, random (0, 360), 2, random (0, 360))
        EXPL AAAAA 0 A_CustomMissile ("ExplosionSmokeFast22", 0, 0, random (0, 360), 2, random (0, 360))
		TNT1 AAAA 0 A_CustomMissile ("FireworkSFXType2", 2, 0, random (0, 360), 2, random (10, 80))
		RAIL A 0 A_SpawnItemEx ("DetectFloorCraterSmall",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
		RAIL A 0 A_SpawnItemEx ("DetectCeilCraterSmall",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
		RAIL A 0 A_CustomMissile ("BluePlasmaFire", 0, 0, random (0, 360), 2, random (0, 360))
		TNT1 AAAAA 0 A_CustomMissile ("BluePlasmaParticle", 0, 0, random (0, 360), 2, random (0, 360))
		TNT1 ABE 0 BRIGHT A_SpawnItem("BlueFlare" ,0)
		Stop
		Stop
	}
}

aCTOR rAILGUNpENETRATOR1
{
	PROJECTILE
	+Missile
	+NOCLIP
	Radius 2
	Height 2
	Speed 40
	Damagetype "Extreme"
	States
	{
		Spawn:
			RAIL A 0
			RAIL A 0 A_CheckFloor("XDeath")
			RAIL A 0 A_Checkceiling("XDeath")
			TNT1 A 0 A_Explode(100, 100)
			TNT1 A 1
			TNT1 A 0 A_Explode(100, 100)
			RAIL A 0 BRIGHT A_CustomMissile("RailgunPenetrator", 0, 0, 0, 2, momz)
			Stop
		XDeath:
			RAIL A 0
			Stop
	}
}


aCTOR rAILGUNpENETRATOR1B: rAILGUNpENETRATOR1
{
	Speed 40
}
		



actor RailgunTracerTrail
{
    Scale 0.2
    RenderStyle Add
    Alpha 0.9
    +NOINTERACTION
    +CLIENTSIDEONLY
	+FORCEXYBILLBOARD
    States
    {
    Spawn:
        PBAL A 2 BRIGHT
        stop
    }
}

Actor RailgunPenetrationParticle
{
+THRUACTORS
+CLIENTSIDEONLY
+MISSILE
+NOGRAVITY
States
	{
		Spawn:
			
			TNT1 A 15
			TNT1 AAAA 0 A_CustomMissile ("OldschoolRocketSmokeTrailDarker", 2, 0, random (160, 210), 2, random (-30, 30))
			Stop
}}



Actor RailgunTrailEffectMissile: FastProjectile
{
damage (random(0, 0))
Decal "Scorch"
DamageType Railgun
+NODAMAGETHRUST
Radius 1
Height 1
Scale 0.2
Speed 999
-SKYEXPLODE
+ripper

MissileType "RailgunTrailEffect"
States
{
	Spawn:
		TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 1 A_SpawnItem("RailgunTrailEffect")
		Stop
		
Death:
		RAIL A 0
		TNT1 B 0
		RAIL A 0 A_SpawnItemEx ("Footstep91",0,0, 40,0,0,0,0,SXF_NOCHECKPOSITION,0)
		TNT1 B 1 
		RAIL A 0 A_SpawnItemEx ("ExplosionSplashSpawner", 0, 0, 0)
        RAIL A 0 A_SpawnItemEx ("DetectFloorCrater",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
	    RAIL A 0 A_SpawnItemEx ("DetectCeilCrater",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
		TNT1 AA 0 A_CustomMissile ("SparkXNoModel", 2, 0, random (0, 360), 2, random (0, 360))
		RAIL A 0 A_SpawnItem("RailgunFlameTrails")
		
		EXPL A 0 Radius_Quake (3, 8, 0, 15, 0)
	    RAIL A 0 A_SpawnItemEx ("UnderwaterExplosion",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
        RAIL A 0 A_SpawnItemEx ("ExplosionFlareSpawner",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
        TNT1 AAA 0 A_CustomMissile ("BDExplosionparticles", 0, 0, random (0, 360), 2, random (40, 90))
		TNT1 AA 0 A_CustomMissile ("BDExplosionparticles2", 0, 0, random (0, 360), 2, random (40, 90))
		TNT1 AA 0 A_CustomMissile ("BDExplosionparticles3", 10, 0, random (0, 360), 2, random (40, 90))
		TNT1 AAA 0 A_CustomMissile ("ExplosionFlames", 0, 0, random (0, 360), 2, random (0, 360))
        RAIL A 0 A_SpawnItemEx ("RocketExplosion",0,0,13,0,0,0,0,SXF_NOCHECKPOSITION,0)
		TNT1 A 2
		RAIL A 0 A_SpawnItemEx ("LiquidExplosionEffectSpawner",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
		RAIL A 0 A_PlaySound("FAREXPL", 3)
		TNT1 A 15
		RAIL A 0 A_PlaySound("distantexp", 5)
		Stop
}
}


Actor RailgunTrailEffect
{
+THRUACTORS
+CLIENTSIDEONLY
+MISSILE
+NOGRAVITY
States
	{
		Spawn:
			//TNT1 AAAA 0 A_CustomMissile ("RailgunTrailParticle", 2, 0, random (0, 360), 2, random (0, 360))
			RAIL A 0
			RAIL A 0 A_SpawnItem("RailgunFlameTrailsBlue")
			TNT1 A 12
			TNT1 AAAA 0 A_CustomMissile ("OldschoolRocketSmokeTrailDarker", 2, 0, random (160, 210), 2, random (-30, 30))
			Stop
}}

Actor RailgunPenetrator: MarineTracer
{
damage (random(50, 60))
//Decal "BulletDecalNew1"
Decal "Scorch"
DamageType Extreme
Radius 4
Height 4
Scale 0.2
+MISSILE
+RIPPER
Speed 80
-SKYEXPLODE
MissileType "RailgunPenetrationParticle"
States
{
	Spawn:
		RAIL A 0
		RAIL A 0 A_CustomMissile("SpawnBulletDecalBackwards", 0, 0, 0)
		TNT1 A 10
		
		sTOP
		
Death:
	RAIL A 0
    TNT1 A 1
	RAIL A 0 A_SpawnItemEx ("DetectFloorCrater",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
	    RAIL A 0 A_SpawnItemEx ("DetectCeilCrater",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
	    RAIL A 0 A_SpawnItemEx ("UnderwaterExplosion",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
        TNT1 AAAAAAAAA 0 A_CustomMissile ("ExplosionParticleHeavy", 0, 0, random (0, 360), 2, random (0, 180))
        TNT1 AAAAAAAAAAAAAAAAAA 0 A_CustomMissile ("ExplosionParticleHeavy", 0, 0, random (0, 360), 2, random (0, 360))
		TNT1 AAAAAAAAA 0 A_CustomMissile ("ExplosionParticleVeryFast", 0, 0, random (0, 360), 2, random (0, 360))
        EXPL AAAAA 0 A_CustomMissile ("ExplosionSmokeFast22", 0, 0, random (0, 360), 2, random (0, 360))
		TNT1 A 0 A_Explode(50, 100)
	RAIL A 0 A_SpawnItemEx ("DetectFloorCraterSmall",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
	RAIL A 0 A_SpawnItemEx ("DetectCeilCraterSmall",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
	RAIL A 0 A_CustomMissile ("BluePlasmaFire", 0, 0, random (0, 360), 2, random (0, 360))
	TNT1 AAAAA 0 A_CustomMissile ("BluePlasmaParticle", 0, 0, random (0, 360), 2, random (0, 360))
	TNT1 ABCDE 2 BRIGHT A_SpawnItem("BlueFlare" ,0)
    TNT2 AAAAAAAAA 9 A_CustomMissile ("PlasmaSmoke", 1, 0, random (0, 360), 2, random (0, 160))
	Stop
	
DeathSpecial:	
	
    Stop
XDEath:
RAIL A 0
//RAIL A 0 A_Explode(2, 5)
TNT1 A 1
Stop	
}
}