Skip to content

Commit

Permalink
fixes merge conflict markers
Browse files Browse the repository at this point in the history
  • Loading branch information
harryob committed Nov 6, 2023
1 parent c05a9cb commit de6875e
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
18 changes: 18 additions & 0 deletions code/modules/mapping/merge_conflicts.dm
Original file line number Diff line number Diff line change
@@ -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).

Check failure on line 1 in code/modules/mapping/merge_conflicts.dm

View workflow job for this annotation

GitHub Actions / Run Linters

DME Validator

File is not included
// 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)
2 changes: 2 additions & 0 deletions code/modules/unit_tests/create_and_destroy.dm
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ GLOBAL_VAR_INIT(running_create_and_destroy, FALSE)
/obj/item/explosive/grenade/flashbang/cluster_piece,
/obj/effect/fake_attacker,
/atom/movable/lighting_mask, //leave it alone
//This is meant to fail extremely loud every single time it occurs in any environment in any context, and it falsely alarms when this unit test iterates it. Let's not spawn it in.
/obj/merge_conflict_marker,
)
//This turf existing is an error in and of itself
ignore += typesof(/turf/baseturf_skipover)
Expand Down
10 changes: 7 additions & 3 deletions tools/mapmerge2/merge_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)}")
Expand Down

0 comments on commit de6875e

Please sign in to comment.