Skip to content

Releases: redruin1/factorio-draftsman

3.3.0

26 Feb 20:41

Choose a tag to compare

  • Updated factorio-data to version 2.0.76 (latest)
  • Added ConstantCombinator.add_signal and ConstantCombinator.get_signal
    • These make simple cases of setting a unique signals in a constant combinator much easier since you don't have to do the signal section management yourself
  • Added sqrt_lut.py and tedius_inserters.py to ./examples
  • Merged Snagnar's pull request:
    • Selector combinator count_inputs_signal should be count_signal
  • Fixed #217 (Turret priority_list should be priority-list)

3.2.0

20 Oct 13:02

Choose a tag to compare

  • Updated factorio-data to version 2.0.71 (latest)
  • Updated Splitter to be circuit connectable (Factorio 2.0.67)
  • Made more SignalFilter attributes optional, bringing it more in line with how Factorio operates
  • Removed several hacks working around a bug in attrs
    • Minimum attrs version is now 25.4.0
  • Fixed issues hidden by the hacky workaround of above bug
  • Added (mostly) correct collision boxes for all new rail entities ([Elevated]StraightRail, [Elevated]HalfDiagonalRail, [Elevated]CurvedRailA, [Elevated]CurvedRailB)
  • Fixed #205 (Cannot create or load an interrupt with targets)
  • Fixed #207 (TypeError running README example)
  • Removed validator issuing GridAlignmentWarnings (possibly temporarily) due to lack of contextual information needed to make them useful

3.1.1

07 Sep 21:32

Choose a tag to compare

  • Added Github workflow for automatically testing draftsman update
  • Fixed #199 (draftsman update fails if multiple mods with no explicit dependencies)
  • Fixed #200 (Failure to extract data from Factorio+ modpack)

3.1.0

27 Aug 13:43

Choose a tag to compare

  • Added support for Blueprint.parameters
  • Added Valve prototype (added in Factorio 2.0.48)
  • Improved Lua stack trace output on LuaErrors when running draftsman update
  • Fixed #196 (draftsman update fails to load pyanadons mods)
  • Fixed #197 (draftsman update fails on mod "Kuxynator's Production Rates")

3.0.1

20 Aug 04:46

Choose a tag to compare

  • Updated factorio-data to version 2.0.64 (latest stable)
  • Added --owns and --no-dlc arguments to draftsman update and draftsman.environment.run_data_lifecycle() (#184)
  • Added command just benchmark which will run a suite of benchmarks and record the result in a .benchmarks folder
  • [PERF] Improved ManualSection.get/set_signal() for requester chests and constant combinators
  • [PERF] Implemented a special SpatialDataStructure for tiles, leading to ~16x speedup on adding tiles to blueprints
  • Fixed #185 (Load order inconsistencies/disparity on non-trivial mod lists)

3.0.0

11 Aug 20:30

Choose a tag to compare

  • Updated factorio-data to version 2.0.63 (latest stable)
  • Switched from pydantic to attrs;
    • A much better fit for Draftsman's scope, much more flexible, and much less boilerplate to maintain
    • Clearer distinction between loading steps:
      • Constructors are for initializing Draftsman objects
      • from_dict() and from_string() methods are for importing from raw JSON/Blueprint String
      • to_dict() and to_string() methods are for exporting to raw JSON/Blueprint String
      • Hooks are defined outside of the class scope which converts the raw JSON format to the internal Python object form
      • This now means that the Python objects are not strictly tied to the JSON format, which means they can deviate for ease of use/performance reasons
      • Conversion functions are separate from validation, meaning shorthands can be resolved even with validation functions turned off
  • Draftsman entities can now handle importing/exporting between Factorio 1.0 and Factorio 2.0 blueprint string formats
    • Simply specify version=(1, 0) or version=(2, 0) in any of to/from_dict() or to/from_string() methods
    • While serialization/deserialization is correctly implemented, migration from an old to new string is not (fully) implemented, and so some parts will still have to be done manually
      • For example, Draftsman will not convert a 1.0 "filter-inserter" into a 2.0 "fast-inserter" for you
  • Added tests to validate the exported formats of all objects match the above JSON schemas, on both game versions
  • Added draftsman.constants.InventoryType which is part of defines
  • Changed the constant ValidationMode.NONE to be the more explicit ValidationMode.DISABLED
  • Removed the validate_assignment attribute entirely
    • Instead, validation is now on a global flag (until there is a good reason for it not to be); makes things much simpler
    • Global flag can be acquired with draftsman.validators.get_mode() and set with draftsman.validators.set_mode(...)
    • set_mode() can also be used as a context manager:
      # Default validation level is `STRICT`
      assert draftsman.validators.get_mode() is ValidationMode.STRICT
      
      with draftsman.validators.set_mode(ValidationMode.DISABLED):
          # No validators are run inside this block
          assert draftsman.validators.get_mode() is ValidationMode.DISABLED
      
      # Validation state returns to whatever it was set before
      assert draftsman.validators.get_mode() is ValidationMode.STRICT
  • Calling a objects validate() method is now guaranteed to also validate all of its children
  • Removed RequestItemsMixin and implemented it directly in Entity (since all entities can request construction items)
  • Removed __factorio_version__ and __factorio_version_info__
    • Users should instead use draftsman.data.mods.versions["base"] if you want to query the current Factorio version; this gives you the flexibility to change Factorio version midway through scripts (if necessary)
  • Added tiles to Groups (#118)
    • Blueprint.entities is now 1-dimensional
    • A new attribute Blueprint.groups now holds children associated with that blueprint
      blueprint = Blueprint()
      
      group = Group()
      group.entities.append("blah", position=...)
      
      blueprint.groups.append(group)
    • blueprint.entities[("a", "b", "c")] is now blueprint.groups["a"].groups["b"].entities["c"], which is more explicit and allows for accessing the newly added tiles attribute
    • However, ID-sequences are still permitted in function calls, a la:
      blueprint.add_circuit_connection("red", ("a", "b", "c"), ("x", "y", "z"))
  • Tidied up the build system
    • Removed setup.py in favor of more modern pyproject.toml
    • You can now use just with draftsman to run common CI commands, see new README
  • Made docs pass and fixed code coverage
  • Wrote an obnoxious amount of new and updated documentation
  • Fixed an issue where certain mods would no be displayed correctly as disabled when using draftsman list
  • Fixed #182 (Failing to update with any mods, with an AttributeError caused by an internal function.)

2.0.3

16 Jul 18:37

Choose a tag to compare

  • Updated factorio-data to version 2.0.60 (latest)
  • Fixed #164 (Decider combinator example doesn't work)
  • Merged vjanell's pull request:
    • Fix reversed operators in DeciderCombinator __ge__ and __le__ methods
  • Fixed #178 (Entity flipping logic has multiple bugs and crashes)

2.0.2

21 Apr 01:28

Choose a tag to compare

  • Updated factorio-data to version 2.0.45 (latest)
  • Fixed #158 (Key "comparator" not found when exporting/importing Constant Combinator)
  • Fixed #157 (Incompatibility with pydantic>=2.11)

2.0.1

17 Mar 00:44

Choose a tag to compare

  • Updated factorio-data to version 2.0.41 (latest)
  • Added planets.get_surface_properties() which grabs a dict of surface properties with valid defaults
  • Added Entity.surface_conditions, which maps directly to the Factorio API surface_conditions
  • Added Entity.is_placeable_on(), which returns false if an entity's surface_conditions prohibit their construction on a planet
  • Added utils.passes_surface_conditions(), which acts as the abstract backend which runs Entity.is_placable_on() and recipes.is_usable_on()
  • Added testing for Asteroid Collector
  • Finished implementing features for LogisticsContainers
  • quality is now an accessible and modifiable attribute of Entitys
  • Made Container.inventory_size proportional to the entity's quality
    • (note that all quality modifiers are not yet available)
  • Merge RosieBaish's pull request:
    • Add logic to allow mods with different special characters
  • Merge Gavinp's pull requests:
    • Add test for creating items with position
    • Add test for recycler get_world_bounding_box()
    • draftsman now prints usage/help on empty args.
  • Fixed #142 (Logistics containers not importing properly)
  • Fixed #121 (Support for Bob's Inserters)
  • Fixed #151 (Severe Performance degradation when using add_circuit_connection)

2.0.0

03 Jan 00:08
bed147f

Choose a tag to compare

For a more user friendly overview of some of the changes, see here.

  • Updated factorio-data to version 2.0.28 (latest)
  • Updated compatibility/defines.lua to 2.0.28 (latest)
  • Updated all prototypes to match Factorio 2.0
  • Added new prototypes in Factorio 2.0
    • AgriculturalTower
    • AsteroidCollector
    • Car
    • CargoBay
    • CargoLandingPad
    • CurvedRailA
    • CurvedRailB
    • DisplayPanel
    • ElevatedCurvedRailA
    • ElevatedCurvedRailB
    • ElevatedHalfDiagonalRail
    • ElevatedStraightRail
    • FusionGenerator
    • FusionReactor
    • HalfDiagonalRail
    • LightningAttractor
    • RailRamp
    • RailSupport
    • SelectorCombinator
    • SpacePlatformHub
    • SpiderVehicle
    • Thruster
  • Removed command line utility draftsman-update
  • Added command line utility draftsman with multiple subcommands
    • draftsman update ... for the original functionality of modifying a Factorio environment
    • draftsman list to list all mods detected under a particular environment
    • draftsman enable/disable ... enables or disables one or more mods
    • draftsman factorio-version reports or sets the version of Factorio's data
    • draftsman version reports Draftsman's own semantic version
    • Write draftsman -h or draftsman [command] -h for more information
  • Swapped from schema to pydantic
    • Format for specifying schemas is now much clearer
    • Both blueprintables and entities now share the same exporting code, overall making more sense
    • Can now create a JSON schema of any entity or blueprintable (by calling Object.json_schema()), which can be exported and used in any other program that reads JSON schema(!)
    • However, minimum Python version is now 3.7 to support type hints
  • Switched from unittest to pytest (more features with similar syntax; coverage run still works the same)
  • Changed the code to be primarily Python3 compatible with the new minimum version
  • Added extras module which implements some handy new features:
    • Added flip_belts(blueprint) which flips all belt entities inside the blueprint (preserving continuity)
  • Added a bunch of equivalent functions from the Factorio StdLib:
    • Added opposite(), next(), previous(), to_orientation(), and to_vector() to Direction
    • Added Orientation class, similar to Direction; comes with it's own suite of __add__(), to_direction(), and to_vector() helpers
    • Added constants.Ticks enumeration which contains SECONDS, MINUTES, HOURS, etc. stored as quantities of Factorio ticks
  • Added union, intersection, and difference to EntityList, TileList, and ScheduleList
  • Updated Direction to now be the Factorio 2.0 16-direction enum; use LegacyDirection for the old enumerations
  • Added TrainConfiguration, which allows you to specify entire trains with strings like "1-4-1" and customize them on a per-car basis
  • Added WaitCondition and WaitConditions objects which keep track of train station condition trees
    • WaitConditions can be combined using bitwise and and or in order to collect them into a WaitConditions object:
    • Added WaitConditionType and WaitConditionCompareType enumerations
  • Added Collection.add_train_at_position() and Collection.add_train_at_station() to make placing trains easier
  • Added Collection.find_trains_filtered() to allow users to search Blueprints/Groups for trains of particular types
  • Added RailPlanner (finally)
  • Added data.fluids module with some useful helpers
  • Added data.planets module allowing you to access planet metadata for things like surface properties
  • Added data.items.fuels which is dict of sets of item names that fall under their respective fuel categories
  • Added data functions signals.add_signal(), tiles.add_tile(), entities.add_entity(), etc. which allow you to add entities on the fly (primarily for Factorio environment compatibility)
  • Added RequestItemsMixin to Locomotive, CargoWagon, and ArtilleryWagon
  • Added unknown keyword to all entity/tile creation constructs which allows the user to specify what should happen when draftsman encounters an entity it doesn't recognize
  • Changed InvalidEntityError and InvalidTileErrors so that they now try to detect a similar tile/entity name and display that information to the user in the error message
    • For example, if you accidentally type Container("wodenchest"), it will realize you probably meant to type Container("wooden-chest") and suggest that to you instead
  • Added a bunch of new documentation to document the above
  • Added a bunch of new examples to test out the above new features
  • Added a fixture that ensures that Draftsman is running a vanilla configuration before running tests, and exits if it detects that it is not the case.
  • Added a new command line option for draftsman-update --lua-version, which prints the version of Lua currently being used for debugging compat issues
  • Added a README.md to the examples folder which provides short descriptions for all of the examples
  • Integrated aforementioned examples into the test suite
  • Removed the area, tile_width, and tile_height properties from Blueprint, which have been replaced with get_world_bounding_box() and get_dimensions()
    • These attributes are no longer cached in the blueprint and have to be recalculated each time such information is desired
    • However, this means that it only has to be calculated when the user actually wants it, instead of every time a user adds a new entity/tile to a blueprint
    • The user has a better idea of when they can cache the blueprint's dimension to reduce calculation, so it's deferred to the user
    • By making them functions it also makes it abundantly clear that calling them is not likely O(1)
  • Added the get_first method to the defaults for the name of every entity
    • This means that if a data configuration has zero entities of a particular type, using a default name will result in a palatable error instead of something cryptic
  • Added index attribute to all Blueprintable types, which allows the end user to customize the index in a parent BlueprintBook manually
    (Still autogenerated based on list order if unspecified, but now can be overridden)
  • Added data functions signals.add_signal(), tiles.add_tile(), entities.add_entity(), etc. which allow you to add entities on the fly (primarily for Factorio environment compatibility)
  • Fixed a bunch of warts in the API:
    • Added the ability to modify x and y attributes of both position and tile_position and have each other update in tandem
    • Made it possible to rotate objects in parent Collections as long as they're either square or rotated such that they preserve their original footprint (akin to Factorio)
    • Added __eq__ operators to pretty much all draftsman things (Entity, EntityList, TileList, ScheduleList, Schedule, WaitConditions, etc.)
    • Added more professional __repr__ functions to pretty much all draftsman things as well
  • Normalized all import filenames to use underscores consistently (potentially breaking change!)
  • Finished up documentation on DeconstructionPlanner
  • [PERF] Reduced memory consumption by up to ~80 percent(!) (This also made it quite a bit faster to boot)
  • Made it so that default collision_mask keys are resolved at once at the data level when you call draftsman-update, so you can query entities.raw for the correct default value
  • Bumped Lupa to 2.0 which allows me to specify Lua version 5.2 which Factorio uses (#50)
    • draftsman-update will issue a warning if it cannot specify the correct Lua version: It'll still try to load and may still work anyway, but it's not guaranteed to\
  • Added --factorio-version command for draftsman-update which either displays the current Factorio version or sets it to a specific Github tag
  • Patched InvalidModVersionError for now (#51)
  • Removed on_(tile/entity)_(insert/set/remove) from all EntityCollection and TileCollection classes
  • Removed on_(insert/set/remove) from all Entity implementations as well (they were not used and are replaced with better things now)
  • Renamed data member to _root member on EntityList and TileList (Internal reasons)
  • Fixed issue #119