Skip to content

Commit

Permalink
Don't add a docking flight log when the player starts the game in a s…
Browse files Browse the repository at this point in the history
…tation.
  • Loading branch information
JonBooth78 committed Oct 5, 2023
1 parent 2d516c3 commit ae8986e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
16 changes: 16 additions & 0 deletions data/libs/FlightLog.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ local Lang = require 'Lang'
local l = Lang.GetResource("ui-core")
-- end of formating / localisation stuff

---@type boolean|nil If true then we've just started a game so don't record the first docking callback
local skip_first_docking = nil


-- default values (private)
---@type integer
local MaxTotalDefaultElements = 3000
Expand Down Expand Up @@ -474,6 +478,11 @@ FlightLog = {

}



function FlightLog.SkipFirstDocking()
skip_first_docking = true
end
--
-- Method: GetLogEntries
--
Expand Down Expand Up @@ -616,6 +625,13 @@ end
local AddStationToLog = function (ship, station)
if not ship:IsPlayer() then return end

-- could check the game time and see if it's the same as the last custom event
-- and there is nothing else in the list and avoud the phantom 'first docking'
-- that way too.
if skip_first_docking then
skip_first_docking = nil
return
end
table.insert( FlightLogData, 1, StationLogEntry.New( station.path, Game.time, Game.player:GetMoney(), nil ) );
TrimLogSize()
end
Expand Down
1 change: 1 addition & 0 deletions data/pigui/modules/new-game-window/class.lua
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ local function startGame(gameParams)

-- XXX horrible hack here to avoid paying a spawn-in docking fee
player:setprop("is_first_spawn", true)
FlightLog.SkipFirstDocking()
FlightLog.MakeCustomEntry(gameParams.player.log)

if gameParams.autoExec then
Expand Down

0 comments on commit ae8986e

Please sign in to comment.