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 00000000000..f4987e829ba Binary files /dev/null and b/code/modules/combat_indicator/icons/combat_indicator.dmi differ 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 00000000000..4224b98ac6e Binary files /dev/null and b/icons/mob/popup_flicks.dmi differ 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"