Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Update oc_capture.lsl #970

Merged
merged 3 commits into from
Aug 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 21 additions & 10 deletions src/Apps/oc_capture.lsl
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ Copyright 2021

Aria (Tashia Redrose)
* Dec 2019 - Rewrote Capture & Reset Script Version to 1.0
* Ping (Pingout Duffield), Nikki Lacrima * July 2023 - Owner ability to end Capture, Prevent BLOCKED from using Capture

et al.


Licensed under the GPLv2. See LICENSE for full details.
https://github.com/OpenCollarTeam/OpenCollar
*/
Expand Down Expand Up @@ -70,6 +70,7 @@ integer in_range(key kID){
}
}
integer NOTIFY = 1002;
integer NOTIFY_OWNERS=1003;
integer LINK_CMD_DEBUG=1999;
integer REBOOT = -1000;

Expand Down Expand Up @@ -140,9 +141,12 @@ UserCommand(integer iNum, string sStr, key kID) {
return;
}
if (sStr==g_sSubMenu || sStr == "menu "+g_sSubMenu) {
if(iNum == CMD_OWNER)
if(g_iCaptured && (iNum == CMD_OWNER || (iNum == CMD_WEARER && !g_iRisky))){ // ask stop capture before any other changes to capture settings.
StopCapture(kID, iNum);
}
else if(iNum == CMD_OWNER)
Menu(kID, iNum);
else if (kID == g_kCaptor) StopCapture(kID, iNum); // if we are the Captor ask if we want to stop capture instead.
else if (kID == g_kCaptor) StopCapture(kID, iNum);
else llMessageLinked(LINK_SET, NOTIFY, "0%NOACCESS% to capture settings", kID);
}
//else if (iNum!=CMD_OWNER && iNum!=CMD_TRUSTED && kID!=g_kWearer) RelayNotify(kID,"Access denied!",0);
Expand Down Expand Up @@ -180,11 +184,12 @@ UserCommand(integer iNum, string sStr, key kID) {
}
}else if(sChangevalue==""){
// Attempt to capture
if(!g_iEnabled)return;
if(!g_iEnabled && !g_iCaptured)return; //PR #858
if(g_iCaptured){
// Check if ID is captor, as they may be trying to release
if(kID == g_kCaptor){
// Check if ID is captor or owner, as they may be trying to release
if((kID == g_kCaptor)||(iNum == CMD_OWNER)){
// Initiate release now
llMessageLinked(LINK_SET, NOTIFY_OWNERS, llGetUsername(g_kWearer)+" is no longer captured by secondlife:///app/agent/"+(string)g_kCaptor+"/about", g_kWearer);
llMessageLinked(LINK_SET, NOTIFY, "0Capture has ended", g_kCaptor);
llMessageLinked(LINK_SET, NOTIFY, "0You are no longer captured by secondlife:///app/agent/"+(string)g_kCaptor+"/about !", g_kWearer);
g_iCaptured=FALSE;
Expand All @@ -210,7 +215,8 @@ UserCommand(integer iNum, string sStr, key kID) {
g_kCaptor=kID;
llMessageLinked(LINK_SET, NOTIFY, "0Successfuly captured secondlife:///app/agent/"+(string)g_kWearer+"/about", g_kCaptor);
g_iCaptured=TRUE;
llMessageLinked(LINK_SET, NOTIFY, "0You have been captured by secondlife:///app/agent/"+(string)g_kCaptor+"/about ! If you need to free yourself, you can always use your safeword '"+g_sSafeword+"'. Also by saying your prefix capture", g_kWearer);
llMessageLinked(LINK_SET, NOTIFY_OWNERS, llGetUsername(g_kWearer)+" is captured by secondlife:///app/agent/"+(string)g_kCaptor+"/about", g_kWearer);
llMessageLinked(LINK_SET, NOTIFY, "0You have been captured by secondlife:///app/agent/"+(string)g_kCaptor+"/about ! If you need to free yourself, you can always use your safeword '"+g_sSafeword+"'.", g_kWearer);
Commit();
} else {
// Ask the wearer for consent to allow capture
Expand Down Expand Up @@ -322,6 +328,10 @@ state active
}

link_message(integer iSender,integer iNum,string sStr,key kID){
if(iNum == CMD_BLOCKED) {
llMessageLinked(LINK_SET, NOTIFY, "0%NOACCESS% to capture because you have been blocked on this collar", kID);
return;
}
if(iNum == CMD_NOACCESS && sStr == "menu" && g_iEnabled && !g_iCaptured && in_range(kID)) StartCapture(kID, iNum); // When the collar is touched by someone without permission and capture is enabled show the Capture dialog.
if(iNum >= CMD_OWNER && iNum <= CMD_NOACCESS) UserCommand(iNum, sStr, kID);
if(iNum == MENUNAME_REQUEST && sStr == g_sParentMenu)
Expand Down Expand Up @@ -395,6 +405,7 @@ state active
} else if(sMsg == "YES"){
g_iCaptured=TRUE;
llMessageLinked(LINK_SET, NOTIFY, "0Success", g_kCaptor);
llMessageLinked(LINK_SET, NOTIFY_OWNERS, llGetUsername(g_kWearer)+" is captured by secondlife:///app/agent/"+(string)g_kCaptor+"/about", g_kWearer);
Commit();
}
g_iExpire=0;
Expand All @@ -408,8 +419,10 @@ state active
llMessageLinked(LINK_SET, NOTIFY, "0Confirmed. Not Ending Capture", g_kExpireFor);
}else if(sMsg == "YES"){
llMessageLinked(LINK_SET, NOTIFY, "1Capture has ended", g_kCaptor);
llMessageLinked(LINK_SET, NOTIFY_OWNERS, llGetUsername(g_kWearer)+" is no longer captured by secondlife:///app/agent/"+(string)g_kCaptor+"/about", g_kWearer);
g_iCaptured=FALSE;
g_kCaptor=NULL_KEY;
if (iNum == CMD_OWNER) Menu(kID, iNum); // Capture ended by owner, now show Menu
Commit();
}

Expand Down Expand Up @@ -437,8 +450,7 @@ state active
if(Flag&2)g_iRisky=TRUE;
if(Flag&4)g_iCaptured=TRUE;
if(Flag&8)g_iAutoRelease=TRUE;


if(g_iCaptured && g_iAutoRelease) llSetTimerEvent(10); // #858
g_iFlagAtLoad=Flag;
}
} else if(llList2String(lSettings,0) == "auth"){
Expand Down Expand Up @@ -508,5 +520,4 @@ state active
}
}


}