Browse Source

colors.txt is now generated

from various sources preventing duplicates
master
poikilos 9 years ago
committed by Jacob Gustafson
parent
commit
fc61c28940
  1. 1
      .gitignore
  2. 6
      chunkymap-regen.py
  3. 0
      colors (base).txt
  4. 69
      colors-missing.txt
  5. 5
      colors/fragments.txt
  6. 9
      colors/fragments/Neon (Ethereal, partial).txt
  7. 22
      colors/fragments/dip.txt
  8. 8
      colors/fragments/ng.emerge.txt
  9. 149
      colors/fragments/paramat.txt
  10. 3
      colors/repos.txt
  11. 15368
      colors/repos/VenessaE.txt
  12. 2019
      colors/repos/sfan5.txt
  13. 21
      expertmm.py
  14. 92
      minetestinfo.py
  15. 4
      minetestmapper-numpy.py
  16. 10
      minetestoffline.py
  17. 6
      singleimage.py
  18. 22
      web/chunkymap.php
  19. 5
      web/viewchunkymap.php

1
.gitignore

@ -3,6 +3,7 @@ chunkymapdata/
chunkymap-genresults/ chunkymap-genresults/
chunkymap.yml chunkymap.yml
minetestmeta.yml minetestmeta.yml
colors.txt
# Byte-compiled / optimized / DLL files # Byte-compiled / optimized / DLL files
__pycache__/ __pycache__/

6
chunkymap-regen.py

@ -64,7 +64,7 @@ class MTChunks:
chunkymap_data_path = None chunkymap_data_path = None
chunkymapdata_worlds_path = None chunkymapdata_worlds_path = None
is_save_output_ok = None is_save_output_ok = None
minetestmapper_fast_sqlite_path = None minetestmapper_numpy_path = None
minetestmapper_custom_path = None minetestmapper_custom_path = None
minetestmapper_py_path = None minetestmapper_py_path = None
colors_path = None colors_path = None
@ -186,9 +186,9 @@ class MTChunks:
print("WARNING: Database backend cannot be detected (unable to ensure image generator script will render map)") print("WARNING: Database backend cannot be detected (unable to ensure image generator script will render map)")
#region the following is also in singleimage.py #region the following is also in singleimage.py
self.minetestmapper_fast_sqlite_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "minetestmapper-numpy.py") self.minetestmapper_numpy_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "minetestmapper-numpy.py")
self.minetestmapper_custom_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "minetestmapper-expertmm.py") self.minetestmapper_custom_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "minetestmapper-expertmm.py")
self.minetestmapper_py_path = self.minetestmapper_fast_sqlite_path self.minetestmapper_py_path = self.minetestmapper_numpy_path
#if (self.backend_string!="sqlite3"): #if (self.backend_string!="sqlite3"):
# minetestmapper-numpy had trouble with leveldb but this fork has it fixed so use numpy always always instead of running the following line # minetestmapper-numpy had trouble with leveldb but this fork has it fixed so use numpy always always instead of running the following line
#self.minetestmapper_py_path = self.minetestmapper_custom_path #self.minetestmapper_py_path = self.minetestmapper_custom_path

0
colors.txt → colors (base).txt

69
colors-missing.txt

@ -189,3 +189,72 @@ seacoral:seacoraldirtredviolet
seaplants:seaplantssandseagrassred seaplants:seaplantssandseagrassred
meze:meze meze:meze
default:junglewood default:junglewood
4seasons:desertsand_winter
4seasons:grass_autumn
4seasons:grass_spring
4seasons:ice_flowing
4seasons:ice_source
4seasons:leaves_autumn
4seasons:leaves_spring
4seasons:sand_winter
bedrock:bedrock
bedrock:glass
beer:beer_grape
beer:beer_hops
bitchange:mineninth_in_ground
default:apple
default:cactus
default:clay
default:desert_sand
default:desert_stone
default:dirt
default:dirt_with_grass
default:dry_shrub
default:grass_1
default:grass_2
default:grass_3
default:grass_4
default:grass_5
default:gravel
default:lava_flowing
default:lava_source
default:leaves
default:nyancat
default:nyancat_rainbow
default:papyrus
default:sand
default:stone
default:stone_with_coal
default:stone_with_copper
default:stone_with_gold
default:stone_with_iron
default:stone_with_mese
default:tree
default:water_flowing
default:water_source
farming:pumpkin
farming_plus:banana
farming_plus:banana_leaves
farming_plus:carrot
farming_plus:cocoa
farming_plus:cocoa_leaves
farming_plus:orange
farming_plus:potato
farming_plus:rhubarb
farming_plus:strawberry
farming_plus:tomato
fire_flowers:fireflower
flowers:dandelion_white
flowers:dandelion_yellow
flowers:geranium
flowers:rose
flowers:tulip
flowers:viola
gloopblocks:stone_mossy
glow:shrooms
glow:stone_with_worms
glowblocks:glowblockwhite_on
moreblocks:super_glow_glass
nature:blossom
smooth:dirt_stone
trail:dirt_with_grass_walked

5
colors/fragments.txt

@ -0,0 +1,5 @@
Author,URL,AccessDate
dip,https://forum.minetest.net/viewtopic.php?pid=40414,2016-03-22
ng.emerge,https://forum.minetest.net/viewtopic.php?pid=40414,2016-03-22
Neon,https://forum.minetest.net/viewtopic.php?pid=40414,2016-03-22
paramat,https://forum.minetest.net/viewtopic.php?pid=40414,2016-03-22

9
colors/fragments/Neon (Ethereal, partial).txt

@ -0,0 +1,9 @@
ethereal:frost_leaves 170 75 170
ethereal:frost_tree 86 58 31
ethereal:mushroom_trunk 170 170 170
ethereal:mushroom 170 50 25
ethereal:crystal_topped_dirt 25 75 170
ethereal:mushroom_dirt 170 75 170
ethereal:fiery_dirt_top 170 50 25
ethereal:gray_dirt_top 170 170 170
ethereal:green_dirt_top 107 134 51

22
colors/fragments/dip.txt

@ -0,0 +1,22 @@
nature:blossom 79 100 68
flowers:flower_cotton 145 165 127
flowers:flower_dandelion_white 161 174 149
flowers:flower_rose 153 9 0
flowers:flower_tulip 175 114 0
flowers:flower_viola 84 90 64
flowers:flower_dandelion_yellow 144 138 0
flowers:flower_geranium 75 101 84
flowers:flower_waterlily 119 166 100
flowers:flower_seaweed 48 114 107
default:sapling 71 64 41
teleporter:teleporter_pad 248 231 153
bushes:strawberry_bush 23 75 17
fire:basic_flame 76 9 0
craft_guide:lcd_pc 64 64 64
craft_guide:sign_wall 212 212 212

8
colors/fragments/ng.emerge.txt

@ -0,0 +1,8 @@
default:furnace_active 238 127 10
moreblocks:slab_circlestonebrick_wall 84 82 81
homedecor:torch_wall 255 165 8
mesecons_pistons:piston_normal_on 132 110 81
homedecor:glass_table_small_round_b 195 195 195
doors:door_steel_t_2 172 172 172
doors:door_steel_b_2 172 172 172
homedecor:glowlight_quarter_yellow 255 255 113

149
colors/fragments/paramat.txt

@ -0,0 +1,149 @@
snow:trunk 234 207 156
snow:needles 47 80 41
snow:sapling_pine 95 255 0
snow:ice 155 155 255
snow:snow 221 223 255
snow:dirt_with_snow 221 223 255
snow:snow_block 221 223 255
paragen:permafrost 181 144 107
paragen:dirt 181 144 107
paragen:desertstone 105 56 43
paragen:needles 47 80 41
paragen:jungleleaf 119 132 50
paragen:cactus 95 255 0
paragen:grass 27 35 25
paragen:swampwater 48 108 48
paragen:swampwaterflow 48 108 48
paragen:stone 97 93 92
paragen:sand 218 180 106
paragen:luxblock 255 218 90
paragen:goldengrass 188 160 0
paragen:drygrass 147 119 71
paragen:activelayer 147 119 71
paragen:water 11 53 115
paragen:waterflow 11 53 115
paragen:snow 221 223 255
paragenv7:dirt 181 144 107
paragenv7:permafrost 181 144 107
paragenv7:acacialeaf 47 80 41
paragenv7:needles 47 80 41
paragenv7:jungleleaf 119 132 50
paragenv7:ssapling 95 255 0
paragenv7:psapling 95 255 0
paragenv7:cactus 95 255 0
paragenv7:grass 27 35 25
paragenv7:goldengrass 188 160 0
paragenv7:drygrass 147 119 71
flexrealm:perfrost 181 144 107
flexrealm:dirt 181 144 107
flexrealm:destone 105 56 43
flexrealm:needles 47 80 41
flexrealm:junleaf 119 132 50
flexrealm:grass 27 35 25
flexrealm:swatzero 48 108 48
flexrealm:swatfour 48 108 48
flexrealm:swatflow 48 108 48
flexrealm:stone 97 93 92
flexrealm:sand 218 180 106
flexrealm:desand 227 138 73
flexrealm:drygrass 147 119 71
flexrealm:frograss 87 76 45
flexrealm:watzero 11 53 115
flexrealm:watfour 11 53 115
flexrealm:watflow 11 53 115
flexrealm:cloud 227 233 240
watershed:dirt 181 144 107
watershed:redstone 105 56 43
watershed:needles 47 80 41
watershed:jungleleaf 119 132 50
watershed:stone 97 93 92
watershed:grass 27 35 25
watershed:water 11 53 115
watershed:waterflow 11 53 115
moonrealm:stone 97 93 92
moonrealm:dust 132 132 132
moonrealm:luxore 255 255 0
moonrealm:luxnode 255 255 0
moonrealm:waterice 155 155 255
asteroid:snowblock 221 223 255
asteroid:waterice 155 155 255
asteroid:stone 97 93 92
asteroid:cobble 116 112 111
asteroid:gravel 137 125 112
asteroid:dust 132 132 132
trail:dirt_walked 181 144 107
trail:dirt_with_grass_walked 255 0 0
trail:desert_sand_walked 255 0 0
trail:snow_walked 255 0 0
trail:snow_block_walked 255 0 0
trail:sand_walked 255 0 0
conifers:trunk 234 207 156
conifers:trunk_reversed 234 207 156
conifers:leaves 47 80 41
conifers:leaves_special 47 80 41
conifers:sapling 95 255 0
volcano:magma_source 255 51 0
volcano:magma_slow 255 51 0
volcano:magma_flowing 255 51 0
volcano:ash 132 132 132
slabrealm:redstone 105 56 43
slabrealm:jleaf 47 80 41
slabrealm:needles 47 80 41
slabrealm:jsapling 95 255 0
slabrealm:psapling 95 255 0
slabrealm:grassslab 27 35 25
slabrealm:stone 97 93 92
slabrealm:slith 204 204 204
slabrealm:desertsandslab 227 138 73
slabrealm:sandslab 218 180 106
slabrealm:snowslab 221 223 255
slabrealm:snowblock 221 223 255
slabrealm:ice 155 155 255
slabrealm:cloud 227 233 240
landup:destone 105 56 43
landup:stone 97 93 92
landup:grass 27 35 25
floatindev:desertstone 105 56 43
floatindev:stone 97 93 92
jungletree:leaves_green 47 80 41
jungletree:leaves_red 47 80 41
jungletree:leaves_yellow 47 80 41
jungletree:sapling 95 255 0
slabworld:slabstone 97 93 92
slabworld:slith 204 204 204
slabworld:cslith 204 204 204
slabworld:cslithslab 204 204 204
slabworld:cslithstair 204 204 204
slabworld:lighton 255 218 90
slabworld:light 255 218 90
slabworld:slabcloud 227 233 240
slabworld:redslabstone 105 56 43
vrealm:sand 218 180 106
vrealm:grass 27 35 25
vrealm:desert_sand 227 138 73
moonlet:lighton 255 218 90
moonlet:light 255 218 90
moonlet:omsand 227 138 73
moonlet:omstone 206 113 68
flolands:floatstone 66 72 97
flolands:floatsand 106 218 196
noise23:flosand 106 218 196
noise23:stone 97 93 92

3
colors/repos.txt

@ -0,0 +1,3 @@
Author,URL,AccessDate
sfan5,https://raw.githubusercontent.com/sfan5/minetest-mapper-cpp/master/colors.txt,2016-03-22
VenesseE,http://digitalaudioconcepts.com/vanessa/hobbies/minetest/colors.txt,2016-03-22

15368
colors/repos/VenessaE.txt

File diff suppressed because it is too large

2019
colors/repos/sfan5.txt

File diff suppressed because it is too large

21
expertmm.py

@ -27,6 +27,7 @@ alnum_chars = alpha_chars+digit_chars
identifier_chars = alnum_chars+"_" identifier_chars = alnum_chars+"_"
identifier_and_dot_chars = identifier_chars+"." identifier_and_dot_chars = identifier_chars+"."
min_indent = "" min_indent = ""
dict_entries_modified_count = 0
class InstalledFile: class InstalledFile:
source_dir_path = None source_dir_path = None
@ -158,9 +159,9 @@ def vec2_not_in(this_vec, this_list):
def ivec2_equals(pos1, pos2): def ivec2_equals(pos1, pos2):
return (int(pos1[0])==int(pos2[0])) and (int(pos1[1])==int(pos2[1])) return (int(pos1[0])==int(pos2[0])) and (int(pos1[1])==int(pos2[1]))
def get_dict_from_conf_file(path,assignment_operator="="): def get_dict_from_conf_file(path,assignment_operator="=",comment_delimiter="#",inline_comments_enable=False):
results = None results = None
results = get_dict_modified_by_conf_file(results, path, assignment_operator) results = get_dict_modified_by_conf_file(results, path, assignment_operator, comment_delimiter=comment_delimiter, inline_comments_enable=inline_comments_enable)
return results return results
def RepresentsInt(s): def RepresentsInt(s):
@ -216,7 +217,20 @@ def print_file(path, min_indent=""):
pass pass
return line_count return line_count
def singular_or_plural(singular, plural, count):
result = plural
if count==1:
result = singular
return str(count)+" "+result
def get_dict_entries_modified_count():
return dict_entries_modified_count
def get_dict_modified_by_conf_file(this_dict, path, assignment_operator="=", comment_delimiter="#", inline_comments_enable=False): def get_dict_modified_by_conf_file(this_dict, path, assignment_operator="=", comment_delimiter="#", inline_comments_enable=False):
global dict_entries_modified_count
dict_entries_modified_count = 0
results = this_dict results = this_dict
#print ("Checking "+str(path)+" for settings...") #print ("Checking "+str(path)+" for settings...")
if (results is None) or (type(results) is not dict): if (results is None) or (type(results) is not dict):
@ -249,6 +263,9 @@ def get_dict_modified_by_conf_file(this_dict, path, assignment_operator="=", com
elif RepresentsFloat(result_value): elif RepresentsFloat(result_value):
result_value = float(result_value) result_value = float(result_value)
#print (" CHECKING... "+result_name+":"+result_value) #print (" CHECKING... "+result_name+":"+result_value)
if (result_name not in results) or (results[result_name]!=result_value):
dict_entries_modified_count += 1
#print(str(dict_entries_modified_count))
results[result_name]=result_value results[result_name]=result_value
ins.close() ins.close()
return results return results

92
minetestinfo.py

@ -38,6 +38,18 @@ after_broken["default:stone_with_mese"] = "default:mese_crystal"
after_broken["moreores:mineral_silver"] = "moreores:silver_lump" after_broken["moreores:mineral_silver"] = "moreores:silver_lump"
after_broken["default:stone_with_gold"] = "default:gold_lump" after_broken["default:stone_with_gold"] = "default:gold_lump"
after_broken["default:stone_with_diamond"] = "default:diamond" after_broken["default:stone_with_diamond"] = "default:diamond"
#NOTE: this stuff could be scraped from lua such as /usr/local/share/minetest/games/fca_game_a/mods/technic/technic_worldgen/nodes.lua
after_broken["technic:mineral_uranium"] = "technic:uranium_lump"
after_broken["technic:mineral_chromium"] = "technic:chromium_lump"
after_broken["technic:mineral_zinc"] = "technic:zinc_lump"
after_broken["technic:mineral_lead"] = "technic:lead_lump"
after_broken["technic:mineral_sulfur"] = "technic:sulfur_lump"
after_broken["caverealms:hanging_thin_ice"] = "caverealms:thin_ice"
after_broken["caverealms:stone_with_moss"] = "default:cobble"
after_broken["caverealms:stone_with_lichen"] = "default:cobble"
after_broken["caverealms:stone_with_algae"] = "default:cobble"
after_broken["caverealms:constant_flame"] = "Empty"
#after_broken[""] = ""
#after_broken[""] = "" #after_broken[""] = ""
#after_broken[""] = "" #after_broken[""] = ""
#after_broken[""] = "" #after_broken[""] = ""
@ -50,6 +62,8 @@ after_broken_startswith["pipeworks:conductor_tube_off_"] = "pipeworks:conductor_
after_broken_startswith["pipeworks:tube_"] = "pipeworks:tube_1" after_broken_startswith["pipeworks:tube_"] = "pipeworks:tube_1"
after_broken_startswith["Item pipeworks:accelerator_tube_"] = "pipeworks:accelerator_tube_1" after_broken_startswith["Item pipeworks:accelerator_tube_"] = "pipeworks:accelerator_tube_1"
#TODO: crafts (scrape list of ingredients to remove from inventory)
genresult_name_closer_string = "_mapper_result.txt" genresult_name_closer_string = "_mapper_result.txt"
loaded_mod_list = list() loaded_mod_list = list()
@ -264,6 +278,7 @@ def get_game_path_from_gameid(gameid):
def init_minetestinfo(): def init_minetestinfo():
global dict_entries_modified_count
if not minetestinfo.contains("www_minetest_path"): if not minetestinfo.contains("www_minetest_path"):
default_www_minetest_path = "/var/www/html/minetest" default_www_minetest_path = "/var/www/html/minetest"
if os_name=="windows": if os_name=="windows":
@ -327,7 +342,82 @@ def init_minetestinfo():
else: else:
break break
load_world_and_mod_data() load_world_and_mod_data()
print("")
lib_path = os.path.join(profile_path, "minetest")
util_path = os.path.join(lib_path, "util")
base_colors_txt = os.path.join(util_path, "colors.txt")
if not os.path.isfile(base_colors_txt):
base_colors_txt = os.path.join(os.path.dirname(os.path.abspath(__file__)), "colors (base).txt")
colors_folder_path = os.path.join( os.path.dirname(os.path.abspath(__file__)), "colors")
colors_repos_folder_path = os.path.join(colors_folder_path, "repos")
colors_fragments_folder_path = os.path.join(colors_folder_path, "fragments")
head_colors_txt = os.path.join( colors_repos_folder_path, "VenessaE.txt")
dest_colors_txt = os.path.join( os.path.dirname(os.path.abspath(__file__)), "colors.txt")
if not os.path.isfile(dest_colors_txt):
print("")
print("Generating colors ("+dest_colors_txt+")...")
base_colors = get_dict_from_conf_file(base_colors_txt,assignment_operator=" ",inline_comments_enable=True)
merged_colors = get_dict_deepcopy(base_colors)
print("")
print(base_colors_txt+" has "+str(len(merged_colors))+" color(s)")
if os.path.isfile(head_colors_txt):
head_colors = get_dict_from_conf_file(head_colors_txt,assignment_operator=" ", inline_comments_enable=True)
print(os.path.basename(head_colors_txt)+" has "+str(len(head_colors))+" color(s)")
#merged_colors = get_dict_modified_by_conf_file(merged_colors, head_colors_txt,assignment_operator=" ", inline_comments_enable=True)
entries_changed_count = 0
entries_new_count = 0
for this_key in head_colors:
if this_key not in merged_colors:
merged_colors[this_key] = head_colors[this_key]
entries_new_count += 1
elif merged_colors[this_key] != head_colors[this_key]:
merged_colors[this_key] = head_colors[this_key]
entries_changed_count += 1
print(" "+singular_or_plural("entry","entries",entries_new_count+entries_changed_count) + " ("+str(entries_new_count)+" new, "+str(entries_changed_count)+" changed) merged from "+os.path.basename(head_colors_txt))
else:
print("Missing '"+head_colors_txt+"'")
this_name = "sfan5.txt"
show_max_count = 7
this_path = os.path.join(colors_repos_folder_path, this_name)
append_colors = get_dict_from_conf_file(this_path,assignment_operator=" ",inline_comments_enable=True)
if os.path.isfile(this_path):
appended_count = 0
print("")
print("Reading "+this_path+"...")
for this_key in append_colors.keys():
if this_key not in merged_colors:
merged_colors[this_key] = append_colors[this_key]
if appended_count<show_max_count:
print(" "+this_key+" "+merged_colors[this_key])
elif appended_count==show_max_count:
print(" ...")
appended_count += 1
print(" "+singular_or_plural("entry","entries",appended_count)+" appended from "+this_name)
else:
print("Missing "+this_path)
folder_path = colors_fragments_folder_path
if os.path.isdir(folder_path):
for sub_name in os.listdir(folder_path):
sub_path = os.path.join(folder_path, sub_name)
if sub_name[:1]!="." and os.path.isfile(sub_path):
print("")
print("Reading "+sub_path+"...")
appended_count = 0
append_colors = get_dict_from_conf_file(sub_path, assignment_operator=" ",inline_comments_enable=True)
for this_key in append_colors.keys():
if this_key not in merged_colors:
merged_colors[this_key] = append_colors[this_key]
if appended_count<show_max_count:
print(" "+this_key+" "+merged_colors[this_key])
elif appended_count==show_max_count:
print(" ...")
appended_count += 1
print(" "+singular_or_plural("entry","entries",appended_count)+" appended from "+sub_name)
save_conf_from_dict(dest_colors_txt, merged_colors, assignment_operator=" ")
else:
print("Using colors "+dest_colors_txt)
def load_world_and_mod_data(): def load_world_and_mod_data():
#if games_path = #if games_path =

4
minetestmapper-numpy.py

@ -472,15 +472,15 @@ class LVLDB:
val = k[0] val = k[0]
#if k[0][:2]=="\\x": #if k[0][:2]=="\\x":
#in leveldb, minetest stores \x before every byte of the value, so remove all and prepend 0x so python can convert to int #in leveldb, minetest stores \x before every byte of the value, so remove all and prepend 0x so python can convert to int
#but this doesn't work (resulting val still throws exception)
#val = "\\0x" + k[0].replace("\\x", "") #val = "\\0x" + k[0].replace("\\x", "")
x, y, z = getIntegerAsBlock(int(val)) x, y, z = getIntegerAsBlock(int(val))
yield x, y, z, k[0] yield x, y, z, val
except: except:
pass pass
#print("Could not finish getting int from first index of value "+str(k)) #print("Could not finish getting int from first index of value "+str(k))
#SOMETIMES prints tons of output such as Could not finish getting int from first index of value ('\x00\x00\x00\x0e\x00\x02\x85 ', '\x19\x08\x02\x02x\x9c\xed\xc11\x01\x00\x00\x00\xc2\xa0\xf5Om\x0c\x1f\xa0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\xb7\x01@\x00\x00\x01x\x9cc\x00\x00\x00\x01\x00\x01\x00\x00\x00\xff\xff\xff\xff\x00\x00\x01\x00\x00\x00\x06ignore\n\x00\x00') #SOMETIMES prints tons of output such as Could not finish getting int from first index of value ('\x00\x00\x00\x0e\x00\x02\x85 ', '\x19\x08\x02\x02x\x9c\xed\xc11\x01\x00\x00\x00\xc2\xa0\xf5Om\x0c\x1f\xa0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\xb7\x01@\x00\x00\x01x\x9cc\x00\x00\x00\x01\x00\x01\x00\x00\x00\xff\xff\xff\xff\x00\x00\x01\x00\x00\x00\x06ignore\n\x00\x00')
def get(self, pos): def get(self, pos):
return BytesIO(self.conn.Get(pos)) return BytesIO(self.conn.Get(pos))

10
minetestoffline.py

@ -22,6 +22,9 @@ min_date_string = None
#min_date_string = "2016-03-15 12:12:00" #min_date_string = "2016-03-15 12:12:00"
DEBUG_TXT_TIME_FORMAT_STRING="%Y-%m-%d %H:%M:%S" DEBUG_TXT_TIME_FORMAT_STRING="%Y-%m-%d %H:%M:%S"
is_start_now = False is_start_now = False
def confirm_min_date():
global min_date_string
while min_date_string is None: while min_date_string is None:
default_min_date_string = datetime.strftime(datetime.now(), DEBUG_TXT_TIME_FORMAT_STRING) default_min_date_string = datetime.strftime(datetime.now(), DEBUG_TXT_TIME_FORMAT_STRING)
print("") print("")
@ -43,6 +46,8 @@ print("Using start "+min_date_string)
if is_start_now: if is_start_now:
print(" (which is the current time, so nothing will be replayed [this is the default just be extra careful, because if you run the replay function on the same part of the log more than once, that will double #of each item each player digs and double the quantity of those items in players offline storage folder])") print(" (which is the current time, so nothing will be replayed [this is the default just be extra careful, because if you run the replay function on the same part of the log more than once, that will double #of each item each player digs and double the quantity of those items in players offline storage folder])")
print("") print("")
players_offline_storage_name = "players_offline_storage" players_offline_storage_name = "players_offline_storage"
deprecated_players_offline_storage_name = "player_storage" deprecated_players_offline_storage_name = "player_storage"
#H:\Minetest\player_storage #H:\Minetest\player_storage
@ -190,6 +195,7 @@ class MinetestInventory:
self.items = list() # IS allowed to have duplicate names self.items = list() # IS allowed to have duplicate names
def push_item(self, item_id, qty): def push_item(self, item_id, qty):
if item_id!="Empty":
for index in range(0,len(self.items)): for index in range(0,len(self.items)):
if self.items[index].name==item_id: if self.items[index].name==item_id:
qty = self.items[index].push_qty(qty) qty = self.items[index].push_qty(qty)
@ -205,6 +211,8 @@ class MinetestInventory:
qty = self.items[index].push_qty(qty) qty = self.items[index].push_qty(qty)
if qty==0: if qty==0:
break break
else:
qty = 0
return qty return qty
def write_to_stream(self, outs): def write_to_stream(self, outs):
@ -264,6 +272,7 @@ class MinetestPlayer:
for index in range(0,len(self.inventories)): for index in range(0,len(self.inventories)):
if self.inventories[index].name=="craft": if self.inventories[index].name=="craft":
qty = self.inventories[index].push_item(item_id, qty) qty = self.inventories[index].push_item(item_id, qty)
#break even if nonzero, since only have this one inventory left (no bag guaranteed)
break break
return qty return qty
@ -659,6 +668,7 @@ def player_inventory_transfer(from_playerid, to_playerid):
#"C:\Users\jgustafson\Desktop\Backup\fcalocal\home\owner\.minetest\debug_archived\2016\03\" #"C:\Users\jgustafson\Desktop\Backup\fcalocal\home\owner\.minetest\debug_archived\2016\03\"
##debug_log_replay_to_offline_player_storage("C:\\Users\\jgustafson\\Desktop\\Backup\\fcalocal\\home\\owner\\.minetest\\debug.txt", players_offline_storage_path, min_date_string) ##debug_log_replay_to_offline_player_storage("C:\\Users\\jgustafson\\Desktop\\Backup\\fcalocal\\home\\owner\\.minetest\\debug.txt", players_offline_storage_path, min_date_string)
#confirm_min_date()
##for debug_path in debugs_list: ##for debug_path in debugs_list:
## debug_log_replay_to_offline_player_storage(debug_path, players_offline_storage_path, min_date_string) ## debug_log_replay_to_offline_player_storage(debug_path, players_offline_storage_path, min_date_string)
#debug_log_replay_to_offline_player_storage(debug_txt_path, players_offline_storage_path, min_date_string) #debug_log_replay_to_offline_player_storage(debug_txt_path, players_offline_storage_path, min_date_string)

6
singleimage.py

@ -8,7 +8,7 @@ from PIL import Image
class ChunkymapOfflineRenderer: class ChunkymapOfflineRenderer:
minetestmapper_fast_sqlite_path = None minetestmapper_numpy_path = None
minetestmapper_custom_path = None minetestmapper_custom_path = None
minetestmapper_py_path = None minetestmapper_py_path = None
backend_string = None backend_string = None
@ -20,9 +20,9 @@ class ChunkymapOfflineRenderer:
self.backend_string = get_world_var("backend") self.backend_string = get_world_var("backend")
#region the following is also in singleimage.py #region the following is also in singleimage.py
self.minetestmapper_fast_sqlite_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "minetestmapper-numpy.py") self.minetestmapper_numpy_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "minetestmapper-numpy.py")
self.minetestmapper_custom_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "minetestmapper-expertmm.py") self.minetestmapper_custom_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "minetestmapper-expertmm.py")
self.minetestmapper_py_path = self.minetestmapper_fast_sqlite_path self.minetestmapper_py_path = self.minetestmapper_numpy_path
#if (self.backend_string!="sqlite3"): #if (self.backend_string!="sqlite3"):
# minetestmapper-numpy had trouble with leveldb but this fork has it fixed so use numpy always always instead of running the following line # minetestmapper-numpy had trouble with leveldb but this fork has it fixed so use numpy always always instead of running the following line
# self.minetestmapper_py_path = self.minetestmapper_custom_path # self.minetestmapper_py_path = self.minetestmapper_custom_path

22
web/chunkymap.php

@ -361,9 +361,9 @@ function get_markers_from_dir($chunkymap_markers_path) {
} }
//chunk_mode_enable: shows chunk png images instead of decachunk jpg images (slower) //chunks_enable: shows chunk png images instead of decachunk jpg images (slower)
//visual_debug_enable: draws colored rectangles based on yml files instead of drawing images //visual_debug_enable: draws colored rectangles based on yml files instead of drawing images
function echo_chunkymap_canvas($show_player_names_enable, $chunk_mode_enable, $visual_debug_enable, $html4_mode_enable) { function echo_chunkymap_canvas($show_player_names_enable, $decachunks_enable, $chunks_enable, $visual_debug_enable, $html4_mode_enable) {
global $x; global $x;
global $z; global $z;
global $zoom; global $zoom;
@ -385,14 +385,14 @@ function echo_chunkymap_canvas($show_player_names_enable, $chunk_mode_enable, $v
$tile_w = 160; $tile_w = 160;
$tile_h = 160; $tile_h = 160;
if (isset($chunk_mode_enable) and ($chunk_mode_enable===true)) { if (isset($chunks_enable) and ($chunks_enable===true)) {
$tile_w = 16; $tile_w = 16;
$tile_h = 16; $tile_h = 16;
$chunks_per_tile_x_count = 1; $chunks_per_tile_x_count = 1;
$chunks_per_tile_z_count = 1; $chunks_per_tile_z_count = 1;
} }
else { else {
$chunk_mode_enable=false; $chunks_enable=false;
} }
$locations_per_tile_x_count = $chunks_per_tile_x_count*16; $locations_per_tile_x_count = $chunks_per_tile_x_count*16;
@ -617,7 +617,7 @@ function echo_chunkymap_canvas($show_player_names_enable, $chunk_mode_enable, $v
var chunkymap_view_max_zoom='.$chunkymap_view_max_zoom.'; var chunkymap_view_max_zoom='.$chunkymap_view_max_zoom.';
var chunkymap_view_min_zoom='.$chunkymap_view_min_zoom.'; var chunkymap_view_min_zoom='.$chunkymap_view_min_zoom.';
var chunkymap_zoom_delta='.$chunkymap_change_zoom_multiplier.'; var chunkymap_zoom_delta='.$chunkymap_change_zoom_multiplier.';
var chunk_mode_enable='.get_javascript_bool_value($chunk_mode_enable).'; var chunks_enable='.get_javascript_bool_value($chunks_enable).';
var visual_debug_enable='.get_javascript_bool_value($visual_debug_enable).'; var visual_debug_enable='.get_javascript_bool_value($visual_debug_enable).';
var chunks_per_tile_x_count='.$chunks_per_tile_x_count.'; var chunks_per_tile_x_count='.$chunks_per_tile_x_count.';
var chunks_per_tile_z_count='.$chunks_per_tile_z_count.'; var chunks_per_tile_z_count='.$chunks_per_tile_z_count.';
@ -1250,7 +1250,7 @@ function echo_chunkymap_canvas($show_player_names_enable, $chunk_mode_enable, $v
global $td_decachunk_placeholder_content; global $td_decachunk_placeholder_content;
global $td_chunk_placeholder_content; global $td_chunk_placeholder_content;
$td_tile_placeholder_content = null; $td_tile_placeholder_content = null;
if ($chunk_mode_enable) { if ($chunks_enable) {
$td_tile_placeholder_content = $td_chunk_placeholder_content; $td_tile_placeholder_content = $td_chunk_placeholder_content;
} }
else { else {
@ -1393,6 +1393,7 @@ function echo_chunkymap_canvas($show_player_names_enable, $chunk_mode_enable, $v
echo '<img id="zoom_out" src="chunkymapdata/images/zoom_out.png"/>'; echo '<img id="zoom_out" src="chunkymapdata/images/zoom_out.png"/>';
echo '<img id="zoom_out_disabled" src="chunkymapdata/images/zoom_out_disabled.png"/>'; echo '<img id="zoom_out_disabled" src="chunkymapdata/images/zoom_out_disabled.png"/>';
$this_tiley_z=$max_tiley_z; //start at max since screen is inverted cartesian $this_tiley_z=$max_tiley_z; //start at max since screen is inverted cartesian
if (($decachunks_enable==true) or ($chunks_enable==true)) {
if ($visual_debug_enable!==true) { if ($visual_debug_enable!==true) {
//this table loads the images then is hidden when javascript runs successfully, but it is also a map though not very functional //this table loads the images then is hidden when javascript runs successfully, but it is also a map though not very functional
if ($html4_mode_enable===true) { if ($html4_mode_enable===true) {
@ -1417,7 +1418,7 @@ function echo_chunkymap_canvas($show_player_names_enable, $chunk_mode_enable, $v
while ($this_tiley_x<=$max_tiley_x) { while ($this_tiley_x<=$max_tiley_x) {
$img_path=null; $img_path=null;
echo " <td>"; echo " <td>";
if ($chunk_mode_enable) { if ($chunks_enable) {
$img_path=get_chunk_image_path_from_chunky_coords($this_tiley_x, $this_tiley_z); $img_path=get_chunk_image_path_from_chunky_coords($this_tiley_x, $this_tiley_z);
if (!is_file($img_path)) { if (!is_file($img_path)) {
echo "<!-- no chunk $img_path -->"; echo "<!-- no chunk $img_path -->";
@ -1448,6 +1449,13 @@ function echo_chunkymap_canvas($show_player_names_enable, $chunk_mode_enable, $v
echo ' </tr>'."\r\n"; echo ' </tr>'."\r\n";
echo '</table>'."\r\n"; echo '</table>'."\r\n";
} }
}
else {
if ($html4_mode_enable===true) {
//else see above for singleimage (if singleimage doesn't exist, this should run though)
//echo 'There is nothing to do for html4_mode_enable since neither chunks nor decachunks were enabled (singleimage html4 is not yet implemented).';
}
}
if ($html4_mode_enable===true) { if ($html4_mode_enable===true) {
echo '<center><small>Powered by <a href="https://github.com/expertmm/minetest-chunkymap">Chunkymap</a></small></center>'; echo '<center><small>Powered by <a href="https://github.com/expertmm/minetest-chunkymap">Chunkymap</a></small></center>';
} }

5
web/viewchunkymap.php

@ -38,10 +38,11 @@ if (is_file('chunkymap.php')) {
//echo "</center>"; //echo "</center>";
set_chunkymap_view($x,$z,$zoom); set_chunkymap_view($x,$z,$zoom);
//echo "<table><tr><td style=\"text-align:left\">"; //echo "<table><tr><td style=\"text-align:left\">";
$chunk_mode_enable=true; //(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.);
$decachunks_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)
$show_player_names_enable=true; $show_player_names_enable=true;
echo_chunkymap_canvas($show_player_names_enable,$chunk_mode_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();
//echo "</td></tr></table>"; //echo "</td></tr></table>";

Loading…
Cancel
Save