Allow random CDS to return None, and fix weights.
This commit is contained in:
parent
9a50a836db
commit
dc348a729a
@ -149,8 +149,9 @@ python early hide:
|
|||||||
|
|
||||||
for block, weight in blocks:
|
for block, weight in blocks:
|
||||||
if n <= weight:
|
if n <= weight:
|
||||||
break
|
return block
|
||||||
else:
|
n -= weight
|
||||||
n -= weight
|
|
||||||
|
|
||||||
return block
|
# In the rare event where weights are incorrectly assigned,
|
||||||
|
# return a random available block, and in any other case None.
|
||||||
|
return renpy.random.choice(blocks)[0] if blocks else None
|
||||||
|
Loading…
Reference in New Issue
Block a user