Files
Bubberstation/code/modules/pai/camera.dm
SkyratBot 367166be9f [MIRROR] Moves silicon camera (photos, not mob cameras) out of click code [MDB IGNORE] (#24138)
* Moves silicon camera (photos, not mob cameras) out of click code (#78774)

## About The Pull Request

Atomized from the swing branch.

Moves silicon camera (taking photos, not mob camera stuff) out of their
core click code. It now uses click intercepts.

(There's an argument to be made to use signals rather than click
intercept as it's rather antiquated but w/e.)

- [x] I tested this PR

## Why It's Good For The Game

Makes it easier to unifiy click a bit more in the future. Reduces
surface area of a feature.

## Changelog

🆑 Melbert
qol: AI, cyborg, and PAI camera (photo taking) behavior now uses balloon
alerts and has sound effects associated
refactor: Refactored AI, cyborg, and PAI camera (photo taking) code
fix: fixed being unable to print photos as a cyborg when below 50%
toner, even though photos only take 5%
/🆑

* Moves silicon camera (photos, not mob cameras) out of click code

---------

Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com>
2023-10-06 14:42:50 -07:00

51 lines
1.6 KiB
Plaintext

/obj/item/camera/siliconcam/pai_camera
name = "pAI photo camera"
light_color = COLOR_PAI_GREEN
/obj/item/camera/siliconcam/pai_camera/after_picture(mob/user, datum/picture/picture)
var/number = length(stored)
picture.picture_name = "Image [number] (taken by [loc.name])"
stored[picture] = TRUE
playsound(src, pick('sound/items/polaroid1.ogg', 'sound/items/polaroid2.ogg'), 75, TRUE, -3)
balloon_alert(user, "image recorded")
/**
* Handles selecting and printing stored images.
*
* @param {mob} user - The pAI.
*
* @returns {boolean} - TRUE if the pAI prints an image,
* FALSE otherwise.
*/
/obj/item/camera/siliconcam/pai_camera/proc/pai_print(mob/user)
var/mob/living/silicon/pai/pai = loc
var/datum/picture/selection = selectpicture(user)
if(!istype(selection))
balloon_alert(user, "invalid image")
return FALSE
printpicture(user, selection)
user.visible_message(span_notice("A picture appears on top of the chassis of [pai.name]!"), span_notice("You print a photograph."))
return TRUE
/**
* All inclusive camera proc. Zooms, snaps, prints.
*
* @param {mob} user - The pAI requesting the camera.
*
* @param {string} mode - The camera option to toggle.
*
* @returns {boolean} - TRUE if the camera worked.
*/
/mob/living/silicon/pai/proc/use_camera(mob/user, mode)
if(!aicamera || isnull(mode))
return FALSE
switch(mode)
if(PAI_PHOTO_MODE_CAMERA)
aicamera.toggle_camera_mode(user)
if(PAI_PHOTO_MODE_PRINTER)
var/obj/item/camera/siliconcam/pai_camera/paicam = aicamera
paicam.pai_print(user)
if(PAI_PHOTO_MODE_ZOOM)
aicamera.adjust_zoom(user)
return TRUE