Skip to content

Commit

Permalink
Merge branch 'master' into MODULE-2
Browse files Browse the repository at this point in the history
  • Loading branch information
Zattarra authored Dec 23, 2024
2 parents 31d1c2b + 92af125 commit d5ac4f7
Show file tree
Hide file tree
Showing 36 changed files with 887 additions and 419 deletions.
9 changes: 9 additions & 0 deletions code/_globalvars/lists/flavor_misc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -307,3 +307,12 @@ GLOBAL_LIST_INIT(status_display_state_pictures, list(
"blank",
"shuttle",
))

GLOBAL_LIST_INIT(most_common_words, init_common_words())

/proc/init_common_words()
. = list()
var/i = 1
for(var/word in world.file2list("strings/1000_most_common.txt"))
.[word] = i
i += 1
2 changes: 1 addition & 1 deletion code/_globalvars/lists/mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ GLOBAL_LIST_INIT_TYPED(language_datum_instances, /datum/language, init_language_
/// List if all language typepaths learnable, IE, those with keys
GLOBAL_LIST_INIT(all_languages, init_all_languages())
// /List of language prototypes to reference, assoc "name" = typepath
GLOBAL_LIST_INIT(language_types_by_name, init_language_types_by_name())
GLOBAL_LIST_INIT_TYPED(language_types_by_name, /datum/language, init_language_types_by_name())

/proc/init_language_prototypes()
var/list/lang_list = list()
Expand Down
7 changes: 1 addition & 6 deletions code/controllers/subsystem/discord.dm
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,13 @@ SUBSYSTEM_DEF(discord)
/// People who have tried to verify this round already
var/list/reverify_cache

/// Common words list, used to generate one time tokens
var/list/common_words

/// The file where notification status is saved
var/notify_file = file("data/notify.json")

/// Is TGS enabled (If not we won't fire because otherwise this is useless)
var/enabled = FALSE

/datum/controller/subsystem/discord/Initialize()
common_words = world.file2list("strings/1000_most_common.txt")
reverify_cache = list()
// Check for if we are using TGS, otherwise return and disables firing
if(world.TgsAvailable())
Expand Down Expand Up @@ -156,7 +152,7 @@ SUBSYSTEM_DEF(discord)
// While there's a collision in the token, generate a new one (should rarely happen)
while(not_unique)
//Column is varchar 100, so we trim just in case someone does us the dirty later
one_time_token = trim("[pick(common_words)]-[pick(common_words)]-[pick(common_words)]-[pick(common_words)]-[pick(common_words)]-[pick(common_words)]", 100)
one_time_token = trim("[pick(GLOB.most_common_words)]-[pick(GLOB.most_common_words)]-[pick(GLOB.most_common_words)]-[pick(GLOB.most_common_words)]-[pick(GLOB.most_common_words)]-[pick(GLOB.most_common_words)]", 100)

not_unique = find_discord_link_by_token(one_time_token, timebound = TRUE)

Expand Down Expand Up @@ -298,4 +294,3 @@ SUBSYSTEM_DEF(discord)
if (length(discord_mention_extraction_regex.group) == 1)
return discord_mention_extraction_regex.group[1]
return null

2 changes: 1 addition & 1 deletion code/controllers/subsystem/processing/quirks.dm
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ GLOBAL_LIST_INIT_TYPED(quirk_blacklist, /list/datum/quirk, list(
list(/datum/quirk/social_anxiety, /datum/quirk/mute),
list(/datum/quirk/mute, /datum/quirk/softspoken),
list(/datum/quirk/poor_aim, /datum/quirk/bighands),
list(/datum/quirk/bilingual, /datum/quirk/foreigner),
// list(/datum/quirk/bilingual, /datum/quirk/foreigner),
list(/datum/quirk/spacer_born, /datum/quirk/item_quirk/settler),
list(/datum/quirk/photophobia, /datum/quirk/nyctophobia),
list(/datum/quirk/item_quirk/settler, /datum/quirk/freerunning),
Expand Down
4 changes: 1 addition & 3 deletions code/datums/brain_damage/mild.dm
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,6 @@
gain_text = span_warning("You lose your grasp on complex words.")
lose_text = span_notice("You feel your vocabulary returning to normal again.")

var/static/list/common_words = world.file2list("strings/1000_most_common.txt")

/datum/brain_trauma/mild/expressive_aphasia/handle_speech(datum/source, list/speech_args)
var/message = speech_args[SPEECH_MESSAGE]
if(message)
Expand All @@ -212,7 +210,7 @@
word = copytext(word, 1, suffix_foundon)
word = html_decode(word)

if(lowertext(word) in common_words)
if(GLOB.most_common_words[lowertext(word)])
new_message += word + suffix
else
if(prob(30) && message_split.len > 2)
Expand Down
2 changes: 2 additions & 0 deletions code/datums/quirks/neutral_quirks/foreigner.dm
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/*
/datum/quirk/foreigner
name = "Foreigner"
desc = "You're not from around here. You don't know Galactic Common!"
Expand All @@ -19,3 +20,4 @@
human_holder.remove_blocked_language(/datum/language/common)
if(ishumanbasic(human_holder))
human_holder.remove_language(/datum/language/uncommon)
*/
2 changes: 2 additions & 0 deletions code/datums/quirks/positive_quirks/bilingual.dm
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/*
/datum/quirk/bilingual
name = "Bilingual"
desc = "Over the years you've picked up an extra language!"
Expand Down Expand Up @@ -26,3 +27,4 @@
return
to_chat(quirk_holder, span_boldnotice("You are already familiar with the quirk in your preferences, so you learned Galactic Uncommon instead."))
quirk_holder.grant_language(language_type, source = LANGUAGE_QUIRK)
*/
6 changes: 5 additions & 1 deletion code/game/atoms_movable.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1467,7 +1467,7 @@
*/

/// Gets or creates the relevant language holder. For mindless atoms, gets the local one. For atom with mind, gets the mind one.
/atom/movable/proc/get_language_holder()
/atom/movable/proc/get_language_holder() as /datum/language_holder
RETURN_TYPE(/datum/language_holder)
if(QDELING(src))
CRASH("get_language_holder() called on a QDELing atom, \
Expand Down Expand Up @@ -1521,6 +1521,10 @@
/atom/movable/proc/get_random_understood_language()
return get_language_holder().get_random_understood_language()

/// Gets a list of all mutually understood languages.
/atom/movable/proc/get_mutually_understood_languages()
return get_language_holder().get_mutually_understood_languages()

/// Gets a random spoken language, useful for forced speech and such.
/atom/movable/proc/get_random_spoken_language()
return get_language_holder().get_random_spoken_language()
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/telecomms/computers/logbrowser.dm
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
message_out = "\"[message_in]\""
else if(!user.has_language(language))
// Language unknown: scramble
message_out = "\"[language_instance.scramble(message_in)]\""
message_out = "\"[language_instance.scramble_sentence(message_in, user.get_mutually_understood_languages())]\""
else
message_out = "(Unintelligible)"
packet_out["message"] = message_out
Expand Down
11 changes: 0 additions & 11 deletions code/game/objects/effects/decals/cleanable.dm
Original file line number Diff line number Diff line change
Expand Up @@ -78,23 +78,12 @@
return FALSE

bloodiness = clamp((bloodiness + by_amount), 0, BLOOD_POOL_MAX)
update_appearance()
return TRUE

/// Called before attempting to scoop up reagents from this decal to only load reagents when necessary
/obj/effect/decal/cleanable/proc/lazy_init_reagents()
return

#ifdef TESTING
/obj/effect/decal/cleanable/update_overlays()
. = ..()
if(bloodiness)
var/mutable_appearance/blah_text = new()
blah_text.maptext = MAPTEXT_TINY_UNICODE("[bloodiness]")
blah_text.appearance_flags |= (KEEP_APART|RESET_ALPHA|RESET_COLOR|RESET_TRANSFORM)
. += blah_text
#endif

/obj/effect/decal/cleanable/attackby(obj/item/W, mob/user, params)
if((istype(W, /obj/item/reagent_containers/cup) && !istype(W, /obj/item/reagent_containers/cup/rag)) || istype(W, /obj/item/reagent_containers/cup/glass))
if(src.reagents && W.reagents)
Expand Down
131 changes: 84 additions & 47 deletions code/game/objects/effects/decals/cleanable/humans.dm
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
decal_reagent = /datum/reagent/blood
bloodiness = BLOOD_AMOUNT_PER_DECAL
color = COLOR_BLOOD
flags_1 = UNPAINTABLE_1
/// Can this blood dry out?
var/can_dry = TRUE
/// Is this blood dried out?
Expand All @@ -29,21 +30,17 @@
/// How long it takes to dry out
var/drying_time = 5 MINUTES
/// The process to drying out, recorded in deciseconds
var/drying_progress = 0
/// Color matrix applied to dried blood via filter to make it look dried
var/static/list/blood_dry_filter_matrix = list(
1, 0, 0, 0,
0, 1, 0, 0,
0, 0, 1, 0,
0, 0, 0, 1,
-0.5, -0.75, -0.75, 0,
)
VAR_FINAL/drying_progress = 0

/obj/effect/decal/cleanable/blood/Initialize(mapload)
. = ..()
START_PROCESSING(SSblood_drying, src)
if(color && can_dry && !dried)
update_blood_drying_effect()
if(mapload)
add_blood_DNA(list("UNKNOWN DNA" = random_human_blood_type()))
if(dried)
dry()
else if(can_dry)
START_PROCESSING(SSblood_drying, src)
// update_atom_colour() // this is already called by parent via add_atom_colour

/obj/effect/decal/cleanable/blood/Destroy()
STOP_PROCESSING(SSblood_drying, src)
Expand All @@ -54,29 +51,56 @@
return
return ..()

#define DRY_FILTER_KEY "dry_effect"

/obj/effect/decal/cleanable/blood/proc/update_blood_drying_effect()
if(!can_dry)
remove_filter(DRY_FILTER_KEY) // I GUESS
return

var/existing_filter = get_filter(DRY_FILTER_KEY)
if(dried)
if(existing_filter)
animate(existing_filter) // just stop existing animations and force it to the end state
return
add_filter(DRY_FILTER_KEY, 2, color_matrix_filter(blood_dry_filter_matrix))
// When color changes we need to update the drying animation
/obj/effect/decal/cleanable/blood/update_atom_colour()
. = ..()
// get a default color based on DNA if it ends up unset somehow
color ||= (GET_ATOM_BLOOD_DNA_LENGTH(src) ? get_blood_dna_color() : COLOR_BLOOD)
// stop existing drying animations
animate(src)
// ok let's make the dry color now
// we will manually calculate what the resulting color should be when it dries
// we do this instead of using something like a color matrix because byond moment
// (at any given moment, there may be like... 200 blood decals on your screen at once
// byond is, apparently, pretty bad at handling that many color matrix operations,
// especially in a filter or while animating)
var/list/starting_color_rgb = ReadRGB(color) || list(255, 255, 255, alpha)
// we want a fixed offset for a fixed drop in color intensity, plus a scaling offset based on our strongest color
// the scaling offset helps keep dark colors from turning black, while also ensurse bright colors don't stay super bright
var/max_color = max(starting_color_rgb[1], starting_color_rgb[2], starting_color_rgb[3])
var/red_offset = 50 + (75 * (starting_color_rgb[1] / max_color))
var/green_offset = 50 + (75 * (starting_color_rgb[2] / max_color))
var/blue_offset = 50 + (75 * (starting_color_rgb[3] / max_color))
// if the color is already decently dark, we should reduce the offsets even further
// this is intended to prevent already dark blood (mixed blood in particular) from becoming full black
var/strength = starting_color_rgb[1] + starting_color_rgb[2] + starting_color_rgb[3]
if(strength <= 192)
red_offset *= 0.5
green_offset *= 0.5
blue_offset *= 0.5
// finally, get this show on the road
var/dried_color = rgb(
clamp(starting_color_rgb[1] - red_offset, 0, 255),
clamp(starting_color_rgb[2] - green_offset, 0, 255),
clamp(starting_color_rgb[3] - blue_offset, 0, 255),
length(starting_color_rgb) >= 4 ? starting_color_rgb[4] : alpha, // maintain alpha! (if it has it)
)
// if it's dried (or about to dry) we can just set color directly
if(dried || drying_progress >= drying_time)
color = dried_color
return

if(existing_filter)
remove_filter(DRY_FILTER_KEY)

add_filter(DRY_FILTER_KEY, 2, color_matrix_filter())
transition_filter(DRY_FILTER_KEY, color_matrix_filter(blood_dry_filter_matrix), drying_time - drying_progress)

#undef DRY_FILTER_KEY

// otherwise set the color to what it should be at the current drying progress, then animate down to the dried color if we can
color = gradient(0, color, 1, dried_color, round(drying_progress / drying_time, 0.01))
if(can_dry)
animate(src, time = drying_time - drying_progress, color = dried_color)

/// Slows down the drying time by a given amount,
/// then updates the effect, meaning the animation will slow down
/obj/effect/decal/cleanable/blood/proc/slow_dry(by_amount)
drying_progress -= by_amount
update_atom_colour()

/// Returns a string of all the blood reagents in the blood
/obj/effect/decal/cleanable/blood/proc/get_blood_string()
var/list/all_dna = GET_ATOM_BLOOD_DNA(src)
var/list/all_blood_names = list()
Expand All @@ -91,7 +115,8 @@

adjust_bloodiness(-0.4 * BLOOD_PER_UNIT_MODIFIER * seconds_per_tick)
drying_progress += (seconds_per_tick * 1 SECONDS)
if(drying_progress >= drying_time + SSblood_drying.wait) // Do it next tick when we're done
// Finish it next tick when we're all done
if(drying_progress >= drying_time + SSblood_drying.wait)
dry()

/obj/effect/decal/cleanable/blood/update_name(updates)
Expand Down Expand Up @@ -121,7 +146,7 @@
dried = TRUE
reagents?.clear_reagents()
update_appearance()
update_blood_drying_effect()
update_atom_colour()
STOP_PROCESSING(SSblood_drying, src)
return TRUE

Expand All @@ -145,17 +170,12 @@
. = ..()
merger.add_blood_DNA(GET_ATOM_BLOOD_DNA(src))
merger.adjust_bloodiness(bloodiness)
merger.drying_progress -= (bloodiness * BLOOD_PER_UNIT_MODIFIER) // goes negative = takes longer to dry
merger.update_blood_drying_effect()
merger.slow_dry(1 SECONDS * bloodiness * BLOOD_PER_UNIT_MODIFIER)

/obj/effect/decal/cleanable/blood/old
bloodiness = 0
icon_state = "floor1-old"

/obj/effect/decal/cleanable/blood/old/Initialize(mapload, list/datum/disease/diseases)
add_blood_DNA(list("UNKNOWN DNA" = random_human_blood_type()))
. = ..()
dry()
dried = TRUE
icon_state = "floor1-old" // just for mappers. overrided in init

/obj/effect/decal/cleanable/blood/splatter
icon_state = "gibbl1"
Expand Down Expand Up @@ -297,17 +317,16 @@
/obj/effect/decal/cleanable/blood/gibs/old
name = "old rotting gibs"
desc = "Space Jesus, why didn't anyone clean this up? They smell terrible."
icon_state = "gib1-old"
icon_state = "gib1-old" // just for mappers. overrided in init
bloodiness = 0
dried = TRUE
dry_prefix = ""
dry_desc = ""

/obj/effect/decal/cleanable/blood/gibs/old/Initialize(mapload, list/datum/disease/diseases)
add_blood_DNA(list("UNKNOWN DNA" = random_human_blood_type()))
. = ..()
setDir(pick(GLOB.cardinals))
AddElement(/datum/element/swabable, CELL_LINE_TABLE_SLUDGE, CELL_VIRUS_TABLE_GENERIC, rand(2,4), 10)
dry()

/obj/effect/decal/cleanable/blood/drip
name = "drips of blood"
Expand Down Expand Up @@ -538,3 +557,21 @@
the_window.vis_contents += final_splatter
the_window.bloodied = TRUE
expire()

/// Subtype which has random DNA baked in OUTSIDE of mapload.
/// For testing, mapping, or badmins
/obj/effect/decal/cleanable/blood/pre_dna
var/list/dna_types = list("UNKNOWN DNA A" = /datum/blood_type/crew/human/a_minus)

/obj/effect/decal/cleanable/blood/pre_dna/Initialize(mapload)
. = ..()
add_blood_DNA(dna_types)

/obj/effect/decal/cleanable/blood/pre_dna/lizard
dna_types = list("UNKNOWN DNA A" = /datum/blood_type/crew/lizard)

/obj/effect/decal/cleanable/blood/pre_dna/lizhuman
dna_types = list("UNKNOWN DNA A" = /datum/blood_type/crew/human/a_minus, "UNKNOWN DNA B" = /datum/blood_type/crew/lizard)

/obj/effect/decal/cleanable/blood/pre_dna/ethereal
dna_types = list("UNKNOWN DNA A" = /datum/blood_type/crew/ethereal)
2 changes: 1 addition & 1 deletion code/game/say.dm
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ GLOBAL_LIST_INIT(freqtospan, list(

if(!has_language(language))
var/datum/language/dialect = GLOB.language_datum_instances[language]
raw_message = dialect.scramble(raw_message)
raw_message = dialect.scramble_sentence(raw_message, get_mutually_understood_languages())

return raw_message

Expand Down
2 changes: 2 additions & 0 deletions code/modules/client/preferences/language.dm
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/*
/datum/preference/choiced/language
category = PREFERENCE_CATEGORY_MANUALLY_RENDERED
savefile_key = "language"
Expand Down Expand Up @@ -33,3 +34,4 @@
/datum/preference/choiced/language/apply_to_human(mob/living/carbon/human/target, value)
return
*/
5 changes: 4 additions & 1 deletion code/modules/client/preferences_savefile.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// You do not need to raise this if you are adding new values that have sane defaults.
// Only raise this value when changing the meaning/format/name/layout of an existing value
// where you would want the updater procs below to run
#define SAVEFILE_VERSION_MAX 45
#define SAVEFILE_VERSION_MAX 45.1

/*
SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Carn
Expand Down Expand Up @@ -111,6 +111,9 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
data_to_migrate = list(INFO_RESKIN = save_data?["pride_pin"]),
)

if (current_version < 45.1)
migrate_quirks_to_language_menu(save_data)

/// checks through keybindings for outdated unbound keys and updates them
/datum/preferences/proc/check_keybindings()
if(!parent)
Expand Down
Loading

0 comments on commit d5ac4f7

Please sign in to comment.