v3.2.4: Direct-Target HUD Fix - Switched to llRegionSayTo for cleanup and restored Goldilocks scale

This commit is contained in:
RebeccaNod1 2026-04-05 10:24:30 -06:00
parent e7b77397c9
commit 8b1dc9dd88
2 changed files with 37 additions and 16 deletions

View file

@ -44,6 +44,7 @@ integer DEBUG_PICKS = FALSE;
// ALL REGISTERED PLAYERS (for channel mapping - order never changes) // ALL REGISTERED PLAYERS (for channel mapping - order never changes)
list allPlayerNames = []; // Names in registration order list allPlayerNames = []; // Names in registration order
list allPlayerKeys = []; // Keys in registration order (for direct signaling)
// CURRENT GAME STATE (Synced from Main Controller) // CURRENT GAME STATE (Synced from Main Controller)
list names = []; // Current player names in game list names = []; // Current player names in game
@ -148,6 +149,7 @@ default {
if (llGetListLength(allPlayerNames) >= MAX_PLAYERS) return; if (llGetListLength(allPlayerNames) >= MAX_PLAYERS) return;
allPlayerNames += [name]; allPlayerNames += [name];
allPlayerKeys += [avKey];
channelIdx = llGetListLength(allPlayerNames) - 1; channelIdx = llGetListLength(allPlayerNames) - 1;
// --- AUTHENTIC REZ BLOCK --- // --- AUTHENTIC REZ BLOCK ---
@ -245,9 +247,19 @@ default {
} }
else if (num == MSG_CLEANUP_FLOAT) { else if (num == MSG_CLEANUP_FLOAT) {
integer ch = (integer)str; integer ch = (integer)str;
llRegionSay(ch, "CLEANUP");
integer foundIdx = ch - FLOATER_BASE_CHANNEL; 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)) { if (foundIdx >= 0 && foundIdx < llGetListLength(allPlayerNames)) {
string removedPlayer = llList2String(allPlayerNames, foundIdx); string removedPlayer = llList2String(allPlayerNames, foundIdx);
@ -283,8 +295,14 @@ default {
if (chanIdx != -1) { if (chanIdx != -1) {
// Remove their floater and clear the slot for re-entry // Remove their floater and clear the slot for re-entry
dbg("🚮 [Floater Manager] Player " + leaveName + " left - cleaning up floater."); 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); allPlayerNames = llListReplaceList(allPlayerNames, [""], chanIdx, chanIdx);
allPlayerKeys = llListReplaceList(allPlayerKeys, [NULL_KEY], chanIdx, chanIdx);
} }
} }
else if (num == MSG_SYNC_GAME_STATE) { else if (num == MSG_SYNC_GAME_STATE) {
@ -329,15 +347,23 @@ default {
} }
} }
else if (num == MSG_CLEANUP_ALL_FLOATERS) { 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; integer i;
for (i = 0; i < MAX_PLAYERS; i++) { for (i = 0; i < MAX_PLAYERS; i++) {
// Ensure we hit EVERY possible channel, even if they aren't in our current memory key targetAv = NULL_KEY;
llRegionSay(FLOATER_BASE_CHANNEL + i, "CLEANUP"); if (i < llGetListLength(allPlayerKeys)) targetAv = llList2Key(allPlayerKeys, i);
llSleep(0.05); // Tiny sleep to ensure Sim processes every pulse reliably
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 // Clear ALL registries to allow fresh re-registration via Rez Guard
allPlayerNames = []; allPlayerNames = [];
allPlayerKeys = [];
players = []; players = [];
names = []; names = [];
lives = []; lives = [];

View file

@ -23,6 +23,7 @@ default {
listenHandle = llListen(start_param, "", NULL_KEY, ""); listenHandle = llListen(start_param, "", NULL_KEY, "");
myName = ""; myName = "";
llSetRemoteScriptAccessPin(1337); llSetRemoteScriptAccessPin(1337);
dbg("📊 [Status Float] Listener active on channel: " + (string)start_param);
} }
attach(key id) { attach(key id) {
@ -30,20 +31,14 @@ default {
// HUD MODE: Stop following target in-world // HUD MODE: Stop following target in-world
llSetTimerEvent(0.0); 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) // HUD Scaling & Rotation (Center 2 focus)
llSetLinkPrimitiveParamsFast(LINK_THIS, [ 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_ROTATION, ZERO_ROTATION,
PRIM_POSITION, <0.0, 0.0, 0.0> PRIM_POSITION, <0.0, 0.0, 0.0>
]); ]);
dbg("📊 [Status Float] HUD Attached to " + llKey2Name(id));
} else { } else {
// BACK TO WORLD: Restore size and follow logic // BACK TO WORLD: Restore size and follow logic
llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_SIZE, <0.2, 0.2, 0.2>]); llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_SIZE, <0.2, 0.2, 0.2>]);