mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-12 18:51:53 +00:00
3591 individual conflicts Update build.js Update install_node.sh Update byond.js oh my fucking god hat slow huh holy shit we all fall down 2 more I missed 2900 individual conflicts 2700 Individual conflicts replaces yarn file with tg version, bumping us down to 2200-ish Down to 2000 individual conflicts 140 down mmm aaaaaaaaaaaaaaaaaaa not yt 575 soon 900 individual conflicts 600 individual conflicts, 121 file conflicts im not okay 160 across 19 files 29 in 4 files 0 conflicts, compiletime fix time some minor incap stuff missed ticks weird dupe definition stuff missed ticks 2 incap fixes undefs and pie fix Radio update and some extra minor stuff returns a single override no more dupe definitions, 175 compiletime errors Unticked file fix sound and emote stuff honk and more radio stuff
83 lines
2.8 KiB
Plaintext
83 lines
2.8 KiB
Plaintext
/**
|
|
* # Loadout categories
|
|
*
|
|
* Loadout categories are singletons used to group loadout items together in the loadout screen.
|
|
*/
|
|
/datum/loadout_category
|
|
/// The name of the category, shown in the tabs
|
|
var/category_name
|
|
/// FontAwesome icon for the category
|
|
var/category_ui_icon
|
|
/// String to display on the top-right of a category tab
|
|
var/category_info
|
|
/// Order which they appear in the tabs, ties go alphabetically
|
|
var/tab_order = -1
|
|
/// What type of loadout items should be generated for this category?
|
|
var/type_to_generate
|
|
/// List of all loadout items in this category
|
|
VAR_FINAL/list/datum/loadout_item/associated_items
|
|
|
|
/datum/loadout_category/New()
|
|
. = ..()
|
|
associated_items = get_items()
|
|
for(var/datum/loadout_item/item as anything in associated_items)
|
|
if(GLOB.all_loadout_datums[item.item_path])
|
|
stack_trace("Loadout datum collision - [item.item_path] is shared between multiple loadout datums.")
|
|
GLOB.all_loadout_datums[item.item_path] = item
|
|
|
|
/datum/loadout_category/Destroy(force, ...)
|
|
if(!force)
|
|
stack_trace("QDEL called on loadout category [type]. This shouldn't ever happen. (Use FORCE if necessary.)")
|
|
return QDEL_HINT_LETMELIVE
|
|
|
|
associated_items.Cut()
|
|
return ..()
|
|
|
|
/// Return a list of all /datum/loadout_items in this category.
|
|
/datum/loadout_category/proc/get_items() as /list
|
|
var/list/all_items = list()
|
|
for(var/datum/loadout_item/found_type as anything in typesof(type_to_generate))
|
|
if(found_type == initial(found_type.abstract_type))
|
|
continue
|
|
|
|
if(!initial(found_type.item_path)) // SKYRAT EDIT ADDITION
|
|
continue
|
|
|
|
if(!ispath(initial(found_type.item_path), /obj/item))
|
|
stack_trace("Loadout get_items(): Attempted to instantiate a loadout item ([found_type]) with an invalid or null typepath! (got path: [initial(found_type.item_path)])")
|
|
continue
|
|
|
|
var/datum/loadout_item/spawned_type = new found_type(src)
|
|
all_items += spawned_type
|
|
|
|
return all_items
|
|
|
|
/// Returns a list of all /datum/loadout_items in this category, formatted for UI use. Only ran once.
|
|
/datum/loadout_category/proc/items_to_ui_data() as /list
|
|
if(!length(associated_items))
|
|
return list()
|
|
|
|
var/list/formatted_list = list()
|
|
|
|
for(var/datum/loadout_item/item as anything in associated_items)
|
|
var/list/item_data = item.to_ui_data()
|
|
UNTYPED_LIST_ADD(formatted_list, item_data)
|
|
|
|
sortTim(formatted_list, /proc/cmp_assoc_list_name) // Alphabetizing
|
|
return formatted_list
|
|
|
|
/**
|
|
* Handles what happens when two items of this category are selected at once
|
|
*
|
|
* Return TRUE if it's okay to continue with adding the incoming item,
|
|
* or return FALSE to stop the new item from being added
|
|
*/
|
|
/datum/loadout_category/proc/handle_duplicate_entires(
|
|
datum/preference_middleware/loadout/manager,
|
|
datum/loadout_item/conflicting_item,
|
|
datum/loadout_item/added_item,
|
|
list/datum/loadout_item/all_loadout_items,
|
|
)
|
|
manager.deselect_item(conflicting_item)
|
|
return TRUE
|