mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-07-19 02:56:14 +01:00
Convert species, organ_data, and rlimb_data to TG (#19277)
* First test batch bulk change * remove desync'd old file * Small change
This commit is contained in:
@@ -11,15 +11,17 @@
|
||||
|
||||
/// FBP check
|
||||
/datum/preference/choiced/gender/proc/is_fbp(datum/preferences/preferences)
|
||||
if(!preferences?.organ_data)
|
||||
var/list/organ_data = preferences?.read_preference(/datum/preference/organ_data)
|
||||
if(!organ_data)
|
||||
return FALSE
|
||||
return preferences.organ_data[BP_TORSO] == "cyborg"
|
||||
return organ_data[BP_TORSO] == "cyborg"
|
||||
|
||||
/// Get the list of valid bio genders for the species
|
||||
/datum/preference/choiced/gender/proc/get_valid_biological_genders(datum/preferences/preferences)
|
||||
var/datum/species/S
|
||||
if(preferences?.species)
|
||||
S = GLOB.all_species[preferences.species]
|
||||
var/species_name = preferences?.read_preference(/datum/preference/choiced/species)
|
||||
if(species_name)
|
||||
S = GLOB.all_species[species_name]
|
||||
if(!S)
|
||||
S = GLOB.all_species[SPECIES_HUMAN]
|
||||
var/list/possible_genders = S.genders
|
||||
|
||||
@@ -11,9 +11,10 @@
|
||||
|
||||
/// Check if the character is a Full Body Prosthetic (allows numbers in name)
|
||||
/datum/preference/name/proc/is_fbp(datum/preferences/preferences)
|
||||
if(!preferences?.organ_data)
|
||||
var/list/organ_data = preferences?.read_preference(/datum/preference/organ_data)
|
||||
if(!organ_data)
|
||||
return FALSE
|
||||
return preferences.organ_data[BP_TORSO] == "cyborg"
|
||||
return organ_data[BP_TORSO] == "cyborg"
|
||||
|
||||
/datum/preference/name/is_valid(value)
|
||||
if(!istext(value))
|
||||
@@ -26,8 +27,8 @@
|
||||
if(!istext(input))
|
||||
return create_default_value()
|
||||
var/species = default_species
|
||||
if(preferences?.species)
|
||||
species = preferences.species
|
||||
if(preferences)
|
||||
species = preferences.read_preference(/datum/preference/choiced/species)
|
||||
var/allow_numbers = is_fbp(preferences)
|
||||
var/sanitized = sanitize_name(input, species, allow_numbers)
|
||||
if(!sanitized)
|
||||
@@ -63,7 +64,7 @@
|
||||
|
||||
/datum/preference/name/real_name/create_informed_default_value(datum/preferences/preferences)
|
||||
var/gender = preferences?.read_preference(/datum/preference/choiced/gender/identifying) || MALE
|
||||
var/species = preferences?.species || SPECIES_HUMAN
|
||||
var/species = preferences?.read_preference(/datum/preference/choiced/species) || SPECIES_HUMAN
|
||||
return random_name(gender, species)
|
||||
|
||||
/datum/preference/name/real_name/create_random_value(datum/preferences/preferences, datum/species/current_species)
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
// Organ data preference for character creation
|
||||
// Stores an assoc list mapping organ tags to their prosthetic/modified status.
|
||||
// Values can be: null (normal), "cyborg", "amputated", FBP_ASSISTED, FBP_MECHANICAL, or FBP_DIGITAL.
|
||||
|
||||
/datum/preference/organ_data
|
||||
savefile_key = "organ_data"
|
||||
savefile_identifier = PREFERENCE_CHARACTER
|
||||
category = PREFERENCE_CATEGORY_MANUALLY_RENDERED
|
||||
can_randomize = FALSE
|
||||
|
||||
/datum/preference/organ_data/create_default_value()
|
||||
return list()
|
||||
|
||||
/datum/preference/organ_data/pref_deserialize(input, datum/preferences/preferences)
|
||||
if(!islist(input))
|
||||
return list()
|
||||
// Return the list directly (same reference) so in-place mutations update the cache.
|
||||
return input
|
||||
|
||||
/datum/preference/organ_data/pref_serialize(input)
|
||||
if(!islist(input))
|
||||
return list()
|
||||
return check_list_copy(input)
|
||||
|
||||
/datum/preference/organ_data/is_valid(value)
|
||||
return islist(value)
|
||||
|
||||
/datum/preference/organ_data/apply_to_human(mob/living/carbon/human/target, value)
|
||||
return // Organ application is handled by copy_to_mob in 03_body.dm
|
||||
|
||||
/datum/preference/organ_data/apply_to_living(mob/living/target, value)
|
||||
return
|
||||
|
||||
/datum/preference/organ_data/apply_to_silicon(mob/living/silicon/target, value)
|
||||
return
|
||||
|
||||
/datum/preference/organ_data/apply_to_animal(mob/living/simple_mob/target, value)
|
||||
return
|
||||
@@ -0,0 +1,42 @@
|
||||
// Robolimb data preference for character creation
|
||||
// Stores an assoc list mapping organ tags to robolimb manufacturer model names.
|
||||
// Values are strings corresponding to keys in GLOB.all_robolimbs.
|
||||
|
||||
/datum/preference/rlimb_data
|
||||
savefile_key = "rlimb_data"
|
||||
savefile_identifier = PREFERENCE_CHARACTER
|
||||
category = PREFERENCE_CATEGORY_MANUALLY_RENDERED
|
||||
can_randomize = FALSE
|
||||
|
||||
/datum/preference/rlimb_data/create_default_value()
|
||||
return list()
|
||||
|
||||
/datum/preference/rlimb_data/pref_deserialize(input, datum/preferences/preferences)
|
||||
if(!islist(input))
|
||||
return list()
|
||||
// Sanitize: remove entries with invalid robolimb keys
|
||||
for(var/limb in input)
|
||||
var/key = input[limb]
|
||||
if(!istext(key) || !LAZYACCESS(GLOB.all_robolimbs, key))
|
||||
input -= limb
|
||||
return input
|
||||
|
||||
/datum/preference/rlimb_data/pref_serialize(input)
|
||||
if(!islist(input))
|
||||
return list()
|
||||
return check_list_copy(input)
|
||||
|
||||
/datum/preference/rlimb_data/is_valid(value)
|
||||
return islist(value)
|
||||
|
||||
/datum/preference/rlimb_data/apply_to_human(mob/living/carbon/human/target, value)
|
||||
return // Robolimb application is handled by copy_to_mob in 03_body.dm
|
||||
|
||||
/datum/preference/rlimb_data/apply_to_living(mob/living/target, value)
|
||||
return
|
||||
|
||||
/datum/preference/rlimb_data/apply_to_silicon(mob/living/silicon/target, value)
|
||||
return
|
||||
|
||||
/datum/preference/rlimb_data/apply_to_animal(mob/living/simple_mob/target, value)
|
||||
return
|
||||
@@ -0,0 +1,38 @@
|
||||
// Species preference for character creation
|
||||
// Handles the player's selected species, validated against GLOB.playable_species.
|
||||
|
||||
/datum/preference/choiced/species
|
||||
savefile_key = "species"
|
||||
savefile_identifier = PREFERENCE_CHARACTER
|
||||
category = PREFERENCE_CATEGORY_MANUALLY_RENDERED
|
||||
can_randomize = FALSE
|
||||
priority = PREFERENCE_PRIORITY_SPECIES
|
||||
|
||||
/datum/preference/choiced/species/init_possible_values()
|
||||
// GLOB.playable_species is populated at world init and contains all joinable species names.
|
||||
return GLOB.playable_species
|
||||
|
||||
/datum/preference/choiced/species/create_default_value()
|
||||
return SPECIES_HUMAN
|
||||
|
||||
/datum/preference/choiced/species/pref_deserialize(input, datum/preferences/preferences)
|
||||
if(!input || !istext(input) || !(input in GLOB.playable_species))
|
||||
return SPECIES_HUMAN
|
||||
return input
|
||||
|
||||
/datum/preference/choiced/species/is_valid(value)
|
||||
if(!istext(value))
|
||||
return FALSE
|
||||
return value in GLOB.playable_species
|
||||
|
||||
/datum/preference/choiced/species/apply_to_human(mob/living/carbon/human/target, value)
|
||||
return // Species application is handled by copy_to via character.set_species()
|
||||
|
||||
/datum/preference/choiced/species/apply_to_living(mob/living/target, value)
|
||||
return
|
||||
|
||||
/datum/preference/choiced/species/apply_to_silicon(mob/living/silicon/target, value)
|
||||
return
|
||||
|
||||
/datum/preference/choiced/species/apply_to_animal(mob/living/simple_mob/target, value)
|
||||
return
|
||||
Reference in New Issue
Block a user