diff --git a/changelog.txt b/changelog.txt index 7af22c0d..1b064e82 100644 --- a/changelog.txt +++ b/changelog.txt @@ -13,6 +13,7 @@ Date: ??? - Fixed that dingrit mk2,mk3,mk4 module recipes were not outputting any empty cages - Moved all aerial turbine code to pyAE - fixed digosaurus being recorded in kill statistics + - fixed crash when mixing oculas and factorissimo 2 (https://github.com/pyanodon/pybugreports/issues/336) --------------------------------------------------------------------------------------------------- Version: 2.1.9 Date: 2023-9-4 diff --git a/scripts/ocula/ocula.lua b/scripts/ocula/ocula.lua index 1d5b6335..ea912806 100644 --- a/scripts/ocula/ocula.lua +++ b/scripts/ocula/ocula.lua @@ -21,7 +21,12 @@ Oculua.events.on_init = function() end function Oculua.set_target(oculua_data, target) - oculua_data.entity.set_command{ + local entity = oculua_data.entity + if entity.surface_index ~= target.surface_index then + Oculua.go_home(oculua_data) + return + end + entity.set_command{ type = defines.command.go_to_location, destination_entity = target, radius = Oculua.range, @@ -232,7 +237,12 @@ end function Oculua.go_home(oculua_data) local ipod = oculua_data.ipod if not ipod or not ipod.valid then Oculua.wander(oculua_data); return end - oculua_data.entity.set_command{ + local entity = oculua_data.entity + if not ipod or not ipod.valid or ipod.surface_index ~= entity.surface_index then + Oculua.wander(oculua_data) + return + end + entity.set_command{ type = defines.command.go_to_location, destination_entity = ipod, radius = 0.5,