mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-26 14:39:58 +01:00
Separate windows for AI multicam (#90119)
## About The Pull Request Adds a button to create popup window out of multicam cameras https://github.com/user-attachments/assets/b4efef52-af53-4058-83eb-a5bd5e134b85 ## Why It's Good For The Game AI is always watching you ## Changelog 🆑 add: AIs now can create a popup window via multicam /🆑
This commit is contained in:
@@ -11,6 +11,8 @@
|
||||
var/atom/movable/screen/component_button/button_x
|
||||
var/atom/movable/screen/component_button/button_expand
|
||||
var/atom/movable/screen/component_button/button_shrink
|
||||
var/atom/movable/screen/component_button/button_pop
|
||||
var/atom/movable/screen/map_view/popup_screen
|
||||
|
||||
var/mutable_appearance/standard_background
|
||||
|
||||
@@ -19,6 +21,8 @@
|
||||
make_backgrounds()
|
||||
RegisterSignal(SSmapping, COMSIG_PLANE_OFFSET_INCREASE, PROC_REF(multiz_offset_increase))
|
||||
multiz_offset_increase(SSmapping)
|
||||
popup_screen = new
|
||||
popup_screen.generate_view("camera-[REF(src)]_map")
|
||||
|
||||
/atom/movable/screen/movable/pic_in_pic/proc/multiz_offset_increase(datum/source)
|
||||
SIGNAL_HANDLER
|
||||
@@ -30,15 +34,20 @@
|
||||
QDEL_NULL(button_x)
|
||||
QDEL_NULL(button_shrink)
|
||||
QDEL_NULL(button_expand)
|
||||
QDEL_NULL(button_pop)
|
||||
QDEL_NULL(popup_screen)
|
||||
return ..()
|
||||
|
||||
/atom/movable/screen/movable/pic_in_pic/component_click(atom/movable/screen/component_button/component, params)
|
||||
if(component == button_x)
|
||||
usr.client?.close_popup("camera-[REF(src)]")
|
||||
qdel(src)
|
||||
else if(component == button_expand)
|
||||
set_view_size(width+1, height+1)
|
||||
else if(component == button_shrink)
|
||||
set_view_size(width-1, height-1)
|
||||
else if(component == button_pop)
|
||||
pop_to_screen()
|
||||
|
||||
/atom/movable/screen/movable/pic_in_pic/proc/make_backgrounds()
|
||||
standard_background = new /mutable_appearance()
|
||||
@@ -99,6 +108,19 @@
|
||||
button_shrink.transform = M
|
||||
vis_contents += button_shrink
|
||||
|
||||
if(!button_pop)
|
||||
button_pop = new /atom/movable/screen/component_button(null, src)
|
||||
var/mutable_appearance/MA = new /mutable_appearance()
|
||||
MA.name = "pop"
|
||||
MA.icon = 'icons/hud/pic_in_pic.dmi'
|
||||
MA.icon_state = "pop"
|
||||
MA.plane = HUD_PLANE
|
||||
button_pop.appearance = MA
|
||||
M = matrix()
|
||||
M.Translate((max(4, width) - 0.75) * ICON_SIZE_X, (height + 0.25) * ICON_SIZE_Y + 16)
|
||||
button_pop.transform = M
|
||||
vis_contents += button_pop
|
||||
|
||||
/atom/movable/screen/movable/pic_in_pic/proc/add_background()
|
||||
if((width > 0) && (height > 0))
|
||||
var/matrix/M = matrix()
|
||||
@@ -134,6 +156,9 @@
|
||||
return
|
||||
viewing_turfs = get_visible_turfs()
|
||||
vis_contents += viewing_turfs
|
||||
if (popup_screen)
|
||||
popup_screen.vis_contents.Cut()
|
||||
popup_screen.vis_contents += viewing_turfs
|
||||
|
||||
/atom/movable/screen/movable/pic_in_pic/proc/get_visible_turfs()
|
||||
var/turf/T = get_turf(center)
|
||||
@@ -152,3 +177,17 @@
|
||||
if(C)
|
||||
shown_to -= C
|
||||
C.screen -= src
|
||||
|
||||
/atom/movable/screen/movable/pic_in_pic/proc/pop_to_screen()
|
||||
if(usr.client.screen_maps["camera-[REF(src)]_map"])
|
||||
return
|
||||
usr.client.setup_popup("camera-[REF(src)]", width, height, 2, "1984")
|
||||
popup_screen.display_to(usr)
|
||||
RegisterSignal(usr.client, COMSIG_POPUP_CLEARED, PROC_REF(on_popup_clear))
|
||||
|
||||
/atom/movable/screen/movable/pic_in_pic/proc/on_popup_clear(client/source, window)
|
||||
SIGNAL_HANDLER
|
||||
if (window == "camera-[REF(src)]")
|
||||
UnregisterSignal(usr.client, COMSIG_POPUP_CLEARED)
|
||||
popup_screen.hide_from(usr)
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 2.6 KiB |
Reference in New Issue
Block a user