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

Three Fixes #193

Merged
merged 2 commits into from
Nov 21, 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
3 changes: 3 additions & 0 deletions script/GameObjects/Entities/Ship/Thruster.lua
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,12 @@ end

function Thruster:render(state)
if state.mode == BlendMode.Additive then
--[[
-- This test (added to improve performance?) needs to be rethought as it is causing a crash when any ship -- player or NPC -- is destroyed.
if self.parent:getOwner():getControlling() == GameState.player.currentShip and GameState.player.currentCamera == Enums.CameraMode.FirstPerson then
Copy link
Member

@IllustrisJack IllustrisJack Nov 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it´s prob better to use a multiline comment so that the formatter doesn´t destroy it again ;)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually did at first, and changed it back, because my editor didn't like it. Updated now.

return
end
]]--

local a = math.abs(self.activation)
if a < 1e-3 then return end
Expand Down
9 changes: 2 additions & 7 deletions script/States/App/LTheoryRedux.lua
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,6 @@ function LTheoryRedux:onInput()
end

if InputInstance:isPressed(Button.KeyboardF) then
GameState:SetState(Enums.GameStates.InGame)

-- Insert the game view into the application canvas to make it visible
self.gameView = Systems.Overlay.GameView(self.player, self.audio)
GameState.render.gameView = self.gameView
Expand All @@ -144,6 +142,8 @@ function LTheoryRedux:onInput()
:add(Systems.Controls.Controls.MasterControl(self.gameView, self.player))
)
self.gameView:setCameraMode(Enums.CameraMode.FirstPerson)

GameState:SetState(Enums.GameStates.InGame)
end
end
end
Expand Down Expand Up @@ -430,11 +430,6 @@ function LTheoryRedux:showShipCreationHint()
Gui:setAlignment(AlignHorizontal.Center, AlignVertical.Center)
end

function LTheoryRedux:showShipCreationHint()
Gui:textEx(Cache.Font('Exo2', 32), '[B]: Random Ship | [F]: Spawn', 1.0, 1.0, 1.0, 1.0)
Gui:setAlignment(AlignHorizontal.Center, AlignVertical.Center)
end

function LTheoryRedux:exitGame()
-- Update Session vars ; temporary until we have a save state
GameState.player.startupCamera = GameState.player.currentCamera
Expand Down
6 changes: 3 additions & 3 deletions script/States/Application.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ function Application:appInit()
WindowInstance:setCenteredPosition()
WindowInstance:setSize(self.resX, self.resY)

self.audio = Audio.Create()
self.audiofx = Audio.Create()
self.audio = Audio.Create()
self.audiofx = Audio.Create()

GameState.render.gameWindow = WindowInstance

self.exit = false
self.exit = false

WindowInstance:setPresentMode(GameState.render.presentMode)

Expand Down
2 changes: 1 addition & 1 deletion script/States/ApplicationBindings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ local self = {
CameraOrbit = Button.KeyboardF3,
Exit = Button.SystemExit, -- Modifier.Ctrl + Button.W or Modifier.Alt + Button.Q

All = Control.Or(
All = Control.Or(
Control.Key(Button.KeyboardA),
Control.Key(Button.KeyboardB),
Control.Key(Button.KeyboardC),
Expand Down
26 changes: 13 additions & 13 deletions script/Systems/Controls/Bindings/ShipBindings.lua
Original file line number Diff line number Diff line change
@@ -1,71 +1,71 @@
local Control = require('Systems.Controls.Control')

local self = {
ThrustX = Control.Or(
ThrustX = Control.Or(
Control.Pair(
Control.Key(Button.KeyboardD),
Control.Key(Button.KeyboardA)),
Control.GamepadAxis(Button.GamepadLeftStickX)),

ThrustZ = Control.Or(
ThrustZ = Control.Or(
Control.Pair(
Control.Key(Button.KeyboardW),
Control.Key(Button.KeyboardS)),
Control.GamepadAxis(Button.GamepadLeftStickY)),

ThrustY = Control.Or(
ThrustY = Control.Or(
Control.Pair(
Control.Key(Button.KeyboardSpace),
Control.Ctrl()),
Control.Pair(
Control.GamepadAxis(Button.GamepadDPadUp),
Control.GamepadAxis(Button.GamepadDPadDown))),

Roll = Control.Or(
Roll = Control.Or(
Control.Pair(
Control.Key(Button.KeyboardE),
Control.Key(Button.KeyboardQ)),
Control.Pair(
Control.GamepadButton(Button.GamepadRightTrigger2),
Control.GamepadButton(Button.GamepadLeftTrigger2))),

Yaw = Control.Or(
Yaw = Control.Or(
Control.MouseX(),
Control.GamepadAxis(Button.GamepadRightStickX)),

Pitch = Control.Or(
Pitch = Control.Or(
Control.MouseY():invert(),
Control.GamepadAxis(Button.GamepadRightStickY):invert()),

Boost = Control.Or(
Boost = Control.Or(
Control.Shift(),
Control.GamepadAxis(Button.GamepadLeftTrigger)),

Fire = Control.Or(
Fire = Control.Or(
Control.MouseButton(Button.MouseLeft),
Control.GamepadAxis(Button.GamepadRightTrigger)),

LockTarget = Control.Or(
LockTarget = Control.Or(
Control.Key(Button.KeyboardT),
Control.GamepadButton(Button.GamepadWest))
:delta(),

ClearTarget = Control.Or(
ClearTarget = Control.Or(
Control.Key(Button.KeyboardG),
Control.GamepadButton(Button.GamepadEast))
:delta(),

NearestTarget = Control.Or(
NearestTarget = Control.Or(
Control.Key(Button.KeyboardN),
Control.GamepadButton(Button.GamepadWest))
:delta(),

Dock = Control.Or(
Dock = Control.Or(
Control.Key(Button.KeyboardF),
Control.GamepadButton(Button.GamepadNorth))
:delta(),

Undock = Control.Or(
Undock = Control.Or(
Control.Key(Button.KeyboardJ),
Control.GamepadButton(Button.GamepadSouth))
:delta(),
Expand Down
3 changes: 3 additions & 0 deletions script/Systems/SFX/MusicPlayer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,15 @@ end

function MusicPlayer:LoadEffects()
-- *** TEMP: Audio FX test START ***

--[[ -- Pulse weapon firing sound effect temporarily commented out until setVolume() is working
Config.audio.pulseFire = SFXObject:Create {
name = Config.audio.pulseFireName,
path = Config.paths.soundEffects .. Config.audio.pulseFireName,
volume = 0.0,
isLooping = false
}
]]

Config.audio.fxSensors = SFXObject:Create {
name = Config.audio.fxSensorsName,
Expand Down
4 changes: 3 additions & 1 deletion script/Systems/Universe/Universe.lua
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,9 @@ function Universe:CreateShip(system, pos, shipObject)
ship:setName(shipObject.shipName)

-- Insert ship into this star system
local spawnPosition = pos or Config.gen.origin
local spawnPosition = ship:getPos() -- use semi-randomly generated position from spawnShip()
Copy link
Member

@IllustrisJack IllustrisJack Nov 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I must have been pretty tired when i approved this :D - now that i think of this it´s kinda a bad fix, also generating a ship was working before, better we fix the bug u got in hud.lua instead

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also this change now bugs out the camera in that generation screen

if pos then spawnPosition = pos end -- unless a position was explicitly provided, in which case use that position

ship:setPos(spawnPosition)
ship:setFriction(shipObject.friction)
ship:setSleepThreshold(shipObject.sleepThreshold[1], shipObject.sleepThreshold[2])
Expand Down