From ee3c12b2c0e627b47c9f6120bbdaca84c6f0c04e Mon Sep 17 00:00:00 2001 From: Kelsi Date: Fri, 13 Mar 2026 07:39:41 -0700 Subject: [PATCH] feat: announce weather changes in chat (rain/snow/storm/clear) --- src/game/game_handler.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/game/game_handler.cpp b/src/game/game_handler.cpp index 3743169f..15093fd0 100644 --- a/src/game/game_handler.cpp +++ b/src/game/game_handler.cpp @@ -4501,10 +4501,26 @@ void GameHandler::handlePacket(network::Packet& packet) { float wIntensity = packet.readFloat(); if (packet.getSize() - packet.getReadPos() >= 1) /*uint8_t isAbrupt =*/ packet.readUInt8(); + uint32_t prevWeatherType = weatherType_; weatherType_ = wType; weatherIntensity_ = wIntensity; const char* typeName = (wType == 1) ? "Rain" : (wType == 2) ? "Snow" : (wType == 3) ? "Storm" : "Clear"; LOG_INFO("Weather changed: type=", wType, " (", typeName, "), intensity=", wIntensity); + // Announce weather changes (including initial zone weather) + if (wType != prevWeatherType) { + const char* weatherMsg = nullptr; + if (wIntensity < 0.05f || wType == 0) { + if (prevWeatherType != 0) + weatherMsg = "The weather clears."; + } else if (wType == 1) { + weatherMsg = "It begins to rain."; + } else if (wType == 2) { + weatherMsg = "It begins to snow."; + } else if (wType == 3) { + weatherMsg = "A storm rolls in."; + } + if (weatherMsg) addSystemChatMessage(weatherMsg); + } // Storm transition: trigger a low-frequency thunder rumble shake if (wType == 3 && wIntensity > 0.3f && cameraShakeCallback_) { float mag = 0.03f + wIntensity * 0.04f; // 0.03–0.07 units