Merge pull request #9805 from Ghommie/Ghommie-cit352

Uplink items are now automatically sorted alphabetically.
This commit is contained in:
kevinz000
2019-12-05 21:40:09 -07:00
committed by GitHub
5 changed files with 99 additions and 72 deletions
+1 -2
View File
@@ -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
+83 -70
View File
@@ -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, \