API Doc: LuaTilePrototype.collision_mask is dictionary

This subforum contains all the issues which we already resolved.
Post Reply
User avatar
Mooncat
Smart Inserter
Smart Inserter
Posts: 1190
Joined: Wed May 18, 2016 4:55 pm
Contact:

API Doc: LuaTilePrototype.collision_mask is dictionary

Post by Mooncat »

Bug:
The document says LuaTilePrototype.collision_mask is an array of string, but in fact it is dictionary string → boolean, same as LuaItemPrototype.flags.

I used serpent.dump to find that, after getting stuck for a few minutes on checking whether the tile is walkable. :)

User avatar
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

Re: API Doc: LuaTilePrototype.collision_mask is dictionary

Post by aubergine18 »

Is there a list of possible keys for that dictionary anywhere? I was trying to find list of available options last night but other than scraping data.raw I didn't get very far.
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.

kovarex
Factorio Staff
Factorio Staff
Posts: 8078
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: API Doc: LuaTilePrototype.collision_mask is dictionary

Post by kovarex »

That is probably boost property tree construction limitation. It accepts array of strings without values, but the export contains the values. This will be changed in the future versions (0.15 probably) once we start using our own property tree implementation.

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

Re: API Doc: LuaTilePrototype.collision_mask is dictionary

Post by Rseding91 »

Fixed for 0.14.15.
If you want to get ahold of me I'm almost always on Discord.

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

Re: API Doc: LuaTilePrototype.collision_mask is dictionary

Post by Rseding91 »

kovarex wrote:That is probably boost property tree construction limitation. It accepts array of strings without values, but the export contains the values. This will be changed in the future versions (0.15 probably) once we start using our own property tree implementation.
It's intentional. It allows you to quickly check if the collision mask has a value in the Lua state by simply checking if the key exists in the dictionary. If it was exported as the prototype definition does it: you would have to iterate over the entire list to check if 1 value existed.
If you want to get ahold of me I'm almost always on Discord.

User avatar
Mooncat
Smart Inserter
Smart Inserter
Posts: 1190
Joined: Wed May 18, 2016 4:55 pm
Contact:

Re: API Doc: LuaTilePrototype.collision_mask is dictionary

Post by Mooncat »

aubergine18 wrote:Is there a list of possible keys for that dictionary anywhere? I was trying to find list of available options last night but other than scraping data.raw I didn't get very far.
I checked tiles.lua for the keys. Maybe this is still accurate: https://wiki.factorio.com/index.php?tit ... lisionMask. I don't see any sign of having any new collision mask since 2015. :lol:
Rseding91 wrote:
kovarex wrote:That is probably boost property tree construction limitation. It accepts array of strings without values, but the export contains the values. This will be changed in the future versions (0.15 probably) once we start using our own property tree implementation.
It's intentional. It allows you to quickly check if the collision mask has a value in the Lua state by simply checking if the key exists in the dictionary. If it was exported as the prototype definition does it: you would have to iterate over the entire list to check if 1 value existed.
Yes, I vote for dictionary too. Thanks! :D

Post Reply

Return to “Resolved Problems and Bugs”