Skip to content

Commit fbc1225

Browse files
authored
Whispers project over tables (#874)
1 parent 9b33eb1 commit fbc1225

3 files changed

Lines changed: 26 additions & 1 deletion

File tree

code/__DEFINES/living.dm

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,11 @@
126126
/// Just be sure to call update_limbless_locomotion() after applying / removal
127127
#define TRAIT_NO_LEG_AID "no_leg_aid"
128128

129+
/// Attach to a turf to have whispers project across it if the speaker is facing it
130+
/// (basically expanding the range of whispers by one tile in the direction of the speaker)
131+
/// Used to allow people to whisper across desks/tables since they otherwise are too distant
132+
#define TRAIT_TURF_PROJECTS_WHISPERS "projects_whispers"
133+
129134
#define COLOR_BLOOD "#c90000"
130135

131136
/// Helper for picking between left or right when given a value

code/game/objects/structures/tables_racks.dm

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,14 @@
5454
)
5555

5656
AddElement(/datum/element/connect_loc, loc_connections)
57-
var/static/list/give_turf_traits = list(TRAIT_TURF_IGNORE_SLOWDOWN, TRAIT_TURF_IGNORE_SLIPPERY, TRAIT_IMMERSE_STOPPED)
57+
// NON-MODULE CHANGE
58+
var/static/list/give_turf_traits = list(
59+
TRAIT_TURF_IGNORE_SLOWDOWN,
60+
TRAIT_TURF_IGNORE_SLIPPERY,
61+
TRAIT_IMMERSE_STOPPED,
62+
TRAIT_TURF_PROJECTS_WHISPERS,
63+
)
64+
5865
AddElement(/datum/element/give_turf_traits, give_turf_traits)
5966
register_context()
6067

code/modules/mob/living/living_say.dm

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,12 @@ GLOBAL_LIST_INIT(department_radio_keys, list(
279279

280280
var/message = ""
281281
var/raw_dist = get_dist(speaker, src)
282+
// NON-MODULE CHANGE - check for projected whispers, calculate distance from the projected tile if so
283+
if(message_mods[WHISPER_MODE] && message_range != INFINITY)
284+
var/turf/in_front = get_step(speaker, speaker.dir)
285+
if(in_front && HAS_TRAIT(in_front, TRAIT_TURF_PROJECTS_WHISPERS))
286+
raw_dist = min(raw_dist, get_dist(in_front, src))
287+
282288
// Infinite range implies something like telecomms, ie something that should never be distance modified
283289
if(!HAS_TRAIT(src, TRAIT_GOOD_HEARING) && message_range != INFINITY)
284290
// How far we are we outside the message range?
@@ -388,6 +394,13 @@ GLOBAL_LIST_INIT(department_radio_keys, list(
388394
var/list/in_view = get_hearers_in_view(message_range + whisper_range, source)
389395
var/list/listening = get_hearers_in_range(message_range + whisper_range, source)
390396

397+
// NON-MODULE CHANGE - check for projected whispers, add new potential hearers if so
398+
if(is_speaker_whispering)
399+
var/turf/in_front = get_step(src, dir)
400+
if(in_front && HAS_TRAIT(in_front, TRAIT_TURF_PROJECTS_WHISPERS))
401+
in_view |= get_hearers_in_view(message_range + whisper_range, in_front)
402+
listening |= get_hearers_in_range(message_range + whisper_range, in_front)
403+
391404
// Pre-process listeners to account for line-of-sight
392405
for(var/atom/movable/listening_movable as anything in listening)
393406
if(!(listening_movable in in_view) && !HAS_TRAIT(listening_movable, TRAIT_XRAY_HEARING))

0 commit comments

Comments
 (0)