From 2e6743445c2c9451fa0703eb440225fc38da674d Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 8 Jan 2025 22:56:47 +0900 Subject: [PATCH 1/3] Compilatron Position Check (#348) * Update compilatron.lua * Update compilatron.lua * Update compilatron.lua --- exp_legacy/module/modules/addons/compilatron.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/exp_legacy/module/modules/addons/compilatron.lua b/exp_legacy/module/modules/addons/compilatron.lua index 706b8c92..0dcc551b 100644 --- a/exp_legacy/module/modules/addons/compilatron.lua +++ b/exp_legacy/module/modules/addons/compilatron.lua @@ -95,8 +95,10 @@ end function Public.spawn_compilatron(surface, location) local position = locations[location] local pos = surface.find_non_colliding_position("small-biter", position, 1.5, 0.5) - local compi = surface.create_entity{ name = "small-biter", position = pos, force = game.forces.neutral } - Public.add_compilatron(compi, location) + if pos then + local compi = surface.create_entity{ name = "small-biter", position = pos, force = game.forces.neutral } + Public.add_compilatron(compi, location) + end end -- When the first player is created this will create all compilatrons that are resisted in the config From f8187005e97aad82024aa38789392454c8033b8b Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 8 Jan 2025 23:00:44 +0900 Subject: [PATCH 2/3] Decon Log Character Check (#347) * Update deconlog.lua * Update deconlog.lua * Update deconlog.lua * Update deconlog.lua * Update deconlog.lua * Move ammo_inv to maintain cast -nil --------- Co-authored-by: Cooldude2606 <25043174+Cooldude2606@users.noreply.github.com> --- exp_legacy/module/modules/addons/deconlog.lua | 66 +++++-------------- 1 file changed, 18 insertions(+), 48 deletions(-) diff --git a/exp_legacy/module/modules/addons/deconlog.lua b/exp_legacy/module/modules/addons/deconlog.lua index 08c40b8f..10442420 100644 --- a/exp_legacy/module/modules/addons/deconlog.lua +++ b/exp_legacy/module/modules/addons/deconlog.lua @@ -93,59 +93,29 @@ if config.mined_entity then end) end -if config.fired_rocket then +if config.fired_rocket or config.fired_explosive_rocket or config.fired_nuke then Event.add(defines.events.on_player_ammo_inventory_changed, function(e) local player = game.players[e.player_index] if Roles.player_has_flag(player, "deconlog-bypass") 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)) - end - end) -end - -if config.fired_explosive_rocket then - Event.add(defines.events.on_player_ammo_inventory_changed, function(e) - local player = game.players[e.player_index] - - if Roles.player_has_flag(player, "deconlog-bypass") 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 == "explosive-rocket" then - add_log(get_secs() .. "," .. player.name .. ",shot-explosive-rocket," .. pos_to_string(player.physical_position) .. "," .. pos_to_string(player.shooting_state.position)) - end - end) -end - -if config.fired_nuke then - Event.add(defines.events.on_player_ammo_inventory_changed, function(e) - local player = game.players[e.player_index] - - if Roles.player_has_flag(player, "deconlog-bypass") 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 == "atomic-bomb" then - add_log(get_secs() .. "," .. player.name .. ",shot-nuke," .. pos_to_string(player.physical_position) .. "," .. pos_to_string(player.shooting_state.position)) + if player.character then + local ammo_inv = player.get_inventory(defines.inventory.character_ammo) --- @cast ammo_inv -nil + local item = ammo_inv[player.character.selected_gun_index] + local action_name + if not item or not item.valid or not item.valid_for_read then + return + end + if config.fired_rocket and item.name == "rocket" then + action_name = ",shot-rocket," + elseif config.fired_explosive_rocket and item.name == "explosive-rocket" then + action_name = ",shot-explosive-rocket," + elseif config.fired_nuke and item.name == "atomic-bomb" then + action_name = ",shot-nuke," + else + return + end + add_log(get_secs() .. "," .. player.name .. action_name .. pos_to_string(player.physical_position) .. "," .. pos_to_string(player.shooting_state.position)) end end) end From ac799c7aef8dca9f2f928731ea1e40d15977be90 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 8 Jan 2025 23:03:08 +0900 Subject: [PATCH 3/3] Decon Log Character Check (#347) * Update deconlog.lua * Update deconlog.lua * Update deconlog.lua * Update deconlog.lua * Update deconlog.lua * Move ammo_inv to maintain cast -nil --------- Co-authored-by: Cooldude2606 <25043174+Cooldude2606@users.noreply.github.com>