[MIRROR] ByondUI Overmap Navigation (#9267)

Co-authored-by: ShadowLarkens <shadowlarkens@gmail.com>
Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
Co-authored-by: CHOMPStation2 <chompsation2@gmail.com>
This commit is contained in:
CHOMPStation2
2024-10-20 17:51:20 +02:00
committed by GitHub
co-authored by ShadowLarkens Kashargul CHOMPStation2
parent 8d5165360f
commit 7a24e79ea4
7 changed files with 160 additions and 19 deletions
+56 -1
View File
@@ -3,7 +3,6 @@
icon = 'icons/obj/overmap.dmi'
icon_state = "object"
/// If set to TRUE will show up on ship sensors for detailed scans
var/scannable
/// Description for scans
@@ -26,14 +25,52 @@
//light_system = MOVABLE_LIGHT
light_on = FALSE
///~~If we need to render a map for cameras and helms for this object~~ basically can you look at and use this as a ship or station.
var/render_map = FALSE
// Stuff needed to render the map
var/map_name
var/obj/screen/map_view/cam_screen
/// All the plane masters that need to be applied.
var/list/cam_plane_masters
var/obj/screen/background/cam_background
/obj/effect/overmap/Initialize()
. = ..()
if(!global.using_map.use_overmap)
return INITIALIZE_HINT_QDEL
if(render_map) // Initialize map objects
map_name = "overmap_[REF(src)]_map"
cam_screen = new
cam_screen.name = "screen"
cam_screen.assigned_map = map_name
cam_screen.del_on_map_removal = FALSE
cam_screen.screen_loc = "[map_name]:1,1"
cam_plane_masters = get_tgui_plane_masters()
for(var/obj/screen/instance as anything in cam_plane_masters)
instance.assigned_map = map_name
instance.del_on_map_removal = FALSE
instance.screen_loc = "[map_name]:CENTER"
cam_background = new
cam_background.assigned_map = map_name
cam_background.del_on_map_removal = FALSE
update_screen()
/obj/effect/overmap/Destroy()
real_appearance?.loc = null
real_appearance = null
if(cam_screen)
QDEL_NULL(cam_screen)
if(cam_plane_masters)
QDEL_LIST(cam_plane_masters)
if(cam_background)
QDEL_NULL(cam_background)
return ..()
//Overlay of how this object should look on other skyboxes
@@ -78,3 +115,21 @@
SSskybox.rebuild_skyboxes(other.map_z)
for(var/obj/effect/overmap/visitable/O in loc)
SSskybox.rebuild_skyboxes(O.map_z)
/**
* Updates the screen object, which is displayed on all connected helms
*/
/obj/effect/overmap/proc/update_screen()
if(render_map)
var/list/visible_turfs = list()
for(var/turf/T in view(4, get_turf(src)))
visible_turfs += T
var/list/bbox = get_bbox_of_atoms(visible_turfs)
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)
return TRUE