Minor lua fixes
Convert all remaining cases of import to require Fix some unintentional global variablesmaster
parent
b091d0dd3c
commit
88dfb5500c
|
@ -751,7 +751,7 @@ Character = {
|
|||
if type(modifier) ~= 'number' then error('SafeRoll(): modifier must be numeric') end
|
||||
if self.dead then return false end -- dead characters fail all tests
|
||||
if self[attribute] and (type(self[attribute])=='number') then
|
||||
local result = Self.DiceRoll()
|
||||
local result = self.DiceRoll()
|
||||
return (result < (self[attribute] + modifier) and result)
|
||||
else
|
||||
return false
|
||||
|
|
|
@ -75,7 +75,7 @@ end
|
|||
|
||||
|
||||
function CrimeRecord.Unserialize(data)
|
||||
obj = CrimeRecord.Super().Unserialize(data)
|
||||
local obj = CrimeRecord.Super().Unserialize(data)
|
||||
setmetatable(obj, CrimeRecord.meta)
|
||||
return obj
|
||||
end
|
||||
|
|
|
@ -7,10 +7,10 @@ local utils = require 'utils'
|
|||
local ui = Engine.ui
|
||||
|
||||
local _DefaultSort = function (self, cmp)
|
||||
local col = self.sortCol
|
||||
if not cmp then
|
||||
cmp = function (a,b) return a.data[col] <= b.data[col] end
|
||||
end
|
||||
col = self.sortCol
|
||||
self.table = utils.stable_sort(self.table, cmp)
|
||||
end
|
||||
|
||||
|
|
|
@ -134,7 +134,7 @@ function utils.stable_sort(values, cmp)
|
|||
return result
|
||||
end
|
||||
|
||||
function merge_sort (values)
|
||||
local function merge_sort (values)
|
||||
if #values > 1 then
|
||||
local a, b = split(values)
|
||||
a = merge_sort(a)
|
||||
|
|
|
@ -18,8 +18,8 @@ local ShipDef = require 'ShipDef'
|
|||
local Ship = require 'Ship'
|
||||
local utils = require 'utils'
|
||||
|
||||
local InfoFace = import("ui/InfoFace")
|
||||
local NavButton = import("ui/NavButton")
|
||||
local InfoFace = require 'ui.InfoFace'
|
||||
local NavButton = require 'ui.NavButton'
|
||||
|
||||
local l = Lang.GetResource("module-assassination")
|
||||
|
||||
|
|
|
@ -16,8 +16,8 @@ local ShipDef = require 'ShipDef'
|
|||
local Ship = require 'Ship'
|
||||
local utils = require 'utils'
|
||||
|
||||
local InfoFace = import("ui/InfoFace")
|
||||
local NavButton = import("ui/NavButton")
|
||||
local InfoFace = require 'ui.InfoFace'
|
||||
local NavButton = require 'ui.NavButton'
|
||||
|
||||
local l = Lang.GetResource("module-cargorun")
|
||||
local l_ui_core = Lang.GetResource("ui-core")
|
||||
|
|
|
@ -18,8 +18,8 @@ local ShipDef = require 'ShipDef'
|
|||
local Ship = require 'Ship'
|
||||
local utils = require 'utils'
|
||||
|
||||
local InfoFace = import("ui/InfoFace")
|
||||
local NavButton = import("ui/NavButton")
|
||||
local InfoFace = require 'ui.InfoFace'
|
||||
local NavButton = require 'ui.NavButton'
|
||||
|
||||
local l = Lang.GetResource("module-combat")
|
||||
|
||||
|
|
|
@ -16,8 +16,8 @@ local ShipDef = require 'ShipDef'
|
|||
local Ship = require 'Ship'
|
||||
local utils = require 'utils'
|
||||
|
||||
local InfoFace = import("ui/InfoFace")
|
||||
local NavButton = import("ui/NavButton")
|
||||
local InfoFace = require 'ui.InfoFace'
|
||||
local NavButton = require 'ui.NavButton'
|
||||
|
||||
local l = Lang.GetResource("module-deliverpackage")
|
||||
|
||||
|
|
|
@ -131,12 +131,10 @@ local onCreateBB = function (station)
|
|||
|
||||
-- if too many fake police, don't place the ad
|
||||
if not ispolice or numPolice < maxPolice then
|
||||
local r = ispolice and rand_police or rand
|
||||
|
||||
if ispolice then
|
||||
numPolice = numPolice + 1
|
||||
r = rand_police
|
||||
else
|
||||
r = rand
|
||||
end
|
||||
|
||||
local flavour = string.interp(l["GOODS_TRADER_"..r:Integer(1, num_names)-1], {name = NameGen.Surname(r)})
|
||||
|
|
|
@ -46,8 +46,8 @@ local Rand = require 'Rand'
|
|||
local ModelSkin = require 'SceneGraph.ModelSkin'
|
||||
local l = Lang.GetResource("module-searchrescue")
|
||||
|
||||
local InfoFace = import("ui/InfoFace")
|
||||
local NavButton = import("ui/NavButton")
|
||||
local InfoFace = require 'ui.InfoFace'
|
||||
local NavButton = require 'ui.NavButton'
|
||||
|
||||
-- Get the UI class
|
||||
local ui = Engine.ui
|
||||
|
@ -436,7 +436,7 @@ end
|
|||
|
||||
local cargoPresent = function (ship, item)
|
||||
-- Check if this cargo item is present on the ship.
|
||||
cargotype = verifyCommodity(item) -- necessary for some users
|
||||
local cargotype = verifyCommodity(item) -- necessary for some users
|
||||
if ship:CountEquip(cargotype) > 0 then
|
||||
return true
|
||||
else
|
||||
|
@ -492,14 +492,14 @@ end
|
|||
local addCargo = function (ship, item)
|
||||
-- Add a ton of the supplied cargo item to the ship.
|
||||
if not cargoSpace(ship) then return end
|
||||
cargotype = verifyCommodity(item) -- necessary for some users
|
||||
local cargotype = verifyCommodity(item) -- necessary for some users
|
||||
ship:AddEquip(cargotype, 1)
|
||||
end
|
||||
|
||||
local removeCargo = function (ship, item)
|
||||
-- Remove a ton of the supplied cargo item from the ship.
|
||||
if not cargoPresent(ship, item) then return end
|
||||
cargotype = verifyCommodity(item) -- necessary for some users
|
||||
local cargotype = verifyCommodity(item) -- necessary for some users
|
||||
ship:RemoveEquip(cargotype, 1)
|
||||
end
|
||||
|
||||
|
@ -772,12 +772,7 @@ local createTargetShip = function (mission)
|
|||
end
|
||||
|
||||
-- load a laser
|
||||
local max_laser_size
|
||||
if default_drive then
|
||||
max_laser_size = shipdef.capacity - default_drive.capabilities.mass
|
||||
else
|
||||
max_laser_size = shipdef.capacity
|
||||
end
|
||||
local max_laser_size = shipdef.capacity - (drive and drive.capabilities.mass or 0)
|
||||
local laserdefs = utils.build_array(utils.filter(function (_,laser) return laser:IsValidSlot('laser_front')
|
||||
and laser.capabilities.mass <= max_laser_size
|
||||
and laser.l10n_key:find("PULSECANNON") end, pairs(Equipment.laser)))
|
||||
|
@ -1072,7 +1067,7 @@ local findClosestPlanets = function ()
|
|||
|
||||
-- pick closest planets to stations
|
||||
for _,planet in pairs(rockyplanets) do
|
||||
nearest_station = planet:FindNearestTo("SPACESTATION")
|
||||
local nearest_station = planet:FindNearestTo("SPACESTATION")
|
||||
table.insert(closestplanets[nearest_station], planet.path)
|
||||
end
|
||||
|
||||
|
@ -1269,7 +1264,7 @@ local makeAdvert = function (station, manualFlavour, closestplanets)
|
|||
deliver_comm = copyTable(flavour.deliver_comm)
|
||||
|
||||
-- set target ship parameters and determine pickup and delivery of personnel based on mission flavour
|
||||
local shipdef, crew_num, shiplabel, pickup_crew, pickup_pass, deliver_crew, shipseed = createTargetShipParameters(flavour, deliver_crew, pickup_crew, pickup_pass)
|
||||
local shipdef, crew_num, shiplabel, pickup_crew, pickup_pass, deliver_crew, shipseed = createTargetShipParameters(flavour)
|
||||
|
||||
-- adjust fuel to deliver based on selected ship and mission flavour
|
||||
local needed_fuel
|
||||
|
@ -1979,7 +1974,7 @@ local onCreateBB = function (station)
|
|||
-- Initial creation of banter boards for current system.
|
||||
|
||||
-- more efficient to determine closest planets per station once per banter board creation
|
||||
closestplanets = findClosestPlanets()
|
||||
local closestplanets = findClosestPlanets()
|
||||
|
||||
-- force ad creation for debugging
|
||||
local num = 3
|
||||
|
|
|
@ -16,8 +16,8 @@ local Ship = require 'Ship'
|
|||
local eq = require 'Equipment'
|
||||
local utils = require 'utils'
|
||||
|
||||
local InfoFace = import("ui/InfoFace")
|
||||
local NavButton = import("ui/NavButton")
|
||||
local InfoFace = require 'ui.InfoFace'
|
||||
local NavButton = require 'ui.NavButton'
|
||||
|
||||
-- Get the language resource
|
||||
local l = Lang.GetResource("module-taxi")
|
||||
|
|
|
@ -28,9 +28,10 @@ local pigui = Engine.pigui
|
|||
-- boolean - true if button was clicked
|
||||
--
|
||||
function ui.imageButton(icon, size, frame_padding, bg_color, tint_color, tooltip)
|
||||
local uv0, uv1 = get_icon_tex_coords(icon)
|
||||
local uv0, uv1 = ui.get_icon_tex_coords(icon)
|
||||
local res = nil
|
||||
ui.withID(tooltip, function()
|
||||
local res = pigui.ImageButton(ui.get_icons_texture(size), size, uv0, uv1, frame_padding, bg_color, tint_color)
|
||||
res = pigui.ImageButton(ui.get_icons_texture(size), size, uv0, uv1, frame_padding, bg_color, tint_color)
|
||||
end)
|
||||
return res
|
||||
end
|
||||
|
|
|
@ -128,7 +128,7 @@ function ui.addWideIcon(position, icon, color, size, anchor_horizontal, anchor_v
|
|||
else
|
||||
pigui.AddImage(ui.get_icons_texture(size), pos, pos + size, uv0, uv1, color)
|
||||
end
|
||||
if tooltip and (ui.isMouseHoveringWindow() or not is.isAnyWindowHovered()) and tooltip ~= "" then
|
||||
if tooltip and (ui.isMouseHoveringWindow() or not ui.isAnyWindowHovered()) and tooltip ~= "" then
|
||||
if pigui.IsMouseHoveringRect(pos, pos + size, true) then
|
||||
ui.maybeSetTooltip(tooltip)
|
||||
end
|
||||
|
|
|
@ -189,7 +189,7 @@ local function getFlightHistory()
|
|||
-- input field for custom log:
|
||||
headerText(l.LOG_NEW, "")
|
||||
ui.sameLine()
|
||||
text, changed = ui.inputText("##inputfield", "", {"EnterReturnsTrue"})
|
||||
local text, changed = ui.inputText("##inputfield", "", {"EnterReturnsTrue"})
|
||||
if changed then
|
||||
FlightLog.MakeCustomEntry(text)
|
||||
end
|
||||
|
|
|
@ -64,6 +64,7 @@ end
|
|||
|
||||
local sectorView
|
||||
local hyperspaceDetailsCache = {}
|
||||
local prevSystemPath = nil
|
||||
|
||||
local onGameStart = function ()
|
||||
-- connect to class SectorView
|
||||
|
@ -129,7 +130,7 @@ end
|
|||
local function calc_star_dist(star)
|
||||
local dist = 0.0
|
||||
while star do
|
||||
dist = dist + (star.apoapsis or 0 + star.periapsis or 0) / 2
|
||||
dist = dist + ((star.apoapsis or 0) + (star.periapsis or 0)) / 2
|
||||
star = star.parent
|
||||
end
|
||||
return dist
|
||||
|
@ -250,8 +251,6 @@ function Windows.systemInfo.Dummy()
|
|||
ui.sameLine()
|
||||
end
|
||||
|
||||
local prevSystemPath = nil
|
||||
|
||||
local search_text = ""
|
||||
|
||||
local function showSettings()
|
||||
|
@ -334,7 +333,7 @@ function Windows.searchBar:Show()
|
|||
|
||||
if leftBarMode == "SEARCH" then
|
||||
ui.text(lc.SEARCH)
|
||||
search_text, changed = ui.inputText("", search_text, {})
|
||||
local search_text, changed = ui.inputText("", search_text, {})
|
||||
ui.spacing()
|
||||
local parsedSystem = changed and search_text ~= "" and SystemPath.ParseString(search_text)
|
||||
if parsedSystem and parsedSystem ~= nil then
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
-- Copyright © 2008-2020 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 gameView = require 'pigui.views.game'
|
||||
|
||||
local ui = require 'pigui'
|
||||
local pionillium = ui.fonts.pionillium
|
||||
|
@ -66,7 +66,7 @@ local function alarm ()
|
|||
|
||||
local reticuleCircleRadius = math.min(ui.screenWidth, ui.screenHeight) / 8 -- required for icon placement
|
||||
local uiTextPos = Vector2(ui.screenWidth / 2, ui.screenHeight / 3 - 10) --sits just above HUD circle
|
||||
local uiPos = ui.pointOnClock(center, reticuleCircleRadius * 1.2 , 10) --left side of the reticule, above frame info
|
||||
local uiPos = ui.pointOnClock(gameView.center, reticuleCircleRadius * 1.2 , 10) --left side of the reticule, above frame info
|
||||
local iconSize = Vector2(24, 24)
|
||||
|
||||
local max_accel = Game.player:GetAcceleration("forward") --max acceleration axis of the ship, which is always forward with all Pioneer ships
|
||||
|
|
|
@ -50,7 +50,7 @@ local function button_lowThrustPower()
|
|||
ui.window("ThrustSliderWindow", {"NoTitleBar", "NoResize"},
|
||||
function()
|
||||
ui.withStyleColors({["SliderGrab"] =colors.white, ["SliderGrabActive"]=colors.buttonBlue},function()
|
||||
new_thrust = ui.vSliderInt('###ThrustLowPowerSlider',Vector2(mainButtonSize.x + 1 + 2 * mainButtonFramePadding,100), thrust*100,0,100)
|
||||
local new_thrust = ui.vSliderInt('###ThrustLowPowerSlider',Vector2(mainButtonSize.x + 1 + 2 * mainButtonFramePadding,100), thrust*100,0,100)
|
||||
player:SetLowThrustPower(new_thrust/100)
|
||||
end)
|
||||
end)
|
||||
|
|
|
@ -72,7 +72,7 @@ local getRepairMessage = function (damage, price)
|
|||
end
|
||||
|
||||
|
||||
function round(num, numDecimalPlaces)
|
||||
local function round(num, numDecimalPlaces)
|
||||
local mult = 10^(numDecimalPlaces or 0)
|
||||
return math.floor(num * mult + 0.5) / mult
|
||||
end
|
||||
|
@ -81,6 +81,7 @@ end
|
|||
local function drawShipRepair()
|
||||
local hullPercent = round(Game.player:GetHullPercent())
|
||||
local damage = 100 - hullPercent
|
||||
local shipDef = ShipDef[Game.player.shipId]
|
||||
|
||||
local intro = string.interp(l.YOUR_HULL_IS_AT_X_INTEGRITY, {value = string.format('%.1f', hullPercent)})
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ function systemEconView.drawEconList(commList, illegalList, showOther)
|
|||
local currSysPos = width - (showOther and iconWidth * 2 or iconWidth)
|
||||
ui.child("CommodityList", Vector2(0, 0), ui.WindowFlags{"NoScrollbar"}, function()
|
||||
for _, info in ipairs(commList) do
|
||||
ui.text(rawget(lcomm, info[1]) or '[NO_JSON]'..info[1])
|
||||
ui.text(rawget(lcomm, info[1]) or ('[NO_JSON]'..info[1]))
|
||||
if showOther and math.abs(info[3] - info[2]) > major_import then
|
||||
ui.sameLine(width - iconWidth * 3)
|
||||
local profit = info[3] - info[2] > 0.0
|
||||
|
@ -101,7 +101,7 @@ function systemEconView.drawEconList(commList, illegalList, showOther)
|
|||
ui.spacing()
|
||||
|
||||
for _, info in ipairs(illegalList) do
|
||||
ui.text(rawget(lcomm, info[1]) or '[NO_JSON]'..info[1])
|
||||
ui.text(rawget(lcomm, info[1]) or ('[NO_JSON]'..info[1]))
|
||||
|
||||
-- only display illegal icon if the commodity is actually legal in the other system
|
||||
if showOther and info[2] or info[3] then
|
||||
|
|
|
@ -7,7 +7,7 @@ local Event = require 'Event'
|
|||
local Lang = require 'Lang'
|
||||
local ui = require 'pigui'
|
||||
local Format = require 'Format'
|
||||
local Input = require 'Input'
|
||||
local Constants = _G.Constants
|
||||
|
||||
local Vector2 = _G.Vector2
|
||||
local lc = Lang.GetResource("core")
|
||||
|
@ -181,7 +181,7 @@ local Windows = {
|
|||
|
||||
function Windows.edgeButtons.Show()
|
||||
-- view control buttons
|
||||
if ui.coloredSelectedIconButton(icons.reset_view, mainButtonSize, showShips, mainButtonFramePadding, svColor.BUTTON_ACTIVE, svColor.BUTTON_INK, lc.RESET_ORIENTATION_AND_ZOOM) then
|
||||
if ui.coloredSelectedIconButton(icons.reset_view, mainButtonSize, false, mainButtonFramePadding, svColor.BUTTON_ACTIVE, svColor.BUTTON_INK, lc.RESET_ORIENTATION_AND_ZOOM) then
|
||||
systemView:SetVisibility("RESET_VIEW")
|
||||
end
|
||||
ui.coloredSelectedIconButton(icons.rotate_view, mainButtonSize, false, mainButtonFramePadding, svColor.BUTTON_ACTIVE, svColor.BUTTON_INK, luc.ROTATE_VIEW)
|
||||
|
@ -190,24 +190,24 @@ function Windows.edgeButtons.Show()
|
|||
systemView:SetZoomMode(ui.isItemActive())
|
||||
ui.text("")
|
||||
-- visibility control buttons
|
||||
if ui.coloredSelectedIconButton(buttonState[ship_drawing].icon, mainButtonSize, showShips, mainButtonFramePadding, buttonState[ship_drawing].color, svColor.BUTTON_INK, lc.SHIPS_DISPLAY_MODE_TOGGLE) then
|
||||
if ui.coloredSelectedIconButton(buttonState[ship_drawing].icon, mainButtonSize, false, mainButtonFramePadding, buttonState[ship_drawing].color, svColor.BUTTON_INK, lc.SHIPS_DISPLAY_MODE_TOGGLE) then
|
||||
ship_drawing = nextShipDrawings[ship_drawing]
|
||||
systemView:SetVisibility(ship_drawing)
|
||||
end
|
||||
if ui.coloredSelectedIconButton(buttonState[show_lagrange].icon, mainButtonSize, showLagrangePoints, mainButtonFramePadding, buttonState[show_lagrange].color, svColor.BUTTON_INK, lc.L4L5_DISPLAY_MODE_TOGGLE) then
|
||||
if ui.coloredSelectedIconButton(buttonState[show_lagrange].icon, mainButtonSize, false, mainButtonFramePadding, buttonState[show_lagrange].color, svColor.BUTTON_INK, lc.L4L5_DISPLAY_MODE_TOGGLE) then
|
||||
show_lagrange = nextShowLagrange[show_lagrange]
|
||||
systemView:SetVisibility(show_lagrange)
|
||||
end
|
||||
if ui.coloredSelectedIconButton(buttonState[show_grid].icon, mainButtonSize, showShips, mainButtonFramePadding, buttonState[show_grid].color, svColor.BUTTON_INK, lc.GRID_DISPLAY_MODE_TOGGLE) then
|
||||
if ui.coloredSelectedIconButton(buttonState[show_grid].icon, mainButtonSize, false, mainButtonFramePadding, buttonState[show_grid].color, svColor.BUTTON_INK, lc.GRID_DISPLAY_MODE_TOGGLE) then
|
||||
show_grid = nextShowGrid[show_grid]
|
||||
systemView:SetVisibility(show_grid)
|
||||
end
|
||||
ui.text("")
|
||||
-- windows control buttons
|
||||
if ui.coloredSelectedIconButton(icons.info, mainButtonSize, showShips, mainButtonFramePadding, buttonState[Windows.objectInfo.visible].color, svColor.BUTTON_INK, lc.OBJECT_INFO) then
|
||||
if ui.coloredSelectedIconButton(icons.info, mainButtonSize, false, mainButtonFramePadding, buttonState[Windows.objectInfo.visible].color, svColor.BUTTON_INK, lc.OBJECT_INFO) then
|
||||
Windows.objectInfo.visible = not Windows.objectInfo.visible
|
||||
end
|
||||
if ui.coloredSelectedIconButton(icons.semi_major_axis, mainButtonSize, showShips, mainButtonFramePadding, buttonState[Windows.orbitPlanner.visible].color, svColor.BUTTON_INK, lc.ORBIT_PLANNER) then
|
||||
if ui.coloredSelectedIconButton(icons.semi_major_axis, mainButtonSize, false, mainButtonFramePadding, buttonState[Windows.orbitPlanner.visible].color, svColor.BUTTON_INK, lc.ORBIT_PLANNER) then
|
||||
Windows.orbitPlanner.visible = not Windows.orbitPlanner.visible
|
||||
end
|
||||
end
|
||||
|
@ -309,6 +309,7 @@ local function getBodyIcon(obj)
|
|||
elseif body:IsCargoContainer() then
|
||||
return icons.rocky_planet -- TODO: better icon
|
||||
else
|
||||
local t, st = body.type, body.superType
|
||||
print("system-view-ui.lua: getBodyIcon not sure how to process body, supertype: " .. (st and st or "nil") .. ", type: " .. (t and t or "nil"))
|
||||
--utils.print_r(body)
|
||||
return icons.ship
|
||||
|
@ -486,7 +487,7 @@ function Windows.objectInfo.Show()
|
|||
ui.sameLine()
|
||||
ui.text(lc.OBJECT_INFO)
|
||||
ui.separator()
|
||||
obj = systemView:GetSelectedObject()
|
||||
local obj = systemView:GetSelectedObject()
|
||||
if obj.type ~= Projectable.OBJECT or obj.base ~= Projectable.SHIP and obj.base ~= Projectable.SYSTEMBODY then return end
|
||||
local data
|
||||
-- system body
|
||||
|
|
|
@ -37,7 +37,7 @@ local function displayTimeWindow()
|
|||
local current = Game.GetTimeAcceleration()
|
||||
local requested = Game.GetRequestedTimeAcceleration()
|
||||
|
||||
function accelButton(name, key)
|
||||
local function accelButton(name, key)
|
||||
local color = bg_color
|
||||
if requested == name and current ~= name then
|
||||
color = colors.white
|
||||
|
@ -47,7 +47,7 @@ local function displayTimeWindow()
|
|||
if time == "paused" then
|
||||
time = lc.PAUSED
|
||||
end
|
||||
tooltip = string.interp(lui.HUD_REQUEST_TIME_ACCEL, { time = time })
|
||||
local tooltip = string.interp(lui.HUD_REQUEST_TIME_ACCEL, { time = time })
|
||||
if ui.coloredSelectedIconButton(icons['time_accel_' .. name], button_size, current == name, frame_padding, color, fg_color, tooltip)
|
||||
or (ui.shiftHeld() and ui.isKeyReleased(key)) then
|
||||
Game.SetTimeAcceleration(name, ui.ctrlHeld() or ui.isMouseDown(1))
|
||||
|
|
|
@ -283,7 +283,7 @@ theme.icons = {
|
|||
filter_stations = 108,
|
||||
filter_ships = 109,
|
||||
lagrange_marker = 110,
|
||||
system_overview = 111,
|
||||
system_overview_vertical = 111,
|
||||
-- eighth row
|
||||
heavy_freighter = 112,
|
||||
medium_freighter = 113,
|
||||
|
|
|
@ -250,7 +250,7 @@ local function displayScreenshotInfo()
|
|||
end
|
||||
end
|
||||
|
||||
local function drawGameModules()
|
||||
local function drawGameModules(delta_t)
|
||||
for i, module in ipairs(gameView.modules) do
|
||||
local shouldDraw = not Game.InHyperspace() or module.showInHyperspace
|
||||
if (not module.disabled) and shouldDraw then
|
||||
|
@ -281,7 +281,7 @@ ui.registerHandler('game', function(delta_t)
|
|||
gameView.center = Vector2(ui.screenWidth / 2, ui.screenHeight / 2)
|
||||
if ui.shouldDrawUI() then
|
||||
if Game.CurrentView() == "world" then
|
||||
drawGameModules(gameView.modules)
|
||||
drawGameModules(delta_t)
|
||||
ui.radialMenu("worldloopworld")
|
||||
else
|
||||
ui.radialMenu("worldloopnotworld")
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
-- Copyright © 2008-2020 Pioneer Developers. See AUTHORS.txt for details
|
||||
-- Licensed under the terms of the GPL v3. See licenses/GPL-3.txt
|
||||
|
||||
local Engine = import("Engine")
|
||||
local Lang = import("Lang")
|
||||
local Engine = require 'Engine'
|
||||
local Lang = require 'Lang'
|
||||
|
||||
local ui = Engine.ui
|
||||
local l = Lang.GetResource("ui-core");
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
-- Copyright © 2008-2020 Pioneer Developers. See AUTHORS.txt for details
|
||||
-- Licensed under the terms of the GPL v3. See licenses/GPL-3.txt
|
||||
|
||||
local Engine = import("Engine")
|
||||
local Lang = import("Lang")
|
||||
local Event = import("Event")
|
||||
local Engine = require 'Engine'
|
||||
local Lang = require 'Lang'
|
||||
local Event = require 'Event'
|
||||
|
||||
local TabView = import("ui/TabView")
|
||||
local TabView = require 'ui.TabView'
|
||||
|
||||
local shipInfo = import("ui/InfoView/ShipInfo")
|
||||
local econTrade = import("ui/InfoView/EconTrade")
|
||||
local missions = import("ui/InfoView/Missions")
|
||||
local crewRoster = import("ui/InfoView/CrewRoster")
|
||||
local orbitalAnalysis = import("ui/InfoView/OrbitalAnalysis")
|
||||
local shipInfo = require 'ui.InfoView.ShipInfo'
|
||||
local econTrade = require 'ui.InfoView.EconTrade'
|
||||
local missions = require 'ui.InfoView.Missions'
|
||||
local crewRoster = require 'ui.InfoView.CrewRoster'
|
||||
local orbitalAnalysis = require 'ui.InfoView.OrbitalAnalysis'
|
||||
|
||||
local piInfoView = import("pigui/views/info-view")
|
||||
local piInfoView = require 'pigui.views.info-view'
|
||||
|
||||
local ui = Engine.ui
|
||||
local l = Lang.GetResource("ui-core");
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
-- Copyright © 2008-2020 Pioneer Developers. See AUTHORS.txt for details
|
||||
-- Licensed under the terms of the GPL v3. See licenses/GPL-3.txt
|
||||
|
||||
local Engine = import("Engine")
|
||||
local Lang = import("Lang")
|
||||
local Game = import("Game")
|
||||
local Format = import("Format")
|
||||
local ShipDef = import("ShipDef")
|
||||
local Comms = import("Comms")
|
||||
local Equipment = import("Equipment")
|
||||
local Engine = require 'Engine'
|
||||
local Lang = require 'Lang'
|
||||
local Game = require 'Game'
|
||||
local Format = require 'Format'
|
||||
local ShipDef = require 'ShipDef'
|
||||
local Comms = require 'Comms'
|
||||
local Equipment = require 'Equipment'
|
||||
|
||||
|
||||
local InfoFace = import("ui/InfoFace")
|
||||
local SmallLabeledButton = import("ui/SmallLabeledButton")
|
||||
local InfoFace = require 'ui.InfoFace'
|
||||
local SmallLabeledButton = require 'ui.SmallLabeledButton'
|
||||
|
||||
local ui = Engine.ui
|
||||
local l = Lang.GetResource("ui-core");
|
||||
|
@ -65,7 +65,7 @@ local crewRoster = function ()
|
|||
local hullMassLeft = Game.player.hullMassLeft
|
||||
local hullDamage = hullMass - hullMassLeft
|
||||
if hullDamage > 0 then
|
||||
if Game.player:CountEquip(Equipment.cargo.metal_alloys, cargo) <= 0 then
|
||||
if Game.player:CountEquip(Equipment.cargo.metal_alloys, "cargo") <= 0 then
|
||||
feedback:SetText(l.NOT_ENOUGH_ALLOY_TO_ATTEMPT_A_REPAIR:interp({alloy = l.METAL_ALLOYS}))
|
||||
return
|
||||
end
|
||||
|
@ -74,7 +74,7 @@ local crewRoster = function ()
|
|||
local repair = math.min(
|
||||
-- Need metal alloys for repair. Check amount.
|
||||
math.ceil(hullDamage/(64 - result)), -- 65 > result > 3
|
||||
Game.player:CountEquip(Equipment.cargo.metal_alloys, cargo)
|
||||
Game.player:CountEquip(Equipment.cargo.metal_alloys, "cargo")
|
||||
)
|
||||
Game.player:RemoveEquip(Equipment.cargo.metal_alloys, repair) -- These will now be part of the hull.
|
||||
local repairPercent = math.min(math.ceil(100 * (repair + hullMassLeft) / hullMass), 100) -- Get new hull percentage...
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
-- Copyright © 2008-2020 Pioneer Developers. See AUTHORS.txt for details
|
||||
-- Licensed under the terms of the GPL v3. See licenses/GPL-3.txt
|
||||
|
||||
local Engine = import("Engine")
|
||||
local Lang = import("Lang")
|
||||
local Game = import("Game")
|
||||
local Equipment = import("Equipment")
|
||||
local ShipDef = import("ShipDef")
|
||||
local Engine = require 'Engine'
|
||||
local Lang = require 'Lang'
|
||||
local Game = require 'Game'
|
||||
local Equipment = require 'Equipment'
|
||||
local ShipDef = require 'ShipDef'
|
||||
|
||||
local SmallLabeledButton = import("ui/SmallLabeledButton")
|
||||
local InfoGauge = import("ui/InfoGauge")
|
||||
local SmallLabeledButton = require 'ui.SmallLabeledButton'
|
||||
local InfoGauge = require 'ui.InfoGauge'
|
||||
|
||||
local ui = Engine.ui
|
||||
local l = Lang.GetResource("ui-core");
|
||||
|
@ -30,7 +30,7 @@ local econTrade = function ()
|
|||
-- Make a cargo list widget that we can revisit and update
|
||||
local cargoListWidget = ui:Margin(0)
|
||||
|
||||
function updateCargoListWidget ()
|
||||
local function updateCargoListWidget ()
|
||||
|
||||
local cargoNameColumn = {}
|
||||
local cargoQuantityColumn = {}
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
-- Copyright © 2008-2020 Pioneer Developers. See AUTHORS.txt for details
|
||||
-- Licensed under the terms of the GPL v3. See licenses/GPL-3.txt
|
||||
|
||||
local Engine = import("Engine")
|
||||
local Lang = import("Lang")
|
||||
local Game = import("Game")
|
||||
local Format = import("Format")
|
||||
local Character = import("Character")
|
||||
local Engine = require 'Engine'
|
||||
local Lang = require 'Lang'
|
||||
local Game = require 'Game'
|
||||
local Format = require 'Format'
|
||||
local Character = require 'Character'
|
||||
|
||||
local SmallLabeledButton = import("ui/SmallLabeledButton")
|
||||
local SmartTable = import("ui/SmartTable")
|
||||
local SmallLabeledButton = require 'ui.SmallLabeledButton'
|
||||
local SmartTable = require 'ui.SmartTable'
|
||||
|
||||
local ui = Engine.ui
|
||||
local l = Lang.GetResource("ui-core");
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
-- Copyright © 2008-2020 Pioneer Developers. See AUTHORS.txt for details
|
||||
-- Licensed under the terms of the GPL v3. See licenses/GPL-3.txt
|
||||
|
||||
local Engine = import("Engine")
|
||||
local Lang = import("Lang")
|
||||
local Game = import("Game")
|
||||
local Space = import("Space")
|
||||
local Engine = require 'Engine'
|
||||
local Lang = require 'Lang'
|
||||
local Game = require 'Game'
|
||||
local Space = require 'Space'
|
||||
|
||||
local ui = Engine.ui
|
||||
local l = Lang.GetResource("ui-core");
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
-- Copyright © 2008-2020 Pioneer Developers. See AUTHORS.txt for details
|
||||
-- Licensed under the terms of the GPL v3. See licenses/GPL-3.txt
|
||||
|
||||
local Engine = import("Engine")
|
||||
local Lang = import("Lang")
|
||||
local Game = import("Game")
|
||||
local Equipment = import("Equipment")
|
||||
local ShipDef = import("ShipDef")
|
||||
local Engine = require 'Engine'
|
||||
local Lang = require 'Lang'
|
||||
local Game = require 'Game'
|
||||
local Equipment = require 'Equipment'
|
||||
local ShipDef = require 'ShipDef'
|
||||
|
||||
local ui = Engine.ui
|
||||
local l = Lang.GetResource("ui-core");
|
||||
|
|
Loading…
Reference in New Issue