Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dan's assorted changes that mostly work #9

Merged
merged 3 commits into from
Jul 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions code/__DEFINES/dcs/signals.dm
Original file line number Diff line number Diff line change
Expand Up @@ -774,4 +774,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" // ()



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 @@ -59,6 +59,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 @@ -400,6 +405,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
2 changes: 2 additions & 0 deletions code/__DEFINES/voreconstants.dm
Original file line number Diff line number Diff line change
Expand Up @@ -307,3 +307,5 @@ GLOBAL_LIST_INIT(prey_release_sounds, list(
#define RADIOPREF_HEAR_RADIO_STATIC "hear_staticky_clicks"

#define ADMIN_CHAT_FILTER_DMS "ADMIN_CHAT_FILTER_DMS"

#define SEE_FANCY_OFF_SCREEN_RUNECHAT "SEE_FANCY_OFF_SCREEN_RUNECHAT"
165 changes: 162 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,141 @@
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_close_pathable = list()
var/list/hidden_inaccessible = list()
var/ready = TRUE

/datum/chatchud/proc/putback()
visible_close.Cut()
visible_far.Cut()
hidden_close_pathable.Cut()
ready = TRUE

/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
while(numb > 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

/// 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/list/see_close = hearers(source, close_range)
var/list/see_far = hearers(source, long_range) - see_close
var/debug_i = 0
dingus:
for(var/client/C in GLOB.clients)
var/mob/M = C.mob
if(M.z != source.z)
continue dingus
if(get_dist(M, source) > long_range)
continue dingus
var/is_far = (M in see_far)
var/is_close = (M in see_close)
if(is_far)
if(private)
continue dingus
CC.visible_far[M] = TRUE
continue dingus
else if(is_close)
CC.visible_close[M] = TRUE
continue dingus
// if(get_dist(M, source) > long_range)
// continue dingus // they're too far away to hear
// now the fun begins. Try to find a path to them
// now the real fun begins
var/list/soundwalk = get_path_to(source, M, long_range, use_visibility = TRUE)
if(!islist(soundwalk))
CC.hidden_inaccessible[M] = TRUE
continue dingus
if(!LAZYLEN(soundwalk) || LAZYLEN(soundwalk) > long_range)
CC.hidden_inaccessible[M] = TRUE
continue dingus
// now walk through the path and find the first tile that can see the source
donger:
for(var/turf/T as anything in soundwalk)
var/list/seeline = getline(T, M)
debug_i = 0
var/cole = pick("#FF0000", "#00FF00", "#0000FF", "#FFFF00", "#FF00FF", "#00FFFF")
for(var/turf/TT as anything in seeline) // beeg american TTs
if(SSchat.debug_chud)
new /obj/effect/temp_visual/numbers/backgrounded(T, debug_i, cole)
debug_i++
if(TT.opacity)
continue donger
for(var/atom/AM as anything in TT.contents)
if(AM.opacity)
continue donger
if(SSchat.debug_chud)
new /obj/effect/temp_visual/debug_heart(T)
CC.hidden_close_pathable[M] = T
continue dingus
// couldnt find anything! mark them as hidden
CC.hidden_inaccessible[M] = TRUE
return CC

//viewers() but with a signal, for blacklisting.
/proc/fov_viewers(depth = world.view, atom/center)
Expand Down
19 changes: 15 additions & 4 deletions code/__HELPERS/path.dm
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* * simulated_only: Whether we consider turfs without atmos simulation (AKA do we want to ignore space)
* * exclude: If we want to avoid a specific turf, like if we're a mulebot who already got blocked by some turf
*/
/proc/get_path_to(caller, end, max_distance = 30, mintargetdist, id=null, simulated_only = TRUE, turf/exclude)
/proc/get_path_to(caller, end, max_distance = 30, mintargetdist, id=null, simulated_only = TRUE, turf/exclude, use_visibility)
if(!caller || !get_turf(end))
return

Expand All @@ -26,7 +26,7 @@
l = SSpathfinder.mobs.getfree(caller)

var/list/path
var/datum/pathfind/pathfind_datum = new(caller, end, id, max_distance, mintargetdist, simulated_only, exclude)
var/datum/pathfind/pathfind_datum = new(caller, end, id, max_distance, mintargetdist, simulated_only, exclude, use_visibility)
path = pathfind_datum.search()
qdel(pathfind_datum)

Expand All @@ -40,7 +40,7 @@
* Note that this can only be used inside the [datum/pathfind][pathfind datum] since it uses variables from said datum
* If you really want to optimize things, optimize this, cuz this gets called a lot
*/
#define CAN_STEP(cur_turf, next) (next && !next.density && cur_turf.Adjacent(next) && !(simulated_only && SSpathfinder.space_type_cache[next.type]) && !cur_turf.LinkBlockedWithAccess(next,caller, id) && (next != avoid))
#define CAN_STEP(cur_turf, next) (next && (use_visibility ? (checkvis(next)) : (!next.density && cur_turf.Adjacent(next) && !cur_turf.LinkBlockedWithAccess(next,caller, id,use_visibility))) && !(simulated_only && SSpathfinder.space_type_cache[next.type]) && (next != avoid))
/// Another helper macro for JPS, for telling when a node has forced neighbors that need expanding
#define STEP_NOT_HERE_BUT_THERE(cur_turf, dirA, dirB) ((!CAN_STEP(cur_turf, get_step(cur_turf, dirA)) && CAN_STEP(cur_turf, get_step(cur_turf, dirB))))

Expand Down Expand Up @@ -116,8 +116,10 @@
var/simulated_only
/// A specific turf we're avoiding, like if a mulebot is being blocked by someone t-posing in a doorway we're trying to get through
var/turf/avoid
/// whether to use opacity checks instead of density checks
var/use_visibility

/datum/pathfind/New(atom/movable/caller, atom/goal, id, max_distance, mintargetdist, simulated_only, avoid)
/datum/pathfind/New(atom/movable/caller, atom/goal, id, max_distance, mintargetdist, simulated_only, avoid, use_visibility)
src.caller = caller
end = get_turf(goal)
open = new /datum/heap(/proc/HeapPathWeightCompare)
Expand All @@ -127,6 +129,7 @@
src.mintargetdist = mintargetdist
src.simulated_only = simulated_only
src.avoid = avoid
src.use_visibility = use_visibility

/// The proc you use to run the search, returns FALSE if it's invalid, an empty list if no path could be found, or a valid path to the target
/datum/pathfind/proc/search()
Expand Down Expand Up @@ -319,6 +322,14 @@
unwind_path(possible_child_node)
return

/datum/pathfind/proc/checkvis(turf/destination_turf)
if(destination_turf.opacity)
return FALSE
for(var/atom/iter_atom in destination_turf)
if(iter_atom.opacity)
return FALSE
return TRUE

/**
* For seeing if we can actually move between 2 given turfs while accounting for our access and the caller's pass_flags
*
Expand Down
18 changes: 18 additions & 0 deletions code/controllers/subsystem/chat.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,22 @@ SUBSYSTEM_DEF(chat)
priority = FIRE_PRIORITY_CHAT
init_order = INIT_ORDER_CHAT

/*
** Base
*/
var/base_say_distance = 7
var/extended_say_distance = 16

var/base_whisper_distance = 1
var/extended_whisper_distance = 3

var/base_sing_distance = 15
var/extended_sing_distance = INFINITY
var/base_yell_distance = 15
var/extended_yell_distance = INFINITY
var/far_distance = 6 // how far until they're considered offscreen


var/list/payload_by_client = list()
/// All the lookups for translating emotes to say prefixes
var/list/emoticon_cache = list()
Expand Down Expand Up @@ -39,6 +55,8 @@ SUBSYSTEM_DEF(chat)
var/flirt_cooldown_time = 5 SECONDS
var/debug_character_directory = 0

var/debug_chud = FALSE

/datum/controller/subsystem/chat/Initialize(start_timeofday)
setup_emoticon_cache()
build_flirt_datums()
Expand Down
28 changes: 14 additions & 14 deletions code/controllers/subsystem/job.dm
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,20 @@ SUBSYSTEM_DEF(job)
return ..()

/datum/controller/subsystem/job/proc/set_overflow_role(new_overflow_role)
var/datum/job/new_overflow = GetJob(new_overflow_role)
var/cap = CONFIG_GET(number/overflow_cap)

new_overflow.allow_bureaucratic_error = FALSE
new_overflow.spawn_positions = cap
new_overflow.total_positions = cap

if(new_overflow_role != overflow_role)
var/datum/job/old_overflow = GetJob(overflow_role)
old_overflow.allow_bureaucratic_error = initial(old_overflow.allow_bureaucratic_error)
old_overflow.spawn_positions = initial(old_overflow.spawn_positions)
old_overflow.total_positions = initial(old_overflow.total_positions)
overflow_role = new_overflow_role
JobDebug("Overflow role set to : [new_overflow_role]")
// var/datum/job/new_overflow = GetJob(new_overflow_role)
// var/cap = CONFIG_GET(number/overflow_cap)

// new_overflow.allow_bureaucratic_error = FALSE
// new_overflow.spawn_positions = cap
// new_overflow.total_positions = cap

// if(new_overflow_role != overflow_role)
// var/datum/job/old_overflow = GetJob(overflow_role)
// old_overflow.allow_bureaucratic_error = initial(old_overflow.allow_bureaucratic_error)
// old_overflow.spawn_positions = initial(old_overflow.spawn_positions)
// old_overflow.total_positions = initial(old_overflow.total_positions)
// overflow_role = new_overflow_role
// JobDebug("Overflow role set to : [new_overflow_role]")

/datum/controller/subsystem/job/proc/SetupOccupations(faction = "Station")
occupations = list()
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 @@ -252,6 +252,14 @@ SUBSYSTEM_DEF(prefbreak) // ALL ABOARD THE S.S. PREFBREAK OFF TO **** YOUR *****
PREFBROKEN
return consumer.admin_wire_tap // kinda vital here

/datum/prefcheck/see_fancy_offscreen_runechat
index = SEE_FANCY_OFF_SCREEN_RUNECHAT

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




Expand Down
Loading
Loading