@name Battery - By croco
@inputs NUMBER2
@outputs DRAIN HH T NUMBER  BATTER RESET F   BATTERYOUTPUT NUMBER3 
@persist G:entity NUMBER E:entity
@model models/props_trainstation/trashcan_indoor001b.mdl
runOnTick(100)
runOnChat(1)
if(first()){
    E = entity()
    E:setAng(ang(90,0,0))
    E:setPos(entity():pos() + vec(0,0,30))
    NUMBER = 0
    DISTANCE = 100
    BATTER = 0
    HH = 0
    T = 0.7
    RESET = 0
    DRAIN = 1
    holoScale(1,vec(T,T,T))

}
#holoTextCreate(10)
 #   holoText(10,"Battery Amount  : " + NUMBER3)

F = findByModel("models/Combine_Helicopter/helicopter_bomb01.mdl")
G = findClosest(entity():pos())

N4 = $NUMBER2
    
NUMBER3 = NUMBER  + N4

if(NUMBER3 <= 0){BATTERYOUTPUT = 0
    NUMBER3 = 0}

if(G){
    if(G:pos():distance(entity():pos()) < 40){
    holoCreate(1)
    holoModel(1,"models/Combine_Helicopter/helicopter_bomb01.mdl")
    holoPos(1,entity():pos() + vec(15,0,0))
 NUMBER = NUMBER + 0.5
    G:propDelete()
    }
}
if(DRAIN==1){
    if(T <= 0.7){
            if(T != 0){
                if(RESET == 0){
                    if(G){
        
    HH = HH+1
    holoAng(1,ang(HH,0,0))

    timer("del",9000)
    T = T - 0.001

holoScale(1,vec(T,T,T))} }}}}
   
 if(clk("del")){
        DRAIN = 1
       RESET = 1
    stopAllTimers()
        holoDelete(1)
      timer("resetsize",1000) 
    }
if(clk("resetsize")){T = 0.7

    RESET = 0}

if(chatClk()){
    S=owner():lastSaid():lower():explode(" ")
if(S[1,string]==">>"){BATTERYOUTPUT = 1}
if(S[1,string]==">"){BATTERYOUTPUT = 0}

}

if(BATTERYOUTPUT ==1){
    NUMBER = NUMBER - 0.5
NUMBER5 = NUMBER}
