From 390856c53968014b313f099242d7aa5a67f8eab7 Mon Sep 17 00:00:00 2001 From: poikilos <7557867+poikilos@users.noreply.github.com> Date: Fri, 22 Apr 2016 16:05:24 -0400 Subject: [PATCH] working on player update time still has issue where python time.gmtime is getting different utc time than php time() --- generator.py | 6 +++--- web/chunkymap.php | 39 +++++++++++++++++++++++++-------------- 2 files changed, 28 insertions(+), 17 deletions(-) diff --git a/generator.py b/generator.py index 84f17f0..915c48c 100644 --- a/generator.py +++ b/generator.py @@ -1040,8 +1040,8 @@ class MTChunks: #else: # if self.verbose_enable: # print("existing "+this_player["index"]+" is not needle "+str(index)) - else: - print("WARNING: player "+this_key+":"+str(this_player)+" is missing index") + #else: + #print("WARNING: player "+this_key+":"+str(this_player)+" is missing index") return result def get_new_player_index(self): @@ -1297,7 +1297,7 @@ class MTChunks: print(min_indent+"PLAYER MOVED: "+str(player_name)+" moved from "+str(saved_player_x)+","+str(saved_player_y)+","+str(saved_player_z)+" to "+str(player_x)+","+str(player_y)+","+str(player_z)) self.last_player_move_mtime_string = this_mtime_string players_moved_count += 1 - self.players[file_name]["utc_mtime"]=this_mtime_string + self.players[file_name]["utc_mtime"] = this_mtime_string else: if self.verbose_enable: print(min_indent+"SAVING map entry for player '"+str(player_name)+"'") diff --git a/web/chunkymap.php b/web/chunkymap.php index da1eb87..c6b9848 100644 --- a/web/chunkymap.php +++ b/web/chunkymap.php @@ -272,6 +272,9 @@ function get_markers_from_dir($chunkymap_markers_path) { global $player_file_age_expired_max_seconds; global $player_file_age_idle_max_seconds; global $show_expired_players_enable; + if ($show_expired_players_enable===true) { + echo "show_expired_players_enable:true"; + } $markers=array(); $markers_count=0; if (is_dir($chunkymap_markers_path)) { @@ -289,9 +292,15 @@ function get_markers_from_dir($chunkymap_markers_path) { $last_player_update_time = strtotime($marker_vars["utc_mtime"]); if (time()-$last_player_update_time > $player_file_age_expired_max_seconds) { $is_expired=true; + echo "expired
"."\n"; } elseif (time()-$last_player_update_time > $player_file_age_idle_max_seconds) { $is_idle=true; + echo "idle
"."\n"; + } + else { + echo "not expired since ".$marker_vars["name"]."'s utc_mtime is ".DATE("Y-m-d H:i",$last_player_update_time)."
"."\n"; + echo " current date is ".DATE("Y-m-d H:i",time())."
"."\n"; } if ($is_expired===false) { $markers[$markers_count]["utc_mtime"] = $marker_vars["utc_mtime"]; @@ -1348,13 +1357,14 @@ function echo_chunkymap_canvas($show_player_names_enable, $decachunks_enable, $c $text = $this_player["name"]; } } - if ($this_player["is_expired"]===true) { //should only be used for debug - $img_border_style="border: 1px solid rgba(128,128,128,.5);"; - $img_style.="opacity: 0.1; filter: alpha(opacity=10);"; //filter is for IE8 and below - $text_style="color:white; opacity: 0.4; filter: alpha(opacity=40);"; //filter is for IE8 and below - $text.=" (expired)"; - } - elseif ($this_player["is_idle"]===true) { + //if ($this_player["is_expired"]===true) { //should only be used for debug + // $img_border_style="border: 1px solid rgba(128,128,128,.5);"; + // $img_style.="opacity: 0.1; filter: alpha(opacity=10);"; //filter is for IE8 and below + // $text_style="color:white; opacity: 0.4; filter: alpha(opacity=40);"; //filter is for IE8 and below + // $text.=" (expired)"; + //} + //elseif + if ($this_player["is_idle"]===true) { $img_border_style="border: 1px solid rgba(128,128,128,.5);"; $img_style.="opacity: 0.4; filter: alpha(opacity=40);"; //filter is for IE8 and below $text_style="color:white; opacity: 0.4; filter: alpha(opacity=40);"; //filter is for IE8 and below @@ -1400,13 +1410,14 @@ function echo_chunkymap_canvas($show_player_names_enable, $decachunks_enable, $c if (isset($this_marker["name"])) { $text = $this_marker["name"]; } - if ($this_marker["is_expired"]===true) { //should only be used for debug - $img_border_style="border: 1px solid rgba(128,128,128,.5);"; - $img_style.="opacity: 0.1; filter: alpha(opacity=10);"; //filter is for IE8 and below - $text_style="color:white; opacity: 0.4; filter: alpha(opacity=40);"; //filter is for IE8 and below - $text.=" (expired)"; - } - elseif ($this_marker["is_idle"]===true) { + //if ($this_marker["is_expired"]===true) { //should only be used for debug + // $img_border_style="border: 1px solid rgba(128,128,128,.5);"; + // $img_style.="opacity: 0.1; filter: alpha(opacity=10);"; //filter is for IE8 and below + // $text_style="color:white; opacity: 0.4; filter: alpha(opacity=40);"; //filter is for IE8 and below + // $text.=" (expired)"; + //} + //else + if ($this_marker["is_idle"]===true) { $img_border_style="border: 1px solid rgba(128,128,128,.5);"; $img_style.="opacity: 0.4; filter: alpha(opacity=40);"; //filter is for IE8 and below $text_style="color:white; opacity: 0.4; filter: alpha(opacity=40);"; //filter is for IE8 and below