mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-08-22 11:38:12 +01:00
Fixes emergent exploit of iteration order in crew monitors
This commit is contained in:
@@ -52,9 +52,15 @@
|
||||
var/list/map_levels = uniquelist(using_map.get_map_levels(z, TRUE, om_range = DEFAULT_OVERMAP_RANGE))
|
||||
data["map_levels"] = map_levels
|
||||
|
||||
data["crewmembers"] = list()
|
||||
var/list/crewmembers = list()
|
||||
for(var/zlevel in map_levels)
|
||||
data["crewmembers"] += crew_repository.health_data(zlevel)
|
||||
crewmembers += crew_repository.health_data(zlevel)
|
||||
|
||||
// This is apparently necessary, because the above loop produces an emergent behavior
|
||||
// of telling you what coordinates someone is at even without sensors on,
|
||||
// because it strictly sorts by zlevel from bottom to top, and by coordinates from top left to bottom right.
|
||||
shuffle_inplace(crewmembers)
|
||||
data["crewmembers"] = crewmembers
|
||||
|
||||
return data
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { sortBy } from 'common/collections';
|
||||
import { flow } from 'common/fp';
|
||||
import { useBackend, useLocalState } from "../backend";
|
||||
import { Window } from "../layouts";
|
||||
import { NanoMap, Box, Table, Button, Tabs, Icon, NumberInput } from "../components";
|
||||
import { TableCell } from '../components/Table';
|
||||
import { COLORS } from '../constants.js';
|
||||
import { Fragment } from 'inferno';
|
||||
|
||||
export const CrewMonitor = () => {
|
||||
@@ -22,9 +22,13 @@ export const CrewMonitor = () => {
|
||||
export const CrewMonitorContent = (props, context) => {
|
||||
const { act, data, config } = useBackend(context);
|
||||
const [tabIndex, setTabIndex] = useLocalState(context, 'tabIndex', 0);
|
||||
const crew = sortBy(
|
||||
cm => cm.name,
|
||||
)(data.crewmembers || []);
|
||||
|
||||
const crew = flow([
|
||||
sortBy(cm => cm.name),
|
||||
sortBy(cm => cm?.x),
|
||||
sortBy(cm => cm?.y),
|
||||
sortBy(cm => cm?.realZ),
|
||||
])(data.crewmembers || []);
|
||||
|
||||
const [
|
||||
mapZoom,
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user