Files
CHOMPStation2/code/_helpers/global_lists.dm
2021-07-04 00:38:04 +00:00

309 lines
12 KiB
Plaintext

//Since it didn't really belong in any other category, I'm putting this here
//This is for procs to replace all the goddamn 'in world's that are chilling around the code
var/global/list/player_list = list() //List of all mobs **with clients attached**. Excludes /mob/new_player
var/global/list/mob_list = list() //List of all mobs, including clientless
var/global/list/human_mob_list = list() //List of all human mobs and sub-types, including clientless
var/global/list/silicon_mob_list = list() //List of all silicon mobs, including clientless
var/global/list/ai_list = list() //List of all AIs, including clientless
var/global/list/living_mob_list = list() //List of all alive mobs, including clientless. Excludes /mob/new_player
var/global/list/dead_mob_list = list() //List of all dead mobs, including clientless. Excludes /mob/new_player
var/global/list/observer_mob_list = list() //List of all /mob/observer/dead, including clientless.
var/global/list/listening_objects = list() //List of all objects which care about receiving messages (communicators, radios, etc)
var/global/list/cleanbot_reserved_turfs = list() //List of all turfs currently targeted by some cleanbot
var/global/list/cable_list = list() //Index for all cables, so that powernets don't have to look through the entire world all the time
var/global/list/landmarks_list = list() //list of all landmarks created
var/global/list/surgery_steps = list() //list of all surgery steps |BS12
var/global/list/side_effects = list() //list of all medical sideeffects types by thier names |BS12
var/global/list/mechas_list = list() //list of all mechs. Used by hostile mobs target tracking.
var/global/list/joblist = list() //list of all jobstypes, minus borg and AI
#define all_genders_define_list list(MALE,FEMALE,PLURAL,NEUTER,HERM) //VOREStaton Edit
#define all_genders_text_list list("Male","Female","Plural","Neuter","Herm") //VOREStation Edit
var/list/mannequins_
// Times that players are allowed to respawn ("ckey" = world.time)
GLOBAL_LIST_EMPTY(respawn_timers)
// Holomaps
var/global/list/holomap_markers = list()
var/global/list/mapping_units = list()
var/global/list/mapping_beacons = list()
//Preferences stuff
//Hairstyles
var/global/list/hair_styles_list = list() //stores /datum/sprite_accessory/hair indexed by name
var/global/list/hair_styles_male_list = list()
var/global/list/hair_styles_female_list = list()
var/global/list/facial_hair_styles_list = list() //stores /datum/sprite_accessory/facial_hair indexed by name
var/global/list/facial_hair_styles_male_list = list()
var/global/list/facial_hair_styles_female_list = list()
var/global/list/skin_styles_female_list = list() //unused
var/global/list/body_marking_styles_list = list() //stores /datum/sprite_accessory/marking indexed by name
var/global/list/ear_styles_list = list() // Stores /datum/sprite_accessory/ears indexed by type
var/global/list/tail_styles_list = list() // Stores /datum/sprite_accessory/tail indexed by type
var/global/list/wing_styles_list = list() // Stores /datum/sprite_accessory/wing indexed by type
GLOBAL_LIST_INIT(custom_species_bases, new) // Species that can be used for a Custom Species icon base
//Underwear
var/datum/category_collection/underwear/global_underwear = new()
//Backpacks
var/global/list/backbaglist = list("Nothing", "Backpack", "Satchel", "Satchel Alt", "Messenger Bag", "Sports Bag")
var/global/list/pdachoicelist = list("Default", "Slim", "Old", "Rugged", "Holographic", "Wrist-Bound")
var/global/list/exclude_jobs = list(/datum/job/ai,/datum/job/cyborg)
// Visual nets
var/list/datum/visualnet/visual_nets = list()
var/datum/visualnet/camera/cameranet = new()
var/datum/visualnet/cult/cultnet = new()
// Runes
var/global/list/rune_list = new()
var/global/list/escape_list = list()
var/global/list/endgame_exits = list()
var/global/list/endgame_safespawns = list()
var/global/list/syndicate_access = list(access_maint_tunnels, access_syndicate, access_external_airlocks)
// Ores (for mining)
GLOBAL_LIST_EMPTY(ore_data)
GLOBAL_LIST_EMPTY(alloy_data)
// Strings which corraspond to bodypart covering flags, useful for outputting what something covers.
var/global/list/string_part_flags = list(
"head" = HEAD,
"face" = FACE,
"eyes" = EYES,
"upper body" = UPPER_TORSO,
"lower body" = LOWER_TORSO,
"legs" = LEGS,
"feet" = FEET,
"arms" = ARMS,
"hands" = HANDS
)
// Strings which corraspond to slot flags, useful for outputting what slot something is.
var/global/list/string_slot_flags = list(
"back" = SLOT_BACK,
"face" = SLOT_MASK,
"waist" = SLOT_BELT,
"ID slot" = SLOT_ID,
"ears" = SLOT_EARS,
"eyes" = SLOT_EYES,
"hands" = SLOT_GLOVES,
"head" = SLOT_HEAD,
"feet" = SLOT_FEET,
"exo slot" = SLOT_OCLOTHING,
"body" = SLOT_ICLOTHING,
"uniform" = SLOT_TIE,
"holster" = SLOT_HOLSTER
)
GLOBAL_LIST_EMPTY(mannequins)
/proc/get_mannequin(var/ckey = "NULL")
var/mob/living/carbon/human/dummy/mannequin/M = GLOB.mannequins[ckey]
if(!istype(M))
GLOB.mannequins[ckey] = new /mob/living/carbon/human/dummy/mannequin(null)
M = GLOB.mannequins[ckey]
return M
/proc/del_mannequin(var/ckey = "NULL")
GLOB.mannequins-= ckey
//////////////////////////
/////Initial Building/////
//////////////////////////
/proc/makeDatumRefLists()
var/list/paths
//Hair - Initialise all /datum/sprite_accessory/hair into an list indexed by hair-style name
paths = typesof(/datum/sprite_accessory/hair) - /datum/sprite_accessory/hair
for(var/path in paths)
var/datum/sprite_accessory/hair/H = new path()
hair_styles_list[H.name] = H
switch(H.gender)
if(MALE) hair_styles_male_list += H.name
if(FEMALE) hair_styles_female_list += H.name
else
hair_styles_male_list += H.name
hair_styles_female_list += H.name
//Facial Hair - Initialise all /datum/sprite_accessory/facial_hair into an list indexed by facialhair-style name
paths = typesof(/datum/sprite_accessory/facial_hair) - /datum/sprite_accessory/facial_hair
for(var/path in paths)
var/datum/sprite_accessory/facial_hair/H = new path()
facial_hair_styles_list[H.name] = H
switch(H.gender)
if(MALE) facial_hair_styles_male_list += H.name
if(FEMALE) facial_hair_styles_female_list += H.name
else
facial_hair_styles_male_list += H.name
facial_hair_styles_female_list += H.name
//Body markings - Initialise all /datum/sprite_accessory/marking into an list indexed by marking name
paths = typesof(/datum/sprite_accessory/marking) - /datum/sprite_accessory/marking
for(var/path in paths)
var/datum/sprite_accessory/marking/M = new path()
body_marking_styles_list[M.name] = M
//Surgery Steps - Initialize all /datum/surgery_step into a list
paths = typesof(/datum/surgery_step)-/datum/surgery_step
for(var/T in paths)
var/datum/surgery_step/S = new T
surgery_steps += S
sort_surgeries()
//List of job. I can't believe this was calculated multiple times per tick!
paths = typesof(/datum/job)-/datum/job
paths -= exclude_jobs
for(var/T in paths)
var/datum/job/J = new T
joblist[J.title] = J
//Languages
paths = typesof(/datum/language)-/datum/language
for(var/T in paths)
var/datum/language/L = new T
if (isnull(GLOB.all_languages[L.name]))
GLOB.all_languages[L.name] = L
else
log_debug("Language name conflict! [T] is named [L.name], but that is taken by [GLOB.all_languages[L.name].type]")
if(isnull(GLOB.language_name_conflicts[L.name]))
GLOB.language_name_conflicts[L.name] = list(GLOB.all_languages[L.name])
GLOB.language_name_conflicts[L.name] += L
for (var/language_name in GLOB.all_languages)
var/datum/language/L = GLOB.all_languages[language_name]
if(!(L.flags & NONGLOBAL))
if(isnull(GLOB.language_keys[L.key]))
GLOB.language_keys[L.key] = L
else
log_debug("Language key conflict! [L] has key [L.key], but that is taken by [(GLOB.language_keys[L.key])]")
if(isnull(GLOB.language_key_conflicts[L.key]))
GLOB.language_key_conflicts[L.key] = list(GLOB.language_keys[L.key])
GLOB.language_key_conflicts[L.key] += L
//Species
var/rkey = 0
paths = typesof(/datum/species)
for(var/T in paths)
rkey++
var/datum/species/S = T
if(!initial(S.name))
continue
S = new T
S.race_key = rkey //Used in mob icon caching.
GLOB.all_species[S.name] = S
//Shakey shakey shake
sortTim(GLOB.all_species, /proc/cmp_species, associative = TRUE)
//Split up the rest
for(var/speciesname in GLOB.all_species)
var/datum/species/S = GLOB.all_species[speciesname]
if(!(S.spawn_flags & SPECIES_IS_RESTRICTED))
GLOB.playable_species += S.name
if(S.spawn_flags & SPECIES_IS_WHITELISTED)
GLOB.whitelisted_species += S.name
//Ores
paths = typesof(/ore)-/ore
for(var/oretype in paths)
var/ore/OD = new oretype()
GLOB.ore_data[OD.name] = OD
paths = typesof(/datum/alloy)-/datum/alloy
for(var/alloytype in paths)
GLOB.alloy_data += new alloytype()
//Closet appearances
GLOB.closet_appearances = decls_repository.get_decls_of_type(/decl/closet_appearance)
paths = typesof(/datum/sprite_accessory/ears) - /datum/sprite_accessory/ears
for(var/path in paths)
var/obj/item/clothing/head/instance = new path()
ear_styles_list[path] = instance
// Custom Tails
paths = typesof(/datum/sprite_accessory/tail) - /datum/sprite_accessory/tail - /datum/sprite_accessory/tail/taur
for(var/path in paths)
var/datum/sprite_accessory/tail/instance = new path()
tail_styles_list[path] = instance
// Custom Wings
paths = typesof(/datum/sprite_accessory/wing) - /datum/sprite_accessory/wing
for(var/path in paths)
var/datum/sprite_accessory/wing/instance = new path()
wing_styles_list[path] = instance
// VOREStation Add - Vore Modes!
paths = typesof(/datum/digest_mode)
for(var/T in paths)
var/datum/digest_mode/DM = new T
GLOB.digest_modes[DM.id] = DM
// VOREStation Add End
init_crafting_recipes(GLOB.crafting_recipes)
/*
// Custom species traits
paths = typesof(/datum/trait) - /datum/trait
for(var/path in paths)
var/datum/trait/instance = new path()
if(!instance.name)
continue //A prototype or something
var/cost = instance.cost
traits_costs[path] = cost
all_traits[path] = instance
switch(cost)
if(-INFINITY to -0.1)
negative_traits[path] = instance
if(0)
neutral_traits[path] = instance
if(0.1 to INFINITY)
positive_traits[path] = instance
*/
// Custom species icon bases
var/list/blacklisted_icons = list(SPECIES_CUSTOM,SPECIES_PROMETHEAN) //VOREStation Edit
var/list/whitelisted_icons = list(SPECIES_FENNEC,SPECIES_XENOHYBRID) //VOREStation Edit
for(var/species_name in GLOB.playable_species)
if(species_name in blacklisted_icons)
continue
var/datum/species/S = GLOB.all_species[species_name]
if(S.spawn_flags & SPECIES_IS_WHITELISTED)
continue
GLOB.custom_species_bases += species_name
for(var/species_name in whitelisted_icons)
GLOB.custom_species_bases += species_name
return 1 // Hooks must return 1
/// Inits the crafting recipe list, sorting crafting recipe requirements in the process.
/proc/init_crafting_recipes(list/crafting_recipes)
for(var/path in subtypesof(/datum/crafting_recipe))
var/datum/crafting_recipe/recipe = new path()
recipe.reqs = sortList(recipe.reqs, /proc/cmp_crafting_req_priority)
crafting_recipes += recipe
return crafting_recipes
/* // Uncomment to debug chemical reaction list.
/client/verb/debug_chemical_list()
for (var/reaction in chemical_reactions_list)
. += "chemical_reactions_list\[\"[reaction]\"\] = \"[chemical_reactions_list[reaction]]\"\n"
if(islist(chemical_reactions_list[reaction]))
var/list/L = chemical_reactions_list[reaction]
for(var/t in L)
. += " has: [t]\n"
to_world(.)
*/
//Hexidecimal numbers
var/global/list/hexNums = list("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F")