mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-07-20 12:29:23 +01:00
Modular computers QDEL and refdrops (#17655)
* Atomization * sdfasdf --------- Co-authored-by: FluffyGhost <FluffyGhost>
This commit is contained in:
@@ -10,7 +10,15 @@
|
||||
|
||||
/datum/ntnet_user/Destroy(force)
|
||||
. = ..()
|
||||
|
||||
//This notifies every client that might have this as a client to deactivate and clear the reference
|
||||
for(var/datum/computer_file/program/chat_client/client as anything in ntnet_global.chat_clients)
|
||||
client.handle_ntnet_user_deletion(src)
|
||||
|
||||
ntnet_global.chat_users.Remove(src)
|
||||
channels = null
|
||||
dm_channels = null
|
||||
clients = null
|
||||
|
||||
/datum/ntnet_user/proc/generateUsernameIdCard(var/obj/item/card/id/card)
|
||||
if(!card)
|
||||
|
||||
@@ -97,15 +97,50 @@
|
||||
sync_linked()
|
||||
|
||||
/obj/item/modular_computer/Destroy()
|
||||
kill_program(TRUE)
|
||||
if(registered_id)
|
||||
registered_id = null
|
||||
STOP_PROCESSING(SSprocessing, src)
|
||||
|
||||
SStgui.close_uis(src)
|
||||
enabled = FALSE
|
||||
|
||||
if(active_program)
|
||||
active_program.kill_program(forced = TRUE)
|
||||
SStgui.close_uis(active_program)
|
||||
|
||||
QDEL_NULL(active_program)
|
||||
|
||||
if(hard_drive)
|
||||
for(var/datum/computer_file/program/P in hard_drive.stored_files)
|
||||
P.event_unregistered()
|
||||
|
||||
QDEL_NULL_LIST(hard_drive.stored_files)
|
||||
|
||||
for(var/obj/item/computer_hardware/CH in src.get_all_components())
|
||||
uninstall_component(null, CH)
|
||||
qdel(CH)
|
||||
STOP_PROCESSING(SSprocessing, src)
|
||||
|
||||
registered_id = null
|
||||
|
||||
//Stop all the programs that we are running, or have
|
||||
for(var/datum/computer_file/program/P in idle_threads)
|
||||
P.kill_program(TRUE)
|
||||
|
||||
for(var/s in enabled_services)
|
||||
var/datum/computer_file/program/service = s
|
||||
if(service.program_type & PROGRAM_SERVICE) // Safety checks
|
||||
service.service_deactivate()
|
||||
service.service_state = PROGRAM_STATE_KILLED
|
||||
|
||||
QDEL_NULL_LIST(idle_threads)
|
||||
QDEL_NULL_LIST(enabled_services)
|
||||
|
||||
if(looping_sound)
|
||||
soundloop.stop(src)
|
||||
QDEL_NULL(soundloop)
|
||||
|
||||
QDEL_NULL(listener)
|
||||
|
||||
linked = null
|
||||
|
||||
return ..()
|
||||
|
||||
/obj/item/modular_computer/CouldUseTopic(var/mob/user)
|
||||
@@ -268,13 +303,16 @@
|
||||
|
||||
|
||||
/obj/item/modular_computer/proc/run_program(prog, mob/user, var/forced=FALSE)
|
||||
if(QDELETED(src))
|
||||
return
|
||||
|
||||
var/datum/computer_file/program/P = null
|
||||
if(!istype(user))
|
||||
user = usr
|
||||
if(hard_drive)
|
||||
P = hard_drive.find_file_by_name(prog)
|
||||
|
||||
if(!P || !istype(P)) // Program not found or it's not executable program.
|
||||
if(!P || !istype(P) || QDELING(P)) // Program not found or it's not executable program, or it's being GC'd
|
||||
to_chat(user, SPAN_WARNING("\The [src]'s screen displays, \"I/O ERROR - Unable to run [prog]\"."))
|
||||
return
|
||||
|
||||
@@ -381,6 +419,9 @@
|
||||
|
||||
|
||||
/obj/item/modular_computer/proc/enable_service(service, mob/user, var/datum/computer_file/program/S = null)
|
||||
if(QDELETED(src))
|
||||
return
|
||||
|
||||
. = FALSE
|
||||
if(!S)
|
||||
S = hard_drive?.find_file_by_name(service)
|
||||
@@ -389,6 +430,10 @@
|
||||
to_chat(user, SPAN_WARNING("\The [src] displays, \"I/O ERROR - Unable to enable [service]\""))
|
||||
return
|
||||
|
||||
//We found the program, but it's being deleted
|
||||
if(QDELETED(S))
|
||||
return
|
||||
|
||||
S.computer = src
|
||||
|
||||
if(!S.is_supported_by_hardware(hardware_flag, 1, user))
|
||||
|
||||
@@ -49,13 +49,15 @@
|
||||
crash_with("Comp was not sent for [src.filename]")
|
||||
|
||||
/datum/computer_file/program/Destroy()
|
||||
computer.idle_threads -= src
|
||||
computer.enabled_services -= src
|
||||
computer = null
|
||||
if(computer)
|
||||
computer.idle_threads -= src
|
||||
computer.enabled_services -= src
|
||||
computer = null
|
||||
. = ..()
|
||||
|
||||
/datum/computer_file/program/ui_host()
|
||||
return computer.ui_host()
|
||||
if(computer)
|
||||
return computer.ui_host()
|
||||
|
||||
/datum/computer_file/program/ui_interact(mob/user, datum/tgui/ui)
|
||||
. = ..()
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
downloading = FALSE
|
||||
requires_ntnet = FALSE // Turn off NTNet requirement as we already loaded the file into local memory.
|
||||
|
||||
/datum/computer_file/program/newsbrowser/kill_program()
|
||||
/datum/computer_file/program/newsbrowser/kill_program(forced)
|
||||
..()
|
||||
requires_ntnet = TRUE
|
||||
loaded_article = null
|
||||
|
||||
@@ -27,6 +27,11 @@
|
||||
ui.autoupdate = FALSE
|
||||
|
||||
/datum/computer_file/program/chat_client/Destroy()
|
||||
service_deactivate()
|
||||
my_user = null
|
||||
focused_conv = null
|
||||
active = null
|
||||
|
||||
return ..()
|
||||
|
||||
/datum/computer_file/program/chat_client/proc/can_receive_notification(var/datum/computer_file/program/chat_client/from)
|
||||
@@ -111,6 +116,11 @@
|
||||
ntnet_global.chat_clients.Remove(src)
|
||||
computer.update_static_data_for_all_viewers()
|
||||
|
||||
/datum/computer_file/program/chat_client/proc/handle_ntnet_user_deletion(var/datum/ntnet_user)
|
||||
if(ntnet_user == src.my_user)
|
||||
service_deactivate()
|
||||
my_user = null
|
||||
|
||||
/datum/computer_file/program/chat_client/ui_data(mob/user)
|
||||
. = ..()
|
||||
var/list/data = list()
|
||||
|
||||
@@ -92,6 +92,12 @@
|
||||
. = ..()
|
||||
listener = new(src)
|
||||
|
||||
/datum/computer_file/program/records/Destroy()
|
||||
active = null
|
||||
QDEL_NULL(listener)
|
||||
active_virus = null
|
||||
. = ..()
|
||||
|
||||
/datum/computer_file/program/records/ui_data(mob/user)
|
||||
var/list/data = list(
|
||||
"activeview" = "list",
|
||||
|
||||
@@ -22,7 +22,10 @@
|
||||
if(parent_computer?.card_slot == src)
|
||||
parent_computer.card_slot = null
|
||||
if(stored_card)
|
||||
stored_card.forceMove(get_turf(parent_computer))
|
||||
stored_card.forceMove(get_turf(parent_computer)) //Why the hell are we not QDEL'ing the stored card if we're being destroyed? I don't know, but something might rely on it, hence...
|
||||
stored_card = null //the conservative approach is to just null the reference and hope for the best
|
||||
|
||||
QDEL_NULL(stored_item)
|
||||
parent_computer = null
|
||||
return ..()
|
||||
|
||||
@@ -49,4 +52,4 @@
|
||||
|
||||
if(parent_computer)
|
||||
parent_computer.verbs -= /obj/item/modular_computer/proc/eject_id
|
||||
parent_computer.name = parent_computer.initial_name
|
||||
parent_computer.name = parent_computer.initial_name
|
||||
|
||||
@@ -142,15 +142,21 @@
|
||||
return null
|
||||
if(!stored_files)
|
||||
return null
|
||||
|
||||
for(var/datum/computer_file/F in stored_files)
|
||||
|
||||
if(QDELETED(F))
|
||||
continue
|
||||
|
||||
if(F.filename == filename)
|
||||
return F
|
||||
|
||||
return null
|
||||
|
||||
/obj/item/computer_hardware/hard_drive/Destroy()
|
||||
if(parent_computer?.hard_drive == src)
|
||||
parent_computer.hard_drive = null
|
||||
stored_files = null
|
||||
QDEL_NULL_LIST(stored_files)
|
||||
return ..()
|
||||
|
||||
/obj/item/computer_hardware/hard_drive/Initialize(mapload)
|
||||
|
||||
Reference in New Issue
Block a user