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.
API Doc: LuaTilePrototype.collision_mask is dictionary
- aubergine18
- Smart Inserter
- Posts: 1264
- Joined: Fri Jul 22, 2016 8:51 pm
- Contact:
Re: API Doc: LuaTilePrototype.collision_mask is dictionary
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.
Re: API Doc: LuaTilePrototype.collision_mask is dictionary
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.
Re: API Doc: LuaTilePrototype.collision_mask is dictionary
Fixed for 0.14.15.
If you want to get ahold of me I'm almost always on Discord.
Re: API Doc: LuaTilePrototype.collision_mask is dictionary
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.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.
If you want to get ahold of me I'm almost always on Discord.
Re: API Doc: LuaTilePrototype.collision_mask is dictionary
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.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.
Yes, I vote for dictionary too. Thanks!Rseding91 wrote: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.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.