@name egpToLocal
@inputs Scr:wirelink
@persist Aim:entity


if(first()) {
    function number heading(Wirelink:wirelink,Center:vector) {
        local Ent=Wirelink:entity()
        local Pos=Ent:toLocal(Center)
        return (vec2(Pos:x(),Pos:y())):toAngle()
    }
    
    Scr:egpClear()
    
    Scr:egpBox(1,vec2(256),vec2(30,30))
    
    Scr:egpTriangle(2,vec2(-15,-25),vec2(-15,-15),vec2(15,-15))
    Scr:egpParent(2,1)
    
    Scr:egpTriangle(3,vec2(15,-25),vec2(15,-15),vec2(-15,-15))
    Scr:egpParent(3,1)
    
    Scr:egpTriangle(4,vec2(0,35),vec2(-22,15),vec2(22,15))
    Scr:egpParent(4,1)
    
    Scr:egpText(5,"Salt Detector",vec2(256,320))
    Scr:egpAlign(5,1,1)
    Scr:egpSize(5,30)
    
    Aim=findPlayerByName("Regular")
}

Scr:egpAngle(1,heading(Scr,Aim:attachmentPos("eyes")))
interval(100)
