From a578f9cef7ab32792fe63232bf044e003a0a4227 Mon Sep 17 00:00:00 2001 From: AzuleUtama <44248086+AzuleUtama@users.noreply.github.com> Date: Wed, 5 Dec 2018 16:02:51 +0000 Subject: [PATCH] Uplink Category Search Makes it so users can pick categories in the uplink --- code/game/objects/items/devices/uplinks.dm | 5 +++ nano/templates/uplink.tmpl | 43 ++++++++++++++-------- 2 files changed, 32 insertions(+), 16 deletions(-) diff --git a/code/game/objects/items/devices/uplinks.dm b/code/game/objects/items/devices/uplinks.dm index d0c0622d1e5..927ddb50b56 100644 --- a/code/game/objects/items/devices/uplinks.dm +++ b/code/game/objects/items/devices/uplinks.dm @@ -24,6 +24,7 @@ var/list/world_uplinks = list() var/job = null var/show_descriptions = 0 + var/temp_category = "Ammunition" /obj/item/uplink/nano_host() return loc @@ -233,6 +234,7 @@ var/list/world_uplinks = list() if(!nanoui_items) generate_items(user) data["nano_items"] = nanoui_items + data["category_choice"] = temp_category data += nanoui_data return data @@ -272,6 +274,9 @@ var/list/world_uplinks = list() if(href_list["descriptions"]) show_descriptions = !show_descriptions update_nano_data() + if(href_list["category"]) + temp_category = href_list["category"] + update_nano_data() SSnanoui.update_uis(src) return 1 diff --git a/nano/templates/uplink.tmpl b/nano/templates/uplink.tmpl index 6177ab016a7..5eeb22a2c95 100644 --- a/nano/templates/uplink.tmpl +++ b/nano/templates/uplink.tmpl @@ -20,7 +20,7 @@ Used In File(s): \code\game\objects\items\devices\uplinks.dm
-{{if data.menu == 0}} +{{if data.menu == 0 || data.menu == 2}}

Request items:

Each item costs a number of tele-crystals as indicated by the number following their name.
@@ -32,23 +32,34 @@ Used In File(s): \code\game\objects\items\devices\uplinks.dm

- {{for data.nano_items}} -
-

{{:value.Category}}

-
- {{for value.items :itemValue:itemIndex}} -
- {{:helper.link( itemValue.Name, 'gear', {'buy_item' : itemValue.obj_path, 'cost' : itemValue.Cost}, itemValue.Cost > data.crystals ? 'disabled' : null, null)}} - {{:itemValue.Cost}} -
+ +{{if data.menu == 0}} + {{for data.nano_items}} +
+ {{:helper.link ( value.Category, 'gear', {'menu' : 2, 'category' : value.Category}, null, null)}} +
+ {{/for}} - {{if itemValue.Cost <= data.crystals && data.descriptions}} -
- {{:itemValue.Description}} -
- {{/if}} - {{/for}} -
+{{else data.menu == 2}} + {{for data.nano_items}} + {{if value.Category == data.category_choice}} +
+

{{:value.Category}}

+
+ {{for value.items :itemValue:itemIndex}} +
+ {{:helper.link( itemValue.Name, 'gear', {'buy_item' : itemValue.obj_path, 'cost' : itemValue.Cost}, itemValue.Cost > data.crystals ? 'disabled' : null, null)}} - {{:itemValue.Cost}} +
+ + {{if itemValue.Cost <= data.crystals && data.descriptions}} +
+ {{:itemValue.Description}} +
+ {{/if}} + {{/for}} + {{/if}} {{/for}} +{{/if}}
{{:helper.link('Buy Random (??)' , 'gear', {'buy_item' : 'random'}, data.crystals <= 0 ? 'disabled' : null, null)}}