mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 11:35:22 +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)
|
||||||
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)
|
Event.add(defines.events.on_player_ammo_inventory_changed, function(e)
|
||||||
local player = game.players[e.player_index]
|
local player = game.players[e.player_index]
|
||||||
if Roles.player_has_flag(player, "deconlog-bypass") then
|
if Roles.player_has_flag(player, "deconlog-bypass") then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local ammo_inv = player.get_inventory(defines.inventory.character_ammo) --- @cast ammo_inv -nil
|
if player.character then
|
||||||
local item = ammo_inv[player.character.selected_gun_index]
|
local ammo_inv = player.get_inventory(defines.inventory.character_ammo) --- @cast ammo_inv -nil
|
||||||
if not item or not item.valid or not item.valid_for_read then
|
local item = ammo_inv[player.character.selected_gun_index]
|
||||||
return
|
local action_name
|
||||||
end
|
if not item or not item.valid or not item.valid_for_read then
|
||||||
if item.name == "rocket" then
|
return
|
||||||
add_log(get_secs() .. "," .. player.name .. ",shot-rocket," .. pos_to_string(player.physical_position) .. "," .. pos_to_string(player.shooting_state.position))
|
end
|
||||||
end
|
if config.fired_rocket and item.name == "rocket" then
|
||||||
end)
|
action_name = ",shot-rocket,"
|
||||||
end
|
elseif config.fired_explosive_rocket and item.name == "explosive-rocket" then
|
||||||
|
action_name = ",shot-explosive-rocket,"
|
||||||
if config.fired_explosive_rocket then
|
elseif config.fired_nuke and item.name == "atomic-bomb" then
|
||||||
Event.add(defines.events.on_player_ammo_inventory_changed, function(e)
|
action_name = ",shot-nuke,"
|
||||||
local player = game.players[e.player_index]
|
else
|
||||||
|
return
|
||||||
if Roles.player_has_flag(player, "deconlog-bypass") then
|
end
|
||||||
return
|
add_log(get_secs() .. "," .. player.name .. action_name .. pos_to_string(player.physical_position) .. "," .. pos_to_string(player.shooting_state.position))
|
||||||
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))
|
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user