redruin1 / factorio-draftsman

A complete, well-tested, and up-to-date module to manipulate Factorio blueprint strings. Compatible with mods.
MIT License
92 stars 17 forks source link

OverlappingObjectsWarning issued for perpendicular gates and rails #76

Closed SIGSTACKFAULT closed 1 year ago

SIGSTACKFAULT commented 1 year ago

consider the following blueprint: image

$ python3
Python 3.10.10 (main, Mar  5 2023, 22:26:53) [GCC 12.2.1 20230201] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import draftsman.blueprintable
>>> draftsman.blueprintable.get_blueprintable_from_string("0eNqdknELgjAQxb/L/b0ip3O6rxIRVocd6JRtRiL77jmlCBLE/rzj3u8ejzfApeqwNaQdqAHo2mgL6jiApVIXVdi5vkVQQA5rYKCLOkymoAo8A9I3fIKK/IkBakeOcNZPQ3/WXX1BMx58lNaN2vLudhOCQdvYUdXo8CqQYsmgB7UTIvae/YD4B1QWDpf0Yi/ehGgvRo83MnidT/gCMV4lyo3EZJWYbiSKP+KLluJLV61lG63J7daS3Ie+TI1SXwVk8EBj509ZlMicyzTnhyzm3r8A63LY5Q==")
<stdin>:1: OverlappingObjectsWarning: Added object 'straight-rail' (StraightRail) at (137.0, -551.0) intersects 'gate' (Gate) at (137.5, -551.5)
<stdin>:1: OverlappingObjectsWarning: Added object 'straight-rail' (StraightRail) at (137.0, -551.0) intersects 'gate' (Gate) at (136.5, -551.5)
<draftsman.classes.blueprint.Blueprint object at 0x7f70fbda0ca0>
>>> 

The rail and gate are perpendicular so they're valid. if they were parallel it should still probably emit, though.

redruin1 commented 1 year ago

Added a special case to check this for StraightRail and Gates. Ideally this would be abstracted out of spatial hashmap, but I'll leave that as a TODO for 2.0. This fix will be in 1.0.5.