Skip to content

Commit

Permalink
Using custom ring count as minimum count, so now we can teleport more…
Browse files Browse the repository at this point in the history
… than 5
  • Loading branch information
zadium committed Sep 27, 2024
1 parent 9c247c8 commit 1d3fd5d
Show file tree
Hide file tree
Showing 3 changed files with 151 additions and 86 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
## Opensource Stargate ring teleporter ##

Ground ring to teleport multiple avatars (only 5) without sitting (Stargate name is in description), to another position in the same region or another region via notecard "Targets"
Ground ring to teleport multiple avatars without sitting (Stargate name is in description), to another position in the same region or another region via notecard "Targets"

You can use as landing point, it show rings for forign avatar comming to the grid.

Idea is based Stargate Movie, and "APN Ring Transporters (OSGrid/OpenSim) by Spectre Draconia and author: Warin Cascabel, April 2009" (just an Idea)

Expand Down
106 changes: 60 additions & 46 deletions Ring.lsl
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
@description:
@author: Zai Dium
@updated: "2024-09-26 17:32:03"
@version: 3.1
@revision: 331
@updated: "2024-09-28 00:35:40"
@version: 4
@revision: 447
@localfile: ?defaultpath\Stargate\[email protected]
@license: MIT
Expand All @@ -17,7 +17,10 @@
//* User Setting
string ringSound = "RingSound";

integer ring_channel = 101;

integer ask_perm = TRUE;
integer fake = FALSE;

//*
string ringDefaultSound = "e6a27da5-6eed-40e7-b57b-e99ac9eb42fe";
Expand All @@ -30,23 +33,24 @@ vector start_pos; //* starting pos
integer ring_number = 0; //* ring number
integer dieRing = 0; //* if enabled do not process teleports

key soundid;

string toTarget;
vector toPos;
vector toLookAt;
string toType;
key agent;

integer isFinished = FALSE;
key rez_owner;
key rezzer = NULL_KEY;

setTimer()
{
llSetTimerEvent((ring_total_time / ring_count) * (ring_count - ring_number + 1));//* +1 for not be 0
}

sound(){
key soundid = llGetInventoryKey(ringSound);
if (soundid == NULL_KEY)
soundid = ringDefaultSound;
llTriggerSound(soundid, 1.0);
}

Expand All @@ -64,12 +68,7 @@ teleport()
osTeleportAgent(agent, toTarget, toPos, toLookAt);
}

if (isFinished)
{
llSleep(0.2);
// llOwnerSay("die:teleport");
llDie();
}
dieOnFinish();
}

start()
Expand All @@ -78,29 +77,33 @@ start()
llSleep(0.1);
llSetPos(start_pos + <0, 0, ring_height>);
llSleep(0.2);
vector offset;
offset = <0, 0, ring_height * (ring_count - llAbs(ring_number) + 1)>; //* +1 the initial pos
vector offset = <0, 0, ring_height * (ring_count - llAbs(ring_number) + 1)>; //* +1 the initial pos
llSetPos(start_pos + offset);
llSleep(0.2);
}

raise()
{
soundid = llGetInventoryKey(ringSound);
if (soundid == NULL_KEY)
soundid = ringDefaultSound;

sound();

// llOwnerSay("Entry Number: " + (string)ring_number);
if (ring_number != 0)
{
start();
setTimer();
}
}

integer ring_channel = 100;
dieOnFinish()
{
dieRing = TRUE;
if (isFinished)
{
llSetTimerEvent(0);
llSleep(0.2);
//llOwnerSay("die:onfinish");
llDie();
}
}

default
{
Expand All @@ -110,33 +113,36 @@ default
llVolumeDetect(TRUE);
}

on_rez(integer param)
on_rez(integer number)
{
//llOwnerSay("rez"+(string)param);
//llOwnerSay("ring:rez:"+(string)number);
//osGrantScriptPermissions(llGetOwner(), ["osTeleportAgent"]);
ask_perm = llList2Key(llGetParcelDetails(llGetPos(), [PARCEL_DETAILS_OWNER]),0) != llGetOwner();
llVolumeDetect(TRUE);
if (param != 0) //* rezzed from Stargate
if (number != 0) //* rezzed from Stargate
{
llSetPrimitiveParams([PRIM_TEMP_ON_REZ, TRUE]);
llTargetOmega(llRot2Up(llGetLocalRot()), PI, 2.0);
rez_owner = osGetRezzingObject();
llListen(ring_channel, "", rez_owner, "");
ring_number = param;
//llSetObjectDesc((string)param); //* because not saved to `listen` scope :(
llSetObjectName("Ring"+(string)param);
//ring_number = (integer)llGetObjectDesc();
if (ring_number < 0)
rezzer = osGetRezzingObject();
if (number<0)
{
ring_number = -ring_number; //* based on 1 not 0, zero make bug diveded
dieRing = TRUE;
//llOwnerSay("fake");
number = -number;
fake = TRUE;
}
ring_number = number & 0xFF;
ring_count = number >> 8;
//llOwnerSay("ring_number "+(string)ring_number+" / ring_count "+(string)ring_count);
llListen(ring_channel, "", NULL_KEY, "");
llTargetOmega(llRot2Up(llGetLocalRot()), PI, 2.0);
llSetObjectName("ring_"+(string)llAbs(ring_number));
//llOwnerSay("ring: ring_"+(string)ring_number);
if (fake)
dieRing = TRUE;
else
dieRing = FALSE;

raise();
}

}

collision_start(integer num)
Expand All @@ -151,29 +157,38 @@ default
teleport();
}
else
dieRing = TRUE; //* if timer still working
if (isFinished)
setTimer();
dieOnFinish();
}

listen(integer channel, string name, key id, string message)
{
//llOwnerSay("data: "+data);
if (ring_number > 0)
//llOwnerSay("ring,rezzer:"+(string)rezzer);
//llOwnerSay("ring,number:"+(string)ring_number);
if (rezzer == id)
{
//llOwnerSay("ring.message:"+message);
list params = llParseStringKeepNulls(message,[";"],[""]);
string cmd = llList2String(params,0);
params = llDeleteSubList(params, 0, 0);
integer number = 0;
if (cmd == "teleport")
{
//* only not temp rings
agent = llList2Key(params, 0);
if (agent != NULL_KEY)
number = llList2Integer(params, 0);
agent = llList2Key(params, 1);
if ((agent == NULL_KEY) || (agent == "")) //* key from "" is not NULL_KEY
{
toType = llToLower(llList2String(params, 1));
toTarget = llList2String(params, 2);
toPos = llList2Vector(params, 3);
toLookAt = llList2Vector(params, 4);
dieOnFinish();
//llOwnerSay("dieOnFinish,null");
}
else
{
//llOwnerSay("ring:"+llKey2Name(agent));
//llOwnerSay("ring:"+(string)agent);
toType = llToLower(llList2String(params, 2));
toTarget = llList2String(params, 3);
toPos = llList2Vector(params, 4);
toLookAt = llList2Vector(params, 5);
if ((agent == llGetOwner()) || (!ask_perm))
teleport();
else
Expand Down Expand Up @@ -206,6 +221,5 @@ default
dieRing = TRUE;
llSetTimerEvent(30);
}

}
}
Loading

0 comments on commit 1d3fd5d

Please sign in to comment.