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

Commit 219ba71

Browse files
progress bar indicators
1 parent 0eadd5f commit 219ba71

File tree

6 files changed

+31
-7
lines changed

6 files changed

+31
-7
lines changed

code/__DEFINES/flags.dm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,5 +250,7 @@ GLOBAL_LIST_INIT(bitflags, list(1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 204
250250
#define IGNORE_INCAPACITATED (1<<3)
251251
/// Used to prevent important slowdowns from being abused by drugs like kronkaine
252252
#define IGNORE_SLOWDOWNS (1<<4)
253+
/// Used to keep the skill indicator icon without using the built-in delay modifier
254+
#define IGNORE_SKILL_DELAY (1<<5)
253255

254256
#define IGNORE_ALL (IGNORE_USER_LOC_CHANGE|IGNORE_TARGET_LOC_CHANGE|IGNORE_HELD_ITEM|IGNORE_INCAPACITATED|IGNORE_SLOWDOWNS)

code/__HELPERS/mobs.dm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ GLOBAL_LIST_EMPTY(species_list)
350350

351351
var/datum/progressbar/progbar
352352
if(progress)
353-
progbar = new(user, delay, target || user)
353+
progbar = new(user, delay, target || user, skill_check)
354354

355355
SEND_SIGNAL(user, COMSIG_DO_AFTER_BEGAN)
356356

code/datums/components/crafting/crafting.dm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@
172172
if(ismob(a))
173173
var/mob/mob = a
174174
timer *= (10 - (mob.get_skill(SKILL_MECHANICAL) + HAS_TRAIT(mob, TRAIT_CRAFTY)*2)) / 10
175-
if(!do_after(a, timer, a))
175+
if(!do_after(a, timer, a, IGNORE_SKILL_DELAY, skill_check = SKILL_MECHANICAL))
176176
return "."
177177
contents = get_surroundings(a, R.blacklist) // Double checking since items could no longer be there after the do_after().
178178
if(!check_contents(a, R, contents))

code/datums/progressbar.dm

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
#define PROGRESSBAR_HEIGHT 6
22
#define PROGRESSBAR_ANIMATION_TIME 5
3+
#define SKILL_ICON_OFFSET_X -18
4+
#define SKILL_ICON_OFFSET_Y -13
35

46
/datum/progressbar
57
///The progress bar visual element.
68
var/image/bar
9+
///The icon for the skill used.
10+
var/image/skill_icon
711
///The target where this progress bar is applied and where it is shown.
812
var/atom/bar_loc
913
///The mob whose client sees the progress bar.
@@ -18,7 +22,7 @@
1822
var/listindex = 0
1923

2024

21-
/datum/progressbar/New(mob/User, goal_number, atom/target)
25+
/datum/progressbar/New(mob/User, goal_number, atom/target, skill_check)
2226
. = ..()
2327
if (!istype(target))
2428
stack_trace("Invalid target [target] passed in")
@@ -37,6 +41,10 @@
3741
bar = image('icons/effects/progessbar.dmi', bar_loc, "prog_bar_0")
3842
SET_PLANE_EXPLICIT(bar, ABOVE_HUD_PLANE, User) //yogs change, increased so it draws ontop of ventcrawling overlays
3943
bar.appearance_flags = APPEARANCE_UI_IGNORE_ALPHA
44+
if(skill_check)
45+
skill_icon = image('icons/mob/skills.dmi', bar_loc, "[skill_check]_small", pixel_x = SKILL_ICON_OFFSET_X)
46+
SET_PLANE_EXPLICIT(skill_icon, ABOVE_HUD_PLANE, User)
47+
skill_icon.appearance_flags = APPEARANCE_UI_IGNORE_ALPHA
4048
user = User
4149

4250
LAZYADDASSOCLIST(user.progressbars, bar_loc, src)
@@ -60,10 +68,12 @@
6068
continue
6169
progress_bar.listindex--
6270

63-
progress_bar.bar.pixel_y = 32 + (PROGRESSBAR_HEIGHT * (progress_bar.listindex - 1))
64-
var/dist_to_travel = 32 + (PROGRESSBAR_HEIGHT * (progress_bar.listindex - 1)) - PROGRESSBAR_HEIGHT
71+
var/dist_to_travel = 32 + (PROGRESSBAR_HEIGHT * progress_bar.listindex) - PROGRESSBAR_HEIGHT
6572
animate(progress_bar.bar, pixel_y = dist_to_travel, time = PROGRESSBAR_ANIMATION_TIME, easing = SINE_EASING)
6673

74+
if(progress_bar.skill_icon)
75+
animate(progress_bar.skill_icon, pixel_y = dist_to_travel + SKILL_ICON_OFFSET_Y, time = PROGRESSBAR_ANIMATION_TIME, easing = SINE_EASING)
76+
6777
LAZYREMOVEASSOC(user.progressbars, bar_loc, src)
6878
user = null
6979

@@ -74,6 +84,8 @@
7484

7585
if(bar)
7686
QDEL_NULL(bar)
87+
if(skill_icon)
88+
QDEL_NULL(skill_icon)
7789

7890
return ..()
7991

@@ -94,6 +106,7 @@
94106
if(!user_client) //Disconnected, already gone.
95107
return
96108
user_client.images -= bar
109+
user_client.images -= skill_icon
97110
user_client = null
98111

99112

@@ -116,6 +129,11 @@
116129
bar.pixel_y = 0
117130
bar.alpha = 0
118131
user_client.images += bar
132+
if(skill_icon)
133+
skill_icon.pixel_y = SKILL_ICON_OFFSET_Y
134+
skill_icon.alpha = 0
135+
user_client.images += skill_icon
136+
animate(skill_icon, pixel_y = 32 + SKILL_ICON_OFFSET_Y + (PROGRESSBAR_HEIGHT * (listindex - 1)), alpha = 255, time = PROGRESSBAR_ANIMATION_TIME, easing = SINE_EASING)
119137
animate(bar, pixel_y = 32 + (PROGRESSBAR_HEIGHT * (listindex - 1)), alpha = 255, time = PROGRESSBAR_ANIMATION_TIME, easing = SINE_EASING)
120138

121139

@@ -134,9 +152,13 @@
134152
bar.icon_state = "[bar.icon_state]_fail"
135153

136154
animate(bar, alpha = 0, time = PROGRESSBAR_ANIMATION_TIME)
155+
if(skill_icon)
156+
animate(skill_icon, alpha = 0, time = PROGRESSBAR_ANIMATION_TIME)
137157

138158
QDEL_IN(src, PROGRESSBAR_ANIMATION_TIME)
139159

140160

161+
#undef SKILL_ICON_OFFSET_Y
162+
#undef SKILL_ICON_OFFSET_X
141163
#undef PROGRESSBAR_ANIMATION_TIME
142164
#undef PROGRESSBAR_HEIGHT

code/game/mecha/mecha.dm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1038,7 +1038,7 @@
10381038

10391039
visible_message("[user] starts to climb into [name].")
10401040

1041-
if(do_after(user, round(enter_delay * (check_eva(user)**2)), src, skill_check = null))
1041+
if(do_after(user, round(enter_delay * (check_eva(user)**2)), src, IGNORE_SKILL_DELAY, skill_check = SKILL_TECHNICAL))
10421042
if(atom_integrity <= 0)
10431043
to_chat(user, span_warning("You cannot get in the [name], it has been destroyed!"))
10441044
else if(occupant)
@@ -1157,7 +1157,7 @@
11571157
/obj/mecha/container_resist(mob/living/user)
11581158
is_currently_ejecting = TRUE
11591159
to_chat(occupant, "<span class='notice'>You begin the ejection procedure. Equipment is disabled during this process. Hold still to finish ejecting.<span>")
1160-
if(do_after(occupant, round(exit_delay * (check_eva(user)**2)), src))
1160+
if(do_after(occupant, round(exit_delay * (check_eva(user)**2)), src, IGNORE_SKILL_DELAY, skill_check = SKILL_TECHNICAL))
11611161
to_chat(occupant, "<span class='notice'>You exit the mech.<span>")
11621162
go_out()
11631163
else

icons/mob/skills.dmi

244 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)