Skip to content
Draft
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
25 changes: 14 additions & 11 deletions code/_helpers/game.dm
Original file line number Diff line number Diff line change
Expand Up @@ -204,19 +204,22 @@
var/list/hearturfs = list()
FOR_DVIEW(var/turf/T, range, center, INVISIBILITY_MAXIMUM)
hearturfs[T] = TRUE
for(var/mob/M in T)
mobs += M
if(islist(mobs))
for(var/mob/M in T)
mobs += M
END_FOR_DVIEW

for(var/mob/M in global.player_list)
if(check_ghosts && M.stat == DEAD && M.get_preference_value(check_ghosts) != PREF_NEARBY)
mobs |= M
else if(hearturfs[get_turf(M)])
mobs |= M

for(var/obj/O in global.listening_objects)
if(hearturfs[get_turf(O)])
objs += O
if(islist(mobs))
for(var/mob/M in global.player_list)
if(check_ghosts && M.stat == DEAD && M.get_preference_value(check_ghosts) != PREF_NEARBY)
mobs |= M
else if(hearturfs[get_turf(M)])
mobs |= M

if(islist(objs))
for(var/obj/O in global.listening_objects)
if(hearturfs[get_turf(O)])
objs += O



Expand Down
9 changes: 9 additions & 0 deletions code/_helpers/text.dm
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,15 @@ var/global/regex/starts_lowercase_regex = regex(@"^[a-z]")
/proc/trim(text)
return trim_left(trim_right(text))

/// Adds punctuation to an emote or speech message automatically.
/proc/handle_autopunctuation(message)
if(!message)
return
var/end_char = copytext_char(trim_right(strip_html_properly(message)), -1)
if(!(end_char in list(".", "?", "!", "-", "~")))
message += "."
return message

//Returns a string with the first element of the string capitalized.
// NOTE: This will not work if there are any HTML tags.
/proc/capitalize(text)
Expand Down
24 changes: 0 additions & 24 deletions code/controllers/subsystems/initialization/lore.dm
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ SUBSYSTEM_DEF(lore)
var/list/credits_topics = list("SACRED GEOMETRY","ABSTRACT MATHEMATICS","LOVE","DRUGS","CRIME","PRODUCTIVITY","LAUNDRY")
var/list/credits_nouns = list("DIGNITY", "SANITY")

// Probably not the best subsystem for these, but oh well.
var/list/languages_by_key
var/list/languages_by_name

/datum/controller/subsystem/lore/Initialize()

var/list/all_backgrounds = decls_repository.get_decls_of_subtype(/decl/background_detail)
Expand Down Expand Up @@ -71,23 +67,3 @@ SUBSYSTEM_DEF(lore)
possible_titles |= credits_other
global.end_credits_title = pick(possible_titles)
. = global.end_credits_title

/datum/controller/subsystem/lore/proc/get_language_by_name(var/language_name)
if(!languages_by_name)
languages_by_name = list()
var/list/language_types = decls_repository.get_decls_of_subtype(/decl/language)
for(var/thing in language_types)
var/decl/language/lang = language_types[thing]
if(lang.name)
languages_by_name[lang.name] = lang
. = languages_by_name[language_name]

/datum/controller/subsystem/lore/proc/get_language_by_key(var/language_key)
if(!languages_by_key)
languages_by_key = list()
var/list/language_types = decls_repository.get_decls_of_subtype(/decl/language)
for(var/thing in language_types)
var/decl/language/lang = language_types[thing]
if(lang.key)
languages_by_key[lang.key] = lang
. = languages_by_key[language_key]
18 changes: 11 additions & 7 deletions code/game/atoms.dm
Original file line number Diff line number Diff line change
Expand Up @@ -642,22 +642,22 @@
- `range?`: The number of tiles away the message will be visible from. Default: world.view
- `check_ghosts?`: Set to `TRUE` if ghosts should see the message if their preferences allow
*/
/atom/proc/visible_message(var/message, var/self_message, var/blind_message, var/range = world.view, var/check_ghosts = null)
/atom/proc/visible_message(var/message, var/self_message, var/blind_message, var/range = world.view, var/check_ghosts = null, atom/source)
var/turf/T = get_turf(src)
var/list/mobs = list()
var/list/objs = list()
get_listeners_in_range(T,range, mobs, objs, check_ghosts)

for(var/o in objs)
var/obj/O = o
O.show_message(message, VISIBLE_MESSAGE, blind_message, AUDIBLE_MESSAGE)
O.show_message(message, VISIBLE_MESSAGE, blind_message, AUDIBLE_MESSAGE, source = source)

for(var/m in mobs)
var/mob/M = m
if(M.see_invisible >= invisibility)
M.show_message(message, VISIBLE_MESSAGE, blind_message, AUDIBLE_MESSAGE)
M.show_message(message, VISIBLE_MESSAGE, blind_message, AUDIBLE_MESSAGE, source = source)
else if(blind_message)
M.show_message(blind_message, AUDIBLE_MESSAGE)
M.show_message(blind_message, AUDIBLE_MESSAGE, source = source)

/**
Show a message to all mobs and objects in earshot of this atom
Expand All @@ -670,18 +670,18 @@
- `check_ghosts?`: TRUE if ghosts should hear the message if their preferences allow
- `radio_message?`: The string to send over radios
*/
/atom/proc/audible_message(var/message, var/deaf_message, var/hearing_distance = world.view, var/check_ghosts = null, var/radio_message)
/atom/proc/audible_message(var/message, var/deaf_message, var/hearing_distance = world.view, var/check_ghosts = null, var/radio_message, atom/source)
var/turf/T = get_turf(src)
var/list/mobs = list()
var/list/objs = list()
get_listeners_in_range(T, hearing_distance, mobs, objs, check_ghosts)

for(var/m in mobs)
var/mob/M = m
M.show_message(message,2,deaf_message,1)
M.show_message(message, AUDIBLE_MESSAGE, deaf_message, VISIBLE_MESSAGE, source = source)
for(var/o in objs)
var/obj/O = o
O.show_message(message,2,deaf_message,1)
O.show_message(message, AUDIBLE_MESSAGE, deaf_message, VISIBLE_MESSAGE, source = source)

/**
Attempt to drop this atom onto the destination.
Expand Down Expand Up @@ -1082,3 +1082,7 @@
// Test for if stepping on a tile containing this obj is safe to do, used for things like landmines and cliffs.
/atom/proc/is_safe_to_step(mob/living/stepper)
return TRUE

//Message, type of message (1 or 2), alternative message, alt message type (1 or 2)
/atom/proc/show_message(msg, type, alt, alt_type, atom/source)
return
Loading
Loading