This probably won't happen in practice, but it is a good safeguard
if this ever does happen (it happened for me in debugging when I wished
to have no "regular" rooms and only generate themed rooms).
this_frequency = 1;
end
total_frequency = total_frequency + this_frequency;
- if (nh.rn2(total_frequency) < this_frequency) then
+ -- avoid rn2(0) if a room has freq 0
+ if this_frequency > 0 and nh.rn2(total_frequency) < this_frequency then
pick = i;
end
end