From dc6b4aba477e9009612c7f8b7422da35e1449d02 Mon Sep 17 00:00:00 2001 From: san7890 Date: Mon, 4 Jul 2022 23:29:44 -0600 Subject: [PATCH] Merge Conflict Markers - The Explicit Pathing, Layering, Iconing, Warning. (#68039) * Merge Conflict Markers - The Explicit Pathing Hey there, This PR corrects an issue I've been having with mapmerge2 these last few months. Basically, what it does is create a base `/obj` that is given the name `---Merge Conflict Marker---`. This is fine and all, but the problem is that the base `/obj` is set to a certain plane. This does mean that sometimes, this VERY IMPORTANT marker is covered up by rocks or other objects. So, this seeks to get rid of that potential flaw, as well as do some other things. Sometimes, when objects are rendered via GAGS or other code-means, they tend to have the same default Purple/White Sprite that any object without a valid icon_state has. This has caused me some confusion, so I have decided to create a new icon for conflict markers. This icon was designed to be as ugly as possible, while creating as much contrast as possible with the background by incorporating several colors into its design. I hope you find merge conflicts as unpleasant as I do. I also updated mapmerge2 to have it so you can set the specified path of the object, as well as a small comment on the warnings if you do not heed it. I'm keeping the fact that mapmerge2 adds a name to the object just in case someone else really needs that. I also updated the linters to check for this path as well (even though the name and description should suffice for linting), and it should all be gravy from here. * Adds further contrast to the DMI. * Splits the merge conflict marker into a generic /obj I also added a thing where if it didn't get caught by linters and it showed up on Initalize, it would error to mapping logs, spit out an error in world, and do all sorts of stuff to remind you. * python new line * forgot to add a tab --- code/modules/mapping/mapping_helpers.dm | 1 - code/modules/mapping/merge_conflicts.dm | 18 ++++++++++++++++++ icons/effects/mapping_helpers.dmi | Bin 23153 -> 23794 bytes tgstation.dme | 1 + tools/ci/check_grep.sh | 7 ++++++- tools/mapmerge2/merge_driver.py | 10 +++++++--- 6 files changed, 32 insertions(+), 5 deletions(-) create mode 100644 code/modules/mapping/merge_conflicts.dm diff --git a/code/modules/mapping/mapping_helpers.dm b/code/modules/mapping/mapping_helpers.dm index df38a2b258e..5f146b73f47 100644 --- a/code/modules/mapping/mapping_helpers.dm +++ b/code/modules/mapping/mapping_helpers.dm @@ -97,7 +97,6 @@ ..() return late ? INITIALIZE_HINT_LATELOAD : INITIALIZE_HINT_QDEL - //airlock helpers /obj/effect/mapping_helpers/airlock layer = DOOR_HELPER_LAYER diff --git a/code/modules/mapping/merge_conflicts.dm b/code/modules/mapping/merge_conflicts.dm new file mode 100644 index 00000000000..4a7ffb36f50 --- /dev/null +++ b/code/modules/mapping/merge_conflicts.dm @@ -0,0 +1,18 @@ +// 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. They physically mapped in a fucking Merge Conflict Marker. What the shit." + 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!!!" + log_mapping(msg) + to_chat(world, span_boldannounce("[msg]")) + warning(msg) diff --git a/icons/effects/mapping_helpers.dmi b/icons/effects/mapping_helpers.dmi index 7f65488aa9b641c09a7b2d8ab90a8f96939e119a..cec45916b682a5611e66b66ddcba18a7d4c94e29 100644 GIT binary patch delta 1997 zcmV;;2Qv8av;p$D0gxnr%6e2-bVOxyV{&P5bZKvH004NLm6lCz+%OD<*Y+udWSbV9 z$rN3AQ%n%dBDsP=OB|cEL>iJjhI9HZ(!U^`h~CM-_w*iRP}HsY{_uEuHpiz^eZiPW z*fi$w`Ac0bqp9v(KP1frmh^tWE!)pt8;{ZfUoO6088uP0!0oe zda+|`SL@LekL`ed!u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a/tgstation.dme +++ b/tgstation.dme @@ -3278,6 +3278,7 @@ #include "code\modules\mapping\access_helpers.dm" #include "code\modules\mapping\map_template.dm" #include "code\modules\mapping\mapping_helpers.dm" +#include "code\modules\mapping\merge_conflicts.dm" #include "code\modules\mapping\preloader.dm" #include "code\modules\mapping\reader.dm" #include "code\modules\mapping\ruins.dm" diff --git a/tools/ci/check_grep.sh b/tools/ci/check_grep.sh index b4267280311..55d81b57061 100755 --- a/tools/ci/check_grep.sh +++ b/tools/ci/check_grep.sh @@ -15,7 +15,12 @@ if grep -P '//' _maps/**/*.dmm | grep -v '//MAP CONVERTED BY dmm2tgm.py THIS HEA echo "ERROR: Unexpected commented out line detected in this map file. Please remove it." st=1 fi; -if grep -P 'Merge conflict marker' _maps/**/*.dmm; then +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; +# We check for this as well to ensure people aren't actually using this mapping effect in their maps. +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; diff --git a/tools/mapmerge2/merge_driver.py b/tools/mapmerge2/merge_driver.py index 39bc1f723e3..5ce86632d0b 100644 --- a/tools/mapmerge2/merge_driver.py +++ b/tools/mapmerge2/merge_driver.py @@ -75,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)}")