Skip to content

Commit

Permalink
Add: [bounty] Voice update (#6326) [testmerge][6195c0f]
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Jan 16, 2025
1 parent c5caf75 commit 94a5d45
Show file tree
Hide file tree
Showing 38 changed files with 355 additions and 50 deletions.
15 changes: 12 additions & 3 deletions code/__DEFINES/dcs/signals.dm
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,15 @@
#define COMSIG_ATOM_NO_LONGER_PULLED "movable_no_longer_pulled"
///signal sent out by an atom when it is no longer pulling something : (atom/pulling)
#define COMSIG_ATOM_NO_LONGER_PULLING "movable_no_longer_pulling"
//signal for mass roundstart store voice (very english)
#define COMSIG_SPECIAL_MASS_STORE_VOICE "store_voice"
#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_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 Expand Up @@ -1111,7 +1120,7 @@
///(obj/item/insertion_candidate, mob/user, silent) - returns bool
#define COMSIG_TRY_STORAGE_CAN_INSERT "storage_can_equip"

// /datum/component/two_handed signals
// datum/component/two_handed signals

///from base of datum/component/two_handed/proc/wield(mob/living/carbon/user): (/mob/user)
#define COMSIG_TWOHANDED_WIELD "twohanded_wield"
Expand Down Expand Up @@ -1152,7 +1161,7 @@
#define OBJECTIVE_VALID_TARGET (1<<0)
#define OBJECTIVE_INVALID_TARGET (1<<1)

// /datum/component/bluespace_rift_scanner signals
// datum/component/bluespace_rift_scanner signals
/// from scanner's `process()` : (seconds, emagged)
#define COMSIG_SCANNING_RIFTS "scanning_rifts"
/// No rifts within the scanner's range
Expand All @@ -1164,7 +1173,7 @@
/// There are no servers available
#define COMPONENT_SCANNED_NO_SERVERS (1<<3)

// /datum/component/overlay_lighting signals, (for-future-backporting)
// datum/component/overlay_lighting signals, (for-future-backporting)
///from base of atom/CheckParts(): (atom/movable/new_craft) - The atom has just been used in a crafting recipe and has been moved inside new_craft.
#define COMSIG_ATOM_USED_IN_CRAFT "atom_used_in_craft"

Expand Down
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/__DEFINES/job.dm
Original file line number Diff line number Diff line change
Expand Up @@ -149,3 +149,5 @@
#define TAIPAN_HUD_COMMS 7
#define TAIPAN_HUD_RD 8
#define TAIPAN_HUD_CYBORG 9

#define STATION_DEPARTMENTS list("Command", "Medical", "Engineering", "Science", "Security", "Cargo", "Support", "Civilian")
2 changes: 1 addition & 1 deletion code/_onclick/hud/plane_master/render_plate.dm
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
/atom/movable/screen/plane_master/rendering_plate/master/hide_from(mob/oldmob)
. = ..()
if(offset == 0)
return
return
var/datum/hud/hud = home.our_hud
if(hud)
UnregisterSignal(hud, COMSIG_HUD_OFFSET_CHANGED, PROC_REF(on_offset_change))
Expand Down
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 GLOB.station_departments)
for(var/department in STATION_DEPARTMENTS)
create_department_account(department)

/datum/controller/subsystem/capitalism/proc/salary_account_init()
Expand Down
15 changes: 14 additions & 1 deletion code/datums/datacore.dm
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@

GLOBAL_LIST_EMPTY(capitalist_manifest)

/datum/datacore
var/list/medical = list()
var/list/general = list()
Expand Down Expand Up @@ -111,6 +114,7 @@ GLOBAL_LIST_EMPTY(PDA_Manifest)
/datum/datacore/proc/manifest()
for(var/mob/living/carbon/human/H in GLOB.player_list)
manifest_inject(H)
SEND_GLOBAL_SIGNAL(COMSIG_DATACORE_VOICE_COLLEAGUE_INJECT, GLOB.capitalist_manifest)

/datum/datacore/proc/manifest_modify(name, rank, assignment)
if(GLOB.PDA_Manifest.len)
Expand Down Expand Up @@ -142,15 +146,24 @@ GLOBAL_VAR_INIT(record_id_num, 1001)
assignment = H.job
else
assignment = "Unassigned"

var/id = num2hex(GLOB.record_id_num++, 6)
H.update_voice()
var/prom_voice = H.voice_name
var/datum/job/prom_job = SSjobs.GetJob(H.job)

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
GLOB.capitalist_manifest[dep_flag] = list((prom_voice) = (H.real_name))

//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
3 changes: 2 additions & 1 deletion code/datums/mind.dm
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@

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 ETP. 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_meta_know = FALSE
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
193 changes: 193 additions & 0 deletions code/datums/voice.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,193 @@
#define GENDER_NAME_UNKNOWN list(MALE = "Неизвестный", FEMALE = "Неизвестная", NEUTER = "Неизвестное", PLURAL = "Неизвестные")
#define MANIFEST_UNKNOWNS list("Неизвестный", "Неизвестная", "Неизвестное", "Неизвестные")
//Voice cumponent
/datum/component/voice_model
var/mob/host = null
var/tts_seed_string = "Arthas"
var/voice_gender = MALE

var/list/known_voices = list()
var/list/known_faces = list()

/datum/component/voice_model/Initialize()
if(!ismob(parent))
return COMPONENT_INCOMPATIBLE //GET OUT

var/mob/owner_voice = parent
host = owner_voice
voice_gender = owner_voice.gender
known_voices[owner_voice.GetVoice()] = owner_voice.name
tts_seed_string = owner_voice.tts_seed

/datum/component/voice_model/RegisterWithParent()
RegisterSignal(SSdcs, COMSIG_SPECIAL_MASS_STORE_VOICE, PROC_REF(special_mass_add_voice))
RegisterSignal(SSdcs, COMSIG_DATACORE_VOICE_COLLEAGUE_INJECT, PROC_REF(special_mass_add_voice))
RegisterSignal(SSdcs, COMSIG_RENAME_VOICE_INJECT, PROC_REF(special_mass_add_voice))

RegisterSignal(parent, COMSIG_MOB_RUN_EXAMINATE, PROC_REF(try_store))
RegisterSignal(parent, COMSIG_VOICE_UPDATE, PROC_REF(voice_update))
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_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(source, list/list_voice)
SIGNAL_HANDLER
UnregisterSignal(SSdcs, COMSIG_DATACORE_VOICE_COLLEAGUE_INJECT)
var/datum/job/prom_job = SSjobs.GetJob(host.job)
if(prom_job)
var/list/prom_data = list_voice?[prom_job.department]

if(prom_data)
LAZYOR(known_voices, prom_data)

/datum/component/voice_model/proc/voice_update(mob/source)
SIGNAL_HANDLER
voice_gender = host.gender
tts_seed_string = host.tts_seed

/* Not used
/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/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"] == host.voice_name)
*returned = t.fields["name"]
break

/* Not used
/datum/component/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/component/voice_model/proc/get_voice_name(mob/source, name)
SIGNAL_HANDLER
*name = host.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
//if(target.voice_name in MANIFEST_UNKNOWNS)
// return FALSE

. = FALSE
if(!ishuman(target))
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))
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)
//known_faces[target_H.name] = prov_wear_id.registered_name
known_voices[target.voice_name] = prov_wear_id.registered_name
. = TRUE
else if(prov_wear_id)
known_voices[target.voice_name] = prov_wear_id.registered_name
. = TRUE
return

/* Not used
/datum/component/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)))
. = known_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/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))
*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)
*returned_name = target.name
return
if(!ishuman(target))
*returned_name = target.name
return
. = known_voices?[target.voice_name]
if(.)
*returned_name = .

/datum/component/voice_model/proc/can_remember_voice(mob/source, mob/target, returned_param)
SIGNAL_HANDLER
if(known_voices?[target.voice_name])
*returned_param = TRUE
else
*returned_param = FALSE

//HELPERS
/proc/gen_departament_voice_tree(mob/target, list/departments)
var/list/result = list()
for(var/dep_flag in departments)
result[dep_flag] = list((target.voice_name) = (target.name))

return result

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

#undef GENDER_NAME_UNKNOWN
5 changes: 5 additions & 0 deletions code/game/atoms.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1706,6 +1706,11 @@ GLOBAL_LIST_EMPTY(blood_splatter_icons)
/atom/proc/GetTTSVoice()
return tts_seed

/mob/proc/update_voice()
voice_name = GetVoice()
tts_seed = GetTTSVoice()
SEND_SIGNAL(src, COMSIG_VOICE_UPDATE)

/// Passes Stat Browser Panel clicks to the game and calls client click on an atom
/atom/Topic(href, list/href_list)
. = ..()
Expand Down
1 change: 1 addition & 0 deletions code/game/gamemodes/clockwork/clockwork.dm
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ GLOBAL_LIST_EMPTY(all_clockers)
clockwork_cult += clock_mind
clock_mind.current.faction |= "clockwork_cult"
clock_mind.special_role = SPECIAL_ROLE_CLOCKER
clock_mind.special_role_meta_know = TRUE

if(clock_mind.assigned_role == JOB_TITLE_CLOWN)
to_chat(clock_mind.current, "<span class='clockitalic'>A dark power has allowed you to overcome your clownish nature, letting you wield weapons without harming yourself.</span>")
Expand Down
1 change: 1 addition & 0 deletions code/game/gamemodes/cult/cult.dm
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ GLOBAL_LIST_EMPTY(all_cults)
cult += cult_mind
cult_mind.current.faction |= "cult"
cult_mind.special_role = SPECIAL_ROLE_CULTIST
cult_mind.special_role_meta_know = TRUE
ADD_TRAIT(cult_mind.current, TRAIT_HEALS_FROM_CULT_PYLONS, CULT_TRAIT)

if(cult_mind.assigned_role == JOB_TITLE_CLOWN)
Expand Down
5 changes: 2 additions & 3 deletions code/game/gamemodes/game_mode.dm
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,12 @@

/**
* 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()

spawn(ROUNDSTART_LOGOUT_REPORT_TIME)
display_roundstart_logout_report()


INVOKE_ASYNC(src, PROC_REF(set_mode_in_db)) // Async query, dont bother slowing roundstart

SScargo_quests.roll_start_quests()
Expand All @@ -99,7 +99,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
3 changes: 3 additions & 0 deletions code/game/jobs/job/engineering.dm
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
min_start_money = 400
max_start_money = 700

default_dep = FALSE
colleagues_department= STATION_DEPARTMENTS

/datum/outfit/job/chief_engineer
name = "Chief Engineer"
jobtype = /datum/job/chief_engineer
Expand Down
Loading

0 comments on commit 94a5d45

Please sign in to comment.