Omnilibrary


A collection of functions that omnimods are using.

Internal
3 months ago
0.15 - 1.1
22.4K

Changelog

Version: 4.1.40
Date: 2023.12.28
  Changes:
    - Avoid using dump() and load() to copy function objects
Version: 4.1.39
Date: 2023.11.05
  Changes:
    - omni.lib.remove_prerequisite() now returns whether the removement was successfull
    - omni.lib.replace_prerequisite() will only add the replacement if it does not already exist
    - simplify omni.lib.add_science_pack() - only accept strings as second argument
    - simplify omni.lib.replace_science_pack() - no longer default to "omni-pack"
Version: 4.1.38
Date: 2023.08.24
  Features:
    - Added omni.lib.get_min() which returns the lowest numerical value of a table
    - Added support for updating omnifluid temperature copies of omnimatter chain recipes
    - Added loader-1x1 to prototype tables
Version: 4.1.37
Date: 2023.06.10
  Bugfixes:
    - Fixed omni.replace_prerequisite() removing the new prereq in some cases
Version: 4.1.36
Date: 2023.04.04
  Changes:
    - Added omni.lib.mod(a,b) that returns the remainder of the division a/b
      This function is based on math.fmod() to avoid known precision issues with the lua 5.2
      implementation of %. (See https://github.com/lua/lua/blob/v5.4.0/llimits.h#L303)
  Bugfixes:
    - Fixed omni.lib.gcd(m,n) returning negative values if m >> n due to precision issues with "%"
Version: 4.1.35
Date: 2023.03.19
  Changes:
    - Added omni.lib.find_placed_by() that returns the name of the item that has the given entity 
      defined as place_result
Version: 4.1.34
Date: 2023.01.06
  Bugfixes:
    - Added a nil check to omni.lib.get_fuel_number() to prevent util.parse_energy() from crashing
Version: 4.1.33
Date: 2022.12.11
  Changes:
    - RecGen:ifSetIngredients() is not expecting strict bools as first argument now
Version: 4.1.32
Date: 2022.08.17
  Changes:
    - Rquired changes for omnimatter 4.1.31: Rename omnicium to omnium
Version: 4.1.31
Date: 2022.08.06
  Bugfixes:
    - Fixed multiple issues in omni.lib.create_barrel() regarding localisations and icons
Version: 4.1.30
Date: 2022.07.05
  Changes:
    - BuildGen:setBurner() adds a burnt_inventory slot by default now
  Bugfixes:
    - Fixed a typo in omni.lib.replace_recipe_result() affecting recipe.expensive
    - Make sure to check all ings/results for both difficulties for nametags in standardisation
Version: 4.1.29
Date: 2022.06.10
  Bugfixes:
    - Fixed load order issue from some missing dependencies
    - Fixed misleading error message in some cases
Version: 4.1.27
Date: 2022.05.31
  Changes:
    - omni.lib.add_ore_tint() now checks the resource map color when the specified ore is not in
      our lookup table
    - Remove the deprecated lua function calls
Version: 4.1.26
Date: 2022.05.01
  Bugfixes:
    - Fixed a typo causing a wrong icons_size in ItemGen:addMask()
Version: 4.1.25
Date: 2022.02.14
  Bugfixes:
    - Fixed compressed tech variants sometimes being hidden
Version: 4.1.24
Date: 2022.02.05
  Bugfixes:
    - Fixed some more tech unlock shenanigans
  Changes:
    - Moved omnidate and omnidatefull to proper chat commands that you can tab complete
Version: 4.1.23
Date: 2022.02.05
  Bugfixes:
    - Fixed an icon scaling issue with technology icons with a scale factor on the first layer
    - Fixed an issue where some recipes or tech effects wouldn't unlock (matter, compression)
    - Fixed that the default fuel category was set on items after importing their recipe
Version: 4.1.22
Date: 2022.01.17
  Changes:
    - Added missing ore tints for PY
    - Log when an ore tint is requested but not available yet
Version: 4.1.21
Date: 2022.01.04
  Features:
    - Added showAmount(bool) and showProduct(bool) to RecGen to set recipe.show_amount_in_title
        and recipe.always_show_products
  Bugfixes:
    - Fixed that omni.lib.add_recipe_ingredient/result() pointed the added ingredient/result for
      both .normal and -expensive to the same table in certain cases.
Version: 4.1.20
Date: 2021.12.15
  Bugfixes:
    - Fixed a control script typo that caused an error on map load/creation
Version: 4.1.19
Date: 2021.12.14
  Info:
    - Internal code cleanup
Version: 4.1.18
Date: 2021.12.02
  Features:
    - Added omni.lib.recipe_is_hidden(recipename)
  Bugfixes:
    - Fixed that recipe standardisation was not accounting for ingredient.temperature
Version: 4.1.17
Date: 2021.10.28
  Bugfixes:
    - Hotfix for missing compressed building recipes
Version: 4.1.16
Date: 2021.10.27
  Features:
    - Added omni.lib.find_recipes(itemname)
  Bugfixes:
    - Fixed accidentally locking some angels recipes
    - Fix resetting some infinite techs when completing them
Version: 4.1.15
Date: 2021.09.01
  Changes:
    - Speed improvements for control-time logic
  Bugfixes:
    - Fixed a crash caused by random numbers in prototype tables (Why???)
Version: 4.1.14
Date: 2021.08.14
  Features:
    - Added ItemGen:setItemPictures()
  Changes:
    - setBurner() does not automatically add "burner-" infront of the proto name
    - setSteam() does not automatically add "steam-" infront of the proto name
  Bugfixes:
    - Fixed that setBurner() did not remove Module Slots
    - Fixed that BuildGen:import() set a default working_sound when the imported entity had none
    - Fixed that setStacksize() was ignored when used on BuildGen
    - Fixed that BuildChain not passing down setStacksize()
Version: 4.1.13
Date: 2021.07.21
  Features:
    - Added omni.lib.alpha(alphabet_position) which returns the corresponding lettter as string
    - Added omni.lib.recipe_is_enabled(recipename)
  Bugfixes:
    - Multiple fixes, typos and fallbacks in recipe generation
    - Fixed that certain settings were not forced properly
    - Fixed omni.lib.hide_setting() not properly forcing bool settings to false
Version: 4.1.12
Date: 2021.06.20
  Features:
    - Added setEmmisions() to set emmision_per_minute for entities
  Bugfixes:
    - Fixed omni.lib.replace_recipe_result() crashing with amount_min and amount_max recipes
    - Fixed omni.lib.multiply_recipe_result() crashing with amount_min and amount_max recipes
Version: 4.1.11
Date: 2021.06.04
  Changes:
    - Recipe standardisation now nils empty main_product strings to avoid errors in recipe gen.
Version: 4.1.10
Date: 2021.03.11
  Bugfixes:
    - Fixed a concat typo in omni.lib.add_science_pack() causing a crash in rare cases
Version: 4.1.9
Date: 2021.03.08
  Info:
    - Moved Angels component mode "omniblocks" from lib to matter
  Bugfixes:
    - Fixed TechGen:setIcons() ignoring tech.icon_size when tech.icons is set
Version: 4.1.8
Date: 2021.02.25
  Features:
    - Added omni.lib.recipe_result_contains_string(recipename, string)
Version: 4.1.7
Date: 2021.02.11
  Bugfixes:
    - Fixed source_inventory_size, result_inventory_size, ingredient_count and result_count
    - -defaultring to 3 on BuildGen:import() when not set
    - Fixed a crash that could happen with recipes that had an empty main_product string set
Version: 4.1.6
Date: 2021.01.21
  Info:
    - Moved omni.locale and omni.icon to omni.lib.locale and omni.lib.icon
    - Renamed omni.marathon.standardise() to omni.lib.standardise()
  Features:
    - Add BuildGen:setFuelCategories(), replaces setFuelCategory for entities
  Changes:
    - fuel_categories (instead of fuel_category) is now used for all entities 
  Bugfixes:
    - Fixed TechGen:setLocName() / setLocDesc() ignoring keys and always adding "Technology-name."
    - Fix locale crashes with types added in latest experimental
Version: 4.1.5
Date: 2021.01.08
  Bugfixes:
    - Fixed an control error related to shortcuts
Version: 4.1.4
Date: 2021.01.04
  Bugfixes:
    - Fixed that omni.lib.replace_prerequisite() did not check if the tech already required 
      the new prerequisite
Version: 4.1.3
Date: 2021.01.03
  Bugfixes:
    - Fixed that BuildGen:import() overwrote the result amount to 1
    - Fixed that BuildGen:setOnAnimation() was pointing to off_animation
    - Fixed that InsertGen:setAnimation() created non-rotateable inserter platforms
Version: 4.1.2
Date: 2020.12.23
  Bugfixes:
    - Fixed that certain functions compared tables with "==" and caused unwanted sideeffects
Version: 4.1.1
Date: 2020.12.14
  Features:
    - Added Krastorio 2 support
  Bugfixes:
    - Fixed that setDurabilityDesc() was not setting durability_description_value
    - Fixed that recipe & item order were overwritten on entity import
Version: 4.1.0
Date: 2020.11.26
  Info:
    - Updated for Factorio version 1.1.0
Version: 4.0.4
Date: 2020.10.04
  Features:
    - Added TechGen:sethidden()
  Bugfixes:
    - Fixed omnitractors mk4+ requiring the wrong plates with angels industries
    - More compression unlock fixes
    - Fixed missing recipe flags on recipe standardization
Version: 4.0.3
Date: 2020.09.01
  Bugfixes:
    - Fixed a possible crash with omni.lib.replace_recipe_result() due to missing brackets
Version: 4.0.2
Date: 2020.08.31
  Features:
    - omni.lib.add_recipe_ingredient()/result() can replace .expensive ings/res seperately
  Bugfixes:
    - Fixed omni.lib.add_unlock_recipe() not disabling the recipe
    - Fixed setLocDesc() forcing localisation types
Version: 4.0.1
Date: 2020.08.22
  Features:
    - Add omni.lib.iunion as a faster alternative to lib.union for merging two contiguous arrays
  Bugfixes:
    - Fixed cases where gcd function hung on NaN
    - Fixed cases where recgen wouldn't handle tech icons correctly
    - Added omni.lib.multiply_recipe_ingredient()
Version: 4.0.0
Date: 2020.08.14
  Changes:
    - Updated for Factorio version 1.0
    - Added "spider-vehicle", "spider-leg" and "spidertron-remote" types
Version: 3.18.18
Date: 2020.08.13
  Features:
    - Added omni.lib.enable_recipe()
  Bugfixes:
    - Fixed a case where icon overlays weren't added correctly
    - Fixed omni.lib.replace_science_pack() not properly working with untagged tables
Version: 3.18.17
Date: 2020.08.07
  Bugfixes:
    - Fixed a control error when loading up old saves
Version: 3.18.16
Date: 2020.08.07
  Changes:
    - Fixed RecGen:impoort overwriting recipe subgroup and order
    - Complete rewrite of all recipe related functions to avoid unnecessary standardisation
    - Control.lua rewritten and now handles compression unlocks
    - Run-time and load-time performance improvements
  Bugfixes:
    - Multiple locale and icon fixes in recipe-generation
Version: 3.18.15
Date: 2020.07.15
  Features:
    - Added BuildGen:setNextUpgrade()
  Changes:
    - Added logging functions to give better feedback when loading up mods with broken recipes
    - Tweaked the science pack colour override script to be less heavy handed
    - Updated some of the omnidate scripts to reflect updates to compression tech naming
Version: 3.18.14
Date: 2020.07.02
  Bugfixes:
    - Added missing entity types to omni.lib.find_entity_prototype()
Version: 3.18.13
Date: 2020.06.19
  Bugfixes:
    - Fixed recipe.normal/expensive.result and .result_count not beeing nilled
    - Replaced old vanilla SP icons
    - Internal restructuring
Version: 3.18.12
Date: 2020.06.09
  Bugfixes:
    - Fixed multi-result recipe localisations beeing broken in some cases
    - Fixed setFuelCategory() not working for inserters #96
    - Fix recipes that only have .normal set not being standardised before acessing .expensive
    - More localisation fixes in recipe-generation
    - Added more checks to improve standarisation consistency
    - Cleaned up omniblock call script to only shor up if needed
Version: 3.18.10
Date: 2020.05.01
  Changes:
    - Removed hard crash from omni.lib.add_prerequisite(tech, req) if tech does not exist
    - Added an additional check if req exists to prevent crashes with mods removing techs
    - Recipe standardisation no longer sets icons() for single result recipes
  Bugfixes:
    - Fixed omni inserters beeing more than twice as loud as vanilla inserters
Version: 3.18.9
Date: 2020.04.27
  Bugfixes:
    - Fixed Recipe standardisation changing multi result recipe icons in some cases
Version: 3.18.8
Date: 2020.04.26
  Features:
    - Added a steam powered Omnitractor and Omniphlog
  Bugfixes:
    - Fixed Recipe standardisation not updating icons & localised names in some edge cases
    - Optimised small icon addition
    - Fixed tinting on omnic water recipes
Version: 3.18.7
Date: 2020.04.20
  Bugfixes:
    - Fixed Recipe standardisation not working correctly on some edge cases
Version: 3.18.6
Date: 2020.04.19
  Features:
    - Added a function to set entity Output Slots
  Bugfixes:
    - Fixed that Furnace output slots default to 7 like assemblers
    - Fixed Recipe standardisation causing invalid main products
    - Fixed localisations not working in some cases
Version: 3.18.5
Date: 2020.04.16
  Bugfixes:
    - Fixed standardisation function not updating all results
Version: 3.18.4
Date: 2020.04.14
  Bugfixes:
    - Fixed that recipe-standard function was forcing icon overrides even when not needed,
      causing icon size mismatch
Version: 3.18.3
Date: 2020.04.13
  Features:
    - Support for Angel's Industry components
  Bugfixes:
    - Fixed a crash when adding a Prereq to a tech that had none so far
    - Fixed a crash when the added Prereq already existed
    - A ton of under the hood fixes and refactoring
Version: 3.18.2
Date: 2020.04.04
  Bugfixes:
    - Fixed a crash when a message was send over the server interface
Version: 3.18.1
Date: 2020.04.03
  Features:
    - Added material requirement progression support for various Angel's/Bob's combos
    - Updated localization
Version: 3.18.0
Date: 2020.04.02
  Features:
    - Updated to 0.18
    - Added thumbnail
  Bugfixes:
    - Fixed recipe standardization not getting main_product out of expensive.
  Info:
    - Added changelog.