// SPDX-License-Identifier: MIT // Copyright (c) 2026 Incoprea // Night-aware lantern // Not compiled or tested in-world // Setup: Put in a spare lantern prim and owner-touch to enable automatic monitoring. Samples every 30 seconds. // Stop / restore: Touch to stop monitoring and restore the original point-light parameters before removal. // Notes: Reads the simulator parcel sun, which may differ from a visitor’s personal environment. It does not change glow, fullbright, region time, or the environment. // License: see LICENSE in this distribution. // Original Incoprea example. MIT. Not compiled or tested in-world. list original; integer active; integer previous = -1; updateLight() { vector sun = llGetSunDirection(); integer night = sun.z < 0.0; if (night == previous) return; previous = night; llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_POINT_LIGHT, night, <1.0, 0.8, 0.5>, 0.45, 4.0, 1.0]); } default { state_entry() { original = llGetLinkPrimitiveParams(LINK_THIS, [PRIM_POINT_LIGHT]); } touch_start(integer count) { if (llDetectedKey(0) != llGetOwner()) return; active = !active; if (active) { previous = -1; updateLight(); llSetTimerEvent(30.0); } else { llSetTimerEvent(0.0); llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_POINT_LIGHT] + original); } } timer() { updateLight(); } }