Updated the connection_type values in the Lua script to be more specific and accurate. For example, replacing `tree-01` with `wood` and adding a check for `pipe` in a certain condition. These changes ensure that the proper entities are being connected and handled correctly.
Description: Added functionality to harvest wood from tree entities in the game. The changes include adding a new function `harvest_trees` to handle wood harvesting, updating the `harvest_resource` function to include a new parameter `radius` for specifying the search radius, and modifying tests to verify wood harvesting functionality. Wood can now be harvested based on tree entities' wood amount and the player's inventory is updated accordingly.
Fixed the orientation calculation for the pipe position of OffshorePump entities. The calculation now correctly adjusts the position based on the orientation, ensuring the pipes are connected properly. Also, added debug prints for testing purposes and updated test cases to include different orientations for connecting entities.
The `global.actions.get_resource_patch` function in `get_resource_patch.lua` has been updated to include a `radius` parameter. This parameter allows the function to search for resources within a specified radius of the given position. Additionally, the function now includes a check for the resource type "water" to handle water tiles separately. The bounding box calculation and resource exploration have been modified to accommodate the radius parameter and the water resource type check. The function now returns the bounding box that encompasses the entire resource patch and the total size of resources found within the specified radius.
Description: This commit refactors the entity connection functionality in several files to improve code readability and maintainability. Changes were made in the following files: connect_entities.py, get_entity.py, observe_all.py, pickup_entity.py, place_entity_next_to.py, and rotate_entity.py. These changes do not affect the overall functionality of the application but improve the organization of the codebase.
This commit adds a new method `_deduplicate_entities` to the `ConnectEntities` class in the `connect_entities.py` file. This method removes duplicate entities from a list while maintaining the original order. It checks the position of each entity and only keeps the last occurrence of entities with the same position. The commit also improves the entity creation process in the same class by directly appending the created entity to the path list instead of appending a dictionary and then creating the entity separately. Finally, it updates the existing entity creation process to use the new deduplication function for the `path` list, ensuring that only unique entities are stored.
The FactorioInstance class had several command methods refactored to improve code readability and maintainability. The reset() method was updated to remove unnecessary commented-out code, while the initialise() method was refactored to use the Lua script manager to load specific game initialization commands. Additionally, the old logic for commands in the initialise() method was commented out for potential future reference. These changes enhance the organization and efficiency of the FactorioInstance class in handling game commands.
This commit refactors the loading and caching of Lua scripts in Factorio to improve performance and reduce redundant script loading. Changes include updating the file structure, adding a script caching mechanism, and optimizing script loading. Performance benchmarks comparing cached and uncached script loading show a significant improvement with caching resulting in faster script loading times.
Implemented a more efficient method for handling path requests in the request_path.lua file. This change improves the overall performance of the application by optimizing the way paths are processed and handled.
Refactored the test_auto_fueling_iron_smelting_factory by removing unnecessary code comments and simplifying the connection of entities using the game.connect_entities method. Updated the connections between the coal drill, furnace, and iron drill fuel inserter for better clarity and organization.
Commit Description: Refactored multiple files within the actions and controllers modules to improve code organization and readability. Updated connect_entities.lua, connect_entities3.lua, connect_entities_2.lua, connect_entities_4.lua, connect_entities_with_belts.lua, get_entity.lua, initialise.lua, inspect_entities.lua, move_to.lua, place_entity.lua, place_entity_next_to.lua, request_path.lua, rotate_entity.lua, and serialize.lua files. Additionally, made changes to connect_entities.py, inspect_entities.py, move_to.py, place_entity_next_to.py, request_path.py, and rotate_entity.py controllers. Updated factorio_entities.py and factorio_types.py files. Ran tests on test_inspect_entities.py, test_move_to.py, and test_connect.py to ensure functionality was not impacted. Branch: main.
Commit Description: Refactored the code in various files related to entity connection functionality in order to improve readability, maintainability, and performance. Changes were made in src/actions/connect_entities.lua, src/controllers/connect_entities.py, and src/tests/functional/test_connect.py. The refactoring involved restructuring the code, optimizing certain functions, and ensuring consistency in naming conventions. This should make it easier to add new features or fix bugs related to entity connection in the future.
Optimized the position calculations in connect_entities.lua and connect_entities.py by using math.floor on source and target positions. Additionally, adjusted connection point positions in connect_entities.py for specific entity types to improve accuracy and efficiency.
This commit updates the logic for placing entities next to each other to ensure proper spacing and alignment based on entity sizes and direction. It also includes test cases to validate the placement of entities of different sizes and types. Additionally, the commit introduces a specific test scenario for placing a transport belt next to a boiler to ensure proper positioning and alignment.
In this commit, the direction mapping in several scripts has been updated to align with Factorio's directions. The changes include converting certain directions by dividing them by 2 to match the expected values in Factorio. Additionally, adjustments have been made to handle directions for inserters correctly. The commit also includes changes to rotate entities as needed in the game environment. The Docker configuration file has been modified to update port mappings. Furthermore, the commit includes adjustments in the FactorioInstance class to set initial scores correctly and handle direction conversions. Lastly, modifications have been made in the Memory class to log to files in a specified directory and handle exceptions gracefully. Branch: main.
Added a new function `global.actions.rotate_entity2` to rotate the closest building entity in the specified direction. The function takes player input for coordinates and direction, finds the closest building entity in the area, validates the direction input, sets the entity's direction, and prints a message confirming the rotation. Additionally, the function `table_contains` is defined to check if a value is present in a table. The existing `global.actions.rotate_entity` function now includes logic to limit the number of rotations allowed while adjusting the entity's direction towards the specified orientation. The function also prints the current and target direction for debugging.
Commit Description: Refactored multiple functions within the actions module to improve readability and maintainability. The changes include restructuring the file organization, renaming functions for clarity, and optimizing code for better performance.
The MoveTo controller has been updated with the removal of unused imports and code, as well as commented out sections. This improves the code readability and maintenance.