secondlife / jira-archive

3 stars 0 forks source link

[BUG-232261] llSitOnLink() breaks sit targets when targeting an agent while they are teleporting. llAvatarOnSitTarget() continues to return a key with no sitter. Sitting is then blocked. #9571

Open sl-service-account opened 2 years ago

sl-service-account commented 2 years ago

Information

Rez a cube and save the following script with an experience that you have allowed on your person and over the land you will be testing with:

Sit(key k)
{
    integer i;
    if ((i = llSitOnLink(k,llGetLinkNumber())) == 1)
    {
        llSay(0,"llSitOnLink(" + (string)k + ") = " + (string)i + ", llAvatarOnSitTarget() = " + (string)llAvatarOnSitTarget());
    }
    else
    {
        llSay(0,"llSitOnLink(" + (string)k + ") = " + (string)i + "(" + llList2String([
            "This script is not running as part of an experience.",
            "You are not participating in the experience.",
            "Unable to find an open sit target.",
            "Unable to find you.",
            "Unable to find specified link.",
            "You are not allowed on the parcel.",
            "This is not a valid sit object.",
            "Unknown sit error " + (string)i + " has occurred."],llListFindList([-1,-2,-3,-4,-5,-6,-7],[i])) + "), llAvatarOnSitTarget() = " + (string)llAvatarOnSitTarget());
    }
}
key last_sitter = NULL_KEY;
default
{
    state_entry()
    {
        llSetLinkPrimitiveParamsFast(LINK_SET,[PRIM_SIT_TARGET,TRUE,<0.0,0.0,-0.35>,ZERO_ROTATION]);
    }
    on_rez(integer i)
    {
        llResetScript();
    }
    touch_end(integer i)
    {
        key dk = llDetectedKey(0);
        llSay(0,"touch_end() - llAvatarOnSitTarget() = " + (string)llAvatarOnSitTarget() + ", Sitting " + (string)dk);
        Sit(dk);
    }
    changed(integer i)
    {
        if (i & CHANGED_LINK)
        {
            key ast = llAvatarOnSitTarget();
            if (ast)
            {
                llSay(0,"changed(" + (string)i + ") llAvatarOnSitTarget() = " + (string)ast);
                last_sitter = ast;
            }
            else if (last_sitter)
            {
                float f = llFabs((float)llGetObjectDesc());
                llSleep(f);
                llSay(0,"changed(" + (string)i + ") llAvatarOnSitTarget() = " + (string)ast + ", llSleep() = " + (string)f + ", llGetAgentSize() = " + (string)llGetAgentSize(last_sitter) + ", Sitting " + (string)last_sitter);
                Sit(last_sitter);
            }
        }
    }
}

Have an alt present so they can see the test chat results since you yourself might not.

Click the object. You should be sat. Now, while sitting, teleport to a different region.

Return back to the region you teleported from and click the object. It should tell you that there are no open sit targets. llAvatarOnSitTarget() now returns your key and will continue to do so until the region is restarted even if the script is reset or the sit target is updated/removed.

Alternatively, change sleep value by updating object desc.

Sleeps of 0.5 seconds or greater seem to deter the condition, but it is unknown if that works for everyone, especially those with more attachments.

The following alternative method also repros (put a landmark to a different region in the object's inventory and click):

Sit(key k)
{
    integer i;
    if ((i = llSitOnLink(k,llGetLinkNumber())) == 1)
    {
        llSay(0,"llSitOnLink(" + (string)k + ") = " + (string)i + ", llAvatarOnSitTarget() = " + (string)llAvatarOnSitTarget());
    }
    else
    {
        llSay(0,"llSitOnLink(" + (string)k + ") = " + (string)i + "(" + llList2String([
            "This script is not running as part of an experience.",
            "You are not participating in the experience.",
            "Unable to find an open sit target.",
            "Unable to find you.",
            "Unable to find specified link.",
            "You are not allowed on the parcel.",
            "This is not a valid sit object.",
            "Unknown sit error " + (string)i + " has occurred."],llListFindList([-1,-2,-3,-4,-5,-6,-7],[i])) + "), llAvatarOnSitTarget() = " + (string)llAvatarOnSitTarget());
    }
}
default
{
    state_entry()
    {
        llSetLinkPrimitiveParamsFast(LINK_SET,[PRIM_SIT_TARGET,TRUE,<0.0,0.0,-0.35>,ZERO_ROTATION]);
    }
    on_rez(integer i)
    {
        llResetScript();
    }
    touch_end(integer i)
    {
        key k = llDetectedKey(0);
        if (llGetInventoryNumber(INVENTORY_LANDMARK))
        {
            llSay(0,"llRequestExperiencePermissions(" + (string)k + ")");
            llRequestExperiencePermissions(k,"");
        }
        else
        {
            llSay(0,"No landmarks in inventory...");
        }
    }
    experience_permissions(key k)
    {
        if (llAvatarOnSitTarget())
        {
            llSay(0,"experience_permissions() llAvatarOnSitTarget() = " + (string)llAvatarOnSitTarget());
            return;
        }
        float f = llFabs((float)llGetObjectDesc());
        llSay(0,"experience_permissions() llTeleportAgent(" + (string)k + ")");
        llTeleportAgent(k,llGetInventoryName(INVENTORY_LANDMARK,0),ZERO_VECTOR,ZERO_VECTOR);
        llSleep(f);
        llSay(0,"experience_permissions() llAvatarOnSitTarget() = " + (string)llAvatarOnSitTarget() + ", llSleep() = " + (string)f + ", llGetAgentSize() = " + (string)llGetAgentSize(k) + ", Sitting " + (string)k);
        Sit(k);
    }
    experience_permissions_denied(key k, integer i)
    {
        llSay(0,"experience_permissions_denied(" + (string)k + ") Reason(" + (string)i + "): " + llGetExperienceErrorMessage(i));
    }
}

Links

Related

Original Jira Fields | Field | Value | | ------------- | ------------- | | Issue | BUG-232261 | | Summary | llSitOnLink() breaks sit targets when targeting an agent while they are teleporting. llAvatarOnSitTarget() continues to return a key with no sitter. Sitting is then blocked. | | Type | Bug | | Priority | Unset | | Status | Accepted | | Resolution | Triaged | | Reporter | Lucia Nightfire (lucia.nightfire) | | Created at | 2022-06-14T04:11:23Z | | Updated at | 2022-06-14T17:00:59Z | ``` { 'Build Id': 'unset', 'Business Unit': ['Platform'], 'Date of First Response': '2022-06-14T11:07:17.673-0500', 'ReOpened Count': 0.0, 'Severity': 'Unset', 'System': 'SL Simulator', 'Target Viewer Version': 'viewer-development', 'What just happened?': 'Rez a cube and save the following script with an experience that you have allowed on your person and over the land you will be testing with:\r\n\r\nScript\r\n\r\nClick the object.\r\nYou should be sat.\r\nNow, while sitting, teleport to a different region.\r\n\r\nReturn back to the region you teleported from and click the object.\r\nIt should tell you that there are no open sit targets.\r\nllAvatarOnSitTarget() now returns your key and will conitue to do so until the region is restarted.', 'What were you doing when it happened?': '?', 'What were you expecting to happen instead?': '?', } ```
sl-service-account commented 2 years ago

Maestro Linden commented at 2022-06-14T16:07:18Z

I can confirm this behavior in Second Life Server 2022-05-27.572237:

  1. Alt touches object to cause it to force sitting, which triggers this output: ```Java touch_end() - llAvatarOnSitTarget() = 00000000-0000-0000-0000-000000000000, Sitting 70243b06-a65e-4e2b-b419-4844fbc3ea11 llSitOnLink(70243b06-a65e-4e2b-b419-4844fbc3ea11) = 1, llAvatarOnSitTarget() = 70243b06-a65e-4e2b-b419-4844fbc3ea11 changed(32) llAvatarOnSitTarget() = 70243b06-a65e-4e2b-b419-4844fbc3ea11
  2. While the agent is seated, they TP to a remote region.
    • In the CHANGED_LINK event, llAvatarOnSitTarget() correctly shows that no agent is currently seated (in the 1st line). However, as soon as llSitOnLink() is called, it apparently succeeds and updates llAvatarOnSitTarget() to the agent that is already TPIng away:
      changed(32) llAvatarOnSitTarget() = 00000000-0000-0000-0000-000000000000, llSleep() = 0.000000, llGetAgentSize() = <0.45000, 0.60000, 1.77093>, Sitting 70243b06-a65e-4e2b-b419-4844fbc3ea11
      llSitOnLink(70243b06-a65e-4e2b-b419-4844fbc3ea11) = 1, llAvatarOnSitTarget() = 70243b06-a65e-4e2b-b419-4844fbc3ea11
  3. While the original sitting agent is away, another agent touches the object to try to sit, which triggers this behavior. This fails, as the departed agent still appears to be sitting: ```Java touch_end() - llAvatarOnSitTarget() = 70243b06-a65e-4e2b-b419-4844fbc3ea11, Sitting e1a51880-d7b5-4c00-800d-91664f5b84c0 llSitOnLink(e1a51880-d7b5-4c00-800d-91664f5b84c0) = -3(Unable to find an open sit target.), llAvatarOnSitTarget() = 70243b06-a65e-4e2b-b419-4844fbc3ea11

    
    
    Rather than this behavior, the llSitOnTarget() call in (2) should fail with SIT_INVALID_AGENT, as the agent is in the process of teleporting away.
    
    I don't see this behavior with a traditional chair script (not using llSitOnLink()); when a sitting agent TPs away, llAvatarOnSitTarget() correctly resets to NULL_KEY.