diff --git a/code/_onclick/hud/_defines.dm b/code/_onclick/hud/_defines.dm index f8dfc703f0..2831e25b10 100644 --- a/code/_onclick/hud/_defines.dm +++ b/code/_onclick/hud/_defines.dm @@ -47,6 +47,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 fbd62f0565..1eb13d20f6 100644 --- a/code/_onclick/hud/hud.dm +++ b/code/_onclick/hud/hud.dm @@ -33,6 +33,8 @@ 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/devil/soul_counter/devilsouldisplay var/atom/movable/screen/synth/coolant_counter/coolant_display @@ -130,6 +132,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 5ed20f69e6..9547ee6f86 100644 --- a/code/_onclick/hud/human.dm +++ b/code/_onclick/hud/human.dm @@ -461,6 +461,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/screen_objects.dm b/code/_onclick/hud/screen_objects.dm index 6ca0416dfd..33c0bb0f04 100644 --- a/code/_onclick/hud/screen_objects.dm +++ b/code/_onclick/hud/screen_objects.dm @@ -720,3 +720,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 19cfc7691d..ce94cb3008 100644 --- a/code/datums/martial/_martial.dm +++ b/code/datums/martial/_martial.dm @@ -15,6 +15,8 @@ /// Set this variable to something not null, this'll be the preferred unarmed parry in most cases if [can_martial_parry] is TRUE. YOU MUST RUN [get_block_parry_data(this)] INSTEAD OF DIRECTLY ACCESSING! var/datum/block_parry_data/block_parry_data var/pugilist = FALSE + var/datum/weakref/holder //owner of the martial art + var/display_combos = FALSE //shows combo meter if true /datum/martial_art/proc/disarm_act(mob/living/carbon/human/A, mob/living/carbon/human/D) return FALSE @@ -25,7 +27,7 @@ /datum/martial_art/proc/grab_act(mob/living/carbon/human/A, mob/living/carbon/human/D) return FALSE -/datum/martial_art/proc/can_use(mob/living/carbon/human/H) +/datum/martial_art/proc/can_use(mob/living/carbon/human/owner_human) return TRUE /datum/martial_art/proc/add_to_streak(element,mob/living/carbon/human/D) @@ -34,11 +36,16 @@ 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) return /datum/martial_art/proc/reset_streak(mob/living/carbon/human/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/damage_roll(mob/living/carbon/human/A, mob/living/carbon/human/D) //Here we roll for our damage to be added into the damage var in the various attack procs. This is changed depending on whether we are in combat mode, lying down, or if our target is in combat mode. @@ -47,46 +54,48 @@ damage *= 0.7 return damage -/datum/martial_art/proc/teach(mob/living/carbon/human/H, make_temporary = FALSE) - if(!istype(H) || !H.mind) +/datum/martial_art/proc/teach(mob/living/carbon/human/owner_human, make_temporary = FALSE) + if(!istype(owner_human) || !owner_human.mind) return FALSE - if(H.mind.martial_art) + if(owner_human.mind.martial_art) if(make_temporary) - if(!H.mind.martial_art.allow_temp_override) + if(!owner_human.mind.martial_art.allow_temp_override) return FALSE - store(H.mind.martial_art,H) + store(owner_human.mind.martial_art,owner_human) else - H.mind.martial_art.on_remove(H) + owner_human.mind.martial_art.on_remove(owner_human) else if(make_temporary) - base = H.mind.default_martial_art + base = owner_human.mind.default_martial_art if(help_verb) - add_verb(H, help_verb) - H.mind.martial_art = src + add_verb(owner_human, help_verb) + owner_human.mind.martial_art = src + holder = WEAKREF(owner_human) if(pugilist) - ADD_TRAIT(H, TRAIT_PUGILIST, MARTIAL_ARTIST_TRAIT) + ADD_TRAIT(owner_human, TRAIT_PUGILIST, MARTIAL_ARTIST_TRAIT) return TRUE -/datum/martial_art/proc/store(datum/martial_art/M,mob/living/carbon/human/H) - M.on_remove(H) +/datum/martial_art/proc/store(datum/martial_art/M,mob/living/carbon/human/owner_human) + M.on_remove(owner_human) if(M.base) //Checks if M is temporary, if so it will not be stored. base = M.base else //Otherwise, M is stored. base = M -/datum/martial_art/proc/remove(mob/living/carbon/human/H) - if(!istype(H) || !H.mind || H.mind.martial_art != src) +/datum/martial_art/proc/remove(mob/living/carbon/human/owner_human) + if(!istype(owner_human) || !owner_human.mind || owner_human.mind.martial_art != src) return - on_remove(H) + on_remove(owner_human) if(base) - base.teach(H) + base.teach(owner_human) else - var/datum/martial_art/X = H.mind.default_martial_art - X.teach(H) - REMOVE_TRAIT(H, TRAIT_PUGILIST, MARTIAL_ARTIST_TRAIT) + var/datum/martial_art/X = owner_human.mind.default_martial_art + X.teach(owner_human) + REMOVE_TRAIT(owner_human, TRAIT_PUGILIST, MARTIAL_ARTIST_TRAIT) + holder = null -/datum/martial_art/proc/on_remove(mob/living/carbon/human/H) +/datum/martial_art/proc/on_remove(mob/living/carbon/human/owner_human) if(help_verb) - remove_verb(H, help_verb) + remove_verb(owner_human, 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 1d6682e3a6..afc1a26659 100644 --- a/code/datums/martial/cqc.dm +++ b/code/datums/martial/cqc.dm @@ -11,6 +11,7 @@ block_chance = 75 pugilist = TRUE var/old_grab_state = null + display_combos = TRUE /datum/martial_art/cqc/reset_streak(mob/living/carbon/human/new_target) . = ..() diff --git a/code/datums/martial/plasma_fist.dm b/code/datums/martial/plasma_fist.dm index 16ffb381aa..59de1f6ec1 100644 --- a/code/datums/martial/plasma_fist.dm +++ b/code/datums/martial/plasma_fist.dm @@ -7,6 +7,7 @@ id = MARTIALART_PLASMAFIST help_verb = /mob/living/carbon/human/proc/plasma_fist_help pugilist = TRUE + display_combos = TRUE /datum/martial_art/plasma_fist/proc/check_streak(mob/living/carbon/human/A, mob/living/carbon/human/D) diff --git a/code/datums/martial/rising_bass.dm b/code/datums/martial/rising_bass.dm index 0d77644c86..87c0d42a29 100644 --- a/code/datums/martial/rising_bass.dm +++ b/code/datums/martial/rising_bass.dm @@ -13,6 +13,7 @@ var/datum/action/risingbassmove/sidekick = new/datum/action/risingbassmove/sidekick() var/datum/action/risingbassmove/deftswitch = new/datum/action/risingbassmove/deftswitch() var/repulsecool = 0 + display_combos = TRUE /datum/martial_art/the_rising_bass/proc/check_streak(mob/living/carbon/human/A, mob/living/carbon/human/D) if(findtext(streak,SIDE_KICK_COMBO)) diff --git a/code/datums/martial/sleeping_carp.dm b/code/datums/martial/sleeping_carp.dm index bac1614228..d0cdee4937 100644 --- a/code/datums/martial/sleeping_carp.dm +++ b/code/datums/martial/sleeping_carp.dm @@ -9,6 +9,7 @@ help_verb = /mob/living/carbon/human/proc/sleeping_carp_help block_parry_data = /datum/block_parry_data/sleeping_carp pugilist = TRUE + display_combos = TRUE /datum/martial_art/the_sleeping_carp/proc/check_streak(mob/living/carbon/human/A, mob/living/carbon/human/D) if(findtext(streak,STRONG_PUNCH_COMBO)) diff --git a/icons/mob/screen_gen.dmi b/icons/mob/screen_gen.dmi index 4377a0d7c6..39e8eb4b45 100644 Binary files a/icons/mob/screen_gen.dmi and b/icons/mob/screen_gen.dmi differ