Skip to content

Commit

Permalink
Autocodex (#864)
Browse files Browse the repository at this point in the history
* auto codex

* fix siemens coeff grammar

* more grammar
  • Loading branch information
Kapu1178 authored Mar 4, 2024
1 parent 259dcfd commit 8796eb1
Show file tree
Hide file tree
Showing 15 changed files with 152 additions and 121 deletions.
3 changes: 0 additions & 3 deletions code/__DEFINES/dcs/signals/signals_atom/signals_atom_main.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
///from base of atom/get_examine_name(): (/mob, list/overrides)
#define COMSIG_ATOM_GET_EXAMINE_NAME "atom_examine_name"
#define COMSIG_PARENT_EXAMINE_MORE "atom_examine_more" ///from base of atom/examine_more(): (/mob)
//Positions for overrides list
#define EXAMINE_POSITION_ARTICLE (1<<0)
#define EXAMINE_POSITION_BEFORE (1<<1)
//End positions
#define COMPONENT_EXNAME_CHANGED (1<<0)
///from base of [/atom/proc/update_appearance]: (updates)
Expand Down
5 changes: 1 addition & 4 deletions code/datums/elements/decals/blood.dm
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,4 @@
/datum/element/decal/blood/proc/get_examine_name(datum/source, mob/user, list/override)
SIGNAL_HANDLER

var/atom/A = source
override[EXAMINE_POSITION_ARTICLE] = A.gender == PLURAL? "some" : "a"
override[EXAMINE_POSITION_BEFORE] = " blood-stained "
return COMPONENT_EXNAME_CHANGED
override.Insert(1, "blood-stained")
10 changes: 0 additions & 10 deletions code/datums/storage/storage.dm
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@
RegisterSignal(parent, COMSIG_PARENT_ATTACKBY_SECONDARY, PROC_REF(open_storage_attackby_secondary))
RegisterSignal(parent, COMSIG_MOVABLE_MOVED, PROC_REF(close_distance))
RegisterSignal(parent, COMSIG_ITEM_EQUIPPED, PROC_REF(update_actions))
RegisterSignal(parent, COMSIG_TOPIC, PROC_REF(topic_handle))

/datum/storage/proc/on_deconstruct()
SIGNAL_HANDLER
Expand Down Expand Up @@ -228,15 +227,6 @@

set_real_location(null)

/datum/storage/proc/topic_handle(datum/source, user, href_list)
SIGNAL_HANDLER

if(href_list["show_valid_pocket_items"])
handle_show_valid_items(source, user)

/datum/storage/proc/handle_show_valid_items(datum/source, user)
to_chat(user, span_notice("[source] can hold: [can_hold_description]"))

/// Almost 100% of the time the lists passed into set_holdable are reused for each instance
/// Just fucking cache it 4head
/// Yes I could generalize this, but I don't want anyone else using it. in fact, DO NOT COPY THIS
Expand Down
17 changes: 9 additions & 8 deletions code/game/atoms.dm
Original file line number Diff line number Diff line change
Expand Up @@ -661,18 +661,19 @@
* [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
var/list/name_list = list(name)

if(SEND_SIGNAL(src, COMSIG_ATOM_GET_EXAMINE_NAME, user, override) & COMPONENT_EXNAME_CHANGED)
. = override.Join("")
SEND_SIGNAL(src, COMSIG_ATOM_GET_EXAMINE_NAME, user, name_list)
if(gender == PLURAL)
return jointext(name_list, " ")

else
return "\a [jointext(name_list, " ")]"

///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)]"
var/that_string = gender == PLURAL ? "Those are " : "That is "
return "[icon2html(src, user)] [thats? that_string :""][get_examine_name(user)]"

/**
* Returns an extended list of examine strings for any contained ID cards.
Expand Down
60 changes: 56 additions & 4 deletions code/game/objects/items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,62 @@ DEFINE_INTERACTABLE(/obj/item)
. = ..()
update_slot_icon()

/obj/item/get_mechanics_info()
. = ..()
var/pronoun = gender == PLURAL ? "They" : "It"
var/pronoun_is = gender == PLURAL ? "They are" : "It is"

. += "- [pronoun_is] a [weight_class_to_text(w_class)] object."

if(atom_storage)
. += "- [pronoun] can store items."
if(!length(atom_storage.can_hold))
. += "- [pronoun] can store [atom_storage.max_slots] item\s that are [weight_class_to_text(atom_storage.max_specific_storage)] or smaller."

var/static/list/string_part_flags = list(
"head" = HEAD,
"torso" = CHEST,
"legs" = LEGS,
"feet" = FEET,
"arms" = ARMS,
"hands" = HANDS
)

// Strings which corraspond to slot flags, useful for outputting what slot something is.
var/static/list/string_slot_flags = list(
"back" = ITEM_SLOT_BACK,
"face" = ITEM_SLOT_MASK,
"waist" = ITEM_SLOT_BELT,
"ID slot" = ITEM_SLOT_ID,
"ears" = ITEM_SLOT_EARS,
"eyes" = ITEM_SLOT_EYES,
"hands" = ITEM_SLOT_GLOVES,
"head" = ITEM_SLOT_HEAD,
"feet" = ITEM_SLOT_FEET,
"over body" = ITEM_SLOT_OCLOTHING,
"body" = ITEM_SLOT_ICLOTHING,
"neck" = ITEM_SLOT_NECK,
)

var/list/covers = list()
var/list/slots = list()
for(var/name in string_part_flags)
if(body_parts_covered & string_part_flags[name])
covers += name

for(var/name in string_slot_flags)
if(slot_flags & string_slot_flags[name])
slots += name

if(length(covers))
. += "- [pronoun] cover[p_s()] the [english_list(covers)]."

if(length(slots))
. += "- [pronoun] can be worn on your [english_list(slots)]."

if(siemens_coefficient == 0)
. += "- [gender == PLURAL ? "They do not" : "It does not"] conduct electricity."

/// Called when an action associated with our item is deleted
/obj/item/proc/on_action_deleted(datum/source)
SIGNAL_HANDLER
Expand Down Expand Up @@ -437,10 +493,6 @@ DEFINE_INTERACTABLE(/obj/item)
abstract_move(null)
forceMove(T)

/obj/item/examine(mob/user) //This might be spammy. Remove?
. = ..()
. += span_notice("[gender == PLURAL ? "They are" : "It is"] a [weight_class_to_text(w_class)] object.")

/obj/item/interact(mob/user)
add_fingerprint(user)
ui_interact(user)
Expand Down
3 changes: 2 additions & 1 deletion code/game/objects/items/cards_ids.dm
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@
return cached_flat_icon

/obj/item/card/id/get_examine_string(mob/user, thats = FALSE)
return "[icon2html(get_cached_flat_icon(), user)] [thats? "That's ":""][get_examine_name(user)]"
var/that_string = gender == PLURAL ? "Those are " : "That is "
return "[icon2html(get_cached_flat_icon(), user)] [thats ? that_string :""][get_examine_name(user)]"

/**
* Helper proc, checks whether the ID card can hold any given set of wildcards.
Expand Down
3 changes: 2 additions & 1 deletion code/game/objects/items/storage/wallets.dm
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@

/obj/item/storage/wallet/get_examine_string(mob/user, thats = FALSE)
if(front_id && is_open)
return "[icon2html(get_cached_flat_icon(), user)] [thats? "That's ":""][get_examine_name(user)]" //displays all overlays in chat
var/that_string = gender == PLURAL ? "Those are " : "That is "
return "[icon2html(get_cached_flat_icon(), user)] [thats? that_string : ""][get_examine_name(user)]" //displays all overlays in chat
return ..()

/obj/item/storage/wallet/proc/open()
Expand Down
1 change: 0 additions & 1 deletion code/game/turfs/closed/wall/mineral_walls.dm
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
color = "#B77D31" //To display in mapping softwares

/turf/closed/wall/mineral/uranium
article = "a"
name = "uranium wall"
desc = "A wall with uranium plating. This is probably a bad idea."
plating_material = /datum/material/uranium
Expand Down
1 change: 0 additions & 1 deletion code/game/turfs/open/floor/mineral_floor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@
//URANIUM

/turf/open/floor/mineral/uranium
article = "a"
name = "uranium floor"
icon_state = "uranium"
floor_tile = /obj/item/stack/tile/mineral/uranium
Expand Down
3 changes: 0 additions & 3 deletions code/game/turfs/open/floor/reinforced_floor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@
//air filled floors; used in atmos pressure chambers

/turf/open/floor/engine/n2o
article = "an"
name = "\improper N2O floor"
initial_gas = ATMOSTANK_NITROUSOXIDE

Expand All @@ -116,12 +115,10 @@
initial_gas = ATMOSTANK_OXYGEN

/turf/open/floor/engine/n2
article = "an"
name = "\improper N2 floor"
initial_gas = ATMOSTANK_NITROGEN

/turf/open/floor/engine/h2
article = "an"
name = "\improper H2 floor"
initial_gas = ATMOSTANK_HYDROGEN

Expand Down
3 changes: 2 additions & 1 deletion code/modules/antagonists/changeling/powers/transform.dm
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@
return cached_flat_icon

/obj/item/changeling/id/get_examine_string(mob/user, thats = FALSE)
return "[icon2html(get_cached_flat_icon(), user)] [thats? "That's ":""][get_examine_name(user)]" //displays all overlays in chat
var/that_string = gender == PLURAL ? "Those are " : "That is "
return "[icon2html(get_cached_flat_icon(), user)] [thats? that_string : ""][get_examine_name(user)]" //displays all overlays in chat

//Change our DNA to that of somebody we've absorbed.
/datum/action/changeling/transform/sting_action(mob/living/carbon/human/user)
Expand Down
135 changes: 62 additions & 73 deletions code/modules/clothing/clothing.dm
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,68 @@

return ..()

/obj/item/clothing/get_mechanics_info()
. = ..()
var/pronoun = gender == PLURAL ? "They" : "It"
var/pronoun_s = p_s()

var/static/list/armor_to_descriptive_term = list(
BLUNT = "blunt force",
SLASH = "cutting",
PUNCTURE = "puncturing",
LASER = "lasers",
ENERGY = "energy",
BOMB = "explosions",
BIO = "biohazards",
)

var/list/armor_info = list()
for(var/armor_type in armor_to_descriptive_term)
var/armor_value = returnArmor().getRating(armor_type)
if(!armor_value)
continue

switch(armor_value)
if(1 to 20)
. += "[FOURSPACES]- [pronoun] barely protect[pronoun_s] against [armor_to_descriptive_term[armor_type]]."
if(21 to 30)
. += "[FOURSPACES]- [pronoun] provide[pronoun_s] a very small defense against [armor_to_descriptive_term[armor_type]]."
if(31 to 40)
. += "[FOURSPACES]- [pronoun] offers a small amount of protection against [armor_to_descriptive_term[armor_type]]."
if(41 to 50)
. += "[FOURSPACES]- [pronoun] offers a moderate defense against [armor_to_descriptive_term[armor_type]]."
if(51 to 60)
. += "[FOURSPACES]- [pronoun] provide[pronoun_s] a strong defense against [armor_to_descriptive_term[armor_type]]."
if(61 to 70)
. += "[FOURSPACES]- [pronoun] is very strong against [armor_to_descriptive_term[armor_type]]."
if(71 to 80)
. += "[FOURSPACES]- [gender == PLURAL ? "These provide" : "It provides"] a very robust defense against [armor_to_descriptive_term[armor_type]]."
if(81 to 100)
. += "[FOURSPACES]- Wearing [gender == PLURAL ? "these" : "it"] would make you nigh-invulerable against [armor_to_descriptive_term[armor_type]]."

if(length(armor_info))
(.):Insert(1, "Armor Information")
(.):Insert(2, jointext(armor_info, ""))

if(clothing_flags & STOPSPRESSUREDAMAGE)
. += "- Wearing [gender == PLURAL ? "these" : "it"] will protect you from the vacuum of space."

if(clothing_flags & THICKMATERIAL)
. += "- The material is exceptionally thick."

if(!isnull(min_cold_protection_temperature) && min_cold_protection_temperature >= SPACE_SUIT_MIN_TEMP_PROTECT)
. += "- [pronoun] provide[pronoun_s] very good protection against very cold temperatures."

switch (max_heat_protection_temperature)
if (400 to 1000)
. += "- [pronoun] offer[pronoun_s] the wearer limited protection from fire."
if (1001 to 1600)
. += "- [pronoun] offer[pronoun_s] the wearer some protection from fire."
if (1601 to 35000)
. += "- [pronoun] offer[pronoun_s] the wearer robust protection from fire."



/// Set the clothing's integrity back to 100%, remove all damage to bodyparts, and generally fix it up
/obj/item/clothing/proc/repair(mob/user, params)
update_clothes_damaged_state(CLOTHING_PRISTINE)
Expand Down Expand Up @@ -282,14 +344,6 @@
. += span_warning("<b>[p_theyre(TRUE)] completely shredded and require[p_s()] mending before [p_they()] can be worn again!</b>")
return

switch (max_heat_protection_temperature)
if (400 to 1000)
. += "[src] offers the wearer limited protection from fire."
if (1001 to 1600)
. += "[src] offers the wearer some protection from fire."
if (1601 to 35000)
. += "[src] offers the wearer robust protection from fire."

for(var/zone in damage_by_parts)
var/pct_damage_part = damage_by_parts[zone] / limb_integrity * 100
var/zone_name = parse_zone(zone)
Expand All @@ -301,27 +355,6 @@
if(30 to 59)
. += span_danger("The [zone_name] is partially shredded.")

if(atom_storage)
var/list/how_cool_are_your_threads = list("<span class='notice'>")
if(atom_storage.attack_hand_interact)
how_cool_are_your_threads += "[src]'s storage opens when clicked.\n"
else
how_cool_are_your_threads += "[src]'s storage opens when dragged to yourself.\n"
if (atom_storage.can_hold?.len) // If pocket type can hold anything, vs only specific items
how_cool_are_your_threads += "[src] can store [atom_storage.max_slots] <a href='?src=[REF(src)];show_valid_pocket_items=1'>item\s</a>.\n"
else
how_cool_are_your_threads += "[src] can store [atom_storage.max_slots] item\s that are [weight_class_to_text(atom_storage.max_specific_storage)] or smaller.\n"
if(atom_storage.quickdraw)
how_cool_are_your_threads += "You can quickly remove an item from [src] using Right-Click.\n"
if(atom_storage.silent)
how_cool_are_your_threads += "Adding or removing items from [src] makes no noise.\n"
how_cool_are_your_threads += "</span>"
. += how_cool_are_your_threads.Join()

returnArmor() //Ensure armor exists
if(armor.bio || armor.bomb || armor.puncture || armor.energy || armor.laser || armor.blunt || armor.slash || armor.fire || armor.acid || (flags_cover & (HEADCOVERSMOUTH|PEPPERPROOF)))
. += span_notice("It has a <a href='?src=[REF(src)];list_armor=1'>tag</a> listing its protection classes.")

/**
* Inserts a trait (or multiple traits) into the clothing traits list
*
Expand Down Expand Up @@ -356,50 +389,6 @@
for(var/new_trait in trait_or_traits)
REMOVE_CLOTHING_TRAIT(wearer, new_trait)

/obj/item/clothing/Topic(href, href_list)
. = ..()

if(href_list["list_armor"])
returnArmor() //Ensure armor exists
var/list/readout = list("<span class='notice'><u><b>PROTECTION CLASSES</u></b>")
if(armor.bio || armor.bomb || armor.puncture || armor.energy || armor.laser || armor.blunt || armor.slash)
readout += "\n<b>ARMOR (I-X)</b>"
if(armor.bio)
readout += "\nTOXIN [armor_to_protection_class(armor.bio)]"
if(armor.bomb)
readout += "\nEXPLOSIVE [armor_to_protection_class(armor.bomb)]"
if(armor.energy)
readout += "\nENERGY [armor_to_protection_class(armor.energy)]"
if(armor.laser)
readout += "\nLASER [armor_to_protection_class(armor.laser)]"
if(armor.blunt)
readout += "\nBLUNT [armor_to_protection_class(armor.blunt)]"
if(armor.puncture)
readout += "\nPUNCTURE [armor_to_protection_class(armor.puncture)]"
if(armor.slash)
readout += "\nSLASH [armor_to_protection_class(armor.slash)]"

if(armor.fire || armor.acid)
readout += "\n<b>DURABILITY (I-X)</b>"
if(armor.fire)
readout += "\nFIRE [armor_to_protection_class(armor.fire)]"
if(armor.acid)
readout += "\nACID [armor_to_protection_class(armor.acid)]"

if(flags_cover & HEADCOVERSMOUTH || flags_cover & PEPPERPROOF)
var/list/things_blocked = list()
if(flags_cover & HEADCOVERSMOUTH)
things_blocked += span_tooltip("Because this item is worn on the head and is covering the mouth, it will block facehugger proboscides, killing facehuggers.", "facehuggers")
if(flags_cover & PEPPERPROOF)
things_blocked += "pepperspray"
if(length(things_blocked))
readout += "\n<b>COVERAGE</b>"
readout += "\nIt will block [english_list(things_blocked)]."

readout += "</span>"

to_chat(usr, "[readout.Join()]")

/**
* Rounds armor_value down to the nearest 10, divides it by 10 and then converts it to Roman numerals.
*
Expand Down
2 changes: 1 addition & 1 deletion code/modules/clothing/gloves/color.dm
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
location.visible_message(span_warning("[src] crumble[p_s()] away into nothing.")) // just like my dreams after working with .dm
qdel(src)

/obj/item/clothing/gloves/color/fyellow //Cheap Chinese Crap
/obj/item/clothing/gloves/color/fyellow //Cheap Chinese Crap
desc = "These gloves are cheap knockoffs of the coveted ones - no way this can end badly."
name = "budget insulated gloves"
icon_state = "yellow"
Expand Down
Loading

0 comments on commit 8796eb1

Please sign in to comment.