actor RushSearch : CustomInventory// 10090
{
//$Category MM8BDM-Assists
//$Title Rush Search
//$Sprite RUS2K0
Inventory.RespawnTics 245
inventory.amount 10
inventory.maxamount 20
inventory.pickupmessage "$PU_RUSHSEARCH"
inventory.icon "RSEARCH"
Tag "$TAG_RUSHSEARCH"
Inventory.PickupSound "item/1up"
scale 2.0
+COUNTITEM
+INVBAR
states
{
Spawn:
RUS2 K -1
loop
Use:
RUS2 K 0 A_JumpIfInventory("RushSearchActive", 1, "Failure")
RUS2 K 0 A_PlaySoundEx("item/refill","Voice")
RUS2 K 0 A_GiveInventory("RushSearchActive", 1)
RUS2 K 0 A_SpawnItemEx("RushSearchTeleport", 40, 0, 256, 0, 0, -32, 0, SXF_NOCHECKPOSITION, 0)
stop
Failure:
WEAP B 0
fail
}
}

actor RushSearchBossCounter : Inventory
{
inventory.maxamount 2
}


actor RushSearchUnlimited : RushSearch
{
inventory.amount 1
inventory.maxamount 1
inventory.icon "RSEARCHU"
states
{
Spawn:
RUS2 L -1
loop
Use:
RUS2 K 0 A_JumpIfInventory("RushSearchActive", 1, "Failure")
RUS2 K 0 A_PlaySoundEx("item/refill","Voice")
RUS2 K 0 A_GiveInventory("RushSearchActive", 1)
RUS2 K 0 A_SpawnItemEx("RushSearchTeleport", 40, 0, 256, 0, 0, -32, 0, SXF_NOCHECKPOSITION, 0)
fail
}
}

actor RushSearchGlobal : RushSearchUnlimited
{
inventory.icon "RSEARCHG"
states
{
Spawn:
RUS2 N -1
loop
}
}

actor RushSearchActive : Inventory {}

actor RushSearchTeleport : RushTeleport
{
states
{
Spawn:
RUSH D 0
RUSH D 6
RUSH D 0 A_ChangeFlag("NOINTERACTION", 0)
RUSH DDDDDDDDDD 1 A_CheckFloor("Next")
Next:
RUSH D 0 //A_ChangeFlag("NOGRAVITY", 0)
Goto Death
Death:
TNT1 A 0 A_SpawnItemEx("RushSearchOut",0,0,3,0,0,momz,0,SXF_NOCHECKPOSITION,0)
stop
}
}

actor RushSearchOut : ProjSpawnFuncActor
{
- SOLID
+MISSILE
+DONTBLAST
+NOCLIP
+SKYEXPLODE
speed 0
scale 2.5
Radius 18
Height 32
+NOTARGETSWITCH

health 1

states
{
Spawn:
RUSH D 0 A_Jump(256,"Death")
RUSH E 0 A_RearrangePointers(AAPTR_TARGET, AAPTR_MASTER, AAPTR_TARGET)
RUSH D 0 A_ChangeFlag("MISSILE",0)
RUSH D 0 A_ChangeVelocity(0, 0, -32, CVF_REPLACE)
RUSH D 1 A_JumpIf(z-floorz<=0, "Look")
Goto Spawn+2
Look:
RUSH E 0 A_ChangeFlag("NOCLIP",0)
RUSH FDEE 1
RUSH E 0 A_ChangeFlag("SHOOTABLE", 1)
RUSH ABA 3
RUS2 AB 8
RUS2 CDEF 3 A_SpawnItemEx("RushSearchFX", 36, random(-2,2), 0, random(-5, -10), random(-2,2), random(5,10), 0, 0)
Digging:
RUS2 CDEF 3
RUS2 F 0 ACS_NamedExecuteWithResult("core_rushsearch_zonecheck")
Treasure:
RUS2 GHGH 4
RUS2 I 0 A_ChangeFlag("SHOOTABLE", 0)
RUS2 I 12 ACS_NamedExecuteAlways("core_rushsearch_treasure", 0) 
RUSH ABAB 3
RUSH A 0 A_JumpIfInventory("CutterFlag", 1, "Detect")
Goto Exit
BigTreasure:
RUS2 GHGHGHGHGHGHGHGHGHGH 4
RUS2 CDEFCDEFCDEFCDEFCDEFCDEFCDEFCDEFCDEFCDEFCDEFCDEF 2 A_SpawnItemEx("RushSearchFX", 36, random(-2,2), 0, random(-5, -10), random(-2,2), random(5,10), 0, 0)
RUS2 GHGHGHGHGHGHGHGH 4
RUS2 I 0 A_ChangeFlag("SHOOTABLE", 0)
RUS2 I 12 ACS_NamedExecuteAlways("core_rushsearch_treasure", 0) 
RUSH ABAB 3
Goto Exit
Death: 
RUS2 J 0 A_PlaySoundEx("misc/monkeybutt", "Voice")
RUS2 J 1 A_SpawnItemEx("PainFX",-5,0,3,0,0,0)
RUS2 J 1 A_Recoil(1)
RUS2 JJJJJJJJJ 2 A_SpawnItemEx("PainFX",-5,0,3,0,0,0)
Exit:
TNT1 A 35 A_SpawnItemEx("RushDeath",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION|SXF_WEPFXCOLOR)
TNT1 A 0 A_TakeInventory("RushSearchActive", 999, 0, AAPTR_TRACER)
stop
Detect:
RUSH AB 3
TNT1 A 0 A_GiveInventory("CutterFlag", 1)
RUSH AB 3
RUSH A 0 A_PlaySoundEx("item/rushdetect", "voice", 0, 0)
RUSH A 0 A_SpawnItemEx("RushSearchDetectFX", 20, 0, 80, 0, 0, 2, 0) 
RUSH ABABABABABABABABABABABA 3
Goto Exit
}
}

actor RushSearchDetectFX : ProjSpawnFuncActor
{
+NOINTERACTION
-SOLID
height 2
radius 2
+MISSILE
scale 2.5
states
{
Spawn:
RUS2 NNNNNNNNNNNNNNNNNNNNNN 2 A_ScaleVelocity(0.02)
stop
}
}

actor RushSearchFX : ProjSpawnFuncActor
{
PROJECTILE
-NOGRAVITY
scale 1.5
+THRUACTORS
translation "251:254=235:235", "9:246=232:232"
states
{
Spawn:
TNT1 A 0
TNT1 A 0 A_PlaySoundEx("item/rushsearchdig", "Voice")
TNT1 A 0 A_Jump(256, "Bit1", "Bit2", "Bit3", "Bit4", "Bit5", "Bit6", "Bit7")
Bit1:
BASL E 120
stop
Bit2:
BASL F 120
stop
Bit3:
BASL G 120
stop
Bit4:
BASL H 120
stop
Bit5:
BASL I 120
stop
Bit6:
BASL J 120
stop
Bit7:
BASL K 120
stop
}
}

actor StardroidArtifact1 : CustomInventory
{
inventory.pickupmessage "Picked up a strange artifact!"
inventory.pickupsound "item/1up"
scale 1.8
states
{
Spawn:
LART A 1
Goto Shine
Shine:
"####" "#" 4 A_SpawnItemEx("SparkleFX", random(-8,8), random(-8,8), random(0,32))
loop
Pickup:
"####" "#" 0 A_JumpIf(CallACS("TC_IsBot", tid-1000)==1, "Failure")
"####" "#" 0 ACS_NamedExecute("core_rushsearch_obtainartifact", 0)
stop
Failure:
"####" "#" 0
fail
Prop:
"####" "#" -1 A_ChangeFlag("NOINTERACTION", 1)
stop
Empty:
LART I -1 A_ChangeFlag("NOINTERACTION", 1)
stop
}
}

actor StardroidArtifact2 : StardroidArtifact1
{
    states 
    {
    Spawn:
        LART B 1
        Goto Shine
    }
}
actor StardroidArtifact3 : StardroidArtifact1 
{
    states 
    {
    Spawn: 
        LART C 1
        Goto Shine
    }
}
actor StardroidArtifact4 : StardroidArtifact1 
{
    states 
    {
    Spawn: 
        LART D 1
        Goto Shine
    }
}
actor StardroidArtifact5 : StardroidArtifact1 
{
    states 
    {
    Spawn: 
        LART E 1
        Goto Shine
    }
}
actor StardroidArtifact6 : StardroidArtifact1 
{
    states 
    {
    Spawn: 
        LART F 1
        Goto Shine
    }
}
actor StardroidArtifact7 : StardroidArtifact1 
{
    states 
    {
    Spawn: 
        LART G 1
        Goto Shine
}
}
actor StardroidArtifact8 : StardroidArtifact1 
{
    states 
    {
    Spawn: 
        LART H 1
        Goto Shine
    }
}


