Proper default media

master
Lars Mueller 2021-03-25 23:19:41 +01:00
parent 091c896478
commit 256723b698
2 changed files with 8 additions and 4 deletions

View File

@ -53,10 +53,10 @@ local conf_spec = {type = "table", children = {
}}
config = modlib.conf.import("voxelizer", conf_spec)
local mediapath = minetest.get_modpath("voxelizer").."/default_media/"
local fallback_defaults = {texture = mediapath.."character.png", model = mediapath.."character.obj", nodemap = mediapath.."colors.txt"}
default_media_path = modlib.mod.get_resource(minetest.get_current_modname(), "default_media", "")
local fallback_defaults = {texture = "character.png", model = "character.obj", nodemap = "colors.txt"}
for key, alt in pairs(fallback_defaults) do
if config.defaults[key] == nil then
config.defaults[key] = alt
config.defaults[key] = default_media_path .. alt
end
end

View File

@ -1,5 +1,9 @@
function get_media(name)
return minetest.get_worldpath().."/media/"..name
local path = minetest.get_worldpath() .. "/media/" .. name
if not modlib.file.exists(path) then
path = default_media_path .. "/" .. name
end
return path
end
function get_obj_bounding_box(vertexes)