diff --git a/code/_globalvars/lists/mobs.dm b/code/_globalvars/lists/mobs.dm index 19e6c21f684..8026afae47b 100644 --- a/code/_globalvars/lists/mobs.dm +++ b/code/_globalvars/lists/mobs.dm @@ -17,9 +17,11 @@ GLOBAL_LIST_EMPTY(suicided_mob_list) //contains a list of all mobs that suicide GLOBAL_LIST_EMPTY(drones_list) GLOBAL_LIST_EMPTY(dead_mob_list) //all dead mobs, including clientless. Excludes /mob/dead/new_player GLOBAL_LIST_EMPTY(joined_player_list) //all clients that have joined the game at round-start or as a latejoin. +GLOBAL_LIST_EMPTY(new_player_list) //all /mob/dead/new_player, in theory all should have clients and those that don't are in the process of spawning and get deleted when done. GLOBAL_LIST_EMPTY(silicon_mobs) //all silicon mobs GLOBAL_LIST_EMPTY(mob_living_list) //all instances of /mob/living and subtypes GLOBAL_LIST_EMPTY(carbon_list) //all instances of /mob/living/carbon and subtypes, notably does not contain brains or simple animals +GLOBAL_LIST_EMPTY(human_list) //all instances of /mob/living/carbon/human and subtypes GLOBAL_LIST_EMPTY(ai_list) GLOBAL_LIST_EMPTY(pai_list) GLOBAL_LIST_EMPTY(available_ai_shells) diff --git a/code/controllers/subsystem/job.dm b/code/controllers/subsystem/job.dm index e5dcfc2efc4..d6f670ed1c6 100644 --- a/code/controllers/subsystem/job.dm +++ b/code/controllers/subsystem/job.dm @@ -162,7 +162,8 @@ SUBSYSTEM_DEF(job) /datum/controller/subsystem/job/proc/ResetOccupations() JobDebug("Occupations reset.") - for(var/mob/dead/new_player/player in GLOB.player_list) + for(var/i in GLOB.new_player_list) + var/mob/dead/new_player/player = i if((player) && (player.mind)) player.mind.assigned_role = null player.mind.special_role = null @@ -242,7 +243,8 @@ SUBSYSTEM_DEF(job) S.latejoin_active = TRUE //Get the players who are ready - for(var/mob/dead/new_player/player in GLOB.player_list) + for(var/i in GLOB.new_player_list) + var/mob/dead/new_player/player = i if(player.ready == PLAYER_READY_TO_PLAY && player.check_preferences() && player.mind && !player.mind.assigned_role) unassigned += player @@ -530,7 +532,8 @@ SUBSYSTEM_DEF(job) var/never = 0 //never var/banned = 0 //banned var/young = 0 //account too young - for(var/mob/dead/new_player/player in GLOB.player_list) + for(var/i in GLOB.new_player_list) + var/mob/dead/new_player/player = i if(!(player.ready == PLAYER_READY_TO_PLAY && player.mind && !player.mind.assigned_role)) continue //This player is not ready if(is_banned_from(player.ckey, job.title) || QDELETED(player)) @@ -655,7 +658,8 @@ SUBSYSTEM_DEF(job) /////////////////////////////////// /datum/controller/subsystem/job/proc/get_living_heads() . = list() - for(var/mob/living/carbon/human/player in GLOB.alive_mob_list) + for(var/i in GLOB.human_list) + var/mob/living/carbon/human/player = i if(player.stat != DEAD && player.mind && (player.mind.assigned_role in GLOB.command_positions)) . |= player.mind @@ -675,7 +679,8 @@ SUBSYSTEM_DEF(job) ////////////////////////////////////////////// /datum/controller/subsystem/job/proc/get_living_sec() . = list() - for(var/mob/living/carbon/human/player in GLOB.carbon_list) + for(var/i in GLOB.human_list) + var/mob/living/carbon/human/player = i if(player.stat != DEAD && player.mind && (player.mind.assigned_role in GLOB.security_positions)) . |= player.mind @@ -684,7 +689,8 @@ SUBSYSTEM_DEF(job) //////////////////////////////////////// /datum/controller/subsystem/job/proc/get_all_sec() . = list() - for(var/mob/living/carbon/human/player in GLOB.carbon_list) + for(var/i in GLOB.human_list) + var/mob/living/carbon/human/player = i if(player.mind && (player.mind.assigned_role in GLOB.security_positions)) . |= player.mind diff --git a/code/controllers/subsystem/ticker.dm b/code/controllers/subsystem/ticker.dm index 399a1397ec2..9ce063ee313 100755 --- a/code/controllers/subsystem/ticker.dm +++ b/code/controllers/subsystem/ticker.dm @@ -156,10 +156,10 @@ SUBSYSTEM_DEF(ticker) //lobby stats for statpanels if(isnull(timeLeft)) timeLeft = max(0,start_at - world.time) - totalPlayers = 0 + totalPlayers = LAZYLEN(GLOB.new_player_list) totalPlayersReady = 0 - for(var/mob/dead/new_player/player in GLOB.player_list) - ++totalPlayers + for(var/i in GLOB.new_player_list) + var/mob/dead/new_player/player = i if(player.ready == PLAYER_READY_TO_PLAY) ++totalPlayersReady @@ -343,7 +343,8 @@ SUBSYSTEM_DEF(ticker) explosion(epi, 0, 256, 512, 0, TRUE, TRUE, 0, TRUE) /datum/controller/subsystem/ticker/proc/create_characters() - for(var/mob/dead/new_player/player in GLOB.player_list) + for(var/i in GLOB.new_player_list) + var/mob/dead/new_player/player = i if(player.ready == PLAYER_READY_TO_PLAY && player.mind) GLOB.joined_player_list += player.ckey player.create_character(FALSE) @@ -352,7 +353,8 @@ SUBSYSTEM_DEF(ticker) CHECK_TICK /datum/controller/subsystem/ticker/proc/collect_minds() - for(var/mob/dead/new_player/P in GLOB.player_list) + for(var/i in GLOB.new_player_list) + var/mob/dead/new_player/P = i if(P.new_character && P.new_character.mind) SSticker.minds += P.new_character.mind CHECK_TICK @@ -360,7 +362,8 @@ SUBSYSTEM_DEF(ticker) /datum/controller/subsystem/ticker/proc/equip_characters() var/captainless=1 - for(var/mob/dead/new_player/N in GLOB.player_list) + for(var/i in GLOB.new_player_list) + var/mob/dead/new_player/N = i var/mob/living/carbon/human/player = N.new_character if(istype(player) && player.mind && player.mind.assigned_role) if(player.mind.assigned_role == "Captain") @@ -371,14 +374,16 @@ SUBSYSTEM_DEF(ticker) SSquirks.AssignQuirks(N.new_character, N.client, TRUE) CHECK_TICK if(captainless) - for(var/mob/dead/new_player/N in GLOB.player_list) + for(var/i in GLOB.new_player_list) + var/mob/dead/new_player/N = i if(N.new_character) to_chat(N, "Captainship not forced on anyone.") CHECK_TICK /datum/controller/subsystem/ticker/proc/transfer_characters() var/list/livings = list() - for(var/mob/dead/new_player/player in GLOB.mob_list) + for(var/i in GLOB.new_player_list) + var/mob/dead/new_player/player = i var/mob/living = player.transfer_character() if(living) qdel(player) @@ -564,7 +569,8 @@ SUBSYSTEM_DEF(ticker) //Everyone who wanted to be an observer gets made one now /datum/controller/subsystem/ticker/proc/create_observers() - for(var/mob/dead/new_player/player in GLOB.player_list) + for(var/i in GLOB.new_player_list) + var/mob/dead/new_player/player = i if(player.ready == PLAYER_READY_TO_OBSERVE && player.mind) //Break chain since this has a sleep input in it addtimer(CALLBACK(player, /mob/dead/new_player.proc/make_me_an_observer), 1) diff --git a/code/datums/datacore.dm b/code/datums/datacore.dm index ca664b1ee90..14963229cc6 100644 --- a/code/datums/datacore.dm +++ b/code/datums/datacore.dm @@ -108,7 +108,8 @@ return /datum/datacore/proc/manifest() - for(var/mob/dead/new_player/N in GLOB.player_list) + for(var/i in GLOB.new_player_list) + var/mob/dead/new_player/N = i if(N.new_character) log_manifest(N.ckey,N.new_character.mind,N.new_character) if(ishuman(N.new_character)) diff --git a/code/game/gamemodes/clown_ops/bananium_bomb.dm b/code/game/gamemodes/clown_ops/bananium_bomb.dm index f8a61487c98..5d6b2867b44 100644 --- a/code/game/gamemodes/clown_ops/bananium_bomb.dm +++ b/code/game/gamemodes/clown_ops/bananium_bomb.dm @@ -34,7 +34,8 @@ /obj/machinery/nuclearbomb/syndicate/bananium/really_actually_explode(off_station) Cinematic(get_cinematic_type(off_station), world) - for(var/mob/living/carbon/human/H in GLOB.carbon_list) + for(var/i in GLOB.human_list) + var/mob/living/carbon/human/H = i var/turf/T = get_turf(H) if(!T || T.z != z) continue diff --git a/code/game/gamemodes/dynamic/dynamic.dm b/code/game/gamemodes/dynamic/dynamic.dm index ee23ba9464e..4c4a2093bbc 100644 --- a/code/game/gamemodes/dynamic/dynamic.dm +++ b/code/game/gamemodes/dynamic/dynamic.dm @@ -317,7 +317,8 @@ GLOBAL_VAR_INIT(dynamic_forced_threat_level, -1) stack_trace("Invalid dynamic configuration variable [variable] in [ruleset.ruletype] [ruleset.name]") ruleset.vars[variable] = rule_conf[variable] - for(var/mob/dead/new_player/player in GLOB.player_list) + for(var/i in GLOB.new_player_list) + var/mob/dead/new_player/player = i if(player.ready == PLAYER_READY_TO_PLAY && player.mind) roundstart_pop_ready++ candidates.Add(player) diff --git a/code/game/gamemodes/game_mode.dm b/code/game/gamemodes/game_mode.dm index 2d948d0e86d..6ad0205c76e 100644 --- a/code/game/gamemodes/game_mode.dm +++ b/code/game/gamemodes/game_mode.dm @@ -59,7 +59,8 @@ ///Checks to see if the game can be setup and ran with the current number of players or whatnot. /datum/game_mode/proc/can_start() var/playerC = 0 - for(var/mob/dead/new_player/player in GLOB.player_list) + for(var/i in GLOB.new_player_list) + var/mob/dead/new_player/player = i if((player.client)&&(player.ready == PLAYER_READY_TO_PLAY)) playerC++ if(!GLOB.Debug2) @@ -124,8 +125,9 @@ set waitfor = FALSE var/list/living_crew = list() - for(var/mob/Player in GLOB.mob_list) - if(Player.mind && Player.stat != DEAD && !isnewplayer(Player) && !isbrain(Player) && Player.client) + for(var/i in GLOB.player_list) + var/mob/Player = i + if(Player.mind && Player.stat != DEAD && !isnewplayer(Player) && !isbrain(Player)) living_crew += Player var/malc = CONFIG_GET(number/midround_antag_life_check) if(living_crew.len / GLOB.joined_player_list.len <= malc) //If a lot of the player base died, we start fresh @@ -359,7 +361,8 @@ var/datum/mind/applicant = null // Ultimate randomizing code right here - for(var/mob/dead/new_player/player in GLOB.player_list) + for(var/i in GLOB.new_player_list) + var/mob/dead/new_player/player = i if(player.client && player.ready == PLAYER_READY_TO_PLAY && player.check_preferences()) players += player @@ -413,7 +416,8 @@ /datum/game_mode/proc/num_players() . = 0 - for(var/mob/dead/new_player/P in GLOB.player_list) + for(var/i in GLOB.new_player_list) + var/mob/dead/new_player/P = i if(P.client && P.ready == PLAYER_READY_TO_PLAY) . ++ diff --git a/code/game/gamemodes/objective.dm b/code/game/gamemodes/objective.dm index fbf20f55cf4..1b8bf52d892 100644 --- a/code/game/gamemodes/objective.dm +++ b/code/game/gamemodes/objective.dm @@ -707,7 +707,8 @@ GLOBAL_LIST_EMPTY(possible_items_special) var/n_p = 1 //autowin var/list/datum/mind/owners = get_owners() if (SSticker.current_state == GAME_STATE_SETTING_UP) - for(var/mob/dead/new_player/P in GLOB.player_list) + for(var/i in GLOB.new_player_list) + var/mob/dead/new_player/P = i if(P.client && P.ready == PLAYER_READY_TO_PLAY && !(P.mind in owners)) n_p ++ else if (SSticker.IsRoundInProgress()) diff --git a/code/game/machinery/computer/crew.dm b/code/game/machinery/computer/crew.dm index f9185023b8c..087936d4a0e 100644 --- a/code/game/machinery/computer/crew.dm +++ b/code/game/machinery/computer/crew.dm @@ -119,7 +119,8 @@ GLOBAL_DATUM_INIT(crewmonitor, /datum/crewmonitor, new) var/pos_y var/life_status - for(var/mob/living/carbon/human/H in GLOB.carbon_list) + for(var/i in GLOB.human_list) + var/mob/living/carbon/human/H = i var/nanite_sensors = FALSE if(H in SSnanites.nanite_monitored_mobs) nanite_sensors = TRUE @@ -192,4 +193,4 @@ GLOBAL_DATUM_INIT(crewmonitor, /datum/crewmonitor, new) if ("select_person") AI.ai_camera_track(params["name"]) -#undef SENSORS_UPDATE_PERIOD \ No newline at end of file +#undef SENSORS_UPDATE_PERIOD diff --git a/code/game/machinery/computer/security.dm b/code/game/machinery/computer/security.dm index 7ad7f0cc31f..9ddb5ed56a5 100644 --- a/code/game/machinery/computer/security.dm +++ b/code/game/machinery/computer/security.dm @@ -819,7 +819,8 @@ What a mess.*/ if("released") active2.fields["criminal"] = "Discharged" investigate_log("[active1.fields["name"]] has been set from [old_field] to [active2.fields["criminal"]] by [key_name(usr)].", INVESTIGATE_RECORDS) - for(var/mob/living/carbon/human/H in GLOB.carbon_list) + for(var/i in GLOB.human_list) + var/mob/living/carbon/human/H = i H.sec_hud_set_security_status() if("Delete Record (Security) Execute") investigate_log("[key_name(usr)] has deleted the security records for [active1.fields["name"]].", INVESTIGATE_RECORDS) diff --git a/code/game/objects/items/pinpointer.dm b/code/game/objects/items/pinpointer.dm index 0b36752e293..a74f07561be 100644 --- a/code/game/objects/items/pinpointer.dm +++ b/code/game/objects/items/pinpointer.dm @@ -120,7 +120,8 @@ var/list/name_counts = list() var/list/names = list() - for(var/mob/living/carbon/human/H in GLOB.carbon_list) + for(var/i in GLOB.human_list) + var/mob/living/carbon/human/H = i if(!trackable(H)) continue diff --git a/code/modules/admin/secrets.dm b/code/modules/admin/secrets.dm index b452b029c49..ae844998a29 100644 --- a/code/modules/admin/secrets.dm +++ b/code/modules/admin/secrets.dm @@ -267,7 +267,8 @@ return var/dat = "Showing DNA from blood.
" dat += "" - for(var/mob/living/carbon/human/H in GLOB.carbon_list) + for(var/i in GLOB.human_list) + var/mob/living/carbon/human/H = i if(H.ckey) dat += "" dat += "
NameDNABlood Type
[H][H.dna.unique_enzymes][H.dna.blood_type]
" @@ -277,7 +278,8 @@ return var/dat = "Showing Fingerprints.
" dat += "" - for(var/mob/living/carbon/human/H in GLOB.carbon_list) + for(var/i in GLOB.human_list) + var/mob/living/carbon/human/H = i if(H.ckey) dat += "" dat += "
NameFingerprints
[H][md5(H.dna.uni_identity)]
" @@ -287,7 +289,8 @@ if(!check_rights(R_FUN)) return SSblackbox.record_feedback("nested tally", "admin_secrets_fun_used", 1, list("Monkeyize All Humans")) - for(var/mob/living/carbon/human/H in GLOB.carbon_list) + for(var/i in GLOB.human_list) + var/mob/living/carbon/human/H = i INVOKE_ASYNC(H, /mob/living/carbon.proc/monkeyize) ok = 1 @@ -300,7 +303,8 @@ log_admin("[key_name(usr)] turned all humans into [result]", 1) message_admins("\blue [key_name_admin(usr)] turned all humans into [result]") var/newtype = GLOB.species_list[result] - for(var/mob/living/carbon/human/H in GLOB.carbon_list) + for(var/i in GLOB.human_list) + var/mob/living/carbon/human/H = i H.set_species(newtype) if("tripleAI") @@ -393,7 +397,8 @@ return SSblackbox.record_feedback("nested tally", "admin_secrets_fun_used", 1, list("Chinese Cartoons")) message_admins("[key_name_admin(usr)] made everything kawaii.") - for(var/mob/living/carbon/human/H in GLOB.carbon_list) + for(var/i in GLOB.human_list) + var/mob/living/carbon/human/H = i SEND_SOUND(H, sound('sound/ai/animes.ogg')) if(H.dna.species.id == "human") @@ -527,7 +532,8 @@ if(!check_rights(R_FUN)) return SSblackbox.record_feedback("nested tally", "admin_secrets_fun_used", 1, list("Dwarf Beards")) - for(var/mob/living/carbon/human/B in GLOB.carbon_list) + for(var/i in GLOB.human_list) + var/mob/living/carbon/human/B = i B.facial_hairstyle = "Dward Beard" B.update_hair() message_admins("[key_name_admin(usr)] activated dorf mode") diff --git a/code/modules/admin/verbs/randomverbs.dm b/code/modules/admin/verbs/randomverbs.dm index 6da84522fbc..35da9ac6da8 100644 --- a/code/modules/admin/verbs/randomverbs.dm +++ b/code/modules/admin/verbs/randomverbs.dm @@ -918,7 +918,8 @@ Traitors and the like can also be revived with the previous role mostly intact. if(confirm != "Yes") return - for(var/mob/living/carbon/human/H in GLOB.carbon_list) + for(var/i in GLOB.human_list) + var/mob/living/carbon/human/H = i new /obj/item/organ/zombie_infection/nodamage(H) message_admins("[key_name_admin(usr)] added a latent zombie infection to all humans.") diff --git a/code/modules/antagonists/disease/disease_mob.dm b/code/modules/antagonists/disease/disease_mob.dm index 85921508822..2f2776e4d63 100644 --- a/code/modules/antagonists/disease/disease_mob.dm +++ b/code/modules/antagonists/disease/disease_mob.dm @@ -167,7 +167,8 @@ the new instance inside the host to be updated to the template's stats. return FALSE var/list/possible_hosts = list() var/list/afk_possible_hosts = list() - for(var/mob/living/carbon/human/H in GLOB.carbon_list) + for(var/i in GLOB.human_list) + var/mob/living/carbon/human/H = i var/turf/T = get_turf(H) if((H.stat != DEAD) && T && is_station_level(T.z) && H.CanContractDisease(disease_template)) if(H.client && !H.client.is_afk()) diff --git a/code/modules/events/holiday/halloween.dm b/code/modules/events/holiday/halloween.dm index 8ee8bc7b00b..c802143987d 100644 --- a/code/modules/events/holiday/halloween.dm +++ b/code/modules/events/holiday/halloween.dm @@ -8,7 +8,8 @@ /datum/round_event/spooky/start() ..() - for(var/mob/living/carbon/human/H in GLOB.carbon_list) + for(var/i in GLOB.human_list) + var/mob/living/carbon/human/H = i var/obj/item/storage/backpack/b = locate() in H.contents if(b) new /obj/item/storage/spooky(b) diff --git a/code/modules/events/wizard/departmentrevolt.dm b/code/modules/events/wizard/departmentrevolt.dm index f37b7470fb3..18e2fefbe07 100644 --- a/code/modules/events/wizard/departmentrevolt.dm +++ b/code/modules/events/wizard/departmentrevolt.dm @@ -38,7 +38,8 @@ var/datum/team/nation/nation = new nation.name = nation_name - for(var/mob/living/carbon/human/H in GLOB.carbon_list) + for(var/i in GLOB.human_list) + var/mob/living/carbon/human/H = i if(H.mind) var/datum/mind/M = H.mind if(M.assigned_role && !(M.has_antag_datum(/datum/antagonist))) diff --git a/code/modules/events/wizard/race.dm b/code/modules/events/wizard/race.dm index dabc5268458..9d7076d30a6 100644 --- a/code/modules/events/wizard/race.dm +++ b/code/modules/events/wizard/race.dm @@ -20,7 +20,8 @@ if(prob(50)) all_the_same = 1 - for(var/mob/living/carbon/human/H in GLOB.carbon_list) //yes, even the dead + for(var/i in GLOB.human_list) //yes, even the dead + var/mob/living/carbon/human/H = i H.set_species(new_species) H.dna.unique_enzymes = H.dna.generate_unique_enzymes() to_chat(H, "You feel somehow... different?") diff --git a/code/modules/holiday/holidays.dm b/code/modules/holiday/holidays.dm index 9ab59318967..8ffe7d99877 100644 --- a/code/modules/holiday/holidays.dm +++ b/code/modules/holiday/holidays.dm @@ -170,7 +170,8 @@ /datum/holiday/april_fools/celebrate() SSjob.set_overflow_role("Clown") SSticker.login_music = 'sound/ambience/clown.ogg' - for(var/mob/dead/new_player/P in GLOB.mob_list) + for(var/i in GLOB.new_player_list) + var/mob/dead/new_player/P = i if(P.client) P.client.playtitlemusic() diff --git a/code/modules/mob/dead/new_player/new_player.dm b/code/modules/mob/dead/new_player/new_player.dm index 913fdad2e0e..12f4e62beb9 100644 --- a/code/modules/mob/dead/new_player/new_player.dm +++ b/code/modules/mob/dead/new_player/new_player.dm @@ -30,6 +30,12 @@ . = ..() + GLOB.new_player_list += src + +/mob/dead/new_player/Destroy() + GLOB.new_player_list -= src + return ..() + /mob/dead/new_player/prepare_huds() return diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 5dfd7bbb9e1..d94e8b8cfa9 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -28,6 +28,8 @@ RegisterSignal(src, COMSIG_COMPONENT_CLEAN_ACT, .proc/clean_blood) AddComponent(/datum/component/personal_crafting) + GLOB.human_list += src + /mob/living/carbon/human/proc/setup_human_dna() //initialize dna. for spawned humans; overwritten by other code create_dna(src) @@ -41,6 +43,7 @@ /mob/living/carbon/human/Destroy() QDEL_NULL(physiology) + GLOB.human_list -= src return ..()