From e4629cf965513cac4a332dc0f20bc5be96cc474c Mon Sep 17 00:00:00 2001 From: LevFendi Date: Sun, 1 Mar 2026 01:08:30 +0300 Subject: [PATCH 1/2] Fix removed rendering.set_color and rendering.is_valid APIs for Factorio 2.0 Co-Authored-By: Claude Sonnet 4.6 --- scripts/graphics.lua | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/scripts/graphics.lua b/scripts/graphics.lua index a69df068..ba40858f 100644 --- a/scripts/graphics.lua +++ b/scripts/graphics.lua @@ -274,13 +274,9 @@ function mod.set_cursor_colors_to_player_colors(pindex) local p = game.get_player(pindex) local vp = Viewpoint.get_viewpoint(pindex) local h_tile = vp:get_cursor_tile_highlight_box() - if h_tile ~= nil and h_tile.valid then rendering.set_color(h_tile, p.color) end - if - storage.players[pindex].building_footprint ~= nil - and rendering.is_valid(storage.players[pindex].building_footprint) - then - rendering.set_color(storage.players[pindex].building_footprint, p.color) - end + if h_tile ~= nil and h_tile.valid then h_tile.color = p.color end + local footprint = storage.players[pindex].building_footprint + if footprint ~= nil and footprint.valid then footprint.color = p.color end end return mod From 1a13269f620dabe5595652bc6761126ff7fb534e Mon Sep 17 00:00:00 2001 From: LevFendi Date: Sun, 1 Mar 2026 01:10:43 +0300 Subject: [PATCH 2/2] Fix health-bar crash for logged-out players in multiplayer get_inventory can return nil for logged-out players whose character is still in the world. Co-Authored-By: Claude Sonnet 4.6 --- scripts/sonifiers/health-bar.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/sonifiers/health-bar.lua b/scripts/sonifiers/health-bar.lua index 2f22a208..404e952e 100644 --- a/scripts/sonifiers/health-bar.lua +++ b/scripts/sonifiers/health-bar.lua @@ -117,7 +117,7 @@ local function get_current_state(pindex) local shield_pct = nil local armor_inv = player.get_inventory(defines.inventory.character_armor) - if armor_inv[1] and armor_inv[1].valid_for_read and armor_inv[1].grid then + if armor_inv and armor_inv[1] and armor_inv[1].valid_for_read and armor_inv[1].grid then local grid = armor_inv[1].grid if grid.valid and grid.max_shield > 0 then shield_pct = math.floor((grid.shield / grid.max_shield) * 100 + 0.5)