From 47ce77abcdbe2ba362e91d8eac58bbb8a7247b4a Mon Sep 17 00:00:00 2001 From: Howard Abrams Date: Sun, 9 Feb 2025 10:49:25 -0800 Subject: [PATCH] Made the room weather less repetitive. May want to keep a list of more than just one. --- typeclasses/rooms_weather.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/typeclasses/rooms_weather.py b/typeclasses/rooms_weather.py index 53ecb21..cb60864 100755 --- a/typeclasses/rooms_weather.py +++ b/typeclasses/rooms_weather.py @@ -147,6 +147,9 @@ class TimeWeatherRoom(Room): any arguments and keyword arguments (hence the *args, **kwargs even though we don't actually use them in this example) """ + # only update 10 % of the time if random.random() < 0.1: - # only update 20 % of the time - self.msg_contents("|w%s|n\n" % choose_weather_message()) + msg = choose_weather_message() + if self.db.previous_weather != msg: + self.db.previous_weather = msg + self.msg_contents(f"|w{msg}|n\n")