From ad4ae53c9793ca899da85cc9f2c020b0668c915b Mon Sep 17 00:00:00 2001 From: snouz Date: Mon, 21 Jun 2021 15:06:34 +0200 Subject: [PATCH 1/2] 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. --- changelog.txt | 5 +++++ control.lua | 5 +++++ info.json | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/changelog.txt b/changelog.txt index 9c5bc16..81a9e0e 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,4 +1,9 @@ --------------------------------------------------------------------------------------------------- +Version: 1.1.7 +Date: 2021-06-21 + Compatibility: + - Added compatibility to Space Exploration's Meteor defence and other mods (no longer displays alert when ammo is dynamically loaded) (by snouz) +--------------------------------------------------------------------------------------------------- Version: 1.1.6 Date: 2021-04-22 Bugfixes: diff --git a/control.lua b/control.lua index 92ff519..10b0a5f 100644 --- a/control.lua +++ b/control.lua @@ -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 diff --git a/info.json b/info.json index e8c57cf..4187f2e 100644 --- a/info.json +++ b/info.json @@ -1,6 +1,6 @@ { "name": "Gun_Turret_Alerts", - "version": "1.1.6", + "version": "1.1.7", "title": "Ammo Alerts", "author": "Wyrrrd", "factorio_version": "1.1", From 33c9bbe78312eb75914548f052aa662d0b85bbb9 Mon Sep 17 00:00:00 2001 From: snouz Date: Tue, 22 Jun 2021 17:13:30 +0200 Subject: [PATCH 2/2] Fixed missing signal names --- locale/de/config.cfg | 6 +++++- locale/en/config.cfg | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/locale/de/config.cfg b/locale/de/config.cfg index 3708ba2..5f7bf78 100644 --- a/locale/de/config.cfg +++ b/locale/de/config.cfg @@ -17,4 +17,8 @@ autofilter_mode-selected=Auswahl [gun-turret-alerts] message-empty=__1__ hat keine Munition -message-low=__1__ hat wenig Munition \ No newline at end of file +message-low=__1__ hat wenig Munition + +[virtual-signal-name] +ammo-icon-red=Hat keine Munition +ammo-icon-yellow=Hat wenig Munition \ No newline at end of file diff --git a/locale/en/config.cfg b/locale/en/config.cfg index 44e8814..8e5ba40 100644 --- a/locale/en/config.cfg +++ b/locale/en/config.cfg @@ -17,4 +17,8 @@ autofilter_mode-selected=Selected [gun-turret-alerts] message-empty=__1__ out of ammo -message-low=__1__ ammo low \ No newline at end of file +message-low=__1__ low ammo + +[virtual-signal-name] +ammo-icon-red=Out of ammo signal +ammo-icon-yellow=Low ammo signal \ No newline at end of file