From 4460bc20118d1c4a79d11b19a9385b5369576b6d Mon Sep 17 00:00:00 2001 From: Erthilo Date: Wed, 27 Jun 2012 18:09:32 +0100 Subject: [PATCH] Simple animals can now use the Me verb. --- code/modules/mob/simple_animal/life.dm | 55 +++++++++++++++++++++++--- 1 file changed, 50 insertions(+), 5 deletions(-) diff --git a/code/modules/mob/simple_animal/life.dm b/code/modules/mob/simple_animal/life.dm index f10a1a473b6..8a72ac825c7 100644 --- a/code/modules/mob/simple_animal/life.dm +++ b/code/modules/mob/simple_animal/life.dm @@ -238,11 +238,56 @@ return "[emote], \"[text]\"" return "says, \"[text]\""; -/mob/living/simple_animal/emote(var/act) - if(act) - if(act == "scream") act = "makes a loud and pained whimper" //ugly hack to stop animals screaming when crushed :P - for (var/mob/O in viewers(src, null)) - O.show_message("[src] [act].") +/mob/living/simple_animal/emote(var/act,var/m_type=1,var/message = null) + switch(act) + + if ("scream") + message = "[src] screams!" + m_type = 2 + + if ("custom") + var/input = copytext(sanitize(input("Choose an emote to display.") as text|null),1,MAX_MESSAGE_LEN) + if (!input) + return + var/input2 = input("Is this a visible or hearable emote?") in list("Visible","Hearable") + if (input2 == "Visible") + m_type = 1 + else if (input2 == "Hearable") + m_type = 2 + else + alert("Unable to use this emote, must be either hearable or visible.") + return + message = "[src] [input]" + + if ("me") + if(silent) + return + if (src.client && (client.muted || client.muted_complete)) + src << "You are muted." + return + if (stat) + return + if(!(message)) + return + else + if(cmptext(copytext(message, 1, 3), "v ")) + message = "[src] [copytext(message, 3)]" + m_type = 1 + else if(cmptext(copytext(message, 1, 3), "h ")) + message = "[src] [copytext(message, 3)]" + m_type = 2 + else + message = "[src] [message]" + else + src << text("Invalid Emote: []", act) + if ((message && src.stat == 0)) + if (m_type & 1) + for(var/mob/O in viewers(src, null)) + O.show_message(message, m_type) + else + for(var/mob/O in hearers(src, null)) + O.show_message(message, m_type) + return /mob/living/simple_animal/attack_animal(mob/living/simple_animal/M as mob)