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
Add ability to override item images using meta #12614
Conversation
04fdcf1
to
88b545d
Compare
pinging @velartrill as I think she was also interested in doing this |
hey awesome! thanks for taking this on, lack of this functionality has been a pain point for me for a while. but there's a significant gotcha with this PR's approach as i pointed out on the old PR:
e.g. one texture pack might assemble icons for various items and their states programmatically by combining a small number of textures at runtime, while a texture pack author might want to provide higher-quality hand-drawn variants for those states. or vice-versa additionally, maybe this part is out of scope and deserves its own PR, but (before you beat me to making a new PR :p) i was also considering folding in a meta key that allows dynamically changing the textures of nodes in the world when i got around to it, since it's a bit silly for itemstacks to be able to change their appearance in inventory but not in the world. the latter would also be very useful for e.g. signs and would obviate many terrible entity hacks. opinions? is this a desirable feature? is a meta key the right way to go about it? should it be a separate PR? oh, ETA: since these features are closely related, it might be worth revisiting the hotbar API as well if this gets merged (in a separate PR ofc). key item callbacks here would be the obvious (mainly i'm thinking about this in terms of "how can we make it as straightforward as possible to implement minecraft-style bows and compasses") i also wonder if it might be worthwhile to have an image change prediction property -- consider what happens when you have a fully-"charged" bow and then switch away without firing. even with full engine support for {
description = "Bow";
texture_prediction = {
on_unwield = {
mode = "reset";
inventory_image = true;
wield_image = true;
};
};
} though that could obviously be simplified depending on how fancy you want texture predictions functionality to be (cf. #9862) anyway, these are really just nitpicks, and i don't mean to detract from this PR! apart from the item texture state spec thing these suggestions all could be progressively implemented in consequent PRs; i think even the PR as is is very much worth merging since it gives us a totally new capability and my suggestions are basically just nice-to-have refinements of that capability. :) |
Hmm, overrides.txt compat is an interesting point, not something I considered. I'm not sure support for this is needed in the first version though. Maybe for forwards compat we could ignore stuff before some character like
This is definitely out of scope |
my concern about that is that if this isn't in there from the start, vanishingly few modders will define state names and texture pack designers will be (further) crippled by this new feature. i suspect modders probably don't often think about how to make their mods easily and fully "skinnable" (and when i do, i often find myself forced to choose between skinability and reasonable design -- it seems like not a lot of thought has hitherto gone into this on the engine side either :/ ) |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
Hi, please can we keep the discussion relevant to this PR thanks |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
88b545d
to
dc4f5b5
Compare
dc4f5b5
to
2453e36
Compare
2453e36
to
5a39efe
Compare
5a39efe
to
fbfe1d5
Compare
Fixes minetest#5686 Co-authored-by: Stefan Vukanović <lisacvukhome@gmail.com>
7f9772b
to
4c11c64
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested, works fine.
@Desour please can you retest? Found and fixed a bug with inventory animations |
item.name = def.name; | ||
|
||
if (!inventory_image.empty()) | ||
cc->inventory_texture = tsrc->getTexture(inventory_image); | ||
getItemMesh(client, item, &(cc->wield_mesh)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could here just pass item name, inventory_image
and inventory_overlay
(as opposed to item
), to avoid similar cache_key
issues in future changes to getItemMesh
.
Oops, looks like I didn't test well enough. Should be fine now though. Approval holds. |
Can this possibly be done without the animation of item switching happens? |
That's a different issue. |
Ah, I see. That is a problem. Is that deeply integrated? |
I don't know. But I guess it's not too hard to change. |
Fixes #5686
This allows setting the inventory image and wield image of an item stack using meta:
To do
This PR is Ready for review
How to test
See
testitems:image_meta
in devtest