Files
ShadowLarkens 31e8e009db Character Setup Rework (#17576)
* Character Setup Rework

Little tweaks

Species selection done~

Merk randomize body button

Body color and eye color

Merk more replaced code

Convert robolimbs to tgui

Add a warning if flavor text/ooc notes are too short

Custom preview icons for species selector!

A sidequest that only took 8
hours. Also add digitigrade and blood type.

Remove unused body_descriptor system completely

Finish the general tab~

Reorganization to prepare for loadout page creation

* Start of work on the loadout screen

* Only send the data that's actually selected

* Get rid of these ugly ../../../..

* Retype this to avoid conflicts

* Holy shit why did this work this way

* Finish loadout screen

* Add copy loadout function

* Finish occupation page

* Move Special Roles into general tab

* Fix path conflict

* Move size prefs to general tab

* Convert jukebox and volume settings to datum/preference

* Fix a little mergery fuckery in loadout

* Migrate jukebox to new range

* Fix TabbedMenu tabs

* Fix wordwrap for loadout screen

* Kill the vore tab, just traits left to convert

* Convert custom messages

* Convert custom species name

* Convert blood color and reagents

* Move icobase to tgui

* Finished

* This can fuck off too

* Fix a few bugs

* Update index.tsx

* initial for emote sound mode switch

* Make show_roles actually work, hide fluff items

* Fix not being able to select species

* Add emote_sound_mode to body tab

* Fix runtime when no active gear list is present

* Add a save notification to character setup

* Switch to floating

* Add more search bars

* Whoops forgot to add this

---------

Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
2025-05-25 03:20:51 +02:00

65 lines
2.6 KiB
Plaintext

//Pretty small file, mostly just for storage.
/datum/preferences
var/obj/item/nif/nif_path
var/nif_durability
var/list/nif_savedata
// Definition of the stuff for NIFs
// Magic bullshit, they're stored separately from everything else
/datum/category_item/player_setup_item/general/nif
name = "NIF Data"
sort_order = 8
/proc/nif_savefile_path(ckey)
if(!ckey)
return
return "data/player_saves/[copytext(ckey,1,2)]/[ckey]/nif.json"
/datum/category_item/player_setup_item/general/nif/load_character()
var/datum/json_savefile/savefile = new /datum/json_savefile(nif_savefile_path(pref.client_ckey))
var/list/save_data_file = savefile.get_entry("character[pref.default_slot]", list())
pref.nif_path = save_data_file["nif_path"]
pref.nif_durability = save_data_file["nif_durability"]
pref.nif_savedata = check_list_copy(save_data_file["nif_savedata"])
/datum/category_item/player_setup_item/general/nif/save_character()
var/datum/json_savefile/savefile = new /datum/json_savefile(nif_savefile_path(pref.client_ckey))
var/list/save_data_file = savefile.get_entry("character[pref.default_slot]", list())
save_data_file["nif_path"] = pref.nif_path
save_data_file["nif_durability"] = pref.nif_durability
save_data_file["nif_savedata"] = check_list_copy(pref.nif_savedata)
savefile.set_entry("character[pref.default_slot]", save_data_file)
savefile.save()
/datum/category_item/player_setup_item/general/nif/sanitize_character()
if(pref.nif_path && !ispath(pref.nif_path)) //We have at least a text string that should be a path.
pref.nif_path = text2path(pref.nif_path) //Try to convert it to a hard path.
if(!pref.nif_path) //If we couldn't, kill it.
pref.nif_path = null //Kill!
WARNING("Loaded a NIF but it was an invalid path, [pref.real_name]")
if (ispath(pref.nif_path, /obj/item/nif/protean) && pref.species != SPECIES_PROTEAN) //no free nifs
pref.nif_path = null
if(ispath(pref.nif_path) && isnull(pref.nif_durability)) //How'd you lose this?
pref.nif_durability = initial(pref.nif_path.durability) //Well, have a new one, my bad.
WARNING("Loaded a NIF but with no durability, [pref.real_name]")
if(!islist(pref.nif_savedata))
pref.nif_savedata = list()
/datum/category_item/player_setup_item/general/nif/copy_to_mob(var/mob/living/carbon/human/character)
//If you had a NIF...
if(istype(character) && ispath(pref.nif_path) && pref.nif_durability)
new pref.nif_path(character, pref.nif_durability, pref.nif_savedata)
/datum/category_item/player_setup_item/general/nif/tgui_data(mob/user, datum/tgui/ui, datum/tgui_state/state)
var/list/data = ..()
data["nif"] = ispath(pref.nif_path)
return data