1
0
mirror of https://github.com/Wyrrrd/Gun_Turret_Alerts.git synced 2026-04-17 19:24:52 +02:00

Merge pull request #2 from snouz/master

New ammo icons, new thumbnail
This commit is contained in:
Wyrrrd
2021-03-29 06:44:45 +00:00
committed by GitHub
6 changed files with 19 additions and 5 deletions

View File

@@ -31,15 +31,14 @@ script.on_nth_tick(600, function (event)
inv_var = turret_entity.get_inventory(defines.inventory.turret_ammo)
if inv_var.is_empty() then
-- 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
-- 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
if GTA_car_enabled and car_entities then
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)
if inv_var.is_empty() then
-- 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
-- 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

View File

@@ -1 +1,2 @@
--data.lua
require("prototypes.signals")

BIN
graphics/ammo-icon-red.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 825 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1007 B

14
prototypes/signals.lua Normal file
View File

@@ -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