diff --git a/src/addons/lua_engine.cpp b/src/addons/lua_engine.cpp index 0d8cc20f..1027fc92 100644 --- a/src/addons/lua_engine.cpp +++ b/src/addons/lua_engine.cpp @@ -5062,6 +5062,14 @@ void LuaEngine::registerCoreAPI() { lua_pushboolean(L, 1); // isCastable return 4; }}, + // --- Weather --- + {"GetWeatherInfo", [](lua_State* L) -> int { + auto* gh = getGameHandler(L); + if (!gh) { lua_pushnumber(L, 0); lua_pushnumber(L, 0); return 2; } + lua_pushnumber(L, gh->getWeatherType()); + lua_pushnumber(L, gh->getWeatherIntensity()); + return 2; + }}, // --- Vendor Buy/Sell --- {"BuyMerchantItem", [](lua_State* L) -> int { auto* gh = getGameHandler(L); diff --git a/src/game/game_handler.cpp b/src/game/game_handler.cpp index 06c959bb..961f8efd 100644 --- a/src/game/game_handler.cpp +++ b/src/game/game_handler.cpp @@ -5221,6 +5221,9 @@ void GameHandler::handlePacket(network::Packet& packet) { } if (weatherMsg) addSystemChatMessage(weatherMsg); } + // Notify addons of weather change + if (addonEventCallback_) + addonEventCallback_("WEATHER_CHANGED", {std::to_string(wType), std::to_string(wIntensity)}); // 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