From bdedd2f6f34ea6174a22007bb86831b8ee8a2ff4 Mon Sep 17 00:00:00 2001 From: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com> Date: Tue, 18 May 2021 13:12:51 -0400 Subject: [PATCH] Configurable laughs, with framework for donator ones (#5768) --- code/__HELPERS/global_lists.dm | 6 +++ .../mob/living/carbon/human/human_defines.dm | 1 + .../modules/client/preferences.dm | 19 +++++++++ .../modules/client/preferences_savefile.dm | 13 ++++++ modular_skyrat/modules/emotes/code/emotes.dm | 27 ------------- .../modules/emotes/code/laugh_datums.dm | 40 +++++++++++++++++++ .../modules/emotes/code/laugh_emotes.dm | 24 +++++++++++ tgstation.dme | 2 + 8 files changed, 105 insertions(+), 27 deletions(-) create mode 100644 modular_skyrat/modules/emotes/code/laugh_datums.dm create mode 100644 modular_skyrat/modules/emotes/code/laugh_emotes.dm diff --git a/code/__HELPERS/global_lists.dm b/code/__HELPERS/global_lists.dm index 033fbf52326..8827add5875 100644 --- a/code/__HELPERS/global_lists.dm +++ b/code/__HELPERS/global_lists.dm @@ -45,6 +45,12 @@ var/datum/scream_type/S = new spath() GLOB.scream_types[S.name] = spath sortList(GLOB.scream_types, /proc/cmp_typepaths_asc) + + //Laugh types + for(var/spath in subtypesof(/datum/laugh_type)) + var/datum/scream_type/S = new spath() + GLOB.laugh_types[S.name] = spath + sortList(GLOB.laugh_types, /proc/cmp_typepaths_asc) //SKYRAT EDIT END //Species diff --git a/code/modules/mob/living/carbon/human/human_defines.dm b/code/modules/mob/living/carbon/human/human_defines.dm index e1a0f3ae7e5..dcd373189cc 100644 --- a/code/modules/mob/living/carbon/human/human_defines.dm +++ b/code/modules/mob/living/carbon/human/human_defines.dm @@ -44,6 +44,7 @@ var/jumpsuit_style = PREF_SUIT //suit/skirt var/datum/scream_type/selected_scream //SKRYAT EDIT ADDITION + var/datum/laugh_type/selected_laugh //SKYRAT EDIT ADDITION //Equipment slots var/obj/item/clothing/wear_suit = null diff --git a/modular_skyrat/modules/customization/modules/client/preferences.dm b/modular_skyrat/modules/customization/modules/client/preferences.dm index 1a1d11cbf7f..c615047997d 100644 --- a/modular_skyrat/modules/customization/modules/client/preferences.dm +++ b/modular_skyrat/modules/customization/modules/client/preferences.dm @@ -106,6 +106,7 @@ GLOBAL_LIST_INIT(food, list( var/skin_tone = "caucasian1" //Skin color var/eye_color = "000" //Eye color var/datum/scream_type/pref_scream = new /datum/scream_type/human() //Scream type + var/datum/laugh_type/pref_laugh = new /datum/laugh_type/human() //Laugh type var/datum/species/pref_species = new /datum/species/human() //Mutant race //Has to include all information that extra organs from mutant bodyparts would need. (so far only genitals now) var/list/features = MANDATORY_FEATURE_LIST @@ -443,6 +444,7 @@ GLOBAL_LIST_INIT(food, list( dat += "
" dat += "Species:
[pref_species.name]
" dat += "Scream:
[pref_scream.name]
" + dat += "Laugh:
[pref_laugh.name]
" dat += "Species Naming:
[(features["custom_species"]) ? features["custom_species"] : "Default"]
" dat += "Sprite body size:
[(features["body_size"] * 100)]% [show_body_size ? "Hide preview" : "Show preview"]
" dat += "

Flavor Text

" @@ -2285,6 +2287,22 @@ GLOBAL_LIST_INIT(food, list( pref_scream = new scream SEND_SOUND(user, pick(pref_scream.male_screamsounds)) + if("laugh") + var/list/available_laughs = list() + for(var/spath in subtypesof(/datum/laugh_type)) //We need to build a custom list of available laughs! + var/datum/laugh_type/laugh = spath + if(initial(laugh.restricted_species_type)) + if(!istype(pref_species, initial(laugh.restricted_species_type))) + continue + if(initial(laugh.donator_only) && !GLOB.donator_list[parent.ckey] && !check_rights(R_ADMIN, FALSE)) + continue + available_laughs[initial(laugh.name)] = spath + var/new_laugh_id = input(user, "Choose your character's laugh:", "Character Scream") as null|anything in available_laughs + var/datum/laugh_type/laugh = available_laughs[new_laugh_id] + if(laugh) + pref_laugh = new laugh + SEND_SOUND(user, pick(pref_laugh.male_laughsounds)) + if("species") ShowSpeciesMenu(user) return TRUE @@ -3002,6 +3020,7 @@ GLOBAL_LIST_INIT(food, list( character.jumpsuit_style = jumpsuit_style character.selected_scream = pref_scream + character.selected_laugh = pref_laugh var/datum/species/chosen_species chosen_species = pref_species.type diff --git a/modular_skyrat/modules/customization/modules/client/preferences_savefile.dm b/modular_skyrat/modules/customization/modules/client/preferences_savefile.dm index a0096682f1a..57446096397 100644 --- a/modular_skyrat/modules/customization/modules/client/preferences_savefile.dm +++ b/modular_skyrat/modules/customization/modules/client/preferences_savefile.dm @@ -398,6 +398,18 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car else pref_scream = new /datum/scream_type/human + //Laughs + var/laugh_id + READ_FILE(S["laugh"], laugh_id) + if(laugh_id) + var/new_type = GLOB.laugh_types[laugh_id] + if(new_type) + pref_laugh = new new_type + else + pref_laugh = new /datum/laugh_type/human + else + pref_laugh = new /datum/laugh_type/human + /*if(!S["features["mcolor"]"] || S["features["mcolor"]"] == "#000") WRITE_FILE(S["features["mcolor"]"] , "#FFF") @@ -690,6 +702,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car WRITE_FILE(S["species"] , pref_species.id) WRITE_FILE(S["phobia"], phobia) WRITE_FILE(S["scream"], pref_scream.name) + WRITE_FILE(S["laugh"], pref_laugh.name) /*WRITE_FILE(S["feature_mcolor"] , features["mcolor"]) WRITE_FILE(S["feature_ethcolor"] , features["ethcolor"]) WRITE_FILE(S["feature_lizard_tail"] , features["tail_lizard"]) diff --git a/modular_skyrat/modules/emotes/code/emotes.dm b/modular_skyrat/modules/emotes/code/emotes.dm index 15616f50dc3..6a8886aaa06 100644 --- a/modular_skyrat/modules/emotes/code/emotes.dm +++ b/modular_skyrat/modules/emotes/code/emotes.dm @@ -276,33 +276,6 @@ return FALSE return ..() -/datum/emote/living/laugh - key = "laugh" - key_third_person = "laughs" - message = "laughs." - message_mime = "laughs silently!" - emote_type = EMOTE_AUDIBLE - vary = TRUE - mob_type_allowed_typecache = list(/mob/living/carbon, /mob/living/silicon/pai) - -/datum/emote/living/laugh/get_sound(mob/living/user) - if(isfelinid(user)) - return pick('modular_skyrat/modules/emotes/sound/emotes/nyahaha1.ogg', - 'modular_skyrat/modules/emotes/sound/emotes/nyahaha2.ogg', - 'modular_skyrat/modules/emotes/sound/emotes/nyaha.ogg', - 'modular_skyrat/modules/emotes/sound/emotes/nyahehe.ogg') - if(ismoth(user)) - return 'modular_skyrat/modules/emotes/sound/emotes/mothlaugh.ogg' - if(isinsect(user)) - return 'modular_skyrat/modules/emotes/sound/emotes/mothlaugh.ogg' - if(iscarbon(user)) - if(user.gender == MALE) - return pick('sound/voice/human/manlaugh1.ogg', - 'sound/voice/human/manlaugh2.ogg') - return pick('modular_skyrat/modules/emotes/sound/emotes/female/female_giggle_1.ogg', - 'modular_skyrat/modules/emotes/sound/emotes/female/female_giggle_2.ogg') - return - /datum/emote/living/headtilt key = "tilt" key_third_person = "tilts" diff --git a/modular_skyrat/modules/emotes/code/laugh_datums.dm b/modular_skyrat/modules/emotes/code/laugh_datums.dm new file mode 100644 index 00000000000..c550edee5bf --- /dev/null +++ b/modular_skyrat/modules/emotes/code/laugh_datums.dm @@ -0,0 +1,40 @@ +GLOBAL_LIST_EMPTY(laugh_types) + +/datum/laugh_type + var/name + var/donator_only = FALSE + var/list/male_laughsounds + var/list/female_laughsounds + var/restricted_species_type + +/datum/laugh_type/none //Why would you want this? + name = "No Laugh" + male_laughsounds = null + female_laughsounds = null + +/datum/laugh_type/human + name = "Human Laugh" + male_laughsounds = list('sound/voice/human/manlaugh1.ogg', + 'sound/voice/human/manlaugh2.ogg') + female_laughsounds = list('modular_skyrat/modules/emotes/sound/emotes/female/female_giggle_1.ogg', + 'modular_skyrat/modules/emotes/sound/emotes/female/female_giggle_2.ogg') + +/datum/laugh_type/felinid + name = "Felinid Laugh" + male_laughsounds = list('modular_skyrat/modules/emotes/sound/emotes/nyahaha1.ogg', + 'modular_skyrat/modules/emotes/sound/emotes/nyahaha2.ogg', + 'modular_skyrat/modules/emotes/sound/emotes/nyaha.ogg', + 'modular_skyrat/modules/emotes/sound/emotes/nyahehe.ogg') + female_laughsounds = null + +/datum/laugh_type/moth + name = "Moth Laugh" + male_laughsounds = list('modular_skyrat/modules/emotes/sound/emotes/mothlaugh.ogg') + female_laughsounds = null + restricted_species_type = /datum/species/moth + +/datum/laugh_type/insect + name = "Insect Laugh" + male_laughsounds = list('modular_skyrat/modules/emotes/sound/emotes/mothlaugh.ogg') + female_laughsounds = null + restricted_species_type = /datum/species/insect diff --git a/modular_skyrat/modules/emotes/code/laugh_emotes.dm b/modular_skyrat/modules/emotes/code/laugh_emotes.dm new file mode 100644 index 00000000000..ce029e663d6 --- /dev/null +++ b/modular_skyrat/modules/emotes/code/laugh_emotes.dm @@ -0,0 +1,24 @@ +/datum/emote/living/laugh + key = "laugh" + key_third_person = "laughs" + message = "laughs." + message_mime = "laughs silently!" + emote_type = EMOTE_AUDIBLE + vary = TRUE + mob_type_allowed_typecache = list(/mob/living/carbon, /mob/living/silicon/pai) + +/datum/emote/living/laugh/get_sound(mob/living/user) + if(iscarbon(user)) + var/mob/living/carbon/human/H = user + if(isnull(H.selected_laugh)) //For things that don't have a selected laugh(npcs) + if(user.gender == MALE) + return pick('sound/voice/human/manlaugh1.ogg', + 'sound/voice/human/manlaugh2.ogg') + else + return pick('modular_skyrat/modules/emotes/sound/emotes/female/female_giggle_1.ogg', + 'modular_skyrat/modules/emotes/sound/emotes/female/female_giggle_2.ogg') + if(user.gender == MALE || !LAZYLEN(H.selected_laugh.female_laughsounds)) + return pick(H.selected_laugh.male_laughsounds) + else + return pick(H.selected_laugh.female_laughsounds) + return diff --git a/tgstation.dme b/tgstation.dme index c7bd056a6eb..7f4f2a641da 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -4000,6 +4000,8 @@ #include "modular_skyrat\modules\electric_welder\code\electric_welder.dm" #include "modular_skyrat\modules\emotes\code\dna_screams.dm" #include "modular_skyrat\modules\emotes\code\emotes.dm" +#include "modular_skyrat\modules\emotes\code\laugh_datums.dm" +#include "modular_skyrat\modules\emotes\code\laugh_emotes.dm" #include "modular_skyrat\modules\emotes\code\scream_datums.dm" #include "modular_skyrat\modules\emotes\code\scream_emote.dm" #include "modular_skyrat\modules\emotes\code\silicon_emotes.dm"