Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compose: handle multiple entries in a single tile_entry.json file #34901

Merged
merged 1 commit into from
Oct 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions doc/TILESET.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,17 @@ The special prefixes `overlay_wielded_`, `overlay_female_wielded_`, `overlay_mal

`"multitle"` is an *optional* field. If it is present and `true`, there must be an `additional_tiles` list with 1 or more dictionaries for entities and sprites associated with this tile, such as broken versions of an item or wall connections. Each dictionary in the list has an `"id`" field, as above, and a `"fg"` field, which can be a single filename, a list of filenames, or a list of dictionaries as above.

Each `tile_entry.json` file can have a single object in it, or a list of 1 or more objects like so:
```C++
[
{ "id": "mon_zombie", "fg": "mon_zombie", "bg": "mon_zombie_bg", "rotates": false },
{ "id": "corpse_mon_zombie", "fg": "mon_zombie_corpse", "bg": "mon_zombie_bg", "rotates": false },
{ "id": "overlay_wielding_corse_mon_zombie", "fg": "wielded_mon_zombie_corpse", "bg": [], "rotates": false }
]
```

Having a list of tile entries in a file may be useful for organization, but completely unrelated entries may all exist in the same file without any complications.

#### expansion `tile_entry` JSON
Tilesheets can have expansion tilesheets, which are tilesheets from mods. Each expansion tilesheet is a single `"id"` value, `"rotates": false"`, and `"fg": 0`. Expansion `tile_entry` JSON are the only `tile_entry` JSONs that use an integer value for `"fg"` and that value must be 0. Expansion `tile_entry` JSONs must be located at the top layer of each image directory.

Expand Down
4 changes: 3 additions & 1 deletion tools/gfx_tools/compose.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,9 @@ def walk_dirs(self, refs):
print("error loading {}".format(filepath))
raise

self.tile_entries.append(tile_entry)
if not isinstance(tile_entry, list):
tile_entry = [tile_entry]
self.tile_entries += tile_entry
if self.row_pngs:
merged = self.merge_row(refs)
tmp_merged_pngs += merged
Expand Down