mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-23 13:10:02 +01:00
[NO GBP] Allows plumbing machines on ducts with different layers (#95052)
## About The Pull Request - Closes #95039. Although intentionally removed in #94678 the inconvenience of not allowing ducts under machines of different layers isn't worth the visual clutter it has helped in reducing so I'm bringing it back ## Changelog 🆑 qol: you can place plumbing machines on ducts with different layers again /🆑
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
. = ..()
|
||||
|
||||
Reference in New Issue
Block a user