From b3fb7c181dbdb5a61f666f9e09cbd29258decf26 Mon Sep 17 00:00:00 2001 From: Aronai Sieyes Date: Wed, 14 Jul 2021 19:29:26 -0400 Subject: [PATCH] Make more object lists lazy to pay for my sins --- code/game/machinery/camera/camera.dm | 2 +- code/game/machinery/suit_cycler_datums.dm | 2 +- code/game/objects/effects/alien/aliens.dm | 4 +-- code/game/objects/effects/spiders.dm | 2 +- code/game/objects/items.dm | 14 ++++---- .../objects/items/weapons/storage/backpack.dm | 1 - code/game/objects/mob_spawner_vr.dm | 2 +- code/modules/clothing/chameleon.dm | 9 +++--- code/modules/clothing/clothing.dm | 32 +++++++++---------- code/modules/clothing/clothing_icons.dm | 2 +- code/modules/clothing/head/misc_special.dm | 2 +- code/modules/clothing/masks/breath_vr.dm | 2 +- code/modules/clothing/spacesuits/rig/rig.dm | 2 +- .../spacesuits/rig/suits/station_vr.dm | 16 +++++----- .../modules/clothing/spacesuits/spacesuits.dm | 4 +-- .../clothing/spacesuits/void/event_vr.dm | 20 ++++++------ .../clothing/under/accessories/accessory.dm | 2 +- .../clothing/under/miscellaneous_vr.dm | 2 +- code/modules/customitems/item_spawning.dm | 4 +-- .../mob/living/carbon/human/human_defense.dm | 2 +- .../species/station/traits_vr/weaver_objs.dm | 2 +- code/modules/mob/living/living_defense.dm | 2 +- .../mob/living/silicon/robot/drone/drone.dm | 4 +-- code/modules/mob/living/simple_mob/hands.dm | 8 ++--- code/modules/projectiles/gun.dm | 8 ++--- .../projectiles/guns/energy/gunsword_vr.dm | 2 +- .../vore/fluffstuff/custom_clothes_vr.dm | 10 +++--- code/modules/vore/resizing/holder_micro_vr.dm | 4 +-- 28 files changed, 81 insertions(+), 85 deletions(-) diff --git a/code/game/machinery/camera/camera.dm b/code/game/machinery/camera/camera.dm index 68a93322c6..8657585718 100644 --- a/code/game/machinery/camera/camera.dm +++ b/code/game/machinery/camera/camera.dm @@ -232,7 +232,7 @@ user.setClickCooldown(user.get_attack_speed(W)) if (W.force >= src.toughness) user.do_attack_animation(src) - visible_message("[src] has been [W.attack_verb.len? pick(W.attack_verb) : "attacked"] with [W] by [user]!") + visible_message("[src] has been [LAZYLEN(W.attack_verb) ? pick(W.attack_verb) : "attacked"] with [W] by [user]!") if (istype(W, /obj/item)) //is it even possible to get into attackby() with non-items? var/obj/item/I = W if (I.hitsound) diff --git a/code/game/machinery/suit_cycler_datums.dm b/code/game/machinery/suit_cycler_datums.dm index a615168332..512b7dfb32 100644 --- a/code/game/machinery/suit_cycler_datums.dm +++ b/code/game/machinery/suit_cycler_datums.dm @@ -270,7 +270,7 @@ GLOBAL_LIST_EMPTY(suit_cycler_emagged) // the presence of the species in the sprite_sheets_obj list on the helmet and suit /datum/suit_cycler_choice/species/proc/can_refit_to(obj/item/clothing/head/helmet/helmet, obj/item/clothing/suit/space/suit) for(var/obj/item/clothing/C in list(helmet, suit)) - if(C.sprite_sheets_obj[name]) + if(LAZYACCESS(C.sprite_sheets_obj, name)) if(!(C.icon_state in cached_icon_states(C.sprite_sheets_obj[name]))) return FALSE // Species was in sprite_sheets_obj, but had no sprite for this object in particular diff --git a/code/game/objects/effects/alien/aliens.dm b/code/game/objects/effects/alien/aliens.dm index 91aea937ff..42aa0c4d61 100644 --- a/code/game/objects/effects/alien/aliens.dm +++ b/code/game/objects/effects/alien/aliens.dm @@ -319,7 +319,7 @@ /obj/effect/alien/weeds/attackby(var/obj/item/weapon/W, var/mob/user) user.setClickCooldown(user.get_attack_speed(W)) - if(W.attack_verb.len) + if(LAZYLEN(W.attack_verb)) visible_message("\The [src] have been [pick(W.attack_verb)] with \the [W][(user ? " by [user]." : ".")]") else visible_message("\The [src] have been attacked with \the [W][(user ? " by [user]." : ".")]") @@ -523,7 +523,7 @@ /obj/effect/alien/egg/attackby(var/obj/item/weapon/W, var/mob/user) if(health <= 0) return - if(W.attack_verb.len) + if(LAZYLEN(W.attack_verb)) src.visible_message("\The [src] has been [pick(W.attack_verb)] with \the [W][(user ? " by [user]." : ".")]") else src.visible_message("\The [src] has been attacked with \the [W][(user ? " by [user]." : ".")]") diff --git a/code/game/objects/effects/spiders.dm b/code/game/objects/effects/spiders.dm index d6b21ef674..6e3f224625 100644 --- a/code/game/objects/effects/spiders.dm +++ b/code/game/objects/effects/spiders.dm @@ -23,7 +23,7 @@ /obj/effect/spider/attackby(var/obj/item/weapon/W, var/mob/user) user.setClickCooldown(user.get_attack_speed(W)) - if(W.attack_verb.len) + if(LAZYLEN(W.attack_verb)) visible_message("\The [src] has been [pick(W.attack_verb)] with \the [W][(user ? " by [user]." : ".")]") else visible_message("\The [src] has been attacked with \the [W][(user ? " by [user]." : ".")]") diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index 7abfa3ea5f..7d9f4fb6a2 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -21,7 +21,7 @@ // causeerrorheresoifixthis var/obj/item/master = null var/list/origin_tech = null //Used by R&D to determine what research bonuses it grants. - var/list/attack_verb = list() //Used in attackby() to say how something was attacked "[x] has been [z.attack_verb] by [y] with [z]" + var/list/attack_verb //Used in attackby() to say how something was attacked "[x] has been [z.attack_verb] by [y] with [z]" var/force = 0 var/heat_protection = 0 //flags which determine which body parts are protected from heat. Use the HEAD, UPPER_TORSO, LOWER_TORSO, etc. flags. See setup.dm @@ -50,8 +50,8 @@ var/siemens_coefficient = 1 // for electrical admittance/conductance (electrocution checks and shit) var/slowdown = 0 // How much clothing is slowing you down. Negative values speeds you up var/canremove = 1 //Mostly for Ninja code at this point but basically will not allow the item to be removed if set to 0. /N - var/list/armor = list(melee = 0, bullet = 0, laser = 0,energy = 0, bomb = 0, bio = 0, rad = 0) - var/list/armorsoak = list(melee = 0, bullet = 0, laser = 0,energy = 0, bomb = 0, bio = 0, rad = 0) + var/list/armor = list("melee" = 0, "bullet" = 0, "laser" = 0,"energy" = 0, "bomb" = 0, "bio" = 0, "rad" = 0) + var/list/armorsoak = list("melee" = 0, "bullet" = 0, "laser" = 0, "energy" = 0, "bomb" = 0, "bio" = 0, "rad" = 0) var/list/allowed = null //suit storage stuff. var/obj/item/device/uplink/hidden/hidden_uplink = null // All items can have an uplink hidden inside, just remember to add the triggers. var/zoomdevicename = null //name used for message when binoculars/scope is used @@ -63,12 +63,12 @@ //** These specify item/icon overrides for _slots_ - var/list/item_state_slots = list() //overrides the default item_state for particular slots. + var/list/item_state_slots //overrides the default item_state for particular slots. // Used to specify the icon file to be used when the item is worn. If not set the default icon for that slot will be used. // If icon_override or sprite_sheets are set they will take precendence over this, assuming they apply to the slot in question. // Only slot_l_hand/slot_r_hand are implemented at the moment. Others to be implemented as needed. - var/list/item_icons = list() + var/list/item_icons //** These specify item/icon overrides for _species_ @@ -79,11 +79,11 @@ ) If index term exists and icon_override is not set, this sprite sheet will be used. */ - var/list/sprite_sheets = list() + var/list/sprite_sheets // Species-specific sprite sheets for inventory sprites // Works similarly to worn sprite_sheets, except the alternate sprites are used when the clothing/refit_for_species() proc is called. - var/list/sprite_sheets_obj = list() + var/list/sprite_sheets_obj var/toolspeed = 1.0 // This is a multipler on how 'fast' a tool works. e.g. setting this to 0.5 will make the tool work twice as fast. var/attackspeed = DEFAULT_ATTACK_COOLDOWN // How long click delay will be when using this, in 1/10ths of a second. Checked in the user's get_attack_speed(). diff --git a/code/game/objects/items/weapons/storage/backpack.dm b/code/game/objects/items/weapons/storage/backpack.dm index ad016d0d85..325980756f 100644 --- a/code/game/objects/items/weapons/storage/backpack.dm +++ b/code/game/objects/items/weapons/storage/backpack.dm @@ -70,7 +70,6 @@ w_class = ITEMSIZE_LARGE max_w_class = ITEMSIZE_NORMAL max_storage_space = ITEMSIZE_COST_NORMAL * 100 // can store a ton of shit! - item_state_slots = null /obj/item/weapon/storage/backpack/cultpack name = "trophy rack" diff --git a/code/game/objects/mob_spawner_vr.dm b/code/game/objects/mob_spawner_vr.dm index a3f01c5371..1b17bda2e2 100644 --- a/code/game/objects/mob_spawner_vr.dm +++ b/code/game/objects/mob_spawner_vr.dm @@ -76,7 +76,7 @@ user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN) user.do_attack_animation(src) - visible_message("\The [src] has been [I.attack_verb.len ? "[pick(I.attack_verb)]":"attacked"] with \the [I] by [user].") + visible_message("\The [src] has been [LAZYLEN(I.attack_verb) ? "[pick(I.attack_verb)]":"attacked"] with \the [I] by [user].") take_damage(I.force) /obj/structure/mob_spawner/bullet_act(var/obj/item/projectile/Proj) diff --git a/code/modules/clothing/chameleon.dm b/code/modules/clothing/chameleon.dm index 08c594153d..c0cde563a8 100644 --- a/code/modules/clothing/chameleon.dm +++ b/code/modules/clothing/chameleon.dm @@ -13,10 +13,9 @@ body_parts_covered = copy.body_parts_covered flags_inv = copy.flags_inv - item_icons = copy.item_icons.Copy() - if(copy.item_state_slots) //Runtime prevention for backpacks - item_state_slots = copy.item_state_slots.Copy() - sprite_sheets = copy.sprite_sheets.Copy() + item_icons = copy.item_icons?.Copy() + item_state_slots = copy.item_state_slots?.Copy() + sprite_sheets = copy.sprite_sheets?.Copy() //copying sprite_sheets_obj should be unnecessary as chameleon items are not refittable. return copy //for inheritance @@ -54,7 +53,7 @@ name = "psychedelic" desc = "Groovy!" icon_state = "psyche" - item_state_slots[slot_w_uniform_str] = "psyche" + LAZYSET(item_state_slots, slot_w_uniform_str, "psyche") update_icon() update_clothing_icon() diff --git a/code/modules/clothing/clothing.dm b/code/modules/clothing/clothing.dm index 647a64736b..787111585d 100644 --- a/code/modules/clothing/clothing.dm +++ b/code/modules/clothing/clothing.dm @@ -164,7 +164,7 @@ //Set icon if (sprite_sheets_refit && (target_species in sprite_sheets_refit)) - sprite_sheets[target_species] = sprite_sheets_refit[target_species] + LAZYSET(sprite_sheets, target_species, sprite_sheets_refit[target_species]) if (sprite_sheets_obj && (target_species in sprite_sheets_obj)) icon = sprite_sheets_obj[target_species] @@ -212,7 +212,7 @@ //Set icon if (sprite_sheets_refit && (target_species in sprite_sheets_refit)) - sprite_sheets[target_species] = sprite_sheets_refit[target_species] + LAZYSET(sprite_sheets, target_species, sprite_sheets_refit[target_species]) if (sprite_sheets_obj && (target_species in sprite_sheets_obj)) icon = sprite_sheets_obj[target_species] @@ -542,9 +542,9 @@ // Generate and cache the on-mob icon, which is used in update_inv_head(). var/body_type = (H && H.species.get_bodytype(H)) - var/cache_key = "[light_overlay][body_type && sprite_sheets[body_type] ? body_type : ""]" + var/cache_key = "[light_overlay][body_type && LAZYACCESS(sprite_sheets, body_type) ? body_type : ""]" if(!light_overlay_cache[cache_key]) - var/use_icon = LAZYACCESS(sprite_sheets,body_type) || 'icons/mob/light_overlays.dmi' + var/use_icon = LAZYACCESS(sprite_sheets, body_type) || 'icons/mob/light_overlays.dmi' light_overlay_cache[cache_key] = image(icon = use_icon, icon_state = "[light_overlay]") else if(helmet_light) @@ -867,9 +867,7 @@ /obj/item/clothing/under/New() ..() if(worn_state) - if(!item_state_slots) - item_state_slots = list() - item_state_slots[slot_w_uniform_str] = worn_state + LAZYSET(item_state_slots, slot_w_uniform_str, worn_state) else worn_state = icon_state @@ -891,9 +889,9 @@ var/icon/under_icon if(icon_override) under_icon = icon_override - else if(H && sprite_sheets && sprite_sheets[H.species.get_bodytype(H)]) + else if(H && LAZYACCESS(sprite_sheets, H.species.get_bodytype(H))) under_icon = sprite_sheets[H.species.get_bodytype(H)] - else if(item_icons && item_icons[slot_w_uniform_str]) + else if(LAZYACCESS(item_icons, slot_w_uniform_str)) under_icon = item_icons[slot_w_uniform_str] else if (worn_state in cached_icon_states(rolled_down_icon)) under_icon = rolled_down_icon @@ -914,9 +912,9 @@ var/icon/under_icon if(icon_override) under_icon = icon_override - else if(H && sprite_sheets && sprite_sheets[H.species.get_bodytype(H)]) + else if(H && LAZYACCESS(sprite_sheets, H.species.get_bodytype(H))) under_icon = sprite_sheets[H.species.get_bodytype(H)] - else if(item_icons && item_icons[slot_w_uniform_str]) + else if(LAZYACCESS(item_icons, slot_w_uniform_str)) under_icon = item_icons[slot_w_uniform_str] else if (worn_state in cached_icon_states(rolled_down_sleeves_icon)) under_icon = rolled_down_sleeves_icon @@ -1009,16 +1007,16 @@ body_parts_covered &= ~(UPPER_TORSO|ARMS) if(worn_state in cached_icon_states(rolled_down_icon)) icon_override = rolled_down_icon - item_state_slots[slot_w_uniform_str] = worn_state + LAZYSET(item_state_slots, slot_w_uniform_str, worn_state) else - item_state_slots[slot_w_uniform_str] = "[worn_state]_d" + LAZYSET(item_state_slots, slot_w_uniform_str, "[worn_state]_d") to_chat(usr, "You roll down your [src].") else body_parts_covered = initial(body_parts_covered) if(icon_override == rolled_down_icon) icon_override = initial(icon_override) - item_state_slots[slot_w_uniform_str] = worn_state + LAZYSET(item_state_slots, slot_w_uniform_str, worn_state) to_chat(usr, "You roll up your [src].") update_clothing_icon() @@ -1042,15 +1040,15 @@ body_parts_covered &= ~(ARMS) if(worn_state in cached_icon_states(rolled_down_sleeves_icon)) icon_override = rolled_down_sleeves_icon - item_state_slots[slot_w_uniform_str] = worn_state + LAZYSET(item_state_slots, slot_w_uniform_str, worn_state) else - item_state_slots[slot_w_uniform_str] = "[worn_state]_r" + LAZYSET(item_state_slots, slot_w_uniform_str, "[worn_state]_r") to_chat(usr, "You roll up your [src]'s sleeves.") else body_parts_covered = initial(body_parts_covered) if(icon_override == rolled_down_sleeves_icon) icon_override = initial(icon_override) - item_state_slots[slot_w_uniform_str] = worn_state + LAZYSET(item_state_slots, slot_w_uniform_str, worn_state) to_chat(usr, "You roll down your [src]'s sleeves.") update_clothing_icon() diff --git a/code/modules/clothing/clothing_icons.dm b/code/modules/clothing/clothing_icons.dm index c28d60a9ff..6560045a1f 100644 --- a/code/modules/clothing/clothing_icons.dm +++ b/code/modules/clothing/clothing_icons.dm @@ -14,7 +14,7 @@ /obj/item/clothing/head/make_worn_icon(var/body_type,var/slot_name,var/inhands,var/default_icon,var/default_layer = 0,var/icon/clip_mask = null) var/image/standing = ..() if(light_on && slot_name == slot_head_str) - var/cache_key = "[light_overlay][LAZYACCESS(sprite_sheets,body_type) ? "_[body_type]" : ""]" + var/cache_key = "[light_overlay][LAZYACCESS(sprite_sheets, body_type) ? "_[body_type]" : ""]" if(standing && light_overlay_cache[cache_key]) standing.add_overlay(light_overlay_cache[cache_key]) return standing diff --git a/code/modules/clothing/head/misc_special.dm b/code/modules/clothing/head/misc_special.dm index d096eb5883..1d3759fae9 100644 --- a/code/modules/clothing/head/misc_special.dm +++ b/code/modules/clothing/head/misc_special.dm @@ -182,7 +182,7 @@ icon_state = "kitty" body_parts_covered = 0 siemens_coefficient = 1.5 - item_icons = list() + item_icons = null /obj/item/clothing/head/kitty/update_icon(var/mob/living/carbon/human/user) if(!istype(user)) return diff --git a/code/modules/clothing/masks/breath_vr.dm b/code/modules/clothing/masks/breath_vr.dm index 9f6016d948..47c5fdb64b 100644 --- a/code/modules/clothing/masks/breath_vr.dm +++ b/code/modules/clothing/masks/breath_vr.dm @@ -1,4 +1,4 @@ /obj/item/clothing/mask/breath/transparent name = "transparent breath mask" item_state = "golem" //This is dumb and hacky but was here when I got here. - sprite_sheets = list() + sprite_sheets = null diff --git a/code/modules/clothing/spacesuits/rig/rig.dm b/code/modules/clothing/spacesuits/rig/rig.dm index cc7084341f..25219809e5 100644 --- a/code/modules/clothing/spacesuits/rig/rig.dm +++ b/code/modules/clothing/spacesuits/rig/rig.dm @@ -594,7 +594,7 @@ var/species_icon = default_mob_icon // Since setting mob_icon will override the species checks in // update_inv_wear_suit(), handle species checks here. - if(wearer && sprite_sheets && sprite_sheets[wearer.species.get_bodytype(wearer)]) + if(wearer && LAZYACCESS(sprite_sheets, wearer.species.get_bodytype(wearer))) species_icon = sprite_sheets[wearer.species.get_bodytype(wearer)] mob_icon = icon(icon = species_icon, icon_state = "[icon_state]") diff --git a/code/modules/clothing/spacesuits/rig/suits/station_vr.dm b/code/modules/clothing/spacesuits/rig/suits/station_vr.dm index e0d14f189a..63e94a4ffb 100644 --- a/code/modules/clothing/spacesuits/rig/suits/station_vr.dm +++ b/code/modules/clothing/spacesuits/rig/suits/station_vr.dm @@ -94,7 +94,7 @@ icon_state = "techno_rig" // No animal people sprites for these yet, sad times species_restricted = list("exclude", SPECIES_TESHARI, SPECIES_VOX, SPECIES_DIONA) - sprite_sheets = list() + sprite_sheets = null /obj/item/clothing/suit/space/rig/focalpoint icon = 'icons/inventory/suit/item_vr.dmi' @@ -102,7 +102,7 @@ icon_state = "techno_rig" // No animal people sprites for these yet, sad times species_restricted = list("exclude", SPECIES_TESHARI, SPECIES_VOX, SPECIES_DIONA) - sprite_sheets = list() + sprite_sheets = null /obj/item/clothing/shoes/magboots/rig/focalpoint icon = 'icons/inventory/feet/item_vr.dmi' @@ -110,7 +110,7 @@ icon_state = "techno_rig" // No animal people sprites for these yet, sad times species_restricted = list("exclude", SPECIES_TESHARI, SPECIES_VOX, SPECIES_DIONA) - sprite_sheets = list() + sprite_sheets = null /obj/item/clothing/gloves/gauntlets/rig/focalpoint icon = 'icons/inventory/hands/item_vr.dmi' @@ -119,7 +119,7 @@ siemens_coefficient = 0 // No animal people sprites for these yet, sad times species_restricted = list("exclude", SPECIES_TESHARI, SPECIES_VOX, SPECIES_DIONA) - sprite_sheets = list() + sprite_sheets = null // 'Ironhammer' hardsuit /obj/item/weapon/rig/hephaestus @@ -153,7 +153,7 @@ icon_state = "ihs_rig" // No animal people sprites for these yet, sad times species_restricted = list("exclude", SPECIES_TESHARI, SPECIES_VOX, SPECIES_DIONA) - sprite_sheets = list() + sprite_sheets = null /obj/item/clothing/suit/space/rig/hephaestus icon = 'icons/inventory/suit/item_vr.dmi' @@ -161,7 +161,7 @@ icon_state = "ihs_rig" // No animal people sprites for these yet, sad times species_restricted = list("exclude", SPECIES_TESHARI, SPECIES_VOX, SPECIES_DIONA) - sprite_sheets = list() + sprite_sheets = null /obj/item/clothing/shoes/magboots/rig/hephaestus icon = 'icons/inventory/feet/item_vr.dmi' @@ -169,7 +169,7 @@ icon_state = "ihs_rig" // No animal people sprites for these yet, sad times species_restricted = list("exclude", SPECIES_TESHARI, SPECIES_VOX, SPECIES_DIONA) - sprite_sheets = list() + sprite_sheets = null /obj/item/clothing/gloves/gauntlets/rig/hephaestus icon = 'icons/inventory/hands/item_vr.dmi' @@ -177,4 +177,4 @@ icon_state = "ihs_rig" // No animal people sprites for these yet, sad times species_restricted = list("exclude", SPECIES_TESHARI, SPECIES_VOX, SPECIES_DIONA) - sprite_sheets = list() + sprite_sheets = null diff --git a/code/modules/clothing/spacesuits/spacesuits.dm b/code/modules/clothing/spacesuits/spacesuits.dm index ed51525e25..9ee31aeb60 100644 --- a/code/modules/clothing/spacesuits/spacesuits.dm +++ b/code/modules/clothing/spacesuits/spacesuits.dm @@ -37,7 +37,7 @@ verbs |= /obj/item/clothing/head/helmet/space/proc/toggle_camera if(type == /obj/item/clothing/head/helmet/space) //VOREStation edit - use the specially refitted sprites by KBraid. Done this way to avoid breaking subtypes. - sprite_sheets[SPECIES_TESHARI] = 'icons/inventory/head/mob_vr_teshari.dmi' + LAZYSET(sprite_sheets, SPECIES_TESHARI, 'icons/inventory/head/mob_vr_teshari.dmi') /obj/item/clothing/head/helmet/space/proc/toggle_camera() set name = "Toggle Helmet Camera" @@ -94,7 +94,7 @@ /obj/item/clothing/suit/space/Initialize() . = ..() if(type == /obj/item/clothing/suit/space) - sprite_sheets[SPECIES_TESHARI] = 'icons/inventory/suit/mob_vr_teshari.dmi' // aAAAaaAAAAA + LAZYSET(sprite_sheets, SPECIES_TESHARI, 'icons/inventory/suit/mob_vr_teshari.dmi') //VOREStation edit end. /obj/item/clothing/suit/space/equipped(mob/M) diff --git a/code/modules/clothing/spacesuits/void/event_vr.dm b/code/modules/clothing/spacesuits/void/event_vr.dm index 6d947ce245..177cd768b0 100644 --- a/code/modules/clothing/spacesuits/void/event_vr.dm +++ b/code/modules/clothing/spacesuits/void/event_vr.dm @@ -86,7 +86,7 @@ // No animal people sprites for these yet, sad times species_restricted = list("exclude", SPECIES_TESHARI, SPECIES_VOX, SPECIES_DIONA) - sprite_sheets = list() + sprite_sheets = null /obj/item/clothing/suit/space/void/hev/violet icon_state = "hev_violet" @@ -102,7 +102,7 @@ // No animal people sprites for these yet, sad times species_restricted = list("exclude", SPECIES_TESHARI, SPECIES_VOX, SPECIES_DIONA) - sprite_sheets = list() + sprite_sheets = null /obj/item/clothing/head/helmet/space/void/hev/violet icon_state = "hev_violet" @@ -121,7 +121,7 @@ // No animal people sprites for these yet, sad times species_restricted = list("exclude", SPECIES_TESHARI, SPECIES_VOX, SPECIES_DIONA) - sprite_sheets = list() + sprite_sheets = null /obj/item/clothing/head/helmet/space/void/makeshift name = "makeshift voidsuit helmet" @@ -135,7 +135,7 @@ // No animal people sprites for these yet, sad times species_restricted = list("exclude", SPECIES_TESHARI, SPECIES_VOX, SPECIES_DIONA) - sprite_sheets = list() + sprite_sheets = null // 'Custodian' armor /obj/item/clothing/suit/space/void/custodian @@ -150,7 +150,7 @@ // No animal people sprites for these yet, sad times species_restricted = list("exclude", SPECIES_TESHARI, SPECIES_VOX, SPECIES_DIONA) - sprite_sheets = list() + sprite_sheets = null /obj/item/clothing/head/helmet/space/void/custodian name = "custodian helmet" @@ -164,7 +164,7 @@ // No animal people sprites for these yet, sad times species_restricted = list("exclude", SPECIES_TESHARI, SPECIES_VOX, SPECIES_DIONA) - sprite_sheets = list() + sprite_sheets = null // 'Moebius' armor /obj/item/clothing/suit/space/void/aether @@ -179,7 +179,7 @@ // No animal people sprites for these yet, sad times species_restricted = list("exclude", SPECIES_TESHARI, SPECIES_VOX, SPECIES_DIONA) - sprite_sheets = list() + sprite_sheets = null /obj/item/clothing/head/helmet/space/void/aether name = "\improper Aether voidsuit helmet" @@ -193,7 +193,7 @@ // No animal people sprites for these yet, sad times species_restricted = list("exclude", SPECIES_TESHARI, SPECIES_VOX, SPECIES_DIONA) - sprite_sheets = list() + sprite_sheets = null /obj/item/clothing/head/helmet/space/void/aether/verb/select_color() set name = "Helmet Color" @@ -218,7 +218,7 @@ // No animal people sprites for these yet, sad times species_restricted = list("exclude", SPECIES_TESHARI, SPECIES_VOX, SPECIES_DIONA) - sprite_sheets = list() + sprite_sheets = null /obj/item/clothing/head/helmet/space/void/excelsior name = "\improper Excelsior voidsuit helmet" @@ -230,4 +230,4 @@ // No animal people sprites for these yet, sad times species_restricted = list("exclude", SPECIES_TESHARI, SPECIES_VOX, SPECIES_DIONA) - sprite_sheets = list() + sprite_sheets = null diff --git a/code/modules/clothing/under/accessories/accessory.dm b/code/modules/clothing/under/accessories/accessory.dm index ab231df431..2157f9ceec 100644 --- a/code/modules/clothing/under/accessories/accessory.dm +++ b/code/modules/clothing/under/accessories/accessory.dm @@ -57,7 +57,7 @@ if("[tmp_icon_state]_mob" in cached_icon_states(icon_override)) tmp_icon_state = "[tmp_icon_state]_mob" mob_overlay = image("icon" = icon_override, "icon_state" = "[tmp_icon_state]") - else if(wearer && sprite_sheets[wearer.species.get_bodytype(wearer)]) //Teshari can finally into webbing, too! + else if(wearer && LAZYACCESS(sprite_sheets, wearer.species.get_bodytype(wearer))) //Teshari can finally into webbing, too! mob_overlay = image("icon" = sprite_sheets[wearer.species.get_bodytype(wearer)], "icon_state" = "[tmp_icon_state]") else mob_overlay = image("icon" = INV_ACCESSORIES_DEF_ICON, "icon_state" = "[tmp_icon_state]") diff --git a/code/modules/clothing/under/miscellaneous_vr.dm b/code/modules/clothing/under/miscellaneous_vr.dm index c99b562c18..2222ed49be 100644 --- a/code/modules/clothing/under/miscellaneous_vr.dm +++ b/code/modules/clothing/under/miscellaneous_vr.dm @@ -11,7 +11,7 @@ body_parts_covered = 0 equip_sound = null - sprite_sheets = list() + sprite_sheets = null item_state = "golem" //This is dumb and hacky but was here when I got here. worn_state = "golem" //It's basically just a coincidentally black iconstate in the file. diff --git a/code/modules/customitems/item_spawning.dm b/code/modules/customitems/item_spawning.dm index aadafb9b66..c1ddca4522 100644 --- a/code/modules/customitems/item_spawning.dm +++ b/code/modules/customitems/item_spawning.dm @@ -96,7 +96,7 @@ //this has to mirror the way update_inv_*_hand() selects the state /datum/custom_item/proc/get_state(var/obj/item/item, var/slot_str, var/hand_str) var/t_state - if(item.item_state_slots && item.item_state_slots[slot_str]) + if(LAZYACCESS(item.item_state_slots, slot_str)) t_state = item.item_state_slots[slot_str] else if(item.item_state) t_state = item.item_state @@ -111,7 +111,7 @@ var/icon/t_icon if(item.icon_override) t_icon = item.icon_override - else if(item.item_icons && (slot_str in item.item_icons)) + else if(LAZYACCESS(item.item_icons, slot_str)) t_icon = item.item_icons[slot_str] else t_icon = hand_icon diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm index feab80627a..c68ee21401 100644 --- a/code/modules/mob/living/carbon/human/human_defense.dm +++ b/code/modules/mob/living/carbon/human/human_defense.dm @@ -267,7 +267,7 @@ emp_act if(!affecting) return //should be prevented by attacked_with_item() but for sanity. - visible_message("[src] has been [I.attack_verb.len? pick(I.attack_verb) : "attacked"] in the [affecting.name] with [I.name] by [user]!") + visible_message("[src] has been [LAZYLEN(I.attack_verb) ? pick(I.attack_verb) : "attacked"] in the [affecting.name] with [I.name] by [user]!") var/soaked = get_armor_soak(hit_zone, "melee", I.armor_penetration) diff --git a/code/modules/mob/living/carbon/human/species/station/traits_vr/weaver_objs.dm b/code/modules/mob/living/carbon/human/species/station/traits_vr/weaver_objs.dm index b3ddc26ed3..095399a6a0 100644 --- a/code/modules/mob/living/carbon/human/species/station/traits_vr/weaver_objs.dm +++ b/code/modules/mob/living/carbon/human/species/station/traits_vr/weaver_objs.dm @@ -15,7 +15,7 @@ user.setClickCooldown(user.get_attack_speed(W)) if(W.force) - visible_message("\The [src] has been [pick(W.attack_verb)] with \the [W][(user ? " by [user]." : ".")]") + visible_message("\The [src] has been [LAZYLEN(W.attack_verb) ? pick(W.attack_verb) : "attacked"] with \the [W][(user ? " by [user]." : ".")]") qdel(src) /obj/effect/weaversilk/bullet_act(var/obj/item/projectile/Proj) diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm index 589d9ac6a3..e9a75d2ab5 100644 --- a/code/modules/mob/living/living_defense.dm +++ b/code/modules/mob/living/living_defense.dm @@ -225,7 +225,7 @@ //Called when the mob is hit with an item in combat. Returns the blocked result /mob/living/proc/hit_with_weapon(obj/item/I, mob/living/user, var/effective_force, var/hit_zone) - visible_message("[src] has been [I.attack_verb.len? pick(I.attack_verb) : "attacked"] with [I.name] by [user]!") + visible_message("[src] has been [LAZYLEN(I.attack_verb) ? pick(I.attack_verb) : "attacked"] with [I.name] by [user]!") if(ai_holder) ai_holder.react_to_attack(user) diff --git a/code/modules/mob/living/silicon/robot/drone/drone.dm b/code/modules/mob/living/silicon/robot/drone/drone.dm index 32cc4f32d4..d615f41290 100644 --- a/code/modules/mob/living/silicon/robot/drone/drone.dm +++ b/code/modules/mob/living/silicon/robot/drone/drone.dm @@ -1,7 +1,7 @@ var/list/mob_hat_cache = list() /proc/get_hat_icon(var/obj/item/hat, var/offset_x = 0, var/offset_y = 0) var/t_state = hat.icon_state - if(hat.item_state_slots && hat.item_state_slots[slot_head_str]) + if(LAZYACCESS(hat.item_state_slots, slot_head_str)) t_state = hat.item_state_slots[slot_head_str] else if(hat.item_state) t_state = hat.item_state @@ -10,7 +10,7 @@ var/list/mob_hat_cache = list() var/t_icon = INV_HEAD_DEF_ICON // are unique across multiple dmis, but whatever. if(hat.icon_override) t_icon = hat.icon_override - else if(hat.item_icons && (slot_head_str in hat.item_icons)) + else if(LAZYACCESS(hat.item_icons, slot_head_str)) t_icon = hat.item_icons[slot_head_str] var/image/I = image(icon = t_icon, icon_state = t_state) I.pixel_x = offset_x diff --git a/code/modules/mob/living/simple_mob/hands.dm b/code/modules/mob/living/simple_mob/hands.dm index 8ec2158d65..9d869df631 100644 --- a/code/modules/mob/living/simple_mob/hands.dm +++ b/code/modules/mob/living/simple_mob/hands.dm @@ -52,7 +52,7 @@ //determine icon state to use var/t_state - if(r_hand.item_state_slots && r_hand.item_state_slots[slot_r_hand_str]) + if(LAZYACCESS(r_hand.item_state_slots, slot_r_hand_str)) t_state = r_hand.item_state_slots[slot_r_hand_str] else if(r_hand.item_state) t_state = r_hand.item_state @@ -61,7 +61,7 @@ //determine icon to use var/icon/t_icon - if(r_hand.item_icons && (slot_r_hand_str in r_hand.item_icons)) + if(LAZYACCESS(r_hand.item_icons, slot_r_hand_str)) t_icon = r_hand.item_icons[slot_r_hand_str] else if(r_hand.icon_override) t_state += "_r" @@ -89,7 +89,7 @@ //determine icon state to use var/t_state - if(l_hand.item_state_slots && l_hand.item_state_slots[slot_l_hand_str]) + if(LAZYACCESS(l_hand.item_state_slots, slot_l_hand_str)) t_state = l_hand.item_state_slots[slot_l_hand_str] else if(l_hand.item_state) t_state = l_hand.item_state @@ -98,7 +98,7 @@ //determine icon to use var/icon/t_icon - if(l_hand.item_icons && (slot_l_hand_str in l_hand.item_icons)) + if(LAZYACCESS(l_hand.item_icons, slot_l_hand_str)) t_icon = l_hand.item_icons[slot_l_hand_str] else if(l_hand.icon_override) t_state += "_l" diff --git a/code/modules/projectiles/gun.dm b/code/modules/projectiles/gun.dm index de0a1f46bd..bdfd61a7d4 100644 --- a/code/modules/projectiles/gun.dm +++ b/code/modules/projectiles/gun.dm @@ -156,11 +156,11 @@ var/mob/living/M = loc if(istype(M)) if(M.can_wield_item(src) && src.is_held_twohanded(M)) - item_state_slots[slot_l_hand_str] = wielded_item_state - item_state_slots[slot_r_hand_str] = wielded_item_state + LAZYSET(item_state_slots, slot_l_hand_str, wielded_item_state) + LAZYSET(item_state_slots, slot_r_hand_str, wielded_item_state) else - item_state_slots[slot_l_hand_str] = initial(item_state) - item_state_slots[slot_r_hand_str] = initial(item_state) + LAZYSET(item_state_slots, slot_l_hand_str, initial(item_state)) + LAZYSET(item_state_slots, slot_r_hand_str, initial(item_state)) ..() diff --git a/code/modules/projectiles/guns/energy/gunsword_vr.dm b/code/modules/projectiles/guns/energy/gunsword_vr.dm index 20ffc1ccea..e5ffffc05d 100644 --- a/code/modules/projectiles/guns/energy/gunsword_vr.dm +++ b/code/modules/projectiles/guns/energy/gunsword_vr.dm @@ -89,7 +89,7 @@ edge = initial(edge) w_class = initial(w_class) set_light(0,0) - attack_verb = list() + attack_verb = null /obj/item/weapon/cell/device/weapon/gunsword/attack_self(mob/living/user as mob) diff --git a/code/modules/vore/fluffstuff/custom_clothes_vr.dm b/code/modules/vore/fluffstuff/custom_clothes_vr.dm index fb7a3de2f0..d622e104f0 100644 --- a/code/modules/vore/fluffstuff/custom_clothes_vr.dm +++ b/code/modules/vore/fluffstuff/custom_clothes_vr.dm @@ -1018,7 +1018,7 @@ icon_state = "gildedcuffs" icon_override = 'icons/vore/custom_onmob_vr.dmi' - item_icons = list() + item_icons = null body_parts_covered = 0 @@ -1847,7 +1847,7 @@ Departamental Swimsuits, for general use rolled_down = 0 rolled_sleeves = 0 starting_accessories = null - item_icons = list() + item_icons = null //Vorrarkul: Melanie Farmer /obj/item/clothing/under/fluff/slime_skeleton @@ -1901,10 +1901,10 @@ Departamental Swimsuits, for general use body_parts_covered = UPPER_TORSO|LOWER_TORSO icon = 'icons/vore/custom_clothes_vr.dmi' icon_state = "latex_clothes" - item_icons = list() + item_icons = null default_worn_icon = 'icons/vore/custom_clothes_vr.dmi' color = COLOR_NAVY - sprite_sheets = list() + sprite_sheets = null //SweetBlueSylveon:Pip Shyner /obj/item/clothing/accessory/poncho/roles/cloak/hop/fluff/pip @@ -1994,7 +1994,7 @@ Departamental Swimsuits, for general use icon_override = 'icons/vore/custom_onmob_vr.dmi' icon_state = "nikki_outfit" item_state = "nikki_outfit" - item_icons = list() + item_icons = null sensor_mode = 3 // I'm a dumbass and forget these all the time please understand :( /obj/item/clothing/under/skirt/outfit/fluff/nikki/mob_can_equip(var/mob/living/carbon/human/M, slot, disable_warning = 0) diff --git a/code/modules/vore/resizing/holder_micro_vr.dm b/code/modules/vore/resizing/holder_micro_vr.dm index 1f4f65084d..d4f114fc2a 100644 --- a/code/modules/vore/resizing/holder_micro_vr.dm +++ b/code/modules/vore/resizing/holder_micro_vr.dm @@ -7,8 +7,8 @@ icon_override = 'icons/inventory/head/mob_vr.dmi' slot_flags = SLOT_FEET | SLOT_HEAD | SLOT_ID w_class = ITEMSIZE_SMALL - item_icons = list() // No in-hand sprites (for now, anyway, we could totally add some) - pixel_y = 0 // Override value from parent. + item_icons = null // No in-hand sprites (for now, anyway, we could totally add some) + pixel_y = 0 // Override value from parent. /obj/item/weapon/holder/micro/examine(mob/user) . = list()