next_upgrade target must have the same collision mask

Place to get help with not working mods / modding interface.
Moosfet
Long Handed Inserter
Long Handed Inserter
Posts: 71
Joined: Fri Jun 10, 2016 1:50 pm
Contact:

next_upgrade target must have the same collision mask

Post 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.
Attachments
flip-dots.zip
(275.08 KiB) Downloaded 4 times
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 3017
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: next_upgrade target must have the same collision mask

Post 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.
Moosfet
Long Handed Inserter
Long Handed Inserter
Posts: 71
Joined: Fri Jun 10, 2016 1:50 pm
Contact:

Re: next_upgrade target must have the same collision mask

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

Return to “Modding help”