mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-11 16:14:08 +01:00
Fix ByondUI small map preview (#90277)
## About The Pull Request This PR should fix the problem of small previews in TGUI once and for all (I hope). What was causing it? Because TGUI takes a long time to open, that's why previews were generated broken (small). On Byond 515 this problem was not so noticeable as the interfaces opened faster, but with the release of 516 it became much worse. Previews were generated inside a window that was not yet open, so the scale was broken, sometimes the window would open before the preview was done and sent, usually with small interfaces, or when reopening. I'm not very good at working with signals, and to tell the truth this is my second experience with them, so I hope I did it right. ## Why It's Good For The Game No more small map previews <details> <summary> Video </summary> https://github.com/user-attachments/assets/834f3820-cc6a-4f65-90e5-d6bb2a118bcf </details> ## Changelog 🆑 fix: Fixed small character preview, color matrix preview, mech preview, and other previews with uses ByondUI map /🆑 --------- Co-authored-by: Gaxeer <44334376+Gaxeer@users.noreply.github.com>
This commit is contained in:
@@ -28,9 +28,7 @@
|
||||
var/turf/last_camera_turf
|
||||
|
||||
// Stuff needed to render the map
|
||||
var/atom/movable/screen/map_view/cam_screen
|
||||
/// All the plane masters that need to be applied.
|
||||
var/atom/movable/screen/background/cam_background
|
||||
var/atom/movable/screen/map_view/camera/cam_screen
|
||||
|
||||
///Internal tracker used to find a specific person and keep them on cameras.
|
||||
var/datum/trackable/internal_tracker
|
||||
@@ -75,13 +73,9 @@
|
||||
// Initialize map objects
|
||||
cam_screen = new
|
||||
cam_screen.generate_view(map_name)
|
||||
cam_background = new
|
||||
cam_background.assigned_map = map_name
|
||||
cam_background.del_on_map_removal = FALSE
|
||||
|
||||
/datum/computer_file/program/secureye/Destroy()
|
||||
QDEL_NULL(cam_screen)
|
||||
QDEL_NULL(cam_background)
|
||||
QDEL_NULL(internal_tracker)
|
||||
last_camera_turf = null
|
||||
return ..()
|
||||
@@ -102,8 +96,7 @@
|
||||
if(is_living)
|
||||
concurrent_users += user_ref
|
||||
// Register map objects
|
||||
cam_screen.display_to(user)
|
||||
user.client.register_map_obj(cam_background)
|
||||
cam_screen.display_to(user, ui.window)
|
||||
|
||||
/datum/computer_file/program/secureye/ui_status(mob/user, datum/ui_state/state)
|
||||
. = ..()
|
||||
@@ -197,7 +190,7 @@
|
||||
var/obj/machinery/camera/active_camera = camera_ref?.resolve()
|
||||
// Show static if can't use the camera
|
||||
if(!active_camera?.can_use())
|
||||
show_camera_static()
|
||||
cam_screen.show_camera_static()
|
||||
return
|
||||
|
||||
var/list/visible_turfs = list()
|
||||
@@ -225,13 +218,6 @@
|
||||
var/size_x = bbox[3] - bbox[1] + 1
|
||||
var/size_y = bbox[4] - bbox[2] + 1
|
||||
|
||||
cam_screen.vis_contents = visible_turfs
|
||||
cam_background.icon_state = "clear"
|
||||
cam_background.fill_rect(1, 1, size_x, size_y)
|
||||
|
||||
/datum/computer_file/program/secureye/proc/show_camera_static()
|
||||
cam_screen.vis_contents.Cut()
|
||||
cam_background.icon_state = "scanline2"
|
||||
cam_background.fill_rect(1, 1, DEFAULT_MAP_SIZE, DEFAULT_MAP_SIZE)
|
||||
cam_screen.show_camera(visible_turfs, size_x, size_y)
|
||||
|
||||
#undef DEFAULT_MAP_SIZE
|
||||
|
||||
Reference in New Issue
Block a user