mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 03:25:23 +09:00
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>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user