diff --git a/code/game/machinery/camera/camera.dm b/code/game/machinery/camera/camera.dm index 7df52bd408c5..d8919967dd65 100644 --- a/code/game/machinery/camera/camera.dm +++ b/code/game/machinery/camera/camera.dm @@ -38,6 +38,10 @@ /// If this camera should have innate EMP-proofing var/emp_proof = FALSE + ///Autonaming + var/autoname = FALSE + var/autonumber = 0 //camera number in area + GLOBAL_LIST_EMPTY_TYPED(all_cameras, /obj/structure/machinery/camera) /obj/structure/machinery/camera/Initialize(mapload, ...) . = ..() @@ -60,6 +64,24 @@ GLOBAL_LIST_EMPTY_TYPED(all_cameras, /obj/structure/machinery/camera) set_pixel_location() update_icon() + //This camera automatically sets it's name to whatever the area that it's in is called. + if(autoname) + autonumber = 1 + var/area/my_area = get_area(src) + if(my_area) + for(var/obj/structure/machinery/camera/autoname/current_camera in GLOB.machines) + if(current_camera == src) + continue + var/area/current_camera_area = get_area(current_camera) + if(current_camera_area.type != my_area.type) + continue + + if(!current_camera.autonumber) + continue + + autonumber = max(autonumber, current_camera.autonumber + 1) + c_tag = "[my_area.name] #[autonumber]" + /obj/structure/machinery/camera/Destroy() GLOB.all_cameras -= src . = ..() diff --git a/code/game/machinery/camera/presets.dm b/code/game/machinery/camera/presets.dm index 1f680ad76712..103e3f709afe 100644 --- a/code/game/machinery/camera/presets.dm +++ b/code/game/machinery/camera/presets.dm @@ -70,21 +70,7 @@ // AUTONAME /obj/structure/machinery/camera/autoname - var/number = 0 //camera number in area - -//This camera type automatically sets it's name to whatever the area that it's in is called. -/obj/structure/machinery/camera/autoname/Initialize(mapload, ...) - . = ..() - number = 1 - var/area/A = get_area(src) - if(A) - for(var/obj/structure/machinery/camera/autoname/C in GLOB.machines) - if(C == src) continue - var/area/CA = get_area(C) - if(CA.type == A.type) - if(C.number) - number = max(number, C.number+1) - c_tag = "[A.name] #[number]" + autoname = TRUE //cameras installed inside the dropships, accessible via both cockpit monitor and Almayer camera computers /obj/structure/machinery/camera/autoname/almayer/dropship_one