mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-11 23:23:28 +01:00
Species Refactor Fixes
This commit is contained in:
@@ -38,12 +38,11 @@
|
||||
language_keys[".[lowertext(L.key)]"] = L
|
||||
language_keys["#[lowertext(L.key)]"] = L
|
||||
|
||||
var/list/paths = subtypesof(/datum/species)
|
||||
var/rkey = 0
|
||||
for(var/T in paths)
|
||||
var/datum/species/S = new T
|
||||
for(var/spath in subtypesof(/datum/species))
|
||||
var/datum/species/S = new spath()
|
||||
S.race_key = ++rkey //Used in mob icon caching.
|
||||
all_species[S.name] = S
|
||||
GLOB.all_species[S.name] = S
|
||||
|
||||
if(IS_WHITELISTED in S.species_traits)
|
||||
whitelisted_species += S.name
|
||||
|
||||
@@ -178,7 +178,7 @@ proc/random_name(gender, species = "Human")
|
||||
|
||||
var/datum/species/current_species
|
||||
if(species)
|
||||
current_species = all_species[species]
|
||||
current_species = GLOB.all_species[species]
|
||||
|
||||
if(!current_species || current_species.name == "Human")
|
||||
if(gender==FEMALE)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//Languages/species/whitelist. //Languages and species fit with mobs right
|
||||
var/global/list/all_species[0]
|
||||
GLOBAL_LIST_EMPTY(all_species)
|
||||
var/global/list/all_languages[0]
|
||||
var/global/list/language_keys[0] // Table of say codes for all languages
|
||||
var/global/list/all_superheroes[0]
|
||||
|
||||
@@ -1010,13 +1010,13 @@
|
||||
to_chat(usr, "This can only be done to instances of type /mob/living/carbon/human")
|
||||
return
|
||||
|
||||
var/new_species = input("Please choose a new species.","Species",null) as null|anything in all_species
|
||||
var/new_species = input("Please choose a new species.","Species",null) as null|anything in GLOB.all_species
|
||||
|
||||
if(!H)
|
||||
to_chat(usr, "Mob doesn't exist anymore")
|
||||
return
|
||||
|
||||
var/datum/species/S = all_species[new_species]
|
||||
var/datum/species/S = GLOB.all_species[new_species]
|
||||
if(H.set_species(S.type))
|
||||
to_chat(usr, "Set species of [H] to [H.dna.species].")
|
||||
H.regenerate_icons()
|
||||
|
||||
@@ -246,10 +246,10 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts
|
||||
|
||||
switch(current_tab)
|
||||
if(TAB_CHAR) // Character Settings
|
||||
var/datum/species/S = all_species[species]
|
||||
var/datum/species/S = GLOB.all_species[species]
|
||||
if(!istype(S)) //The species was invalid. Set the species to the default, fetch the datum for that species and generate a random character.
|
||||
species = initial(species)
|
||||
S = all_species[species]
|
||||
S = GLOB.all_species[species]
|
||||
random_character()
|
||||
|
||||
dat += "<div class='statusDisplay' style='max-width: 128px; position: absolute; left: 150px; top: 150px'><img src=previewicon.png class='charPreview'><img src=previewicon2.png class='charPreview'></div>"
|
||||
@@ -828,7 +828,7 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts
|
||||
return 1
|
||||
|
||||
/datum/preferences/proc/ShowDisabilityState(mob/user,flag,label)
|
||||
var/datum/species/S = all_species[species]
|
||||
var/datum/species/S = GLOB.all_species[species]
|
||||
if(flag==DISABILITY_FLAG_FAT && !(CAN_BE_FAT in S.species_traits))
|
||||
return "<li><i>[species] cannot be fat.</i></li>"
|
||||
return "<li><b>[label]:</b> <a href=\"?_src_=prefs;task=input;preference=disabilities;disability=[flag]\">[disabilities & flag ? "Yes" : "No"]</a></li>"
|
||||
@@ -1053,7 +1053,7 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts
|
||||
/datum/preferences/proc/process_link(mob/user, list/href_list)
|
||||
if(!user) return
|
||||
|
||||
var/datum/species/S = all_species[species]
|
||||
var/datum/species/S = GLOB.all_species[species]
|
||||
if(href_list["preference"] == "job")
|
||||
switch(href_list["task"])
|
||||
if("close")
|
||||
@@ -1291,7 +1291,7 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts
|
||||
new_species += whitelisted_species
|
||||
|
||||
species = input("Please select a species", "Character Generation", null) in new_species
|
||||
var/datum/species/NS = all_species[species]
|
||||
var/datum/species/NS = GLOB.all_species[species]
|
||||
if(!istype(NS)) //The species was invalid. Notify the user and fail out.
|
||||
species = prev_species
|
||||
to_chat(user, "<span class='warning'>Invalid species, please pick something else.</span>")
|
||||
@@ -2083,8 +2083,8 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts
|
||||
return 1
|
||||
|
||||
/datum/preferences/proc/copy_to(mob/living/carbon/human/character)
|
||||
var/datum/species/S = all_species[species]
|
||||
character.change_species(S.type) // Yell at me if this causes everything to melt
|
||||
var/datum/species/S = GLOB.all_species[species]
|
||||
character.set_species(S.type) // Yell at me if this causes everything to melt
|
||||
if(be_random_name)
|
||||
real_name = random_name(gender,species)
|
||||
|
||||
|
||||
@@ -252,7 +252,7 @@
|
||||
autohiss_mode = text2num(query.item[52])
|
||||
|
||||
//Sanitize
|
||||
var/datum/species/SP = all_species[species]
|
||||
var/datum/species/SP = GLOB.all_species[species]
|
||||
metadata = sanitize_text(metadata, initial(metadata))
|
||||
real_name = reject_bad_name(real_name, 1)
|
||||
if(isnull(species)) species = "Human"
|
||||
|
||||
@@ -3,17 +3,6 @@
|
||||
AC.flags = flags
|
||||
AC.ui_interact(user, state = state)
|
||||
|
||||
/mob/living/carbon/human/proc/change_species(datum/species/new_species)
|
||||
if(!new_species || dna.species.type == new_species || !ispath(new_species, /datum/species))
|
||||
return FALSE
|
||||
|
||||
set_species(new_species, null, TRUE)
|
||||
reset_hair()
|
||||
if(dna.species.bodyflags & HAS_MARKINGS)
|
||||
reset_markings()
|
||||
|
||||
return TRUE
|
||||
|
||||
/mob/living/carbon/human/proc/change_gender(var/new_gender, var/update_dna = 1)
|
||||
var/obj/item/organ/external/head/H = bodyparts_by_name["head"]
|
||||
if(gender == new_gender || (gender == PLURAL && dna.species.has_gender))
|
||||
@@ -321,8 +310,8 @@
|
||||
|
||||
/mob/living/carbon/human/proc/generate_valid_species(var/check_whitelist = 1, var/list/whitelist = list(), var/list/blacklist = list())
|
||||
var/list/valid_species = new()
|
||||
for(var/current_species_name in all_species)
|
||||
var/datum/species/current_species = all_species[current_species_name]
|
||||
for(var/current_species_name in GLOB.all_species)
|
||||
var/datum/species/current_species = GLOB.all_species[current_species_name]
|
||||
|
||||
if(check_whitelist && config.usealienwhitelist && !check_rights(R_ADMIN, 0, src)) //If we're using the whitelist, make sure to check it!
|
||||
if(whitelist.len && !(current_species_name in whitelist))
|
||||
|
||||
@@ -549,7 +549,7 @@
|
||||
/mob/new_player/proc/check_prefs_are_sane()
|
||||
var/datum/species/chosen_species
|
||||
if(client.prefs.species)
|
||||
chosen_species = all_species[client.prefs.species]
|
||||
chosen_species = GLOB.all_species[client.prefs.species]
|
||||
if(!(chosen_species && (is_species_whitelisted(chosen_species) || has_admin_rights())))
|
||||
// Have to recheck admin due to no usr at roundstart. Latejoins are fine though.
|
||||
log_runtime(EXCEPTION("[src] had species [client.prefs.species], though they weren't supposed to. Setting to Human."), src)
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
/datum/preferences
|
||||
//The mob should have a gender you want before running this proc. Will run fine without H
|
||||
/datum/preferences/proc/random_character(gender_override)
|
||||
var/datum/species/S = all_species[species]
|
||||
var/datum/species/S = GLOB.all_species[species]
|
||||
if(!istype(S)) //The species was invalid. Set the species to the default, fetch the datum for that species and generate a random character.
|
||||
species = initial(species)
|
||||
S = all_species[species]
|
||||
S = GLOB.all_species[species]
|
||||
var/datum/robolimb/robohead
|
||||
|
||||
if(S.bodyflags & ALL_RPARTS)
|
||||
@@ -216,7 +216,7 @@
|
||||
if(gender == FEMALE) g = "f"
|
||||
|
||||
var/icon/icobase
|
||||
var/datum/species/current_species = all_species[species]
|
||||
var/datum/species/current_species = GLOB.all_species[species]
|
||||
|
||||
//Icon-based species colour.
|
||||
var/coloured_tail
|
||||
|
||||
@@ -31,8 +31,8 @@
|
||||
|
||||
if(href_list["race"])
|
||||
if(can_change(APPEARANCE_RACE) && (href_list["race"] in valid_species))
|
||||
var/datum/species/S = all_species[href_list["race"]]
|
||||
if(owner.change_species(S.type))
|
||||
var/datum/species/S = GLOB.all_species[href_list["race"]]
|
||||
if(owner.set_species(S.type))
|
||||
cut_and_generate_data()
|
||||
// Species change creates new organs - runtimes ahoy if we forget this
|
||||
head_organ = owner.get_organ("head")
|
||||
|
||||
Reference in New Issue
Block a user