mirror of
https://github.com/SPLURT-Station/S.P.L.U.R.T-Station-13.git
synced 2025-12-11 10:22:13 +00:00
subcategories work
This commit is contained in:
@@ -12,7 +12,6 @@
|
||||
|
||||
//mask
|
||||
#define CATEGORY_MASK "Mask"
|
||||
#define SUBCATEGORY_MASK_DONATOR "Donator"
|
||||
|
||||
//hands
|
||||
#define CATEGORY_HANDS "Hands"
|
||||
|
||||
13
code/_globalvars/lists/loadout_categories.dm
Normal file
13
code/_globalvars/lists/loadout_categories.dm
Normal file
@@ -0,0 +1,13 @@
|
||||
GLOBAL_LIST_INIT(loadout_categories, list(
|
||||
CATEGORY_BACKPACK = list(SUBCATEGORY_BACKPACK_GENERAL, SUBCATEGORY_BACKPACK_TOYS),
|
||||
CATEGORY_NECK = list(SUBCATEGORY_NECK_GENERAL, SUBCATEGORY_NECK_TIE, SUBCATEGORY_NECK_SCARVES),
|
||||
CATEGORY_MASK = list("NOSUBCATEGORY"),
|
||||
CATEGORY_HANDS = list("NOSUBCATEGORY"),
|
||||
CATEGORY_UNIFORM = list(SUBCATEGORY_UNIFORM_GENERAL, SUBCATEGORY_UNIFORM_JOBS),
|
||||
CATEGORY_SUIT = list(SUBCATEGORY_SUIT_GENERAL, SUBCATEGORY_SUIT_COATS, SUBCATEGORY_SUIT_JACKETS, SUBCATEGORY_SUIT_JOBS),
|
||||
CATEGORY_HEAD = list(SUBCATEGORY_HEAD_GENERAL, SUBCATEGORY_HEAD_JOBS),
|
||||
CATEGORY_SHOES = list("NOSUBCATEGORY"),
|
||||
CATEGORY_GLOVES = list("NOSUBCATEGORY"),
|
||||
CATEGORY_GLASSES = list("NOSUBCATEGORY"),
|
||||
CATEGORY_DONATOR = list("NOSUBCATEGORY")
|
||||
))
|
||||
@@ -39,8 +39,6 @@ GLOBAL_LIST_EMPTY(preferences_datums)
|
||||
var/tmp/old_be_special = 0 //Bitflag version of be_special, used to update old savefiles and nothing more
|
||||
//If it's 0, that's good, if it's anything but 0, the owner of this prefs file's antag choices were,
|
||||
//autocorrected this round, not that you'd need to check that.
|
||||
|
||||
|
||||
var/UI_style = null
|
||||
var/buttons_locked = FALSE
|
||||
var/hotkeys = FALSE
|
||||
@@ -53,7 +51,6 @@ GLOBAL_LIST_EMPTY(preferences_datums)
|
||||
/// List with a key string associated to a list of keybindings. Unlike key_bindings, this one operates on raw key, allowing for binding a key that triggers regardless of if a modifier is depressed as long as the raw key is sent.
|
||||
var/list/modless_key_bindings = list()
|
||||
|
||||
|
||||
var/tgui_fancy = TRUE
|
||||
var/tgui_lock = TRUE
|
||||
var/windowflashing = TRUE
|
||||
@@ -231,6 +228,8 @@ GLOBAL_LIST_EMPTY(preferences_datums)
|
||||
var/list/gear_categories
|
||||
var/list/chosen_gear = list()
|
||||
var/gear_tab
|
||||
var/category = 1
|
||||
var/subcategory = 1
|
||||
|
||||
var/screenshake = 100
|
||||
var/damagescreenshake = 2
|
||||
@@ -1059,32 +1058,45 @@ GLOBAL_LIST_EMPTY(preferences_datums)
|
||||
dat += "<br>"
|
||||
|
||||
if(3)
|
||||
if(!gear_tab)
|
||||
gear_tab = GLOB.loadout_items[1]
|
||||
dat += "<table align='center' width='100%'>"
|
||||
dat += "<tr><td colspan=4><center><b><font color='[gear_points == 0 ? "#E62100" : "#CCDDFF"]'>[gear_points]</font> loadout points remaining.</b> \[<a href='?_src_=prefs;preference=gear;clear_loadout=1'>Clear Loadout</a>\]</center></td></tr>"
|
||||
dat += "<tr><td colspan=4><center>You can only choose one item per category, unless it's an item that spawns in your backpack or hands.</center></td></tr>"
|
||||
dat += "<tr><td colspan=4><center><b>"
|
||||
var/firstcat = TRUE
|
||||
for(var/i in GLOB.loadout_items)
|
||||
if(firstcat)
|
||||
firstcat = FALSE
|
||||
else
|
||||
dat += " |"
|
||||
if(i == gear_tab)
|
||||
var/category_section = GLOB.loadout_categories[category]
|
||||
var/subcategory_section = GLOB.loadout_categories[category_section][subcategory]
|
||||
var/category_index = 1
|
||||
for(var/i in GLOB.loadout_categories)
|
||||
if(category_index != 1)
|
||||
dat += "<br>"
|
||||
if(category_index == category)
|
||||
dat += " <span class='linkOn'>[i]</span> "
|
||||
else
|
||||
dat += " <a href='?_src_=prefs;preference=gear;select_category=[i]'>[i]</a> "
|
||||
dat += " <a href='?_src_=prefs;preference=gear;select_category=[category_index]'>[i]</a> "
|
||||
category_index += 1
|
||||
dat += "</b></center></td></tr>"
|
||||
dat += "<tr><td colspan=4><hr></td></tr>"
|
||||
dat += "<tr><td colspan=4><b><center>[gear_tab]</center></b></td></tr>"
|
||||
dat += "<tr><td colspan=4><hr></td></tr>"
|
||||
var/subcategory_index = 1
|
||||
for(var/i in GLOB.loadout_categories[category_section])
|
||||
if(i == "NOSUBCATEGORY")
|
||||
continue
|
||||
if(subcategory_index != 1)
|
||||
dat += " |"
|
||||
if(subcategory_index == subcategory)
|
||||
dat += " <span class='linkOn'>[i]</span> "
|
||||
else
|
||||
dat += " <a href='?_src_=prefs;preference=gear;select_subcategory=[subcategory_index]'>[i]</a> "
|
||||
subcategory_index += 1
|
||||
|
||||
dat += "<tr width=10% style='vertical-align:top;'><td width=15%><b>Name</b></td>"
|
||||
dat += "<td style='vertical-align:top'><b>Cost</b></td>"
|
||||
dat += "<td width=10%><font size=2><b>Restrictions</b></font></td>"
|
||||
dat += "<td width=80%><font size=2><b>Description</b></font></td></tr>"
|
||||
for(var/j in GLOB.loadout_items[gear_tab])
|
||||
var/datum/gear/gear = GLOB.loadout_items[gear_tab][j]
|
||||
for(var/j in GLOB.loadout_items[category_section][subcategory_section])
|
||||
var/datum/gear/gear = GLOB.loadout_items[category_section][subcategory_section][j]
|
||||
if(!gear.name)
|
||||
continue
|
||||
var/donoritem = gear.donoritem
|
||||
if(donoritem && !gear.donator_ckey_check(user.ckey))
|
||||
continue
|
||||
@@ -2687,11 +2699,14 @@ GLOBAL_LIST_EMPTY(preferences_datums)
|
||||
gear_points = CONFIG_GET(number/initial_gear_points)
|
||||
save_preferences()
|
||||
if(href_list["select_category"])
|
||||
for(var/i in GLOB.loadout_items)
|
||||
if(i == href_list["select_category"])
|
||||
gear_tab = i
|
||||
category = text2num(href_list["select_category"])
|
||||
message_admins(category)
|
||||
if(href_list["select_subcategory"])
|
||||
subcategory = text2num(href_list["select_subcategory"])
|
||||
if(href_list["toggle_gear_path"])
|
||||
var/datum/gear/G = GLOB.loadout_items[gear_tab][html_decode(href_list["toggle_gear_path"])]
|
||||
var/category_section = GLOB.loadout_categories[category]
|
||||
var/subcategory_section = GLOB.loadout_categories[category_section][subcategory]
|
||||
var/datum/gear/G = GLOB.loadout_items[category_section][subcategory_section][html_decode(href_list["toggle_gear_path"])]
|
||||
if(!G)
|
||||
return
|
||||
var/toggle = text2num(href_list["toggle_gear"])
|
||||
|
||||
@@ -230,7 +230,7 @@
|
||||
path = /obj/item/toy/darksabre
|
||||
ckeywhitelist = list("inferno707")
|
||||
|
||||
datum/gear/darksabresheath
|
||||
/datum/gear/donator/darksabresheath
|
||||
name = "Dark Sabre Sheath"
|
||||
slot = SLOT_IN_BACKPACK
|
||||
path = /obj/item/storage/belt/sabre/darksabre
|
||||
|
||||
@@ -26,15 +26,11 @@ GLOBAL_LIST_EMPTY(loadout_whitelist_ids)
|
||||
|
||||
/proc/initialize_global_loadout_items()
|
||||
load_loadout_config()
|
||||
LAZYINITLIST(GLOB.loadout_items["NOSUBCATEGORY"]) //items without a subcategory just have one that doesnt show
|
||||
for(var/item in subtypesof(/datum/gear))
|
||||
var/datum/gear/I = new item
|
||||
LAZYINITLIST(GLOB.loadout_items[I.category])
|
||||
if(I.subcategory)
|
||||
LAZYINITLIST(GLOB.loadout_items[I.category][I.subcategory])
|
||||
GLOB.loadout_items[I.category][I.subcategory][I.name] = I
|
||||
else
|
||||
GLOB.loadout_items[I.category]["NOSUBCATEGORY"][I.name] = I
|
||||
if(islist(I.geargroupID))
|
||||
var/list/ggidlist = I.geargroupID
|
||||
I.ckeywhitelist = list()
|
||||
@@ -47,8 +43,8 @@ GLOBAL_LIST_EMPTY(loadout_whitelist_ids)
|
||||
|
||||
/datum/gear
|
||||
var/name
|
||||
var/category
|
||||
var/subcategory
|
||||
var/category = "NOCATEGORY"
|
||||
var/subcategory = "NOSUBCATEGORY"
|
||||
var/slot
|
||||
var/description
|
||||
var/path //item-to-spawn path
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
|
||||
/datum/gear/head/nursehat
|
||||
name = "Nurse Hat"
|
||||
category = SLOT_HEAD
|
||||
path = /obj/item/clothing/head/nursehat
|
||||
subcategory = SUBCATEGORY_HEAD_JOBS
|
||||
restricted_roles = list("Medical Doctor", "Chief Medical Officer", "Geneticist", "Chemist", "Virologist")
|
||||
@@ -40,7 +39,6 @@
|
||||
|
||||
/datum/gear/uniform/nursesuit
|
||||
name = "Nurse Suit"
|
||||
category = SLOT_W_UNIFORM
|
||||
path = /obj/item/clothing/under/rank/medical/doctor/nurse
|
||||
subcategory = SUBCATEGORY_UNIFORM_JOBS
|
||||
restricted_roles = list("Medical Doctor", "Chief Medical Officer", "Geneticist", "Chemist", "Virologist")
|
||||
|
||||
@@ -64,36 +64,36 @@
|
||||
path = /obj/item/storage/crayons
|
||||
subcategory = SUBCATEGORY_BACKPACK_TOYS
|
||||
|
||||
/datum/gear/multipen
|
||||
/datum/gear/backpack/multipen
|
||||
name = "A multicolored pen"
|
||||
path = /obj/item/pen/fourcolor
|
||||
|
||||
/datum/gear/fountainpen
|
||||
/datum/gear/backpack/fountainpen
|
||||
name = "A fancy pen"
|
||||
path = /obj/item/pen/fountain
|
||||
cost = 2
|
||||
|
||||
/datum/gear/modular_tablet
|
||||
/datum/gear/backpack/modular_tablet
|
||||
name = "A modular tablet"
|
||||
path = /obj/item/modular_computer/tablet/preset/cheap/
|
||||
cost = 4
|
||||
|
||||
/datum/gear/modular_laptop
|
||||
/datum/gear/backpack/modular_laptop
|
||||
name = "A modular laptop"
|
||||
path = /obj/item/modular_computer/laptop/preset/civilian
|
||||
cost = 7
|
||||
|
||||
/datum/gear/ringbox_gold
|
||||
/datum/gear/backpack/ringbox_gold
|
||||
name = "A gold ring box"
|
||||
path = /obj/item/storage/fancy/ringbox
|
||||
cost = 3
|
||||
|
||||
/datum/gear/ringbox_silver
|
||||
/datum/gear/backpack/ringbox_silver
|
||||
name = "A silver ring box"
|
||||
path = /obj/item/storage/fancy/ringbox/silver
|
||||
cost = 3
|
||||
|
||||
/datum/gear/ringbox_diamond
|
||||
/datum/gear/backpack/ringbox_diamond
|
||||
name = "A diamond ring box"
|
||||
path = /obj/item/storage/fancy/ringbox/diamond
|
||||
cost = 5
|
||||
|
||||
@@ -1,53 +1,53 @@
|
||||
/datum/gear/hands
|
||||
category = CATEGORY_HANDS
|
||||
|
||||
/datum/gear/cane
|
||||
/datum/gear/hands/cane
|
||||
name = "Cane"
|
||||
path = /obj/item/cane
|
||||
|
||||
/datum/gear/cigarettes
|
||||
/datum/gear/hands/cigarettes
|
||||
name = "Cigarette pack"
|
||||
path = /obj/item/storage/fancy/cigarettes
|
||||
|
||||
/datum/gear/dice
|
||||
/datum/gear/hands/dice
|
||||
name = "Dice bag"
|
||||
path = /obj/item/storage/box/dice
|
||||
|
||||
/datum/gear/eightball
|
||||
/datum/gear/hands/eightball
|
||||
name = "Magic eightball"
|
||||
path = /obj/item/toy/eightball
|
||||
|
||||
/datum/gear/matches
|
||||
/datum/gear/hands/matches
|
||||
name = "Matchbox"
|
||||
path = /obj/item/storage/box/matches
|
||||
|
||||
/datum/gear/cheaplighter
|
||||
/datum/gear/hands/cheaplighter
|
||||
name = "Cheap lighter"
|
||||
path = /obj/item/lighter/greyscale
|
||||
|
||||
/datum/gear/cards
|
||||
/datum/gear/hands/cards
|
||||
name = "Playing cards"
|
||||
path = /obj/item/toy/cards/deck
|
||||
|
||||
/datum/gear/skub
|
||||
/datum/gear/hands/skub
|
||||
name = "Skub"
|
||||
path = /obj/item/skub
|
||||
|
||||
/datum/gear/wallet
|
||||
/datum/gear/hands/wallet
|
||||
name = "Wallet"
|
||||
path = /obj/item/storage/wallet
|
||||
|
||||
/datum/gear/flask
|
||||
/datum/gear/hands/flask
|
||||
name = "Flask"
|
||||
path = /obj/item/reagent_containers/food/drinks/flask
|
||||
cost = 2
|
||||
|
||||
/datum/gear/zippolighter
|
||||
/datum/gear/hands/zippolighter
|
||||
name = "Zippo Lighter"
|
||||
path = /obj/item/lighter
|
||||
cost = 2
|
||||
|
||||
/datum/gear/cigar
|
||||
/datum/gear/hands/cigar
|
||||
name = "Cigar"
|
||||
path = /obj/item/clothing/mask/cigarette/cigar
|
||||
cost = 4 //smoking is bad mkay
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
/datum/gear/neck/redtie
|
||||
name = "Red tie"
|
||||
category = SLOT_NECK
|
||||
subcategory = SUBCATEGORY_NECK_TIE
|
||||
path = /obj/item/clothing/neck/tie/red
|
||||
|
||||
/datum/gear/neck/blacktie
|
||||
@@ -80,10 +80,8 @@
|
||||
|
||||
/datum/gear/neck/headphones
|
||||
name = "Headphones"
|
||||
category = SLOT_NECK
|
||||
path = /obj/item/clothing/ears/headphones
|
||||
|
||||
/datum/gear/neck/polycloak
|
||||
name = "Polychromatic Cloak"
|
||||
category = SLOT_NECK
|
||||
path = /obj/item/clothing/neck/cloak/polychromic
|
||||
|
||||
@@ -201,6 +201,7 @@
|
||||
#include "code\_globalvars\lists\client.dm"
|
||||
#include "code\_globalvars\lists\flavor_misc.dm"
|
||||
#include "code\_globalvars\lists\keybindings.dm"
|
||||
#include "code\_globalvars\lists\loadout_categories.dm"
|
||||
#include "code\_globalvars\lists\maintenance_loot.dm"
|
||||
#include "code\_globalvars\lists\mapping.dm"
|
||||
#include "code\_globalvars\lists\medals.dm"
|
||||
|
||||
Reference in New Issue
Block a user