@quenty/timesyncservice 8.3.1-canary.d08dd64.0 → 9.0.0-canary.439.eb597ee.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,7 +3,7 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- ## [8.3.1-canary.d08dd64.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/timesyncservice@8.3.0...@quenty/timesyncservice@8.3.1-canary.d08dd64.0) (2024-01-01)
6
+ # [9.0.0-canary.439.eb597ee.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/timesyncservice@8.4.0...@quenty/timesyncservice@9.0.0-canary.439.eb597ee.0) (2024-01-17)
7
7
 
8
8
  **Note:** Version bump only for package @quenty/timesyncservice
9
9
 
@@ -11,6 +11,17 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
11
11
 
12
12
 
13
13
 
14
+ # [8.4.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/timesyncservice@8.3.0...@quenty/timesyncservice@8.4.0) (2024-01-08)
15
+
16
+
17
+ ### Features
18
+
19
+ * Add GetClockFunction() as a method ([131a04d](https://github.com/Quenty/NevermoreEngine/commit/131a04dba7212d07b81baea33a513aba4756ed93))
20
+
21
+
22
+
23
+
24
+
14
25
  # [8.3.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/timesyncservice@8.2.0...@quenty/timesyncservice@8.3.0) (2023-12-28)
15
26
 
16
27
  **Note:** Version bump only for package @quenty/timesyncservice
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/timesyncservice",
3
- "version": "8.3.1-canary.d08dd64.0",
3
+ "version": "9.0.0-canary.439.eb597ee.0",
4
4
  "description": "Quenty's TimeSyncService keeps time synchronized between all clients and the server",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -26,17 +26,18 @@
26
26
  "Quenty"
27
27
  ],
28
28
  "dependencies": {
29
- "@quenty/baseobject": "7.1.1-canary.d08dd64.0",
30
- "@quenty/loader": "7.1.1-canary.d08dd64.0",
29
+ "@quenty/baseobject": "8.0.0-canary.439.eb597ee.0",
30
+ "@quenty/loader": "8.0.0-canary.439.eb597ee.0",
31
31
  "@quenty/maid": "2.6.0",
32
- "@quenty/promise": "7.1.1-canary.d08dd64.0",
33
- "@quenty/remoting": "7.3.1-canary.d08dd64.0",
34
- "@quenty/rx": "8.3.1-canary.d08dd64.0",
35
- "@quenty/signal": "3.1.1-canary.d08dd64.0",
36
- "@quenty/table": "3.4.0"
32
+ "@quenty/promise": "8.0.0-canary.439.eb597ee.0",
33
+ "@quenty/remoting": "8.0.0-canary.439.eb597ee.0",
34
+ "@quenty/rx": "9.0.0-canary.439.eb597ee.0",
35
+ "@quenty/signal": "4.0.0-canary.439.eb597ee.0",
36
+ "@quenty/table": "3.4.0",
37
+ "@quenty/valueobject": "9.0.0-canary.439.eb597ee.0"
37
38
  },
38
39
  "publishConfig": {
39
40
  "access": "public"
40
41
  },
41
- "gitHead": "d08dd641615f51bc83b2fe46f11f41bd95acdec1"
42
+ "gitHead": "eb597ee01e62e4dd91190bb7abd1d1404652d5ff"
42
43
  }
@@ -6,6 +6,7 @@
6
6
  local require = require(script.Parent.loader).load(script)
7
7
 
8
8
  local BaseObject = require("BaseObject")
9
+ local Rx = require("Rx")
9
10
 
10
11
  local MasterClock = setmetatable({}, BaseObject)
11
12
  MasterClock.__index = MasterClock
@@ -36,6 +37,10 @@ function MasterClock.new(remoteEvent, remoteFunction)
36
37
  alive = false
37
38
  end)
38
39
 
40
+ self._clockFunction = function()
41
+ return self:GetTime()
42
+ end
43
+
39
44
  task.delay(5, function()
40
45
  while alive do
41
46
  self:_forceSync()
@@ -46,6 +51,24 @@ function MasterClock.new(remoteEvent, remoteFunction)
46
51
  return self
47
52
  end
48
53
 
54
+ --[=[
55
+ Gets a function that can be used as a clock, like `time` and `tick` are.
56
+
57
+ @return function
58
+ ]=]
59
+ function MasterClock:GetClockFunction()
60
+ return self._clockFunction
61
+ end
62
+
63
+ --[=[
64
+ Observes how much ping the clock has
65
+
66
+ @return Observable<number>
67
+ ]=]
68
+ function MasterClock:ObservePing()
69
+ return Rx.of(0)
70
+ end
71
+
49
72
  --[=[
50
73
  Returns true if the manager has synced with the server
51
74
  @return boolean
@@ -6,6 +6,7 @@
6
6
  local require = require(script.Parent.loader).load(script)
7
7
 
8
8
  local BaseObject = require("BaseObject")
9
+ local ValueObject = require("ValueObject")
9
10
 
10
11
  local SlaveClock = setmetatable({}, BaseObject)
11
12
  SlaveClock.__index = SlaveClock
@@ -24,7 +25,7 @@ function SlaveClock.new(remoteEvent, remoteFunction)
24
25
 
25
26
  self._remoteEvent = remoteEvent or error("No remoteEvent")
26
27
  self._remoteFunction = remoteFunction or error("No remoteFunction")
27
- self._ping = 0
28
+ self._ping = self._maid:Add(ValueObject.new(0, "number"))
28
29
 
29
30
  self._maid:GiveTask(self._remoteEvent.OnClientEvent:Connect(function(timeOne)
30
31
  self:_handleSyncEventAsync(timeOne)
@@ -35,9 +36,26 @@ function SlaveClock.new(remoteEvent, remoteFunction)
35
36
  self._syncedBindable = Instance.new("BindableEvent")
36
37
  self.SyncedEvent = self._syncedBindable.Event
37
38
 
39
+ self._clockFunction = function()
40
+ return self:GetTime()
41
+ end
42
+
38
43
  return self
39
44
  end
40
45
 
46
+ --[=[
47
+ Gets a function that can be used as a clock, like `time` and `tick` are.
48
+
49
+ @return function
50
+ ]=]
51
+ function SlaveClock:GetClockFunction()
52
+ return self._clockFunction
53
+ end
54
+
55
+ function SlaveClock:ObservePing()
56
+ return self._ping:Observe()
57
+ end
58
+
41
59
  --[=[
42
60
  Converts the syncedTime to the original tick value.
43
61
  @param syncedTime number
@@ -77,7 +95,7 @@ end
77
95
  @return number
78
96
  ]=]
79
97
  function SlaveClock:GetPing()
80
- return self._ping
98
+ return self._ping.Value
81
99
  end
82
100
 
83
101
  function SlaveClock:_handleSyncEventAsync(timeOne)
@@ -113,7 +131,7 @@ function SlaveClock:_handleSyncEventAsync(timeOne)
113
131
 
114
132
  self._offset = offset -- Estimated difference between server/client
115
133
  self._pneWayDelay = oneWayDelay -- Estimated time for network events to send. (MSDelay/SMDelay)
116
- self._ping = ping
134
+ self._ping.Value = ping
117
135
 
118
136
  self._syncedBindable:Fire()
119
137
  end