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. 9
      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/

9
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,6 +1519,10 @@ 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;
global $auto_choose_enable;
if ($auto_choose_enable===true) {
if (!isset($world_name)) { if (!isset($world_name)) {
if ($handle = opendir($chunkymapdata_worlds_path)) { if ($handle = opendir($chunkymapdata_worlds_path)) {
while (false !== ($file_name = readdir($handle))) { while (false !== ($file_name = readdir($handle))) {
@ -1533,6 +1537,7 @@ function check_world() {
closedir($handle); closedir($handle);
} }
} }
}
if (isset($world_name)) { if (isset($world_name)) {
$chunkymapdata_thisworld_path = $chunkymapdata_worlds_path."/".$world_name; $chunkymapdata_thisworld_path = $chunkymapdata_worlds_path."/".$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