aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
Commit message (Expand)AuthorAge
...
* updated version to rc2, rolling out new windows test binaryPerttu Ahola2011-07-30
* Removed remaining -delta referencesPerttu Ahola2011-07-30
* removed -delta namingsPerttu Ahola2011-07-23
* Tweak makefiles to add -delta suffix.Weedy2011-07-21
* Merge branch 'upstream/master'Nils Dagsson Moskopp2011-07-14
|\
| * Updated version and changelogPerttu Ahola2011-07-04
* | Merge branch 'master' of https://github.com/erlehmann/minetest-delta.git into...Sebastian Rühl2011-06-26
|\ \ | |/ |/|
| * MacOSX build supportMrLoom2011-06-01
* | Reorganizing stuff (import from temporary git repo)Perttu Ahola2011-06-25
* | Changed MapBlockObjects to be never written anymore. Incremented version number.Perttu Ahola2011-06-18
* | merged Mac OSX build fix from minetest-deltaPerttu Ahola2011-06-18
* | In a globally installed build, debug.txt is now placed in userdata directory....Perttu Ahola2011-06-02
* | 0.2.20110602_0Perttu Ahola2011-06-02
* | updated versionPerttu Ahola2011-05-31
* | 20110529_2Perttu Ahola2011-05-29
* | versionPerttu Ahola2011-05-29
* | changed version number to 0.2.20110529_0Perttu Ahola2011-05-29
|/
* Optimized smooth lighting calculation codePerttu Ahola2011-04-24
* updated menu a bit, and some other small fixesPerttu Ahola2011-04-24
* removed /usr prefix from install pathsPerttu Ahola2011-04-24
* changed version for making a test binaryPerttu Ahola2011-04-23
* updated changelog and versionPerttu Ahola2011-04-10
* still modified version!Perttu Ahola2011-04-06
* Fixed wrong version numberPerttu Ahola2011-04-06
* Changed version number according to a new versioning scheme.Perttu Ahola2011-04-06
* Incremented version to 0.0.2.Perttu Ahola2011-04-05
* small fixes: crack texture, server build on windows, configuration file examp...Perttu Ahola2011-02-16
* might work good on cmake+msvc nowPerttu Ahola2011-02-15
* oops... blew. now?Perttu Ahola2011-01-18
* Tried to fix install directory problem on linux... Let's hope this doesn't bl...Perttu Ahola2011-01-18
* random build system tweakingPerttu Ahola2011-01-09
* Mainly small build system fixesPerttu Ahola2011-01-09
* Lots of small stuffPerttu Ahola2011-01-08
* doc updates; CMake works reasonably well now.Perttu Ahola2011-01-08
* CMake stuff works now on linux and windows... and should be possible to make ...Perttu Ahola2011-01-08
* CMake working on Linux (not on windows)Perttu Ahola2011-01-08
pt">() -------------------------------------------------------------------------------- -- Menu helper functions -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- local function render_client_count(n) if n > 99 then return '99+' elseif n >= 0 then return tostring(n) else return '?' end end local function configure_selected_world_params(idx) local worldconfig = pkgmgr.get_worldconfig(menudata.worldlist:get_list()[idx].path) if worldconfig.creative_mode then core.settings:set("creative_mode", worldconfig.creative_mode) end if worldconfig.enable_damage then core.settings:set("enable_damage", worldconfig.enable_damage) end end -------------------------------------------------------------------------------- function image_column(tooltip, flagname) return "image,tooltip=" .. core.formspec_escape(tooltip) .. "," .. "0=" .. core.formspec_escape(defaulttexturedir .. "blank.png") .. "," .. "1=" .. core.formspec_escape(defaulttexturedir .. (flagname and "server_flags_" .. flagname .. ".png" or "blank.png")) .. "," .. "2=" .. core.formspec_escape(defaulttexturedir .. "server_ping_4.png") .. "," .. "3=" .. core.formspec_escape(defaulttexturedir .. "server_ping_3.png") .. "," .. "4=" .. core.formspec_escape(defaulttexturedir .. "server_ping_2.png") .. "," .. "5=" .. core.formspec_escape(defaulttexturedir .. "server_ping_1.png") end -------------------------------------------------------------------------------- function render_serverlist_row(spec, is_favorite) local text = "" if spec.name then text = text .. core.formspec_escape(spec.name:trim()) elseif spec.address then text = text .. core.formspec_escape(spec.address:trim()) if spec.port then text = text .. ":" .. spec.port end end local grey_out = not is_server_protocol_compat(spec.proto_min, spec.proto_max) local details if is_favorite then details = "1," else details = "0," end if spec.ping then local ping = spec.ping * 1000 if ping <= 50 then details = details .. "2," elseif ping <= 100 then details = details .. "3," elseif ping <= 250 then details = details .. "4," else details = details .. "5," end else details = details .. "0," end if spec.clients and spec.clients_max then local clients_percent = 100 * spec.clients / spec.clients_max -- Choose a color depending on how many clients are connected -- (relatively to clients_max) local clients_color if grey_out then clients_color = '#aaaaaa' elseif spec.clients == 0 then clients_color = '' -- 0 players: default/white elseif clients_percent <= 60 then clients_color = '#a1e587' -- 0-60%: green elseif clients_percent <= 90 then clients_color = '#ffdc97' -- 60-90%: yellow elseif clients_percent == 100 then clients_color = '#dd5b5b' -- full server: red (darker) else clients_color = '#ffba97' -- 90-100%: orange end details = details .. clients_color .. ',' .. render_client_count(spec.clients) .. ',/,' .. render_client_count(spec.clients_max) .. ',' elseif grey_out then details = details .. '#aaaaaa,?,/,?,' else details = details .. ',?,/,?,' end if spec.creative then details = details .. "1," else details = details .. "0," end if spec.damage then details = details .. "1," else details = details .. "0," end if spec.pvp then details = details .. "1," else details = details .. "0," end return details .. (grey_out and '#aaaaaa,' or ',') .. text end -------------------------------------------------------------------------------- os.tempfolder = function() local temp = core.get_temp_path() return temp .. DIR_DELIM .. "MT_" .. math.random(0, 10000) end -------------------------------------------------------------------------------- os.tmpname = function() local path = os.tempfolder() io.open(path, "w"):close() return path end -------------------------------------------------------------------------------- function menu_render_worldlist() local retval = "" local current_worldlist = menudata.worldlist:get_list() for i, v in ipairs(current_worldlist) do if retval ~= "" then retval = retval .. "," end retval = retval .. core.formspec_escape(v.name) .. " \\[" .. core.formspec_escape(v.gameid) .. "\\]" end return retval end -------------------------------------------------------------------------------- function menu_handle_key_up_down(fields, textlist, settingname) local oldidx, newidx = core.get_textlist_index(textlist), 1 if fields.key_up or fields.key_down then if fields.key_up and oldidx and oldidx > 1 then newidx = oldidx - 1 elseif fields.key_down and oldidx and oldidx < menudata.worldlist:size() then newidx = oldidx + 1 end core.settings:set(settingname, menudata.worldlist:get_raw_index(newidx)) configure_selected_world_params(newidx) return true end return false end -------------------------------------------------------------------------------- function text2textlist(xpos, ypos, width, height, tl_name, textlen, text, transparency) local textlines = core.wrap_text(text, textlen, true) local retval = "textlist[" .. xpos .. "," .. ypos .. ";" .. width .. "," .. height .. ";" .. tl_name .. ";" for i = 1, #textlines do textlines[i] = textlines[i]:gsub("\r", "") retval = retval .. core.formspec_escape(textlines[i]) .. "," end retval = retval .. ";0;" if transparency then retval = retval .. "true" end retval = retval .. "]" return retval end -------------------------------------------------------------------------------- function is_server_protocol_compat(server_proto_min, server_proto_max) if (not server_proto_min) or (not server_proto_max) then -- There is no info. Assume the best and act as if we would be compatible. return true end return min_supp_proto <= server_proto_max and max_supp_proto >= server_proto_min end -------------------------------------------------------------------------------- function is_server_protocol_compat_or_error(server_proto_min, server_proto_max) if not is_server_protocol_compat(server_proto_min, server_proto_max) then local server_prot_ver_info, client_prot_ver_info local s_p_min = server_proto_min local s_p_max = server_proto_max if s_p_min ~= s_p_max then server_prot_ver_info = fgettext_ne("Server supports protocol versions between $1 and $2. ", s_p_min, s_p_max) else server_prot_ver_info = fgettext_ne("Server enforces protocol version $1. ", s_p_min) end if min_supp_proto ~= max_supp_proto then client_prot_ver_info= fgettext_ne("We support protocol versions between version $1 and $2.", min_supp_proto, max_supp_proto) else client_prot_ver_info = fgettext_ne("We only support protocol version $1.", min_supp_proto) end gamedata.errormessage = fgettext_ne("Protocol version mismatch. ") .. server_prot_ver_info .. client_prot_ver_info return false end return true end -------------------------------------------------------------------------------- function menu_worldmt(selected, setting, value) local world = menudata.worldlist:get_list()[selected] if world then local filename = world.path .. DIR_DELIM .. "world.mt" local world_conf = Settings(filename) if value then if not world_conf:write() then core.log("error", "Failed to write world config file") end world_conf:set(setting, value) world_conf:write() else return world_conf:get(setting) end else return nil end end function menu_worldmt_legacy(selected) local modes_names = {"creative_mode", "enable_damage", "server_announce"} for _, mode_name in pairs(modes_names) do local mode_val = menu_worldmt(selected, mode_name) if mode_val then core.settings:set(mode_name, mode_val) else menu_worldmt(selected, mode_name, core.settings:get(mode_name)) end end end