Negative Space

by rycieos

Adds a negative space entity for marking where empty space must be in blueprints that removes entities after the blueprint is placed. Optionally automatically adds negative space around belts or fluid pipes.

Utilities
2 months ago
2.0 - 2.1
588
Blueprints

i Keybind to flood fill the held blueprint with Negative Space

15 days ago
(updated 15 days ago)

I had an idea for this mod to make it easier to use with people's existing blueprint libraries. A new keybind (can be Ctrl-N possibly) which takes the blueprint from the player's cursor and replaces it with a temporary copy that has all unoccupied spaces filled with Negative Space.

(So you would make a new cursor_stack_temporary item - you can look at Cycle Quality on Clipboard for an example of how to do this.)

I don't know how expensive it would be to scan large blueprints to find all non-colliding spaces.

It could be useful to have a reverse keybind as well, which would remove any negative space from the temporary copy.

EDIT: Reading some of the old threads now, I realise this idea is fairly similar to Fill enclosed empty space.

14 days ago

Yeah it is similar. The original request was more along the lines of only filling in enclosed spaces. This request is any empty spaces, which is quite a lot easier. This isn't too different from the belt and pipe surrounding logic already existing, so this should be possible to add. I'll look into it.

4 days ago

Ok, this is going to be much more difficult than I thought it would be. The blueprint manipulation that this mod already does is simple by comparison, because it does it right after a blueprint is created, so I can access the in world entities to check for collision. Meaning the engine does all the collision checks for me.

This suggestion is for blueprints that already exist. And the engine doesn't have any way to do collision checks for blueprint entities. Meaning I need to check: * Collision masks * Collision bounding boxes * Entity rotation * Atypical bounding boxes (non-rectangular, ex: rails, rail supports) * Probably other things I haven't yet thought of

A much easier task would be to do this when the blueprint is first generated. Then I could check the real world entities. That would be a less useful feature, and not what you were looking for, but much more likely to be implemented. Thoughts?

3 days ago

Ok, this is going to be much more difficult than I thought it would be. The blueprint manipulation that this mod already does is simple by comparison, because it does it right after a blueprint is created, so I can access the in world entities to check for collision. Meaning the engine does all the collision checks for me.

Ah well, thank you for looking into it. Doing some experimenting of my own, I realise that even just working out the dimensions of a blueprint is non-trivial (and you can't necessarily use blueprint_snap_to_grid if it's present, because the user can shrink it).

I tried making a flood-fill which ignores collision (so it fills the blueprint entirely with a rectangle of negative-space), but this causes the negative-space to take priority over the original blueprint contents. And for some reason the negative-space entities don't disappear. o.O


A much easier task would be to do this when the blueprint is first generated. Then I could check the real world entities. That would be a less useful feature, and not what you were looking for, but much more likely to be implemented. Thoughts?

I wouldn't go to the trouble of implementing that version. You can easily just use the planner to draw negative-space over the area you want blueprinted, and clear it afterwards.

3 days ago

I realise that even just working out the dimensions of a blueprint is non-trivial (and you can't necessarily use blueprint_snap_to_grid if it's present, because the user can shrink it).

Good point. If you are doing manual collision checks you could track bounding boxes and their expansion of a overall bounding box, but yeah it's more work and difficult.

I wouldn't go to the trouble of implementing that version.

Fair enough. I'll leave this open in case anyone else has ideas for how to make implementing the original request possible.

New response