From cacf98c11283d1ebd600ff0d44513a9db7cb8b87 Mon Sep 17 00:00:00 2001 From: FajsiEx Date: Sat, 14 Aug 2021 13:28:13 +0200 Subject: [PATCH] + testing out IR support --- scripts/result.lua | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/scripts/result.lua b/scripts/result.lua index 260be56..b3b0274 100644 --- a/scripts/result.lua +++ b/scripts/result.lua @@ -103,6 +103,8 @@ local objectTypeTimingStats = { vol = {criticals = 0, errors = 0} } +local irHeartbeatRequested = false; +local irText = '' game.LoadSkinSample("result") @@ -335,6 +337,10 @@ local drawBottomPanelContent = function (deltatime) -- Draw volforce VolforceWindow.render(0, bottomPanelX+310, bottomPanelY+355) + + -- Draw IR text + gfx.FontSize(22) + gfx.Text(irText, bottomPanelX+80, bottomPanelY+461); end local drawJacketPanel = function() @@ -357,6 +363,21 @@ local drawJacketPanelContent = function() gfx.Text(result.level, jacketPanelX+270, jacketPanelY+14.5); end +local IR_HeartbeatResponse = function(res) + if res.statusCode == IRData.States.Success then + irText = res.body.serverName .. ' ' .. res.body.irVersion; + else + game.Log("Can't connect to IR!", game.LOGGER_WARNING) + end +end + +local IR_Handle = function() + if not irHeartbeatRequested then + IR.Heartbeat(IR_HeartbeatResponse) + irHeartbeatRequested = true; + end +end + local tickTransitions = function(deltaTime) if transitionEnterScale < 1 then @@ -478,7 +499,8 @@ render = function(deltaTime, showStats) Footer.draw(); - handleSfx() + handleSfx(); + IR_Handle(); -- debug gfx.FontSize(18)