LuaEntityPrototype::secondary_collision_box is not exposed.

Post Reply
dewiniaid
Long Handed Inserter
Long Handed Inserter
Posts: 96
Joined: Tue Mar 07, 2017 8:50 pm
Contact:

LuaEntityPrototype::secondary_collision_box is not exposed.

Post by dewiniaid »

Some entities (i.e. curved rails) have a secondary collision box.

While this can be accessed on an entity itself (LuaEntity::secondary_bounding_box), it can't be accessed on entity prototypes.

I'm working on a feature to automatically add landfill to tiles that need it in a blueprint, so this is needed to be able to handle curved rails and anything else that might have odd collision boxes.

Boodals
Fast Inserter
Fast Inserter
Posts: 129
Joined: Sun Feb 11, 2018 7:10 pm
Contact:

Re: LuaEntityPrototype::secondary_collision_box is not exposed.

Post by Boodals »

I looked into this. secondary_collision_box only exists for rail and rail remnant prototypes, and they are translated and rotated when the rail is created. Being able to read it would only give you the size of it, not its position relative to the rail, nor its rotation.
The best you could do is make a lookup table that takes the direction of the curved rail and gives the collision box. That said, I will make a pull request to expose the untransformed collision box so if it is changed by mods for some reason, you can at least use it.
If you do make a lookup table, please post it here so that others can use it if they are looking for the same thing.
Last edited by Boodals on Thu Mar 28, 2019 11:45 pm, edited 1 time in total.

dewiniaid
Long Handed Inserter
Long Handed Inserter
Posts: 96
Joined: Tue Mar 07, 2017 8:50 pm
Contact:

Re: LuaEntityPrototype::secondary_collision_box is not exposed.

Post by dewiniaid »

Yup, I'm aware that priority prototype bounding boxes are relative to the origin and facing north. Transformed bounding boxes can be obtained from an entity directly, but I don't have a real entity available in this case.

The transformation itself is not too difficult though, I already have code for most of that.

Boodals
Fast Inserter
Fast Inserter
Posts: 129
Joined: Sun Feb 11, 2018 7:10 pm
Contact:

Re: LuaEntityPrototype::secondary_collision_box is not exposed.

Post by Boodals »

The pull request was accepted already, it'll be in the next version of 0.17.

Post Reply

Return to “Implemented mod requests”