@name Drum Kit - By Moglizorz
@inputs Chair:wirelink
@outputs 
@persist PY:entity Check IsUp [Playing Current Normal Cardboard Metal]:array
runOnTick(1)
runOnChat(1)
interval(50)
if(first()){
    if(Chair["Entity",entity]==noentity()){Check=1}
    #Sounds= Snare, Bass, Hihat, Symbol, Left, Right
    Normal=array("snare","physics/metal/metal_canister_impact_soft1.wav","HIHAT","SYMBOL","LEFT","RIGHT")
    Cardboard=array("physics/cardboard/cardboard_box_impact_bullet1.wav","physics/cardboard/cardboard_box_impact_hard1.wav","physics/cardboard/cardboard_box_strain1.wav","physics/cardboard/cardboard_box_impact_bullet2.wav","physics/cardboard/cardboard_box_impact_hard4.wav","physics/cardboard/cardboard_box_impact_hard5.wav")
    Metal=array("physics/metal/metal_barrel_impact_hard1.wav","physics/metal/metal_canister_impact_soft1.wav","physics/metal/metal_chainlink_impact_soft1.wav","physics/metal/metal_chainlink_impact_hard3.wav","physics/metal/metal_box_impact_hard1.wav","physics/metal/metal_box_impact_bullet2.wav")
    Current=Cardboard
    for(I=1,6){
        Count=(1*I*10-9)
        ## Creating models for 4 drums (1-4,11-14,21-24,31,34)
        holoCreate(Count)
        holoModel(Count,"hqcylinder2")
        holoMaterial(Count,"models/props_debris/plasterwall034a")
        holoCreate(Count+1)
        holoModel(Count+1,"hqtorus2")
        holoMaterial(Count+1,"models/props_wasteland/wood_fence01a")
        holoCreate(Count+2)
        holoModel(Count+2,"hqtorus2")
        holoMaterial(Count+2,"phoenix_storms/fender_chrome")
        holoPos(Count,vec())
        holoPos(Count+1,vec())
        holoPos(Count+2,vec())
    }
    ##Drum 1, right hand drum
    holoScale(1,vec(1.5,1.5,1.5))
    holoScale(2,vec(1.5,1.5,6.8))
    holoParent(2,1)
    holoScale(3,vec(1.6,1.6,2))
    holoParent(3,1)
    holoPos(1,Chair["Entity",entity]:toWorld(vec(23,26,20)))
    holoAng(1,Chair["Entity",entity]:toWorld(ang(30,-135,0)))
    ##Drum 2, snare
    holoScale(11,vec(1.2,1.2,0.7))
    holoScale(12,vec(1.2,1.2,3))
    holoParent(12,11)
    holoScale(13,vec(1.3,1.3,0.9))
    holoParent(13,11)
    holoPos(11,Chair["Entity",entity]:toWorld(vec(0,32,20)))
    holoAng(11,Chair["Entity",entity]:toWorld(ang(15,-90,0)))    
    ##Drum 3, bass
    holoScale(21,vec(1.9,1.9,0.9))
    holoScale(22,vec(1.9,1.9,3.9))
    holoParent(22,21)
    holoScale(23,vec(2,2,0.9))
    holoParent(23,21)
    holoPos(21,Chair["Entity",entity]:toWorld(vec(10,46,15)))
    holoAng(21,Chair["Entity",entity]:toWorld(ang(0,-10,90)))  
    ##Drum 4, top left of snare
    holoScale(31,vec(1.3,1.3,0.9))
    holoScale(32,vec(1.3,1.3,4))
    holoParent(32,31)
    holoScale(33,vec(1.4,1.4,0.9))
    holoParent(33,31)
    holoPos(31,Chair["Entity",entity]:toWorld(vec(-10,44,31)))
    holoAng(31,Chair["Entity",entity]:toWorld(ang(25,-70,0)))     
    ##Symbol
    holoModel(41,"hqcone")
    holoMaterial(41,"models/XQM/Deg360_diffuse")
    holoModel(42,"dome2")
    holoMaterial(42,"models/XQM/Deg360_diffuse")
    holoModel(43,"hqcylinder2")
    holoCreate(44)
    holoMaterial(44,"phoenix_storms/fender_chrome")
    holoModel(44,"hqcylinder2")
    holoScale(43,vec(0.15,0.15,2.3))
    holoAng(43,Chair["Entity",entity]:toWorld(ang(0,0,0)))
    holoPos(43,Chair["Entity",entity]:toWorld(vec(28,44,13.5)))
    holoScale(44,vec(0.15,0.15,3))
    holoAng(44,Chair["Entity",entity]:toWorld(ang(45,230,0)))
    holoPos(44,Chair["Entity",entity]:toWorld(vec(28,44,27.2)))
    holoScale(41,vec(1.7,1.7,0.15))
    holoScale(42,vec(0.5,0.5,0.3))
    holoParent(42,41)
    holoAng(41,Chair["Entity",entity]:toWorld(ang(20,220,0)))
    holoPos(41,Chair["Entity",entity]:toWorld(vec(20,35,40)))
    ##Hi-hat
    holoModel(51,"hqcylinder2")
    holoMaterial(51,"phoenix_storms/fender_chrome")
    holoScale(51,vec(0.15,0.15,4))
    holoAng(51,Chair["Entity",entity]:toWorld(ang(0,0,0)))
    holoPos(51,Chair["Entity",entity]:toWorld(vec(-20,27,24.5)))
    holoModel(52,"hqcone")
    holoModel(53,"dome2")
    holoCreate(54)
    holoCreate(55)
    holoModel(54,"hqcone")
    holoModel(55,"dome2")
    for(I=52,55){holoMaterial(I,"models/XQM/Deg360_diffuse")}
    for(I=52,53){
        holoAng(I,Chair["Entity",entity]:toWorld(ang(0,0,0)))
        holoPos(I,Chair["Entity",entity]:toWorld(vec(-20,27,43)))
    }
    holoScale(52,vec(1.7,1.7,0.15))
    holoScale(53,vec(0.5,0.5,0.3))
    for(I=54,55){
        holoAng(I,Chair["Entity",entity]:toWorld(ang(180,0,0)))
        holoPos(I,Chair["Entity",entity]:toWorld(vec(-20,27,37)))
    }
    holoScale(54,vec(1.7,1.7,0.15))
    holoScale(55,vec(0.5,0.5,0.3))    
    for(I=1,70){holoParent(I,Chair["Entity",entity])}
    
}
if(clk()){
    if(Chair["D",number]){
        if(!Playing[6,number]){
            holoEntity(1):soundPlay(6,0,Current[6,string])
            Playing[6,number]=1
        }
        holoColor(1,vec(0,200,0))
    }else{
        holoColor(1,vec(255,255,255))
        Playing[6,number]=0
    }
    if(Chair["S",number]){
        holoColor(11,vec(0,200,0))
        if(!Playing[1,number]){
            holoEntity(11):soundPlay(1,0,Current[1,string])
            Playing[1,number]=1
        }
    }else{
        holoColor(11,vec(255,255,255))
        Playing[1,number]=0
    }    
    if(Chair["Space",number]){
        holoColor(21,vec(0,200,0))
        if(!Playing[2,number]){
            holoEntity(21):soundPlay(2,0,Current[2,string])
            Playing[2,number]=1
        }
    }else{
        holoColor(21,vec(255,255,255))
        Playing[2,number]=0
    }        
    if(Chair["W",number]){
        holoColor(31,vec(0,200,0))
        if(!Playing[5,number]){
            holoEntity(31):soundPlay(5,0,Current[5,string])
            Playing[5,number]=1
        }
    }else{
        holoColor(31,vec(255,255,255))
        Playing[5,number]=0
    } 
    if(Chair["R",number]){
        holoColor(41,vec(0,255,0))
        holoColor(42,vec(0,255,0))
        if(!Playing[4,number]){
            holoEntity(41):soundPlay(4,0,Current[4,string])
            Playing[4,number]=1
        }
        
    }else{
        holoColor(41,vec(255,200,0))
        holoColor(42,vec(255,200,0))
        Playing[4,number]=0
    }
    if(Chair["A",number]){
        holoColor(52,vec(0,255,0))
        holoColor(53,vec(0,255,0))
        holoColor(54,vec(0,255,0))
        holoColor(55,vec(0,255,0))
        if(!Playing[3,number]){
            holoEntity(54):soundPlay(3,0,Current[3,string])
            Playing[3,number]=1
        }
        for(I=52,53) {
            holoAng(I,Chair["Entity",entity]:toWorld(ang(0,0,0)))
            holoPos(I,Chair["Entity",entity]:toWorld(vec(-20,27,39)))
            IsUp=0
        }
        
    }else{
        holoColor(52,vec(255,200,0))
        holoColor(53,vec(255,200,0))
        holoColor(54,vec(255,200,0))
        holoColor(55,vec(255,200,0))
        if(!IsUp){
            for(I=52,53) {
                IsUp=1
                holoAng(I,Chair["Entity",entity]:toWorld(ang(0,0,0)))
                holoPos(I,Chair["Entity",entity]:toWorld(vec(-20,27,43)))
            }
        }
        Playing[3,number]=0
    }     
    if((Chair["Entity",entity]:driver()!=PY)&(Chair["Entity",entity]:driver()!=noentity())){
        PY=Chair["Entity",entity]:driver()
        Chair["Entity",entity]:hintDriver("=== Holographic Drumkit ===",7)
        Chair["Entity",entity]:hintDriver("===        By Moglizorz      ===",7)
        Chair["Entity",entity]:hintDriver("----",7)
        Chair["Entity",entity]:hintDriver("Keys: W, A, S, D, R, [Space]",7)
        Chair["Entity",entity]:hintDriver("----",7)
        Chair["Entity",entity]:hintDriver("Type !drums to change from the current sound set.",7)
    }
    if(Check){
        if(Chair["Entity",entity]!=noentity()){
            reset()
        }
    }
}

