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 | Date | |
|---|---|---|---|
| 0b343029e9 | |||
| 445691bd04 |
@@ -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.
|
||||
|
||||
@@ -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
@@ -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)
|
||||
Reference in New Issue
Block a user