1
0
mirror of https://github.com/Wyrrrd/Gun_Turret_Alerts.git synced 2026-06-04 00:06:38 +02:00

Adaptive threshold based on automated ammo count

-Threshold for alert comes is never higher than then number of ammo loaded by an inserter.
-This fixes annoying alerts in Space Exploration's meteor defence, where the default ammo loaded is 4, and fixes the problem for any other mod.
This commit is contained in:
snouz
2021-06-21 15:06:34 +02:00
parent 9545d088eb
commit ad4ae53c97
3 changed files with 11 additions and 1 deletions
+5
View File
@@ -166,6 +166,11 @@ local function generate_alerts()
if inventory and get_ammo_flag[mode] then
if entity.type == "ammo-turret" then
ammo_flag = get_ammo_flag[mode](inventory, player_threshold)
if entity.prototype.automated_ammo_count then
if entity.prototype.automated_ammo_count < player_threshold then
ammo_flag = get_ammo_flag[mode](inventory, entity.prototype.automated_ammo_count)
end
end
elseif entity.type == "car" then
ammo_flag = get_ammo_flag[mode](inventory, player_threshold, entity.selected_gun_index)
end