Skip to content

Commit

Permalink
Buildmode say (ParadiseSS13#27826)
Browse files Browse the repository at this point in the history
* Implement atom_emote

* Buildmode say icon

* Buildmode say

* Better logging.

* Apply suggestions from code review

Co-authored-by: Luc <[email protected]>
Signed-off-by: Charlie Nolan <[email protected]>

---------

Signed-off-by: Charlie Nolan <[email protected]>
Co-authored-by: Luc <[email protected]>
  • Loading branch information
FunnyMan3595 and lewcc authored Jan 8, 2025
1 parent 77c5280 commit b665536
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 1 deletion.
2 changes: 1 addition & 1 deletion code/datums/emote.dm
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@
* * user - The user of the emote.
* * text - The text of the emote.
*/
/datum/emote/proc/runechat_emote(mob/user, text)
/proc/runechat_emote(atom/user, text)
var/runechat_text = text
if(length(text) > 100)
runechat_text = "[copytext(text, 1, 101)]..."
Expand Down
7 changes: 7 additions & 0 deletions code/game/atoms.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1175,6 +1175,13 @@ GLOBAL_LIST_EMPTY(blood_splatter_icons)
I.appearance_flags = APPEARANCE_UI_IGNORE_ALPHA
INVOKE_ASYNC(GLOBAL_PROC, GLOBAL_PROC_REF(flick_overlay), I, speech_bubble_hearers, 30)

/atom/proc/atom_emote(emote)
if(!emote)
return
visible_message("<span class='game emote'><span class='name'>[src]</span> [emote]</span>", "<span class='game emote'>You hear how something [emote]</span>")

runechat_emote(src, emote)

/atom/proc/speech_bubble(bubble_state = "", bubble_loc = src, list/bubble_recipients = list())
return

Expand Down
36 changes: 36 additions & 0 deletions code/modules/buildmode/submodes/say.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/datum/buildmode_mode/say
key = "say"

/datum/buildmode_mode/say/show_help(mob/user)
to_chat(user, "<span class='notice'>***********************************************************</span>")
to_chat(user, "<span class='notice'>Left Mouse Button = Say</span>")
to_chat(user, "<span class='notice'>Right Mouse Button = Emote</span>")
to_chat(user, "<span class='notice'>***********************************************************</span>")

/datum/buildmode_mode/say/handle_click(mob/user, params, atom/object)
if(ismob(object))
var/mob/target = object
if(!isnull(target.ckey))
alert("This cannot be used on mobs with a ckey. Use Forcesay in player panel instead.")
return

var/list/pa = params2list(params)
var/left_click = pa.Find("left")
var/right_click = pa.Find("right")

if(left_click)
var/say = tgui_input_text(user, "What should [object] say?", "Say what?")
if(isnull(say))
return
log_admin("Build Mode: [key_name(user)] made [object] at ([object.x],[object.y],[object.z] say [say].")
message_admins("<span class='notice'>Build Mode: [key_name(user)] made [object] at ([object.x],[object.y],[object.z] say [say].</span>")
user.create_log(MISC_LOG, "Made [object] at ([object.x],[object.y],[object.z] say [say].")
object.atom_say(say)
else if(right_click)
var/emote = tgui_input_text(user, "What should [object] do?", "Emote what?")
if(isnull(emote))
return
log_admin("Build Mode: [key_name(user)] made [object] at ([object.x],[object.y],[object.z] emote *[emote].")
message_admins("<span class='notice'>Build Mode: [key_name(user)] made [object] at ([object.x],[object.y],[object.z] emote *[emote].</span>")
user.create_log(MISC_LOG, "Made [object] at ([object.x],[object.y],[object.z] emote *[emote].")
object.atom_emote(emote)
Binary file modified icons/misc/buildmode.dmi
Binary file not shown.
1 change: 1 addition & 0 deletions paradise.dme
Original file line number Diff line number Diff line change
Expand Up @@ -1718,6 +1718,7 @@
#include "code\modules\buildmode\submodes\mapgen.dm"
#include "code\modules\buildmode\submodes\offer.dm"
#include "code\modules\buildmode\submodes\save.dm"
#include "code\modules\buildmode\submodes\say.dm"
#include "code\modules\buildmode\submodes\throwing.dm"
#include "code\modules\buildmode\submodes\tilt.dm"
#include "code\modules\buildmode\submodes\variable_edit.dm"
Expand Down

0 comments on commit b665536

Please sign in to comment.