diff --git a/code/modules/asset_cache/assets/asset_nanomap.dm b/code/modules/asset_cache/assets/asset_nanomap.dm index d678800f292c..d183c413de31 100644 --- a/code/modules/asset_cache/assets/asset_nanomap.dm +++ b/code/modules/asset_cache/assets/asset_nanomap.dm @@ -2,8 +2,9 @@ // It REALLY doesnt matter too much if these arent up to date // They are relatively big assets = list( - "Cyberiad220_nanomap_z1.png" = 'icons/_nanomaps/Cyberiad220_nanomap_z1.png', // SS220 EDITS - OUR MAPS + "Cyberiad220_nanomap_z1.png" = 'icons/_nanomaps/Cyberiad220_nanomap_z1.png', // SS220 EDIT START - OUR MAPS "Delta220_nanomap_z1.png" = 'icons/_nanomaps/Delta220_nanomap_z1.png', "MetaStation220_nanomap_z1.png" = 'icons/_nanomaps/MetaStation220_nanomap_z1.png', + "Lavaland_nanomap_z1.png" = 'icons/_nanomaps/Lavaland_nanomap_z1.png', // SS220 EDIT END - OUR MAPS "CereStation_nanomap_z1.png" = 'icons/_nanomaps/CereStation_nanomap_z1.png', ) diff --git a/icons/_nanomaps/Lavaland_nanomap_z1.png b/icons/_nanomaps/Lavaland_nanomap_z1.png new file mode 100644 index 000000000000..47ba8a29ef02 Binary files /dev/null and b/icons/_nanomaps/Lavaland_nanomap_z1.png differ diff --git a/modular_ss220/camera_nanomap/code/camera.dm b/modular_ss220/camera_nanomap/code/camera.dm index 1838a49d9907..81dcf0bef311 100644 --- a/modular_ss220/camera_nanomap/code/camera.dm +++ b/modular_ss220/camera_nanomap/code/camera.dm @@ -1,3 +1,17 @@ +/obj/machinery/camera + var/nanomap_png + +/obj/machinery/camera/Initialize(mapload, should_add_to_cameranet) + . = ..() + if(z == level_name_to_num(MAIN_STATION)) + nanomap_png = "[SSmapping.map_datum.technical_name]_nanomap_z1.png" + else if(z == level_name_to_num(MINING)) + nanomap_png = "[MINING]_nanomap_z1.png" + +/obj/machinery/computer/security + var/list/z_levels = list() // Assoc list, "z_level":"nanomap.png" + var/current_z_level_index + /obj/machinery/computer/security/ui_interact(mob/user, datum/tgui/ui = null) // Update UI ui = SStgui.try_update_ui(user, src, ui) @@ -47,6 +61,7 @@ ) var/list/cameras = get_available_cameras() data["cameras"] = list() + z_levels = list() for(var/i in cameras) var/obj/machinery/camera/C = cameras[i] data["cameras"] += list(list( @@ -56,6 +71,19 @@ z = C.z, status = C.status )) + if("[C.z]" in z_levels || !C.nanomap_png) + continue + z_levels += list("[C.z]" = C.nanomap_png) + // Sort it by z levels + z_levels = sortAssoc(z_levels) + if(isnull(current_z_level_index)) + current_z_level_index = clamp(z_levels.Find("[z]"), 1, length(z_levels)) + else + current_z_level_index = clamp(current_z_level_index, 1, length(z_levels)) + // On null, it uses map datum value + data["mapUrl"] = z_levels["[z_levels[current_z_level_index]]"] || null + // On null, it uses station's z level + data["selected_z_level"] = z_levels[current_z_level_index] || null return data /obj/machinery/computer/security/ui_static_data() @@ -63,3 +91,18 @@ data["mapRef"] = map_name data["stationLevel"] = level_name_to_num(MAIN_STATION) return data + +/obj/machinery/computer/security/ui_act(action, params) + . = ..() + if(. && action == "switch_camera") + if(!active_camera) + return + current_z_level_index = z_levels.Find("[active_camera.z]") + return + if(.) + return + + if(action == "switch_z_level") + var/z_dir = params["z_dir"] + current_z_level_index = clamp(current_z_level_index + z_dir, 1, length(z_levels)) + return TRUE diff --git a/tgui/packages/tgui/components/NanoMap.js b/tgui/packages/tgui/components/NanoMap.js index bbb9b4516829..63f2506abe93 100644 --- a/tgui/packages/tgui/components/NanoMap.js +++ b/tgui/packages/tgui/components/NanoMap.js @@ -116,7 +116,7 @@ export class NanoMap extends Component { const { dragging, offsetX, offsetY, zoom = 1 } = this.state; const { children } = this.props; - const mapUrl = config.map + '_nanomap_z1.png'; + const mapUrl = this.props.mapUrl || config.map + '_nanomap_z1.png'; const mapSize = MAP_SIZE * zoom + 'px'; const newStyle = { width: mapSize, @@ -151,6 +151,7 @@ export class NanoMap extends Component { {children} + ); } @@ -280,3 +281,17 @@ class NanoButton extends Component { } } NanoMap.NanoButton = NanoButton; + +const NanoMapZSelector = (props, context) => { + const { act, data } = useBackend(context); + return ( + + +