diff --git a/code/_globalvars/lists/typecache.dm b/code/_globalvars/lists/typecache.dm index bfadbc9104b..96807214f2f 100644 --- a/code/_globalvars/lists/typecache.dm +++ b/code/_globalvars/lists/typecache.dm @@ -5,4 +5,8 @@ GLOBAL_LIST_INIT(typecache_mob, typecacheof(/mob)) +GLOBAL_LIST_INIT(typecache_living, typecacheof(/mob/living)) + +GLOBAL_LIST_INIT(typecache_stack, typecacheof(/obj/item/stack)) + GLOBAL_LIST_INIT(typecache_machine_or_structure, typecacheof(list(/obj/machinery, /obj/structure))) diff --git a/code/datums/components/material_container.dm b/code/datums/components/material_container.dm index 759b07f8c68..202de771978 100644 --- a/code/datums/components/material_container.dm +++ b/code/datums/components/material_container.dm @@ -27,8 +27,13 @@ max_amount = max(0, max_amt) show_on_examine = _show_on_examine disable_attackby = _disable_attackby + if(allowed_types) - allowed_typecache = typecacheof(allowed_types) + if(ispath(allowed_types) && allowed_types == /obj/item/stack) + allowed_typecache = GLOB.typecache_stack + else + allowed_typecache = typecacheof(allowed_types) + precondition = _precondition after_insert = _after_insert diff --git a/code/datums/components/remote_materials.dm b/code/datums/components/remote_materials.dm index b69c15c3297..b746997bb72 100644 --- a/code/datums/components/remote_materials.dm +++ b/code/datums/components/remote_materials.dm @@ -57,7 +57,7 @@ handles linking back and forth. list(MAT_METAL, MAT_GLASS, MAT_SILVER, MAT_GOLD, MAT_DIAMOND, MAT_PLASMA, MAT_URANIUM, MAT_BANANIUM, MAT_TITANIUM, MAT_BLUESPACE, MAT_PLASTIC), local_size, FALSE, - list(/obj/item/stack)) + /obj/item/stack) /datum/component/remote_materials/proc/set_local_size(size) local_size = size diff --git a/code/datums/emotes.dm b/code/datums/emotes.dm index 45a490fc732..57cdb9bcf51 100644 --- a/code/datums/emotes.dm +++ b/code/datums/emotes.dm @@ -16,7 +16,7 @@ var/emote_type = EMOTE_VISIBLE //Whether the emote is visible or audible var/restraint_check = FALSE //Checks if the mob is restrained before performing the emote var/muzzle_ignore = FALSE //Will only work if the emote is EMOTE_AUDIBLE - var/list/mob_type_allowed_typecache = list(/mob) //Types that are allowed to use that emote + var/list/mob_type_allowed_typecache = /mob //Types that are allowed to use that emote var/list/mob_type_blacklist_typecache //Types that are NOT allowed to use that emote var/list/mob_type_ignore_stat_typecache var/stat_allowed = CONSCIOUS @@ -25,7 +25,16 @@ /datum/emote/New() if(key_third_person) emote_list[key_third_person] = src - mob_type_allowed_typecache = typecacheof(mob_type_allowed_typecache) + if (ispath(mob_type_allowed_typecache)) + switch (mob_type_allowed_typecache) + if (/mob) + mob_type_allowed_typecache = GLOB.typecache_mob + if (/mob/living) + mob_type_allowed_typecache = GLOB.typecache_living + else + mob_type_allowed_typecache = typecacheof(mob_type_allowed_typecache) + else + mob_type_allowed_typecache = typecacheof(mob_type_allowed_typecache) mob_type_blacklist_typecache = typecacheof(mob_type_blacklist_typecache) mob_type_ignore_stat_typecache = typecacheof(mob_type_ignore_stat_typecache) diff --git a/code/game/machinery/Sleeper.dm b/code/game/machinery/Sleeper.dm index c5e26c98eed..7a10e4122c0 100644 --- a/code/game/machinery/Sleeper.dm +++ b/code/game/machinery/Sleeper.dm @@ -25,10 +25,10 @@ var/list/chem_buttons //Used when emagged to scramble which chem is used, eg: antitoxin -> morphine var/scrambled_chems = FALSE //Are chem buttons scrambled? used as a warning var/enter_message = "You feel cool air surround you. You go numb as your senses turn inward." - occupant_typecache = list(/mob/living) /obj/machinery/sleeper/Initialize() . = ..() + occupant_typecache = GLOB.typecache_living update_icon() reset_chem_buttons() diff --git a/code/game/machinery/droneDispenser.dm b/code/game/machinery/droneDispenser.dm index ffe7961534f..7c92c158b37 100644 --- a/code/game/machinery/droneDispenser.dm +++ b/code/game/machinery/droneDispenser.dm @@ -50,7 +50,7 @@ /obj/machinery/droneDispenser/Initialize() . = ..() - var/datum/component/material_container/materials = AddComponent(/datum/component/material_container, list(MAT_METAL, MAT_GLASS), MINERAL_MATERIAL_AMOUNT * MAX_STACK_SIZE * 2, TRUE, list(/obj/item/stack)) + var/datum/component/material_container/materials = AddComponent(/datum/component/material_container, list(MAT_METAL, MAT_GLASS), MINERAL_MATERIAL_AMOUNT * MAX_STACK_SIZE * 2, TRUE, /obj/item/stack) materials.insert_amount(starting_amount) materials.precise_insertion = TRUE using_materials = list(MAT_METAL=metal_cost, MAT_GLASS=glass_cost) diff --git a/code/game/mecha/mech_fabricator.dm b/code/game/mecha/mech_fabricator.dm index c1f41ac5c5f..01e304872f1 100644 --- a/code/game/mecha/mech_fabricator.dm +++ b/code/game/mecha/mech_fabricator.dm @@ -36,7 +36,7 @@ /obj/machinery/mecha_part_fabricator/Initialize() var/datum/component/material_container/materials = AddComponent(/datum/component/material_container, list(MAT_METAL, MAT_GLASS, MAT_SILVER, MAT_GOLD, MAT_DIAMOND, MAT_PLASMA, MAT_URANIUM, MAT_BANANIUM, MAT_TITANIUM, MAT_BLUESPACE), 0, - TRUE, list(/obj/item/stack), CALLBACK(src, .proc/is_insertion_ready), CALLBACK(src, .proc/AfterMaterialInsert)) + TRUE, /obj/item/stack, CALLBACK(src, .proc/is_insertion_ready), CALLBACK(src, .proc/AfterMaterialInsert)) materials.precise_insertion = TRUE stored_research = new return ..() diff --git a/code/modules/assembly/flash.dm b/code/modules/assembly/flash.dm index 0a99615e11c..ca60ef5c083 100644 --- a/code/modules/assembly/flash.dm +++ b/code/modules/assembly/flash.dm @@ -87,7 +87,7 @@ if(isturf(target_loc) || (ismob(target_loc) && isturf(target_loc.loc))) return viewers(range, get_turf(target_loc)) else - return typecache_filter_list(target_loc.GetAllContents(), typecacheof(list(/mob/living))) + return typecache_filter_list(target_loc.GetAllContents(), GLOB.typecache_living) /obj/item/assembly/flash/proc/try_use_flash(mob/user = null) if(crit_fail || (world.time < last_trigger + cooldown)) diff --git a/code/modules/clothing/shoes/bananashoes.dm b/code/modules/clothing/shoes/bananashoes.dm index 3dc80e0dede..b6348948050 100644 --- a/code/modules/clothing/shoes/bananashoes.dm +++ b/code/modules/clothing/shoes/bananashoes.dm @@ -10,7 +10,7 @@ /obj/item/clothing/shoes/clown_shoes/banana_shoes/Initialize() . = ..() - AddComponent(/datum/component/material_container, list(MAT_BANANIUM), 200000, TRUE, list(/obj/item/stack)) + AddComponent(/datum/component/material_container, list(MAT_BANANIUM), 200000, TRUE, /obj/item/stack) AddComponent(/datum/component/squeak, list('sound/items/bikehorn.ogg'=1), 75) if(always_noslip) clothing_flags |= NOSLIP diff --git a/code/modules/integrated_electronics/subtypes/manipulation.dm b/code/modules/integrated_electronics/subtypes/manipulation.dm index c1609cfb3d4..5a9acfa0f2a 100644 --- a/code/modules/integrated_electronics/subtypes/manipulation.dm +++ b/code/modules/integrated_electronics/subtypes/manipulation.dm @@ -609,7 +609,7 @@ /obj/item/integrated_circuit/manipulation/matman/Initialize() var/datum/component/material_container/materials = AddComponent(/datum/component/material_container, list(MAT_METAL, MAT_GLASS, MAT_SILVER, MAT_GOLD, MAT_DIAMOND, MAT_PLASMA, MAT_URANIUM, MAT_BANANIUM, MAT_TITANIUM, MAT_BLUESPACE), 0, - FALSE, list(/obj/item/stack), CALLBACK(src, .proc/is_insertion_ready), CALLBACK(src, .proc/AfterMaterialInsert)) + FALSE, /obj/item/stack, CALLBACK(src, .proc/is_insertion_ready), CALLBACK(src, .proc/AfterMaterialInsert)) materials.max_amount =100000 materials.precise_insertion = TRUE .=..() @@ -673,4 +673,4 @@ /obj/item/integrated_circuit/manipulation/matman/Destroy() GET_COMPONENT(materials, /datum/component/material_container) materials.retrieve_all() - .=..() \ No newline at end of file + .=..() diff --git a/code/modules/mining/machine_processing.dm b/code/modules/mining/machine_processing.dm index 026170da09e..a004a6ae0d0 100644 --- a/code/modules/mining/machine_processing.dm +++ b/code/modules/mining/machine_processing.dm @@ -82,7 +82,7 @@ /obj/machinery/mineral/processing_unit/Initialize() . = ..() proximity_monitor = new(src, 1) - AddComponent(/datum/component/material_container, list(MAT_METAL, MAT_GLASS, MAT_SILVER, MAT_GOLD, MAT_DIAMOND, MAT_PLASMA, MAT_URANIUM, MAT_BANANIUM, MAT_TITANIUM, MAT_BLUESPACE), INFINITY, TRUE, list(/obj/item/stack)) + AddComponent(/datum/component/material_container, list(MAT_METAL, MAT_GLASS, MAT_SILVER, MAT_GOLD, MAT_DIAMOND, MAT_PLASMA, MAT_URANIUM, MAT_BANANIUM, MAT_TITANIUM, MAT_BLUESPACE), INFINITY, TRUE, /obj/item/stack) stored_research = new /datum/techweb/specialized/autounlocking/smelter /obj/machinery/mineral/processing_unit/Destroy() diff --git a/code/modules/mining/machine_silo.dm b/code/modules/mining/machine_silo.dm index 8207df78822..bd1da0a90f7 100644 --- a/code/modules/mining/machine_silo.dm +++ b/code/modules/mining/machine_silo.dm @@ -19,7 +19,7 @@ GLOBAL_LIST_EMPTY(silo_access_logs) list(MAT_METAL, MAT_GLASS, MAT_SILVER, MAT_GOLD, MAT_DIAMOND, MAT_PLASMA, MAT_URANIUM, MAT_BANANIUM, MAT_TITANIUM, MAT_BLUESPACE, MAT_PLASTIC), INFINITY, FALSE, - list(/obj/item/stack), + /obj/item/stack, null, null, TRUE) diff --git a/code/modules/mining/mint.dm b/code/modules/mining/mint.dm index 66b6b94d6c8..6b03be610d7 100644 --- a/code/modules/mining/mint.dm +++ b/code/modules/mining/mint.dm @@ -15,7 +15,7 @@ /obj/machinery/mineral/mint/Initialize() . = ..() - AddComponent(/datum/component/material_container, list(MAT_METAL, MAT_PLASMA, MAT_SILVER, MAT_GOLD, MAT_URANIUM, MAT_DIAMOND, MAT_BANANIUM), MINERAL_MATERIAL_AMOUNT * 50, FALSE, list(/obj/item/stack)) + AddComponent(/datum/component/material_container, list(MAT_METAL, MAT_PLASMA, MAT_SILVER, MAT_GOLD, MAT_URANIUM, MAT_DIAMOND, MAT_BANANIUM), MINERAL_MATERIAL_AMOUNT * 50, FALSE, /obj/item/stack) /obj/machinery/mineral/mint/process() var/turf/T = get_step(src, input_dir) diff --git a/code/modules/mob/living/emote.dm b/code/modules/mob/living/emote.dm index c728b8c982f..61ce1c2bc3a 100644 --- a/code/modules/mob/living/emote.dm +++ b/code/modules/mob/living/emote.dm @@ -1,7 +1,7 @@ /* EMOTE DATUMS */ /datum/emote/living - mob_type_allowed_typecache = list(/mob/living) + mob_type_allowed_typecache = /mob/living mob_type_blacklist_typecache = list(/mob/living/simple_animal/slime, /mob/living/brain) /datum/emote/living/blush diff --git a/code/modules/research/nanites/nanite_chamber.dm b/code/modules/research/nanites/nanite_chamber.dm index 6f58cb2ad90..5c5e8b442f4 100644 --- a/code/modules/research/nanites/nanite_chamber.dm +++ b/code/modules/research/nanites/nanite_chamber.dm @@ -9,7 +9,6 @@ density = TRUE idle_power_usage = 50 active_power_usage = 300 - occupant_typecache = list(/mob/living) var/obj/machinery/computer/nanite_chamber_control/console var/locked = FALSE @@ -20,6 +19,10 @@ var/busy_message var/message_cooldown = 0 +/obj/machinery/nanite_chamber/Initialize() + . = ..() + occupant_typecache = GLOB.typecache_living + /obj/machinery/nanite_chamber/RefreshParts() scan_level = 0 for(var/obj/item/stock_parts/scanning_module/P in component_parts) @@ -224,4 +227,4 @@ /obj/machinery/nanite_chamber/MouseDrop_T(mob/target, mob/user) if(user.stat || user.lying || !Adjacent(user) || !user.Adjacent(target) || !iscarbon(target) || !user.IsAdvancedToolUser()) return - close_machine(target) \ No newline at end of file + close_machine(target) diff --git a/code/modules/research/nanites/public_chamber.dm b/code/modules/research/nanites/public_chamber.dm index 89c99a9c72e..32a7bdcdbc5 100644 --- a/code/modules/research/nanites/public_chamber.dm +++ b/code/modules/research/nanites/public_chamber.dm @@ -9,7 +9,6 @@ density = TRUE idle_power_usage = 50 active_power_usage = 300 - occupant_typecache = list(/mob/living) var/cloud_id = 1 var/locked = FALSE @@ -18,6 +17,10 @@ var/busy_icon_state var/message_cooldown = 0 +/obj/machinery/public_nanite_chamber/Initialize() + . = ..() + occupant_typecache = GLOB.typecache_living + /obj/machinery/public_nanite_chamber/RefreshParts() var/obj/item/circuitboard/machine/public_nanite_chamber/board = circuit if(board) @@ -171,4 +174,4 @@ /obj/machinery/public_nanite_chamber/MouseDrop_T(mob/target, mob/user) if(user.stat || user.lying || !Adjacent(user) || !user.Adjacent(target) || !iscarbon(target) || !user.IsAdvancedToolUser()) return - close_machine(target) \ No newline at end of file + close_machine(target)