From baf9e3f2df350cb6efe4179bf9a1ab4a289b7909 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Tue, 7 Jan 2025 17:39:47 +0900 Subject: [PATCH] . --- exp_legacy/module/modules/addons/deconlog.lua | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/exp_legacy/module/modules/addons/deconlog.lua b/exp_legacy/module/modules/addons/deconlog.lua index 08c40b8f..8f42ad72 100644 --- a/exp_legacy/module/modules/addons/deconlog.lua +++ b/exp_legacy/module/modules/addons/deconlog.lua @@ -100,12 +100,15 @@ if config.fired_rocket then return end local ammo_inv = player.get_inventory(defines.inventory.character_ammo) --- @cast ammo_inv -nil - local item = ammo_inv[player.character.selected_gun_index] - if not item or not item.valid or not item.valid_for_read then - return - end - if item.name == "rocket" then - add_log(get_secs() .. "," .. player.name .. ",shot-rocket," .. pos_to_string(player.physical_position) .. "," .. pos_to_string(player.shooting_state.position)) + + if player.character then + local item = ammo_inv[player.character.selected_gun_index] + if not item or not item.valid or not item.valid_for_read then + return + end + if item.name == "rocket" then + add_log(get_secs() .. "," .. player.name .. ",shot-rocket," .. pos_to_string(player.physical_position) .. "," .. pos_to_string(player.shooting_state.position)) + end end end) end