Reading a photo with blueprints now requires squinting (#82984)

## About The Pull Request

To see the wires in a photo of blueprints you first must squint at them.

## Why It's Good For The Game

Realism, a picture of blueprints taken from across the room makes it
difficult to see what's up

## Changelog

🆑 Melbert
balance: To see wires in photos of blueprints, you first must squint at
the photo.
/🆑
This commit is contained in:
MrMelbert
2024-05-07 18:12:48 -05:00
committed by GitHub
parent 2253dd6426
commit cf27199e7e
+39 -4
View File
@@ -41,6 +41,9 @@
/// If every instance of these wires should be random. Prevents wires from showing up in station blueprints.
var/randomize = FALSE
/// Lazy assoc list of refs to mobs to refs to photos they have studied for wires
var/list/studied_photos
/datum/wires/New(atom/holder)
..()
if(!istype(holder, holder_type))
@@ -261,10 +264,10 @@
if(!randomize)
if(user.is_holding_item_of_type(/obj/item/blueprints))
return TRUE
for(var/obj/item/photo/photo in user.held_items)
if(!photo.picture || !photo.picture.has_blueprints)
continue
return TRUE
if(!isnull(user.mind))
for(var/obj/item/photo/photo in user.held_items)
if(LAZYACCESS(studied_photos, REF(user.mind)) == REF(photo))
return TRUE
return FALSE
@@ -279,6 +282,37 @@
/datum/wires/proc/always_reveal_wire(color)
return FALSE
#define STUDY_INTERACTION_KEY "studying_photo"
/**
* Attempts to study a photo for blueprints.
*/
/datum/wires/proc/try_study_photo(mob/user)
if(randomize)
return
if(isnull(user.mind))
return
if(DOING_INTERACTION(user, STUDY_INTERACTION_KEY))
return
if(LAZYACCESS(studied_photos, REF(user.mind)))
return
for(var/obj/item/photo/photo in user.held_items)
if(!photo.picture?.has_blueprints)
continue
var/study_length = 1 SECONDS * floor(min(photo.picture.psize_x, photo.picture.psize_y) / 32)
if(study_length >= 4 SECONDS)
to_chat(user, span_notice("<i>You squint [photo]... Hey, there's blueprints in the frame! Really wish the photo was zoomed in, though. \
It's rather difficult to make out the wires.</i>"))
else
to_chat(user, span_notice("<i>You glance at [photo], looking for wires in the pictured blueprints.</i>"))
if(do_after(user, study_length, holder, interaction_key = STUDY_INTERACTION_KEY, hidden = TRUE))
LAZYSET(studied_photos, REF(user.mind), REF(photo))
return
#undef STUDY_INTERACTION_KEY
/datum/wires/ui_host()
return holder
@@ -295,6 +329,7 @@
if (!ui)
ui = new(user, src, "Wires", "[holder.name] Wires")
ui.open()
try_study_photo(user)
/datum/wires/ui_data(mob/user)
var/list/data = list()