Skip to content

Commit

Permalink
Merge pull request #127 from Superlagg/cus-some-fuckin-dildo-decided-…
Browse files Browse the repository at this point in the history
…to-eat-a-million-clams-and-scream-for-hours-on-end-and-it-was-so-loud-the-giant-dragon-couldnt-appreciate-the-cat-touching-his-balls

Sound no longer travels through walls, bit it can go through floors
  • Loading branch information
Tk420634 authored Dec 8, 2024
2 parents 36f8279 + 5312c51 commit 3f2f463
Show file tree
Hide file tree
Showing 13 changed files with 292 additions and 110 deletions.
1 change: 1 addition & 0 deletions code/__DEFINES/voreconstants.dm
Original file line number Diff line number Diff line change
Expand Up @@ -314,3 +314,4 @@ GLOBAL_LIST_INIT(prey_release_sounds, list(
#define LOCK_STUFF_ON_LOGOUT "LOCK_STUFF_ON_LOGOUT"
#define USE_AUTO_CONTRAST "USE_AUTO_CONTRAST"
#define SHOW_ME_HORNY_RADIO "SHOW_ME_HORNY_RADIO"
#define HEAR_PEOPLE_ON_OTHER_ZS "HEAR_PEOPLE_ON_OTHER_ZS"
49 changes: 35 additions & 14 deletions code/__HELPERS/game.dm
Original file line number Diff line number Diff line change
Expand Up @@ -311,12 +311,15 @@ GLOBAL_LIST_EMPTY(chat_chuds)
var/list/visible_far = list()
var/list/hidden_pathable = list()
var/list/hidden_inaccessible = list()
var/list/on_another_z = list()
var/ready = TRUE

/datum/chatchud/proc/putback()
visible_close.Cut()
visible_far.Cut()
hidden_pathable.Cut()
hidden_inaccessible.Cut()
on_another_z.Cut()
ready = TRUE // snip snip no jutsu wuz here

/obj/effect/temp_visual/debug_heart
Expand Down Expand Up @@ -377,7 +380,7 @@ GLOBAL_LIST_EMPTY(chat_chuds)
var/close_range = momchat.close_message_range
var/long_range = momchat.far_message_range
var/cheapo = FALSE
if(!isplayer(source) && !istype(source, /mob/living/simple_animal/debug_chatterboy))
if(!isplayer(source) && !istype(source, /mob/living/carbon/human/debug_chatterboy))
long_range = min(long_range, 7)
close_range = min(close_range, 7) // raiders screamed so hard the server lagged
cheapo = TRUE
Expand All @@ -386,15 +389,33 @@ GLOBAL_LIST_EMPTY(chat_chuds)
var/private = A.private
var/datum/chatchud/CC = get_chatchud(source)
var/turf/source_turf = get_turf(source)
var/turf/upper_turf = SSmapping.get_turf_above(source_turf)
var/turf/lower_turf = SSmapping.get_turf_below(source_turf)
var/debug_i = 0
dingus:
for(var/client/C in GLOB.clients)
var/mob/M = C.mob
if(isnewplayer(M))
continue dingus // quit talkin to ghosts, unless ur an admeme
var/turf/viewer_turf = get_turf(M)
if(source_turf.z != viewer_turf.z) // TODO: let people yell up stairs
continue dingus
var/turf/cool_source_turf = source_turf
var/on_another_z = FALSE
if(source_turf.z != viewer_turf.z) // TODO: let people yell up stairs // todone
if(!CHECK_PREFS(M, HEAR_PEOPLE_ON_OTHER_ZS))
continue dingus
if(momchat.is_quiet)
continue dingus
if(momchat.is_loud)
if(upper_turf && viewer_turf.z == upper_turf.z)
cool_source_turf = upper_turf
on_another_z = TRUE
CC.on_another_z[M] = upper_turf
else if(lower_turf && viewer_turf.z == lower_turf.z)
cool_source_turf = lower_turf
on_another_z = TRUE
CC.on_another_z[M] = lower_turf
else
continue dingus
var/am_widescreen = C.prefs.widescreenpref
var/westest
if(am_widescreen)
Expand Down Expand Up @@ -429,21 +450,21 @@ GLOBAL_LIST_EMPTY(chat_chuds)
t_southwest.Beam(t_northwest, icon_state = "1-full", time = 3 SECONDS)
var/in_close_view
if(SSchat.debug_use_cool_los_proc)
in_close_view = isInSight(source_turf, viewer_turf)
in_close_view = isInSight(cool_source_turf, viewer_turf)
else
in_close_view = (source_turf in things_in_viewer_los)
var/in_rect = IS_IN_VIEWER_RECT(source_turf)
if(!in_rect && get_dist(source_turf, viewer_turf) > long_range)
in_close_view = (cool_source_turf in things_in_viewer_los)
var/in_rect = IS_IN_VIEWER_RECT(cool_source_turf)
if(!in_rect && get_dist(cool_source_turf, viewer_turf) > long_range)
continue dingus
// basic visibility, fulfills these conditions:
// 1. must be in the box of visibility, so we dont have to play with pathing nonsense
// 2. must be in the line of sight of the hearer, so it shouldnt be over darkness
// basically if they're on screen, and either of the ranges are met, they're visible and we can skip the pathing
if(in_rect && in_close_view)
if(get_dist(source_turf, viewer_turf) <= close_range)
if(in_rect && in_close_view && !on_another_z)
if(get_dist(cool_source_turf, viewer_turf) <= close_range)
CC.visible_close[M] = TRUE
continue dingus
// else if(get_dist(source_turf, viewer_turf) <= long_range)
// else if(get_dist(cool_source_turf, viewer_turf) <= long_range)
// CC.visible_far[M] = TRUE
// continue dingus
// if the source is in a Private area,
Expand All @@ -452,12 +473,12 @@ GLOBAL_LIST_EMPTY(chat_chuds)
if(private)
continue dingus
// if(in_rect && !quiet)
// CC.hidden_pathable[M] = source_turf // close enough
// CC.hidden_pathable[M] = cool_source_turf // close enough
// continue dingus
// now the fun begins. Try to find a path to them
var/list/soundwalk = cheapo\
? getline(source_turf, viewer_turf)\
: get_path_to(source_turf, viewer_turf, long_range, use_visibility = TRUE) // yes i'm using expensive pathfinding for horny moaning, I'm an expensive date
? getline(cool_source_turf, viewer_turf)\
: get_path_to(cool_source_turf, viewer_turf, long_range, use_visibility = TRUE) // yes i'm using expensive pathfinding for horny moaning, I'm an expensive date
// they're closed off, no path to them, but they're still within long range
if(!islist(soundwalk))
CC.hidden_inaccessible[M] = TRUE // mark them as hidden
Expand All @@ -469,7 +490,7 @@ GLOBAL_LIST_EMPTY(chat_chuds)
// 1. must be in the box of visibility
// 2. must be in the line of sight of the hearer
debug_i = 0
var/list/ccline = getline(source_turf, viewer_turf) // know that cool pathfinding stuff? throw it out, just needed it for seeing if we can reach em!
var/list/ccline = getline(cool_source_turf, viewer_turf) // know that cool pathfinding stuff? throw it out, just needed it for seeing if we can reach em!
var/cole = SSchat.debug_chud && safepick("#FF0000", "#00FF00", "#0000FF", "#FFFF00", "#FF00FF", "#00FFFF")
for(var/turf/T as anything in ccline) // for each step we take...
if(SSchat.debug_chud)
Expand Down
4 changes: 2 additions & 2 deletions code/__HELPERS/path.dm
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
qdel(pathfind_datum)

SSpathfinder.mobs.found(l)
if(!path)
path = list()
// if(!path)
// path = list()
return path

/**
Expand Down
18 changes: 18 additions & 0 deletions code/controllers/subsystem/datumrentals.dm
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,12 @@ SUBSYSTEM_DEF(rentaldatums)
var/langtreated
var/cant_language
var/is_thing
var/is_loud
var/is_muffled
var/dots_distance
var/dots_maxdistance
var/dots_some_anyway
var/dots_please

/datum/rental_mommy/chat/copy_mommy(datum/rental_mommy/chat/mommy)
if(!..())
Expand Down Expand Up @@ -231,6 +237,12 @@ SUBSYSTEM_DEF(rentaldatums)
langtreated = mommy.langtreated
cant_language = mommy.cant_language
is_thing = mommy.is_thing
is_loud = mommy.is_loud
is_muffled = mommy.is_muffled
dots_distance = mommy.dots_distance
dots_maxdistance = mommy.dots_maxdistance
dots_some_anyway = mommy.dots_some_anyway
dots_please = mommy.dots_please

/datum/rental_mommy/chat/wipe()
original_message = ""
Expand Down Expand Up @@ -300,6 +312,12 @@ SUBSYSTEM_DEF(rentaldatums)
langtreated = null
cant_language = null
is_thing = null
is_loud = null
is_muffled = null
dots_distance = null
dots_maxdistance = null
dots_some_anyway = null
dots_please = null

// /// Know what, know what? screw it, I'm compiling all the chat procs into this datum
// /datum/rental_mommy/chat/proc/handle_say(
Expand Down
8 changes: 8 additions & 0 deletions code/controllers/subsystem/prefbreak.dm
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,14 @@ SUBSYSTEM_DEF(prefbreak) // ALL ABOARD THE S.S. PREFBREAK OFF TO **** YOUR *****
return CHECK_BITFIELD(consumer.chat_toggles, CHAT_SEE_COOLCHAT) // kinda vital here
// return consumer.see_fancy_offscreen_runechat // kinda vital here

/datum/prefcheck/hear_people_on_other_zs
index = HEAR_PEOPLE_ON_OTHER_ZS

/datum/prefcheck/hear_people_on_other_zs/allowed(datum/preferences/consumer)
PREFBROKEN
return consumer.hear_people_on_other_zs // kinda vital here
// return consumer.see_fancy_offscreen_runechat // kinda vital here

///////////////////////////////////////////////////////////////////////////////////
/datum/prefcheck/stash_equipment_on_logout
index = DUMP_STUFF_ON_LOGOUT
Expand Down
10 changes: 9 additions & 1 deletion code/datums/chatmessage.dm
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ GLOBAL_LIST_INIT(verbal_punch_lasers, list(null,null,null,null,null,null,null,nu
var/turf/alt_display
var/stick_on_turf
var/is_thing
var/muffled

/**
* Constructs a chat message overlay
Expand Down Expand Up @@ -72,6 +73,8 @@ GLOBAL_LIST_INIT(verbal_punch_lasers, list(null,null,null,null,null,null,null,nu
target = target.loc
if(mommy.runechat_mode == "hidden_pathable")
stick_on_turf = TRUE
if(mommy.is_muffled)
muffled = TRUE
else
alt_display = data["display_turf"] || null
if((get_dist(owner, (alt_display || target)) > 6 || data["is_far"])) // SD screens are 7 radius, but the UI covers a bit of that
Expand Down Expand Up @@ -237,10 +240,15 @@ GLOBAL_LIST_INIT(verbal_punch_lasers, list(null,null,null,null,null,null,null,nu
var/alphatomakeit = 255
if(eavesdrop)
alphatomakeit /= 2
message.transform = message.transform.Scale(0.75)
if(offscreen)
alphatomakeit /= 1.5
message.pixel_x = rand(-40, 40)
message.pixel_y = rand(-40, 40)
message.transform = message.transform.Scale(0.75)
if(muffled)
alphatomakeit /= 4
message.transform = message.transform.Scale(0.75)
// if((SPAN_SMALL in extra_classes) || (SPAN_SMALLER in extra_classes))
// alphatomakeit /= 2

Expand Down Expand Up @@ -303,7 +311,7 @@ GLOBAL_LIST_INIT(verbal_punch_lasers, list(null,null,null,null,null,null,null,nu
if(runechat_flags & EMOTE_MESSAGE)
new /datum/chatmessage(raw_message, speaker, src, list("emote", "italics"), null, data, mommy)
else
new /datum/chatmessage(lang_treat(speaker, message_language, raw_message, spans, null, TRUE), speaker, src, spans, null, data, mommy)
new /datum/chatmessage(lang_treat(speaker, message_language, raw_message, spans, null, TRUE, mommy), speaker, src, spans, null, data, mommy)


// Tweak these defines to change the available color ranges
Expand Down
7 changes: 6 additions & 1 deletion code/game/say.dm
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ Dan's even bigger Say() rewrite.
momchat.original_speakername = namepart
//End name span.
var/endspanpart = "</span>"

//Message
var/messagepart = " <span class='message'>[lang_treat(speaker, message_language, raw_message, spans, message_mode, null, momchat)]</span></span>"

Expand Down Expand Up @@ -224,6 +224,11 @@ Dan's even bigger Say() rewrite.
no_quote = FALSE,
datum/rental_mommy/chat/momchat,
)

if(momchat?.dots_please)
raw_message = dots(raw_message, null, momchat.dots_distance, momchat.dots_maxdistance, momchat.dots_some_anyway)
momchat.dots_please = FALSE

var/atom/movable/AM = speaker.GetSource() || speaker || src
if(has_language(language))
if(momchat?.langtreated)
Expand Down
Loading

0 comments on commit 3f2f463

Please sign in to comment.