Page 1 of 1

Collision Boxes? Is there a Collision circle option?

Posted: Fri Nov 18, 2016 7:45 pm
by voxelv
Hello,

I've just recently been looking at some other mods' code and realized my idea for a mod may not work due to collision boxes only able to be defined as boxes.

Is there a way to define a circle collision area instead of a box?

I just wanted to ask and make sure before I started a Mod Interface request.

Thanks,

voxelv

Re: Collision Boxes? Is there a Collision circle option?

Posted: Fri Nov 18, 2016 7:54 pm
by Rseding91
No, nothing in Factorio does circle collision.

Re: Collision Boxes? Is there a Collision circle option?

Posted: Fri Nov 18, 2016 10:21 pm
by voxelv
No, nothing in Factorio does circle collision.
Thanks for the info. I don't suppose there would be an event such as "on_entity_enter_radius" or equivalent would there?

Thanks,

voxelv

Re: Collision Boxes? Is there a Collision circle option?

Posted: Fri Nov 18, 2016 10:34 pm
by Rseding91
voxelv wrote:
No, nothing in Factorio does circle collision.
Thanks for the info. I don't suppose there would be an event such as "on_entity_enter_radius" or equivalent would there?

Thanks,

voxelv
Nope.

Re: Collision Boxes? Is there a Collision circle option?

Posted: Mon Nov 28, 2016 5:10 pm
by Ranakastrasz
What exactly are you trying to do? Depending on that, a workaround might be doable.

Re: Collision Boxes? Is there a Collision circle option?

Posted: Wed Nov 30, 2016 2:45 am
by BenSeidel
Depending on the radius, a work arround may be possible. Create yourself an invisible, unselectable item with a 1x1 collision box. When the item with your circular radius is placed, add a series of these 1x1 items in a circle around the item. When the item is mined, remove the 1x1 items.

I have done it in my C&C mod (yet to be released) for things like the repair pad and refinery that don't have an NxM footprint. The only issues is that it does not take the 1x1 items into account while you are placing your structure, but it's easy to detect a collision and cancel the construction.

Re: Collision Boxes? Is there a Collision circle option?

Posted: Wed Nov 30, 2016 3:41 pm
by Ranakastrasz
Make sure you handle the possibility of picking up items if you use them. I think you mean entities tho.

Re: Collision Boxes? Is there a Collision circle option?

Posted: Thu Dec 01, 2016 4:16 am
by BenSeidel
yes, "Entity" not "Item.

Re: Collision Boxes? Is there a Collision circle option?

Posted: Thu Dec 01, 2016 5:25 am
by keyboardhack
voxelv wrote:
No, nothing in Factorio does circle collision.
Thanks for the info. I don't suppose there would be an event such as "on_entity_enter_radius" or equivalent would there?

Thanks,

voxelv
You could place a land-mine and edit the trigger_radius to whatever you want. Then you just have to change the action so when a person enters the radius of the land-mine it spawns another entity. You can then use the event on_trigger_created_entity to catch the event in lua.