-
Notifications
You must be signed in to change notification settings - Fork 0
/
EGP_PlayerMap
95 lines (93 loc) · 2.54 KB
/
EGP_PlayerMap
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
@name EGP_PlayerMap
@inputs E:wirelink
@outputs
@persist O:entity Plys:array Zoom
@trigger
#[
Made by Xandertron5000 - STEAM_0:1:42942061 - github.com/Xandertron
Use Numpad Plus and Minus to zoom in and out
]#
Plys = players()
if(changed(Plys:count())|E:egpHasObject(100)!=1){
E:egpClear()
E:egpBoxOutline(100,vec2(152),vec2(300))
E:egpBox(101,vec2(152),vec2(298))
E:egpColor(101,vec(20,20,20))
E:egpAlpha(101,200)
}
interval(100)
if(first()){
#E:egpHudToggle()
if(entity():isWeldedTo():type()=="gmod_wire_egp_hud"){
entity():createWire(entity():isWeldedTo(),"E","wirelink")
E:egpClear()
E:egpBoxOutline(100,vec2(152),vec2(300))
E:egpBox(101,vec2(152),vec2(298))
E:egpColor(101,vec(20,20,20))
E:egpAlpha(101,200)
}
else{
concmd("gmod_toolmode wire_egp;wire_egp_type 2;+attack")
timer("back",250)
}
O = owner()
Zoom = 8
}
if(clkName()=="back"){
concmd("gmod_toolmode wire_expression2;wire_egp_type 1;-attack")
findIncludePlayerProps(owner())
findByClass("gmod_wire_egp_hud")
A = findToArray()
for(I=1,A:count()){
if(A[I,entity]:type()=="gmod_wire_egp_hud"){
entity():createWire(A[I,entity],"E","wirelink")
E:egpHudToggle()
E:egpBox(1,vec2(256),vec2(20))
break
}
}
E:egpClear()
E:egpBoxOutline(100,vec2(152),vec2(300))
E:egpBox(101,vec2(152),vec2(298))
E:egpColor(101,vec(20,20,20))
E:egpAlpha(101,200)
}
if(changed(O:keyPressed("pad_minus"))&O:keyPressed("pad_minus")){
Zoom++
}
if(changed(O:keyPressed("pad_plus"))&O:keyPressed("pad_plus")){
Zoom--
}
if(Zoom<=0){
Zoom=1
}
#[
put m overlay here, for a fullscreen map
if(owner():keyPressed("KEY_M")){
}
]#
for(I=1,Plys:count()){
Ply=Plys[I,entity]
Dif=Ply:pos()-O:pos()
Dis=Ply:pos():distance(O:pos())
if(Dis>(Zoom^2*152)){
E:egpRemove(I)
E:egpRemove(I+Plys:count()+1)
continue
}
W=toRad(toDeg(atan(Dif:x(),Dif:y()))-toDeg(atan(O:eye():x(),O:eye():y())))
Org=sqrt(Dif:x()^2+Dif:y()^2)
X=sin(W)*Org/(Zoom^2)+152
Y=-cos(W)*Org/(Zoom^2)+152
E:egpBox(I,vec2(X,Y),vec2(5))
E:egpText(I+Plys:count()+1,Plys[I,entity]:name(),vec2(X,Y))
E:egpSize(I+Plys:count()+1,10)
#E:egpAngle(I,45)
#E:egpColor(I,vec(255,0,0))
#E:egpAlpha(I,200)
}
B = O:eyeAngles():yaw()
E:egpText(102,"N",vec2(cos(4/4 * 360+B)*(-152+10)+152,sin(4/4 * 360+B)*(-152+10)+152))
E:egpAlign(102,1,1)
E:egpText(106,"x"+Zoom,vec2(285,288))
E:egpAlign(106,1,1)