Merge pull request #2128 from Neerti/7/13/2016_younger_synths

Allows FBPs to potentially have different age limits.
This commit is contained in:
Yoshax
2016-07-13 23:53:22 +01:00
committed by GitHub
3 changed files with 59 additions and 9 deletions

View File

@@ -29,9 +29,7 @@ datum/preferences/proc/set_biological_gender(var/gender)
S["OOC_Notes"] << pref.metadata
/datum/category_item/player_setup_item/general/basic/sanitize_character()
if(!pref.species) pref.species = "Human"
var/datum/species/S = all_species[pref.species ? pref.species : "Human"]
pref.age = sanitize_integer(pref.age, S.min_age, S.max_age, initial(pref.age))
pref.age = sanitize_integer(pref.age, get_min_age(), get_max_age(), initial(pref.age))
pref.biological_gender = sanitize_inlist(pref.biological_gender, get_genders(), pick(get_genders()))
pref.identifying_gender = (pref.identifying_gender in all_genders_define_list) ? pref.identifying_gender : pref.biological_gender
pref.real_name = sanitize_name(pref.real_name, pref.species)
@@ -75,7 +73,6 @@ datum/preferences/proc/set_biological_gender(var/gender)
. = jointext(.,null)
/datum/category_item/player_setup_item/general/basic/OnTopic(var/href,var/list/href_list, var/mob/user)
var/datum/species/S = all_species[pref.species]
if(href_list["rename"])
var/raw_name = input(user, "Choose your character's name:", "Character Name") as text|null
if (!isnull(raw_name) && CanUseTopic(user))
@@ -108,10 +105,11 @@ datum/preferences/proc/set_biological_gender(var/gender)
return TOPIC_REFRESH
else if(href_list["age"])
if(!pref.species) pref.species = "Human"
var/new_age = input(user, "Choose your character's age:\n([S.min_age]-[S.max_age])", "Character Preference", pref.age) as num|null
var/min_age = get_min_age()
var/max_age = get_max_age()
var/new_age = input(user, "Choose your character's age:\n([min_age]-[max_age])", "Character Preference", pref.age) as num|null
if(new_age && CanUseTopic(user))
pref.age = max(min(round(text2num(new_age)), S.max_age), S.min_age)
pref.age = max(min(round(text2num(new_age)), max_age), min_age)
return TOPIC_REFRESH
else if(href_list["spawnpoint"])

View File

@@ -331,8 +331,9 @@ var/global/list/valid_bloodtypes = list("A+", "A-", "B+", "B-", "AB+", "AB-", "O
reset_limbs() // Safety for species with incompatible manufacturers; easier than trying to do it case by case.
var/datum/species/S = all_species[pref.species]
pref.age = max(min(pref.age, S.max_age), S.min_age)
var/min_age = get_min_age()
var/max_age = get_max_age()
pref.age = max(min(pref.age, max_age), min_age)
return TOPIC_REFRESH_UPDATE_PREVIEW

View File

@@ -4,6 +4,10 @@
#define TOPIC_UPDATE_PREVIEW 4
#define TOPIC_REFRESH_UPDATE_PREVIEW (TOPIC_REFRESH|TOPIC_UPDATE_PREVIEW)
#define PREF_FBP_CYBORG "cyborg"
#define PREF_FBP_POSI "posi"
#define PREF_FBP_SOFTWARE "software"
/datum/category_group/player_setup_category/general_preferences
name = "General"
sort_order = 1
@@ -252,3 +256,50 @@
if(pref.client)
return pref.client.mob
// Checks in a really hacky way if a character's preferences say they are an FBP or not.
/datum/category_item/player_setup_item/proc/is_FBP()
if(pref.organ_data && pref.organ_data[BP_TORSO] != "cyborg")
return 0
return 1
// Returns what kind of FBP the player's prefs are. Returns 0 if they're not an FBP.
/datum/category_item/player_setup_item/proc/get_FBP_type()
if(!is_FBP())
return 0 // Not a robot.
switch(pref.organ_data["brain"])
if("assisted")
return PREF_FBP_CYBORG
if("mechanical")
return PREF_FBP_POSI
if("digital")
return PREF_FBP_SOFTWARE
return 0 //Something went wrong!
/datum/category_item/player_setup_item/proc/get_min_age()
var/datum/species/S = all_species[pref.species ? pref.species : "Human"]
if(!is_FBP())
return S.min_age // If they're not a robot, we can just use the species var.
var/FBP_type = get_FBP_type()
switch(FBP_type)
if(PREF_FBP_CYBORG)
return S.min_age
if(PREF_FBP_POSI)
return 1
if(PREF_FBP_SOFTWARE)
return 1
return S.min_age // welp
/datum/category_item/player_setup_item/proc/get_max_age()
var/datum/species/S = all_species[pref.species ? pref.species : "Human"]
if(!is_FBP())
return S.max_age // If they're not a robot, we can just use the species var.
var/FBP_type = get_FBP_type()
switch(FBP_type)
if(PREF_FBP_CYBORG)
return S.max_age + 20
if(PREF_FBP_POSI)
return 220
if(PREF_FBP_SOFTWARE)
return 150
return S.max_age // welp