From a74a1f3ec7cc3d40bf2ea49102a371485d6b15cb Mon Sep 17 00:00:00 2001 From: Matt Wagner Date: Sun, 4 Jul 2021 12:45:47 -0700 Subject: [PATCH] Uninstall generic mapper when present, tweak space gauge font size --- mfile | 2 +- src/scripts/info-panel/info-panel.lua | 21 +++++++++++---------- src/scripts/setup/setup.lua | 5 +++++ 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/mfile b/mfile index 348c945..eaa9d83 100644 --- a/mfile +++ b/mfile @@ -1,4 +1,4 @@ { "package": "lotj-ui", - "version": "v2.1.0" + "version": "v2.1.1" } \ No newline at end of file diff --git a/src/scripts/info-panel/info-panel.lua b/src/scripts/info-panel/info-panel.lua index 34c87c1..4d54955 100644 --- a/src/scripts/info-panel/info-panel.lua +++ b/src/scripts/info-panel/info-panel.lua @@ -253,6 +253,7 @@ function lotj.infoPanel.createSpaceStats(container) local gaugeHeight = math.ceil(lotj.layout.lowerInfoPanelHeight/5 * 1.33) local allGaugesHeight = gaugeHeight*3+gaugeSpacing local gaugesStart = math.floor((totalSpace - allGaugesHeight)/2) + local spaceStatFontSize = getFontSize()-1 local energyGauge = Geyser.Gauge:new({ x="3%", y=gaugesStart, @@ -260,7 +261,7 @@ function lotj.infoPanel.createSpaceStats(container) }, container) energyGauge.front:setStyleSheet(gaugeFrontStyle("#7a7a7a", "#777777", "#656565", "#505050", "#656565")) energyGauge.back:setStyleSheet(gaugeBackStyle("#383838", "#303030", "#222222", "#151515", "#222222")) - styleGaugeText(energyGauge, getFontSize()-1) + styleGaugeText(energyGauge, spaceStatFontSize) wireGaugeUpdate(energyGauge, "Ship.Info.energy", "Ship.Info.maxEnergy", "en", "gmcp.Ship.Info") local hullGauge = Geyser.Gauge:new({ @@ -269,7 +270,7 @@ function lotj.infoPanel.createSpaceStats(container) }, container) hullGauge.front:setStyleSheet(gaugeFrontStyle("#bd7833", "#bd6e20", "#994c00", "#703800", "#994c00")) hullGauge.back:setStyleSheet(gaugeBackStyle("#442511", "#441d08", "#331100", "#200900", "#331100")) - styleGaugeText(hullGauge, getFontSize()-1) + styleGaugeText(hullGauge, spaceStatFontSize) wireGaugeUpdate(hullGauge, "Ship.Info.hull", "Ship.Info.maxHull", "hl", "gmcp.Ship.Info") local shieldGauge = Geyser.Gauge:new({ @@ -278,7 +279,7 @@ function lotj.infoPanel.createSpaceStats(container) }, container) shieldGauge.front:setStyleSheet(gaugeFrontStyle("#31d0d0", "#22cfcf", "#00b2b2", "#009494", "#00b2b2")) shieldGauge.back:setStyleSheet(gaugeBackStyle("#113f3f", "#073f3f", "#003333", "#002222", "#001111")) - styleGaugeText(shieldGauge, getFontSize()-1) + styleGaugeText(shieldGauge, spaceStatFontSize) wireGaugeUpdate(shieldGauge, "Ship.Info.shield", "Ship.Info.maxShield", "sh", "gmcp.Ship.Info") @@ -287,7 +288,7 @@ function lotj.infoPanel.createSpaceStats(container) x="35%", y="10%", width="13%", height="40%" }, container) - pilotLabel:echo("Pilot: ", nil, "rb"..getFontSize()) + pilotLabel:echo("Pilot: ", nil, "rb"..spaceStatFontSize) local pilotBoxCont = Geyser.Label:new({ x="48%", y="16%", @@ -314,11 +315,11 @@ function lotj.infoPanel.createSpaceStats(container) local function updateSpeed() if not gmcp.Ship or not gmcp.Ship.Info or not gmcp.Ship.Info.maxSpeed then - speedGauge:echo("Sp: N/A", nil, "l"..getFontSize()) + speedGauge:echo("Sp: N/A", nil, "l"..spaceStatFontSize) else local speed = gmcp.Ship.Info.speed or 0 local maxSpeed = gmcp.Ship.Info.maxSpeed or 0 - speedGauge:echo("Sp: "..speed.."/"..maxSpeed, nil, "l"..getFontSize()) + speedGauge:echo("Sp: "..speed.."/"..maxSpeed, nil, "l"..spaceStatFontSize) end end lotj.setup.registerEventHandler("gmcp.Ship.Info", updateSpeed) @@ -331,12 +332,12 @@ function lotj.infoPanel.createSpaceStats(container) local function updateCoords() if not gmcp.Ship or not gmcp.Ship.Info or not gmcp.Ship.Info.posX then - coordsInfo:echo("Coords: N/A", nil, "l"..getFontSize()) + coordsInfo:echo("Coords: N/A", nil, "l"..spaceStatFontSize) else local shipX = gmcp.Ship.Info.posX or 0 local shipY = gmcp.Ship.Info.posY or 0 local shipZ = gmcp.Ship.Info.posZ or 0 - coordsInfo:echo("Coords: "..shipX.." "..shipY.." "..shipZ, nil, "l"..getFontSize()) + coordsInfo:echo("Coords: "..shipX.." "..shipY.." "..shipZ, nil, "l"..spaceStatFontSize) end end lotj.setup.registerEventHandler("gmcp.Ship.Info", updateCoords) @@ -350,7 +351,7 @@ function lotj.infoPanel.createSpaceStats(container) x="77%", y="53%", width="15%", height="40%", }, container) - lotj.infoPanel.chaffIndicator:echo("[Chaff]", "yellow", "c13b") + lotj.infoPanel.chaffIndicator:echo("[Chaff]", "yellow", "c"..spaceStatFontSize.."b") lotj.infoPanel.chaffIndicator:hide() end @@ -364,7 +365,7 @@ function lotj.infoPanel.markSpaceTick() lotj.infoPanel.spaceTickTimers = {} for i = 0,20,1 do local timerId = tempTimer(i, function() - lotj.infoPanel.spaceTickCounter:echo("Tick: "..20-i, nil, "c13") + lotj.infoPanel.spaceTickCounter:echo("Tick: "..20-i, nil, "c"..spaceStatFontSize) end) table.insert(lotj.infoPanel.spaceTickTimers, timerId) end diff --git a/src/scripts/setup/setup.lua b/src/scripts/setup/setup.lua index 5c4974c..e8e4c46 100644 --- a/src/scripts/setup/setup.lua +++ b/src/scripts/setup/setup.lua @@ -51,6 +51,11 @@ lotj.setup.registerEventHandler("sysLoadEvent", function() end) lotj.setup.registerEventHandler("sysInstallPackage", function(_, pkgName) + --Check if the generic_mapper package is installed and if so uninstall it + if table.contains(getPackages(),"generic_mapper") then + uninstallPackage("generic_mapper") + end + if pkgName ~= "lotj-ui" then return end sendGMCP("Core.Supports.Set", "[\"Ship 1\"]") setup()