@@ -217,16 +217,26 @@ local function transfer_hyperfuel_mil(hyperdrive, amt)
217217end
218218
219219local function fuelTransferButton (drive , amt )
220- local icon = amt < 0 and icons . chevron_down or icons . chevron_up
220+ local driveEnabled = false
221221
222- if ui .button (ui .get_icon_glyph (icon ) .. tostring (math.abs (amt ))) then
222+ -- Don't allow transferring fuel while the hyperdrive is doing its thing
223+ if Game .player :IsHyperspaceActive () or
224+ Game .player .flightState == " JUMPING" or
225+ Game .player .flightState == " HYPERSPACE" then
226+ driveEnabled = true
227+ end
223228
224- if drive .fuel == Commodities .hydrogen then
225- transfer_hyperfuel_hydrogen (drive , amt )
226- elseif drive .fuel == Commodities .military_fuel then
227- transfer_hyperfuel_mil (drive , amt )
228- end
229+ local color = driveEnabled and ui .theme .buttonColors .disabled or ui .theme .buttonColors .default
230+ local icon = amt < 0 and icons .chevron_down or icons .chevron_up
229231
232+ if ui .button (ui .get_icon_glyph (icon ) .. tostring (math.abs (amt )), Vector2 (100 , 0 ), color ) then
233+ if not driveEnabled then
234+ if drive .fuel == Commodities .hydrogen then
235+ transfer_hyperfuel_hydrogen (drive , amt )
236+ elseif drive .fuel == Commodities .military_fuel then
237+ transfer_hyperfuel_mil (drive , amt )
238+ end
239+ end
230240 end
231241end
232242
@@ -246,9 +256,6 @@ local function drawCentered(id, fun)
246256end
247257
248258local function drawFuelTransfer (drive )
249- -- Don't allow transferring fuel while the hyperdrive is doing its thing
250- if Game .player :IsHyperspaceActive () then return end
251-
252259 drawCentered (" Hyperdrive" , function ()
253260 ui .horizontalGroup (function ()
254261 fuelTransferButton (drive , 10 )
0 commit comments