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
check existence of media file #10389
Comments
Media collection currently runs after all mods were loaded, but I assume you'd want to query the existence of a media file at mod load time, is that correct? |
Interesting, is there any technical constraints doing it so ? Lua code execution during load time is not creating any media files IIRC. So I guess it would be possible to change that order. |
Lua code execution could make media files |
My current use case is that my quest creators need to attach textures onto a bunch of entities. But because there are so many textures, I do not want to use a dropdown list. I want them to insert a string into a normal text field, then search among the known media for a fitting texture. When there's none, they'll upload it by providing a URL string. After it got uploaded, I'd like it be findable, too. Since it goes into a worldmod folder, it will be available next time the server starts, but until then it needs to be added to some list. This way, among other uses, I'd like to avoid the gnarly "Texture does not exist! Will create dummy texture!!" message shown to players. |
You can use get_dir_list to list files in a directory |
I'm curious, are there mods that currently generate media files on the fly? I wasn't aware that this was possible. Is it documented somewhere? |
Problem
Currently there is no way to see whether a texture, sound or other media file is available to the server. There is dynamic_add_media which indicates duplicates as "error", but that's about it.
Solutions
Similar to the registered definition tables like minetest.registered_items we could have a minetest.registered_media which holds at least the name, even better the path
Alternatives
One could try to create such an index by going over all mods and worldmods and scrape the media files from there or use dynamic_add_media to check the presence and guess that "errorr" means the file in question is already present.
The text was updated successfully, but these errors were encountered: