@name FailCake FishTank FishEggs
@outputs ANG
@persist [E]:entity GTABLE:gtable Eggs G
@trigger all
@model models/props_junk/garbage_takeoutcarton001a.mdl

if(first() | duped()){
runOnTick(1)
Eggs = 1
G = 0
E = entity()  
GTABLE = gTable("fishtank",0)

}


if(Eggs > 0){

ANG = E:angles():roll()

if(ANG >= 170 | ANG < -170){
timer("drop",200)
if(clk("drop")){
Eggs -= 1
G += 1
holoCreate(G)
holoModel(G,"hqicosphere")
holoScaleUnits(G,vec(1,1,1))
holoColor(G,vec(90,90,90))
holoMaterial(G,"models/flesh")
holoPos(G,E:toWorld(vec(randint(-2,2),randint(-2,2),5)))
}
}

}

if(G > 0){
for(P=1,G){

rangerFilter(E)
rangerFilter(holoEntity(P))
Ran = rangerOffset(2,holoEntity(P):pos(),holoEntity(P):up())

holoPos(P,holoEntity(P):toWorld(vec(0,0,2)))   


if(Ran:hit()){
holoDelete(P)
if(Ran:entity() == GTABLE["fishtank",entity]){
GTABLE["fish",number] = GTABLE["fish",number] + 1    
}
} 
    
}      
}

setName("FailCake FishTank FishEggs
Eggs : " + Eggs)
