Page 1 of 1
Add ability to use map generator bounding box in can_place_entity
Posted: Fri Feb 22, 2019 6:11 pm
by orzelek
Today's FFF describes new map generator bounding box added to entities to fix up enemy bases.
Please make sure that there is an option in can_place_entity that will make it use same bounding box so mods can use it when placing enemy bases.
Re: Add ability to use map generator bounding box in can_place_entity
Posted: Fri Feb 22, 2019 6:15 pm
by Rseding91
That's not likely to ever happen.
Map generation has exactly 2 places where it checks if an entity would collide with the world and it completely ignores the rest of the logic in those 2 places.
Making can-place-entity work with different bounding boxes is asking for the entire buildability check system to be re-written and as I said above: that's not likely to ever happen.
An entity is buildable if it's buildablity check passes. It's placeable through the ma generator if the basic map generator bounding box doesn't collide *and* the normal buildability checks pass.
Re: Add ability to use map generator bounding box in can_place_entity
Posted: Fri Feb 22, 2019 9:49 pm
by orzelek
So maybe a separate method for this?
If there is no access to this then RSO bases will still have bugs while base game ones won't. This is kind od dissapointing.
Basically I need to reimplement this logic on lua side somehow or RSO bases wil be subpar.
Re: Add ability to use map generator bounding box in can_place_entity
Posted: Fri Feb 22, 2019 10:24 pm
by Rseding91
I'm not against adding a simple LuaSurface::collides(boudning box, collision mask, direction) - which is what the map generation logic uses. But I'm never going to re-write the entire can-build-entity collision system to support arbitrary collision boxes.
Re: Add ability to use map generator bounding box in can_place_entity
Posted: Sun Feb 24, 2019 10:20 am
by orzelek
That would work as long as new collision box is available from prototype.
Re: Add ability to use map generator bounding box in can_place_entity
Posted: Sun Feb 24, 2019 10:40 am
by Bilka
orzelek wrote: ↑Sun Feb 24, 2019 10:20 am
That would work as long as new collision box is available from prototype.
It wasn't available so I added LuaEntityPrototype::map_generator_bounding_box. Now nothing should be in the way of adding LuaSurface::collides().
Re: Add ability to use map generator bounding box in can_place_entity
Posted: Wed Feb 27, 2019 8:38 pm
by orzelek
Since request is in won't implement should I add new one for simple collision?
I actually had an idea for slightly different way.
Add a version of find_non_colliding_position that would accept collision box instead of name of entity prototype.
It could use then either of collision masks depending on how you call it.