12/21 modernizations from TG live (#103)

* sync (#3)

* shuttle auto call

* Merge /vore into /master (#39)

* progress

* Compile errors fixed

No idea if it's test worthy tho as conflicts with race overhaul and
narky removal.

* Update admins.txt

* efforts continue

Fuck grab code, seriously

* grab code is cancer

* Execute the Narkism

Do not hesitate.

Show no mercy.

* holy shit grab code is awful

* have I bitched about grab code

My bitching, let me show you it

* código de agarre es una mierda

No really it is

* yeah I don't even know anymore.

* Lolnope. Fuck grab code

* I'm not even sure what to fix anymore

* Self eating is not an acceptable fate

* Taste the void, son.

* My code doesn't pass it's own sanity check.

Maybe it's a sign of things to come.

* uncommented and notes

* It Works and I Don't Know Why (#38)

* shuttle auto call

* it works and I don't know why

* Subsystem 12/21

Most Recent TG subsystem folder

* globalvars 12/21

Tossed out the flavor_misc and parallax files

* Onclick 12/21

as well as .dme updates

* _defines 12/21

ommited old _MC.dm

* _HELPERS 12/21

Preserved snowflake placement of furry sprites

* _defeines/genetics

reapplied narkism holdover for snowflake races.

* Oops forgot mutant colors

* modules porting 12/21 + Sounds/icons

Admin, Client and most of mob life files ommitted

* enviroment file

* Admin optimizations

ahelp log system kept

* Mob ports 12/21

Flavor text preserved

* datums ported 12/21

* Game ported 12/21

* batch of duplicate fixes/dogborg work

Dogborgs need to be modernized to refractored borg standards.

* moar fixes

* Maps and futher compile fixes
This commit is contained in:
Poojawa
2016-12-22 03:57:55 -06:00
committed by GitHub
parent f5e143a452
commit cf59ac1c3d
2215 changed files with 707445 additions and 87041 deletions
+37
View File
@@ -0,0 +1,37 @@
#Map Merger#
Before any change to a map, it is good to use the Map Merger tools. In a nutshell, it rewrites the map to minimize differences between different versions of the map (DreamMakers map editor rewrites a lot of the tile keys). This makes the git diff between different map changes much smaller. More recently a new way of laying out the map was invented by Remie, called TGM, this helps to further reduce conflicts in the map files.
This is good for a few reasons
1) Maintainers can actually verify the changes you are making are what you say they are by simply viewing the diff (For small changes at least)
2) The less changes there are in any given map diff, the easier it is for git to merge it without running into unexpected conflicts, which in most cases you have to either manually resolve or require you to remap your changes
However - to do all this is going to require you to put some elbow grease into understanding the map merger tool.
If you have difficulty using these tools, ask for help in #coderbus
#Using the tools#
##1. Install Python 3.5 or greater##
If you don't have Python already installed it can be downloaded from: https://www.python.org/downloads/ - make sure you grab the latest python 3, again, it must be 3.5 or greater
##2. PATH Python##
This step is mostly applicable to windows users, you must make sure you ask the windows installer to add python to your path, [like shown in this example screenshot](https://file.house/DA6H.png)
If you have already installed python you may need to manually add it to your path as indicated in [this guide](http://superuser.com/questions/143119/how-to-add-python-to-the-windows-path)
##3. Prepare Maps##
Run "Prepare Maps.bat" in the tools/mapmerge/ directory.
##4. Edit your map##
Make your changes to the map here. Remember to save them!
##5. Clean map##
Run "Run Map Merge - TGM.bat" in the tools/mapmerge/ directory.
##7. Check differences##
Use your git application of choice to look at the differences between revisions of your code and commit the result.
##8. Commit##
Your map is now ready to be committed, rejoice and wait for conflicts.
#Common pitfalls#
Open the map in dreameditor before committing the results of the mapmerger - this can cause dreameditor to resave the map back to
dmm, if you're having issues with your map getting stuck in dmm mode, try comitting and pushing the mapmerger changes before
reopening in dreameditor.
+45 -21
View File
@@ -1,5 +1,18 @@
import sys
try:
version = sys.version_info
if version.major < 3 or (version.major == 3 and version.minor < 5):
print("ERROR: You are running an incompatible version of Python. The current minimum version required is [3.5].\nYour version: {}".format(sys.version))
sys.exit()
except:
print("ERROR: Something went wrong, you might be running an incompatible version of Python. The current minimum version required is [3.5].\nYour version: {}".format(sys.version))
sys.exit()
import collections
error = {0:"OK", 1:"WARNING: Key lengths are different, all the lines change."}
maxx = 0
maxy = 0
key_length = 1
@@ -16,11 +29,21 @@ def merge_map(newfile, backupfile, tgm):
reset_globals()
shitmap = parse_map(newfile)
originalmap = parse_map(backupfile)
global key_length
if shitmap["key_length"] != originalmap["key_length"]:
if tgm:
write_dictionary_tgm(newfile, shitmap["dictionary"])
write_grid_coord_small(newfile, shitmap["grid"])
return 1
else:
key_length = originalmap["key_length"]
shitDict = shitmap["dictionary"] #key to tile data dictionary
shitGrid = shitmap["grid"] #x,y coords to tiles (keys) dictionary (the map's layout)
originalmap = parse_map(backupfile)
originalDict = originalmap["dictionary"]
originalDict = sort_dictionary(originalmap["dictionary"])
originalGrid = originalmap["grid"]
mergeGrid = dict() #final map layout
@@ -60,7 +83,7 @@ def merge_map(newfile, backupfile, tgm):
try:
unused_keys.remove(newKey)
except ValueError: #caused by a duplicate entry
print("WARNING: Correcting duplicate dictionary entry. ({})".format(shitKey))
print("NOTICE: Correcting duplicate dictionary entry. ({})".format(shitKey))
mergeGrid[x,y] = newKey
known_keys[shitKey] = newKey
#if data at original x,y no longer exists we reuse the key immediately
@@ -74,9 +97,6 @@ def merge_map(newfile, backupfile, tgm):
newKey = generate_new_key(originalDict)
else:
newKey = generate_new_key(tempDict)
if newKey == "OVERFLOW": #if this happens, merging is impossible
print("ERROR: Key overflow detected.")
return 0
tempGrid[x,y] = newKey
temp_keys[shitKey] = newKey
tempDict[newKey] = shitData
@@ -101,7 +121,6 @@ def merge_map(newfile, backupfile, tgm):
i += 1
sort = 1
#Recycle outdated keys with any new tile data, starting from the bottom of the dictionary
i = 0
for key, value in reversed(tempDict.items()):
@@ -120,15 +139,7 @@ def merge_map(newfile, backupfile, tgm):
#if gaps in the key sequence were found, sort the dictionary for cleanliness
if sort == 1:
sorted_dict = collections.OrderedDict()
next_key = get_next_key("")
while len(sorted_dict) < len(originalDict):
try:
sorted_dict[next_key] = originalDict[next_key]
except KeyError:
pass
next_key = get_next_key(next_key)
originalDict = sorted_dict
originalDict = sort_dictionary(originalDict)
if tgm:
write_dictionary_tgm(newfile, originalDict)
@@ -136,7 +147,7 @@ def merge_map(newfile, backupfile, tgm):
else:
write_dictionary(newfile, originalDict)
write_grid(newfile, mergeGrid)
return 1
return 0
#write dictionary in tgm format
def write_dictionary_tgm(filename, dictionary):
@@ -229,6 +240,17 @@ def get_next_key(key):
carry -= 1
return new_key[::-1]
def sort_dictionary(dictionary):
sorted_dict = collections.OrderedDict()
next_key = get_next_key("")
while len(sorted_dict) < len(dictionary):
try:
sorted_dict[next_key] = dictionary[next_key]
except KeyError:
pass
next_key = get_next_key(next_key)
return sorted_dict
#still does not support more than one z level per file, but should parse any format
def parse_map(map_file):
with open(map_file, "r") as map_input:
@@ -256,9 +278,10 @@ def parse_map(map_file):
curr_num = ""
reading_coord = "x"
global key_length
global maxx
global maxy
key_length_local = 0
curr_x = 0
curr_y = 0
curr_z = 1
@@ -343,7 +366,7 @@ def parse_map(map_file):
if in_key_block:
if char == "\"":
in_key_block = False
key_length = len(curr_key)
key_length_local = len(curr_key)
else:
curr_key = curr_key + char
continue
@@ -419,7 +442,7 @@ def parse_map(map_file):
curr_key = curr_key + char
if len(curr_key) == key_length:
if len(curr_key) == key_length_local:
iter_x += 1
if iter_x > 1:
curr_x += 1
@@ -444,6 +467,7 @@ def parse_map(map_file):
data = dict()
data["dictionary"] = dictionary
data["grid"] = grid
data["key_length"] = key_length_local
return data
#subtract keyB from keyA
+11 -6
View File
@@ -1,7 +1,7 @@
import map_helpers
import sys
import os
import pathlib
import map_helpers
import shutil
#main("../../_maps/")
@@ -47,7 +47,7 @@ def main(map_folder, tgm=0):
print("\nMerging these maps:")
for i in valid_indices:
print(str(list_of_files[i])[len(map_folder):])
merge = input("\nPress Enter to merge...")
merge = input("\nPress Enter to merge...\n")
if merge == "abort":
print("\nAborted map merge.")
sys.exit()
@@ -57,14 +57,19 @@ def main(map_folder, tgm=0):
shutil.copyfile(path_str, path_str + ".before")
path_str_pretty = path_str[len(map_folder):]
try:
if map_helpers.merge_map(path_str, path_str + ".backup", tgm) != 1:
print("ERROR MERGING: {}".format(path_str_pretty))
error = map_helpers.merge_map(path_str, path_str + ".backup", tgm)
if error > 1:
print(map_helpers.error[error])
os.remove(path_str + ".before")
continue
if error == 1:
print(map_helpers.error[1])
print("MERGED: {}".format(path_str_pretty))
print(" - ")
except FileNotFoundError:
print("\nERROR: File not found! Make sure you run 'Prepare Maps.bat' before merging.")
print(path_str_pretty + " || " + path_str_pretty + ".backup")
print("ERROR: File not found! Make sure you run 'Prepare Maps.bat' before merging.")
print("MISSING BACKUP FILE: " + path_str_pretty + ".backup")
print(" - ")
print("\nFinished merging.")
print("\nNOTICE: A version of the map files from before merging have been created for debug purposes.\nDo not delete these files until it is sure your map edits have no undesirable changes.")