Files
00807234b9 refactors asset subsystem (#6459)
refactors the asset subsystem to make it much more managed

adds support for 'deferred' assets for tgui, which will be later used
for things like tgui character setup and admin panels.
deferred means that it'll be 'sent in a timely manner after the ui
opens', as opposed to 'sent before the ui opens'

---------

Co-authored-by: silicons <no@you.cat>
2024-06-01 17:08:13 -06:00

40 lines
1.3 KiB
Plaintext

/// Sends information needed for uplinks
/datum/asset_pack/json/uplink
name = "uplink"
/datum/asset_pack/json/uplink/generate()
var/list/data = list()
var/list/categories = list()
var/list/items = list()
for(var/datum/uplink_category/category as anything in subtypesof(/datum/uplink_category))
categories += category
categories = tim_sort(categories, GLOBAL_PROC_REF(uplink_category_desc))
var/list/new_categories = list()
for(var/datum/uplink_category/category as anything in categories)
new_categories += initial(category.name)
categories = new_categories
for(var/datum/uplink_item/item_path as anything in subtypesof(/datum/uplink_item))
var/datum/uplink_item/item = new item_path()
if(item.item) {
items += list(list(
"id" = item_path,
"name" = item.name,
"cost" = item.cost,
"desc" = item.desc,
"category" = item.category? initial(item.category.name) : null,
"purchasable_from" = item.purchasable_from,
"restricted" = item.restricted,
"limited_stock" = item.limited_stock,
"restricted_roles" = item.restricted_roles,
"progression_minimum" = item.progression_minimum,
))
}
SStraitor.uplink_items += item
SStraitor.uplink_items_by_type[item_path] = item
data["items"] = items
data["categories"] = categories
return data