HalcyonGrid / halcyon

Halcyon 3d virtual reality world simulator
BSD 3-Clause "New" or "Revised" License
20 stars 20 forks source link

GetAvatarSeat #23

Open zauberparacelsus opened 6 years ago

zauberparacelsus commented 6 years ago

One shortcoming I just discovered in LSL is that there is no way for a script to detect what your avatar is sitting on. So, I'm proposing this little function:

key iwGetAvatarSeat(key agent);

What it would do is return the UUID of whatever prim the avatar is sitting on, or NULL_KEY if the avatar is not seated.

kf6kjg commented 6 years ago

As opposed to iterating with http://wiki.secondlife.com/wiki/LlAvatarOnLinkSitTarget?

zauberparacelsus commented 6 years ago

llAvatarOnLinkSitTarget does not provide what I want. It only detects what prim an avatar is sitting on if it is called within a linkset containing the seat. iwGetAvatarSeat identifies the seat regardless of what object contains the script.

What brought this on was in Second Life, I had coded a little attachment which would change the pose on my avatar's tail when I sat down or stood up (one pose looked better standing, the other looked better sitting). However, I was annoyed that it would run when sitting on dance pads, so I always had to either detach it or manually switch the tail pose. I wanted to extend my script so that it would ignore dance pads or dance balls, but the capability did not exist.

Granted, implementing it in Halcyon wouldn't get it implemented in SL, but I'm only hanging out in SL while I wait for the Islandz grid to open :P

kf6kjg commented 6 years ago

Ah, I'd automatically assumed that this new command would only work within the context of a script in the linkset. Instead it's a spy command: what is agent X in this same region sitting on? As such I'm not as inclined to like it yet - it may need some heavy restrictions or a reformulation.

On a separate note, if we do go forward with something like this the prefix should be whatever's decided in #16.

zauberparacelsus commented 6 years ago

As far as restrictions go, I'd say it would be adequate to allow the function to read the avatar's seat if either of the following conditions are true:

A) The script is owned by the target avatar B) The target avatar has granted animation permissions to a script that is owned by the same person as the GetAvatarSeat script.