Skip to content

Commit

Permalink
Merge branch 'mommy-pwease-may-i-dispway-my-swuttiness-uwu' of https:…
Browse files Browse the repository at this point in the history
  • Loading branch information
Tk420634 committed Sep 23, 2024
2 parents 6ad19f5 + c53905e commit 71cbf2d
Show file tree
Hide file tree
Showing 39 changed files with 590 additions and 97 deletions.
4 changes: 4 additions & 0 deletions code/__DEFINES/dcs/signals.dm
Original file line number Diff line number Diff line change
Expand Up @@ -773,4 +773,8 @@
#define COMSIG_MOB_IS_IMPORTANT "COMSIG_MOB_IS_IMPORTANT" // ()


#define COMSIG_UPDATE_SOUND_BLOCKERS "COMSIG_UPDATE_SOUND_BLOCKERS" // ()
#define COMSIG_CHECK_SOUND_BLOCKERS "COMSIG_CHECK_SOUND_BLOCKERS" // ()



4 changes: 3 additions & 1 deletion code/__DEFINES/layers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@
#define MOB_PLANE -3 // Used for mobs rendering.
#define FIELD_OF_VISION_VISUAL_PLANE -2 //Yea, FoV does require quite a few planes to work with 513 filters to a decent degree.

#define CHAT_PLANE -1 //We don't want heard messages to be hidden by FoV.
#define CHAT_LAYER 12.1 //Legacy, it doesn't matter that much because we are displayed above the game plane anyway.

#define BLACKNESS_PLANE 0 //To keep from conflicts with SEE_BLACKNESS internals

#define CHAT_PLANE 2 //We don't want heard messages to be hidden by FoV.

#define SPACE_LAYER 1.8
//#define TURF_LAYER 2 //For easy recordkeeping; this is a byond define
#define MID_TURF_LAYER 2.02
Expand Down Expand Up @@ -122,6 +123,7 @@

///Normal 1 per turf dynamic lighting objects
#define LIGHTING_PLANE 100
#define RUNECHAT_PLANE (LIGHTING_PLANE + 1) // GOSH DARN IT LIGHTING, STOP EATING MY CHAT THINGS!

#define RAD_TEXT_LAYER 15.1

Expand Down
5 changes: 5 additions & 0 deletions code/__DEFINES/maths.dm
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,11 @@
var/roundie = 1 * (0.1**decimals)
return "[round(number, roundie)][unit]"

/// checks if a given turf's x/y coordinates fall within a given rectangle
/// xwest, ynorth, xeast, ysouth are the bounds of the rectangle
/// N/S is Y, Y increases as you go north
/// E/W is X, X increases as you go east
#define TURF_IN_RECTANGLE(turf, xwest, ynorth, xeast, ysouth) (turf.x >= xwest && turf.x <= xeast && turf.y >= ynorth && turf.y <= ysouth)


#define RANDOM(min, max) (rand(min*1000, max*1000)*0.001)
Expand Down
2 changes: 2 additions & 0 deletions code/__DEFINES/preferences.dm
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ GLOBAL_LIST_INIT(undie_position_strings, list("Under Clothes", "Over Clothes", "
#define PMC_UNBREAK_FAVORITE_PLAPS "/datum/interaction/bang/datum/interaction/funch" // Player Master Changelog
#define PMC_FENNY_FINISHED_124_QUESTS "and_killed_the_server" // Player Master Changelog
#define PMC_MY_PDA_FLIES_IN_FULL_COLOR "nekooooooooo" // Player Master Changelog
#define PMC_MOMMYCHAT_IS_COOL "ill be your mommy tonight uwu" // Player Master Changelog

/// The master Preferences Changelog to check the player's prefs against.
/// includes a list of actions that need to be taken to update the player's prefs.
Expand All @@ -157,6 +158,7 @@ GLOBAL_LIST_INIT(undie_position_strings, list("Under Clothes", "Over Clothes", "
PMC_DAN_MESSED_UP_WHO_STUFF,\
PMC_FENNY_FINISHED_124_QUESTS,\
PMC_MY_PDA_FLIES_IN_FULL_COLOR,\
PMC_MOMMYCHAT_IS_COOL,\
)

#define PMR_WHY_DOES_EVERYTHING_DEFAULT_TO_OFF "lookingatyouwiretap" // Player Master Changelog
Expand Down
3 changes: 3 additions & 0 deletions code/__DEFINES/say.dm
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
#define SPAN_SANS "sans"
#define SPAN_PAPYRUS "papyrus"
#define SPAN_REALLYBIG "reallybig"
#define SPAN_SMALL "small"
#define SPAN_SMALLER "small"
#define SPAN_COMMAND "command_headset"
#define SPAN_CLOWN "clown"
#define SPAN_SINGING "singing"
Expand Down Expand Up @@ -140,6 +142,7 @@
#define ONLY_OVERHEAD (1<<1)
// Append the player's name to the front
#define PUT_NAME_IN (1<<2)
#define IS_EAVESDROP (1<<3)

#define EMOTE_HEADER_TEXT "\
The Following Chat Functions Exist \n\
Expand Down
7 changes: 7 additions & 0 deletions code/__DEFINES/sound.dm
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@
#define SOUND_MINIMUM_PRESSURE 10
#define FALLOFF_SOUNDS 1

#define CLEAR_SOUND (1 << 0)
#define BLOCK_SOUND_COMPLETE (1 << 1)
#define BLOCK_SOUND_PARTIAL (1 << 2)
#define SOUND_BLOCK_CORNER (1 << 3)

//default byond sound environments
#define SOUND_ENVIRONMENT_NONE -1
#define SOUND_ENVIRONMENT_GENERIC 0
Expand Down Expand Up @@ -397,6 +402,8 @@
#define CSP_INDEX_DISTANT_RANGE "dsr"
/// they dont have to be 3 letters, I just like it

/// FUCK YOU COPILOT WHY THE FUCK ARE YOU CENSORING THE WORD TERRORIST FUCK YOU FUCK YOU
#define RADIO_STATIC_SOUND 'sound/effects/counter_terrorists_win.ogg'

/*
gun_sound_properties = list(
Expand Down
1 change: 1 addition & 0 deletions code/__DEFINES/span.dm
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@
#define span_singing(str) ("<span class='singing'>" + str + "</span>")
#define span_slime(str) ("<span class='slime'>" + str + "</span>")
#define span_small(str) ("<span class='small'>" + str + "</span>")
#define span_smaller(str) ("<span class='smaller'>" + str + "</span>")
#define span_smalldanger(str) ("<span class='smalldanger'>" + str + "</span>")
#define span_smallnotice(str) ("<span class='smallnotice'>" + str + "</span>")
#define span_smallnoticeital(str) ("<span class='smallnoticeital'>" + str + "</span>")
Expand Down
217 changes: 214 additions & 3 deletions code/__HELPERS/game.dm
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@
return


// Better recursive loop, technically sort of not actually recursive cause that shit is stupid, enjoy.
// Better recursive loop, technically sort of not actually recursive cause that sh1t is stupid, enjoy.
//No need for a recursive limit either
/proc/recursive_mob_check(atom/O,client_check=1,sight_check=1,include_radio=1)

Expand Down Expand Up @@ -238,7 +238,35 @@

return found_mobs

/proc/get_hearers_in_view(R, atom/source)
/obj/soundblocker
name = "Sound Blocker"
icon = 'icons/effects/landmarks_static.dmi'
icon_state = "tdome_admin" // trust me it makes sense
invisibility = INVISIBILITY_ABSTRACT
var/flag = BLOCK_SOUND_COMPLETE

/obj/soundblocker/partial
name = "Partial Sound Blocker"
icon_state = "tdome_observer"
flag = BLOCK_SOUND_PARTIAL

/obj/soundblocker/corner
name = "Corner Sound Blocker"
icon_state = "tdome_corner"
flag = BLOCK_SOUND_PARTIAL | SOUND_BLOCK_CORNER

/obj/soundblocker/Initialize()
. = ..()
RegisterSignal(get_turf(src), COMSIG_UPDATE_SOUND_BLOCKERS, PROC_REF(UpdateSoundBlockers))
RegisterSignal(get_turf(src), COMSIG_CHECK_SOUND_BLOCKERS, PROC_REF(CheckSoundBlockers))

/obj/soundblocker/proc/UpdateSoundBlockers()

/obj/soundblocker/proc/CheckSoundBlockers()



/proc/get_hearers_in_view(R, atom/source, exclude_players)
var/turf/T = get_turf(source)
. = list()
if(!T)
Expand All @@ -258,10 +286,193 @@
var/i = 0
while(i < length(processing))
var/atom/A = processing[++i]
processing += A.contents
if(exclude_players && istype(A, /mob))
var/mob/M = A
if(M.client)
continue // we'll get to them
if(A.flags_1 & HEAR_1)
. += A
SEND_SIGNAL(A, COMSIG_ATOM_HEARER_IN_VIEW, processing, .)
processing += A.contents

GLOBAL_LIST_EMPTY(chat_chuds)

/proc/get_chatchud(atom/source)
for(var/i in 1 to LAZYLEN(GLOB.chat_chuds))
var/datum/chatchud/chud = GLOB.chat_chuds[i]
if(chud.ready)
return chud
var/datum/chatchud/chud = new /datum/chatchud()
GLOB.chat_chuds += chud
return chud

/datum/chatchud
var/list/visible_close = list()
var/list/visible_far = list()
var/list/hidden_pathable = list()
var/list/hidden_inaccessible = list()
var/ready = TRUE

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

/obj/effect/temp_visual/debug_heart
name = "love heart"
icon = 'icons/effects/effects.dmi'
icon_state = "heart"
duration = 2 SECONDS

/obj/effect/temp_visual/numbers
name = "numberwang"
icon = 'icons/effects/numbers.dmi'
icon_state = "blank"
duration = 2 SECONDS

/obj/effect/temp_visual/numbers/backgrounded
name = "numberwang"
icon = 'icons/effects/numbers.dmi'
icon_state = "blank_ish"
duration = 3 SECONDS

/obj/effect/temp_visual/numbers/Initialize(mapload, numb, coler)
. = ..()
numericate(numb, coler)

/obj/effect/temp_visual/numbers/proc/numericate(numb, coler)
if(numb > 99999999)
numb = 99999999
var/list/splitnumbers = list()
/// splits numb into its digits, from most to least significant
if(numb <= 0)
splitnumbers += 0
else
var/tries = 10
while(numb > 0 && tries-- > 0)
splitnumbers += numb % 10
numb /= 10
numb = floor(numb)
/// now we have to reverse the list
splitnumbers = reverseList(splitnumbers)
var/offset = 0
/// now we can display the numbers
for(var/i in 1 to LAZYLEN(splitnumbers))
var/digy = clamp(LAZYACCESS(splitnumbers, i), 0, 9)
var/image/numbie = image('icons/effects/numbers.dmi', src, "[digy]")
numbie.pixel_x = offset
overlays += numbie
offset += 9
if(coler)
color = coler

#define IS_IN_VIEWER_RECT(turf) TURF_IN_RECTANGLE(turf, westest, northest, eastest, southest)

/// returns a datum of players and how well they can hear the source
/proc/get_listening(atom/source, close_range, long_range, quiet)
var/area/A = get_area(source)
var/private = A.private
var/datum/chatchud/CC = get_chatchud(source)
var/turf/source_turf = get_turf(source)
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/am_widescreen = C.prefs.widescreenpref
var/westest
if(am_widescreen)
westest = max(viewer_turf.x - 8, 1)
else
westest = max(viewer_turf.x - 6, 1)
var/eastest
if(am_widescreen)
eastest = min(viewer_turf.x + 8, world.maxx)
else
eastest = min(viewer_turf.x + 6, world.maxx)
var/northest
if(am_widescreen)
northest = max(viewer_turf.y - 7, 1)
else
northest = max(viewer_turf.y - 6, 1)
var/southest
if(am_widescreen)
southest = min(viewer_turf.y + 6, world.maxy)
else
southest = min(viewer_turf.y + 6, world.maxy)
var/list/things_in_viewer_los = view(7, viewer_turf)
if(SSchat.debug_chud)
var/turf/t_northwest = locate(westest, northest, viewer_turf.z)
var/turf/t_southeast = locate(eastest, southest, viewer_turf.z)
var/turf/t_northeast = locate(eastest, northest, viewer_turf.z)
var/turf/t_southwest = locate(westest, southest, viewer_turf.z)
/// draw a beam box!
t_northeast.Beam(t_northwest, icon_state = "1-full", time = 3 SECONDS, show_to = list(C))
t_northeast.Beam(t_southeast, icon_state = "1-full", time = 3 SECONDS, show_to = list(C))
t_southeast.Beam(t_southwest, icon_state = "1-full", time = 3 SECONDS, show_to = list(C))
t_southwest.Beam(t_northwest, icon_state = "1-full", time = 3 SECONDS, show_to = list(C))
var/in_close_view
if(SSchat.debug_use_cool_los_proc)
in_close_view = isInSight(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)
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)
CC.visible_close[M] = TRUE
continue dingus
// else if(get_dist(source_turf, viewer_turf) <= long_range)
// CC.visible_far[M] = TRUE
// continue dingus
// if the source is in a Private area,
// and the viewer is either not in the line of sight or not in the box of visibility,
// then they're hidden, so we dont bleat out a bunch of horny moaning to the whole world
if(private)
continue dingus
if(in_rect && !quiet)
CC.hidden_pathable[M] = source_turf // close enough
continue dingus
// now the fun begins. Try to find a path to them
var/list/soundwalk = get_path_to(source_turf, viewer_turf, long_range, use_visibility = TRUE)
// 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
continue dingus
// the path from source to viewer is too long, so we consider them out of range
if(!LAZYLEN(soundwalk) || LAZYLEN(soundwalk) > long_range)
continue dingus
// now walk through the path and find the first tile that can fulfill all of these conditions:
// 1. must be in the box of visibility
// 2. must be in the line of sight of the hearer
debug_i = 0
var/cole = SSchat.debug_chud && safepick("#FF0000", "#00FF00", "#0000FF", "#FFFF00", "#FF00FF", "#00FFFF")
for(var/turf/T as anything in soundwalk) // for each step we take...
if(SSchat.debug_chud)
new /obj/effect/temp_visual/numbers/backgrounded(T, debug_i, cole)
debug_i++
if(!IS_IN_VIEWER_RECT(T)) // ...check if our turf is in the viewer's box of visibility
continue // we can't see them
// if(!(T in things_in_viewer_los)) // if they're in the box but not in the line of sight,
// continue // we can't see them
// at this point, we have met these conditions
if(SSchat.debug_chud)
new /obj/effect/temp_visual/debug_heart(T)
CC.hidden_pathable[M] = T
continue dingus // move along, dingus
// couldnt find anything! mark them as hidden
CC.hidden_inaccessible[M] = TRUE
return CC

GLOBAL_LIST_EMPTY(chat_chuds)

Expand Down
Loading

0 comments on commit 71cbf2d

Please sign in to comment.