From 8d4276851e6446521288e97c0d0e95258b558fb0 Mon Sep 17 00:00:00 2001 From: Eisendrachen Date: Sat, 12 Mar 2022 02:25:16 -0600 Subject: [PATCH] Combat Indicator It indicates combat --- code/__DEFINES/keybinding.dm | 1 + code/datums/keybinding/mob.dm | 4 +- .../combat_indicator/code/combat_indicator.dm | 57 ++++++++++++++++++ .../icons/combat_indicator.dmi | Bin 0 -> 749 bytes code/modules/mob/living/death.dm | 1 + code/modules/mob/living/emote_popup.dm | 19 ++++++ icons/mob/popup_flicks.dmi | Bin 0 -> 520 bytes tgstation.dme | 2 + 8 files changed, 82 insertions(+), 2 deletions(-) create mode 100644 code/modules/combat_indicator/code/combat_indicator.dm create mode 100644 code/modules/combat_indicator/icons/combat_indicator.dmi create mode 100644 code/modules/mob/living/emote_popup.dm create mode 100644 icons/mob/popup_flicks.dmi diff --git a/code/__DEFINES/keybinding.dm b/code/__DEFINES/keybinding.dm index 2fc4f935809..ddfc01fd3e5 100644 --- a/code/__DEFINES/keybinding.dm +++ b/code/__DEFINES/keybinding.dm @@ -3,6 +3,7 @@ //General #define COMSIG_KB_ACTIVATED (1<<0) #define COMSIG_KB_EMOTE "keybinding_emote_down" +#define COMSIG_KB_LIVING_COMBAT_INDICATOR "keybinding_living_combat_indicator" //Admin #define COMSIG_KB_ADMIN_ASAY_DOWN "keybinding_admin_asay_down" diff --git a/code/datums/keybinding/mob.dm b/code/datums/keybinding/mob.dm index eb4fa2f31c3..cb993bbf0e8 100644 --- a/code/datums/keybinding/mob.dm +++ b/code/datums/keybinding/mob.dm @@ -72,7 +72,7 @@ return TRUE /datum/keybinding/mob/toggle_move_intent - hotkey_keys = list("C") + hotkey_keys = list("Alt") //PARIAH EDIT CHANGE - COMBAT_INDICATOR name = "toggle_move_intent" full_name = "Hold to toggle move intent" description = "Held down to cycle to the other move intent, release to cycle back" @@ -233,7 +233,7 @@ return TRUE /datum/keybinding/mob/prevent_movement - hotkey_keys = list("Alt") + hotkey_keys = list("Unbound") name = "block_movement" full_name = "Block movement" description = "Prevents you from moving" diff --git a/code/modules/combat_indicator/code/combat_indicator.dm b/code/modules/combat_indicator/code/combat_indicator.dm new file mode 100644 index 00000000000..f9ea9e8d186 --- /dev/null +++ b/code/modules/combat_indicator/code/combat_indicator.dm @@ -0,0 +1,57 @@ +#define COMBAT_NOTICE_COOLDOWN 10 SECONDS +GLOBAL_VAR_INIT(combat_indicator_overlay, GenerateCombatOverlay()) + +/proc/GenerateCombatOverlay() + var/mutable_appearance/combat_indicator = mutable_appearance('code/modules/combat_indicator/icons/combat_indicator.dmi', "combat", FLY_LAYER) + combat_indicator.appearance_flags = APPEARANCE_UI_IGNORE_ALPHA | KEEP_APART + return combat_indicator + +/mob/living + var/combat_indicator = FALSE + var/nextcombatpopup = 0 + +/mob/living/proc/combat_indicator_unconscious_signal() + set_combat_indicator(FALSE) + +/mob/living/proc/set_combat_indicator(state) + if(combat_indicator == state) + return + + combat_indicator = state + + if(combat_indicator) + if(world.time > nextcombatpopup) + nextcombatpopup = world.time + COMBAT_NOTICE_COOLDOWN + playsound(src, 'sound/machines/chime.ogg', 10) + flick_emote_popup_on_mob("combat", 20) + visible_message("[src] gets ready for combat!") + add_overlay(GLOB.combat_indicator_overlay) + combat_indicator = TRUE + src.log_message("has turned ON the combat indicator!", INDIVIDUAL_ATTACK_LOG) + RegisterSignal(src, COMSIG_LIVING_STATUS_UNCONSCIOUS, .proc/combat_indicator_unconscious_signal) + else + cut_overlay(GLOB.combat_indicator_overlay) + combat_indicator = FALSE + src.log_message("has turned OFF the combat indicator!", INDIVIDUAL_ATTACK_LOG) + UnregisterSignal(src, COMSIG_LIVING_STATUS_UNCONSCIOUS) + +/mob/living/proc/user_toggle_combat_indicator() + if(stat != CONSCIOUS) + return + set_combat_indicator(!combat_indicator) + +#undef COMBAT_NOTICE_COOLDOWN + +/datum/keybinding/living/combat_indicator + hotkey_keys = list("C") + name = "combat_indicator" + full_name = "Combat Indicator" + description = "Indicates that you're escalating to mechanics. YOU NEED TO USE THIS" + keybind_signal = COMSIG_KB_LIVING_COMBAT_INDICATOR + +/datum/keybinding/living/combat_indicator/down(client/user) + . = ..() + if(.) + return + var/mob/living/L = user.mob + L.user_toggle_combat_indicator() diff --git a/code/modules/combat_indicator/icons/combat_indicator.dmi b/code/modules/combat_indicator/icons/combat_indicator.dmi new file mode 100644 index 0000000000000000000000000000000000000000..f4987e829ba8a191cb589cb0ee8bc9e04febf0da GIT binary patch literal 749 zcmeAS@N?(olHy`uVBq!ia0vp^4M3d0!3HF+R#kZdsrssrh!U67;^d;tf|AVqJO+k} zIl0F-avd@dV0-ZMoo3yw&?6z&qg7muw!9ZOo5{4T^+`ZYHGBBaW$TYu?rD*%3{0AyE{-7;bKc(FoqISyfc0YR!KDTPoPKv0BiBZ< zco!Uq+QO&8wdp~HeB;c?KPJaGNpuMC*rkWI?$BGT?~p9XFo*E~f~YO&OMO;W6CXN% z?(KK~_uv17#}a#-<|P&ll>9S@6q{;8{eN_Z+d>> z+Q<37@7~V;?fhpmP+LIgd`ZEb?&lfy@{P{-PEPJI_Ezg<1*vZY?DckNO@cv->o$oaa7WQn1h_x8I zx|n>1nbEqZul>vTQf#;Vv6S0e`RfKn|G$3Cx0P2=QmU_Oo5wG3S!Cxr=kw|vJLZcU zWbJ>q|Ax}8|FwTU)>Ivt;l9LwOMT?^fAxv~H^pDiPAOq8IQ0DS%HPv#_wN@jx09^7?^$;JYD@<);T3K0RURpK|KHf literal 0 HcmV?d00001 diff --git a/code/modules/mob/living/death.dm b/code/modules/mob/living/death.dm index 66b194ccc4c..062cf6c1cea 100644 --- a/code/modules/mob/living/death.dm +++ b/code/modules/mob/living/death.dm @@ -91,6 +91,7 @@ med_hud_set_status() stop_pulling() + set_combat_indicator(FALSE) //PARIAH EDIT ADDITION - COMBAT_INDICATOR SEND_SIGNAL(src, COMSIG_LIVING_DEATH, gibbed) SEND_GLOBAL_SIGNAL(COMSIG_GLOB_MOB_DEATH, src, gibbed) diff --git a/code/modules/mob/living/emote_popup.dm b/code/modules/mob/living/emote_popup.dm new file mode 100644 index 00000000000..da03c25ec6f --- /dev/null +++ b/code/modules/mob/living/emote_popup.dm @@ -0,0 +1,19 @@ +/obj/effect/overlay/emote_popup + icon = 'icons/mob/popup_flicks.dmi' + icon_state = "combat" + layer = FLY_LAYER + plane = GAME_PLANE + appearance_flags = APPEARANCE_UI_IGNORE_ALPHA | KEEP_APART + mouse_opacity = 0 + +/mob/living/proc/flick_emote_popup_on_mob(state, time) + var/obj/effect/overlay/emote_popup/I = new + I.icon_state = state + vis_contents += I + animate(I, alpha = 255, time = 5, easing = BOUNCE_EASING, pixel_y = 10) + addtimer(CALLBACK(src, .proc/remove_emote_popup_on_mob, I), time) + +/mob/living/proc/remove_emote_popup_on_mob(obj/effect/overlay/emote_popup/I) + vis_contents -= I + qdel(I) + return diff --git a/icons/mob/popup_flicks.dmi b/icons/mob/popup_flicks.dmi new file mode 100644 index 0000000000000000000000000000000000000000..4224b98ac6e4567adcec05e04a99fbaf19fd3336 GIT binary patch literal 520 zcmV+j0{8uiP)V=-0C=2*%P|hZFc1aN+Ixzxq(=m3-5^KEMREs&7i@{d(RxX)PXQ7o-AwUX zocoI(;Ra7DOU-45#c8)Ev*oA>7RLjb#QBl*GgX5!ESmZf;W@H2WMY;Ii;m1)!o=Tx zma@R2`FFme|Bg83AXE1GvalcfV(xXKO(=ve^Iaa89Y@9fE|FX1i%i! zRsvuLU@HNz1F)3<*a6r|0PFy4B>;8+wh{n409y%w9e}NW58xZEZiB4?6$7jQ0000< KMNUMnLSTZ9DBbJ; literal 0 HcmV?d00001 diff --git a/tgstation.dme b/tgstation.dme index c41d3371caa..2d33364bccf 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -2593,6 +2593,7 @@ #include "code\modules\clothing\under\jobs\Plasmaman\engineering.dm" #include "code\modules\clothing\under\jobs\Plasmaman\medsci.dm" #include "code\modules\clothing\under\jobs\Plasmaman\security.dm" +#include "code\modules\combat_indicator\code\combat_indicator.dm" #include "code\modules\detectivework\detective_work.dm" #include "code\modules\detectivework\evidence.dm" #include "code\modules\detectivework\footprints_and_rag.dm" @@ -3078,6 +3079,7 @@ #include "code\modules\mob\living\damage_procs.dm" #include "code\modules\mob\living\death.dm" #include "code\modules\mob\living\emote.dm" +#include "code\modules\mob\living\emote_popup.dm" #include "code\modules\mob\living\inhand_holder.dm" #include "code\modules\mob\living\init_signals.dm" #include "code\modules\mob\living\life.dm"