Makes examine block HR's format better collapse (#13235)

* Makes examine HR's automatically collapse

* length

* code formatting
This commit is contained in:
Tastyfish
2022-05-02 07:19:16 -04:00
committed by GitHub
parent 3878017e9c
commit 94ca2a95f8
10 changed files with 38 additions and 16 deletions
+2
View File
@@ -1,5 +1,7 @@
#define MESSAGE_TYPE_MENTOR "mentor"
#define EXAMINE_SECTION_BREAK "<hr>"
/// 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>")
+15 -5
View File
@@ -628,28 +628,37 @@
* Produces a signal [COMSIG_PARENT_EXAMINE]
*/
/atom/proc/examine(mob/user)
. = list("[get_examine_string(user, TRUE)].<hr>")
. = list("[get_examine_string(user, TRUE)].", EXAMINE_SECTION_BREAK) // SKYRAT EDIT CHANGE - original: list("[get_examine_string(user, TRUE)].")
. += get_name_chaser(user)
if(desc)
. += desc
if(custom_materials)
. += "<hr>" //SKYRAT EDIT ADDITION
// SKYRAT EDIT ADDITION BEGIN - HR sections
if(length(custom_materials) > 1)
. += EXAMINE_SECTION_BREAK //SKYRAT EDIT ADDITION
//SKYRAT EDIT ADDITION END
var/list/materials_list = list()
for(var/datum/material/current_material as anything in custom_materials)
materials_list += "[current_material.name]"
. += "<u>It is made out of [english_list(materials_list)]</u>."
// SKYRAT EDIT ADDITION BEGIN - HR sections
if(length(custom_materials) > 1)
. += EXAMINE_SECTION_BREAK //SKYRAT EDIT ADDITION
//SKYRAT EDIT ADDITION END
if(reagents)
. += "<hr>" //SKYRAT EDIT ADDITION
if(reagents.flags & TRANSPARENT)
. += EXAMINE_SECTION_BREAK //SKYRAT EDIT ADDITION - HR sections
. += "It contains:"
if(length(reagents.reagent_list))
if(user.can_see_reagents()) //Show each individual reagent
for(var/datum/reagent/current_reagent as anything in reagents.reagent_list)
. += "[round(current_reagent.volume, 0.01)] units of [current_reagent.name]"
. += "&bull; [round(current_reagent.volume, 0.01)] units of [current_reagent.name]" // SKYRAT EDIT CHANGE - added bullet
if(reagents.is_reacting)
. += span_warning("It is currently reacting!")
. += span_warning("&nbsp;&nbsp;It is currently reacting!") // SKYRAT EDIT CHANGE - added spacing
. += span_notice("The solution's pH is [round(reagents.ph, 0.01)] and has a temperature of [reagents.chem_temp]K.")
else //Otherwise, just show the total volume
var/total_volume = 0
@@ -658,6 +667,7 @@
. += "[total_volume] units of various reagents"
else
. += "Nothing."
. += EXAMINE_SECTION_BREAK //SKYRAT EDIT ADDITION
else if(reagents.flags & AMOUNT_VISIBLE)
if(reagents.total_volume)
. += span_notice("It has [reagents.total_volume] unit\s left.")
+4 -1
View File
@@ -6,7 +6,7 @@
var/t_has = p_have()
var/t_is = p_are()
. = list("<span class='info'>This is [icon2html(src, user)] \a <EM>[src]</EM>!<hr>")
. = list("<span class='info'>This is [icon2html(src, user)] \a <EM>[src]</EM>!", EXAMINE_SECTION_BREAK) // SKYRAT EDIT CHANGE - HR padding
var/obscured = check_obscured_slots()
if (handcuffed)
@@ -24,6 +24,9 @@
if (back)
. += "[t_He] [t_has] [back.get_examine_string(user)] on [t_his] back."
. += EXAMINE_SECTION_BREAK // SKYRAT EDIT ADDITION - hr sections
var/appears_dead = FALSE
if (stat == DEAD)
appears_dead = TRUE
@@ -34,7 +34,7 @@
else
species_name_string = ", [prefix_a_or_an(dna.species.name)] <EM>[dna.species.name]</EM>!"
. = list("<span class='info'>This is <EM>[!obscure_name ? name : "Unknown"]</EM>[species_name_string]<hr>") //SKYRAT EDIT CHANGE
. = list("<span class='info'>This is <EM>[!obscure_name ? name : "Unknown"]</EM>[species_name_string]", EXAMINE_SECTION_BREAK) //SKYRAT EDIT CHANGE
if(species_visible) //If they have a custom species shown, show the real one too
if(dna.features["custom_species"])
. += "[t_He] [t_is] [prefix_a_or_an(dna.species.name)] [dna.species.name]!"
@@ -47,13 +47,13 @@
if(dna?.species && !skipface)
apparent_species = ", \an [dna.species.name]"
. = list("<span class='info'>*---------*\nThis is <EM>[!obscure_name ? name : "Unknown"][apparent_species]</EM>!")
. = list("<span class='info'>*---------*\nThis is <EM>[!obscure_name ? name : "Unknown"]</EM>!")
var/obscured = check_obscured_slots()
var/skipface = (wear_mask && (wear_mask.flags_inv & HIDEFACE)) || (head && (head.flags_inv & HIDEFACE))
*/ //SKYRAT EDIT END
//uniform
if(w_uniform && !(obscured & ITEM_SLOT_ICLOTHING) && !(w_uniform.item_flags & EXAMINE_SKIP))
//accessory
@@ -131,6 +131,8 @@
. += wear_id.get_id_examine_strings(user)
. += EXAMINE_SECTION_BREAK // SKYRAT EDIT ADDITION - hr sections
//Status effects
var/list/status_examines = status_effect_examines()
if (length(status_examines))
@@ -1,5 +1,5 @@
/mob/living/silicon/ai/examine(mob/user)
. = list("<span class='info'>This is [icon2html(src, user)] <EM>[src]</EM>!<hr>") //SKYRAT EDIT CHANGE
. = list("<span class='info'>This is [icon2html(src, user)] <EM>[src]</EM>!", EXAMINE_SECTION_BREAK) //SKYRAT EDIT CHANGE
if (stat == DEAD)
. += span_deadsay("It appears to be powered-down.")
else
@@ -90,7 +90,7 @@
text_span = "purple"
if(THEME_HOLY)
text_span = "blue"
. = list("<span class='[text_span]'>This is [icon2html(src, user)] \a <b>[src]</b>!\n[desc]<hr>") //SKYRAT EDIT CHANGE
. = list("<span class='[text_span]'>This is [icon2html(src, user)] \a <b>[src]</b>!\n[desc]", EXAMINE_SECTION_BREAK) //SKYRAT EDIT CHANGE
if(health < maxHealth)
if(health >= maxHealth/2)
. += span_warning("[t_He] look[t_s] slightly dented.")
@@ -249,7 +249,7 @@
dust()
/mob/living/simple_animal/drone/examine(mob/user)
. = list("<span class='info'>This is [icon2html(src, user)] \a <b>[src]</b>!<hr>") //SKYRAT EDIT CHANGE
. = list("<span class='info'>This is [icon2html(src, user)] \a <b>[src]</b>!", EXAMINE_SECTION_BREAK) //SKYRAT EDIT CHANGE
//Hands
for(var/obj/item/I in held_items)
@@ -19,7 +19,7 @@
/mob/living/simple_animal/hostile/guardian/dextrous/examine(mob/user)
if(dextrous)
. = list("<span class='info'>This is [icon2html(src)] \a <b>[src]</b>!\n[desc]<hr>") //SKYRAT EDIT CHANGE
. = list("<span class='info'>This is [icon2html(src)] \a <b>[src]</b>!\n[desc]", EXAMINE_SECTION_BREAK) //SKYRAT EDIT CHANGE
for(var/obj/item/I in held_items)
if(!(I.item_flags & ABSTRACT))
. += "It has [I.get_examine_string(user)] in its [get_held_index_name(get_held_index_of_item(I))]."
@@ -438,7 +438,7 @@
return
/mob/living/simple_animal/slime/examine(mob/user)
. = list("<span class='info'>This is [icon2html(src, user)] \a <EM>[src]</EM>!<hr>") //SKYRAT EDIT CHANGE
. = list("<span class='info'>This is [icon2html(src, user)] \a <EM>[src]</EM>!", EXAMINE_SECTION_BREAK) //SKYRAT EDIT CHANGE
if (stat == DEAD)
. += span_deadsay("It is limp and unresponsive.")
else
+7 -2
View File
@@ -493,9 +493,14 @@
//SKYRAT EDIT ADDITION
if(result.len)
for(var/i = 1, i <= result.len, i++)
if(!findtext(result[i], "<hr>"))
for(var/i in 1 to length(result))
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--
//SKYRAT EDIT END
to_chat(src, "<div class='examine_block'><span class='infoplain'>[result.Join()]</span></div>") //SKYRAT EDIT CHANGE