From cab1fe8e25ae3de3a6547673becab545c436db8c Mon Sep 17 00:00:00 2001 From: AndroidSFV Date: Wed, 13 Aug 2014 14:42:17 -0500 Subject: [PATCH] Bug fixes to AI photography Ext. 2 --- code/datums/wires/robot.dm | 9 ++++++++- code/game/machinery/newscaster.dm | 13 +++++++++---- code/modules/paperwork/photography.dm | 9 +++++---- 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/code/datums/wires/robot.dm b/code/datums/wires/robot.dm index dcb89787fe3..30f3cca3f12 100644 --- a/code/datums/wires/robot.dm +++ b/code/datums/wires/robot.dm @@ -61,9 +61,16 @@ var/const/BORG_WIRE_CAMERA = 16 R.notify_ai(1) var/numberer = 1 // Send images the Cyborg has taken to the AI's album upon sync. for(var/datum/picture/z in R.aicamera.aipictures) + if(R.connected_ai.aicamera.aipictures.len == 0) + var/datum/picture/p = new/datum/picture() + p = z + p.fields["name"] = "Uploaded Image [numberer] (synced from [R.name])" + R.connected_ai.aicamera.aipictures += p + numberer++ + continue for(var/datum/picture/t in R.connected_ai.aicamera.aipictures) //Hopefully to prevent someone spamming images to silicons, by spamming this wire if((z.fields["pixel_y"] != t.fields["pixel_y"]) && (z.fields["pixel_x"] != t.fields["pixel_x"])) //~2.26 out of 1000 chance this will stop something it shouldn't - var/datum/picture/p = new() + var/datum/picture/p = new/datum/picture() p = z p.fields["name"] = "Uploaded Image [numberer] (synced from [R.name])" R.connected_ai.aicamera.aipictures += p diff --git a/code/game/machinery/newscaster.dm b/code/game/machinery/newscaster.dm index 25f850d2a08..29ee00bd7e0 100644 --- a/code/game/machinery/newscaster.dm +++ b/code/game/machinery/newscaster.dm @@ -788,9 +788,12 @@ var/list/obj/machinery/newscaster/allCasters = list() //Global list that will co /obj/machinery/newscaster/proc/AttachPhoto(mob/user as mob) if(photo) - photo.loc = src.loc - if(!issilicon(user)) - user.put_in_inactive_hand(photo) + if(!photo.sillynewscastervar) + photo.loc = src.loc + if(!issilicon(user)) + user.put_in_inactive_hand(photo) + else + qdel(photo) photo = null if(istype(user.get_active_hand(), /obj/item/weapon/photo)) photo = user.get_active_hand() @@ -825,8 +828,10 @@ var/list/obj/machinery/newscaster/allCasters = list() //Global list that will co if(q.fields["name"] == find) selection = q break - P.construct(selection.fields["icon"], selection.fields["img"], selection.fields["desc"]) + P.photocreate(selection.fields["icon"], selection.fields["img"], selection.fields["desc"]) + P.sillynewscastervar = 1 photo = P + qdel(P) //######################################################################################################################## diff --git a/code/modules/paperwork/photography.dm b/code/modules/paperwork/photography.dm index b941ffe94eb..609bee39892 100644 --- a/code/modules/paperwork/photography.dm +++ b/code/modules/paperwork/photography.dm @@ -31,6 +31,7 @@ var/icon/img //Big photo image var/scribble //Scribble on the back. var/blueprints = 0 //Does it include the blueprints? + var/sillynewscastervar //Photo objects with this set to 1 will not be ejected by a newscaster. Only gets set to 1 if a silicon puts one of their images into a newscaster /obj/item/weapon/photo/attack_self(mob/user) @@ -78,7 +79,7 @@ name = "photo[(n_name ? text("- '[n_name]'") : null)]" add_fingerprint(usr) -/obj/item/weapon/photo/proc/construct(var/inicon, var/inimg, var/indesc, var/inblueprints) +/obj/item/weapon/photo/proc/photocreate(var/inicon, var/inimg, var/indesc, var/inblueprints) icon = inicon img = inimg desc = indesc @@ -198,7 +199,7 @@ /obj/item/device/camera/proc/camera_get_mobs(turf/the_turf) var/mob_detail - for(var/mob/living/carbon/A in the_turf) + for(var/mob/living/A in the_turf) if(A.invisibility) continue var/holding = null if(A.l_hand || A.r_hand) @@ -348,7 +349,7 @@ obj/item/device/camera/siliconcam/proc/viewpichelper(var/obj/item/device/camera/ if(q.fields["name"] == find) selection = q break // just in case some AI decides to take 10 thousand pictures in a round - P.construct(selection.fields["icon"], selection.fields["img"], selection.fields["desc"]) + P.photocreate(selection.fields["icon"], selection.fields["img"], selection.fields["desc"]) P.pixel_x = selection.fields["pixel_x"] P.pixel_y = selection.fields["pixel_y"] @@ -422,7 +423,7 @@ obj/item/device/camera/siliconcam/robot_camera/proc/borgprint() selection = q break var/obj/item/weapon/photo/p = new /obj/item/weapon/photo(C.loc) - p.construct(selection.fields["icon"], selection.fields["img"], selection.fields["desc"], selection.fields["blueprints"]) + p.photocreate(selection.fields["icon"], selection.fields["img"], selection.fields["desc"], selection.fields["blueprints"]) p.pixel_x = rand(-10, 10) p.pixel_y = rand(-10, 10) C.toner -= 20 //Cyborgs are very ineffeicient at printing an image