Currently setting EntityPrototype.collision_mask.layers to an empty table results in an entity that collides with nothing, regardless of whether not_colliding_with_itself is true or false. I would like for that parameter to be effective in this case, such that setting it to true produces the current behavior, but leaving it the default of false makes an entity that collides only with itself.
Currently I believe that to accomplish this I would need to use up one of the custom collision mask slots, but that seems wasteful since there's already room in the existing data structure to accommodate this behavior.
Empty collision_mask.layers should collide with itself
- micromario
- Fast Inserter
- Posts: 109
- Joined: Thu Apr 05, 2018 11:53 am
- Contact:
Re: Empty collision_mask.layers should collide with itself
I disagree with this.
100% of the time if I set an empty mask then I expect it to collide with nothing. What is your use case for a empty collision mask that collides with other masks?
Factorio performs an optimization to disable collision checking for empty collision masks.
Requiring everyone to set not_colliding_with_itself is in my opinion confusing and would be another modding API quirk to remember.
Your mod's solution should be to define a new mask prototype.
100% of the time if I set an empty mask then I expect it to collide with nothing. What is your use case for a empty collision mask that collides with other masks?
Factorio performs an optimization to disable collision checking for empty collision masks.
Requiring everyone to set not_colliding_with_itself is in my opinion confusing and would be another modding API quirk to remember.
Your mod's solution should be to define a new mask prototype.
Re: Empty collision_mask.layers should collide with itself
I don't understand the question. I don't want my entity to collide with anything with a collision mask either.micromario wrote: ↑Mon Oct 28, 2024 9:17 pmWhat is your use case for a empty collision mask that collides with other masks?
It can still perform that same optimization for things that don't collide with anything (no collision mask and not_colliding_with_itself).micromario wrote: ↑Mon Oct 28, 2024 9:17 pmFactorio performs an optimization to disable collision checking for empty collision masks.
If anything, the option not being effective when the masks are empty is a quirk, and an undocumented one at that. `not_colliding_with_itself=false` should collide with itself seems extremely straightforward to me. Would it make more sense if the name and default were reversed? `collides_with_itself` could default to true.micromario wrote: ↑Mon Oct 28, 2024 9:17 pmRequiring everyone to set not_colliding_with_itself is in my opinion confusing and would be another modding API quirk to remember.
Defining a new mask for a single entity is a recipe for users not using a mod once they hit the mask limit with bigger mods.micromario wrote: ↑Mon Oct 28, 2024 9:17 pmYour mod's solution should be to define a new mask prototype.
- _CodeGreen
- Long Handed Inserter
- Posts: 72
- Joined: Sat Mar 05, 2022 11:30 am
- Contact:
Re: Empty collision_mask.layers should collide with itself
I really doubt mods will be hitting the mask limit any time soon. I have never heard of anyone needing to do what you're trying to do right now, but a creating a single layer prototype and using it for your entity is the correct way to go about handling this.
My Mods | If you can't make it perfect, make it adjustable