From fd981d0600c4247ccbc23edb92031960ba8a56c4 Mon Sep 17 00:00:00 2001 From: EphDoering <12696697+EphDoering@users.noreply.github.com> Date: Sat, 9 Jul 2022 09:15:15 -0400 Subject: [PATCH] Fixes for crashes blindbat84 reported. --- mods/FactorioAccess_0.0.1/control.lua | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/mods/FactorioAccess_0.0.1/control.lua b/mods/FactorioAccess_0.0.1/control.lua index 887c37ed..bd8e1394 100644 --- a/mods/FactorioAccess_0.0.1/control.lua +++ b/mods/FactorioAccess_0.0.1/control.lua @@ -2832,15 +2832,17 @@ function move(direction,pindex) end players[pindex].position = new_pos players[pindex].cursor_pos = offset_position(players[pindex].cursor_pos, direction,1) - if players[pindex].tile.previous ~= nil and players[pindex].tile.previous.type == "transport-belt" then - game.get_player(pindex).play_sound{path = "utility/metal_walking_sound"} - game.get_player(pindex).play_sound{path = "utility/metal_walking_sound"} + if players[pindex].tile.previous ~= nil + and players[pindex].tile.previous.valid + and players[pindex].tile.previous.type == "transport-belt" + then game.get_player(pindex).play_sound{path = "utility/metal_walking_sound"} else local tile = game.get_player(pindex).surface .get_tile(new_pos.x, new_pos.y) - game.get_player(pindex).play_sound{path = "tile-walking/" .. tile.name} - game.get_player(pindex).play_sound{path = "tile-walking/" .. tile.name} - game.get_player(pindex).play_sound{path = "tile-walking/" .. tile.name} + local sound_path = "tile-walking/" .. tile.name + if game.is_valid_sound_path(sound_path) then + game.get_player(pindex).play_sound{path = "tile-walking/" .. tile.name} + end end read_tile(pindex) target(pindex)