From a00a12aeb7f924d6fa7d767f0e88b7e9ddf709d5 Mon Sep 17 00:00:00 2001 From: iamgoofball Date: Sun, 23 Mar 2014 20:29:55 -0700 Subject: [PATCH] fixes issues pointed out in PR --- code/modules/clothing/under/chameleon.dm | 128 ++++++++++++++--------- 1 file changed, 78 insertions(+), 50 deletions(-) diff --git a/code/modules/clothing/under/chameleon.dm b/code/modules/clothing/under/chameleon.dm index 57c16ae5f13..927b1442e5a 100644 --- a/code/modules/clothing/under/chameleon.dm +++ b/code/modules/clothing/under/chameleon.dm @@ -18,7 +18,7 @@ /obj/item/clothing/under/golem, /obj/item/clothing/under/gimmick)//Prevent infinite loops and bad jumpsuits. for(var/U in typesof(/obj/item/clothing/under)-blocked) var/obj/item/clothing/under/V = new U - src.clothing_choices += V + src.clothing_choices[V.name] = U return emp_act(severity) @@ -26,16 +26,19 @@ desc = "Groovy!" icon_state = "psyche" item_color = "psyche" + update_icon() + usr.update_icons() verb/change() set name = "Change Jumpsuit Appearance" set category = "Object" set src in usr - var/obj/item/clothing/suit/A - A = input("Select jumpsuit to change it to", "Chameleon Jumpsuit")as null|anything in clothing_choices - if(!A) + var/picked = input("Select jumpsuit to change it to", "Chameleon Jumpsuit")as null|anything in clothing_choices + if(!picked || !clothing_choices[picked]) return + var/newtype = clothing_choices[picked] + var/obj/item/clothing/A = new newtype desc = null permeability_coefficient = 0.90 @@ -45,7 +48,8 @@ icon_state = A.icon_state item_state = A.item_state item_color = A.item_color - usr.update_inv_w_uniform() //so our overlays update. + if(usr) + usr.update_inv_w_uniform() //so our overlays update. //***************** //**Chameleon Hat** @@ -66,7 +70,7 @@ /obj/item/clothing/head/space/golem, /obj/item/clothing/head/justice,)//Prevent infinite loops and bad hats. for(var/U in typesof(/obj/item/clothing/head)-blocked) var/obj/item/clothing/head/V = new U - src.clothing_choices += V + src.clothing_choices[V.name] = U return emp_act(severity) //Because we don't have psych for all slots right now but still want a downside to EMP. In this case your cover's blown. @@ -75,16 +79,18 @@ icon_state = "greysoft" item_color = "grey" update_icon() + usr.update_icons() verb/change() set name = "Change Hat/Helmet Appearance" set category = "Object" set src in usr - var/obj/item/clothing/suit/A - A = input("Select headwear to change it to", "Chameleon Hat")as null|anything in clothing_choices - if(!A) + var/picked = input("Select headwear to change it to", "Chameleon Hat")as null|anything in clothing_choices + if(!picked || !clothing_choices[picked]) return + var/newtype = clothing_choices[picked] + var/obj/item/clothing/A = new newtype desc = null permeability_coefficient = 0.90 @@ -95,7 +101,8 @@ item_state = A.item_state item_color = A.item_color flags_inv = A.flags_inv - usr.update_inv_head() //so our overlays update. + if(usr) + usr.update_inv_head() //so our overlays update. //****************** //**Chameleon Suit** @@ -116,7 +123,7 @@ /obj/item/clothing/suit/greatcoat)//Prevent infinite loops and bad suits. for(var/U in typesof(/obj/item/clothing/suit)-blocked) var/obj/item/clothing/suit/V = new U - src.clothing_choices += V + src.clothing_choices[V.name] = U return emp_act(severity) //Because we don't have psych for all slots right now but still want a downside to EMP. In this case your cover's blown. @@ -125,16 +132,18 @@ icon_state = "armor" item_color = "armor" update_icon() + usr.update_icons() verb/change() set name = "Change Exosuit Appearance" set category = "Object" set src in usr - var/obj/item/clothing/suit/A - A = input("Select footwear to change it to", "Chameleon Exosuit")as null|anything in clothing_choices - if(!A) + var/picked = input("Select exosuit to change it to", "Chameleon Exosuit")as null|anything in clothing_choices + if(!picked || !clothing_choices[picked]) return + var/newtype = clothing_choices[picked] + var/obj/item/clothing/A = new newtype desc = null permeability_coefficient = 0.90 @@ -145,7 +154,8 @@ item_state = A.item_state item_color = A.item_color flags_inv = A.flags_inv - usr.update_inv_wear_suit() //so our overlays update. + if(usr) + usr.update_inv_wear_suit() //so our overlays update. //******************* //**Chameleon Shoes** @@ -155,7 +165,7 @@ icon_state = "black" item_state = "black" item_color = "black" - desc = "They're comfy black shoes, with clever Syndicate cloaking technology built in. It seems to have a small dial on the back of each shoe." + desc = "They're comfy black shoes, with clever cloaking technology built in. It seems to have a small dial on the back of each shoe." origin_tech = "syndicate=3" var/list/clothing_choices = list() @@ -165,7 +175,7 @@ /obj/item/clothing/shoes/golem, /obj/item/clothing/shoes/syndigaloshes, /obj/item/clothing/shoes/cyborg)//prevent infinite loops and bad shoes. for(var/U in typesof(/obj/item/clothing/shoes)-blocked) var/obj/item/clothing/shoes/V = new U - src.clothing_choices += V + src.clothing_choices[V.name] = U return emp_act(severity) //Because we don't have psych for all slots right now but still want a downside to EMP. In this case your cover's blown. @@ -175,16 +185,18 @@ item_state = "black" item_color = "black" update_icon() + usr.update_icons() verb/change() set name = "Change Footwear Appearance" set category = "Object" set src in usr - var/obj/item/clothing/shoes/A - A = input("Select footwear to change it to", "Chameleon Shoes")as null|anything in clothing_choices - if(!A) + var/picked = input("Select shoes to change it to", "Chameleon Shoes")as null|anything in clothing_choices + if(!picked || !clothing_choices[picked]) return + var/newtype = clothing_choices[picked] + var/obj/item/clothing/A = new newtype desc = null permeability_coefficient = 0.90 @@ -194,7 +206,8 @@ icon_state = A.icon_state item_state = A.item_state item_color = A.item_color - usr.update_inv_shoes() //so our overlays update. + if(usr) + usr.update_inv_shoes() //so our overlays update. //********************** //**Chameleon Backpack** @@ -212,7 +225,7 @@ var/blocked = list(/obj/item/weapon/storage/backpack/chameleon, /obj/item/weapon/storage/backpack/satchel/withwallet) for(var/U in typesof(/obj/item/weapon/storage/backpack)-blocked)//Prevent infinite loops and bad backpacks. var/obj/item/weapon/storage/backpack/V = new U - src.clothing_choices += V + src.clothing_choices[V.name] = U return emp_act(severity) //Because we don't have psych for all slots right now but still want a downside to EMP. In this case your cover's blown. @@ -221,16 +234,18 @@ icon_state = "backpack" item_state = "backpack" update_icon() + usr.update_icons() verb/change() set name = "Change Backpack Appearance" set category = "Object" set src in usr - var/obj/item/weapon/storage/backpack/A - A = input("Select backpack to change it to", "Chameleon Backpack")as null|anything in clothing_choices - if(!A) + var/picked = input("Select backpack to change it to", "Chameleon Backpack")as null|anything in clothing_choices + if(!picked || !clothing_choices[picked]) return + var/newtype = clothing_choices[picked] + var/obj/item/weapon/storage/backpack/A = new newtype desc = null permeability_coefficient = 0.90 @@ -240,7 +255,8 @@ icon_state = A.icon_state item_state = A.item_state item_color = A.item_color - usr.update_inv_back() //so our overlays update. + if(usr) + usr.update_inv_back() //so our overlays update. //******************** //**Chameleon Gloves** @@ -260,7 +276,7 @@ var/blocked = list(/obj/item/clothing/gloves/chameleon)//Prevent infinite loops and bad hats. for(var/U in typesof(/obj/item/clothing/gloves)-blocked) var/obj/item/clothing/gloves/V = new U - src.clothing_choices += V + src.clothing_choices[V.name] = U return emp_act(severity) //Because we don't have psych for all slots right now but still want a downside to EMP. In this case your cover's blown. @@ -269,16 +285,18 @@ icon_state = "black" item_color = "brown" update_icon() + usr.update_icons() verb/change() set name = "Change Gloves Appearance" set category = "Object" set src in usr - var/obj/item/clothing/gloves/A - A = input("Select gloves to change it to", "Chameleon Gloves")as null|anything in clothing_choices - if(!A) + var/picked = input("Select gloves to change it to", "Chameleon Gloves")as null|anything in clothing_choices + if(!picked || !clothing_choices[picked]) return + var/newtype = clothing_choices[picked] + var/obj/item/clothing/A = new newtype desc = null permeability_coefficient = 0.90 @@ -289,7 +307,8 @@ item_state = A.item_state item_color = A.item_color flags_inv = A.flags_inv - usr.update_inv_gloves() //so our overlays update. + if(usr) + usr.update_inv_gloves() //so our overlays update. //****************** //**Chameleon Mask** @@ -308,7 +327,8 @@ var/blocked = list(/obj/item/clothing/mask/chameleon)//Prevent infinite loops and bad hats. for(var/U in typesof(/obj/item/clothing/mask)-blocked) var/obj/item/clothing/mask/V = new U - src.clothing_choices += V + if(V) + src.clothing_choices[V.name] = U return emp_act(severity) //Because we don't have psych for all slots right now but still want a downside to EMP. In this case your cover's blown. @@ -316,16 +336,17 @@ desc = "It's a gas mask." icon_state = "gas_alt" update_icon() - + usr.update_icons() verb/change() set name = "Change Mask Appearance" set category = "Object" set src in usr - var/obj/item/clothing/mask/A - A = input("Select mask to change it to", "Chameleon Mask")as null|anything in clothing_choices - if(!A) + var/picked = input("Select mask to change it to", "Chameleon Mask")as null|anything in clothing_choices + if(!picked || !clothing_choices[picked]) return + var/newtype = clothing_choices[picked] + var/obj/item/clothing/A = new newtype desc = null permeability_coefficient = 0.90 @@ -335,7 +356,8 @@ icon_state = A.icon_state item_state = A.item_state flags_inv = A.flags_inv - usr.update_inv_wear_mask() //so our overlays update. + if(usr) + usr.update_inv_wear_mask() //so our overlays update. //********************* //**Chameleon Glasses** @@ -354,7 +376,7 @@ var/blocked = list(/obj/item/clothing/glasses/chameleon)//Prevent infinite loops and bad hats. for(var/U in typesof(/obj/item/clothing/glasses)-blocked) var/obj/item/clothing/glasses/V = new U - src.clothing_choices += V + src.clothing_choices[V.name] = U return emp_act(severity) //Because we don't have psych for all slots right now but still want a downside to EMP. In this case your cover's blown. @@ -362,16 +384,18 @@ desc = "It's a set of mesons." icon_state = "meson" update_icon() + usr.update_icons() verb/change() set name = "Change Glasses Appearance" set category = "Object" set src in usr - var/obj/item/clothing/glasses/A - A = input("Select glasses to change it to", "Chameleon Glasses")as null|anything in clothing_choices - if(!A) + var/picked = input("Select glasses to change it to", "Chameleon Glasses")as null|anything in clothing_choices + if(!picked || !clothing_choices[picked]) return + var/newtype = clothing_choices[picked] + var/obj/item/clothing/A = new newtype desc = null permeability_coefficient = 0.90 @@ -381,7 +405,8 @@ icon_state = A.icon_state item_state = A.item_state flags_inv = A.flags_inv - usr.update_inv_glasses() //so our overlays update. + if(usr) + usr.update_inv_glasses() //so our overlays update. //***************** //**Chameleon Gun** @@ -399,27 +424,29 @@ New() ..() - var/blocked = list(/obj/item/weapon/gun/projectile/chameleon)//Prevent infinite loops and bad hats. + var/blocked = list(/obj/item/weapon/gun/projectile/chameleon) for(var/U in typesof(/obj/item/weapon/gun/)-blocked) var/obj/item/weapon/gun/V = new U - src.gun_choices += V + src.gun_choices[V.name] = U return - emp_act(severity) //Because we don't have psych for all slots right now but still want a downside to EMP. In this case your cover's blown. + emp_act(severity) name = "desert eagle" desc = "It's a desert eagle." icon_state = "deagle" update_icon() + usr.update_icons() verb/change() set name = "Change Gun Appearance" set category = "Object" set src in usr - var/obj/item/weapon/gun/A - A = input("Select gun to change it to", "Chameleon Gun")as null|anything in gun_choices - if(!A) + var/picked = input("Select gun to change it to", "Chameleon Gun")as null|anything in gun_choices + if(!picked || !gun_choices[picked]) return + var/newtype = gun_choices[picked] + var/obj/item/weapon/gun/A = new newtype desc = null permeability_coefficient = 0.90 @@ -429,5 +456,6 @@ icon_state = A.icon_state item_state = A.item_state flags_inv = A.flags_inv - usr.update_inv_r_hand() - usr.update_inv_l_hand() //so our overlays update. \ No newline at end of file + if(usr) + usr.update_inv_r_hand() + usr.update_inv_l_hand() //so our overlays update. \ No newline at end of file