You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

244 lines
6.8 KiB

  1. GLOBAL_LIST_EMPTY(custom_outfits) //Admin created outfits
  2. /client/proc/outfit_manager()
  3. set category = "Debug"
  4. set name = "Outfit Manager"
  5. if(!check_rights(R_DEBUG))
  6. return
  7. holder.outfit_manager(usr)
  8. /datum/admins/proc/outfit_manager(mob/admin)
  9. var/list/dat = list("<ul>")
  10. for(var/datum/outfit/O in GLOB.custom_outfits)
  11. var/vv = FALSE
  12. var/datum/outfit/varedit/VO = O
  13. if(istype(VO))
  14. vv = length(VO.vv_values)
  15. dat += "<li>[O.name][vv ? "(VV)" : ""]</li> <a href='?_src_=holder;[HrefToken()];save_outfit=1;chosen_outfit=[REF(O)]'>Save</a> <a href='?_src_=holder;[HrefToken()];delete_outfit=1;chosen_outfit=[REF(O)]'>Delete</a>"
  16. dat += "</ul>"
  17. dat += "<a href='?_src_=holder;[HrefToken()];create_outfit_menu=1'>Create</a><br>"
  18. dat += "<a href='?_src_=holder;[HrefToken()];load_outfit=1'>Load from file</a>"
  19. admin << browse(dat.Join(),"window=outfitmanager")
  20. /datum/admins/proc/save_outfit(mob/admin,datum/outfit/O)
  21. O.save_to_file(admin)
  22. outfit_manager(admin)
  23. /datum/admins/proc/delete_outfit(mob/admin,datum/outfit/O)
  24. GLOB.custom_outfits -= O
  25. qdel(O)
  26. to_chat(admin,"<span class='notice'>Outfit deleted.</span>", confidential = TRUE)
  27. outfit_manager(admin)
  28. /datum/admins/proc/load_outfit(mob/admin)
  29. var/outfit_file = input("Pick outfit json file:", "File") as null|file
  30. if(!outfit_file)
  31. return
  32. var/filedata = file2text(outfit_file)
  33. var/json = json_decode(filedata)
  34. if(!json)
  35. to_chat(admin,"<span class='warning'>JSON decode error.</span>", confidential = TRUE)
  36. return
  37. var/otype = text2path(json["outfit_type"])
  38. if(!ispath(otype,/datum/outfit))
  39. to_chat(admin,"<span class='warning'>Malformed/Outdated file.</span>", confidential = TRUE)
  40. return
  41. var/datum/outfit/O = new otype
  42. if(!O.load_from(json))
  43. to_chat(admin,"<span class='warning'>Malformed/Outdated file.</span>", confidential = TRUE)
  44. return
  45. GLOB.custom_outfits += O
  46. outfit_manager(admin)
  47. /datum/admins/proc/create_outfit(mob/admin)
  48. var/list/uniforms = typesof(/obj/item/clothing/under)
  49. var/list/suits = typesof(/obj/item/clothing/suit)
  50. var/list/gloves = typesof(/obj/item/clothing/gloves)
  51. var/list/shoes = typesof(/obj/item/clothing/shoes)
  52. var/list/headwear = typesof(/obj/item/clothing/head)
  53. var/list/glasses = typesof(/obj/item/clothing/glasses)
  54. var/list/masks = typesof(/obj/item/clothing/mask)
  55. var/list/ids = typesof(/obj/item/card/id)
  56. var/uniform_select = "<select name=\"outfit_uniform\"><option value=\"\">None</option>"
  57. for(var/path in uniforms)
  58. uniform_select += "<option value=\"[path]\">[path]</option>"
  59. uniform_select += "</select>"
  60. var/suit_select = "<select name=\"outfit_suit\"><option value=\"\">None</option>"
  61. for(var/path in suits)
  62. suit_select += "<option value=\"[path]\">[path]</option>"
  63. suit_select += "</select>"
  64. var/gloves_select = "<select name=\"outfit_gloves\"><option value=\"\">None</option>"
  65. for(var/path in gloves)
  66. gloves_select += "<option value=\"[path]\">[path]</option>"
  67. gloves_select += "</select>"
  68. var/shoes_select = "<select name=\"outfit_shoes\"><option value=\"\">None</option>"
  69. for(var/path in shoes)
  70. shoes_select += "<option value=\"[path]\">[path]</option>"
  71. shoes_select += "</select>"
  72. var/head_select = "<select name=\"outfit_head\"><option value=\"\">None</option>"
  73. for(var/path in headwear)
  74. head_select += "<option value=\"[path]\">[path]</option>"
  75. head_select += "</select>"
  76. var/glasses_select = "<select name=\"outfit_glasses\"><option value=\"\">None</option>"
  77. for(var/path in glasses)
  78. glasses_select += "<option value=\"[path]\">[path]</option>"
  79. glasses_select += "</select>"
  80. var/mask_select = "<select name=\"outfit_mask\"><option value=\"\">None</option>"
  81. for(var/path in masks)
  82. mask_select += "<option value=\"[path]\">[path]</option>"
  83. mask_select += "</select>"
  84. var/id_select = "<select name=\"outfit_id\"><option value=\"\">None</option>"
  85. for(var/path in ids)
  86. id_select += "<option value=\"[path]\">[path]</option>"
  87. id_select += "</select>"
  88. var/dat = {"
  89. <html><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8'><title>Create Outfit</title></head><body>
  90. <form name="outfit" action="byond://?src=[REF(src)];[HrefToken()]" method="get">
  91. <input type="hidden" name="src" value="[REF(src)]">
  92. [HrefTokenFormField()]
  93. <input type="hidden" name="create_outfit_finalize" value="1">
  94. <table>
  95. <tr>
  96. <th>Name:</th>
  97. <td>
  98. <input type="text" name="outfit_name" value="Custom Outfit">
  99. </td>
  100. </tr>
  101. <tr>
  102. <th>Uniform:</th>
  103. <td>
  104. [uniform_select]
  105. </td>
  106. </tr>
  107. <tr>
  108. <th>Suit:</th>
  109. <td>
  110. [suit_select]
  111. </td>
  112. </tr>
  113. <tr>
  114. <th>Back:</th>
  115. <td>
  116. <input type="text" name="outfit_back" value="">
  117. </td>
  118. </tr>
  119. <tr>
  120. <th>Belt:</th>
  121. <td>
  122. <input type="text" name="outfit_belt" value="">
  123. </td>
  124. </tr>
  125. <tr>
  126. <th>Gloves:</th>
  127. <td>
  128. [gloves_select]
  129. </td>
  130. </tr>
  131. <tr>
  132. <th>Shoes:</th>
  133. <td>
  134. [shoes_select]
  135. </td>
  136. </tr>
  137. <tr>
  138. <th>Head:</th>
  139. <td>
  140. [head_select]
  141. </td>
  142. </tr>
  143. <tr>
  144. <th>Mask:</th>
  145. <td>
  146. [mask_select]
  147. </td>
  148. </tr>
  149. <tr>
  150. <th>Ears:</th>
  151. <td>
  152. <input type="text" name="outfit_ears" value="">
  153. </td>
  154. </tr>
  155. <tr>
  156. <th>Glasses:</th>
  157. <td>
  158. [glasses_select]
  159. </td>
  160. </tr>
  161. <tr>
  162. <th>ID:</th>
  163. <td>
  164. [id_select]
  165. </td>
  166. </tr>
  167. <tr>
  168. <th>Left Pocket:</th>
  169. <td>
  170. <input type="text" name="outfit_l_pocket" value="">
  171. </td>
  172. </tr>
  173. <tr>
  174. <th>Right Pocket:</th>
  175. <td>
  176. <input type="text" name="outfit_r_pocket" value="">
  177. </td>
  178. </tr>
  179. <tr>
  180. <th>Suit Store:</th>
  181. <td>
  182. <input type="text" name="outfit_s_store" value="">
  183. </td>
  184. </tr>
  185. <tr>
  186. <th>Right Hand:</th>
  187. <td>
  188. <input type="text" name="outfit_r_hand" value="">
  189. </td>
  190. </tr>
  191. <tr>
  192. <th>Left Hand:</th>
  193. <td>
  194. <input type="text" name="outfit_l_hand" value="">
  195. </td>
  196. </tr>
  197. </table>
  198. <br>
  199. <input type="submit" value="Save">
  200. </form></body></html>
  201. "}
  202. admin << browse(dat, "window=dressup;size=550x600")
  203. /datum/admins/proc/create_outfit_finalize(mob/admin, list/href_list)
  204. var/datum/outfit/O = new
  205. O.name = href_list["outfit_name"]
  206. O.uniform = text2path(href_list["outfit_uniform"])
  207. O.shoes = text2path(href_list["outfit_shoes"])
  208. O.gloves = text2path(href_list["outfit_gloves"])
  209. O.suit = text2path(href_list["outfit_suit"])
  210. O.head = text2path(href_list["outfit_head"])
  211. O.back = text2path(href_list["outfit_back"])
  212. O.mask = text2path(href_list["outfit_mask"])
  213. O.glasses = text2path(href_list["outfit_glasses"])
  214. O.r_hand = text2path(href_list["outfit_r_hand"])
  215. O.l_hand = text2path(href_list["outfit_l_hand"])
  216. O.suit_store = text2path(href_list["outfit_s_store"])
  217. O.l_pocket = text2path(href_list["outfit_l_pocket"])
  218. O.r_pocket = text2path(href_list["outfit_r_pocket"])
  219. O.id = text2path(href_list["outfit_id"])
  220. O.belt = text2path(href_list["outfit_belt"])
  221. O.ears = text2path(href_list["outfit_ears"])
  222. GLOB.custom_outfits.Add(O)
  223. message_admins("[key_name(usr)] created \"[O.name]\" outfit!")