From 8a97cb8c2c1fb513e2c099a1f23d7e31432dfecc Mon Sep 17 00:00:00 2001 From: Kayne Ruse Date: Wed, 18 Feb 2015 00:21:38 +1100 Subject: [PATCH] Checked the tick in Hertz --- rsc/scripts/setup_server.lua | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/rsc/scripts/setup_server.lua b/rsc/scripts/setup_server.lua index 94ed374..a284260 100644 --- a/rsc/scripts/setup_server.lua +++ b/rsc/scripts/setup_server.lua @@ -11,18 +11,26 @@ local function dumpTable(t) end end +--debugging (only works correctly with one room) +globalTickTest = { + ticks = 0, + start = 0 +} + --test the room hooks roomSystem.RoomManager.SetOnCreate(function(room, index) print("", "Creating room: ", roomSystem.Room.GetName(room), index) + globalTickTest.start = os.clock() + --called ~60 times per second - --TODO: test this --- roomSystem.Room.SetOnTick(room, function(room) --- print("", "","tick") --- end) + roomSystem.Room.SetOnTick(room, function(room) + globalTickTest.ticks = globalTickTest.ticks + 1 + end) end) roomSystem.RoomManager.SetOnUnload(function(room, index) print("", "Unloading room: ", roomSystem.Room.GetName(room), index) + print("Time: ", (os.clock() - globalTickTest.start), "Ticks: ", globalTickTest.ticks) end) --NOTE: room 0 is the first that the client asks for, therefore it must exist