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 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)