diff --git a/code/_onclick/hud/_defines.dm b/code/_onclick/hud/_defines.dm index cbe745051c0..f976fd77744 100644 --- a/code/_onclick/hud/_defines.dm +++ b/code/_onclick/hud/_defines.dm @@ -37,6 +37,7 @@ #define ui_storage1 "CENTER+1:18,SOUTH:5" #define ui_storage2 "CENTER+2:20,SOUTH:5" #define ui_pda "CENTER+3:22,SOUTH:5" +#define ui_combo "CENTER+4:24,SOUTH+1:7" //combo meter for martial arts #define ui_alien_head "4:12,1:5" //aliens #define ui_alien_oclothing "5:14,1:5" //aliens diff --git a/code/_onclick/hud/hud.dm b/code/_onclick/hud/hud.dm index e4561e5b0d6..dcc9100060d 100644 --- a/code/_onclick/hud/hud.dm +++ b/code/_onclick/hud/hud.dm @@ -29,6 +29,7 @@ var/obj/screen/zone_select var/obj/screen/move_intent var/obj/screen/module_store_icon + var/obj/screen/combo/combo_display var/obj/screen/devil/soul_counter/devilsouldisplay diff --git a/code/_onclick/hud/human.dm b/code/_onclick/hud/human.dm index 74bd9db4f16..3377fab1db0 100644 --- a/code/_onclick/hud/human.dm +++ b/code/_onclick/hud/human.dm @@ -401,6 +401,10 @@ inventory_shown = FALSE + combo_display = new() + infodisplay += combo_display + + for(var/obj/screen/inventory/inv in (static_inventory + toggleable_inventory)) if(inv.slot_id) inv.hud = src diff --git a/code/modules/martial_arts/martial.dm b/code/modules/martial_arts/martial.dm index a828fcdea2c..afd17d18a5b 100644 --- a/code/modules/martial_arts/martial.dm +++ b/code/modules/martial_arts/martial.dm @@ -4,8 +4,9 @@ /datum/martial_art var/name = "Martial Art" var/streak = "" - var/max_streak_length = 6 + // var/max_streak_length = 6 var/temporary = FALSE + var/owner_UID /// The permanent style. var/datum/martial_art/base = null /// Chance to deflect projectiles while on throw mode. @@ -33,7 +34,9 @@ /// What combos are currently (possibly) being performed. var/list/datum/martial_art/current_combos = list() /// When the last hit happened. - var/last_hit = 0 + // var/last_hit = 0 + /// Stores the timer_id for the combo timeout timer + var/combo_timer /// If the user is preparing a martial arts stance. var/in_stance = FALSE @@ -59,16 +62,26 @@ /datum/martial_art/proc/act(step, mob/living/carbon/human/user, mob/living/carbon/human/target) if(!can_use(user)) return MARTIAL_ARTS_CANNOT_USE + if(combo_timer) + deltimer(combo_timer) +/* if(last_hit + COMBO_ALIVE_TIME < world.time) reset_combos() last_hit = world.time - +*/ + combo_timer = addtimer(CALLBACK(src, PROC_REF(reset_combos)), COMBO_ALIVE_TIME, TIMER_UNIQUE | TIMER_STOPPABLE) + streak += intent_to_streak(step) + var/mob/living/carbon/human/owner = locateUID(owner_UID) + owner?.hud_used.combo_display.update_icon(ALL, streak) if(HAS_COMBOS) return check_combos(step, user, target) return FALSE /datum/martial_art/proc/reset_combos() current_combos.Cut() + streak = "" + var/mob/living/carbon/human/owner = locateUID(owner_UID) + owner?.hud_used.combo_display.update_icon(ALL, streak) for(var/combo_type in combos) current_combos.Add(new combo_type()) @@ -174,6 +187,7 @@ base = H.mind.martial_art.base else base = src + owner_UID = H.UID() H.mind.martial_art = src /datum/martial_art/proc/remove(var/mob/living/carbon/human/H) @@ -234,6 +248,17 @@ /datum/martial_art/proc/try_deflect(mob/user) return prob(deflection_chance) +/datum/martial_art/proc/intent_to_streak(intent) + switch(intent) + if(MARTIAL_COMBO_STEP_HARM) + return "E" // these hands are rated E for everyone + if(MARTIAL_COMBO_STEP_DISARM) + return "D" + if(MARTIAL_COMBO_STEP_GRAB) + return "G" + if(MARTIAL_COMBO_STEP_HELP) + return "H" + //ITEMS /obj/item/clothing/gloves/boxing @@ -507,5 +532,31 @@ return ..() return 0 +/obj/screen/combo + icon_state = "" + mouse_opacity = MOUSE_OPACITY_TRANSPARENT + screen_loc = ui_combo + layer = ABOVE_HUD_LAYER + var/streak + +/obj/screen/combo/proc/clear_streak() + cut_overlays() + streak = "" + icon_state = "" + +/obj/screen/combo/update_icon(updates, _streak) + streak = _streak + icon_state = "" + if(!streak) + clear_streak() + return + icon_state = "combo" + for(var/i in 1 to length(streak)) + 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) + overlays += intent_icon + return ..() + #undef HAS_COMBOS #undef COMBO_ALIVE_TIME diff --git a/icons/mob/screen_gen.dmi b/icons/mob/screen_gen.dmi index 9fedb927b9f..79ec236c898 100644 Binary files a/icons/mob/screen_gen.dmi and b/icons/mob/screen_gen.dmi differ