diff --git a/code/modules/mob/living/simple_animal/parrot.dm b/code/modules/mob/living/simple_animal/parrot.dm index d46398dbe2e..ed149eacddb 100644 --- a/code/modules/mob/living/simple_animal/parrot.dm +++ b/code/modules/mob/living/simple_animal/parrot.dm @@ -159,6 +159,7 @@ . += "Held Item: [held_item]" . += "Combat mode: [combat_mode ? "On" : "Off"]" +/* SKYRAT EDIT - MOVED TO modular_skyrat/modules/poly_commands /mob/living/simple_animal/parrot/Hear(message, atom/movable/speaker, message_langs, raw_message, radio_freq, list/spans, list/message_mods = list()) . = ..() if(speaker != src && prob(50)) //Dont imitate ourselves @@ -168,6 +169,7 @@ speech_buffer |= html_decode(raw_message) if(speaker == src && !client) //If a parrot squawks in the woods and no one is around to hear it, does it make a sound? This code says yes! return message +*/ /mob/living/simple_animal/parrot/radio(message, list/message_mods = list(), list/spans, language) //literally copied from human/radio(), but there's no other way to do this. at least it's better than it used to be. . = ..() @@ -845,8 +847,7 @@ GLOBAL_LIST_INIT(strippable_parrot_items, create_strippable_list(list( pixel_x = initial(pixel_x) pixel_y = initial(pixel_y) - - +/* SKYRAT EDIT - MOVED TO modular_skyrat/modules/poly_commands/parrot.dm /mob/living/simple_animal/parrot/proc/perch_on_human(mob/living/carbon/human/H) if(!H) return @@ -857,7 +858,7 @@ GLOBAL_LIST_INIT(strippable_parrot_items, create_strippable_list(list( icon_state = icon_sit parrot_state = PARROT_PERCH to_chat(src, span_notice("You sit on [H]'s shoulder.")) - +*/ /mob/living/simple_animal/parrot/proc/toggle_mode() set name = "Toggle mode" diff --git a/modular_skyrat/modules/poly_commands/parrot.dm b/modular_skyrat/modules/poly_commands/parrot.dm new file mode 100644 index 00000000000..39a0f7f76d6 --- /dev/null +++ b/modular_skyrat/modules/poly_commands/parrot.dm @@ -0,0 +1,83 @@ +/* +* Parrot commands: Made modular +*/ + +/mob/living/simple_animal/parrot + /// Whether the parrot is on a human's shoulder or not + var/buckled_to_human = FALSE + +/mob/living/simple_animal/parrot/Hear(message, atom/movable/speaker, message_langs, raw_message, radio_freq, list/spans, list/message_mods = list()) + . = ..() + if(check_command(message, speaker)) + return + if(speaker != src && prob(50)) //Dont imitate ourselves + if(!radio_freq || prob(10)) + if(speech_buffer.len >= 500) + speech_buffer -= pick(speech_buffer) + speech_buffer |= html_decode(raw_message) + if(speaker == src && !client) //If a parrot squawks in the woods and no one is around to hear it, does it make a sound? This code says yes! + return message + +/mob/living/simple_animal/parrot/proc/perch_on_human(mob/living/carbon/human/human_target) + if(!human_target) + return + forceMove(get_turf(human_target)) + if(human_target.buckle_mob(src, TRUE)) + pixel_y = 9 + pixel_x = pick(-8,8) //pick left or right shoulder + icon_state = icon_sit + parrot_state = PARROT_PERCH + buckled_to_human = TRUE + to_chat(src, span_notice("You sit on [human_target]'s shoulder.")) + +/* +* Parrot commands: new code +*/ + +/mob/living/simple_animal/parrot/proc/check_command() + return FALSE // Simply return false for non-Poly parrots + +/mob/living/simple_animal/parrot/poly/check_command(message, speaker) + var/mob/living/carbon/human/human_target = speaker + if(!istype(human_target)) + return FALSE + if(!(human_target.mind?.assigned_role.title == "Chief Engineer")) + return FALSE + if(!(findtext(message, "poly"))) + return FALSE + if(findtext(message, "perch") || findtext(message, "up")) + command_perch(speaker) + return TRUE + else if(findtext(message, "off") || findtext(message, "down")) + command_hop_off(speaker) + return TRUE + else + return FALSE + +/mob/living/simple_animal/parrot/poly/proc/command_perch(mob/living/carbon/human/human_target) + if(human_target.buckled_mobs?.len >= human_target.max_buckled_mobs) + return + if(buckled_to_human) + emote("me", EMOTE_VISIBLE, "gives [human_target] a confused look, squawking softly.") + return + if(get_dist(src, human_target) > 1 || buckled) // Only adjacent + emote("me", EMOTE_VISIBLE, "tilts their head at [human_target], before bawking loudly and staying put.") + return + emote("me", EMOTE_VISIBLE, "obediently hops up onto [human_target]'s shoulder, spreading their wings for a moment before settling down.") + perch_on_human(human_target) + +/mob/living/simple_animal/parrot/poly/proc/command_hop_off(mob/living/carbon/human/human_target) + if(!buckled_to_human || !buckled) + emote("me", EMOTE_VISIBLE, "gives [human_target] a confused look, squawking softly.") + return + + icon_state = icon_living + parrot_state = PARROT_WANDER + if(buckled) + to_chat(src, span_notice("You are no longer sitting on [buckled].")) + buckled.unbuckle_mob(src, TRUE) + emote("me", EMOTE_VISIBLE, "squawks and hops off of [buckled], flying away.") + buckled = null + buckled_to_human = FALSE + pixel_x = initial(pixel_x) + pixel_y = initial(pixel_y) diff --git a/tgstation.dme b/tgstation.dme index 0e63d2caf9b..6a1f800ff59 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -4977,6 +4977,7 @@ #include "modular_skyrat\modules\pollution\code\scented_candles.dm" #include "modular_skyrat\modules\pollution\code\temporary_pollution_emission_component.dm" #include "modular_skyrat\modules\pollution\code\turf_open.dm" +#include "modular_skyrat\modules\poly_commands\parrot.dm" #include "modular_skyrat\modules\positronic_alert_console\code\positronic_alert_console.dm" #include "modular_skyrat\modules\powerarmor\code\powerarmor.dm" #include "modular_skyrat\modules\primitive_fun\code\ceramics.dm"