Skip to content

Commit

Permalink
Merge pull request #974 from NikkiLacrima/master
Browse files Browse the repository at this point in the history
Update LockGuard handling in oc_particle
  • Loading branch information
SilkieSabra authored Aug 4, 2023
2 parents 6eb6da7 + ff098a1 commit fefcde5
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 1,134 deletions.
2 changes: 1 addition & 1 deletion src/Apps/oc_detach.lsl
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ UserCommand(integer iNum, string sStr, key kID) {

key g_kWearer;
list g_lMenuIDs;
integer g_iMenuStride;
integer g_iMenuStride = 3;
integer g_iLocked=FALSE;
integer ALIVE = -55;
integer READY = -56;
Expand Down
2 changes: 1 addition & 1 deletion src/Apps/oc_undress.lsl
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ UserCommand(integer iNum, string sStr, key kID) {

key g_kWearer;
list g_lMenuIDs;
integer g_iMenuStride;
integer g_iMenuStride = 3;
//list g_lOwner;
//list g_lTrust;
//list g_lBlock;
Expand Down
100 changes: 67 additions & 33 deletions src/collar/oc_particle.lsl
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// This file is part of OpenCollar.
// Copyright (c) 2008 - 2017 Lulu Pink, Nandana Singh, Garvin Twine,
// Copyright (c) 2008 - 2023 Lulu Pink, Nandana Singh, Garvin Twine,
// Cleo Collins, Satomi Ahn, Joy Stipe, Wendy Starfall, Romka Swallowtail,
// lillith xue, littlemousy et al.
// lillith xue, littlemousy, Nikki Lacrima et al.
// Licensed under the GPLv2. See LICENSE for full details.

string g_sScriptVersion = "8.1.0000";
string g_sScriptVersion = "8.3";
integer LINK_CMD_DEBUG=1999;
//MESSAGE MAP
//integer CMD_ZERO = 0;
Expand Down Expand Up @@ -103,6 +103,7 @@ string g_sSettingToken = "particle_";

string g_sParticleTexture = "Silk";
string g_sParticleTextureID; //we need the UUID for llLinkParticleSystem
string g_sChainParticleTexture; //default chains for Lock Guard
string g_sLeashParticleTexture;
//string g_sOccParticleTexture = "4cde01ac-4279-2742-71e1-47ff81cc3529";
string g_sLeashParticleMode;
Expand Down Expand Up @@ -244,7 +245,6 @@ key findPrimKey(string sDesc)
}
return NULL_KEY;
}
doClearChain(string sChainCMD)
{
if (sChainCMD == "all") {
Expand All @@ -259,7 +259,6 @@ doClearChain(string sChainCMD)
list lChains = llParseString2List(sChainCMD,["~"],[]); // Could be a string like "point=target~point=target..." or "point~point..."
integer i;
for (i=0;i<llGetListLength(lChains);++i) lRemChains += [llList2String(llParseString2List(llList2String(lChains,i),["="],[]),0)]; // Remove the targets out of the string
for (i=1;i<llGetNumberOfPrims()+1;++i)
{
string sDesc = llList2String(llGetLinkPrimitiveParams(i,[PRIM_NAME]),0);
Expand Down Expand Up @@ -484,6 +483,7 @@ state active
FindLinkedPrims();
StopParticles(TRUE);
GetSettings(FALSE);
g_sChainParticleTexture = "4cde01ac-4279-2742-71e1-47ff81cc3529"; // Chain texture for LockGuard
//Debug("Starting");
}

Expand Down Expand Up @@ -745,37 +745,71 @@ state active
if (llList2String(lLGCmd,0) == "lockguard") {
key kLGAv = llList2Key(lLGCmd,1); // Request Avatar-UUID
string sLGPoint = llList2String(lLGCmd,2); // Request ChainPoint
string sLGCMD = llList2String(lLGCmd,3); // Request Command
key kLGTarget = llList2Key(lLGCmd,4); // Request Target

// check that we are within leash length
integer point = llList2Integer(llGetObjectDetails(kLGTarget, [OBJECT_ATTACHED_POINT]),0);
if(point != 0 && g_iLeashedToAvatar){
// this is likely a leash holder
jump ovLG;
integer iLeashPrimIndex = llListFindList(g_lLeashPrims, [sLGPoint]);
if ((iLeashPrimIndex<0) && (sLGPoint != "all")) return; // Invalid chain point
integer iLeashPrim = llList2Integer(g_lLeashPrims,iLeashPrimIndex+1);
integer iFCollarPrim = llList2Integer(g_lLeashPrims,llListFindList(g_lLeashPrims, ["fcollar"])+1);
key kLGTarget = NULL_KEY;
integer iLGIndex=3;
integer iIsLinking = FALSE;

while (iLGIndex < llGetListLength(lLGCmd)) {
string sLGCMD = llList2String(lLGCmd,iLGIndex++); // Request Command
if (sLGCMD == "link") {
if (g_iLeashActive && iLeashPrim == iFCollarPrim) return; // Dont replace leash
kLGTarget = llList2Key(lLGCmd,iLGIndex++); // Request Target
// check that we are within leash length
integer point = llList2Integer(llGetObjectDetails(kLGTarget, [OBJECT_ATTACHED_POINT]),0);
if(point == 0 || !g_iLeashedToAvatar){
if(llVecDist(llGetPos(), (vector)llList2String(llGetObjectDetails(kLGTarget, [OBJECT_POS]),0)) > g_iLeashLength){
return;
}
}

iIsLinking = TRUE;
} else if (sLGCMD == "unlink") {
kLGTarget = NULL_KEY; // Request Target
if (sLGPoint == "all") {
integer iCPIndex = 0;
// loop over collar points and unleash if not leashed to avatar on fcollar
while (iCPIndex < llGetListLength(g_lCollarPoints)) {
integer iPrimIndex = llListFindList(g_lLeashPrims, [llList2String(g_lCollarPoints,iCPIndex)]);
integer iPrim = llList2Integer(g_lLeashPrims,iPrimIndex+1);
if (!g_iLeashActive || iPrim != iFCollarPrim) {
llLinkParticleSystem(iPrim,[]);
}
iCPIndex += 3;
}
} else {
if (!g_iLeashActive || iLeashPrim != iFCollarPrim) {
llLinkParticleSystem(iLeashPrim,[]);
}
}
} else if (sLGCMD == "gravity") {
g_vLeashGravity.z = -llList2Float(lLGCmd,iLGIndex++);
} else if (sLGCMD == "life") {
g_fParticleAge = llList2Float(lLGCmd,iLGIndex++);
} else if (sLGCMD == "color") {
g_vLeashColor.x = llList2Float(lLGCmd,iLGIndex++);
g_vLeashColor.y = llList2Float(lLGCmd,iLGIndex++);
g_vLeashColor.z = llList2Float(lLGCmd,iLGIndex++);
} else if (sLGCMD == "size") {
g_vLeashSize.x = llList2Float(lLGCmd,iLGIndex++);
g_vLeashSize.y = llList2Float(lLGCmd,iLGIndex++);
} else if (sLGCMD == "texture") {
g_sChainParticleTexture = llList2Key(lLGCmd,iLGIndex++);
} else if (sLGCMD == "ping") {
llWhisper( g_iChan_LOCKGUARD, "lockguard " + (string)llGetOwner() + " " + sLGPoint + " okay" );
} else {
llWhisper(0, "Unknown LockGuard command: "+sLGCMD);
}
}
if(llVecDist(llGetPos(), (vector)llList2String(llGetObjectDetails(kLGTarget, [OBJECT_POS]),0)) > g_iLeashLength){
return;
if (iIsLinking) {
g_sParticleMode = "Classic";
g_sParticleTextureID = g_sChainParticleTexture;
Particles(iLeashPrim, kLGTarget,g_vLeashSize);
}

@ovLG;
g_iGotLMReplies=TRUE;
integer iIndex = llListFindList(g_lLeashPrims, [sLGPoint]);
if (iIndex > -1 && kLGAv == g_kWearer) {
if (sLGCMD == "link") Particles(llList2Integer(g_lLeashPrims,iIndex+1), kLGTarget,g_vLeashSize);
else if (sLGCMD == "unlink") llLinkParticleSystem(llList2Integer(g_lLeashPrims,iIndex+1),[]);
else if (sLGCMD == "gravity") g_vLeashGravity.z = llList2Float(lLGCmd,4);
else if (sLGCMD == "life") g_fParticleAge = llList2Float(lLGCmd,4);
else if (sLGCMD == "color") {

g_vLeashColor.x = llList2Float(lLGCmd,4);
g_vLeashColor.y = llList2Float(lLGCmd,5);
g_vLeashColor.z = llList2Float(lLGCmd,6);
} else if (sLGCMD == "size") {
g_vLeashSize.x = llList2Float(lLGCmd,4);
g_vLeashSize.y = llList2Float(lLGCmd,5);
} else if (sLGCMD == "texture") g_sParticleTextureID = llList2Key(lLGCmd,4);
}
}
} else if (iChannel == g_iChan_LOCKMEISTER) {
// Implementation of the LMV2 Protocol
Expand Down
14 changes: 0 additions & 14 deletions src/remote/RELEASE_NOTES.md

This file was deleted.

Loading

0 comments on commit fefcde5

Please sign in to comment.