Replaces typesof with subtypesof where applicable

This commit is contained in:
DZD
2015-08-03 11:04:28 -04:00
parent 809be52c98
commit d9bb30f47a
55 changed files with 93 additions and 97 deletions
+1 -1
View File
@@ -179,7 +179,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
@@ -395,8 +395,8 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that
set name = "Del-All"
// to prevent REALLY stupid deletions
var/blocked = list(/obj, /mob, /mob/living, /mob/living/carbon, /mob/living/carbon/human, /mob/dead, /mob/dead/observer, /mob/living/silicon, /mob/living/silicon/robot, /mob/living/silicon/ai)
var/hsbitem = input(usr, "Choose an object to delete.", "Delete:") as null|anything in typesof(/obj) + typesof(/mob) - blocked
var/blocked = list(/mob/living, /mob/living/carbon, /mob/living/carbon/human, /mob/dead, /mob/dead/observer, /mob/living/silicon, /mob/living/silicon/robot, /mob/living/silicon/ai)
var/hsbitem = input(usr, "Choose an object to delete.", "Delete:") as null|anything in subtypesof(/obj) + subtypesof(/mob) - blocked
if(hsbitem)
for(var/atom/O in world)
if(istype(O, hsbitem))
+1 -1
View File
@@ -1,4 +1,4 @@
var/global/automation_types=typesof(/datum/automation) - /datum/automation
var/global/automation_types = subtypesof(/datum/automation)
#define AUTOM_RT_NULL 0
#define AUTOM_RT_NUM 1
@@ -2,7 +2,7 @@ var/list/spawntypes = list()
/proc/populate_spawn_points()
spawntypes = list()
for(var/type in typesof(/datum/spawnpoint)-/datum/spawnpoint)
for(var/type in subtypesof(/datum/spawnpoint))
var/datum/spawnpoint/S = new type()
spawntypes[S.display_name] = S
+2 -2
View File
@@ -11,11 +11,11 @@
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
+2 -2
View File
@@ -3,8 +3,8 @@
/obj/item/clothing/under/color/random/New()
..()
var/list/excluded = list(/obj/item/clothing/under/color/random, /obj/item/clothing/under/color, /obj/item/clothing/under/color/blackf, /obj/item/clothing/under/color/blue/dodgeball, /obj/item/clothing/under/color/orange/prison, /obj/item/clothing/under/color/red/dodgeball, /obj/item/clothing/under/color/red/jersey, /obj/item/clothing/under/color/blue/jersey)
var/obj/item/clothing/under/color/C = pick(typesof(/obj/item/clothing/under/color) - excluded)
var/list/excluded = list(/obj/item/clothing/under/color/random, /obj/item/clothing/under/color/blackf, /obj/item/clothing/under/color/blue/dodgeball, /obj/item/clothing/under/color/orange/prison, /obj/item/clothing/under/color/red/dodgeball, /obj/item/clothing/under/color/red/jersey, /obj/item/clothing/under/color/blue/jersey)
var/obj/item/clothing/under/color/C = pick(subtypesof(/obj/item/clothing/under/color) - excluded)
name = initial(C.name)
icon_state = initial(C.icon_state)
item_state = initial(C.item_state)
+1 -1
View File
@@ -82,5 +82,5 @@
/obj/item/weapon/storage/box/testing_disks
New()
..()
for(var/typekey in typesof(/obj/item/weapon/disk/file) - /obj/item/weapon/disk/file)
for(var/typekey in subtypesof(/obj/item/weapon/disk/file))
new typekey(src)
+1 -1
View File
@@ -89,7 +89,7 @@ var/setup_economy = 0
newChannel.is_admin_channel = 1
news_network.network_channels += newChannel
for(var/loc_type in typesof(/datum/trade_destination) - /datum/trade_destination)
for(var/loc_type in subtypesof(/datum/trade_destination))
var/datum/trade_destination/D = new loc_type
weighted_randomevent_locations[D] = D.viable_random_events.len
weighted_mundaneevent_locations[D] = D.viable_mundane_events.len
+1 -1
View File
@@ -22,7 +22,7 @@
var/datum/event_meta/new_event = new
/datum/event_manager/New()
allEvents = typesof(/datum/event) - /datum/event
allEvents = subtypesof(/datum/event)
/datum/event_manager/proc/process()
for(var/datum/event/E in event_manager.active_events)
+2 -2
View File
@@ -58,7 +58,7 @@
/obj/machinery/cooking/oven/updatefood()
for(var/U in food_choices)
food_choices.Remove(U)
for(var/U in typesof(/obj/item/weapon/reagent_containers/food/snacks/customizable/cook)-(/obj/item/weapon/reagent_containers/food/snacks/customizable/cook))
for(var/U in subtypesof(/obj/item/weapon/reagent_containers/food/snacks/customizable/cook))
var/obj/item/weapon/reagent_containers/food/snacks/customizable/cook/V = new U
src.food_choices += V
return
@@ -73,7 +73,7 @@
/obj/machinery/cooking/candy/updatefood()
for(var/U in food_choices)
food_choices.Remove(U)
for(var/U in typesof(/obj/item/weapon/reagent_containers/food/snacks/customizable/candy)-(/obj/item/weapon/reagent_containers/food/snacks/customizable/candy))
for(var/U in subtypesof(/obj/item/weapon/reagent_containers/food/snacks/customizable/candy))
var/obj/item/weapon/reagent_containers/food/snacks/customizable/candy/V = new U
src.food_choices += V
return
+1 -1
View File
@@ -77,7 +77,7 @@
proc/trigger_side_effect(mob/living/carbon/human/H)
spawn
if(!istype(H)) return
var/tp = pick(typesof(/datum/genetics/side_effect) - /datum/genetics/side_effect)
var/tp = pick(subtypesof(/datum/genetics/side_effect))
var/datum/genetics/side_effect/S = new tp
S.start(H)
+1 -1
View File
@@ -9,7 +9,7 @@
/datum/genetree/New(var/obj/machinery/networked/biomass_controller/holder)
biomass = holder
// Build list of all sectors
for(var/typepath in typesof(/datum/genetic_sector) - /datum/genetic_sector)
for(var/typepath in subtypesof(/datum/genetic_sector))
var/datum/genetic_sector/sector = new typepath
sectors[sector.id]=sector
+1 -1
View File
@@ -328,7 +328,7 @@
if(!check_rights(R_SERVER)) return
var/list/choice = list()
for(var/H in typesof(/datum/holiday) - /datum/holiday)
for(var/H in subtypesof(/datum/holiday))
choice += "[H]"
choice += "--CANCEL--"
+1 -1
View File
@@ -71,7 +71,7 @@ var/global/datum/controller/plants/plant_controller // Set in New().
plant_product_sprites |= copytext(icostate,1,split)
// Populate the global seed datum list.
for(var/type in typesof(/datum/seed)-/datum/seed)
for(var/type in subtypesof(/datum/seed))
var/datum/seed/S = new type
seeds[S.name] = S
S.uid = "[seeds.len]"
+1 -1
View File
@@ -8,7 +8,7 @@
/obj/effect/landmark/animal_spawner/New()
if(!spawn_type)
var/new_type = pick(typesof(/obj/effect/landmark/animal_spawner) - /obj/effect/landmark/animal_spawner)
var/new_type = pick(subtypesof(/obj/effect/landmark/animal_spawner))
new new_type(get_turf(src))
qdel(src)
+1 -1
View File
@@ -95,7 +95,7 @@
var/amount = rand(2,6)
var/quantity = rand(10,50)
var/list/possible_spawns = list()
for(var/bar_type in typesof(/obj/item/stack/sheet/mineral) - /obj/item/stack/sheet/mineral - /obj/item/stack/sheet/mineral/enruranium)
for(var/bar_type in subtypesof(/obj/item/stack/sheet/mineral) - /obj/item/stack/sheet/mineral/enruranium)
possible_spawns += bar_type
var/bar_type = pick(possible_spawns)
+1 -1
View File
@@ -13,7 +13,7 @@
var/list/datum/material/storage[0]
/datum/materials/New()
for(var/matdata in typesof(/datum/material) - /datum/material)
for(var/matdata in subtypesof(/datum/material))
var/datum/material/mat = new matdata
storage[mat.id]=mat
+1 -1
View File
@@ -2,7 +2,7 @@ var/list/name_to_mineral
proc/SetupMinerals()
name_to_mineral = list()
for(var/type in typesof(/mineral) - /mineral)
for(var/type in subtypesof(/mineral))
var/mineral/new_mineral = new type
if(!new_mineral.name)
continue
+1 -1
View File
@@ -3,7 +3,7 @@
#define TURF_FLOOR 0
#define TURF_WALL 1
var/global/list/mining_surprises = typesof(/mining_surprise)-/mining_surprise
var/global/list/mining_surprises = subtypesof(/mining_surprise)
/surprise_turf_info
var/list/types[0]
@@ -15,7 +15,7 @@ var/global/list/pai_software_by_key = list()
var/global/list/default_pai_software = list()
/hook/startup/proc/populate_pai_software_list()
var/r = 1 // I would use ., but it'd sacrifice runtime detection
for(var/type in typesof(/datum/pai_software) - /datum/pai_software)
for(var/type in subtypesof(/datum/pai_software))
var/datum/pai_software/P = new type()
if(pai_software_by_key[P.id])
var/datum/pai_software/O = pai_software_by_key[P.id]
@@ -110,8 +110,8 @@
if(0) laws = new /datum/ai_laws/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)
laws = new lawtype()
var/datum/ai_laws/lawtype = pick(subtypesof(/datum/ai_laws/default))
laws = new lawtype()
/mob/living/silicon/robot/proc/statelaws() // -- TLE
// set category = "AI Commands"
@@ -200,4 +200,4 @@
list += {"<br><br><A href='byond://?src=\ref[src];laws=1'>State Laws</A>"}
usr << browse(list, "window=laws")
usr << browse(list, "window=laws")
+2 -2
View File
@@ -18,7 +18,7 @@ datum
//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()
@@ -29,7 +29,7 @@ datum
// 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)
+3 -3
View File
@@ -555,7 +555,7 @@ datum
required_other = 1
on_reaction(var/datum/reagents/holder)
var/list/borks = typesof(/obj/item/weapon/reagent_containers/food/snacks) - /obj/item/weapon/reagent_containers/food/snacks
var/list/borks = subtypesof(/obj/item/weapon/reagent_containers/food/snacks)
// BORK BORK BORK
playsound(get_turf(holder.my_atom), 'sound/effects/phasein.ogg', 100, 1)
@@ -582,7 +582,7 @@ datum
required_other = 1
on_reaction(var/datum/reagents/holder)
var/list/borks = typesof(/obj/item/weapon/reagent_containers/food/drinks) - /obj/item/weapon/reagent_containers/food/drinks
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)
@@ -888,7 +888,7 @@ datum
required_other = 1
on_reaction(var/datum/reagents/holder)
feedback_add_details("slime_cores_used","[replacetext(name," ","_")]")
var/list/paints = typesof(/obj/item/weapon/reagent_containers/glass/paint) - /obj/item/weapon/reagent_containers/glass/paint
var/list/paints = subtypesof(/obj/item/weapon/reagent_containers/glass/paint)
var/chosen = pick(paints)
var/obj/P = new chosen
if(P)
+2 -2
View File
@@ -57,7 +57,7 @@ won't update every console in existence) but it's more of a hassle to do. Also,
/obj/machinery/computer/rdconsole/proc/CallTechName(var/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)
@@ -91,7 +91,7 @@ won't update every console in existence) but it's more of a hassle to do. Also,
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)
+6 -6
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()
@@ -140,7 +140,7 @@ research holder datum.
D.reliability = min(100, D.reliability + rand(1,3))
if(I.crit_fail)
D.reliability = min(100, D.reliability + rand(3, 5))
/datum/research/proc/FindDesignByID(var/id)
for(var/datum/design/D in known_designs)
if(D.id == id)
@@ -148,9 +148,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
@@ -278,7 +278,7 @@ datum/tech/robotics
/obj/item/weapon/disk/tech_disk/New()
src.pixel_x = rand(-5.0, 5)
src.pixel_y = rand(-5.0, 5)
/obj/item/weapon/disk/design_disk
name = "Component Design Disk"
desc = "A disk for storing device design data for construction in lathes."
@@ -72,12 +72,12 @@ var/list/valid_secondary_effect_types = list(\
..()
//setup primary effect - these are the main ones (mixed)
var/effecttype = pick(typesof(/datum/artifact_effect) - /datum/artifact_effect)
var/effecttype = pick(subtypesof(/datum/artifact_effect))
my_effect = new effecttype(src)
//75% chance to have a secondary stealthy (and mostly bad) effect
if(prob(75))
effecttype = pick(typesof(/datum/artifact_effect) - /datum/artifact_effect)
effecttype = pick(subtypesof(/datum/artifact_effect))
secondary_effect = new effecttype(src)
if(prob(75))
secondary_effect.ToggleActivate(0)
@@ -324,8 +324,7 @@
apply_image_decorations = 0
apply_material_decorations = 0
if(24)
var/list/possible_spawns = typesof(/obj/item/weapon/stock_parts)
possible_spawns -= /obj/item/weapon/stock_parts
var/list/possible_spawns = subtypesof(/obj/item/weapon/stock_parts)
possible_spawns -= /obj/item/weapon/stock_parts/subspace
var/new_type = pick(possible_spawns)
+1 -1
View File
@@ -25,7 +25,7 @@ var/global/datum/store/centcomm_store=new
var/obj/machinery/account_database/linked_db
/datum/store/New()
for(var/itempath in typesof(/datum/storeitem) - /datum/storeitem/)
for(var/itempath in subtypesof(/datum/storeitem))
items += new itempath()
/datum/store/proc/charge(var/datum/mind/mind,var/amount,var/datum/storeitem/item)
+1 -1
View File
@@ -15,7 +15,7 @@
/datum/disease2/effectholder/proc/getrandomeffect(var/badness = 1)
var/list/datum/disease2/effect/list = list()
for(var/e in (typesof(/datum/disease2/effect) - /datum/disease2/effect))
for(var/e in subtypesof(/datum/disease2/effect))
var/datum/disease2/effect/f = new e
if (f.badness > badness) //we don't want such strong effects
continue