From e740425da635f034a4dd0a41674d5794134f6aa1 Mon Sep 17 00:00:00 2001 From: Kashargul <144968721+Kashargul@users.noreply.github.com> Date: Thu, 4 Apr 2024 19:58:00 +0200 Subject: [PATCH] map view fixes and tcomms (#8150) --- .../game/machinery/telecomms/machine_interactions.dm | 4 ++-- code/modules/asset_cache/asset_list_items.dm | 2 +- code/modules/tgui/modules/atmos_control.dm | 5 +++-- code/modules/tgui/modules/crew_monitor.dm | 7 +++++-- maps/~map_system/maps.dm | 12 ++++++++++++ tgui/packages/tgui/components/NanoMap.jsx | 8 +++----- tgui/packages/tgui/interfaces/AtmosControl.jsx | 2 +- tgui/packages/tgui/interfaces/CrewMonitor.jsx | 2 +- .../tgui/interfaces/TelecommsMultitoolMenu.jsx | 12 +++++++++++- 9 files changed, 39 insertions(+), 15 deletions(-) diff --git a/code/game/machinery/telecomms/machine_interactions.dm b/code/game/machinery/telecomms/machine_interactions.dm index 124f5171b4..e136f087ed 100644 --- a/code/game/machinery/telecomms/machine_interactions.dm +++ b/code/game/machinery/telecomms/machine_interactions.dm @@ -313,13 +313,13 @@ if("freq") - var/newfreq = input(usr, "Specify a new frequency to filter (GHz). Decimals assigned automatically.", src, network) as null|num + var/newfreq = tgui_input_number(usr, "Specify a new frequency to filter (GHz). Decimals assigned automatically.", src, max_value=9999) if(newfreq && canAccess(usr)) if(findtext(num2text(newfreq), ".")) newfreq *= 10 // shift the decimal one place if(!(newfreq in freq_listening) && newfreq < 10000) freq_listening.Add(newfreq) - set_temp("-% New frequency filter assigned: \"[newfreq] GHz\" %-", "average") + set_temp("-% New frequency filter assigned: \"[newfreq/10] GHz\" %-", "average") . = TRUE if("delete") diff --git a/code/modules/asset_cache/asset_list_items.dm b/code/modules/asset_cache/asset_list_items.dm index c094a8b1a1..2717932ee3 100644 --- a/code/modules/asset_cache/asset_list_items.dm +++ b/code/modules/asset_cache/asset_list_items.dm @@ -470,9 +470,9 @@ assets = list( // CHOMP Edit: Restored for chomp station. Removed Tether. "southern_cross_nanomap_z1.png" = 'icons/_nanomaps/southern_cross_nanomap_z1.png', - "southern_cross_nanomap_z10.png" = 'icons/_nanomaps/southern_cross_nanomap_z10.png', "southern_cross_nanomap_z2.png" = 'icons/_nanomaps/southern_cross_nanomap_z2.png', "southern_cross_nanomap_z3.png" = 'icons/_nanomaps/southern_cross_nanomap_z3.png', + "southern_cross_nanomap_z4.png" = 'icons/_nanomaps/southern_cross_nanomap_z4.png', "southern_cross_nanomap_z5.png" = 'icons/_nanomaps/southern_cross_nanomap_z5.png', "southern_cross_nanomap_z6.png" = 'icons/_nanomaps/southern_cross_nanomap_z6.png', "southern_cross_nanomap_z7.png" = 'icons/_nanomaps/southern_cross_nanomap_z7.png', diff --git a/code/modules/tgui/modules/atmos_control.dm b/code/modules/tgui/modules/atmos_control.dm index a7004c2499..514f0c1934 100644 --- a/code/modules/tgui/modules/atmos_control.dm +++ b/code/modules/tgui/modules/atmos_control.dm @@ -50,7 +50,7 @@ . = ..() var/z = get_z(user) - var/list/map_levels = using_map.get_map_levels(z) + var/list/map_levels = using_map.get_visible_map_levels(z) //CHOMPEdit // TODO: Move these to a cache, similar to cameras var/alarms[0] @@ -67,12 +67,13 @@ "y" = alarm.y, "z" = alarm.z) .["alarms"] = alarms + .["zoomScale"] = world.maxx + world.maxy /datum/tgui_module/atmos_control/tgui_data(mob/user) var/list/data = list() var/z = get_z(user) - var/list/map_levels = using_map.get_map_levels(z) + var/list/map_levels = using_map.get_visible_map_levels(z) //CHOMPEdit data["map_levels"] = map_levels return data diff --git a/code/modules/tgui/modules/crew_monitor.dm b/code/modules/tgui/modules/crew_monitor.dm index 034904c1f5..9574fdae6a 100644 --- a/code/modules/tgui/modules/crew_monitor.dm +++ b/code/modules/tgui/modules/crew_monitor.dm @@ -32,7 +32,7 @@ /datum/tgui_module/crew_monitor/tgui_interact(mob/user, datum/tgui/ui = null) var/z = get_z(user) - var/list/map_levels = using_map.get_map_levels(z, TRUE, om_range = DEFAULT_OVERMAP_RANGE) + var/list/map_levels = using_map.get_visible_map_levels(z, TRUE) //CHOMPEdit if(!map_levels.len) to_chat(user, "The crew monitor doesn't seem like it'll work here.") @@ -46,6 +46,9 @@ ui.autoupdate = TRUE ui.open() +/datum/tgui_module/crew_monitor/tgui_static_data(mob/user) + . = ..() + .["zoomScale"] = world.maxx + world.maxy /datum/tgui_module/crew_monitor/tgui_data(mob/user) var/data[0] @@ -53,7 +56,7 @@ data["isAI"] = isAI(user) var/z = get_z(user) - var/list/map_levels = uniqueList(using_map.get_map_levels(z, TRUE, om_range = DEFAULT_OVERMAP_RANGE)) + var/list/map_levels = uniqueList(using_map.get_visible_map_levels(z, TRUE)) //CHOMPEdit data["map_levels"] = map_levels var/list/crewmembers = list() diff --git a/maps/~map_system/maps.dm b/maps/~map_system/maps.dm index 07ff20317e..39c8deca0b 100644 --- a/maps/~map_system/maps.dm +++ b/maps/~map_system/maps.dm @@ -228,6 +228,18 @@ var/list/all_maps = list() if(z) // Else, it's not a valid z and we want to expunge it empty_levels |= z +//CHOMPAdd Start restricted map view +/datum/map/proc/get_visible_map_levels(var/srcz, var/long_range = FALSE) + if (long_range && (srcz in contact_levels)) + return contact_levels.Copy() - admin_levels + //If in station levels, return station levels + else if (srcz in station_levels) + return station_levels.Copy() + //Just give them back their zlevel + else + return list(srcz) +//CHOMPAdd End + // Get a list of 'nearby' or 'connected' zlevels. // You should at least return a list with the given z if nothing else. /datum/map/proc/get_map_levels(var/srcz, var/long_range = FALSE, var/om_range = -1) diff --git a/tgui/packages/tgui/components/NanoMap.jsx b/tgui/packages/tgui/components/NanoMap.jsx index 3f9b1129f2..75ed55a0bd 100644 --- a/tgui/packages/tgui/components/NanoMap.jsx +++ b/tgui/packages/tgui/components/NanoMap.jsx @@ -16,8 +16,6 @@ const pauseEvent = (e) => { return false; }; -const zoomScale = 280; - export class NanoMap extends Component { constructor(props) { super(props); @@ -79,8 +77,8 @@ export class NanoMap extends Component { }; this.handleOnClick = (e) => { - let byondX = e.offsetX / this.state.zoom / zoomScale; - let byondY = 1 - e.offsetY / this.state.zoom / zoomScale; // Byond origin is bottom left, this is top left + let byondX = e.offsetX / this.state.zoom / this.props.zoomScale; + let byondY = 1 - e.offsetY / this.state.zoom / this.props.zoomScale; // Byond origin is bottom left, this is top left e.byondX = byondX; e.byondY = byondY; @@ -130,7 +128,7 @@ export class NanoMap extends Component { config.map + '_nanomap_z' + config.mapZLevel + '.png', ); // (x * zoom), x Needs to be double the turf- map size. (for virgo, 140x140) - const mapSize = zoomScale * zoom + 'px'; + const mapSize = this.props.zoomScale * zoom + 'px'; const newStyle = { width: mapSize, height: mapSize, diff --git a/tgui/packages/tgui/interfaces/AtmosControl.jsx b/tgui/packages/tgui/interfaces/AtmosControl.jsx index 62266c9540..82a8e93443 100644 --- a/tgui/packages/tgui/interfaces/AtmosControl.jsx +++ b/tgui/packages/tgui/interfaces/AtmosControl.jsx @@ -50,7 +50,7 @@ export const AtmosControlContent = (props) => { // and change the @for scss to match. body = ( - setZoom(v)}> + setZoom(v)}> {sortedAlarms .filter((x) => ~~x.z === ~~config.mapZLevel) .map((cm) => ( diff --git a/tgui/packages/tgui/interfaces/CrewMonitor.jsx b/tgui/packages/tgui/interfaces/CrewMonitor.jsx index 3038834999..428829d4b8 100644 --- a/tgui/packages/tgui/interfaces/CrewMonitor.jsx +++ b/tgui/packages/tgui/interfaces/CrewMonitor.jsx @@ -165,7 +165,7 @@ const CrewMonitorMapView = (props) => { const { act, config, data } = useBackend(); return ( - props.onZoom(v)}> + props.onZoom(v)}> {data.crewmembers .filter( (x) => x.sensor_type === 3 && ~~x.realZ === ~~config.mapZLevel, diff --git a/tgui/packages/tgui/interfaces/TelecommsMultitoolMenu.jsx b/tgui/packages/tgui/interfaces/TelecommsMultitoolMenu.jsx index 066a240d1b..396aa3a7e0 100644 --- a/tgui/packages/tgui/interfaces/TelecommsMultitoolMenu.jsx +++ b/tgui/packages/tgui/interfaces/TelecommsMultitoolMenu.jsx @@ -122,7 +122,17 @@ const TelecommsMultitoolMenuStatus = (props) => { ))} -
+
act('freq')} + /> + } + > {filter.map((f) => (