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

[bounty] add: Voices memorization/Unk. voices at start #6237

Draft
wants to merge 4 commits into
base: master220
Choose a base branch
from
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
4 changes: 4 additions & 0 deletions code/__DEFINES/is_helpers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@

#define isitem(A) (istype(A, /obj/item))

#define isIdCard(A) (istype(A, /obj/item/card/id))

#define isWallet(A) (istype(A, /obj/item/storage/wallet))

#define isstack(A) (istype(A, /obj/item/stack))

#define isstorage(A) (istype(A, /obj/item/storage))
Expand Down
2 changes: 2 additions & 0 deletions code/datums/datacore.dm
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,13 @@ GLOBAL_VAR_INIT(record_id_num, 1001)
var/id = num2hex(GLOB.record_id_num++, 6)


//При создании рекордсов еще берется и голос, боже помилуй чтобы это ничего не сломало
//General Record
var/datum/data/record/G = new()
G.fields["id"] = id
G.fields["name"] = H.real_name
G.fields["real_rank"] = H.mind.assigned_role
G.fields["voice"] = H.GetVoice()
G.fields["rank"] = assignment
G.fields["age"] = H.age
G.fields["fingerprint"] = md5(H.dna.uni_identity)
Expand Down
2 changes: 1 addition & 1 deletion code/datums/mind.dm
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

var/assigned_role //assigned role is what job you're assigned to when you join the station.
var/playtime_role //if set, overrides your assigned_role for the purpose of playtime awards. Set by IDcomputer when your ID is changed.
var/special_role //special roles are typically reserved for antags or roles like ERT. If you want to avoid a character being automatically announced by the AI, on arrival (becuase they're an off station character or something); ensure that special_role and assigned_role are equal.
var/special_role //special roles are typically reserved for antags or roles like ERP. If you want to avoid a character being automatically announced by the AI, on arrival (becuase they're an off station character or something); ensure that special_role and assigned_role are equal.
var/offstation_role = FALSE //set to true for ERT, deathsquad, abductors, etc, that can go from and to z2 at will and shouldn't be antag targets
var/list/restricted_roles = list()

Expand Down
120 changes: 120 additions & 0 deletions code/datums/voice.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
#define GENDER_NAME_UNKNOW list(MALE = "Незнакомец", FEMALE = "Незнакомка", NEUTER = "Неизвестный", PLURAL = "Неизвестный")

//Новая система голоса
/datum/voice_model
var/tts_seed_string = "Arthas"
var/voice_gender = MALE
var/voice_name = "Неизвестный"
var/real_voice_name = "Неизвестный"

var/list/famous_voices = list()
//var/list/famous_faces = list()

/datum/voice_model/proc/CreateVoiceModel(var/atom/owner_voice)
var/datum/voice_model/result = new()

result.real_voice_name = owner_voice.GetVoice()
result.voice_name = owner_voice.GetVoice()
result.voice_gender = owner_voice.gender
result.famous_voices[voice_name] = owner_voice.name
result.tts_seed_string = owner_voice.tts_seed

return result

/datum/voice_model/proc/VoiceUpdate(var/atom/owner_voice)
voice_name = owner_voice.GetVoice() //:badguy:

/datum/voice_model/proc/get_gender_unknown_name(gender_string)
var/result = (GENDER_NAME_UNKNOW)?[gender_string]
if(result)
return result
return "Неизвестный"

/datum/voice_model/proc/CopyInVoice(datum/voice_model/voice_to_copy)
tts_seed_string = voice_to_copy.tts_seed_string
voice_gender = voice_to_copy.voice_gender
voice_name = voice_to_copy.voice_name

/datum/voice_model/proc/FullCopyInVoice(datum/voice_model/voice_to_copy)
CopyInVoice(voice_to_copy)
real_voice_name = voice_to_copy.real_voice_name
famous_voices = voice_to_copy.famous_voices

//было две бутылки, словарь или два прока. Я сел на вторую
/datum/voice_model/proc/GetManifestKnowVoice()
for(var/datum/data/record/t in GLOB.data_core.general)
if(t)
if(t.fields["voice"] == voice_name)
return t.fields["name"]
return "IDENTIFICATION VOICE ERROR"
//Технически name это представление твоего ебала
/* BYOND...
/datum/voice_model/proc/GetManifestKnowFace(mob/face_target)
for(var/datum/data/record/t in GLOB.data_core.general)
if(t)
if(t.fields["name"] == face_target.name)
return t.fields["name"]
return "IDENTIFICATION FACE ERROR"
*/

/datum/voice_model/proc/TryStore(mob/target)
if(src == target.adv_voice)
return TRUE
. = FALSE
if(!ishuman(target)) //Нахуя мне знать как зовут мышей :badguy:
return target.name
var/mob/living/carbon/human/target_H = target
var/obj/item/card/id/prov_wear_id = null

if(isIdCard(target_H.wear_id)) //Fuck
prov_wear_id = target_H.wear_id
if(isWallet(target_H.wear_id)) //Мфпмфпф
var/obj/item/storage/wallet/prom = target_H.wear_id
prov_wear_id = prom.front_id

if(!((target_H.wear_mask?.flags_inv & HIDENAME) || (target_H.head?.flags_inv & HIDENAME)) && prov_wear_id)

//famous_faces[target_H.name] = prov_wear_id.registered_name //FUCK BYOND
famous_voices[target_H.adv_voice.voice_name] = prov_wear_id.registered_name
. = TRUE
else if(prov_wear_id)
famous_voices[target_H.adv_voice.voice_name] = prov_wear_id.registered_name
. = TRUE
return

//For examie
/* FUCKING BYOND
/datum/voice_model/proc/TryRecollectFace(mob/target)
if(src == target.adv_voice)
return target.name
if(!ishuman(target)) //:Roflcat: Чтобы имена мышей знать сразу
return target.name
var/mob/living/carbon/human/target_H = target

if(!((target_H.wear_mask?.flags_inv & HIDENAME) || (target_H.head?.flags_inv & HIDENAME)))
. = famous_faces?[target_H.name]

if(.)
return

if((target_H.wear_suit?.flags_inv & HIDEJUMPSUIT) && (target_H.head?.flags_inv & HIDENAME))
. = get_gender_unknown_name(NEUTER)
else
. = get_gender_unknown_name(target_H.gender)
return
*/
//For hear
/datum/voice_model/proc/TryRecollectVoice(mob/target)
if(src == target.adv_voice)
return target.adv_voice.voice_name
if(!ishuman(target))
return target.adv_voice.voice_name
var/mob/living/carbon/human/target_H = target

. = famous_voices?[target_H.name]
if(.)
return

return get_gender_unknown_name(target_H.adv_voice.voice_gender)

#undef GENDER_NAME_UNKNOW
40 changes: 37 additions & 3 deletions code/game/gamemodes/game_mode.dm
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,44 @@

/**
* Everyone should now be on the station and have their normal gear. This is the place to give the special roles extra things.
*/
*/
/datum/game_mode/proc/post_setup()

//Cringe zone start
//Data format JOB = list(Voice_name = name)
var/list/communist_manifest = list()
var/list/capitalist_pig = list()
var/list/head_pigs = list() //capitan
/*
var/list/god_ai_list = list() //for AI
for(var/mob/living/silicon/ai)
if(ai.job = JOB_TITLE_AI && ai.loc.z == STATION_LEVEL)
god_ai_list[ai.voice_name] = ai.name
*/
for(var/mob/living/carbon/human/target)
var/datum/job/prom_job = SSjobs.GetJob(target.job)
var/dep_flag = "[prom_job?.department_flag]"

if(!dep_flag)
continue
if(target.job in GLOB.command_positions)
capitalist_pig[target.GetVoice()] = target.name
if(target.job == JOB_TITLE_CAPTAIN)
head_pigs[target.GetVoice()] = target.name
if(communist_manifest?[dep_flag])
communist_manifest[dep_flag][target.GetVoice()] = target.name
else
communist_manifest[dep_flag] = list(target.GetVoice() = target.name)
for(var/mob/living/carbon/human/target)
var/datum/job/prom_job = SSjobs.GetJob(target.job)
var/dep_flag = "[prom_job?.department_flag]"
if(!dep_flag)
continue
if(communist_manifest?[dep_flag])
if(target.job in GLOB.command_positions)
target.adv_voice.famous_voices = (communist_manifest[dep_flag] + capitalist_pig) - target.GetVoice()
else
target.adv_voice.famous_voices = (communist_manifest[dep_flag] + head_pigs) - target.GetVoice()
//Cringe zone stop
spawn(ROUNDSTART_LOGOUT_REPORT_TIME)
display_roundstart_logout_report()

Expand All @@ -99,7 +134,6 @@
GLOB.start_state.count()
return TRUE


/datum/game_mode/proc/set_mode_in_db() // I wonder what this could do guessing by the name
if(SSticker?.mode && SSdbcore.IsConnected())
var/datum/db_query/query_round_game_mode = SSdbcore.NewQuery("UPDATE round SET game_mode=:gm WHERE id=:rid", list(
Expand Down
18 changes: 8 additions & 10 deletions code/modules/mob/hear_say.dm
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@

if(italics)
message = "<i>[message]</i>"

speaker_name = adv_voice.TryRecollectVoice(speaker)
var/track = null
if(isobserver(src))
if(speaker_name != speaker.real_name && speaker.real_name)
Expand Down Expand Up @@ -245,17 +245,15 @@
INVOKE_ASYNC(GLOBAL_PROC, /proc/tts_cast, src, src, message_tts, speaker.tts_seed, FALSE, effect, null, null, 'sound/effects/radio_chatter.ogg')

/mob/proc/handle_speaker_name(mob/speaker = null, vname, hard_to_hear)
var/speaker_name = "unknown"
if(speaker)
speaker_name = speaker.name

if(vname)
speaker_name = vname

var/speaker_name = "Неизвестный"
if(hard_to_hear)
speaker_name = "unknown"
return speaker_name
if(!(speaker))
return vname
if(!ishuman(speaker))
return speaker.adv_voice.voice_name

return speaker_name
return adv_voice.TryRecollectVoice(speaker)

/mob/proc/handle_track(message, verb = "says", mob/speaker = null, speaker_name, atom/follow_target, hard_to_hear)
return
Expand Down
3 changes: 2 additions & 1 deletion code/modules/mob/living/carbon/human/examine.dm
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
skipears |= wear_mask.flags_inv & HIDEHEADSETS

var/msg = "This is "

if(!user.adv_voice.TryStore(src))
to_chat(user, "Кажется вам не за что зацепится взглядом...")
if(!(skipjumpsuit && skipface) && icon) //big suits/masks/helmets make it hard to tell their gender
msg += "[bicon(icon(icon, dir=SOUTH))] " //fucking BYOND: this should stop dreamseeker crashing if we -somehow- examine somebody before their icon is generated
msg += "<EM>[name]</EM>"
Expand Down
8 changes: 5 additions & 3 deletions code/modules/mob/living/carbon/human/human.dm
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

/mob/living/carbon/human/Initialize(mapload, datum/species/new_species = /datum/species/human)
icon = null // This is now handled by overlays -- we just keep an icon for the sake of the map editor.
create_dna()
Expand Down Expand Up @@ -391,9 +392,9 @@
if(name_override)
return name_override
if(wear_mask && (wear_mask.flags_inv & HIDENAME)) //Wearing a mask which hides our face, use id-name if possible
return get_id_name("Unknown")
return get_id_name(adv_voice.get_gender_unknown_name(gender))
if(head && (head.flags_inv & HIDENAME))
return get_id_name("Unknown") //Likewise for hats
return get_id_name(adv_voice.get_gender_unknown_name(gender)) //Likewise for hats
var/face_name = get_face_name()
var/id_name = get_id_name("")
if(add_id_name && id_name && (id_name != face_name))
Expand All @@ -404,7 +405,7 @@
/mob/living/carbon/human/proc/get_face_name()
var/obj/item/organ/external/head_organ = get_organ(BODY_ZONE_HEAD)
if(!head_organ || head_organ.is_disfigured() || cloneloss > 50 || !real_name || HAS_TRAIT(src, TRAIT_HUSK)) //disfigured. use id-name if possible
return "Unknown"
return adv_voice.get_gender_unknown_name(gender)
return real_name


Expand All @@ -413,6 +414,7 @@
* Useful when player is being seen by other mobs.
*/
/mob/living/carbon/human/proc/get_id_name(if_no_id = "Unknown")
if_no_id = adv_voice.get_gender_unknown_name(gender)
var/obj/item/card/id/id = wear_id?.GetID()
if(istype(id))
return id.registered_name
Expand Down
5 changes: 3 additions & 2 deletions code/modules/mob/living/carbon/human/life.dm
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@

life_tick++

voice = GetVoice()
tts_seed = GetTTSVoice()
//Теперь это этажом ниже
//voice = GetVoice()
//tts_seed = GetTTSVoice()

if(.) //not dead

Expand Down
6 changes: 6 additions & 0 deletions code/modules/mob/living/carbon/life.dm
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
/mob/living/carbon/Life(seconds, times_fired)
set invisibility = 0
//:roflcat:
voice_name = GetVoice()
tts_seed = GetTTSVoice()

adv_voice.voice_gender = gender
adv_voice.voice_name = voice_name
adv_voice.tts_seed_string = tts_seed
if(HAS_TRAIT(src, TRAIT_NO_TRANSFORM))
return

Expand Down
3 changes: 3 additions & 0 deletions code/modules/mob/living/silicon/silicon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@
/mob/living/silicon/med_hud_set_status()
return diag_hud_set_status() //we use a different hud

/mob/living/silicon/handle_speaker_name(mob/speaker = null, vname, hard_to_hear)
return speaker.adv_voice.GetManifestKnowVoice()

/mob/living/silicon/Destroy()
UnregisterSignal(SSalarm, list(
COMSIG_TRIGGERED_ALARM,
Expand Down
8 changes: 8 additions & 0 deletions code/modules/mob/mob.dm
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@

/mob/Initialize(mapload)
GLOB.mob_list += src
voice_name = GetVoice()

adv_voice = new /datum/voice_model()
adv_voice.real_voice_name = name
adv_voice.tts_seed_string = GetTTSVoice()
adv_voice.voice_gender = gender
adv_voice.voice_name = voice_name

if(stat == DEAD)
GLOB.dead_mob_list += src
else
Expand Down
2 changes: 2 additions & 0 deletions code/modules/mob/mob_defines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,9 @@

//see: setup.dm for list of mutations

var/liberated_name = "Неизвестный" //Долой гнет бульена!!
var/voice_name = "неизвестный голос"
var/datum/voice_model/adv_voice = null

var/list/faction = list("neutral") //Used for checking whether hostile simple animals will attack you, possibly more stuff later

Expand Down
Loading
Loading