diff --git a/data/pigui/modules/hyperjump-planner.lua b/data/pigui/modules/hyperjump-planner.lua index 7af7e6e26..ab0bd1a4e 100644 --- a/data/pigui/modules/hyperjump-planner.lua +++ b/data/pigui/modules/hyperjump-planner.lua @@ -2,7 +2,6 @@ -- Licensed under the terms of the GPL v3. See licenses/GPL-3.txt local Game = require 'Game' -local Event = require 'Event' local Equipment = require 'Equipment' local Lang = require 'Lang' @@ -26,14 +25,12 @@ local hyperJumpPlanner = {} -- for export -- hyperjump route stuff local hyperjump_route = {} local route_jumps = 0 -local auto_route_min_jump = 2 -- minimum jump distance when auto routing local current_system local current_path local map_selected_path local selected_jump local current_fuel local remove_first_if_current = true -local hideHyperJumpPlaner = false local textIconSize = nil local function textIcon(icon, tooltip) @@ -117,7 +114,8 @@ end --mainButton local function buildJumpRouteList() hyperjump_route = {} local player = Game.player - local start = Game.system.path + -- if we are not in the system, then we are in hyperspace, we start building the route from the jump target + local start = Game.system and Game.system.path or player:GetHyperspaceDestination() local drive = table.unpack(player:GetEquip("engine")) or nil local fuel_type = drive and drive.fuel or Equipment.cargo.hydrogen local current_fuel = player:CountEquip(fuel_type,"cargo") @@ -151,7 +149,8 @@ local function updateHyperspaceTarget() if #hyperjump_route > 0 then -- first waypoint is always the hyperspace target sectorView:SetHyperspaceTarget(hyperjump_route[1].path) - else + elseif not Game.InHyperspace() then + -- we will not reset the hyperjump target while we are in the hyperjump sectorView:ResetHyperspaceTarget() selected_jump = nil end @@ -169,8 +168,6 @@ local function showJumpRoute() mainButton(icons.current_line, lui.REMOVE_JUMP, function() - local new_route = {} - local new_count = 0 if selected_jump then sectorView:RemoveRouteItem(selected_jump) end diff --git a/data/pigui/views/map-sector-view.lua b/data/pigui/views/map-sector-view.lua index d8cb8c732..353758072 100644 --- a/data/pigui/views/map-sector-view.lua +++ b/data/pigui/views/map-sector-view.lua @@ -1,9 +1,7 @@ -- Copyright © 2008-2021 Pioneer Developers. See AUTHORS.txt for details -- Licensed under the terms of the GPL v3. See licenses/GPL-3.txt -local Engine = require 'Engine' local Game = require 'Game' -local utils = require 'utils' local Event = require 'Event' local Format = require 'Format' local SystemPath = require 'SystemPath' @@ -26,7 +24,6 @@ local mainButtonFramePadding = 3 local font = ui.fonts.pionillium.medlarge local smallfont = ui.fonts.pionillium.medium -local MAX_SEARCH_STRINGS_VISIBLE = 15 local edgePadding = Vector2(font.size) local function setAlpha(c, a) @@ -52,7 +49,6 @@ local draw_vertical_lines = false local draw_out_range_labels = false local draw_uninhabited_labels = true local automatic_system_selection = true -local lock_hyperspace_target = false local function mainMenuButton(icon, tooltip) return ui.coloredSelectedIconButton(icon, mainButtonSize, false, mainButtonFramePadding, svColor.BUTTON_ACTIVE, svColor.BUTTON_INK, tooltip) @@ -115,6 +111,7 @@ local Windows = { local statusIcons = { OK = { icon = icons.route_destination }, + DRIVE_ACTIVE = { icon = icons.ship }, CURRENT_SYSTEM = { icon = icons.navtarget }, INSUFFICIENT_FUEL = { icon = icons.fuel }, OUT_OF_RANGE = { icon = icons.alert_generic },