diff --git a/code/modules/atmospherics/machinery/portable/canister.dm b/code/modules/atmospherics/machinery/portable/canister.dm
index 56fe498603..20ec34e3a0 100644
--- a/code/modules/atmospherics/machinery/portable/canister.dm
+++ b/code/modules/atmospherics/machinery/portable/canister.dm
@@ -315,6 +315,16 @@
holding.forceMove(T)
holding = null
+/obj/machinery/portable_atmospherics/canister/replace_tank(mob/living/user, close_valve)
+ . = ..()
+ if(.)
+ if(close_valve)
+ valve_open = FALSE
+ update_icon()
+ investigate_log("Valve was closed by [key_name(user)].
", INVESTIGATE_ATMOS)
+ else if(valve_open && holding)
+ investigate_log("[key_name(user)] started a transfer into [holding].
", INVESTIGATE_ATMOS)
+
/obj/machinery/portable_atmospherics/canister/process_atmos()
..()
if(stat & BROKEN)
@@ -435,7 +445,7 @@
message_admins(msg)
else
logmsg = "Valve was closed by [key_name(usr)], stopping the transfer into \the [holding || "air"].
"
- investigate_log(logmsg, "atmos")
+ investigate_log(logmsg, INVESTIGATE_ATMOS)
release_log += logmsg
. = TRUE
if("timer")
diff --git a/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm b/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm
index a584c2ceef..10c5ab1f43 100644
--- a/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm
+++ b/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm
@@ -80,13 +80,38 @@
/obj/machinery/portable_atmospherics/portableConnectorReturnAir()
return air_contents
+/obj/machinery/portable_atmospherics/AltClick(mob/living/user)
+ if(!istype(user) || !user.canUseTopic(src, BE_CLOSE, !ismonkey(user)))
+ return
+ if(holding)
+ to_chat(user, "You remove [holding] from [src].")
+ replace_tank(user, TRUE)
+
+/obj/machinery/portable_atmospherics/examine(mob/user)
+ ..()
+ if(holding)
+ to_chat(user, "\The [src] contains [holding]. Alt-click [src] to remove it.")
+
+/obj/machinery/portable_atmospherics/proc/replace_tank(mob/living/user, close_valve, obj/item/tank/new_tank)
+ if(holding)
+ holding.forceMove(drop_location())
+ if(Adjacent(user) && !issilicon(user))
+ user.put_in_hands(holding)
+ if(new_tank)
+ holding = new_tank
+ else
+ holding = null
+ update_icon()
+ return TRUE
+
/obj/machinery/portable_atmospherics/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/tank))
if(!(stat & BROKEN))
var/obj/item/tank/T = W
- if(holding || !user.transferItemToLoc(T, src))
+ if(!user.transferItemToLoc(T, src))
return
- holding = T
+ to_chat(user, "[holding ? "In one smooth motion you pop [holding] out of [src]'s connector and replace it with [T]" : "You insert [T] into [src]"].")
+ replace_tank(user, FALSE, T)
update_icon()
else if(istype(W, /obj/item/wrench))
if(!(stat & BROKEN))
diff --git a/code/modules/atmospherics/machinery/portable/pump.dm b/code/modules/atmospherics/machinery/portable/pump.dm
index e94492ad2d..798b555444 100644
--- a/code/modules/atmospherics/machinery/portable/pump.dm
+++ b/code/modules/atmospherics/machinery/portable/pump.dm
@@ -67,6 +67,16 @@
update_icon()
..()
+/obj/machinery/portable_atmospherics/pump/replace_tank(mob/living/user, close_valve)
+ . = ..()
+ if(.)
+ if(close_valve)
+ if(on)
+ on = FALSE
+ update_icon()
+ else if(on && holding && direction == PUMP_OUT)
+ investigate_log("[key_name(user)] started a transfer into [holding].
", INVESTIGATE_ATMOS)
+
/obj/machinery/portable_atmospherics/pump/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \
datum/tgui/master_ui = null, datum/ui_state/state = GLOB.physical_state)
@@ -105,11 +115,15 @@
var/area/A = get_area(src)
message_admins("[ADMIN_LOOKUPFLW(usr)] turned on a pump that contains [n2o ? "N2O" : ""][n2o && plasma ? " & " : ""][plasma ? "Plasma" : ""] at [A][ADMIN_JMP(src)]")
log_admin("[key_name(usr)] turned on a pump that contains [n2o ? "N2O" : ""][n2o && plasma ? " & " : ""][plasma ? "Plasma" : ""] at [A][COORD(src)]")
+ else if(on && direction == PUMP_OUT)
+ investigate_log("[key_name(usr)] started a transfer into [holding].
", INVESTIGATE_ATMOS)
. = TRUE
if("direction")
if(direction == PUMP_OUT)
direction = PUMP_IN
else
+ if(on && holding)
+ investigate_log("[key_name(usr)] started a transfer into [holding].
", INVESTIGATE_ATMOS)
direction = PUMP_OUT
. = TRUE
if("pressure")