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

Camera Autoname change #5456

Merged
merged 3 commits into from
Jan 28, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
17 changes: 17 additions & 0 deletions code/game/machinery/camera/camera.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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

/obj/structure/machinery/camera/Initialize(mapload, ...)
. = ..()
WireColorToFlag = randomCameraWires()
Expand All @@ -58,6 +62,19 @@
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/A = get_area(src)
realforest2001 marked this conversation as resolved.
Show resolved Hide resolved
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.autonumber)
autonumber = max(autonumber, C.autonumber+1)
realforest2001 marked this conversation as resolved.
Show resolved Hide resolved
c_tag = "[A.name] #[autonumber]"
realforest2001 marked this conversation as resolved.
Show resolved Hide resolved

/obj/structure/machinery/camera/Destroy()
. = ..()
QDEL_NULL(assembly)
Expand Down
16 changes: 1 addition & 15 deletions code/game/machinery/camera/presets.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading