1
0
mirror of https://github.com/Wyrrrd/Gun_Turret_Alerts.git synced 2026-06-30 03:56:14 +02:00

Compare commits

...

2 Commits

Author SHA1 Message Date
Wyrrrd 0b343029e9 Added static script event listeners 2023-03-12 23:15:14 +01:00
Wyrrrd 445691bd04 Update README.md 2022-08-07 17:31:55 +02:00
4 changed files with 13 additions and 4 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
<img src=https://raw.githubusercontent.com/Wyrrrd/Gun_Turret_Alerts/master/thumbnail.png width="128" height="128">
### Description
Adds alerts when a car or gun turret is out of ammo or has low ammo. The amount of ammo considered low can be configured. Alerts for cars and turrets can be disabled separately. Behaviour on cars with multiple ammo slots can be configured globally.
Adds alerts when a gun turret, car or artillery is out of ammo or has low ammo. The amount of ammo considered low can be configured. Alerts for turrets, cars and artillery can be disabled separately. Behaviour on cars with multiple ammo slots can be configured globally.
### Locale
If you want to contribute by translating this mod, you can view the existing translations [here](https://github.com/Wyrrrd/Gun_Turret_Alerts/tree/master/locale). I'd be happy to add your language and credits to the next release.
+5
View File
@@ -1,4 +1,9 @@
---------------------------------------------------------------------------------------------------
Version: 1.1.11
Date: 2023-03-12
Bugfixes:
- Added static script event listeners to fix missing alerts for script built entities
---------------------------------------------------------------------------------------------------
Version: 1.1.10
Date: 2022-08-07
Features:
+6 -2
View File
@@ -65,9 +65,10 @@ local get_ammo_flag = {
local function add_entity_to_list(event)
--Whenever an ammo-turret, car or artillery type entity is built, add it to the global table.
local index = event.created_entity.surface.name.."_"..event.created_entity.force.name
local entity = event.created_entity or event.entity
local index = entity.surface.name.."_"..entity.force.name
if global.ammo_entities[index] then
table.insert(global.ammo_entities[index], event.created_entity)
table.insert(global.ammo_entities[index], entity)
end
end
@@ -212,9 +213,12 @@ script.on_event(defines.events.on_forces_merged, remove_force_from_list)
script.on_event(defines.events.on_built_entity, add_entity_to_list, {{filter="type", type = "ammo-turret"},{filter="type", type = "car"},{filter="type", type = "artillery-turret"},{filter="type", type = "artillery-wagon"}})
script.on_event(defines.events.on_robot_built_entity, add_entity_to_list, {{filter="type", type = "ammo-turret"},{filter="type", type = "car"},{filter="type", type = "artillery-turret"},{filter="type", type = "artillery-wagon"}})
script.on_event(defines.events.script_raised_built, add_entity_to_list, {{filter="type", type = "ammo-turret"},{filter="type", type = "car"},{filter="type", type = "artillery-turret"},{filter="type", type = "artillery-wagon"}})
script.on_event(defines.events.script_raised_revive, add_entity_to_list, {{filter="type", type = "ammo-turret"},{filter="type", type = "car"},{filter="type", type = "artillery-turret"},{filter="type", type = "artillery-wagon"}})
script.on_event(defines.events.on_player_mined_entity, remove_entity_from_list, {{filter="type", type = "ammo-turret"},{filter="type", type = "car"},{filter="type", type = "artillery-turret"},{filter="type", type = "artillery-wagon"}})
script.on_event(defines.events.on_robot_mined_entity, remove_entity_from_list, {{filter="type", type = "ammo-turret"},{filter="type", type = "car"},{filter="type", type = "artillery-turret"},{filter="type", type = "artillery-wagon"}})
script.on_event(defines.events.on_entity_died, remove_entity_from_list, {{filter="type", type = "ammo-turret"},{filter="type", type = "car"},{filter="type", type = "artillery-turret"},{filter="type", type = "artillery-wagon"}})
script.on_event(defines.events.script_raised_destroy, remove_entity_from_list, {{filter="type", type = "ammo-turret"},{filter="type", type = "car"},{filter="type", type = "artillery-turret"},{filter="type", type = "artillery-wagon"}})
script.on_nth_tick(600, generate_alerts)
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "Gun_Turret_Alerts",
"version": "1.1.10",
"version": "1.1.11",
"title": "Ammo Alerts",
"author": "Wyrrrd",
"factorio_version": "1.1",