Crafting Efficiency

Adds technologies to increase the gain of wastefull and expensive processes, such as copper cable, steel, gears, circuits, and engines. Requires omniLib which enables dynamic recipe generation and auto-updating entities in world with newer recipes. Works on items even if mods change their recipes. Updated for Factorio v17
a month ago
0.16 - 0.17
6439

Changelog

Version: 0.1.06
Date: 05. 12. 2019 
  Changes:
    - Changed dependency to require omniLib 3.09. Patched with Zelos to correct productivity modules being deleted after update caused them to be invalid. Productivity modules should once again, be permitted in recipes. No warranties or refunds for lost modules. Sorry.
              

Version: 0.1.05
Date: 03. 17. 2019
  Changes:
    - Steel efficiency now requires detection of a mod that adds a furnace capable of selecting the smelting recipe. hard coded, unfortunately. bob's assembly+plates+ores, or advanced furnaces by badway are the only valid options for now that i'm aware of.
              

Version: 0.1.04
Date: 03. 05. 2019
  Changes:
    - Added recipe-name-based check to prevent recipe types of "compression/stacking/recycling",etc from being treated as valid for efficiency research recipes. Via omni.lib.string_contained_list(str, list)
    - Removed some legacy code that never worked in the first place and had long-been commented out.
    - "Variety-scanning" code should function for the most part but has not been thoroughly tested in various mod-configurations. Future mods may also be released that require adjustments to settings. 
    - Improved VarietyList comparison logic. Reduced function-calls slightly by re-arranging order of operations. Very large modpacks will still suffer slightly, but much less so than previous code would have caused. Filtering/blacklisting is also improved.
              

Version: 0.1.03
Date: 03. 01. 2019
  Changes:
    - Added technology-description localization entries
    - Mod thumbnail added
    - Factorio v15 Legacy Code "technology.lua" file removed entirely.
              

Version: 0.1.02
Date: 02. 28. 2019
  Changes:
    - Updated item, entity, and reference names to those being used for 0.17
    - Updated dependency info with current information available. some mods still require update before functions/integration is restored.
    - Minimum version omniLib required: 3.0.0
              

Version: 0.0.24
Date: 12. 06. 2018
  Changes:
    - Disabled dynamic code for generating list of recipes with result == itemName while template-based blacklisting feature is put into place. Effectively reverts version back to 0.22 for those changes. Necessary as several more utility functions will likely need to be put into place. Mod can detect if recipe is enabled from start of game or can be unlocked by research, but there was no method put in place to deal with mods such as deadlocks stacking or other compressed-item based mods. Both a method for ensuring recipe ingredient table does not contain result-item as well as a method for checking recipe Name against a list/template of known mods functioning systems for generating compressed-items etc will need to be added BEFORE the dynamic variety-list gen method is re-enabled. Once complete, this should allow, mod-load-order-permitting, for any mods to change any recipes or add recipes for the items that have Efficiency Research----without causing problems of any sort... But more work is required.
	- Code is either commented out or logic'd out, but other changes from 0.23 should still be effective. Individual items can still be disabled; item recipe icons should now use the correct icons (mod-load-order-permitting).
              

Version: 0.0.23
Date: 12. 05. 2018
  Changes:
    - Changed minimum [for each] tiers to 0 for each item/science pack. Makes it possible to disable individual type. Useful mostly for steel if you don't have a furnace with a recipe GUI. 
    - Enabled optional selection of science pack efficiency. Set tier to 0 to disable a specific pack's efficiency research and keep only those you want. 
    - Added method to add Efficiency research for alternative recipes. Alpha version. Scanning method heavily reliant on data-load-order and mod-dependency-hierarchy. 
    - Changed internal references to icons to be based on recipeName rather than internal item-name, should fix some scenarios of mismatched icons. 
    - Changed active recipe logic to include a mandated tech-tree scan to ensure recipe is not added, and then later removed by another mod. Data-load-order reliant. 
    - Py still not explicitly supported, because py is incompatible with all the things. Your mileage may vary. sorrynotsorry
    - Plastic seems broken with /when using angel's petrochem eventhough it *shouldn't* be broken. Need a new set of eyes to determine cause, i've already spent too long trying to fix.
    - Something something tiny fixes.
              

Version: 0.0.22
Date: 11. 19. 2018
  Changes:
    - Change code-ordering so that generateFractionMatrix only runs once per [prototype].lua rather than per item-name. 
    - Refactored code resulted in reduced load time from 8.895 seconds to 5.482. Improvement: 3.413 seconds. almost 40% improvement. 
    - Improved handling of improper prerequisite technology declaration for modded/customized items. Errors due to missing or incorrect naming of technology should result in no prerequisite being set without throwing any errors/crashing game. Correct LUA syntax must be followed, however. This only handles scenarios where either the customized items added do not have an entry in the prerequisite table, or if the named-technology doesn't exist.
              

Version: 0.0.21
Date: 11. 18. 2018
  Changes:
    - Fixed Changelog format. Now viewable from changelog window in-game
              

Version: 0.0.20
Date: 11. 18. 2018
  Changes:
    - Removed base_prob as a variable/config option, etc as it was mostly added for an earlier idea that was never realized, and thus abandoned. 
    - Fixed issue where science pack efficiency was using the Yield_Increase_Rate of standard items instead of the one specific for science packs. 
    - Improved decimal-to-fraction matching, simplifying, or precision-reduction for fractions n/[2,3,4,5,6,8,10,12,16,20,25,32,50,64]. error rate for precision reduction generally less than 0.03%.
              

Version: 0.0.19
Date: 11. 17. 2018
  Changes:
    - Newer iteration of fractionalize method should prevent factorio stalling during load if yield_Increase Rate is > 2 decimal places or is highly-irrational/difficult to covert into a fraction within set denominator-resolution. Mix of "nearest-value" dictionary-lookup and precision-reduction/truncation is used. 
    - Newer iteration of fractionalize method should now correctly simplify as much as possible BEFORE multipliers are applied to a recipe's ingredient and result amounts. This does NOT solve scenarios where the resulting ingredient amount and result_count seem to indicate a better fraction. Fractionalize function has no knowledge (yet) of what the resulting recipe ingredient amounts and results will be. So some final recipes may seem like they should have different ingredient costs and outputs....oh well. This may be improved in future, but for now, this is the best the curret system can do.
              

Version: 0.0.18
Date: 11. 16. 2018
  Changes:
    - Futher impovement to fractionalize function and debugging scripts / logging info. 
    - New method includes rounded-decimal-comparison to list of fraction values (ie: 0.333xxxx resolves to 1/3 regardless of x values, and similar other iterations of like-code)
    - Floating-point rounding-error-handling improved
    - infinite-loop crash-prevention by precision=reduction to fewer decimal places if certain checks fail earlier in code.
    - New functions: NumberWithinScope and NumberWithinRange assist in determining acceptable deviation when converting decimal to a set of multipliers (fraction) / choosing which fraction best fits. 
    - debug logging now prints info on what item is being fractionalized. 
    - Procedurally generates a list of base-2 (denominator = 2,4,8,16,32,64) fractions and their decimal equivalents, which it then attempts to pair with the configured Yield value. If a match is not found that closely (+-0.003) matches, then, as a final attempt, the configured Yield_Increase_Rate is precision-reduced to 2-decimal places and fractions are calculated from there on. 
    - improved matching to fractions n/6, n/9, n/10, n/12, n/50, n/64. If a decimal closely (+-0.003) matches a fraction generated here, or can be expressed as one of these, it should match perfectly; otherwise it'll use GCD and precision-reduction to attempt to calculate a somewhat-rational fraction. Some values produce horrendous results, while others work exactly as expected. it is advised to only use a value of 3 decimal places or fewer, therefore.
              

Version: 0.0.17
Date: 11. 15. 2018
  Changes:
    - Fractionalize function overhauled (somewhat)
    - Improvements to fractionalize function that converts decimal values into a fraction (two different multipliers: one for ingredient costs and one for result_counts) to simplify recipes as best as possible. Some odd values for Yield_Increase_Rate may still generate undesirable results, but that's what enforced_reduction mechanism is for...
    - Corrected algorithm used for simplifying fraction.
    - Added mod-setting to print debug info that will inform user on what values are being generated by the mod. Needs some improvement to be wholly legible. 
    - Corrected odd (not even)-numbers generating incorrect fractions most of the time. at least in all cases i was able to generate. 
    - Does anybody even read these things? if so, I want you to know... I'm awesome. Hope you enjoy the mod.
              

Version: 0.0.16
Date: 11. 14. 2018
  Graphics:
    - Graphic cleanup
    - Deleted Icon folder. Mod will use icons that the native-recipe uses instead. Simplifies customization/adding custom items. 
    - Still no method for detecting if a graphic file exists/is available, so technology icons remain mandatory, however.
  Modding:
    - Added support for types: Item, module, ammo, capsule, and science packs (tool)
  Changes:
    - Technology pre-requisites now correctly do not NEED declaration in setting-values.lua, and error-handling will result in no-pre-requisite being set (treated as none) if declared pre-requisite doesn't exist. Mod will not throw error if custom item does not have a pre-requisite set or if the technology is missing or incorrectly named.  
  Bugfixes:
    - Fix config issue where vanilla science was using CE_Prob_IncreaseRate instead of CE-prob_increaseRateVanillaScience. Science yield improvement per level should now correctly follow it's own config value rather then copying the value used for other items. This enables science packs to improve at a different rate than other items.
              

Version: 0.0.15
Date: 11. 07. 2018
  Changes:
    - Added New function attempts to resolve/locate recipe for item in cases where the item name and recipe name do not match. 
    - Changed In event that no recipe is found with a result matching the item, efficiency research and related recipes for that item will be skipped to prevent error on load. 
  Bugfixes:
    - Fixed crash when recipe or technology = nil  (error-handling update)
              

Version: 0.0.14
Date: 11. 05. 2018
  Graphics:
    - Added tech icon for "logistic science pack" efficiency research. 
  Bugfixes:
    - Fixed CE not loading with bob's tech enabled.
              

Version: 0.0.13
Date: 11. 05. 2018
  Changes:
    - General: Major Handcrafting fix, Energy-bonus update, graphics update 
    - Removed "probability"-based version of incremental gains in previous release to make room for changes that would function for handcrafting
    - Changed Dynamic recipe generation calculates ingredient and result multipliers based on a custom decimal-to-fraction function. Decimal based on value set in Yield_Increase Rate in startup configs
    - Added inverse-coefficient bonus for energy vs yield increase rates (setting yield increase to 1 virtually negates improvement in timing. )
    - Changed Decimal to Fraction formula with enforced denominator resolution of 100: What is the maximum fractional multiplier applied to a recipe ingredient and results that most-closely resembles a decimal value for rate-of-increase. 100 gives less than 1% deviation from desired ratio. 
    - Info: In case the above was complicated: Handcrafting with partial (less than 1) units increase per research level are now possible because the function generates recipes with ingredient lists multiplies so that the results are whole numbers because factorio treats any recipe with an "uncertain-result" as invalid in terms of intermediate-hand-crafting for other items. 
    - Changed prob_increaseRate to 0.3
  Graphics:
    - Added graphics for other researches. Still haven't figured out a way (i doubt it's possible) to generate graphics in game based solely on the item icons and a background image, but if it *i possible, and you'd like to share the method or help me with that, i'd be very pleased.
              

Version: 0.0.12
Date: 11. 04. 2018
  Bugfixes:
    - Major localization fix 
    - Localization finally fixed to no longer show "unknown key" all over the place.
              

Version: 0.0.11
Date: 11. 03. 2018
  Changes:
    - Renamed data-updates.lua to data-final-fixes.lua 
    - Added optional dependencies to info.json
  Bugfixes:
    - Fixed omniPack having free recipe and logistic pack having different recipe based on earlier prototype version
              

Version: 0.0.10
Date: 11. 03. 2018
  Bugfixes:
    - General: Another handcrafting fix attempt
    - Fixed previous update did not resolve hand crafting issue, really (just got lucky when testing, or unlucky). Factorio will not treat any recipe with a fractional result (even if the result is bonus to a guaranteed result) as a valid recipe to use when calculating the resources required to craft another item. Since it can't calculate how many resources to reserve it treats the item as being uncraftable because it is unsure. For this reason starting_efficiency mod setting and implementation have been removed. new default for IncreaseRate set to 1. mod-setting info now includes disclaimer that reducing this rate of increase to any fractional amount will result in handcrafting not functioning for any items that require that item somewhere in their ingredient list if you don't already have sufficient amounts of that item already. (If however you do set the rate of increase lower than 1, you can still handcraft items such as wooden poles, so long as you manually craft the copper wire first. It just won't attempt to automatically craft it if you change the yield amounts to any fractional value.)
    - Fixed science integration with OmniCrystal. corrects typo. 
    - Fixed crash with omniCrystal or bobsTech because icons didn't exist. Added icons for omnipack and logistic science pack
              

Version: 0.0.9
Date: 11. 03. 2018
  Changes:
    - General: Energy-cost/timing, handcrafting fix, productivity, localization updated, vanilla science integration, and dynamic setting generation
    - Changed crafting times a bit more, now more closely resembles the rate of yield-increase (but does still yield products at a faster rate than the vanilla counterpart)
    - Adjusted energy costs for dynamic recipes to more-closely resemble the cost of the initial item * the current amount of product yielded (modified slightly based on config values, but it is a better function in all.)
    - Added vanilla science pack efficiency. Must be enabled manually, as the option is disabled by default. yield growth default is set to 0.2 and is kept/configured separately than the yield-rate improvement of the rest of the items. (this feature so that science pack yield increase rate can be set differently than the yield increase rate of everything else.)		
    - Added Dynamic setting-generation: science-efficiency settings for omniPack ; logistic science are only generated if omniscience+omniCrystal ; bobTech are detected. 
    - Changed format of refSciencePacks to match refItems in settings-values.lua 
    - Changed global limit on reserach tiers to 26 to keep recChain attempting to generate more levels of research than omniLib function permits natively. previous limit was 50 but caused game to crash. if customizing mod, do not change this value. 
  Bugfixes:
    - Fixed some localizations that were skipped in earlier releases.
    - Fixed some hand-crafting not working due to yield being based on probability so factorio would not attempt any hand-crafting (even when yield amount was greater than 1). Now, for dynamic recipes, any "excess" potential is treated as a probability, and the primary result is guaranteed, thus hand crafting should work so long as the level reached means the yield is greater than 1. If starting_efficiency is enabled, then handcrafting is limited until a certain reserach level and yield is reached, because all recipes with yield < 1 are treated as "probability" of yield, and factorio will never attempt auto-crafting in the event it is unsure what amount of resources to reserve for crafting said item. 
    - Fixed Productivity modules not being allowed. (requires omniLib 2.0.47)- Thanks Omnissiah Zelos.
              

Version: 0.0.8
Date: 10. 26. 2018
  Changes:
    - General: Mod Support, Balance, and additional configs		
    - Changed updated features requires omnilib 2.0.45 (update of current omniLib to get mod functionality working. Thanks to Omni author, Zelos)
    - Changed Yield defaults decreased for all items. Now is based on a configurable setting that increases yield values (default: +30% per level)
    - Changed Starting yield for all "efficiency" items begins at 0.5 for expensive recipes and 0.75 for normal recipes. First tier efficiency gives 90% yield (regardless of difficulty). and increases in yield by 30% at each progressive tech level. (assuming default values. prob_base, starting_efficiency, and prob_initial can all be used to modify this behaviour quite a lot)
    - Changed Technology costs and time to be based on tier (refered as "grade" by omniLib). base_time + (2*grade)
    - Added unique crafting time function to generate reasonable crafting times for all generated recipes based on several variables. 
    - Renamed Data.lua to data-updates.lua to switch recipe-generation to later during the loading phase to allow recipe-changes by mods to take affect before a "template" recipe is chosen as the one to be copied. May require later-transition to data-final-fixes.
    - Added configs for a whole mess of stuff. Number of techs generated per item are individually configurable. Mod-settings generate dynamically once settings-values.lua is updated with more item-names. Yield values can be tweaked, initial efficiency can be set to improve game balance, and individual items can be omitted from having their initial efficiency reduced as well. 
    - Moved core settings to settings-values.lua ---use this file to customize/add additional items. Instructions provided. "pipe" example provided. graphic already inserted into __graphics/technology/
              

Version: 0.0.7
Date: 10. 19. 2018
  Changes:
    - Changed: Integration with omniLib (now required). Mod is now considered alpha state due to scope of changes.
    - OmniLib enables recipes to be auto-updated in entities. 
    - Completing efficiency research will result in all machines being updated. Alpha mod has not been thoroughly tested yet.
              

Version: 0.0.6
Date: 09. 10. 2018
  Bugfixes:
    - Quick patch to get steel-efficiency functional. Requires that both "bob's assembly machines" and "bob's plates" mods are installed because they add a furnace with a recipe-configuration window similar to how the "pick recipe" screen works for assemblers. Regular furnaces will not benefit from the steel-efficiency tech.
              

Version: 0.0.5
Date: 09. 09. 2018
  Changes:
    - Cleanup of some code. Prepare for steel efficiency fix.
              

Version: 0.0.4
Date: 09. 09. 2018
  Bugfixes:
    - Fixed issue with renamed mod causing graphics lookup error (rename required for upload to modportal)
              

Version: 0.0.3
Date: 09. 09. 2018
  Changes:
    - Initial for version v16. 
    - Added efficiency technology for engine units.