Newscaster and photo cleanup

Synthetics can no longer magically print color images on a black-and-white photocopier.
No longer possible for organics to acquire a synth-image by un-attaching it from a newscaster.
News articles now come with a timestamp and photo captions, if anything was penned on an attached photo.
Reception-checks no longer unconditionally sleeps the thread. Was causing havoc with NanoUI.

Misc. code refactoring.
This commit is contained in:
PsiOmega
2014-11-06 13:24:13 +01:00
parent 8078ffe079
commit 77c52f48a8
16 changed files with 270 additions and 277 deletions
+16 -20
View File
@@ -34,8 +34,8 @@
dat += "<a href='byond://?src=\ref[src];add=1'>+</a><BR><BR>"
else if(toner)
dat += "Please insert paper to copy.<BR><BR>"
if(istype(user,/mob/living/silicon))
dat += "<a href='byond://?src=\ref[src];aipic=1'>Print photo from database</a><BR><BR>"
if(istype(user,/mob/living/silicon))
dat += "<a href='byond://?src=\ref[src];aipic=1'>Print photo from database</a><BR><BR>"
dat += "Current toner level: [toner]"
if(!toner)
dat +="<BR>Please insert a new toner cartridge!"
@@ -122,18 +122,20 @@
if(!camera)
return
var/datum/picture/selection = camera.selectpicture()
var/obj/item/weapon/photo/selection = camera.selectpicture()
if (!selection)
return
var/obj/item/weapon/photo/p = new /obj/item/weapon/photo (src.loc)
p.construct(selection)
var/obj/item/weapon/photo/p = photocopy(selection)
p.loc = src.loc
if (p.desc == "")
p.desc += "Copied by [tempAI.name]"
p.desc += "Copy by [tempAI.name]"
else
p.desc += " - Copied by [tempAI.name]"
toner -= 5
p.desc += " - Copy by [tempAI.name]"
sleep(15)
else
usr << "<span class='notice'>The photocopier couldn't finish the printjob.</span>"
updateUsrDialog()
attackby(obj/item/O as obj, mob/user as mob)
@@ -244,24 +246,18 @@
/obj/machinery/photocopier/proc/photocopy(var/obj/item/weapon/photo/photocopy)
var/obj/item/weapon/photo/p = new /obj/item/weapon/photo (src.loc)
var/obj/item/weapon/photo/p = photocopy.copy()
var/icon/I = icon(photocopy.icon, photocopy.icon_state)
var/icon/img = icon(photocopy.img)
var/icon/tiny = icon(photocopy.tiny)
if(toner > 10) //plenty of toner, go straight greyscale
I.MapColors(rgb(77,77,77), rgb(150,150,150), rgb(28,28,28), rgb(0,0,0)) //I'm not sure how expensive this is, but given the many limitations of photocopying, it shouldn't be an issue.
img.MapColors(rgb(77,77,77), rgb(150,150,150), rgb(28,28,28), rgb(0,0,0))
tiny.MapColors(rgb(77,77,77), rgb(150,150,150), rgb(28,28,28), rgb(0,0,0))
p.img.MapColors(rgb(77,77,77), rgb(150,150,150), rgb(28,28,28), rgb(0,0,0))
p.tiny.MapColors(rgb(77,77,77), rgb(150,150,150), rgb(28,28,28), rgb(0,0,0))
else //not much toner left, lighten the photo
I.MapColors(rgb(77,77,77), rgb(150,150,150), rgb(28,28,28), rgb(100,100,100))
img.MapColors(rgb(77,77,77), rgb(150,150,150), rgb(28,28,28), rgb(100,100,100))
tiny.MapColors(rgb(77,77,77), rgb(150,150,150), rgb(28,28,28), rgb(100,100,100))
p.img.MapColors(rgb(77,77,77), rgb(150,150,150), rgb(28,28,28), rgb(100,100,100))
p.tiny.MapColors(rgb(77,77,77), rgb(150,150,150), rgb(28,28,28), rgb(100,100,100))
p.icon = I
p.img = img
p.tiny = tiny
p.name = photocopy.name
p.desc = photocopy.desc
p.scribble = photocopy.scribble
toner -= 5 //photos use a lot of ink!
if(toner < 0)
toner = 0
+15 -2
View File
@@ -286,7 +286,7 @@
pc.Blend(tiny_img,ICON_OVERLAY, 12, 19)
var/datum/picture/P = new()
P.fields["author"] = user
P.fields["name"] = "photo"
P.fields["icon"] = ic
P.fields["tiny"] = pc
P.fields["img"] = photoimage
@@ -305,10 +305,23 @@
Photo.construct(P)
/obj/item/weapon/photo/proc/construct(var/datum/picture/P)
name = P.fields["name"]
icon = P.fields["icon"]
tiny = P.fields["tiny"]
img = P.fields["img"]
desc = P.fields["desc"]
pixel_x = P.fields["pixel_x"]
pixel_y = P.fields["pixel_y"]
photo_size = P.fields["size"]
photo_size = P.fields["size"]
/obj/item/weapon/photo/proc/copy()
var/obj/item/weapon/photo/p = new/obj/item/weapon/photo()
p.icon = icon(icon, icon_state)
p.img = icon(img)
p.tiny = icon(tiny)
p.name = name
p.desc = desc
p.scribble = scribble
return p
+15 -16
View File
@@ -8,7 +8,7 @@
/obj/item/device/camera/siliconcam
var/in_camera_mode = 0
var/photos_taken = 0
var/list/aipictures = list()
var/list/obj/item/weapon/photo/aipictures = list()
/obj/item/device/camera/siliconcam/ai_camera //camera AI can take pictures with
name = "AI photo camera"
@@ -22,7 +22,9 @@
/obj/item/device/camera/siliconcam/proc/injectaialbum(var/datum/picture/P, var/sufix = "") //stores image information to a list similar to that of the datacore
photos_taken++
P.fields["name"] = "Image [photos_taken][sufix]"
aipictures += P
var/obj/item/weapon/photo/photo = new
photo.construct(P)
aipictures += photo
/obj/item/device/camera/siliconcam/proc/injectmasteralbum(var/datum/picture/P) //stores image information to a list similar to that of the datacore
var/mob/living/silicon/robot/C = src.loc
@@ -44,30 +46,27 @@
if(cam.aipictures.len == 0)
usr << "<span class='userdanger'>No images saved</span>"
return
for(var/datum/picture/t in cam.aipictures)
nametemp += t.fields["name"]
find = input("Select image (numbered in order taken)") in nametemp
for(var/obj/item/weapon/photo/t in cam.aipictures)
nametemp += t.name
find = input("Select image (numbered in order taken)") as null|anything in nametemp
if(!find)
return
for(var/datum/picture/q in cam.aipictures)
if(q.fields["name"] == find)
for(var/obj/item/weapon/photo/q in cam.aipictures)
if(q.name == find)
return q
/obj/item/device/camera/siliconcam/proc/viewpictures()
var/datum/picture/selection = selectpicture()
var/obj/item/weapon/photo/selection = selectpicture()
if(!selection)
return
var/obj/item/weapon/photo/P = new/obj/item/weapon/photo()
P.construct(selection)
P.show(usr)
usr << P.desc
// TG uses a special garbage collector.. qdel(P)
del(P) //so 10 thousand pictures items are not left in memory should an AI take them and then view them all.
selection.show(usr)
usr << selection.desc
/obj/item/device/camera/siliconcam/proc/deletepicture()
var/datum/picture/selection = selectpicture()
var/selection = selectpicture()
if(!selection)
return