Skip to content

Add meta dictionary to individual tiles - #23714

Closed
Lucrecious wants to merge 3 commits into
godotengine:masterfrom
Lucrecious:lucrecious
Closed

Add meta dictionary to individual tiles#23714
Lucrecious wants to merge 3 commits into
godotengine:masterfrom
Lucrecious:lucrecious

Conversation

@Lucrecious

@Lucrecious Lucrecious commented Nov 15, 2018

Copy link
Copy Markdown

A simple way of adding properties to individual tiles in a TileSet.

This isn't finished, mostly just a simple proof of concept.

Here is the current state of things:
Gets a copy of the meta properties associated with the given tile id
tile_get_meta_properties(id : int) -> Dictionary

Gets the value associated with the tile id and key in the meta properties of the tile
tile_get_meta_property(id : int, key : Variant) -> Variant

Sets a value to the given key in the meta dictionary associated with the tile id
tile_set_meta_property(id : int, key : Variant, value : Variant) -> void

Bugsquad edit: Fixes #12634.

@aaronfranke

Copy link
Copy Markdown
Member

Is this related to #18591 ?

@Lucrecious

Copy link
Copy Markdown
Author

@aaronfranke no, individual tiles on a tileset are not objects, so they don't have the capabilities of having a dictionary for meta values.

this would be used if, for example, you want textured tiles (say grass sounds play on grass tiles and dirt sounds on dirt tiles).

@aaronfranke

Copy link
Copy Markdown
Member

To avoid confusion, perhaps it shouldn't contain the word "meta". Why not "tile property dictionary"?

@Lucrecious

Copy link
Copy Markdown
Author

That's a fair point - although, I'll mostly be making these changes after 3.1 has been released :)

@akien-mga

Copy link
Copy Markdown
Member

This addresses #12634, but as mentioned there without a way to set properties from the TileSet editor this is not so useful. If it's only available programmatically then one can just as well define a Dictionary property in the TileSet's script to achieve the same result.

That's why the similar PR #3089 by @neikeq was not merged back then as it seemed unsatisfactory to have a proper tile property system.

@akien-mga

Copy link
Copy Markdown
Member

I guess #23864 might be a more comprehensive approach that addresses the issue mentioned above. It hasn't been thoroughly reviewed nor merged yet, though.

@akien-mga akien-mga modified the milestones: 3.2, 4.0 Oct 4, 2019
@Lucrecious

Copy link
Copy Markdown
Author

Closed since #23864 seems like a good solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Giving tiles a property dictionary

5 participants