Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MIRROR] Fixes smart pipe & cryo gas reallocation #2954

Merged
merged 1 commit into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@
var/obj/machinery/atmospherics/components/unary/gas_connector

/datum/gas_machine_connector/New(location, obj/machinery/connecting_machine = null, direction = SOUTH, gas_volume)
gas_connector = new(location)

connected_machine = connecting_machine
if(!connected_machine)
QDEL_NULL(gas_connector)
qdel(src)
return

gas_connector = new(location)
gas_connector.dir = connected_machine.dir
gas_connector.airs[1].volume = gas_volume

Expand Down Expand Up @@ -41,7 +39,8 @@
RegisterSignal(connected_machine, COMSIG_MOVABLE_PRE_MOVE, PROC_REF(pre_move_connected_machine))
RegisterSignal(connected_machine, COMSIG_MOVABLE_MOVED, PROC_REF(moved_connected_machine))
RegisterSignal(connected_machine, COMSIG_MACHINERY_DEFAULT_ROTATE_WRENCH, PROC_REF(wrenched_connected_machine))
RegisterSignal(connected_machine, COMSIG_QDELETING, PROC_REF(deconstruct_connected_machine))
RegisterSignal(connected_machine, COMSIG_OBJ_DECONSTRUCT, PROC_REF(deconstruct_connected_machine))
RegisterSignal(connected_machine, COMSIG_QDELETING, PROC_REF(destroy_connected_machine))

/**
* Unregister the signals previously registered
Expand All @@ -51,7 +50,8 @@
COMSIG_MOVABLE_MOVED,
COMSIG_MOVABLE_PRE_MOVE,
COMSIG_MACHINERY_DEFAULT_ROTATE_WRENCH,
COMSIG_QDELETING,
COMSIG_OBJ_DECONSTRUCT,
COMSIG_QDELETING
))

/**
Expand Down Expand Up @@ -82,12 +82,18 @@
*/
/datum/gas_machine_connector/proc/deconstruct_connected_machine()
SIGNAL_HANDLER

relocate_airs()

/**
* Called when the machine has been destroyed
*/
/datum/gas_machine_connector/proc/destroy_connected_machine()
SIGNAL_HANDLER

disconnect_connector()
SSair.stop_processing_machine(connected_machine)
unregister_from_machine()
connected_machine = null
QDEL_NULL(gas_connector)
qdel(src)

/**
Expand Down
12 changes: 6 additions & 6 deletions code/modules/atmospherics/machinery/pipes/pipes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@
AddElement(/datum/element/undertile, TRAIT_T_RAY_VISIBLE) //if changing this, change the subtypes RemoveElements too, because thats how bespoke works

/obj/machinery/atmospherics/pipe/on_deconstruction(disassembled)
releaseAirToTurf()
//we delete the parent here so it initializes air_temporary for us. See /datum/pipeline/Destroy() which calls temporarily_store_air()
QDEL_NULL(parent)

if(air_temporary)
var/turf/T = loc
T.assume_air(air_temporary)

return ..()

Expand All @@ -61,11 +66,6 @@
replace_pipenet(parent, new /datum/pipeline)
return list(parent)

/obj/machinery/atmospherics/pipe/proc/releaseAirToTurf()
if(air_temporary)
var/turf/T = loc
T.assume_air(air_temporary)

/obj/machinery/atmospherics/pipe/return_air()
if(air_temporary)
return air_temporary
Expand Down
Loading