mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-14 09:35:30 +01:00
General maintenance for hand held camera (#95295)
## About The Pull Request - Merged a lot of procs into procs `attempt_picture()` and `interact_with_atom()` reducing proc overhead - Taking pictures will now always use the cameras internal `picture_size_x` & `picture_size_y`. It no longer accepts variable sizes as parameters - All camera operations are asynchronous and respects checks on if the target can be captured on camera or not. - A bunch of other code rearrangement that makes readability easier - Fixes the following camera bugs. They fall under the same category - Fixes #95286 - Fixes #95256 ## Changelog 🆑 fix: camera devices work again, camera flash turns on in most instances refactor: camera code has been refactored. Report bugs on github /🆑 --------- Co-authored-by: ArcaneMusic <41715314+ArcaneMusic@users.noreply.github.com>
This commit is contained in:
@@ -19,28 +19,29 @@
|
||||
overlay_icon_state = "bg_default_border"
|
||||
cooldown_time = 30 SECONDS
|
||||
///camera we use to take photos
|
||||
var/obj/item/camera/ability_camera
|
||||
var/obj/item/camera/internal_camera
|
||||
|
||||
/datum/action/cooldown/mob_cooldown/capture_photo/Grant(mob/grant_to)
|
||||
. = ..()
|
||||
if(isnull(owner))
|
||||
return
|
||||
ability_camera = new(owner)
|
||||
ability_camera.print_picture_on_snap = FALSE
|
||||
RegisterSignal(ability_camera, COMSIG_PREQDELETED, PROC_REF(on_camera_delete))
|
||||
internal_camera = new(owner)
|
||||
internal_camera.print_picture_on_snap = FALSE
|
||||
internal_camera.cooldown = 1 SECONDS
|
||||
RegisterSignal(internal_camera, COMSIG_PREQDELETED, PROC_REF(on_camera_delete))
|
||||
|
||||
/datum/action/cooldown/mob_cooldown/capture_photo/Activate(atom/target)
|
||||
if(isnull(ability_camera))
|
||||
if(isnull(internal_camera))
|
||||
return FALSE
|
||||
ability_camera.captureimage(target, owner)
|
||||
internal_camera.attempt_picture(target, owner)
|
||||
StartCooldown()
|
||||
return TRUE
|
||||
|
||||
/datum/action/cooldown/mob_cooldown/capture_photo/proc/on_camera_delete(datum/source)
|
||||
SIGNAL_HANDLER
|
||||
UnregisterSignal(ability_camera, COMSIG_PREQDELETED)
|
||||
ability_camera = null
|
||||
UnregisterSignal(internal_camera, COMSIG_PREQDELETED)
|
||||
internal_camera = null
|
||||
|
||||
/datum/action/cooldown/mob_cooldown/capture_photo/Destroy()
|
||||
QDEL_NULL(ability_camera)
|
||||
QDEL_NULL(internal_camera)
|
||||
return ..()
|
||||
|
||||
Reference in New Issue
Block a user