Quality Control

by raley

Adds a chance to change the quality of buildable units based on their activity level. Highly configurable, works well with other quality mods.

Content
10 days ago
2.0
397
Factorio: Space Age Icon Space Age Mod
Cheats

Changelog

Version: 1.4.0
Date: 24. 08. 2025
  Features:
    - Added setting to continue generating quality change attempts at max quality. When enabled,
      entities at maximum quality will continue to accumulate manufacturing hours that drive
      quality change events for other entities in the factory.
Version: 1.3.1
Date: 22. 08. 2025
  Changes:
    - Removed support for rocket silos due to the 'send to orbit automatically' setting being reset on upgrades.
      Once a way can be found to manage this via API they will be added back in.
  Bugfixes:
    - Fixed machines losing their flipped status when their quality is changed
    - Machines marked for deconstruction are no longer targets for quality change events
      Thank you Stargateur for finding these issues!
Version: 1.3.0
Date: 21. 08. 2025
  Features:
    - Added the ability to turn off assemblers and furnaces as upgrade targets.
      They are still used to generate upgrade attempts for other entities, they are just
      not a target for upgrades themselves.
    - Added fine control over each entity that can change quality (in startup settings)
  Optimizations:
    - Refactored code to improve readability and remove some unecessary complexity
    - Cached frequently accessed storage fields for minor performance improvement
  Changes:
    - Updated the machine inspection output to be easier to understand
  Bugfixes:
    - Removed cargo landing pad as a target for quality changes (containers aren't supported yet)
Version: 1.2.8
Date: 21. 08. 2025
  Modding:
    - Enhanced compatability with other mods by excluding non-selectable and indestructible entities
      from quality changes
Version: 1.2.7
Date: 21. 08. 2025
  Modding:
    - Excludes entities from Miniloader Redux mod to prevent compatibility issues with belt-connected entities
      Broken miniloaders will be removed from the players save to prevent crashes (sorry Xaal!!)
      Also, thank you Xaal for discovering the problem and reporting.
Version: 1.2.6
Date: 20. 08. 2025
  Changes:
    - Changed default setting for "Change modules with entity" from enabled to disabled to match documentation
      Thank you Stargateur for catching this!
  Bugfixes:
    - First pass at fixing a bug that occurred when players tried to join multiplayer games.
      Thank you MrSilver2510 and Smougtea for reporting the issues and sharing info!
Version: 1.2.5
Date: 20. 08. 2025
  Modding:
    - Excludes entities from ammo-loader mod to prevent compatibility issues
    - Adds data migration to fix broken ammo-loader entities that may have been upgraded
      before the exclusion was added.
Version: 1.2.4
Date: 19. 08. 2025
  Bugfixes:
    - Fixed issue where entity properties were accessed after script.raise_script_destroy. Thank you Smougtea (again!!)
  Modding:
    - Excludes entities that didn't upgrade well from:
      ControlTech updated for Factorio 2
      Circuit-Controlled Routers
      Bulk Rail Loader 2.0 Temporary Patch
      Thank you Sangrias for the excellent save file that helped identify these!
Version: 1.2.3
Date: 19. 08. 2025
  Modding:
    - Excludes entities from Realistic Reactors Reborn mod to prevent issues
Version: 1.2.2
Date: 18. 08. 2025
  Bugfixes:
    - Fixed a crash when entities become invalid during quality processing. Thank you Smougtea for reporting!
  Modding:
    - Excludes entities from mods that add non-upgradeable items (Warp-Drive-Machine, quality-condenser)
Version: 1.2.1
Date: 18. 08. 2025
  Bugfixes:
    - Fixed crash caused by debug statements accessing invalid entity properties. Even though
      debugging was turned off, LUA still evaluated the arguments with the way it was setup.
      Thanks to MrSilver2510 for the bug report!
    - Removed all debug statements until a safer approach can be implemented.
Version: 1.2.0
Date: 17. 08. 2025
  Balancing:
    - Improved upgrade system for secondary entities to provide more consistent progression.
      It should feel more reliable and slightly more frequent. They now receive guaranteed
      upgrade attempts proportional to the ratio of secondary to primary entities. Previously
      the mod used a per-unit-per-tick-percentage-chance that decayed over time, which was too
      difficult to tune properly. This system is simpler and more consistent.
Version: 1.1.3
Date: 16. 08. 2025
  Optimizations:
    - Small performance improvement by filtering out non-player events where possible
  Bugfixes:
    - Fixed a crash when inspecting entities that can no longer change quality
Version: 1.1.2
Date: 16. 08. 2025
  Bugfixes:
    - Fixed a crash when entity cloning fails during cross-mod interactions (Thank you Stargateur!!)
Version: 1.1.1
Date: 15. 08. 2025
  Bugfixes:
    - Fixed a crash that could occur when entities reached the quality limit (Thank you Xaal!!)
    - Fixed the hotkey for entity inspection (Control+Shift+Q)
Version: 1.1.0
Date: 15. 08. 2025
  Features:
    - Added support for additional turret types: ammo-turret, electric-turret, and fluid-turret
  Ease of use:
    - Clarified aggregate notification setting to indicate 5-minute display frequency
Version: 1.0.2
Date: 15. 08. 2025
  Bugfixes:
    - Fixed an issue with secondary entity rate tracking that could apply updates too frequently
  Ease of use:
    - Added tests and validation scripts for mod authors and contributors
    - The quality-control-init command now preserves machine progress instead of resetting it to zero
Version: 1.0.1
Date: 13. 08. 2025
  Bugfixes:
    - Fixed an issue with the secondary entity change rate being affected by ticks between processing
    - Secondary entities now upgrade at consistent rates regardless of batch processing interval
Version: 1.0.0
Date: 11. 08. 2025
  Features:
    - Prevent console alert spam by adding notification throttling with cooldown (the console alert is off by default)
  Optimizations:
    - Improved performance by adding configurable batch processing
    - Reduced total tracked entities by removing those that cannot change quality
    - Reduced memory usage by implementing exponentially weighted moving average (EWMA) for secondary entity upgrade attempts
  Bugfixes:
    - Prevent double upgrades when re-initializing cached storage
Version: 0.9.0
Date: 10. 08. 2025
  Features:
    - Added settings to customize which entities are affected by quality changes
    - Added options to allow modules to progress alongside their host entities
  Balancing:
    - Added option to have modules move only one quality tier at a time
  Ease of use:
    - Added comprehensive tooltips explaining entity types and balance considerations for all settings
Version: 0.8.0
Date: 09. 08. 2025
  Features:
    - Modules now automatically upgrade to match entity quality during quality changes
Version: 0.7.0
Date: 07. 08. 2025
  Features:
    - Expanded tracked entity types to include Space Age content
Version: 0.6.0
Date: 04. 08. 2025
  Features:
    - Split notifications into two independently configurable types:
      - Aggregate console alerts showing summary of all changes per tick
      - Individual entity map ping alerts for each quality change
    - Enhanced stability with automatic storage reinitialization
    - Added entity validation and error recovery mechanisms
  Optimizations:
    - Reduced memory overhead and improved predictability of entity tracking
    - Refactored entity type checking to improve maintainability
  Bugfixes:
    - Improved handling of invalid entities during quality checks
Version: 0.5.0
Date: 03. 08. 2025
  Features:
    - Apply quality changes to secondary entities
    - Expanded entity tracking to include more placeable types (except belts, pipes, and tiles as they impacted performance too much)
    - Added entity inspection tool and cache re-initialization command
  Optimizations:
    - Replaced periodic entity scan with event-based tracking - eliminated expensive find_entities_filtered calls from the main quality-check loop by maintaining a cached list updated via creation/destruction events (major performance improvement on large maps)
    - Consolidated scattered entity type definitions into a single hardcoded lookup table with O(1) performance, replacing multiple inline table definitions
    - Refined quality change distribution logic to process all accumulated upgrade attempts per cycle instead of just one
  Bugfixes:
    - Reset internal state on configuration change
    - Restricted manufacturing hour tracking to assemblers and furnaces only
    - Fixed quality processing to handle all accumulated upgrade attempts per cycle
    - Fixed "qaulity" typo in setting and variable names
Version: 0.4.0
Date: 02. 08. 2025
  Features:
    - Added accumulating chance for quality upgrades
  Optimizations:
    - Removed redundant storage initialization checks that were being performed multiple times per tick
    - Simplified quality control logic by eliminating unnecessary state variables and streamlining the upgrade/downgrade decision flow
Version: 0.3.0
Date: 01. 08. 2025
  Features:
    - Extended quality control to inserter, pump, radar, and roboport
Version: 0.2.0
Date: 31. 07. 2025
  Features:
    - Implemented periodic checks based on manufacturing hours
    - Added quality control support for labs and mining drills
    - Added player notifications for machine quality changes
    - Added optional console messages for quality changes
  Optimizations:
    - Return quality name string directly instead of full prototype object when determining next quality level (reduced memory usage and lookup overhead)
    - Improved machine data cleanup efficiency by replacing periodic full-scan cleanup with instant event-driven removal on entity destruction (on_entity_died, on_player_mined_entity, on_robot_mined_entity)
Version: 0.1.0
Date: 30. 07. 2025
  Features:
    - Initial implementation of quality tracking system for machines
    - Automatic quality upgrades and downgrades based on manufacturing hours
    - Configurable upgrade timing and direction settings
    - Support for assembling machines and furnaces