diff --git a/code/_onclick/hud/_defines.dm b/code/_onclick/hud/_defines.dm index 4b963c730d..3fd73192f4 100644 --- a/code/_onclick/hud/_defines.dm +++ b/code/_onclick/hud/_defines.dm @@ -168,6 +168,8 @@ //UI position overrides for 1:1 screen layout. (default is 7:5) #define ui_stamina "EAST-1:28,CENTER:17" // replacing internals button #define ui_overridden_resist "EAST-3:24,SOUTH+1:7" +#define ui_clickdelay "CENTER:16,SOUTH:5" +#define ui_resistdelay "EAST-3:24,SOUTH+1:15" #define ui_combat_toggle "EAST-4:22,SOUTH:5" #define ui_boxcraft "EAST-4:22,SOUTH+1:6" diff --git a/code/_onclick/hud/human.dm b/code/_onclick/hud/human.dm index 9380cf98aa..04141becf2 100644 --- a/code/_onclick/hud/human.dm +++ b/code/_onclick/hud/human.dm @@ -140,6 +140,17 @@ sprint_buffer.hud = src static_inventory += sprint_buffer + // clickdelay + clickdelay = new + clickdelay.hud = src + clickdelay.screen_loc = ui_clickdelay + static_inventory += clickdelay + + // resistdelay + resistdelay = new + resistdelay.hud = src + resistdelay.screen_loc = ui_resistdelay + static_inventory += resistdelay using = new /obj/screen/drop() using.icon = ui_style diff --git a/code/modules/mob/clickdelay.dm b/code/modules/mob/clickdelay.dm index 09bd24170a..2729970510 100644 --- a/code/modules/mob/clickdelay.dm +++ b/code/modules/mob/clickdelay.dm @@ -57,6 +57,7 @@ if(considered_action) (immediate? last_action_immediate : last_action) = world.time (immediate? next_action_immediate : next_action) = max(next_action, world.time + (ignore_mod? amount : (amount * action_cooldown_mod + action_cooldown_adjust))) + hud_used?.clickdelay?.mark_dirty() /** * Get estimated time of next attack. @@ -66,7 +67,7 @@ var/obj/item/I = get_active_held_item() if(I) attack_speed = I.GetEstimatedAttackSpeed() - return max(next_action, last_action + attack_speed) + return max(next_action, next_action_immediate, max(last_action, last_action_immediate) + attack_speed) /** * Sets our next action to. The difference is DelayNextAction cannot reduce next_action under any circumstances while this can. @@ -75,6 +76,7 @@ if(considered_action) (immediate? last_action_immediate : last_action) = world.time (immediate? next_action_immediate : next_action) = world.time + (ignore_mod? amount : (amount * action_cooldown_mod + action_cooldown_adjust)) + hud_used?.clickdelay?.mark_dirty() /** * Checks if we can do another action. @@ -97,6 +99,7 @@ /mob/proc/FlushCurrentAction() last_action = last_action_immediate next_action = next_action_immediate + hud_used?.clickdelay?.mark_dirty() /** * Discards last_action and next_action @@ -104,6 +107,7 @@ /mob/proc/DiscardCurrentAction() last_action_immediate = last_action next_action_immediate = next_action + hud_used?.clickdelay?.mark_dirty() /** * Checks if we can resist again. @@ -121,6 +125,7 @@ /mob/proc/MarkResistTime(extra_cooldown = resist_cooldown, override = FALSE) last_resist = world.time next_resist = override? (world.time + extra_cooldown) : max(next_resist, world.time + extra_cooldown) + hud_used?.clickdelay?.mark_dirty() /atom // Standard clickdelay variables