Merge pull request #13063 from Incoming5643/subtypesof

Adds subtypesof(path)
This commit is contained in:
Cheridan
2015-11-19 16:31:09 -06:00
46 changed files with 73 additions and 81 deletions
+1 -1
View File
@@ -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
+2 -2
View File
@@ -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
@@ -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
+2 -2
View File
@@ -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
+1 -2
View File
@@ -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)
+1 -1
View File
@@ -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
@@ -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
+1 -1
View File
@@ -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
+2 -2
View File
@@ -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)
+2 -2
View File
@@ -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)
+1 -1
View File
@@ -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)
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
+2 -2
View File
@@ -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)
@@ -359,8 +359,8 @@
H.visible_message("<b>[H]</b> 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 << "<span class='danger'>The pain subsides. You feel... different.</span>"
@@ -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)
+2 -2
View File
@@ -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)
+4 -4
View File
@@ -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