From 5a92fc4ec95050260d151054313ef525960f3baf Mon Sep 17 00:00:00 2001 From: Aronai Sieyes Date: Tue, 21 Apr 2020 03:30:49 -0400 Subject: [PATCH] Let mechs connect to ports if they're larger mechs (#7001) --- code/game/mecha/mecha.dm | 49 ++++++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 20 deletions(-) diff --git a/code/game/mecha/mecha.dm b/code/game/mecha/mecha.dm index bbc508cda7..5e5cc8149d 100644 --- a/code/game/mecha/mecha.dm +++ b/code/game/mecha/mecha.dm @@ -1074,7 +1074,7 @@ return 0 //Make sure are close enough for a valid connection - if(new_port.loc != src.loc) + if(!(new_port.loc in locs)) return 0 //Perform the connection @@ -1115,21 +1115,26 @@ set category = "Exosuit Interface" set src = usr.loc set popup_menu = 0 - if(!src.occupant) return - if(usr!=src.occupant) + + if(!occupant) return - var/obj/machinery/atmospherics/portables_connector/possible_port = locate(/obj/machinery/atmospherics/portables_connector/) in loc - if(possible_port) - if(connect(possible_port)) - src.occupant_message("\The [name] connects to the port.") - src.verbs += /obj/mecha/verb/disconnect_from_port - src.verbs -= /obj/mecha/verb/connect_to_port - return + + if(usr != occupant) + return + + for(var/turf/T in locs) + var/obj/machinery/atmospherics/portables_connector/possible_port = locate(/obj/machinery/atmospherics/portables_connector) in T + if(possible_port) + if(connect(possible_port)) + occupant_message("\The [name] connects to the port.") + verbs += /obj/mecha/verb/disconnect_from_port + verbs -= /obj/mecha/verb/connect_to_port + return + else + occupant_message("\The [name] failed to connect to the port.") + return else - src.occupant_message("\The [name] failed to connect to the port.") - return - else - src.occupant_message("Nothing happens") + occupant_message("Nothing happens") /obj/mecha/verb/disconnect_from_port() @@ -1137,15 +1142,19 @@ set category = "Exosuit Interface" set src = usr.loc set popup_menu = 0 - if(!src.occupant) return - if(usr!=src.occupant) + + if(!occupant) return + + if(usr != occupant) + return + if(disconnect()) - src.occupant_message("[name] disconnects from the port.") - src.verbs -= /obj/mecha/verb/disconnect_from_port - src.verbs += /obj/mecha/verb/connect_to_port + occupant_message("[name] disconnects from the port.") + verbs -= /obj/mecha/verb/disconnect_from_port + verbs += /obj/mecha/verb/connect_to_port else - src.occupant_message("[name] is not connected to the port at the moment.") + occupant_message("[name] is not connected to the port at the moment.") /obj/mecha/verb/toggle_lights() set name = "Toggle Lights"