Allow random CDS to return None, and fix weights.

This commit is contained in:
LoafyLemon 2024-08-09 15:49:21 +01:00
parent 9a50a836db
commit dc348a729a

View File

@ -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