From 2ce902437f3cf0c0a7443c438d690deff22af711 Mon Sep 17 00:00:00 2001 From: Brevven Date: Tue, 24 Dec 2024 15:49:04 -0800 Subject: [PATCH] fix runtime crash with Cerys --- changelog.txt | 5 +++++ control-util.lua | 9 ++++++++- info.json | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/changelog.txt b/changelog.txt index 01e8ba4..ab8ace3 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,4 +1,9 @@ --------------------------------------------------------------------------------------------------- +Version: 2.0.3 +Date: 2024-12-24 + Fixes: + - Fix runtime crash with Cerys mod +--------------------------------------------------------------------------------------------------- Version: 2.0.2 Date: 2024-12-24 Fixes: diff --git a/control-util.lua b/control-util.lua index d6b863a..bf45beb 100644 --- a/control-util.lua +++ b/control-util.lua @@ -99,7 +99,14 @@ end -- https://forums.factorio.com/viewtopic.php?f=7&t=124996&p=655013#p655013 function util.ore_workaround(event) for i, ore in pairs(util.me.ores_for_workaround) do - if event.surface.map_gen_settings.autoplace_controls["titanium-ore"] then return end + if ( + event.surface and + event.surface.map_gen_settings and + event.surface.map_gen_settings.autoplace_controls and + event.surface.map_gen_settings.autoplace_controls["titanium-ore"] + ) then + return + end if event.surface.name ~= "nauvis" then return end if math.random() < settings.global[util.me.name.."-ore-workaround-probability"].value then util.generate_ore(event, ore.name, ore.amount, ore.tiles) diff --git a/info.json b/info.json index 001a946..d68778d 100644 --- a/info.json +++ b/info.json @@ -1,6 +1,6 @@ { "name": "bztitanium", - "version": "2.0.2", + "version": "2.0.3", "factorio_version": "2.0", "title": "Titanium", "author": "Brevven",