mirror of
https://github.com/Wyrrrd/Gun_Turret_Alerts.git
synced 2026-04-18 03:34:52 +02:00
Small cleanup and commenting
This commit is contained in:
10
control.lua
10
control.lua
@@ -125,9 +125,11 @@ local function remove_force_from_list(event)
|
|||||||
force = event.source
|
force = event.source
|
||||||
end
|
end
|
||||||
|
|
||||||
if force and not force.connected_players then
|
if force then
|
||||||
for surface_name,_ in pairs(game.surfaces) do
|
if not force.valid or (force.valid and table_is_empty(force.connected_players)) then
|
||||||
storage.ammo_entities[surface_name.."_"..force.name] = nil
|
for surface_name,_ in pairs(game.surfaces) do
|
||||||
|
storage.ammo_entities[surface_name.."_"..force.name] = nil
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -217,6 +219,7 @@ local function generate_alerts()
|
|||||||
if inventory and get_ammo_flag[mode] then
|
if inventory and get_ammo_flag[mode] then
|
||||||
if entity.type == "ammo-turret" or entity.type == "artillery-turret" or entity.type == "artillery-wagon" then
|
if entity.type == "ammo-turret" or entity.type == "artillery-turret" or entity.type == "artillery-wagon" then
|
||||||
ammo_flag = get_ammo_flag[mode](inventory, player_threshold)
|
ammo_flag = get_ammo_flag[mode](inventory, player_threshold)
|
||||||
|
-- Automated amme count override (if activated)
|
||||||
if auto_full and entity.prototype.automated_ammo_count then
|
if auto_full and entity.prototype.automated_ammo_count then
|
||||||
if entity.prototype.automated_ammo_count < player_threshold then
|
if entity.prototype.automated_ammo_count < player_threshold then
|
||||||
ammo_flag = get_ammo_flag[mode](inventory, entity.prototype.automated_ammo_count)
|
ammo_flag = get_ammo_flag[mode](inventory, entity.prototype.automated_ammo_count)
|
||||||
@@ -237,6 +240,7 @@ local function generate_alerts()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
-- Cleanup if entity is invalid
|
||||||
table.remove(ammo_entities, index)
|
table.remove(ammo_entities, index)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -24,8 +24,8 @@ gun-turret-alerts-mode-individually=Individually
|
|||||||
gun-turret-alerts-mode-selected=Selected
|
gun-turret-alerts-mode-selected=Selected
|
||||||
|
|
||||||
[gun-turret-alerts]
|
[gun-turret-alerts]
|
||||||
message-empty=__1__ out of ammo
|
message-empty=__1__ is out of ammo
|
||||||
message-low=__1__ low ammo
|
message-low=__1__ is low on ammo
|
||||||
|
|
||||||
[virtual-signal-name]
|
[virtual-signal-name]
|
||||||
ammo-icon-red=Out of ammo signal
|
ammo-icon-red=Out of ammo signal
|
||||||
|
|||||||
Reference in New Issue
Block a user