@name FailCake Weather Machine
@inputs Up Down
@outputs Random Screen R R2 I ThundMod Text:string
@persist I T STim FF
@trigger all
runOnTick(1)
if(first()){
hint("Made By FailCake",999)
holoAlpha(4,0)
ThundMod = 0
SunMod = 1
Text = ""
FF = 1
}
OP = entity()
UP = 0


##Sky##
soundPlay(88888,88888,"")
    holoCreate(1)
    holoModel(1,"cube")
    holoParent(1, OP)
    holoScale(1,vec(20,20,20))
    holoAng(1,ang(0,0,0))
    holoPos(1,OP:pos()+vec(0,0,18+UP))
    holoMaterial(1,"models/debug/debugwhite")
    
    holoCreate(3)
    holoModel(3,"cube")
    holoParent(3, OP)
    holoScale(3,vec(-20,-20,-20))
    holoAng(3,ang(0,0,0))
    holoPos(3,OP:pos()+vec(0,0,18+UP))
    holoMaterial(3,"models/debug/debugwhite")
   

    holoCreate(4)
    holoModel(4,"cube")
    holoParent(4, OP)
    holoScale(4,vec(-19,-19,-19))
    holoAng(4,ang(0,0,0))
    holoPos(4,OP:pos()+vec(0,0,18+UP))
    holoColor(4,vec(255,255,255))
    holoMaterial(4,"models/alyx/emptool_glow") 
##Floor##

    holoCreate(2)
    holoModel(2,"cube")
    holoParent(2, OP)
    holoScale(2,vec(20,20,0.1))
    holoAng(2,ang(0,0,0))
    holoPos(2,OP:pos()+vec(0,0,1+UP))
 
    holoMaterial(2,"models/props_wasteland/rockcliff02a")    
    
    holoCreate(5)
    holoModel(5,"cube")
    holoParent(5, OP)
    holoScale(5,vec(20,20,0.1))
    holoAng(5,ang(0,0,0))
    holoPos(5,OP:pos()+vec(0,0,138+UP))

    holoMaterial(5,"models/debug/debugwhite")

#models/props_lab/warp_sheet
#skybox/sky_day2_07bk

    
if(ThundMod){
    
holoColor(1,vec(1,1,1)) 
holoColor(2,vec(255,255,255))  
holoColor(3,vec(1,1,1)) 
holoColor(5,vec(1,1,1)) 
holoAlpha(1,150)
holoAlpha(3,150)
holoAlpha(5,150)

timer("random",1000)
if(clk("random")){Random = randint(1,5)}
Screen = Random    

Songs=array()
Songs:setString(1,"ambient/atmosphere/thunder1.wav")
Songs:setString(2,"ambient/atmosphere/thunder2.wav")
Songs:setString(3,"ambient/atmosphere/thunder3.wav")
Songs:setString(4,"ambient/atmosphere/thunder4.wav") 
if(Random == 5){
R=randint(1,4)
holoEntity(1):soundPlay(1000,1000,Songs:string(R))
holoEntity(2):soundPlay(5000,5000,Songs:string(R))
holoAlpha(4,200)
T = 0
Random = randint(1,5)
}else{
T += 0.1
if(T >= 2){
holoAlpha(4,0)    
}
}
if(Random == 7){
holoEntity(3):soundPlay(2322,2322,"ambient/nature/wind_leaves_mild_gust_1.wav")
holoEntity(4):soundPlay(2324,2324,"ambient/nature/wind_leaves_mild_gust_1.wav")
}
}

if(SunMod){
holoAlpha(4,0) 
holoColor(1,vec(0,0,255)) 
holoColor(2,vec(255,255,255))  
holoColor(3,vec(0,0,255)) 
holoColor(5,vec(0,0,255)) 
holoAlpha(1,50)
holoAlpha(3,50)
holoAlpha(5,50)

STim+=0.1
if(STim == 1){
R2=randint(1,20)
entity():soundPlay(1000,1000,"ambient/wind/wasteland_wind.wav")
entity():soundPlay(5000,5000,"ambient/wind/wasteland_wind.wav")
}
if(STim >= 20){
STim = 0    
}
}

if(Down){
if(FF < 3){
timer("clk",150)
if(clk("clk")){
FF++
}  
}
}

if(Up){
if(FF > 0){
timer("clk",150)
if(clk("clk")){
FF--  
}  
}
}

if(FF == 1){
Text = "Sun Day"
ThundMod = 0
SunMod = 1  
}elseif(FF == 2){
Text = "Thunder Day"
ThundMod = 1
SunMod = 0
}

if(duped()){selfDestructAll()}


####################################################################
## Do not rename the E2 or remove the hint("Made by Failcake",100)##
####################################################################