1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-02 16:38:41 +00:00

Modify mod and texture directory hierarchies

This commit is contained in:
Perttu Ahola 2011-11-15 08:48:24 +02:00
parent 40e7a1a5c9
commit e71744b918
111 changed files with 28 additions and 10 deletions

View file

@ -256,9 +256,9 @@ void draw_hotbar(video::IVideoDriver *driver, gui::IGUIFont *font,
/*
Draw hearts
*/
video::ITexture *heart_texture = tsrc->getTextureRaw("heart.png");
if(heart_texture)
{
video::ITexture *heart_texture =
driver->getTexture(getTexturePath("heart.png").c_str());
v2s32 p = pos + v2s32(0, -20);
for(s32 i=0; i<halfheartcount/2; i++)
{

View file

@ -997,13 +997,27 @@ Server::Server(
// Export API
scriptapi_export(m_lua, this);
// Load and run scripts
std::string defaultscript = porting::path_data + DIR_DELIM
+ "scripts" + DIR_DELIM + "default.lua";
bool success = script_load(m_lua, defaultscript.c_str());
if(!success){
errorstream<<"Server: Failed to load and run "
<<defaultscript<<std::endl;
assert(0);
core::list<std::string> modspaths;
modspaths.push_back(porting::path_data + DIR_DELIM + "mods");
for(core::list<std::string>::Iterator i = modspaths.begin();
i != modspaths.end(); i++){
std::string modspath = *i;
std::vector<fs::DirListNode> dirlist = fs::GetDirListing(modspath);
for(u32 j=0; j<dirlist.size(); j++){
if(!dirlist[j].dir)
continue;
std::string modname = dirlist[j].name;
infostream<<"Server: Loading mod \""<<modname<<"\" script..."
<<std::endl;
std::string scriptpath = modspath + DIR_DELIM + modname
+ DIR_DELIM + "init.lua";
bool success = script_load(m_lua, scriptpath.c_str());
if(!success){
errorstream<<"Server: Failed to load and run "
<<scriptpath<<std::endl;
assert(0);
}
}
}
// Initialize Environment

View file

@ -132,7 +132,7 @@ std::string getTexturePath(const std::string &filename)
*/
if(fullpath == "")
{
std::string rel_path = std::string("textures")+DIR_DELIM+filename;
std::string rel_path = std::string("clienttextures")+DIR_DELIM+filename;
std::string testpath = porting::path_data + DIR_DELIM + rel_path;
// Check all filename extensions. Returns "" if not found.
fullpath = getImagePath(testpath);