Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

message range update to visible_action_feedback, and makes subtles make a, well, subtly-does-something message for people within range instead of being completely silent #5722

Merged
merged 3 commits into from
Jul 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions citadel.dme
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions code/__DEFINES/spans.dm
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@
#define SPAN_SUPPRADIO(str) ("<span class='suppradio'>[str]</span>")
#define SPAN_SYNDRADIO(str) ("<span class='syndradio'>[str]</span>")
#define SPAN_TAPE_RECORDER(str) ("<span class='tape_recorder'>[str]</span>")
#define SPAN_TINY(str) ("<span class='tiny'>[str]</span>")
#define SPAN_TINYNOTICE(str) ("<span class='tinynotice'>[str]</span>")
#define SPAN_TINYNOTICEITAL(str) ("<span class='tinynoticeital'>[str]</span>")
#define SPAN_UNCONSCIOUS(str) ("<span class='unconscious'>[str]</span>")
Expand Down
55 changes: 55 additions & 0 deletions code/game/atoms/action_feedback.dm
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 2 additions & 0 deletions code/game/atoms/atom.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 10 additions & 2 deletions code/modules/fishing/aquarium/aquarium.dm
Original file line number Diff line number Diff line change
Expand Up @@ -184,15 +184,23 @@
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_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))
return
if(QDELETED(living_pulled) || user.pulling != living_pulled || living_pulled.buckled || living_pulled.has_buckled_mobs())
return
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_hard = SPAN_WARNING("[user] stuffs [living_pulled] into [src]!"),
visible_soft = SPAN_WARNING("[user] stuffs something into [src]!"),
)
living_pulled.forceMove(src)
update_appearance()

Expand Down
28 changes: 7 additions & 21 deletions code/modules/mob/action_feedback.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand All @@ -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)
Expand All @@ -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.
*/
Expand Down
8 changes: 8 additions & 0 deletions code/modules/mob/observer/dead/dead.dm
Original file line number Diff line number Diff line change
@@ -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!
Expand Down Expand Up @@ -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...
Expand Down Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions code/modules/mob/say_vr.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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("<i>[src] does something [pick("subtly", "discreetly", "hidden", "obscured")].</i>"), 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)
Expand Down Expand Up @@ -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("<i>[src] does something [pick("subtly", "discreetly", "hidden", "obscured")].</i>"), SAYCODE_TYPE_VISIBLE)

/////// END

#define MAX_HUGE_MESSAGE_LEN 8192
Expand Down
6 changes: 5 additions & 1 deletion code/modules/reagents/items/hypospray.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
48 changes: 40 additions & 8 deletions code/modules/reagents/machinery/dispenser/dispenser.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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")
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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))
Expand All @@ -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))
Expand All @@ -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)
Expand Down
37 changes: 9 additions & 28 deletions tgui/packages/tgui-panel/styles/goon/chat-dark.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@import './chat.scss';

/**
* Copyright (c) 2020 Aleksej Komarov
* SPDX-License-Identifier: MIT
Expand Down Expand Up @@ -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 {
Expand Down
Loading
Loading