Skip to content

Commit

Permalink
Merge pull request #65 from Starfly-13/SSD-Indicators-Will-Be-Real-In…
Browse files Browse the repository at this point in the history
…-2020-

SSD-Indicators-Will-Be-Real-In-2020-
  • Loading branch information
lectronyx authored Jun 13, 2024
2 parents ee1c8e3 + 59867b4 commit 55268e0
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 17 deletions.
5 changes: 3 additions & 2 deletions code/modules/mob/living/carbon/human/examine.dm
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@
if(!key)
msg += "<span class='deadsay'>[t_He] [t_is] totally catatonic. The stresses of life in deep-space must have been too much for [t_him]. Any recovery is unlikely.</span>\n"
else if(!client)
msg += "<span class='warning'>[t_He] appears to be suffering from SSD - Space Sleep Disorder. [t_He] may snap out of it at any time! Or maybe never. It's best to leave [t_him] be.</span>\n"
msg += "<span class='warning'>[t_He] [t_has] been suffering from SSD - Space Sleep Disorder - for [trunc(((world.time - lastclienttime) / (1 MINUTES)))] minutes. [t_He] may snap out of it at any time! Or maybe never. It's best to leave [t_him] be.</span>\n"
if (length(msg))
. += "<span class='warning'>[msg.Join("")]</span>"

Expand Down Expand Up @@ -416,4 +416,5 @@
. = ..()
if ((wear_mask && (wear_mask.flags_inv & HIDEFACE)) || (head && (head.flags_inv & HIDEFACE)))
return
. += list(span_notice("[p_they(TRUE)] appear[p_s()] to be [get_age()]."))
if(get_age())
. += list(span_notice("[p_they(TRUE)] appear[p_s()] to be [get_age()]."))
9 changes: 6 additions & 3 deletions code/modules/mob/living/carbon/life.dm
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,12 @@
if(.) //not dead
handle_blood()

if(isLivingSSD())//if you're disconnected, you're going to sleep
if(AmountSleeping() < 20)
AdjustSleeping(20)//adjust every 10 seconds
if(isLivingSSD()) // If you're disconnected, you're going to sleep
if(trunc((world.time - lastclienttime) / (3 MINUTES)) > 0) // After a three minute grace period, your character will fall asleep
if(AmountSleeping() < 20)
AdjustSleeping(20) // Adjust every 10 seconds
if(ssd_indicator)
cut_overlay(GLOB.ssd_indicator_overlay) // Prevents chronically SSD players from breaking immersion

if(stat != DEAD)
var/bprv = handle_bodyparts()
Expand Down
41 changes: 29 additions & 12 deletions code/modules/mob/living/living.dm
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@

/mob/living/proc/get_up(instant = FALSE)
set waitfor = FALSE
if(!instant && !do_mob(src, src, 2 SECONDS, uninterruptible = TRUE, extra_checks = CALLBACK(src, TYPE_PROC_REF(/mob/living, rest_checks_callback))))
if(!instant && !do_after(src, 1 SECONDS, src, timed_action_flags = (IGNORE_USER_LOC_CHANGE|IGNORE_TARGET_LOC_CHANGE|IGNORE_HELD_ITEM), extra_checks = CALLBACK(src, TYPE_PROC_REF(/mob/living, rest_checks_callback)), interaction_key = DOAFTER_SOURCE_GETTING_UP))
return
if(resting || body_position == STANDING_UP || HAS_TRAIT(src, TRAIT_FLOORED))
return
Expand Down Expand Up @@ -977,7 +977,7 @@
"<span class='userdanger'>[src] tries to remove your [what.name].</span>", null, null, src)
to_chat(src, "<span class='danger'>You try to remove [who]'s [what.name]...</span>")
what.add_fingerprint(src)
if(do_mob(src, who, what.strip_delay))
if(do_after(src, what.strip_delay, who, interaction_key = what))
if(what && Adjacent(who))
if(islist(where))
var/list/L = where
Expand Down Expand Up @@ -1024,7 +1024,7 @@
who.visible_message("<span class='notice'>[src] tries to put [what] on [who].</span>", \
"<span class='notice'>[src] tries to put [what] on you.</span>", null, null, src)
to_chat(src, "<span class='notice'>You try to put [what] on [who]...</span>")
if(do_mob(src, who, what.equip_delay_other))
if(do_after(src, what.equip_delay_other, who))
if(what && Adjacent(who) && what.mob_can_equip(who, src, final_where, TRUE, TRUE))
if(temporarilyRemoveItemFromInventory(what))
if(where_list)
Expand Down Expand Up @@ -1144,15 +1144,6 @@
devilInfo.remove_soul(mind)
mind.soulOwner = mind

/mob/living/proc/has_bane(banetype)
var/datum/antagonist/devil/devilInfo = is_devil(src)
return devilInfo && banetype == devilInfo.bane

/mob/living/proc/check_weakness(obj/item/weapon, mob/living/attacker)
if(mind && mind.has_antag_datum(/datum/antagonist/devil))
return check_devil_bane_multiplier(weapon, attacker)
return 1 //This is not a boolean, it's the multiplier for the damage the weapon does.

/mob/living/proc/check_acedia()
if(mind && mind.has_objective(/datum/objective/sintouched/acedia))
return TRUE
Expand Down Expand Up @@ -1419,6 +1410,32 @@
if(player_logged && stat != DEAD)
return TRUE

// The above code is kept to prevent old SSD behavior from breaking, while the code below is dedicated to the SSD Indicator

GLOBAL_VAR_INIT(ssd_indicator_overlay, mutable_appearance('icons/mob/ssd_indicator.dmi', "default0", RUNECHAT_PLANE))

/mob/living
var/ssd_indicator = FALSE
var/lastclienttime = 0

/mob/living/proc/set_ssd_indicator(state)
if(state == ssd_indicator)
return
ssd_indicator = state
if(ssd_indicator && stat != DEAD)
add_overlay(GLOB.ssd_indicator_overlay)
else
cut_overlay(GLOB.ssd_indicator_overlay)

/mob/living/Login()
. = ..()
set_ssd_indicator(FALSE)

/mob/living/Logout()
. = ..()
lastclienttime = world.time
set_ssd_indicator(TRUE)

/mob/living/vv_get_header()
. = ..()
var/refid = REF(src)
Expand Down
Binary file added icons/mob/ssd_indicator.dmi
Binary file not shown.

0 comments on commit 55268e0

Please sign in to comment.