-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Peddling Purple Prose: Porting the 'Do' action from F13 (#725)
* Initial commit of Do roleplay action * Link in correct keybind signal * Update unit tests * I want to throw eslint down a well * Move to mob/living and change to use hearers instead of view() * Apply suggestions from code review Co-authored-by: Bloop <[email protected]> * Fix compile issues * Yabba dabba Do * Allow AI to Do from their eyeobj position (and also hear from it as well) --------- Co-authored-by: Bloop <[email protected]>
- Loading branch information
1 parent
7c2ec91
commit 3f8d6a4
Showing
11 changed files
with
110 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
#define MAX_FLAVOR_LEN 4096 //double the maximum message length. | ||
#define LOOC_CHANNEL "LOOC" // LOOC | ||
#define WHIS_CHANNEL "Whis" // Whisper | ||
#define DO_CHANNEL "Do" // Do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/mob/living/proc/doverb_checks(message) | ||
if(!length(message)) | ||
return FALSE | ||
|
||
if(GLOB.say_disabled) //This is here to try to identify lag problems | ||
to_chat(usr, span_danger("Speech is currently admin-disabled.")) | ||
return FALSE | ||
|
||
//quickly calc our name stub again: duplicate this in say.dm override | ||
var/name_stub = " (<b>[usr]</b>)" | ||
if(length(message) > (MAX_MESSAGE_LEN - length(name_stub))) | ||
to_chat(usr, message) | ||
to_chat(usr, span_warning("^^^----- The preceding message has been DISCARDED for being over the maximum length of [MAX_MESSAGE_LEN]. It has NOT been sent! -----^^^")) | ||
return FALSE | ||
|
||
if(usr.stat != CONSCIOUS) | ||
to_chat(usr, span_notice("You cannot send a Do in your current condition.")) | ||
return FALSE | ||
|
||
return TRUE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/mob/verb/do_verb(message as message) | ||
set name = "Do" | ||
set category = "IC" | ||
set instant = TRUE | ||
|
||
if(GLOB.say_disabled) | ||
to_chat(usr, span_danger("Speech is currently admin-disabled.")) | ||
return | ||
|
||
if(message) | ||
QUEUE_OR_CALL_VERB_FOR(VERB_CALLBACK(src, TYPE_VERB_REF(/mob/living, do_actual_verb), message), SSspeech_controller) | ||
|
||
/mob/living/verb/do_actual_verb(message as message) | ||
if (!message || !doverb_checks(message)) | ||
return | ||
|
||
if (!try_speak(message)) // ensure we pass the vibe check (filters, etc) | ||
return | ||
|
||
var/name_stub = " (<b>[usr]</b>)" | ||
message = usr.say_emphasis(message) | ||
message = trim(copytext_char(message, 1, (MAX_MESSAGE_LEN - length(name_stub)))) | ||
var/message_with_name = message + name_stub | ||
|
||
usr.log_message(message, LOG_EMOTE) | ||
|
||
var/list/viewers = get_hearers_in_view(DEFAULT_MESSAGE_RANGE, usr) | ||
|
||
if(istype(usr, /mob/living/silicon/ai)) | ||
var/mob/living/silicon/ai/ai = usr | ||
viewers = get_hearers_in_view(DEFAULT_MESSAGE_RANGE, ai.eyeobj) | ||
|
||
var/obj/effect/overlay/holo_pad_hologram/hologram = GLOB.hologram_impersonators[usr] | ||
if(hologram) | ||
viewers |= get_hearers_in_view(1, hologram) | ||
|
||
for(var/mob/living/silicon/ai/ai as anything in GLOB.ai_list) | ||
if(ai.client && !(ai in viewers) && (ai.eyeobj in viewers)) | ||
viewers += ai | ||
|
||
for(var/mob/ghost as anything in GLOB.dead_mob_list) | ||
if((ghost.client?.prefs.chat_toggles & CHAT_GHOSTSIGHT) && !(ghost in viewers)) | ||
ghost.show_message(span_emote(message_with_name)) | ||
|
||
for(var/mob/reciever in viewers) | ||
reciever.show_message(span_emote(message_with_name), alt_msg = span_emote(message_with_name)) | ||
if (reciever.client?.prefs.read_preference(/datum/preference/toggle/enable_runechat)) | ||
create_chat_message(usr, null, message, null, EMOTE_MESSAGE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters