Skip to content

Commit

Permalink
fix: Fixed cannot submerge a submarine in remote view. Resolves #46
Browse files Browse the repository at this point in the history
  • Loading branch information
notnotmelon committed Dec 6, 2024
1 parent 485c9de commit e1a1930
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions scripts/submarine.lua
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,12 @@ local function decend_or_ascend(submarine)
player.opened = submarine
end

if passenger then
if passenger and passenger.physical_vehicle == submarine then
passenger.teleport(target_position, target_surface, true)
maraxsis.execute_later("enter_submarine", 1, passenger, submarine)
end

if driver then
if driver and driver.physical_vehicle == submarine then
driver.teleport(target_position, target_surface, true)
maraxsis.execute_later("enter_submarine", 1, driver, submarine)
end
Expand All @@ -182,9 +182,9 @@ end
maraxsis.on_event("maraxsis-trench-submerge", function(event)
local player = game.get_player(event.player_index)
if not player then return end
local submarine = player.physical_vehicle
local submarine = player.vehicle

if submarine and SUBMARINES[submarine.name] and player.physical_surface == player.surface then
if submarine and SUBMARINES[submarine.name] then
decend_or_ascend(submarine)
end
end)
Expand Down

0 comments on commit e1a1930

Please sign in to comment.