Replies: 1 comment
-
This behavior, specifically the separation from spatial "detection" and "resolution" (I guess would be the best terms for them) is now possible in version No matter what way you slice it though, it's hard to delegate certain operations, because they are all somewhat integrated with one another. For example, you could argue that |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I wanted to have a bit of a discussion on how to conditionally reject/accept intersecting entities. Take this blueprint string for example:
This is a pretty simple tileable rail grid where the snap distance is set such that the edge straight rails and big pole overlap each other (42, 38). Obviously, this isn't a problem in Factorio and I think this isn't too big of a deal within draftsman except when the entity is circuit or power connectable. In the example above, stitching this blueprint together with itself, you get electric poles that overlap. The blueprint can be imported Factorio as is no problem, but if you want to set up the power connections things start to break because the duplicate poles get deleted even though they had power connections attached to them. You end up with an incomplete power grid.
How do you think this should be handled. I can think of a couple things. First, have the user work within these limitations. It could be by not overlapping any connectable entity when tiling the blueprint but this could cause issues on the boundaries of tiling. The user could also do a pass on the entity list removing offending overlapping entities after adding everything together. Constraining the user seems to be one of the things you are avoiding, so I'm not sure this is a path you want to take.
Second, move the overlap checking code outside of the hashmap and have a separate function to handle overlapping entities so that it can be overridden and allow the user to define what to do in these instances. It would have to be moved out
SpatialHashMapbecause there's no way of communicating withentitiesto remove/not add that particular entity. It could be added toentitieseven though the hashmap rejects it due to overlapping. Moving it may be unreasonable due to howSpatialHashMaprecursively adds entities.My last idea would be that
SpatialHashMapsomehow communicates with the containing class, i.e.Group, with a function similar toon_entity_insert. This function would perform the overlapping checks and could be overridden to give the user the ability to create custom overlapping behavior. Big issue I see here is what would happen when a sub-entity is overlapping another and should be removed? Communicating withGroupisn't particularly useful since the entity in question is at an unknown depth in the entity list from the perspective of the group. I suppose the way to deal with that would be to keep track of the indexing down the recursive add and handing it back to the parent. Another issue is that the entity gets added after the hashmap does the recursive add. I suppose these two could be swapped inEntityList.I feel I'm rambling a bit now, so I'll leave it here. Let me know your thoughts.
Beta Was this translation helpful? Give feedback.
All reactions