Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.

Commit 307f6cb

Browse files
progress bar
1 parent ba17312 commit 307f6cb

File tree

2 files changed

+31
-5
lines changed

2 files changed

+31
-5
lines changed

code/_onclick/hud/screen_objects.dm

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,8 @@
136136
ui_interact(usr)
137137

138138
/atom/movable/screen/skill_menu/ui_interact(mob/user, datum/tgui/ui)
139+
if(!user.mind)
140+
CRASH("[user.type] ([user]) tried to use the skill menu without a mind!")
139141
ui = SStgui.try_update_ui(user, src, ui)
140142
if (!ui)
141143
ui = new(user, src, "SkillMenu", "Allocate Skill Points")
@@ -148,13 +150,20 @@
148150
skill_data.Add(list(list(
149151
"base" = user.get_skill(skill),
150152
"allocated" = allocated_skills[skill],
153+
"exp_progress" = user.mind?.exp_progress[skill],
151154
)))
152155
data["skills"] = skill_data
153156
data["skill_points"] = user.mind.skill_points
154157
data["allocated_points"] = allocated_points
155158
data["exceptional_skill"] = HAS_MIND_TRAIT(user, TRAIT_EXCEPTIONAL_SKILL)
156159
return data
157160

161+
/atom/movable/screen/skill_menu/ui_static_data(mob/user)
162+
var/static/list/data = list(
163+
"exp_per_level" = EXPERIENCE_PER_LEVEL
164+
)
165+
return data
166+
158167
/atom/movable/screen/skill_menu/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
159168
. = ..()
160169
if(.)

tgui/packages/tgui/interfaces/SkillMenu.js

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { classes } from 'common/react';
22
import { useBackend } from '../backend';
3-
import { Box, Button, Icon, LabeledList, Section, Stack, Tooltip } from '../components';
3+
import { Box, Button, Icon, LabeledList, ProgressBar, Section, Stack, Tooltip } from '../components';
44
import { Window } from '../layouts';
55

66
export const SkillMenu = (props, context) => {
@@ -10,7 +10,7 @@ export const SkillMenu = (props, context) => {
1010
return (
1111
<Window
1212
title="Skills"
13-
width={224}
13+
width={320}
1414
height={262}
1515
>
1616
<Window.Content>
@@ -21,30 +21,35 @@ export const SkillMenu = (props, context) => {
2121
name="Physiology"
2222
index={0}
2323
tooltip="Medical knowledge and surgical precision."
24+
color='blue'
2425
/>
2526
<AdjustSkill
2627
skill="mechanics"
2728
name="Mechanics"
2829
index={1}
2930
tooltip="Construction and repair of structures, machinery, and exosuits."
31+
color='orange'
3032
/>
3133
<AdjustSkill
3234
skill="technical"
3335
name="Technical"
3436
index={2}
3537
tooltip="Electrical work, robot maintenance, and piloting exosuits or ships."
38+
color='yellow'
3639
/>
3740
<AdjustSkill
3841
skill="science"
3942
name="Science"
4043
index={3}
4144
tooltip="Knowledge of biology, chemistry, or other scientific fields."
45+
color='rebeccapurple'
4246
/>
4347
<AdjustSkill
4448
skill="fitness"
4549
name="Fitness"
4650
index={4}
4751
tooltip="Physical prowess and accuracy with weapons."
52+
color='red'
4853
/>
4954
</LabeledList>
5055
<Button
@@ -67,9 +72,11 @@ export const SkillMenu = (props, context) => {
6772

6873
const AdjustSkill = (props, context) => {
6974
const { act, data } = useBackend(context);
70-
const { skill, name, index, tooltip } = props;
71-
const { skills, skill_points, allocated_points, exceptional_skill } = data;
72-
const { base, allocated } = skills[index];
75+
const { skill, name, index, tooltip, color } = props;
76+
const { skills, skill_points, allocated_points, exceptional_skill, exp_per_level } = data;
77+
const { base, allocated, exp_progress } = skills[index];
78+
79+
const exp_required = exp_per_level * Math.pow(2, base)
7380

7481
return (
7582
<Stack>
@@ -103,6 +110,16 @@ const AdjustSkill = (props, context) => {
103110
amount: 1,
104111
})}
105112
/>
113+
<ProgressBar
114+
value={exp_progress}
115+
maxValue={exp_required}
116+
color={color}
117+
width={7.5}
118+
ml={1}
119+
textAlign="left"
120+
>
121+
{Math.floor(exp_progress)} / {Math.floor(exp_required)}
122+
</ProgressBar>
106123
</Box>
107124
</LabeledList.Item>
108125
</Stack>

0 commit comments

Comments
 (0)