Collision Boxes? Is there a Collision circle option?

Place to get help with not working mods / modding interface.
Post Reply
voxelv
Burner Inserter
Burner Inserter
Posts: 5
Joined: Fri Sep 30, 2016 8:32 am
Contact:

Collision Boxes? Is there a Collision circle option?

Post 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

Rseding91
Factorio Staff
Factorio Staff
Posts: 13209
Joined: Wed Jun 11, 2014 5:23 am
Contact:

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

Post by Rseding91 »

No, nothing in Factorio does circle collision.
If you want to get ahold of me I'm almost always on Discord.

voxelv
Burner Inserter
Burner Inserter
Posts: 5
Joined: Fri Sep 30, 2016 8:32 am
Contact:

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

Post 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

Rseding91
Factorio Staff
Factorio Staff
Posts: 13209
Joined: Wed Jun 11, 2014 5:23 am
Contact:

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

Post 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.
If you want to get ahold of me I'm almost always on Discord.

User avatar
Ranakastrasz
Smart Inserter
Smart Inserter
Posts: 2124
Joined: Thu Jun 12, 2014 3:05 am
Contact:

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

Post by Ranakastrasz »

What exactly are you trying to do? Depending on that, a workaround might be doable.
My Mods:
Modular Armor Revamp - V16
Large Chests - V16
Agent Orange - V16
Flare - V16
Easy Refineries - V16

BenSeidel
Filter Inserter
Filter Inserter
Posts: 584
Joined: Tue Jun 28, 2016 1:44 am
Contact:

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

Post 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.

User avatar
Ranakastrasz
Smart Inserter
Smart Inserter
Posts: 2124
Joined: Thu Jun 12, 2014 3:05 am
Contact:

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

Post by Ranakastrasz »

Make sure you handle the possibility of picking up items if you use them. I think you mean entities tho.
My Mods:
Modular Armor Revamp - V16
Large Chests - V16
Agent Orange - V16
Flare - V16
Easy Refineries - V16

BenSeidel
Filter Inserter
Filter Inserter
Posts: 584
Joined: Tue Jun 28, 2016 1:44 am
Contact:

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

Post by BenSeidel »

yes, "Entity" not "Item.

keyboardhack
Filter Inserter
Filter Inserter
Posts: 478
Joined: Sat Aug 23, 2014 11:43 pm
Contact:

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

Post 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.
Waste of bytes : P

Post Reply

Return to “Modding help”