diff --git a/README.md b/README.md
index 24de494..1beacfb 100644
--- a/README.md
+++ b/README.md
@@ -10,6 +10,10 @@ This program comes without any warranty, to the extent permitted by applicable l
* Has static html version of map (echo_chunkymap_table() php function)
* Zoom in and out
* optionally echo name of world that was detected by the scheduled py file
+ * shows player location (and only first 2 characters of name, for privacy; there is no saved setting yet, so to adjust, you must change the value of $nonprivate_name_beginning_char_count in chunkymap.php)
+ * Ghost players if they stay in one spot 2 minutes (consider them logged out by that method alone since not requiring mods; see $player_file_age_idle_max_seconds in chunkymap.php)
+ * Hide players if they stay in one spot 5 minutes (consider them logged out by that method alone since not requiring mods; see $player_file_age_expired_max_seconds in chunkymap.php)
+
* Has optional script to add crontab entry (to schedule update script every minute that runs the py file unless the py file is not complete [took longer than 1 minute])
## Requirements:
@@ -58,7 +62,6 @@ This program comes without any warranty, to the extent permitted by applicable l
## Known Issues
* index-example.php should read the size of the chunks -- see near is_file($chunk_genresult_path) in chunkymap.php
-* Show player location (and optionally turn off)
-* Make a php file that shows the map on an html5 canvas (refresh players every 10 seconds, check for new map chunks every minute)
-* Make players invisible if they stay in one spot too long (consider them logged out by that method alone since not requiring mods)
+* optionally hide player location
+* Make a method (in chunkymap.php) to echo the map as an html5 canvas (refresh players every 10 seconds, check for new map chunks every minute)
* Detect failure of minetestmapper-numpy.py and instead use minetest-mapper if on linux, otherwise show error if neither are present (Windows has no minetest-mapper at least on client 0.4.13)
diff --git a/web/chunkymap.php b/web/chunkymap.php
index 5277b72..b284da4 100644
--- a/web/chunkymap.php
+++ b/web/chunkymap.php
@@ -310,6 +310,7 @@ function echo_chunkymap_table() {
$chunk_assoc[$chunk_luid][ "players" ][ $chunk_assoc[$chunk_luid]["players_count"] ][ "z" ] = $player_dict["z"];
$chunk_assoc[$chunk_luid][ "players" ][ $chunk_assoc[$chunk_luid]["players_count"] ][ "rel_x" ] = $rel_x;
$chunk_assoc[$chunk_luid][ "players" ][ $chunk_assoc[$chunk_luid]["players_count"] ][ "rel_z" ] = $rel_z;
+ $chunk_assoc[$chunk_luid][ "players" ][ $chunk_assoc[$chunk_luid]["players_count"] ][ "file_path" ] = $file_path;
if (isset($player_dict["name"])) {
$chunk_assoc[$chunk_luid][ "players" ][ $chunk_assoc[$chunk_luid]["players_count"] ][ "name" ] = $player_dict["name"];
@@ -389,13 +390,15 @@ function echo_chunkymap_table() {
$z_count = $chunkz_max - $chunkz_min;
echo "\r\n";
echo "
\r\n";
- echo_hold( " \r\n");
+ echo_hold( " \r\n");
$z = (int)$chunkz_max;
$scale=(float)$chunkymap_view_zoom_multiplier; // no longer /100
$zoomed_w=(int)((float)$chunkymap_tile_original_w*$scale+.5);
$zoomed_h=(int)((float)$chunkymap_tile_original_h*$scale+.5);
$genresult_suffix_then_dot_then_ext="_mapper_result.txt";
$dot_yaml=".yml";
+ $player_file_age_expired_max_seconds=299;
+ $player_file_age_idle_max_seconds=119;
while ($z >= $chunkz_min) {
echo_hold( " \r\n");
$x = (int)$chunkx_min;
@@ -448,14 +451,14 @@ function echo_chunkymap_table() {
if (isset($chunk_dict["image_right"])) {
if ( (int)$chunk_dict["image_left"] > $expected_left ) {
$td_style_suffix.="text-align:right;";
- $alignment_comment.="";
+ //$alignment_comment.="";
}
//elseif ( (int)$chunk_dict["image_right"] < $expected_right ) {
// $td_style_suffix.="text-align:left;";
//}
else {
$td_style_suffix.="text-align:left;";
- $alignment_comment.="";
+ //$alignment_comment.="";
}
}
}
@@ -473,14 +476,14 @@ function echo_chunkymap_table() {
if (isset($chunk_dict["image_bottom"])) {
if ( (int)$chunk_dict["image_top"] > $expected_top) {
$element_align_style_suffix.="vertical-align:bottom;";
- $alignment_comment.="";
+ //$alignment_comment.="";
}
//elseif ( (int)$chunk_dict["image_bottom"] < $expected_bottom) {
// $element_align_style_suffix.="vertical-align:top;";
//}
else {
$element_align_style_suffix.="vertical-align:top;";
- $alignment_comment.="";
+ //$alignment_comment.="";
}
}
}
@@ -518,6 +521,17 @@ function echo_chunkymap_table() {
for ($player_count=0; $player_count<$chunk_assoc[$chunk_luid]["players_count"]; $player_count++) {
$rel_x = $chunk_assoc[$chunk_luid][ "players" ][ $player_count ]["rel_x"];
$rel_z = $chunk_assoc[$chunk_luid][ "players" ][ $player_count ]["rel_z"];
+ $is_expired=false;
+ $is_idle=false;
+ if (isset($chunk_assoc[$chunk_luid][ "players" ][ $player_count ]["file_path"])) {
+ $last_player_update_time=filemtime($chunk_assoc[$chunk_luid][ "players" ][ $player_count ]["file_path"]);
+ if (time()-$last_player_update_time > $player_file_age_expired_max_seconds) {
+ $is_expired=true;
+ }
+ elseif (time()-$last_player_update_time > $player_file_age_idle_max_seconds) {
+ $is_idle=true;
+ }
+ }
$player_name = $chunk_assoc[$chunk_luid]["players"][$player_count]["name"];
if (strlen($chunk_assoc[$chunk_luid]["players"][$player_count]["name"])>$nonprivate_name_beginning_char_count) {
$player_name = substr($player_name, 0, $nonprivate_name_beginning_char_count)."*";
@@ -527,7 +541,13 @@ function echo_chunkymap_table() {
$zoomed_head_h=$character_icon_h;//(int)((float)$character_icon_h*$scale+.5);
$rel_x -= (int)($zoomed_head_w/2);
$rel_z -= (int)($zoomed_head_h/2);
- echo_hold( "$player_name
" );
+ $img_style="";
+ if (!$is_expired) {
+ if ($is_idle) {
+ $img_style="opacity: 0.4; filter: alpha(opacity=40);"; //filter is for IE8 and below
+ }
+ echo_hold( "$player_name
" );
+ }
//$position_offset_x+=$character_icon_w;
}
}