Implements Status Indicators

This commit is contained in:
Atermonera
2020-07-30 12:29:46 -07:00
committed by VirgoBot
parent daa3307d25
commit 65cfe5f6e3
39 changed files with 311 additions and 68 deletions

View File

@@ -138,6 +138,8 @@ What is the naming convention for planes or layers?
#define PLANE_MESONS 30 //Stuff seen with mesons, like open ceilings. This is 30 for downstreams. #define PLANE_MESONS 30 //Stuff seen with mesons, like open ceilings. This is 30 for downstreams.
#define PLANE_STATUS 31 //Status Indicators that show over mobs' heads when certain things like stuns affect them.
#define PLANE_ADMIN2 33 //Purely for shenanigans (above lighting) #define PLANE_ADMIN2 33 //Purely for shenanigans (above lighting)
#define PLANE_BUILDMODE 39 //Things that only show up when you have buildmode on #define PLANE_BUILDMODE 39 //Things that only show up when you have buildmode on

View File

@@ -399,7 +399,9 @@
#define VIS_CLOAKED 23 #define VIS_CLOAKED 23
#define VIS_COUNT 23 //Must be highest number from above. #define VIS_STATUS 24
#define VIS_COUNT 24 //Must be highest number from above.
//Some mob icon layering defines //Some mob icon layering defines
#define BODY_LAYER -100 #define BODY_LAYER -100

View File

@@ -19,6 +19,8 @@
var/icon_scale_x = 1 // Used to scale icons up or down horizonally in update_transform(). var/icon_scale_x = 1 // Used to scale icons up or down horizonally in update_transform().
var/icon_scale_y = 1 // Used to scale icons up or down vertically in update_transform(). var/icon_scale_y = 1 // Used to scale icons up or down vertically in update_transform().
var/icon_rotation = 0 // Used to rotate icons in update_transform() var/icon_rotation = 0 // Used to rotate icons in update_transform()
var/icon_expected_height = 32
var/icon_expected_width = 32
var/old_x = 0 var/old_x = 0
var/old_y = 0 var/old_y = 0
var/datum/riding/riding_datum = null var/datum/riding/riding_datum = null
@@ -561,6 +563,14 @@
return null return null
return text2num(pickweight(candidates)) return text2num(pickweight(candidates))
// Returns the current scaling of the sprite.
// Note this DOES NOT measure the height or width of the icon, but returns what number is being multiplied with to scale the icons, if any.
/atom/movable/proc/get_icon_scale_x()
return icon_scale_x
/atom/movable/proc/get_icon_scale_y()
return icon_scale_y
/atom/movable/proc/update_transform() /atom/movable/proc/update_transform()
var/matrix/M = matrix() var/matrix/M = matrix()
M.Scale(icon_scale_x, icon_scale_y) M.Scale(icon_scale_x, icon_scale_y)

View File

@@ -83,7 +83,7 @@
for(var/mob/living/carbon/M in ohearers(6, T)) for(var/mob/living/carbon/M in ohearers(6, T))
if(M.get_ear_protection() >= 2) if(M.get_ear_protection() >= 2)
continue continue
M.sleeping = 0 M.SetSleeping(0)
M.stuttering += 20 M.stuttering += 20
M.ear_deaf += 30 M.ear_deaf += 30
M.Weaken(3) M.Weaken(3)

View File

@@ -216,7 +216,7 @@
occupant.set_stat(UNCONSCIOUS) occupant.set_stat(UNCONSCIOUS)
occupant.dir = SOUTH occupant.dir = SOUTH
if(occupant.bodytemperature < T0C) if(occupant.bodytemperature < T0C)
occupant.sleeping = max(5, (1/occupant.bodytemperature)*2000) occupant.Sleeping(max(5, (1/occupant.bodytemperature)*2000))
occupant.Paralyse(max(5, (1/occupant.bodytemperature)*3000)) occupant.Paralyse(max(5, (1/occupant.bodytemperature)*3000))
if(air_contents.gas["oxygen"] > 2) if(air_contents.gas["oxygen"] > 2)
if(occupant.getOxyLoss()) occupant.adjustOxyLoss(-1) if(occupant.getOxyLoss()) occupant.adjustOxyLoss(-1)

View File

@@ -221,7 +221,7 @@
for(var/mob/living/carbon/M in ohearers(6, src)) for(var/mob/living/carbon/M in ohearers(6, src))
if(M.get_ear_protection() >= 2) if(M.get_ear_protection() >= 2)
continue continue
M.sleeping = 0 M.SetSleeping(0)
M.stuttering += 20 M.stuttering += 20
M.ear_deaf += 30 M.ear_deaf += 30
M.Weaken(3) M.Weaken(3)

View File

@@ -26,7 +26,7 @@
return return
to_chat(M, "<span class='warning'>Your ears feel like they're bleeding!</span>") to_chat(M, "<span class='warning'>Your ears feel like they're bleeding!</span>")
playsound(M, 'sound/effects/bang.ogg', 70, 1, 30) playsound(M, 'sound/effects/bang.ogg', 70, 1, 30)
M.sleeping = 0 M.SetSleeping(0)
M.ear_deaf += 30 M.ear_deaf += 30
M.ear_damage += rand(5, 20) M.ear_damage += rand(5, 20)
M.Weaken(3) M.Weaken(3)

View File

@@ -138,7 +138,7 @@
for(var/mob/living/carbon/M in oviewers(4, T)) for(var/mob/living/carbon/M in oviewers(4, T))
if(M.get_ear_protection() >= 2) if(M.get_ear_protection() >= 2)
continue continue
M.sleeping = 0 M.SetSleeping(0)
M.stuttering += 20 M.stuttering += 20
M.ear_deaf += 30 M.ear_deaf += 30
M.Weaken(3) M.Weaken(3)

View File

@@ -1468,12 +1468,12 @@ var/datum/announcement/minor/admin_min_announcer = new
if(check_rights(R_ADMIN|R_MOD|R_EVENT)) if(check_rights(R_ADMIN|R_MOD|R_EVENT))
if (H.paralysis == 0) if (H.paralysis == 0)
H.paralysis = 8000 H.SetParalysis(8000)
msg = "has paralyzed [key_name(H)]." msg = "has paralyzed [key_name(H)]."
log_and_message_admins(msg) log_and_message_admins(msg)
else else
if(alert(src, "[key_name(H)] is paralyzed, would you like to unparalyze them?",,"Yes","No") == "Yes") if(alert(src, "[key_name(H)] is paralyzed, would you like to unparalyze them?",,"Yes","No") == "Yes")
H.paralysis = 0 H.SetParalysis(0)
msg = "has unparalyzed [key_name(H)]." msg = "has unparalyzed [key_name(H)]."
log_and_message_admins(msg) log_and_message_admins(msg)

View File

@@ -266,6 +266,18 @@ var/list/_client_preferences_by_type
enabled_description = "Enabled" enabled_description = "Enabled"
disabled_description = "Disabled" disabled_description = "Disabled"
/datum/client_preference/status_indicators
description = "Status Indicators"
key = "SHOW_STATUS"
enabled_description = "Show"
disabled_description = "Hide"
/datum/client_preference/status_indicators/toggled(mob/preference_mob, enabled)
. = ..()
if(preference_mob && preference_mob.plane_holder)
var/datum/plane_holder/PH = preference_mob.plane_holder
PH.set_vis(VIS_STATUS, enabled)
/******************** /********************
* Staff Preferences * * Staff Preferences *
********************/ ********************/

View File

@@ -334,6 +334,19 @@
You will have to reload VChat and/or reconnect to the server for these changes to take place. \ You will have to reload VChat and/or reconnect to the server for these changes to take place. \
VChat message persistence is not guaranteed if you change this again before the start of the next round.") VChat message persistence is not guaranteed if you change this again before the start of the next round.")
/client/verb/toggle_status_indicators()
set name = "Toggle Status Indicators"
set category = "Preferences"
set desc = "Enable/Disable seeing status indicators over peoples' heads."
var/pref_path = /datum/client_preference/status_indicators
toggle_preference(pref_path)
SScharacter_setup.queue_preferences_save(prefs)
to_chat(src, "You will now [(is_preference_enabled(/datum/client_preference/status_indicators)) ? "see" : "not see"] status indicators.")
feedback_add_details("admin_verb","TStatusIndicators")
// Not attached to a pref datum because those are strict binary toggles // Not attached to a pref datum because those are strict binary toggles
/client/verb/toggle_examine_mode() /client/verb/toggle_examine_mode()

View File

@@ -168,12 +168,12 @@ mob/living/carbon/proc/handle_hallucinations()
if(71 to 72) if(71 to 72)
//Fake death //Fake death
// src.sleeping_willingly = 1 // src.sleeping_willingly = 1
src.sleeping = 20 SetSleeping(20)
hal_crit = 1 hal_crit = 1
hal_screwyhud = 1 hal_screwyhud = 1
spawn(rand(50,100)) spawn(rand(50,100))
// src.sleeping_willingly = 0 // src.sleeping_willingly = 0
src.sleeping = 0 SetSleeping(0)
hal_crit = 0 hal_crit = 0
hal_screwyhud = 0 hal_screwyhud = 0
handling_hal = 0 handling_hal = 0

View File

@@ -68,9 +68,9 @@
if(health <= 0) if(health <= 0)
death() death()
return return
weakened = 0 SetWeakened(0)
stunned = 0 SetStunned(0)
paralysis = 0 SetParalysis(0)
if(on && !client && !busy) if(on && !client && !busy)
spawn(0) spawn(0)

View File

@@ -59,7 +59,7 @@
adjustHalLoss(-3) adjustHalLoss(-3)
if (mind) if (mind)
if(mind.active && client != null) if(mind.active && client != null)
sleeping = max(sleeping-1, 0) AdjustSleeping(-1)
blinded = 1 blinded = 1
set_stat(UNCONSCIOUS) set_stat(UNCONSCIOUS)
else if(resting) else if(resting)

View File

@@ -1,3 +1,3 @@
/mob/living/carbon/brain/Login() /mob/living/carbon/brain/Login()
..() ..()
sleeping = 0 SetSleeping(0)

View File

@@ -136,7 +136,7 @@
to_chat(src, "<span class='danger'>Oh god, everything's spinning!</span>") to_chat(src, "<span class='danger'>Oh god, everything's spinning!</span>")
Confuse(max(0,confuse_dur)) Confuse(max(0,confuse_dur))
if(species.emp_sensitivity & EMP_WEAKEN) if(species.emp_sensitivity & EMP_WEAKEN)
if(weaken_dur >= 1) if(weaken_dur >= 1)
to_chat(src, "<span class='danger'>Your limbs go slack!</span>") to_chat(src, "<span class='danger'>Your limbs go slack!</span>")
Weaken(max(0,weaken_dur)) Weaken(max(0,weaken_dur))
//physical damage block, deals (minor-4) 5-15, 10-20, 15-25, 20-30 (extreme-1) of *each* type //physical damage block, deals (minor-4) 5-15, 10-20, 15-25, 20-30 (extreme-1) of *each* type
@@ -287,7 +287,7 @@
M.visible_message("<span class='notice'>[M] shakes [src] trying to wake [T.him] up!</span>", \ M.visible_message("<span class='notice'>[M] shakes [src] trying to wake [T.him] up!</span>", \
"<span class='notice'>You shake [src], but [T.he] [T.does] not respond... Maybe [T.he] [T.has] S.S.D?</span>") "<span class='notice'>You shake [src], but [T.he] [T.does] not respond... Maybe [T.he] [T.has] S.S.D?</span>")
else if(lying || src.sleeping) else if(lying || src.sleeping)
src.sleeping = max(0,src.sleeping-5) AdjustSleeping(-5)
if(src.sleeping == 0) if(src.sleeping == 0)
src.resting = 0 src.resting = 0
if(H) H.in_stasis = 0 //VOREStation Add - Just In Case if(H) H.in_stasis = 0 //VOREStation Add - Just In Case
@@ -403,7 +403,7 @@
to_chat(usr, "<font color='red'>You are already sleeping</font>") to_chat(usr, "<font color='red'>You are already sleeping</font>")
return return
if(alert(src,"You sure you want to sleep for a while?","Sleep","Yes","No") == "Yes") if(alert(src,"You sure you want to sleep for a while?","Sleep","Yes","No") == "Yes")
usr.sleeping = 20 //Short nap usr.AdjustSleeping(20)
/mob/living/carbon/Bump(atom/A) /mob/living/carbon/Bump(atom/A)
if(now_pushing) if(now_pushing)

View File

@@ -240,7 +240,11 @@
message = "faints." message = "faints."
if(sleeping) if(sleeping)
return //Can't faint while asleep return //Can't faint while asleep
<<<<<<< HEAD
sleeping += 10 //Short-short nap sleeping += 10 //Short-short nap
=======
Sleeping(10)
>>>>>>> 55b2c8d... Merge pull request #7354 from Neerti/status_indicators
m_type = 1 m_type = 1
if("cough", "coughs") if("cough", "coughs")

View File

@@ -1103,7 +1103,7 @@
drowsyness = max(0, drowsyness - 1) drowsyness = max(0, drowsyness - 1)
eye_blurry = max(2, eye_blurry) eye_blurry = max(2, eye_blurry)
if (prob(5)) if (prob(5))
sleeping += 1 Sleeping(1)
Paralyse(5) Paralyse(5)
// If you're dirty, your gloves will become dirty, too. // If you're dirty, your gloves will become dirty, too.
@@ -1258,7 +1258,18 @@
if(blinded) if(blinded)
overlay_fullscreen("blind", /obj/screen/fullscreen/blind) overlay_fullscreen("blind", /obj/screen/fullscreen/blind)
throw_alert("blind", /obj/screen/alert/blind) throw_alert("blind", /obj/screen/alert/blind)
<<<<<<< HEAD
=======
else
clear_fullscreens()
clear_alert("blind")
if(blinded)
overlay_fullscreen("blind", /obj/screen/fullscreen/blind)
>>>>>>> 55b2c8d... Merge pull request #7354 from Neerti/status_indicators
else if(!machine) else if(!machine)
clear_fullscreens() clear_fullscreens()
clear_alert("blind") clear_alert("blind")

View File

@@ -126,10 +126,14 @@
/mob/living/proc/handle_weakened() /mob/living/proc/handle_weakened()
if(weakened) if(weakened)
<<<<<<< HEAD
weakened = max(weakened-1,0) weakened = max(weakened-1,0)
throw_alert("weakened", /obj/screen/alert/weakened) throw_alert("weakened", /obj/screen/alert/weakened)
else else
clear_alert("weakened") clear_alert("weakened")
=======
AdjustWeakened(-1)
>>>>>>> 55b2c8d... Merge pull request #7354 from Neerti/status_indicators
return weakened return weakened
/mob/living/proc/handle_stuttering() /mob/living/proc/handle_stuttering()
@@ -181,7 +185,7 @@
throw_alert("blind", /obj/screen/alert/blind) throw_alert("blind", /obj/screen/alert/blind)
else else
clear_alert("blind") clear_alert("blind")
if(eye_blurry) //blurry eyes heal slowly if(eye_blurry) //blurry eyes heal slowly
eye_blurry = max(eye_blurry-1, 0) eye_blurry = max(eye_blurry-1, 0)

View File

@@ -491,6 +491,15 @@ default behaviour is:
if(!isnull(M.disable_duration_percent)) if(!isnull(M.disable_duration_percent))
amount = round(amount * M.disable_duration_percent) amount = round(amount * M.disable_duration_percent)
..(amount) ..(amount)
if(stunned > 0)
add_status_indicator("stunned")
/mob/living/SetStunned(amount)
..()
if(stunned <= 0)
remove_status_indicator("stunned")
else
add_status_indicator("stunned")
/mob/living/AdjustStunned(amount) /mob/living/AdjustStunned(amount)
if(amount > 0) if(amount > 0)
@@ -498,12 +507,25 @@ default behaviour is:
if(!isnull(M.disable_duration_percent)) if(!isnull(M.disable_duration_percent))
amount = round(amount * M.disable_duration_percent) amount = round(amount * M.disable_duration_percent)
..(amount) ..(amount)
if(stunned <= 0)
remove_status_indicator("stunned")
else
add_status_indicator("stunned")
/mob/living/Weaken(amount) /mob/living/Weaken(amount)
for(var/datum/modifier/M in modifiers) for(var/datum/modifier/M in modifiers)
if(!isnull(M.disable_duration_percent)) if(!isnull(M.disable_duration_percent))
amount = round(amount * M.disable_duration_percent) amount = round(amount * M.disable_duration_percent)
..(amount) ..(amount)
if(weakened > 0)
add_status_indicator("weakened")
/mob/living/SetWeakened(amount)
..()
if(weakened <= 0)
remove_status_indicator("weakened")
else
add_status_indicator("weakened")
/mob/living/AdjustWeakened(amount) /mob/living/AdjustWeakened(amount)
if(amount > 0) if(amount > 0)
@@ -511,12 +533,25 @@ default behaviour is:
if(!isnull(M.disable_duration_percent)) if(!isnull(M.disable_duration_percent))
amount = round(amount * M.disable_duration_percent) amount = round(amount * M.disable_duration_percent)
..(amount) ..(amount)
if(weakened <= 0)
remove_status_indicator("weakened")
else
add_status_indicator("weakened")
/mob/living/Paralyse(amount) /mob/living/Paralyse(amount)
for(var/datum/modifier/M in modifiers) for(var/datum/modifier/M in modifiers)
if(!isnull(M.disable_duration_percent)) if(!isnull(M.disable_duration_percent))
amount = round(amount * M.disable_duration_percent) amount = round(amount * M.disable_duration_percent)
..(amount) ..(amount)
if(paralysis > 0)
add_status_indicator("paralysis")
/mob/living/SetParalysis(amount)
..()
if(paralysis <= 0)
remove_status_indicator("paralysis")
else
add_status_indicator("paralysis")
/mob/living/AdjustParalysis(amount) /mob/living/AdjustParalysis(amount)
if(amount > 0) if(amount > 0)
@@ -524,12 +559,25 @@ default behaviour is:
if(!isnull(M.disable_duration_percent)) if(!isnull(M.disable_duration_percent))
amount = round(amount * M.disable_duration_percent) amount = round(amount * M.disable_duration_percent)
..(amount) ..(amount)
if(paralysis <= 0)
remove_status_indicator("paralysis")
else
add_status_indicator("paralysis")
/mob/living/Sleeping(amount) /mob/living/Sleeping(amount)
for(var/datum/modifier/M in modifiers) for(var/datum/modifier/M in modifiers)
if(!isnull(M.disable_duration_percent)) if(!isnull(M.disable_duration_percent))
amount = round(amount * M.disable_duration_percent) amount = round(amount * M.disable_duration_percent)
..(amount) ..(amount)
if(sleeping > 0)
add_status_indicator("sleeping")
/mob/living/SetSleeping(amount)
..()
if(sleeping <= 0)
remove_status_indicator("sleeping")
else
add_status_indicator("sleeping")
/mob/living/AdjustSleeping(amount) /mob/living/AdjustSleeping(amount)
if(amount > 0) if(amount > 0)
@@ -537,12 +585,25 @@ default behaviour is:
if(!isnull(M.disable_duration_percent)) if(!isnull(M.disable_duration_percent))
amount = round(amount * M.disable_duration_percent) amount = round(amount * M.disable_duration_percent)
..(amount) ..(amount)
if(sleeping <= 0)
remove_status_indicator("sleeping")
else
add_status_indicator("sleeping")
/mob/living/Confuse(amount) /mob/living/Confuse(amount)
for(var/datum/modifier/M in modifiers) for(var/datum/modifier/M in modifiers)
if(!isnull(M.disable_duration_percent)) if(!isnull(M.disable_duration_percent))
amount = round(amount * M.disable_duration_percent) amount = round(amount * M.disable_duration_percent)
..(amount) ..(amount)
if(confused > 0)
add_status_indicator("confused")
/mob/living/SetConfused(amount)
..()
if(confused <= 0)
remove_status_indicator("confused")
else
add_status_indicator("confused")
/mob/living/AdjustConfused(amount) /mob/living/AdjustConfused(amount)
if(amount > 0) if(amount > 0)
@@ -550,12 +611,25 @@ default behaviour is:
if(!isnull(M.disable_duration_percent)) if(!isnull(M.disable_duration_percent))
amount = round(amount * M.disable_duration_percent) amount = round(amount * M.disable_duration_percent)
..(amount) ..(amount)
if(confused <= 0)
remove_status_indicator("confused")
else
add_status_indicator("confused")
/mob/living/Blind(amount) /mob/living/Blind(amount)
for(var/datum/modifier/M in modifiers) for(var/datum/modifier/M in modifiers)
if(!isnull(M.disable_duration_percent)) if(!isnull(M.disable_duration_percent))
amount = round(amount * M.disable_duration_percent) amount = round(amount * M.disable_duration_percent)
..(amount) ..(amount)
if(eye_blind > 0)
add_status_indicator("blinded")
/mob/living/SetBlinded(amount)
..()
if(eye_blind <= 0)
remove_status_indicator("blinded")
else
add_status_indicator("blinded")
/mob/living/AdjustBlinded(amount) /mob/living/AdjustBlinded(amount)
if(amount > 0) if(amount > 0)
@@ -563,6 +637,10 @@ default behaviour is:
if(!isnull(M.disable_duration_percent)) if(!isnull(M.disable_duration_percent))
amount = round(amount * M.disable_duration_percent) amount = round(amount * M.disable_duration_percent)
..(amount) ..(amount)
if(eye_blind <= 0)
remove_status_indicator("blinded")
else
add_status_indicator("blinded")
// ++++ROCKDTBEN++++ MOB PROCS //END // ++++ROCKDTBEN++++ MOB PROCS //END
@@ -827,10 +905,10 @@ default behaviour is:
if(pulling) // we were pulling a thing and didn't lose it during our move. if(pulling) // we were pulling a thing and didn't lose it during our move.
var/pull_dir = get_dir(src, pulling) var/pull_dir = get_dir(src, pulling)
if(pulling.anchored || !isturf(pulling.loc)) if(pulling.anchored || !isturf(pulling.loc))
stop_pulling() stop_pulling()
else if(get_dist(src, pulling) > 1 || (moving_diagonally != SECOND_DIAG_STEP && ((pull_dir - 1) & pull_dir))) // puller and pullee more than one tile away or in diagonal position else if(get_dist(src, pulling) > 1 || (moving_diagonally != SECOND_DIAG_STEP && ((pull_dir - 1) & pull_dir))) // puller and pullee more than one tile away or in diagonal position
// If it is too far away or across z-levels from old location, stop pulling. // If it is too far away or across z-levels from old location, stop pulling.
if(get_dist(pulling.loc, oldloc) > 1 || pulling.loc.z != oldloc?.z) if(get_dist(pulling.loc, oldloc) > 1 || pulling.loc.z != oldloc?.z)
@@ -846,7 +924,7 @@ default behaviour is:
stop_pulling() stop_pulling()
if(!isturf(loc)) if(!isturf(loc))
return return
else if(lastarea?.has_gravity == 0) else if(lastarea?.has_gravity == 0)
inertial_drift() inertial_drift()
//VOREStation Edit Start //VOREStation Edit Start
@@ -863,7 +941,7 @@ default behaviour is:
if(Process_Spacemove(1)) if(Process_Spacemove(1))
inertia_dir = 0 inertia_dir = 0
return return
var/locthen = loc var/locthen = loc
spawn(5) spawn(5)
if(!anchored && !pulledby && loc == locthen) if(!anchored && !pulledby && loc == locthen)
@@ -1145,22 +1223,42 @@ default behaviour is:
/mob/living/proc/is_sentient() /mob/living/proc/is_sentient()
return TRUE return TRUE
<<<<<<< HEAD
/mob/living/update_transform() /mob/living/update_transform()
// First, get the correct size. // First, get the correct size.
var/desired_scale_x = size_multiplier //VOREStation edit var/desired_scale_x = size_multiplier //VOREStation edit
var/desired_scale_y = size_multiplier //VOREStation edit var/desired_scale_y = size_multiplier //VOREStation edit
=======
/mob/living/get_icon_scale_x()
. = ..()
>>>>>>> 55b2c8d... Merge pull request #7354 from Neerti/status_indicators
for(var/datum/modifier/M in modifiers) for(var/datum/modifier/M in modifiers)
if(!isnull(M.icon_scale_x_percent)) if(!isnull(M.icon_scale_x_percent))
desired_scale_x *= M.icon_scale_x_percent . *= M.icon_scale_x_percent
/mob/living/get_icon_scale_y()
. = ..()
for(var/datum/modifier/M in modifiers)
if(!isnull(M.icon_scale_y_percent)) if(!isnull(M.icon_scale_y_percent))
desired_scale_y *= M.icon_scale_y_percent . *= M.icon_scale_y_percent
/mob/living/update_transform()
// First, get the correct size.
var/desired_scale_x = get_icon_scale_x()
var/desired_scale_y = get_icon_scale_y()
// Now for the regular stuff. // Now for the regular stuff.
var/matrix/M = matrix() var/matrix/M = matrix()
M.Scale(desired_scale_x, desired_scale_y) M.Scale(desired_scale_x, desired_scale_y)
<<<<<<< HEAD
M.Translate(0, (vis_height/2)*(desired_scale_y-1)) //VOREStation edit M.Translate(0, (vis_height/2)*(desired_scale_y-1)) //VOREStation edit
src.transform = M //VOREStation edit src.transform = M //VOREStation edit
=======
M.Translate(0, 16*(desired_scale_y-1))
animate(src, transform = M, time = 10)
handle_status_indicators()
>>>>>>> 55b2c8d... Merge pull request #7354 from Neerti/status_indicators
// This handles setting the client's color variable, which makes everything look a specific color. // This handles setting the client's color variable, which makes everything look a specific color.
// This proc is here so it can be called without needing to check if the client exists, or if the client relogs. // This proc is here so it can be called without needing to check if the client exists, or if the client relogs.

View File

@@ -1,3 +1,3 @@
/mob/living/silicon/Login() /mob/living/silicon/Login()
sleeping = 0 SetSleeping(0)
..() ..()

View File

@@ -32,7 +32,7 @@
// SetStunned(min(stunned, 30)) // SetStunned(min(stunned, 30))
SetParalysis(min(paralysis, 30)) SetParalysis(min(paralysis, 30))
// SetWeakened(min(weakened, 20)) // SetWeakened(min(weakened, 20))
sleeping = 0 SetSleeping(0)
adjustBruteLoss(0) adjustBruteLoss(0)
adjustToxLoss(0) adjustToxLoss(0)
adjustOxyLoss(0) adjustOxyLoss(0)
@@ -78,7 +78,7 @@
if(src.sleeping) if(src.sleeping)
Paralyse(3) Paralyse(3)
src.sleeping-- AdjustSleeping(-1)
//if(src.resting) // VOREStation edit. Our borgos would rather not. //if(src.resting) // VOREStation edit. Our borgos would rather not.
// Weaken(5) // Weaken(5)

View File

@@ -115,25 +115,7 @@
/mob/living/silicon/apply_effect(var/effect = 0,var/effecttype = STUN, var/blocked = 0) /mob/living/silicon/apply_effect(var/effect = 0,var/effecttype = STUN, var/blocked = 0)
return 0//The only effect that can hit them atm is flashes and they still directly edit so this works for now return 0//The only effect that can hit them atm is flashes and they still directly edit so this works for now
/*
if(!effect || (blocked >= 2)) return 0
switch(effecttype)
if(STUN)
stunned = max(stunned,(effect/(blocked+1)))
if(WEAKEN)
weakened = max(weakened,(effect/(blocked+1)))
if(PARALYZE)
paralysis = max(paralysis,(effect/(blocked+1)))
if(IRRADIATE)
radiation += min((effect - (effect*getarmor(null, "rad"))), 0)//Rads auto check armor
if(STUTTER)
stuttering = max(stuttering,(effect/(blocked+1)))
if(EYE_BLUR)
eye_blurry = max(eye_blurry,(effect/(blocked+1)))
if(DROWSY)
drowsyness = max(drowsyness,(effect/(blocked+1)))
updatehealth()
return 1*/
/proc/islinked(var/mob/living/silicon/robot/bot, var/mob/living/silicon/ai/ai) /proc/islinked(var/mob/living/silicon/robot/bot, var/mob/living/silicon/ai/ai)
if(!istype(bot) || !istype(ai)) if(!istype(bot) || !istype(ai))

View File

@@ -64,6 +64,8 @@
pixel_x = -16 pixel_x = -16
old_x = -16 old_x = -16
icon_expected_width = 64
icon_expected_height = 64
meat_amount = 5 meat_amount = 5
/mob/living/simple_mob/animal/space/alien/queen /mob/living/simple_mob/animal/space/alien/queen
@@ -95,6 +97,8 @@
pixel_x = -16 pixel_x = -16
old_x = -16 old_x = -16
icon_expected_width = 64
icon_expected_height = 64
/mob/living/simple_mob/animal/space/alien/queen/empress/mother /mob/living/simple_mob/animal/space/alien/queen/empress/mother
name = "alien mother" name = "alien mother"
@@ -111,6 +115,8 @@
pixel_x = -32 pixel_x = -32
old_x = -32 old_x = -32
icon_expected_width = 96
icon_expected_height = 96
/mob/living/simple_mob/animal/space/alien/death() /mob/living/simple_mob/animal/space/alien/death()
..() ..()

View File

@@ -87,6 +87,8 @@
pixel_x = -16 pixel_x = -16
default_pixel_x = -16 default_pixel_x = -16
icon_expected_width = 64
icon_expected_height = 32
meat_amount = 3 meat_amount = 3
@@ -108,6 +110,8 @@
pixel_y = -16 pixel_y = -16
default_pixel_y = -16 default_pixel_y = -16
icon_expected_width = 64
icon_expected_height = 64
meat_amount = 10 meat_amount = 10

View File

@@ -45,7 +45,7 @@
"rad" = 100) "rad" = 100)
/mob/living/simple_mob/construct/juggernaut/Life() /mob/living/simple_mob/construct/juggernaut/Life()
weakened = 0 SetWeakened(0)
..() ..()
/mob/living/simple_mob/construct/juggernaut/bullet_act(var/obj/item/projectile/P) /mob/living/simple_mob/construct/juggernaut/bullet_act(var/obj/item/projectile/P)

View File

@@ -0,0 +1,88 @@
#define STATUS_INDICATOR_Y_OFFSET 2 // Offset from the edge of the icon sprite, so 32 pixels plus whatever number is here.
#define STATUS_INDICATOR_ICON_X_SIZE 16 // Don't need to care about the Y size due to the origin being on the bottom side.
#define STATUS_INDICATOR_ICON_MARGIN 2 // The space between two status indicators.
// 'Status indicators' are icons that display over a mob's head, that visually indicate that the mob is suffering
// from some kind of effect, such as being stunned, blinded, confused, asleep, etc.
// The icons are managed automatically by the mob itself, so that their positions will shift if another indicator is added,
// and it will try to always be above the mob sprite, even for larger sprites like xenos.
/mob/living
var/list/status_indicators = null // Will become a list as needed.
// Adds an icon_state, or image overlay, to the list of indicators to be managed automatically.
// Also initializes the list if one doesn't exist.
/mob/living/proc/add_status_indicator(image/thing)
if(get_status_indicator(thing)) // No duplicates, please.
return
if(!istype(thing, /image))
thing = image(icon = 'icons/mob/status_indicators.dmi', icon_state = thing)
LAZYADD(status_indicators, thing)
handle_status_indicators()
// Similar to above but removes it instead, and nulls the list if it becomes empty as a result.
/mob/living/proc/remove_status_indicator(image/thing)
thing = get_status_indicator(thing)
cut_overlay(thing)
LAZYREMOVE(status_indicators, thing)
handle_status_indicators()
/mob/living/proc/get_status_indicator(image/thing)
if(!istype(thing, /image))
for(var/image/I in status_indicators)
if(I.icon_state == thing)
return I
return LAZYACCESS(status_indicators, LAZYFIND(status_indicators, thing))
// Refreshes the indicators over a mob's head. Should only be called when adding or removing a status indicator with the above procs,
// or when the mob changes size visually for some reason.
/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 put them back on in the right spot.
var/our_sprite_x = icon_expected_width * get_icon_scale_x()
var/our_sprite_y = icon_expected_height * get_icon_scale_y()
var/x_offset = our_sprite_x // Add your own offset here later if you want.
var/y_offset = our_sprite_y + STATUS_INDICATOR_Y_OFFSET
// Calculates how 'long' the row of indicators and the margin between them should be.
// The goal is to have the center of that row be horizontally aligned with the sprite's center.
var/expected_status_indicator_length = (STATUS_INDICATOR_ICON_X_SIZE * status_indicators.len) + (STATUS_INDICATOR_ICON_MARGIN * max(status_indicators.len - 1, 0))
var/current_x_position = (x_offset / 2) - (expected_status_indicator_length / 2)
// In /mob/living's `update_transform()`, the sprite is horizontally shifted when scaled up, so that the center of the sprite doesn't move to the right.
// Because of that, this adjustment needs to happen with the future indicator row as well, or it will look bad.
current_x_position -= (icon_expected_width / 2) * (get_icon_scale_y() - 1)
// Now the indicator row can actually be built.
for(var/thing in status_indicators)
var/image/I = thing
// This is a semi-HUD element, in a similar manner as medHUDs, in that they're 'above' everything else in the world,
// but don't pierce obfuscation layers such as blindness or darkness, unlike actual HUD elements like inventory slots.
I.plane = PLANE_STATUS
I.layer = HUD_LAYER
I.appearance_flags = PIXEL_SCALE|TILE_BOUND|NO_CLIENT_COLOR|RESET_COLOR|RESET_ALPHA|RESET_TRANSFORM|KEEP_APART
I.pixel_y = y_offset
I.pixel_x = current_x_position
add_overlay(I)
// Adding the margin space every time saves a conditional check on the last iteration,
// and it won't cause any issues since no more icons will be added, and the var is not used for anything else.
current_x_position += STATUS_INDICATOR_ICON_X_SIZE + STATUS_INDICATOR_ICON_MARGIN
#undef STATUS_INDICATOR_Y_OFFSET
#undef STATUS_INDICATOR_ICON_X_SIZE
#undef STATUS_INDICATOR_ICON_MARGIN

View File

@@ -66,6 +66,10 @@
plane_holder.set_ao(VIS_OBJS, ao_enabled) plane_holder.set_ao(VIS_OBJS, ao_enabled)
plane_holder.set_ao(VIS_MOBS, ao_enabled) plane_holder.set_ao(VIS_MOBS, ao_enabled)
// Status indicators
var/status_enabled = client.is_preference_enabled(/datum/client_preference/status_indicators)
plane_holder.set_vis(VIS_STATUS, status_enabled)
//set macro to normal incase it was overriden (like cyborg currently does) //set macro to normal incase it was overriden (like cyborg currently does)
client.set_hotkeys_macro("macro", "hotkeymode") client.set_hotkeys_macro("macro", "hotkeymode")

View File

@@ -30,6 +30,8 @@
plane_masters[VIS_CH_SPECIAL] = new /obj/screen/plane_master{plane = PLANE_CH_SPECIAL} //"Special" role stuff plane_masters[VIS_CH_SPECIAL] = new /obj/screen/plane_master{plane = PLANE_CH_SPECIAL} //"Special" role stuff
plane_masters[VIS_CH_STATUS_OOC]= new /obj/screen/plane_master{plane = PLANE_CH_STATUS_OOC} //OOC status HUD plane_masters[VIS_CH_STATUS_OOC]= new /obj/screen/plane_master{plane = PLANE_CH_STATUS_OOC} //OOC status HUD
plane_masters[VIS_STATUS] = new /obj/screen/plane_master{plane = PLANE_STATUS} //Status indicators that show over mob heads.
plane_masters[VIS_ADMIN1] = new /obj/screen/plane_master{plane = PLANE_ADMIN1} //For admin use plane_masters[VIS_ADMIN1] = new /obj/screen/plane_master{plane = PLANE_ADMIN1} //For admin use
plane_masters[VIS_ADMIN2] = new /obj/screen/plane_master{plane = PLANE_ADMIN2} //For admin use plane_masters[VIS_ADMIN2] = new /obj/screen/plane_master{plane = PLANE_ADMIN2} //For admin use
plane_masters[VIS_ADMIN3] = new /obj/screen/plane_master{plane = PLANE_ADMIN3} //For admin use plane_masters[VIS_ADMIN3] = new /obj/screen/plane_master{plane = PLANE_ADMIN3} //For admin use

View File

@@ -42,7 +42,7 @@ mob/living/carbon/human/proc/handle_pain()
maxdam = dam maxdam = dam
if(damaged_organ && chem_effects[CE_PAINKILLER] < maxdam) if(damaged_organ && chem_effects[CE_PAINKILLER] < maxdam)
if(maxdam > 10 && paralysis) if(maxdam > 10 && paralysis)
paralysis = max(0, paralysis - round(maxdam/10)) AdjustParalysis(-round(maxdam/10))
if(maxdam > 50 && prob(maxdam / 5)) if(maxdam > 50 && prob(maxdam / 5))
drop_item() drop_item()
var/burning = damaged_organ.burn_dam > damaged_organ.brute_dam var/burning = damaged_organ.burn_dam > damaged_organ.brute_dam

View File

@@ -122,8 +122,8 @@
if(effective_dose >= strength * 6) // Toxic dose if(effective_dose >= strength * 6) // Toxic dose
M.add_chemical_effect(CE_ALCOHOL_TOXIC, toxicity*3) M.add_chemical_effect(CE_ALCOHOL_TOXIC, toxicity*3)
if(effective_dose >= strength * 7) // Pass out if(effective_dose >= strength * 7) // Pass out
M.paralysis = max(M.paralysis, 60) M.Paralyse(60)
M.sleeping = max(M.sleeping, 90) M.Sleeping(90)
if(druggy != 0) if(druggy != 0)
M.druggy = max(M.druggy, druggy*3) M.druggy = max(M.druggy, druggy*3)
@@ -166,8 +166,8 @@
if(dose * strength_mod >= strength * 6) // Toxic dose if(dose * strength_mod >= strength * 6) // Toxic dose
M.add_chemical_effect(CE_ALCOHOL_TOXIC, toxicity) M.add_chemical_effect(CE_ALCOHOL_TOXIC, toxicity)
if(dose * strength_mod >= strength * 7) // Pass out if(dose * strength_mod >= strength * 7) // Pass out
M.paralysis = max(M.paralysis, 20) M.Paralyse(20)
M.sleeping = max(M.sleeping, 30) M.Sleeping(30)
if(druggy != 0) if(druggy != 0)
M.druggy = max(M.druggy, druggy) M.druggy = max(M.druggy, druggy)
@@ -465,7 +465,7 @@
M.Weaken(2) M.Weaken(2)
M.drowsyness = max(M.drowsyness, 20) M.drowsyness = max(M.drowsyness, 20)
else else
M.sleeping = max(M.sleeping, 20) M.Sleeping(20)
M.drowsyness = max(M.drowsyness, 60) M.drowsyness = max(M.drowsyness, 60)
/datum/reagent/sulfur /datum/reagent/sulfur

View File

@@ -327,7 +327,7 @@
M.Weaken(2) M.Weaken(2)
M.drowsyness = max(M.drowsyness, 20) M.drowsyness = max(M.drowsyness, 20)
else else
M.sleeping = max(M.sleeping, 20) M.Sleeping(20)
M.drowsyness = max(M.drowsyness, 60) M.drowsyness = max(M.drowsyness, 60)
/datum/reagent/nutriment/mayo /datum/reagent/nutriment/mayo
@@ -834,7 +834,7 @@
M.adjust_nutrition(nutrition * removed) M.adjust_nutrition(nutrition * removed)
M.dizziness = max(0, M.dizziness + adj_dizzy) M.dizziness = max(0, M.dizziness + adj_dizzy)
M.drowsyness = max(0, M.drowsyness + adj_drowsy) M.drowsyness = max(0, M.drowsyness + adj_drowsy)
M.sleeping = max(0, M.sleeping + adj_sleepy) M.AdjustSleeping(adj_sleepy)
if(adj_temp > 0 && M.bodytemperature < 310) // 310 is the normal bodytemp. 310.055 if(adj_temp > 0 && M.bodytemperature < 310) // 310 is the normal bodytemp. 310.055
M.bodytemperature = min(310, M.bodytemperature + (adj_temp * TEMPERATURE_DAMAGE_COEFFICIENT)) M.bodytemperature = min(310, M.bodytemperature + (adj_temp * TEMPERATURE_DAMAGE_COEFFICIENT))
if(adj_temp < 0 && M.bodytemperature > 310) if(adj_temp < 0 && M.bodytemperature > 310)
@@ -922,7 +922,7 @@
M.Weaken(2) M.Weaken(2)
M.drowsyness = max(M.drowsyness, 20) M.drowsyness = max(M.drowsyness, 20)
else else
M.sleeping = max(M.sleeping, 20) M.Sleeping(20)
M.drowsyness = max(M.drowsyness, 60) M.drowsyness = max(M.drowsyness, 60)
*/ */
@@ -1506,7 +1506,7 @@
M.Weaken(2) M.Weaken(2)
M.drowsyness = max(M.drowsyness, 20) M.drowsyness = max(M.drowsyness, 20)
else else
M.sleeping = max(M.sleeping, 20) M.Sleeping(20)
M.drowsyness = max(M.drowsyness, 60) M.drowsyness = max(M.drowsyness, 60)
/datum/reagent/drink/milkshake/chocoshake /datum/reagent/drink/milkshake/chocoshake
@@ -2168,7 +2168,7 @@
..() ..()
M.dizziness = max(0, M.dizziness - 5) M.dizziness = max(0, M.dizziness - 5)
M.drowsyness = max(0, M.drowsyness - 3) M.drowsyness = max(0, M.drowsyness - 3)
M.sleeping = max(0, M.sleeping - 2) M.AdjustSleeping(-2)
if(M.bodytemperature > 310) if(M.bodytemperature > 310)
M.bodytemperature = max(310, M.bodytemperature - (5 * TEMPERATURE_DAMAGE_COEFFICIENT)) M.bodytemperature = max(310, M.bodytemperature - (5 * TEMPERATURE_DAMAGE_COEFFICIENT))
//if(alien == IS_TAJARA) //if(alien == IS_TAJARA)

View File

@@ -197,7 +197,7 @@
M.drowsyness = 0 M.drowsyness = 0
M.stuttering = 0 M.stuttering = 0
M.SetConfused(0) M.SetConfused(0)
M.sleeping = 0 M.SetSleeping(0)
M.jitteriness = 0 M.jitteriness = 0
M.radiation = 0 M.radiation = 0
M.ExtinguishMob() M.ExtinguishMob()

View File

@@ -170,7 +170,7 @@
/datum/reagent/toxin/cyanide/affect_blood(var/mob/living/carbon/M, var/alien, var/removed) /datum/reagent/toxin/cyanide/affect_blood(var/mob/living/carbon/M, var/alien, var/removed)
..() ..()
M.adjustOxyLoss(20 * removed) M.adjustOxyLoss(20 * removed)
M.sleeping += 1 M.Sleeping(1)
/datum/reagent/toxin/mold /datum/reagent/toxin/mold
name = "Mold" name = "Mold"
@@ -645,7 +645,7 @@
else else
M.Weaken(2) M.Weaken(2)
else else
M.sleeping = max(M.sleeping, 20) M.Sleeping(20)
M.drowsyness = max(M.drowsyness, 60) M.drowsyness = max(M.drowsyness, 60)
/datum/reagent/chloralhydrate /datum/reagent/chloralhydrate
@@ -689,7 +689,7 @@
M.Weaken(30) M.Weaken(30)
M.Confuse(40) M.Confuse(40)
else else
M.sleeping = max(M.sleeping, 30) M.Sleeping(30)
if(effective_dose > 1 * threshold) if(effective_dose > 1 * threshold)
M.adjustToxLoss(removed) M.adjustToxLoss(removed)

View File

@@ -404,7 +404,7 @@
stage = 2 stage = 2
/datum/disease2/effect/blind/activate(var/mob/living/carbon/mob,var/multiplier) /datum/disease2/effect/blind/activate(var/mob/living/carbon/mob,var/multiplier)
mob.eye_blind = max(mob.eye_blind, 4) mob.SetBlinded(4)
/datum/disease2/effect/cough /datum/disease2/effect/cough
name = "Severe Cough" name = "Severe Cough"

View File

@@ -194,7 +194,7 @@
'sound/hallucinations/turn_around1.ogg',\ 'sound/hallucinations/turn_around1.ogg',\
'sound/hallucinations/turn_around2.ogg',\ 'sound/hallucinations/turn_around2.ogg',\
), 50, 1, -3) ), 50, 1, -3)
M.sleeping = max(M.sleeping,rand(5,10)) M.Sleeping(rand(5, 10))
src.loc = null src.loc = null
else else
STOP_PROCESSING(SSobj, src) STOP_PROCESSING(SSobj, src)

View File

@@ -21,7 +21,7 @@
var/turf/T = get_turf(suspension_field) var/turf/T = get_turf(suspension_field)
for(var/mob/living/M in T) for(var/mob/living/M in T)
M.weakened = max(M.weakened, 3) M.Weaken(3)
cell.charge -= power_use cell.charge -= power_use
if(prob(5)) if(prob(5))
to_chat(M, "<span class='warning'>[pick("You feel tingly","You feel like floating","It is hard to speak","You can barely move")].</span>") to_chat(M, "<span class='warning'>[pick("You feel tingly","You feel like floating","It is hard to speak","You can barely move")].</span>")
@@ -208,7 +208,7 @@
for(var/mob/living/M in T) for(var/mob/living/M in T)
to_chat(M, "<span class='info'>You no longer feel like floating.</span>") to_chat(M, "<span class='info'>You no longer feel like floating.</span>")
M.weakened = min(M.weakened, 3) M.Weaken(3)
src.visible_message("<font color='blue'>[bicon(src)] [src] deactivates with a gentle shudder.</font>") src.visible_message("<font color='blue'>[bicon(src)] [src] deactivates with a gentle shudder.</font>")
qdel(suspension_field) qdel(suspension_field)

Binary file not shown.

After

Width:  |  Height:  |  Size: 576 B

View File

@@ -2418,6 +2418,7 @@
#include "code\modules\mob\living\login.dm" #include "code\modules\mob\living\login.dm"
#include "code\modules\mob\living\logout.dm" #include "code\modules\mob\living\logout.dm"
#include "code\modules\mob\living\say.dm" #include "code\modules\mob\living\say.dm"
#include "code\modules\mob\living\status_indicators.dm"
#include "code\modules\mob\living\bot\bot.dm" #include "code\modules\mob\living\bot\bot.dm"
#include "code\modules\mob\living\bot\bot_vr.dm" #include "code\modules\mob\living\bot\bot_vr.dm"
#include "code\modules\mob\living\bot\cleanbot.dm" #include "code\modules\mob\living\bot\cleanbot.dm"