From 575b1725aa7e815833662f82401eb914592e1cea Mon Sep 17 00:00:00 2001 From: "OpenGenesis (MPL 2.0)" <153564363+opengenesislink@users.noreply.github.com> Date: Wed, 28 Oct 2026 18:28:05 +0100 Subject: [PATCH] feat(gen1): replace retired OGLSeasons with simulator-wide OGLWeather and 5-day forecast (#335) * feat(oglweather): add independent simulator-wide deterministic weather engine * feat(oglweather): add independent simulator-wide deterministic weather engine * feat(oglweather): add independent simulator-wide deterministic weather engine * feat(oglweather): add weather particles, forecast display and opt-in config * feat(oglweather): add weather particles, forecast display and opt-in config * feat(oglweather): add weather particles, forecast display and opt-in config * build/test(oglweather): add separate deploy script and forecast-versus-reality regression * build/test(oglweather): add separate deploy script and forecast-versus-reality regression * build/test(oglweather): add separate deploy script and forecast-versus-reality regression * build/test(oglweather): add separate deploy script and forecast-versus-reality regression * ci(oglweather): verify deterministic forecast and compile standalone simulator addon * fix(oglweather): batch five-day board hydration to avoid unnecessary texture reloads * docs(oglweather): independent forecast and weather emitter deployment guide * chore(gen1): retire OGLSeasons from default builds and CI * chore(gen1): retire OGLSeasons from default builds and CI * chore(gen1): remove retired OGLSeasons component addons/OGLSeasons/OGLSeasons.ini.example * chore(gen1): remove retired OGLSeasons component addons/OGLSeasons/README.md * chore(gen1): remove retired OGLSeasons component addons/OGLSeasons/WeatherEmitter.lsl * chore(gen1): retire OGLSeasons legacy weather addon * chore(gen1): retire OGLSeasons legacy weather addon * chore(gen1): retire OGLSeasons legacy weather addon * chore(gen1): retire OGLSeasons legacy weather addon * chore(gen1): retire OGLSeasons legacy build and regression components * chore(gen1): retire OGLSeasons legacy build and regression components * chore(gen1): retire OGLSeasons legacy build and regression components * chore(gen1): retire OGLSeasons legacy build and regression components * chore(gen1): drop retired OGLSeasons CI tests and EEP regression * chore(gen1): drop retired OGLSeasons CI tests and EEP regression * chore(gen1): drop retired OGLSeasons CI tests and EEP regression * chore(gen1): drop retired OGLSeasons CI tests and EEP regression * chore(gen1): drop retired OGLSeasons CI tests and EEP regression * docs(gen1): mark OGLSeasons retired and OGLWeather as exclusive successor * docs(gen1): mark OGLSeasons retired and OGLWeather as exclusive successor * test(gen1): ensure retired OGLSeasons is absent from build tree and CI * fix(oglweather): make five-day forecasts account for actual DST 23/25-hour days * fix(oglweather): make five-day forecasts account for actual DST 23/25-hour days * fix(oglweather): make five-day forecasts account for actual DST 23/25-hour days * fix(oglweather): make five-day forecasts account for actual DST 23/25-hour days * ci(gen1): remove final obsolete OGLSeasons addon build and EEP runtime steps * fix(oglweather): regenerate Prebuild project artifacts before standalone addon compilation --- .github/workflows/nexjast-ci.yml | 25 +- VERSIONING.md | 2 +- addon-modules/OGLSeasons/build.sh | 56 --- addon-modules/OGLWeather/build.sh | 50 +++ addons/OGLSeasons/OGLSeasons.ini.example | 23 -- addons/OGLSeasons/OglSeasonalEepOverlay.cs | 182 --------- addons/OGLSeasons/OglSeasonsRegionModule.cs | 215 ----------- addons/OGLSeasons/README.md | 345 ------------------ addons/OGLSeasons/SeasonWeatherModel.cs | 208 ----------- addons/OGLSeasons/SeasonalLandscape.lsl | 109 ------ addons/OGLSeasons/WeatherEmitter.lsl | 134 ------- addons/OGLSeasons/WeatherInfoBoard.lsl | 62 ---- addons/OGLWeather/OGLWeather.ini.example | 14 + addons/OGLWeather/OglWeatherModel.cs | 152 ++++++++ addons/OGLWeather/OglWeatherRegionModule.cs | 160 ++++++++ .../OpenGenesisLINK.Addons.OGLWeather.csproj} | 3 +- addons/OGLWeather/README.md | 69 ++++ addons/OGLWeather/WeatherEmitter.lsl | 103 ++++++ addons/OGLWeather/WeatherForecastBoard.lsl | 173 +++++++++ doc/NexVerse/ROADMAP.md | 28 +- runprebuild.sh | 2 +- .../OglSeasonsEepRegression.csproj | 15 - tools/ci/OglSeasonsEepRegression/Program.cs | 104 ------ tools/ci/OglSeasonsRegression/Program.cs | 81 ---- .../OglWeatherRegression.csproj} | 6 +- tools/ci/OglWeatherRegression/Program.cs | 97 +++++ tools/ci/verify_ogl_seasons.py | 54 --- tools/ci/verify_ogl_seasons_eep.py | 34 -- tools/ci/verify_ogl_weather.py | 55 +++ 29 files changed, 905 insertions(+), 1656 deletions(-) delete mode 100644 addon-modules/OGLSeasons/build.sh create mode 100644 addon-modules/OGLWeather/build.sh delete mode 100644 addons/OGLSeasons/OGLSeasons.ini.example delete mode 100644 addons/OGLSeasons/OglSeasonalEepOverlay.cs delete mode 100644 addons/OGLSeasons/OglSeasonsRegionModule.cs delete mode 100644 addons/OGLSeasons/README.md delete mode 100644 addons/OGLSeasons/SeasonWeatherModel.cs delete mode 100644 addons/OGLSeasons/SeasonalLandscape.lsl delete mode 100644 addons/OGLSeasons/WeatherEmitter.lsl delete mode 100644 addons/OGLSeasons/WeatherInfoBoard.lsl create mode 100644 addons/OGLWeather/OGLWeather.ini.example create mode 100644 addons/OGLWeather/OglWeatherModel.cs create mode 100644 addons/OGLWeather/OglWeatherRegionModule.cs rename addons/{OGLSeasons/OpenGenesisLINK.Addons.OGLSeasons.csproj => OGLWeather/OpenGenesisLINK.Addons.OGLWeather.csproj} (83%) create mode 100644 addons/OGLWeather/README.md create mode 100644 addons/OGLWeather/WeatherEmitter.lsl create mode 100644 addons/OGLWeather/WeatherForecastBoard.lsl delete mode 100644 tools/ci/OglSeasonsEepRegression/OglSeasonsEepRegression.csproj delete mode 100644 tools/ci/OglSeasonsEepRegression/Program.cs delete mode 100644 tools/ci/OglSeasonsRegression/Program.cs rename tools/ci/{OglSeasonsRegression/OglSeasonsRegression.csproj => OglWeatherRegression/OglWeatherRegression.csproj} (58%) create mode 100644 tools/ci/OglWeatherRegression/Program.cs delete mode 100644 tools/ci/verify_ogl_seasons.py delete mode 100644 tools/ci/verify_ogl_seasons_eep.py create mode 100644 tools/ci/verify_ogl_weather.py diff --git a/.github/workflows/nexjast-ci.yml b/.github/workflows/nexjast-ci.yml index a4d9876f..ccc8f77b 100644 --- a/.github/workflows/nexjast-ci.yml +++ b/.github/workflows/nexjast-ci.yml @@ -427,17 +427,14 @@ jobs: shell: bash run: python3 tools/ci/verify_r409_world_portal_contract.py - - name: Verify OGL Germany seasons addon + - name: Weather Forecast regression and independent addon build shell: bash - run: python3 tools/ci/verify_ogl_seasons.py - - - name: Verify opt-in EEP and safe seasonal landscapes - shell: bash - run: python3 tools/ci/verify_ogl_seasons_eep.py - - - name: Regression-test seasonal calendar and simulated weather - shell: bash - run: dotnet run --configuration Release --project tools/ci/OglSeasonsRegression/OglSeasonsRegression.csproj + run: | + set -euo pipefail + python3 tools/ci/verify_ogl_weather.py + bash -n addon-modules/OGLWeather/build.sh + dotnet run --configuration Release --project tools/ci/OglWeatherRegression/OglWeatherRegression.csproj + bash addon-modules/OGLWeather/build.sh Release - name: Verify citizen social and profile integration shell: bash @@ -645,14 +642,6 @@ jobs: shell: bash run: dotnet run --configuration Release --project tools/ci/OglPbrMaterialRegression/OglPbrMaterialRegression.csproj - - name: Build optional OGL Seasons addon - shell: bash - run: bash addon-modules/OGLSeasons/build.sh Release - - - name: Runtime regression OGL Seasons EEP sky, clouds and fog - shell: bash - run: dotnet run --configuration Release --project tools/ci/OglSeasonsEepRegression/OglSeasonsEepRegression.csproj - - name: Runtime regression cross-region llListen delivery (two scenes) shell: bash run: dotnet run --configuration Release --project tools/ci/CrossRegionListenRuntimeRegression/CrossRegionListenRuntimeRegression.csproj diff --git a/VERSIONING.md b/VERSIONING.md index 06286d83..977b5267 100644 --- a/VERSIONING.md +++ b/VERSIONING.md @@ -42,7 +42,7 @@ OpenGenesisLINK continues from the OpenSimulator 0.9.3.0 source baseline and the - `OpenGenesisLINK v0.9.3.8` — **stable release, 8 October 2026**; promoted after successful RC1 operator acceptance and green release CI. Known limitations and previously unverified edge cases remain documented in the release notes. - `OpenGenesisLINK v0.9.3.10` — Stable Abschluss des Stabilisierungstrains nach ausdrücklicher Betreiberentscheidung (12.10.2026) for .NET runtime, local/HG logins, NV$ Economy/GRID SERVICES Masterbank, inventory/asset foundations and R287 World API. NexExperiences viewer integration is paused and disabled in shipped RC templates (security regressions remain); OGL Pathfinding 2.0, OGL My Outfits 2.0 and any Experiences 2.0 are deferred to the own viewer; OGLVoice is separate. Die 22 RC1-Funktionsprüfungen wurden vom Betreiber im Chat bestätigt, jedoch nicht mit einzeln referenzierbaren v2-Belegen eingereicht. Die 23/23-Formalprüfung einschließlich 24-h-Soak wurde nicht abgeschlossen; bewusste einmalige Ausnahme: `doc/NexVerse/09310_OPERATOR_RELEASE_DECISION.md`. Dies ist keine Empfehlung für spätere Releases. See `doc/NexVerse/RELEASE_TRAIN_0.9.3.10.md`. - `OpenGenesisLINK v0.9.3.12` — **stable release, 14 October 2026**, from the independent 0.9.3.12 line. -- `OpenGenesisLINK v0.9.3.13` — **Stable, 27 October 2026, durch ausdrückliche Betreiberentscheidung**: 17.1 OGL AssetService (opt-in; FSAssets weiterhin autoritativ), 17.2 Mesh/PBR-Materialpipeline, 17.3 Extended Region Visibility, LLUDP-Fix, FastMap und World-API-Verbesserungen. Die formale 30-Gates-Evidence-Ausnahme ist dokumentiert in `doc/NexVerse/09313_OPERATOR_RELEASE_DECISION.md`. OGLSeasons-Neuentwicklung weiterhin verschoben. +- `OpenGenesisLINK v0.9.3.13` — **Stable, 27 October 2026, durch ausdrückliche Betreiberentscheidung**: 17.1 OGL AssetService (opt-in; FSAssets weiterhin autoritativ), 17.2 Mesh/PBR-Materialpipeline, 17.3 Extended Region Visibility, LLUDP-Fix, FastMap und World-API-Verbesserungen. Die formale 30-Gates-Evidence-Ausnahme ist dokumentiert in `doc/NexVerse/09313_OPERATOR_RELEASE_DECISION.md`. OGLSeasons war in dieser historischen Stable-Veröffentlichung eingefroren; in Generation 1 anschließend eingestellt und durch OGLWeather ersetzt. - `OpenGenesisLINK Generation 1` — **aktuelle gemeinsame Entwicklungsstufe**; bisherige Planungen `0.9.3.14` und `0.9.4.0` sind zusammengeführt. Interne Build-/Assembly-Version `0.9.4.0`, Releasekanal Dev. Enthält einen flexibel priorisierten Ideenpool für Simulator/ROBUST, World API, Addons, Performance, Fehlerkorrekturen, Betriebsfunktionen, NexAds, Events und Notifications sowie die Plattformkonsolidierung. Kein einzelner Bereich gilt allein wegen der Version als implementiert oder verpflichtend. Der Tag `v0.9.3.13` bleibt die letzte offiziell veröffentlichte Stable-Version. The product-name transition does not rewrite provenance. OpenSimulator 0.9.3.0 remains the historical source baseline, and inherited licensing remains attached to inherited code until independently replaced. diff --git a/addon-modules/OGLSeasons/build.sh b/addon-modules/OGLSeasons/build.sh deleted file mode 100644 index d9a8ecdc..00000000 --- a/addon-modules/OGLSeasons/build.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -# OGLSeasons is an INonSharedRegionModule. A plain server build must never -# install its DLL into the shared bin, because ROBUST does not host the -# /OpenSim/RegionModules Mono.Addins extension point. -if [[ "${1:-}" == "--help" ]]; then - echo "Usage: $0 [Release|Debug] [--sim-bin /absolute/path/to/simulator/bin]" - echo "Without --sim-bin, the DLL is only compiled, not installed." - exit 0 -fi - -ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" -cd "$ROOT" -CONFIG="${1:-Release}" -case "$CONFIG" in - Release|Debug) ;; - *) echo "Expected Release or Debug" >&2; exit 2 ;; -esac - -if (( $# != 0 && $# != 1 && $# != 3 )); then - echo "Usage: $0 [Release|Debug] [--sim-bin /absolute/path/to/simulator/bin]" >&2 - exit 2 -fi -if (( $# == 3 )) && [[ "$2" != "--sim-bin" ]]; then - echo "Expected --sim-bin before simulator path" >&2 - exit 2 -fi - -dotnet build addons/OGLSeasons/OpenGenesisLINK.Addons.OGLSeasons.csproj -c "$CONFIG" -OUT="addons/OGLSeasons/bin/$CONFIG/net8.0" -DLL="$OUT/OpenGenesisLINK.Addons.OGLSeasons.dll" -test -s "$DLL" || { - echo "OGLSeasons addon DLL missing" >&2 - exit 1 -} - -if (( $# == 3 )); then - SIM_BIN="$(realpath -m -- "$3")" - # Fail closed on the known ROBUST runtime directory. The explicit option - # and region framework assembly both serve as deployment guardrails. - if [[ "${SIM_BIN,,}" == */robust/bin ]]; then - echo "Refusing to install region addon into ROBUST: $SIM_BIN" >&2 - exit 2 - fi - if [[ "$SIM_BIN" != */bin || ! -f "$SIM_BIN/OpenSim.Region.Framework.dll" ]]; then - echo "Expected an existing simulator bin with OpenSim.Region.Framework.dll: $SIM_BIN" >&2 - exit 2 - fi - install -m 0644 "$DLL" "$SIM_BIN/OpenGenesisLINK.Addons.OGLSeasons.dll" - echo "OGLSeasons installed only in simulator bin: $SIM_BIN" -else - echo "OGLSeasons built: $DLL" - echo "Not installed in shared bin. To install explicitly:" - echo " bash addon-modules/OGLSeasons/build.sh $CONFIG --sim-bin /opt/developer/bin" -fi diff --git a/addon-modules/OGLWeather/build.sh b/addon-modules/OGLWeather/build.sh new file mode 100644 index 00000000..a0691191 --- /dev/null +++ b/addon-modules/OGLWeather/build.sh @@ -0,0 +1,50 @@ +#!/usr/bin/env bash +set -euo pipefail + +# This add-on ONLY runs in a simulator, never ROBUST. +# Build without deploying; optional explicit --sim-bin path installs the DLL. +if [[ "${1:-}" == "--help" ]]; then + echo "Usage: bash addon-modules/OGLWeather/build.sh [Release|Debug] [--sim-bin /absolute/simulator/bin]" + exit 0 +fi + +ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" +cd "$ROOT" +CONFIG="${1:-Release}" +case "$CONFIG" in Release|Debug) ;; *) echo "Invalid build configuration" >&2; exit 2 ;; esac +if [[ $# -ne 0 && $# -ne 1 && $# -ne 3 ]]; then + echo "Expected [Release|Debug] [--sim-bin /absolute/simulator/bin]" >&2 + exit 2 +fi +if [[ $# -eq 3 && "$2" != "--sim-bin" ]]; then + echo "Expected --sim-bin" >&2 + exit 2 +fi + +# OpenGenesisLINK uses the classic Prebuild tool. Checked-in project +# files may be stale or malformed until the normal project-generation step. +# Regenerate first so this independent addon builds from a clean checkout. +if [[ ! -f "$ROOT/bin/prebuild.dll" ]]; then + echo "Missing bin/prebuild.dll; build from a complete OpenGenesisLINK source tree." >&2 + exit 1 +fi +bash runprebuild.sh + +dotnet build addons/OGLWeather/OpenGenesisLINK.Addons.OGLWeather.csproj -c "$CONFIG" +DLL="addons/OGLWeather/bin/$CONFIG/net8.0/OpenGenesisLINK.Addons.OGLWeather.dll" +test -s "$DLL" || { echo "OGLWeather DLL missing" >&2; exit 1; } + +if [[ $# -eq 3 ]]; then + SIM_BIN="$(realpath -m -- "$3")" + if [[ "${SIM_BIN,,}" == */robust/bin || + "$SIM_BIN" != */bin || + ! -f "$SIM_BIN/OpenSim.Region.Framework.dll" ]]; then + echo "Refusing installation: expected simulator bin with Region.Framework.dll, never ROBUST." >&2 + exit 2 + fi + install -m 0644 "$DLL" "$SIM_BIN/OpenGenesisLINK.Addons.OGLWeather.dll" + echo "OGLWeather installed to simulator: $SIM_BIN" +else + echo "OGLWeather built only. Manual install:" + echo "bash addon-modules/OGLWeather/build.sh $CONFIG --sim-bin /opt/developer/bin" +fi diff --git a/addons/OGLSeasons/OGLSeasons.ini.example b/addons/OGLSeasons/OGLSeasons.ini.example deleted file mode 100644 index 2007de04..00000000 --- a/addons/OGLSeasons/OGLSeasons.ini.example +++ /dev/null @@ -1,23 +0,0 @@ -; OpenGenesisLINK OGL Seasons – Muster für bin/config-include/ -; bewusst deaktiviert, keine Terrain-/Estate-/EEP-Änderungen. -[OGLSeasons] -Enabled = false -; Leer: alle Regionen dieses Simulatorprozesses, oder kommagetrennte Regionsnamen -AllowedRegions = "" -; Nur Faktoren von 1440 im Bereich 5–1440 -WeatherIntervalMinutes = 30 -; Gleiche Zone = gleiches Wetter für benachbarte Regionen, auch auf anderen Simulatoren. -; Leer = jede Region bekommt ihren eigenen, reproduzierbaren Wetterverlauf. -WeatherZone = "" -; Ephemere Himmels-/Wolken-/Nebelüberlagerung. Nie persistent speichern! -EnableEepOverlay = false -; Bereits vorhandene Estate-/Region-EEP grundsätzlich schützen. -AllowCustomRegionEep = false -; Höhe/Mikroklima: -15 bis +15 °C gegenüber dem Basismodell. -TemperatureOffsetC = 0 -; Nur Status, kein echter DWD-Wetterabruf -Seed = 2026 -CheckSeconds = 60 -BroadcastSeconds = 180 -; Muss negativ sein. Der LSL-Wetter-Emitter nutzt denselben Kanal. -LSLChannel = -835011 diff --git a/addons/OGLSeasons/OglSeasonalEepOverlay.cs b/addons/OGLSeasons/OglSeasonalEepOverlay.cs deleted file mode 100644 index d44a9898..00000000 --- a/addons/OGLSeasons/OglSeasonalEepOverlay.cs +++ /dev/null @@ -1,182 +0,0 @@ -// SPDX-License-Identifier: MPL-2.0 -using System; -using System.Runtime.CompilerServices; -using log4net; -using OpenMetaverse; -using OpenMetaverse.StructuredData; -using OpenSim.Framework; -using OpenSim.Region.Framework.Interfaces; -using OpenSim.Region.Framework.Scenes; - -[assembly: InternalsVisibleTo("OglSeasonsEepRegression")] - -namespace OpenGenesisLINK.Addons.OGLSeasons -{ - /// - /// Volatile, owner-controlled EEP overlay. NEVER calls StoreOnRegion, never - /// touches parcel EEP or estate rights, and never changes persisted data. - /// If an admin replaces the current environment, the addon stops changing it. - /// - internal sealed class OglSeasonalEepOverlay - { - private static readonly ILog Log = LogManager.GetLogger(typeof(OglSeasonalEepOverlay)); - private readonly Scene m_Scene; - private readonly IEnvironmentModule m_Environment; - private readonly bool m_AllowCustomEnvironment; - private ViewerEnvironment m_Previous; - private ViewerEnvironment m_Template; - private ViewerEnvironment m_Applied; - private bool m_Suspended; - private string m_LastKey; - - internal OglSeasonalEepOverlay(Scene scene, IEnvironmentModule environment, - bool allowCustomEnvironment) - { - m_Scene = scene ?? throw new ArgumentNullException(nameof(scene)); - m_Environment = environment ?? throw new ArgumentNullException(nameof(environment)); - m_AllowCustomEnvironment = allowCustomEnvironment; - } - - internal bool Apply(OglWeatherState weather) - { - if (weather == null || m_Suspended) - return false; - - ViewerEnvironment current = m_Scene.RegionEnvironment; - if (m_Applied == null) - { - // An existing EEP daycycle can be estate- or parcel-specific: - // do not overwrite it without a separate explicit opt-in. - if (current != null && !m_AllowCustomEnvironment) - { - m_Suspended = true; - Log.InfoFormat("[OGL-JAHRESZEITEN][EEP]: Region {0} besitzt eigene EEP-Einstellungen. " - + "Automatische Überlagerung übersprungen.", m_Scene.Name); - return false; - } - m_Previous = current; - m_Template = (current ?? m_Environment.GetRegionEnvironment())?.Clone(); - } - else if (!ReferenceEquals(current, m_Applied)) - { - // CAS-like ownership: a changed region environment belongs to - // the new administrator/editor, not this module. - m_Suspended = true; - Log.WarnFormat("[OGL-JAHRESZEITEN][EEP]: Region {0}: EEP wurde anderweitig verändert; " - + "automatische Überlagerung gestoppt.", m_Scene.Name); - return false; - } - - string key = weather.SeasonKey + ":" + weather.WeatherKey + ":" + weather.Intensity / 20; - if (m_Applied != null && key == m_LastKey) - return false; - - try - { - ViewerEnvironment template = m_Template; - if (template == null) - return false; - ViewerEnvironment overlay = template.Clone(); - if (!TransformSkyFrames(overlay, weather)) - { - Log.WarnFormat("[OGL-JAHRESZEITEN][EEP]: Region {0}: " - + "keine gültigen Himmel-Frames; Originalumgebung beibehalten.", m_Scene.Name); - return false; - } - m_Scene.RegionEnvironment = overlay; - m_Applied = overlay; - m_LastKey = key; - m_Environment.WindlightRefresh(10); - return true; - } - catch (Exception e) - { - Log.Warn("[OGL-JAHRESZEITEN][EEP]: Überlagerung fehlgeschlagen.", e); - if (m_Applied != null && ReferenceEquals(m_Scene.RegionEnvironment, m_Applied)) - m_Scene.RegionEnvironment = m_Previous; - m_Applied = null; - m_Suspended = true; - return false; - } - } - - internal void Restore() - { - if (m_Applied == null) - return; - try - { - if (ReferenceEquals(m_Scene.RegionEnvironment, m_Applied)) - { - m_Scene.RegionEnvironment = m_Previous; - m_Environment.WindlightRefresh(10); - } - } - catch (Exception e) - { - Log.Warn("[OGL-JAHRESZEITEN][EEP]: Ursprungsumgebung konnte nicht aktualisiert werden.", e); - } - finally - { - m_Applied = null; - m_Previous = null; - m_Template = null; - m_LastKey = null; - m_Suspended = true; - } - } - - internal static bool TransformSkyFrames(ViewerEnvironment environment, OglWeatherState weather) - { - if (environment == null || weather == null || environment.ToOSD() is not OSDMap top || - !top.TryGetValue("day_cycle", out OSD rawCycle) || rawCycle is not OSDMap cycle || - !cycle.TryGetValue("frames", out OSD rawFrames) || rawFrames is not OSDMap frames) - return false; - - // Cloud shadow/legacy haze are native EEP sky fields; preserve all - // sky timings, moon/sun rotation, water and non-sky components. - bool heavy = weather.Weather == OglWeather.Starkregen - || weather.Weather == OglWeather.Gewitter - || weather.Weather == OglWeather.Schneesturm - || weather.Weather == OglWeather.Sturm; - bool fog = weather.Weather == OglWeather.Nebel; - bool precipitation = weather.Weather is OglWeather.Regen or OglWeather.Nieselregen - or OglWeather.Schneefall or OglWeather.Starkregen or OglWeather.Schneesturm - or OglWeather.Gewitter or OglWeather.Hagel; - float coverage = fog ? 0.88f : heavy ? 0.84f - : precipitation ? 0.66f - : weather.Weather == OglWeather.Bewoelkt ? 0.52f : 0.16f; - float haze = fog ? 2.5f : heavy ? 1.45f : precipitation ? 1.2f - : weather.Season == OglSeason.Winter ? 0.95f : 0.6f; - float light = weather.Season == OglSeason.Sommer ? 1.05f - : weather.Season == OglSeason.Winter ? 0.72f : 0.90f; - if (heavy || fog) light *= 0.72f; - - int transformed = 0; - foreach (System.Collections.Generic.KeyValuePair frame in frames) - { - if (frame.Value is not OSDMap sky || - !sky.TryGetValue("type", out OSD type) || - !string.Equals(type.AsString(), "sky", StringComparison.OrdinalIgnoreCase)) - continue; - sky["cloud_shadow"] = coverage; - sky["cloud_variance"] = precipitation ? 0.23f : 0.09f; - sky["cloud_color"] = fog ? new Vector3(0.74f, 0.77f, 0.79f) - : heavy ? new Vector3(0.35f, 0.39f, 0.44f) - : new Vector3(0.86f, 0.89f, 0.94f); - if (sky.TryGetValue("legacy_haze", out OSD oldHaze) && oldHaze is OSDMap legacy) - { - legacy["haze_density"] = haze; - legacy["haze_horizon"] = fog ? 0.85f : heavy ? 0.5f : 0.20f; - legacy["ambient"] = new Vector3(light, light, light); - } - transformed++; - } - if (transformed == 0) - return false; - environment.FromOSD(top); - environment.InvalidateCaches(); - return true; - } - } -} diff --git a/addons/OGLSeasons/OglSeasonsRegionModule.cs b/addons/OGLSeasons/OglSeasonsRegionModule.cs deleted file mode 100644 index d7c89abf..00000000 --- a/addons/OGLSeasons/OglSeasonsRegionModule.cs +++ /dev/null @@ -1,215 +0,0 @@ -// SPDX-License-Identifier: MPL-2.0 -using System; -using log4net; -using Mono.Addins; -using Nini.Config; -using OpenMetaverse; -using OpenSim.Framework; -using OpenSim.Region.Framework.Interfaces; -using OpenSim.Region.Framework.Scenes; - -// Keep Name and Namespace separate: Mono.Addins prefixes the namespace automatically. -[assembly: Addin("OGLSeasons", Namespace = "OpenGenesisLINK", Version = "0.1.1")] -// The region framework owns /OpenSim/RegionModules. Mono.Addins treats -// dependency IDs as relative to this addin's "OpenGenesisLINK" namespace -// unless "::" explicitly selects the global OpenSim addin identity. -[assembly: AddinDependency("::OpenSim.Region.Framework", OpenSim.VersionInfo.VersionNumber)] - -namespace OpenGenesisLINK.Addons.OGLSeasons -{ - /// - /// Nonshared, disabled-by-default region addon. Never edits terrain, - /// object textures, wind physics, parcel environments or estate rights. - /// Particle emitter prims are opt-in and read weather broadcasts via LSL. - /// - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "OGLSeasons")] - public sealed class OglSeasonsRegionModule : INonSharedRegionModule, IOglSeasonsService - { - private static readonly ILog Log = LogManager.GetLogger(typeof(OglSeasonsRegionModule)); - private Scene m_Scene; - private bool m_Enabled; - private bool m_Started; - private int m_IntervalMinutes = 30; - private int m_Seed = 2026; - private int m_CheckSeconds = 60; - private int m_BroadcastSeconds = 180; - private int m_Channel = -835011; - private string m_AllowedRegions = ""; - private string m_WeatherZone = ""; - private int m_TemperatureOffsetC; - private DateTime m_NextCheckUtc = DateTime.MinValue; - private DateTime m_NextBroadcastUtc = DateTime.MinValue; - private OglWeatherState m_Current; - private OglSeasonalEepOverlay m_EepOverlay; - private bool m_EnableEepOverlay; - private bool m_AllowCustomEnvironment; - - public string Name => "OGLSeasons"; - public Type ReplaceableInterface => null; - public OglWeatherState Current => m_Current; - public event Action StateChanged; - - public void Initialise(IConfigSource config) - { - IConfig settings = config?.Configs["OGLSeasons"]; - m_Enabled = settings?.GetBoolean("Enabled", false) ?? false; - if (!m_Enabled) - return; - m_IntervalMinutes = settings.GetInt("WeatherIntervalMinutes", 30); - if (m_IntervalMinutes < 5 || m_IntervalMinutes > 1440 || - 1440 % m_IntervalMinutes != 0) - { - Log.Warn("[OGL-JAHRESZEITEN]: Ungültiges Wetterintervall; Modul deaktiviert."); - m_Enabled = false; - return; - } - m_CheckSeconds = Math.Clamp(settings.GetInt("CheckSeconds", 60), 30, 3600); - m_BroadcastSeconds = Math.Clamp(settings.GetInt("BroadcastSeconds", 180), 60, 3600); - m_Seed = settings.GetInt("Seed", 2026); - m_Channel = settings.GetInt("LSLChannel", -835011); - m_AllowedRegions = settings.GetString("AllowedRegions", "") ?? ""; - m_EnableEepOverlay = settings.GetBoolean("EnableEepOverlay", false); - m_AllowCustomEnvironment = settings.GetBoolean("AllowCustomRegionEep", false); - m_WeatherZone = (settings.GetString("WeatherZone", "") ?? "").Trim(); - m_TemperatureOffsetC = settings.GetInt("TemperatureOffsetC", 0); - if (m_WeatherZone.Length > 80 || - m_TemperatureOffsetC < -15 || m_TemperatureOffsetC > 15) - { - Log.Warn("[OGL-JAHRESZEITEN]: Wetterzone oder Temperaturkorrektur ungültig; Modul deaktiviert."); - m_Enabled = false; - return; - } - if (m_Channel >= 0) - { - Log.Warn("[OGL-JAHRESZEITEN]: LSLChannel muss negativ sein; Modul deaktiviert."); - m_Enabled = false; - } - } - - public void AddRegion(Scene scene) - { - if (!m_Enabled || scene == null) - return; - if (!string.IsNullOrWhiteSpace(m_AllowedRegions)) - { - bool allowed = false; - foreach (string item in m_AllowedRegions.Split(',', StringSplitOptions.RemoveEmptyEntries)) - { - if (string.Equals(item.Trim(), scene.RegionInfo.RegionName, StringComparison.OrdinalIgnoreCase)) - { - allowed = true; - break; - } - } - if (!allowed) - return; - } - m_Scene = scene; - scene.RegisterModuleInterface(this); - } - - public void RegionLoaded(Scene scene) - { - if (m_Scene != scene || m_Started || !m_Enabled) - return; - m_Started = true; - if (m_EnableEepOverlay) - { - IEnvironmentModule env = scene.RequestModuleInterface(); - if (env == null) - Log.WarnFormat("[OGL-JAHRESZEITEN][EEP]: Region {0}: " - + "EEP-Modul fehlt; Himmelsüberlagerung bleibt deaktiviert.", scene.Name); - else - m_EepOverlay = new OglSeasonalEepOverlay(scene, env, m_AllowCustomEnvironment); - } - m_NextCheckUtc = DateTime.MinValue; - m_NextBroadcastUtc = DateTime.MinValue; - scene.EventManager.OnFrame += OnFrame; - Log.InfoFormat("[OGL-JAHRESZEITEN]: Region {0} aktiviert, deutscher Kalender; " + - "Wettermodell-Simulation, kein Live-Wetterdienst.", scene.RegionInfo.RegionName); - } - - private void OnFrame() - { - Scene scene = m_Scene; - if (!m_Started || scene == null) - return; - DateTime now = DateTime.UtcNow; - if (now < m_NextCheckUtc && now < m_NextBroadcastUtc) - return; - if (now >= m_NextCheckUtc) - { - m_NextCheckUtc = now.AddSeconds(m_CheckSeconds); - try - { - OglWeatherState next = SeasonWeatherModel.Calculate( - new DateTimeOffset(now, TimeSpan.Zero), - scene.RegionInfo.RegionID.Guid, m_IntervalMinutes, m_Seed, - m_WeatherZone, m_TemperatureOffsetC); - OglWeatherState old = m_Current; - m_Current = next; - if (old == null || old.ValidFromUtc != next.ValidFromUtc || - old.Season != next.Season || old.Weather != next.Weather) - { - m_NextBroadcastUtc = DateTime.MinValue; - Log.InfoFormat("[OGL-JAHRESZEITEN]: Region {0}: {1}, Wetter {2}, {3} °C, " + - "Wind {4} km/h, Stärke {5} %.", scene.RegionInfo.RegionName, - next.Season, next.Weather, next.TemperatureC, - next.WindKmh, next.Intensity); - if (m_EepOverlay != null) - m_EepOverlay.Apply(next); - try { StateChanged?.Invoke(next); } - catch (Exception e) - { - Log.Warn("[OGL-JAHRESZEITEN]: Ein Statusabonnent meldete einen Fehler.", e); - } - } - } - catch (Exception e) - { - // Keep simulator alive; never crash region frame loop. - Log.Error("[OGL-JAHRESZEITEN]: Wetterberechnung fehlgeschlagen.", e); - return; - } - } - if (now >= m_NextBroadcastUtc && m_Current != null) - { - m_NextBroadcastUtc = now.AddSeconds(m_BroadcastSeconds); - try - { - IWorldComm comm = scene.RequestModuleInterface(); - if (comm != null) - comm.DeliverMessage(ChatTypeEnum.Region, m_Channel, - "OGLSeasons", UUID.Zero, m_Current.ToProtocol(), - new Vector3(scene.RegionInfo.RegionSizeX / 2f, - scene.RegionInfo.RegionSizeY / 2f, 20f)); - } - catch (Exception e) - { - Log.Warn("[OGL-JAHRESZEITEN]: Wetter-Signal an LSL konnte nicht gesendet werden.", e); - } - } - } - - public void RemoveRegion(Scene scene) - { - if (m_Scene != scene) - return; - if (m_Started) - scene.EventManager.OnFrame -= OnFrame; - // Only restore a snapshot still owned by OGLSeasons. - m_EepOverlay?.Restore(); - m_EepOverlay = null; - scene.UnregisterModuleInterface(this); - m_Started = false; - m_Current = null; - m_Scene = null; - } - - public void Close() - { - if (m_Scene != null) - RemoveRegion(m_Scene); - } - } -} diff --git a/addons/OGLSeasons/README.md b/addons/OGLSeasons/README.md deleted file mode 100644 index 8adf2cae..00000000 --- a/addons/OGLSeasons/README.md +++ /dev/null @@ -1,345 +0,0 @@ -# OGL Seasons – Jahreszeiten & Wetter für Stadt NexVerse (Deutschland) - -**Stand:** 21.10.2026 · Phase 2 (EEP/Objektsteuerung), sicher deaktivierbar -`feature/ogl-seasons-germany-weather-addon-20261021` · Phase 1 / technisch -testbar, **nicht** für unkontrollierten Produktiveinsatz freigeschaltet. - -## Ziel - -Ein optionales OpenGenesisLINK-Regionenmodul, das auf der **nördlichen -Halbkugel nach dem deutschen meteorologischen Jahreszeitenkalender** arbeitet -und pro Region über die gesamte Stadt-NexVerse-Welt konsistente, -zeitlich stabile Wetterzustände bereitstellt. Ausgaben und Module auf Deutsch. - -| Jahreszeit | Deutsche meteorologische Monate | Beispiele | -|---|---|---| -| Frühling | März bis Mai | sonnig, wechselhaft, Regen, Schauer, Gewitter | -| Sommer | Juni bis August | Sonne, Wärme/Hitzewelle, Starkregen, Gewitter, Hagel | -| Herbst | September bis November | Nebel, Nieselregen, Wind, Sturm, Regen | -| Winter | Dezember bis Februar | Frostnähe, Schnee, Schneesturm, Regen, Nebel | - -Die Umschaltung erfolgt um **00:00 Uhr Europe/Berlin** (MEZ/MESZ), -nicht nach der UTC-Monatsgrenze. Die astronomischen Jahreszeiten haben -bewegliche Grenztermine und sind nicht Bestandteil dieser ersten Stufe. - -**Wichtig:** Die implementierten Wahrscheinlichkeiten sind eine synthetische, -reproduzierbare Simulation mit groben deutschen Temperaturankern. Das Addon -bezieht **keine Live-DWD-Daten** und behauptet keine echte Wettervorhersage. - -## Funktionsumfang Phase 1 - -- eigenständiges `INonSharedRegionModule`, pro Region getrennter Wetterzustand; -- standardmäßig **deaktiviert**, optionale Regions-Whitelist; -- optionale `WeatherZone`: eine zusammenhängende Wetterlage über mehrere Simulatoren; -- `TemperatureOffsetC`: lokale Temperaturkorrektur für Höhenlagen (-15 bis +15 °C); -- Zustandsberechnung in 30-Minuten-Fenstern (konfigurierbar, 5–1440 Minuten, - nur Teiler von 1440), mit regionalem Seed und stabilen Wetterwerten; -- zwölf Wetterarten: heiter, bewölkt, Nieselregen, Regen, Starkregen, - Schneefall, Schneesturm, Nebel, Gewitter, Sturm, Hagel, Hitzewelle; -- Temperatur in °C, Wind in km/h, Luftfeuchtigkeit und Stärke 0–100 %; -- Schutz vor Schneefall bei synthetischer Temperatur über 2 °C; -- `IOglSeasonsService.Current` und `StateChanged` für spätere Addons; -- optionales Region-Chatprotokoll über `IWorldComm`, ausschließlich - auf einem negativen Kanal, ohne IM- oder Avatar-Chatspam; -- LSL-Partikel-Emitter für Regen/Schnee/Hagel/Sturm/Gewitter mit begrenzter Partikellast und Senderprüfung, der - ausschließlich **lokale Partikel** erzeugt und bei Ausfall nach - zehn Minuten den Niederschlag abschaltet; -- LSL-Wetterinformationstafel als Beispielintegration; -- keine automatischen Änderungen an Terrain, Eigentum, Windphysik, - Wasserstand, Region-EEP, Objekten oder Parzellen. - -### Technische Grenze der Viewer - -OpenSim und Firestorm bieten **keinen universellen regionsweiten -Wetter-Schalter**, der automatisch alle Viewer Regen-/Schneepartikel -rendern lässt. Für sichtbaren Niederschlag werden **Wetter-Emitter-Prims** -mit LSL-Skripten benötigt. Große VarRegions benötigen mehrere verteilte -Emitter. `Nebel`, `Hitzewelle` und `Sturm` sind im Kern bereits -Wetterdaten. Flächendeckende EEP-Wetterstimmungen, dynamische -Lichtblitze, Boden-Schneedecken oder physische Sturmeinflüsse -sind Folgephasen und **nicht in Phase 1 implementiert**. - -## Mono.Addins-Abhängigkeitsfix (22.10.2026) - -Der Simulatorstart konnte mit `Mono.Addins.MissingDependencyException` -für `OpenGenesisLINK.OpenSim.Region.Framework,0.9.3.12` abbrechen. -Ursache war eine **relative** `AddinDependency("OpenSim.Region.Framework", ...)` -im Namespaced-Addon `OpenGenesisLINK.OGLSeasons`. Mono.Addins stellte -dadurch irrtümlich `OpenGenesisLINK.` vor den Framework-Namen. - -Die Abhängigkeit ist nun mit `::OpenSim.Region.Framework` global -qualifiziert. Dies ist das Addin-Root aus -`OpenSim.Region.Framework.dll`; die Versionsnummer bleibt synchron zum -Serverbuild (`OpenSim.VersionInfo.VersionNumber`). - -Nach dem Update muss die **neue Addon-DLL** ausdrücklich in das -Simulator-`bin/` installiert werden: - -```bash -cd /opt/developer -bash addon-modules/OGLSeasons/build.sh Release --sim-bin /opt/developer/bin -``` - -ROBUST benötigt dieses Simulator-Addon nicht. Bei fortbestehendem -Addin-Fehler sicherstellen, dass `OpenSim.Region.Framework.dll` und -`OpenGenesisLINK.Addons.OGLSeasons.dll` aus zueinander passenden Builds -stammen. Simulator vor DLL-Austausch stoppen. - -## Installation auf Test-Simulator - -1. Branch auschecken und mit aktuellem `main` abgleichen. -2. Build ausführen: - ```bash - ./runprebuild.sh - ./compile.sh - # oder wenn die OpenSim-Bibliotheken bereits gebaut sind: - bash addon-modules/OGLSeasons/build.sh Release - # WICHTIG: Erst dieser EXPLIZITE Simulator-Installationsschritt - # legt das Regionsmodul in /opt/developer/bin ab: - bash addon-modules/OGLSeasons/build.sh Release --sim-bin /opt/developer/bin - ``` - Ohne `--sim-bin` wird das Addon nur nach - `addons/OGLSeasons/bin/Release/net8.0/` kompiliert und **nicht** - in das allgemeine `bin/` kopiert. Damit laden ROBUST-Builds - das Regionsmodul nicht mehr versehentlich. -3. `addons/OGLSeasons/OGLSeasons.ini.example` nach - `bin/config-include/OGLSeasons.ini` kopieren und diese Datei - **explizit** über die aktiven Simulator-INI-Includes einbinden. -4. `Enabled = true` nur auf einem Testsimulator setzen. -5. Optional `AllowedRegions = "OGL Developer Gen1,Freiburg Sued"` - einstellen (Regionsnamen exakt, Groß-/Kleinschreibung egal). -6. Ergänze `Include-OGLSeasons = "config-include/OGLSeasons.ini"` im aktiven Include-Bereich `[Architecture]` der Simulator-Konfiguration, falls die Datei nicht bereits eingebunden ist. Bestehende Includes unbedingt erhalten. -7. Simulator neu starten und in dessen Log nach - `[OGL-JAHRESZEITEN]: Region ... aktiviert` suchen. -8. In einem geeigneten Weather-Emitter-Prim `WeatherEmitter.lsl` - einfügen. Prim über dem gewünschten Gebiet positionieren; - gegebenenfalls mehrere Emitter einsetzen. Die Skriptdatei - `WeatherInfoBoard.lsl` eignet sich für eine Wetteranzeige. -9. Emitter-`CHANNEL` und Modul-`LSLChannel` müssen identisch sein. - Bei deaktiviertem Modul bleibt der Emitter ohne Niederschlag. - -### ROBUST-Warnung: fehlendes OpenSim.Region.Framework - -`OpenGenesisLINK.Addons.OGLSeasons.dll` ist ein Regionsmodul und gehört ausschließlich in das Simulator-`bin` (etwa `/opt/developer/bin`). Steht die DLL auch in `/opt/robust/bin`, versucht ROBUST sie zu laden und meldet eine fehlende Abhängigkeit `OpenGenesisLINK.OpenSim.Region.Framework,0.9.3.12`. Das ist kein Fehler des Account- oder Gridservice. - -Zur Korrektur die DLL im ROBUST-Bin zunächst an einen sicheren Backup-Ort außerhalb des Bin-Verzeichnisses verschieben und ROBUST neu starten. Auf den Simulatoren die DLL belassen, zusammen mit dem Framework aus dem exakt gleichen Build. Ein gemeinsames `bin` für ROBUST und Simulator erfordert eine saubere Trennung der Startartefakte. - -```bash -mkdir -p /root/robust-disabled-addons -if [ -f /opt/robust/bin/OpenGenesisLINK.Addons.OGLSeasons.dll ]; then - mv /opt/robust/bin/OpenGenesisLINK.Addons.OGLSeasons.dll /root/robust-disabled-addons/ -fi -# ROBUST danach regulär neu starten -``` - -Der Build von `addons/OGLSeasons` kopiert ab dieser Änderung keine -DLL mehr ungefragt in das allgemeine `bin/`. Auf Simulatoren -nach einem frischen Build die DLL explizit installieren: - -```bash -cd /opt/developer -bash addon-modules/OGLSeasons/build.sh Release --sim-bin /opt/developer/bin -``` - -Für die Installation muss im gewählten Simulatorverzeichnis die passende -`OpenSim.Region.Framework.dll` vorhanden sein; das Skript lehnt -`/opt/robust/bin` ausdrücklich ab. Eine bereits auf ROBUST vorhandene -alte DLL entfernt ein Git-Update nicht automatisch. - -### Mono.Addins-Registrierung auf dem Simulator prüfen - -OGL Seasons ist ein **Regionen-Addon**, kein ROBUST-Service. Die Datei -`OpenGenesisLINK.Addons.OGLSeasons.dll` gehört in das `bin/` des -**Simulators**. Ein ROBUST-Prozess, der dieselbe DLL scannt, kann Warnungen -über den Erweiterungspunkt `/OpenSim/RegionModules` ausgeben, weil ROBUST -kein Regionsmodul-Host ist. Die Warnung an `R.O.B.U.S.T.#` allein zeigt -deshalb **keinen** Fehler in der Wetterberechnung des Simulators. - -Das Addon muss `OpenSim.Region.Framework` als Mono.Addins-Abhängigkeit -deklarieren: Diese Assembly definiert `/OpenSim/RegionModules`. Die -eindeutige Addin-ID lautet `OpenGenesisLINK.OGLSeasons` (ohne doppeltes -`OpenGenesisLINK.`). Beide Metadaten werden durch den CI-Regressionstest -geprüft. - -Auf dem **Developer-Simulator** nach Build und regulärem Neustart: - -```bash -cd /opt/developer -bash addon-modules/OGLSeasons/build.sh Release --sim-bin /opt/developer/bin -# Simulator neu starten; danach: -grep -Ei 'OGLSeasons|OGL-JAHRESZEITEN|Plugin Error' bin/OpenSim.log | tail -n 50 -``` - -Erwartet werden die Registrierung von **einem nicht geteilten Regionsmodul** -sowie bei `Enabled = true` und passendem `AllowedRegions` die Meldung -`[OGL-JAHRESZEITEN]: Region ... aktiviert`. Das Einlesen von -`OGLSeasons.ini` allein reicht als Aktivierungsnachweis nicht aus. -Die Einstellungen sind für jeden Simulatorprozess separat einzubinden; -ein ROBUST-Neustart aktiviert keine Regionsmodule. - -## Konfigurationsvertrag - -```ini -[OGLSeasons] -Enabled = false -AllowedRegions = "" -WeatherIntervalMinutes = 30 -WeatherZone = "" -TemperatureOffsetC = 0 -Seed = 2026 -CheckSeconds = 60 -BroadcastSeconds = 180 -LSLChannel = -835011 -``` - -`WeatherZone` muss für benachbarte Regionen auf allen beteiligten Simulatoren identisch sein (z. B. `Freiburg`). Leer bedeutet unabhängige Wetterzonen. Auf allen Simulatoren müssen `Seed`, `WeatherIntervalMinutes` und die Systemzeit übereinstimmen. `TemperatureOffsetC` erlaubt Gebirgs-/Küstenklima, kann jedoch den simulierten Niederschlag (Schnee/Regen) abweichen lassen. Der UTC-Zeitstempel der doppelten Stunde beim Winterzeitwechsel berücksichtigt den jeweils tatsächlichen UTC-Offset. - -`AllowedRegions` gilt für die Region auf dem jeweiligen Simulator, nicht -für alle Grids global. Ein leerer Wert erlaubt alle Regionen des Prozesses, -wenn `Enabled = true` gesetzt ist. Unzulässige Einstellungen für Intervall -oder Chatkanal deaktivieren das Modul statt den Simulator abzubrechen. -Die Simulationswerte ändern sich in Zeitfenstern; das Broadcastintervall -ist nur ein Heartbeat für frisch hinzugefügte LSL-Skripte. - -## EEP-Himmel, Wolken, Nebel und saisonale Landschaft (Phase 2) - -Diese Erweiterung enthält eine **rein flüchtige, regionale EEP-Überlagerung**. -Sie verändert die für Viewer angezeigten `SkyData`-Werte (Wolkenabdeckung, -Wolkenfarbe, Dunst/Nebel, Himmelshelligkeit) und aktualisiert die Viewer per -`IEnvironmentModule.WindlightRefresh(10)`. Im Gegensatz zum normalen -`StoreOnRegion` wird **kein EEP in die Simulationsdatenbank geschrieben**. -Der Tageszyklus inklusive Sonnen-/Mondposition und Wasserparameter bleibt -erhalten. Nach einem Simulator-Neustart ist das ursprünglich persistierte -EEP automatisch wiederhergestellt. - -Die neue Funktion ist zusätzlich zum Wetterkern standardmäßig **aus**: - -```ini -[OGLSeasons] -Enabled = true -EnableEepOverlay = false -AllowCustomRegionEep = false -``` - -Für eine explizit vorbereitete **Testregion ohne eigene -Region-EEP-Einstellungen** ist `EnableEepOverlay = true` möglich. -Falls bereits ein eigenes Region-EEP existiert, überspringt das Addon die -Himmelsüberlagerung grundsätzlich. Nur wenn der Betreiber zusätzlich -`AllowCustomRegionEep = true` setzt, darf es temporär über ein -vorhandenes EEP legen. Diese zweite Option ist für Produktivregions -mit Estate-/Designer-EEP normalerweise **nicht empfohlen**. Sie setzt -voraus, dass der Betreiber die betroffenen Assets und Rechte kennt. - -**Eigentümer- und Editorschutz:** Das Modul merkt sich die ursprüngliche -Region-Umgebungsreferenz. Wenn ein Administrator die EEP-Einstellungen -während des Betriebs ersetzt, stoppt das Addon die Überlagerung und stellt -sie beim späteren Modul-Stopp **nicht** über die neue Einstellung. -Beim ordentlichen Modul-Stopp wird ausschließlich eine noch vom Modul -verwaltete Überlagerung rückgängig gemacht. Parzellen-EEP, Estate-Daten, -Boden, Wasserhöhe und Windphysik werden nicht geändert. - -**Grenze:** Firestorm-Parzellen können eigene EEP-Layer haben, die die -Regionsebene verdecken. Außerdem zeigt das Modul auf sehr alten Viewern -möglicherweise nur einen Teil der EEP-Felder. Es versendet keine -Wettertexturen oder gerenderte Gewitterwolken; es modifiziert -Himmelsparameter anhand des synthetischen Wettermodells. - -### Saisonale Landschaftsobjekte – nur mit Zustimmung des Eigentümers - -Die Datei `SeasonalLandscape.lsl` ist für gezielt vorbereitete eigene -Bäume, Sträucher, Parkobjekte, Blätter oder Schneeskulpturen gedacht. -Das Linkset enthält neben dem Rootprim vier Child-Objekte bzw. Meshvarianten: - -| Linknummer | Variante | -| --- | --- | -| 2 | Frühling (zarte Blätter / Blüten) | -| 3 | Sommer (grüne Vegetation) | -| 4 | Herbst (gelb/rot/orange) | -| 5 | Winter (kahle Äste / Schnee) | - -Nur die jeweilige Variante wird sichtbar geschaltet – per -`llSetLinkAlpha`, **ohne Texturen oder Materialien zu ersetzen**. -Das Wetterprotokoll `OGLSEASONS/1` bestimmt die Jahreszeit; nach zehn -Minuten ohne Signal kehrt das Skript zur vorbereiteten Frühlingsvariante -zurück. Ein Klick durch den Eigentümer schaltet die Automatik ein/aus. -Das Rootprim sowie fremde und nicht verlinkte Objekte bleiben unverändert. -Bitte nicht in bereits texturierten Linksets ohne Prüfung verwenden: -`llSetLinkAlpha(..., ALL_SIDES)` setzt die Transparenz jeder Seite -der vier explizit konfigurierten Child-Prims. - -Diese Lösung ist absichtlich konservativ. Ein globales Überschreiben -aller Bäume, Terrains oder Meshtexturen ist **nicht implementiert**: -das wäre ohne Zustimmung und Snapshot-/Rollback-Funktionen für bestehende -Stadtobjekte zu riskant. - -### Tests der neuen Funktionen - -- `python3 tools/ci/verify_ogl_seasons_eep.py`: Nichtpersistenz, - gesicherte Konfiguration, EEP-Besitzprüfung und LSL-Grenzen. -- `dotnet run -c Release --project - tools/ci/OglSeasonsEepRegression/OglSeasonsEepRegression.csproj`: - EEP-Klonen/Cloud-Fog-Modifikation und Erhalt von Wasser-/Tageszyklus - gegen den echten OpenSim-ViewerEnvironment-Serializer. -- Anschließend: Inworld-Abnahme mit Firestorm, beliebigen Alt-EEP- - Einstellungen, Parzellen-Ausnahmen, Administratoränderungen und - Neustart. Die CI allein ersetzt die visuelle Abnahme **nicht**. - -## Nachrichtenprotokoll OGLSEASONS/1 - -```text -OGLSEASONS|1|1792569600|herbst|regen|57|11|15|84 -``` - -Felder: Protokoll, Version, UTC-Unix-Sekunden des Wetterfensters, -Jahreszeit, Wetterart, Stärke (0–100), Temperatur (°C), Wind (km/h), -relative Feuchtigkeit (%). Die Zahlen sind ein **Strukturbeispiel**. -Sendername `OGLSeasons`, Standardkanal `-835011`. -Das Protokoll ist nicht kryptografisch authentifiziert: Es darf -nur unverfängliche visuelle Effekte auslösen, niemals Inventarzugriffe, -Geldtransaktionen, Estate-Aktionen oder Benutzerrechte ändern. - -## Leistung und Betrieb - -Das Modul hängt sich an den regionalen `OnFrame`-Event, führt pro -Frame aber lediglich eine Zeitprüfung aus. Die eigentliche -Wetterberechnung erfolgt höchstens alle `CheckSeconds`; LSL-Signale -werden höchstens alle `BroadcastSeconds` gesendet. Die Rechenlast -der **Partikelemitter** hängt von ihrer Anzahl und LSL-Burstfrequenz ab: -Emitter zunächst nur an zentralen Orten aktivieren und FPS prüfen. -In `RemoveRegion` und `Close` wird das Event abgemeldet, um -verwaiste Zustände zu vermeiden. - -## Roadmap (separat zu entwickeln) - -1. **Phase 2 – Viewer-EEP (Basis umgesetzt):** flüchtiges EEP mit Wolken, - Dunst und Nebel. Optionale ausgefeilte Himmelspresets, Übergangsprofile - und Parzellenansichten später weiterentwickeln. -2. **Phase 3 – Vegetation und Boden (Basis umgesetzt):** opt-in Linkset- - Varianten mit reversibler Sichtbarkeit. Schneedecken-Assets und - Eigentümer-Management ohne fremde Inhalte zu überschreiben folgen. -3. **Phase 4 – Wetterphänomene:** synchronisierte Blitze/Donner, - Nebelvolumen, Böen und sichere hydrologische Integration mit HydroEngine. -4. **Phase 5 – Atlas/Portal-API:** regionale Wetterdaten, Wetterwarnstufen, - historische Zustände, ggf. externer Wetterprovider, Caching und - Rechte-/Ratenbegrenzung. Kein ungesicherter HTTP-Endpunkt. -5. **Phase 6 – Tests:** echte Firestorm-Viewer-Tests, VarRegion-Übertritte, - 24h-Dauerlauf, Neustart, Sommerzeit, viele simultane Emitter. - -## Test- und Freigabeprozess - -- `python3 tools/ci/verify_ogl_seasons.py` prüft das - deaktivierte Defaultprofil, Modul-Registrierung und Buildvertrag. -- `dotnet run --configuration Release --project - tools/ci/OglSeasonsRegression/OglSeasonsRegression.csproj` prüft - deutschen Jahreszeitenwechsel, Sommerzeit, Stabilität und Grenzen. -- `bash addon-modules/OGLSeasons/build.sh Release` kompiliert das Modul - mit dem OpenGenesisLINK-Region-Framework. -- PR-CI darf die funktionierende `main`-Version nicht verändern. -- **Ein grüner Build bedeutet noch keine nachgewiesene Partikelwirkung im - Viewer**. Inworld-Testergebnis und Speicher-/Lagprofil separat abnehmen. - -Dateien: -`SeasonWeatherModel.cs` (Modell), -`OglSeasonsRegionModule.cs` (Regionen-Addon), -`WeatherEmitter.lsl` und `WeatherInfoBoard.lsl` (optionale Inworld-Effekte), -`OGLSeasons.ini.example` (Konfiguration). diff --git a/addons/OGLSeasons/SeasonWeatherModel.cs b/addons/OGLSeasons/SeasonWeatherModel.cs deleted file mode 100644 index 1a68dbab..00000000 --- a/addons/OGLSeasons/SeasonWeatherModel.cs +++ /dev/null @@ -1,208 +0,0 @@ -// SPDX-License-Identifier: MPL-2.0 -using System; -using System.Globalization; -using System.Text; - -namespace OpenGenesisLINK.Addons.OGLSeasons -{ - public enum OglSeason { Fruehling, Sommer, Herbst, Winter } - public enum OglWeather - { - Heiter, Bewoelkt, Nieselregen, Regen, Starkregen, - Schneefall, Schneesturm, Nebel, Gewitter, Sturm, Hagel, Hitzewelle - } - - public sealed class OglWeatherState - { - public OglSeason Season { get; } - public OglWeather Weather { get; } - public DateTimeOffset ValidFromUtc { get; } - public int TemperatureC { get; } - public int WindKmh { get; } - public int HumidityPercent { get; } - public int Intensity { get; } - public string SeasonKey => Season.ToString().ToLowerInvariant(); - public string WeatherKey => Weather.ToString().ToLowerInvariant(); - - public OglWeatherState(OglSeason season, OglWeather weather, DateTimeOffset validFromUtc, - int temperatureC, int windKmh, int humidityPercent, int intensity) - { - Season = season; - Weather = weather; - ValidFromUtc = validFromUtc; - TemperatureC = temperatureC; - WindKmh = windKmh; - HumidityPercent = humidityPercent; - Intensity = intensity; - } - - public string ToProtocol() - { - // Stable culture-neutral data contract. No LSL/JSON dependencies. - return "OGLSEASONS|1|" + ValidFromUtc.ToUnixTimeSeconds().ToString(CultureInfo.InvariantCulture) - + "|" + SeasonKey + "|" + WeatherKey + "|" - + Intensity.ToString(CultureInfo.InvariantCulture) + "|" - + TemperatureC.ToString(CultureInfo.InvariantCulture) + "|" - + WindKmh.ToString(CultureInfo.InvariantCulture) + "|" - + HumidityPercent.ToString(CultureInfo.InvariantCulture); - } - } - - /// - /// Reproducible seasonal weather simulation for German (Berlin) civil time. - /// It is NOT live DWD weather data and does not claim climate forecasts. - /// - public static class SeasonWeatherModel - { - // Monthly mean anchors for plausible *fictional* lowland German weather, - // not meteorological observations or climatic reference normals. - private static readonly int[] s_BaseTemperature = { -1, 0, 5, 9, 14, 18, 20, 19, 15, 10, 5, 1 }; - private static readonly TimeZoneInfo s_Zone = ResolveGermanZone(); - - public static TimeZoneInfo GermanZone => s_Zone; - - private static TimeZoneInfo ResolveGermanZone() - { - try { return TimeZoneInfo.FindSystemTimeZoneById("Europe/Berlin"); } - catch (TimeZoneNotFoundException) - { - return TimeZoneInfo.FindSystemTimeZoneById("W. Europe Standard Time"); - } - } - - public static OglSeason ResolveSeason(DateTimeOffset instantUtc) - { - int month = TimeZoneInfo.ConvertTime(instantUtc, s_Zone).Month; - if (month >= 3 && month <= 5) return OglSeason.Fruehling; - if (month >= 6 && month <= 8) return OglSeason.Sommer; - if (month >= 9 && month <= 11) return OglSeason.Herbst; - return OglSeason.Winter; - } - - public static OglWeatherState Calculate( - DateTimeOffset instantUtc, Guid regionId, int intervalMinutes = 30, int seed = 2026, - string weatherZone = null, int temperatureOffsetC = 0) - { - if (intervalMinutes < 5 || intervalMinutes > 1440 || 1440 % intervalMinutes != 0) - throw new ArgumentOutOfRangeException(nameof(intervalMinutes), - "Interval must be a divisor of 1440 between 5 and 1440 minutes."); - - if (temperatureOffsetC < -15 || temperatureOffsetC > 15) - throw new ArgumentOutOfRangeException(nameof(temperatureOffsetC)); - if (weatherZone != null && weatherZone.Length > 80) - throw new ArgumentOutOfRangeException(nameof(weatherZone)); - DateTimeOffset local = TimeZoneInfo.ConvertTime(instantUtc, s_Zone); - OglSeason season = ResolveSeason(instantUtc); - int minutes = local.Hour * 60 + local.Minute; - int slot = minutes / intervalMinutes; - // Same nonempty weather zone on different simulators produces - // identical weather. Without a zone, each region is independent. - // Use stable UTF8 FNV-1a; string.GetHashCode differs per process. - uint hash = 2166136261u; - if (string.IsNullOrWhiteSpace(weatherZone)) - { - foreach (byte value in regionId.ToByteArray()) - hash = (hash ^ value) * 16777619u; - } - else - { - foreach (byte value in Encoding.UTF8.GetBytes( - weatherZone.Trim().Normalize(NormalizationForm.FormKC).ToUpperInvariant())) - hash = (hash ^ value) * 16777619u; - } - hash = Mix(hash, (uint)seed); - hash = Mix(hash, (uint)local.Year); - hash = Mix(hash, (uint)local.DayOfYear); - hash = Mix(hash, (uint)slot); - Random random = new Random(unchecked((int)(hash & 0x7fffffff))); - - int temperature = s_BaseTemperature[local.Month - 1] + random.Next(-5, 6) - + temperatureOffsetC; - int wind = Math.Max(0, 4 + random.Next(0, 20)); - int humidity = 40 + random.Next(0, 57); - int roll = random.Next(1000); - OglWeather weather; - switch (season) - { - case OglSeason.Winter: - weather = roll < 230 ? OglWeather.Bewoelkt - : roll < 420 ? OglWeather.Heiter - : roll < 585 ? OglWeather.Nebel - : roll < 740 ? OglWeather.Schneefall - : roll < 795 ? OglWeather.Schneesturm - : roll < 940 ? OglWeather.Regen - : roll < 980 ? OglWeather.Sturm - : OglWeather.Nieselregen; - break; - case OglSeason.Fruehling: - weather = roll < 260 ? OglWeather.Heiter - : roll < 465 ? OglWeather.Bewoelkt - : roll < 565 ? OglWeather.Nieselregen - : roll < 800 ? OglWeather.Regen - : roll < 870 ? OglWeather.Starkregen - : roll < 940 ? OglWeather.Gewitter - : roll < 980 ? OglWeather.Nebel - : OglWeather.Hagel; - break; - case OglSeason.Sommer: - weather = roll < 360 ? OglWeather.Heiter - : roll < 550 ? OglWeather.Bewoelkt - : roll < 680 ? OglWeather.Hitzewelle - : roll < 810 ? OglWeather.Regen - : roll < 890 ? OglWeather.Starkregen - : roll < 970 ? OglWeather.Gewitter - : OglWeather.Hagel; - break; - default: // Autumn - weather = roll < 160 ? OglWeather.Heiter - : roll < 400 ? OglWeather.Bewoelkt - : roll < 590 ? OglWeather.Nebel - : roll < 750 ? OglWeather.Regen - : roll < 850 ? OglWeather.Nieselregen - : roll < 925 ? OglWeather.Starkregen - : roll < 975 ? OglWeather.Sturm - : OglWeather.Gewitter; - break; - } - - if ((weather == OglWeather.Schneefall || weather == OglWeather.Schneesturm) - && temperature > 2) - weather = weather == OglWeather.Schneesturm ? OglWeather.Starkregen : OglWeather.Regen; - if (weather == OglWeather.Regen && temperature <= -1) - weather = OglWeather.Schneefall; - if (weather == OglWeather.Hitzewelle && temperature < 26) - temperature = 26 + random.Next(0, 9); - if (weather == OglWeather.Sturm || weather == OglWeather.Schneesturm) - wind = Math.Max(wind, 65 + random.Next(0, 35)); - else if (weather == OglWeather.Gewitter || weather == OglWeather.Hagel) - wind = Math.Max(wind, 35 + random.Next(0, 35)); - int intensity = weather switch - { - OglWeather.Heiter or OglWeather.Bewoelkt => 0, - OglWeather.Nebel => 20 + random.Next(55), - OglWeather.Nieselregen => 12 + random.Next(28), - OglWeather.Hitzewelle => 30 + random.Next(65), - OglWeather.Sturm or OglWeather.Schneesturm => 60 + random.Next(41), - OglWeather.Starkregen or OglWeather.Gewitter or OglWeather.Hagel => 50 + random.Next(51), - _ => 20 + random.Next(61) - }; - // Respect the ACTUAL offset for the occurrence of an ambiguous - // local clock hour at autumn's DST rollback. GetUtcOffset(DateTime) - // selects one of the two offsets and can return a future boundary. - DateTime localStart = local.Date.AddMinutes(slot * intervalMinutes); - DateTimeOffset boundary = new DateTimeOffset(localStart, local.Offset).ToUniversalTime(); - return new OglWeatherState(season, weather, boundary, temperature, wind, humidity, intensity); - } - - private static uint Mix(uint current, uint value) - { - unchecked { return (current ^ value) * 16777619u; } - } - } - - public interface IOglSeasonsService - { - OglWeatherState Current { get; } - event Action StateChanged; - } -} diff --git a/addons/OGLSeasons/SeasonalLandscape.lsl b/addons/OGLSeasons/SeasonalLandscape.lsl deleted file mode 100644 index 7b93d39f..00000000 --- a/addons/OGLSeasons/SeasonalLandscape.lsl +++ /dev/null @@ -1,109 +0,0 @@ -// Stadt NexVerse: saisonales Landschafts-Linkset (Eigentümer-Opt-in). -// 1 Rootprim mit Script, 4 Child-Prims/Meshes mit alternativen -// Fruehling-/Sommer-/Herbst-/Winteransichten (alle am selben Standort). -// Ausschliesslich Alpha, KEINE Texturen, Assets, Terrain oder Fremdprims. -// Den vier Child-Prims die passenden Texturen vorab zuweisen. -// Bei Script-Reset/Modulausfall wird die definierte Basisansicht angezeigt. - -integer WEATHER_CHANNEL = -835011; -integer LINK_FRUEHLING = 2; -integer LINK_SOMMER = 3; -integer LINK_HERBST = 4; -integer LINK_WINTER = 5; -integer ENABLED = TRUE; -integer m_lastSeen; -integer m_activeSeason = -1; -integer m_valid = FALSE; - -integer validateLinks() -{ - integer maxLinks = llGetNumberOfPrims(); - list links = [LINK_FRUEHLING, LINK_SOMMER, LINK_HERBST, LINK_WINTER]; - integer i; - for (i = 0; i < 4; ++i) - { - integer v = llList2Integer(links, i); - if (v <= 1 || v > maxLinks) return FALSE; - integer j; - for (j = i + 1; j < 4; ++j) - if (v == llList2Integer(links, j)) return FALSE; - } - return TRUE; -} - -setSeason(integer which) -{ - if (!m_valid) return; - list links = [LINK_FRUEHLING, LINK_SOMMER, LINK_HERBST, LINK_WINTER]; - integer i; - for (i = 0; i < 4; ++i) - { - // One visible variant, no need to alter textures or inventory. - integer linkNum = llList2Integer(links, i); - float opacity = 0.0; - if (i == which) opacity = 1.0; - llSetLinkAlpha(linkNum, opacity, ALL_SIDES); - } - m_activeSeason = which; -} - -default -{ - state_entry() - { - m_valid = validateLinks(); - if (!m_valid) - { - llOwnerSay("OGLSeasons: Vier unterschiedliche Link-Prims (2 bis 5) erforderlich."); - return; - } - llListen(WEATHER_CHANNEL, "OGLSeasons", NULL_KEY, ""); - m_lastSeen = 0; - setSeason(0); - llSetTimerEvent(60.0); - } - listen(integer channel, string name, key id, string message) - { - if (!ENABLED || !m_valid || channel != WEATHER_CHANNEL || - name != "OGLSeasons" || id != NULL_KEY) return; - list t = llParseStringKeepNulls(message, ["|"], []); - if (llGetListLength(t) != 9 || - llList2String(t, 0) != "OGLSEASONS" || - llList2String(t, 1) != "1") return; - string season = llList2String(t, 3); - integer target = -1; - if (season == "fruehling") target = 0; - else if (season == "sommer") target = 1; - else if (season == "herbst") target = 2; - else if (season == "winter") target = 3; - if (target < 0) return; - m_lastSeen = llGetUnixTime(); - if (m_activeSeason != target) setSeason(target); - } - timer() - { - // Conservative fallback after weather module stops responding. - if (m_lastSeen != 0 && llGetUnixTime() - m_lastSeen > 600) - { - m_lastSeen = 0; - setSeason(0); - } - } - touch_start(integer count) - { - // Only the owner can manually disable/re-enable seasonal switching. - if (llDetectedKey(0) != llGetOwner()) return; - ENABLED = !ENABLED; - if (!ENABLED) setSeason(0); - if (ENABLED) - llOwnerSay("OGLSeasons: Automatik aktiv."); - else - llOwnerSay("OGLSeasons: Automatik aus, Fruehlingsansicht wiederhergestellt."); - } - changed(integer change) - { - if (change & (CHANGED_LINK | CHANGED_OWNER)) - llResetScript(); - } - on_rez(integer param) { llResetScript(); } -} diff --git a/addons/OGLSeasons/WeatherEmitter.lsl b/addons/OGLSeasons/WeatherEmitter.lsl deleted file mode 100644 index 88493876..00000000 --- a/addons/OGLSeasons/WeatherEmitter.lsl +++ /dev/null @@ -1,134 +0,0 @@ -// Stadt NexVerse – optionaler Wetter-Emitter für OGLSeasons. -// In ein Eigentümer-Prim in der Region legen, das in der Luft -// (z.B. 10–20 m über dem Boden) positioniert wird. -// Pro Emitter nur lokale Partikel: mehrere Emitter für große Bereiche nötig. -// Kein automatischer Terrain-, Wasser- oder Physikeingriff. -integer CHANNEL = -835011; -string SOURCE_NAME = "OGLSeasons"; -string m_weather = "heiter"; -integer m_intensity = 0; -integer m_lastMessageTime = 0; - -updateParticles() -{ - if (m_weather != "regen" && m_weather != "nieselregen" && - m_weather != "starkregen" && m_weather != "gewitter" && - m_weather != "sturm" && m_weather != "schneefall" && - m_weather != "schneesturm" && m_weather != "hagel") - { - llParticleSystem([]); - return; - } - - integer snow = (m_weather == "schneefall" || m_weather == "schneesturm"); - integer hail = (m_weather == "hagel"); - vector startColor = <0.63, 0.77, 1.0>; - vector startScale = <0.035, 0.50, 0.0>; - vector endScale = <0.03, 0.25, 0.0>; - vector accel = <0.0, 0.0, -5.0>; - float age = 5.0; - float minSpeed = 0.6; - float maxSpeed = 1.4; - if (snow) - { - startColor = <0.97, 0.98, 1.0>; - startScale = <0.14, 0.14, 0.0>; - endScale = <0.06, 0.06, 0.0>; - accel = <0.0, 0.0, -0.65>; - age = 8.0; - minSpeed = 0.1; - maxSpeed = 0.8; - } - else if (hail) - { - startColor = <0.80, 0.95, 1.0>; - startScale = <0.08, 0.08, 0.0>; - } - // Keep per-emitter particles bounded even with many nearby prims. - // Max 5 / 0.15s ~33 particles/s instead of 125 particles/s. - if (m_weather == "sturm") - { - startColor = <0.83, 0.88, 0.90>; - startScale = <0.28, 0.03, 0.0>; - endScale = <0.40, 0.02, 0.0>; - accel = <2.5, 0.0, -0.1>; - minSpeed = 1.5; - maxSpeed = 4.0; - } - integer count = 1 + (m_intensity / 25); - if (count > 5) count = 5; - float rate = 0.15; - llParticleSystem([ - PSYS_PART_FLAGS, PSYS_PART_INTERP_COLOR_MASK | PSYS_PART_INTERP_SCALE_MASK, - PSYS_SRC_PATTERN, PSYS_SRC_PATTERN_EXPLODE, - PSYS_PART_START_COLOR, startColor, - PSYS_PART_END_COLOR, startColor, - PSYS_PART_START_ALPHA, 0.8, - PSYS_PART_END_ALPHA, 0.0, - PSYS_PART_START_SCALE, startScale, - PSYS_PART_END_SCALE, endScale, - PSYS_PART_MAX_AGE, age, - PSYS_SRC_BURST_RATE, rate, - PSYS_SRC_BURST_PART_COUNT, count, - PSYS_SRC_BURST_RADIUS, 7.5, - PSYS_SRC_BURST_SPEED_MIN, minSpeed, - PSYS_SRC_BURST_SPEED_MAX, maxSpeed, - PSYS_SRC_ACCEL, accel, - PSYS_SRC_MAX_AGE, 0.0 - ]); -} - -default -{ - state_entry() - { - llParticleSystem([]); - llListen(CHANNEL, SOURCE_NAME, NULL_KEY, ""); - llSetTimerEvent(30.0); - llOwnerSay("OGLSeasons: Wetter-Emitter aktiv. Warte auf Simulator-Wettersignal."); - } - - listen(integer channel, string name, key id, string message) - { - // Genuine simulator broadcasts originate from UUID.Zero. A normal - // in-world avatar/object cannot impersonate this sender UUID. - if (channel != CHANNEL || name != SOURCE_NAME || id != NULL_KEY) return; - list fields = llParseStringKeepNulls(message, ["|"], []); - if (llGetListLength(fields) != 9 || - llList2String(fields, 0) != "OGLSEASONS" || - llList2String(fields, 1) != "1") return; - string kind = llList2String(fields, 4); - // Allow-list: fremde Chat-Nachrichten duerfen keine beliebigen - // LSL-Befehle ausfuehren. Sie steuern ausschliesslich Partikel. - if (kind != "heiter" && kind != "bewoelkt" && - kind != "nieselregen" && kind != "regen" && - kind != "starkregen" && kind != "schneefall" && - kind != "schneesturm" && kind != "nebel" && - kind != "gewitter" && kind != "sturm" && - kind != "hagel" && kind != "hitzewelle") return; - m_weather = kind; - m_intensity = llList2Integer(fields, 5); - if (m_intensity < 0) m_intensity = 0; - if (m_intensity > 100) m_intensity = 100; - m_lastMessageTime = llGetUnixTime(); - updateParticles(); - } - - timer() - { - // Keine ewigen Niederschlagseffekte, falls das Wetter-Modul - // deaktiviert oder die Region nach einem Update neu gestartet wurde. - if (m_lastMessageTime != 0 && llGetUnixTime() - m_lastMessageTime > 600) - { - m_lastMessageTime = 0; - m_weather = "heiter"; - m_intensity = 0; - llParticleSystem([]); - } - } - - on_rez(integer startParam) - { - llResetScript(); - } -} diff --git a/addons/OGLSeasons/WeatherInfoBoard.lsl b/addons/OGLSeasons/WeatherInfoBoard.lsl deleted file mode 100644 index a2d78676..00000000 --- a/addons/OGLSeasons/WeatherInfoBoard.lsl +++ /dev/null @@ -1,62 +0,0 @@ -// Stadt NexVerse – saisonale Info-Tafel. Prim aufstellen und Script einfügen. -// Reagiert auf serverseitige OGLSEASONS-Region-Nachrichten. -integer CHANNEL = -835011; -integer lastReceived; -string germanSeason(string s) -{ - if (s == "fruehling") return "Frühling"; - if (s == "sommer") return "Sommer"; - if (s == "herbst") return "Herbst"; - if (s == "winter") return "Winter"; - return s; -} -string germanWeather(string w) -{ - if (w == "heiter") return "Heiter"; - if (w == "bewoelkt") return "Bewölkt"; - if (w == "nieselregen") return "Nieselregen"; - if (w == "regen") return "Regen"; - if (w == "starkregen") return "Starkregen"; - if (w == "schneefall") return "Schneefall"; - if (w == "schneesturm") return "Schneesturm"; - if (w == "nebel") return "Nebel"; - if (w == "gewitter") return "Gewitter"; - if (w == "sturm") return "Sturm"; - if (w == "hagel") return "Hagel"; - if (w == "hitzewelle") return "Hitzewelle"; - return w; -} -default -{ - state_entry() - { - llListen(CHANNEL, "OGLSeasons", NULL_KEY, ""); - llSetText("Stadt NexVerse\nWetterdaten werden geladen …", <0.8,0.95,1.0>, 1.0); - llSetTimerEvent(45.0); - } - listen(integer channel, string speaker, key id, string message) - { - if (channel != CHANNEL || speaker != "OGLSeasons" || id != NULL_KEY) return; - list t = llParseStringKeepNulls(message, ["|"], []); - if (llGetListLength(t) != 9 || - llList2String(t, 0) != "OGLSEASONS" || - llList2String(t, 1) != "1") return; - string season = germanSeason(llList2String(t, 3)); - string condition = germanWeather(llList2String(t, 4)); - string temp = llList2String(t, 6); - string wind = llList2String(t, 7); - string strength = llList2String(t, 5); - llSetText("Stadt NexVerse\n" + season + " · " + condition + - "\n" + temp + " °C · Wind " + wind + " km/h" + - "\nIntensität: " + strength + " %", <0.8,0.95,1.0>, 1.0); - lastReceived = llGetUnixTime(); - } - timer() - { - if (lastReceived != 0 && llGetUnixTime() - lastReceived > 600) - { - lastReceived = 0; - llSetText("Stadt NexVerse\nWetterstatus derzeit nicht verfügbar", <1.0,0.7,0.45>, 1.0); - } - } -} diff --git a/addons/OGLWeather/OGLWeather.ini.example b/addons/OGLWeather/OGLWeather.ini.example new file mode 100644 index 00000000..e4ae0d0c --- /dev/null +++ b/addons/OGLWeather/OGLWeather.ini.example @@ -0,0 +1,14 @@ +; OpenGenesisLINK Generation 1: eigenstaendiges, simulatorweites OGLWeather. +; Nur auf Simulator-Prozessen installieren, NICHT auf ROBUST. +[OGLWeather] +Enabled = false +; Jeder Region auf diesem Simulator folgt dem gleichen Wetterplan. +; Gleicher Seed + Zeitzone = gleicher Wetterplan auch auf anderen Nodes. +WeatherSeed = 20261028 +TimeZone = "Europe/Berlin" +; Separater Kanal, NICHT mit OGLSeasons verwechseln. +LSLChannel = -835311 +CurrentBroadcastSeconds = 60 +ForecastBroadcastSeconds = 300 +; Keine EEP-Aenderungen, keine dauerhaften Rezzed-Objekte. +; Das Wettersystem benoetigt Wetter-Emitter-Prims fuer sichtbare Partikel. diff --git a/addons/OGLWeather/OglWeatherModel.cs b/addons/OGLWeather/OglWeatherModel.cs new file mode 100644 index 00000000..cca4aa36 --- /dev/null +++ b/addons/OGLWeather/OglWeatherModel.cs @@ -0,0 +1,152 @@ +// SPDX-License-Identifier: MPL-2.0 +// Pure, deterministic weather simulation. No external weather API and no network calls. +using System; +using System.Globalization; + +namespace OpenGenesisLINK.Addons.OGLWeather +{ + public sealed class WeatherReading + { + public string Condition { get; set; } + public int TemperatureC { get; set; } + public int Intensity { get; set; } + public int WindKmh { get; set; } + } + + public sealed class WeatherDay + { + public DateTime Date { get; set; } + public string Condition { get; set; } + public int MinC { get; set; } + public int MaxC { get; set; } + public int PrecipitationHours { get; set; } + } + + /// + /// Every forecast and every actual state comes from the same immutable + /// UTC-to-local calculation. The public seed defines a simulator-wide + /// climate. There is nothing to persist or revise on restart. + /// + public static class OglWeatherModel + { + public static WeatherReading At(DateTimeOffset utc, int seed, TimeZoneInfo zone) + { + if (zone == null) throw new ArgumentNullException(nameof(zone)); + return AtLocal(TimeZoneInfo.ConvertTime(utc, zone).DateTime, seed); + } + + public static WeatherReading AtLocal(DateTime local, int seed) + { + DateTime day = local.Date; + int ordinal = day.DayOfYear; + int segment = local.Hour / 6; + + // July warmth, January frost and a smooth afternoon temperature peak. + // The fixed daily anomaly is shared by all hourly predictions. + int anomaly = (int)(Hash(seed, day.Year, ordinal, 0, 11) % 9) - 4; + double seasonal = 11.5 + 12.5 * Math.Cos( + 2.0 * Math.PI * (ordinal - 204.0) / 365.2425); + double diurnal = 4.0 * Math.Cos( + 2.0 * Math.PI * (local.Hour - 15.0) / 24.0); + int temperature = (int)Math.Round(seasonal + diurnal + anomaly, + MidpointRounding.AwayFromZero); + + // Exactly four fixed six-hour precipitation periods per local day. + // They never depend on time of query or mutable random state. + int chance = (int)(Hash(seed, day.Year, ordinal, segment, 23) % 100); + string weather = chance < 20 ? "sun" : + chance < 64 ? "cloud" : temperature <= 1 ? "snow" : "rain"; + bool wet = weather == "rain" || weather == "snow"; + return new WeatherReading + { + Condition = weather, + TemperatureC = temperature, + Intensity = wet + ? 20 + (int)(Hash(seed, day.Year, ordinal, segment, 29) % 71) + : 0, + WindKmh = 3 + (int)(Hash(seed, day.Year, ordinal, segment, 31) % 36) + }; + } + + public static WeatherDay ForecastDay(DateTime localDate, int seed, TimeZoneInfo zone) + { + if (zone == null) throw new ArgumentNullException(nameof(zone)); + DateTime date = DateTime.SpecifyKind(localDate.Date, DateTimeKind.Unspecified); + // DST creates 23-hour or 25-hour calendar days. Iterate actual + // UTC instants so predicted precipitation hours always match + // the hours the simulator truly observes. + DateTime fromUtc = TimeZoneInfo.ConvertTimeToUtc(date, zone); + DateTime untilUtc = TimeZoneInfo.ConvertTimeToUtc(date.AddDays(1), zone); + int min = int.MaxValue; + int max = int.MinValue; + int rain = 0; + int snow = 0; + int cloud = 0; + int sunny = 0; + + // Sample every actually occurring hour of this local calendar day. + for (DateTime hourUtc = fromUtc; hourUtc < untilUtc; + hourUtc = hourUtc.AddHours(1)) + { + DateTime actualLocal = TimeZoneInfo.ConvertTimeFromUtc(hourUtc, zone); + WeatherReading weather = AtLocal(actualLocal, seed); + min = Math.Min(min, weather.TemperatureC); + max = Math.Max(max, weather.TemperatureC); + if (weather.Condition == "rain") rain++; + else if (weather.Condition == "snow") snow++; + else if (weather.Condition == "cloud") cloud++; + else sunny++; + } + + // A day labelled as rain/snow contains that actual precipitation + // in the forecast model. A mix is reported as its larger share. + string summary = snow > 0 && snow >= rain ? "snow" : + rain > 0 ? "rain" : cloud >= sunny ? "cloud" : "sun"; + + return new WeatherDay + { + Date = date, MinC = min, MaxC = max, + Condition = summary, PrecipitationHours = rain + snow + }; + } + + public static string NowWire(DateTimeOffset utc, int seed, TimeZoneInfo zone) + { + DateTime local = TimeZoneInfo.ConvertTime(utc, zone).DateTime; + WeatherReading reading = AtLocal(local, seed); + return "OGLWX|1|NOW|" + + local.ToString("yyyy-MM-dd HH:00", CultureInfo.InvariantCulture) + "|" + + reading.Condition + "|" + reading.TemperatureC.ToString(CultureInfo.InvariantCulture) + + "|" + reading.Intensity.ToString(CultureInfo.InvariantCulture) + + "|" + reading.WindKmh.ToString(CultureInfo.InvariantCulture); + } + + public static string DayWire(DateTime localDate, int seed, int index, TimeZoneInfo zone) + { + WeatherDay day = ForecastDay(localDate, seed, zone); + return "OGLWX|1|DAY|" + index.ToString(CultureInfo.InvariantCulture) + "|" + + day.Date.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture) + "|" + + day.Condition + "|" + day.MinC.ToString(CultureInfo.InvariantCulture) + + "|" + day.MaxC.ToString(CultureInfo.InvariantCulture) + + "|" + day.PrecipitationHours.ToString(CultureInfo.InvariantCulture); + } + + private static uint Hash(int seed, int year, int day, int slot, int salt) + { + unchecked + { + uint h = 2166136261; + h = (h ^ (uint)seed) * 16777619; + h = (h ^ (uint)year) * 16777619; + h = (h ^ (uint)day) * 16777619; + h = (h ^ (uint)slot) * 16777619; + h = (h ^ (uint)salt) * 16777619; + h ^= h >> 16; + h *= 0x7feb352d; + h ^= h >> 15; + h *= 0x846ca68b; + return h ^ (h >> 16); + } + } + } +} diff --git a/addons/OGLWeather/OglWeatherRegionModule.cs b/addons/OGLWeather/OglWeatherRegionModule.cs new file mode 100644 index 00000000..2c5526c6 --- /dev/null +++ b/addons/OGLWeather/OglWeatherRegionModule.cs @@ -0,0 +1,160 @@ +// SPDX-License-Identifier: MPL-2.0 +using System; +using System.Collections.Concurrent; +using log4net; +using Mono.Addins; +using Nini.Config; +using OpenMetaverse; +using OpenSim.Framework; +using OpenSim.Region.Framework.Interfaces; +using OpenSim.Region.Framework.Scenes; + +[assembly: Addin("OGLWeather", Namespace = "OpenGenesisLINK", Version = "0.1.0")] +[assembly: AddinDependency("::OpenSim.Region.Framework", OpenSim.VersionInfo.VersionNumber)] + +namespace OpenGenesisLINK.Addons.OGLWeather +{ + /// + /// One shared module instance serves EVERY region of this simulator. + /// Only broadcasts authenticated-by-origin region chat; an owner-installed + /// LSL emitter renders particles locally to viewers (no server rezzing). + /// + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "OGLWeather")] + public sealed class OglWeatherRegionModule : ISharedRegionModule + { + private sealed class RegionRuntime + { + public Scene Scene; + public EventManager.OnFrameDelegate Handler; + public long NextNow; + public long NextDays; + } + + private static readonly ILog Log = LogManager.GetLogger(typeof(OglWeatherRegionModule)); + private readonly ConcurrentDictionary m_Regions = new(); + private bool m_Enabled; + private bool m_Closing; + private int m_Seed; + private int m_Channel; + private int m_CurrentSeconds; + private int m_DailySeconds; + private TimeZoneInfo m_TimeZone; + + public string Name => "OGLWeather"; + public Type ReplaceableInterface => null; + + public void Initialise(IConfigSource source) + { + IConfig cfg = source?.Configs["OGLWeather"]; + m_Enabled = cfg?.GetBoolean("Enabled", false) ?? false; + if (!m_Enabled) return; + + m_Seed = cfg.GetInt("WeatherSeed", 20261028); + m_Channel = cfg.GetInt("LSLChannel", -835311); + m_CurrentSeconds = Math.Clamp(cfg.GetInt("CurrentBroadcastSeconds", 60), 30, 300); + m_DailySeconds = Math.Clamp(cfg.GetInt("ForecastBroadcastSeconds", 300), 60, 3600); + if (m_Channel >= 0) + { + Log.Error("[OGL-WEATHER]: LSLChannel muss negativ sein; Modul deaktiviert."); + m_Enabled = false; + return; + } + + string zoneName = cfg.GetString("TimeZone", "Europe/Berlin").Trim(); + try + { + m_TimeZone = TimeZoneInfo.FindSystemTimeZoneById(zoneName); + } + catch (Exception ex) + { + // Wrong timezones would silently make the forecast date incorrect. + m_Enabled = false; + Log.Error("[OGL-WEATHER]: Unbekannte Zeitzone; Modul deaktiviert: " + zoneName, ex); + return; + } + + Log.InfoFormat("[OGL-WEATHER]: Simulatorweite deterministische Wettervorhersage aktiv, Seed={0}, Zone={1}", + m_Seed, m_TimeZone.Id); + } + + public void PostInitialise() { } + + public void AddRegion(Scene scene) + { + if (!m_Enabled || m_Closing || scene == null) return; + var region = new RegionRuntime { Scene = scene }; + region.Handler = () => OnFrame(region); + m_Regions.TryAdd(scene.RegionInfo.RegionID, region); + } + + public void RegionLoaded(Scene scene) + { + if (!m_Enabled || m_Closing || scene == null) return; + if (m_Regions.TryGetValue(scene.RegionInfo.RegionID, out RegionRuntime runtime)) + { + // Called exactly once for each loaded Scene. + scene.EventManager.OnFrame -= runtime.Handler; + scene.EventManager.OnFrame += runtime.Handler; + } + } + + private void OnFrame(RegionRuntime state) + { + if (!m_Enabled || m_Closing) return; + long now = DateTimeOffset.UtcNow.ToUnixTimeSeconds(); + if (now < state.NextNow && now < state.NextDays) return; + + // Each region has its own cadence. All of them use the same seed, + // timezone and pure schedule, so no per-region random drift. + try + { + IWorldComm comm = state.Scene.RequestModuleInterface(); + if (comm == null) return; + Vector3 location = new Vector3(state.Scene.RegionInfo.RegionSizeX / 2f, + state.Scene.RegionInfo.RegionSizeY / 2f, 20f); + DateTimeOffset utc = DateTimeOffset.UtcNow; + + if (now >= state.NextNow) + { + state.NextNow = now + m_CurrentSeconds; + comm.DeliverMessage(ChatTypeEnum.Region, m_Channel, + "OGLWeather", UUID.Zero, + OglWeatherModel.NowWire(utc, m_Seed, m_TimeZone), location); + } + if (now >= state.NextDays) + { + state.NextDays = now + m_DailySeconds; + DateTime localDate = TimeZoneInfo.ConvertTime(utc, m_TimeZone).Date; + for (int i = 0; i < 5; ++i) + { + comm.DeliverMessage(ChatTypeEnum.Region, m_Channel, + "OGLWeather", UUID.Zero, + OglWeatherModel.DayWire(localDate.AddDays(i + 1), + m_Seed, i, m_TimeZone), location); + } + } + } + catch (Exception ex) + { + // A weather failure must never interrupt a region frame. + Log.Warn("[OGL-WEATHER]: Region-Wetterbroadcast fehlgeschlagen.", ex); + } + } + + public void RemoveRegion(Scene scene) + { + if (scene == null) return; + if (m_Regions.TryRemove(scene.RegionInfo.RegionID, out RegionRuntime state)) + scene.EventManager.OnFrame -= state.Handler; + } + + public void Close() + { + m_Closing = true; + foreach (RegionRuntime state in m_Regions.Values) + state.Scene.EventManager.OnFrame -= state.Handler; + m_Regions.Clear(); + m_Enabled = false; + } + } +} diff --git a/addons/OGLSeasons/OpenGenesisLINK.Addons.OGLSeasons.csproj b/addons/OGLWeather/OpenGenesisLINK.Addons.OGLWeather.csproj similarity index 83% rename from addons/OGLSeasons/OpenGenesisLINK.Addons.OGLSeasons.csproj rename to addons/OGLWeather/OpenGenesisLINK.Addons.OGLWeather.csproj index 5090553b..5ba48348 100644 --- a/addons/OGLSeasons/OpenGenesisLINK.Addons.OGLSeasons.csproj +++ b/addons/OGLWeather/OpenGenesisLINK.Addons.OGLWeather.csproj @@ -2,7 +2,7 @@ net8.0 Library - OpenGenesisLINK.Addons.OGLSeasons + OpenGenesisLINK.Addons.OGLWeather disable disable false @@ -12,7 +12,6 @@ ../../bin/Nini.dllfalse ../../bin/Mono.Addins.dllfalse - ../../bin/OpenMetaverse.StructuredData.dllfalse ../../bin/OpenMetaverse.dllfalse ../../bin/OpenMetaverseTypes.dllfalse ../../bin/log4net.dllfalse diff --git a/addons/OGLWeather/README.md b/addons/OGLWeather/README.md new file mode 100644 index 00000000..44b26f53 --- /dev/null +++ b/addons/OGLWeather/README.md @@ -0,0 +1,69 @@ +# OGLWeather – OpenGenesisLINK Generation 1 + +**Eigenständiges Wetter-Addon (0.1.0 Dev)** für alle Regionen eines Simulatorprozesses. Ersetzt das eingestellte OGLSeasons-Projekt. Kein externer DWD-Dienst und **keine echte meteorologische Wettervorhersage**: Dies ist eine vollständig deterministische Wetter-Simulation. + +## Funktionen + +- Gemeinsamer Wetterplan für **alle geladenen Regionen desselben Simulators** über `ISharedRegionModule`. Kein regionaler Zufall, keine Wetterabweichungen zwischen Regionen. +- Bei identischem Seed und identischer Zeitzone stimmt das Wetter auch **zwischen unterschiedlichen Simulatorprozessen** überein – ganz ohne Netzbus-Abhängigkeit. +- Echte Uhren: lokale Zeit mit `TimeZone = Europe/Berlin` inklusive Sommer-/Winterzeit. +- Jahreszeitlich schwankende Tages- und Nachttemperaturen; alle sechs Stunden ein fester Regen-/Schnee-/Sonne-/Wolken-Abschnitt. Bei Temperaturen bis einschließlich 1°C wird Niederschlag als Schnee ausgewiesen, sonst Regen. +- Aktueller Wetterstatus: Zustand, Temperatur, Stärke und Wind. +- Fünf kommende Kalendertage: Wetterart, tatsächliches Tagesminimum/-maximum und Stunden mit Niederschlag. **Vorhersage und spätere Wirklichkeit sind das gleiche deterministische Modell** und ändern sich bei Neustart nicht, solange Seed, Zeitzone und Modellversion gleich bleiben. +- Kein Schreiben in Terrain, Estate-, Parcel- oder EEP-Einstellungen. Keine automatischen Rezzes auf fremden Grundstücken. Partikel werden ausschließlich durch freiwillig platzierte LSL-Emitter erzeugt. +- Jede Region empfängt die Statusdaten über ihren eigenen `IWorldComm`-Channel; die Region-Clients und Emitter müssen **nicht** gegenseitig per Grid-Chat kommunizieren. + +## Installation + +Im NexVerse-Quellbaum: + +```bash +# Nur bauen, NICHT in ROBUST installieren +bash addon-modules/OGLWeather/build.sh Release + +# Nur auf einem Simulator installieren +bash addon-modules/OGLWeather/build.sh Release --sim-bin /opt/developer/bin +``` + +INI-Beispiel `addons/OGLWeather/OGLWeather.ini.example` in die geladene `bin/config/` oder `bin/config-include/` des **Simulators** kopieren und gezielt aktivieren: + +```ini +[OGLWeather] +Enabled = true +WeatherSeed = 20261028 +TimeZone = "Europe/Berlin" +LSLChannel = -835311 +CurrentBroadcastSeconds = 60 +ForecastBroadcastSeconds = 300 +``` + +**Nicht** auf ROBUST installieren oder aktivieren. Mit `Enabled = false` ist das Modul inaktiv. Die genutzte DLL und Konfiguration erfordern einen Simulatorneustart. + +## Wetterpartikel + +`WeatherEmitter.lsl` kommt in ein unsichtbares Emitter-Prim der jeweiligen Region, idealerweise oberhalb des geplanten Niederschlagsbereichs. Die Effektfläche ist durch Viewer-Partikel begrenzt; für eine ganze 256×256-Region braucht es mehrere sinnvoll verteilte Emitter, **es regnet nicht allein durch Installation der DLL überall sichtbar**. Pro Emitter gibt es eine bewusst begrenzte Partikelrate; zu viele Emitter können Viewer-FPS beeinträchtigen. + +Die Emitter schalten bei Sonne/Wolken automatisch ab, bei Schnee/Regen die passende Partikelart ein. Bei abgeschaltetem Modul stoppen sie nach spätestens 240 Sekunden ohne Meldung. Ein optionales Partikel-Asset kann später ergänzt werden. + +## Wettertafel + +`WeatherForecastBoard.lsl` kommt in einen einzelnen Prim (standardmäßig Vorderseite `DISPLAY_FACE=3`): Status jetzt, Temperatur, Wind und fünf Tage mit Min/Max und Niederschlagsdauer. `osSetDynamicTextureDataFace` benötigt die entsprechende OSSL-Freigabe und VectorRender-Unterstützung. + +Beim Start wartet die Tafel auf alle fünf Forecast-Einträge und rendert **einmal**. Danach werden neue dynamische Textur-UUIDs nur angefordert, wenn die Daten geändert wurden. Der vorhandene dynamische Textur-Cache-Handoff von Generation 1 kann die Sichtbarkeit verbessern, aber **vollständig flackerfreie Viewer-Updates sind nicht garantiert**. + +## Berechtigungen und Protokoll + +Die Region sendet ausschließlich in-world `IWorldComm.DeliverMessage(ChatTypeEnum.Region, -835311, "OGLWeather", UUID.Zero, ...)`: +- `OGLWX|1|NOW|yyyy-MM-dd HH:00|sun/cloud/rain/snow|tempC|intensity|windKmh` +- `OGLWX|1|DAY|0..4|yyyy-MM-dd|sun/cloud/rain/snow|minC|maxC|precipitationHours` + +LSL akzeptiert ausschließlich die exakten Protokollkennungen, Channel, Quellnamen und `NULL_KEY` als serverseitige Quelle. Anonyme Avatar- oder Objekt-Chats gelten nicht als gültige Wetterdaten. + +## Tests und Betrieb + +- `tools/ci/OglWeatherRegression`: Prognose gegen tatsächliche zukünftige 24-Stunden-Zustände an 365 Tagen, mehrere Jahreszeiten, Temperatur-/Niederschlagsgrenzen, DST und identischer Seed. +- `tools/ci/verify_ogl_weather.py`: Build-/LSL-/Plugin-Vertrag, sichere Defaults und keine Reste der aktiven OGLSeasons-Integration. +- `.github/workflows/nexjast-ci.yml`: eigenständiger Release-Build und Regressionen. Historische Release-Dokumente bleiben unberührt. +- Live-Abnahme: mindestens zwei Regionen im selben Prozess, einige Wetter-Emitter, eine Wettertafel, Firestorm und OpenGenesisLINK Viewer. Zusätzlich anderen Simulatorprozess mit gleichem Seed auf dieselben Temperaturen prüfen. + +**Hinweis:** Das geplante Wetter ist garantierte **Spielwelt-Simulation**, nicht reale Wetterdaten aus der Umgebung. Änderungen an Seed, Zeitzone oder Algorithmen verändern die zukünftige Wetterkurve. Keine Wolken-/EEP-/Terraininteraktion in dieser ersten Entwicklungsstufe. diff --git a/addons/OGLWeather/WeatherEmitter.lsl b/addons/OGLWeather/WeatherEmitter.lsl new file mode 100644 index 00000000..790ffa6c --- /dev/null +++ b/addons/OGLWeather/WeatherEmitter.lsl @@ -0,0 +1,103 @@ +// STADT NEXVERSE - OGLWeather 0.1 +// In ein unsichtbares, nicht-physikalisches Prim pro Wetterbereich. +// Beispiel: 20-30 m Hoehe, mehrfach verteilt fuer 256m Regionen. +// Niederschlag ist LOKAL um jeden Emitter (Viewer-Partikel-Limit). +// Alle Regionen eines Simulatorprozesses empfangen dasselbe Wetter. +// Kein Scriptzugriff auf Fremdregionen, kein Terraforming. +integer CHANNEL = -835311; +string SOURCE = "OGLWeather"; +string gCondition = "sun"; +integer gIntensity; +integer gLastUpdate; + +particles() +{ + if (gCondition != "rain" && gCondition != "snow") + { + llParticleSystem([]); + return; + } + + integer snow = gCondition == "snow"; + vector color = snow ? <0.95, 0.97, 1.0> : <0.60, 0.75, 0.95>; + vector startScale = snow ? <0.16, 0.16, 0.0> : <0.035, 0.42, 0.0>; + vector endScale = snow ? <0.10, 0.10, 0.0> : <0.02, 0.25, 0.0>; + vector gravity = snow ? <0.3, 0.1, -0.9> : <0.1, 0.0, -5.5>; + float age = snow ? 7.0 : 5.0; + integer count = 1 + gIntensity / 18; + if (count > 6) count = 6; + if (count < 1) count = 1; + + llParticleSystem([ + PSYS_PART_FLAGS, + PSYS_PART_INTERP_COLOR_MASK | PSYS_PART_INTERP_SCALE_MASK, + PSYS_SRC_PATTERN, PSYS_SRC_PATTERN_EXPLODE, + PSYS_PART_START_COLOR, color, + PSYS_PART_END_COLOR, color, + PSYS_PART_START_ALPHA, 0.85, + PSYS_PART_END_ALPHA, 0.0, + PSYS_PART_START_SCALE, startScale, + PSYS_PART_END_SCALE, endScale, + PSYS_PART_MAX_AGE, age, + PSYS_SRC_BURST_RATE, 0.18, + PSYS_SRC_BURST_PART_COUNT, count, + PSYS_SRC_BURST_RADIUS, 8.0, + PSYS_SRC_BURST_SPEED_MIN, snow ? 0.1 : 0.4, + PSYS_SRC_BURST_SPEED_MAX, snow ? 0.9 : 1.6, + PSYS_SRC_ACCEL, gravity, + PSYS_SRC_MAX_AGE, 0.0 + ]); +} + +default +{ + state_entry() + { + llParticleSystem([]); + // Unsichtbarer Emitter-Prim; Partikel bleiben sichtbar. + llSetAlpha(0.0, ALL_SIDES); + llListen(CHANNEL, SOURCE, NULL_KEY, ""); + llSetTimerEvent(60.0); + } + + listen(integer channel, string name, key id, string message) + { + // Nur authentisch serverseitig eingespeiste Region-Nachrichten. + if (channel != CHANNEL || name != SOURCE || id != NULL_KEY) return; + list p = llParseStringKeepNulls(message, ["|"], []); + if (llGetListLength(p) != 8 || + llList2String(p, 0) != "OGLWX" || + llList2String(p, 1) != "1" || + llList2String(p, 2) != "NOW") return; + + string next = llList2String(p, 4); + if (next != "sun" && next != "cloud" && + next != "rain" && next != "snow") return; + + integer intensity = llList2Integer(p, 6); + if (intensity < 0 || intensity > 100) return; + gLastUpdate = llGetUnixTime(); + + // Nicht bei jeder 60-Sekunden-Nachricht Partikel neu starten. + if (next != gCondition || intensity != gIntensity) + { + gCondition = next; + gIntensity = intensity; + particles(); + } + } + + timer() + { + // Wettermodul offline -> niemals endlos regnen/schneien. + if (gLastUpdate != 0 && llGetUnixTime() - gLastUpdate > 240) + { + gLastUpdate = 0; + gCondition = "sun"; + gIntensity = 0; + llParticleSystem([]); + } + } + + on_rez(integer p) { llResetScript(); } +} diff --git a/addons/OGLWeather/WeatherForecastBoard.lsl b/addons/OGLWeather/WeatherForecastBoard.lsl new file mode 100644 index 00000000..d59bd847 --- /dev/null +++ b/addons/OGLWeather/WeatherForecastBoard.lsl @@ -0,0 +1,173 @@ +// STADT NEXVERSE - OGLWeather 0.1 +// Frontseite eines Prims: aktuelle Wetterlage + 5-Tage-Vorhersage. +// osSetDynamicTextureDataFace (OpenSimulator/OSSL) erforderlich. +// Neue Bild-UUID nur erzeugen, wenn sich etwas am Wetterbild aendert. +integer CHANNEL = -835311; +integer DISPLAY_FACE = 3; +string SOURCE = "OGLWeather"; + +string gCurrent = ""; +list gDays = ["", "", "", "", ""]; +string gRendered = ""; +integer gLastReceived = 0; + +string label(string code) +{ + if (code == "sun") return "Sonnig"; + if (code == "cloud") return "Bewoelkt"; + if (code == "rain") return "Regen"; + if (code == "snow") return "Schnee"; + return "Unbekannt"; +} + +draw() +{ + if (gCurrent == "") return; + // All five forecast records must arrive before the first draw. + // Avoid five consecutive new texture UUIDs during initial hydration. + integer loaded; + for (loaded = 0; loaded < 5; loaded++) + { + if (llList2String(gDays, loaded) == "") return; + } + string signature = gCurrent + llDumpList2String(gDays, ";"); + if (signature == gRendered) return; + + list now = llParseStringKeepNulls(gCurrent, ["|"], []); + string d = ""; + d = osSetPenColor(d, "black"); + d = osMovePen(d, 0, 0); + d = osDrawFilledRectangle(d, 1024, 512); + d = osSetFontName(d, "Arial"); + + d = osSetPenColor(d, "yellow"); + d = osSetFontSize(d, 40); + d = osMovePen(d, 30, 15); + d = osDrawText(d, "STADT NEXVERSE"); + + d = osSetPenColor(d, "white"); + d = osSetFontSize(d, 24); + d = osMovePen(d, 32, 74); + d = osDrawText(d, "WETTER | " + llGetRegionName()); + + d = osSetPenColor(d, "yellow"); + d = osSetFontSize(d, 25); + d = osMovePen(d, 35, 121); + d = osDrawText(d, "JETZT: " + label(llList2String(now, 4))); + + d = osSetPenColor(d, "white"); + d = osSetFontSize(d, 26); + d = osMovePen(d, 460, 121); + d = osDrawText(d, + llList2String(now, 5) + " C Wind " + + llList2String(now, 7) + " km/h"); + + d = osSetPenColor(d, "gray"); + d = osMovePen(d, 30, 160); + d = osDrawFilledRectangle(d, 964, 2); + + d = osSetPenColor(d, "yellow"); + d = osSetFontSize(d, 22); + d = osMovePen(d, 35, 170); + d = osDrawText(d, "5-TAGE-VORHERSAGE MIN / MAX"); + + integer i; + for (i = 0; i < 5; i++) + { + string row = llList2String(gDays, i); + integer y = 213 + i * 49; + d = osSetPenColor(d, "white"); + d = osSetFontSize(d, 23); + d = osMovePen(d, 35, y); + if (row != "") + { + list p = llParseStringKeepNulls(row, ["|"], []); + string date = llList2String(p, 4); + d = osDrawText(d, date); + d = osMovePen(d, 310, y); + d = osDrawText(d, label(llList2String(p, 5))); + d = osMovePen(d, 670, y); + d = osDrawText(d, + llList2String(p, 6) + " / " + + llList2String(p, 7) + " C"); + d = osMovePen(d, 844, y); + d = osDrawText(d, llList2String(p, 8) + "h nass"); + } + else + { + d = osDrawText(d, "Vorhersage wird geladen ..."); + } + } + + d = osSetPenColor(d, "gray"); + d = osSetFontSize(d, 17); + d = osMovePen(d, 36, 481); + d = osDrawText(d, "OGLWeather - simuliertes, verbindliches Grid-Wetter"); + + // Kein Weisssetzen/Texture-Reset vor dem naechsten Render. + osSetDynamicTextureDataFace("", "vector", d, + "width:1024,height:512,alpha:255,bgcolour:black", 0, DISPLAY_FACE); + gRendered = signature; +} + +default +{ + state_entry() + { + llSetLinkPrimitiveParamsFast(LINK_THIS, + [PRIM_FULLBRIGHT, DISPLAY_FACE, TRUE]); + llListen(CHANNEL, SOURCE, NULL_KEY, ""); + llSetTimerEvent(60.0); + // Vorhandene Face-Textur bewusst nicht loeschen. + } + + listen(integer channel, string name, key id, string message) + { + if (channel != CHANNEL || name != SOURCE || id != NULL_KEY) return; + list p = llParseStringKeepNulls(message, ["|"], []); + if (llList2String(p, 0) != "OGLWX" || + llList2String(p, 1) != "1") return; + string kind = llList2String(p, 2); + if (kind == "NOW" && llGetListLength(p) == 8) + { + string condition = llList2String(p, 4); + if (condition != "sun" && condition != "cloud" && + condition != "rain" && condition != "snow") return; + gCurrent = message; + } + else if (kind == "DAY" && llGetListLength(p) == 9) + { + integer index = llList2Integer(p, 3); + if (index < 0 || index > 4) return; + // At midnight clear stale five-day records as a batch. + if (index == 0) + { + string previous = llList2String(gDays, 0); + if (previous != "") + { + list old = llParseStringKeepNulls(previous, ["|"], []); + if (llList2String(old, 4) != llList2String(p, 4)) + gDays = ["", "", "", "", ""]; + } + } + gDays = llListReplaceList(gDays, [message], index, index); + } + else return; + + gLastReceived = llGetUnixTime(); + draw(); + } + + timer() + { + // Warnung anzeigen, wenn die Modul-Daten verschwunden sind. + if (gLastReceived != 0 && llGetUnixTime() - gLastReceived > 900) + { + llSetText("OGLWeather: Daten veraltet / Simulator-Modul offline", + <1.0, 0.65, 0.3>, 1.0); + } + else llSetText("", <1.0, 1.0, 1.0>, 0.0); + } + + on_rez(integer p) { llResetScript(); } +} diff --git a/doc/NexVerse/ROADMAP.md b/doc/NexVerse/ROADMAP.md index 68c7ffab..6e1dc59d 100644 --- a/doc/NexVerse/ROADMAP.md +++ b/doc/NexVerse/ROADMAP.md @@ -1541,15 +1541,27 @@ Eine sichtbare 5×5-Regionen-Anordnung wird angestrebt, aber nicht allein durch den Server garantiert; Firestorm-Sichtweite und Grid-Topologie sind maßgeblich. Dokumentation: [Extended Region Visibility](../OpenGenesisLINK/09313_EXTENDED_REGION_VISIBILITY.md). -### OGLSeasons — Nachfolge erst nach Stable 0.9.3.13 +### Generation 1 – OGLWeather ersetzt OGLSeasons -Das bisherige OGLSeasons-Addon wird in 0.9.3.13 **eingefroren**: -keine weiteren Feature-Änderungen, keine automatische Deinstallation und -kein 0.9.3.13-Release-Gate. Nach der Veröffentlichung wird die bisherige -Umsetzung im Rahmen eines gesonderten Projekts vollständig neu konzipiert. -Eine Entfernung oder Migration erfolgt erst nach ausdrücklichem -Kompatibilitäts- und Betreiberentscheid, damit bestehende Regionen nicht -unbeabsichtigt beschädigt werden. +Das frühere **OGLSeasons-Projekt wurde nach Betreiberentscheidung am +28.10.2026 eingestellt**. Quellcode, Build-Aufruf, EEP-Beispielskripte, +Regressionen und CI-Gates des alten Addons werden aus der Entwicklungslinie +entfernt. Historische 0.9.3.13-Releasenotizen bleiben unverändert. + +**OGLWeather 0.1.0 Dev** ist das neue, unabhängige Addon: ein +`ISharedRegionModule` synchronisiert simuliertes Wetter auf allen Regionen +desselben Simulatorprozesses. LSL-Emitter visualisieren Regen/Schnee; eine +1024×512-Wettertafel zeigt aktuelle Lage, Temperatur und die nächsten fünf Tage. +Vorhersage und später eintretender Wetterverlauf beruhen auf einem +deterministischen Zeitplan (keine Live-DWD-Daten). Das Addon bleibt bis zur +Live-Abnahme auf Produktionssimulatoren deaktiviert; kein automatischer +Objekt-Rez und keine EEP-/Estate-Änderungen. + +Wichtige Migrationsregel: Auf bereits laufenden Simulatoren muss eine +vorhandene `OpenGenesisLINK.Addons.OGLSeasons.dll` beim Update **gezielt** +entfernt oder isoliert werden; GitHub-Quellcode-Löschung entfernt keine DLLs +von Produktionshosts. Vorher eventuell vorhandene OGLSeasons-Emitter/Skripte +identifizieren und durch OGLWeather ersetzen. --- diff --git a/runprebuild.sh b/runprebuild.sh index bf2e3f0c..cc13cb97 100755 --- a/runprebuild.sh +++ b/runprebuild.sh @@ -20,7 +20,7 @@ case "$1" in cp bin/System.Drawing.Common.dll.linux bin/System.Drawing.Common.dll dotnet bin/prebuild.dll /target vs2022 /targetframework net8_0 /excludedir = "obj | bin" /file prebuild.xml - printf '%s\n' '#!/bin/sh' 'set -e' 'dotnet build -c Release OpenSim.sln' 'bash addon-modules/OGLAssetService/build.sh Release' 'bash addon-modules/OGLSeasons/build.sh Release' > compile.sh + printf '%s\n' '#!/bin/sh' 'set -e' 'dotnet build -c Release OpenSim.sln' 'bash addon-modules/OGLAssetService/build.sh Release' 'bash addon-modules/OGLWeather/build.sh Release' > compile.sh chmod +x compile.sh ;; diff --git a/tools/ci/OglSeasonsEepRegression/OglSeasonsEepRegression.csproj b/tools/ci/OglSeasonsEepRegression/OglSeasonsEepRegression.csproj deleted file mode 100644 index ff513439..00000000 --- a/tools/ci/OglSeasonsEepRegression/OglSeasonsEepRegression.csproj +++ /dev/null @@ -1,15 +0,0 @@ - - - net8.0 - Exe - OglSeasonsEepRegression - disable - disable - - - - ../../../bin/OpenMetaverse.StructuredData.dlltrue - ../../../bin/OpenMetaverse.dll - ../../../bin/OpenMetaverseTypes.dll - - \ No newline at end of file diff --git a/tools/ci/OglSeasonsEepRegression/Program.cs b/tools/ci/OglSeasonsEepRegression/Program.cs deleted file mode 100644 index 0e72725f..00000000 --- a/tools/ci/OglSeasonsEepRegression/Program.cs +++ /dev/null @@ -1,104 +0,0 @@ -// SPDX-License-Identifier: MPL-2.0 -using System; -using OpenMetaverse.StructuredData; -using OpenSim.Framework; -using OpenGenesisLINK.Addons.OGLSeasons; - -internal static class Program -{ - private static void Require(bool condition, string what) - { - if (!condition) throw new Exception("EEP regression: " + what); - } - - private static OSDMap GetFrames(ViewerEnvironment v) - { - var root = (OSDMap)v.ToOSD(); - return (OSDMap)((OSDMap)root["day_cycle"])["frames"]; - } - - private static void VerifyAddinRegistrationMetadata() - { - // Verify compiled attributes, not only the source code text: Mono.Addins - // resolves extension points using the declaring root's add-in identity. - bool foundSeasonsAddin = false; - bool foundFrameworkDependency = false; - foreach (var attribute in typeof(OglSeasonsRegionModule).Assembly.GetCustomAttributesData()) - { - if (attribute.AttributeType.FullName == "Mono.Addins.AddinAttribute" && - attribute.ConstructorArguments.Count > 0 && - (string)attribute.ConstructorArguments[0].Value == "OGLSeasons") - { - foreach (var named in attribute.NamedArguments) - if (named.MemberName == "Namespace" && - (string)named.TypedValue.Value == "OpenGenesisLINK") - foundSeasonsAddin = true; - } - if (attribute.AttributeType.FullName == "Mono.Addins.AddinDependencyAttribute" && - attribute.ConstructorArguments.Count > 0 && - (string)attribute.ConstructorArguments[0].Value == "::OpenSim.Region.Framework") - foundFrameworkDependency = true; - } - Require(foundSeasonsAddin, "canonical OpenGenesisLINK.OGLSeasons add-in identity"); - Require(foundFrameworkDependency, "globally qualified dependency on /OpenSim/RegionModules provider"); - - bool foundRoot = false; - foreach (var attribute in typeof(OpenSim.Region.Framework.Interfaces.IRegionModuleBase) - .Assembly.GetCustomAttributesData()) - if (attribute.AttributeType.FullName == "Mono.Addins.AddinRootAttribute" && - attribute.ConstructorArguments.Count > 0 && - (string)attribute.ConstructorArguments[0].Value == "OpenSim.Region.Framework") - foundRoot = true; - Require(foundRoot, "region framework root add-in exists"); - } - - public static void Main() - { - VerifyAddinRegistrationMetadata(); - // This fixture exercises the genuine OpenSim EEP serializer, not - // a mock or a file-based substitute. FromLightShare provides a - // valid sky+water daycycle with deterministic test data. - var env = new ViewerEnvironment(); - env.FromLightShare(new RegionLightShareData()); - string original = ViewerEnvironment.ToOSDString(env); - var first = SeasonWeatherModel.Calculate( - new DateTimeOffset(2026, 12, 15, 12, 0, 0, TimeSpan.Zero), - Guid.Parse("46d88f05-fb22-4a13-bf8d-1f6842182739")); - - ViewerEnvironment overlay = env.Clone(); - Require(OglSeasonalEepOverlay.TransformSkyFrames(overlay, first), - "valid sky frames transformed"); - Require(ViewerEnvironment.ToOSDString(env) == original, - "source must remain unchanged"); - Require(env.DayLength == overlay.DayLength && env.DayOffset == overlay.DayOffset, - "day cycle timing preserved"); - var sourceFrames = GetFrames(env); - var resultFrames = GetFrames(overlay); - Require(sourceFrames.Count == resultFrames.Count, "frame count preserved"); - int skyCount = 0; - foreach (System.Collections.Generic.KeyValuePair frame in sourceFrames) - { - var before = (OSDMap)frame.Value; - var after = (OSDMap)resultFrames[frame.Key]; - if (before["type"].AsString() == "water") - { - Require(OSDParser.SerializeLLSDXmlString(before) == - OSDParser.SerializeLLSDXmlString(after), - "water settings must not change"); - continue; - } - if (before["type"].AsString() != "sky") continue; - skyCount++; - Require(before["sun_rotation"].AsString() == after["sun_rotation"].AsString(), - "sun position not overwritten"); - Require(before["cloud_shadow"].AsReal() != after["cloud_shadow"].AsReal(), - "weather cloud cover must change"); - } - Require(skyCount > 0, "sky asset frames exercised"); - Require(!OglSeasonalEepOverlay.TransformSkyFrames(null, first), - "null environment rejected"); - Require(!OglSeasonalEepOverlay.TransformSkyFrames(overlay, null), - "null weather rejected"); - Console.WriteLine("OGL Seasons EEP: cloud/fog overlay, preserved daylight/water and input isolation: OK"); - } -} \ No newline at end of file diff --git a/tools/ci/OglSeasonsRegression/Program.cs b/tools/ci/OglSeasonsRegression/Program.cs deleted file mode 100644 index 6f099cb6..00000000 --- a/tools/ci/OglSeasonsRegression/Program.cs +++ /dev/null @@ -1,81 +0,0 @@ -// SPDX-License-Identifier: MPL-2.0 -using System; -using OpenGenesisLINK.Addons.OGLSeasons; - -static class Program -{ - private static void Require(bool pass, string message) - { - if (!pass) throw new Exception("OGLSeasons regression: " + message); - } - - private static DateTimeOffset Utc(int year, int month, int day, int hour = 12, int minute = 0) - => new DateTimeOffset(year, month, day, hour, minute, 0, TimeSpan.Zero); - - public static void Main() - { - Guid regionA = Guid.Parse("3a111111-1111-4111-8111-111111111111"); - Guid regionB = Guid.Parse("3a222222-2222-4222-8222-222222222222"); - // Europe/Berlin time (including DST boundaries), not UTC month. - Require(SeasonWeatherModel.ResolveSeason(Utc(2026, 2, 28, 22)) == OglSeason.Winter, "winter end"); - Require(SeasonWeatherModel.ResolveSeason(Utc(2026, 2, 28, 23)) == OglSeason.Fruehling, "spring starts at local midnight"); - Require(SeasonWeatherModel.ResolveSeason(Utc(2026, 5, 31, 22)) == OglSeason.Sommer, "summer starts with CEST"); - Require(SeasonWeatherModel.ResolveSeason(Utc(2026, 8, 31, 22)) == OglSeason.Herbst, "autumn starts with CEST"); - Require(SeasonWeatherModel.ResolveSeason(Utc(2026, 11, 30, 23)) == OglSeason.Winter, "winter starts with CET"); - Require(SeasonWeatherModel.GermanZone.Id != null, "valid German timezone"); - // The repeated local hour at the autumn DST rollback must not - // produce a bogus UTC future window boundary. - var fallFirst = Utc(2026, 10, 25, 0, 15); - var fallSecond = Utc(2026, 10, 25, 1, 15); - var firstHour = SeasonWeatherModel.Calculate(fallFirst, regionA); - var secondHour = SeasonWeatherModel.Calculate(fallSecond, regionA); - Require(firstHour.ValidFromUtc == Utc(2026, 10, 25, 0), "DST fallback first 02:xx valid-from"); - Require(secondHour.ValidFromUtc == Utc(2026, 10, 25, 1), "DST fallback second 02:xx valid-from"); - Require(firstHour.ValidFromUtc <= fallFirst && secondHour.ValidFromUtc <= fallSecond, - "no future weather period at DST rollback"); - Require(SeasonWeatherModel.Calculate(Utc(2026, 3, 29, 1, 3), regionA).ValidFromUtc - <= Utc(2026, 3, 29, 1, 3), "spring DST forward valid-from"); - // Same weather zone across independent region IDs and simulators - // guarantees a shared local weather pattern. - var alignedA = SeasonWeatherModel.Calculate(Utc(2026, 10, 21), regionA, - weatherZone: "Freiburg"); - var alignedB = SeasonWeatherModel.Calculate(Utc(2026, 10, 21), regionB, - weatherZone: " freiburg "); - Require(alignedA.ToProtocol() == alignedB.ToProtocol(), - "shared zone weather must match across region IDs"); - var cold = SeasonWeatherModel.Calculate(Utc(2026, 10, 21), regionA, - weatherZone: "Freiburg", temperatureOffsetC: -4); - Require(cold.TemperatureC == alignedA.TemperatureC - 4 || - (alignedA.Weather == OglWeather.Hitzewelle && cold.Weather == OglWeather.Hitzewelle), - "negative microclimate temperature offset"); - try { SeasonWeatherModel.Calculate(Utc(2026, 1, 1), regionA, temperatureOffsetC: 20); - throw new Exception("expected climate offset range exception"); } - catch (ArgumentOutOfRangeException) { } - try { SeasonWeatherModel.Calculate(Utc(2026, 1, 1), regionA, - weatherZone: new string('Z', 81)); - throw new Exception("expected zone name length exception"); } - catch (ArgumentOutOfRangeException) { } - - OglWeatherState one = SeasonWeatherModel.Calculate(Utc(2026, 10, 21, 10, 0), regionA); - OglWeatherState two = SeasonWeatherModel.Calculate(Utc(2026, 10, 21, 10, 9), regionA); - Require(one.ToProtocol() == two.ToProtocol(), "stable state within 30-minute window"); - Require(one.ToProtocol().Split('|').Length == 9, "LSL protocol fields"); - Require(one.WeatherKey == one.Weather.ToString().ToLowerInvariant(), "weather key"); - bool differs = false; - for (int h = 0; h < 48; h++) - { - DateTimeOffset time = Utc(2026, 10, 21, 0).AddMinutes(h * 30); - var a = SeasonWeatherModel.Calculate(time, regionA); - var b = SeasonWeatherModel.Calculate(time, regionB); - if (a.ToProtocol() != b.ToProtocol()) differs = true; - Require(a.Intensity >= 0 && a.Intensity <= 100, "intensity bounds"); - Require(a.WindKmh >= 0 && a.HumidityPercent is >= 40 and <= 96, "wind/humidity bounds"); - if (a.Weather is OglWeather.Schneefall or OglWeather.Schneesturm) - Require(a.TemperatureC <= 2, "snow only when cold"); - } - Require(differs, "region-specific weather variation"); - try { SeasonWeatherModel.Calculate(Utc(2026, 1, 1), regionA, 17); throw new Exception("expected range exception"); } - catch (ArgumentOutOfRangeException) { } - Console.WriteLine("OGLSeasons: DE-Kalender, Wetterfenster, Regionstreuung, Schnee-/Windgrenzen, Protokoll: OK"); - } -} diff --git a/tools/ci/OglSeasonsRegression/OglSeasonsRegression.csproj b/tools/ci/OglWeatherRegression/OglWeatherRegression.csproj similarity index 58% rename from tools/ci/OglSeasonsRegression/OglSeasonsRegression.csproj rename to tools/ci/OglWeatherRegression/OglWeatherRegression.csproj index 8500fc34..b1f10a6a 100644 --- a/tools/ci/OglSeasonsRegression/OglSeasonsRegression.csproj +++ b/tools/ci/OglWeatherRegression/OglWeatherRegression.csproj @@ -1,13 +1,11 @@ - net8.0 Exe + net8.0 disable disable - false - - + diff --git a/tools/ci/OglWeatherRegression/Program.cs b/tools/ci/OglWeatherRegression/Program.cs new file mode 100644 index 00000000..5e6a227b --- /dev/null +++ b/tools/ci/OglWeatherRegression/Program.cs @@ -0,0 +1,97 @@ +using System; +using OpenGenesisLINK.Addons.OGLWeather; + +internal static class Program +{ + private static int checks; + private static void Require(bool condition, string message) + { + ++checks; + if (!condition) throw new InvalidOperationException("OGLWeather: " + message); + } + + public static void Main() + { + TimeZoneInfo berlin = TimeZoneInfo.FindSystemTimeZoneById("Europe/Berlin"); + int seed = 20261028; + var now = new DateTimeOffset(2026, 10, 28, 16, 0, 0, TimeSpan.Zero); + WeatherReading same1 = OglWeatherModel.At(now, seed, berlin); + WeatherReading same2 = OglWeatherModel.At(now, seed, berlin); + Require(same1.Condition == same2.Condition && same1.TemperatureC == same2.TemperatureC, + "identical time and seed on independent regions must agree"); + Require(OglWeatherModel.NowWire(now, seed, berlin).StartsWith("OGLWX|1|NOW|"), + "CURRENT LSL wire contract"); + + // One year of predicted future days (including winter/summer, 2027 DST) + // is compared against all 24 values that WILL occur in the same model. + int wetDays = 0, snowDays = 0, dryDays = 0; + DateTime start = new DateTime(2026, 10, 29); + for (int d = 0; d < 365; ++d) + { + DateTime day = start.AddDays(d); + WeatherDay prediction = OglWeatherModel.ForecastDay(day, seed, berlin); + Require(prediction.MinC <= prediction.MaxC, "daily temperature limits"); + int countedWet = 0; + bool sawRain = false, sawSnow = false; + int min = int.MaxValue, max = int.MinValue; + DateTime dayStartUtc = TimeZoneInfo.ConvertTimeToUtc( + DateTime.SpecifyKind(day.Date, DateTimeKind.Unspecified), berlin); + DateTime dayEndUtc = TimeZoneInfo.ConvertTimeToUtc( + DateTime.SpecifyKind(day.Date.AddDays(1), DateTimeKind.Unspecified), berlin); + for (DateTime hourUtc = dayStartUtc; hourUtc < dayEndUtc; + hourUtc = hourUtc.AddHours(1)) + { + DateTime observedLocal = TimeZoneInfo.ConvertTimeFromUtc(hourUtc, berlin); + WeatherReading observed = OglWeatherModel.AtLocal(observedLocal, seed); + min = Math.Min(min, observed.TemperatureC); + max = Math.Max(max, observed.TemperatureC); + if (observed.Condition == "rain" || observed.Condition == "snow") countedWet++; + if (observed.Condition == "rain") sawRain = true; + if (observed.Condition == "snow") sawSnow = true; + Require(observed.Condition != "snow" || observed.TemperatureC <= 1, + "snow requires freezing temperatures"); + Require(observed.Condition != "rain" || observed.TemperatureC > 1, + "rain requires positive temperatures"); + Require(observed.Intensity >= 0 && observed.Intensity <= 100, + "particle intensity bounded"); + } + Require(prediction.MinC == min && prediction.MaxC == max, + "forecast min/max equal actual readings"); + Require(prediction.PrecipitationHours == countedWet, + "forecast wet hours equal actual rain/snow hours"); + Require(prediction.Condition != "rain" || sawRain, + "daily rain prediction must actually rain"); + Require(prediction.Condition != "snow" || sawSnow, + "daily snow prediction must actually snow"); + Require(OglWeatherModel.DayWire(day, seed, d % 5, berlin).StartsWith("OGLWX|1|DAY|"), + "DAY LSL wire contract"); + if (countedWet > 0) wetDays++; else dryDays++; + if (sawSnow) snowDays++; + } + Require(wetDays > 30 && dryDays > 5 && snowDays > 0, + "plausible variety across all seasons"); + Require((TimeZoneInfo.ConvertTimeToUtc(new DateTime(2027, 3, 29), berlin) - + TimeZoneInfo.ConvertTimeToUtc(new DateTime(2027, 3, 28), berlin)).TotalHours == 23, + "DST spring starts a 23-hour local calendar day"); + Require((TimeZoneInfo.ConvertTimeToUtc(new DateTime(2027, 11, 1), berlin) - + TimeZoneInfo.ConvertTimeToUtc(new DateTime(2027, 10, 31), berlin)).TotalHours == 25, + "DST autumn starts a 25-hour local calendar day"); + + // Berlin clock moves forward and back; the day-based simulator climate + // remains stable under repeated queries and server restart. + foreach (DateTimeOffset instant in new[] { + new DateTimeOffset(2027, 3, 28, 0, 30, 0, TimeSpan.Zero), + new DateTimeOffset(2027, 3, 28, 1, 30, 0, TimeSpan.Zero), + new DateTimeOffset(2027, 10, 31, 0, 30, 0, TimeSpan.Zero), + new DateTimeOffset(2027, 10, 31, 1, 30, 0, TimeSpan.Zero) + }) + { + string first = OglWeatherModel.NowWire(instant, seed, berlin); + string second = OglWeatherModel.NowWire(instant, seed, berlin); + Require(first == second, "DST and restart yield same weather schedule"); + } + + Console.WriteLine("OGLWeather: " + checks + " checks PASS, " + + wetDays + " wet days, " + dryDays + " dry days, " + snowDays + " snowy days"); + } +} diff --git a/tools/ci/verify_ogl_seasons.py b/tools/ci/verify_ogl_seasons.py deleted file mode 100644 index f972c8c7..00000000 --- a/tools/ci/verify_ogl_seasons.py +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env python3 -"""Feature boundary and build wiring for opt-in OGL seasons addon.""" -from pathlib import Path -model = Path("addons/OGLSeasons/SeasonWeatherModel.cs").read_text(encoding="utf-8") -module = Path("addons/OGLSeasons/OglSeasonsRegionModule.cs").read_text(encoding="utf-8") -config = Path("addons/OGLSeasons/OGLSeasons.ini.example").read_text(encoding="utf-8") -emitter = Path("addons/OGLSeasons/WeatherEmitter.lsl").read_text(encoding="utf-8") -build = Path("addon-modules/OGLSeasons/build.sh").read_text(encoding="utf-8") -prebuild = Path("runprebuild.sh").read_text(encoding="utf-8") -ci = Path(".github/workflows/nexjast-ci.yml").read_text(encoding="utf-8") -for marker in ("ResolveSeason(", "Europe/Berlin", "WeatherIntervalMinutes", - "OglWeather.Schneefall", "OglWeather.Sturm", "OglWeather.Gewitter", - "humidity", "OGLSEASONS|1|"): - assert marker.lower() in (model+module).lower(), marker -assert 'settings?.GetBoolean("Enabled", false)' in module, "must be disabled by default" -for marker in ("INonSharedRegionModule", "IWorldComm", "OnFrame += OnFrame", - "OnFrame -= OnFrame", "RegisterModuleInterface", - "UnregisterModuleInterface", "DeliverMessage("): - assert marker in module, marker -assert "Enabled = false" in config -assert "AllowedRegions" in config -assert 'WeatherZone = ""' in config and "TemperatureOffsetC = 0" in config -assert 'weatherZone.Trim().Normalize(NormalizationForm.FormKC)' in model -assert 'new DateTimeOffset(localStart, local.Offset)' in model -assert 'settings.GetString("WeatherZone", "")' in module -assert 'settings.GetInt("TemperatureOffsetC", 0)' in module -assert "llParticleSystem([])" in emitter -assert "llListen(CHANNEL, SOURCE_NAME" in emitter -assert "OGLSEASONS" in emitter -assert "id != NULL_KEY" in emitter -assert "if (count > 5) count = 5;" in emitter -assert 'm_weather == "sturm"' in emitter -# Region modules must explicitly depend on the add-in root defining -# /OpenSim/RegionModules. Otherwise Mono.Addins silently skips discovery. -assert '[assembly: Addin("OGLSeasons", Namespace = "OpenGenesisLINK", Version = "0.1.1")]' in module -assert '[assembly: AddinDependency("::OpenSim.Region.Framework", OpenSim.VersionInfo.VersionNumber)]' in module, "framework dependency must be globally qualified, not OpenGenesisLINK.OpenSim.Region.Framework" -assert 'AddinDependency("OpenSim.Region.Framework"' not in module, "relative dependency breaks Mono.Addins region module startup" -assert 'Addin("OpenGenesisLINK.OGLSeasons", Namespace = "OpenGenesisLINK"' not in module -assert "OGLSeasons.dll" in build -# Plain ROBUST/CI builds must not load a simulator-only Mono.Addins plugin. -assert "--sim-bin" in build, "installation must explicitly target a simulator" -assert 'install -m 0644 "$DLL" "$SIM_BIN/OpenGenesisLINK.Addons.OGLSeasons.dll"' in build -assert 'SIM_BIN' in build and '*/robust/bin' in build -assert 'OpenSim.Region.Framework.dll' in build -assert 'cp "$OUT/OpenGenesisLINK.Addons.OGLSeasons.dll" bin/' not in build -assert "mkdir -p bin" not in build - -assert "addon-modules/OGLSeasons/build.sh Release" in prebuild -assert "tools/ci/OglSeasonsRegression/OglSeasonsRegression.csproj" in ci -assert "tools/ci/verify_ogl_seasons.py" in ci -assert "addon-modules/OGLSeasons/build.sh Release" in ci -assert "StoreOnRegion(" not in module, "must not overwrite EEP" -assert "SetTerrain" not in module, "must not edit terrain" -print("OGLSeasons addon opt-in, bounded weather signaling and build contract: OK") diff --git a/tools/ci/verify_ogl_seasons_eep.py b/tools/ci/verify_ogl_seasons_eep.py deleted file mode 100644 index 80a5763b..00000000 --- a/tools/ci/verify_ogl_seasons_eep.py +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env python3 -"""Safety contract for opt-in nonpersistent seasons EEP and landscape visuals.""" -from pathlib import Path -root = Path("addons/OGLSeasons") -overlay = (root/"OglSeasonalEepOverlay.cs").read_text(encoding="utf-8") -module = (root/"OglSeasonsRegionModule.cs").read_text(encoding="utf-8") -landscape = (root/"SeasonalLandscape.lsl").read_text(encoding="utf-8") -config = (root/"OGLSeasons.ini.example").read_text(encoding="utf-8") -ci = Path(".github/workflows/nexjast-ci.yml").read_text(encoding="utf-8") -for marker in ("EnableEepOverlay = false", "AllowCustomRegionEep = false"): - assert marker in config, marker -for marker in ('settings.GetBoolean("EnableEepOverlay", false)', - 'settings.GetBoolean("AllowCustomRegionEep", false)', - "m_EepOverlay?.Restore()", "m_EepOverlay.Apply(next)"): - assert marker in module, marker -for marker in ("RegionEnvironment = overlay", "ReferenceEquals(current, m_Applied)", - "ReferenceEquals(m_Scene.RegionEnvironment, m_Applied)", - "GetRegionEnvironment()", "m_Scene.RegionEnvironment = m_Previous", - "WindlightRefresh(10)", 'sky["cloud_shadow"]', - 'sky["cloud_color"]', 'sky["cloud_variance"]', - 'sky.TryGetValue("legacy_haze"', "TransformSkyFrames("): - assert marker in overlay, marker -for forbidden in ("StoreOnRegion(", "StoreRegionEnvironmentSettings(", "SetTerrain", - "File.WriteAllText(", "ResetEnvironmentSettings("): - assert forbidden not in overlay, "EEP overlay must not persist data: " + forbidden -for marker in ("llSetLinkAlpha", "llGetOwner()", "id != NULL_KEY", - "llGetNumberOfPrims()", "CHANGED_LINK", "setSeason(0)"): - assert marker in landscape, marker -for forbidden in ("llSetTexture(", "llSetLinkTexture(", "llSetPrimitiveParams(", - "llGiveMoney(", "llMessageLinked("): - assert forbidden not in landscape, forbidden -assert "tools/ci/OglSeasonsEepRegression/OglSeasonsEepRegression.csproj" in ci -assert "tools/ci/verify_ogl_seasons_eep.py" in ci -print("OGL Seasons EEP visual overlay: nonpersistent/opt-in and landscape safety: OK") diff --git a/tools/ci/verify_ogl_weather.py b/tools/ci/verify_ogl_weather.py new file mode 100644 index 00000000..360234a4 --- /dev/null +++ b/tools/ci/verify_ogl_weather.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python3 +"""Fail-closed checks for isolated, simulator-wide OGLWeather add-on.""" +from pathlib import Path +root = Path(__file__).resolve().parents[2] +def read(path): + return (root / path).read_text(encoding="utf-8-sig") + +model = read("addons/OGLWeather/OglWeatherModel.cs") +module = read("addons/OGLWeather/OglWeatherRegionModule.cs") +emitter = read("addons/OGLWeather/WeatherEmitter.lsl") +board = read("addons/OGLWeather/WeatherForecastBoard.lsl") +config = read("addons/OGLWeather/OGLWeather.ini.example") +builder = read("addon-modules/OGLWeather/build.sh") +csproj = read("addons/OGLWeather/OpenGenesisLINK.Addons.OGLWeather.csproj") +workflow = read(".github/workflows/nexjast-ci.yml") +for term in ("public static WeatherReading At(", "public static WeatherDay ForecastDay(", + "TimeZoneInfo.ConvertTimeFromUtc(hourUtc, zone)", "NowWire(", "DayWire(", + '"OGLWX|1|NOW|"', '"OGLWX|1|DAY|"'): + assert term in model, term +for term in ("ISharedRegionModule", 'Id = "OGLWeather"', + "ConcurrentDictionary", + "IWorldComm", "EventManager.OnFrame", + 'Configs["OGLWeather"]', '"Enabled", false', + 'm_Regions.TryAdd(', "m_Channel", + 'comm.DeliverMessage(ChatTypeEnum.Region', + '"OGLWeather", UUID.Zero', "localDate.AddDays(i + 1)", + "state.Scene.EventManager.OnFrame -= state.Handler", + "m_Regions.Clear();"): + assert term in module, term +assert "INonSharedRegionModule" not in module +assert "OGLSeasons" not in module and "OGLSeasons" not in model +assert "Enabled = false" in config and 'TimeZone = "Europe/Berlin"' in config +assert "WeatherSeed = 20261028" in config +assert "llParticleSystem(" in emitter and "llListen(CHANNEL, SOURCE, NULL_KEY" in emitter +assert "llGetUnixTime() - gLastUpdate > 240" in emitter +assert 'id != NULL_KEY' in emitter +assert "osSetDynamicTextureDataFace(" in board +assert "gRendered = signature" in board +assert "llSetTexture(" not in board +assert "OGLWeather" in csproj +assert "robust/bin" in builder and "--sim-bin" in builder +assert "Weather Forecast regression" in workflow +assert not (root / "addons/OGLSeasons").exists(), "retired addon sources still tracked" +assert not (root / "addon-modules/OGLSeasons").exists(), "retired build scripts still tracked" +for path in ( + "tools/ci/verify_ogl_seasons.py", + "tools/ci/verify_ogl_seasons_eep.py", + "tools/ci/OglSeasonsRegression", + "tools/ci/OglSeasonsEepRegression", +): + assert not (root / path).exists(), "old weather test survived: " + path +assert "OGLSeasons" not in workflow, "obsolete CI weather gate still active" +assert "OGLSeasons" not in read("runprebuild.sh"), "obsolete compile step still active" +assert "OGLWeather" in read("runprebuild.sh"), "new addon missing from compile script" +print("OGLWeather static contracts: simulator-wide, deterministic, opt-in, LSL and isolation PASS")