From 3c86a96e75fb6ab5f7d777996703968e5659db7b Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Thu, 23 Feb 2012 02:39:50 +1000 Subject: Implement llSleep(), and wait a bit longer for the test, now that it's sleeping properly. --- LuaSL/src/LSL.lua | 2 +- LuaSL/src/LuaSL_main.c | 14 +++++++++++++- LuaSL/src/LuaSL_test.c | 2 +- 3 files changed, 15 insertions(+), 3 deletions(-) (limited to 'LuaSL') 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") newFunc("float", "llGetTime") newFunc("", "llResetTime") newFunc("", "llSetTimerEvent", "float seconds") -newFunc("", "llSleep", "float seconds") +newFunc("float", "llSleep", "float seconds") -- Faked return type, it actually does not return anything. This forces it to wait. Actually fully implements llSleep(). B-) -- 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; static Eina_Strbuf *clientStream; +static Eina_Bool _sleep_timer_cb(void *data) +{ + char *SID = data; + +printf("Waking up %s\n", SID); + sendToChannel(SID, "0.0", NULL, NULL); + return ECORE_CALLBACK_CANCEL; +} + static void _sendBack(void * data) { scriptMessage *message = data; - sendBack(message->script->game, message->script->client, message->script->SID, message->message); + if (0 == strncmp(message->message, "llSleep(", 8)) + ecore_timer_add(atof(&(message->message)[8]), _sleep_timer_cb, message->script->SID); + else + sendBack(message->script->game, message->script->client, message->script->SID, message->message); free(message); } 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 snprintf(buf, sizeof(buf), "%s/Test sim/objects", PACKAGE_DATA_DIR); eina_file_dir_list(buf, EINA_TRUE, dirList_compile, game); // Wait awhile, then quit all scripts we started, for testing. - ecore_timer_add(2.0, _quit_timer_cb, game); + ecore_timer_add(3.5, _quit_timer_cb, game); return ECORE_CALLBACK_RENEW; } -- cgit v1.1