I have "Air" units that based on collision_mask = {}. Rocket can hit them, but cannon-projectile can't. Why is that?
I tried adding data.raw['projectile']['cannon-projectile']['action']['ignore_collision_condition'] = true. That didn't do anything. I thought it would behave like adding it in type="area"
Question on Cannon Projectile collision
Re: Question on Cannon Projectile collision
I found the issue.
I have to add collision_mask = { 'layer-33' } to air unit and then add the mask to the projectile in hit_collision_mask. eg. data.raw['projectile']['cannon-projectile']['hit_collision_mask'] = { 'train-layer', 'player-layer', 'layer-33'}
I have to add collision_mask = { 'layer-33' } to air unit and then add the mask to the projectile in hit_collision_mask. eg. data.raw['projectile']['cannon-projectile']['hit_collision_mask'] = { 'train-layer', 'player-layer', 'layer-33'}
Re: Question on Cannon Projectile collision
Avoid hard-coding collision masks. You don't know what other mods might be using it.
Instead, use this:
Then you can assign collision_mask = {air_unit_layer} and add it to the projectile.
Instead, use this:
Code: Select all
air_unit_layer = require("collision-mask-util").get_first_unused_layer()
Re: Question on Cannon Projectile collision
oh nice! Thank you for this TIL.
Re: Question on Cannon Projectile collision
Hmm, I didn't know this either. Thanks, PFQNiet! I've sent a documentation improvement request for https://wiki.factorio.com/Types/CollisionMask to mention get_first_unused_layer.