diff --git a/code/_onclick/hud/_defines.dm b/code/_onclick/hud/_defines.dm index b8bfb039ab3..9c4d8c62b77 100644 --- a/code/_onclick/hud/_defines.dm +++ b/code/_onclick/hud/_defines.dm @@ -45,6 +45,7 @@ #define ui_back "CENTER-2:14,SOUTH:5" #define ui_storage1 "CENTER+1:18,SOUTH:5" #define ui_storage2 "CENTER+2:20,SOUTH:5" +#define ui_combo "CENTER+4:24,SOUTH+1:7" //combo meter for martial arts //Lower right, persistent menu #define ui_drop_throw "EAST-1:28,SOUTH+1:7" diff --git a/code/_onclick/hud/hud.dm b/code/_onclick/hud/hud.dm index 5b9d9d70080..87dc8fe81ec 100644 --- a/code/_onclick/hud/hud.dm +++ b/code/_onclick/hud/hud.dm @@ -34,6 +34,7 @@ GLOBAL_LIST_INIT(available_ui_styles, list( var/atom/movable/screen/alien_plasma_display var/atom/movable/screen/alien_queen_finder + var/atom/movable/screen/combo/combo_display var/atom/movable/screen/action_intent var/atom/movable/screen/zone_select @@ -111,6 +112,7 @@ GLOBAL_LIST_INIT(available_ui_styles, list( blobpwrdisplay = null alien_plasma_display = null alien_queen_finder = null + combo_display = null QDEL_LIST_ASSOC_VAL(plane_masters) QDEL_LIST(screenoverlays) diff --git a/code/_onclick/hud/human.dm b/code/_onclick/hud/human.dm index 07d8fa84515..7e179cab3e2 100644 --- a/code/_onclick/hud/human.dm +++ b/code/_onclick/hud/human.dm @@ -310,6 +310,9 @@ zone_select.update_icon() static_inventory += zone_select + combo_display = new /atom/movable/screen/combo() + infodisplay += combo_display + for(var/atom/movable/screen/inventory/inv in (static_inventory + toggleable_inventory)) if(inv.slot_id) inv.hud = src diff --git a/code/_onclick/hud/living.dm b/code/_onclick/hud/living.dm index 331b443ead4..8afb7892404 100644 --- a/code/_onclick/hud/living.dm +++ b/code/_onclick/hud/living.dm @@ -11,6 +11,9 @@ pull_icon.hud = src static_inventory += pull_icon + combo_display = new /atom/movable/screen/combo() + infodisplay += combo_display + //mob health doll! assumes whatever sprite the mob is healthdoll = new /atom/movable/screen/healthdoll/living() healthdoll.hud = src diff --git a/code/_onclick/hud/screen_objects.dm b/code/_onclick/hud/screen_objects.dm index 841da4399e0..7c2b0f6446d 100644 --- a/code/_onclick/hud/screen_objects.dm +++ b/code/_onclick/hud/screen_objects.dm @@ -730,3 +730,28 @@ /atom/movable/screen/component_button/Click(params) if(parent) parent.component_click(src, params) + +/atom/movable/screen/combo + icon_state = "" + mouse_opacity = MOUSE_OPACITY_TRANSPARENT + screen_loc = ui_combo + layer = ABOVE_HUD_LAYER + var/timerid + +/atom/movable/screen/combo/proc/clear_streak() + cut_overlays() + icon_state = "" + +/atom/movable/screen/combo/update_icon_state(streak = "") + clear_streak() + if (timerid) + deltimer(timerid) + if (!streak) + return + timerid = addtimer(CALLBACK(src, .proc/clear_streak), 20, TIMER_UNIQUE | TIMER_STOPPABLE) + icon_state = "combo" + for (var/i = 1; i <= length(streak); ++i) + var/intent_text = copytext(streak, i, i + 1) + var/image/intent_icon = image(icon,src,"combo_[intent_text]") + intent_icon.pixel_x = 16 * (i - 1) - 8 * length(streak) + add_overlay(intent_icon) diff --git a/code/datums/martial/_martial.dm b/code/datums/martial/_martial.dm index 51c12837725..47ae8cd89e0 100644 --- a/code/datums/martial/_martial.dm +++ b/code/datums/martial/_martial.dm @@ -9,6 +9,8 @@ var/help_verb var/allow_temp_override = TRUE //if this martial art can be overridden by temporary martial arts var/smashes_tables = FALSE //If the martial art smashes tables when performing table slams and head smashes + var/datum/weakref/holder //owner of the martial art + var/display_combos = FALSE //shows combo meter if true /datum/martial_art/proc/help_act(mob/living/A, mob/living/D) return FALSE @@ -31,48 +33,55 @@ streak = streak+element if(length(streak) > max_streak_length) streak = copytext(streak, 1 + length(streak[1])) + if (display_combos) + var/mob/living/holder_living = holder.resolve() + holder_living?.hud_used?.combo_display.update_icon_state(streak) /datum/martial_art/proc/reset_streak(mob/living/new_target) current_target = new_target streak = "" + var/mob/living/holder_living = holder.resolve() + holder_living?.hud_used?.combo_display.update_icon_state(streak) -/datum/martial_art/proc/teach(mob/living/owner, make_temporary=FALSE) - if(!istype(owner) || !owner.mind) +/datum/martial_art/proc/teach(mob/living/holder_living, make_temporary=FALSE) + if(!istype(holder_living) || !holder_living.mind) return FALSE - if(owner.mind.martial_art) + if(holder_living.mind.martial_art) if(make_temporary) - if(!owner.mind.martial_art.allow_temp_override) + if(!holder_living.mind.martial_art.allow_temp_override) return FALSE - store(owner.mind.martial_art, owner) + store(holder_living.mind.martial_art, holder_living) else - owner.mind.martial_art.on_remove(owner) + holder_living.mind.martial_art.on_remove(holder_living) else if(make_temporary) - base = owner.mind.default_martial_art + base = holder_living.mind.default_martial_art if(help_verb) - add_verb(owner, help_verb) - owner.mind.martial_art = src + add_verb(holder_living, help_verb) + holder_living.mind.martial_art = src + holder = WEAKREF(holder_living) return TRUE -/datum/martial_art/proc/store(datum/martial_art/old, mob/living/owner) - old.on_remove(owner) +/datum/martial_art/proc/store(datum/martial_art/old, mob/living/holder_living) + old.on_remove(holder_living) if (old.base) //Checks if old is temporary, if so it will not be stored. base = old.base else //Otherwise, old is stored. base = old -/datum/martial_art/proc/remove(mob/living/owner) - if(!istype(owner) || !owner.mind || owner.mind.martial_art != src) +/datum/martial_art/proc/remove(mob/living/holder_living) + if(!istype(holder_living) || !holder_living.mind || holder_living.mind.martial_art != src) return - on_remove(owner) + on_remove(holder_living) if(base) - base.teach(owner) + base.teach(holder_living) else - var/datum/martial_art/default = owner.mind.default_martial_art - default.teach(owner) + var/datum/martial_art/default = holder_living.mind.default_martial_art + default.teach(holder_living) + holder = null -/datum/martial_art/proc/on_remove(mob/living/owner) +/datum/martial_art/proc/on_remove(mob/living/holder_living) if(help_verb) - remove_verb(owner, help_verb) + remove_verb(holder_living, help_verb) return ///Gets called when a projectile hits the owner. Returning anything other than BULLET_ACT_HIT will stop the projectile from hitting the mob. diff --git a/code/datums/martial/cqc.dm b/code/datums/martial/cqc.dm index d28db36b1e6..25d741821f9 100644 --- a/code/datums/martial/cqc.dm +++ b/code/datums/martial/cqc.dm @@ -12,6 +12,7 @@ smashes_tables = TRUE var/old_grab_state = null var/restraining = FALSE + display_combos = TRUE /datum/martial_art/cqc/reset_streak(mob/living/new_target) . = ..() diff --git a/code/datums/martial/plasma_fist.dm b/code/datums/martial/plasma_fist.dm index c87a4d82ca3..3f4e314ad3c 100644 --- a/code/datums/martial/plasma_fist.dm +++ b/code/datums/martial/plasma_fist.dm @@ -10,6 +10,7 @@ var/plasma_power = 1 //starts at a 1, 2, 4 explosion. var/plasma_increment = 1 //how much explosion power gets added per kill (1 = 1, 2, 4. 2 = 2, 4, 8 and so on) var/plasma_cap = 12 //max size explosion level + display_combos = TRUE /datum/martial_art/plasma_fist/proc/check_streak(mob/living/A, mob/living/D) if(findtext(streak,TORNADO_COMBO)) diff --git a/code/datums/martial/sleeping_carp.dm b/code/datums/martial/sleeping_carp.dm index c2eb4ceabf4..203bef763bf 100644 --- a/code/datums/martial/sleeping_carp.dm +++ b/code/datums/martial/sleeping_carp.dm @@ -7,6 +7,7 @@ id = MARTIALART_SLEEPINGCARP allow_temp_override = FALSE help_verb = /mob/living/proc/sleeping_carp_help + display_combos = TRUE /datum/martial_art/the_sleeping_carp/proc/check_streak(mob/living/A, mob/living/D) if(findtext(streak,STRONG_PUNCH_COMBO)) diff --git a/icons/hud/screen_gen.dmi b/icons/hud/screen_gen.dmi index d0abe42459e..5fdfbdaceef 100644 Binary files a/icons/hud/screen_gen.dmi and b/icons/hud/screen_gen.dmi differ