From dd16a509f251e430f1d68e8fa036a4bb2d7c3255 Mon Sep 17 00:00:00 2001 From: The0bserver Date: Sun, 26 Jul 2020 09:18:32 -0400 Subject: [PATCH 1/3] Initial Commit: MIGHT add tags --- code/modules/clothing/clothing.dm | 85 +++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/code/modules/clothing/clothing.dm b/code/modules/clothing/clothing.dm index d2553c4d7c..d48fbbcd1e 100644 --- a/code/modules/clothing/clothing.dm +++ b/code/modules/clothing/clothing.dm @@ -58,6 +58,10 @@ var/limb_integrity = 0 // How many zones (body parts, not precise) we have disabled so far, for naming purposes var/zones_disabled + ///These are armor values that protect the wearer, taken from the clothing's armor datum. List updates on examine because it's currently only used to print armor ratings to chat in Topic(). + var/list/armor_list = list() + ///These are armor values that protect the clothing, taken from its armor datum. List updates on examine because it's currently only used to print armor ratings to chat in Topic(). + var/list/durability_list = list() /obj/item/clothing/Initialize() . = ..() @@ -253,6 +257,87 @@ how_cool_are_your_threads += "Adding or removing items from [src] makes no noise.\n" how_cool_are_your_threads += "" . += how_cool_are_your_threads.Join() + + if(LAZYLEN(armor_list)) + armor_list.Cut() + if(armor.bio) + armor_list += list("TOXIN" = armor.bio) + if(armor.bomb) + armor_list += list("EXPLOSIVE" = armor.bomb) + if(armor.bullet) + armor_list += list("BULLET" = armor.bullet) + if(armor.energy) + armor_list += list("ENERGY" = armor.energy) + if(armor.laser) + armor_list += list("LASER" = armor.laser) + if(armor.magic) + armor_list += list("MAGIC" = armor.magic) + if(armor.melee) + armor_list += list("MELEE" = armor.melee) + if(armor.rad) + armor_list += list("RADIATION" = armor.rad) + + if(LAZYLEN(durability_list)) + durability_list.Cut() + if(armor.fire) + durability_list += list("FIRE" = armor.fire) + if(armor.acid) + durability_list += list("ACID" = armor.acid) + + if(LAZYLEN(armor_list) || LAZYLEN(durability_list)) + . += "It has a tag listing its protection classes." + +/obj/item/clothing/Topic(href, href_list) + . = ..() + + if(href_list["list_armor"]) + var/list/readout = list("PROTECTION CLASSES (I-X)") + if(LAZYLEN(armor_list)) + readout += "\nARMOR" + for(var/dam_type in armor_list) + var/armor_amount = armor_list[dam_type] + readout += "\n[dam_type] [armor_to_protection_class(armor_amount)]" //e.g. BOMB IV + if(LAZYLEN(durability_list)) + readout += "\nDURABILITY" + for(var/dam_type in durability_list) + var/durability_amount = durability_list[dam_type] + readout += "\n[dam_type] [armor_to_protection_class(durability_amount)]" //e.g. FIRE II + readout += "" + + to_chat(usr, "[readout.Join()]") + +/** + * Rounds armor_value to nearest 10, divides it by 10 and then expresses it in roman numerals up to 10 + * + * Rounds armor_value to nearest 10, divides it by 10 + * and then expresses it in roman numerals up to 10 + * Arguments: + * * armor_value - Number we're converting + */ +/obj/item/clothing/proc/armor_to_protection_class(armor_value) + armor_value = round(armor_value,10) / 10 + switch (armor_value) + if (1) + . = "I" + if (2) + . = "II" + if (3) + . = "III" + if (4) + . = "IV" + if (5) + . = "V" + if (6) + . = "VI" + if (7) + . = "VII" + if (8) + . = "VIII" + if (9) + . = "IX" + if (10 to INFINITY) + . = "X" + return . /obj/item/clothing/obj_break(damage_flag) damaged_clothes = CLOTHING_DAMAGED From 556fedacd07ffcf22695877f025d9348cc505bd7 Mon Sep 17 00:00:00 2001 From: The0bserver Date: Sun, 26 Jul 2020 09:56:46 -0400 Subject: [PATCH 2/3] this commit intentionally left blank --- code/modules/clothing/clothing.dm | 1 + 1 file changed, 1 insertion(+) diff --git a/code/modules/clothing/clothing.dm b/code/modules/clothing/clothing.dm index d48fbbcd1e..7b97297684 100644 --- a/code/modules/clothing/clothing.dm +++ b/code/modules/clothing/clothing.dm @@ -339,6 +339,7 @@ . = "X" return . + /obj/item/clothing/obj_break(damage_flag) damaged_clothes = CLOTHING_DAMAGED update_clothes_damaged_state() From 129297dfa58eed444755cefe800029756442ea0a Mon Sep 17 00:00:00 2001 From: The0bserver Date: Sun, 26 Jul 2020 10:06:35 -0400 Subject: [PATCH 3/3] this commit intentionally left blank 2 --- code/modules/clothing/clothing.dm | 1 - 1 file changed, 1 deletion(-) diff --git a/code/modules/clothing/clothing.dm b/code/modules/clothing/clothing.dm index 7b97297684..d48fbbcd1e 100644 --- a/code/modules/clothing/clothing.dm +++ b/code/modules/clothing/clothing.dm @@ -339,7 +339,6 @@ . = "X" return . - /obj/item/clothing/obj_break(damage_flag) damaged_clothes = CLOTHING_DAMAGED update_clothes_damaged_state()