Robot256's Library


Utilities used in many of my mods bundled into one package.

Internal
4 days ago
0.17 - 2.0
27.8K

Changelog

Version: 2.0.5
Date: 2024-11-17
  Changes:
    - Added support for Factorio 2.0 train groups.
Version: 2.0.4
Date: 2024-11-02
  Bugfixes:
    - Fixed that copy_color_from_train_stop was not preserved on replacement.
Version: 2.0.3
Date: 2024-11-01
  Bugfixes:
    - Fixed crash when replacing carriages with equipment grids.
    - Fixed that equipment removal orders were not preserved.
Version: 2.0.2
Date: 2024-11-01
  Bugfixes:
    - Fixed that fuel insert requests were recreated out of order during carriage replacement.
    - Fixed that fuel removal requests were lost during carriage replacement.
Version: 2.0.1
Date: 2024-10-31
  Bugfixes:
    - Fix crash in pipette library when not in cheat mode due to quality handling code.
Version: 2.0.0
Date: 2024-10-11
  Changes:
    - Updated for Factorio 2.0
    - Added support for rolling stock quality when replacing carriages
    - Added support for artillery auto targeting control
    - Added support for quality and spoilage when copying Cargo Wagon cargo
    - Added support for quality in burner, ammo, item-request-proxy, and probably equipment grid.
Version: 1.1.5
Date: 2024-01-06
  Changes:
    - Prevent unnecessary on_entity_color_changed events when replacing trains with no color set.
Version: 1.1.4
Date: 2022-01-23
  Bugfixes:
    - Fix item duplication when pipetting Vehicle Wagons in Space Exploration remote view mode.
Version: 1.1.3
Date: 2022-01-23
  Bugfixes:
    - Fix pipette mapping behavior when "Pick ghost item if no items are available" option is enabled.
Version: 1.1.2
Date: 2020-12-05
  Bugfixes:
    - Carriage replacement restores artillery wagon "damage dealt" statistic.
Version: 1.1.1
Date: 2020-12-03
  Bugfixes:
    - Carriage replacement restores any open player GUIs with the new entity, since deleting the old one closes the GUI.
Version: 1.1.0
Date: 2020-11-23
  Changes:
    - Updated empty book/upgrade/deconstruction item strings in save_restore/spillStack function. (This probably would not have worked in 1.0 either.)
Version: 0.18.8
Date: 2020-09-15
  Bugfixes:
    - Prevent saving item-request-proxy with empty contents, to fix crash when restoring item-request-proxy with empty contents.
Version: 0.18.7
Date: 2020-07-09
  Bugfixes:
    - Fixed errors when saving and restoring cargo inventory filters and bars.
Version: 0.18.6
Date: 2020-05-29
  Bugfixes:
    - Update for Factorio 0.18.27.
    - Removed any attempt to generate on_player_placed_equipment event.
Version: 0.18.5
Date: 2020-05-28
  Bugfixes:
    - Empty or invalid inventories return nil instead of empty arrays.
    - Preserve flags on carriage replacement: minable, destructible, operable, rotatable, enable_logistics_while_moving.
Version: 0.18.4
Date: 2020-05-26
  Bugfixes:
    - Should be the last accidental global reference.
Version: 0.18.3
Date: 2020-05-23
  Bugfixes:
    - Fixed even more accidental global references.
Version: 0.2.1
Date: 2020-05-23
  Bugfixes:
    - Fixed some accidental global references and dangling variables.
Version: 0.2.0
Date: 2020-01-23
  Changes:
    - Update for Factorio 0.18.
Version: 0.1.1
Date: 2020-01-23
  Features:
    - Added parameter to replaceCarriage to flip the orientation of the wagon during replacement.
    - Added support to replaceCarriage for copying cargo wagon filters and inventory.
    - Added support for saving and restoring arbitrary LuaInventory objects.
    - Added support for saving and restoring Blueprints, Blueprint Books, Deconstruction Planners, and Upgrade Planners stored in inventories.
    - Added support for saving items with equipment grids, like Modular Armor. Contents of grid is saved alongside the armor (script can't add grid to LuaItemStack that doesn't already have one).
    - Added basic functions to make event filter lists for a given set of entity names (work in progress).
  Scripting:
    - mergeStackLists(stack1,stack2):  Consolidates items in stack2 into stack1, returns stack1.
    - itemsToStacks(items):  Converts item list stored in name:count dictionary format into StackList.
    - saveInventoryStacks(source):  Replaces saveInventory.  Returns StackList.
    - insertStack(target, stack, stack_limit):  Attempts to insert _stack_ into LuaInventory _target_.  Returns SimpleItemStack with any items that could not be inserted.
    - spillStack(stack, surface, position):  Spills the items in _stack_ onto _surface_ at _position_.
    - spillStacks(stacks, surface, position):  Spills the given list of stacks.
    - insertInventoryStacks(target, stacks):  Attempts to insert _stacks_ into LuaInventory _target_.  Returns StackList with any items that could not be inserted.
    - removeStackFromSavedGrid(savedGrid, stack):  Attempts to subtrack _stack_ from a grid contents structure created by saveGrid.
    - saveGridStacks(savedGrid):  Converts a saved grid structure into StackList so that it can be disassembled and added to inventories.
    - saveFilters(source):  Saves all the slot item filters and sizing bar in LuaInventory _source_.
    - restoreFilters(target, filters):  Sets filters and sizing bar in LuaInventory _target_ according to saved _filters_ structure.
    - generateNameFilter(<strings and/or lists of strings>):  Returns a list of filter entries for every string in the argument(s) in the form {filter="name", name=<entry>, mode="or"}.
    - generateGhostFilter(<strings and/or lists of strings>):  Returns a list of filter entries for every string in the argument(s) in the form {filter="ghost_name", name=<entry>, mode="or"}.
  Changes:
    - Changed all inventory manipulation to use arrays of SimpleItemStack structures ("StackList" structure).
    - Added input null checking on all functions.  If target is null, "insert" functions return the entire argument as remainders.
    - saveBurner, restoreBurner: Uses saveInventoryStacks and insertInventoryStacks to handle fuel inventories.
    - restoreGrid, restoreBurner: Returns list of any fuel and equipment that could not be inserted.
Version: 0.1.0
Date: 2019-12-29
  Scripting:
    - function replaceCarriage:  sneakily swaps any rolling stock entity with another entity of the same type.
    - function saveGrid, restoreGrid, saveBurner, restoreBurner:  used transfer equipment grids between entities.
    - function saveItemRequestProxy:  checks for the Item Request Proxy associated with the given entity (fuel, ammo, or module insertion request) and saves it in a format that can be easily recreated on the new entity.
    - function mapBlueprint, mapPipette:  checks player cursor, cut/copy blueprint, or blueprint item and swaps entity names per the given map.  Useful to prevent non-craftable items from being created or requested.