[MIRROR] Refactors roundstart centcom threat report. (#2739)
* Refactors roundstart centcom threat report. * Update blob.dm * Update changeling.dm * Update traitor_chan.dm * Update sandbox.dm * Update traitor.dm
This commit is contained in:
committed by
Poojawa
parent
0bc0d643ab
commit
9a4f84da5e
@@ -205,6 +205,22 @@
|
||||
|
||||
return null
|
||||
|
||||
/proc/pickweightAllowZero(list/L) //The original pickweight proc will sometimes pick entries with zero weight. I'm not sure if changing the original will break anything, so I left it be.
|
||||
var/total = 0
|
||||
var/item
|
||||
for (item in L)
|
||||
if (!L[item])
|
||||
L[item] = 0
|
||||
total += L[item]
|
||||
|
||||
total = rand(0, total)
|
||||
for (item in L)
|
||||
total -=L [item]
|
||||
if (total <= 0 && L[item])
|
||||
return item
|
||||
|
||||
return null
|
||||
|
||||
//Pick a random element from the list and remove it from the list.
|
||||
/proc/pick_n_take(list/L)
|
||||
if(L.len)
|
||||
|
||||
Reference in New Issue
Block a user