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

Refactors silicon emotes slightly - port of tgstation 84912 #5384

Merged
merged 1 commit into from
Feb 21, 2025
Merged
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
2 changes: 1 addition & 1 deletion code/__DEFINES/traits/declarations.dm
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai
/// These mobs have particularly hygienic tongues
/* #define TRAIT_WOUND_LICKER "wound_licker" */
/// Mobs with this trait are allowed to use silicon emotes
/* #define TRAIT_SILICON_EMOTES_ALLOWED "silicon_emotes_allowed" */
#define TRAIT_SILICON_EMOTES_ALLOWED "silicon_emotes_allowed"

/// This trait designate that the mob was originally a monkey
/* #define TRAIT_BORN_MONKEY "born_as_a_monkey" */
Expand Down
2 changes: 1 addition & 1 deletion code/_globalvars/traits/_traits.dm
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,7 @@ GLOBAL_LIST_INIT(traits_by_type, list(
"TRAIT_XRAY_VISION" = TRAIT_XRAY_VISION,
"TRAIT_COLD_BLOODED" = TRAIT_COLD_BLOODED,
"TRAIT_ZOMBIE_CONSUMED" = TRAIT_ZOMBIE_CONSUMED,
"TRAIT_SILICON_EMOTES_ALLOWED" = TRAIT_SILICON_EMOTES_ALLOWED,
/* "TRAIT_ADAMANTINE_EXTRACT_ARMOR" = TRAIT_ADAMANTINE_EXTRACT_ARMOR, */
/* "TRAIT_ALWAYS_WANTED" = TRAIT_ALWAYS_WANTED, */
/* "TRAIT_ANOSMIA" = TRAIT_ANOSMIA, */
Expand Down Expand Up @@ -593,7 +594,6 @@ GLOBAL_LIST_INIT(traits_by_type, list(
/* "TRAIT_ROCK_STONER" = TRAIT_ROCK_STONER, */
/* "TRAIT_ROUGHRIDER" = TRAIT_ROUGHRIDER, */
/* "TRAIT_SEE_WORN_COLOURS" = TRAIT_SEE_WORN_COLOURS, */
/* "TRAIT_SILICON_EMOTES_ALLOWED" = TRAIT_SILICON_EMOTES_ALLOWED, */
/* "TRAIT_SLOW_FLIP" = TRAIT_SLOW_FLIP, */
/* "TRAIT_SPEECH_BOOSTER" = TRAIT_SPEECH_BOOSTER, */
/* "TRAIT_SPELLS_LOTTERY" = TRAIT_SPELLS_LOTTERY, */
Expand Down
4 changes: 4 additions & 0 deletions code/datums/emotes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
var/list/mob_type_blacklist_typecache
/// Types that can use this emote regardless of their state.
var/list/mob_type_ignore_stat_typecache
/// Trait that is required to use this emote.
var/trait_required
/// In which state can you use this emote? (Check stat.dm for a full list of them)
var/stat_allowed = CONSCIOUS
/// Sound to play when emote is called.
Expand Down Expand Up @@ -247,6 +249,8 @@
* Returns a bool about whether or not the user can run the emote.
*/
/datum/emote/proc/can_run_emote(mob/user, status_check = TRUE, intentional = FALSE)
if(trait_required && !HAS_TRAIT(user, trait_required))
return FALSE
if(!is_type_in_typecache(user, mob_type_allowed_typecache))
return FALSE
if(is_type_in_typecache(user, mob_type_blacklist_typecache))
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/basic/bots/_bots.dm
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ GLOBAL_LIST_INIT(command_strings, list(
RegisterSignal(src, COMSIG_MOVABLE_MOVED, PROC_REF(handle_loop_movement))
RegisterSignal(src, COMSIG_ATOM_WAS_ATTACKED, PROC_REF(after_attacked))
RegisterSignal(src, COMSIG_MOB_TRIED_ACCESS, PROC_REF(attempt_access))
ADD_TRAIT(src, TRAIT_NO_GLIDE, INNATE_TRAIT)
add_traits(list(TRAIT_NO_GLIDE, TRAIT_SILICON_EMOTES_ALLOWED), INNATE_TRAIT)
GLOB.bots_list += src

// Give bots a fancy new ID card that can hold any access.
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/brain/brain.dm
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
forceMove(OB)
if(!container?.mecha) //Unless inside a mecha, brains are rather helpless.
add_traits(list(TRAIT_IMMOBILIZED, TRAIT_HANDS_BLOCKED), BRAIN_UNAIDED)

ADD_TRAIT(src, TRAIT_SILICON_EMOTES_ALLOWED, INNATE_TRAIT)

/mob/living/brain/on_changed_z_level(turf/old_turf, turf/new_turf, same_z_layer, notify_contents)
var/obj/item/organ/internal/brain/brain_loc = loc
Expand Down
9 changes: 0 additions & 9 deletions code/modules/mob/living/emote.dm
Original file line number Diff line number Diff line change
Expand Up @@ -675,15 +675,6 @@ monkestation edit end */
/datum/emote/living/custom/replace_pronoun(mob/user, message)
return message

/datum/emote/living/beep
key = "beep"
key_third_person = "beeps"
message = "beeps."
message_param = "beeps at %t."
sound = 'sound/machines/twobeep.ogg'
mob_type_allowed_typecache = list(/mob/living/brain, /mob/living/silicon)
emote_type = EMOTE_AUDIBLE

/datum/emote/living/inhale
key = "inhale"
key_third_person = "inhales"
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/silicon/ai/ai.dm
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@
RegisterSignal(ai_tracking_tool, COMSIG_TRACKABLE_TRACKING_TARGET, PROC_REF(on_track_target))
RegisterSignal(ai_tracking_tool, COMSIG_TRACKABLE_GLIDE_CHANGED, PROC_REF(tracked_glidesize_changed))

add_traits(list(TRAIT_PULL_BLOCKED, TRAIT_HANDS_BLOCKED), ROUNDSTART_TRAIT)
add_traits(list(TRAIT_PULL_BLOCKED, TRAIT_HANDS_BLOCKED, TRAIT_SILICON_EMOTES_ALLOWED), ROUNDSTART_TRAIT)

alert_control = new(src, list(ALARM_ATMOS, ALARM_FIRE, ALARM_POWER, ALARM_CAMERA, ALARM_BURGLAR, ALARM_MOTION), list(z), camera_view = TRUE)
RegisterSignal(alert_control.listener, COMSIG_ALARM_LISTENER_TRIGGERED, PROC_REF(alarm_triggered))
Expand Down
10 changes: 10 additions & 0 deletions code/modules/mob/living/silicon/robot/emote.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,22 @@
// enable silicon emotes for users with synthetic voice boxes.
//mob_type_allowed_typecache = list(/mob/living/silicon, /mob/living/simple_animal/bot)
emote_type = EMOTE_AUDIBLE
trait_required = TRAIT_SILICON_EMOTES_ALLOWED

/datum/emote/silicon/boop
key = "boop"
key_third_person = "boops"
message = "boops."

/datum/emote/silicon/beep
key = "beep"
key_third_person = "beeps"
message = "beeps."
message_param = "beeps at %t."
sound = 'sound/machines/twobeep.ogg'
emote_type = EMOTE_AUDIBLE


/datum/emote/silicon/buzz
key = "buzz"
key_third_person = "buzzes"
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/silicon/robot/robot.dm
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
post_tipped_callback = CALLBACK(src, PROC_REF(after_tip_over)), \
post_untipped_callback = CALLBACK(src, PROC_REF(after_righted)), \
roleplay_friendly = TRUE, \
roleplay_emotes = list(/datum/emote/silicon/buzz, /datum/emote/silicon/buzz2, /datum/emote/living/beep), \
roleplay_emotes = list(/datum/emote/silicon/buzz, /datum/emote/silicon/buzz2, /datum/emote/silicon/beep), \
roleplay_callback = CALLBACK(src, PROC_REF(untip_roleplay)))

set_wires(new /datum/wires/robot(src))
Expand Down
1 change: 1 addition & 0 deletions code/modules/mob/living/silicon/silicon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
)

add_traits(traits_to_apply, ROUNDSTART_TRAIT)
ADD_TRAIT(src, TRAIT_SILICON_EMOTES_ALLOWED, INNATE_TRAIT)

/mob/living/silicon/Destroy()
QDEL_NULL(radio)
Expand Down
1 change: 1 addition & 0 deletions code/modules/surgery/organs/internal/tongue/_tongue.dm
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,7 @@ GLOBAL_LIST_INIT(english_to_zombie, list())
attack_verb_simple = list("beep", "boop")
modifies_speech = TRUE
taste_sensitivity = 25 // not as good as an organic tongue
organ_traits = list(TRAIT_SILICON_EMOTES_ALLOWED)

/obj/item/organ/internal/tongue/robot/get_scream_sound()
return 'monkestation/sound/voice/screams/silicon/scream_silicon.ogg'
Expand Down
15 changes: 0 additions & 15 deletions monkestation/code/modules/emotes/code/emote.dm
Original file line number Diff line number Diff line change
Expand Up @@ -305,21 +305,6 @@
/datum/emote/living/tailthump/can_run_emote(mob/user, status_check, intentional)
return ..() && islizard(user)

// The below function replaces the `/datum/emote/silicon/mob_type_allowed_typecache` variable. If
// you remove this function, be sure to replace the above variable.
/datum/emote/silicon/can_run_emote(mob/user, status_check, intentional)
// Silicons and simple bots can always use silicon emotes, assuming nothing else is wrong
if(issilicon(user) || isbot(user))
return ..()

// Allow users with synthetic voice boxes to use silicon emotes as well, because a synthetic
// voice box is more akin to a speaker than a human larynx.
var/tongue = user.get_organ_slot(ORGAN_SLOT_TONGUE)
if(istype(tongue, /obj/item/organ/internal/tongue/synth))
return ..()

return FALSE

/datum/emote/squint
key = "squint"
key_third_person = "squints"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
attack_verb_simple = list("beep", "boop")
modifies_speech = TRUE
taste_sensitivity = 25 // not as good as an organic tongue
organ_traits = list(TRAIT_SILICON_EMOTES_ALLOWED)
maxHealth = 100 //RoboTongue!
zone = BODY_ZONE_HEAD
slot = ORGAN_SLOT_TONGUE
Expand Down
Loading