diff --git a/update-web-only.sh b/update-web-only.sh new file mode 100644 index 0000000..c64528b --- /dev/null +++ b/update-web-only.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +DEST_WWW_PATH=/var/www/html +if [ -f /var/www/html/minetest/chunkymap.php ]; then + DEST_WWW_PATH=/var/www/html/minetest +fi + +if [ -f viewchunkymap.php ]; then + rm viewchunkymap.php +fi +wget https://github.com/expertmm/minetest-chunkymap/raw/master/web/viewchunkymap.php +sudo mv -f viewchunkymap.php $DEST_WWW_PATH/ +if [ -f chunkymap.php ]; then + rm chunkymap.php +fi +wget https://github.com/expertmm/minetest-chunkymap/raw/master/web/chunkymap.php +sudo mv -f chunkymap.php $DEST_WWW_PATH/ + diff --git a/web/chunkymap.php b/web/chunkymap.php index 4920f88..4a6b26c 100644 --- a/web/chunkymap.php +++ b/web/chunkymap.php @@ -6,8 +6,8 @@ if (($_SERVER['PHP_SELF'] == "chunkymap.php") or endsWith($_SERVER['PHP_SELF']," echo "This is the backend--don't call it directly. instead do include_once('chunkymap.php'); To use the map, go to viewchunkymap.php instead."; } - - +$auto_choose_enable = false; +$auto_choose_enable = false; $minute=60; $player_file_age_expired_max_seconds=20*$minute-1; $player_file_age_idle_max_seconds=5*$minute-1; @@ -1519,18 +1519,23 @@ function check_world() { global $chunkymapdata_thisworld_path; global $world_name; global $chunkymapdata_worlds_path; - if (!isset($world_name)) { - if ($handle = opendir($chunkymapdata_worlds_path)) { - while (false !== ($file_name = readdir($handle))) { - if (substr($file_name, 0, 1) != ".") { - $file_path = $chunkymapdata_worlds_path."/".$file_name; - if (is_dir($file_path)) { - $world_name=$file_name; - break; + global $auto_choose_enable; + + + if ($auto_choose_enable===true) { + if (!isset($world_name)) { + if ($handle = opendir($chunkymapdata_worlds_path)) { + while (false !== ($file_name = readdir($handle))) { + if (substr($file_name, 0, 1) != ".") { + $file_path = $chunkymapdata_worlds_path."/".$file_name; + if (is_dir($file_path)) { + $world_name=$file_name; + break; + } } } + closedir($handle); } - closedir($handle); } } if (isset($world_name)) { diff --git a/web/viewchunkymap.php b/web/viewchunkymap.php index 1945d53..6d7afd2 100644 --- a/web/viewchunkymap.php +++ b/web/viewchunkymap.php @@ -43,6 +43,31 @@ if (is_file('chunkymap.php')) { $chunks_enable=false; //(this should normally be false) if true, uses 16x16 png files instead of the 160x160 decachunks; it is slower but may have more of the map during times when new chunks are explored but before the render queue is done and the decachunk images are created from the chunk images.); $visual_debug_enable=false; //if true, this renders colors based on yml files instead of drawing images (and does not echo images at all) $html4_mode_enable=false; + $append_vars = ""; + if (isset($x)) { + $append_vars.="&x=$x" + } + if (isset($z)) { + $append_vars.="&z=$z" + } + if (isset($zoom)) { + $append_vars.="&zoom=$zoom" + } + if (!isset($world_name)) { + if ($handle = opendir($chunkymapdata_worlds_path)) { + while (false !== ($file_name = readdir($handle))) { + if (substr($file_name, 0, 1) != ".") { + $file_path = $chunkymapdata_worlds_path."/".$file_name; + if (is_dir($file_path)) { + echo "$file_name"; + // $world_name=$file_name; + // break; + } + } + } + closedir($handle); + } + } echo_chunkymap_canvas($show_player_names_enable,$decachunks_enable,$chunks_enable,$visual_debug_enable,$html4_mode_enable); //echo_chunkymap_as_chunk_table(false); //echo_decachunk_table();