Skip to content

Commit

Permalink
Merge pull request tgstation#52727 from MrMelbert/touchyfeely
Browse files Browse the repository at this point in the history
Allows blind people to touch things to examine them
  • Loading branch information
kriskog authored Aug 7, 2020
2 parents dd23b1b + f14abf7 commit 9ce3040
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 7 deletions.
3 changes: 2 additions & 1 deletion code/game/objects/structures/displaycase.dm
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,8 @@
if (!Adjacent(user))
return
if (user.a_intent == INTENT_HELP)
user.examinate(src)
if(!user.is_blind())
user.examinate(src)
return
user.visible_message("<span class='danger'>[user] kicks the display case.</span>", null, null, COMBAT_MESSAGE_RANGE)
log_combat(user, src, "kicks")
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/structures/plaques/_plaques.dm
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

/obj/structure/plaque/attack_hand(mob/user)
. = ..()
if(.)
if(. || user.is_blind())
return
user.examinate(src)

Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/structures/signs/_signs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

/obj/structure/sign/attack_hand(mob/user)
. = ..()
if(.)
if(. || user.is_blind())
return
user.examinate(src)

Expand Down
2 changes: 1 addition & 1 deletion code/modules/mining/laborcamp/laborstacker.dm
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ GLOBAL_LIST(labor_sheet_values)

/obj/machinery/mineral/labor_points_checker/attack_hand(mob/user)
. = ..()
if(.)
if(. || user.is_blind())
return
user.examinate(src)

Expand Down
38 changes: 35 additions & 3 deletions code/modules/mob/mob.dm
Original file line number Diff line number Diff line change
Expand Up @@ -446,9 +446,41 @@
// shift-click catcher may issue examinate() calls for out-of-sight turfs
return

if(is_blind())
to_chat(src, "<span class='warning'>Something is there but you can't see it!</span>")
return
if(is_blind()) //blind people see things differently (through touch)
//need to be next to something and awake
if(!in_range(A, src) || incapacitated())
to_chat(src, "<span class='warning'>Something is there, but you can't see it!</span>")
return
//also neeed an empty hand, and you can only initiate as many examines as you have hands
if(LAZYLEN(do_afters) >= get_num_arms() || get_active_held_item())
to_chat(src, "<span class='warning'>You don't have a free hand to examine this!</span>")
return
//can only queue up one examine on something at a time
if(A in do_afters)
return

to_chat(src, "<span class='notice'>You start feeling around for something...</span>")
visible_message("<span class='notice'> [name] begins feeling around for \the [A.name]...</span>")

/// how long it takes for the blind person to find the thing they're examining
var/examine_delay_length = rand(1 SECONDS, 2 SECONDS)
if(client?.recent_examines && client?.recent_examines[A]) //easier to find things we just touched
examine_delay_length = 0.5 SECONDS
else if(isobj(A))
examine_delay_length *= 1.5
else if(ismob(A) && A != src)
examine_delay_length *= 2

if(examine_delay_length > 0 && !do_after(src, examine_delay_length, target = A))
to_chat(src, "<span class='notice'>You can't get a good feel for what is there.</span>")
return

//now we touch the thing we're examining
/// our current intent, so we can go back to it after touching
var/previous_intent = a_intent
a_intent = INTENT_HELP
A.attack_hand(src)
a_intent = previous_intent

face_atom(A)
var/list/result
Expand Down

0 comments on commit 9ce3040

Please sign in to comment.