Implemented basic water well and water bucket
This commit is contained in:
parent
f928139088
commit
3dbc618418
17 changed files with 862 additions and 0 deletions
67
LSL/raw/tests/item_sink.lsl
Normal file
67
LSL/raw/tests/item_sink.lsl
Normal file
|
@ -0,0 +1,67 @@
|
|||
#include "Common.lsl"
|
||||
|
||||
integer global_ingredients;
|
||||
list g_lDiscovered = [];
|
||||
key g_kAv;
|
||||
integer g_iChannel;
|
||||
integer g_iListen;
|
||||
|
||||
|
||||
default
|
||||
{
|
||||
state_entry()
|
||||
{
|
||||
XteaKey(PSK);
|
||||
|
||||
global_ingredients = getIngredientChannel(NULL_KEY);
|
||||
llListen(global_ingredients, "", "", "");
|
||||
llOwnerSay("Listening on " + (string)global_ingredients);
|
||||
}
|
||||
|
||||
touch_start(integer t) {
|
||||
if(g_kAv != "") {
|
||||
return;
|
||||
}
|
||||
g_lDiscovered = [];
|
||||
llSay(0, "Looking for nearby ingredients...");
|
||||
|
||||
llWhisper(global_ingredients, xtea_encrypt_string(llList2Json(JSON_OBJECT, ["cmd", "query"])));
|
||||
|
||||
llSetTimerEvent(3);
|
||||
g_kAv = llDetectedKey(0);
|
||||
}
|
||||
|
||||
timer() {
|
||||
list lOpts = StrideOfList(g_lDiscovered, 3, 1, -1);
|
||||
g_iChannel = llRound(llFrand(0xFFFF));
|
||||
g_iListen = llListen(g_iChannel, "", "", "");
|
||||
|
||||
llDialog(g_kAv, "What item do you want to delete?", lOpts, g_iChannel);
|
||||
|
||||
llSetTimerEvent(0);
|
||||
}
|
||||
|
||||
listen(integer c,string n,key i,string m) {
|
||||
if(c == global_ingredients) {
|
||||
|
||||
string params = xtea_decrypt_string(m);
|
||||
if(llJsonGetValue(params,["cmd"]) == "reply"){
|
||||
g_lDiscovered += [llJsonGetValue(params,["id"]), llJsonGetValue(params, ["ingredient"]), i];
|
||||
llWhisper(0, "Discovered: " + llJsonGetValue(params, ["ingredient"]));
|
||||
}
|
||||
} else if(c == g_iChannel) {
|
||||
integer iIndex = llListFindList(g_lDiscovered, [m]);
|
||||
if(iIndex == -1) {
|
||||
llResetScript();
|
||||
} else {
|
||||
string sID = llList2String(g_lDiscovered, iIndex-1);
|
||||
string sObj = llList2String(g_lDiscovered, iIndex+1);
|
||||
|
||||
integer iChan = getIngredientChannel(sObj);
|
||||
llRegionSayTo(sObj, iChan, xtea_encrypt_string(llList2Json(JSON_OBJECT, ["cmd", "use", "id", sID])));
|
||||
|
||||
llResetScript();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue