@name CT Printerbank
@persist [Owner Entity]:entity [Profile Printers]:table
@inputs [Workstation UpgradeBox Storage]:entity Props:array

@persist [DrillBase DrillPlatform DrillSlot DrillTop]:entity

interval(100)
runOnChat(1)
runOnLast(1)

if(first()) {
    Owner=owner()
    Entity=entity()
    
    Profile=table(
        "ngii_a_printer"=table(
            "name"="Superior Printer",
            "enbaled"=1,
            "mps"=45,
            "windup"=60,
            
            "upgrades"=array(
                "ngii_a_storagebox",
                
                "ngii_a_overclocker",
                "ngii_a_overclocker",
                "ngii_a_overclocker",
                "ngii_a_overclocker",
                
                "ngii_a_cooler",
                "ngii_a_cooler",
                "ngii_a_cooler"
            )
        ),
        
        "ngii_c_printer"=table(
            "name"="Advanced Printer",
            "enabled"=0,
            "mps"=0,
            "windup"=60*20,
            
            "upgrades"=array(
                "ngii_a_overclocker",
                "ngii_a_overclocker",
                
                "ngii_a_cooler",
                "ngii_a_cooler",
                "ngii_a_cooler"
            )
        ),
        
        "ngii_e_printer"=table(
            "name"="Basic Printer",
            "enabled"=0,
            "mps"=0,
            "windup"=60*30,
            
            "upgrades"=array(
                "ngii_a_overclocker",
                "ngii_a_cooler"
            )
        )
    )
    
    # 44.115765 51.717323 51.717316	
    local UnitZ=44.115765
    local UnitX=51.717323
    
    DrillBase=propSpawn("models/XQM/deg360.mdl",Entity:toWorld(vec()),Entity:toWorld(ang(90,0,0)),1)
    Props:pushEntity(DrillBase)
    
    DrillPlatform=propSpawn("models/XQM/panel360.mdl",Entity:toWorld(vec(0,0,UnitZ/2)),Entity:toWorld(ang(90,0,0)),1)
    Props:pushEntity(DrillPlatform)
    
    DrillSlot=propSpawn("models/XQM/deg90single.mdl",Entity:toWorld(vec(UnitZ*0.25,UnitZ*0.25,UnitX)),Entity:toWorld(ang(90,0,0)),1)
    Props:pushEntity(DrillSlot)
} 
if (last()) {
    foreach(I,V:entity=Props) {
        V:propDelete()
    }
}
