diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000000..d7a9139e8ac --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +## Merger hooks, run tools/hooks/install.bat or install.sh to set up +*.dmm text eol=lf merge=dmm diff --git a/code/modules/mapping/merge_conflicts.dm b/code/modules/mapping/merge_conflicts.dm new file mode 100644 index 00000000000..bc6a647068b --- /dev/null +++ b/code/modules/mapping/merge_conflicts.dm @@ -0,0 +1,17 @@ +// Used by mapmerge2 to denote the existence of a merge conflict (or when it has to complete a "best intent" merge where it dumps the movable contents of an old key and a new key on the same tile). +// We define it explicitly here to ensure that it shows up on the highest possible plane (while giving off a verbose icon) to aide mappers in resolving these conflicts. +// DO NOT USE THIS IN NORMAL MAPPING!!! Linters WILL fail. + +/obj/merge_conflict_marker + name = "Merge Conflict Marker - DO NOT USE" + icon = 'icons/effects/mapping_helpers.dmi' + icon_state = "merge_conflict_marker" + desc = "If you are seeing this in-game: someone REALLY, REALLY, REALLY fucked up. Please make an issue report on GitHub or contact a coder as soon as possible." + plane = POINT_PLANE + +///We REALLY do not want un-addressed merge conflicts in maps for an inexhaustible list of reasons. This should help ensure that this will not be missed in case linters fail to catch it for any reason what-so-ever. +/obj/merge_conflict_marker/Initialize(mapload) + . = ..() + var/msg = "HEY, LISTEN!!! Merge Conflict Marker detected at [AREACOORD(src)]! Please manually address all potential merge conflicts!!!" + warning(msg) + to_chat(world, "[msg]") diff --git a/icons/effects/mapping_helpers.dmi b/icons/effects/mapping_helpers.dmi index b82578726a2..3959c8fd205 100644 Binary files a/icons/effects/mapping_helpers.dmi and b/icons/effects/mapping_helpers.dmi differ diff --git a/paradise.dme b/paradise.dme index 6551663ecc1..7acb9ca86f6 100644 --- a/paradise.dme +++ b/paradise.dme @@ -1782,6 +1782,7 @@ #include "code\modules\mapping\cyberiad.dm" #include "code\modules\mapping\delta.dm" #include "code\modules\mapping\mapping_helpers.dm" +#include "code\modules\mapping\merge_conflicts.dm" #include "code\modules\mapping\metastation.dm" #include "code\modules\mapping\test_tiny.dm" #include "code\modules\martial_arts\adminfu.dm" diff --git a/tools/ci/check_grep.sh b/tools/ci/check_grep.sh index aff249df8a1..b34715bc5c8 100755 --- a/tools/ci/check_grep.sh +++ b/tools/ci/check_grep.sh @@ -31,6 +31,15 @@ if grep -P '^/*var/' code/**/*.dm; then echo "ERROR: Unmanaged global var use detected in code, please use the helpers." st=1 fi; +# Check for merge conflict markers and their associated description text. +if grep -P 'Merge Conflict Marker' _maps/**/*.dmm; then + echo "ERROR: Merge conflict markers detected in map, please resolve all merge failures!" + st=1 +fi; +if grep -P '/obj/merge_conflict_marker' _maps/**/*.dmm; then + echo "ERROR: Merge conflict markers detected in map, please resolve all merge failures!" + st=1 +fi; nl=' ' nl=$'\n' diff --git a/tools/mapmerge2/merge_driver.py b/tools/mapmerge2/merge_driver.py index 440b90628a7..8daead9c165 100644 --- a/tools/mapmerge2/merge_driver.py +++ b/tools/mapmerge2/merge_driver.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 -import sys, collections +import sys +import collections from . import dmm, mapmerge from hooks.merge_frontend import MergeDriver @@ -74,9 +75,13 @@ def three_way_merge(base, left, right): print(f" C: Both sides touch the tile at {coord}") if merged_movables is None: - obj_name = "---Merge conflict marker---" - merged_movables = left_movables + [f'/obj{{name = "{obj_name}"}}'] + right_movables - print(f" Left and right movable groups are split by an `/obj` named \"{obj_name}\"") + # Note that if you do not have an object that matches this path in your DME, the invalid path may be discarded when the map is loaded into a map editor. + # To rectify this, either add an object with this same path, or create a new object/denote an existing object in the obj_path define. + obj_path = "/obj/merge_conflict_marker" + obj_name = "---Merge Conflict Marker---" + obj_desc = "A best-effort merge was performed. You must resolve this conflict yourself (manually) and remove this object once complete." + merged_movables = left_movables + [f'{obj_path}{{name = "{obj_name}";\n\tdesc = "{obj_desc}"}}'] + right_movables + print(f" Left and right movable groups are split by an `{obj_path}` named \"{obj_name}\"") if merged_turfs is None: merged_turfs = left_turfs print(f" Saving turf: {', '.join(left_turfs)}")