################
# > Flag America: The american flag floating above your head. Due to holo limits, there are no stars.
# > How to use: Spawn it. It will be above your head.
################

@name American Flag :D
@persist I A Scale Target:entity

interval(10)

if (first()|duped()) {
    Scale = 12.98
    # Background
    holoCreate(1)
    holoScale(1,vec(3.85,0.2,2)*Scale)
    holoPos(1,entity():pos()+vec(0,0,12*Scale))
    
    # Red Stripes
    for (I=2,8) {
        holoCreate(I)
        holoScale(I,vec(3.8,0.3,(2/13))*Scale)
        holoColor(I,vec(178,33.66,51.765))
        holoPos(I,entity():pos()+vec(0,0,(-((2/13)*42)+((2/13)*I)*24)*Scale))
    }
    
    # Blue Box
    holoCreate(9)
    holoScale(9,vec(3.8*(2/5),0.4,2*(7/13))*Scale)
    holoPos(9,entity():pos()+vec((-((3.8*(2/5))*9)),0,(2*(7/13))*16.3)*Scale)
    holoColor(9,vec(59.67,59.415,109.65))
    
    for (I=2,9) {
        holoParent(I,holoEntity(1))
    }
    
    Target=owner()
}

A+=1
Z=sin(A)*(5+Scale)

holoAng(1,ang(0,A,0))
holoPos(1,Target:pos()+vec(0,0,(83+Z)+Scale*12))
