Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix small errors, adjust orbitscanner balance #5515

Merged
merged 7 commits into from
Feb 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion data/libs/Equipment.lua
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ misc.orbitscanner_good = BodyScannerType.New({
capabilities={mass=7,sensor=1}, purchasable=true, tech_level=8,
max_range=100000000, target_altitude=0, state="HALTED", progress=0,
bodyscanner_stats={scan_speed=3, scan_tolerance=0.05},
stats={ aperture = 2.2, minAltitude = 1750000, resolution = 11375, orbital = true },
stats={ aperture = 2.8, minAltitude = 1750000, resolution = 12375, orbital = true },
icon_name="equip_orbit_scanner"
})

Expand Down
8 changes: 6 additions & 2 deletions data/libs/Ship.lua
Original file line number Diff line number Diff line change
Expand Up @@ -885,12 +885,15 @@ local onGameStart = function ()
if loaded_data then
CrewRoster = loaded_data
Event.Queue('crewAvailable') -- Signal any scripts that depend on initialised crew
else
CrewRoster = {}
end

loaded_data = nil
end

local onGameEnd = function()
CrewRoster = {}
Gliese852 marked this conversation as resolved.
Show resolved Hide resolved
end

local serialize = function ()
-- Remove non-existent ships first, or the serializer will choke
for crewedShip,crew in pairs(CrewRoster) do
Expand Down Expand Up @@ -940,6 +943,7 @@ end
Event.Register("onEnterSystem", onEnterSystem)
Event.Register("onShipDestroyed", onShipDestroyed)
Event.Register("onGameStart", onGameStart)
Event.Register("onGameEnd", onGameEnd)
Event.Register("onShipTypeChanged", onShipTypeChanged)
Serializer:Register("ShipClass", serialize, unserialize)

Expand Down
2 changes: 1 addition & 1 deletion data/pigui/modules/info-view/02-personal-info.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ local orbiteer = ui.fonts.orbiteer
local colors = ui.theme.colors
local icons = ui.theme.icons

local textTable = require 'pigui/libs/text-table'
local textTable = require 'pigui.libs.text-table'

local l = Lang.GetResource("ui-core")

Expand Down
3 changes: 2 additions & 1 deletion data/pigui/modules/info-view/03-econ-trade.lua
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ end
local function cargolist ()
local count = cachedCargoList or rebuildCargoList()

ui.beginTable("cargoTable", 3, { "SizingFixedFit" })
if not ui.beginTable("cargoTable", 3, { "SizingFixedFit" }) then return end

ui.tableSetupColumn("Amount")
ui.tableSetupColumn("Name", { "WidthStretch" })
ui.tableSetupColumn("Jettison")
Expand Down
21 changes: 11 additions & 10 deletions data/pigui/modules/sidebar/cargo.lua
Original file line number Diff line number Diff line change
Expand Up @@ -252,17 +252,18 @@ function module:drawBody()

if cargoMgr:GetUsedSpace() > 0 then

ui.beginTable("cargo", 4)
ui.tableSetupColumn("Cargo")
ui.tableSetupColumn("Amount")
ui.tableSetupColumn("Gauge", { "WidthStretch" })
ui.tableSetupColumn("Buttons")

for _, v in ipairs(sortTable) do
self:drawCargoRow(v, maxWidth, totalSpace)
end
if ui.beginTable("cargo", 4) then
ui.tableSetupColumn("Cargo")
ui.tableSetupColumn("Amount")
ui.tableSetupColumn("Gauge", { "WidthStretch" })
ui.tableSetupColumn("Buttons")

for _, v in ipairs(sortTable) do
self:drawCargoRow(v, maxWidth, totalSpace)
end

ui.endTable()
ui.endTable()
end

else
ui.alignTextToButtonPadding()
Expand Down
8 changes: 8 additions & 0 deletions data/pigui/modules/station-view/02-bulletinBoard.lua
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,14 @@ bulletinBoard = Table.New("BulletinBoardTable", false, {
local ref = item.__ref
local ad = SpaceStation.adverts[station][ref]

-- TODO: if the player is watching the BBS while an ad expires, the ad
-- will be grayed-out but not removed until the player clicks on
-- something.
if not ad then
refresh()
return
end

if Game.paused then
return
end
Expand Down
3 changes: 2 additions & 1 deletion data/pigui/modules/station-view/04-shipMarket.lua
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,8 @@ local tradeMenu = function()
ui.child("ShipSpecs", Vector2(0, 0), function()
ui.withStyleVars({ CellPadding = Vector2(8, 4) }, function()

ui.beginTable("specs", 4)
if not ui.beginTable("specs", 4) then return end

ui.tableSetupColumn("name1")
ui.tableSetupColumn("body1")
ui.tableSetupColumn("name2")
Expand Down
3 changes: 2 additions & 1 deletion data/pigui/modules/system-econ-view.lua
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,8 @@ function SystemEconView:drawPriceList(key, prices)
local iconSize = Vector2(ui.getTextLineHeight() + 4)
local out = nil

ui.beginTable("prices", 3)
if not ui.beginTable("prices", 3) then return end

ui.tableSetupColumn("Name", { "WidthStretch" })
ui.tableSetupColumn("Indicators")
ui.tableSetupColumn("Amount")
Expand Down
13 changes: 11 additions & 2 deletions data/pigui/views/mainmenu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ local Equipment = require 'Equipment'
local Format = require 'Format'
local MusicPlayer = require 'modules.MusicPlayer'
local Lang = require 'Lang'
local FlightLog = require ("FlightLog")
local Commodities = require("Commodities")
local FlightLog = require 'FlightLog'
local Commodities = require 'Commodities'
local Character = require 'Character'
local Vector2 = _G.Vector2

local lc = Lang.GetResource("core")
Expand Down Expand Up @@ -185,6 +186,14 @@ local function startAtLocation(location)

Game.player:SetMoney(location.money)

local ship = Game.player
-- Generate crew for the starting ship
for i = 2, ShipDef[ship.shipId].minCrew do
local newCrew = Character.New()
newCrew:RollNew(true)
ship:Enroll(newCrew)
end

if location.hyperdrive then
Game.player:AddEquip(hyperspace['hyperdrive_'..ShipDef[Game.player.shipId].hyperdriveClass])
end
Expand Down
4 changes: 2 additions & 2 deletions data/ships/skipjack.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
"scoop": 2,
"laser_front": 1,
"missile": 8,
"sensor": 1,
"sensor": 3,
"cargo": 140
},
"roles": ["mercenary", "merchant", "pirate", "courier"],

"effective_exhaust_velocity": 18900000,
"thruster_fuel_use": -1.0,
"fuel_tank_mass": 135,
Expand Down
2 changes: 1 addition & 1 deletion src/lua/LuaBody.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ static int l_body_get_altitude_rel_to(lua_State *l)
if (other && other->IsType(ObjectType::TERRAINBODY)) {
const TerrainBody *terrain = static_cast<const TerrainBody *>(other);
vector3d surface_pos = pos.Normalized();
double radius = 0.0;
double radius = terrain->GetSystemBody()->GetRadius();
if (center_dist <= 3.0 * terrain->GetMaxFeatureRadius()) {
radius = terrain->GetTerrainHeight(surface_pos);
}
Expand Down
2 changes: 1 addition & 1 deletion src/lua/LuaPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ static int l_get_gps(lua_State *l)
if (!playerFrame->IsRotFrame())
playerFrame = Frame::GetFrame(playerFrame->GetRotFrame());
vector3d surface_pos = pos.Normalized();
double radius = 0.0;
double radius = terrain->GetSystemBody()->GetRadius();
if (center_dist <= 3.0 * terrain->GetMaxFeatureRadius()) {
radius = terrain->GetTerrainHeight(surface_pos);
}
Expand Down
2 changes: 1 addition & 1 deletion src/ship/PlayerShipController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ REGISTER_INPUT_BINDING(PlayerShipController)
auto flightGroup = controlsPage->GetBindingGroup("ShipOrient");
input->AddAxisBinding("BindAxisPitch", flightGroup, Axis({}, { SDLK_k }, { SDLK_i }));
input->AddAxisBinding("BindAxisYaw", flightGroup, Axis({}, { SDLK_j }, { SDLK_l }));
input->AddAxisBinding("BindAxisRoll", flightGroup, Axis({}, { SDLK_u }, { SDLK_o }));
input->AddAxisBinding("BindAxisRoll", flightGroup, Axis({}, { SDLK_q }, { SDLK_e }));
input->AddActionBinding("BindKillRot", flightGroup, Action({ SDLK_p }, { SDLK_x }));
input->AddActionBinding("BindToggleRotationDamping", flightGroup, Action({ SDLK_v }));

Expand Down