From 85ca01350f8d6f02c927038403c0a7e6eeac1ccd Mon Sep 17 00:00:00 2001 From: veganzombeh Date: Sun, 26 Apr 2015 10:07:08 +0100 Subject: [PATCH] Adds a ditigal camera to the protolathe construction menu. The digital camera allows you to save up to 10 photos, and print or delete them whever you want. It still requires film to print photos. --- code/modules/paperwork/photography.dm | 82 ++++++++++++++++++- code/modules/research/designs/misc_designs.dm | 10 +++ 2 files changed, 91 insertions(+), 1 deletion(-) diff --git a/code/modules/paperwork/photography.dm b/code/modules/paperwork/photography.dm index a10372b8be8..c7c4205bc1c 100644 --- a/code/modules/paperwork/photography.dm +++ b/code/modules/paperwork/photography.dm @@ -310,7 +310,11 @@ pc.Blend(tiny_img,ICON_OVERLAY, 12, 19) var/datum/picture/P = new() - P.fields["name"] = "photo" + if(istype(src,/obj/item/device/camera/digital)) + P.fields["name"] = input(user,"Name photo:","photo") + P.name = P.fields["name"]//So the name is displayed on the print/delete list. + else + P.fields["name"] = "photo" P.fields["author"] = user P.fields["icon"] = ic P.fields["tiny"] = pc @@ -351,6 +355,82 @@ return p +/***************** +* digital camera * +******************/ +/obj/item/device/camera/digital + name = "digital camera" + desc = "A digital camera. A small screen shows there is space for 10 photos left." + var/list/datum/picture/saved_pictures = list() + pictures_left = 30 + var/max_storage = 10 + +/obj/item/device/camera/digital/afterattack(atom/target as mob|obj|turf|area, mob/user as mob, flag) + if(!on || !pictures_left || ismob(target.loc)) return + captureimage(target, user, flag) + + playsound(loc, pick('sound/items/polaroid1.ogg', 'sound/items/polaroid2.ogg'), 75, 1, -3) + + desc = "A digital camera. A small screen shows that there are currently [saved_pictures.len] pictures stored." + icon_state = icon_off + on = 0 + spawn(64) + icon_state = icon_on + on = 1 + +/obj/item/device/camera/digital/captureimage(atom/target, mob/user, flag) + if(saved_pictures.len >= max_storage) + user << "Maximum photo storage capacity reached." + return + user << "Picture saved." + var/x_c = target.x - (size-1)/2 + var/y_c = target.y + (size-1)/2 + var/z_c = target.z + var/list/turfs = list() + var/mobs = "" + for(var/i = 1; i <= size; i++) + for(var/j = 1; j <= size; j++) + var/turf/T = locate(x_c, y_c, z_c) + if(can_capture_turf(T, user)) + turfs.Add(T) + mobs += get_mobs(T) + x_c++ + y_c-- + x_c = x_c - size + + var/datum/picture/P = createpicture(target, user, turfs, mobs, flag) + saved_pictures += P + +/obj/item/device/camera/digital/verb/print_picture() + set name = "Print picture" + set category = "Object" + set src in usr + + if(saved_pictures.len == 0) + usr << "No images saved." + return + if(pictures_left == 0) + usr << "There is no film left to print." + return + + var/datum/picture/P = null + P = input("Select image to print:",P) as null|anything in saved_pictures + if(P) + printpicture(usr,P) + pictures_left -- + +/obj/item/device/camera/digital/verb/delete_picture() + set name = "Delete picture" + set category = "Object" + set src in usr + + if(saved_pictures.len == 0) + usr << "No images saved" + return + var/datum/picture/P = null + P = input("Select image to delete:",P) as null|anything in saved_pictures + if(P) + saved_pictures -= P /************** *video camera * diff --git a/code/modules/research/designs/misc_designs.dm b/code/modules/research/designs/misc_designs.dm index 4b0dc6425e9..403e5745ca8 100644 --- a/code/modules/research/designs/misc_designs.dm +++ b/code/modules/research/designs/misc_designs.dm @@ -39,4 +39,14 @@ build_type = PROTOLATHE | AUTOLATHE materials = list("$metal" = 30, "$glass" = 10) build_path = /obj/item/weapon/disk/tech_disk + category = list("Miscellaneous") + +/datum/design/digital_camera + name = "Digital Camera" + desc = "Produce an enhanced version of the standard issue camera." + id = "digitalcamera" + req_tech = list("programming" = 2, "materials" = 2) + build_type = PROTOLATHE + materials = list("$metal" = 500, "$glass" = 300) + build_path = /obj/item/device/camera/digital category = list("Miscellaneous") \ No newline at end of file