mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-12 02:32:10 +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
69 lines
2.8 KiB
Plaintext
69 lines
2.8 KiB
Plaintext
/datum/preference/loadout
|
|
savefile_key = "loadout_list"
|
|
savefile_identifier = PREFERENCE_CHARACTER
|
|
priority = PREFERENCE_PRIORITY_LOADOUT
|
|
can_randomize = FALSE
|
|
// Loadout preference is an assoc list [item_path] = [loadout item information list]
|
|
//
|
|
// it may look something like
|
|
// - list(/obj/item/glasses = list())
|
|
// or
|
|
// - list(/obj/item/plush/lizard = list("name" = "Tests-The-Loadout", "color" = "#FF0000"))
|
|
|
|
// Loadouts are applied with job equip code.
|
|
/datum/preference/loadout/apply_to_human(mob/living/carbon/human/target, value)
|
|
return
|
|
|
|
// Sanitize on load to ensure no invalid paths from older saves get in
|
|
/datum/preference/loadout/deserialize(input, datum/preferences/preferences)
|
|
return sanitize_loadout_list(input, preferences.parent?.mob, preferences.parent) // SKYRAT EDIT CHANGE parent
|
|
|
|
// Default value is null - the loadout list is a lazylist
|
|
/datum/preference/loadout/create_default_value(datum/preferences/preferences)
|
|
return null
|
|
|
|
/datum/preference/loadout/is_valid(value)
|
|
return isnull(value) || islist(value)
|
|
|
|
/**
|
|
* Removes all invalid paths from loadout lists.
|
|
* This is a general sanitization for preference loading.
|
|
*
|
|
* Returns a list, or null if empty
|
|
*/
|
|
/datum/preference/loadout/proc/sanitize_loadout_list(list/passed_list, mob/optional_loadout_owner, client/owner_client) as /list // SKYRAT EDIT CHANGE - client/owner_client
|
|
var/list/sanitized_list
|
|
for(var/path in passed_list)
|
|
// Loading from json has each path in the list as a string that we need to convert back to typepath
|
|
var/obj/item/real_path = istext(path) ? text2path(path) : path
|
|
if(!ispath(real_path, /obj/item))
|
|
if(optional_loadout_owner)
|
|
to_chat(optional_loadout_owner, span_boldnotice("The following invalid item path was found \
|
|
in your character loadout: [real_path || "null"]. \
|
|
It has been removed, renamed, or is otherwise missing - \
|
|
You may want to check your loadout settings."))
|
|
continue
|
|
|
|
else if(!istype(GLOB.all_loadout_datums[real_path], /datum/loadout_item))
|
|
if(optional_loadout_owner)
|
|
to_chat(optional_loadout_owner, span_boldnotice("The following invalid loadout item was found \
|
|
in your character loadout: [real_path || "null"]. \
|
|
It has been removed, renamed, or is otherwise missing - \
|
|
You may want to check your loadout settings."))
|
|
continue
|
|
|
|
// SKYRAT EDIT ADDITION
|
|
else if(owner_client)
|
|
var/datum/loadout_item/loadout_item = GLOB.all_loadout_datums[real_path]
|
|
if(loadout_item?.ckeywhitelist && !(owner_client?.ckey in loadout_item.ckeywhitelist))
|
|
continue
|
|
if(loadout_item?.donator_only && !GLOB.donator_list[owner_client?.ckey])
|
|
continue
|
|
// SKYRAT EDIT END
|
|
|
|
// Set into sanitize list using converted path key
|
|
var/list/data = passed_list[path]
|
|
LAZYSET(sanitized_list, real_path, LAZYLISTDUPLICATE(data))
|
|
|
|
return sanitized_list
|