aboutsummaryrefslogtreecommitdiff
path: root/src/network/clientopcodes.h
diff options
context:
space:
mode:
authorElias Fleckenstein <54945686+EliasFleckenstein03@users.noreply.github.com>2021-03-04 20:37:41 +0100
committerGitHub <noreply@github.com>2021-03-04 20:37:41 +0100
commit5b42b5a8c26811bd7cb152cbb5ffeee77abb8d66 (patch)
treec3704afbee37986721595b918dc0a1bdbafa98c2 /src/network/clientopcodes.h
parent1abb83b1abde10632442554c90549d81d1b39cd7 (diff)
downloadminetest-5b42b5a8c26811bd7cb152cbb5ffeee77abb8d66.tar.gz
minetest-5b42b5a8c26811bd7cb152cbb5ffeee77abb8d66.tar.bz2
minetest-5b42b5a8c26811bd7cb152cbb5ffeee77abb8d66.zip
Add mod.conf to preview clientmod (#11020)
Diffstat (limited to 'src/network/clientopcodes.h')
0 files changed, 0 insertions, 0 deletions
a> 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135
--Minetest
--Copyright (C) 2014 sapier
--
--This program is free software; you can redistribute it and/or modify
--it under the terms of the GNU Lesser General Public License as published by
--the Free Software Foundation; either version 2.1 of the License, or
--(at your option) any later version.
--
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
--GNU Lesser General Public License for more details.
--
--You should have received a copy of the GNU Lesser General Public License along
--with this program; if not, write to the Free Software Foundation, Inc.,
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

--------------------------------------------------------------------------------
local function filter_texture_pack_list(list)
	local retval = {}

	for _, item in ipairs(list) do
		if item ~= "base" then
			retval[#retval + 1] = item
		end
	end

	table.sort(retval)
	table.insert(retval, 1, fgettext("None"))

	return retval
end

--------------------------------------------------------------------------------
local function render_texture_pack_list(list)
	local retval = ""

	for i, v in ipairs(list) do
		if v:sub(1, 1) ~= "." then
			if retval ~= "" then
				retval = retval .. ","
			end

			retval = retval .. core.formspec_escape(v)
		end
	end

	return retval
end

--------------------------------------------------------------------------------
local function get_formspec(tabview, name, tabdata)

	local retval = "label[4,-0.25;" .. fgettext("Select Texture Pack:") .. "]" ..
			"textlist[4,0.25;7.5,5.0;TPs;"

	local current_texture_path = core.settings:get("texture_path")
	local list = filter_texture_pack_list(core.get_dir_list(core.get_texturepath(), true))
	local index = tonumber(core.settings:get("mainmenu_last_selected_TP"))

	if not index then index = 1 end

	if current_texture_path == "" then
		retval = retval ..
			render_texture_pack_list(list) ..
			";" .. index .. "]" ..
			"textarea[0.6,2.85;3.7,1.5;;" ..
			fgettext("Default textures will be used.") ..
			";]"