Page 1 of 1

Inverted collision masks and multiple collision boxes/masks per entity

Posted: Wed Jul 03, 2024 1:53 am
by braxbro
Allowing one entity to have multiple collision boxes with independent collision masks would streamline the creation of entities with more complex placement restrictions. Similarly, allowing the inversion of one or more of these collision masks would allow for a greater range of placement restrictions than just "not-colliding-with-itself" currently allows.

Some examples of complex placement restrictions are:
  • Exclusion zones, as seen on some mods' wind turbines (Py and Nullius both have examples)
  • Inclusion zones, where certain entities must be placed in proximity to another entity
  • Non-rectangular collision boxes (dunno why you'd want this, but it's something to note)
Currently, creating an exclusion zone (or a non-rectangular entity, I guess) looks something like this:
  • Create entity A, which has one collision box, usually the most commonly applicable one.
  • Create a dummy entity B, which has another collision box, usually consisting of just one layer
  • Add the layer B collides with to A's collision mask
  • When an A is created, use a script to place a B, ignoring its collision mask.
  • When an A is destroyed, use a script to remove its B.
  • Other A's collide with the placed B's, preventing placement too close to other As.
It is not currently possible (as far as I understand) to easily create inclusion zones without messy scripting or special tiles, as there's no way to specify that an entity MUST collide with a certain collision layer.

This would be greatly appreciated, even though a lot of the new territory it opens up can already be done via script; this change alone would make these complex requirements easier to maintain, both on the inter-mod compatibility front and the general implementation complexity front.

Thanks.

Re: Inverted collision masks and multiple collision boxes/masks per entity

Posted: Fri Jul 05, 2024 2:06 am
by Anachrony
Even with scripts, there are subtle problems with these compound entities and hidden collision masks. These scripted entities usually don't behave exactly perfectly in all respects, especially once you start adding in other mod scripts. So It wouldn't just simplify something you can already do, but the end result would behave better. Spacing out entities makes sense for a lot of things, but modders usually don't bother unless it's really important, because of the complexity it adds. In addition to the wind turbines, Nullius also uses it for large beacons. But there are some other items where it might make have also made sense but isn't done because it's not worth it, for example chimneys or outfalls where you dump waste into the environment, or air intakes. And it might make sense for air intakes to be spaced far away from chimneys and water intakes to be spaced far away from outfalls. But it's currently complicated to do that.

Re: Inverted collision masks and multiple collision boxes/masks per entity

Posted: Fri Jul 05, 2024 11:34 pm
by FuryoftheStars
This request was for something similar for different reasons, but the response likely applies here, too:
viewtopic.php?f=221&t=47567
Rseding91 wrote:
Tue Oct 02, 2018 10:48 pm
The game only has 1 entity with multiple collision boxes and it already causes a massive amount of problems.

We're never going to add more collision boxes to entities.

Re: Inverted collision masks and multiple collision boxes/masks per entity

Posted: Sat Jul 06, 2024 1:08 am
by curiosity
FuryoftheStars wrote:
Fri Jul 05, 2024 11:34 pm
This request was for something similar for different reasons, but the response likely applies here, too:
viewtopic.php?f=221&t=47567
There is a not insignificant number of times when Rseding said that something will never be added and then later it was added. I won't put absolute confidence in a reply from over five years ago.