Skip to content

Commit

Permalink
Merge pull request #950 from KiwiHawk/recipe-builder-overrides
Browse files Browse the repository at this point in the history
Recipe builder overrides
  • Loading branch information
KiwiHawk authored Nov 25, 2023
2 parents 4bb390f + c2e13bd commit c166b6d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions angelsrefining/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Date: xx.xx.xxxx
- Added custom error message for when trying to insert invalid items into a barreling pump (933)
- Changed Crystal catalyst recipe to require Crystallizer 2 (943)
- Removed Crystal catalyst from Bob's gem ore crystallization recipes (943)
- Changed the Recipe Builder to make it easier for other mods to add their own materials (950)
---------------------------------------------------------------------------------------------------
Version: 0.12.4
Date: 23.02.2023
Expand Down
4 changes: 3 additions & 1 deletion angelsrefining/prototypes/recipe-builder.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ end
RB.set_fallback = function(i_type, i_name, fb_list, i_condition) -- i_type either "item" or "fluid", i_name the name of the item, fb_list a table containing subtables { name, multiplier, condition } where item_name is a string, multiplier is a positive number (defaults to 1), and condition is a function taking i_type and i_name as arguments and returning a boolean (defaults to return true) can also be formatted { name = name, multiplier = multiplier, condition = condition }, condition (optional) is like the condition field in a subtable of fb_list but for i_name
local parent = fallbacks[i_type]
if parent then
if check_raw_for(i_type, i_name) and (not i_condition or i_condition(i_type, i_name)) then
if parent[i_name] ~= nil then
-- fallback already exists
elseif check_raw_for(i_type, i_name) and (not i_condition or i_condition(i_type, i_name)) then
parent[i_name] = nil
else
local sentinel = true
Expand Down

0 comments on commit c166b6d

Please sign in to comment.