diff --git a/code/game/machinery/camera/camera_assembly.dm b/code/game/machinery/camera/camera_assembly.dm index 64e08fcb224..1f0b638ffa9 100644 --- a/code/game/machinery/camera/camera_assembly.dm +++ b/code/game/machinery/camera/camera_assembly.dm @@ -15,8 +15,8 @@ obj_integrity = 150 max_integrity = 150 // Motion, EMP-Proof, X-Ray - var/list/obj/item/possible_upgrades = list(/obj/item/device/assembly/prox_sensor, /obj/item/stack/sheet/mineral/plasma, /obj/item/device/analyzer) - var/list/upgrades = list() + var/static/list/possible_upgrades = typecacheof(list(/obj/item/device/assembly/prox_sensor, /obj/item/stack/sheet/mineral/plasma, /obj/item/device/analyzer)) + var/list/upgrades var/state = 1 /* @@ -26,15 +26,14 @@ 4 = Screwdriver panel closed and is fully built (you cannot attach upgrades) */ -/obj/structure/camera_assembly/New(loc, ndir, building) - ..() +/obj/structure/camera_assembly/Initialize(mapload, ndir, building) + . = ..() if(building) setDir(ndir) + upgrades = list() /obj/structure/camera_assembly/Destroy() - for(var/I in upgrades) - qdel(I) - upgrades.Cut() + QDEL_LIST(upgrades) return ..() /obj/structure/camera_assembly/attackby(obj/item/W, mob/living/user, params) @@ -110,7 +109,7 @@ return // Upgrades! - if(is_type_in_list(W, possible_upgrades) && !is_type_in_list(W, upgrades)) // Is a possible upgrade and isn't in the camera already. + if(is_type_in_typecache(W, possible_upgrades) && !is_type_in_list(W, upgrades)) // Is a possible upgrade and isn't in the camera already. if(!user.drop_item(W)) return to_chat(user, "You attach \the [W] into the assembly inner circuits.") diff --git a/code/game/machinery/recharger.dm b/code/game/machinery/recharger.dm index 03e95ee2de3..357a9bd8522 100755 --- a/code/game/machinery/recharger.dm +++ b/code/game/machinery/recharger.dm @@ -8,12 +8,12 @@ idle_power_usage = 4 active_power_usage = 250 var/obj/item/charging = null - var/list/allowed_devices = list(/obj/item/weapon/gun/energy,/obj/item/weapon/melee/baton,/obj/item/ammo_box/magazine/recharge,/obj/item/device/modular_computer) + var/static/list/allowed_devices = typecacheof(list(/obj/item/weapon/gun/energy, /obj/item/weapon/melee/baton, /obj/item/ammo_box/magazine/recharge,/obj/item/device/modular_computer)) var/recharge_coeff = 1 -/obj/machinery/recharger/New() - ..() - var/obj/item/weapon/circuitboard/machine/B = new /obj/item/weapon/circuitboard/machine/recharger(null) +/obj/machinery/recharger/Initialize() + . = ..() + var/obj/item/weapon/circuitboard/machine/recharger/B = new() B.apply_default_parts(src) /obj/item/weapon/circuitboard/machine/recharger @@ -37,7 +37,7 @@ playsound(loc, G.usesound, 75, 1) return - var/allowed = is_type_in_list(G, allowed_devices) + var/allowed = is_type_in_typecache(G, allowed_devices) if(allowed) if(anchored) diff --git a/code/game/objects/items/robot/robot_items.dm b/code/game/objects/items/robot/robot_items.dm index 723a2fed46f..645941af835 100644 --- a/code/game/objects/items/robot/robot_items.dm +++ b/code/game/objects/items/robot/robot_items.dm @@ -154,10 +154,11 @@ icon_state = "charger_draw" flags = NOBLUDGEON var/mode = "draw" - var/list/charge_machines = list(/obj/machinery/cell_charger, /obj/machinery/recharger, - /obj/machinery/recharge_station, /obj/machinery/mech_bay_recharge_port) - var/list/charge_items = list(/obj/item/weapon/stock_parts/cell, /obj/item/weapon/gun/energy, - ) + var/static/list/charge_machines = typecacheof(list(/obj/machinery/cell_charger, /obj/machinery/recharger, /obj/machinery/recharge_station, /obj/machinery/mech_bay_recharge_port)) + var/static/list/charge_items = typecacheof(list(/obj/item/weapon/stock_parts/cell, /obj/item/weapon/gun/energy)) + +/obj/item/borg/charger/Initialize() + . = ..() /obj/item/borg/charger/update_icon() ..() diff --git a/code/modules/atmospherics/machinery/atmosmachinery.dm b/code/modules/atmospherics/machinery/atmosmachinery.dm index 54b70f45d82..18fdef19573 100644 --- a/code/modules/atmospherics/machinery/atmosmachinery.dm +++ b/code/modules/atmospherics/machinery/atmosmachinery.dm @@ -246,7 +246,7 @@ Pipelines + Other Objects -> Pipe network var/obj/machinery/atmospherics/target_move = findConnecting(direction) if(target_move) if(target_move.can_crawl_through()) - if(is_type_in_list(target_move, GLOB.ventcrawl_machinery)) + if(is_type_in_typecache(target_move, GLOB.ventcrawl_machinery)) user.forceMove(target_move.loc) //handle entering and so on. user.visible_message("You hear something squeezing through the ducts...","You climb out the ventilation system.") else @@ -259,7 +259,7 @@ Pipelines + Other Objects -> Pipe network user.last_played_vent = world.time playsound(src, 'sound/machines/ventcrawl.ogg', 50, 1, -3) else - if((direction & initialize_directions) || is_type_in_list(src, GLOB.ventcrawl_machinery) && can_crawl_through()) //if we move in a way the pipe can connect, but doesn't - or we're in a vent + if((direction & initialize_directions) || is_type_in_typecache(src, GLOB.ventcrawl_machinery) && can_crawl_through()) //if we move in a way the pipe can connect, but doesn't - or we're in a vent user.forceMove(src.loc) user.visible_message("You hear something squeezing through the ducts...","You climb out the ventilation system.") user.canmove = 0 diff --git a/code/modules/cargo/exports.dm b/code/modules/cargo/exports.dm index b4a99d2a28e..36a667bc232 100644 --- a/code/modules/cargo/exports.dm +++ b/code/modules/cargo/exports.dm @@ -71,11 +71,14 @@ Credit dupes that require a lot of manual work shouldn't be removed, unless they var/total_cost = 0 var/total_amount = 0 var/init_cost - + /datum/export/New() ..() SSprocessing.processing += src init_cost = cost + export_types = typecacheof(export_types) + exclude_types = typecacheof(exclude_types) + /datum/export/Destroy() SSprocessing.processing -= src @@ -108,7 +111,7 @@ Credit dupes that require a lot of manual work shouldn't be removed, unless they return FALSE if(!include_subtypes && !(O.type in export_types)) return FALSE - if(include_subtypes && (!is_type_in_list(O, export_types) || is_type_in_list(O, exclude_types))) + if(include_subtypes && (!is_type_in_typecache(O, export_types) || is_type_in_typecache(O, exclude_types))) return FALSE if(!get_cost(O, contr, emag)) return FALSE @@ -127,7 +130,7 @@ Credit dupes that require a lot of manual work shouldn't be removed, unless they total_amount += amount*MINERAL_MATERIAL_AMOUNT else total_amount += amount - + cost *= GLOB.E**(-1*k_elasticity*amount) //marginal cost modifier SSblackbox.add_details("export_sold_amount","[O.type]|[amount]") SSblackbox.add_details("export_sold_cost","[O.type]|[the_cost]") diff --git a/code/modules/food_and_drinks/kitchen_machinery/juicer.dm b/code/modules/food_and_drinks/kitchen_machinery/juicer.dm index 5770adc5394..176430bdbb5 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/juicer.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/juicer.dm @@ -11,8 +11,8 @@ idle_power_usage = 5 active_power_usage = 100 pass_flags = PASSTABLE - var/obj/item/weapon/reagent_containers/beaker = null - var/global/list/allowed_items = list ( + var/obj/item/weapon/reagent_containers/beaker + var/static/list/allowed_items = list( /obj/item/weapon/reagent_containers/food/snacks/grown/tomato = "tomatojuice", /obj/item/weapon/reagent_containers/food/snacks/grown/carrot = "carrotjuice", /obj/item/weapon/reagent_containers/food/snacks/grown/berries = "berryjuice", @@ -27,10 +27,10 @@ /obj/item/weapon/reagent_containers/food/snacks/watermelonslice = "watermelonjuice", /obj/item/weapon/reagent_containers/food/snacks/grown/berries/poison = "poisonberryjuice", /obj/item/weapon/reagent_containers/food/snacks/grown/pumpkin = "pumpkinjuice", - /obj/item/weapon/reagent_containers/food/snacks/grown/blumpkin = "blumpkinjuice", - ) + /obj/item/weapon/reagent_containers/food/snacks/grown/blumpkin = "blumpkinjuice") -/obj/machinery/juicer/New() +/obj/machinery/juicer/Initialize() + . = ..() beaker = new /obj/item/weapon/reagent_containers/glass/beaker/large(src) /obj/machinery/juicer/update_icon() diff --git a/code/modules/hydroponics/grown/towercap.dm b/code/modules/hydroponics/grown/towercap.dm index dd322e57d39..e03027d06ed 100644 --- a/code/modules/hydroponics/grown/towercap.dm +++ b/code/modules/hydroponics/grown/towercap.dm @@ -50,6 +50,9 @@ /obj/item/weapon/reagent_containers/food/snacks/grown/ambrosia/deus, /obj/item/weapon/reagent_containers/food/snacks/grown/wheat) +/obj/item/weapon/grown/log/Initialize() + . = ..() + accepted = typecacheof(accepted) /obj/item/weapon/grown/log/attackby(obj/item/weapon/W, mob/user, params) if(W.sharpness) @@ -66,7 +69,7 @@ to_chat(user, "You add the newly-formed [plank_name] to the stack. It now contains [plank.amount] [plank_name].") qdel(src) - if(is_type_in_list(W,accepted)) + if(is_type_in_typecache(W,accepted)) var/obj/item/weapon/reagent_containers/food/snacks/grown/leaf = W if(leaf.dry) user.show_message("You wrap \the [W] around the log, turning it into a torch!") diff --git a/code/modules/mob/living/simple_animal/bot/cleanbot.dm b/code/modules/mob/living/simple_animal/bot/cleanbot.dm index 190e6a7db4f..190a581d489 100644 --- a/code/modules/mob/living/simple_animal/bot/cleanbot.dm +++ b/code/modules/mob/living/simple_animal/bot/cleanbot.dm @@ -21,7 +21,7 @@ var/trash = 0 var/pests = 0 - var/list/target_types = list() + var/list/target_types var/obj/effect/decal/cleanable/target var/max_targets = 50 //Maximum number of targets a cleanbot can ignore. var/oldloc = null @@ -32,7 +32,7 @@ var/next_dest_loc /mob/living/simple_animal/bot/cleanbot/Initialize() - ..() + . = ..() get_targets() icon_state = "cleanbot[on]" @@ -87,7 +87,7 @@ var/mob/living/carbon/C = A if(C.stat != DEAD && C.lying) return C - else if(is_type_in_list(A, target_types)) + else if(is_type_in_typecache(A, target_types)) return A /mob/living/simple_animal/bot/cleanbot/handle_automated_action() @@ -193,6 +193,8 @@ if(trash) target_types += /obj/item/trash + target_types = typecacheof(target_types) + /mob/living/simple_animal/bot/cleanbot/UnarmedAttack(atom/A) if(istype(A, /obj/effect/decal/cleanable)) anchored = 1 diff --git a/code/modules/mob/living/simple_animal/friendly/lizard.dm b/code/modules/mob/living/simple_animal/friendly/lizard.dm index ce8c0f0a334..b5783aa4f2d 100644 --- a/code/modules/mob/living/simple_animal/friendly/lizard.dm +++ b/code/modules/mob/living/simple_animal/friendly/lizard.dm @@ -21,20 +21,19 @@ gold_core_spawnable = 2 obj_damage = 0 environment_smash = ENVIRONMENT_SMASH_NONE - var/list/edibles = list(/mob/living/simple_animal/butterfly,/mob/living/simple_animal/cockroach) //list of atoms, however turfs won't affect AI, but will affect consumption. + var/static/list/edibles = typecacheof(list(/mob/living/simple_animal/butterfly,/mob/living/simple_animal/cockroach)) //list of atoms, however turfs won't affect AI, but will affect consumption. /mob/living/simple_animal/hostile/lizard/CanAttack(atom/the_target)//Can we actually attack a possible target? if(see_invisible < the_target.invisibility)//Target's invisible to us, forget it - return 0 - if(is_type_in_list(the_target,edibles)) - return 1 - return 0 + return FALSE + if(is_type_in_typecache(the_target,edibles)) + return TRUE + return FALSE /mob/living/simple_animal/hostile/lizard/AttackingTarget() - if(is_type_in_list(target,edibles)) //Makes sure player lizards only consume edibles. + if(is_type_in_typecache(target,edibles)) //Makes sure player lizards only consume edibles. visible_message("[name] consumes [target] in a single gulp", "You consume [target] in a single gulp") - qdel(target) //Nom - target = null + QDEL_NULL(target) //Nom adjustBruteLoss(-2) return TRUE else diff --git a/code/modules/mob/living/ventcrawling.dm b/code/modules/mob/living/ventcrawling.dm index a1430f6cd43..471e103c260 100644 --- a/code/modules/mob/living/ventcrawling.dm +++ b/code/modules/mob/living/ventcrawling.dm @@ -1,5 +1,7 @@ -GLOBAL_LIST_INIT(ventcrawl_machinery, list(/obj/machinery/atmospherics/components/unary/vent_pump, /obj/machinery/atmospherics/components/unary/vent_scrubber)) +GLOBAL_LIST_INIT(ventcrawl_machinery, typecacheof(list( + /obj/machinery/atmospherics/components/unary/vent_pump, + /obj/machinery/atmospherics/components/unary/vent_scrubber))) //VENTCRAWLING @@ -32,7 +34,7 @@ GLOBAL_LIST_INIT(ventcrawl_machinery, list(/obj/machinery/atmospherics/component if(!vent_found) for(var/obj/machinery/atmospherics/machine in range(1,src)) - if(is_type_in_list(machine, GLOB.ventcrawl_machinery)) + if(is_type_in_typecache(machine, GLOB.ventcrawl_machinery)) vent_found = machine if(!vent_found.can_crawl_through()) diff --git a/code/modules/reagents/chemistry/machinery/reagentgrinder.dm b/code/modules/reagents/chemistry/machinery/reagentgrinder.dm index b929337a139..09f56960a75 100644 --- a/code/modules/reagents/chemistry/machinery/reagentgrinder.dm +++ b/code/modules/reagents/chemistry/machinery/reagentgrinder.dm @@ -13,8 +13,8 @@ var/operating = FALSE var/obj/item/weapon/reagent_containers/beaker = null var/limit = 10 - var/list/blend_items = list ( + var/static/list/blend_items = list( //Sheets /obj/item/stack/sheet/mineral/plasma = list("plasma" = 20), /obj/item/stack/sheet/metal = list("iron" = 20), @@ -31,7 +31,6 @@ /obj/item/weapon/grown/nettle/basic = list("sacid" = 0), /obj/item/weapon/grown/nettle/death = list("facid" = 0, "sacid" = 0), /obj/item/weapon/grown/novaflower = list("capsaicin" = 0, "condensedcapsaicin" = 0), - //Blender Stuff /obj/item/weapon/reagent_containers/food/snacks/grown/soybeans = list("soymilk" = 0), /obj/item/weapon/reagent_containers/food/snacks/grown/tomato = list("ketchup" = 0), @@ -42,25 +41,19 @@ /obj/item/weapon/reagent_containers/food/snacks/grown/cherries = list("cherryjelly" = 0), /obj/item/weapon/reagent_containers/food/snacks/grown/bluecherries = list("bluecherryjelly" = 0), /obj/item/weapon/reagent_containers/food/snacks/egg = list("eggyolk" = -5), - //Grinder stuff, but only if dry /obj/item/weapon/reagent_containers/food/snacks/grown/coffee/robusta = list("coffeepowder" = 0, "morphine" = 0), /obj/item/weapon/reagent_containers/food/snacks/grown/coffee = list("coffeepowder" = 0), /obj/item/weapon/reagent_containers/food/snacks/grown/tea/astra = list("teapowder" = 0, "salglu_solution" = 0), /obj/item/weapon/reagent_containers/food/snacks/grown/tea = list("teapowder" = 0), - - //All types that you can put into the grinder to transfer the reagents to the beaker. !Put all recipes above this.! /obj/item/slime_extract = list(), /obj/item/weapon/reagent_containers/pill = list(), /obj/item/weapon/reagent_containers/food = list(), /obj/item/weapon/reagent_containers/honeycomb = list(), - /obj/item/toy/crayon = list() - - ) - - var/list/juice_items = list ( + /obj/item/toy/crayon = list()) + var/static/list/juice_items = list( //Juicer Stuff /obj/item/weapon/reagent_containers/food/snacks/grown/corn = list("corn_starch" = 0), /obj/item/weapon/reagent_containers/food/snacks/grown/tomato = list("tomatojuice" = 0), @@ -78,16 +71,14 @@ /obj/item/weapon/reagent_containers/food/snacks/grown/blumpkin = list("blumpkinjuice" = 0), /obj/item/weapon/reagent_containers/food/snacks/grown/apple = list("applejuice" = 0), /obj/item/weapon/reagent_containers/food/snacks/grown/grapes = list("grapejuice" = 0), - /obj/item/weapon/reagent_containers/food/snacks/grown/grapes/green = list("grapejuice" = 0), - ) + /obj/item/weapon/reagent_containers/food/snacks/grown/grapes/green = list("grapejuice" = 0)) - var/list/dried_items = list( + var/static/list/dried_items = list( //Grinder stuff, but only if dry, /obj/item/weapon/reagent_containers/food/snacks/grown/coffee/robusta = list("coffeepowder" = 0, "morphine" = 0), /obj/item/weapon/reagent_containers/food/snacks/grown/coffee = list("coffeepowder" = 0), /obj/item/weapon/reagent_containers/food/snacks/grown/tea/astra = list("teapowder" = 0, "salglu_solution" = 0), - /obj/item/weapon/reagent_containers/food/snacks/grown/tea = list("teapowder" = 0) - ) + /obj/item/weapon/reagent_containers/food/snacks/grown/tea = list("teapowder" = 0)) var/list/holdingitems = list() @@ -96,9 +87,7 @@ beaker = new /obj/item/weapon/reagent_containers/glass/beaker/large(src) /obj/machinery/reagentgrinder/Destroy() - if(beaker) - qdel(beaker) - beaker = null + QDEL_NULL(beaker) return ..() /obj/machinery/reagentgrinder/contents_explosion(severity, target)