@name Fuel Lab
@inputs 
@persist [E, O,Out]:entity 
@persist Ge Sm Fuel
@outputs
@model models/props_c17/FurnitureBoiler001a.mdl
interval(100)
# Element model: models/sprops/geometry/sphere_3.mdl
# Fuel model: models/props_junk/gascan001a.mdl
# Needs: 1xFuel 3xSourcium 5xGmodite

###########
#Main Code#
###########

if ( first() || dupefinished() )
{
    E = entity()
    O = owner()  
}

findIncludeModel("models/props_junk/gascan001a.mdl")
findIncludeModel("models/sprops/geometry/sphere_3.mdl")
findExcludeEntity(Out)
findInSphere(E:pos(),50)
findSortByDistance(E:pos())
Find = find()

if ( Find:isValid() )
{
    if ( Find:model() == "models/props_junk/gascan001a.mdl" && Fuel !=1 && !Find["gaben",number]) { Find:propDelete(),Fuel=1 } 
    elseif ( Find:model() == "models/sprops/geometry/sphere_3.mdl") 
    { 
        if ( Find["oretype",number]==2 && Ge!=5) {Ge++}
        elseif ( Find["oretype",number]==3 && Sm!=3) {Sm++}
        Find:propDelete()   
    }   
}
# Name
setName("Fuel Lab | "+Ge+"/5u Ge | "+Sm+"/3u Sm | "+Fuel+"/1L Fuel")
if ( Ge==5 && Sm==3 && Fuel==1 )
{
    Out=propSpawn("models/props_junk/gascan001a.mdl",E:toWorld(vec(0,0,100)),0)
    Out:setColor(0,255,0)
    Out["gaben",number]=1 
    Ge=0,Fuel=0,Sm=0 
    
    E:soundPlay(1,3,"buttons/bell1.wav")
}
