Skip to content

Commit

Permalink
fixes orbit menu for 0 health and admins refreshing
Browse files Browse the repository at this point in the history
  • Loading branch information
harryob committed Nov 25, 2023
1 parent 7ce5c3e commit af78811
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion code/modules/mob/dead/observer/orbit.dm
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@

var/is_admin = FALSE
if(user && user.client)
is_admin = check_other_rights(user.client, R_ADMIN, FALSE)
is_admin = check_client_rights(user.client, R_ADMIN, FALSE)
var/list/pois = getpois(skip_mindless = !is_admin, specify_dead_role = FALSE)
for(var/name in pois)
var/list/serialized = list()
Expand Down
4 changes: 3 additions & 1 deletion tgui/packages/tgui/interfaces/Orbit/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ export const getDisplayName = (full_name: string, nickname?: string) => {
};

/** Returns the display color for certain health percentages */
export const getHealthColor = (health: number) => {
export const getHealthColor = (health?: number) => {
if (!health) return 'bad';

switch (true) {
case health > HEALTH.Good:
return 'good';
Expand Down
6 changes: 4 additions & 2 deletions tgui/packages/tgui/interfaces/Orbit/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,8 @@ const ObservableItem = (

const [autoObserve] = useLocalState<boolean>(context, 'autoObserve', false);

const displayHealth = typeof health === 'number';

return (
<Button
color={'transparent'}
Expand All @@ -225,9 +227,9 @@ const ObservableItem = (
'color': color ? 'white' : 'grey',
}}
onClick={() => act('orbit', { ref: ref })}
tooltip={!!health && <ObservableTooltip item={item} />}
tooltip={displayHealth && <ObservableTooltip item={item} />}
tooltipPosition="bottom-start">
{!!health && (
{displayHealth && (
<ColorBox
color={getHealthColor(health)}
style={{ 'margin-right': '0.5em' }}
Expand Down

0 comments on commit af78811

Please sign in to comment.