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

tg examine/chat ports, readability changes to dsay/ooc/xeno/admin spans #16732

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open
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
12 changes: 12 additions & 0 deletions code/__DEFINES/announce.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// the types of priority announcements
/// Regular gameplay, not too important
#define ANNOUNCEMENT_REGULAR 1
/// Probably round outcome changing, like OBs and Alamo fun
#define ANNOUNCEMENT_PRIORITY 2
/// Command alerts
#define ANNOUNCEMENT_COMMAND 3

/// Admin or OOC sources. Yellow
#define OOC_ALERT_ADMIN "ooc"
/// Game alerts, like roundend. Red
#define OOC_ALERT_GAME "game"
8 changes: 7 additions & 1 deletion code/__DEFINES/chat.dm
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,11 @@
#define debug_world_log(msg) if (GLOB.Debug2) log_world("DEBUG: [msg]")
/// Adds a generic box around whatever message you're sending in chat. Really makes things stand out.
#define examine_block(str) ("<div class='examine_block'>" + str + "</div>")

/// Makes a fieldset with a name in the middle top part. Can apply additional classes
#define fieldset_block(title, content, classes) ("<fieldset class='" + classes + "'><legend align='center' style='max-width: 95%; text-align: center;'><div style='margin: 0em 0.2em -0.4em 0.2em;' >" + title + "</div></legend>" + content + "</fieldset>")
/// Makes a horizontal line with text in the middle
#define separator_hr(str) ("<div class='separator'>" + str + "</div>")
/// Header for use in examine blocks
#define examine_header(str) ("<span class='blockheader'>" + str + "</span>")
/// A horizontal line for use in examine blocks
#define EXAMINE_SECTION_BREAK "<hr>"
5 changes: 4 additions & 1 deletion code/__DEFINES/dcs/signals/signals.dm
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,10 @@
#define COMSIG_ATOM_ATTACK_POWERLOADER "atom_attack_powerloader"//from base of atom/attack_powerloader: (mob/living/user, obj/item/powerloader_clamp/attached_clamp)
///from base of atom/emp_act(): (severity)
#define COMSIG_ATOM_EMP_ACT "atom_emp_act"
#define COMSIG_ATOM_EXAMINE "atom_examine" //from base of atom/examine(): (/mob)
///from base of atom/examine(): (/mob, list/examine_text)
#define COMSIG_ATOM_EXAMINE "atom_examine"
///from base of atom/examine_tags(): (/mob, list/examine_tags)
#define COMSIG_ATOM_EXAMINE_TAGS "atom_examine_tags"
///from base of atom/get_examine_name(): (/mob, list/overrides)
#define COMSIG_ATOM_GET_EXAMINE_NAME "atom_examine_name"
//Positions for overrides list
Expand Down
4 changes: 4 additions & 0 deletions code/__DEFINES/items.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
///The text for weight class data lists (item examine)
#define WEIGHT_CLASS_TEXT "text"
///The tooltip desc for weight class data lists (item examine)
#define WEIGHT_CLASS_TOOLTIP "tooltip"
2 changes: 2 additions & 0 deletions code/__DEFINES/span.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#define span_adminhelp(str) ("<span class='adminhelp'>" + str + "</span>")
#define span_adminnotice(str) ("<span class='adminnotice'>" + str + "</span>")
#define span_adminooc(str) ("<span class='adminooc'>" + str + "</span>")
#define span_adminsay(str) ("<span class='asay'>" + str + "</span>")
#define span_alert(str) ("<span class='alert'>" + str + "</span>")
#define span_alertalien(str) ("<span class='alertalien'>" + str + "</span>")
#define span_alien(str) ("<span class='alien'>" + str + "</span>")
Expand Down Expand Up @@ -43,6 +44,7 @@
#define span_looc(str) ("<span class='looc'>" + str + "</span>")
#define span_memo(str) ("<span class='memo'>" + str + "</span>")
#define span_memoedit(str) ("<span class='memoedit'>" + str + "</span>")
#define span_mentorsay(str) ("<span class='msay'>" + str + "</span>")
#define span_message(str) ("<span class='message'>" + str + "</span>")
#define span_moderate(str) ("<span class='moderate'>" + str + "</span>")
#define span_motd(str) ("<span class='motd'>" + str + "</span>")
Expand Down
7 changes: 1 addition & 6 deletions code/__HELPERS/announce.dm
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
// the types of priority announcements
#define ANNOUNCEMENT_REGULAR 1
#define ANNOUNCEMENT_PRIORITY 2
#define ANNOUNCEMENT_COMMAND 3

// Do not use these macros outside of here (unless you absolutely have to or something), this is mainly to make sure they appear consistent
// The best way to use these for to_chats or something would be assemble_alert()

Expand Down Expand Up @@ -124,7 +119,7 @@
if(playing_sound)
SEND_SOUND(M, s)


///Spawns a paper at each communications printer
/proc/print_command_report(papermessage, papertitle = "paper", announcemessage = "A report has been downloaded and printed out at all communications consoles.", announcetitle = "Incoming Classified Message", announce = TRUE)
if(announce)
priority_announce(announcemessage, announcetitle, sound = 'sound/AI/commandreport.ogg')
Expand Down
2 changes: 1 addition & 1 deletion code/__HELPERS/ooc_announcement.dm
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
play_sound = TRUE,
sound_override = 'sound/misc/adm_announce.ogg',
sender_override = "Server Admin Announcement",
style = "ooc",
style = OOC_ALERT_ADMIN,
encode_title = TRUE,
encode_text = FALSE,
)
Expand Down
20 changes: 18 additions & 2 deletions code/__HELPERS/unsorted.dm
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,7 @@ GLOBAL_LIST_INIT(wallitems, typecacheof(list(
/proc/format_text(text)
return replacetext(replacetext(text,"\proper ",""),"\improper ","")

///Returns a string based on the weight class define used as argument
///Returns a string based on the weight class define used as argument.
/proc/weight_class_to_text(w_class)
switch(w_class)
if(WEIGHT_CLASS_TINY)
Expand All @@ -810,7 +810,23 @@ GLOBAL_LIST_INIT(wallitems, typecacheof(list(
if(WEIGHT_CLASS_GIGANTIC)
. = "gigantic"
else
. = ""
. = "?????"

///Returns an assoc list of WEIGHT CLASS TEXT = DESCRIPTION based on the arg you provide.
/proc/weight_class_data(w_class)
. = list()
.[WEIGHT_CLASS_TEXT] = weight_class_to_text(w_class)
switch(w_class)
if(WEIGHT_CLASS_TINY, WEIGHT_CLASS_SMALL)
.[WEIGHT_CLASS_TOOLTIP] = "Fits in pockets and almost all containers, except some specialized containers. Takes up almost no space in containers."
if(WEIGHT_CLASS_NORMAL)
.[WEIGHT_CLASS_TOOLTIP] = "Fits in most containers. Takes up some space."
if(WEIGHT_CLASS_BULKY)
.[WEIGHT_CLASS_TOOLTIP] = "Only fits in rare specialized containers, such as holsters. Takes up a lot of space in containers."
if(WEIGHT_CLASS_HUGE, WEIGHT_CLASS_GIGANTIC)
.[WEIGHT_CLASS_TOOLTIP] = "Only fits in extremely rare specialized containers."
else
.[WEIGHT_CLASS_TOOLTIP] = "Yell at coders, this isn't supposed to happen."

/// Converts a semver string into a list of numbers
/proc/semver_to_list(semver_string)
Expand Down
2 changes: 1 addition & 1 deletion code/controllers/subsystem/ticker.dm
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ SUBSYSTEM_DEF(ticker)
tip = pick(SSstrings.get_list_from_file("tips/meme"))

if(tip)
to_chat(world, examine_block("[span_tip("<big>Tip of the round:</big>")][EXAMINE_SECTION_BREAK][html_encode(tip)]"))
to_chat(world, fieldset_block("[span_tip("<big>Tip of the round</big>")]", html_encode(tip), "examine_block"))


/datum/controller/subsystem/ticker/proc/check_queue()
Expand Down
2 changes: 1 addition & 1 deletion code/datums/gamemodes/campaign.dm
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
title = round_finished,
text = announcement_body,
play_sound = FALSE,
style = "game"
style = OOC_ALERT_GAME
)

var/sound/som_track
Expand Down
4 changes: 2 additions & 2 deletions code/datums/gamemodes/campaign/campaign_mission.dm
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@
title = name,
text = "Next mission is [name], selected by [starting_faction] on the battlefield of [map_name].",
sound_override = 'sound/ambience/votestart.ogg',
style = "game"
style = OOC_ALERT_GAME
)

///Intro when the mission is started
Expand All @@ -376,7 +376,7 @@
title = "[starting_faction] [outcome]",
text = "The engagement between [starting_faction] and [hostile_faction] on [map_name] has ended in a [starting_faction] [outcome]!",
play_sound = FALSE,
style = "game"
style = OOC_ALERT_GAME
)

map_text_broadcast(starting_faction, outro_message[outcome][MISSION_STARTING_FACTION], op_name_starting)
Expand Down
2 changes: 1 addition & 1 deletion code/datums/gamemodes/combat_patrol.dm
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
title = round_finished,
text = "Thus ends the story of the brave men and women of the TerraGov Marine Corps and Sons of Mars, and their struggle on [SSmapping.configs[GROUND_MAP].map_name].",
play_sound = FALSE,
style = "game"
style = OOC_ALERT_GAME
)

/datum/game_mode/hvh/combat_patrol/get_deploy_point_message(mob/living/user)
Expand Down
2 changes: 1 addition & 1 deletion code/datums/gamemodes/infestation.dm
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@
title = round_finished,
text = "Thus ends the story of the brave men and women of the TerraGov Marine Corps, and their struggle on [SSmapping.configs[GROUND_MAP].map_name]...",
play_sound = FALSE,
style = "game"
style = OOC_ALERT_GAME
)

var/sound/xeno_track
Expand Down
17 changes: 9 additions & 8 deletions code/datums/jobs/job/job.dm
Original file line number Diff line number Diff line change
Expand Up @@ -162,16 +162,17 @@ GLOBAL_PROTECT(exp_specialmap)
/datum/job/proc/map_check()
return TRUE


/datum/job/proc/radio_help_message(mob/M)
to_chat(M, {"
[span_role_header("You are the [title].")]
[span_role_body("As the <b>[title]</b> you answer to [supervisors]. Special circumstances may change this.")]
"})
/// The message you get when spawning in as this job, called by [/datum/job/proc/after_spawn]
/datum/job/proc/radio_help_message(mob/new_player)
var/list/message = list()
message += span_role_body("As the <b>[title]</b> you answer to [supervisors]. Special circumstances may change this.")
if(!(job_flags & JOB_FLAG_NOHEADSET))
to_chat(M, "<span class='role_body'>Prefix your message with ; to speak on the default radio channel. To see other prefixes, look closely at your headset.</span>")
message += separator_hr("[span_role_body("<b>Radio</b>")]")
message += span_role_body("Prefix your message with <b>;</b> to speak on the default radio channel, in most cases this is your squad radio. For additional prefixes, examine your headset.")
if(req_admin_notify)
to_chat(M, "<span class='role_body'>You are playing a job that is important for game progression. If you have to disconnect, please head to hypersleep, if you can't make it there, notify the admins via adminhelp.</span>")
message += separator_hr("[span_role_header("This is an important job.")]")
message += span_role_body("If you have to disconnect, please take a hypersleep pod. If you can't make it there, <b><u>adminhelp</u></b> using F1 or the Adminhelp verb.")
to_chat(new_player, fieldset_block("[span_role_header("You are the [title].")]", jointext(message, ""), "examine_block"))

/datum/outfit/job
var/jobtype
Expand Down
106 changes: 0 additions & 106 deletions code/game/atoms/_atom.dm
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,11 @@

var/resistance_flags = PROJECTILE_IMMUNE

///If non-null, overrides a/an/some in all cases
var/article

///a very temporary list of overlays to remove
var/list/remove_overlays
///a very temporary list of overlays to add
var/list/add_overlays


///Related to do_after/do_mob overlays, I can't get my hopes high.
var/list/display_icons

Expand Down Expand Up @@ -286,108 +282,6 @@ directive is properly returned.
found += A.search_contents_for(path,filter_path)
return found


//mob verbs are faster than object verbs. See https://secure.byond.com/forum/?post=1326139&page=2#comment8198716 for why this isn't atom/verb/examine()
/mob/verb/examinate(atom/examinify as mob|obj|turf in view())
set name = "Examine"
set category = "IC"

if(is_blind(src))
to_chat(src, span_notice("Something is there but you can't see it."))
return

face_atom(examinify)
var/list/result = examinify.examine(src) // if a tree is examined but no client is there to see it, did the tree ever really exist?

if(length(result))
for(var/i in 1 to (length(result) - 1))
if(result[i] != EXAMINE_SECTION_BREAK)
result[i] += "\n"
else
// remove repeated <hr's> and ones on the ends.
if((i == 1) || (i == length(result)) || (result[i - 1] == EXAMINE_SECTION_BREAK))
result.Cut(i, i + 1)
i--

to_chat(src, examine_block(span_infoplain(result.Join())))
SEND_SIGNAL(src, COMSIG_MOB_EXAMINATE, examinify)

/**
* Get the name of this object for examine
*
* You can override what is returned from this proc by registering to listen for the
* [COMSIG_ATOM_GET_EXAMINE_NAME] signal
*/
/atom/proc/get_examine_name(mob/user)
. = "\a [src]"
var/list/override = list(gender == PLURAL ? "some" : "a", " ", "[name]")
if(article)
. = "[article] [src]"
override[EXAMINE_POSITION_ARTICLE] = article
if(SEND_SIGNAL(src, COMSIG_ATOM_GET_EXAMINE_NAME, user, override) & COMPONENT_EXNAME_CHANGED)
. = override.Join("")

///Generate the full examine string of this atom (including icon for goonchat)
/atom/proc/get_examine_string(mob/user, thats = FALSE)
return "[icon2html(src, user)] [thats? "That's ":""][get_examine_name(user)]"

/atom/proc/examine(mob/user)
SHOULD_CALL_PARENT(TRUE)
var/examine_string = get_examine_string(user, thats = TRUE)
if(examine_string)
. = list("[examine_string].", EXAMINE_SECTION_BREAK)
else
. = list()

if(desc)
. += desc
if(user.can_use_codex() && SScodex.get_codex_entry(get_codex_value()))
. += EXAMINE_SECTION_BREAK
. += span_notice("The codex has <a href='?_src_=codex;show_examined_info=[REF(src)];show_to=[REF(user)]'>relevant information</a> available.")

if((get_dist(user,src) <= 2) && reagents)
. += EXAMINE_SECTION_BREAK
if(reagents.reagent_flags & TRANSPARENT)
. += "It contains:"
if(length(reagents.reagent_list)) // TODO: Implement scan_reagent and can_see_reagents() to show each individual reagent
var/total_volume = 0
for(var/datum/reagent/R in reagents.reagent_list)
total_volume += R.volume
. += span_notice("[total_volume] units of various reagents.")
else
. += "Nothing."
else if(CHECK_BITFIELD(reagents.reagent_flags, AMOUNT_VISIBLE))
if(reagents.total_volume)
. += span_notice("It has [reagents.total_volume] unit\s left.")
else
. += span_warning("It's empty.")
else if(CHECK_BITFIELD(reagents.reagent_flags, AMOUNT_SKILLCHECK))
if(isxeno(user))
return
if(user.skills.getRating(SKILL_MEDICAL) >= SKILL_MEDICAL_NOVICE)
. += "It contains these reagents:"
if(length(reagents.reagent_list))
for(var/datum/reagent/R in reagents.reagent_list)
. += "[R.volume] units of [R.name]"
else
. += "Nothing."
else
. += "You don't know what's in it."
else if(reagents.reagent_flags & AMOUNT_ESTIMEE)
var/obj/item/reagent_containers/C = src
if(!reagents.total_volume)
. += span_notice("\The [src] is empty!")
else if (reagents.total_volume<= C.volume*0.3)
. += span_notice("\The [src] is almost empty!")
else if (reagents.total_volume<= C.volume*0.6)
. += span_notice("\The [src] is half full!")
else if (reagents.total_volume<= C.volume*0.9)
. += span_notice("\The [src] is almost full!")
else
. += span_notice("\The [src] is full!")

SEND_SIGNAL(src, COMSIG_ATOM_EXAMINE, user, .)

/// Checks if the colors given are different and if so causes a greyscale icon update
/// The colors argument can be either a list or the full color string
/atom/proc/set_greyscale_colors(list/colors, update=TRUE)
Expand Down
Loading
Loading