diff --git a/code/__HELPERS/cmp.dm b/code/__HELPERS/cmp.dm index c0501b4e41..87f3a32b0d 100644 --- a/code/__HELPERS/cmp.dm +++ b/code/__HELPERS/cmp.dm @@ -85,6 +85,9 @@ GLOBAL_VAR_INIT(cmp_field, "name") /proc/cmp_job_display_asc(datum/job/A, datum/job/B) return A.display_order - B.display_order +/proc/cmp_uplink_items_dsc(datum/uplink_item/A, datum/uplink_item/B) + return sorttext(initial(B.name), initial(A.name)) + /proc/cmp_numbered_displays_name_asc(datum/numbered_display/A, datum/numbered_display/B) return sorttext(A.sample_object.name, B.sample_object.name) diff --git a/code/__HELPERS/global_lists.dm b/code/__HELPERS/global_lists.dm index 7852251230..a7bf5da17f 100644 --- a/code/__HELPERS/global_lists.dm +++ b/code/__HELPERS/global_lists.dm @@ -97,6 +97,16 @@ var/datum/emote/E = new path() E.emote_list[E.key] = E + //Uplink Items + for(var/path in subtypesof(/datum/uplink_item)) + var/datum/uplink_item/I = path + if(!initial(I.item)) //We add categories to a separate list. + GLOB.uplink_categories |= initial(I.category) + continue + GLOB.uplink_items += path + //(sub)typesof entries are listed by the order they are loaded in the code, so we'll have to rearrange them here. + GLOB.uplink_items = sortList(GLOB.uplink_items, /proc/cmp_uplink_items_dsc) + init_subtypes(/datum/crafting_recipe, GLOB.crafting_recipes) //creates every subtype of prototype (excluding prototype) and adds it to list L. diff --git a/code/_globalvars/lists/objects.dm b/code/_globalvars/lists/objects.dm index 14c752613b..fa68fab85f 100644 --- a/code/_globalvars/lists/objects.dm +++ b/code/_globalvars/lists/objects.dm @@ -19,6 +19,8 @@ GLOBAL_LIST(chemical_reagents_list) //list of all /datum/reagent datums index GLOBAL_LIST_EMPTY(materials_list) //list of all /datum/material datums indexed by material id. GLOBAL_LIST_EMPTY(tech_list) //list of all /datum/tech datums indexed by id. GLOBAL_LIST_EMPTY(surgeries_list) //list of all surgeries by name, associated with their path. +GLOBAL_LIST_EMPTY(uplink_items) //list of all uplink item typepaths, ascendingly sorted by their initial name. +GLOBAL_LIST_EMPTY(uplink_categories) //list of all uplink categories, listed by the order they are loaded in code. Be careful. GLOBAL_LIST_EMPTY(crafting_recipes) //list of all table craft recipes GLOBAL_LIST_EMPTY(rcd_list) //list of Rapid Construction Devices. GLOBAL_LIST_EMPTY(apcs_list) //list of all Area Power Controller machines, separate from machines for powernet speeeeeeed. diff --git a/code/modules/holiday/halloween/halloween.dm b/code/modules/holiday/halloween/halloween.dm index 5b9b2ac21d..24225c1a20 100644 --- a/code/modules/holiday/halloween/halloween.dm +++ b/code/modules/holiday/halloween/halloween.dm @@ -252,12 +252,11 @@ // Spooky Uplink Items // ///////////////////////// -/datum/uplink_item/dangerous/crossbow/candy +/datum/uplink_item/stealthy_weapons/crossbow/candy name = "Candy Corn Crossbow" desc = "A standard miniature energy crossbow that uses a hard-light projector to transform bolts into candy corn. Happy Halloween!" category = "Holiday" item = /obj/item/gun/energy/kinetic_accelerator/crossbow/halloween - cost = 12 surplus = 0 /datum/uplink_item/device_tools/emag/hack_o_lantern diff --git a/code/modules/uplink/uplink_items.dm b/code/modules/uplink/uplink_items.dm index aef3b31895..cf663e353f 100644 --- a/code/modules/uplink/uplink_items.dm +++ b/code/modules/uplink/uplink_items.dm @@ -1,13 +1,9 @@ -GLOBAL_LIST_INIT(uplink_items, subtypesof(/datum/uplink_item)) - -/proc/get_uplink_items(var/datum/game_mode/gamemode = null, allow_sales = TRUE, allow_restricted = TRUE) - var/list/filtered_uplink_items = list() +/proc/get_uplink_items(datum/game_mode/gamemode, allow_sales = TRUE, allow_restricted = TRUE) + var/list/filtered_uplink_items = GLOB.uplink_categories.Copy() // list of uplink categories without associated values. var/list/sale_items = list() for(var/path in GLOB.uplink_items) var/datum/uplink_item/I = new path - if(!I.item) - continue if(I.include_modes.len) if(!gamemode && SSticker.mode && !(SSticker.mode.type in I.include_modes)) continue @@ -23,9 +19,8 @@ GLOBAL_LIST_INIT(uplink_items, subtypesof(/datum/uplink_item)) if (I.restricted && !allow_restricted) continue - if(!filtered_uplink_items[I.category]) - filtered_uplink_items[I.category] = list() - filtered_uplink_items[I.category][I.name] = I + LAZYSET(filtered_uplink_items[I.category], I.name, I) + if(I.limited_stock < 0 && !I.cant_discount && I.item && I.cost > 1) sale_items += I if(allow_sales) @@ -45,9 +40,12 @@ GLOBAL_LIST_INIT(uplink_items, subtypesof(/datum/uplink_item)) A.desc += " Normally costs [initial(A.cost)] TC. All sales final. [pick(disclaimer)]" A.item = I.item - if(!filtered_uplink_items[A.category]) - filtered_uplink_items[A.category] = list() - filtered_uplink_items[A.category][A.name] = A + LAZYSET(filtered_uplink_items[A.category], A.name, A) + + for(var/category in filtered_uplink_items) + if(!filtered_uplink_items[category]) //empty categories with no associated uplink item. Remove. + filtered_uplink_items -= category + return filtered_uplink_items @@ -106,16 +104,77 @@ GLOBAL_LIST_INIT(uplink_items, subtypesof(/datum/uplink_item)) to_chat(user, "[A] materializes onto the floor.") return A -//Discounts (dynamically filled above) -/datum/uplink_item/discounts - category = "Discounted Gear" +/* + Uplink Categories: + Due to how the typesof() in-built byond proc works, it should be kept in mind + the order categories are displayed in the uplink UI is same to the order they are loaded in the code. + I trust no extra filter is needed as long as they are all contained within the following lines. + When adding new uplink categories, please keep them separate from their sub paths here and without set item. + Failure to comply may result in the new categories being listed at the bottom of the UI. +*/ + +/datum/uplink_item/holiday + category = "Holiday" -//All bundles and telecrystals /datum/uplink_item/bundles_TC category = "Bundles and Telecrystals" surplus = 0 cant_discount = TRUE +/datum/uplink_item/dangerous + category = "Conspicuous and Dangerous Weapons" + +/datum/uplink_item/stealthy_weapons + category = "Stealthy and Inconspicuous Weapons" + +/datum/uplink_item/ammo + category = "Ammunition" + surplus = 40 + +/datum/uplink_item/explosives + category = "Grenades and Explosives" + +/datum/uplink_item/support + category = "Support and Mechanized Exosuits" + surplus = 0 + include_modes = list(/datum/game_mode/nuclear) + +/datum/uplink_item/suits + category = "Space Suits, Hardsuits and Clothing" + surplus = 40 + +/datum/uplink_item/stealthy_tools + category = "Stealth and Camouflage Items" + +/datum/uplink_item/device_tools + category = "Devices and Tools" + +/datum/uplink_item/implants + category = "Implants" + surplus = 50 + +/datum/uplink_item/role_restricted + category = "Role-Restricted" + exclude_modes = list(/datum/game_mode/nuclear, /datum/game_mode/nuclear/clown_ops) + surplus = 0 + +/datum/uplink_item/badass + category = "(Pointless) Badassery" + surplus = 0 + +//Discounts (dynamically filled above) +/datum/uplink_item/discounts + category = "Discounted Gear" + + +/* + Uplink Items: + Unlike categories, uplink item entries are automatically sorted alphabetically on server init in a global list, + When adding new entries to the file, please keep them sorted by category. +*/ + +//All bundles and telecrystals + /datum/uplink_item/bundles_TC/chemical name = "Bioterror bundle" desc = "For the madman: Contains a handheld Bioterror chem sprayer, a Bioterror foam grenade, a box of lethal chemicals, a dart pistol, \ @@ -288,8 +347,6 @@ GLOBAL_LIST_INIT(uplink_items, subtypesof(/datum/uplink_item)) cost = 20 // Dangerous Items -/datum/uplink_item/dangerous - category = "Conspicuous and Dangerous Weapons" /datum/uplink_item/dangerous/pistol name = "Stechkin Pistol" @@ -544,8 +601,6 @@ GLOBAL_LIST_INIT(uplink_items, subtypesof(/datum/uplink_item)) surplus = 10 // Stealthy Weapons -/datum/uplink_item/stealthy_weapons - category = "Stealthy and Inconspicuous Weapons" /datum/uplink_item/stealthy_weapons/combatglovesplus name = "Combat Gloves Plus" @@ -564,12 +619,6 @@ GLOBAL_LIST_INIT(uplink_items, subtypesof(/datum/uplink_item)) cost = 13 surplus = 0 -/datum/uplink_item/dangerous/phantomthief - name = "Syndicate Mask" - desc = "A cheap plastic mask fitted with an adrenaline autoinjector, which can be used by simply tensing your muscles" - item = /obj/item/clothing/glasses/phantomthief/syndicate - cost = 2 - /datum/uplink_item/stealthy_weapons/dart_pistol name = "Dart Pistol" desc = "A miniaturized version of a normal syringe gun. It is very quiet when fired and can fit into any \ @@ -671,9 +720,6 @@ datum/uplink_item/stealthy_weapons/taeclowndo_shoes cost = 6 // Ammunition -/datum/uplink_item/ammo - category = "Ammunition" - surplus = 40 /datum/uplink_item/ammo/pistol name = "10mm Handgun Magazine" @@ -923,8 +969,7 @@ datum/uplink_item/stealthy_weapons/taeclowndo_shoes cost = 1 include_modes = list(/datum/game_mode/nuclear) -/datum/uplink_item/explosives - category = "Grenades and Explosives" +//Grenades and Explosives /datum/uplink_item/explosives/bioterrorfoam name = "Bioterror Foam Grenade" @@ -1081,10 +1126,6 @@ datum/uplink_item/stealthy_weapons/taeclowndo_shoes //Support and Mechs -/datum/uplink_item/support - category = "Support and Mechanized Exosuits" - surplus = 0 - include_modes = list(/datum/game_mode/nuclear) /datum/uplink_item/support/clown_reinforcement name = "Clown Reinforcements" @@ -1155,8 +1196,6 @@ datum/uplink_item/stealthy_weapons/taeclowndo_shoes cost = 140 // Stealth Items -/datum/uplink_item/stealthy_tools - category = "Stealth and Camouflage Items" /datum/uplink_item/stealthy_tools/agent_card name = "Agent Identification Card" @@ -1266,17 +1305,6 @@ datum/uplink_item/stealthy_weapons/taeclowndo_shoes item = /obj/item/jammer cost = 5 -/*/datum/uplink_item/stealthy_tools/syndi_borer - name = "Syndicate Brain Slug" - desc = "A small cortical borer, modified to be completely loyal to the owner. \ - Genetically infertile, these brain slugs can assist medically in a support role, or take direct action \ - to assist their host." - item = /obj/item/antag_spawner/syndi_borer - refundable = TRUE - cost = 10 - surplus = 20 //Let's not have this be too common - exclude_modes = list(/datum/game_mode/nuclear) */ - /datum/uplink_item/stealthy_tools/smugglersatchel name = "Smuggler's Satchel" desc = "This satchel is thin enough to be hidden in the gap between plating and tiling; great for stashing \ @@ -1287,9 +1315,6 @@ datum/uplink_item/stealthy_weapons/taeclowndo_shoes surplus = 30 //Space Suits and Hardsuits -/datum/uplink_item/suits - category = "Space Suits, Hardsuits and Clothing" - surplus = 40 /datum/uplink_item/suits/turtlenck name = "Tactical Turtleneck" @@ -1364,8 +1389,6 @@ datum/uplink_item/stealthy_weapons/taeclowndo_shoes exclude_modes = list() // Devices and Tools -/datum/uplink_item/device_tools - category = "Devices and Tools" /datum/uplink_item/device_tools/emag name = "Cryptographic Sequencer" @@ -1380,6 +1403,12 @@ datum/uplink_item/stealthy_weapons/taeclowndo_shoes item = /obj/item/emagrecharge cost = 2 +/datum/uplink_item/device_tools/phantomthief + name = "Syndicate Mask" + desc = "A cheap plastic mask fitted with an adrenaline autoinjector, which can be used by simply tensing your muscles" + item = /obj/item/clothing/glasses/phantomthief/syndicate + cost = 2 + /datum/uplink_item/device_tools/cutouts name = "Adaptive Cardboard Cutouts" desc = "These cardboard cutouts are coated with a thin material that prevents discoloration and makes the images on them appear more lifelike. \ @@ -1599,9 +1628,6 @@ datum/uplink_item/stealthy_weapons/taeclowndo_shoes // Implants -/datum/uplink_item/implants - category = "Implants" - surplus = 50 /datum/uplink_item/implants/adrenal name = "Adrenal Implant" @@ -1698,10 +1724,6 @@ datum/uplink_item/stealthy_weapons/taeclowndo_shoes include_modes = list(/datum/game_mode/nuclear) // Role-specific items -/datum/uplink_item/role_restricted - category = "Role-Restricted" - exclude_modes = list(/datum/game_mode/nuclear, /datum/game_mode/nuclear/clown_ops) - surplus = 0 /datum/uplink_item/role_restricted/ancient_jumpsuit name = "Ancient Jumpsuit" @@ -1929,10 +1951,7 @@ datum/uplink_item/stealthy_weapons/taeclowndo_shoes item = /obj/item/gun/energy/emitter restricted_roles = list("Chief Engineer", "Station Engineer", "Atmospheric Technician") -// Pointless -/datum/uplink_item/badass - category = "(Pointless) Badassery" - surplus = 0 +// Pointless (Badassery) /datum/uplink_item/badass/costumes/obvious_chameleon name = "Broken Chameleon Kit" @@ -1986,12 +2005,6 @@ datum/uplink_item/stealthy_weapons/taeclowndo_shoes item = /obj/item/storage/secure/briefcase/syndie cost = 1 -/datum/uplink_item/badass/phantomthief - name = "Syndicate Mask" - desc = "A cheap plastic mask fitted with an adrenaline autoinjector, which can be used by simply tensing your muscles" - item = /obj/item/clothing/glasses/phantomthief/syndicate - cost = 2 - /datum/uplink_item/badass/syndiecards name = "Syndicate Playing Cards" desc = "A special deck of space-grade playing cards with a mono-molecular edge and metal reinforcement, \