mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-17 10:08:09 +01:00
## About The Pull Request I'm making the ordeal of finding a maint disk (or buying blackmarket bootleg disk) with a theme in it a slightly more rewarding experience, while sticking to the concept that it's something you've to find, unlike default PDA themes. This PR also proves to be an opportunity to put the progress tab that I coded a year ago for the 'Fishdex' to good use. TODO: ~~Refactor preferences to allow specific choices to be shown/hidden depending on whether the player meets a defined criteria, otherwise you'll have to do it manually every round, which is lame~~ - [x] Make some simple ui icons associated with each unlockable theme to be shown in the cheevo progress tab - [x] Code to validate deserialized DB values, in the remote case that any theme is removed in the future, as well as unit test code for any non-abstract theme without ID - [x] Add sound cue and chat feedback when unlocking a theme (or when fishing a new kind of fish for the first time, like, the code's similar) - [x] Test all of this ## Why It's Good For The Game These themes are basically an end in itself, and I understand the reason behind their existence is to make for some cute, little maint loot, but relegating it to chance of finding a disk somewhere in maintenance, **every single round** really rots whatever little substance this purely cosmetic feature already has. ## Changelog 🆑 add: Once installed, special PDA themes from maintenance disks will be present on your roundstart PDA on future rounds (Sadly I couldn't figure out a way to add those to the preferences UI yet). You can check which PDA themes you've unlocked in the Progress tab of the achievements UI. /🆑
128 lines
5.0 KiB
Plaintext
128 lines
5.0 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"
|
|
circuit_comp_type = /obj/item/circuit_component/mod_program/camera
|
|
|
|
/// Camera built-into the tablet.
|
|
var/obj/item/camera/app/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
|
|
|
|
// Special type of camera for this exact usecase to prevent harddels
|
|
/obj/item/camera/app
|
|
name = "internal camera"
|
|
desc = "Specialized internal camera protected from the hellish depths of SSWardrobe. \
|
|
Yell at coders if you somehow manage to see this"
|
|
|
|
/datum/computer_file/program/maintenance/camera/on_install(datum/computer_file/source, obj/item/modular_computer/computer_installing, mob/user)
|
|
. = ..()
|
|
internal_camera = new(computer)
|
|
internal_camera.print_picture_on_snap = FALSE
|
|
RegisterSignal(internal_camera, COMSIG_CAMERA_IMAGE_CAPTURED, PROC_REF(save_picture))
|
|
|
|
/datum/computer_file/program/maintenance/camera/Destroy()
|
|
QDEL_NULL(internal_camera)
|
|
QDEL_NULL(internal_picture)
|
|
return ..()
|
|
|
|
/datum/computer_file/program/maintenance/camera/tap(atom/tapped_atom, mob/living/user, list/modifiers)
|
|
. = ..()
|
|
|
|
QDEL_NULL(internal_picture)
|
|
if(internal_camera.blending)
|
|
user.balloon_alert(user, "still blending!")
|
|
return
|
|
|
|
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
|
|
INVOKE_ASYNC(internal_camera, TYPE_PROC_REF(/obj/item/camera, captureimage), our_turf, user, internal_camera.picture_size_x + 1, internal_camera.picture_size_y + 1)
|
|
|
|
/datum/computer_file/program/maintenance/camera/proc/save_picture(cam, target, user, datum/picture/picture)
|
|
SIGNAL_HANDLER
|
|
|
|
internal_picture = picture
|
|
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, datum/ui_state/state)
|
|
. = ..()
|
|
switch(action)
|
|
if("print_photo")
|
|
if(computer.stored_paper <= 0)
|
|
to_chat(ui.user, span_notice("Hardware error: Printer out of paper."))
|
|
return
|
|
internal_camera.printpicture(usr, internal_picture)
|
|
computer.stored_paper--
|
|
computer.visible_message(span_notice("\The [computer] prints out a paper."))
|
|
|
|
/obj/item/circuit_component/mod_program/camera
|
|
associated_program = /datum/computer_file/program/maintenance/camera
|
|
circuit_flags = CIRCUIT_FLAG_INPUT_SIGNAL
|
|
|
|
///A target to take a picture of.
|
|
var/datum/port/input/picture_target
|
|
///The photographed target
|
|
var/datum/port/output/photographed
|
|
/**
|
|
* Pinged when the image has been captured.
|
|
* I'm not using the default trigger output here because the process is asynced,
|
|
* even though I'm mostly sure it only sleeps if there's a set user.
|
|
*/
|
|
var/datum/port/output/photo_taken
|
|
|
|
/obj/item/circuit_component/mod_program/camera/populate_ports()
|
|
. = ..()
|
|
picture_target = add_input_port("Picture Target", PORT_TYPE_ATOM)
|
|
photographed = add_output_port("Photographed Entity", PORT_TYPE_ATOM)
|
|
photo_taken = add_output_port("Photo Taken", PORT_TYPE_SIGNAL)
|
|
|
|
/obj/item/circuit_component/mod_program/camera/register_shell(atom/movable/shell)
|
|
. = ..()
|
|
var/datum/computer_file/program/maintenance/camera/cam = associated_program
|
|
RegisterSignal(cam.internal_camera, COMSIG_CAMERA_IMAGE_CAPTURED, PROC_REF(on_image_captured))
|
|
|
|
/obj/item/circuit_component/mod_program/camera/unregister_shell()
|
|
var/datum/computer_file/program/maintenance/camera/cam = associated_program
|
|
UnregisterSignal(cam.internal_camera, COMSIG_CAMERA_IMAGE_CAPTURED)
|
|
return ..()
|
|
|
|
/obj/item/circuit_component/mod_program/camera/input_received(datum/port/input/port)
|
|
var/atom/target = picture_target.value
|
|
if(!target)
|
|
var/turf/our_turf = get_location()
|
|
target = locate(our_turf.x, our_turf.y, our_turf.z)
|
|
if(!target)
|
|
return
|
|
var/datum/computer_file/program/maintenance/camera/cam = associated_program
|
|
if(!cam.internal_camera.can_target(target))
|
|
return
|
|
var/pic_size_x = cam.internal_camera.picture_size_x - 1
|
|
var/pic_size_y = cam.internal_camera.picture_size_y - 1
|
|
INVOKE_ASYNC(cam.internal_camera, TYPE_PROC_REF(/obj/item/camera, captureimage), target, null, pic_size_x, pic_size_y)
|
|
|
|
/obj/item/circuit_component/mod_program/camera/proc/on_image_captured(obj/item/camera/source, atom/target, mob/user)
|
|
SIGNAL_HANDLER
|
|
photographed.set_output(target)
|
|
photo_taken.set_output(COMPONENT_SIGNAL)
|