From c76182a977208468ef8457668371cc09dfdcd8bd Mon Sep 17 00:00:00 2001
From: Useroth <37159550+Useroth@users.noreply.github.com>
Date: Fri, 24 Mar 2023 16:27:18 +0100
Subject: [PATCH] [TESTMERGE CANDIDATE] [SEMI-MODULAR] AI and hologram QoL
stuff + misc bugfixes (#19248)
* Standarized silicon examine stuff.
* There we actually go
* Fuck, finally.
* Let's do something to amend the double-messages
* fixing a dumb copypaste
* How dumb of me
* Amendments
* oh well, this should take care of some runtimes
* this too
* Okay now it should compile
* Oh well, might as well do this too
* Dear got, subtler is full of spaghetti. Even before I touched it. It legitimately deserves a fucking rewrite.
* one way to resolve a conflict
* ordered tgstation.dme correctly now
* fiiiixed
---
code/datums/emotes.dm | 18 +++++---
code/game/machinery/hologram.dm | 37 ++--------------
code/modules/mob/living/silicon/ai/examine.dm | 3 ++
.../mob/living/silicon/robot/examine.dm | 19 +-------
.../modules/mob/living/silicon/robot/robot.dm | 6 ---
code/modules/mob/mob.dm | 23 ++++++++++
code/modules/pai/pai.dm | 3 ++
.../code/game/machinery/hologram.dm | 14 ++++++
.../modules/altborgs/code/robot_defines.dm | 4 +-
.../modules/mob/living/silicon/examine.dm | 24 +++++++++++
.../modules/mob/living/silicon/topic.dm | 5 +++
modular_skyrat/modules/verbs/code/subtle.dm | 43 ++++++++++++++++---
tgstation.dme | 3 ++
13 files changed, 132 insertions(+), 70 deletions(-)
create mode 100644 modular_skyrat/master_files/code/game/machinery/hologram.dm
create mode 100644 modular_skyrat/modules/customization/modules/mob/living/silicon/examine.dm
create mode 100644 modular_skyrat/modules/customization/modules/mob/living/silicon/topic.dm
diff --git a/code/datums/emotes.dm b/code/datums/emotes.dm
index 3f39bb8dc9f..c136648f7f2 100644
--- a/code/datums/emotes.dm
+++ b/code/datums/emotes.dm
@@ -122,12 +122,6 @@
continue
if(ghost.client.prefs.chat_toggles & CHAT_GHOSTSIGHT && !(ghost in viewers(user_turf, null)))
ghost.show_message("[FOLLOW_LINK(ghost, user)] [dchatmsg]")
- //SKYRAT EDIT ADDITION BEGIN - AI QoL
- for(var/mob/living/silicon/ai/ai as anything in GLOB.ai_list)
- var/ai_eye_turf = get_turf(ai.eyeobj)
- if(ai.client && !(ai.stat == DEAD) && (get_dist(user_turf, ai_eye_turf)<8))
- ai.show_message("[dchatmsg]")
- //SKYRAT EDIT ADDITION END - AI QoL
if(emote_type & (EMOTE_AUDIBLE | EMOTE_VISIBLE)) //emote is audible and visible
user.audible_message(msg, deaf_message = "You see how [user] [msg]", audible_message_flags = EMOTE_MESSAGE)
else if(emote_type & EMOTE_VISIBLE) //emote is only visible
@@ -137,6 +131,18 @@
if(viewer.is_blind() && !viewer.can_hear())
to_chat(viewer, msg)
+ // SKYRAT EDIT -- BEGIN -- ADDITION -- AI QOL - RELAY EMOTES OVER HOLOPADS
+ var/obj/effect/overlay/holo_pad_hologram/hologram = GLOB.hologram_impersonators[user]
+ if(hologram)
+ if(emote_type & (EMOTE_AUDIBLE | EMOTE_VISIBLE))
+ hologram.audible_message(msg, deaf_message = span_emote("You see how [user] [msg]"), audible_message_flags = EMOTE_MESSAGE)
+ else if(emote_type & EMOTE_VISIBLE)
+ hologram.visible_message(msg, visible_message_flags = EMOTE_MESSAGE)
+ if(emote_type & EMOTE_IMPORTANT)
+ for(var/mob/living/viewer in viewers(world.view, hologram))
+ if(viewer.is_blind() && !viewer.can_hear())
+ to_chat(viewer, msg)
+ // SKYRAT EDIT -- END
SEND_SIGNAL(user, COMSIG_MOB_EMOTED(key))
/**
diff --git a/code/game/machinery/hologram.dm b/code/game/machinery/hologram.dm
index 5ffe7421fe0..9629f5e33f6 100644
--- a/code/game/machinery/hologram.dm
+++ b/code/game/machinery/hologram.dm
@@ -220,29 +220,6 @@ Possible to do for anyone motivated enough:
else if(in_range(user, src) || isobserver(user))
. += span_notice("The status display reads: Current projection range: [holo_range] units.")
- //SKYRAT EDIT ADDITION BEGIN - AI QoL
- var/obj/effect/overlay/holo_pad_hologram/holo
- var/line
- var/mob/living/silicon/ai/aiPlayer
- for(var/mob/living/silicon/ai/master in masters)
- if(masters[master])
- holo = masters[master]
- if(LAZYLEN(masters))
- for(var/I in masters)
- var/mob/living/master = I
- var/mob/living/silicon/ai/AI = master
- if(!istype(AI))
- AI = null
- else
- aiPlayer = AI
- if(LAZYLEN(masters))
- if(holo.Impersonation)
- . += holo.Impersonation.examine(user)
- else
- . += "*---------*\nThis is [aiPlayer.name].\n*---------*"
- . += line
- //SKYRAT EDIT ADDITION END - AI QoL
-
/obj/machinery/holopad/wrench_act(mob/living/user, obj/item/tool)
. = ..()
default_unfasten_wrench(user, tool)
@@ -553,6 +530,7 @@ Possible to do for anyone motivated enough:
var/obj/effect/overlay/holo_pad_hologram/Hologram = new(loc)//Spawn a blank effect at the location.
if(AI)
Hologram.icon = AI.holo_icon
+ Hologram.Impersonation = AI //SKYRAT EDIT -- ADDITION -- Customization; puts the AI core as the impersonated mob so that the examine proc can be redirected
AI.eyeobj.setLoc(get_turf(src)) //ensure the AI camera moves to the holopad
else //make it like real life
Hologram.icon = user.icon
@@ -563,11 +541,12 @@ Possible to do for anyone motivated enough:
Hologram.add_atom_colour("#77abff", FIXED_COLOUR_PRIORITY)
Hologram.Impersonation = user
- Hologram.mouse_opacity = MOUSE_OPACITY_TRANSPARENT//So you can't click on it.
+ //Hologram.mouse_opacity = MOUSE_OPACITY_TRANSPARENT//So you can't click on it. //SKYRAT EDIT -- Customization; Making holograms clickable/examinable
Hologram.layer = FLY_LAYER //Above all the other objects/mobs. Or the vast majority of them.
SET_PLANE_EXPLICIT(Hologram, ABOVE_GAME_PLANE, src)
Hologram.set_anchored(TRUE)//So space wind cannot drag it.
- Hologram.name = "[user.name] (Hologram)"//If someone decides to right click.
+ // Hologram.name = "[user.name] (Hologram)"//If someone decides to right click. //SKYRAT EDIT -- ORIGINAL
+ Hologram.name = user.name //SKYRAT EDIT -- Make the name exact, so that the double-emotes are less jarring in the chat
Hologram.set_light(2) //hologram lighting
move_hologram()
@@ -630,15 +609,8 @@ For the other part of the code, check silicon say.dm. Particularly robot talk.*/
AI.current = src
SetLightsAndPower()
update_holoray(user, get_turf(loc))
- RegisterSignal(user, COMSIG_MOB_EMOTE, PROC_REF(handle_hologram_emote)) // SKYRAT ADDITION - HOLOGRAM EMOTE MIRROR
return TRUE
-// SKYRAT ADDITION - HOLOGRAM EMOTE MIRROR
-/obj/machinery/holopad/proc/handle_hologram_emote(atom/movable/source, datum/emote/emote, action, type_override, message, intentional)
- SIGNAL_HANDLER
- for(var/mob/mob_viewer in viewers(world.view, src))
- to_chat(mob_viewer, "[source] [message]")
-// SKYRAT ADDITION - END
/obj/machinery/holopad/proc/clear_holo(mob/living/user)
qdel(masters[user]) // Get rid of user's hologram
@@ -670,7 +642,6 @@ For the other part of the code, check silicon say.dm. Particularly robot talk.*/
qdel(holorays[user])
LAZYREMOVE(holorays, user)
SetLightsAndPower()
- UnregisterSignal(user, COMSIG_MOB_EMOTE) // SKYRAT ADDITION - HOLOGRAM EMOTE MIRROR
return TRUE
//Try to transfer hologram to another pad that can project on T
diff --git a/code/modules/mob/living/silicon/ai/examine.dm b/code/modules/mob/living/silicon/ai/examine.dm
index bd015e551eb..e4a98f5f366 100644
--- a/code/modules/mob/living/silicon/ai/examine.dm
+++ b/code/modules/mob/living/silicon/ai/examine.dm
@@ -26,6 +26,9 @@
. += "The wireless networking light is blinking."
else if (!shunted && !client)
. += "[src]Core.exe has stopped responding! NTOS is searching for a solution to the problem..."
+ //SKYRAT EDIT ADDITION BEGIN - CUSTOMIZATION
+ . += get_silicon_flavortext()
+ //SKYRAT EDIT ADDITION END
. += ""
. += ..()
diff --git a/code/modules/mob/living/silicon/robot/examine.dm b/code/modules/mob/living/silicon/robot/examine.dm
index f5f89b01840..68ee438dc12 100644
--- a/code/modules/mob/living/silicon/robot/examine.dm
+++ b/code/modules/mob/living/silicon/robot/examine.dm
@@ -47,24 +47,7 @@
if(DEAD)
. += span_deadsay("It looks like its system is corrupted and requires a reset.")
//SKYRAT EDIT ADDITION BEGIN - CUSTOMIZATION
- var/flavor_text_link
- /// The first 1-FLAVOR_PREVIEW_LIMIT characters in the mob's client's silicon_flavor_text preference datum. FLAVOR_PREVIEW_LIMIT is defined in flavor_defines.dm.
- var/silicon_preview_text = copytext_char((client?.prefs.read_preference(/datum/preference/text/silicon_flavor_text)), 1, FLAVOR_PREVIEW_LIMIT)
-
- flavor_text_link = span_notice("[silicon_preview_text]... Look closer?")
-
- if (flavor_text_link)
- . += flavor_text_link
-
- if(client)
- var/erp_status_pref = client.prefs.read_preference(/datum/preference/choiced/erp_status)
- if(erp_status_pref && erp_status_pref != "disabled")
- . += span_notice("ERP STATUS: [erp_status_pref]")
- if(temporary_flavor_text)
- if(length_char(temporary_flavor_text) <= 40)
- . += span_notice("They look different than usual: [temporary_flavor_text]")
- else
- . += span_notice("They look different than usual: [copytext_char(temporary_flavor_text, 1, 37)]... More...")
+ . += get_silicon_flavortext()
//SKYRAT EDIT ADDITION END
. += ""
diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm
index 2c7b62f23d2..b8ddcd81e3f 100644
--- a/code/modules/mob/living/silicon/robot/robot.dm
+++ b/code/modules/mob/living/silicon/robot/robot.dm
@@ -163,12 +163,6 @@
//Show alerts window if user clicked on "Show alerts" in chat
if(href_list["showalerts"])
alert_control.ui_interact(src)
- // SKYRAT EDIT ADDITION -- Customization
- if(href_list["lookup_info"])
- tgui.holder = src
- tgui.ui_interact(usr) //datum has a tgui component, here we open the window
- // SKYRAT EDIT END
-
/mob/living/silicon/robot/get_cell()
return cell
diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm
index abb16ebac32..2a91c1a9f44 100644
--- a/code/modules/mob/mob.dm
+++ b/code/modules/mob/mob.dm
@@ -260,6 +260,17 @@
var/list/hearers = get_hearers_in_view(vision_distance, src) //caches the hearers and then removes ignored mobs.
hearers -= ignored_mobs
+ //SKYRAT EDIT ADDITION BEGIN - AI QoL
+ for(var/mob/camera/ai_eye/ai_eye in hearers)
+ if(ai_eye.ai?.client && !(ai_eye.ai.stat == DEAD))
+ hearers -= ai_eye
+ hearers |= ai_eye.ai
+
+ for(var/obj/effect/overlay/holo_pad_hologram/holo in hearers)
+ if(holo.Impersonation?.client)
+ hearers |= holo.Impersonation
+ //SKYRAT EDIT ADDITION END - AI QoL
+
if(self_message)
hearers -= src
@@ -312,6 +323,18 @@
*/
/atom/proc/audible_message(message, deaf_message, hearing_distance = DEFAULT_MESSAGE_RANGE, self_message, audible_message_flags = NONE, separation = " ") // SKYRAT EDIT ADDITION - Better emotes
var/list/hearers = get_hearers_in_view(hearing_distance, src)
+
+ //SKYRAT EDIT ADDITION BEGIN - AI QoL
+ for(var/mob/camera/ai_eye/ai_eye in hearers)
+ if(ai_eye.ai?.client && !(ai_eye.ai.stat == DEAD))
+ hearers -= ai_eye
+ hearers |= ai_eye.ai
+
+ for(var/obj/effect/overlay/holo_pad_hologram/holo in hearers)
+ if(holo.Impersonation?.client)
+ hearers |= holo.Impersonation
+ //SKYRAT EDIT ADDITION END - AI QoL
+
if(self_message)
hearers -= src
var/raw_msg = message
diff --git a/code/modules/pai/pai.dm b/code/modules/pai/pai.dm
index ddf300a4122..97de72da257 100644
--- a/code/modules/pai/pai.dm
+++ b/code/modules/pai/pai.dm
@@ -170,6 +170,9 @@
/mob/living/silicon/pai/examine(mob/user)
. = ..()
. += "Its master ID string seems to be [(!master_name || emagged) ? "empty" : master_name]."
+ //SKYRAT EDIT ADDITION BEGIN - CUSTOMIZATION
+ . += get_silicon_flavortext()
+ //SKYRAT EDIT ADDITION END
/mob/living/silicon/pai/get_status_tab_items()
. += ..()
diff --git a/modular_skyrat/master_files/code/game/machinery/hologram.dm b/modular_skyrat/master_files/code/game/machinery/hologram.dm
new file mode 100644
index 00000000000..08ce03c90c6
--- /dev/null
+++ b/modular_skyrat/master_files/code/game/machinery/hologram.dm
@@ -0,0 +1,14 @@
+GLOBAL_LIST_EMPTY(hologram_impersonators)
+
+/obj/machinery/holopad/set_holo(mob/living/user, obj/effect/overlay/holo_pad_hologram/holo)
+ if(holo.Impersonation)
+ GLOB.hologram_impersonators[user] = holo
+ holo.become_hearing_sensitive() // Well, we need to show up on "get_hearers_in_view()"
+ . = ..()
+
+/obj/machinery/holopad/clear_holo(mob/living/user)
+ var/obj/effect/overlay/holo_pad_hologram/hologram = GLOB.hologram_impersonators[user]
+ if(hologram)
+ hologram.lose_hearing_sensitivity()
+ GLOB.hologram_impersonators -= user
+ . = ..()
diff --git a/modular_skyrat/modules/altborgs/code/robot_defines.dm b/modular_skyrat/modules/altborgs/code/robot_defines.dm
index 83b2fee427b..1d7abacfa61 100644
--- a/modular_skyrat/modules/altborgs/code/robot_defines.dm
+++ b/modular_skyrat/modules/altborgs/code/robot_defines.dm
@@ -1,4 +1,6 @@
+/mob/living/silicon
+ var/datum/examine_panel/examine_panel = new() //create the datum
+
/mob/living/silicon/robot
var/robot_resting = FALSE
var/robot_rest_style = ROBOT_REST_NORMAL
- var/datum/examine_panel/tgui = new() //create the datum
diff --git a/modular_skyrat/modules/customization/modules/mob/living/silicon/examine.dm b/modular_skyrat/modules/customization/modules/mob/living/silicon/examine.dm
new file mode 100644
index 00000000000..8bf25a21f9c
--- /dev/null
+++ b/modular_skyrat/modules/customization/modules/mob/living/silicon/examine.dm
@@ -0,0 +1,24 @@
+/**
+ * Returns a list of lines containing silicon flavourtext, temporary flavourtext, ERP preferences and a link to "look closer" and open the examine panel.
+ * Intended to be appended at the end of examine() result.
+ */
+/mob/living/silicon/proc/get_silicon_flavortext()
+ . = list()
+ var/flavor_text_link
+ /// The first 1-FLAVOR_PREVIEW_LIMIT characters in the mob's client's silicon_flavor_text preference datum. FLAVOR_PREVIEW_LIMIT is defined in flavor_defines.dm.
+ var/silicon_preview_text = copytext_char((client?.prefs.read_preference(/datum/preference/text/silicon_flavor_text)), 1, FLAVOR_PREVIEW_LIMIT)
+
+ flavor_text_link = span_notice("[silicon_preview_text]... Look closer?")
+
+ if (flavor_text_link)
+ . += flavor_text_link
+
+ if(client)
+ var/erp_status_pref = client.prefs.read_preference(/datum/preference/choiced/erp_status)
+ if(erp_status_pref && erp_status_pref != "disabled")
+ . += span_notice("ERP STATUS: [erp_status_pref]")
+ if(temporary_flavor_text)
+ if(length_char(temporary_flavor_text) <= 40)
+ . += span_notice("They look different than usual: [temporary_flavor_text]")
+ else
+ . += span_notice("They look different than usual: [copytext_char(temporary_flavor_text, 1, 37)]... More...")
diff --git a/modular_skyrat/modules/customization/modules/mob/living/silicon/topic.dm b/modular_skyrat/modules/customization/modules/mob/living/silicon/topic.dm
new file mode 100644
index 00000000000..3a5310e8c3b
--- /dev/null
+++ b/modular_skyrat/modules/customization/modules/mob/living/silicon/topic.dm
@@ -0,0 +1,5 @@
+/mob/living/silicon/Topic(href, href_list)
+ . = ..()
+ if(href_list["lookup_info"] == "open_examine_panel")
+ examine_panel.holder = src
+ examine_panel.ui_interact(usr) //datum has a tgui component, here we open the window
diff --git a/modular_skyrat/modules/verbs/code/subtle.dm b/modular_skyrat/modules/verbs/code/subtle.dm
index 50d35073ce8..a39e678a809 100644
--- a/modular_skyrat/modules/verbs/code/subtle.dm
+++ b/modular_skyrat/modules/verbs/code/subtle.dm
@@ -16,7 +16,7 @@
return FALSE
var/subtle_message
var/subtle_emote = params
- if(is_banned_from(user, "emote"))
+ if(SSdbcore.IsConnected() && is_banned_from(user, "emote"))
to_chat(user, "You cannot send subtle emotes (banned).")
return FALSE
else if(user.client?.prefs.muted & MUTE_IC)
@@ -45,6 +45,14 @@
var/list/viewers = get_hearers_in_view(SUBTLE_DEFAULT_DISTANCE, user)
+ var/obj/effect/overlay/holo_pad_hologram/hologram = GLOB.hologram_impersonators[user]
+ if(hologram)
+ viewers |= get_hearers_in_view(SUBTLE_DEFAULT_DISTANCE, hologram)
+
+ for(var/obj/effect/overlay/holo_pad_hologram/hologram in viewers)
+ if(hologram?.Impersonation?.client)
+ viewers |= hologram.Impersonation
+
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(subtle_message)
@@ -70,8 +78,8 @@
return FALSE
var/subtler_message
var/subtler_emote = params
- var/mob/target
- if(is_banned_from(user, "emote"))
+ var/target
+ if(SSdbcore.IsConnected() && is_banned_from(user, "emote"))
to_chat(user, span_warning("You cannot send subtle emotes (banned)."))
return FALSE
else if(user.client?.prefs.muted & MUTE_IC)
@@ -83,9 +91,17 @@
return FALSE
var/list/in_view = get_hearers_in_view(1, user)
+
+ var/obj/effect/overlay/holo_pad_hologram/hologram = GLOB.hologram_impersonators[user]
+ if(hologram)
+ in_view |= get_hearers_in_view(1, hologram)
+
in_view -= GLOB.dead_mob_list
in_view.Remove(user)
+ for(var/mob/camera/ai_eye/ai_eye in in_view)
+ in_view.Remove(ai_eye)
+
var/list/targets = list(SUBTLE_ONE_TILE_TEXT, SUBTLE_SAME_TILE_TEXT) + in_view
target = tgui_input_list(user, "Pick a target", "Target Selection", targets)
if(!target)
@@ -113,14 +129,29 @@
subtler_message = span_emote("[user][space][user.say_emphasis(subtler_message)]")
- if(istype(target))
+ if(istype(target, /mob))
+ var/mob/target_mob = target
user.show_message(subtler_message, alt_msg = subtler_message)
- if(get_dist(user.loc, target.loc) <= SUBTLE_DEFAULT_DISTANCE)
- target.show_message(subtler_message, alt_msg = subtler_message)
+ var/obj/effect/overlay/holo_pad_hologram/hologram = GLOB.hologram_impersonators[user]
+ if((get_dist(user.loc, target_mob.loc) <= SUBTLE_DEFAULT_DISTANCE) || (hologram && get_dist(hologram.loc, target_mob.loc) <= SUBTLE_DEFAULT_DISTANCE))
+ target_mob.show_message(subtler_message, alt_msg = subtler_message)
else
to_chat(user, span_warning("Your emote was unable to be sent to your target: Too far away."))
+ else if(istype(target, /obj/effect/overlay/holo_pad_hologram))
+ var/obj/effect/overlay/holo_pad_hologram/hologram = target
+ if(hologram.Impersonation?.client)
+ hologram.Impersonation.show_message(subtler_message, alt_msg = subtler_message)
else
var/ghostless = get_hearers_in_view(target, user) - GLOB.dead_mob_list
+
+ var/obj/effect/overlay/holo_pad_hologram/hologram = GLOB.hologram_impersonators[user]
+ if(hologram)
+ ghostless |= get_hearers_in_view(target, hologram)
+
+ for(var/obj/effect/overlay/holo_pad_hologram/holo in ghostless)
+ if(holo?.Impersonation?.client)
+ ghostless |= holo.Impersonation
+
for(var/mob/reciever in ghostless)
reciever.show_message(subtler_message, alt_msg = subtler_message)
diff --git a/tgstation.dme b/tgstation.dme
index aa57d2ca343..d603ce3f6ef 100644
--- a/tgstation.dme
+++ b/tgstation.dme
@@ -5234,6 +5234,7 @@
#include "modular_skyrat\master_files\code\game\effects\spawners\random\structure.dm"
#include "modular_skyrat\master_files\code\game\gamemodes\dynamic.dm"
#include "modular_skyrat\master_files\code\game\gamemodes\objective.dm"
+#include "modular_skyrat\master_files\code\game\machinery\hologram.dm"
#include "modular_skyrat\master_files\code\game\machinery\suit_storage.dm"
#include "modular_skyrat\master_files\code\game\machinery\doors\firedoor.dm"
#include "modular_skyrat\master_files\code\game\objects\items.dm"
@@ -5944,6 +5945,8 @@
#include "modular_skyrat\modules\customization\modules\mob\living\carbon\human\species\vox.dm"
#include "modular_skyrat\modules\customization\modules\mob\living\carbon\human\species\vulpkanin.dm"
#include "modular_skyrat\modules\customization\modules\mob\living\carbon\human\species\xeno.dm"
+#include "modular_skyrat\modules\customization\modules\mob\living\silicon\examine.dm"
+#include "modular_skyrat\modules\customization\modules\mob\living\silicon\topic.dm"
#include "modular_skyrat\modules\customization\modules\mob\living\simple_mob\examine.dm"
#include "modular_skyrat\modules\customization\modules\reagents\chemistry\reagents.dm"
#include "modular_skyrat\modules\customization\modules\reagents\chemistry\reagents\alcohol_reagents.dm"