From bd0e745a6282af66769c3ecad23ca08da345eee2 Mon Sep 17 00:00:00 2001 From: Bloop <13398309+vinylspiders@users.noreply.github.com> Date: Mon, 10 Nov 2025 20:01:35 -0500 Subject: [PATCH] [no gbp] Fixes a small mistake with helper proc (#93748) --- code/__HELPERS/_lists.dm | 14 +++++++------- code/modules/events/space_vines/vine_event.dm | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/code/__HELPERS/_lists.dm b/code/__HELPERS/_lists.dm index 3d0dfc68294..fd7757e595c 100644 --- a/code/__HELPERS/_lists.dm +++ b/code/__HELPERS/_lists.dm @@ -546,21 +546,21 @@ * e.g. pick_n(list_of_stuff, 10) would return a list of 10 items from the list, chosen randomly. */ /proc/pick_n(list/list_to_pick, n) - var/list_to_pick_length = length(list_to_pick) - if(!islist(list_to_pick) || !list_to_pick_length || n <= 0) + var/list_to_pick_length + if(islist(list_to_pick)) + list_to_pick_length = length(list_to_pick) + + if(!list_to_pick_length || n <= 0) return list() - /// The final list that gets returned - var/list/result /// length of our list_to_pick n = min(n, list_to_pick_length) // Shuffle and slice the first n indices var/list/copy_to_shuffle = list_to_pick.Copy() - shuffle(copy_to_shuffle) - result = copy_to_shuffle.Copy(1, n + 1) + shuffle_inplace(copy_to_shuffle) - return result + return copy_to_shuffle.Copy(1, n + 1) /** * Given a list, return a copy where values without defined weights are given weight 1. diff --git a/code/modules/events/space_vines/vine_event.dm b/code/modules/events/space_vines/vine_event.dm index 2ccd4f04489..104dd39601e 100644 --- a/code/modules/events/space_vines/vine_event.dm +++ b/code/modules/events/space_vines/vine_event.dm @@ -36,7 +36,7 @@ else var/obj/structure/spacevine/vine = new() var/list/floor_candidates = list() - for(var/area/station/hallway/area in shuffle(GLOB.areas.Copy())) + for(var/area/station/hallway/area in shuffle(GLOB.areas)) for(var/turf/open/floor in area.get_turfs_from_all_zlevels()) if(isopenspaceturf(floor)) continue