Skip to content

Commit

Permalink
more fix around
Browse files Browse the repository at this point in the history
  • Loading branch information
blackcrystall committed Jun 24, 2024
1 parent 6c474ea commit 2e3638b
Show file tree
Hide file tree
Showing 6 changed files with 81 additions and 79 deletions.
41 changes: 21 additions & 20 deletions code/controllers/subsystem/who.dm
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ SUBSYSTEM_DEF(who)
/datum/player_list/proc/update_data()
var/list/new_list_data = list()
var/list/new_mobs_ckey = list()
var/list/additiona_data = list(
var/list/additional_data = list(
"lobby" = 0,
"admin_observers" = 0,
"observers" = 0,
Expand All @@ -46,16 +46,16 @@ SUBSYSTEM_DEF(who)
if(client_mob)
if(istype(client_mob, /mob/new_player))
client_payload["text"] += " - in Lobby"
additiona_data["lobby"]++
additional_data["lobby"]++
new_list_data["total_players"] += list(client_payload)
continue

if(isobserver(client_mob))
client_payload["text"] += " - Playing as [client_mob.real_name]"
if(CLIENT_IS_STAFF(client))
additiona_data["admin_observers"]++
additional_data["admin_observers"]++
else
additiona_data["observers"]++
additional_data["observers"]++

var/mob/dead/observer/observer = client_mob
if(observer.started_as_observer)
Expand Down Expand Up @@ -89,72 +89,72 @@ SUBSYSTEM_DEF(who)
else if(client_mob.faction == FACTION_YAUTJA)
client_payload["color"] += "#7ABA19"
client_payload["text"] += " - Yautja"
additiona_data["yautja"]++
additional_data["yautja"]++
if(client_mob.status_flags & XENO_HOST)
additiona_data["infected_preds"]++
additional_data["infected_preds"]++
else
additiona_data["humans"]++
additional_data["humans"]++
if(client_mob.status_flags & XENO_HOST)
additiona_data["infected_humans"]++
additional_data["infected_humans"]++
if(client_mob.faction == FACTION_MARINE)
additiona_data["uscm"]++
additional_data["uscm"]++
if(client_mob.job in (GLOB.ROLES_MARINES))
additiona_data["uscm_marines"]++
additional_data["uscm_marines"]++
else
counted_factions[client_mob.faction]++

new_list_data["total_players"] += list(client_payload)

new_list_data["additional_info"] += list(list(
"content" = "in Lobby: [additiona_data["lobby"]]",
"content" = "in Lobby: [additional_data["lobby"]]",
"color" = "#777",
"text" = "Player in lobby",
))

new_list_data["additional_info"] += list(list(
"content" = "Spectators: [additiona_data["observers"]] Players",
"content" = "Spectators: [additional_data["observers"]] Players",
"color" = "#777",
"text" = "Spectating players",
))

new_list_data["additional_info"] += list(list(
"content" = "Spectators: [additiona_data["admin_observers"]] Administrators",
"content" = "Spectators: [additional_data["admin_observers"]] Administrators",
"color" = "#777",
"text" = "Spectating administrators",
))

new_list_data["additional_info"] += list(list(
"content" = "Humans: [additiona_data["humans"]]",
"content" = "Humans: [additional_data["humans"]]",
"color" = "#2C7EFF",
"text" = "Players playing as Human",
))

new_list_data["additional_info"] += list(list(
"content" = "Infected Humans: [additiona_data["infected_humans"]]",
"content" = "Infected Humans: [additional_data["infected_humans"]]",
"color" = "#F00",
"text" = "Players playing as Infected Human",
))

new_list_data["additional_info"] += list(list(
"content" = "USS `Almayer` Personnel: [additiona_data["uscm"]]",
"content" = "USS `Almayer` Personnel: [additional_data["uscm"]]",
"color" = "#3e26c8",
"text" = "Players playing as USS `Almayer` Personnel",
))

new_list_data["additional_info"] += list(list(
"content" = "Marines: [additiona_data["uscm_marines"]]",
"content" = "Marines: [additional_data["uscm_marines"]]",
"color" = "#3e26c8",
"text" = "Players playing as Marines",
))

new_list_data["additional_info"] += list(list(
"content" = "Yautjes: [additiona_data["yautja"]]",
"content" = "Yautjes: [additional_data["yautja"]]",
"color" = "#7ABA19",
"text" = "Players playing as Yautja",
))

new_list_data["additional_info"] += list(list(
"content" = "Infected Yautjes: [additiona_data["infected_preds"]]",
"content" = "Infected Predators: [additional_data["infected_preds"]]",
"color" = "#7ABA19",
"text" = "Players playing as Infected Yautja",
))
Expand Down Expand Up @@ -207,7 +207,8 @@ SUBSYSTEM_DEF(who)

switch(action)
if("get_player_panel")
GLOB.admin_datums[usr.client.ckey].show_player_panel(mobs_ckey[params["ckey"]])
if(mobs_ckey[params["ckey"]])
GLOB.admin_datums[usr.client.ckey].show_player_panel(mobs_ckey[params["ckey"]])

/datum/player_list/ui_status(mob/user, datum/ui_state/state)
return UI_INTERACTIVE
Expand Down
4 changes: 2 additions & 2 deletions code/modules/almayer/weaponhits.dm
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
name = "Railgun"
possibly_ammunition = list(
/datum/space_weapon_ammo/rail_gun,
/datum/space_weapon_ammo/rail_gun/stronk
/datum/space_weapon_ammo/rail_gun/stronk,
)

/datum/space_weapon/rail_gun/shot_message(quantity, hit_eta)
Expand All @@ -42,7 +42,7 @@
name = "Rocket Launcher"
possibly_ammunition = list(
/datum/space_weapon_ammo/rocket_launcher,
/datum/space_weapon_ammo/rocket_launcher/swing_rockets
/datum/space_weapon_ammo/rocket_launcher/swing_rockets,
)

/datum/space_weapon/rocket_launcher/shot_message(quantity, hit_eta)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/vehicles/apc/apc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ GLOBAL_LIST_EMPTY(command_apc_list)
/obj/item/hardpoint/secondary/frontalcannon,
/obj/item/hardpoint/support/flare_launcher,
/obj/item/hardpoint/locomotion/apc_wheels,
)
)

/obj/effect/vehicle_spawner/apc/decrepit/spawn_vehicle(obj/vehicle/multitile/spawning)
load_misc(spawning)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/vehicles/arc/arc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@
hardpoints = list(
/obj/item/hardpoint/primary/arc_sentry,
/obj/item/hardpoint/support/arc_antenna,
/obj/item/hardpoint/locomotion/arc_wheels
/obj/item/hardpoint/locomotion/arc_wheels,
)

/obj/effect/vehicle_spawner/arc/spawn_vehicle(obj/vehicle/multitile/spawning)
Expand Down
4 changes: 2 additions & 2 deletions code/modules/vehicles/tank/tank.dm
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@

seats = list(
VEHICLE_DRIVER = null,
VEHICLE_GUNNER = null
VEHICLE_GUNNER = null,
)

active_hp = list(
VEHICLE_DRIVER = null,
VEHICLE_GUNNER = null
VEHICLE_GUNNER = null,
)

actions_list = list(
Expand Down
107 changes: 54 additions & 53 deletions tgui/packages/tgui/interfaces/Who.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import { filter } from 'common/collections';
import { flow } from 'common/fp';
import { useBackend, useLocalState } from '../backend';
import { Button, Collapsible, Box, Stack, Section, Input, Icon } from '../components';
import {
Box,
Button,
Collapsible,
Icon,
Input,
Section,
Stack,
} from '../components';
import { Window } from '../layouts';

export const Who = (props, context) => {
Expand All @@ -17,18 +23,10 @@ export const Who = (props, context) => {

const [searchQuery, setSearchQuery] = useLocalState('searchQuery', '');

const MostRelevant = (searchQuery) => {
const mostRelevant = flow([
filter((player) => isMatch(player, searchQuery)),
])(total_players)[0];
if (mostRelevant !== undefined) {
act('get_player_panel', { ckey: mostRelevant.ckey });
}
};
const searchPlayers = () =>
total_players.filter((player) => isMatch(player, searchQuery));

const filtered_total_players = flow([
filter((player) => isMatch(player, searchQuery)),
])(total_players);
const filteredTotalPlayers = searchPlayers();

return (
<Window resizable width={800} height={600}>
Expand All @@ -44,7 +42,11 @@ export const Who = (props, context) => {
<Input
autoFocus
fluid
onEnter={(e, value) => MostRelevant(value)}
onEnter={(e, value) =>
act('get_player_panel', {
ckey: searchPlayers()?.[0].ckey,
})
}
onInput={(e) => setSearchQuery(e.target.value)}
placeholder="Search..."
value={searchQuery}
Expand All @@ -56,17 +58,10 @@ export const Who = (props, context) => {
<Stack.Item mt={0.2} grow>
<Section>
<WhoCollapsible title={'Players - ' + all_clients} color="good">
{filtered_total_players.length ? (
{filteredTotalPlayers.length ? (
<Box>
{filtered_total_players.map((x, index) => (
<GetPlayerInfo
key={index}
admin={admin}
ckey={x.ckey}
ckey_color={x.ckey_color}
color={x.color}
text={x.text}
/>
{filteredTotalPlayers.map((x) => (
<GetPlayerInfo key={x.ckey} admin={admin} player={x} />
))}
</Box>
) : null}
Expand All @@ -78,33 +73,33 @@ export const Who = (props, context) => {
<Box direction="column">
{additional_info.length
? additional_info.map((x, index) => (
<GetAddInfo
key={index}
content={x.content}
color={x.color}
text={x.text}
/>
))
<GetAddInfo
key={index}
content={x.content}
color={x.color}
text={x.text}
/>
))
: null}
{factions.length
? factions.map((x, index) => (
<GetAddInfo
key={index}
content={x.content}
color={x.color}
text={x.text}
/>
))
<GetAddInfo
key={index}
content={x.content}
color={x.color}
text={x.text}
/>
))
: null}
{xenomorphs.length
? xenomorphs.map((x, index) => (
<GetAddInfo
key={index}
content={x.content}
color={x.color}
text={x.text}
/>
))
<GetAddInfo
key={index}
content={x.content}
color={x.color}
text={x.text}
/>
))
: null}
</Box>
</WhoCollapsible>
Expand Down Expand Up @@ -137,30 +132,35 @@ const GetAddInfo = (props, context) => {
'border-color': color,
'border-style': 'solid',
'border-width': '1px',
'color': color,
color: color,
}}
tooltip={text}
tooltipPosition="bottom-start">
tooltipPosition="bottom-start"
>
{content}
</Button>
);
};

const GetPlayerInfo = (props, context) => {
const { act } = useBackend(context);
const { admin, ckey, ckey_color, color, text } = props;
const {
admin,
player: { ckey, ckey_color, color, text },
} = props;
return admin !== 0 ? (
<Button
color={'transparent'}
style={{
'border-color': admin ? color : '#2185d0',
'border-style': 'solid',
'border-width': '1px',
'color': admin ? color : ckey_color,
color: admin ? color : ckey_color,
}}
onClick={() => act('get_player_panel', { ckey: ckey })}
tooltip={text}
tooltipPosition="bottom-start">
tooltipPosition="bottom-start"
>
<div color={ckey_color}>{ckey}</div>
</Button>
) : (
Expand All @@ -170,8 +170,9 @@ const GetPlayerInfo = (props, context) => {
'border-color': '#2185d0',
'border-style': 'solid',
'border-width': '1px',
'color': ckey_color,
}}>
color: ckey_color,
}}
>
<div color={ckey_color}>{ckey}</div>
</Button>
);
Expand Down

0 comments on commit 2e3638b

Please sign in to comment.