Browse Source

working on better world selection

master
poikilos 9 years ago
committed by Jacob Gustafson
parent
commit
c46e15a46d
  1. 18
      update-web-only.sh
  2. 27
      web/chunkymap.php
  3. 25
      web/viewchunkymap.php

18
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/

27
web/chunkymap.php

@ -6,8 +6,8 @@ if (($_SERVER['PHP_SELF'] == "chunkymap.php") or endsWith($_SERVER['PHP_SELF'],"
echo "<html><body style=\"font-family:calibri,arial,helvetica,sans\">This is the backend--don't call it directly. instead do include_once('chunkymap.php'); To use the map, go to <a href=\"viewchunkymap.php\">viewchunkymap.php</a> instead.</body></html>"; echo "<html><body style=\"font-family:calibri,arial,helvetica,sans\">This is the backend--don't call it directly. instead do include_once('chunkymap.php'); To use the map, go to <a href=\"viewchunkymap.php\">viewchunkymap.php</a> instead.</body></html>";
} }
$auto_choose_enable = false;
$auto_choose_enable = false;
$minute=60; $minute=60;
$player_file_age_expired_max_seconds=20*$minute-1; $player_file_age_expired_max_seconds=20*$minute-1;
$player_file_age_idle_max_seconds=5*$minute-1; $player_file_age_idle_max_seconds=5*$minute-1;
@ -1519,18 +1519,23 @@ function check_world() {
global $chunkymapdata_thisworld_path; global $chunkymapdata_thisworld_path;
global $world_name; global $world_name;
global $chunkymapdata_worlds_path; global $chunkymapdata_worlds_path;
if (!isset($world_name)) { global $auto_choose_enable;
if ($handle = opendir($chunkymapdata_worlds_path)) {
while (false !== ($file_name = readdir($handle))) {
if (substr($file_name, 0, 1) != ".") { if ($auto_choose_enable===true) {
$file_path = $chunkymapdata_worlds_path."/".$file_name; if (!isset($world_name)) {
if (is_dir($file_path)) { if ($handle = opendir($chunkymapdata_worlds_path)) {
$world_name=$file_name; while (false !== ($file_name = readdir($handle))) {
break; 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)) { if (isset($world_name)) {

25
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.); $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) $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; $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 "<a href=\"?world_name=$file_name$append_vars\">$file_name</a>";
// $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_canvas($show_player_names_enable,$decachunks_enable,$chunks_enable,$visual_debug_enable,$html4_mode_enable);
//echo_chunkymap_as_chunk_table(false); //echo_chunkymap_as_chunk_table(false);
//echo_decachunk_table(); //echo_decachunk_table();

Loading…
Cancel
Save