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

Lesser drones and facehuggers cannot speak for 3 minutes after spawning #5352

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 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/dcs/signals/atom/mob/living/signals_xeno.dm
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,7 @@

/// For any additional things that should happen when a xeno's melee_attack_additional_effects_self() proc is called
#define COMSIG_XENO_SLASH_ADDITIONAL_EFFECTS_SELF "xeno_slash_additional_effects_self"

/// From /mob/living/carbon/xenomorph/proc/hivemind_talk(): (message)
#define COMSIG_XENO_TRY_HIVEMIND_TALK "xeno_try_hivemind_talk"
#define COMPONENT_CANCEL_HIVEMIND_TALK (1<<0)
49 changes: 49 additions & 0 deletions code/datums/components/temporary_mute.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/datum/component/temporary_mute
dupe_mode = COMPONENT_DUPE_UNIQUE
/// A message to tell the user when they attempt to speak, if any
var/on_speak_message = ""
/// A message to tell the user when they become no longer mute, if any
var/on_unmute_message = ""
/// How long after the component's initialization it should be deleted. -1 means it will never delete
var/time_until_unmute = 5 MINUTES

/datum/component/temporary_mute/Initialize(on_speak_message = "", on_unmute_message = "", time_until_unmute = 5 MINUTES)
. = ..()
if(!ismob(parent))
return COMPONENT_INCOMPATIBLE

src.on_speak_message = on_speak_message
src.on_unmute_message = on_unmute_message
src.time_until_unmute = time_until_unmute
if(time_until_unmute != -1)
QDEL_IN(src, time_until_unmute)


/datum/component/temporary_mute/RegisterWithParent()
..()
RegisterSignal(parent, COMSIG_LIVING_SPEAK, PROC_REF(on_speak))
RegisterSignal(parent, COMSIG_XENO_TRY_HIVEMIND_TALK, PROC_REF(on_speak))

/datum/component/temporary_mute/UnregisterFromParent()
..()
if(parent)
to_chat(parent, SPAN_NOTICE(on_unmute_message))
UnregisterSignal(parent, COMSIG_LIVING_SPEAK)

/datum/component/temporary_mute/proc/on_speak(
Zonespace27 marked this conversation as resolved.
Show resolved Hide resolved
message,
datum/language/speaking = null,
verb = "says",
alt_name = "",
italics = FALSE,
message_range = GLOB.world_view_size,
sound/speech_sound,
sound_vol,
nolog = FALSE,
message_mode = null
)
var/mob/mob_parent = parent

log_say("[mob_parent.name != "Unknown" ? mob_parent.name : "([mob_parent.real_name])"] attempted to say the following before their xenomorph spawn mute ended: [message] (CKEY: [mob_parent.key]) (JOB: [mob_parent.job])")
to_chat(parent, SPAN_BOLDNOTICE(on_speak_message))
Zonespace27 marked this conversation as resolved.
Show resolved Hide resolved
return COMPONENT_OVERRIDE_SPEAK
15 changes: 15 additions & 0 deletions code/modules/mob/living/carbon/xenomorph/castes/Facehugger.dm
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,21 @@
weed_food_icon = 'icons/mob/xenos/weeds_48x48.dmi'
weed_food_states = list("Facehugger_1","Facehugger_2","Facehugger_3")
weed_food_states_flipped = list("Facehugger_1","Facehugger_2","Facehugger_3")
/// The last ckey to have inhabited this mob
var/last_ckey_inhabited = ""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this not redundant to persistent ckey?


/mob/living/carbon/xenomorph/facehugger/Login()
. = ..()
if(ckey == last_ckey_inhabited)
return

AddComponent(\
/datum/component/temporary_mute,\
"We aren't old enough to vocalize anything yet.",\
"We feel old enough to be able to vocalize and speak to the hivemind.",\
3 MINUTES,\
)
last_ckey_inhabited = ckey

/mob/living/carbon/xenomorph/facehugger/initialize_pass_flags(datum/pass_flags_container/PF)
..()
Expand Down
15 changes: 15 additions & 0 deletions code/modules/mob/living/carbon/xenomorph/castes/lesser_drone.dm
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,21 @@
weed_food_icon = 'icons/mob/xenos/weeds.dmi'
weed_food_states = list("Lesser_Drone_1","Lesser_Drone_2","Lesser_Drone_3")
weed_food_states_flipped = list("Lesser_Drone_1","Lesser_Drone_2","Lesser_Drone_3")
/// The last ckey to have inhabited this mob
var/last_ckey_inhabited = ""

/mob/living/carbon/xenomorph/lesser_drone/Login()
. = ..()
if(ckey == last_ckey_inhabited)
return

AddComponent(\
/datum/component/temporary_mute,\
"We aren't old enough to vocalize anything yet.",\
"We feel old enough to be able to vocalize and speak to the hivemind.",\
3 MINUTES,\
)
last_ckey_inhabited = ckey

/mob/living/carbon/xenomorph/lesser_drone/age_xeno()
if(stat == DEAD || !caste || QDELETED(src) || !client)
Expand Down
3 changes: 3 additions & 0 deletions code/modules/mob/living/carbon/xenomorph/say.dm
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@
to_chat(src, SPAN_WARNING("A headhunter temporarily cut off your psychic connection!"))
return

if(SEND_SIGNAL(src, COMSIG_XENO_TRY_HIVEMIND_TALK, message) & COMPONENT_CANCEL_HIVEMIND_TALK)
return

hivemind_broadcast(message, hive)

/mob/living/carbon/proc/hivemind_broadcast(message, datum/hive_status/hive)
Expand Down
1 change: 1 addition & 0 deletions colonialmarines.dme
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,7 @@
#include "code\datums\components\overlay_lighting.dm"
#include "code\datums\components\rename.dm"
#include "code\datums\components\speed_modifier.dm"
#include "code\datums\components\temporary_mute.dm"
#include "code\datums\components\toxin_buildup.dm"
#include "code\datums\components\tutorial_status.dm"
#include "code\datums\components\weed_damage_reduction.dm"
Expand Down
Loading