From f6b73e5668bcd677d676dda87c92508a3c353e67 Mon Sep 17 00:00:00 2001 From: poikilos <7557867+poikilos@users.noreply.github.com> Date: Mon, 29 Feb 2016 11:42:30 -0500 Subject: [PATCH] fixed rerender issue in pseudorecursion and improved documentation of signals txt file --- README.md | 15 +++++++++ chunkymap-regen.py | 59 +++++++++++++++++++--------------- install-chunkymap-on-ubuntu.sh | 2 +- 3 files changed, 49 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index d5513e7..9fe4b32 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,20 @@ This program comes without any warranty, to the extent permitted by applicable l echo "refresh_map_enable:False" > ~/minetest/util/chunkymap-signals.txt sleep 15s echo "loop_enable:False" > ~/minetest/util/chunkymap-signals.txt + * list of signals: + loop_enable:True + loop_enable:False + refresh_players_enable:True + refresh_players_enable:False + refresh_map_enable:True + refresh_map_enable:False + #rerenders chunks that were rendered in this run: + recheck_rendered:True + #where 1 is number of seconds: + refresh_map_seconds:1 + #where 1 is number of seconds: + refresh_players_seconds:1 + * Has static html version of map (echo_chunkymap_table() php function) -- see example.php * Zoom in and out * optionally echo name of world that was detected by the scheduled py file @@ -89,6 +103,7 @@ This program comes without any warranty, to the extent permitted by applicable l chunkymap-regen-loop.bat * copy example.php and chunkymap.php (and optionally browser.php) to your DocumentRoot or whatever folder will contain the chunkymapdata folder ## Known Issues +* * chunkymap.php should read the size of the chunks -- see near is_file($chunk_genresult_path) in chunkymap.php * 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) diff --git a/chunkymap-regen.py b/chunkymap-regen.py index 0eaf38c..f47f7b7 100644 --- a/chunkymap-regen.py +++ b/chunkymap-regen.py @@ -789,39 +789,39 @@ class MTChunks: is_render_needed = False - #if not self.is_chunk_fresh(chunk_luid): - if is_player_in_this_chunk: - if self.is_chunk_yaml_marked(chunk_luid): - if self.is_chunk_yaml_marked_empty(chunk_luid): + if not self.is_chunk_fresh(chunk_luid): + if is_player_in_this_chunk: + if self.is_chunk_yaml_marked(chunk_luid): + if self.is_chunk_yaml_marked_empty(chunk_luid): + is_render_needed = True + if self.is_verbose: + print (chunk_luid+": RENDERING nonfresh previously marked empty (player in it)") + else: + sys.stdout.write('.') + else: + if self.is_verbose: + print (chunk_luid+": SKIPPING nonfresh previously marked nonempty (player in it)") + #else: + #sys.stdout.write('.') + else: is_render_needed = True if self.is_verbose: - print (chunk_luid+": RENDERING nonfresh previously marked empty (player in it)") + print (chunk_luid+": RENDERING nonfresh unmarked (player in it)") else: sys.stdout.write('.') - else: - if self.is_verbose: - print (chunk_luid+": SKIPPING nonfresh previously marked nonempty (player in it)") - #else: - #sys.stdout.write('.') else: - is_render_needed = True - if self.is_verbose: - print (chunk_luid+": RENDERING nonfresh unmarked (player in it)") + if (not self.is_chunk_yaml_marked(chunk_luid)): + is_render_needed = True + if self.is_verbose: + print (chunk_luid+": RENDERING nonfresh unmarked (simple check since has no player)") + else: + sys.stdout.write('.') else: - sys.stdout.write('.') + if self.is_verbose: + print (chunk_luid+": SKIPPING nonfresh previously marked (simple check since has no player)") else: - if (not self.is_chunk_yaml_marked(chunk_luid)): - is_render_needed = True - if self.is_verbose: - print (chunk_luid+": RENDERING nonfresh unmarked (simple check since has no player)") - else: - sys.stdout.write('.') - else: - if self.is_verbose: - print (chunk_luid+": SKIPPING nonfresh previously marked (simple check since has no player)") - #else: - # if self.is_verbose: - # print (chunk_luid+": SKIPPING fresh chunk") + if self.is_verbose: + print (chunk_luid+": SKIPPING fresh chunk") #if (not self.is_chunk_yaml_marked(chunk_luid)): #is_render_needed = True @@ -1136,6 +1136,13 @@ class MTChunks: print("ERROR: expected >=1 seconds for refresh_players_seconds (int or float)") else: print("ERROR: expected int for "+this_key) + elif this_key=="recheck_rendered": + if type(signals[this_key]) is bool: + if signals[this_key]: + for chunk_luid in self.chunks.keys(): + self.chunks[chunk_luid].is_fresh = False + else: + print("ERROR: expected bool for "+this_key) elif this_key=="refresh_map_enable": if type(signals[this_key]) is bool: self.refresh_map_enable = signals[this_key] diff --git a/install-chunkymap-on-ubuntu.sh b/install-chunkymap-on-ubuntu.sh index c2978e6..32eccb7 100644 --- a/install-chunkymap-on-ubuntu.sh +++ b/install-chunkymap-on-ubuntu.sh @@ -52,7 +52,7 @@ chmod -x "$CHUNKYMAP_DEST/unused/chunkymap-cronjob" chmod -x "$CHUNKYMAP_DEST/unused/set-minutely-crontab-job.sh" chmod -x "$CHUNKYMAP_DEST/unused/set-minutely-players-crontab-job.sh" -sudo apt-get install python-numpy python-pil +sudo apt-get install python-numpy python-pil python-leveldb echo "" echo "To see what needs to be in your $MT_MY_WEBSITE_PATH directory (if you don't use that directory, modify chunkymap-regen.py to use your directory):" echo "cd $CHUNKYMAP_DEST/web"