-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathwtconfgun-0.7.0.beta9-SA.conf
297 lines (285 loc) · 29.6 KB
/
wtconfgun-0.7.0.beta9-SA.conf
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
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
name: WT Gunner v0.7.0.beta9-SA
pvp: true
slots:
core:
class: CoreUnit
shield:
class: ShieldGeneratorUnit
weapon:
class: WeaponUnit
select: manual
radar:
class: RadarPVPUnit
select: manual
db:
class: DatabankUnit
select: manual
ammoCont:
class: AmmoContainerUnit
select: manual
handlers:
unit:
onStart:
lua: |
weaponsPerPanel = 6 --export
showGunnerAR = true --export
function weaponClass(a,b,c)local d={}local e={}local f={}local g=0;c=c or 3;local function h()if not(type(b)=='table'and#b>0)then return end;local i;for j,k in ipairs(b)do if(j-1)%c==0 then i=a.createWidgetPanel('')end;local l=a.createData(k.getWidgetData())e[l]=k;a.addDataToWidget(l,a.createWidget(i,k.getWidgetType()))end end;local function m(e)return{["weaponStatus"]=e:match('"weaponStatus":(%d+)'),["animationTime"]=tonumber(e:match('"cycleAnimationRemainingTime":(.-),'))or 0,["fireReady"]=e:match('"fireReady":(.-),'),["outOfZone"]=e:match('"outOfZone":(.-),'),["targetConstructID"]=e:match('"constructId":"(.-)"'),["hitProb"]=math.floor((tonumber(e:match('"hitProbability":(%d%.%d+),'))or 0)*100)}end;local function n(o,f)if o["weaponStatus"]~=f["weaponStatus"]or o["fireReady"]~=f["fireReady"]or o["outOfZone"]~=f["outOfZone"]or o["targetConstructID"]~=f["targetConstructID"]or o["hitProb"]~=f["hitProb"]or o["animationTime"]>(f["animationTime"]or 0)then return true end;return false end;function d.onUpdate()for l,k in pairs(e)do local e=k.getWidgetData()local o=m(e)local p=n(o,f[l]or{})f[l]=o;local q=a.getUtcTime()if not p and q-g<1 then goto r end;g=q;local s=e:match('"ammoName":"(.-)"')local t=""if s:match("Antimatter")then t="AM"elseif s:match("Electromagnetic")then t="EM"elseif s:match("Kinetic")then t="KI"elseif s:match("Thermic")then t="TH"end;local u=""if s:match("Precision")then u="Prec"elseif s:match("Heavy")then u="Heavy"end;e=e:gsub('"ammoName":"(.-)"','"ammoName":"'..o["hitProb"]..'%% - '..t..' '..u..'"')e=e:gsub('"constructId":"(%d+(%d%d%d))","name":"(.?.?.?.?.?.?.?.?.?.?.?.?.?.?).-"','"constructId":"%1","name":"%2 - %3"')if not a.updateData(l,e)then a.print('wtWeapons update error')end::r::end end;h()return d end
function radarClass(a,b,c,d,e,f,g)local h=require("dkjson")local i={}local j=50;local l=0.1;local m={['l']=true,['m']=true,['s']=true,['xs']=true}local n=false;local o=f or{}local p={}local q={}local r=0;local s={}local t={}local u={}local v={}local w={}local x;local y;local z=0;local A;i.counter={["total"]=0,["displayed"]=0,["allies"]=0,["enemies"]=0,["dead"]=0,["locked by"]=0,["attacked by"]=0,closest={},idents={},threats={}}i.lastEnemyContact=0;if g~=nil and g.hasKey('friendlist')then local B=0;for k,C in pairs(h.decode(g.getStringValue('friendlist')))do p[tonumber(k)]=C;B=B+1 end;a.print('Loaded '..B..' ids to friendlist from databank')end;if g~=nil and g.hasKey('deadCores')then local B=0;for k,C in pairs(h.decode(g.getStringValue('deadCores')))do q[tonumber(k)]=C;B=B+1 end;a.print('Loaded '..B..' ids to deadCores from databank')end;local D=false;local E=false;local F={}local G=m;local H=false;local I;local J={}local K=a.getScreenHeight()local L=a.getScreenWidth()local function M(N,O,P,Q,R)local S=400;local T=c.getPointOnScreen({O.x,O.y,O.z})if T[3]<=0 then return''end;local U=T[1]*L-S/2;local V=T[2]*K-S/2;svg=[[<svg viewBox="0 0 500 500" class="point" style="left:]]..U..[[px;top:]]..V..[[px;position:absolute;width:]]..S..[[px;height:]]..S..[[px">]]if N=='circle'then svg=svg..[[<circle cx="250" cy="250" r="10" opacity="0.3" stroke="]]..P..[[" stroke-width="2" fill="none"/>]]elseif N=='cross'then svg=svg..[[<line x1="250" y1="242" x2="250" y2="258" opacity="0.5" stroke="]]..P..[[" stroke-width="2"/><line x1="242" y1="250" x2="258" y2="250" opacity="0.5" stroke="]]..P..[[" stroke-width="2"/>]]elseif N=='box'then svg=svg..[[<rect x="240" y="240" width="20" height="20" style="fill: rgba(0,0,0,0); stroke: ]]..P..[[; stroke-width: 2"/>]]end;svg=svg..[[<text x="50%" y ="47%" style="text-anchor: middle; fill: ]]..P..[[; font-family: Arial, sans-serif; font-size: 14px;">]]..(Q or'')..[[</text><text x="50%" y ="55%" style="text-anchor: middle; fill: ]]..P..[[; font-family: Arial, sans-serif; font-size: 14px;">]]..(R or'')..[[</text></svg>]]return svg end;local function W(O,P,Q,R)return M('box',O,P,Q,R)end;local function X()I=a.createData(e.getWidgetData())a.addDataToWidget(I,a.createWidget(a.createWidgetPanel(''),e.getWidgetType()))end;local function Y()if g~=nil then g.setStringValue('deadCores',h.encode(q))a.print('saved deadCores to databank')end end;local function Z()local _={}local a0={}local a1={}local a2={}local a3={}local a4=e.getWidgetData()local a5=next(F)~=nil;local a6={["total"]=0,["displayed"]=0,["allies"]=0,["enemies"]=0,["dead"]=0,["locked by"]=0,["attacked by"]=0,idents={},threats={},closest={}}local a7=e.getConstructs(0,0)for a8,a9 in pairs(a7)do a6["total"]=a6["total"]+1;if a6["total"]%j==0 then coroutine.yield()end;local aa=a.getUtcTime()local ab=a9.constructId;local ac=a9.size;local ad=e.hasMatchingTransponder(ab)if ad then table.insert(_,ab)end;local ae=o[ab]==true or p[ab]==true or ad;local af=e.isConstructAbandoned(ab)if af then a6["dead"]=a6["dead"]+1;if q[ab]==nil and aa-10>r then r=aa;local ag=e.getConstructWorldPos(ab)q[ab]=ag;Y()local ah='Dead core: '..a9.name..' ('..ab..') at '..'::pos{0,0,'..ag[1]..','..ag[2]..','..ag[3]..'}'a.print(ah)end elseif ae then if#a6.closest<8 then table.insert(a6.closest,ab)end;a6["allies"]=a6["allies"]+1 else if#a6.closest<8 then table.insert(a6.closest,ab)end;a6["enemies"]=a6["enemies"]+1 end;local ai=e.getThreatRateFrom(ab)if ai=='identified'then table.insert(a6.threats,ab)a6["locked by"]=a6["locked by"]+1 elseif ai=='attacked'then table.insert(a6.threats,ab)a6["attacked by"]=a6["attacked by"]+1 end;if e.isConstructIdentified(ab)then table.insert(a6.idents,ab)end;if e.getThreatRateFrom(ab)<3 and F[ab%1000]~=true and ab~=e.getTargetId()then if not D and not G[ac:lower()]then goto aj end;if ae~=n then goto aj end;if not D and a5 and F[ab%1000]~=true then goto aj end;if D and not e.isConstructIdentified(ab)then goto aj end end;a9.name=string.format("%03d",ab%1000)..' - '..a9.name;str=h.encode(a9)if not H then table.insert(a0,str)elseif ac=="L"then table.insert(a0,str)elseif ac=="M"then table.insert(a1,str)elseif ac=="S"then table.insert(a2,str)elseif ac=="XS"then table.insert(a3,str)end;a6["displayed"]=a6["displayed"]+1::aj::end;if i.counter["enemies"]==0 and a6["enemies"]>0 then a.playSound("wthud/radarContact.mp3")elseif a6["enemies"]==0 and i.counter["enemies"]>0 then a.playSound("wthud/radarClear.mp3")end;if i.counter["enemies"]<a6["enemies"]then i.lastEnemyContact=a.getUtcTime()end;i.counter=a6;local ak={}for al,am in pairs(G)do if am then table.insert(ak,al:upper())end end;table.sort(ak)local an=(a6["displayed"]..'/'..a6["total"]..' ')..(a5 and'FOCUS 'or'')..(n and'Friends'or'Enemies')..(D and' - LOCKED'or'')..' ('..table.concat(ak,",")..')'local ao=a4:match('"elementId":".+')local ap=e.getTargetId()if g~=nil then if e.isConstructIdentified(ap)then g.setIntValue('targetSpeed',math.floor(e.getConstructSpeed(ap)))else g.setIntValue('targetSpeed',-1)end end;ao=ao:gsub('"errorMessage":""','"errorMessage":"'..an..'"')local aq=''local ar=false;if#a0>0 then aq=aq..table.concat(a0,",")ar=true end;if#a1>0 then if ar then aq=aq..','end;aq=aq..table.concat(a1,",")ar=true end;if#a2>0 then if ar then aq=aq..','end;aq=aq..table.concat(a2,",")ar=true end;if#a3>0 then if ar then aq=aq..','end;aq=aq..table.concat(a3,",")end;a4='{"constructsList":['..aq.."],"..ao;a.updateData(I,a4)J=_ end;local function as()while true do Z()coroutine.yield()end end;local at=coroutine.create(as)local function au(av)local aw=av;while true do aw,k=string.gsub(aw,"^(-?%d+)(%d%d%d)",'%1,%2')if k==0 then break end end;return aw end;local function ax(ay)if ay==nil then return''end;ay=ay*3.6;return au(math.floor(ay))..' km/h'end;local function az(aA)if e.isConstructIdentified(aA)then return ax(vec3(e.getConstructWorldVelocity(aA)):len())end;return ax(s[aA])end;local function aB(aA)local aC=e.getConstructOwnerEntity(aA)if aC.isOrganization then return' '..a.getOrganization(aC.id).tag else return' '..a.getPlayerName(aC.id)end end;function i.onFlush()local aa=a.getUtcTime()for aD,aE in ipairs(J)do local O=vec3(e.getConstructWorldPos(aE))if u[aE]==nil then u[aE]={O,aa}end;if O~=u[aE][1]then v[aE]=u[aE]u[aE]={O,aa}if w[aE]==nil then w[aE]=u[aE]end;if t[aE]==nil or aa-t[aE]>1 then t[aE]=aa;s[aE]=(u[aE][1]-w[aE][1]):len()/(u[aE][2]-w[aE][2])w[aE]=u[aE]end end end;local ap=e.getTargetId()if ap==x then local aF=e.getConstructDistance(ap)if y==nil then y={aF,aa}elseif aF~=y[1]and aa-y[2]>1 then A=(y[1]-aF)/(aa-y[2])y={aF,aa}end else y=nil;A=nil end;x=ap end;function i.getHUD()local aG=''if not showGunnerAR then return aG end;local aa=a.getUtcTime()for aD,aE in ipairs(J)do local O=vec3(e.getConstructWorldPos(aE))if v[aE]~=nil then O=u[aE][1]+(u[aE][1]-v[aE][1]):normalize()*(aa-u[aE][2])*(u[aE][1]-v[aE][1]):len()/(u[aE][2]-v[aE][2])end;if O then local P="#0cf27b"if e.getThreatRateFrom(aE)>2 then P="#FF5B72"end;aG=aG..W(O,P,aE%1000 ..aB(aE),az(aE))end end;local aH=vec3(d.getWorldPosition())for aE,ag in pairs(q)do local ag=vec3(ag)local aI=(vec3(ag)-aH):len()if aI>400000 then aG=aG..W(ag,"#ccc",aE%1000,string.format('%0.2f',aI/200000)..' su')end end;return aG end;function i.getTargClosingSpeed()return A end;function i.onTick()coroutine.resume(at)end;function i.clearIDFilter()F={}end;function i.addIDFilter(aJ)F[aJ]=true end;local function aK()if g~=nil then g.setStringValue('friendlist',h.encode(p))a.print('saved friendlist to databank')end end;function i.onTextInput(aL)aL=string.lower(aL)if aL:match('^f%A*$')~=nil then i.clearIDFilter()for aJ in aL:gmatch('%D(%d%d%d)')do i.addIDFilter(tonumber(aJ))end elseif aL:match('^%d%d%d$')~=nil then i.clearIDFilter()i.addIDFilter(tonumber(aL:match('^(%d%d%d)$')))elseif aL:match('^s[sh]?%s?x?[sml]?$')~=nil then local aM,al=aL:match('^s([sh]?)%s?(x?[sml]?)$')local aN;if aM==nil or aM==''then G=m;return elseif aM=='s'then aN=true elseif aM=='h'then aN=false end;if al==nil then return end;G[al]=aN elseif aL:match('^addall')~=nil then for aD,aJ in ipairs(e.getConstructIds())do p[aJ]=true;a.print('Adding '..aJ..' to friendlist')end;aK()elseif aL:match('^addid')~=nil then for aJ in aL:gmatch('%D(%d+)')do p[tonumber(aJ)]=true end;aK()elseif aL:match('^clearall$')~=nil then p={}aK()elseif aL:match('^cleardead')~=nil then local aO=true;for aJ in aL:gmatch('%D(%d%d%d)')do aO=false;for aP,aD in pairs(q)do if aP%1000==tonumber(aJ)then q[aP]=nil end end;i.addIDFilter(tonumber(aJ))end;if aO then q={}end;Y()end end;function i.toggleFriendlyMode()n=not n end;function i.toggleOnlyIdentified()D=not D end;function i.toggleGunnerMode()E=not E end;X()b.setTimer('wtRadarTick',l)return i end
function damageReporterClass(a,b,c)local d={}if c==nil then c=10 end;if a==nil then a=1 end;if b==nil then b=60 end;local e=b+c+5;local f=50000;local g;local h=""local function i()g={peakDps=0,damageDealt=0,damageDealtById={},damageDealtHistory={},damageRecievedHistory={},shotsHit=0,shotsFired=0}for j=1,e do g.damageDealtHistory[#g.damageDealtHistory+1]=0;g.damageRecievedHistory[#g.damageRecievedHistory+1]=0 end end;i()local function k(l)table.remove(l,1)l[#l+1]=0 end;local function m(n,o,p)p=p or f;local function q(r,s,t)local u={}for j=0,t-1 do local v=0;for w=0,s-1 do v=v+r[#r-j-w]end;local x=v/s;u[t-j]=x;if x>p then p=x end end;return u end;local function y(r,t)local v=0;for j=#r,#r-t+1,-1 do v=v+r[j]end;return v/t end;local z=200;local A=100;local B=30;local C=30;p=p or 50000;local function D(E)local F={}for j,r in ipairs(E)do local G=(1-math.min(r/p,1))*A+C;local H=(j-1)/(#E-1)*z+B;table.insert(F,{x=H,y=G})end;return F end;local I=c;local J=b;local K=q(n,I,J)local L=K[#K]local M=q(o,I,J)local N=M[#M]local O=y(n,J)local P=y(o,J)local Q=(1-O/p)*A+C;local R=(1-P/p)*A+C;local S=D(K)local T=D(M)local function U(V,W)local X=''local Y;for Z,_ in ipairs(V)do X=X..'<circle class="'..W..'" cx="'.._.x..'" cy="'.._.y..'" r="1"/>'if Y~=nil then X=X..'<line class="'..W..'" x1="'.._.x..'" y1="'.._.y..'" x2="'..Y.x..'" y2="'..Y.y..'" />'end;Y=_ end;return X end;local function a0(a1)return string.format('%.1fk',a1/1000)end;local a2=[[
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="260px" height="160px" viewBox="0 0 260 160" xml:space="preserve">
<rect class="outd" x="29" y="129" width="202" height="2"/>
<rect class="outd" x="29" y="29" width="2" height="102"/>
]]if O>0 then a2=a2 ..U(S,'ind')a2=a2 ..'<line class="ind" stroke-width="0.5" x1="28" y1="'..Q..'" x2="228" y2="'..Q..'" stroke-dasharray="5" stroke-dashoffset="7.5"/><text class="ind text" font-size="11" text-anchor="end" x="27" y="'..Q..'">'..a0(O)..'</text>'end;if P>0 then a2=a2 ..U(T,'outd')a2=a2 ..'<line class="" stroke="#cfc" stroke-opacity="0.5" stroke-width="1" x1="28" y1="'..R..'" x2="228" y2="'..R..'" stroke-dasharray="5" stroke-dashoffset="7.5"/><text class="outd text" font-size="11" text-anchor="end" x="27" y="'..R..'">'..a0(P)..'</text>'end;if N>0 then a2=a2 ..'<text class="outd text" font-size="11" x="233" y="'..T[#T].y..'">'..a0(N)..'</text>'end;if L>0 then a2=a2 ..'<text class="ind text" font-size="11" x="233" y="'..S[#S].y..'">'..a0(L)..'</text>'end;a2=a2 ..'</svg>'return a2 end;function d.weaponOnHit(a3,a4)g.damageDealt=g.damageDealt+a4;g.damageDealtById[a3]=(g.damageDealtById[a3]or 0)+a4;g.shotsHit=g.shotsHit+1;g.shotsFired=g.shotsFired+1;g.damageDealtHistory[#g.damageDealtHistory]=g.damageDealtHistory[#g.damageDealtHistory]+a4 end;function d.weaponOnMiss(a3)g.shotsFired=g.shotsFired+1 end;function d.onDamage(a5)g.damageRecievedHistory[#g.damageRecievedHistory]=g.damageRecievedHistory[#g.damageRecievedHistory]+a5 end;function d.onPvPTimer(a6)if a6==0 then i()end end;function d.onTimer()local a7=0;for j=e,e-c,-1 do a7=a7+g.damageDealtHistory[j]end;local a8=a7/c;if a8>g.peakDps then g.peakDps=a8 end;h=m(g.damageRecievedHistory,g.damageDealtHistory)k(g.damageDealtHistory)k(g.damageRecievedHistory)end;h=m(g.damageRecievedHistory,g.damageDealtHistory)unit.setTimer('weaponStats',a)function d.getDamageStats()return g end;function d.getDpsGraphHtml()return h end;return d end
wtWeapons = weaponClass(system, weapon, weaponsPerPanel)
wtRadar = radarClass(system, unit, library, construct, radar_1, {}, db_1)
dpsReporter = damageReporterClass()
local a="black"local b="#b6dbe7"local c="1"local d=[[
<style>
.ui {
color: ]]..b..[[;
font: Inconsolata, monospace;
font-family: monospace;
font-size: 0.75em;
font-weight: bold;
opacity: ]]..c..[[;
white-space: pre;
text-shadow: -1px -1px 0 ]]..a..[[, 1px -1px 0 ]]..a..[[, -1px 1px 0 ]]..a..[[, 1px 1px 0 ]]..a..[[;
}
.blue {
color: #5BD8FF;
text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
}
.red {
color: #FF5B72;
text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
}
.orange {
color: #fc934f;
text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
}
.yellow {
color: #fce94f;
text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
}
.green {
color: #72ff5b;
text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
}
</style>
]]local function e(f)return math.max(math.min(50000/3.6,50000/3.6-10713*(f-10000)/(853926+f-10000)),20000/3.6)end;local function g(h,i,j,l)local m='-'l=l or'█'local n=math.floor(math.min(math.abs(math.max(i-1,0)),1)*h+0.5)local o=math.floor(math.min(math.abs(i),1)*h+0.5)local p;if i>=0 then p='[</a><a class="'..(j or'')..'">'..string.rep(l,o-n)..'</a><a class="red">'..string.rep(l,n)..'</a><a>'..string.rep(m,h-o)..']'elseif i<0 then p='['..string.rep(m,h-o)..'</a><a class="red">'..string.rep(l,o).."</a><a>]"else p='[</a><a class="red">'..string.rep('X',h).."</a><a>]"end;return p end;local function q(r)if r<1000 then return math.ceil(r)..'m'elseif r<1000*10 then return string.format("%.2fkm",r/1000)elseif r<1000*100 then return string.format("%.1fkm",r/1000)elseif r<1000*200*10 then return string.format("%.2fsu",r/1000/200)elseif r<1000*200*100 then return string.format("%.1fsu",r/1000/200)else return math.ceil(r/1000/200)..'su'end end;local function s(t,u,v)if t>u+v*2 then return'red'elseif t>u+v then return'orange'elseif t>u then return'yellow'else return''end end;local function w(x)local y=x;while true do y,k=string.gsub(y,"^(-?%d+)(%d%d%d)",'%1,%2')if k==0 then break end end;return y end;local function z(A)if A==nil then return''end;A=A*3.6;return w(math.floor(A))..' km/h'end;local function B(A)A=A or 5;local C={'|','/','|','\\'}local D=math.floor(system.getUtcTime()*A%#C)+1;return C[D]end;local function E(F)if F<1000 then return math.floor(F)elseif F<1000*10 then return string.format("%.2fk",F/1000)elseif F<1000*100 then return string.format("%.1fk",F/1000)elseif F<1000*1000*10 then return string.format("%.2fm",F/1000000)elseif F<1000*200*100 then return string.format("%.1fm",F/1000000)else return math.ceil(F/1000000)..'m'end end;local function G(h,H)local I=(h-#H)/2;local J=math.floor(I)local K=math.ceil(I)local L=string.rep(' ',J)..H..string.rep(' ',K)return L end;local function M()return radar_1 end;local function N()activeRadar=M()if wtRadar==nil then return''end;local function O(P)if activeRadar.getThreatRateFrom(P)>2 then return'red'elseif activeRadar.hasMatchingTransponder(P)then return'green'else return''end end;local function Q(P)return string.format('%2s',activeRadar.getConstructCoreSize(P))end;local function R(P)local S=activeRadar.getConstructOwnerEntity(P)if S==nil then return''end;local T;if S.isOrganization then T=system.getOrganization(S.id).tag or''else T=system.getPlayerName(S.id)or''end;return T:sub(1,4)end;local function U(P)if P==nil then return string.rep(' ',19)end;return'</a><a class="'..O(P)..'">'..Q(P)..' '..string.format('%03d',P%1000)..' '..string.format('%-6s',q(activeRadar.getConstructDistance(P)))..' '..string.format('%-4s',R(P))..'</a><a>'end;local function V(P)if P==nil then return string.rep(' ',11)end;return string.format('%-11s',z(activeRadar.getConstructSpeed(P)))end;local W=''if wtRadar.counter["attacked by"]>0 then W='red'end;return[[
<style>
.contacts-panel {
position: absolute;
top: 2vh;
left: 38vw;
font-size: 0.7em;
}
</style>
<div class="ui contacts-panel"><a>
___]]..G(37,'CONTACTS '..string.format('%-5d',wtRadar.counter["total"]))..[[___
| ENEMIES ]]..string.format('%-5d',wtRadar.counter["enemies"])..[[ | </a><a class="]]..W..[[">ATTACKING ]]..string.format('%-5d',wtRadar.counter["attacked by"])..[[</a><a> |
| ALLIES ]]..string.format('%-5d',wtRadar.counter["allies"])..[[ | THREATS ]]..string.format('%-5d',wtRadar.counter["locked by"]+wtRadar.counter["attacked by"])..[[ |
| | |
]]..U(wtRadar.counter.closest[1])..[[ | ]]..U(wtRadar.counter.threats[1])..[[
]]..U(wtRadar.counter.closest[2])..[[ | ]]..U(wtRadar.counter.threats[2])..[[
]]..U(wtRadar.counter.closest[3])..[[ | ]]..U(wtRadar.counter.threats[3])..[[
]]..U(wtRadar.counter.closest[4])..[[ | ]]..U(wtRadar.counter.threats[4])..[[
]]..U(wtRadar.counter.closest[5])..[[ | ]]..U(wtRadar.counter.threats[5])..[[
]]..U(wtRadar.counter.closest[6])..[[ | ]]..U(wtRadar.counter.threats[6])..[[
| ]]..U(wtRadar.counter.closest[7])..[[ | ]]..U(wtRadar.counter.threats[7])..[[ |
| ]]..U(wtRadar.counter.closest[8])..[[ | ]]..U(wtRadar.counter.threats[8])..[[ |
|___]]..string.rep(' ',37)..[[___|
</a></div>
]]end;function getGunnerHudHtml()local X=d;local activeRadar=M()local Y=0;local Z=0;local _=0;local a0=0;local a1=ammoCont_1~=nil and ammoCont_1.getItemsVolume()/ammoCont_1.getMaxVolume()or 0;local a2=g(14,a1)local a3=math.floor(a1*100+0.5)local a4=dpsReporter.getDamageStats()local a5=string.format('%-4s',a4.shotsFired>0 and math.floor(a4.shotsHit/a4.shotsFired*100+0.5)..'%'or'0')local a6={}for a7=1,6 do a6[a7]=string.rep(' ',34)end;if(weapon_size or 0)>0 then local a8=0;for a7,a9 in ipairs(weapon)do a8=a8+a9.getHitProbability()local aa=a9.getWidgetData()local ab=a9.getMaxAmmo()>0 and a9.getAmmoCount()/a9.getMaxAmmo()or 0;local ac=a9.getStatus()local ad=a9.getOperationalState()~=1;local ae=''local af,l;if ad then af='BROKEN'ae='red'elseif ac==4 then af='RELOADING'ae='yellow'l=B()ab=1 elseif ac==5 then af='UNLOADING'ae='yellow'l=B()ab=1 elseif ab==0 then af='RELOAD'ae='red'elseif ac==6 then af='BLOCKED'ae='red'elseif ab<=0.1 then af='LOW AMMO'ae='yellow'elseif ac==2 then af='FIRING'elseif ac==1 then af='IDLE'else af='ERROR'ae='red'end;local ag='</a><a class="'..ae..'">'..a9.getClass():match('Weapon(.)')..'</a><a>'local af='</a><a class="'..ae..'">'..string.format('%-9s',af)..'</a><a>'local ah=g(20,ab,ae,l)a6[a7]=ag..' '..ah..' '..af end;Y=a8/weapon_size;Z=weapon[1].getOptimalTracking()_=weapon[1].getOptimalDistance()a0=(weapon[1].getMaxDistance()-weapon[1].getOptimalDistance())/2 end;local ai=activeRadar.getTargetId()if ai~=0 then local aj=activeRadar.getConstructAngularSpeed(ai)*180/math.pi;local ak=wtRadar.getTargClosingSpeed()local al=activeRadar.getConstructSpeed(ai)local am=activeRadar.getConstructName(ai)local an=activeRadar.getConstructMass(ai)local ao=activeRadar.getConstructCoreSize(ai)local ap=activeRadar.isConstructAbandoned(ai)local aq=activeRadar.getConstructDistance(ai)local ar=e(an)local as=0;local at=activeRadar.isConstructIdentified(ai)local au=at and string.rep(' ',12)or'</a><a class="red">UNIDENTIFIED</a><a>'local av=string.format('%4s','['..ao..']')local aw=string.format('%03d',ai%1000)local ax=string.format('%-17s',am:sub(1,17))local ay=ap and'</a><a class="red">DEAD</a><a>'or' 'local az=string.format('%4s',math.floor(Y*100+0.5)..'%')..' '..g(18,Y)local aA=s(aj,Z,Z)local aB=at and'</a><a class="'..aA..'">'..string.format('%3d',math.ceil(aj))..'</a><a> deg/s'or string.rep(' ',9)local aC=s(aq,_,a0)local aD='</a><a class="'..aC..'">'..string.format('%6s',q(aq))..'</a><a>'local aE=string.format('%12s',z(ak))local aF=at and string.format('%11s',z(al))or string.rep(' ',11)local aG=at and string.format('%11s',z(ar))or string.rep(' ',11)X=X..[[
<style>
.target-panel {
position: absolute;
top: 56vh;
left: 28vw;
font-size: 0.69em;
}
</style>
<div class="ui target-panel"><a>
___ ]]..av..[[ ]]..aw..[[ - ]]..ax..[[ ___
| ]]..ay..[[ |
| hit prob ]]..az..[[ |
]]..au..[[
| TARGET | OPTIMAL
angular | ]]..aB..[[ | ]]..string.format('%-9s',math.floor(Z)..' deg/s')..[[
distance | ]]..aD..[[ | ]]..string.format('%6s',q(_))..[[
-----------|-----------|----------
closing at | ]]..aE..[[
speed | ]]..aF..[[
| max speed | ]]..aG..[[ |
|___ damage | ]]..string.format('%-7s',E(a4.damageDealtById[ai]or 0))..[[ ___|
</a></div>
]]end;X=X..[[
<style>
.weapon-panel {
position: absolute;
top: 62vh;
left: 62vw;
font-size: 0.55em;
}
</style>
<div class="ui weapon-panel"><a>
___ ___
| WEAPON STATUS |
| ]]..a6[1]..[[ |
]]..a6[2]..[[
]]..a6[3]..[[
]]..a6[4]..[[
]]..a6[5]..[[
| ]]..a6[6]..[[ |
|___ AMMO ]]..a2 ..[[ ___|
</a></div>
<style>
.stats-panel {
position: absolute;
top: 3vh;
left: 54vw;
font-size: 0.7em;
}
</style>
<div class="ui stats-panel"><a>
SHOTS FIRED ]]..string.format('%-7s',tostring(a4.shotsFired))..[[
SHOTS HIT ]]..string.format('%-7s',tostring(a4.shotsHit))..[[
ACCURACY ]]..string.format('%-7s',a5)..[[
PEAK DPS ]]..string.format('%-7s',E(a4.peakDps))..[[
DAMAGE ]]..string.format('%-7s',E(a4.damageDealt))..[[
</a></div>
]]X=X..[[
<style>
.dps-panel {
position: absolute;
top: 3vh;
left: 64vw;
font-size: 0.75em;
}
.outd{
stroke-width: 1;
stroke: ]]..a..[[;
stroke-opacity: 0.3;
fill-opacity: ]]..c..[[;
fill: ]]..b..[[;
}
.ind{
stroke-width: 1;
stroke: #FF5B72;
stroke-opacity: 0.3;
fill-opacity: 0.75;
fill: #fff;
}
.text{
stroke-width: 1;
font-size: 8;
}
</style>
<div class="dps-panel">
]]..dpsReporter.getDpsGraphHtml()..[[
</div>
]]X=X..N()X=X..[[
<style>
body {
box-shadow: inset 0 0 800px 0px rgba(255,0,0,]]..1-system.getUtcTime()+wtRadar.lastEnemyContact..[[)
}
</style>
]]return X end
system.showScreen(1)
local function getHTML()
return getGunnerHudHtml() .. wtRadar.getHUD()
end
function updateHud()
system.setScreen(getHTML())
end
construct:
onPvPTimer(active):
lua: |
dpsReporter.onPvPTimer(active)
system:
onUpdate:
lua: |
wtWeapons.onUpdate()
updateHud()
onFlush:
lua: |
wtRadar.onFlush()
inputText(text):
lua: |
wtRadar.onTextInput(text)
actionStart:
args: [option9]
lua: |
showGunnerAR = not showGunnerAR
unit:
tick:
args: ["wtRadarTick"]
lua: |
wtRadar.onTick()
tick:
args: ["weaponStats"]
lua: |
dpsReporter.onTimer()
core:
onStressChanged(stress):
lua: |
dpsReporter.onDamage(stress)
shield:
onAbsorbed(hitpoints, hitpointsRaw):
lua: |
dpsReporter.onDamage(hitpoints)
weapon_1:
onHit(targetId,damage):
lua: |
dpsReporter.weaponOnHit(targetId, damage)
onMissed(targetId):
lua: |
dpsReporter.weaponOnMiss(targetId)
onElementDestroyed(targetId,elementId):
lua: |
weapon_2:
onHit(targetId,damage):
lua: |
dpsReporter.weaponOnHit(targetId, damage)
onMissed(targetId):
lua: |
dpsReporter.weaponOnMiss(targetId)
onElementDestroyed(targetId,elementId):
lua: |
weapon_3:
onHit(targetId,damage):
lua: |
dpsReporter.weaponOnHit(targetId, damage)
onMissed(targetId):
lua: |
dpsReporter.weaponOnMiss(targetId)
onElementDestroyed(targetId,elementId):
lua: |
weapon_4:
onHit(targetId,damage):
lua: |
dpsReporter.weaponOnHit(targetId, damage)
onMissed(targetId):
lua: |
dpsReporter.weaponOnMiss(targetId)
onElementDestroyed(targetId,elementId):
lua: |
weapon_5:
onHit(targetId,damage):
lua: |
dpsReporter.weaponOnHit(targetId, damage)
onMissed(targetId):
lua: |
dpsReporter.weaponOnMiss(targetId)
onElementDestroyed(targetId,elementId):
lua: |
weapon_6:
onHit(targetId,damage):
lua: |
dpsReporter.weaponOnHit(targetId, damage)
onMissed(targetId):
lua: |
dpsReporter.weaponOnMiss(targetId)
onElementDestroyed(targetId,elementId):
lua: |