Is there a way to change collision box with player but not with other objects?

Place to get help with not working mods / modding interface.
User avatar
Impatient
Filter Inserter
Filter Inserter
Posts: 884
Joined: Sun Mar 20, 2016 2:51 am
Contact:

Is there a way to change collision box with player but not with other objects?

Post by Impatient »

Since the new beacons look ground level fort their most parts, I tried to make them walkable by reducing the collision box:

Code: Select all

data.raw["beacon"]["beacon"].collision_box = {{-0.2, -0.2}, {0.2, 0.2}}
This way the player character collides only with the spike in the middle of the beacon. Works fine - for the player character.

But the unwanted side effect is, that the beacons also can be placed overlapping. That is a no go.

Is there a way to achieve distinct collision behavior for beacons with player characters, cars, bugs, etc, and beacons with other immobile objects in the game world?
User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2905
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: Is there a way to change collision box with player but not with other objects?

Post by darkfrei »

Code: Select all

r = 1.4 -- for 3x3 entity
entity.collision_box = {{-r, -r}, {r, r}}
Disable by beacon the player layer collision mask, add hidden entity in the middle with player layer collision mask.
Don't forget to destroy the hidden entity after the the beacon entity was mined or destroyed.
User avatar
Impatient
Filter Inserter
Filter Inserter
Posts: 884
Joined: Sun Mar 20, 2016 2:51 am
Contact:

Re: Is there a way to change collision box with player but not with other objects?

Post by Impatient »

thanks!

I will try it.
Post Reply

Return to “Modding help”