Checked the tick in Hertz

This commit is contained in:
Kayne Ruse
2015-02-18 00:21:38 +11:00
parent e011e6bdc5
commit 8a97cb8c2c
+12 -4
View File
@@ -11,18 +11,26 @@ local function dumpTable(t)
end end
end end
--debugging (only works correctly with one room)
globalTickTest = {
ticks = 0,
start = 0
}
--test the room hooks --test the room hooks
roomSystem.RoomManager.SetOnCreate(function(room, index) roomSystem.RoomManager.SetOnCreate(function(room, index)
print("", "Creating room: ", roomSystem.Room.GetName(room), index) print("", "Creating room: ", roomSystem.Room.GetName(room), index)
globalTickTest.start = os.clock()
--called ~60 times per second --called ~60 times per second
--TODO: test this roomSystem.Room.SetOnTick(room, function(room)
-- roomSystem.Room.SetOnTick(room, function(room) globalTickTest.ticks = globalTickTest.ticks + 1
-- print("", "","tick") end)
-- end)
end) end)
roomSystem.RoomManager.SetOnUnload(function(room, index) roomSystem.RoomManager.SetOnUnload(function(room, index)
print("", "Unloading room: ", roomSystem.Room.GetName(room), index) print("", "Unloading room: ", roomSystem.Room.GetName(room), index)
print("Time: ", (os.clock() - globalTickTest.start), "Ticks: ", globalTickTest.ticks)
end) end)
--NOTE: room 0 is the first that the client asks for, therefore it must exist --NOTE: room 0 is the first that the client asks for, therefore it must exist