From 0cb49e52890db3e1532a42fa09489ec77d915106 Mon Sep 17 00:00:00 2001 From: Sokomine Date: Sat, 8 Jul 2023 20:37:59 +0200 Subject: [PATCH] moved texture adding to yl_npc.add_textures() --- yl_local_server_config.lua | 44 +------------------------- yl_local_server_do_once_on_startup.lua | 29 +---------------- 2 files changed, 2 insertions(+), 71 deletions(-) diff --git a/yl_local_server_config.lua b/yl_local_server_config.lua index ffafb51..b802c1d 100644 --- a/yl_local_server_config.lua +++ b/yl_local_server_config.lua @@ -2,51 +2,9 @@ -- Please link local_server_config.lua to this file IF running on the YourLand server! -- Else ignore this file. -- --- taken from yl_speak_up from yl -local function add_skins_and_capes(temp, races, modname) - --[[ Let's see if the files are the ones we want. Format is - yl_npc_main_name.png <-- Those are the ones we want - yl_npc_cape_name.png - yl_npc_item_name.png - ]]-- - - for _, race in ipairs(races) do - if(not(yl_speak_up.mob_skins[modname..race])) then - yl_speak_up.mob_skins[modname..race] = {} - end - if(not(yl_speak_up.mob_capes[modname..race])) then - yl_speak_up.mob_capes[modname..race] = {} - end - end - - for _, v in pairs(temp) do - local s = string.split(v, "_") - if s[1] == "yl" and s[2] == "npc" and s[3] == "main" then - for i, race in ipairs(races) do - table.insert(yl_speak_up.mob_skins[modname..race], v) - end - end - if s[1] == "yl" and s[2] == "npc" and s[3] == "cape" then - for i, race in ipairs(races) do - table.insert(yl_speak_up.mob_capes[modname..race], v) - end - end - end - - for _, race in ipairs(races) do - if(#yl_speak_up.mob_skins[modname..race] < 1) then - yl_speak_up.mob_skins[modname..race] = {"yl_speak_up_main_default.png"} - end - if(#yl_speak_up.mob_capes[modname..race] < 1) then - yl_speak_up.mob_capes[modname..race] = {"yl_npc_cape_default.png"} - end - end -end - -- do all the things that have to be done when yl_speak_up is initialized or reloaded -add_skins_and_capes(yl_speak_up_addons.file_list, {"dwarf","elf","goblin","human","npc","orc"}, "yl_speak_up:") -add_skins_and_capes(yl_speak_up_addons.file_list, {"dwarf","elf","goblin","human","npc","orc"}, "yl_npc:") +yl_npc.add_textures() -- Tribe Miocene (Obsidian Flans) yl_speak_up.mesh_data["zmobs_lava_flan.x"] = { texture_index = 1, } diff --git a/yl_local_server_do_once_on_startup.lua b/yl_local_server_do_once_on_startup.lua index c2bcc4d..9802103 100644 --- a/yl_local_server_do_once_on_startup.lua +++ b/yl_local_server_do_once_on_startup.lua @@ -2,33 +2,9 @@ -- Please link local_server_do_once_on_startup.lua to this file IF running on the YourLand server! -- Else ignore this file. -yl_speak_up_addons = {} - -local function read_skins_and_capes_from_folders() - local temp = {} - - -- get the files out of modpath - local mp_list = minetest.get_dir_list(yl_speak_up.modpath .. DIR_DELIM .. "textures", false) - - -- get the files out of worlddir - local wp_list = - minetest.get_dir_list( - yl_speak_up.worldpath .. DIR_DELIM .. "worldmods" .. DIR_DELIM .. "yl_npc" .. DIR_DELIM .. "textures", - false - ) - - -- Let's join both lists. - table.insert_all(temp, mp_list) - table.insert_all(temp, wp_list) - - return temp -end - - -yl_speak_up.enable_yl_mobs = true -- mobs registered as yl_speak_up-mobs (based on mobs_redo) -if(yl_speak_up.enable_yl_mobs) then +if(true) then -- react to right-click etc. dofile(yl_speak_up.modpath .. "interface_mobs_api.lua") -- the actual mobs, using mobs_redo @@ -36,6 +12,3 @@ if(yl_speak_up.enable_yl_mobs) then -- may store a table of registered mobs in the future; currently not really used yl_speak_up.mob_table = yl_speak_up.init_mob_table() or {} end - --- this has to be called *once* when the file is initialized -yl_speak_up_addons.file_list = read_skins_and_capes_from_folders()