Files
Bubberstation/code/modules/client/preferences/migrations/quirk_loadout_migration.dm
SkyratBot 58ab268888 [MIRROR] Adds Character Loadout Tab to preferences (with just a small handful of items to start) (#28126)
* Adds Character Loadout Tab to preferences (with just a small handful of items to start)

* step one rip out all the old nasties

* fixes, current bugs: donator lock, ckey lock, one item in case

* opps

* sanity checks, fixed, donator implementation, ckey locking. fixes.

* wew

* final fixes

* Update loadout_categories.dm

* Update loadout_items.dm

* Update loadout_items.dm

* Update declarations.dm

---------

Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com>
Co-authored-by: Gandalf <9026500+Gandalf2k15@users.noreply.github.com>
Co-authored-by: SpaceLoveSs13 <68121607+SpaceLoveSs13@users.noreply.github.com>
2024-06-22 22:09:03 +01:00

28 lines
1.1 KiB
Plaintext

/**
* Move quirk items into loadout items
*
* If this is accompanied with removal of a quirk,
* you don't need to worry about handling that here -
* quirk sanitization happens AFTER migration
*/
/datum/preferences/proc/migrate_quirk_to_loadout(quirk_to_migrate, new_typepath, list/data_to_migrate)
ASSERT(istext(quirk_to_migrate) && ispath(new_typepath, /obj/item))
if(quirk_to_migrate in all_quirks)
add_loadout_item(new_typepath, data_to_migrate)
/// Helper for slotting in a new loadout item
/datum/preferences/proc/add_loadout_item(typepath, list/data = list())
PRIVATE_PROC(TRUE)
var/list/loadout_list = read_preference(/datum/preference/loadout) || list()
loadout_list[typepath] = data
write_preference(GLOB.preference_entries[/datum/preference/loadout], loadout_list)
/// Helper for removing a loadout item
/datum/preferences/proc/remove_loadout_item(typepath)
PRIVATE_PROC(TRUE)
var/list/loadout_list = read_preference(/datum/preference/loadout)
if(loadout_list?.Remove(typepath))
write_preference(GLOB.preference_entries[/datum/preference/loadout], loadout_list)