module things, jfc
This commit is contained in:
@@ -4,21 +4,29 @@
|
||||
var/caption
|
||||
var/icon/picture_image
|
||||
var/icon/picture_icon
|
||||
var/psize_x = 0
|
||||
var/psize_y = 0
|
||||
var/psize_x = 96
|
||||
var/psize_y = 96
|
||||
var/has_blueprints = FALSE
|
||||
var/logpath //If the picture has been logged this is the path.
|
||||
var/id //this var is NOT protected because the worst you can do with this that you couldn't do otherwise is overwrite photos, and photos aren't going to be used as attack logs/investigations anytime soon.
|
||||
|
||||
/datum/picture/New(name = "picture", desc = "This is a picture. A bugged one. Report it to coderbus!", image, icon, size_x = 96, size_y = 96, bp = FALSE, caption_, autogenerate_icon = FALSE)
|
||||
picture_name = name
|
||||
picture_desc = desc
|
||||
picture_image = image
|
||||
picture_icon = icon
|
||||
psize_x = size_x
|
||||
psize_y = size_y
|
||||
has_blueprints = bp
|
||||
caption = caption_
|
||||
/datum/picture/New(name, desc, image, icon, size_x, size_y, bp, caption_, autogenerate_icon)
|
||||
if(!isnull(name))
|
||||
picture_name = name
|
||||
if(!isnull(desc))
|
||||
picture_desc = desc
|
||||
if(!isnull(image))
|
||||
picture_image = image
|
||||
if(!isnull(icon))
|
||||
picture_icon = icon
|
||||
if(!isnull(psize_x))
|
||||
psize_x = size_x
|
||||
if(!isnull(psize_y))
|
||||
psize_y = size_y
|
||||
if(!isnull(bp))
|
||||
has_blueprints = bp
|
||||
if(!isnull(caption_))
|
||||
caption = caption_
|
||||
if(autogenerate_icon && !picture_icon && picture_image)
|
||||
regenerate_small_icon()
|
||||
|
||||
|
||||
@@ -6,12 +6,12 @@
|
||||
icon = 'icons/obj/items_and_weapons.dmi'
|
||||
desc = "A polaroid camera."
|
||||
icon_state = "camera"
|
||||
item_state = "electropack"
|
||||
item_state = "camera"
|
||||
lefthand_file = 'icons/mob/inhands/misc/devices_lefthand.dmi'
|
||||
righthand_file = 'icons/mob/inhands/misc/devices_righthand.dmi'
|
||||
w_class = WEIGHT_CLASS_SMALL
|
||||
flags_1 = CONDUCT_1
|
||||
slot_flags = ITEM_SLOT_BELT
|
||||
slot_flags = ITEM_SLOT_NECK
|
||||
materials = list(MAT_METAL = 50, MAT_GLASS = 150)
|
||||
var/state_on = "camera"
|
||||
var/state_off = "camera_off"
|
||||
@@ -24,21 +24,12 @@
|
||||
var/obj/item/disk/holodisk/disk
|
||||
var/sound/custom_sound
|
||||
var/silent = FALSE
|
||||
var/picture_size_x = 1
|
||||
var/picture_size_y = 1
|
||||
var/picture_size_x_min = 0
|
||||
var/picture_size_y_min = 0
|
||||
var/picture_size_x_max = 3
|
||||
var/picture_size_y_max = 3
|
||||
|
||||
/obj/item/camera/CheckParts(list/parts_list)
|
||||
..()
|
||||
var/obj/item/camera/C = locate(/obj/item/camera) in contents
|
||||
if(C)
|
||||
pictures_max = C.pictures_max
|
||||
pictures_left = C.pictures_left
|
||||
visible_message("[C] has been imbued with godlike power!")
|
||||
qdel(C)
|
||||
var/picture_size_x = 2
|
||||
var/picture_size_y = 2
|
||||
var/picture_size_x_min = 1
|
||||
var/picture_size_y_min = 1
|
||||
var/picture_size_x_max = 4
|
||||
var/picture_size_y_max = 4
|
||||
|
||||
/obj/item/camera/attack_self(mob/user)
|
||||
if(!disk)
|
||||
@@ -47,6 +38,10 @@
|
||||
user.put_in_hands(disk)
|
||||
disk = null
|
||||
|
||||
/obj/item/camera/examine(mob/user)
|
||||
. = ..()
|
||||
to_chat(user, "<span class='notice'>Alt-click to change its focusing, allowing you to set how big of an area it will capture.</span>")
|
||||
|
||||
/obj/item/camera/AltClick(mob/user)
|
||||
var/desired_x = input(user, "How high do you want the camera to shoot, between [picture_size_x_min] and [picture_size_x_max]?", "Zoom", picture_size_x) as num
|
||||
var/desired_y = input(user, "How wide do you want the camera to shoot, between [picture_size_y_min] and [picture_size_y_max]?", "Zoom", picture_size_y) as num
|
||||
@@ -86,9 +81,23 @@
|
||||
..()
|
||||
to_chat(user, "It has [pictures_left] photos left.")
|
||||
|
||||
//user can be atom or mob
|
||||
/obj/item/camera/proc/can_target(atom/target, mob/user, prox_flag)
|
||||
if(!on || blending || !pictures_left || (!isturf(target) && !isturf(target.loc)) || !((isAI(user) && GLOB.cameranet.checkTurfVis(get_turf(target))) || ((user.client && (get_turf(target) in get_hear(user.client.view, user)) || (get_turf(target) in get_hear(world.view, user))))))
|
||||
if(!on || blending || !pictures_left)
|
||||
return FALSE
|
||||
var/turf/T = get_turf(target)
|
||||
if(!T)
|
||||
return FALSE
|
||||
if(istype(user))
|
||||
if(isAI(user) && !GLOB.cameranet.checkTurfVis(T))
|
||||
return FALSE
|
||||
else if(user.client && !(get_turf(target) in get_hear(user.client.view, user)))
|
||||
return FALSE
|
||||
else if(!(get_turf(target) in get_hear(world.view, user)))
|
||||
return FALSE
|
||||
else //user is an atom
|
||||
if(!(get_turf(target) in view(world.view, user)))
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/obj/item/camera/afterattack(atom/target, mob/user, flag)
|
||||
@@ -109,10 +118,16 @@
|
||||
return
|
||||
|
||||
on = FALSE
|
||||
addtimer(CALLBACK(src, .proc/cooldown), cooldown)
|
||||
|
||||
var/realcooldown = cooldown
|
||||
var/mob/living/carbon/human/H = user
|
||||
if (H.has_trait(TRAIT_PHOTOGRAPHER))
|
||||
realcooldown *= 0.5
|
||||
addtimer(CALLBACK(src, .proc/cooldown), realcooldown)
|
||||
|
||||
icon_state = state_off
|
||||
|
||||
INVOKE_ASYNC(src, .proc/captureimage, target, user, flag, picture_size_x, picture_size_y)
|
||||
INVOKE_ASYNC(src, .proc/captureimage, target, user, flag, picture_size_x - 1, picture_size_y - 1)
|
||||
|
||||
|
||||
/obj/item/camera/proc/cooldown()
|
||||
@@ -134,7 +149,7 @@
|
||||
return FALSE
|
||||
size_x = CLAMP(size_x, 0, CAMERA_PICTURE_SIZE_HARD_LIMIT)
|
||||
size_y = CLAMP(size_y, 0, CAMERA_PICTURE_SIZE_HARD_LIMIT)
|
||||
var/list/desc = list()
|
||||
var/list/desc = list("This is a photo of an area of [size_x+1] meters by [size_y+1] meters.")
|
||||
var/ai_user = isAI(user)
|
||||
var/list/seen
|
||||
var/list/viewlist = (user && user.client)? getviewsize(user.client.view) : getviewsize(world.view)
|
||||
@@ -146,15 +161,15 @@
|
||||
var/blueprints = FALSE
|
||||
var/clone_area = SSmapping.RequestBlockReservation(size_x * 2 + 1, size_y * 2 + 1)
|
||||
for(var/turf/T in block(locate(target_turf.x - size_x, target_turf.y - size_y, target_turf.z), locate(target_turf.x + size_x, target_turf.y + size_y, target_turf.z)))
|
||||
if((ai_user && GLOB.cameranet.checkTurfVis(T)) || T in seen)
|
||||
if((ai_user && GLOB.cameranet.checkTurfVis(T)) || (T in seen))
|
||||
turfs += T
|
||||
for(var/mob/M in T)
|
||||
mobs += M
|
||||
if(locate(/obj/item/areaeditor/blueprints) in T)
|
||||
blueprints = TRUE
|
||||
CHECK_TICK
|
||||
for(var/i in mobs)
|
||||
desc += camera_get_mobdesc(i)
|
||||
var/mob/M = i
|
||||
desc += M.get_photo_description(src)
|
||||
|
||||
var/psize_x = (size_x * 2 + 1) * world.icon_size
|
||||
var/psize_y = (size_y * 2 + 1) * world.icon_size
|
||||
@@ -165,34 +180,10 @@
|
||||
temp.Scale(psize_x, psize_y)
|
||||
temp.Blend(get_icon, ICON_OVERLAY)
|
||||
|
||||
var/datum/picture/P = new("picture", desc.Join(""), temp, null, psize_x, psize_y, blueprints)
|
||||
var/datum/picture/P = new("picture", desc.Join(" "), temp, null, psize_x, psize_y, blueprints)
|
||||
after_picture(user, P, flag)
|
||||
blending = FALSE
|
||||
|
||||
/obj/item/camera/proc/camera_get_mobdesc(mob/M)
|
||||
var/list/mob_details = list()
|
||||
if(M.invisibility)
|
||||
if(see_ghosts && isobserver(M))
|
||||
mob_details += "You can also see a g-g-g-g-ghooooost! "
|
||||
else
|
||||
return mob_details
|
||||
var/list/holding = list()
|
||||
if(isliving(M))
|
||||
var/mob/living/L = M
|
||||
var/len = length(L.held_items)
|
||||
if(len)
|
||||
for(var/obj/item/I in L.held_items)
|
||||
if(!holding.len)
|
||||
holding += "They are holding \a [I]"
|
||||
else if(L.held_items.Find(I) == len)
|
||||
holding += ", and \a [I]."
|
||||
else
|
||||
holding += ", \a [I]"
|
||||
holding += "."
|
||||
holding = holding.Join("")
|
||||
mob_details += "You can also see [L] on the photo[L.health < (L.maxHealth * 0.75) ? ", looking a bit hurt":""][holding ? ". [holding]":"."]."
|
||||
return mob_details.Join("")
|
||||
|
||||
/obj/item/camera/proc/after_picture(mob/user, datum/picture/picture, proximity_flag)
|
||||
printpicture(user, picture)
|
||||
|
||||
@@ -204,15 +195,15 @@
|
||||
to_chat(user, "<span class='notice'>[pictures_left] photos left.</span>")
|
||||
var/customize = alert(user, "Do you want to customize the photo?", "Customization", "Yes", "No")
|
||||
if(customize == "Yes")
|
||||
var/name1 = stripped_input(user, "Set a name for this photo, or leave blank. 32 characters max.", "Name", max_length = 32) as text|null
|
||||
var/desc1 = stripped_input(user, "Set a description to add to photo, or leave blank. 128 characters max.", "Caption", max_length = 128) as text|null
|
||||
var/caption = stripped_input(user, "Set a caption for this photo, or leave blank. 256 characters max.", "Caption", max_length = 256) as text|null
|
||||
var/name1 = stripped_input(user, "Set a name for this photo, or leave blank. 32 characters max.", "Name", max_length = 32)
|
||||
var/desc1 = stripped_input(user, "Set a description to add to photo, or leave blank. 128 characters max.", "Caption", max_length = 128)
|
||||
var/caption = stripped_input(user, "Set a caption for this photo, or leave blank. 256 characters max.", "Caption", max_length = 256)
|
||||
if(name1)
|
||||
picture.picture_name = name1
|
||||
if(desc1)
|
||||
picture.picture_desc = "[desc1] - [picture.picture_desc]"
|
||||
if(caption)
|
||||
picture.caption = caption
|
||||
p.set_picture(picture)
|
||||
p.set_picture(picture, TRUE, TRUE)
|
||||
if(CONFIG_GET(flag/picture_logging_camera))
|
||||
picture.log_to_file()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/obj/effect/appearance_clone
|
||||
|
||||
/obj/effect/appearance_clone/New(loc, atom/A) //Intentionally not Initialize().
|
||||
/obj/effect/appearance_clone/New(loc, atom/A) //Intentionally not Initialize(), to make sure the clone assumes the intended appearance in time for the camera getFlatIcon.
|
||||
if(istype(A))
|
||||
appearance = A.appearance
|
||||
dir = A.dir
|
||||
@@ -73,7 +73,8 @@
|
||||
xo += AM.step_x
|
||||
yo += AM.step_y
|
||||
var/icon/img = getFlatIcon(A)
|
||||
res.Blend(img, blendMode2iconMode(A.blend_mode), xo, yo)
|
||||
if(img)
|
||||
res.Blend(img, blendMode2iconMode(A.blend_mode), xo, yo)
|
||||
CHECK_TICK
|
||||
|
||||
if(!silent)
|
||||
|
||||
@@ -37,21 +37,39 @@
|
||||
continue
|
||||
. |= P.picture.id
|
||||
|
||||
//Manual loading, DO NOT USE FOR HARDCODED/MAPPED IN ALBUMS. This is for if an album needs to be loaded mid-round from an ID.
|
||||
/obj/item/storage/photo_album/proc/persistence_load()
|
||||
var/list/data = SSpersistence.GetPhotoAlbums()
|
||||
if(data[persistence_id])
|
||||
populate_from_id_list(data[persistence_id])
|
||||
|
||||
/obj/item/storage/photo_album/proc/populate_from_id_list(list/ids)
|
||||
var/list/current_ids = get_picture_id_list()
|
||||
for(var/i in ids)
|
||||
if(i in current_ids)
|
||||
continue
|
||||
var/obj/item/photo/P = load_photo_from_disk(i)
|
||||
if(istype(P))
|
||||
if(!SEND_SIGNAL(src, COMSIG_TRY_STORAGE_INSERT, P, null, TRUE, TRUE))
|
||||
qdel(P)
|
||||
|
||||
#define ALBUM_DEFINE(id) /obj/item/storage/photo_album/##id/persistence_id = #id
|
||||
/obj/item/storage/photo_album/HoS
|
||||
persistence_id = "HoS"
|
||||
|
||||
ALBUM_DEFINE(HoS)
|
||||
ALBUM_DEFINE(RD)
|
||||
ALBUM_DEFINE(HoP)
|
||||
ALBUM_DEFINE(Captain)
|
||||
ALBUM_DEFINE(CMO)
|
||||
ALBUM_DEFINE(QM)
|
||||
ALBUM_DEFINE(CE)
|
||||
/obj/item/storage/photo_album/RD
|
||||
persistence_id = "RD"
|
||||
|
||||
#undef ALBUM_DEFINE
|
||||
/obj/item/storage/photo_album/HoP
|
||||
persistence_id = "HoP"
|
||||
|
||||
/obj/item/storage/photo_album/Captain
|
||||
persistence_id = "Captain"
|
||||
|
||||
/obj/item/storage/photo_album/CMO
|
||||
persistence_id = "CMO"
|
||||
|
||||
/obj/item/storage/photo_album/QM
|
||||
persistence_id = "QM"
|
||||
|
||||
/obj/item/storage/photo_album/CE
|
||||
persistence_id = "CE"
|
||||
|
||||
@@ -90,6 +90,12 @@
|
||||
if(istype(framed) && istype(framed.picture))
|
||||
return framed.picture.id
|
||||
|
||||
//Manual loading, DO NOT USE FOR HARDCODED/MAPPED IN ALBUMS. This is for if an album needs to be loaded mid-round from an ID.
|
||||
/obj/structure/sign/picture_frame/proc/persistence_load()
|
||||
var/list/data = SSpersistence.GetPhotoFrames()
|
||||
if(data[persistence_id])
|
||||
load_from_id(data[persistence_id])
|
||||
|
||||
/obj/structure/sign/picture_frame/proc/load_from_id(id)
|
||||
var/obj/item/photo/P = load_photo_from_disk(id)
|
||||
if(istype(P))
|
||||
|
||||
@@ -12,13 +12,12 @@
|
||||
grind_results = list("iodine" = 4)
|
||||
var/datum/picture/picture
|
||||
var/scribble //Scribble on the back.
|
||||
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/photo/Initialize(mapload, datum/picture/P, datum_name = TRUE, datum_desc = TRUE)
|
||||
set_picture(P, datum_name, datum_desc)
|
||||
set_picture(P, datum_name, datum_desc, TRUE)
|
||||
return ..()
|
||||
|
||||
/obj/item/photo/proc/set_picture(datum/picture/P, setname, setdesc)
|
||||
/obj/item/photo/proc/set_picture(datum/picture/P, setname, setdesc, name_override = FALSE)
|
||||
if(!istype(P))
|
||||
return
|
||||
picture = P
|
||||
@@ -26,7 +25,10 @@
|
||||
if(P.caption)
|
||||
scribble = P.caption
|
||||
if(setname && P.picture_name)
|
||||
name = P.picture_name
|
||||
if(name_override)
|
||||
name = P.picture_name
|
||||
else
|
||||
name = "photo - [P.picture_name]"
|
||||
if(setdesc && P.picture_desc)
|
||||
desc = P.picture_desc
|
||||
|
||||
|
||||
Reference in New Issue
Block a user