Skip to content

Commit e400a90

Browse files
4.3.0
Fixed ammo and turret
1 parent 7049e73 commit e400a90

15 files changed

Lines changed: 58 additions & 24 deletions

changelog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Date: 2026-03-22
1010
- Added safe clamp for inventory slots bonus values (0 to 65535).
1111
Bugfixes:
1212
- Fixed "Convert Inventory to Legendary (Quality)" so equipped armor and armor with equipment grids convert without duplicating armor or losing grid equipment.
13+
- Fixed ammo and turret damage sliders to handle Base-only and DLC combinations without errors when Space Age categories/entities are unavailable.
1314
Translation:
1415
- Added EN, pt-BR, and external locale names, messages, and tooltip for the new option.
1516

control.lua

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ local permissions = require("scripts/utils/permissions")
77
_G.is_allowed = permissions.is_allowed
88
local flib_on_tick_n = require("__flib__.on-tick-n")
99
local flib_table = require("__flib__.table")
10+
local compat = require("scripts/utils/mod_compat")
1011

1112
local function safe_control_call(label, fn, ...)
1213
local ok, err = pcall(fn, ...)
@@ -141,7 +142,7 @@ local function is_legendary_quality_module_researched(force)
141142
end
142143

143144
local function update_legendary_shortcut_availability()
144-
local quality_active = script.active_mods["quality"] ~= nil
145+
local quality_active = compat.is_quality_active()
145146
flib_table.for_each(game.players, function(player)
146147
if not (player and player.valid) then
147148
return
@@ -295,7 +296,7 @@ script.on_event(defines.events.on_lua_shortcut, function(e)
295296
main_gui.toggle_main_gui(player)
296297
elseif e.prototype_name == "facc_give_legendary_upgrader" then
297298
if is_allowed(player) then
298-
if script.active_mods["quality"] == nil or not is_legendary_quality_module_researched(player.force) then
299+
if not compat.is_quality_active() or not is_legendary_quality_module_researched(player.force) then
299300
player.print({ "facc.legendary-upgrader-research-required" })
300301
return
301302
end

scripts/armor/create_full_armor.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ function M.run(player)
1616
end
1717

1818
-- Detect mods
19-
local quality_enabled = compat.is_mod_active("quality")
20-
local space_age_enabled = compat.is_mod_active("space-age")
19+
local quality_enabled = compat.is_quality_active()
20+
local space_age_enabled = compat.is_space_age_stack_active()
2121

2222
-- Choose armor and layout
2323
local armor_name, armor_quality, layout

scripts/cheats/add_infinite_research_levels.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
local M = {}
66
local flib_technology = require("__flib__.technology")
77
local research_targets = require("scripts/cheats/research_targets")
8+
local compat = require("scripts/utils/mod_compat")
89

910
local function is_multilevel(tech)
1011
local ok, result = pcall(flib_technology.is_multilevel, tech)
@@ -18,7 +19,7 @@ function M.run(player)
1819
end
1920

2021
local force = player.force
21-
local space_age_enabled = script.active_mods["space-age"] ~= nil
22+
local space_age_enabled = compat.is_space_age_stack_active()
2223
local tech_names = research_targets.get(space_age_enabled)
2324

2425
local updated = 0

scripts/cheats/high_infinite_research_levels.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
local M = {}
66
local flib_technology = require("__flib__.technology")
77
local research_targets = require("scripts/cheats/research_targets")
8+
local compat = require("scripts/utils/mod_compat")
89

910
local function is_multilevel(tech)
1011
local ok, result = pcall(flib_technology.is_multilevel, tech)
@@ -23,7 +24,7 @@ function M.run(player)
2324
end
2425

2526
local force = player.force
26-
local space_age_enabled = script.active_mods["space-age"] ~= nil
27+
local space_age_enabled = compat.is_space_age_stack_active()
2728

2829
local tech_names = research_targets.get(space_age_enabled)
2930

scripts/combat/ammo_to_turrets.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ local chunk_jobs = require("scripts/utils/chunk_job_runner")
1111
local compat = require("scripts/utils/mod_compat")
1212

1313
-- Detect whether the Space Age DLC/mod is active
14-
local space_age_enabled = compat.is_mod_active("space-age")
14+
local space_age_enabled = compat.is_space_age_stack_active()
1515
local JOBS_KEY = "facc_jobs_ammo_to_turrets"
1616
local CHUNKS_PER_TICK = 8
1717
local STATUS_OPTIONS = {

scripts/environment/surface_properties.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
local M = {}
55
local math_util = require("scripts/utils/flib_math")
6+
local compat = require("scripts/utils/mod_compat")
67

78
local SPACE_AGE_REQUIRED_KEYS = {
89
pressure = true,
@@ -127,7 +128,7 @@ function M.set_property(player, property_name, raw_value)
127128
return
128129
end
129130

130-
if SPACE_AGE_REQUIRED_KEYS[property_name] and script.active_mods["space-age"] == nil then
131+
if SPACE_AGE_REQUIRED_KEYS[property_name] and not compat.is_space_age_stack_active() then
131132
player.print({"facc.surface-property-no-space-age"})
132133
return
133134
end

scripts/events/gui_events.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ local set_mining_speed = require("scripts/mining/set_mining_speed")
3333
local run_faster = require("scripts/character/run_faster")
3434
local increase_robot_speed = require("scripts/logistic-network/increase_robot_speed")
3535
local set_inventory_slots_bonus = require("scripts/character/set_inventory_slots_bonus")
36+
local compat = require("scripts/utils/mod_compat")
3637

3738
-- Character features
3839
local ghost_toggle = require("scripts/character/toggle_ghost_character")
@@ -250,7 +251,7 @@ local features = {
250251
facc_set_inventory_slots_bonus = set_inventory_slots_bonus,
251252
}
252253

253-
local quality_enabled = script.active_mods["quality"] ~= nil
254+
local quality_enabled = compat.is_quality_active()
254255
if quality_enabled then
255256
features.facc_convert_inventory = require("scripts/character/convert_inventory_to_legendary")
256257
features.facc_upgrade_blueprints = require("scripts/blueprints/upgrade_blueprints_to_legendary")

scripts/gui/main_gui.lua

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@ local M = {}
77
local flib_gui = require("__flib__.gui")
88
local flib_table = require("__flib__.table")
99
local gui_events = require("scripts/events/gui_events")
10+
local compat = require("scripts/utils/mod_compat")
1011

1112
--------------------------------------------------------------------------------
1213
-- Mod detection
1314
--------------------------------------------------------------------------------
14-
local quality_enabled = script.active_mods["quality"] ~= nil
15-
local space_age_enabled = script.active_mods["space-age"] ~= nil
15+
local quality_enabled = compat.is_quality_active()
16+
local space_age_enabled = compat.is_space_age_stack_active()
1617
-- Disable “Increase Resources” when infinite resources is active
1718
local infinite_resources_enabled = settings.startup["facc-infinite-resources"]
1819
and settings.startup["facc-infinite-resources"].value

scripts/legendary-upgrader/legendary_upgrader.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
local TOOL_NAME = "facc_legendary_upgrader"
55
local QUALITY = "legendary" -- hard-coded legendary quality
6+
local compat = require("scripts/utils/mod_compat")
67

78
-- Main upgrader: triggered when player selects an area with our tool
89
script.on_event(defines.events.on_player_selected_area, function(event)
@@ -13,7 +14,7 @@ script.on_event(defines.events.on_player_selected_area, function(event)
1314
if not is_allowed(player) then return end
1415
if not player then return end
1516

16-
local quality_active = script.active_mods["quality"] ~= nil
17+
local quality_active = compat.is_quality_active()
1718
local legendary_quality = quality_active
1819
and player.force
1920
and player.force.valid

0 commit comments

Comments
 (0)