-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathLOSWeaponDebugger.txt
58 lines (53 loc) · 1.73 KB
/
LOSWeaponDebugger.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
--@name Lanteans OS AppCard (WeaponDebugger)
--@author Yuri6037
--@class processor
--@model models/props_junk/sawblade001a.mdl
--Initialisation
Entity = ents.self()
Entity:setMaterial("phoenix_storms/black_chrome")
wire.createOutputs({"AppName", "AppCode"}, {"String", "String"})
Ports = wire.ports
--End
--Application
AppName = "weapondebug"
AppCode = [[
local app = {}
function app:Init()
self:EnableAINetContext()
self:SetTitle("Weapon Debugger")
self:SetSize(256, 166)
self:SetPos(LOCATION_CENTER)
self.P = self:AddComponent("progress", 10, 32, COLOR(255, 255, 0), "Progress")
self.P:SetSize(AUTO, 32)
self.S = self:AddComponent("progress", 10, 64, COLOR(255, 0, 0), "Shield lost")
self.S:SetSize(AUTO, 32)
self.H = self:AddComponent("progress", 10, 96, COLOR(0, 0, 255), "Hull lost")
self.H:SetSize(AUTO, 32)
self.A = self:AddComponent("progress", 10, 128, COLOR(0, 255, 255), "Armor lost")
self.A:SetSize(AUTO, 32)
self:AddPullDownMenu(" Extension ")
self:AddPullDownMenuItem("StartSampling", function()
OS.Dialog("code", "Please enter the amount of samples to read :", function(app)
local code = tonumber(app:GetCodeStr())
AIRunFunc("DBGStartSampling", code)
app:Exit()
end)
end)
self:AddPullDownMenuItem("StopSampling", function()
AIRunFunc("DBGStopSampling")
end)
end
function app:OnDataReceived(data)
self.P:SetValue(math.round(data["CurSample"] / data["NumSamples"], 3))
self.S:SetValue(math.round(data["PShieldLost"], 3))
self.H:SetValue(math.round(data["PHullLost"], 3))
self.A:SetValue(math.round(data["PArmorLost"], 3))
end
OS.DefineApp("weapondebug", app)
OS.AddAppMenuItem("weapondebug", "Weapon Debugger", "LanAI")
]]
--End
--Saving
Ports["AppName"] = "app_" .. AppName
Ports["AppCode"] = AppCode
--End