From a31b0deea1a776dd47b74de615a2e44956bc5376 Mon Sep 17 00:00:00 2001 From: zontreck Date: Wed, 12 Feb 2025 00:52:08 -0700 Subject: [PATCH] Add ability to transfer well contents via API --- LSL/raw/water_well.lsl | 65 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 63 insertions(+), 2 deletions(-) diff --git a/LSL/raw/water_well.lsl b/LSL/raw/water_well.lsl index 8175b56..6f8383d 100644 --- a/LSL/raw/water_well.lsl +++ b/LSL/raw/water_well.lsl @@ -12,7 +12,7 @@ float g_fEmpty = -1.142; float g_fFull = -0.202; integer g_iRequestTime = 0; string WATER_WELL_NAME = "WoodStoneWaterWell"; -string VERSION = "1.0.1"; +string VERSION = "1.0.2"; integer g_iWaterPrim; integer g_iRoofPrim; integer g_iDestroyed = 0; @@ -55,6 +55,48 @@ integer g_iWaitDelivery = 0; string g_sCallbackURL; key g_kCallbackURLRequest; + + +particles(key kTarget) { + if(kTarget == NULL_KEY) llParticleSystem([]); + else { + llParticleSystem( + [ + // texture parameters: + PSYS_SRC_TEXTURE , "", + PSYS_PART_START_SCALE , <0.67,0.58,0.00>, PSYS_PART_END_SCALE , <0.09,0.09,0.00>, + PSYS_PART_START_COLOR , WATER_PARTICLE, PSYS_PART_END_COLOR , <0.16,0.71,0.83>, + PSYS_PART_START_ALPHA , (float)1.00, PSYS_PART_END_ALPHA , (float)1.00, + // production parameters: + PSYS_SRC_BURST_PART_COUNT , 16, + PSYS_SRC_BURST_RATE , (float)0.10, + PSYS_PART_MAX_AGE , (float)6.54, + PSYS_SRC_MAX_AGE , (float)0.18, + // placement parameters: + PSYS_SRC_PATTERN , 2, + PSYS_SRC_BURST_SPEED_MIN , (float)1.00, PSYS_SRC_BURST_SPEED_MAX , (float)1.00, + PSYS_SRC_BURST_RADIUS , (float)0.00, + // placement parameters (for angles only): + PSYS_SRC_ANGLE_BEGIN , (float)0.00, + PSYS_SRC_ANGLE_END , (float)0.00, + PSYS_SRC_OMEGA , <0.00,0.00,0.00>, + // after-effects & influences: + PSYS_SRC_ACCEL , <0.00,0.00,0.00>, + PSYS_SRC_TARGET_KEY , kTarget, + PSYS_PART_FLAGS , ( 0 // texture & influence options: + // | PSYS_PART_INTERP_COLOR_MASK + | PSYS_PART_INTERP_SCALE_MASK + // | PSYS_PART_BOUNCE_MASK + // | PSYS_PART_WIND_MASK + // | PSYS_PART_FOLLOW_SRC_MASK + | PSYS_PART_FOLLOW_VELOCITY_MASK + | PSYS_PART_TARGET_POS_MASK + // | PSYS_PART_TARGET_LINEAR_MASK + | PSYS_PART_EMISSIVE_MASK + )] ); + } +} + default { state_entry() @@ -122,6 +164,25 @@ default setText(); updateLevel(); } + } else if(llJsonGetValue(sJson, ["cmd"]) == "query" && llJsonGetValue(sJson, ["product"]) == "water well") { + llRegionSayTo(i,c,xtea_encrypt_string(llList2Json(JSON_OBJECT, ["cmd", "reply", "ingredient", "Water", "id", llGetKey()]))); + + } else if(llJsonGetValue(sJson, ["cmd"]) == "use" && llJsonGetValue(sJson, ["id"]) == llGetKey()) { + particles(i); + if(g_iTotalWater == 0) + { + llRegionSayTo(i,global_ingredients,llList2Json(JSON_OBJECT, ["cmd", "use_reply", "id", NULL_KEY, "amount", 0])); + return; + } + + g_iTotalWater--; + updateLevel(); + setText(); + + llSetTimerEvent(1); + + + llRegionSayTo(i,global_ingredients,llList2Json(JSON_OBJECT, ["cmd", "use_reply", "id", llGetKey(), "amount", 4, "ingredient", "Water"])); } } @@ -171,7 +232,7 @@ default return; } } - if(llGetUnixTime() > (g_iLastFillTime + 30)) { + if(llGetUnixTime() > (g_iLastFillTime + 60)) { g_iLastFillTime = llGetUnixTime(); g_iTotalWater ++;