From 2812a72cca9b0b1dfcdd4b96c68be3e79b595fac Mon Sep 17 00:00:00 2001 From: MrROBUST Date: Mon, 11 Sep 2017 20:24:38 +0300 Subject: [PATCH] Mechs now can be connected to atmos ports (#30551) * Mechs now can be connected to atmos ports * Using internal_tank instead of dead code. * Apply Cyberboss's advises Corrected stupid typos * Broke connection if external powers move mech Remove forgotten comment * get_turf(src) --- code/game/mecha/mecha.dm | 33 +++---------------- code/game/mecha/mecha_topic.dm | 19 +++++++++++ .../portable/portable_atmospherics.dm | 2 +- 3 files changed, 24 insertions(+), 30 deletions(-) diff --git a/code/game/mecha/mecha.dm b/code/game/mecha/mecha.dm index aa5788192e..33a54561dc 100644 --- a/code/game/mecha/mecha.dm +++ b/code/game/mecha/mecha.dm @@ -451,6 +451,9 @@ . = ..() if(.) events.fireEvent("onMove",get_turf(src)) + if (internal_tank.disconnect()) // Something moved us and broke connection + occupant_message("Air port connection teared off!") + log_message("Lost connection to gas port.") /obj/mecha/Process_Spacemove(var/movement_dir = 0) . = ..() @@ -474,7 +477,7 @@ user.forceMove(get_turf(src)) to_chat(user, "You climb out from [src].") return 0 - if(connected_port) + if(internal_tank.connected_port) if(world.time - last_message > 20) occupant_message("Unable to move while connected to the air system port!") last_message = world.time @@ -763,40 +766,12 @@ . = t_air.return_pressure() return - /obj/mecha/proc/return_temperature() var/datum/gas_mixture/t_air = return_air() if(t_air) . = t_air.return_temperature() return -/obj/mecha/proc/connect(obj/machinery/atmospherics/components/unary/portables_connector/new_port) - //Make sure not already connected to something else - if(connected_port || !new_port || new_port.connected_device) - return 0 - - //Make sure are close enough for a valid connection - if(new_port.loc != loc) - return 0 - - //Perform the connection - connected_port = new_port - connected_port.connected_device = src - var/datum/pipeline/connected_port_parent = connected_port.PARENT1 - connected_port_parent.reconcile_air() - - log_message("Connected to gas port.") - return 1 - -/obj/mecha/proc/disconnect() - if(!connected_port) - return 0 - - connected_port.connected_device = null - connected_port = null - log_message("Disconnected from gas port.") - return 1 - /obj/mecha/portableConnectorReturnAir() return internal_tank.return_air() diff --git a/code/game/mecha/mecha_topic.dm b/code/game/mecha/mecha_topic.dm index 4df6578c50..87009ac292 100644 --- a/code/game/mecha/mecha_topic.dm +++ b/code/game/mecha/mecha_topic.dm @@ -115,6 +115,7 @@