Skip to content

Commit

Permalink
Fix station data not being initialized on game start
Browse files Browse the repository at this point in the history
- Since the onShipDocked event is no longer emitted when a game starts with the player docked, we need to create the starting station data separately
  • Loading branch information
sturnclaw committed Jan 14, 2024
1 parent 5e7314b commit eb27c55
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion data/libs/SpaceStation.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1008,7 +1008,7 @@ Event.Register("onGameStart", function ()

visited = loaded_data.visited or {}
police = loaded_data.police

for station,_ in pairs(visited) do
createCommodityStock(station)
end
Expand All @@ -1031,6 +1031,12 @@ Event.Register("onGameStart", function ()
loaded_data = nil
end

local station = Game.player:GetDockedWith()

if station and station:isa("SpaceStation") and not visited[station] then
createStationData(station)
end

Timer:CallEvery(3600, updateSystem)
end)

Expand Down

0 comments on commit eb27c55

Please sign in to comment.