diff --git a/code/modules/organs/internal/species/machine/access_port.dm b/code/modules/organs/internal/species/machine/access_port.dm index 62001dfa307..303da885afe 100644 --- a/code/modules/organs/internal/species/machine/access_port.dm +++ b/code/modules/organs/internal/species/machine/access_port.dm @@ -77,11 +77,13 @@ SIGNAL_HANDLER if(internal_port) crash_with("Insert_item with [jack] on access port called with [internal_port] of [owner] already present!") + return FALSE internal_port = jack jack.forceMove(src) RegisterSignal(internal_port, COMSIG_QDELETING, PROC_REF(clear_port)) to_chat(owner, SPAN_MACHINE_WARNING("Internal firewall notice: [internal_port] inserted into [src].")) + return TRUE /** * This proc is called whenever the access cable is, for some reason, qdeleted (like with an explosion). @@ -111,9 +113,16 @@ /obj/item/organ/internal/machine/access_port/insert_cable(obj/item/access_cable/cable, mob/user) . = ..() - insert_item(cable) + if (!insert_item(cable)) + return + cable.create_cable(owner) +/obj/item/organ/internal/machine/access_port/remove_cable(obj/item/access_cable/cable) + . = ..() + if(internal_port == cable) + clear_port() + /obj/item/organ/internal/machine/access_port/cable_interact(obj/item/access_cable/cable, mob/user) var/obj/item/organ/internal/machine/internal_diagnostics/diagnostics_unit = owner.internal_organs_by_name[BP_DIAGNOSTICS_SUITE] if(!diagnostics_unit) @@ -277,6 +286,15 @@ user.visible_message(SPAN_WARNING("[user] tries to jack \the [src] into [human]'s access port...")) if(!do_mob(user, human, 2 SECONDS)) return + // Re-check after the delay: port state may have changed during consent/wait window + var/obj/item/organ/internal/machine/access_port/fresh_port = human.internal_organs_by_name[BP_ACCESS_PORT] + if(!fresh_port) + to_chat(user, SPAN_WARNING("[human] no longer has an access port!")) + return + if(fresh_port.internal_port) + to_chat(user, SPAN_WARNING("The access port is now occupied by [fresh_port.internal_port]!")) + return + access_port = fresh_port user.visible_message(SPAN_WARNING("[user] jacks \the [src] into [human]'s access port!")) else diff --git a/html/changelogs/hellfirejag-ipc-cable-fixes.yml b/html/changelogs/hellfirejag-ipc-cable-fixes.yml new file mode 100644 index 00000000000..4b87bbc629d --- /dev/null +++ b/html/changelogs/hellfirejag-ipc-cable-fixes.yml @@ -0,0 +1,4 @@ +author: Hellfirejag +delete-after: True +changes: + - bugfix: "Fixed some situations where an IPC datacable can get 'stuck'."