diff --git a/code/__HELPERS/plumbing.dm b/code/__HELPERS/plumbing.dm index a16e861cba9..918650b6606 100644 --- a/code/__HELPERS/plumbing.dm +++ b/code/__HELPERS/plumbing.dm @@ -3,20 +3,26 @@ * * Arguments * * atom/destination - the target loc we are checking for - * * ducting_layer - the ducting layer to check for. Pass 0 to ignore all layer checks + * * ducting_layer - the ducting layer to check for. pass -ve value when you are checking for overlapping machines */ /proc/ducting_layer_check(atom/destination, ducting_layer) . = null - for(var/obj/machinery/other in get_turf(destination)) + + var/is_machine = FALSE + if(ducting_layer < 0) + is_machine = TRUE + ducting_layer = abs(ducting_layer) + + for(var/atom/movable/other in get_turf(destination)) if(other == destination) continue //check for overlapping ducts var/obj/machinery/duct/pipe = other - if(istype(pipe) && (!ducting_layer || (pipe.duct_layer & ducting_layer))) + if(istype(pipe) && (pipe.duct_layer & ducting_layer)) return pipe - //check for overlapping machines. Only allow machines to overlap during ci testing which should be fixed in the future + //check for overlapping machines. -ve duct layer means we are checking machines on machines overlap which regardless of layer is not allowed for(var/datum/component/plumbing/plumber as anything in other.GetComponents(/datum/component/plumbing)) - if(!PERFORM_ALL_TESTS(maptest_log_mapping) || (plumber.ducting_layer & ducting_layer)) + if(is_machine || (plumber.ducting_layer & ducting_layer)) return plumber diff --git a/code/datums/components/plumbing/_plumbing.dm b/code/datums/components/plumbing/_plumbing.dm index 716f8e0ccd2..284d2eb068d 100644 --- a/code/datums/components/plumbing/_plumbing.dm +++ b/code/datums/components/plumbing/_plumbing.dm @@ -140,7 +140,7 @@ SIGNAL_HANDLER if(!active()) - var/datum/overlap = ducting_layer_check(parent_obj) + var/datum/overlap = ducting_layer_check(parent_obj, -ducting_layer) if(!isnull(overlap)) parent_obj.balloon_alert(user, "overlapping [istype(overlap, /obj/machinery/duct) ? "duct" : "machine"] detected!") return ITEM_INTERACT_FAILURE diff --git a/code/game/objects/items/rcd/RPLD.dm b/code/game/objects/items/rcd/RPLD.dm index 3c1f916ab14..2a6ace7783e 100644 --- a/code/game/objects/items/rcd/RPLD.dm +++ b/code/game/objects/items/rcd/RPLD.dm @@ -221,7 +221,7 @@ return FALSE if(initial(blueprint.density) && destination.is_blocked_turf(exclude_mobs = FALSE, source_atom = null, ignore_atoms = null)) return FALSE - return isnull(ducting_layer_check(destination, ispath(blueprint, /obj/machinery/duct) ? GLOB.plumbing_layers[current_layer] : NONE)) + return isnull(ducting_layer_check(destination, (ispath(blueprint, /obj/machinery/duct) ? 1 : -1) * GLOB.plumbing_layers[current_layer])) /obj/item/construction/plumbing/interact_with_atom(atom/interacting_with, mob/living/user, list/modifiers) . = ..()