[no gbp] Fixes a small mistake with helper proc (#93748)

This commit is contained in:
Bloop
2025-11-10 20:01:35 -05:00
committed by GitHub
parent 28fdbbb189
commit bd0e745a62
2 changed files with 8 additions and 8 deletions
+7 -7
View File
@@ -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.
@@ -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