fixes/improvements to species picking + fixes some cases where you can't see your inventory when joining as a ghostrole (#4701)

Co-authored-by: VM_USER <VM_USER>
This commit is contained in:
silicons
2022-11-12 19:10:59 +01:00
committed by GitHub
co-authored by VM_USER <VM_USER>
parent 4033c767c2
commit 1d2f7ea70f
57 changed files with 215 additions and 137 deletions
@@ -26,7 +26,9 @@
character_species_lookup = list()
for(var/path in species_paths)
var/datum/species/S = species_paths[path]
if(!(S.species_spawn_flags & SPECIES_SPAWN_ALLOWED)) // don't bother lmao
if(S.species_spawn_flags & (SPECIES_SPAWN_SPECIAL)) // don't bother
continue
if(!(S.species_spawn_flags & (SPECIES_SPAWN_CHARACTER))) // don't bother
continue
if(!S.uid)
stack_trace("no species ID on [S.type].")
@@ -44,7 +46,10 @@
stack_trace("ignoring custom character species path [path] - collides on uid [S.uid]")
continue
character_species_lookup[S.uid] = S
tim_sort(character_species_lookup, /proc/cmp_auto_compare, TRUE)
rebuild_character_species_ui_cache()
/datum/controller/subsystem/characters/proc/rebuild_character_species_ui_cache()
// make species data cache
character_species_cache = list()
for(var/id in character_species_lookup)
@@ -52,7 +57,7 @@
LAZYINITLIST(character_species_cache[S.category])
character_species_cache[S.category] += list(list(
"id" = S.uid,
"whitelisted" = S.whitelisted,
"spawn_flags" = S.species_spawn_flags,
"name" = S.name,
"desc" = S.desc,
"appearance_flags" = S.species_appearance_flags,
@@ -60,8 +65,6 @@
"category" = S.category, // note to self optimize this
))
tim_sort(character_species_lookup, /proc/cmp_auto_compare, TRUE)
/datum/controller/subsystem/characters/proc/resolve_character_species(uid)
RETURN_TYPE(/datum/character_species)
return character_species_lookup[uid]
@@ -43,9 +43,9 @@
if(S.species_spawn_flags & SPECIES_SPAWN_WHITELISTED)
whitelisted_species += S.name
if(!(S.species_spawn_flags & SPECIES_SPAWN_RESTRICTED))
if(!(S.species_spawn_flags & SPECIES_SPAWN_SPECIAL))
playable_species += S.name
if((!(S.species_spawn_flags & (SPECIES_SPAWN_WHITELISTED | SPECIES_SPAWN_RESTRICTED)) && !(S.get_species_id() in blacklisted_icon_ids)) || (S.get_species_id() in whitelisted_icon_ids))
if((!(S.species_spawn_flags & (SPECIES_SPAWN_WHITELISTED | SPECIES_SPAWN_SPECIAL)) && !(S.get_species_id() in blacklisted_icon_ids)) || (S.get_species_id() in whitelisted_icon_ids))
custom_species_bases += S.name
tim_sort(species_lookup, /proc/cmp_auto_compare, TRUE)