From 789d3e4d54eb22ebc28536437cf7652f3ff6cd47 Mon Sep 17 00:00:00 2001 From: mwerezak Date: Sat, 19 Jul 2014 22:20:30 -0400 Subject: [PATCH] Fixes modkits Fixes modkits not tracking suit/helmet parts, not checking allowed parts, and not checking if the clothing needs to be modified. --- code/game/objects/items/devices/modkit.dm | 34 +++++++++++++++-------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/code/game/objects/items/devices/modkit.dm b/code/game/objects/items/devices/modkit.dm index bbab8870b1..2921559a63 100644 --- a/code/game/objects/items/devices/modkit.dm +++ b/code/game/objects/items/devices/modkit.dm @@ -22,11 +22,20 @@ del(src) return - /* TODO: list comparison - if(istype(O,to_type)) - user << "[O] is already modified." + var/allowed = 0 + for (var/permitted_type in permitted_types) + if(istype(O, permitted_type)) + allowed = 1 + + var/obj/item/clothing/I = O + if (!istype(I) || !allowed) + user << "[src] is unable to modify that." return - */ + + var/excluding = ("exclude" in I.species_restricted) + var/in_list = (target_species in I.species_restricted) + if (excluding ^ in_list) + user << "[I] is already modified." if(!isturf(O.loc)) user << "[O] must be safely placed on the ground for modification." @@ -36,14 +45,17 @@ user.visible_message("\red [user] opens \the [src] and modifies \the [O].","\red You open \the [src] and modify \the [O].") - var/obj/item/clothing/I = O - if(istype(I)) - if (target_species) - I.refit_for_species(target_species) - else - I.refit_for_species("Human") + if (target_species) + I.refit_for_species(target_species) + else + I.refit_for_species("Human") - parts-- + + if (istype(I, /obj/item/clothing/head/helmet)) + parts &= ~MODKIT_HELMET + if (istype(I, /obj/item/clothing/suit)) + parts &= ~MODKIT_SUIT + if(!parts) user.drop_from_inventory(src) del(src)