mirror of
https://github.com/Wyrrrd/Gun_Turret_Alerts.git
synced 2026-07-01 20:51:08 +02:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| db141f81ca | |||
| 1eb12f0f28 | |||
| eb3b6cf0e6 | |||
| 7f0fa8bbcf |
@@ -5,4 +5,5 @@
|
|||||||
Adds alerts when a car or gun turret is out of ammo or has low ammo.
|
Adds alerts when a car or gun turret is out of ammo or has low ammo.
|
||||||
|
|
||||||
### Credit
|
### Credit
|
||||||
Thanks to [unhott](https://mods.factorio.com/user/unhott) for the [original mod](https://mods.factorio.com/mod/GunTurretAlerts).
|
Thanks to [unhott](https://mods.factorio.com/user/unhott) for the [original mod](https://mods.factorio.com/mod/GunTurretAlerts).
|
||||||
|
Thanks to [snouz](https://mods.factorio.com/user/snouz) for the new icons and thumbnail.
|
||||||
@@ -1,4 +1,14 @@
|
|||||||
---------------------------------------------------------------------------------------------------
|
---------------------------------------------------------------------------------------------------
|
||||||
|
Version: 1.1.3
|
||||||
|
Date: 2021-03-29
|
||||||
|
Changes:
|
||||||
|
- Icon and message overhaul (by snouz)
|
||||||
|
---------------------------------------------------------------------------------------------------
|
||||||
|
Version: 1.1.2
|
||||||
|
Date: 2021-03-28
|
||||||
|
Bugfixes:
|
||||||
|
- Added migration to add car index to existing saves
|
||||||
|
---------------------------------------------------------------------------------------------------
|
||||||
Version: 1.1.1
|
Version: 1.1.1
|
||||||
Date: 2021-03-28
|
Date: 2021-03-28
|
||||||
Changes:
|
Changes:
|
||||||
|
|||||||
+5
-6
@@ -2,7 +2,7 @@
|
|||||||
--This mod scans the map for cars and gun-turrets and places alerts when they are low.
|
--This mod scans the map for cars and gun-turrets and places alerts when they are low.
|
||||||
|
|
||||||
script.on_init(function (event)
|
script.on_init(function (event)
|
||||||
-- turret index init
|
-- car and turret index init
|
||||||
global.turret_entities = {}
|
global.turret_entities = {}
|
||||||
global.car_entities = {}
|
global.car_entities = {}
|
||||||
end)
|
end)
|
||||||
@@ -31,15 +31,14 @@ script.on_nth_tick(600, function (event)
|
|||||||
inv_var = turret_entity.get_inventory(defines.inventory.turret_ammo)
|
inv_var = turret_entity.get_inventory(defines.inventory.turret_ammo)
|
||||||
if inv_var.is_empty() then
|
if inv_var.is_empty() then
|
||||||
-- no ammo alert
|
-- no ammo alert
|
||||||
player.add_custom_alert(turret_entity, {type = "item", name = "piercing-rounds-magazine"}, "Out of ammo", true)
|
player.add_custom_alert(turret_entity, {type = "virtual", name = "ammo-icon-red"}, "Turret out of ammo", true)
|
||||||
elseif inv_var[1].count < player_threshold then
|
elseif inv_var[1].count < player_threshold then
|
||||||
-- low ammo alert
|
-- low ammo alert
|
||||||
player.add_custom_alert(turret_entity, {type = "item", name = "firearm-magazine"}, "Ammo low", true)
|
player.add_custom_alert(turret_entity, {type = "virtual", name = "ammo-icon-yellow"}, "Turret ammo low", true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
if GTA_car_enabled and car_entities then
|
if GTA_car_enabled and car_entities then
|
||||||
for _,car_entity in pairs(car_entities) do
|
for _,car_entity in pairs(car_entities) do
|
||||||
@@ -48,10 +47,10 @@ script.on_nth_tick(600, function (event)
|
|||||||
inv_var = car_entity.get_inventory(defines.inventory.car_ammo)
|
inv_var = car_entity.get_inventory(defines.inventory.car_ammo)
|
||||||
if inv_var.is_empty() then
|
if inv_var.is_empty() then
|
||||||
-- no ammo alert
|
-- no ammo alert
|
||||||
player.add_custom_alert(car_entity, {type = "item", name = "piercing-rounds-magazine"}, "Out of ammo", true)
|
player.add_custom_alert(car_entity, {type = "virtual", name = "ammo-icon-red"}, "Car out of ammo", true)
|
||||||
elseif inv_var[1].count < player_threshold then
|
elseif inv_var[1].count < player_threshold then
|
||||||
-- low ammo alert
|
-- low ammo alert
|
||||||
player.add_custom_alert(car_entity, {type = "item", name = "firearm-magazine"}, "Ammo low", true)
|
player.add_custom_alert(car_entity, {type = "virtual", name = "ammo-icon-yellow"}, "Car ammo low", true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 825 B |
Binary file not shown.
|
After Width: | Height: | Size: 1007 B |
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "Gun_Turret_Alerts",
|
"name": "Gun_Turret_Alerts",
|
||||||
"version": "1.1.1",
|
"version": "1.1.3",
|
||||||
"title": "Ammo Alerts",
|
"title": "Ammo Alerts",
|
||||||
"author": "Wyrrrd",
|
"author": "Wyrrrd",
|
||||||
"factorio_version": "1.1",
|
"factorio_version": "1.1",
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
script.on_configuration_changed(function (event)
|
||||||
|
-- car index init fix
|
||||||
|
global.car_entities = {}
|
||||||
|
end)
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
data:extend({
|
||||||
|
{
|
||||||
|
type = "virtual-signal",
|
||||||
|
name = "ammo-icon-red",
|
||||||
|
icon = "__Gun_Turret_Alerts__/graphics/ammo-icon-red.png",
|
||||||
|
icon_size = 64,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type = "virtual-signal",
|
||||||
|
name = "ammo-icon-yellow",
|
||||||
|
icon = "__Gun_Turret_Alerts__/graphics/ammo-icon-yellow.png",
|
||||||
|
icon_size = 64,
|
||||||
|
}
|
||||||
|
})
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 23 KiB |
Reference in New Issue
Block a user