actor WarpPortalWep_NormalBar : NormalBar{args 64,79}
actor WarpPortalWep : BaseMM8BDMWep
{
Weapon.AmmoUse 7
Weapon.AmmoGive 28
Weapon.SlotNumber 4
Inventory.Pickupmessage "$PU_WARPPORTAL"
Obituary "$OB_WARPPORTAL"
Tag "$TAG_WARPPORTAL"
weapon.ammotype "WarpPortalAmmo"
inventory.icon "WPORICON"
Scale 2.0
States
{
SpawnLoop:
WPOR Z -1
loop
Ready:
WPOR A 0 ACS_NamedExecuteWithResult("core_weaponcolor",COLOR_WARPPORTAL)
WPOR A 1 A_WeaponReady
Goto Ready+1
ReadyC: Goto Ready+1
Deselect:
WPOR A 0
goto DeselectSwap
Select:
WPOR A 0
goto SelectSwap
Fire:
WPOR A 0 A_JumpIfNoAmmo("NoAmmo")
WPOR A 0 A_TakeInventory("WarpPortalAmmo",7,TIF_NOTAKEINFINITE)
Teleporting:
WPOR BC 2 ACS_NamedExecuteAlways("core_unsolidplayer",0,0,USP_TOGGLEON)
WPOR A 0 A_SpawnItemEX("WarpPortalPortal",0,0,16)
WPOR A 0 A_PlaySoundEx("misc/galaxyteleport","Weapon")
TNT1 A 0 A_ChangeFlag("INVULNERABLE", 1)
TNT1 A 0 ACS_NamedExecuteAlways("core_freezeplayer",0,0,1)
WPOR A 1 A_SetTranslucent(0.0)
WPOR A 0 A_Stop
WPOR A 0 A_SpawnItemEx("WarpPortalHitbox",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION)
TNT1 A 1 A_GiveInventory("WarpPortalThrust_P",1)

WPOR A 0 A_SpawnItemEx("WarpPortalHitbox",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION)
TNT1 A 1 A_GiveInventory("WarpPortalThrust_P",1)

WPOR A 0 A_SpawnItemEx("WarpPortalHitbox",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION)
TNT1 A 1 A_GiveInventory("WarpPortalThrust_P",1)

WPOR A 0 A_SpawnItemEx("WarpPortalHitbox",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION)
TNT1 A 1 A_GiveInventory("WarpPortalThrust_P",1)
WPOR A 0 A_CheckFloor("FinishTP")

FinishTP:
TNT1 A 0 A_ScaleVelocity(0.1)
WPOR A 0 A_PlaySoundEx("misc/galaxyteleport","Weapon")
WPOR A 0 A_SpawnItemEX("WarpPortalPortal",0,0,16)
WPOR A 0 A_SetTranslucent(1.0)
WPOR E 0 ACS_NamedExecuteAlways("core_freezeplayer",0,0,0)
WPOR AA 1 ACS_NamedExecuteAlways("core_unsolidplayer",0,0,USP_TOGGLEOFF_DAMAGE,ACS_NamedExecuteWithResult("core_getmaxhealth")/10)
WPOR C 2 A_SpawnItemEx("WarpPortalTelefrag",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION)
WPOR B 2 A_ChangeFlag("INVULNERABLE", 0)
TNT1 A 0 SetPlayerProperty(0,0,0)
WPOR BBBAAAAAAAA 1 ACS_NamedExecuteAlways("core_unsolidplayer",0,0,USP_TOGGLEOFF_DAMAGE,ACS_NamedExecuteWithResult("core_getmaxhealth")/10)
WPOR A 15
goto Ready+1
NoAmmo:
WPOR A 1 ACS_Execute(979,0)
WPOR A 0 A_Refire
goto Ready+1
}
}

actor WarpPortalAmmo : Ammo
{
inventory.amount 1
inventory.maxamount 28
+INVENTORY.IGNORESKILL
}

actor WarpPortalThrust_P : CustomInventory
{
states
{
Pickup:
TNT1 A 0
TNT1 A 0 A_JumpIf(ACS_ExecuteWithResult(975,0)==2,"Saxton")
TNT1 A 1 A_ChangeVelocity(cos(pitch)*200,0,-sin(pitch)*120,CVF_RELATIVE|CVF_REPLACE)
stop
Saxton:
TNT1 A 1 A_ChangeVelocity(cos(pitch)*125,0,-sin(pitch)*75,CVF_RELATIVE|CVF_REPLACE)
stop
}
}

actor WarpPortalPortal : TimePortalProp
{
-VISIBILITYPULSE
alpha 0.1
states
{
	Spawn:
	WPRT AB 2 A_FadeIn(0.8)
	WPRT CDABCDABCD 2 A_FadeOut(0.15)
	stop
}
}



actor WarpPortalHitbox
{
-SOLID
+NOGRAVITY
PROJECTILE
+DONTBLAST
+NOINTERACTION
damage 0
radius 1
height 1
damagetype "WarpPortal"
Obituary "$OB_WARPPORTAL"
States
{
Spawn:
TNT1 A 0
TNT1 A 1 A_Explode(CallACS("vile_cbm_damage",24), 72,0,0,72)
stop
}
}

actor WarpPortalTelefrag
{
-SOLID
+NOGRAVITY
PROJECTILE
+DONTBLAST
+NOINTERACTION
damage 0
radius 1
height 1
damagetype "WarpPortal"
Obituary "$OB_WARPPORTAL"
States
{
Spawn:
TNT1 A 0
TNT1 A 1 A_Explode(110, 24,0,0,24)
stop
}
}