Page 1 of 1

next_upgrade target must have the same collision mask

Posted: Sun Oct 27, 2024 1:46 am
by Moosfet
I'm trying to update my mod to 2.0 and getting this error:
Error while running setup for entity prototype "lamp-flip-dot" (lamp): next_upgrade target (switch-flip-dot) must have the same collision mask.
I'm setting both of them identically:

Code: Select all

lamp_entity.collision_mask = data.raw["lamp"]["small-lamp"].collision_mask
switch_entity.collision_mask = data.raw["lamp"]["small-lamp"].collision_mask
Also, I added these lines to check:

Code: Select all

log(serpent.block(data.raw["lamp"]["small-lamp"].collision_mask))
log(serpent.block(data.raw["lamp"]["lamp-flip-dot"].collision_mask))
log(serpent.block(data.raw["power-switch"]["switch-flip-dot"].collision_mask))
It appears they are all the same, in that they're all nil.

Code: Select all

   2.080 Script @__flip-dots__/data.lua:9: nil
   2.080 Script @__flip-dots__/data.lua:10: nil
   2.080 Script @__flip-dots__/data.lua:11: nil
   2.352 Script @__flip-dots__/data-final-fixes.lua:29: nil
   2.352 Script @__flip-dots__/data-final-fixes.lua:30: nil
   2.352 Script @__flip-dots__/data-final-fixes.lua:31: nil
I tried setting the collision_mask of the small-lamp to the example on this page:

https://lua-api.factorio.com/latest/typ ... ector.html

data.raw["lamp"]["small-lamp"].collision_mask = {layers = {item = true, meltable = true, object = true, player = true, water_tile = true, is_object = true, is_lower_object = true}}

Then like before I copied the small lamp's collision mask to my flip dots. This allows the mod to load.

It doesn't seem like I should have to modify the small-lamp to make it work. So I wonder if this is a bug in the game in that "nil" is somehow a valid value for the collision_mask but the check to verify that two masks are the same doesn't work when they're both nil, or perhaps the lamp is supposed to have a collision mask but it doesn't. So should I just set the collision mask to that example or should I submit a bug report about this? I don't really know Lua so I'm not all that confident that I know what I'm doing here.

Re: next_upgrade target must have the same collision mask

Posted: Sun Oct 27, 2024 2:05 am
by boskid
If collision_mask is not given, then a default is used from collision-mask-defaults.lua. They are per entity type so they may have different defaults.

Re: next_upgrade target must have the same collision mask

Posted: Sun Oct 27, 2024 2:10 am
by Moosfet
That explains why at one point the problem only seemed to be affecting the power switch version of the flip dot. I guess I will have to find out what the default collision mask is for the small-lamp and apply it myself.

Thank you.