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.
This commit is contained in:
veganzombeh
2015-04-26 10:07:08 +01:00
parent 22b07a5820
commit 85ca01350f
2 changed files with 91 additions and 1 deletions
+81 -1
View File
@@ -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 << "<span class='notice'>Maximum photo storage capacity reached.</span>"
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 << "<span class='userdanger'>No images saved.</span>"
return
if(pictures_left == 0)
usr << "<span class='userdanger'>There is no film left to print.</span>"
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 << "<span class='userdanger'>No images saved</span>"
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 *
@@ -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")