mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-24 21:48:39 +01:00
Reworks pAIs (#68241)
A pretty heavy refactor for pAIs that just spilled into a rework. Attempts to fully document and organize backend code. Fixes a large number of bugs left untouched for a decade. Breaks down the frontend into subcomponents. Rebalances their software modules. (should) fix pAI faces get removed if you activate them during alert #68242
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
/mob/living/silicon/pai/ClickOn(atom/target, params)
|
||||
..()
|
||||
if(!camera?.in_camera_mode)
|
||||
return FALSE
|
||||
//pAI picture taking
|
||||
camera.toggle_camera_mode(sound = FALSE)
|
||||
camera.captureimage(target, usr, camera.picture_size_x - 1, camera.picture_size_y - 1)
|
||||
return TRUE
|
||||
|
||||
/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(loc, 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(!camera || isnull(mode))
|
||||
return FALSE
|
||||
switch(mode)
|
||||
if(PAI_PHOTO_MODE_CAMERA)
|
||||
camera.toggle_camera_mode(user)
|
||||
if(PAI_PHOTO_MODE_PRINTER)
|
||||
camera.pai_print(user)
|
||||
if(PAI_PHOTO_MODE_ZOOM)
|
||||
camera.adjust_zoom(user)
|
||||
return TRUE
|
||||
Reference in New Issue
Block a user