From b8a886975f3aadb16134a24db48392cf5a74e07d Mon Sep 17 00:00:00 2001 From: silicons Date: Sun, 16 Jul 2023 23:18:01 -0700 Subject: [PATCH 1/3] update --- citadel.dme | 1 + code/game/atoms/action_feedback.dm | 55 +++++++++++++++++++ code/game/atoms/atom.dm | 2 + code/modules/fishing/aquarium/aquarium.dm | 12 +++- code/modules/mob/action_feedback.dm | 28 +++------- code/modules/mob/observer/dead/dead.dm | 8 +++ code/modules/mob/say_vr.dm | 8 +++ code/modules/reagents/items/hypospray.dm | 6 +- .../reagents/machinery/dispenser/dispenser.dm | 48 +++++++++++++--- 9 files changed, 136 insertions(+), 32 deletions(-) create mode 100644 code/game/atoms/action_feedback.dm diff --git a/citadel.dme b/citadel.dme index c6a3112e151..2d4468553e9 100644 --- a/citadel.dme +++ b/citadel.dme @@ -951,6 +951,7 @@ #include "code\game\area\Space Station 13 areas.dm" #include "code\game\area\ss13_deprecated_areas.dm" #include "code\game\area\Tether_areas.dm" +#include "code\game\atoms\action_feedback.dm" #include "code\game\atoms\appearance.dm" #include "code\game\atoms\atom.dm" #include "code\game\atoms\buckling.dm" diff --git a/code/game/atoms/action_feedback.dm b/code/game/atoms/action_feedback.dm new file mode 100644 index 00000000000..e3e2d4065a0 --- /dev/null +++ b/code/game/atoms/action_feedback.dm @@ -0,0 +1,55 @@ +//* Action feedback module +//* Handles giving chat feedback for actions performed by an atom, +//* whether to the atom, to the target, or to everyone around + +/** + * gives feedback for an action we're doing and makes it visible for everyone around us too. + * + * @params + * * target - target atom + * * hard_range - how far to display hard message; defaults to MESSAGE_RANGE_COMBAT_LOUD. if doesn't exist we use soft. + * * soft_range - how far to display soft message; defaults to MESSAGE_RANGE_COMBAT_LOUD. overrides hard range if smaller. + * * visible_hard - hard message. if doesn't exist we use soft message. + * * audible_hard - what blind people hear when inside hard range. if doesn't exist we use soft message. + * * visible_soft - soft message. + * * audible_soft - what blind people hear when inside soft range (overridden by self and them if specified) + * * visible_self - what we see + * * audible_self - override if self is blind. if null, defaults to 'self. + * * visible_them - what the target see + * * audible_them - what the target sees if they are blind. if null, defaults to 'them'. + */ +/atom/proc/visible_action_feedback(atom/target, hard_range = MESSAGE_RANGE_COMBAT_LOUD, soft_range, visible_hard, audible_hard, audible_soft, visible_soft, visible_self, audible_self, visible_them, audible_them) + var/list/viewing + var/viewing_range = max(soft_range, hard_range) + //! LEGACY + if(isbelly(loc)) + var/obj/belly/B = loc + viewing = B.effective_emote_hearers() + else + viewing = get_hearers_in_view(viewing_range, src) + //! end + var/hard_visible = visible_hard || visible_soft + var/hard_audible = audible_hard || audible_soft + for(var/atom/movable/AM as anything in viewing) + if(get_dist(AM, src) <= hard_range) + if(ismob(AM)) + var/mob/M = AM + if(visible_self && (M == src)) + M.show_message(visible_self, 1, audible_hard, 2) + else if((M.see_invisible >= invisibility) && M.can_see_plane(plane)) + M.show_message(hard_visible, 1, hard_audible, 2) + else if(hard_audible) + M.show_message(hard_audible, 2) + else + AM.show_message(hard_visible, 1, hard_audible, 2) + else + if(ismob(AM)) + var/mob/M = AM + if(visible_self && (M == src)) + M.show_message(visible_self, 1, audible_hard, 2) + else if((M.see_invisible >= invisibility) && M.can_see_plane(plane)) + M.show_message(visible_soft, 1, audible_soft, 2) + else if(audible_soft) + M.show_message(audible_soft, 2) + else + AM.show_message(visible_soft, 1, audible_soft, 2) diff --git a/code/game/atoms/atom.dm b/code/game/atoms/atom.dm index 35dccecf393..b0667f9caad 100644 --- a/code/game/atoms/atom.dm +++ b/code/game/atoms/atom.dm @@ -750,11 +750,13 @@ // todo: refactor /atom/proc/visible_message(message, self_message, blind_message, range = world.view) var/list/see + //! LEGACY if(isbelly(loc)) var/obj/belly/B = loc see = B.effective_emote_hearers() else see = get_hearers_in_view(range, src) + //! end for(var/atom/movable/AM as anything in see) if(ismob(AM)) var/mob/M = AM diff --git a/code/modules/fishing/aquarium/aquarium.dm b/code/modules/fishing/aquarium/aquarium.dm index 683e9976e0f..721ee414608 100644 --- a/code/modules/fishing/aquarium/aquarium.dm +++ b/code/modules/fishing/aquarium/aquarium.dm @@ -184,7 +184,11 @@ if(living_pulled.buckled || living_pulled.has_buckled_mobs()) user.action_feedback(SPAN_WARNING("[living_pulled] is attached to something!")) return - user.visible_action_feedback(SPAN_DANGER("[user] starts to put [living_pulled] into src!"), src) + user.visible_action_feedback( + target = src, + visible_loud = SPAN_WARNING("[user] starts to put [living_pulled] into [src]!"), + visible_soft = SPAN_WARNING("[user] starts to put something into [src]!") + ) if(!do_after(user, 10 SECONDS, target = src)) return if(QDELETED(living_pulled) || user.pulling != living_pulled || living_pulled.buckled || living_pulled.has_buckled_mobs()) @@ -192,7 +196,11 @@ var/datum/component/aquarium_content/content_component = living_pulled.GetComponent(/datum/component/aquarium_content) if(content_component || content_component.is_ready_to_insert(src)) return - user.visible_action_feedback(SPAN_DANGER("[user] stuffs [living_pulled] into [src]!"), src) + user.visible_action_feedback( + target = src, + visible_loud = SPAN_WARNING("[user] stuffs [living_pulled] into [src]!"), + visible_soft = SPAN_WARNING("[user] stuffs something into [src]!"), + ) living_pulled.forceMove(src) update_appearance() diff --git a/code/modules/mob/action_feedback.dm b/code/modules/mob/action_feedback.dm index 92c19d3c0d5..3a524e0b940 100644 --- a/code/modules/mob/action_feedback.dm +++ b/code/modules/mob/action_feedback.dm @@ -4,8 +4,8 @@ * use this instead of direct to_chats so mob remote control can be done better. * * @params - * - msg - what we see/know - * - target - what we're messing with + * * msg - what we see/know + * * target - what we're messing with */ /mob/proc/action_feedback(msg, atom/target) to_chat(src, msg) @@ -16,8 +16,8 @@ * use this instead of direct bubble alerts so mob remote control can be done better. * * @params - * - msg - what we see/know - * - target - what we're messing with + * * msg - what we see/know + * * target - what we're messing with */ /mob/proc/bubble_action_feedback(msg, atom/target) // for now, just wrapper for chat action feedback @@ -27,9 +27,9 @@ * gives feedback to us and someone else * * @params - * - msg - what we see - * - target - what we're messing with - * - them - what they see + * * msg - what we see + * * target - what we're messing with + * * them - what they see */ /mob/proc/detectable_action_feedback(msg, atom/target, them) ASSERT(them && target) @@ -38,20 +38,6 @@ return to_chat(target, them) -/** - * gives feedback for an action we're doing and makes it visible for everyone around us too. - * - * @params - * - msg - what everyone sees by default - * - target - what we're messing with - * - range - how far to display; defaults to loud range - * - self - what we see - * - them - what they see - * - blind - what blind people see (overridden by self and them if specified) - */ -/mob/proc/visible_action_feedback(others, atom/target, range = MESSAGE_RANGE_COMBAT_LOUD, self, them, blind) - visible_message(others, self, blind, range) - /** * gives feedback for something a mob can innately feel, body or not. */ diff --git a/code/modules/mob/observer/dead/dead.dm b/code/modules/mob/observer/dead/dead.dm index 296bd690559..9839e3a10da 100644 --- a/code/modules/mob/observer/dead/dead.dm +++ b/code/modules/mob/observer/dead/dead.dm @@ -1,3 +1,6 @@ +/// all player ghosts +GLOBAL_LIST_EMPTY(observer_list) + /mob/observer/dead name = "ghost" desc = "It's a g-g-g-g-ghooooost!" //jinkies! @@ -93,6 +96,7 @@ var/datum/orbit_menu/orbit_menu /mob/observer/dead/Initialize(mapload) + GLOB.observer_list += src var/mob/body = loc see_invisible = SEE_INVISIBLE_OBSERVER see_in_dark = world.view //I mean. I don't even know if byond has occlusion culling... but... @@ -149,6 +153,10 @@ real_name = name return ..() +/mob/observer/dead/Destroy() + GLOB.observer_list -= src + return ..() + /mob/observer/dead/Topic(href, href_list) if (href_list["track"]) var/mob/target = locate(href_list["track"]) in GLOB.mob_list diff --git a/code/modules/mob/say_vr.dm b/code/modules/mob/say_vr.dm index 8f9a8588367..242174b63e5 100644 --- a/code/modules/mob/say_vr.dm +++ b/code/modules/mob/say_vr.dm @@ -58,6 +58,10 @@ spawn(0) O.see_emote(src, message, 2) + var/list/other_viewers = get_hearers_in_view(source = src) + for(var/mob/M in other_viewers - vis_mobs) + M.show_message(SPAN_SMALL("[src] does something [pick("subtly", "discreetly", "hidden", "obscured")]."), SAYCODE_TYPE_VISIBLE) + /mob/proc/emote_vr(var/act, var/type, var/message) //This would normally go in say.dm if(act == "me") return custom_emote_vr(type, message) @@ -111,6 +115,10 @@ var/obj/O = visobj O.see_emote(src, message, 2) + var/list/other_viewers = get_hearers_in_view(source = src) + for(var/mob/M in (other_viewers - vis_mobs) | GLOB.observer_list) + M.show_message(SPAN_SMALL("[src] does something [pick("subtly", "discreetly", "hidden", "obscured")]."), SAYCODE_TYPE_VISIBLE) + /////// END #define MAX_HUGE_MESSAGE_LEN 8192 diff --git a/code/modules/reagents/items/hypospray.dm b/code/modules/reagents/items/hypospray.dm index 45becb70b8a..18a049d03b9 100644 --- a/code/modules/reagents/items/hypospray.dm +++ b/code/modules/reagents/items/hypospray.dm @@ -180,7 +180,11 @@ // todo: 'friendly name' so limbs can stay concealed of their true names while under clothing? inject_message = SPAN_WARNING("[user] starts to intrusively align [src] up against [target]'s [limb]!") if(!silent) - user.visible_action_feedback(inject_message, target, MESSAGE_RANGE_COMBAT_SUPPRESSED) + user.visible_action_feedback( + target = target, + visible_soft = inject_message, + soft_range = MESSAGE_RANGE_COMBAT_SUPPRESSED, + ) if(!do_after(user, delay, target, mobility_flags = MOBILITY_CAN_USE)) return FALSE if(!loaded?.reagents?.total_volume) diff --git a/code/modules/reagents/machinery/dispenser/dispenser.dm b/code/modules/reagents/machinery/dispenser/dispenser.dm index d5539b02f21..f7d0cb54148 100644 --- a/code/modules/reagents/machinery/dispenser/dispenser.dm +++ b/code/modules/reagents/machinery/dispenser/dispenser.dm @@ -266,7 +266,11 @@ if(!inserted) return TRUE usr.grab_item_from_interacted_with(inserted, src) - usr.visible_action_feedback(SPAN_NOTICE("[usr] ejects [inserted] from [src]."), src, range = MESSAGE_RANGE_INVENTORY_SOFT) + usr.visible_action_feedback( + target = src, + visible_soft = SPAN_NOTICE("[usr] ejects [inserted] from [src]."), + soft_range = MESSAGE_RANGE_INVENTORY_SOFT, + ) investigate_log("[key_name(usr)] ejected [ref_name_path(inserted)]", INVESTIGATE_REAGENTS) inserted = null return TRUE @@ -284,7 +288,11 @@ return TRUE remove_cartridge(cart, usr) usr.grab_item_from_interacted_with(cart, src) - usr.visible_action_feedback(SPAN_NOTICE("[usr] removes [cart] from [src]."), src, range = MESSAGE_RANGE_CONSTRUCTION) + usr.visible_action_feedback( + target = src, + visible_soft = SPAN_NOTICE("[usr] removes [cart] from [src]."), + soft_range = MESSAGE_RANGE_CONSTRUCTION, + ) update_static_data() return TRUE if("eject_cell") @@ -293,7 +301,11 @@ if(!cell) return TRUE usr.grab_item_from_interacted_with(cell, src) - usr.visible_action_feedback(SPAN_NOTICE("[usr] removes [cell] from [src]."), src, range = MESSAGE_RANGE_CONSTRUCTION) + usr.visible_action_feedback( + target = src, + visible_soft = SPAN_NOTICE("[usr] removes [cell] from [src]."), + soft_range = MESSAGE_RANGE_CONSTRUCTION, + ) component_parts -= cell cell = null return TRUE @@ -380,7 +392,11 @@ if(!insert_cartridge(I)) I.forceMove(drop_location()) return CLICKCHAIN_DO_NOT_PROPAGATE - user.visible_action_feedback(SPAN_NOTICE("[user] inserts [I] into [src]."), src, range = MESSAGE_RANGE_CONSTRUCTION) + user.visible_action_feedback( + target = src, + visible_soft = SPAN_NOTICE("[user] inserts [I] into [src]."), + soft_range = MESSAGE_RANGE_CONSTRUCTION, + ) return CLICKCHAIN_DO_NOT_PROPAGATE if(istype(I, /obj/item/reagent_synth)) var/obj/item/reagent_synth/synth = I @@ -393,7 +409,11 @@ user.action_feedback(SPAN_WARNING("[I] is stuck to your hand."), src) return CLICKCHAIN_DO_NOT_PROPAGATE LAZYADD(synthesizers, synth) - user.visible_action_feedback(SPAN_NOTICE("[user] inserts [I] into [src]."), src, range = MESSAGE_RANGE_CONSTRUCTION) + user.visible_action_feedback( + target = src, + visible_soft = SPAN_NOTICE("[user] inserts [I] into [src]."), + soft_range = MESSAGE_RANGE_CONSTRUCTION, + ) update_static_data() return CLICKCHAIN_DO_NOT_PROPAGATE if(istype(I, /obj/item/cell)) @@ -405,7 +425,11 @@ return CLICKCHAIN_DO_NOT_PROPAGATE cell = I component_parts |= cell - user.visible_action_feedback(SPAN_NOTICE("[user] inserts [I] into [src]."), src, range = MESSAGE_RANGE_CONSTRUCTION) + user.visible_action_feedback( + target = src, + visible_soft = SPAN_NOTICE("[user] inserts [I] into [src]."), + soft_range = MESSAGE_RANGE_CONSTRUCTION, + ) return CLICKCHAIN_DO_NOT_PROPAGATE if(istype(I, /obj/item/reagent_containers)) @@ -427,10 +451,18 @@ // process swap? if(inserted) investigate_log("[key_name(user)] ejected [ref_name_path(inserted)]", INVESTIGATE_REAGENTS) - user.visible_action_feedback(SPAN_NOTICE("[user] quickly swaps [src]'s [inserted] for [I]."), src, range = MESSAGE_RANGE_INVENTORY_SOFT) + user.visible_action_feedback( + target = src, + visible_soft = SPAN_NOTICE("[user] quickly swaps [src]'s [inserted] for [I]."), + soft_range = MESSAGE_RANGE_INVENTORY_SOFT, + ) user.put_in_hands_or_drop(inserted) else - user.visible_action_feedback(SPAN_NOTICE("[user] inserts [I] into [src]."), src, range = MESSAGE_RANGE_INVENTORY_SOFT) + user.visible_action_feedback( + target = src, + visible_soft = SPAN_NOTICE("[user] inserts [I] into [src]."), + soft_range = MESSAGE_RANGE_INVENTORY_SOFT, + ) investigate_log("[key_name(user)] inserted [ref_name_path(I)]", INVESTIGATE_REAGENTS) inserted = I SStgui.update_uis(src) From ec81bfa8b4320025c22ea4a545342a7b97bf4f1d Mon Sep 17 00:00:00 2001 From: silicons Date: Sun, 16 Jul 2023 23:24:57 -0700 Subject: [PATCH 2/3] a --- code/modules/fishing/aquarium/aquarium.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/modules/fishing/aquarium/aquarium.dm b/code/modules/fishing/aquarium/aquarium.dm index 721ee414608..156c2f2fefc 100644 --- a/code/modules/fishing/aquarium/aquarium.dm +++ b/code/modules/fishing/aquarium/aquarium.dm @@ -186,7 +186,7 @@ return user.visible_action_feedback( target = src, - visible_loud = SPAN_WARNING("[user] starts to put [living_pulled] into [src]!"), + visible_hard = SPAN_WARNING("[user] starts to put [living_pulled] into [src]!"), visible_soft = SPAN_WARNING("[user] starts to put something into [src]!") ) if(!do_after(user, 10 SECONDS, target = src)) @@ -198,7 +198,7 @@ return user.visible_action_feedback( target = src, - visible_loud = SPAN_WARNING("[user] stuffs [living_pulled] into [src]!"), + visible_hard = SPAN_WARNING("[user] stuffs [living_pulled] into [src]!"), visible_soft = SPAN_WARNING("[user] stuffs something into [src]!"), ) living_pulled.forceMove(src) From 47781db36b981713df4be8a60aac2b9cfae63d92 Mon Sep 17 00:00:00 2001 From: silicons Date: Mon, 17 Jul 2023 11:39:54 -0700 Subject: [PATCH 3/3] scss stuff --- code/__DEFINES/spans.dm | 1 + code/modules/mob/say_vr.dm | 4 +- .../tgui-panel/styles/goon/chat-dark.scss | 37 +++-------- .../tgui-panel/styles/goon/chat-light.scss | 37 +++-------- .../packages/tgui-panel/styles/goon/chat.scss | 64 +++++++++++++++++++ 5 files changed, 85 insertions(+), 58 deletions(-) create mode 100644 tgui/packages/tgui-panel/styles/goon/chat.scss diff --git a/code/__DEFINES/spans.dm b/code/__DEFINES/spans.dm index 7ad99938077..2869fc00d95 100644 --- a/code/__DEFINES/spans.dm +++ b/code/__DEFINES/spans.dm @@ -122,6 +122,7 @@ #define SPAN_SUPPRADIO(str) ("[str]") #define SPAN_SYNDRADIO(str) ("[str]") #define SPAN_TAPE_RECORDER(str) ("[str]") +#define SPAN_TINY(str) ("[str]") #define SPAN_TINYNOTICE(str) ("[str]") #define SPAN_TINYNOTICEITAL(str) ("[str]") #define SPAN_UNCONSCIOUS(str) ("[str]") diff --git a/code/modules/mob/say_vr.dm b/code/modules/mob/say_vr.dm index 242174b63e5..9629e0877a3 100644 --- a/code/modules/mob/say_vr.dm +++ b/code/modules/mob/say_vr.dm @@ -60,7 +60,7 @@ var/list/other_viewers = get_hearers_in_view(source = src) for(var/mob/M in other_viewers - vis_mobs) - M.show_message(SPAN_SMALL("[src] does something [pick("subtly", "discreetly", "hidden", "obscured")]."), SAYCODE_TYPE_VISIBLE) + M.show_message(SPAN_SMALL("[src] does something [pick("subtly", "discreetly", "hidden", "obscured")]."), SAYCODE_TYPE_VISIBLE) /mob/proc/emote_vr(var/act, var/type, var/message) //This would normally go in say.dm if(act == "me") @@ -117,7 +117,7 @@ var/list/other_viewers = get_hearers_in_view(source = src) for(var/mob/M in (other_viewers - vis_mobs) | GLOB.observer_list) - M.show_message(SPAN_SMALL("[src] does something [pick("subtly", "discreetly", "hidden", "obscured")]."), SAYCODE_TYPE_VISIBLE) + M.show_message(SPAN_SMALL("[src] does something [pick("subtly", "discreetly", "hidden", "obscured")]."), SAYCODE_TYPE_VISIBLE) /////// END diff --git a/tgui/packages/tgui-panel/styles/goon/chat-dark.scss b/tgui/packages/tgui-panel/styles/goon/chat-dark.scss index a508e8a4a96..30cae836f40 100644 --- a/tgui/packages/tgui-panel/styles/goon/chat-dark.scss +++ b/tgui/packages/tgui-panel/styles/goon/chat-dark.scss @@ -1,3 +1,5 @@ +@import './chat.scss'; + /** * Copyright (c) 2020 Aleksej Komarov * SPDX-License-Identifier: MIT @@ -953,40 +955,19 @@ blockquote.brass { font-family: "Courier New", cursive, sans-serif; } -.command_headset { - font-weight: bold; - font-size: 125%; -} - -.small { - font-size: 60%; -} - -.big { - font-size: 185%; -} - -.reallybig { - font-size: 245%; -} - -.extremelybig { - font-size: 310%; -} - .greentext { + @include size-ll; color: #059223; - font-size: 185%; -} - -.redtext { - color: #c51e1e; - font-size: 185%; } .yellowtext { + @include size-ll; color: #FFCC00; - font-size: 185%; +} + +.redtext { + @include size-ll; + color: #c51e1e; } .clown { diff --git a/tgui/packages/tgui-panel/styles/goon/chat-light.scss b/tgui/packages/tgui-panel/styles/goon/chat-light.scss index 5433970c99e..0e8acfada0a 100644 --- a/tgui/packages/tgui-panel/styles/goon/chat-light.scss +++ b/tgui/packages/tgui-panel/styles/goon/chat-light.scss @@ -1,3 +1,5 @@ +@import './chat.scss'; + /** * Copyright (c) 2020 Aleksej Komarov * SPDX-License-Identifier: MIT @@ -994,40 +996,19 @@ blockquote.brass { font-family: "Courier New", cursive, sans-serif; } -.command_headset { - font-weight: bold; - font-size: 125%; /* 160% default, changed so command can scream less */ -} - -.small { - font-size: 60%; -} - -.big { - font-size: 185%; -} - -.reallybig { - font-size: 245%; -} - -.extremelybig { - font-size: 310%; -} - .greentext { + @include size-ll; color: #00FF00; - font-size: 185%; -} - -.redtext { - color: #FF0000; - font-size: 185%; } .yellowtext { + @include size-ll; color: #FFCC00; - font-size: 185%; +} + +.redtext { + @include size-ll; + color: #FF0000; } .clown { diff --git a/tgui/packages/tgui-panel/styles/goon/chat.scss b/tgui/packages/tgui-panel/styles/goon/chat.scss new file mode 100644 index 00000000000..329cab8e005 --- /dev/null +++ b/tgui/packages/tgui-panel/styles/goon/chat.scss @@ -0,0 +1,64 @@ +//* Utility: Size *// + +@mixin size-sss { + font-size: 60%; +} + +.tiny { + @include size-sss; +} + +@mixin size-ss { + font-size: 75%; +} + +.small { + @include size-ss; +} + +@mixin size-s { + font-size: 85%; +} + +.soft { + @include size-s; +} + +@mixin size-l { + font-size: 125%; +} + +.loud { + @include size-l; +} + +@mixin size-ll { + font-size: 185%;; +} + +.big { + @include size-ll; +} + +@mixin size-lll { + font-size: 245%; +} + +.reallybig { + @include size-lll; +} + +@mixin size-llll { + font-size: 310%; +} + +.extremelybig { + @include size-llll; +} + +//* General: Radio *// + +.command_headset { + @include size-l; + font-weight: bold; +}