Converted to state-based approach, fixed all known bugs
This commit is contained in:
parent
3dac7b989a
commit
41b402a74e
1 changed files with 38 additions and 8 deletions
|
@ -150,7 +150,6 @@ default
|
||||||
// if (llDetectedType(0) & AGENT)
|
// if (llDetectedType(0) & AGENT)
|
||||||
// if (!doorLock && doorClosed && configCollide) door();
|
// if (!doorLock && doorClosed && configCollide) door();
|
||||||
//}
|
//}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
state loading
|
state loading
|
||||||
|
@ -159,7 +158,7 @@ state loading
|
||||||
{
|
{
|
||||||
loadSettings();
|
loadSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
dataserver(key qid, string data)
|
dataserver(key qid, string data)
|
||||||
{
|
{
|
||||||
if (qid == settingsKey) {
|
if (qid == settingsKey) {
|
||||||
|
@ -266,7 +265,10 @@ state loading
|
||||||
} else {
|
} else {
|
||||||
if (settingsSection == 1) {
|
if (settingsSection == 1) {
|
||||||
llSay(0, "Settings loaded.");
|
llSay(0, "Settings loaded.");
|
||||||
loadSettings(2);
|
if (!loadSettings(2)) {
|
||||||
|
if (doorClosed) state closed;
|
||||||
|
else state opened;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
llSay(0, "Access List loaded. " + (string)llGetListLength(Keys) + " with access.");
|
llSay(0, "Access List loaded. " + (string)llGetListLength(Keys) + " with access.");
|
||||||
if (doorClosed) state closed;
|
if (doorClosed) state closed;
|
||||||
|
@ -281,6 +283,7 @@ state closed
|
||||||
{
|
{
|
||||||
state_entry()
|
state_entry()
|
||||||
{
|
{
|
||||||
|
llPassTouches(0);
|
||||||
doorClosed = TRUE;
|
doorClosed = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -381,6 +384,7 @@ state opened
|
||||||
{
|
{
|
||||||
state_entry()
|
state_entry()
|
||||||
{
|
{
|
||||||
|
llPassTouches(0);
|
||||||
doorClosed = FALSE;
|
doorClosed = FALSE;
|
||||||
if (configSensor && doorActUID != NULL_KEY) {
|
if (configSensor && doorActUID != NULL_KEY) {
|
||||||
if (configAxisCenter) llSensorRepeat("", doorActUID, AGENT, doorActDist + 1.5, TWO_PI, 1.0);
|
if (configAxisCenter) llSensorRepeat("", doorActUID, AGENT, doorActDist + 1.5, TWO_PI, 1.0);
|
||||||
|
@ -399,14 +403,41 @@ state opened
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
touch_start(integer total_number)
|
||||||
|
{
|
||||||
|
if (configDistance > 0.0) {
|
||||||
|
if (llVecDist(llGetPos(), llDetectedPos(0)) <= configDistance) {
|
||||||
|
llResetTime();
|
||||||
|
if (touchDrag) touchDrag = FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
touch(integer total_number)
|
||||||
|
{
|
||||||
|
if (configDistance > 0.0) {
|
||||||
|
if (llVecDist(llGetPos(), llDetectedPos(0)) <= configDistance) {
|
||||||
|
if (llGetTime() >= 0.25 && !touchDrag) {
|
||||||
|
touchDrag = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
touch_end(integer total_number)
|
touch_end(integer total_number)
|
||||||
{
|
{
|
||||||
if (configDistance > 0.0) {
|
if (configDistance > 0.0) {
|
||||||
if (llVecDist(llGetPos(), llDetectedPos(0)) <= configDistance) {
|
if (llVecDist(llGetPos(), llDetectedPos(0)) <= configDistance) {
|
||||||
doorControl = TRUE;
|
if (touchDrag) {
|
||||||
state closing;
|
llSetTimerEvent(0.0);
|
||||||
//if (doorClosed) door(llDetectedKey(0), llVecDist(llGetPos(), llDetectedPos(0)));
|
llSensorRemove();
|
||||||
//else door();
|
touchDrag = FALSE;
|
||||||
|
} else {
|
||||||
|
doorControl = TRUE;
|
||||||
|
state closing;
|
||||||
|
//if (doorClosed) door(llDetectedKey(0), llVecDist(llGetPos(), llDetectedPos(0)));
|
||||||
|
//else door();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -567,4 +598,3 @@ state opening
|
||||||
state opened;
|
state opened;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue