diff --git a/src/scripts/info-panel/info-panel.lua b/src/scripts/info-panel/info-panel.lua index e1e53f2..abcb0c7 100644 --- a/src/scripts/info-panel/info-panel.lua +++ b/src/scripts/info-panel/info-panel.lua @@ -176,18 +176,18 @@ function lotj.infoPanel.createOpponentStats(container) opponentGauge:setFontSize("12") local function update() - local opponentName = string.gsub(gmcp.Char.Enemy.name or "", "&.", "") - -- Opponent name seems to always be empty string even when fighting, so fall back to something reasonable + if not gmcp.Char.Enemy.name then + opponentGauge:setValue(0, 1, "Not fighting") + return + end + + local opponentName = string.gsub(gmcp.Char.Enemy.name, "&.", "") if opponentName == "" then opponentName = "Current target" end - local opponentHealth = gmcp.Char.Enemy.Percent + local opponentHealth = gmcp.Char.Enemy.percent local opponentHealthMax = 100 - if opponentHealth ~= nil then - opponentGauge:setValue(opponentHealth, opponentHealthMax, opponentName.."
"..opponentHealth.."%") - else - opponentGauge:setValue(0, 1, "Not fighting") - end + opponentGauge:setValue(opponentHealth, opponentHealthMax, opponentName.."
"..opponentHealth.."%") end lotj.setup.registerEventHandler("gmcp.Char.Enemy", update) end diff --git a/src/scripts/system-map/system-map.lua b/src/scripts/system-map/system-map.lua index cfc52e6..2db9fac 100644 --- a/src/scripts/system-map/system-map.lua +++ b/src/scripts/system-map/system-map.lua @@ -112,8 +112,7 @@ function lotj.systemMap.drawMap() elem:hide() end - -- We use ship max speed as a proxy for "do we have ship data at all" - if not gmcp.Ship or not gmcp.Ship.Info or gmcp.Ship.Info.maxSpeed == nil then + if not gmcp.Ship or not gmcp.Ship.Info or gmcp.Ship.Info.posX == nil then return end