feat(gen1): complete inworld LSL companion packs for NexTraffic, NexTransit, NexSmartLight and OGLWeather (#340)
* feat(lsl): add practical city and weather inworld companion script * feat(lsl): add practical city and weather inworld companion script * feat(lsl): add practical city and weather inworld companion script * feat(lsl): add practical city and weather inworld companion script * feat(lsl): add practical city and weather inworld companion script * feat(lsl): add practical city and weather inworld companion script * feat(lsl): add practical city and weather inworld companion script * feat(lsl): add practical city and weather inworld companion script * feat(lsl): add practical city and weather inworld companion script * fix(nextraffic): update countdown every second without changing lamp prims; fail-safe on stale signal * fix(lsl): correct NexTraffic multiline hovertext newline escape * fix(nextransit): validate full timetable and correctly handle empty route broadcasts before dynamic texture rendering * docs(gen1): complete 13-script traffic, transit, lighting and weather inworld setup guide * test(gen1): static protocol, safety and LSL API checks for all 13 companion scripts * ci(gen1): verify 13 inworld LSL scripts in default NexVerse CI * ci(gen1): guard registration of all Inworld LSL script checks * docs(nextraffic): link complete 13-script inworld installation manual * docs(nextransit): link complete 13-script inworld installation manual * docs(nexsmartlight): link complete 13-script inworld installation manual * docs(oglweather): link complete 13-script inworld installation manual * fix(ci): use existing OglWeatherRegionModule class path for LSL protocol verification * fix(nextraffic): replace signal script with forward-safe portable LSL and authoritative countdown
This commit is contained in:
1 parent
655bf90c38
commit
b40d8713d1
19 files changed
+993
-45
No files matched your search
@@ -436,6 +436,12 @@ jobs:
|
||||
dotnet run --configuration Release --project tools/ci/OglWeatherRegression/OglWeatherRegression.csproj
|
||||
bash addon-modules/OGLWeather/build.sh Release
|
||||
|
||||
- name: Verify Generation-1 Inworld LSL companion scripts
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
python3 tools/ci/verify_gen1_inworld_lsl_packs.py
|
||||
|
||||
- name: Regression-test Nex city modules and build independent addons
|
||||
shell: bash
|
||||
run: |
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
// NexSmartLight - controls all lamp parts named LIGHT_* in one linked object.
|
||||
// Only named lamp prims are affected; avoid changing the rest of the model.
|
||||
// Requires the server's NexSmartLight module; no 30s polling.
|
||||
integer CHANNEL = -835423;
|
||||
string PREFIX = "LIGHT_";
|
||||
integer SERVER_TIMEOUT = 300;
|
||||
integer FALLBACK_TO_SIM_SUN = FALSE;
|
||||
integer gLast = 0;
|
||||
integer gMode = -1;
|
||||
vector LIGHT_COLOR = <1.0, 0.88, 0.68>;
|
||||
float LIGHT_INTENSITY = 0.95;
|
||||
float LIGHT_RADIUS = 13.0;
|
||||
float LIGHT_FALLOFF = 0.5;
|
||||
|
||||
switchLights(integer on)
|
||||
{
|
||||
if (on == gMode) return;
|
||||
gMode = on;
|
||||
integer i;
|
||||
integer total = llGetNumberOfPrims();
|
||||
for (i = 1; i <= total; i++)
|
||||
{
|
||||
string name = llToUpper(llGetLinkName(i));
|
||||
if (llSubStringIndex(name, PREFIX) == 0)
|
||||
{
|
||||
float glow = 0.0;
|
||||
if (on) glow = 0.06;
|
||||
llSetLinkPrimitiveParamsFast(i, [
|
||||
PRIM_POINT_LIGHT, on, LIGHT_COLOR, LIGHT_INTENSITY,
|
||||
LIGHT_RADIUS, LIGHT_FALLOFF,
|
||||
PRIM_FULLBRIGHT, ALL_SIDES, on,
|
||||
PRIM_GLOW, ALL_SIDES, glow
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
default
|
||||
{
|
||||
state_entry()
|
||||
{
|
||||
llListen(CHANNEL, "NexSmartLight", NULL_KEY, "");
|
||||
switchLights(FALSE);
|
||||
llSetTimerEvent(120.0);
|
||||
}
|
||||
listen(integer channel, string name, key id, string message)
|
||||
{
|
||||
if (channel != CHANNEL || name != "NexSmartLight" || id != NULL_KEY)
|
||||
return;
|
||||
list f = llParseStringKeepNulls(message, ["|"], []);
|
||||
if (llGetListLength(f) != 4 ||
|
||||
llList2String(f, 0) != "NEXLIGHT" ||
|
||||
llList2String(f, 1) != "1") return;
|
||||
string mode = llList2String(f, 2);
|
||||
if (mode != "ON" && mode != "OFF") return;
|
||||
gLast = llGetUnixTime();
|
||||
switchLights(mode == "ON");
|
||||
}
|
||||
timer()
|
||||
{
|
||||
if (gLast != 0 && llGetUnixTime() - gLast <= SERVER_TIMEOUT) return;
|
||||
if (FALLBACK_TO_SIM_SUN) switchLights(llGetSunDirection().z < -0.05);
|
||||
else switchLights(FALSE);
|
||||
}
|
||||
changed(integer code)
|
||||
{
|
||||
if (code & CHANGED_LINK) { gMode = -1; switchLights(FALSE); }
|
||||
}
|
||||
on_rez(integer param) { llResetScript(); }
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
// NexSmartLight - diagnostics/status sign; never overrides lamp objects.
|
||||
integer CHANNEL = -835423;
|
||||
integer gLast = 0;
|
||||
string gStatus = "OFF";
|
||||
string gClock = "";
|
||||
|
||||
render()
|
||||
{
|
||||
if (gLast == 0 || llGetUnixTime() - gLast > 300)
|
||||
{
|
||||
llSetText("NexSmartLight\nKeine Verbindung",
|
||||
<1.0, 0.35, 0.2>, 1.0);
|
||||
return;
|
||||
}
|
||||
vector tint = <0.7, 0.85, 1.0>;
|
||||
if (gStatus == "ON") tint = <1.0, 0.9, 0.5>;
|
||||
llSetText("NexSmartLight\n" + gStatus + "\n" + gClock,
|
||||
tint, 1.0);
|
||||
}
|
||||
|
||||
default
|
||||
{
|
||||
state_entry()
|
||||
{
|
||||
llListen(CHANNEL, "NexSmartLight", NULL_KEY, "");
|
||||
llSetTimerEvent(60.0);
|
||||
render();
|
||||
}
|
||||
listen(integer channel, string name, key id, string message)
|
||||
{
|
||||
if (channel != CHANNEL || name != "NexSmartLight" || id != NULL_KEY)
|
||||
return;
|
||||
list v = llParseStringKeepNulls(message, ["|"], []);
|
||||
if (llGetListLength(v) != 4 ||
|
||||
llList2String(v, 0) != "NEXLIGHT" ||
|
||||
llList2String(v, 1) != "1") return;
|
||||
string status = llList2String(v, 2);
|
||||
if (status != "ON" && status != "OFF") return;
|
||||
gStatus = status;
|
||||
gClock = llList2String(v, 3);
|
||||
gLast = llGetUnixTime();
|
||||
render();
|
||||
}
|
||||
timer() { render(); }
|
||||
on_rez(integer param) { llResetScript(); }
|
||||
}
|
||||
@@ -1,5 +1,16 @@
|
||||
# NexSmartLight 0.1.0 – automatische Stadtbeleuchtung
|
||||
|
||||
## Alle passenden LSL-Skripte
|
||||
|
||||
Die zusätzlichen Inworld-Skripte, Voraussetzungen, Prim-Linknamen und
|
||||
Einstellungen stehen im
|
||||
[Generation-1-LSL-Handbuch](../../doc/NexVerse/GEN1_INWORLD_LSL_PACKS.md).
|
||||
Das Handbuch beschreibt ausdrücklich, welche Anzeigen auf **reinem LSL**
|
||||
basieren und welche Bildtafeln `osSetDynamicTextureDataFace` benötigen.
|
||||
Die Wetter-Emitter selbst werden **automatisch vom Server** gesteuert,
|
||||
nicht durch eine manuell aufgestellte LSL-Rezzerbox.
|
||||
|
||||
|
||||
## Automatischer Standard-Build (Generation 1)
|
||||
|
||||
Dieses Addon wird zusammen mit OpenGenesisLINK automatisch über `./runprebuild.sh` und `dotnet build -c Release OpenSim.sln` erstellt. Die DLL `OpenGenesisLINK.Addons.NexSmartLight.dll` wird dabei automatisch in `bin/` abgelegt, **ohne einen separaten Addon-Build oder Installationsschritt**. Das funktioniert auch über die automatisch erzeugte `compile.sh`. Die Build-Integration installiert keine Dateien auf fremden Servern und aktiviert das Addon nicht automatisch; `Enabled = false` bleibt die sichere Vorgabe.
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
// NexTraffic - countdown for one junction axis (LSL, no OSSL)
|
||||
// Put into a countdown sign prim. Matches NexTrafficModel.Wire.
|
||||
// JUNCTION and AXIS must match the signal scripts next to it.
|
||||
integer CHANNEL = -835421;
|
||||
string JUNCTION = "Hauptstrasse";
|
||||
string AXIS = "A"; // "A" or "B"
|
||||
integer gServerTime = 0;
|
||||
integer gRemaining = 0;
|
||||
integer gReceived = 0;
|
||||
string gPhase = "RED";
|
||||
string gShown = "";
|
||||
|
||||
render()
|
||||
{
|
||||
integer seconds = gRemaining - (llGetUnixTime() - gServerTime);
|
||||
if (seconds < 0) seconds = 0;
|
||||
string mode = "ROT";
|
||||
vector color = <1.0, 0.25, 0.25>;
|
||||
if (gPhase == "GREEN")
|
||||
{
|
||||
mode = "GRUEN";
|
||||
color = <0.3, 1.0, 0.4>;
|
||||
}
|
||||
else if (gPhase == "YELLOW")
|
||||
{
|
||||
mode = "GELB";
|
||||
color = <1.0, 0.8, 0.2>;
|
||||
}
|
||||
if (gReceived == 0 || llGetUnixTime() - gReceived > 15)
|
||||
{
|
||||
mode = "KEINE DATEN - ROT";
|
||||
color = <1.0, 0.2, 0.2>;
|
||||
seconds = 0;
|
||||
}
|
||||
string textValue = JUNCTION + " / " + AXIS + "\n" + mode + "\n" + (string)seconds + " s";
|
||||
if (textValue != gShown)
|
||||
{
|
||||
gShown = textValue;
|
||||
llSetText(textValue, color, 1.0);
|
||||
}
|
||||
}
|
||||
|
||||
default
|
||||
{
|
||||
state_entry()
|
||||
{
|
||||
llListen(CHANNEL, "NexTraffic", NULL_KEY, "");
|
||||
llSetTimerEvent(1.0);
|
||||
render();
|
||||
}
|
||||
|
||||
listen(integer channel, string name, key id, string message)
|
||||
{
|
||||
if (channel != CHANNEL || name != "NexTraffic" || id != NULL_KEY) return;
|
||||
list fields = llParseStringKeepNulls(message, ["|"], []);
|
||||
if (llGetListLength(fields) != 7 ||
|
||||
llList2String(fields, 0) != "NEXTRAFFIC" ||
|
||||
llList2String(fields, 1) != "1" ||
|
||||
llList2String(fields, 2) != JUNCTION) return;
|
||||
integer column = 3;
|
||||
if (AXIS == "B") column = 4;
|
||||
string phase = llList2String(fields, column);
|
||||
if (phase != "GREEN" && phase != "RED" && phase != "YELLOW") return;
|
||||
integer remaining = llList2Integer(fields, 5);
|
||||
integer stamp = llList2Integer(fields, 6);
|
||||
if (remaining < 1 || remaining > 120 ||
|
||||
llAbs(llGetUnixTime() - stamp) > 15) return;
|
||||
gReceived = llGetUnixTime();
|
||||
gServerTime = stamp;
|
||||
gRemaining = remaining;
|
||||
gPhase = phase;
|
||||
render();
|
||||
}
|
||||
|
||||
timer() { render(); }
|
||||
on_rez(integer param) { llResetScript(); }
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
// NexTraffic - non-interfering diagnostic monitor for one junction
|
||||
// Shows both street directions. Does not control signals/vehicles.
|
||||
integer CHANNEL = -835421;
|
||||
string JUNCTION = "Hauptstrasse";
|
||||
integer gLast;
|
||||
string gA = "RED";
|
||||
string gB = "RED";
|
||||
integer gUntil;
|
||||
|
||||
show()
|
||||
{
|
||||
if (gLast == 0 || llGetUnixTime() - gLast > 20)
|
||||
{
|
||||
llSetText("NexTraffic " + JUNCTION + "\nOFFLINE / STOP",
|
||||
<1.0, 0.25, 0.25>, 1.0);
|
||||
return;
|
||||
}
|
||||
integer remaining = gUntil - llGetUnixTime();
|
||||
if (remaining < 0) remaining = 0;
|
||||
vector tint = <0.8, 1.0, 0.8>;
|
||||
if (gA != "RED" && gB != "RED") tint = <1.0, 0.25, 0.25>;
|
||||
llSetText("NexTraffic " + JUNCTION + "\nA: " + gA +
|
||||
" | B: " + gB + "\n" + (string)remaining + " s",
|
||||
tint, 1.0);
|
||||
}
|
||||
|
||||
default
|
||||
{
|
||||
state_entry()
|
||||
{
|
||||
llListen(CHANNEL, "NexTraffic", NULL_KEY, "");
|
||||
llSetTimerEvent(1.0);
|
||||
show();
|
||||
}
|
||||
|
||||
listen(integer channel, string name, key id, string message)
|
||||
{
|
||||
if (channel != CHANNEL || name != "NexTraffic" || id != NULL_KEY) return;
|
||||
list v = llParseStringKeepNulls(message, ["|"], []);
|
||||
if (llGetListLength(v) != 7 || llList2String(v, 0) != "NEXTRAFFIC" ||
|
||||
llList2String(v, 1) != "1" || llList2String(v, 2) != JUNCTION) return;
|
||||
string a = llList2String(v, 3);
|
||||
string b = llList2String(v, 4);
|
||||
if (a != "RED" && a != "GREEN" && a != "YELLOW") return;
|
||||
if (b != "RED" && b != "GREEN" && b != "YELLOW") return;
|
||||
// Reject inconsistent messages instead of displaying false safety.
|
||||
if (a != "RED" && b != "RED") return;
|
||||
integer seconds = llList2Integer(v, 5);
|
||||
integer stamp = llList2Integer(v, 6);
|
||||
if (seconds < 1 || seconds > 120 || llAbs(llGetUnixTime() - stamp) > 15)
|
||||
return;
|
||||
gA = a;
|
||||
gB = b;
|
||||
gLast = llGetUnixTime();
|
||||
gUntil = stamp + seconds;
|
||||
show();
|
||||
}
|
||||
|
||||
timer() { show(); }
|
||||
on_rez(integer param) { llResetScript(); }
|
||||
}
|
||||
@@ -1,38 +1,50 @@
|
||||
// NEXTRAFFIC 0.1 / Stadt-NexVerse
|
||||
// Linked signal prims must be named RED, YELLOW, GREEN.
|
||||
// One script in the root; AXIS A or B for opposite street directions.
|
||||
// Decorations only. Do not use as a real-world safety controller.
|
||||
// NexTraffic 0.2 - two-axis synchronized inworld traffic signal.
|
||||
// Linkset: lamp prims MUST be named RED, YELLOW, GREEN.
|
||||
// Put one script in each signal root; configure JUNCTION and AXIS.
|
||||
// Uses server region chat. Visual signals only, NOT physical road safety.
|
||||
integer CHANNEL = -835421;
|
||||
string JUNCTION = "Hauptstrasse";
|
||||
string AXIS = "A";
|
||||
integer LAST_SIGNAL;
|
||||
string AXIS = "A"; // "A" or "B"
|
||||
string CURRENT = "RED";
|
||||
integer REMAINING;
|
||||
integer LAST_SIGNAL = 0;
|
||||
integer PHASE_END = 0;
|
||||
integer LAST_CAPTION = -1;
|
||||
string LAST_PHASE = "";
|
||||
|
||||
showSignal()
|
||||
updateCaption()
|
||||
{
|
||||
integer seconds = PHASE_END - llGetUnixTime();
|
||||
if (seconds < 0) seconds = 0;
|
||||
if (CURRENT == LAST_PHASE && seconds == LAST_CAPTION) return;
|
||||
LAST_PHASE = CURRENT;
|
||||
LAST_CAPTION = seconds;
|
||||
llSetText("NexTraffic " + JUNCTION + " [" + AXIS + "]\n" +
|
||||
CURRENT + " " + (string)seconds + "s",
|
||||
<1.0, 1.0, 1.0>, 1.0);
|
||||
}
|
||||
|
||||
setLamps()
|
||||
{
|
||||
integer i;
|
||||
for (i = 1; i <= llGetNumberOfPrims(); i++)
|
||||
{
|
||||
string name = llToUpper(llGetLinkName(i));
|
||||
vector tint;
|
||||
if (name == "RED") tint = <1.0, 0.0, 0.0>;
|
||||
else if (name == "YELLOW") tint = <1.0, 0.74, 0.0>;
|
||||
else if (name == "GREEN") tint = <0.0, 1.0, 0.15>;
|
||||
else jump nextLamp;
|
||||
|
||||
integer active = (name == CURRENT);
|
||||
float brightness = 0.08;
|
||||
if (active) brightness = 1.0;
|
||||
llSetLinkPrimitiveParamsFast(i, [
|
||||
PRIM_COLOR, ALL_SIDES, tint * brightness, 1.0,
|
||||
PRIM_FULLBRIGHT, ALL_SIDES, active
|
||||
]);
|
||||
@nextLamp;
|
||||
if (name == "RED" || name == "YELLOW" || name == "GREEN")
|
||||
{
|
||||
vector tint = <0.0, 0.0, 0.0>;
|
||||
if (name == "RED") tint = <1.0, 0.0, 0.0>;
|
||||
else if (name == "YELLOW") tint = <1.0, 0.74, 0.0>;
|
||||
else if (name == "GREEN") tint = <0.0, 1.0, 0.15>;
|
||||
integer active = (name == CURRENT);
|
||||
float brightness = 0.08;
|
||||
if (active) brightness = 1.0;
|
||||
llSetLinkPrimitiveParamsFast(i, [
|
||||
PRIM_COLOR, ALL_SIDES, tint * brightness, 1.0,
|
||||
PRIM_FULLBRIGHT, ALL_SIDES, active
|
||||
]);
|
||||
}
|
||||
}
|
||||
llSetText("NexTraffic " + JUNCTION + " [" + AXIS + "]\n" +
|
||||
CURRENT + " " + (string)REMAINING + "s",
|
||||
<1.0, 1.0, 1.0>, 1.0);
|
||||
updateCaption();
|
||||
}
|
||||
|
||||
default
|
||||
@@ -40,54 +52,63 @@ default
|
||||
state_entry()
|
||||
{
|
||||
CURRENT = "RED";
|
||||
REMAINING = 0;
|
||||
showSignal();
|
||||
PHASE_END = 0;
|
||||
setLamps();
|
||||
llListen(CHANNEL, "NexTraffic", NULL_KEY, "");
|
||||
llSetTimerEvent(5.0);
|
||||
llSetTimerEvent(1.0);
|
||||
}
|
||||
|
||||
listen(integer channel, string name, key id, string message)
|
||||
{
|
||||
if (channel != CHANNEL || name != "NexTraffic" || id != NULL_KEY)
|
||||
return;
|
||||
if (AXIS != "A" && AXIS != "B") return;
|
||||
list f = llParseStringKeepNulls(message, ["|"], []);
|
||||
if (llGetListLength(f) != 7 ||
|
||||
llList2String(f, 0) != "NEXTRAFFIC" ||
|
||||
llList2String(f, 1) != "1" ||
|
||||
llList2String(f, 2) != JUNCTION) return;
|
||||
|
||||
integer phaseIndex = 3;
|
||||
if (AXIS == "B") phaseIndex = 4;
|
||||
string phase = llList2String(f, phaseIndex);
|
||||
if (phase != "GREEN" && phase != "YELLOW" && phase != "RED")
|
||||
integer column = 3;
|
||||
if (AXIS == "B") column = 4;
|
||||
string phase = llList2String(f, column);
|
||||
string other = llList2String(f, 4);
|
||||
if (AXIS == "B") other = llList2String(f, 3);
|
||||
if (phase != "RED" && phase != "GREEN" && phase != "YELLOW")
|
||||
return;
|
||||
if (other != "RED" && other != "GREEN" && other != "YELLOW")
|
||||
return;
|
||||
// A vehicle direction can only move if the other is red.
|
||||
if (phase != "RED" && other != "RED") return;
|
||||
integer remaining = llList2Integer(f, 5);
|
||||
integer serverTime = llList2Integer(f, 6);
|
||||
if (remaining < 1 || remaining > 120 ||
|
||||
llAbs(llGetUnixTime() - serverTime) > 15) return;
|
||||
|
||||
LAST_SIGNAL = llGetUnixTime();
|
||||
REMAINING = remaining;
|
||||
if (CURRENT != phase)
|
||||
PHASE_END = serverTime + remaining;
|
||||
if (phase != CURRENT)
|
||||
{
|
||||
CURRENT = phase;
|
||||
showSignal();
|
||||
setLamps();
|
||||
}
|
||||
else updateCaption();
|
||||
}
|
||||
|
||||
timer()
|
||||
{
|
||||
// Fail closed: no traffic module -> every signal red.
|
||||
// Fail visibly red if module stops or data no longer arrive.
|
||||
if (LAST_SIGNAL == 0 || llGetUnixTime() - LAST_SIGNAL > 20)
|
||||
{
|
||||
PHASE_END = 0;
|
||||
if (CURRENT != "RED")
|
||||
{
|
||||
CURRENT = "RED";
|
||||
REMAINING = 0;
|
||||
showSignal();
|
||||
setLamps();
|
||||
}
|
||||
else updateCaption();
|
||||
}
|
||||
else updateCaption();
|
||||
}
|
||||
|
||||
on_rez(integer code) { llResetScript(); }
|
||||
changed(integer change)
|
||||
{
|
||||
if (change & CHANGED_LINK) setLamps();
|
||||
}
|
||||
on_rez(integer param) { llResetScript(); }
|
||||
}
|
||||
@@ -1,5 +1,16 @@
|
||||
# NexTraffic 0.1.0 – simulatorweite Ampelsteuerung
|
||||
|
||||
## Alle passenden LSL-Skripte
|
||||
|
||||
Die zusätzlichen Inworld-Skripte, Voraussetzungen, Prim-Linknamen und
|
||||
Einstellungen stehen im
|
||||
[Generation-1-LSL-Handbuch](../../doc/NexVerse/GEN1_INWORLD_LSL_PACKS.md).
|
||||
Das Handbuch beschreibt ausdrücklich, welche Anzeigen auf **reinem LSL**
|
||||
basieren und welche Bildtafeln `osSetDynamicTextureDataFace` benötigen.
|
||||
Die Wetter-Emitter selbst werden **automatisch vom Server** gesteuert,
|
||||
nicht durch eine manuell aufgestellte LSL-Rezzerbox.
|
||||
|
||||
|
||||
## Automatischer Standard-Build (Generation 1)
|
||||
|
||||
Dieses Addon wird zusammen mit OpenGenesisLINK automatisch über `./runprebuild.sh` und `dotnet build -c Release OpenSim.sln` erstellt. Die DLL `OpenGenesisLINK.Addons.NexTraffic.dll` wird dabei automatisch in `bin/` abgelegt, **ohne einen separaten Addon-Build oder Installationsschritt**. Das funktioniert auch über die automatisch erzeugte `compile.sh`. Die Build-Integration installiert keine Dateien auf fremden Servern und aktiviert das Addon nicht automatisch; `Enabled = false` bleibt die sichere Vorgabe.
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
// NexTransit - OPT-IN local text announcement for scheduled departures.
|
||||
// llSay(0, ...) has limited local chat radius. No TTS or audio files.
|
||||
// Default is disabled to avoid unsolicited repeated messages.
|
||||
integer CHANNEL = -835422;
|
||||
integer ANNOUNCE_IN_CHAT = FALSE;
|
||||
integer ANNOUNCE_WHEN_MINUTES = 1;
|
||||
integer COOLDOWN_SECONDS = 600;
|
||||
string STOP_NAME = "Stadt-NexVerse";
|
||||
string gLastAnnouncement = "";
|
||||
integer gLastAnnouncementTime = 0;
|
||||
|
||||
default
|
||||
{
|
||||
state_entry() { llListen(CHANNEL, "NexTransit", NULL_KEY, ""); }
|
||||
listen(integer channel, string name, key id, string message)
|
||||
{
|
||||
if (!ANNOUNCE_IN_CHAT || channel != CHANNEL ||
|
||||
name != "NexTransit" || id != NULL_KEY) return;
|
||||
list f = llParseStringKeepNulls(message, ["|"], []);
|
||||
if (llGetListLength(f) != 4 ||
|
||||
llList2String(f, 0) != "NEXTRANSIT" ||
|
||||
llList2String(f, 1) != "1") return;
|
||||
list rows = llParseStringKeepNulls(llList2String(f, 3), [";"], []);
|
||||
integer i;
|
||||
for (i = 0; i < llGetListLength(rows); i++)
|
||||
{
|
||||
list r = llParseStringKeepNulls(llList2String(rows, i), [","], []);
|
||||
if (llGetListLength(r) != 4) return;
|
||||
integer minutes = llList2Integer(r, 3);
|
||||
if (minutes == ANNOUNCE_WHEN_MINUTES)
|
||||
{
|
||||
string signature = llList2String(f, 2) + "|" +
|
||||
llList2String(r, 0) + "|" + llList2String(r, 2);
|
||||
if (signature != gLastAnnouncement &&
|
||||
llGetUnixTime() - gLastAnnouncementTime >= COOLDOWN_SECONDS)
|
||||
{
|
||||
gLastAnnouncement = signature;
|
||||
gLastAnnouncementTime = llGetUnixTime();
|
||||
llSay(0, "Naechste Planabfahrt " + STOP_NAME + ": Linie " +
|
||||
llList2String(r, 0) + " Richtung " + llList2String(r, 1) +
|
||||
", Abfahrt " + llList2String(r, 2) + " Uhr.");
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
on_rez(integer param) { llResetScript(); }
|
||||
}
|
||||
@@ -14,7 +14,9 @@ drawBoard(string wire)
|
||||
if (llGetListLength(p) != 4 ||
|
||||
llList2String(p, 0) != "NEXTRANSIT" ||
|
||||
llList2String(p, 1) != "1") return;
|
||||
list routes = llParseStringKeepNulls(llList2String(p, 3), [";"], []);
|
||||
string rawRoutes = llList2String(p, 3);
|
||||
list routes = [];
|
||||
if (rawRoutes != "") routes = llParseStringKeepNulls(rawRoutes, [";"], []);
|
||||
string d = "";
|
||||
d = osSetPenColor(d, "black");
|
||||
d = osMovePen(d, 0, 0);
|
||||
@@ -91,6 +93,20 @@ default
|
||||
if (llGetListLength(p) != 4 ||
|
||||
llList2String(p, 0) != "NEXTRANSIT" ||
|
||||
llList2String(p, 1) != "1") return;
|
||||
// Validate the WHOLE message before updating the offline watchdog.
|
||||
// Untrusted or malformed rows must never replace the last good sign.
|
||||
string payload = llList2String(p, 3);
|
||||
list rows = [];
|
||||
if (payload != "") rows = llParseStringKeepNulls(payload, [";"], []);
|
||||
if (llGetListLength(rows) > 10) return;
|
||||
integer i;
|
||||
for (i = 0; i < llGetListLength(rows); i++)
|
||||
{
|
||||
list row = llParseStringKeepNulls(llList2String(rows, i), [","], []);
|
||||
if (llGetListLength(row) != 4) return;
|
||||
integer wait = llList2Integer(row, 3);
|
||||
if (wait < 0 || wait > 1440) return;
|
||||
}
|
||||
LAST_RECV = llGetUnixTime();
|
||||
drawBoard(message);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
// NexTransit - static bus destination sign using the configured schedule.
|
||||
// It DOES NOT steer, rez, teleport or represent a live physical bus.
|
||||
integer CHANNEL = -835422;
|
||||
string LINE = "101";
|
||||
integer gLast;
|
||||
string gVisible = "";
|
||||
|
||||
refresh()
|
||||
{
|
||||
if (gLast == 0 || llGetUnixTime() - gLast > 150)
|
||||
llSetText("Linie " + LINE + "\nFahrplan offline",
|
||||
<1.0, 0.5, 0.1>, 1.0);
|
||||
else
|
||||
llSetText(gVisible, <1.0, 0.85, 0.2>, 1.0);
|
||||
}
|
||||
|
||||
default
|
||||
{
|
||||
state_entry()
|
||||
{
|
||||
llListen(CHANNEL, "NexTransit", NULL_KEY, "");
|
||||
llSetTimerEvent(60.0);
|
||||
refresh();
|
||||
}
|
||||
listen(integer ch, string name, key id, string message)
|
||||
{
|
||||
if (ch != CHANNEL || name != "NexTransit" || id != NULL_KEY) return;
|
||||
if (llStringLength(message) > 960) return;
|
||||
list fields = llParseStringKeepNulls(message, ["|"], []);
|
||||
if (llGetListLength(fields) != 4 ||
|
||||
llList2String(fields, 0) != "NEXTRANSIT" ||
|
||||
llList2String(fields, 1) != "1") return;
|
||||
list rows = llParseStringKeepNulls(llList2String(fields, 3), [";"], []);
|
||||
integer i;
|
||||
string found = "";
|
||||
for (i = 0; i < llGetListLength(rows); i++)
|
||||
{
|
||||
list cols = llParseStringKeepNulls(llList2String(rows, i), [","], []);
|
||||
if (llGetListLength(cols) != 4) return;
|
||||
if (llList2String(cols, 0) == LINE && found == "")
|
||||
found = "Linie " + LINE + "\nRichtung " +
|
||||
llList2String(cols, 1) + "\n" +
|
||||
llList2String(cols, 2) + " / " +
|
||||
llList2String(cols, 3) + " min";
|
||||
}
|
||||
gLast = llGetUnixTime();
|
||||
if (found == "") found = "Linie " + LINE + "\nKeine Planabfahrt";
|
||||
gVisible = found;
|
||||
refresh();
|
||||
}
|
||||
timer() { refresh(); }
|
||||
on_rez(integer param) { llResetScript(); }
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
// NexTransit - one-prim stop information and private touch response.
|
||||
// No OSSL: standard LSL only; no teleport and no actual vehicle tracking.
|
||||
integer CHANNEL = -835422;
|
||||
string STOP_NAME = "Stadt-NexVerse";
|
||||
integer gLast;
|
||||
string gStatus = "Lade Fahrplan...";
|
||||
list gDepartures = [];
|
||||
|
||||
render()
|
||||
{
|
||||
if (gLast == 0 || llGetUnixTime() - gLast > 150)
|
||||
{
|
||||
llSetText(STOP_NAME + "\nFahrplan offline",
|
||||
<1.0, 0.45, 0.2>, 1.0);
|
||||
return;
|
||||
}
|
||||
string output = STOP_NAME + "\n";
|
||||
integer count = llGetListLength(gDepartures);
|
||||
if (count == 0) output += "Keine Planabfahrten";
|
||||
integer i;
|
||||
for (i = 0; i < count && i < 3; i++)
|
||||
{
|
||||
list row = llParseStringKeepNulls(llList2String(gDepartures, i), [","], []);
|
||||
if (llGetListLength(row) == 4)
|
||||
output += llList2String(row, 0) + " " +
|
||||
llList2String(row, 1) + " - " +
|
||||
llList2String(row, 3) + " min\n";
|
||||
}
|
||||
llSetText(output, <0.95, 0.95, 0.75>, 1.0);
|
||||
}
|
||||
|
||||
default
|
||||
{
|
||||
state_entry()
|
||||
{
|
||||
llListen(CHANNEL, "NexTransit", NULL_KEY, "");
|
||||
llSetTimerEvent(60.0);
|
||||
render();
|
||||
}
|
||||
listen(integer channel, string name, key id, string message)
|
||||
{
|
||||
if (channel != CHANNEL || name != "NexTransit" || id != NULL_KEY)
|
||||
return;
|
||||
if (llStringLength(message) > 960) return;
|
||||
list f = llParseStringKeepNulls(message, ["|"], []);
|
||||
if (llGetListLength(f) != 4 ||
|
||||
llList2String(f, 0) != "NEXTRANSIT" ||
|
||||
llList2String(f, 1) != "1") return;
|
||||
string data = llList2String(f, 3);
|
||||
list rows = [];
|
||||
if (data != "") rows = llParseStringKeepNulls(data, [";"], []);
|
||||
integer i;
|
||||
for (i = 0; i < llGetListLength(rows); i++)
|
||||
{
|
||||
list cols = llParseStringKeepNulls(llList2String(rows, i), [","], []);
|
||||
if (llGetListLength(cols) != 4) return;
|
||||
integer mins = llList2Integer(cols, 3);
|
||||
if (mins < 0 || mins > 1440) return;
|
||||
}
|
||||
gDepartures = rows;
|
||||
gStatus = llList2String(f, 2);
|
||||
gLast = llGetUnixTime();
|
||||
render();
|
||||
}
|
||||
touch_start(integer total)
|
||||
{
|
||||
key user = llDetectedKey(0);
|
||||
if (gLast == 0 || llGetUnixTime() - gLast > 150)
|
||||
{
|
||||
llInstantMessage(user, "NexTransit: Fahrplandaten nicht verfuegbar.");
|
||||
return;
|
||||
}
|
||||
string response = "NexTransit " + STOP_NAME + " (" + gStatus + ")\n";
|
||||
integer i;
|
||||
for (i = 0; i < llGetListLength(gDepartures); i++)
|
||||
{
|
||||
list cols = llParseStringKeepNulls(llList2String(gDepartures, i), [","], []);
|
||||
response += llList2String(cols, 0) + " Richtung " +
|
||||
llList2String(cols, 1) + " um " +
|
||||
llList2String(cols, 2) + " (" +
|
||||
llList2String(cols, 3) + " min)\n";
|
||||
}
|
||||
if (llGetListLength(gDepartures) == 0) response += "Keine Abfahrten";
|
||||
llInstantMessage(user, response);
|
||||
}
|
||||
timer()
|
||||
{
|
||||
// The published minutes may be one minute old; display them only
|
||||
// while recent and do not claim to track actual vehicle arrivals.
|
||||
render();
|
||||
}
|
||||
on_rez(integer param) { llResetScript(); }
|
||||
}
|
||||
@@ -1,5 +1,16 @@
|
||||
# NexTransit 0.1.0 – Stadt-NexVerse Linien und Fahrplananzeigen
|
||||
|
||||
## Alle passenden LSL-Skripte
|
||||
|
||||
Die zusätzlichen Inworld-Skripte, Voraussetzungen, Prim-Linknamen und
|
||||
Einstellungen stehen im
|
||||
[Generation-1-LSL-Handbuch](../../doc/NexVerse/GEN1_INWORLD_LSL_PACKS.md).
|
||||
Das Handbuch beschreibt ausdrücklich, welche Anzeigen auf **reinem LSL**
|
||||
basieren und welche Bildtafeln `osSetDynamicTextureDataFace` benötigen.
|
||||
Die Wetter-Emitter selbst werden **automatisch vom Server** gesteuert,
|
||||
nicht durch eine manuell aufgestellte LSL-Rezzerbox.
|
||||
|
||||
|
||||
## Automatischer Standard-Build (Generation 1)
|
||||
|
||||
Dieses Addon wird zusammen mit OpenGenesisLINK automatisch über `./runprebuild.sh` und `dotnet build -c Release OpenSim.sln` erstellt. Die DLL `OpenGenesisLINK.Addons.NexTransit.dll` wird dabei automatisch in `bin/` abgelegt, **ohne einen separaten Addon-Build oder Installationsschritt**. Das funktioniert auch über die automatisch erzeugte `compile.sh`. Die Build-Integration installiert keine Dateien auf fremden Servern und aktiviert das Addon nicht automatisch; `Enabled = false` bleibt die sichere Vorgabe.
|
||||
|
||||
@@ -1,5 +1,16 @@
|
||||
# OGLWeather – OpenGenesisLINK Generation 1
|
||||
|
||||
## Alle passenden LSL-Skripte
|
||||
|
||||
Die zusätzlichen Inworld-Skripte, Voraussetzungen, Prim-Linknamen und
|
||||
Einstellungen stehen im
|
||||
[Generation-1-LSL-Handbuch](../../doc/NexVerse/GEN1_INWORLD_LSL_PACKS.md).
|
||||
Das Handbuch beschreibt ausdrücklich, welche Anzeigen auf **reinem LSL**
|
||||
basieren und welche Bildtafeln `osSetDynamicTextureDataFace` benötigen.
|
||||
Die Wetter-Emitter selbst werden **automatisch vom Server** gesteuert,
|
||||
nicht durch eine manuell aufgestellte LSL-Rezzerbox.
|
||||
|
||||
|
||||
## Automatischer Standard-Build (Generation 1)
|
||||
|
||||
Dieses Addon wird zusammen mit OpenGenesisLINK automatisch über `./runprebuild.sh` und `dotnet build -c Release OpenSim.sln` erstellt. Die DLL `OpenGenesisLINK.Addons.OGLWeather.dll` wird dabei automatisch in `bin/` abgelegt, **ohne einen separaten Addon-Build oder Installationsschritt**. Das funktioniert auch über die automatisch erzeugte `compile.sh`. Die Build-Integration installiert keine Dateien auf fremden Servern und aktiviert das Addon nicht automatisch; `Enabled = false` bleibt die sichere Vorgabe.
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
// OGLWeather - compact, standard LSL weather sign with temperature.
|
||||
// Not a weather emitter; rain/snow is managed by server-side C#.
|
||||
integer CHANNEL = -835311;
|
||||
integer LAST = 0;
|
||||
string gStatus = "";
|
||||
integer gTemperature;
|
||||
integer gWind;
|
||||
integer gIntensity;
|
||||
string gForecastTime;
|
||||
|
||||
string weatherName(string code)
|
||||
{
|
||||
if (code == "sun") return "Sonnig";
|
||||
if (code == "cloud") return "Bewoelkt";
|
||||
if (code == "rain") return "Regen";
|
||||
if (code == "snow") return "Schnee";
|
||||
return "Unbekannt";
|
||||
}
|
||||
render()
|
||||
{
|
||||
if (LAST == 0 || llGetUnixTime() - LAST > 240)
|
||||
{
|
||||
llSetText("OGLWeather\nWetterdienst nicht erreichbar",
|
||||
<1.0, 0.4, 0.25>, 1.0);
|
||||
return;
|
||||
}
|
||||
vector tint = <0.65, 0.9, 1.0>;
|
||||
if (gStatus == "sun") tint = <1.0, 0.9, 0.4>;
|
||||
if (gStatus == "snow") tint = <0.85, 0.95, 1.0>;
|
||||
string textValue = "STADT NEXVERSE\n" + weatherName(gStatus) +
|
||||
" " + (string)gTemperature + " C\n" +
|
||||
"Wind " + (string)gWind + " km/h";
|
||||
if (gStatus == "rain" || gStatus == "snow")
|
||||
textValue += " | " + (string)gIntensity + "%";
|
||||
llSetText(textValue, tint, 1.0);
|
||||
}
|
||||
|
||||
default
|
||||
{
|
||||
state_entry()
|
||||
{
|
||||
llListen(CHANNEL, "OGLWeather", NULL_KEY, "");
|
||||
llSetTimerEvent(60.0);
|
||||
render();
|
||||
}
|
||||
listen(integer ch, string name, key id, string message)
|
||||
{
|
||||
if (ch != CHANNEL || name != "OGLWeather" || id != NULL_KEY) return;
|
||||
list f = llParseStringKeepNulls(message, ["|"], []);
|
||||
if (llGetListLength(f) != 8 || llList2String(f, 0) != "OGLWX" ||
|
||||
llList2String(f, 1) != "1" || llList2String(f, 2) != "NOW")
|
||||
return;
|
||||
string status = llList2String(f, 4);
|
||||
if (status != "sun" && status != "cloud" &&
|
||||
status != "rain" && status != "snow") return;
|
||||
integer intensity = llList2Integer(f, 6);
|
||||
integer wind = llList2Integer(f, 7);
|
||||
if (intensity < 0 || intensity > 100 || wind < 0 || wind > 150)
|
||||
return;
|
||||
gStatus = status;
|
||||
gTemperature = llList2Integer(f, 5);
|
||||
gIntensity = intensity;
|
||||
gWind = wind;
|
||||
gForecastTime = llList2String(f, 3);
|
||||
LAST = llGetUnixTime();
|
||||
render();
|
||||
}
|
||||
timer() { render(); }
|
||||
on_rez(integer param) { llResetScript(); }
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
// OGLWeather - five-day hovertext forecast, no OSSL texture permissions.
|
||||
// A display prim is optional; NOT needed for rainfall/snowfall.
|
||||
integer CHANNEL = -835311;
|
||||
list gDays = ["", "", "", "", ""];
|
||||
integer gLast = 0;
|
||||
|
||||
string title(string code)
|
||||
{
|
||||
if (code == "sun") return "Sonnig";
|
||||
if (code == "cloud") return "Bewoelkt";
|
||||
if (code == "rain") return "Regen";
|
||||
if (code == "snow") return "Schnee";
|
||||
return "n/a";
|
||||
}
|
||||
|
||||
render()
|
||||
{
|
||||
if (gLast == 0 || llGetUnixTime() - gLast > 900)
|
||||
{
|
||||
llSetText("OGLWeather\nVorhersage wird geladen...",
|
||||
<1.0, 0.7, 0.3>, 1.0);
|
||||
return;
|
||||
}
|
||||
string result = "STADT NEXVERSE\nWetter-Vorhersage\n";
|
||||
integer i;
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
string line = llList2String(gDays, i);
|
||||
if (line != "")
|
||||
{
|
||||
list row = llParseStringKeepNulls(line, ["|"], []);
|
||||
result += llList2String(row, 4) + " " +
|
||||
title(llList2String(row, 5)) + " " +
|
||||
llList2String(row, 6) + "/" + llList2String(row, 7) + " C\n";
|
||||
}
|
||||
}
|
||||
llSetText(result, <0.85, 0.95, 1.0>, 1.0);
|
||||
}
|
||||
|
||||
default
|
||||
{
|
||||
state_entry()
|
||||
{
|
||||
llListen(CHANNEL, "OGLWeather", NULL_KEY, "");
|
||||
llSetTimerEvent(60.0);
|
||||
render();
|
||||
}
|
||||
listen(integer ch, string name, key id, string message)
|
||||
{
|
||||
if (ch != CHANNEL || name != "OGLWeather" || id != NULL_KEY) return;
|
||||
list p = llParseStringKeepNulls(message, ["|"], []);
|
||||
if (llGetListLength(p) != 9 || llList2String(p, 0) != "OGLWX" ||
|
||||
llList2String(p, 1) != "1" || llList2String(p, 2) != "DAY") return;
|
||||
integer slot = llList2Integer(p, 3);
|
||||
if (slot < 0 || slot >= 5) return;
|
||||
string condition = llList2String(p, 5);
|
||||
if (condition != "sun" && condition != "cloud" &&
|
||||
condition != "rain" && condition != "snow") return;
|
||||
|
||||
if (slot == 0 && llList2String(gDays, 0) != "")
|
||||
{
|
||||
list old = llParseStringKeepNulls(llList2String(gDays, 0), ["|"], []);
|
||||
if (llList2String(old, 4) != llList2String(p, 4))
|
||||
gDays = ["", "", "", "", ""];
|
||||
}
|
||||
gDays = llListReplaceList(gDays, [message], slot, slot);
|
||||
gLast = llGetUnixTime();
|
||||
render();
|
||||
}
|
||||
timer() { render(); }
|
||||
on_rez(integer param) { llResetScript(); }
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
# Generation 1 – Inworld-LSL-Skriptpaket
|
||||
|
||||
Alle Skripte befinden sich direkt unter `addons/<AddonName>/` und werden
|
||||
zusammen mit dem Server-Quellcode versioniert. **Die LSL-Dateien sind Quelltexte
|
||||
für den OpenSim-/Firestorm-Skripteditor**; sie werden nicht zu .NET-DLLs
|
||||
kompiliert, nicht automatisch in Inventare geladen und nicht ungefragt in
|
||||
Bewohnerobjekte eingesetzt. Die vier eigenständigen **.NET8-DLLs** entstehen
|
||||
weiterhin automatisch bei `bash runprebuild.sh && bash compile.sh`.
|
||||
|
||||
## Voraussetzungen
|
||||
|
||||
1. **Regionssimulator**, nicht ROBUST, aktualisieren und sicherstellen, dass
|
||||
`bin/OpenGenesisLINK.Addons.{NexTraffic,NexTransit,NexSmartLight,OGLWeather}.dll`
|
||||
vorhanden ist. Die Dateiklammern sind hier symbolisch gemeint.
|
||||
2. Die jeweiligen `.ini.example`-Dateien in die tatsächlich geladene
|
||||
Simulator-Konfiguration übernehmen. `Enabled=true` nur bei den gewünschten
|
||||
Addons setzen. Die **vier LSLChannel-Werte dürfen nicht geändert werden**,
|
||||
ohne die Skripte ebenfalls anzupassen. Simulator neu starten.
|
||||
3. Im Firestorm-Inworld-Skripteditor die gewünschte `.lsl` in das
|
||||
passende Objekt kopieren, speichern und aktivieren. Die Skripte setzen auf
|
||||
**LSL**, ausgenommen die zwei dynamischen Vektortexturtafeln mit OSSL.
|
||||
4. Die Module senden **Region-Chat** aus `IWorldComm`. Jeder Listener arbeitet
|
||||
in seiner Region, auch wenn mehrere Regionen im selben Simulator laufen.
|
||||
Kein globales Chat-Relay und keine Installation von Skripten in ROBUST.
|
||||
|
||||
## Skriptübersicht und Aufbau
|
||||
|
||||
| Modul | Datei | Einsatz |
|
||||
| --- | --- | --- |
|
||||
| NexTraffic | `NexTrafficSignal.lsl` | Linkset aus drei benannten Lampenprims `RED`, `YELLOW`, `GREEN`; je Fahrtrichtung ein Skript in der Root-Prim |
|
||||
| NexTraffic | `NexTrafficCountdown.lsl` | Eigenständiger Countdown-Prim für Richtung A oder B; aktualisiert Zähler pro Sekunde |
|
||||
| NexTraffic | `NexTrafficJunctionMonitor.lsl` | Diagnosetafel mit Status beider Achsen und Offlinewarnung |
|
||||
| NexTransit | `NexTransitDepartureBoard.lsl` | 1024×512-Bildtafel; benötigt `osSetDynamicTextureDataFace` und VectorRender-Freigabe |
|
||||
| NexTransit | `NexTransitStopInfo.lsl` | Haltestellenschild mit den nächsten drei Abfahrten und privater Touch-Auskunft, nur LSL |
|
||||
| NexTransit | `NexTransitRouteHeadSign.lsl` | Linien-/Zielanzeige für ein bestehendes Bus- oder Haltestellenobjekt, kein physisch fahrender Bus |
|
||||
| NexTransit | `NexTransitDepartureAnnouncement.lsl` | Optionale lokale Abfahrtsansage **als Chat-Text**, kein TTS; standardmäßig AUS |
|
||||
| NexSmartLight | `NexSmartLightLamp.lsl` | Einzelne Straßenlaterne, direkt im leuchtenden Lampenprim |
|
||||
| NexSmartLight | `NexSmartLightLinkset.lsl` | Gemeinsam geschaltete Lampenprims mit Linknamen `LIGHT_*` in einem Objekt |
|
||||
| NexSmartLight | `NexSmartLightStatus.lsl` | Diagnose-Anzeige mit ON/OFF, Uhrzeit und Status des Dienstes |
|
||||
| OGLWeather | `WeatherForecastBoard.lsl` | 1024×512-Wettertafel mit fünf Tagen, benötigt OSSL/VectorRender |
|
||||
| OGLWeather | `WeatherCurrentSign.lsl` | Kompaktes Wetterschild mit aktueller Temperatur und Wind, reines LSL |
|
||||
| OGLWeather | `WeatherForecastText.lsl` | Fünf-Tage-Vorschau als Hovertext, reines LSL |
|
||||
|
||||
## NexTraffic – Kreuzungsbeispiel
|
||||
|
||||
Im `NexTraffic.ini` etwa `Junctions=Hauptstrasse:0` aktivieren.
|
||||
Zwei gegenüberliegende Ampel-Linksets anlegen:
|
||||
|
||||
- Linkset 1: Child-Prims `RED`, `YELLOW`, `GREEN`, in der Root-Prim
|
||||
`NexTrafficSignal.lsl` mit `JUNCTION="Hauptstrasse"`, `AXIS="A"`.
|
||||
- Linkset 2: gleiche Lampennamen, aber `AXIS="B"`.
|
||||
- Zusätzlich können `NexTrafficCountdown.lsl` und
|
||||
`NexTrafficJunctionMonitor.lsl` auf **eigenen Primobjekten** laufen.
|
||||
|
||||
Die Ampel erhält die serverseitige Farbe; ohne Daten schaltet sie sichtbar auf
|
||||
Rot. Das ist eine **Inworld-Anzeige**, keine physische/behördliche
|
||||
Verkehrssicherung. Eine Fußgängerfreigabe ist **nicht** implementiert; das
|
||||
kurze serverseitige beidseitige Rot darf nicht als WALK-Phase interpretiert
|
||||
werden. Es werden keine Autos oder NPCs gesteuert.
|
||||
|
||||
## NexTransit – Linien und Haltestellen
|
||||
|
||||
Serverbeispiel:
|
||||
```ini
|
||||
[NexTransit]
|
||||
Enabled = true
|
||||
LSLChannel = -835422
|
||||
TimeZone = Europe/Berlin
|
||||
RefreshSeconds = 30
|
||||
Routes = 101,Magdeburg,10,0,*;150,Jenseits,20,15,Gummybear Island
|
||||
```
|
||||
|
||||
Ein normales Haltestellenprim mit `NexTransitStopInfo.lsl` benötigt **keine
|
||||
OSSL-Berechtigungen**. Touch liefert die nächsten Planabfahrten als private
|
||||
Nachricht. Für eine große Anzeigetafel `NexTransitDepartureBoard.lsl`
|
||||
verwenden; bei Bedarf `DISPLAY_FACE` ändern (in Standard-OpenSim-Boxen
|
||||
kann die Front je nach Rotation unterschiedlich ausgerichtet sein).
|
||||
|
||||
`NexTransitRouteHeadSign.lsl` filtert die Nachricht nach `LINE="101"`.
|
||||
Wenn diese Linie am Aufenthaltsort des Objekts nicht in den nächsten
|
||||
Abfahrten vorkommt, zeigt das Skript **Keine Planabfahrt** und **erfindet
|
||||
kein Ziel**. Das ist **keine Fahrzeugsteuerung**.
|
||||
|
||||
`NexTransitDepartureAnnouncement.lsl` enthält den Schalter
|
||||
`ANNOUNCE_IN_CHAT = FALSE`: für Textansagen auf eigene Verantwortung
|
||||
aktivieren. Das Skript ruft bei einer bevorstehenden Planabfahrt `llSay(0)`
|
||||
auf (nur lokaler Hörkreis), **keine TTS-Engine, keine vorhandenen WAV-Dateien
|
||||
vorausgesetzt**; der zeitliche Abstand zwischen Chatansagen ist begrenzt.
|
||||
|
||||
## NexSmartLight – Einzelprim oder Linkset
|
||||
|
||||
Beim Einzelprim-Skript dürfen sich mehrere andere Scripte am gleichen
|
||||
Leuchtenprim **nicht ebenfalls gegenseitig überschreibende**
|
||||
`PRIM_POINT_LIGHT`-Befehle senden. Das Linkset-Skript gehört **nur in
|
||||
ein** Root-Prim und schaltet ausschließlich alle Child-/Root-Prims, deren
|
||||
**Linkname mit `LIGHT_` beginnt**, also zum Beispiel `LIGHT_VORNE`,
|
||||
`LIGHT_HINTEN`. So bleiben Straßenmast, Schilder und andere Teile unberührt.
|
||||
Die Sonne-/Uhrzeit-Fallback-Option ist standardmäßig AUS, da die vom
|
||||
Server veröffentlichte Lokalzeit (Europe/Berlin) nicht automatisch dem
|
||||
regionalen EEP-Himmel entspricht.
|
||||
|
||||
## OGLWeather – ohne manuelle Partikelquellen
|
||||
|
||||
Für das **Regnen und Schneien** werden **keine LSL-Skripte** benötigt.
|
||||
Die kompatiblen Legacy-Emitter werden bereits vom C#-Addon temporär und
|
||||
automatisch während Regen/Schnee erzeugt und gelöscht. Die drei Wetter-LSLs
|
||||
sind ausschließlich **optionale Wetteranzeigen**. Die beiden einfachen
|
||||
Hovertext-Varianten benötigen keine hochprivilegierten OSSL-Funktionen.
|
||||
|
||||
Die Temperaturen und fünf Tage sind **simulierte deterministische
|
||||
Wettervorhersagen**, keine Live-DWD-Wetterwerte. Standard-Firestorm zeigt
|
||||
Regentropfen/Schnee über serververwaltete Partikel-Emitter, der native
|
||||
OGL-Viewer-Renderer bleibt ein separates Entwicklungsziel.
|
||||
|
||||
## Grenzen und Abnahme
|
||||
|
||||
Alle Skripte prüfen die bisherige Server-Wire-Version, den jeweiligen
|
||||
negativen Chatkanal, den exakten Absendernamen und `NULL_KEY`. Der
|
||||
Kanal ist **kein kryptographischer Identitätsnachweis**, und diese Skripte
|
||||
dürfen nicht als Sicherheits-, Zahlungs- oder Zugangskontrollsystem
|
||||
verwendet werden.
|
||||
|
||||
Die automatischen CI-Tests prüfen Syntaxstruktur, beabsichtigte
|
||||
LSL-Funktionsnamen, gemeinsam verwendete Kanäle und Protokollkennungen.
|
||||
**Ein echter Inworld-LSL-Compilerlauf und Firestorm-Abnahmetests sind
|
||||
vor einem Produktivrollout noch notwendig.** Insbesondere benötigt
|
||||
VectorRender die richtige OSSL-Funktionsfreigabe des Script-Owners.
|
||||
@@ -0,0 +1,143 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Source-contract verification for Generation-1 Inworld LSL companion packs.
|
||||
|
||||
This does NOT imply an inworld compiler or runtime test. Intentionally guard
|
||||
against protocol drift, accidentally unbounded chat or prim-emitter scripts.
|
||||
"""
|
||||
from pathlib import Path
|
||||
import re
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[2]
|
||||
PACKAGES = {
|
||||
"NexTraffic": {
|
||||
"channel": -835421, "source": "NexTraffic", "wire": "NEXTRAFFIC",
|
||||
"files": (
|
||||
"NexTrafficSignal.lsl",
|
||||
"NexTrafficCountdown.lsl",
|
||||
"NexTrafficJunctionMonitor.lsl",
|
||||
),
|
||||
},
|
||||
"NexTransit": {
|
||||
"channel": -835422, "source": "NexTransit", "wire": "NEXTRANSIT",
|
||||
"files": (
|
||||
"NexTransitDepartureBoard.lsl",
|
||||
"NexTransitStopInfo.lsl",
|
||||
"NexTransitRouteHeadSign.lsl",
|
||||
"NexTransitDepartureAnnouncement.lsl",
|
||||
),
|
||||
},
|
||||
"NexSmartLight": {
|
||||
"channel": -835423, "source": "NexSmartLight", "wire": "NEXLIGHT",
|
||||
"files": (
|
||||
"NexSmartLightLamp.lsl",
|
||||
"NexSmartLightLinkset.lsl",
|
||||
"NexSmartLightStatus.lsl",
|
||||
),
|
||||
},
|
||||
"OGLWeather": {
|
||||
"channel": -835311, "source": "OGLWeather", "wire": "OGLWX",
|
||||
"files": (
|
||||
"WeatherForecastBoard.lsl",
|
||||
"WeatherCurrentSign.lsl",
|
||||
"WeatherForecastText.lsl",
|
||||
),
|
||||
},
|
||||
}
|
||||
|
||||
def source_without_literals(source):
|
||||
# Verify balanced delimiters in code, excluding strings and comments.
|
||||
# This is not a substitute for an actual LSL compiler.
|
||||
expression = re.compile(r'"(?:\\.|[^"\\])*"|//[^\n]*|/\*[\s\S]*?\*/')
|
||||
return expression.sub(lambda m: " " * len(m.group()), source)
|
||||
|
||||
def check_balanced(source, file):
|
||||
body = source_without_literals(source)
|
||||
stack = []
|
||||
pairs = {')': '(', ']': '[', '}': '{'}
|
||||
for idx, ch in enumerate(body):
|
||||
if ch in "([{":
|
||||
stack.append((ch, idx))
|
||||
elif ch in ")]}":
|
||||
assert stack and stack[-1][0] == pairs[ch], (
|
||||
f"{file}: unbalanced {ch} at char {idx}")
|
||||
stack.pop()
|
||||
assert not stack, f"{file}: unclosed delimiter {stack[-1] if stack else ''}"
|
||||
assert "default" in body and "state_entry()" in body, file
|
||||
assert "llListen(" in body and "listen(" in body, file
|
||||
# LSL does not have a portable C-style ?: operator.
|
||||
assert " ? " not in body and " : " not in body, file
|
||||
|
||||
docs = (ROOT / "doc/NexVerse/GEN1_INWORLD_LSL_PACKS.md").read_text()
|
||||
seen = set()
|
||||
total = 0
|
||||
for package, info in PACKAGES.items():
|
||||
module_path = (
|
||||
f"addons/{package}/{package}RegionModule.cs"
|
||||
if package != "OGLWeather"
|
||||
else "addons/OGLWeather/OglWeatherRegionModule.cs"
|
||||
)
|
||||
module = (ROOT / module_path).read_text()
|
||||
assert f'"{package}", UUID.Zero' in module, package
|
||||
assert f'"LSLChannel", {info["channel"]}' in module, package
|
||||
for filename in info["files"]:
|
||||
file = ROOT / "addons" / package / filename
|
||||
assert file.is_file(), file
|
||||
assert filename not in seen, filename
|
||||
seen.add(filename)
|
||||
data = file.read_text(encoding="utf-8-sig")
|
||||
check_balanced(data, file)
|
||||
assert f"integer CHANNEL = {info['channel']};" in data, file
|
||||
assert f'"{info["wire"]}"' in data, file
|
||||
assert f'"{info["source"]}"' in data or (
|
||||
package == "OGLWeather" and
|
||||
'string SOURCE = "OGLWeather"' in data
|
||||
), file
|
||||
assert "llParseStringKeepNulls(" in data, file
|
||||
assert "id != NULL_KEY" in data, file
|
||||
assert "on_rez(integer " in data, file
|
||||
assert filename in docs, f"{filename} missing from installation guide"
|
||||
assert "llGiveMoney(" not in data and "llTeleportAgent(" not in data
|
||||
assert "llRezObject(" not in data and "llRezAtRoot(" not in data
|
||||
assert "llHTTPRequest(" not in data
|
||||
if package == "OGLWeather":
|
||||
assert "llParticleSystem(" not in data, (
|
||||
"Weather visuals must remain server-managed, not resident-owned")
|
||||
total += 1
|
||||
assert all(x in docs for x in info["files"]), package
|
||||
|
||||
# All LSL calls used by the legacy/portable scripts must exist in the
|
||||
# shipped LSL API; OSSL dynamic texture calls are allowed explicitly.
|
||||
stub = (ROOT / "OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs").read_text()
|
||||
for package, info in PACKAGES.items():
|
||||
for filename in info["files"]:
|
||||
file = ROOT / "addons" / package / filename
|
||||
source = source_without_literals(file.read_text(encoding="utf-8-sig"))
|
||||
# A few calls may be declared in the LSL ScriptBaseClass API rather
|
||||
# than forwarded as source methods; checks below test regular ll* calls.
|
||||
for name in set(re.findall(r'\b(ll[A-Z][A-Za-z0-9_]*)\s*\(', source)):
|
||||
assert name in stub, f"Unknown/missing LSL binding {name} in {file}"
|
||||
|
||||
assert total == 13, f"Expected 13 companion scripts, got {total}"
|
||||
traffic = (ROOT / "addons/NexTraffic/NexTrafficSignal.lsl").read_text()
|
||||
assert "PHASE_END = serverTime + remaining" in traffic
|
||||
assert "llSetTimerEvent(1.0)" in traffic
|
||||
assert 'CURRENT = "RED"' in traffic
|
||||
transit = (ROOT / "addons/NexTransit/NexTransitDepartureBoard.lsl").read_text()
|
||||
assert 'if (payload != "")' in transit and "if (llGetListLength(rows) > 10)" in transit
|
||||
assert 'osSetDynamicTextureDataFace("", "vector", d,' in transit
|
||||
assert "llSetTexture(" not in transit
|
||||
announce = (ROOT / "addons/NexTransit/NexTransitDepartureAnnouncement.lsl").read_text()
|
||||
assert "integer ANNOUNCE_IN_CHAT = FALSE;" in announce
|
||||
assert "COOLDOWN_SECONDS = 600" in announce
|
||||
assert "llSay(0," in announce
|
||||
linkset = (ROOT / "addons/NexSmartLight/NexSmartLightLinkset.lsl").read_text()
|
||||
assert 'string PREFIX = "LIGHT_";' in linkset
|
||||
assert "PRIM_POINT_LIGHT" in linkset and "CHANGED_LINK" in linkset
|
||||
weather = (ROOT / "addons/OGLWeather/WeatherForecastText.lsl").read_text()
|
||||
assert "llListReplaceList(gDays, [message], slot, slot)" in weather
|
||||
assert "osSetDynamicTextureDataFace" not in weather
|
||||
assert "server-managed" in docs or "Server" in docs
|
||||
assert "Wetter" in docs
|
||||
|
||||
print(f"Generation-1 LSL pack: {total} scripts, 4 server wire protocols, "
|
||||
"13 structural and compatibility contracts PASS (source only)")
|
||||
@@ -86,4 +86,5 @@ assert "bash addon-modules/OGLWeather/build.sh Release" not in prebuild, (
|
||||
assert 'dotnet build -c Release OpenSim.sln' in compile_script
|
||||
print("NexCity + OGLWeather solution bundling: all 4 DLLs checked")
|
||||
|
||||
assert "Verify Generation-1 Inworld LSL companion scripts" in workflow
|
||||
print("NexCity addon contracts PASS: independent plugins, bounded wire, safe disabled defaults")
|
||||
Reference in new issue
Block a user