diff --git a/Floater_Manager.lsl b/Floater_Manager.lsl index 40afc4e..faf347b 100644 --- a/Floater_Manager.lsl +++ b/Floater_Manager.lsl @@ -44,6 +44,7 @@ integer DEBUG_PICKS = FALSE; // ALL REGISTERED PLAYERS (for channel mapping - order never changes) list allPlayerNames = []; // Names in registration order +list allPlayerKeys = []; // Keys in registration order (for direct signaling) // CURRENT GAME STATE (Synced from Main Controller) list names = []; // Current player names in game @@ -148,6 +149,7 @@ default { if (llGetListLength(allPlayerNames) >= MAX_PLAYERS) return; allPlayerNames += [name]; + allPlayerKeys += [avKey]; channelIdx = llGetListLength(allPlayerNames) - 1; // --- AUTHENTIC REZ BLOCK --- @@ -245,9 +247,19 @@ default { } else if (num == MSG_CLEANUP_FLOAT) { integer ch = (integer)str; - llRegionSay(ch, "CLEANUP"); - integer foundIdx = ch - FLOATER_BASE_CHANNEL; + key playerToClean = NULL_KEY; + + if (foundIdx >= 0 && foundIdx < llGetListLength(allPlayerKeys)) { + playerToClean = llList2Key(allPlayerKeys, foundIdx); + } + + if (playerToClean != NULL_KEY) { + llRegionSayTo(playerToClean, ch, "CLEANUP"); + } else { + llRegionSay(ch, "CLEANUP"); // Fallback for bots/unknowns + } + if (foundIdx >= 0 && foundIdx < llGetListLength(allPlayerNames)) { string removedPlayer = llList2String(allPlayerNames, foundIdx); @@ -283,8 +295,14 @@ default { if (chanIdx != -1) { // Remove their floater and clear the slot for re-entry dbg("๐Ÿšฎ [Floater Manager] Player " + leaveName + " left - cleaning up floater."); - llRegionSay(FLOATER_BASE_CHANNEL + chanIdx, "CLEANUP"); + key leaveKey = llList2Key(allPlayerKeys, chanIdx); + if (leaveKey != NULL_KEY) { + llRegionSayTo(leaveKey, FLOATER_BASE_CHANNEL + chanIdx, "CLEANUP"); + } else { + llRegionSay(FLOATER_BASE_CHANNEL + chanIdx, "CLEANUP"); + } allPlayerNames = llListReplaceList(allPlayerNames, [""], chanIdx, chanIdx); + allPlayerKeys = llListReplaceList(allPlayerKeys, [NULL_KEY], chanIdx, chanIdx); } } else if (num == MSG_SYNC_GAME_STATE) { @@ -329,15 +347,23 @@ default { } } else if (num == MSG_CLEANUP_ALL_FLOATERS) { - dbg("๐Ÿงน [Floater Manager] Universal Cleanup Triggered - Clearing all " + (string)MAX_PLAYERS + " possible channels."); + dbg("๐Ÿงน [Floater Manager] Universal Cleanup Triggered - Clearing " + (string)MAX_PLAYERS + " channels via llRegionSayTo."); integer i; for (i = 0; i < MAX_PLAYERS; i++) { - // Ensure we hit EVERY possible channel, even if they aren't in our current memory - llRegionSay(FLOATER_BASE_CHANNEL + i, "CLEANUP"); - llSleep(0.05); // Tiny sleep to ensure Sim processes every pulse reliably + key targetAv = NULL_KEY; + if (i < llGetListLength(allPlayerKeys)) targetAv = llList2Key(allPlayerKeys, i); + + integer chTarget = FLOATER_BASE_CHANNEL + i; + if (targetAv != NULL_KEY) { + llRegionSayTo(targetAv, chTarget, "CLEANUP"); + } else { + llRegionSay(chTarget, "CLEANUP"); + } + llSleep(0.05); } // Clear ALL registries to allow fresh re-registration via Rez Guard allPlayerNames = []; + allPlayerKeys = []; players = []; names = []; lives = []; diff --git a/PlayerStatus_Float.lsl b/PlayerStatus_Float.lsl index 04bc656..50b3e17 100644 --- a/PlayerStatus_Float.lsl +++ b/PlayerStatus_Float.lsl @@ -23,6 +23,7 @@ default { listenHandle = llListen(start_param, "", NULL_KEY, ""); myName = ""; llSetRemoteScriptAccessPin(1337); + dbg("๐Ÿ“Š [Status Float] Listener active on channel: " + (string)start_param); } attach(key id) { @@ -30,20 +31,14 @@ default { // HUD MODE: Stop following target in-world llSetTimerEvent(0.0); - // Re-initialize listener for HUD space robustness - // This ensures the HUD remains responsive to CLEANUP signals after attachment - string currentDesc = llGetObjectDesc(); - // The channel is stored in the script by on_rez, but we don't have start_param here. - // If the listener is already active, we don't strictly need to redo it, - // but we'll add a debug whisper to confirm it's alive. - dbg("๐Ÿ“Š [Status Float] HUD Attached to " + llKey2Name(id) + ". Listener active."); - // HUD Scaling & Rotation (Center 2 focus) llSetLinkPrimitiveParamsFast(LINK_THIS, [ - PRIM_SIZE, <0.01, 0.01, 0.01>, // Super tiny to not block view + PRIM_SIZE, <0.05, 0.05, 0.05>, PRIM_ROTATION, ZERO_ROTATION, PRIM_POSITION, <0.0, 0.0, 0.0> ]); + + dbg("๐Ÿ“Š [Status Float] HUD Attached to " + llKey2Name(id)); } else { // BACK TO WORLD: Restore size and follow logic llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_SIZE, <0.2, 0.2, 0.2>]);