Skip to content

Commit

Permalink
фмпмфппмфпмф апдейте
Browse files Browse the repository at this point in the history
  • Loading branch information
Pelmenik123 committed Jan 15, 2025
1 parent 74a2fff commit bfa77b1
Show file tree
Hide file tree
Showing 15 changed files with 95 additions and 55 deletions.
5 changes: 5 additions & 0 deletions code/__DEFINES/dcs/signals.dm
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@
#define COMSIG_DATACORE_VOICE_COLLEAGUE_INJECT "manifest_injection"
#define COMSIG_RENAME_VOICE_INJECT "rename_inject"
#define COMSIG_VOICE_UPDATE "voice_update"
#define COMSIG_GET_VOICE_NAME "get_voice_name"
#define COMSIG_GET_VOICE_GENDER "get_voice_gender"
#define COMSIG_TRY_RECOLLECT_VOICE "try_recollect_voice"
#define COMSIG_CAN_REMEMBER_VOICE "can_rem_voice"
#define COMSIG_GET_MANIFEST_KWON_VOICE "get_manigest_voice"

///from base of atom/attackby(): (/obj/item, /mob/living, params)
#define COMSIG_PARENT_ATTACKBY "atom_attackby"
Expand Down
2 changes: 1 addition & 1 deletion code/__DEFINES/job.dm
Original file line number Diff line number Diff line change
Expand Up @@ -150,4 +150,4 @@
#define TAIPAN_HUD_RD 8
#define TAIPAN_HUD_CYBORG 9

#define PRIMITIVE_STATION_DEPARTMENTS list("Command", "Medical", "Engineering", "Science", "Security", "Cargo", "Support", "Civilian")
#define STATION_DEPARTMENTS list("Command", "Medical", "Engineering", "Science", "Security", "Cargo", "Support", "Civilian")
2 changes: 1 addition & 1 deletion code/controllers/subsystem/capitalism.dm
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ SUBSYSTEM_DEF(capitalism)
create_station_account()

if(GLOB.department_accounts.len == 0)
for(var/department in PRIMITIVE_STATION_DEPARTMENTS)
for(var/department in STATION_DEPARTMENTS)
create_department_account(department)

/datum/controller/subsystem/capitalism/proc/salary_account_init()
Expand Down
7 changes: 3 additions & 4 deletions code/datums/datacore.dm
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,11 @@ GLOBAL_VAR_INIT(record_id_num, 1001)

var/id = num2hex(GLOB.record_id_num++, 6)
H.update_voice()
var/datum/component/voice_model/prom_adv_voice = H.GetComponent(/datum/component/voice_model)
var/prom_voice = prom_adv_voice.voice_name

var/prom_voice = "Незнакомец"
SEND_SIGNAL(H, COMSIG_GET_VOICE_NAME, &(prom_voice))
var/datum/job/prom_job = SSjobs.GetJob(H.job)

for(var/dep_flag in prom_job.colleagues_department) //:catsmile:
for(var/dep_flag in prom_job.colleagues_department)
if(!isnull(GLOB.capitalist_manifest?[dep_flag]))
GLOB.capitalist_manifest[dep_flag][prom_voice] = H.real_name
else
Expand Down
94 changes: 64 additions & 30 deletions code/datums/voice.dm
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#define GENDER_NAME_UNKNOWN list(MALE = "Неизвестный", FEMALE = "Неизвестная", NEUTER = "Неизвестное", PLURAL = "Неизвестные")
#define MANIFEST_UNKNOWNS list("Неизвестный", "Неизвестная", "Неизвестное", "Неизвестные")
//Voice cumponent
/datum/component/voice_model
var/mob/host = null
Expand Down Expand Up @@ -29,19 +30,29 @@

RegisterSignal(parent, COMSIG_MOB_RUN_EXAMINATE, PROC_REF(try_store))
RegisterSignal(parent, COMSIG_VOICE_UPDATE, PROC_REF(voice_update))
RegisterSignal(parent, COMSIG_GET_VOICE_NAME, PROC_REF(get_voice_name))
RegisterSignal(parent, COMSIG_GET_VOICE_GENDER, PROC_REF(get_voice_gender))
RegisterSignal(parent, COMSIG_TRY_RECOLLECT_VOICE, PROC_REF(try_recollect_voice))
RegisterSignal(parent, COMSIG_CAN_REMEMBER_VOICE, PROC_REF(can_remember_voice))
RegisterSignal(parent, COMSIG_GET_MANIFEST_KWON_VOICE, PROC_REF(get_manifest_know_voice))


/datum/component/voice_model/UnregisterFromParent()
UnregisterSignal(SSdcs, COMSIG_SPECIAL_MASS_STORE_VOICE)
UnregisterSignal(SSdcs, COMSIG_DATACORE_VOICE_COLLEAGUE_INJECT)
UnregisterSignal(SSdcs, COMSIG_RENAME_VOICE_INJECT)
UnregisterSignal(parent, COMSIG_MOB_RUN_EXAMINATE)
UnregisterSignal(parent, COMSIG_VOICE_UPDATE)
UnregisterSignal(parent, COMSIG_GET_VOICE_NAME)
UnregisterSignal(parent, COMSIG_TRY_RECOLLECT_VOICE)
UnregisterSignal(parent, COMSIG_GET_VOICE_GENDER)
UnregisterSignal(parent, COMSIG_CAN_REMEMBER_VOICE)
UnregisterSignal(parent, COMSIG_GET_MANIFEST_KWON_VOICE)

/datum/component/voice_model/proc/special_mass_add_voice(suka, list/list_voice)
/datum/component/voice_model/proc/special_mass_add_voice(source, list/list_voice)
SIGNAL_HANDLER
UnregisterSignal(SSdcs, COMSIG_DATACORE_VOICE_COLLEAGUE_INJECT)

var/datum/job/prom_job = SSjobs.GetJob(host.job) //WARNING. Fuking byond
var/datum/job/prom_job = SSjobs.GetJob(host.job)
if(prom_job)
var/list/prom_data = list_voice?[prom_job.department]

Expand All @@ -66,12 +77,14 @@
famous_voices = voice_to_copy.famous_voices
*/

/datum/component/voice_model/proc/get_manifest_know_voice()
/datum/component/voice_model/proc/get_manifest_know_voice(mob/source, returned)
SIGNAL_HANDLER
*returned = "IDENTIFICATION ERROR"
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 ERROR"
*returned = t.fields["name"]
break

/* Not used
/datum/component/voice_model/proc/GetManifestKnowFace(mob/face_target)
Expand All @@ -82,12 +95,22 @@
return "IDENTIFICATION FACE ERROR"
*/

/datum/component/voice_model/proc/get_voice_name(mob/source, name)
SIGNAL_HANDLER
*name = voice_name

/datum/component/voice_model/proc/get_voice_gender(mob/source, target_gender)
SIGNAL_HANDLER
*target_gender = voice_gender

/datum/component/voice_model/proc/try_store(mob/source, mob/target)
SIGNAL_HANDLER
if(target == source)
return FALSE
var/datum/component/voice_model/adv_voice = target.GetComponent(/datum/component/voice_model)
if(isnull(adv_voice))
var/speaker_name = get_gender_unknown_name(target.gender)
SEND_SIGNAL(target, COMSIG_GET_VOICE_NAME, &speaker_name)

if(speaker_name in MANIFEST_UNKNOWNS)
return FALSE

. = FALSE
Expand All @@ -104,10 +127,10 @@

if(!((target_H.wear_mask?.flags_inv & HIDENAME) || (target_H.head?.flags_inv & HIDENAME)) && prov_wear_id)
//known_faces[target_H.name] = prov_wear_id.registered_name
known_voices[adv_voice.voice_name] = prov_wear_id.registered_name
known_voices[speaker_name] = prov_wear_id.registered_name
. = TRUE
else if(prov_wear_id)
known_voices[adv_voice.voice_name] = prov_wear_id.registered_name
known_voices[speaker_name] = prov_wear_id.registered_name
. = TRUE
return

Expand All @@ -133,37 +156,48 @@
*/

//For hear
/datum/component/voice_model/proc/try_recollect_voice(mob/target)
/datum/component/voice_model/proc/try_recollect_voice(mob/source, mob/target, returned_name)
SIGNAL_HANDLER
var/target_gender = NEUTER
SEND_SIGNAL(target, COMSIG_GET_VOICE_GENDER, &target_gender)
*returned_name = get_gender_unknown_name(target_gender)

if(!ishuman(host))
return target.name
if(host.mind.special_role_meta_know && (target.mind.special_role == host.mind.special_role))
return target.name
*returned_name = target.name
return
if(host.mind.special_role_meta_know && ((target.mind.special_role) == (host.mind.special_role)))
*returned_name = target.name
return

if(host == target)
return target.name
*returned_name = target.name
return
if(!ishuman(target))
return target.name
var/datum/component/voice_model/adv_voice = target.GetComponent(/datum/component/voice_model)
. = known_voices?[adv_voice.voice_name]
if(.)
*returned_name = target.name
return
var/speaker_name = get_gender_unknown_name(target.gender)
SEND_SIGNAL(target, COMSIG_GET_VOICE_NAME, &speaker_name)
. = known_voices?[speaker_name]
if(.)
*returned_name = .

return get_gender_unknown_name(adv_voice.voice_gender)

/datum/component/voice_model/proc/can_remember_voice(mob/target)
var/datum/component/voice_model/adv_voice = target.GetComponent(/datum/component/voice_model)

if(known_voices?[adv_voice.voice_name])
return TRUE
return FALSE
/datum/component/voice_model/proc/can_remember_voice(mob/source, mob/target, returned_param)
SIGNAL_HANDLER
var/speaker_name = get_gender_unknown_name(target.gender)
SEND_SIGNAL(target, COMSIG_GET_VOICE_NAME, &speaker_name)
if(known_voices?[speaker_name])
*returned_param = TRUE
else
*returned_param = FALSE

//HELPERS
/proc/gen_departament_voice_tree(mob/target, list/departments)
var/list/result = list()

var/speaker_name
speaker_name = get_gender_unknown_name(target.gender)
SEND_SIGNAL(target, COMSIG_GET_VOICE_NAME, &(speaker_name))
for(var/dep_flag in departments)
var/datum/component/voice_model/adv_voice = target.GetComponent(/datum/component/voice_model)
result[dep_flag] = list(adv_voice.voice_name = target.name)
result[dep_flag] = list((speaker_name) = (target.name))

return result

Expand Down
2 changes: 1 addition & 1 deletion code/game/jobs/job/engineering.dm
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
max_start_money = 700

default_dep = FALSE
colleagues_department= PRIMITIVE_STATION_DEPARTMENTS
colleagues_department= STATION_DEPARTMENTS

/datum/outfit/job/chief_engineer
name = "Chief Engineer"
Expand Down
2 changes: 1 addition & 1 deletion code/game/jobs/job/medical.dm
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
max_start_money = 700

default_dep = FALSE
colleagues_department= PRIMITIVE_STATION_DEPARTMENTS
colleagues_department= STATION_DEPARTMENTS

/datum/outfit/job/cmo
name = JOB_TITLE_CMO
Expand Down
2 changes: 1 addition & 1 deletion code/game/jobs/job/science.dm
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
max_start_money = 700

default_dep = FALSE
colleagues_department= PRIMITIVE_STATION_DEPARTMENTS
colleagues_department= STATION_DEPARTMENTS

/datum/outfit/job/rd
name = "Research Director"
Expand Down
2 changes: 1 addition & 1 deletion code/game/jobs/job/security.dm
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
max_start_money = 700

default_dep = FALSE
colleagues_department= PRIMITIVE_STATION_DEPARTMENTS
colleagues_department= STATION_DEPARTMENTS

/datum/outfit/job/hos
name = "Head of Security"
Expand Down
4 changes: 2 additions & 2 deletions code/game/jobs/job/supervisor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ GLOBAL_DATUM_INIT(captain_announcement, /datum/announcement/minor, new(do_newsca
max_start_money = 1200

default_dep = FALSE
colleagues_department= PRIMITIVE_STATION_DEPARTMENTS
colleagues_department= STATION_DEPARTMENTS

/datum/job/captain/get_access()
return get_all_accesses()
Expand Down Expand Up @@ -100,7 +100,7 @@ GLOBAL_DATUM_INIT(captain_announcement, /datum/announcement/minor, new(do_newsca
max_start_money = 700

default_dep = FALSE
colleagues_department= PRIMITIVE_STATION_DEPARTMENTS
colleagues_department= STATION_DEPARTMENTS

/datum/outfit/job/hop
name = "Head of Personnel"
Expand Down
2 changes: 1 addition & 1 deletion code/game/jobs/job/support.dm
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
max_start_money = 700

default_dep = FALSE
colleagues_department= PRIMITIVE_STATION_DEPARTMENTS
colleagues_department= STATION_DEPARTMENTS

/datum/outfit/job/qm
name = "Quartermaster"
Expand Down
8 changes: 3 additions & 5 deletions code/modules/mob/hear_say.dm
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,7 @@

if(italics)
message = "<i>[message]</i>"
var/datum/component/voice_model/adv_voice = GetComponent(/datum/component/voice_model)
speaker_name = adv_voice.try_recollect_voice(speaker)
SEND_SIGNAL(src, COMSIG_TRY_RECOLLECT_VOICE, speaker, &speaker_name)
var/track = null
if(isobserver(src))
if(speaker_name != speaker.real_name && speaker.real_name)
Expand Down Expand Up @@ -253,9 +252,8 @@
return vname
if(!ishuman(speaker))
return speaker.name

var/datum/component/voice_model/adv_voice = GetComponent(/datum/component/voice_model)
return adv_voice.try_recollect_voice(speaker)
SEND_SIGNAL(src, COMSIG_TRY_RECOLLECT_VOICE, speaker, &speaker_name)
return speaker_name

/mob/proc/handle_track(message, verb = "says", mob/speaker = null, speaker_name, atom/follow_target, hard_to_hear)
return
Expand Down
14 changes: 9 additions & 5 deletions code/modules/mob/living/silicon/silicon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,18 @@
return diag_hud_set_status() //we use a different hud

/mob/living/silicon/handle_speaker_name(mob/speaker = null, vname, hard_to_hear)
var/speaker_name = ""

if(speaker == src) //HeLLO Is I
return speaker.name

var/datum/component/voice_model/src_adv_voice = src.GetComponent(/datum/component/voice_model)
if(src_adv_voice.can_remember_voice(speaker))
return src_adv_voice.try_recollect_voice(speaker)
var/datum/component/voice_model/speaker_adv_voice = speaker.GetComponent(/datum/component/voice_model)
return speaker_adv_voice.get_manifest_know_voice()
var/i_can_rememver = FALSE
SEND_SIGNAL(src, COMSIG_CAN_REMEMBER_VOICE, speaker, &i_can_rememver)
if(i_can_rememver)
SEND_SIGNAL(src, COMSIG_TRY_RECOLLECT_VOICE, speaker, &speaker_name)
else
SEND_SIGNAL(speaker, COMSIG_GET_MANIFEST_KWON_VOICE, &speaker_name)
return speaker_name

/mob/living/silicon/Destroy()
UnregisterSignal(SSalarm, list(
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/mob.dm
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

/mob/Initialize(mapload)
voice_name = GetVoice()
src.AddComponent(/datum/component/voice_model)
AddComponent(/datum/component/voice_model)

add_to_mob_list()

Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/mob_helpers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ GLOBAL_LIST_INIT(intents, list(INTENT_HELP,INTENT_DISARM,INTENT_GRAB,INTENT_HARM
pos = findtextEx_char(objective.explanation_text, oldname)
objective.explanation_text = copytext_char(objective.explanation_text, 1, pos)+newname+copytext_char(objective.explanation_text, pos+length)
update_voice()
if(!LAZYLEN(mass_update))
if(LAZYLEN(mass_update))
SEND_GLOBAL_SIGNAL(COMSIG_RENAME_VOICE_INJECT, gen_departament_voice_tree(src, mass_update))
return 1

Expand Down

0 comments on commit bfa77b1

Please sign in to comment.