-
Notifications
You must be signed in to change notification settings - Fork 0
/
ground_bridge_controller.txt
245 lines (202 loc) · 10.4 KB
/
ground_bridge_controller.txt
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
@name Ground Bridge Controller
@inputs BridgeController:wirelink
@outputs Size Active Distance [Color,Br1,Br2]:vector
@persist Prefix:string Distance AutoReset TSCMBridge
#include "Novas-Public-E2s/library/color_lib"
if(first() | dupefinished()){
Prefix = "/gb"
holoCreate(1)
holoAlpha(1,0)
holoCreate(2)
holoAlpha(2,0)
Distance = 100
AutoReset = 0 #Reset automatically when activating
if(map() == "sb_galaxies_2018_v2"){
TSCMBridge = 1
}
else{
TSCMBridge = 0
}
if(BridgeController:entity():isValid()){
BridgeController["Bridge1 Pos",vector] = holoEntity(1):pos()
BridgeController["Bridge2 Pos",vector] = holoEntity(2):pos()
}
else{
printColor(ColPink,"[GBC] ",ColOng,"You need to link a Ground Bridge Controller!")
}
}
if(~BridgeController & BridgeController:entity():isValid()){
BridgeController["Bridge1 Pos",entity] = holoEntity(1)
BridgeController["Bridge2 Pos",entity] = holoEntity(2)
printColor(ColPink,"[GBC] ",ColOng,"Ground Bridge Controller Linked.")
}
event chat(SaidPly:entity, Said:string,_:number){
local OLS = Said:lower():explode(" ")
if(SaidPly == owner()){
if(OLS[1,string] == Prefix){
hideChat(1)
if(OLS[2,string] == "reset"){
BridgeController["Reset",number] = 1
printColor(ColPink,"[GBC] ",ColOng,"Ground Bridge Reset")
timer("unreset",10)
}
elseif(OLS[2,string] == "help"){
printColor(ColPink,"[GBC] ",ColOng,"Ground Bridge Commands:")
printColor(ColPink,"[GBC] ",ColOng,"Reset: '/gb reset'")
printColor(ColPink,"[GBC] ",ColOng,"Setcolor: '/gb color <normal / blue / default / purple / pink / custom 255,95,255>'")
printColor(ColPink,"[GBC] ",ColOng,"Set Size: '/gb <scale / size> 0.1 - 2'")
printColor(ColPink,"[GBC] ",ColOng,"Open Bridge: '/gb <activate / on / open>'")
printColor(ColPink,"[GBC] ",ColOng,"Close Bridge: '/gb <deactivate / off / close>'")
printColor(ColPink,"[GBC] ",ColOng,"Distance: '/gb dist <number>'")
printColor(ColPink,"[GBC] ",ColOng,"Set Aimpos: '/gb here <1 or 2>'")
printColor(ColPink,"[GBC] ",ColOng,"Set Playerpos: '/gb ply <playername> <1 or 2>'")
}
elseif(OLS[2,string] == "color"){
if(OLS[3,string] == "normal" | OLS[3,string] == "default" | OLS[3,string] == "blue"){
BridgeController["Color",vector] = vec(255,255,255)
Color = vec(255,255,255)
printColor(ColPink,"[GBC] ",ColOng,"Ground Bridge Color Normal")
}
elseif(OLS[3,string] == "purple"){
BridgeController["Color",vector] = vec(150,0,150)
Color = vec(150,0,150)
printColor(ColPink,"[GBC] ",ColOng,"Ground Bridge Color ",vec(150,0,150),"Purple")
}
elseif(OLS[3,string] == "pink"){
BridgeController["Color",vector] = vec(255,95,255)
Color = vec(255,95,255)
printColor(ColPink,"[GBC] ",ColOng,"Ground Bridge Color ",vec(255,95,255),"Pink")
}
elseif(OLS[3,string] == "custom"){
local V = OLS[4,string]:explode(",")
local X = V[1,string]:toNumber()
local Y = V[2,string]:toNumber()
local Z = V[3,string]:toNumber()
local Col = vec(X,Y,Z)
BridgeController["Color",vector] = Col
printColor(ColPink,"[GBC] ",ColOng,"Ground Bridge Color set to: ",Col,Col:toString())
}
}
elseif(OLS[2,string] == "scale" | OLS[2,string] == "size"){
BridgeController["Size",number] = clamp(OLS[3,string]:toNumber(),0.1,2)
Size = clamp(OLS[3,string]:toNumber(),0.1,2)
printColor(ColPink,"[GBC] ",ColOng,"Ground Bridge Size ",clamp(OLS[3,string]:toNumber(),0.1,2):toString())
}
elseif(OLS[2,string] == "activate" | OLS[2,string] == "on" | OLS[2,string] == "open"){
if(AutoReset == 1){
BridgeController["Reset",number] = 1
timer("resetactive",100)
}
else{
BridgeController["Activate",number] = 1
Active = 1
printColor(ColPink,"[GBC] ",ColOng,"Ground Bridge Active")
}
}
elseif(OLS[2,string] == "deactivate" | OLS[2,string] == "off" | OLS[2,string] == "close"){
BridgeController["Activate",number] = 0
Active = 0
printColor(ColPink,"[GBC] ",ColOng,"Ground Bridge Inactive")
}
elseif(OLS[2,string] == "dist"){
Distance = OLS[3,string]:toNumber()
printColor(ColPink,"[GBC] ",ColOng,"Ground Bridge Distance set to ",Distance:toString())
}
elseif(OLS[2,string] == "here"){
if(OLS[3,string]:toNumber() != 1 & OLS[3,string]:toNumber() != 2){
printColor(ColPink,"[GBC] ",ColOng,"You must select a Ground Bridge to set the position of")
}
else{
local HoloNum = OLS[3,string]:toNumber()
local RangerData = owner():eyeTrace()
local HoloPos = RangerData:pos() + RangerData:hitNormal() * Distance
if(TSCMBridge == 1){
HoloAng1 = (HoloPos - owner():pos()):toAngle():setYaw(0) + ang(-90,0,0)
}
else{
HoloAng1 = (HoloPos - owner():pos()):toAngle():setPitch(0) + ang(-90,0,0)
}
holoPos(HoloNum,HoloPos)
holoAng(HoloNum,HoloAng1)
local BridgePos = "Bridge"+HoloNum:toString()+" Pos"
local BridgeAng = "Bridge"+HoloNum:toString()+" Angle"
BridgeController[BridgePos,vector] = HoloPos
BridgeController[BridgeAng,angle] = HoloAng1
if(HoloNum == 1){
Br1 = HoloPos
}
else{
Br2 = HoloPos
}
printColor(ColPink,"[GBC] ",ColOng,"Set the position of Ground Bridge Portal ",HoloNum," to your aimpos.")
}
}
elseif(OLS[2,string] == "ply"){
local Ply = findPlayerByName(OLS[4,string])
if(Ply:isPlayer()){
if(OLS[3,string]:toNumber() != 1 & OLS[3,string]:toNumber() != 2){
printColor(ColPink,"[GBC] ",ColOng,"You must select a Ground Bridge to set the position of")
}
else{
local HoloNum = OLS[3,string]:toNumber()
local HoloPos = Ply:pos() + vec(300,0,Distance)
print(HoloPos)
if(TSCMBridge == 1){
HoloAng2 = (HoloPos - Ply:pos()):toAngle():setYaw(0) + ang(0,0,0)
}
else{
HoloAng2 = (HoloPos - Ply:pos()):toAngle():setPitch(0) + ang(-90,0,0)
}
local BridgePos = "Bridge"+HoloNum:toString()+" Pos"
local BridgeAng = "Bridge"+HoloNum:toString()+" Angle"
BridgeController[BridgePos,vector] = HoloPos
BridgeController[BridgeAng,angle] = HoloAng2
holoPos(HoloNum,HoloPos)
holoAng(HoloNum,HoloAng2)
if(HoloNum == 1){
Br1 = HoloPos
}
else{
Br2 = HoloPos
}
printColor(ColPink,"[GBC] ",ColOng,"Set the position of Ground Bridge Portal ",HoloNum," to ",teamColor(Ply:team()),Ply:name())
}
}
}
elseif(OLS[2,string] == "home"){
if(map() == "gm_cruisercanyon" | map() == "gm_cruisercanyon_rwu"){
if(OLS[3,string]:toNumber() != 1 & OLS[3,string]:toNumber() != 2){
printColor(ColPink,"[GBC] ",ColOng,"You must select a Ground Bridge to set the position of")
}
else{
local HoloNum = OLS[3,string]:toNumber()
BridgeController["Size",number] = 0.5
local BridgePos = "Bridge"+HoloNum:toString()+" Pos"
local BridgeAng = "Bridge"+HoloNum:toString()+" Angle"
BridgeController[BridgePos,vector] = vec(-11403,2456,-8273)
BridgeController[BridgeAng,angle] = ang(270,0,0)
if(HoloNum == 1){
Br1 = vec(-11403,2456,-8273)
}
else{
Br2 = vec(-11403,2456,-8273)
}
printColor(ColPink,"[GBC] ",ColOng,"Set the position of Ground Bridge Portal ",HoloNum," to Home")
}
}
else{
printColor(ColPink,"[GBC] ",ColOng,"This map has no home!")
}
}
}
}
}
if(clk("resetactive")){
BridgeController["Reset",number] = 0
BridgeController["Activate",number] = 1
Active = 1
printColor(ColPink,"[GBC] ",ColOng,"Ground Bridge Active")
}
if(clk("unreset")){
BridgeController["Reset",number] = 0
}