aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/LuaSL
diff options
context:
space:
mode:
authorDavid Walter Seikel2012-02-23 02:39:50 +1000
committerDavid Walter Seikel2012-02-23 02:39:50 +1000
commit3c86a96e75fb6ab5f7d777996703968e5659db7b (patch)
treeba3dfeea4569ffcef09e9ae7c9b156d8848abe4d /LuaSL
parentImplement llGetSubString(). (diff)
downloadSledjHamr-3c86a96e75fb6ab5f7d777996703968e5659db7b.zip
SledjHamr-3c86a96e75fb6ab5f7d777996703968e5659db7b.tar.gz
SledjHamr-3c86a96e75fb6ab5f7d777996703968e5659db7b.tar.bz2
SledjHamr-3c86a96e75fb6ab5f7d777996703968e5659db7b.tar.xz
Implement llSleep(), and wait a bit longer for the test, now that it's sleeping properly.
Diffstat (limited to 'LuaSL')
-rw-r--r--LuaSL/src/LSL.lua2
-rw-r--r--LuaSL/src/LuaSL_main.c14
-rw-r--r--LuaSL/src/LuaSL_test.c2
3 files changed, 15 insertions, 3 deletions
diff --git a/LuaSL/src/LSL.lua b/LuaSL/src/LSL.lua
index 216f0a7..de7f956 100644
--- a/LuaSL/src/LSL.lua
+++ b/LuaSL/src/LSL.lua
@@ -438,7 +438,7 @@ newFunc("", "llSetColor", "vector colour", "integer side")
438newFunc("float", "llGetTime") 438newFunc("float", "llGetTime")
439newFunc("", "llResetTime") 439newFunc("", "llResetTime")
440newFunc("", "llSetTimerEvent", "float seconds") 440newFunc("", "llSetTimerEvent", "float seconds")
441newFunc("", "llSleep", "float seconds") 441newFunc("float", "llSleep", "float seconds") -- Faked return type, it actually does not return anything. This forces it to wait. Actually fully implements llSleep(). B-)
442 442
443 443
444-- TODO - fake this for now. 444-- TODO - fake this for now.
diff --git a/LuaSL/src/LuaSL_main.c b/LuaSL/src/LuaSL_main.c
index daee816..04145b5 100644
--- a/LuaSL/src/LuaSL_main.c
+++ b/LuaSL/src/LuaSL_main.c
@@ -6,11 +6,23 @@ static int CPUs = 4;
6static Eina_Strbuf *clientStream; 6static Eina_Strbuf *clientStream;
7 7
8 8
9static Eina_Bool _sleep_timer_cb(void *data)
10{
11 char *SID = data;
12
13printf("Waking up %s\n", SID);
14 sendToChannel(SID, "0.0", NULL, NULL);
15 return ECORE_CALLBACK_CANCEL;
16}
17
9static void _sendBack(void * data) 18static void _sendBack(void * data)
10{ 19{
11 scriptMessage *message = data; 20 scriptMessage *message = data;
12 21
13 sendBack(message->script->game, message->script->client, message->script->SID, message->message); 22 if (0 == strncmp(message->message, "llSleep(", 8))
23 ecore_timer_add(atof(&(message->message)[8]), _sleep_timer_cb, message->script->SID);
24 else
25 sendBack(message->script->game, message->script->client, message->script->SID, message->message);
14 free(message); 26 free(message);
15} 27}
16 28
diff --git a/LuaSL/src/LuaSL_test.c b/LuaSL/src/LuaSL_test.c
index 1b434f9..9053878 100644
--- a/LuaSL/src/LuaSL_test.c
+++ b/LuaSL/src/LuaSL_test.c
@@ -124,7 +124,7 @@ static Eina_Bool _add(void *data, int type __UNUSED__, Ecore_Con_Event_Server_Ad
124 snprintf(buf, sizeof(buf), "%s/Test sim/objects", PACKAGE_DATA_DIR); 124 snprintf(buf, sizeof(buf), "%s/Test sim/objects", PACKAGE_DATA_DIR);
125 eina_file_dir_list(buf, EINA_TRUE, dirList_compile, game); 125 eina_file_dir_list(buf, EINA_TRUE, dirList_compile, game);
126 // Wait awhile, then quit all scripts we started, for testing. 126 // Wait awhile, then quit all scripts we started, for testing.
127 ecore_timer_add(2.0, _quit_timer_cb, game); 127 ecore_timer_add(3.5, _quit_timer_cb, game);
128 return ECORE_CALLBACK_RENEW; 128 return ECORE_CALLBACK_RENEW;
129} 129}
130 130