mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-19 03:55:11 +01:00
21b4095dfd
Upstream 04/17/2026 fixes https://github.com/Bubberstation/Bubberstation/issues/5549 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: tgstation-ci[bot] <179393467+tgstation-ci[bot]@users.noreply.github.com> Co-authored-by: ArcaneMusic <41715314+ArcaneMusic@users.noreply.github.com> Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com> Co-authored-by: Rhials <28870487+Rhials@users.noreply.github.com> Co-authored-by: rageguy505 <54517726+rageguy505@users.noreply.github.com> Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com> Co-authored-by: John Willard <53777086+JohnFulpWillard@users.noreply.github.com> Co-authored-by: Aliceee2ch <160794176+Aliceee2ch@users.noreply.github.com> Co-authored-by: Time-Green <7501474+Time-Green@users.noreply.github.com> Co-authored-by: Tsar-Salat <62388554+Tsar-Salat@users.noreply.github.com> Co-authored-by: SmArtKar <44720187+SmArtKar@users.noreply.github.com> Co-authored-by: Maxipat <108554989+Maxipat112@users.noreply.github.com> Co-authored-by: SyncIt21 <110812394+SyncIt21@users.noreply.github.com> Co-authored-by: deltanedas <39013340+deltanedas@users.noreply.github.com> Co-authored-by: SimplyLogan <47579821+loganuk@users.noreply.github.com> Co-authored-by: loganuk <fakeemail123@aol.com> Co-authored-by: Leland Kemble <70413276+lelandkemble@users.noreply.github.com> Co-authored-by: FalloutFalcon <86381784+FalloutFalcon@users.noreply.github.com> Co-authored-by: Roxy <75404941+TealSeer@users.noreply.github.com> Co-authored-by: Lucy <lucy@absolucy.moe> Co-authored-by: siliconOpossum <138069572+siliconOpossum@users.noreply.github.com> Co-authored-by: Isratosh <Isratosh@hotmail.com> Co-authored-by: TheRyeGuyWhoWillNowDie <70169560+TheRyeGuyWhoWillNowDie@users.noreply.github.com> Co-authored-by: Neocloudy <88008002+Neocloudy@users.noreply.github.com> Co-authored-by: Alexander V. <volas@ya.ru> Co-authored-by: ElGitificador <168473461+ElGitificador@users.noreply.github.com> Co-authored-by: Twaticus <46540570+Twaticus@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Bloop <13398309+vinylspiders@users.noreply.github.com> Co-authored-by: Cameron Lennox <killer65311@gmail.com> Co-authored-by: Tim <timothymtorres@gmail.com> Co-authored-by: Iamgoofball <iamgoofball@gmail.com> Co-authored-by: Layzu666 <121319428+Layzu666@users.noreply.github.com> Co-authored-by: Arturlang <24881678+Arturlang@users.noreply.github.com> Co-authored-by: _0Steven <42909981+00-Steven@users.noreply.github.com> Co-authored-by: mrmanlikesbt <99309552+mrmanlikesbt@users.noreply.github.com> Co-authored-by: Ben10Omintrix <138636438+Ben10Omintrix@users.noreply.github.com> Co-authored-by: John F. Kennedy <54908920+MacaroniCritter@users.noreply.github.com> Co-authored-by: Cursor <102828457+theselfish@users.noreply.github.com> Co-authored-by: Josh <josh.adam.powell@gmail.com> Co-authored-by: Josh Powell <josh.powell@softwire.com> Co-authored-by: Yobrocharlie <Charliemiller5617@gmail.com> Co-authored-by: Hardly3D <66234359+Hardly3D@users.noreply.github.com> Co-authored-by: shayoki <96078776+shayoki@users.noreply.github.com> Co-authored-by: LT3 <83487515+lessthnthree@users.noreply.github.com>
121 lines
4.1 KiB
Plaintext
121 lines
4.1 KiB
Plaintext
/// Helper macro, for ease of expanding checks for mobs which cannot be blinded
|
|
/// There are no reason why these cannot be blinded, it is simply for "design reasons" (these things shouldn't be blinded)
|
|
#define CAN_BE_BLIND(mob) (!isanimal_or_basicmob(mob) && !isbrain(mob) && !isrevenant(mob))
|
|
|
|
/// Blindness
|
|
/datum/status_effect/grouped/blindness
|
|
// This is not "remove on fullheal" as in practice,
|
|
// fullheal should instead remove all the sources and in turn cure this
|
|
id = "blindness"
|
|
tick_interval = STATUS_EFFECT_NO_TICK
|
|
alert_type = /atom/movable/screen/alert/status_effect/blind
|
|
var/static/list/update_signals = list(
|
|
SIGNAL_REMOVETRAIT(TRAIT_SIGHT_BYPASS),
|
|
SIGNAL_ADDTRAIT(TRAIT_SIGHT_BYPASS),
|
|
)
|
|
/// List of sources which prevent SIGHT_BYPASS from working
|
|
var/static/list/blocking_sources = list(
|
|
QUIRK_TRAIT, // Meant to be completely immutable
|
|
UNCONSCIOUS_TRAIT, // Duh
|
|
)
|
|
|
|
/datum/status_effect/grouped/blindness/on_apply()
|
|
if (!CAN_BE_BLIND(owner))
|
|
return FALSE
|
|
|
|
RegisterSignals(owner, update_signals, PROC_REF(update_blindness))
|
|
return ..()
|
|
|
|
/datum/status_effect/grouped/blindness/source_added(source, ...)
|
|
update_blindness(source)
|
|
|
|
/datum/status_effect/grouped/blindness/source_removed(source, removing)
|
|
if (!removing)
|
|
update_blindness(source)
|
|
|
|
/datum/status_effect/grouped/blindness/proc/update_blindness(changed_source)
|
|
if (!CAN_BE_BLIND(owner)) // future proofing
|
|
qdel(src)
|
|
return
|
|
|
|
if (!HAS_TRAIT(owner, TRAIT_SIGHT_BYPASS))
|
|
make_blind(changed_source)
|
|
return
|
|
|
|
for (var/blocker in blocking_sources)
|
|
if (owner.is_blind_from(blocker))
|
|
make_blind(changed_source)
|
|
return
|
|
|
|
make_unblind()
|
|
|
|
/datum/status_effect/grouped/blindness/proc/make_blind(changed_source)
|
|
// have some extra logic to determine what overlay to use
|
|
// by default we use the noflicker overlay
|
|
// but if our one and only source is from "temp blindness", use flicker overlay
|
|
var/overlay_to_use = /atom/movable/screen/fullscreen/blind/noflicker
|
|
if(changed_source == /datum/status_effect/temporary_blindness::id && length(sources) == 1)
|
|
overlay_to_use = /atom/movable/screen/fullscreen/blind
|
|
owner.overlay_fullscreen(id, overlay_to_use )
|
|
// You are blind - at most, able to make out shapes near you
|
|
owner.add_client_colour(/datum/client_colour/blindness, REF(src))
|
|
|
|
/datum/status_effect/grouped/blindness/proc/make_unblind()
|
|
owner.clear_fullscreen(id)
|
|
owner.remove_client_colour(REF(src))
|
|
|
|
/datum/status_effect/grouped/blindness/on_remove()
|
|
make_unblind()
|
|
UnregisterSignal(owner, update_signals)
|
|
return ..()
|
|
|
|
/atom/movable/screen/alert/status_effect/blind
|
|
name = "Blind"
|
|
desc = "You can't see! This may be caused by a genetic defect, eye trauma, being unconscious, or something covering your eyes."
|
|
use_user_hud_icon = USER_HUD_STYLE_INHERIT
|
|
overlay_state = "blind"
|
|
|
|
/// This status effect handles applying a temporary blind to the mob.
|
|
/datum/status_effect/temporary_blindness
|
|
id = "temporary_blindness"
|
|
tick_interval = 2 SECONDS
|
|
alert_type = null
|
|
remove_on_fullheal = TRUE
|
|
|
|
/datum/status_effect/temporary_blindness/on_creation(mob/living/new_owner, duration = 10 SECONDS)
|
|
src.duration = duration
|
|
return ..()
|
|
|
|
/datum/status_effect/temporary_blindness/on_apply()
|
|
if(!CAN_BE_BLIND(owner))
|
|
return FALSE
|
|
|
|
owner.become_blind(id)
|
|
return TRUE
|
|
|
|
/datum/status_effect/temporary_blindness/on_remove()
|
|
owner.cure_blind(id)
|
|
|
|
/datum/status_effect/temporary_blindness/tick(seconds_between_ticks)
|
|
if(owner.stat == DEAD)
|
|
return
|
|
|
|
// Temp. blindness heals faster if our eyes are covered
|
|
if(!owner.is_blind_from(EYES_COVERED))
|
|
return
|
|
|
|
// Knocks 2 seconds off of our duration
|
|
// If we should be deleted, give a message letting them know
|
|
var/mob/living/stored_owner = owner
|
|
if(remove_duration(2 SECONDS))
|
|
to_chat(stored_owner, span_green("Your eyes start to feel better!"))
|
|
return
|
|
|
|
// Otherwise add a chance to let them know that it's working
|
|
else if(SPT_PROB(5, seconds_between_ticks))
|
|
var/obj/item/thing_covering_eyes = owner.is_eyes_covered()
|
|
// "Your blindfold soothes your eyes", for example
|
|
to_chat(owner, span_green("Your [thing_covering_eyes?.name || "eye covering"] soothes your eyes."))
|
|
|
|
#undef CAN_BE_BLIND
|