Skip to content

Commit

Permalink
Merge pull request #193 from Limit-Theory-Redux/Flat/framework
Browse files Browse the repository at this point in the history
Three Fixes
  • Loading branch information
Flatfingers authored Nov 21, 2023
2 parents bd7aca0 + 6dc0bff commit a81dcd3
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 25 deletions.
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
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()
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

0 comments on commit a81dcd3

Please sign in to comment.