From 1f9f0dfc40f89270680cb731263d98ecb66936ab Mon Sep 17 00:00:00 2001 From: Incoming Date: Mon, 16 Nov 2015 18:55:57 -0500 Subject: [PATCH] Adds subtypesof(). It's shorthand for typesof(path) - path. Replaces typesof(path) - path with subtypesof(path) in obvious places. I was a bit conservative, there's probably a few more places that could use this. --- code/__HELPERS/global_lists.dm | 13 ++++--------- code/__HELPERS/unsorted.dm | 4 ++++ code/controllers/configuration.dm | 8 ++++---- code/controllers/subsystem/events.dm | 2 +- code/controllers/subsystem/jobs.dm | 6 +++--- code/controllers/subsystem/shuttles.dm | 4 +--- code/datums/ai_laws.dm | 2 +- code/datums/diseases/_disease.dm | 2 +- code/datums/diseases/advance/symptoms/symptoms.dm | 2 +- code/datums/uplink_item.dm | 2 +- .../game/gamemodes/abduction/machinery/dispenser.dm | 2 +- .../gamemodes/abduction/machinery/experiment.dm | 2 +- code/game/gamemodes/blob/overmind.dm | 2 +- code/game/gamemodes/blob/powers.dm | 3 +-- code/game/gamemodes/changeling/changeling.dm | 2 +- code/game/gamemodes/cult/ritual.dm | 2 +- code/game/gamemodes/cult/runes.dm | 2 +- code/game/gamemodes/handofgod/structures.dm | 2 +- code/game/gamemodes/sandbox/h_sandbox.dm | 6 +++--- code/game/gamemodes/setupgame.dm | 2 +- code/game/gamemodes/wizard/artefact.dm | 2 +- code/game/gamemodes/wizard/spellbook.dm | 2 +- code/game/machinery/computer/arcade.dm | 2 +- code/game/machinery/slotmachine.dm | 2 +- code/game/objects/items/weapons/gift_wrappaper.dm | 4 ++-- code/game/objects/structures/barsigns.dm | 2 +- code/game/objects/structures/mirror.dm | 4 ++-- code/modules/admin/verbs/buildmode.dm | 2 +- code/modules/admin/verbs/debug.dm | 4 ++-- code/modules/admin/verbs/manipulate_organs.dm | 4 ++-- code/modules/clothing/under/chameleon.dm | 4 ++-- code/modules/clothing/under/color.dm | 3 +-- code/modules/events/wizard/race.dm | 2 +- .../food&drinks/kitchen machinery/processor.dm | 2 +- code/modules/holodeck/computer.dm | 2 +- code/modules/library/random_books.dm | 4 ++-- code/modules/mining/abandoned_crates.dm | 4 ++-- code/modules/mob/living/silicon/laws.dm | 2 +- code/modules/ninja/suit/suit.dm | 2 +- code/modules/projectiles/projectile/magic.dm | 2 +- code/modules/reagents/Chemistry-Holder.dm | 4 ++-- .../reagents/Chemistry-Reagents/Other-Reagents.dm | 4 ++-- .../reagents/Chemistry-Recipes/Slime_extracts.dm | 6 ++---- code/modules/research/rdconsole.dm | 4 ++-- code/modules/research/research.dm | 8 ++++---- 45 files changed, 72 insertions(+), 79 deletions(-) diff --git a/code/__HELPERS/global_lists.dm b/code/__HELPERS/global_lists.dm index ec2f9ccd639..3729f8cefeb 100644 --- a/code/__HELPERS/global_lists.dm +++ b/code/__HELPERS/global_lists.dm @@ -28,16 +28,14 @@ //Species - for(var/spath in typesof(/datum/species)) - if(spath == /datum/species) - continue + for(var/spath in subtypesof(/datum/species)) var/datum/species/S = new spath() if(S.roundstart) roundstart_species[S.name] = S.type species_list[S.id] = S.type //Surgeries - for(var/path in (typesof(/datum/surgery) - /datum/surgery)) + for(var/path in (subtypesof(/datum/surgery))) surgeries_list += new path() init_subtypes(/datum/table_recipe, table_recipes) @@ -58,8 +56,7 @@ //if no list/L is provided, one is created. /proc/init_subtypes(prototype, list/L) if(!istype(L)) L = list() - for(var/path in typesof(prototype)) - if(path == prototype) continue + for(var/path in subtypesof(prototype)) L += new path() return L @@ -68,8 +65,6 @@ /proc/init_paths(prototype, list/L) if(!istype(L)) L = list() - for(var/path in typesof(prototype)) - if(path == prototype) - continue + for(var/path in subtypesof(prototype)) L+= path return L diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index 0ca23216275..19b9660e51c 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -1343,3 +1343,7 @@ B --><-- A c_dist++ return L + +/proc/subtypesof(typepath) + . = typesof(typepath) - typepath + . diff --git a/code/controllers/configuration.dm b/code/controllers/configuration.dm index bce63ca65cf..4985ab86780 100644 --- a/code/controllers/configuration.dm +++ b/code/controllers/configuration.dm @@ -184,7 +184,7 @@ /datum/configuration/New() - var/list/L = typesof(/datum/game_mode) - /datum/game_mode + var/list/L = subtypesof(/datum/game_mode) for(var/T in L) // I wish I didn't have to instance the game modes in order to look up // their information, but it is the only way (at least that I know of). @@ -653,7 +653,7 @@ /datum/configuration/proc/pick_mode(mode_name) // I wish I didn't have to instance the game modes in order to look up // their information, but it is the only way (at least that I know of). - for(var/T in (typesof(/datum/game_mode) - /datum/game_mode)) + for(var/T in subtypesof(/datum/game_mode)) var/datum/game_mode/M = new T() if(M.config_tag && M.config_tag == mode_name) return M @@ -662,7 +662,7 @@ /datum/configuration/proc/get_runnable_modes() var/list/datum/game_mode/runnable_modes = new - for(var/T in (typesof(/datum/game_mode) - /datum/game_mode)) + for(var/T in subtypesof(/datum/game_mode)) var/datum/game_mode/M = new T() //world << "DEBUG: [T], tag=[M.config_tag], prob=[probabilities[M.config_tag]]" if(!(M.config_tag in modes)) @@ -678,7 +678,7 @@ /datum/configuration/proc/get_runnable_midround_modes(crew) var/list/datum/game_mode/runnable_modes = new - for(var/T in (typesof(/datum/game_mode) - /datum/game_mode - ticker.mode.type)) + for(var/T in (subtypesof(/datum/game_mode) - ticker.mode.type)) var/datum/game_mode/M = new T() if(!(M.config_tag in modes)) qdel(M) diff --git a/code/controllers/subsystem/events.dm b/code/controllers/subsystem/events.dm index a0ec2bab7c5..dc7a82ac4ae 100644 --- a/code/controllers/subsystem/events.dm +++ b/code/controllers/subsystem/events.dm @@ -178,7 +178,7 @@ var/datum/subsystem/events/SSevent var/MM = text2num(time2text(world.timeofday, "MM")) // get the current month var/DD = text2num(time2text(world.timeofday, "DD")) // get the current day - for(var/H in typesof(/datum/holiday) - /datum/holiday) + for(var/H in subtypesof(/datum/holiday)) var/datum/holiday/holiday = new H() if(holiday.shouldCelebrate(DD, MM, YY)) holiday.celebrate() diff --git a/code/controllers/subsystem/jobs.dm b/code/controllers/subsystem/jobs.dm index eb40fc49621..b43adf04264 100644 --- a/code/controllers/subsystem/jobs.dm +++ b/code/controllers/subsystem/jobs.dm @@ -24,7 +24,7 @@ var/datum/subsystem/job/SSjob /datum/subsystem/job/proc/SetupOccupations(faction = "Station") occupations = list() - var/list/all_jobs = typesof(/datum/job) + var/list/all_jobs = subtypesof(/datum/job) if(!all_jobs.len) world << "Error setting up jobs, no job datums found" return 0 @@ -342,10 +342,10 @@ var/datum/subsystem/job/SSjob if(!joined_late) var/obj/S = null for(var/obj/effect/landmark/start/sloc in start_landmarks_list) - if(sloc.name != rank) + if(sloc.name != rank) S = sloc //so we can revert to spawning them on top of eachother if something goes wrong continue - if(locate(/mob/living) in sloc.loc) + if(locate(/mob/living) in sloc.loc) continue S = sloc break diff --git a/code/controllers/subsystem/shuttles.dm b/code/controllers/subsystem/shuttles.dm index 6d88f105bd2..7f7a0dceb74 100644 --- a/code/controllers/subsystem/shuttles.dm +++ b/code/controllers/subsystem/shuttles.dm @@ -52,9 +52,7 @@ var/datum/subsystem/shuttle/SSshuttle ordernum = rand(1,9000) - for(var/typepath in typesof(/datum/supply_packs)) - if(typepath == /datum/supply_packs) - continue + for(var/typepath in subtypesof(/datum/supply_packs)) var/datum/supply_packs/P = new typepath() if(P.name == "HEADER") continue // To filter out group headers supply_packs["[P.type]"] = P diff --git a/code/datums/ai_laws.dm b/code/datums/ai_laws.dm index 74cd402bca3..7291fe5e2bd 100644 --- a/code/datums/ai_laws.dm +++ b/code/datums/ai_laws.dm @@ -100,7 +100,7 @@ WARNING("Invalid custom AI laws, check silicon_laws.txt") return if(2) - var/datum/ai_laws/lawtype = pick(typesof(/datum/ai_laws/default) - /datum/ai_laws/default) + var/datum/ai_laws/lawtype = pick(subtypesof(/datum/ai_laws/default)) var/datum/ai_laws/templaws = new lawtype() inherent = templaws.inherent diff --git a/code/datums/diseases/_disease.dm b/code/datums/diseases/_disease.dm index fd91b82aa17..6ba2dd648b4 100644 --- a/code/datums/diseases/_disease.dm +++ b/code/datums/diseases/_disease.dm @@ -27,7 +27,7 @@ #define BIOHAZARD "BIOHAZARD THREAT!" -var/list/diseases = typesof(/datum/disease) - /datum/disease +var/list/diseases = subtypesof(/datum/disease) /datum/disease diff --git a/code/datums/diseases/advance/symptoms/symptoms.dm b/code/datums/diseases/advance/symptoms/symptoms.dm index bbdeef487a4..296e94e28be 100644 --- a/code/datums/diseases/advance/symptoms/symptoms.dm +++ b/code/datums/diseases/advance/symptoms/symptoms.dm @@ -1,6 +1,6 @@ // Symptoms are the effects that engineered advanced diseases do. -var/list/list_symptoms = typesof(/datum/symptom) - /datum/symptom +var/list/list_symptoms = subtypesof(/datum/symptom) var/list/dictionary_symptoms = list() var/global/const/SYMPTOM_ACTIVATION_PROB = 3 diff --git a/code/datums/uplink_item.dm b/code/datums/uplink_item.dm index 1910b88dd9e..60dc9db40be 100644 --- a/code/datums/uplink_item.dm +++ b/code/datums/uplink_item.dm @@ -8,7 +8,7 @@ var/list/uplink_items = list() // A keyed list, acting as categories, which are lists to the datum. var/list/last = list() - for(var/item in typesof(/datum/uplink_item)) + for(var/item in subtypesof(/datum/uplink_item)) var/datum/uplink_item/I = new item() if(!I.item) diff --git a/code/game/gamemodes/abduction/machinery/dispenser.dm b/code/game/gamemodes/abduction/machinery/dispenser.dm index dd3a3c9607e..aacf75770e9 100644 --- a/code/game/gamemodes/abduction/machinery/dispenser.dm +++ b/code/game/gamemodes/abduction/machinery/dispenser.dm @@ -14,7 +14,7 @@ return rgb(rand(0,255),rand(0,255),rand(0,255)) /obj/machinery/abductor/gland_dispenser/New() - gland_types = typesof(/obj/item/organ/internal/gland) - /obj/item/organ/internal/gland + gland_types = subtypesof(/obj/item/organ/internal/gland) gland_types = shuffle(gland_types) gland_colors = new/list(gland_types.len) amounts = new/list(gland_types.len) diff --git a/code/game/gamemodes/abduction/machinery/experiment.dm b/code/game/gamemodes/abduction/machinery/experiment.dm index 688637f630f..9458a61adc7 100644 --- a/code/game/gamemodes/abduction/machinery/experiment.dm +++ b/code/game/gamemodes/abduction/machinery/experiment.dm @@ -155,7 +155,7 @@ H << "You feel intensely watched." sleep(5) H << "Your mind snaps!" - var/objtype = pick(typesof(/datum/objective/abductee/) - /datum/objective/abductee/) + var/objtype = pick(subtypesof(/datum/objective/abductee/)) var/datum/objective/abductee/O = new objtype() ticker.mode.abductees += H.mind H.mind.objectives += O diff --git a/code/game/gamemodes/blob/overmind.dm b/code/game/gamemodes/blob/overmind.dm index f97ae377668..6416f1e56fe 100644 --- a/code/game/gamemodes/blob/overmind.dm +++ b/code/game/gamemodes/blob/overmind.dm @@ -25,7 +25,7 @@ real_name = new_name last_attack = world.time var/list/possible_reagents = list() - for(var/type in (typesof(/datum/reagent/blob) - /datum/reagent/blob)) + for(var/type in (subtypesof(/datum/reagent/blob))) possible_reagents.Add(new type) blob_reagent_datum = pick(possible_reagents) if(blob_core) diff --git a/code/game/gamemodes/blob/powers.dm b/code/game/gamemodes/blob/powers.dm index a0c97c1da99..91c149f24f2 100644 --- a/code/game/gamemodes/blob/powers.dm +++ b/code/game/gamemodes/blob/powers.dm @@ -221,8 +221,7 @@ set desc = "Replaces your chemical with a different one" if(!can_buy(50)) return - var/list/excluded = list(/datum/reagent/blob, blob_reagent_datum.type) - var/datum/reagent/blob/B = pick((typesof(/datum/reagent/blob) - excluded)) + var/datum/reagent/blob/B = pick((subtypesof(/datum/reagent/blob) - blob_reagent_datum.type)) blob_reagent_datum = new B for(var/obj/effect/blob/BL in blobs) BL.adjustcolors(blob_reagent_datum.color) diff --git a/code/game/gamemodes/changeling/changeling.dm b/code/game/gamemodes/changeling/changeling.dm index f1101aa26fb..427de546b75 100644 --- a/code/game/gamemodes/changeling/changeling.dm +++ b/code/game/gamemodes/changeling/changeling.dm @@ -80,7 +80,7 @@ var/list/slot2type = list("head" = /obj/item/clothing/head/changeling, "wear_mas //Decide if it's ok for the lings to have a team objective //And then set it up to be handed out in forge_changeling_objectives - var/list/team_objectives = typesof(/datum/objective/changeling_team_objective) - /datum/objective/changeling_team_objective + var/list/team_objectives = subtypesof(/datum/objective/changeling_team_objective) var/list/possible_team_objectives = list() for(var/T in team_objectives) var/datum/objective/changeling_team_objective/CTO = T diff --git a/code/game/gamemodes/cult/ritual.dm b/code/game/gamemodes/cult/ritual.dm index 122705e782a..5249b8029d6 100644 --- a/code/game/gamemodes/cult/ritual.dm +++ b/code/game/gamemodes/cult/ritual.dm @@ -247,7 +247,7 @@ It also contains rune words, which are soon to be removed. var/rune_to_scribe var/entered_rune_name var/list/possible_runes = list() - for(var/T in typesof(/obj/effect/rune) - /obj/effect/rune/malformed - /obj/effect/rune) + for(var/T in subtypesof(/obj/effect/rune) - /obj/effect/rune/malformed) var/obj/effect/rune/R = T if(initial(R.cultist_name)) possible_runes.Add(initial(R.cultist_name)) //This is to allow the menu to let cultists select runes by name rather than by object path. I don't know a better way to do this diff --git a/code/game/gamemodes/cult/runes.dm b/code/game/gamemodes/cult/runes.dm index 76a6ee5f3f4..ff080a46929 100644 --- a/code/game/gamemodes/cult/runes.dm +++ b/code/game/gamemodes/cult/runes.dm @@ -1,5 +1,5 @@ var/list/sacrificed = list() -var/list/non_revealed_runes = (typesof(/obj/effect/rune) - /obj/effect/rune/malformed - /obj/effect/rune ) +var/list/non_revealed_runes = (subtypesof(/obj/effect/rune) - /obj/effect/rune/malformed) /* diff --git a/code/game/gamemodes/handofgod/structures.dm b/code/game/gamemodes/handofgod/structures.dm index 97e6ede44c0..3ac0165bbb2 100644 --- a/code/game/gamemodes/handofgod/structures.dm +++ b/code/game/gamemodes/handofgod/structures.dm @@ -3,7 +3,7 @@ if(global_handofgod_traptypes.len && global_handofgod_structuretypes.len) return - var/list/types = typesof(/obj/structure/divine) - /obj/structure/divine - /obj/structure/divine/trap + var/list/types = subtypesof(/obj/structure/divine) - /obj/structure/divine/trap for(var/T in types) var/obj/structure/divine/D = T if(initial(D.constructable)) diff --git a/code/game/gamemodes/sandbox/h_sandbox.dm b/code/game/gamemodes/sandbox/h_sandbox.dm index acbd6511c01..14ad0918f91 100644 --- a/code/game/gamemodes/sandbox/h_sandbox.dm +++ b/code/game/gamemodes/sandbox/h_sandbox.dm @@ -230,7 +230,7 @@ var/hsboxspawn = 1 if(!clothinfo) clothinfo = "Clothing (Reagent Containers) (Other Items)

" - var/list/all_items = typesof(/obj/item/clothing) - /obj/item/clothing + var/list/all_items = subtypesof(/obj/item/clothing) for(var/typekey in spawn_forbidden) all_items -= typesof(typekey) for(var/O in reverseRange(all_items)) @@ -244,7 +244,7 @@ var/hsboxspawn = 1 if(!reaginfo) reaginfo = "Reagent Containers (Clothing) (Other Items)

" - var/list/all_items = typesof(/obj/item/weapon/reagent_containers) - /obj/item/weapon/reagent_containers + var/list/all_items = subtypesof(/obj/item/weapon/reagent_containers) for(var/typekey in spawn_forbidden) all_items -= typesof(typekey) for(var/O in reverseRange(all_items)) @@ -258,7 +258,7 @@ var/hsboxspawn = 1 if(!objinfo) objinfo = "Other Items (Clothing) (Reagent Containers)

" - var/list/all_items = typesof(/obj/item/) - typesof(/obj/item/clothing) - typesof(/obj/item/weapon/reagent_containers) - /obj/item + var/list/all_items = subtypesof(/obj/item/) - typesof(/obj/item/clothing) - typesof(/obj/item/weapon/reagent_containers) for(var/typekey in spawn_forbidden) all_items -= typesof(typekey) diff --git a/code/game/gamemodes/setupgame.dm b/code/game/gamemodes/setupgame.dm index dae344006de..085a061c29a 100644 --- a/code/game/gamemodes/setupgame.dm +++ b/code/game/gamemodes/setupgame.dm @@ -3,7 +3,7 @@ for(var/i=1, i<=DNA_STRUC_ENZYMES_BLOCKS, i++) avnums[i] = i - for(var/A in typesof(/datum/mutation/human) - /datum/mutation/human) + for(var/A in subtypesof(/datum/mutation/human)) var/datum/mutation/human/B = new A() if(B.dna_block == NON_SCANNABLE) continue diff --git a/code/game/gamemodes/wizard/artefact.dm b/code/game/gamemodes/wizard/artefact.dm index 7849698753e..e5ba5fd717b 100644 --- a/code/game/gamemodes/wizard/artefact.dm +++ b/code/game/gamemodes/wizard/artefact.dm @@ -290,7 +290,7 @@ var/global/list/multiverse = list() M.faction = list("[usr.real_name]") if(prob(50)) var/list/all_species = list() - for(var/speciestype in typesof(/datum/species) - /datum/species) + for(var/speciestype in subtypesof(/datum/species)) var/datum/species/S = new speciestype() if(!S.dangerous_existence) all_species += speciestype diff --git a/code/game/gamemodes/wizard/spellbook.dm b/code/game/gamemodes/wizard/spellbook.dm index 609cfc3999b..af82a237171 100644 --- a/code/game/gamemodes/wizard/spellbook.dm +++ b/code/game/gamemodes/wizard/spellbook.dm @@ -512,7 +512,7 @@ user << "It appears to have no author." /obj/item/weapon/spellbook/proc/Initialize() - var/entry_types = typesof(/datum/spellbook_entry) - /datum/spellbook_entry - /datum/spellbook_entry/item - /datum/spellbook_entry/summon + var/entry_types = subtypesof(/datum/spellbook_entry) - /datum/spellbook_entry/item - /datum/spellbook_entry/summon for(var/T in entry_types) var/datum/spellbook_entry/E = new T if(E.IsAvailible()) diff --git a/code/game/machinery/computer/arcade.dm b/code/game/machinery/computer/arcade.dm index 1e1ee0858d7..7356b1354d3 100644 --- a/code/game/machinery/computer/arcade.dm +++ b/code/game/machinery/computer/arcade.dm @@ -43,7 +43,7 @@ // If it's a generic arcade machine, pick a random arcade // circuit board for it and make the new machine if(!circuit) - var/choice = pick(typesof(/obj/item/weapon/circuitboard/arcade) - /obj/item/weapon/circuitboard/arcade) + var/choice = pick(subtypesof(/obj/item/weapon/circuitboard/arcade)) var/obj/item/weapon/circuitboard/CB = new choice() new CB.build_path(loc, CB) qdel(src) diff --git a/code/game/machinery/slotmachine.dm b/code/game/machinery/slotmachine.dm index 8134995ba53..b5a6944e7d2 100644 --- a/code/game/machinery/slotmachine.dm +++ b/code/game/machinery/slotmachine.dm @@ -237,7 +237,7 @@ money = 0 for(var/i = 0, i < 5, i++) - var/cointype = pick(typesof(/obj/item/weapon/coin) - /obj/item/weapon/coin) + var/cointype = pick(subtypesof(/obj/item/weapon/coin)) var/obj/item/weapon/coin/C = new cointype(loc) random_step(C, 2, 50) diff --git a/code/game/objects/items/weapons/gift_wrappaper.dm b/code/game/objects/items/weapons/gift_wrappaper.dm index 6f5df0174ea..d09278543c7 100644 --- a/code/game/objects/items/weapons/gift_wrappaper.dm +++ b/code/game/objects/items/weapons/gift_wrappaper.dm @@ -60,8 +60,8 @@ /obj/item/clothing/suit/poncho/green, /obj/item/clothing/suit/poncho/red) - gift_type_list += typesof(/obj/item/clothing/head/collectable) - /obj/item/clothing/head/collectable - gift_type_list += typesof(/obj/item/toy) - (((typesof(/obj/item/toy/cards) - /obj/item/toy/cards/deck) + /obj/item/toy/ammo) + /obj/item/toy) //All toys, except for abstract types and syndicate cards. + gift_type_list += subtypesof(/obj/item/clothing/head/collectable) + gift_type_list += subtypesof(/obj/item/toy) - (((typesof(/obj/item/toy/cards) - /obj/item/toy/cards/deck) + /obj/item/toy/ammo)) //All toys, except for abstract types and syndicate cards. var/gift_type = pick(gift_type_list) diff --git a/code/game/objects/structures/barsigns.dm b/code/game/objects/structures/barsigns.dm index f09ec051c67..2ceaba07c52 100644 --- a/code/game/objects/structures/barsigns.dm +++ b/code/game/objects/structures/barsigns.dm @@ -20,7 +20,7 @@ //filling the barsigns list - for(var/bartype in typesof(/datum/barsign) - /datum/barsign) + for(var/bartype in subtypesof(/datum/barsign)) var/datum/barsign/signinfo = new bartype if(!signinfo.hidden) barsigns += signinfo diff --git a/code/game/objects/structures/mirror.dm b/code/game/objects/structures/mirror.dm index e74d5e4449c..04ce58ae6d6 100644 --- a/code/game/objects/structures/mirror.dm +++ b/code/game/objects/structures/mirror.dm @@ -131,7 +131,7 @@ /obj/structure/mirror/magic/New() if(!choosable_races.len) - for(var/speciestype in typesof(/datum/species) - /datum/species) + for(var/speciestype in subtypesof(/datum/species)) var/datum/species/S = new speciestype() if(!(S.id in races_blacklist)) choosable_races += S.id @@ -142,7 +142,7 @@ ..() /obj/structure/mirror/magic/badmin/New() - for(var/speciestype in typesof(/datum/species) - /datum/species) + for(var/speciestype in subtypesof(/datum/species)) var/datum/species/S = new speciestype() choosable_races += S.id ..() diff --git a/code/modules/admin/verbs/buildmode.dm b/code/modules/admin/verbs/buildmode.dm index 03bcd93bf46..934ba3d6df4 100644 --- a/code/modules/admin/verbs/buildmode.dm +++ b/code/modules/admin/verbs/buildmode.dm @@ -185,7 +185,7 @@ if("turf-reference") master.buildmode.valueholder = input(usr,"Enter variable value:" ,"Value") as turf in world if(AREA_BUILDMODE) - var/list/gen_paths = typesof(/datum/mapGenerator) - /datum/mapGenerator + var/list/gen_paths = subtypesof(/datum/mapGenerator) var/type = input(usr,"Select Generator Type","Type") as null|anything in gen_paths if(!type) return diff --git a/code/modules/admin/verbs/debug.dm b/code/modules/admin/verbs/debug.dm index 78c90014258..58595a5bfd5 100644 --- a/code/modules/admin/verbs/debug.dm +++ b/code/modules/admin/verbs/debug.dm @@ -419,7 +419,7 @@ var/list/TYPES_SHORTCUTS = list( var/global/list/g_fancy_list_of_types = null /proc/get_fancy_list_of_types() if (isnull(g_fancy_list_of_types)) //init - var/list/temp = sortList(typesof(/atom) - typesof(/area) - /atom - /atom/movable) + var/list/temp = sortList(subtypesof(/atom) - typesof(/area) - /atom/movable) g_fancy_list_of_types = new(temp.len) for(var/type in temp) var/typename = "[type]" @@ -627,7 +627,7 @@ var/global/list/g_fancy_list_of_types = null var/list/outfits = list("Naked","Custom","As Job...") - var/list/paths = typesof(/datum/outfit) - /datum/outfit - typesof(/datum/outfit/job) + var/list/paths = subtypesof(/datum/outfit) - typesof(/datum/outfit/job) for(var/path in paths) var/datum/outfit/O = path //not much to initalize here but whatever outfits[initial(O.name)] = path diff --git a/code/modules/admin/verbs/manipulate_organs.dm b/code/modules/admin/verbs/manipulate_organs.dm index ae500213e59..7b9349403f5 100644 --- a/code/modules/admin/verbs/manipulate_organs.dm +++ b/code/modules/admin/verbs/manipulate_organs.dm @@ -6,7 +6,7 @@ var/list/organs = list() switch(operation) if("add organ") - for(var/path in typesof(/obj/item/organ/internal) - /obj/item/organ/internal) + for(var/path in subtypesof(/obj/item/organ/internal)) var/dat = replacetext("[path]", "/obj/item/organ/internal/", ":") organs[dat] = path @@ -16,7 +16,7 @@ organ.Insert(C) if("add implant") - for(var/path in typesof(/obj/item/weapon/implant) - /obj/item/weapon/implant) + for(var/path in subtypesof(/obj/item/weapon/implant)) var/dat = replacetext("[path]", "/obj/item/weapon/implant/", ":") organs[dat] = path diff --git a/code/modules/clothing/under/chameleon.dm b/code/modules/clothing/under/chameleon.dm index e6d1ecb8629..5f7ef6f487a 100644 --- a/code/modules/clothing/under/chameleon.dm +++ b/code/modules/clothing/under/chameleon.dm @@ -15,11 +15,11 @@ /obj/item/clothing/under/chameleon/New() ..() - for(var/U in typesof(/obj/item/clothing/under/color)-(/obj/item/clothing/under/color)) + for(var/U in subtypesof(/obj/item/clothing/under/color)) var/obj/item/clothing/under/V = new U src.clothing_choices += V - for(var/U in typesof(/obj/item/clothing/under/rank)-(/obj/item/clothing/under/rank)) + for(var/U in subtypesof(/obj/item/clothing/under/rank)) var/obj/item/clothing/under/V = new U src.clothing_choices += V return diff --git a/code/modules/clothing/under/color.dm b/code/modules/clothing/under/color.dm index c5bc98a2cc1..3c2713efad0 100644 --- a/code/modules/clothing/under/color.dm +++ b/code/modules/clothing/under/color.dm @@ -3,8 +3,7 @@ /obj/item/clothing/under/color/random/New() ..() - var/list/excluded = list(/obj/item/clothing/under/color/random, /obj/item/clothing/under/color) - var/obj/item/clothing/under/color/C = pick(typesof(/obj/item/clothing/under/color) - excluded) + var/obj/item/clothing/under/color/C = pick(subtypesof(/obj/item/clothing/under/color) - /obj/item/clothing/under/color/random) name = initial(C.name) icon_state = initial(C.icon_state) item_state = initial(C.item_state) diff --git a/code/modules/events/wizard/race.dm b/code/modules/events/wizard/race.dm index 7bbee2ba98c..cb4f4896f1b 100644 --- a/code/modules/events/wizard/race.dm +++ b/code/modules/events/wizard/race.dm @@ -10,7 +10,7 @@ var/all_the_same = 0 var/all_species = list() - for(var/speciestype in typesof(/datum/species) - /datum/species) + for(var/speciestype in subtypesof(/datum/species)) var/datum/species/S = new speciestype() if(!S.dangerous_existence) all_species += speciestype diff --git a/code/modules/food&drinks/kitchen machinery/processor.dm b/code/modules/food&drinks/kitchen machinery/processor.dm index 331d1c29449..371008ee51e 100644 --- a/code/modules/food&drinks/kitchen machinery/processor.dm +++ b/code/modules/food&drinks/kitchen machinery/processor.dm @@ -127,7 +127,7 @@ /datum/food_processor_process/mob/monkey/output = null /obj/machinery/processor/proc/select_recipe(X) - for (var/Type in typesof(/datum/food_processor_process) - /datum/food_processor_process - /datum/food_processor_process/mob) + for (var/Type in subtypesof(/datum/food_processor_process) - /datum/food_processor_process/mob) var/datum/food_processor_process/P = new Type() if (!istype(X, P.input)) continue diff --git a/code/modules/holodeck/computer.dm b/code/modules/holodeck/computer.dm index 78b73eaa337..6f31a22f717 100644 --- a/code/modules/holodeck/computer.dm +++ b/code/modules/holodeck/computer.dm @@ -69,7 +69,7 @@ /obj/machinery/computer/holodeck/initialize() program_cache = list() emag_programs = list() - for(var/typekey in typesof(program_type) - program_type) + for(var/typekey in subtypesof(program_type)) var/area/holodeck/A = locate(typekey) if(!A || A == offline_program) continue if(A.contents.len == 0) continue // not loaded diff --git a/code/modules/library/random_books.dm b/code/modules/library/random_books.dm index 9c703aec9c0..16c3dee6ac9 100644 --- a/code/modules/library/random_books.dm +++ b/code/modules/library/random_books.dm @@ -1,6 +1,6 @@ /obj/item/weapon/book/manual/random/New() - var/static/banned_books = list(/obj/item/weapon/book/manual,/obj/item/weapon/book/manual/random,/obj/item/weapon/book/manual/nuclear,/obj/item/weapon/book/manual/wiki) - var/newtype = pick(typesof(/obj/item/weapon/book/manual) - banned_books) + var/static/banned_books = list(/obj/item/weapon/book/manual/random,/obj/item/weapon/book/manual/nuclear,/obj/item/weapon/book/manual/wiki) + var/newtype = pick(subtypesof(/obj/item/weapon/book/manual) - banned_books) new newtype(loc) qdel(src) diff --git a/code/modules/mining/abandoned_crates.dm b/code/modules/mining/abandoned_crates.dm index 12adf16e326..129a0c0cc53 100644 --- a/code/modules/mining/abandoned_crates.dm +++ b/code/modules/mining/abandoned_crates.dm @@ -63,7 +63,7 @@ if(53 to 54) new /obj/item/toy/balloon(src) if(55 to 56) - var/newitem = pick(typesof(/obj/item/toy/prize) - /obj/item/toy/prize) + var/newitem = pick(subtypesof(/obj/item/toy/prize)) new newitem(src) if(57 to 58) new /obj/item/toy/syndicateballoon(src) @@ -85,7 +85,7 @@ if(67 to 68) var/t = rand(4,7) for(var/i = 0, i < t, ++i) - var /newitem = pick(typesof(/obj/item/weapon/stock_parts) - /obj/item/weapon/stock_parts - /obj/item/weapon/stock_parts/subspace) + var /newitem = pick(subtypesof(/obj/item/weapon/stock_parts) - /obj/item/weapon/stock_parts/subspace) new newitem(src) if(69 to 70) for(var/i = 0, i < 5, ++i) diff --git a/code/modules/mob/living/silicon/laws.dm b/code/modules/mob/living/silicon/laws.dm index c159c87cd41..b17e1c66afc 100644 --- a/code/modules/mob/living/silicon/laws.dm +++ b/code/modules/mob/living/silicon/laws.dm @@ -45,7 +45,7 @@ if(0) laws = new /datum/ai_laws/default/asimov() if(1) laws = new /datum/ai_laws/custom() if(2) - var/datum/ai_laws/lawtype = pick(typesof(/datum/ai_laws/default) - /datum/ai_laws/default) + var/datum/ai_laws/lawtype = pick(subtypesof(/datum/ai_laws/default)) laws = new lawtype() laws.associate(src) diff --git a/code/modules/ninja/suit/suit.dm b/code/modules/ninja/suit/suit.dm index c74a0b30edc..65d10c3eb07 100644 --- a/code/modules/ninja/suit/suit.dm +++ b/code/modules/ninja/suit/suit.dm @@ -66,7 +66,7 @@ Contents: //Research Init stored_research = new() - for(var/T in typesof(/datum/tech) - /datum/tech)//Store up on research. + for(var/T in subtypesof(/datum/tech))//Store up on research. stored_research += new T(src) //Reagent Init diff --git a/code/modules/projectiles/projectile/magic.dm b/code/modules/projectiles/projectile/magic.dm index 7a794bb3491..2dae06cb671 100644 --- a/code/modules/projectiles/projectile/magic.dm +++ b/code/modules/projectiles/projectile/magic.dm @@ -225,7 +225,7 @@ var/mob/living/carbon/human/H = new_mob if(prob(50)) var/list/all_species = list() - for(var/speciestype in typesof(/datum/species) - /datum/species) + for(var/speciestype in subtypesof(/datum/species)) var/datum/species/S = new speciestype() if(!S.dangerous_existence) all_species += speciestype diff --git a/code/modules/reagents/Chemistry-Holder.dm b/code/modules/reagents/Chemistry-Holder.dm index a66727f01d9..495f438bd7a 100644 --- a/code/modules/reagents/Chemistry-Holder.dm +++ b/code/modules/reagents/Chemistry-Holder.dm @@ -24,7 +24,7 @@ var/const/INJECT = 5 //injection //I dislike having these here but map-objects are initialised before world/New() is called. >_> if(!chemical_reagents_list) //Chemical Reagents - Initialises all /datum/reagent into a list indexed by reagent id - var/paths = typesof(/datum/reagent) - /datum/reagent + var/paths = subtypesof(/datum/reagent) chemical_reagents_list = list() for(var/path in paths) var/datum/reagent/D = new path() @@ -35,7 +35,7 @@ var/const/INJECT = 5 //injection // For example: // chemical_reaction_list["plasma"] is a list of all reactions relating to plasma - var/paths = typesof(/datum/chemical_reaction) - /datum/chemical_reaction + var/paths = subtypesof(/datum/chemical_reaction) chemical_reactions_list = list() for(var/path in paths) diff --git a/code/modules/reagents/Chemistry-Reagents/Other-Reagents.dm b/code/modules/reagents/Chemistry-Reagents/Other-Reagents.dm index d432ab1a3f6..747ba7e0dd6 100644 --- a/code/modules/reagents/Chemistry-Reagents/Other-Reagents.dm +++ b/code/modules/reagents/Chemistry-Reagents/Other-Reagents.dm @@ -359,8 +359,8 @@ H.visible_message("[H] falls to the ground and screams as their skin bubbles and froths!") //'froths' sounds painful when used with SKIN. H.Weaken(3) sleep(30) - var/list/blacklisted_species = list(/datum/species/zombie, /datum/species/skeleton, /datum/species/human, /datum/species/golem, /datum/species/golem/adamantine, /datum/species/shadow, /datum/species/shadow/ling, /datum/species/plasmaman, /datum/species) - var/list/possible_morphs = typesof(/datum/species/) - blacklisted_species + var/list/blacklisted_species = list(/datum/species/zombie, /datum/species/skeleton, /datum/species/human, /datum/species/golem, /datum/species/golem/adamantine, /datum/species/shadow, /datum/species/shadow/ling, /datum/species/plasmaman) + var/list/possible_morphs = subtypesof(/datum/species/) - blacklisted_species var/datum/species/mutation = pick(possible_morphs) if(prob(90) && mutation && H.dna.species != /datum/species/golem && H.dna.species != /datum/species/golem/adamantine) H << "The pain subsides. You feel... different." diff --git a/code/modules/reagents/Chemistry-Recipes/Slime_extracts.dm b/code/modules/reagents/Chemistry-Recipes/Slime_extracts.dm index 25391e5e7a8..29169f232fe 100644 --- a/code/modules/reagents/Chemistry-Recipes/Slime_extracts.dm +++ b/code/modules/reagents/Chemistry-Recipes/Slime_extracts.dm @@ -202,9 +202,7 @@ /datum/chemical_reaction/slimebork2/on_reaction(datum/reagents/holder) feedback_add_details("slime_cores_used","[type]") - var/list/blocked = list(/obj/item/weapon/reagent_containers/food/drinks) - - var/list/borks = typesof(/obj/item/weapon/reagent_containers/food/drinks) - blocked + var/list/borks = subtypesof(/obj/item/weapon/reagent_containers/food/drinks) // BORK BORK BORK playsound(get_turf(holder.my_atom), 'sound/effects/phasein.ogg', 100, 1) @@ -665,7 +663,7 @@ /datum/chemical_reaction/slimepaint/on_reaction(datum/reagents/holder) feedback_add_details("slime_cores_used","[type]") - var/list/paints = typesof(/obj/item/weapon/paint) - /obj/item/weapon/paint + var/list/paints = subtypesof(/obj/item/weapon/paint) var/chosen = pick(paints) var/obj/P = new chosen if(P) diff --git a/code/modules/research/rdconsole.dm b/code/modules/research/rdconsole.dm index 95757a85469..b1c29467930 100644 --- a/code/modules/research/rdconsole.dm +++ b/code/modules/research/rdconsole.dm @@ -55,7 +55,7 @@ won't update every console in existence) but it's more of a hassle to do. Also, /proc/CallTechName(ID) //A simple helper proc to find the name of a tech with a given ID. var/datum/tech/check_tech var/return_name = null - for(var/T in typesof(/datum/tech) - /datum/tech) + for(var/T in subtypesof(/datum/tech)) check_tech = null check_tech = new T() if(check_tech.id == ID) @@ -89,7 +89,7 @@ proc/CallMaterialName(ID) if("clown") return_name = "Bananium" else - for(var/R in typesof(/datum/reagent) - /datum/reagent) + for(var/R in subtypesof(/datum/reagent)) temp_reagent = null temp_reagent = new R() if(temp_reagent.id == ID) diff --git a/code/modules/research/research.dm b/code/modules/research/research.dm index 7d714de9710..77b65ba32e3 100644 --- a/code/modules/research/research.dm +++ b/code/modules/research/research.dm @@ -53,9 +53,9 @@ research holder datum. var/list/known_designs = list() //List of available designs (at base reliability). /datum/research/New() //Insert techs into possible_tech here. Known_tech automatically updated. - for(var/T in typesof(/datum/tech) - /datum/tech) + for(var/T in subtypesof(/datum/tech)) possible_tech += new T(src) - for(var/D in typesof(/datum/design) - /datum/design) + for(var/D in subtypesof(/datum/design)) possible_designs += new D(src) RefreshResearch() @@ -167,9 +167,9 @@ research holder datum. //Autolathe files /datum/research/autolathe/New() - for(var/T in (typesof(/datum/tech) - /datum/tech)) + for(var/T in (subtypesof(/datum/tech))) possible_tech += new T(src) - for(var/path in typesof(/datum/design) - /datum/design) + for(var/path in subtypesof(/datum/design)) var/datum/design/D = new path(src) possible_designs += D if((D.build_type & AUTOLATHE) && ("initial" in D.category)) //autolathe starts without hacked designs