const int ICEWALLDAMAGE=18;
actor IceWallWep : BaseMM8BDMWep 10018
{
//$Category MM8BDM-Weapons
//$Title Ice Wall
//$Sprite ICWLX0
Weapon.AmmoUse 2
Weapon.AmmoGive 28
Weapon.SlotNumber 7
Inventory.Pickupmessage "$PU_ICEWALL"
Obituary "$OB_ICEWALL"
Tag "$TAG_ICEWALL"
weapon.ammotype "IceWallAmmo"
inventory.icon "IWALL"
States
{
SpawnLoop:
ICWL X -1
loop
Ready:
ICWL H 0 ACS_ExecuteAlways(998,0,176)
ICWL H 1 A_WeaponReady
Goto Ready+1
Deselect:
TNT1 AAAAAAAAAAAAAAAAAAAAAA 0 A_Lower
ICWL H 1 A_Lower
Loop
Select:
TNT1 AAAAAAAAAAAAAAAAAAAAAA 0 A_Raise
ICWL H 1 A_Raise
Loop
Fire:
ICWL H 0 A_JumpIfNoAmmo("NoAmmo")
ICWL H 0 A_PlaySoundEx("weapon/icewallspawn","Weapon")
ICWL H 0 A_ChangeVelocity(momx*0.75, momy*0.75, momz, CVF_REPLACE)
ICWL H 0 A_GiveInventory("FireIceWall", 1)
ICWL H 0 A_TakeInventory("IceWallAmmo",2,TIF_NOTAKEINFINITE)
ICWL IJ 3
ICWL H 40
ICWL H 0 A_Refire
goto Ready+1
AltFire:
ICWL H 0 A_JumpIfNoAmmo("NoAmmo")
ICWL H 0 A_PlaySoundEx("weapon/icewallspawn","Weapon")
ICWL H 0 A_ChangeVelocity(0, 0, momz, CVF_REPLACE)
ICWL H 0 A_GiveInventory("AltFireIceWall", 1)
Goto Fire+5
NoAmmo:
ICWL H 0 ACS_Execute(979,0)
Goto Ready+1
}
}

actor FireIceWall : CustomInventory
{
    States
    {
    Pickup:
        TNT1 A 0 A_SpawnItemEx("IceWallSpawner",56,0,8, momx, momy, 0, 0, SXF_ABSOLUTEMOMENTUM)
        TNT1 A 0 A_JumpIfInventory("RuneSpread", 1, "PickupSpread")
        stop
    PickupSpread:
    	TNT1 A 0 A_SpawnItemEx("IceWallSpawner",56,-4,8, momx, momy, 0, -60, SXF_ABSOLUTEMOMENTUM)
    	TNT1 A 0 A_SpawnItemEx("IceWallSpawner",56,-4,8, momx, momy, 0, 60, SXF_ABSOLUTEMOMENTUM)
        stop
    }
}

actor AltFireIceWall : CustomInventory
{
    States
    {
    Pickup:
        TNT1 A 0 A_SpawnItemEx("IceWallSpawner",64,0,8, 0, 0, 0, 0, SXF_ABSOLUTEMOMENTUM)
        TNT1 A 0 A_JumpIfInventory("RuneSpread", 1, "PickupSpread")
        stop
    PickupSpread:
    	TNT1 A 0 A_SpawnItemEx("IceWallSpawner",64,-4,8, 0, 0, 0, -60, SXF_ABSOLUTEMOMENTUM)
    	TNT1 A 0 A_SpawnItemEx("IceWallSpawner",64,-4,8, 0, 0, 0, 60, SXF_ABSOLUTEMOMENTUM)

        stop
    }
}
actor IceWallSpawner
{
scale 2.5
+MISSILE
+RIPPER
+NOGRAVITY
+DONTBLAST
+NOBLOOD
+STEPMISSILE
+NOEXPLODEFLOOR
species "MovingPlatform"
+THRUSPECIES
maxstepheight 32
Mass 9999999
DamageType "IceWall"
Damage (0)
Height 64
Radius 24
States
{
Spawn:
ICWL A 0 
ICWL A 0 A_ChangeFlag("NOCLIP", 0)
//ICWL A 0 A_JumpIf(ACS_NamedExecuteWithResult("HF_ZCheck") > 64, "Death")
ICWL ABCDE 2
ICWL F 0 A_ChangeFlag("NOGRAVITY",0)
ICWL F 0 A_Explode(ICEWALLDAMAGE, 64, 0)
ICWL F 0 A_SpawnItemEx("IceWall", 0, 0, 0, momx, momy,momz, 0, SXF_ABSOLUTEMOMENTUM)
stop
Death:
ICWL K 0
ICWL K 0 A_Stop
ICWL LM 5
stop
}
}
 
actor IceWall
{
scale 2.1
Obituary "$OB_ICEWALL"
+MISSILE
+RIPPER
+PUSHABLE
+SHOOTABLE
+SOLID
+NODAMAGETHRUST
+NOTARGETSWITCH
+NOBLOOD
+MOVEWITHSECTOR
+CANBOUNCEWATER
+DONTSPLASH
+DONTRIP
+NOEXPLODEFLOOR
+STEPMISSILE
+DONTREFLECT
+NOTAUTOAIMED
+BOUNCEONWALLS
+ALLOWBOUNCEONACTORS
+FORCEYBILLBOARD
Maxstepheight 7
Mass 9999999
DamageType "IceWall"
Health 200
Damage (ICEWALLDAMAGE)
Radius 24
Height 64
speed 0
//Gravity 2.0
BounceFactor 0.91
WallBounceFactor 0.91
DamageFactor "IceWall", 0.0
species "MovingPlatform"
+THRUSPECIES
var int user_playerRiding[64];
States
{
Spawn:
ICWL F 1 //A_JumpIfInventory("IceWallFlag",1,"Death",AAPTR_TARGET)
ICWL F 0 A_JumpIf(momx>1||momy>1||momx<-1||momy<-1,"MoveBegin")
ICWL F 0 Thing_Damage(0, 1)
ICWL F 0 A_Explode(ICEWALLDAMAGE, 64, 0)
loop
MoveBegin:
ICWL F 0 ACS_NamedExecuteAlways("core_stickyLifts",0,STICKYMODE_GUTSLIFT)
ICWL F 0 A_ChangeFlag("PUSHABLE",0)
ICWL F 0 ACS_ExecuteAlways(994, 0, 1)
ICWL F 1 A_JumpIfInventory("IceWallFlag",1,"Death",AAPTR_TARGET)
Accelerate:
ICWL F 0 A_Recoil(-3)
ICWL FFFFF 1 //A_JumpIfInventory("IceWallFlag",1,"Death",AAPTR_TARGET)
ICWL F 0 A_Recoil(-3)
ICWL FFFFF 1 //A_JumpIfInventory("IceWallFlag",1,"Death",AAPTR_TARGET)
ICWL F 0 A_Recoil(-4)
ICWL FFFFF 1 //A_JumpIfInventory("IceWallFlag",1,"Death",AAPTR_TARGET)
ICWL F 0 A_Recoil(-2)
ICWL FFFFF 1 //A_JumpIfInventory("IceWallFlag",1,"Death",AAPTR_TARGET)
ICWL F 0 A_Recoil(-2)
ICWL FFFFF 1 //A_JumpIfInventory("IceWallFlag",1,"Death",AAPTR_TARGET)
Moving:
ICWL F 0 //A_JumpIfInventory("IceWallFlag",1,"Death",AAPTR_TARGET)
ICWL F 0 Thing_Damage(0, 1)
ICWL F 1 A_JumpIfHealthLower(75,"MovingLow")
loop
MovingLow:
ICWL K 0 //A_JumpIfInventory("IceWallFlag",1,"Death",AAPTR_TARGET)
ICWL K 1 Thing_Damage(0, 1)
loop
Death:
ICWL K 0
ICWL K 0 A_Stop
ICWL K 0 A_ChangeFlag("NOGRAVITY", 1)
ICWL K 0 A_ChangeFlag("SOLID", 0)
ICWL K 0 A_ChangeFlag("SHOOTABLE", 0)
ICWL K 10
ICWL LM 5
stop
}
}
 
actor IceWallAmmo : Ammo
{
inventory.amount 1
inventory.maxamount 28
+INVENTORY.IGNORESKILL
}
 
actor IceWallFlag : Once {}
