Cataclysm-dda: Since only a few tilesets go into main game, mods should have the ability to add tiles to these.

Created on 3 Jan 2017  Â·  15Comments  Â·  Source: CleverRaven/Cataclysm-DDA

Something that came up as an issue for me when adding heavy duty stowboards and corner variants of the ordinary stowboard.

<Suggestion / Discussion> Mods Tiles / Sound

All 15 comments

No conversation in some time; closing for now. If anyone wants this reopened please ping me or just create a new issue.

Well.. it's certainly not crucial, but I think that it's semi-important at least for mods to be able to add tiles, so their content isn't ASCII among graphical tiles.

Hm, @Leland, I have nothing new to add, but finding this issue again by the way of things, I still think it's something that would be nice to have in the game.

@Asmageddon sure, we can keep this open for a while longer.

It's not a knock against the issue to close it – you typically have quality issues, and I agree with you on this one – it's just a simple fact that with well over 600 issues, Suggestions stay open only so long as people are talking about or working on them.

I agree, but I have no ideas that what kind of json structure is best written by mods. I seek your ideas to resolve this issue.

There was an earlier proposal for a "looks-like" or similar field, so you could add a new item and have tilesets re-use an existing image if one doesn't exist. It seemed conceptually simple to me and possibly relatively easy to program, but I haven't dug into it to be sure.

@mlangsdorf I think "looks-like" field is good idea, but I think it is better for game that make mods possible that add tile png files.

Looking at the code a bit more, the key bit seems to be src/cata_tiles.cpp:1561-1628.
You would want to move the code at lines 1561-1572 into a separate function called find_tile_with_seasons() Then, for each category type x_, if x_id.is_valid(), if !x_id.obj()->get_looks_like().empty(), you assign tt to find_tile_with_seasons( x_id.obj()->get_looks_like() ) and only look up the symbol and color if you don't find a tt.
something like this:

        if (category == C_FURNITURE) {
            const furn_str_id fid( id );
            if( fid.is_valid() ) {
                const furn_t &f = fid.obj();
                if( ! fid->get_looks_like().empty() ) {
                    tt = tileset_ptr->find_tile_with_seasons( fid->get_looks_like() );
                }
                if( ! tt ) {
                    sym = f.symbol();
                    col = f.color();
                }
            }

then you'd need to add the get_looks_like() function to the basic object code.

and then you'd need to go through all the mods and add looks-like fields.

I may pick this up in a week or three.

The problem with letting mods to add tile pngs is that the tileset loader doesn't know about mods and so it's going to be tricky to teach it to open tile.pngs and multiple tile_configs.json. The function is pretty well encapsulated, and I think it can already handle multiple tile.pngs, so that might not be too hard.

@mlangsdorf It's good solution! but I prefer "looks-like" field to be prioritize over default tile setting.

Do you mean the looks-like should override the assigned value from the tileset if the tileset has one? That's going to be a tough sell.

I thought the use case was:
mod_content = {
"item": "hddoor",
"looks_like": "door"
}
and then when you loaded Retrodays ISO that hasn't been updated in years, retrodays ISO makes hddoors look like doors. The code above should be an outline towards doing that.

if you mean a use case like this:
mod_content = {
"item": "door",
"copy-from": "door",
"looks_like": "chicken_walker",
}
and when you load Chesthole, all the vehicle doors look like chicken walkers.
That may or may not be an interesting thing to do, but it's not something I intend to work on. But you're welcome to try it.

@mlangsdorf Isee and please forget it. I will try it and consider again.

went ahead and did a rough prototype of the solution I proposed, and it was good enough that I could create a new item "test_scythe", give it "looks_like": "scythe", and have the chesthole tileset display it as a scythe.
I went to test the recursive search through copy-from functions and then expand the logic to cover a few more types of things, but the basic idea is sound.
Also, please assign this me so I can track it.

looks_like1
Screen shot of test_scythe with looks_like scythe.

Hm, not fully convinced if that invalidates this issue, but... well, it's better than nothing for sure, probably makes more sense in the light of how tilesets and mods work, too.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Coolthulhu picture Coolthulhu  Â·  51Comments

nexusmrsep picture nexusmrsep  Â·  64Comments

Coolthulhu picture Coolthulhu  Â·  68Comments

MrHrulgin picture MrHrulgin  Â·  55Comments

railmonkey picture railmonkey  Â·  43Comments