From 778a589555427c488af2de0c53805d2d965aa99a Mon Sep 17 00:00:00 2001 From: Gandalf Date: Wed, 30 Jun 2021 20:50:50 +0100 Subject: [PATCH] Removes a lot of redundant non-modular changes and maybe fixes cleanbots (#6615) * oof * Update _ai_controller.dm * no need for this anymore --- code/__HELPERS/sanitize_values.dm | 2 +- code/datums/ai/_ai_controller.dm | 4 ++-- code/datums/chatmessage.dm | 3 +-- code/datums/diseases/advance/advance.dm | 6 +++--- code/datums/mapgen/CaveGenerator.dm | 2 +- .../dynamic/dynamic_rulesets_latejoin.dm | 2 +- .../dynamic/dynamic_rulesets_midround.dm | 6 +++--- .../dynamic/dynamic_rulesets_roundstart.dm | 2 +- code/game/objects/effects/spawners/bundle.dm | 2 +- .../game/objects/effects/spawners/lootdrop.dm | 2 +- .../objects/effects/spawners/structure.dm | 2 +- code/game/objects/items.dm | 2 +- code/game/objects/structures/flora.dm | 2 +- .../view_variables/mass_edit_variables.dm | 2 +- .../admin/view_variables/modify_variables.dm | 2 +- .../cargo/blackmarket/blackmarket_uplink.dm | 4 ++-- code/modules/cargo/expressconsole.dm | 4 ++-- code/modules/cargo/order.dm | 2 +- code/modules/clothing/clothing.dm | 2 +- code/modules/hydroponics/grown.dm | 4 ++-- code/modules/hydroponics/hydroitemdefines.dm | 2 +- code/modules/mapping/map_template.dm | 3 +-- code/modules/mob/dead/crew_manifest.dm | 2 +- .../mob/living/carbon/carbon_update_icons.dm | 2 +- .../carbon/human/species_types/golems.dm | 2 +- code/modules/mob/living/carbon/inventory.dm | 2 +- code/modules/mob/living/silicon/ai/ai.dm | 2 +- .../mob/living/silicon/robot/inventory.dm | 2 +- .../mob/living/simple_animal/bot/bot.dm | 2 +- .../mob/living/simple_animal/bot/mulebot.dm | 2 +- .../mob/living/simple_animal/bot/secbot.dm | 19 ++++++++----------- .../living/simple_animal/hostile/hostile.dm | 3 ++- .../mob/living/simple_animal/simple_animal.dm | 14 +++++++------- code/modules/mob/mob.dm | 2 +- .../file_system/programs/ntnrc_client.dm | 2 +- code/modules/power/powernet.dm | 2 +- code/modules/religion/rites.dm | 2 +- code/modules/shuttle/emergency.dm | 2 +- code/modules/spells/spell_types/projectile.dm | 2 +- code/modules/station_goals/dna_vault.dm | 2 +- code/modules/unit_tests/outfit_sanity.dm | 4 +--- 41 files changed, 63 insertions(+), 69 deletions(-) diff --git a/code/__HELPERS/sanitize_values.dm b/code/__HELPERS/sanitize_values.dm index 87448c46060..75ed837aae9 100644 --- a/code/__HELPERS/sanitize_values.dm +++ b/code/__HELPERS/sanitize_values.dm @@ -29,7 +29,7 @@ return value if(default) return default - if(List && List.len) + if(List?.len) return pick(List) diff --git a/code/datums/ai/_ai_controller.dm b/code/datums/ai/_ai_controller.dm index 0ef9dcb39da..d2aee869ccd 100644 --- a/code/datums/ai/_ai_controller.dm +++ b/code/datums/ai/_ai_controller.dm @@ -99,9 +99,9 @@ have ways of interacting with a specific atom and control it. They posses a blac walk(pawn, 0) //stop moving return //this should remove them from processing in the future through event-based stuff. - if(!current_behaviors && current_behaviors.len) + if(!current_behaviors?.len) SelectBehaviors(delta_time) - if(!(current_behaviors && current_behaviors.len)) + if(!current_behaviors?.len) PerformIdleBehavior(delta_time) //Do some stupid shit while we have nothing to do return diff --git a/code/datums/chatmessage.dm b/code/datums/chatmessage.dm index 5dfd23ce730..8806c56ab34 100644 --- a/code/datums/chatmessage.dm +++ b/code/datums/chatmessage.dm @@ -159,8 +159,7 @@ LAZYSET(language_icons, language, language_icon) LAZYADD(prefixes, "\icon[language_icon]") - if(prefixes) - text = "[prefixes.Join(" ")][text]" + text = "[prefixes?.Join(" ")][text]" // We dim italicized text to make it more distinguishable from regular text var/tgt_color = extra_classes.Find("italics") ? target.chat_color_darkened : target.chat_color diff --git a/code/datums/diseases/advance/advance.dm b/code/datums/diseases/advance/advance.dm index 4323bb70b34..c4aec06d144 100644 --- a/code/datums/diseases/advance/advance.dm +++ b/code/datums/diseases/advance/advance.dm @@ -210,7 +210,7 @@ /datum/disease/advance/proc/Refresh(new_name = FALSE) GenerateProperties() AssignProperties() - if(processing && symptoms && symptoms.len) + if(processing && symptoms?.len) for(var/datum/symptom/S in symptoms) S.Start(src) S.on_stage_change(src) @@ -238,7 +238,7 @@ // Assign the properties that are in the list. /datum/disease/advance/proc/AssignProperties() - if(properties && properties.len) + if(properties?.len) if(properties["stealth"] >= 2) visibility_flags |= HIDDEN_SCANNER else @@ -308,7 +308,7 @@ // Will generate a random cure, the more resistance the symptoms have, the harder the cure. /datum/disease/advance/proc/GenerateCure() - if(properties && properties.len) + if(properties?.len) var/res = clamp(properties["resistance"] - (symptoms.len / 2), 1, advance_cures.len) if(res == oldres) return diff --git a/code/datums/mapgen/CaveGenerator.dm b/code/datums/mapgen/CaveGenerator.dm index 89bb1991c36..8cf81c1d8f5 100644 --- a/code/datums/mapgen/CaveGenerator.dm +++ b/code/datums/mapgen/CaveGenerator.dm @@ -118,7 +118,7 @@ var/atom/picked_mob = pickweight(mob_spawn_list) if(picked_mob == SPAWN_MEGAFAUNA) // - if((A.area_flags & MEGAFAUNA_SPAWN_ALLOWED) && megafauna_spawn_list && megafauna_spawn_list.len) //this is danger. it's boss time. + if((A.area_flags & MEGAFAUNA_SPAWN_ALLOWED) && megafauna_spawn_list?.len) //this is danger. it's boss time. picked_mob = pickweight(megafauna_spawn_list) else //this is not danger, don't spawn a boss, spawn something else picked_mob = pickweight(mob_spawn_list - SPAWN_MEGAFAUNA) //What if we used 100% of the brain...and did something (slightly) less shit than a while loop? diff --git a/code/game/gamemodes/dynamic/dynamic_rulesets_latejoin.dm b/code/game/gamemodes/dynamic/dynamic_rulesets_latejoin.dm index 95814e2aba8..6632f426d18 100644 --- a/code/game/gamemodes/dynamic/dynamic_rulesets_latejoin.dm +++ b/code/game/gamemodes/dynamic/dynamic_rulesets_latejoin.dm @@ -131,7 +131,7 @@ /// Checks for revhead loss conditions and other antag datums. /datum/dynamic_ruleset/latejoin/provocateur/proc/check_eligible(datum/mind/M) var/turf/T = get_turf(M.current) - if(!considered_afk(M) && considered_alive(M) && is_station_level(T.z) && !(M.antag_datums && M.antag_datums.len) && !HAS_TRAIT(M, TRAIT_MINDSHIELD)) + if(!considered_afk(M) && considered_alive(M) && is_station_level(T.z) && !M.antag_datums?.len && !HAS_TRAIT(M, TRAIT_MINDSHIELD)) return TRUE return FALSE diff --git a/code/game/gamemodes/dynamic/dynamic_rulesets_midround.dm b/code/game/gamemodes/dynamic/dynamic_rulesets_midround.dm index 79b119760d7..68012c8afa3 100644 --- a/code/game/gamemodes/dynamic/dynamic_rulesets_midround.dm +++ b/code/game/gamemodes/dynamic/dynamic_rulesets_midround.dm @@ -221,7 +221,7 @@ living_players -= player else if(is_centcom_level(player.z)) living_players -= player // We don't autotator people in CentCom - else if(player.mind && (player.mind.special_role || ( player.mind.antag_datums && player.mind.antag_datums.len ) > 0)) + else if(player.mind && (player.mind.special_role || player.mind.antag_datums?.len > 0)) living_players -= player // We don't autotator people with roles already /datum/dynamic_ruleset/midround/autotraitor/ready(forced = FALSE) @@ -270,7 +270,7 @@ candidates -= player else if(is_centcom_level(player.z)) candidates -= player - else if(player.mind && (player.mind.special_role || ( player.mind.antag_datums && player.mind.antag_datums.len ) > 0)) + else if(player.mind && (player.mind.special_role || player.mind.antag_datums?.len > 0)) candidates -= player else if(HAS_TRAIT(player, TRAIT_MINDSHIELD)) candidates -= player @@ -339,7 +339,7 @@ candidates -= player continue - if(player.mind && (player.mind.special_role || ( player.mind.antag_datums && player.mind.antag_datums.len ) > 0)) + if(player.mind && (player.mind.special_role || player.mind.antag_datums?.len > 0)) candidates -= player /datum/dynamic_ruleset/midround/malf/execute() diff --git a/code/game/gamemodes/dynamic/dynamic_rulesets_roundstart.dm b/code/game/gamemodes/dynamic/dynamic_rulesets_roundstart.dm index 3833d1f68c4..9482e78f16d 100644 --- a/code/game/gamemodes/dynamic/dynamic_rulesets_roundstart.dm +++ b/code/game/gamemodes/dynamic/dynamic_rulesets_roundstart.dm @@ -478,7 +478,7 @@ /// Checks for revhead loss conditions and other antag datums. /datum/dynamic_ruleset/roundstart/revs/proc/check_eligible(datum/mind/M) var/turf/T = get_turf(M.current) - if(!considered_afk(M) && considered_alive(M) && is_station_level(T.z) && !(M.antag_datums && M.antag_datums.len) && !HAS_TRAIT(M, TRAIT_MINDSHIELD)) + if(!considered_afk(M) && considered_alive(M) && is_station_level(T.z) && !M.antag_datums?.len && !HAS_TRAIT(M, TRAIT_MINDSHIELD)) return TRUE return FALSE diff --git a/code/game/objects/effects/spawners/bundle.dm b/code/game/objects/effects/spawners/bundle.dm index d03e4b5256a..3e8e2d070fe 100644 --- a/code/game/objects/effects/spawners/bundle.dm +++ b/code/game/objects/effects/spawners/bundle.dm @@ -8,7 +8,7 @@ /obj/effect/spawner/bundle/Initialize(mapload) ..() - if(items && items.len) + if(items?.len) for(var/path in items) new path(loc) return INITIALIZE_HINT_QDEL diff --git a/code/game/objects/effects/spawners/lootdrop.dm b/code/game/objects/effects/spawners/lootdrop.dm index db263097689..a9f4b16ac45 100644 --- a/code/game/objects/effects/spawners/lootdrop.dm +++ b/code/game/objects/effects/spawners/lootdrop.dm @@ -9,7 +9,7 @@ /obj/effect/spawner/lootdrop/Initialize(mapload) ..() - if(loot && loot.len) + if(loot?.len) var/loot_spawned = 0 while((lootcount-loot_spawned) && loot.len) var/lootspawn = pickweight(loot) diff --git a/code/game/objects/effects/spawners/structure.dm b/code/game/objects/effects/spawners/structure.dm index f55a1470f62..c561f787e2c 100644 --- a/code/game/objects/effects/spawners/structure.dm +++ b/code/game/objects/effects/spawners/structure.dm @@ -10,7 +10,7 @@ again. /obj/effect/spawner/structure/Initialize() . = ..() - if(spawn_list && spawn_list.len) + if(spawn_list?.len) for(var/I in spawn_list) new I(get_turf(src)) return INITIALIZE_HINT_QDEL diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index 74d8f4dbc13..b956350b6bb 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -1125,7 +1125,7 @@ GLOBAL_DATUM_INIT(fire_overlay, /mutable_appearance, mutable_appearance('icons/e return source_item?.reagents?.add_reagent(/datum/reagent/blood, 2) - else if(custom_materials && custom_materials.len) //if we've got materials, lets see whats in it + else if(custom_materials?.len) //if we've got materials, lets see whats in it /// How many mats have we found? You can only be affected by two material datums by default var/found_mats = 0 /// How much of each material is in it? Used to determine if the glass should break diff --git a/code/game/objects/structures/flora.dm b/code/game/objects/structures/flora.dm index 39dae0e5347..d5458c45f81 100644 --- a/code/game/objects/structures/flora.dm +++ b/code/game/objects/structures/flora.dm @@ -48,7 +48,7 @@ /obj/structure/flora/tree/pine/Initialize() . = ..() - if(islist(icon_states)) + if(islist(icon_states?.len)) icon_state = pick(icon_states) /obj/structure/flora/tree/pine/xmas diff --git a/code/modules/admin/view_variables/mass_edit_variables.dm b/code/modules/admin/view_variables/mass_edit_variables.dm index ecb0c89c776..138dd573379 100644 --- a/code/modules/admin/view_variables/mass_edit_variables.dm +++ b/code/modules/admin/view_variables/mass_edit_variables.dm @@ -117,7 +117,7 @@ var/list/varsvars = vv_parse_text(O, new_value) var/pre_processing = new_value var/unique - if (varsvars && varsvars.len) + if (varsvars?.len) unique = tgui_alert(usr, "Process vars unique to each instance, or same for all?", "Variable Association", list("Unique", "Same")) if(unique == "Unique") unique = TRUE diff --git a/code/modules/admin/view_variables/modify_variables.dm b/code/modules/admin/view_variables/modify_variables.dm index f6fd4bc500d..b97a76ef064 100644 --- a/code/modules/admin/view_variables/modify_variables.dm +++ b/code/modules/admin/view_variables/modify_variables.dm @@ -23,7 +23,7 @@ GLOBAL_PROTECT(VVpixelmovement) var/list/subtypes = subtypesof(type) if (!subtypes || !subtypes.len) return FALSE - if (subtypes && subtypes.len) + if (subtypes?.len) switch(tgui_alert(usr,"Strict object type detection?", "Type detection", list("Strictly this type","This type and subtypes", "Cancel"))) if("Strictly this type") return FALSE diff --git a/code/modules/cargo/blackmarket/blackmarket_uplink.dm b/code/modules/cargo/blackmarket/blackmarket_uplink.dm index 222eec50e6a..138497d32b5 100644 --- a/code/modules/cargo/blackmarket/blackmarket_uplink.dm +++ b/code/modules/cargo/blackmarket/blackmarket_uplink.dm @@ -19,7 +19,7 @@ if(accessible_markets.len) viewing_market = accessible_markets[1] var/list/categories = SSblackmarket.markets[viewing_market].categories - if(categories && categories.len) + if(categories?.len) viewing_category = categories[1] /obj/item/blackmarket_uplink/attackby(obj/item/I, mob/user, params) @@ -121,7 +121,7 @@ viewing_market = market var/list/categories = SSblackmarket.markets[viewing_market].categories - if(categories && categories.len) + if(categories?.len) viewing_category = categories[1] else viewing_category = null diff --git a/code/modules/cargo/expressconsole.dm b/code/modules/cargo/expressconsole.dm index 5cee9a3bc9f..55fce78dff1 100644 --- a/code/modules/cargo/expressconsole.dm +++ b/code/modules/cargo/expressconsole.dm @@ -201,7 +201,7 @@ continue LAZYADD(empty_turfs, T) CHECK_TICK - if(empty_turfs && empty_turfs.len) + if(empty_turfs?.len) LZ = pick(empty_turfs) if (SO.pack.get_cost() <= points_to_check && LZ)//we need to call the cost check again because of the CHECK_TICK call TIMER_COOLDOWN_START(src, COOLDOWN_EXPRESSPOD_CONSOLE, 5 SECONDS) @@ -220,7 +220,7 @@ continue LAZYADD(empty_turfs, T) CHECK_TICK - if(empty_turfs && empty_turfs.len) + if(empty_turfs?.len) TIMER_COOLDOWN_START(src, COOLDOWN_EXPRESSPOD_CONSOLE, 10 SECONDS) D.adjust_money(-(SO.pack.get_cost() * (0.72*MAX_EMAG_ROCKETS))) diff --git a/code/modules/cargo/order.dm b/code/modules/cargo/order.dm index 94613fcb88a..e44801c0b38 100644 --- a/code/modules/cargo/order.dm +++ b/code/modules/cargo/order.dm @@ -16,7 +16,7 @@ errors |= MANIFEST_ERROR_ITEM /obj/item/paper/fluff/jobs/cargo/manifest/proc/is_approved() - return (stamped && stamped.len) && !is_denied() + return stamped?.len && !is_denied() /obj/item/paper/fluff/jobs/cargo/manifest/proc/is_denied() return stamped && ("stamp-deny" in stamped) diff --git a/code/modules/clothing/clothing.dm b/code/modules/clothing/clothing.dm index 32d6b9fec17..63726d6f0de 100644 --- a/code/modules/clothing/clothing.dm +++ b/code/modules/clothing/clothing.dm @@ -304,7 +304,7 @@ how_cool_are_your_threads += "[src]'s storage opens when clicked.\n" else how_cool_are_your_threads += "[src]'s storage opens when dragged to yourself.\n" - if (pockets.can_hold && pockets.can_hold.len) // If pocket type can hold anything, vs only specific items + if (pockets.can_hold?.len) // If pocket type can hold anything, vs only specific itemss how_cool_are_your_threads += "[src] can store [pockets.max_items] item\s.\n" else how_cool_are_your_threads += "[src] can store [pockets.max_items] item\s that are [weightclass2text(pockets.max_w_class)] or smaller.\n" diff --git a/code/modules/hydroponics/grown.dm b/code/modules/hydroponics/grown.dm index 8e84ba537aa..413fdda4556 100644 --- a/code/modules/hydroponics/grown.dm +++ b/code/modules/hydroponics/grown.dm @@ -109,7 +109,7 @@ /obj/item/food/grown/on_grind() . = ..() var/nutriment = reagents.get_reagent_amount(/datum/reagent/consumable/nutriment) - if(grind_results && grind_results.len) + if(grind_results?.len) for(var/i in 1 to grind_results.len) grind_results[grind_results[i]] = nutriment reagents.del_reagent(/datum/reagent/consumable/nutriment) @@ -117,7 +117,7 @@ /obj/item/food/grown/on_juice() var/nutriment = reagents.get_reagent_amount(/datum/reagent/consumable/nutriment) - if(juice_results && juice_results.len) + if(juice_results?.len) for(var/i in 1 to juice_results.len) juice_results[juice_results[i]] = nutriment reagents.del_reagent(/datum/reagent/consumable/nutriment) diff --git a/code/modules/hydroponics/hydroitemdefines.dm b/code/modules/hydroponics/hydroitemdefines.dm index f71b942d467..5441260ce97 100644 --- a/code/modules/hydroponics/hydroitemdefines.dm +++ b/code/modules/hydroponics/hydroitemdefines.dm @@ -218,7 +218,7 @@ if(scanned_object.reagents) //we have reagents contents returned_message += get_analyzer_text_chem_contents(scanned_object) - else if (our_seed.reagents_add && our_seed.reagents_add.len) //we have a seed with reagent genes + else if (our_seed.reagents_add?.len) //we have a seed with reagent genes returned_message += get_analyzer_text_chem_genes(our_seed) else returned_message += "*---------*\nNo reagents found.\n*---------*" diff --git a/code/modules/mapping/map_template.dm b/code/modules/mapping/map_template.dm index 75fbdfc2265..7b8bc034260 100644 --- a/code/modules/mapping/map_template.dm +++ b/code/modules/mapping/map_template.dm @@ -138,8 +138,7 @@ for(var/L in border) var/turf/turf_to_disable = L SSair.remove_from_active(turf_to_disable) //stop processing turfs along the border to prevent runtimes, we return it in initTemplateBounds() - if(turf_to_disable.atmos_adjacent_turfs) - turf_to_disable.atmos_adjacent_turfs.Cut() + turf_to_disable.atmos_adjacent_turfs?.Cut() // Accept cached maps, but don't save them automatically - we don't want // ruins clogging up memory for the whole round. diff --git a/code/modules/mob/dead/crew_manifest.dm b/code/modules/mob/dead/crew_manifest.dm index d553beea1df..aa511768776 100644 --- a/code/modules/mob/dead/crew_manifest.dm +++ b/code/modules/mob/dead/crew_manifest.dm @@ -19,7 +19,7 @@ /datum/crew_manifest/ui_data(mob/user) var/list/positions = list( - "Central Command" = list("exceptions" = list(), "open" = 0), + "Central Command" = list("exceptions" = list(), "open" = 0), //SKYRAT EDIT ADDITION "Command" = list("exceptions" = list(), "open" = 0), "Security" = list("exceptions" = list(), "open" = 0), "Engineering" = list("exceptions" = list(), "open" = 0), diff --git a/code/modules/mob/living/carbon/carbon_update_icons.dm b/code/modules/mob/living/carbon/carbon_update_icons.dm index 2dcc5b6e2c8..122f2c484c7 100644 --- a/code/modules/mob/living/carbon/carbon_update_icons.dm +++ b/code/modules/mob/living/carbon/carbon_update_icons.dm @@ -57,7 +57,7 @@ if(client && hud_used && hud_used.hud_version != HUD_STYLE_NOHUD) I.screen_loc = ui_hand_position(get_held_index_of_item(I)) client.screen += I - if(observers && observers.len) + if(observers?.len) for(var/M in observers) var/mob/dead/observe = M if(observe.client && observe.client.eye == src) diff --git a/code/modules/mob/living/carbon/human/species_types/golems.dm b/code/modules/mob/living/carbon/human/species_types/golems.dm index 81ac6b92ecb..c6068cd71fd 100644 --- a/code/modules/mob/living/carbon/human/species_types/golems.dm +++ b/code/modules/mob/living/carbon/human/species_types/golems.dm @@ -53,7 +53,7 @@ // cultural contamination if(prob(human_surname_chance)) golem_surname = pick(GLOB.last_names) - else if(special_names && special_names.len && prob(special_name_chance)) + else if(special_names?.len && prob(special_name_chance)) golem_surname = pick(special_names) var/golem_name = "[prefix] [golem_surname]" diff --git a/code/modules/mob/living/carbon/inventory.dm b/code/modules/mob/living/carbon/inventory.dm index 02244bbce08..2beaae0c83e 100644 --- a/code/modules/mob/living/carbon/inventory.dm +++ b/code/modules/mob/living/carbon/inventory.dm @@ -39,7 +39,7 @@ I.screen_loc = null if(client) client.screen -= I - if(observers && observers.len) + if(observers?.len) for(var/M in observers) var/mob/dead/observe = M if(observe.client) diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm index 84deb22bcc7..2a0fb30f7f3 100644 --- a/code/modules/mob/living/silicon/ai/ai.dm +++ b/code/modules/mob/living/silicon/ai/ai.dm @@ -550,7 +550,7 @@ if (cameras) if (cam?.can_use()) queueAlarm("--- [class] alarm detected in [home.name]! ([cam.c_tag])", class) - else if (our_cams && our_cams.len) + else if (our_cams?.len) var/foo = 0 var/dat2 = "" for (var/obj/machinery/camera/I in our_cams) diff --git a/code/modules/mob/living/silicon/robot/inventory.dm b/code/modules/mob/living/silicon/robot/inventory.dm index b47be3c1b25..fc6c99d8c1c 100644 --- a/code/modules/mob/living/silicon/robot/inventory.dm +++ b/code/modules/mob/living/silicon/robot/inventory.dm @@ -244,7 +244,7 @@ * * add - whether or not the item is being added, or removed. */ /mob/living/silicon/robot/proc/observer_screen_update(obj/item/item_module, add = TRUE) - if(observers && observers.len) + if(observers?.len) for(var/M in observers) var/mob/dead/observe = M if(observe.client && observe.client.eye == src) diff --git a/code/modules/mob/living/simple_animal/bot/bot.dm b/code/modules/mob/living/simple_animal/bot/bot.dm index c333be83be0..beb56724f51 100644 --- a/code/modules/mob/living/simple_animal/bot/bot.dm +++ b/code/modules/mob/living/simple_animal/bot/bot.dm @@ -565,7 +565,7 @@ Pass a positive integer as an argument to override a bot's default speed. calling_ai = caller //Link the AI to the bot! ai_waypoint = waypoint - if(path && path.len) //Ensures that a valid path is calculated! + if(path?.len) //Ensures that a valid path is calculated! var/end_area = get_area_name(waypoint) if(!on) turn_on() //Saves the AI the hassle of having to activate a bot manually. diff --git a/code/modules/mob/living/simple_animal/bot/mulebot.dm b/code/modules/mob/living/simple_animal/bot/mulebot.dm index 6b5e18cfc33..a592cfa716e 100644 --- a/code/modules/mob/living/simple_animal/bot/mulebot.dm +++ b/code/modules/mob/living/simple_animal/bot/mulebot.dm @@ -524,7 +524,7 @@ /mob/living/simple_animal/bot/mulebot/call_bot() ..() - if(path && path.len) + if(path?.len) target = ai_waypoint //Target is the end point of the path, the waypoint set by the AI. destination = get_area_name(target, TRUE) pathset = 1 //Indicates the AI's custom path is initialized. diff --git a/code/modules/mob/living/simple_animal/bot/secbot.dm b/code/modules/mob/living/simple_animal/bot/secbot.dm index 63a09c7b61f..83600bd7b42 100644 --- a/code/modules/mob/living/simple_animal/bot/secbot.dm +++ b/code/modules/mob/living/simple_animal/bot/secbot.dm @@ -300,13 +300,11 @@ Auto Patrol: []"}, weapon.attack(C, src) if(ishuman(C)) C.stuttering = 5 - //C.Paralyze(100) SKYRAT EDIT CHANGE BELOW - C.StaminaKnockdown(60,TRUE) + C.Paralyze(100) var/mob/living/carbon/human/H = C threat = H.assess_threat(judgement_criteria, weaponcheck=CALLBACK(src, .proc/check_for_weapons)) else - //C.Paralyze(100) SKYRAT EDIT CHANGE BELOW - C.StaminaKnockdown(60,TRUE) + C.Paralyze(100) C.stuttering = 5 threat = C.assess_threat(judgement_criteria, weaponcheck=CALLBACK(src, .proc/check_for_weapons)) @@ -345,10 +343,9 @@ Auto Patrol: []"}, else stun_attack(target) + mode = BOT_PREP_ARREST + set_anchored(TRUE) target_lastloc = target.loc - if(target.incapacitated()) //SKYRAT EDIT ADDITION - mode = BOT_PREP_ARREST - set_anchored(TRUE) return else // not next to perp @@ -364,7 +361,7 @@ Auto Patrol: []"}, if(BOT_PREP_ARREST) // preparing to arrest target // see if he got away. If he's no no longer adjacent or inside a closet or about to get up, we hunt again. - if( !Adjacent(target) || !isturf(target.loc) || (target.AmountParalyzed() < 40 && target.staminaloss < STAMINA_THRESHOLD_SOFTCRIT)) //SKYRAT EDIT CHANGE: if( !Adjacent(target) || !isturf(target.loc) || target.AmountParalyzed() < 40) + if( !Adjacent(target) || !isturf(target.loc) || target.AmountParalyzed() < 40) back_to_hunt() return @@ -473,9 +470,9 @@ Auto Patrol: []"}, Sa.add_overlay("hs_hole") Sa.created_name = name new /obj/item/assembly/prox_sensor(Tsec) - /* var/obj/item/gun/energy/disabler/G = new (Tsec) - SKYRAT EDIT REMOVAL START + var/obj/item/gun/energy/disabler/G = new (Tsec) G.cell.charge = 0 - G.update_appearance() */ // SKYRAT EDIT REMOVAL END - no more disabler farms + G.update_appearance() if(prob(50)) new /obj/item/bodypart/l_leg/robot(Tsec) if(prob(25)) @@ -491,7 +488,7 @@ Auto Patrol: []"}, Sa.add_overlay("hs_hole") Sa.created_name = name new /obj/item/assembly/prox_sensor(Tsec) - // drop_part(baton_type, Tsec) - SKYRAT EDIT REMOVAL - no more baton farms + drop_part(baton_type, Tsec) if(prob(50)) drop_part(robot_arm, Tsec) diff --git a/code/modules/mob/living/simple_animal/hostile/hostile.dm b/code/modules/mob/living/simple_animal/hostile/hostile.dm index 7caf9c03fad..d08362907e4 100644 --- a/code/modules/mob/living/simple_animal/hostile/hostile.dm +++ b/code/modules/mob/living/simple_animal/hostile/hostile.dm @@ -353,7 +353,8 @@ /mob/living/simple_animal/hostile/proc/AttackingTarget(atom/attacked_target) in_melee = TRUE - SEND_SIGNAL(src, COMSIG_HOSTILE_PRE_ATTACKINGTARGET, target) + if(SEND_SIGNAL(src, COMSIG_HOSTILE_PRE_ATTACKINGTARGET, target) & COMPONENT_HOSTILE_NO_ATTACK) + return FALSE //but more importantly return before attack_animal called var/result = target.attack_animal(src) SEND_SIGNAL(src, COMSIG_HOSTILE_POST_ATTACKINGTARGET, target, result) return result diff --git a/code/modules/mob/living/simple_animal/simple_animal.dm b/code/modules/mob/living/simple_animal/simple_animal.dm index ada29641746..882746c6555 100644 --- a/code/modules/mob/living/simple_animal/simple_animal.dm +++ b/code/modules/mob/living/simple_animal/simple_animal.dm @@ -260,12 +260,12 @@ set waitfor = FALSE if(speak_chance) if(prob(speak_chance) || override) - if(speak && speak.len) - if((emote_hear && emote_hear.len) || (emote_see && emote_see.len)) + if(speak?.len) + if((emote_hear?.len) || (emote_see?.len)) var/length = speak.len - if(emote_hear && emote_hear.len) + if(emote_hear?.len) length += emote_hear.len - if(emote_see && emote_see.len) + if(emote_see?.len) length += emote_see.len var/randomValue = rand(1,length) if(randomValue <= speak.len) @@ -279,11 +279,11 @@ else say(pick(speak), forced = "poly") else - if(!(emote_hear && emote_hear.len) && (emote_see && emote_see.len)) + if(!(emote_hear?.len) && (emote_see?.len)) manual_emote(pick(emote_see)) - if((emote_hear && emote_hear.len) && !(emote_see && emote_see.len)) + if((emote_hear?.len) && !(emote_see?.len)) manual_emote(pick(emote_hear)) - if((emote_hear && emote_hear.len) && (emote_see && emote_see.len)) + if((emote_hear?.len) && (emote_see?.len)) var/length = emote_hear.len + emote_see.len var/pick = rand(1,length) if(pick <= emote_see.len) diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 415079360c6..ecbdba6edeb 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -37,7 +37,7 @@ progressbars = null for (var/alert in alerts) clear_alert(alert, TRUE) - if(observers && observers.len) + if(observers?.len) for(var/M in observers) var/mob/dead/observe = M observe.reset_perspective(null) diff --git a/code/modules/modular_computers/file_system/programs/ntnrc_client.dm b/code/modules/modular_computers/file_system/programs/ntnrc_client.dm index c904b925ea9..29a4418d2ca 100644 --- a/code/modules/modular_computers/file_system/programs/ntnrc_client.dm +++ b/code/modules/modular_computers/file_system/programs/ntnrc_client.dm @@ -180,7 +180,7 @@ else last_message = null return TRUE - if(channel?.messages && channel?.messages.len) + if(channel?.messages?.len) ui_header = last_message == channel.messages[length(channel.messages)] ? "ntnrc_idle.gif" : "ntnrc_new.gif" else ui_header = "ntnrc_idle.gif" diff --git a/code/modules/power/powernet.dm b/code/modules/power/powernet.dm index 547154ed5b1..70d5b529e99 100644 --- a/code/modules/power/powernet.dm +++ b/code/modules/power/powernet.dm @@ -80,7 +80,7 @@ //see if there's a surplus of power remaining in the powernet and stores unused power in the SMES netexcess = avail - load - if(netexcess > 100 && nodes && nodes.len) // if there was excess power last cycle + if(netexcess > 100 && nodes?.len) // if there was excess power last cycle for(var/obj/machinery/power/smes/S in nodes) // find the SMESes in the network S.restore() // and restore some of the power that was used diff --git a/code/modules/religion/rites.dm b/code/modules/religion/rites.dm index 36d1005d3b2..c7fa03051f1 100644 --- a/code/modules/religion/rites.dm +++ b/code/modules/religion/rites.dm @@ -96,7 +96,7 @@ if(!ismovable(religious_tool)) CRASH("[name]'s perform_rite had a movable atom that has somehow turned into a non-movable!") var/atom/movable/movable_reltool = religious_tool - if(!(movable_reltool?.buckled_mobs && movable_reltool?.buckled_mobs.len)) + if(!movable_reltool?.buckled_mobs?.len) return FALSE var/mob/living/carbon/human/human2borg for(var/i in movable_reltool.buckled_mobs) diff --git a/code/modules/shuttle/emergency.dm b/code/modules/shuttle/emergency.dm index 14f228c85a7..bc2ec83f311 100644 --- a/code/modules/shuttle/emergency.dm +++ b/code/modules/shuttle/emergency.dm @@ -282,7 +282,7 @@ for(var/obj/item/card/id/ID in src) qdel(ID) - if(authorized && authorized.len) + if(authorized?.len) authorized.Cut() authorized = null diff --git a/code/modules/spells/spell_types/projectile.dm b/code/modules/spells/spell_types/projectile.dm index fd210edf537..3f458273ea9 100644 --- a/code/modules/spells/spell_types/projectile.dm +++ b/code/modules/spells/spell_types/projectile.dm @@ -48,7 +48,7 @@ var/mob/M = target if(M.anti_magic_check(check_antimagic, check_holy)) return FALSE - if(ignored_factions && ignored_factions.len && faction_check(M.faction,ignored_factions)) + if(ignored_factions?.len && faction_check(M.faction,ignored_factions)) return FALSE diff --git a/code/modules/station_goals/dna_vault.dm b/code/modules/station_goals/dna_vault.dm index adccce0513d..f0f6251feff 100644 --- a/code/modules/station_goals/dna_vault.dm +++ b/code/modules/station_goals/dna_vault.dm @@ -203,7 +203,7 @@ data["choiceB"] = "" if(user && completed) var/list/L = power_lottery[user] - if(L && L.len) + if(L?.len) data["used"] = FALSE data["choiceA"] = L[1] data["choiceB"] = L[2] diff --git a/code/modules/unit_tests/outfit_sanity.dm b/code/modules/unit_tests/outfit_sanity.dm index 71951d03f2b..57ce22434e1 100644 --- a/code/modules/unit_tests/outfit_sanity.dm +++ b/code/modules/unit_tests/outfit_sanity.dm @@ -34,9 +34,7 @@ CHECK_OUTFIT_SLOT(r_pocket, ITEM_SLOT_RPOCKET) if (outfit.backpack_contents || outfit.box) - var/list/backpack_contents = null - if(outfit.backpack_contents) - backpack_contents = outfit.backpack_contents.Copy() + var/list/backpack_contents = outfit.backpack_contents?.Copy() if (outfit.box) if (!backpack_contents) backpack_contents = list()