Change various things to subtypesof()

This commit is contained in:
Aronai Sieyes
2021-07-20 12:54:59 -04:00
parent 34982728cb
commit 669d23322c
49 changed files with 68 additions and 66 deletions
+1 -1
View File
@@ -12,7 +12,7 @@ var/datum/admin_secrets/admin_secrets = new()
for(var/datum/admin_secret_category/category in categories)
category_assoc[category.type] = category
for(var/item_type in (typesof(/datum/admin_secret_item) - /datum/admin_secret_item))
for(var/item_type in subtypesof(/datum/admin_secret_item))
var/datum/admin_secret_item/secret_item = item_type
if(!initial(secret_item.name))
continue
+1 -1
View File
@@ -302,7 +302,7 @@
to_chat(usr, "<span class='warning'>Looks like you didn't select a mob.</span>")
return
var/list/possible_modifiers = typesof(/datum/modifier) - /datum/modifier
var/list/possible_modifiers = subtypesof(/datum/modifier)
var/new_modifier_type = tgui_input_list(usr, "What modifier should we add to [L]?", "Modifier Type", possible_modifiers)
if(!new_modifier_type)
+1 -1
View File
@@ -63,7 +63,7 @@
//credits
var/amount = rand(2,6)
var/list/possible_spawns = list()
for(var/cash_type in typesof(/obj/item/weapon/spacecash) - /obj/item/weapon/spacecash)
for(var/cash_type in subtypesof(/obj/item/weapon/spacecash))
possible_spawns += cash_type
var/cash_type = pick(possible_spawns)
+1 -1
View File
@@ -7,7 +7,7 @@ var/datum/lore/loremaster/loremaster = new/datum/lore/loremaster
/datum/lore/loremaster/New()
var/list/paths = typesof(/datum/lore/organization) - /datum/lore/organization
var/list/paths = subtypesof(/datum/lore/organization)
for(var/path in paths)
// Some intermediate paths are not real organizations (ex. /datum/lore/organization/mil). Only do ones with names
var/datum/lore/organization/instance = path
+1 -1
View File
@@ -7,7 +7,7 @@ var/datum/lore/loremaster/loremaster = new/datum/lore/loremaster
/datum/lore/loremaster/New()
var/list/paths = typesof(/datum/lore/organization) - /datum/lore/organization
var/list/paths = subtypesof(/datum/lore/organization)
for(var/path in paths)
// Some intermediate paths are not real organizations (ex. /datum/lore/organization/mil). Only do ones with names
var/datum/lore/organization/instance = path
@@ -53,7 +53,7 @@
/datum/gear/plushie/New()
..()
var/list/plushies = list()
for(var/obj/item/toy/plushie/plushie_type as anything in subtypesof(/obj/item/toy/plushie/) - /obj/item/toy/plushie/therapy)
for(var/obj/item/toy/plushie/plushie_type as anything in subtypesof(/obj/item/toy/plushie) - /obj/item/toy/plushie/therapy)
plushies[initial(plushie_type.name)] = plushie_type
gear_tweaks += new/datum/gear_tweak/path(sortAssoc(plushies))
@@ -65,7 +65,7 @@
/datum/gear/figure/New()
..()
var/list/figures = list()
for(var/obj/item/toy/figure/figure_type as anything in typesof(/obj/item/toy/figure/) - /obj/item/toy/figure)
for(var/obj/item/toy/figure/figure_type as anything in subtypesof(/obj/item/toy/figure))
figures[initial(figure_type.name)] = figure_type
gear_tweaks += new/datum/gear_tweak/path(sortAssoc(figures))
@@ -18,7 +18,7 @@
/datum/gear/character/New()
..()
var/list/characters = list()
for(var/obj/item/toy/character/character_type as anything in typesof(/obj/item/toy/character/) - /obj/item/toy/character)
for(var/obj/item/toy/character/character_type as anything in subtypesof(/obj/item/toy/character))
characters[initial(character_type.name)] = character_type
gear_tweaks += new/datum/gear_tweak/path(sortAssoc(characters))
@@ -30,7 +30,7 @@
/datum/gear/mechtoy/New()
..()
var/list/mechs = list()
for(var/obj/item/toy/mecha/mech_type as anything in typesof(/obj/item/toy/mecha/) - /obj/item/toy/mecha/)
for(var/obj/item/toy/mecha/mech_type as anything in subtypesof(/obj/item/toy/mecha))
mechs[initial(mech_type.name)] = mech_type
gear_tweaks += new/datum/gear_tweak/path(sortAssoc(mechs))
@@ -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
+1 -1
View File
@@ -60,7 +60,7 @@ var/global/economy_init = 0
news_network.CreateFeedChannel("The Gibson Gazette", "Editor Mike Hammers", 1, 1)
news_network.CreateFeedChannel("Oculum Content Aggregator", "Oculus v6rev7", 1, 1)
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.mundane_probability
+3 -3
View File
@@ -252,7 +252,7 @@
//
/datum/event/supply_demand/proc/choose_food_items(var/differentTypes)
var/list/types = typesof(/datum/recipe) - /datum/recipe
var/list/types = subtypesof(/datum/recipe)
for(var/i in 1 to differentTypes)
var/datum/recipe/R = pick(types)
types -= R // Don't pick the same thing twice
@@ -262,7 +262,7 @@
return
/datum/event/supply_demand/proc/choose_research_items(var/differentTypes)
var/list/types = typesof(/datum/design) - /datum/design
var/list/types = subtypesof(/datum/design)
for(var/i in 1 to differentTypes)
var/datum/design/D = pick(types)
types -= D // Don't pick the same thing twice
@@ -327,7 +327,7 @@
return
/datum/event/supply_demand/proc/choose_alloy_items(var/differentTypes)
var/list/types = typesof(/datum/alloy) - /datum/alloy
var/list/types = subtypesof(/datum/alloy)
for(var/i in 1 to differentTypes)
var/datum/alloy/A = pick(types)
types -= A // Don't pick the same thing twice
+1 -1
View File
@@ -43,7 +43,7 @@
if(!available_recipes)
available_recipes = new
for(var/datum/recipe/type as anything in (typesof(/datum/recipe)-/datum/recipe))
for(var/datum/recipe/type as anything in subtypesof(/datum/recipe))
if((initial(type.appliance) & appliancetype))
available_recipes += new type
+1 -1
View File
@@ -15,7 +15,7 @@
"Catalysts" = CR.catalysts)
//////////////////////// FOOD
var/list/food_recipes = typesof(/datum/recipe) - /datum/recipe
var/list/food_recipes = subtypesof(/datum/recipe)
//Build a useful list
for(var/Rp in food_recipes)
//Lists don't work with datum-stealing no-instance initial() so we have to.
+1 -1
View File
@@ -67,7 +67,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)
+2 -2
View File
@@ -58,7 +58,7 @@
if(53 to 54)
new/obj/item/latexballon(src)
if(55 to 56)
var/newitem = pick(typesof(/obj/item/toy/mecha) - /obj/item/toy/mecha)
var/newitem = pick(subtypesof(/obj/item/toy/mecha))
new newitem(src)
if(57 to 58)
new/obj/item/toy/syndicateballoon(src)
@@ -77,7 +77,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)
new/obj/item/weapon/pickaxe/silver(src)
@@ -56,7 +56,7 @@
if(life_tick % 15 != 0)
return 0
var/list/L = typesof(/datum/medical_effect)-/datum/medical_effect
var/list/L = subtypesof(/datum/medical_effect)
for(var/T in L)
var/datum/medical_effect/M = new T
if (M.manifest(src))
@@ -56,7 +56,7 @@
if(life_tick % 15 != 0)
return 0
var/list/L = typesof(/datum/medical_effect)-/datum/medical_effect
var/list/L = subtypesof(/datum/medical_effect)
for(var/T in L)
var/datum/medical_effect/M = new T
if (M.manifest(src))
@@ -751,7 +751,7 @@
update_eyes()
// hair
var/list/all_hairs = typesof(/datum/sprite_accessory/hair) - /datum/sprite_accessory/hair
var/list/all_hairs = subtypesof(/datum/sprite_accessory/hair)
var/list/hairs = list()
// loop through potential hairs
@@ -767,7 +767,7 @@
h_style = new_style
// facial hair
var/list/all_fhairs = typesof(/datum/sprite_accessory/facial_hair) - /datum/sprite_accessory/facial_hair
var/list/all_fhairs = subtypesof(/datum/sprite_accessory/facial_hair)
var/list/fhairs = list()
for(var/x in all_fhairs)
@@ -21,7 +21,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]
+1 -1
View File
@@ -159,7 +159,7 @@ var/global/list/SKILL_PRE = list("Engineer" = SKILL_ENGINEER, "Roboticist" = SKI
/proc/setup_skills()
if(SKILLS == null)
SKILLS = list()
for(var/T in (typesof(/datum/skill)-/datum/skill))
for(var/T in subtypesof(/datum/skill))
var/datum/skill/S = new T
if(S.ID != "none")
if(!SKILLS.Find(S.field))
@@ -17,7 +17,8 @@ var/list/fusion_reactions
/proc/get_fusion_reaction(var/p_react, var/s_react, var/m_energy)
if(!fusion_reactions)
fusion_reactions = list()
for(var/rtype in typesof(/decl/fusion_reaction) - /decl/fusion_reaction)
for(var/rtype in subtypesof(/decl/fusion_reaction)
)
var/decl/fusion_reaction/cur_reaction = new rtype()
if(!fusion_reactions[cur_reaction.p_react])
fusion_reactions[cur_reaction.p_react] = list()
+1 -1
View File
@@ -158,7 +158,7 @@
var/mob/living/spawned_mob
var/list/spawned_mobs = list()
var/spawn_path = tgui_input_list(usr, "Select a mob type.", "Drop Pod Selection", typesof(/mob/living)-/mob/living)
var/spawn_path = tgui_input_list(usr, "Select a mob type.", "Drop Pod Selection", subtypesof(/mob/living))
if(!spawn_path)
return
+2 -2
View File
@@ -55,14 +55,14 @@
choice = tgui_alert(usr, "Do you wish to add structures or machines?","Supply Drop",list("No","Yes"))
if(choice == "Yes")
while(1)
var/adding_loot_type = tgui_input_list(usr, "Select a new loot path. Cancel to finish.", "Loot Selection", typesof(/obj) - typesof(/obj/item))
var/adding_loot_type = tgui_input_list(usr, "Select a new loot path. Cancel to finish.", "Loot Selection", subtypesof(/obj))
if(!adding_loot_type)
break
chosen_loot_types |= adding_loot_type
choice = tgui_alert(usr, "Do you wish to add any non-weapon items?","Supply Drop",list("No","Yes"))
if(choice == "Yes")
while(1)
var/adding_loot_type = tgui_input_list(usr, "Select a new loot path. Cancel to finish.", "Loot Selection", typesof(/obj/item) - typesof(/obj/item/weapon))
var/adding_loot_type = tgui_input_list(usr, "Select a new loot path. Cancel to finish.", "Loot Selection", subtypesof(/obj/item))
if(!adding_loot_type)
break
chosen_loot_types |= adding_loot_type
+2 -2
View File
@@ -24,14 +24,14 @@
switch(val)
if(2 to 3)
if(prob(60))
var/grass_path = pick(typesof(/obj/structure/flora/grass)-/obj/structure/flora/grass)
var/grass_path = pick(subtypesof(/obj/structure/flora/grass))
new grass_path(T)
if(prob(5))
var/mob_type = pick(list(/mob/living/simple_mob/animal/passive/lizard, /mob/living/simple_mob/animal/passive/mouse))
new mob_type(T)
if(5 to 6)
if(prob(20))
var/grass_path = pick(typesof(/obj/structure/flora/grass)-/obj/structure/flora/grass)
var/grass_path = pick(subtypesof(/obj/structure/flora/grass))
new grass_path(T)
if(7 to 9)
if(prob(60))
+1 -1
View File
@@ -36,7 +36,7 @@
if(!holder) return
var/map_datum = tgui_input_list(usr, "Choose a map to create.", "Map Choice", typesof(/datum/random_map)-/datum/random_map)
var/map_datum = tgui_input_list(usr, "Choose a map to create.", "Map Choice", subtypesof(/datum/random_map))
if(!map_datum)
return
@@ -208,7 +208,8 @@
result_amount = 1
/decl/chemical_reaction/instant/slime_food/on_reaction(var/datum/reagents/holder)
var/list/borks = typesof(/obj/item/weapon/reagent_containers/food/snacks) - /obj/item/weapon/reagent_containers/food/snacks // BORK BORK BORK
var/list/borks = subtypesof(/obj/item/weapon/reagent_containers/food/snacks)
playsound(holder.my_atom, 'sound/effects/phasein.ogg', 100, 1)
+2 -2
View File
@@ -52,12 +52,12 @@ GLOBAL_LIST_INIT(design_datums, list())
/datum/research/New() //Insert techs into possible_tech here. Known_tech automatically updated.
if(!LAZYLEN(GLOB.design_datums))
for(var/T in typesof(/datum/design) - /datum/design)
for(var/T in subtypesof(/datum/design))
GLOB.design_datums += new T
possible_designs = GLOB.design_datums
if(!LAZYLEN(known_tech))
for(var/T in typesof(/datum/tech) - /datum/tech)
for(var/T in subtypesof(/datum/tech))
known_tech += new T
RefreshResearch()
+1 -1
View File
@@ -447,7 +447,7 @@ var/global/list/infomorph_software_by_key = list()
var/global/list/default_infomorph_software = list()
/hook/startup/proc/populate_infomorph_software_list()
var/r = 1 // I would use ., but it'd sacrifice runtime detection
for(var/type in typesof(/datum/infomorph_software) - /datum/infomorph_software)
for(var/type in subtypesof(/datum/infomorph_software))
var/datum/infomorph_software/P = new type()
if(infomorph_software_by_key[P.id])
var/datum/infomorph_software/O = infomorph_software_by_key[P.id]
+1 -1
View File
@@ -193,7 +193,7 @@
/datum/shuttle_web_master/proc/build_destinations()
// First, instantiate all the destination subtypes relevant to this datum.
var/list/destination_types = typesof(destination_class) - destination_class
var/list/destination_types = subtypesof(destination_class)
for(var/new_type in destination_types)
var/datum/shuttle_destination/D = new_type
if(initial(D.skip_me))
+1 -1
View File
@@ -8,7 +8,7 @@
var/list/command_name_types = list()
var/list/warned_command_names = warnings_only ? list() : null
var/warned_about_the_dangers_of_robutussin = !warnings_only
for(var/I in typesof(/datum/tgs_chat_command) - /datum/tgs_chat_command)
for(var/I in subtypesof(/datum/tgs_chat_command))
if(!warned_about_the_dangers_of_robutussin)
TGS_ERROR_LOG("Custom chat commands in [ApiVersion()] lacks the /datum/tgs_chat_user/sender.channel field!")
warned_about_the_dangers_of_robutussin = TRUE
+1 -1
View File
@@ -1,7 +1,7 @@
/datum/tgs_api/v4/proc/ListCustomCommands()
var/results = list()
custom_commands = list()
for(var/I in typesof(/datum/tgs_chat_command) - /datum/tgs_chat_command)
for(var/I in subtypesof(/datum/tgs_chat_command))
var/datum/tgs_chat_command/stc = new I
var/command_name = stc.name
if(!command_name || findtext(command_name, " ") || findtext(command_name, "'") || findtext(command_name, "\""))
+1 -1
View File
@@ -1,7 +1,7 @@
/datum/tgs_api/v5/proc/ListCustomCommands()
var/results = list()
custom_commands = list()
for(var/I in typesof(/datum/tgs_chat_command) - /datum/tgs_chat_command)
for(var/I in subtypesof(/datum/tgs_chat_command))
var/datum/tgs_chat_command/stc = new I
var/command_name = stc.name
if(!command_name || findtext(command_name, " ") || findtext(command_name, "'") || findtext(command_name, "\""))
@@ -33,11 +33,11 @@
secondary_effect.ToggleActivate(0)
else
var/effecttype = pick(typesof(/datum/artifact_effect) - /datum/artifact_effect)
var/effecttype = pick(subtypesof(/datum/artifact_effect))
my_effect = new effecttype(src)
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)
@@ -85,11 +85,11 @@
secondary_effect.trigger = predefined_trig_secondary
/obj/machinery/artifact/proc/choose_effect()
var/effect_type = tgui_input_list(usr, "What type do you want?", "Effect Type", typesof(/datum/artifact_effect) - /datum/artifact_effect)
var/effect_type = tgui_input_list(usr, "What type do you want?", "Effect Type", subtypesof(/datum/artifact_effect))
if(effect_type)
my_effect = new effect_type(src)
if(tgui_alert(usr, "Do you want a secondary effect?", "Second Effect", list("No", "Yes")) == "Yes")
var/second_effect_type = tgui_input_list(usr, "What type do you want as well?", "Second Effect Type", typesof(/datum/artifact_effect) - list(/datum/artifact_effect, effect_type))
var/second_effect_type = tgui_input_list(usr, "What type do you want as well?", "Second Effect Type", subtypesof(/datum/artifact_effect) - effect_type)
secondary_effect = new second_effect_type(src)
else
secondary_effect = null
+1 -1
View File
@@ -82,7 +82,7 @@ Slime definitions, Life and New live here.
/mob/living/simple_mob/xeno/slime/New()
..()
for(var/datum/language/L in (typesof(/datum/language) - /datum/language))
for(var/datum/language/L in subtypesof(/datum/language))
languages += L
speak += "[station_name()]?"
traitdat.source = "Slime"
+1 -1
View File
@@ -29,7 +29,7 @@
/hook/startup/proc/generateGasData()
gas_data = new
for(var/p in (typesof(/decl/xgm_gas) - /decl/xgm_gas))
for(var/p in subtypesof(/decl/xgm_gas))
var/decl/xgm_gas/gas = new p //avoid initial() because of potential New() actions
if(gas.id in gas_data.gases)