mapmerge: Separate DMM conflicts for distinct atom root types. (#22609)

* Separate DMM conflicts for distinct atom root types.

* clarify order of operations
This commit is contained in:
warriorstar-orion
2023-11-01 16:37:18 -04:00
committed by GitHub
parent ab4a8cb554
commit 349eca230c
3 changed files with 69 additions and 30 deletions
+47 -10
View File
@@ -2,16 +2,53 @@
// 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
#define MERGE_CONFLICT_MARKER_NAME "Merge Conflict Marker - DO NOT USE"
#define MERGE_CONFLICT_MARKER_ICON 'icons/effects/mapping_helpers.dmi'
#define MERGE_CONFLICT_MARKER_ICON_STATE "merge_conflict_marker"
#define MERGE_CONFLICT_MARKER_DESC "If you are seeing this in-game, please make an issue report on GitHub or contact a coder immediately."
///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!!!"
/// 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.
/proc/announce_merge_conflict_marker(atom/origin)
var/msg = "HEY, LISTEN!!! Merge Conflict Marker detected at [AREACOORD(origin)]! Please manually address all potential merge conflicts!!!"
warning(msg)
to_chat(world, "<span class='boldannounce'>[msg]</span>")
/obj/merge_conflict_marker
name = MERGE_CONFLICT_MARKER_NAME
icon = MERGE_CONFLICT_MARKER_ICON
icon_state = MERGE_CONFLICT_MARKER_ICON_STATE
desc = MERGE_CONFLICT_MARKER_DESC
plane = POINT_PLANE
/obj/merge_conflict_marker/Initialize(mapload)
. = ..()
announce_merge_conflict_marker(src)
/area/merge_conflict_marker
name = MERGE_CONFLICT_MARKER_NAME
icon = MERGE_CONFLICT_MARKER_ICON
icon_state = MERGE_CONFLICT_MARKER_ICON_STATE
desc = MERGE_CONFLICT_MARKER_DESC
plane = POINT_PLANE
/area/merge_conflict_marker/Initialize(mapload)
. = ..()
announce_merge_conflict_marker(src)
/turf/merge_conflict_marker
name = MERGE_CONFLICT_MARKER_NAME
icon = MERGE_CONFLICT_MARKER_ICON
icon_state = MERGE_CONFLICT_MARKER_ICON_STATE
desc = MERGE_CONFLICT_MARKER_DESC
plane = POINT_PLANE
/turf/merge_conflict_marker/Initialize(mapload)
. = ..()
announce_merge_conflict_marker(src)
#undef MERGE_CONFLICT_MARKER_NAME
#undef MERGE_CONFLICT_MARKER_ICON
#undef MERGE_CONFLICT_MARKER_ICON_STATE
#undef MERGE_CONFLICT_MARKER_DESC
@@ -3,3 +3,7 @@ help:
make sure everything in that area is correct.
/obj/merge_conflict_marker:
banned: true
/area/merge_conflict_marker:
banned: true
/turf/merge_conflict_marker:
banned: true
+18 -20
View File
@@ -1,7 +1,6 @@
#!/usr/bin/env python3
import sys
import collections
from . import dmm, mapmerge
from . import dmm
from hooks.merge_frontend import MergeDriver
@@ -11,6 +10,17 @@ SELECT_LEFT = 'left'
SELECT_RIGHT = 'right'
def make_conflict_marker(type="/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 = f"{type}/merge_conflict_marker"
obj_name = f"Merge Conflict Marker{(': ' + name) if name else ''}"
return f'{obj_path}{{name = "{obj_name}"}}'
def select(base, left, right, *, debug=None):
if left == right:
# whether or not it's in the base, both sides agree
@@ -123,36 +133,24 @@ def three_way_merge(base: dmm.DMM, left: dmm.DMM, right: dmm.DMM):
elif select_movable == SELECT_RIGHT:
tile += right_movables
else:
# 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."
tile += 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}\"")
tile += [make_conflict_marker("<<<")] + left_movables + [make_conflict_marker("---")] + right_movables + [make_conflict_marker(">>>")]
print(f" Left and right movable groups are split by an object conflict marker.")
if select_turf == SELECT_LEFT:
tile += left_turfs
elif select_turf == SELECT_RIGHT:
tile += right_turfs
else:
print(f" Saving turf: {', '.join(left_turfs)}")
print(f" Alternative: {', '.join(right_turfs)}")
print(f" Original: {', '.join(base_turfs)}")
tile += left_turfs
tile += [make_conflict_marker("/turf", "<<<")] + left_turfs + [make_conflict_marker("/turf", "---")] + right_turfs + [make_conflict_marker("/turf", ">>>")]
print(f" Left and right turfs are split by an object conflict marker.")
if select_area == SELECT_LEFT:
tile += left_areas
elif select_area == SELECT_RIGHT:
tile += right_areas
else:
print(f" Saving area: {', '.join(left_areas)}")
print(f" Alternative: {', '.join(right_areas)}")
print(f" Original: {', '.join(base_areas)}")
tile += left_areas
tile += [make_conflict_marker("/area", "<<<")] + left_areas + [make_conflict_marker("/area", "---")] + right_areas + [make_conflict_marker("/area", ">>>")]
print(f" Left and right areas are split by an object conflict marker.")
merged.set_tile(coord, tile)