From 38b2903260ee63cc22602aaced5d0fc42c0374c4 Mon Sep 17 00:00:00 2001 From: QuoteFox <49098813+quotefox@users.noreply.github.com> Date: Tue, 4 May 2021 13:57:39 +0100 Subject: [PATCH] SSD indicators and Status Indicator frame work --- code/modules/mob/living/carbon/life.dm | 5 ++ code/modules/mob/typing_indicator.dm | 1 + .../modules/mob/living/status_indicators.dm | 51 ++++++++++++++++++ hyperstation/icons/mob/status_indicators.dmi | Bin 0 -> 885 bytes tgstation.dme | 1 + 5 files changed, 58 insertions(+) create mode 100644 hyperstation/code/modules/mob/living/status_indicators.dm create mode 100644 hyperstation/icons/mob/status_indicators.dmi diff --git a/code/modules/mob/living/carbon/life.dm b/code/modules/mob/living/carbon/life.dm index d9493d6f..8e29859a 100644 --- a/code/modules/mob/living/carbon/life.dm +++ b/code/modules/mob/living/carbon/life.dm @@ -556,6 +556,11 @@ GLOBAL_LIST_INIT(ballmer_windows_me_msg, list("Yo man, what if, we like, uh, put var/restingpwr = 1 + 4 * resting + if(!client) + add_status_indicator("ssd") + else + remove_status_indicator("ssd") + //Dizziness if(dizziness) var/client/C = client diff --git a/code/modules/mob/typing_indicator.dm b/code/modules/mob/typing_indicator.dm index d7ce4dce..0c6b6f0d 100644 --- a/code/modules/mob/typing_indicator.dm +++ b/code/modules/mob/typing_indicator.dm @@ -52,5 +52,6 @@ GLOBAL_LIST_EMPTY(typing_indicator_overlays) mouse_opacity = MOUSE_OPACITY_TRANSPARENT icon = 'icons/mob/talk.dmi' icon_state = "normal_typing" + appearance_flags = RESET_COLOR | TILE_BOUND | PIXEL_SCALE layer = ABOVE_FLY_LAYER diff --git a/hyperstation/code/modules/mob/living/status_indicators.dm b/hyperstation/code/modules/mob/living/status_indicators.dm new file mode 100644 index 00000000..b22337df --- /dev/null +++ b/hyperstation/code/modules/mob/living/status_indicators.dm @@ -0,0 +1,51 @@ +//Ported from virgo, with some touch ups to make it work with our code. + +/mob/living + var/list/status_indicators = null // Will become a list as needed. + +/mob/living/proc/add_status_indicator(mutable_appearance/thing) + if(get_status_indicator(thing)) + return + + if(!istype(thing, /mutable_appearance)) + thing = mutable_appearance('hyperstation/icons/mob/status_indicators.dmi', icon_state = thing) + + LAZYADD(status_indicators, thing) + handle_status_indicators() + +/mob/living/proc/remove_status_indicator(mutable_appearance/thing) + thing = get_status_indicator(thing) + + cut_overlay(thing) + LAZYREMOVE(status_indicators, thing) + handle_status_indicators() + +/mob/living/proc/get_status_indicator(mutable_appearance/thing) + if(!istype(thing, /mutable_appearance)) + for(var/mutable_appearance/I in status_indicators) + if(I.icon_state == thing) + return I + return LAZYACCESS(status_indicators, LAZYFIND(status_indicators, thing)) + +/mob/living/proc/handle_status_indicators() + // First, get rid of all the overlays. + for(var/thing in status_indicators) + cut_overlay(thing) + + if(!LAZYLEN(status_indicators)) + return + + if(stat == DEAD) + return + + // Now the indicator row can actually be built. + for(var/thing in status_indicators) + var/mutable_appearance/I = thing + + I.appearance_flags = PIXEL_SCALE|KEEP_APART + I.mouse_opacity = MOUSE_OPACITY_TRANSPARENT + I.plane = HUD_PLANE + I.layer = ABOVE_FLY_LAYER + I.pixel_y = 18 + I.pixel_x = 18 + add_overlay(I) diff --git a/hyperstation/icons/mob/status_indicators.dmi b/hyperstation/icons/mob/status_indicators.dmi new file mode 100644 index 0000000000000000000000000000000000000000..23b55ae187ff650c643db1e5c41c645ae316aa5b GIT binary patch literal 885 zcmV-*1B(2KP)FKt%wyZKT)YQ}#78df`t?s*5>8?2P%!AmSCi2skWl3;6CPnb-^3%uIDH$+OHCyG| z>A=9iCnP5p6&4W?5kNrMIRF3v0d!JMQvg8b*k%9#0E~K6Sad{Xb7OL8aCB*JZU6vy zoKseCa&`CgQ*iP1h>VYbT@O!zO1nl6N@@HB$cStXF^*P_{GEw5q-<+az&wxIn;LpE8zN;-)LDHbEv-z zrl18v-+6`b>Q93)CF?7EdZnvMd-ctLoEVUo9=*~luZm;+VK7D$1Nun;({(^!4VJqG zn)$x5Z1wwi9_J}5ihrS!|dYP^W zxGq6YAoF3Ki?jKE2S_}YRsjdclA8HG))tN6;M0Bk_dID0b<;F$_sYLGFis16`)K`L zwn^UEAWPiE?lX{QFl!+qQTS`xS+GbpLATd+Xl|!aTZvHh})V@6vd5|7w7~ zMgLw9=JEZ*MAHFusa)(I-$&KpYteP-Toinf3As5C(K9*|!bkHc;O-d^4vzlJgV?`e zh12KVyEHxw<9PYG-dx?gZxG+Vt#2G}ufpWLJLJzkr!a5tI3LE#9kJiDyJw*C_iq@l z2v(T0cbwxbKW=(2%-cK8ZQ literal 0 HcmV?d00001 diff --git a/tgstation.dme b/tgstation.dme index aee9875b..082aeadc 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -3086,6 +3086,7 @@ #include "hyperstation\code\modules\economy\account.dm" #include "hyperstation\code\modules\integrated_electronics\input.dm" #include "hyperstation\code\modules\mob\mob_helpers.dm" +#include "hyperstation\code\modules\mob\living\status_indicators.dm" #include "hyperstation\code\modules\patreon\patreon.dm" #include "hyperstation\code\modules\reagents\chemistry\reagents\food_reagents.dm" #include "hyperstation\code\modules\reagents\chemistry\reagents\hydroponics_reactions.dm"