Files
Bubberstation/code/modules/modular_computers/file_system/programs/maintenance/camera.dm
SkyratBot cbaee82e73 [MIRROR] The Spectre-Meter App, also a bootleg data disk item for the black market. [MDB IGNORE] (#25717)
The Spectre-Meter App, also a bootleg data disk item for the black market.

Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com>
Co-authored-by: Gandalf <9026500+Gandalf2k15@users.noreply.github.com>
2023-12-24 23:25:23 +00:00

63 lines
2.2 KiB
Plaintext

/datum/computer_file/program/maintenance/camera
filename = "camera_app"
filedesc = "Camera"
program_open_overlay = "camera"
downloader_category = PROGRAM_CATEGORY_EQUIPMENT
extended_desc = "This program allows the taking of pictures."
size = 4
can_run_on_flags = PROGRAM_PDA
tgui_id = "NtosCamera"
program_icon = "camera"
/// Camera built-into the tablet.
var/obj/item/camera/internal_camera
/// Latest picture taken by the app.
var/datum/picture/internal_picture
/// How many pictures were taken already, used for the camera's TGUI photo display
var/picture_number = 1
/datum/computer_file/program/maintenance/camera/on_install()
. = ..()
internal_camera = new(computer)
internal_camera.print_picture_on_snap = FALSE
/datum/computer_file/program/maintenance/camera/Destroy()
if(internal_camera)
QDEL_NULL(internal_camera)
if(internal_picture)
QDEL_NULL(internal_picture)
return ..()
/datum/computer_file/program/maintenance/camera/tap(atom/tapped_atom, mob/living/user, params)
. = ..()
if(internal_picture)
QDEL_NULL(internal_picture)
var/turf/our_turf = get_turf(tapped_atom)
var/spooky_camera = locate(/datum/computer_file/program/maintenance/spectre_meter) in computer.stored_files
internal_camera.see_ghosts = spooky_camera ? CAMERA_SEE_GHOSTS_BASIC : CAMERA_NO_GHOSTS
internal_picture = internal_camera.captureimage(our_turf, user, internal_camera.picture_size_x + 1, internal_camera.picture_size_y + 1)
picture_number++
computer.save_photo(internal_picture.picture_image)
/datum/computer_file/program/maintenance/camera/ui_data(mob/user)
var/list/data = list()
if(!isnull(internal_picture))
user << browse_rsc(internal_picture.picture_image, "tmp_photo[picture_number].png")
data["photo"] = "tmp_photo[picture_number].png"
data["paper_left"] = computer.stored_paper
return data
/datum/computer_file/program/maintenance/camera/ui_act(action, params, datum/tgui/ui)
var/mob/living/user = usr
switch(action)
if("print_photo")
if(computer.stored_paper <= 0)
to_chat(usr, span_notice("Hardware error: Printer out of paper."))
return
internal_camera.printpicture(user, internal_picture)
computer.stored_paper--
computer.visible_message(span_notice("\The [computer] prints out a paper."))