@rbxts/covenant 1.5.7 → 1.5.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rbxts/covenant",
3
- "version": "1.5.7",
3
+ "version": "1.5.8",
4
4
  "main": "src/init.luau",
5
5
  "scripts": {
6
6
  "build": "rbxtsc",
package/src/covenant.d.ts CHANGED
@@ -5,6 +5,7 @@ export * from "@rbxts/jecs";
5
5
  export type WorldChangesForReplication = Map<string, Delete | Map<string, defined | Remove>>;
6
6
  export type WorldChangesForPrediction = Map<string, Map<string, defined | Remove>>;
7
7
  export interface CovenantProps {
8
+ logging: boolean;
8
9
  requestPayloadSend: () => void;
9
10
  requestPayloadConnect: (callback: (player: Player) => void) => void;
10
11
  replicationSend: (player: Player, worldChanges: WorldChangesForReplication) => void;
@@ -33,7 +34,7 @@ export declare class Covenant {
33
34
  private replicationSendAll;
34
35
  private predictionSend;
35
36
  private predictionConnect;
36
- constructor({ requestPayloadSend, requestPayloadConnect, replicationSend, replicationConnect, replicationSendAll, predictionSend, predictionConnect, }: CovenantProps);
37
+ constructor({ logging, requestPayloadSend, requestPayloadConnect, replicationSend, replicationConnect, replicationSendAll, predictionSend, predictionConnect, }: CovenantProps);
37
38
  private logging;
38
39
  enableLogging(): void;
39
40
  disableLogging(): void;
package/src/covenant.luau CHANGED
@@ -44,6 +44,7 @@ do
44
44
  return self:constructor(...) or self
45
45
  end
46
46
  function Covenant:constructor(_param)
47
+ local logging = _param.logging
47
48
  local requestPayloadSend = _param.requestPayloadSend
48
49
  local requestPayloadConnect = _param.requestPayloadConnect
49
50
  local replicationSend = _param.replicationSend
@@ -62,7 +63,7 @@ do
62
63
  self.started = false
63
64
  self.stringifiedComponentSubscribers = {}
64
65
  self.stringifiedComponentValidators = {}
65
- self.logging = false
66
+ self.logging = logging
66
67
  self.requestPayloadSend = requestPayloadSend
67
68
  self.requestPayloadConnect = requestPayloadConnect
68
69
  self.replicationSend = replicationSend
@@ -370,7 +371,13 @@ do
370
371
  else
371
372
  self._world:set(entity, component, newState)
372
373
  end
373
- if self.logging and RunService:IsStudio() then
374
+ local _condition = self.logging and RunService:IsStudio()
375
+ if _condition then
376
+ local _internalStringifiedComponents = self.internalStringifiedComponents
377
+ local _arg0 = tostring(component)
378
+ _condition = not (_internalStringifiedComponents[_arg0] ~= nil)
379
+ end
380
+ if _condition then
374
381
  print(`{entity}.{component}:{lastState}->{newState}`)
375
382
  end
376
383
  local _stringifiedComponentSubscribers = self.stringifiedComponentSubscribers
@@ -405,20 +412,20 @@ do
405
412
  if entityChanges ~= Delete then
406
413
  local _entityChanges = entityChanges
407
414
  local _exp = tostring(component)
408
- local _condition = newState
409
- if _condition == nil then
410
- _condition = Remove
415
+ local _condition_1 = newState
416
+ if _condition_1 == nil then
417
+ _condition_1 = Remove
411
418
  end
412
- _entityChanges[_exp] = _condition
419
+ _entityChanges[_exp] = _condition_1
413
420
  end
414
421
  end
415
- local _condition = RunService:IsClient()
416
- if _condition then
422
+ local _condition_1 = RunService:IsClient()
423
+ if _condition_1 then
417
424
  local _predictedStringifiedComponents = self.predictedStringifiedComponents
418
425
  local _arg0_2 = tostring(component)
419
- _condition = _predictedStringifiedComponents[_arg0_2] ~= nil
426
+ _condition_1 = _predictedStringifiedComponents[_arg0_2] ~= nil
420
427
  end
421
- if _condition then
428
+ if _condition_1 then
422
429
  local _worldChangesForPrediction = self.worldChangesForPrediction
423
430
  local _arg0_2 = tostring(component)
424
431
  local componentChanges = _worldChangesForPrediction[_arg0_2]
@@ -431,11 +438,11 @@ do
431
438
  end
432
439
  local _componentChanges = componentChanges
433
440
  local _exp = tostring(entity)
434
- local _condition_1 = newState
435
- if _condition_1 == nil then
436
- _condition_1 = Remove
441
+ local _condition_2 = newState
442
+ if _condition_2 == nil then
443
+ _condition_2 = Remove
437
444
  end
438
- _componentChanges[_exp] = _condition_1
445
+ _componentChanges[_exp] = _condition_2
439
446
  end
440
447
  end
441
448
  function Covenant:subscribeComponent(component, subscriber)
@@ -494,6 +501,9 @@ do
494
501
  local _undefinedStringifiedComponents = self.undefinedStringifiedComponents
495
502
  local _arg0 = tostring(c)
496
503
  _undefinedStringifiedComponents[_arg0] = true
504
+ if RunService:IsStudio() and self.logging then
505
+ print(`{({ debug.info(1, "s") })}:{c}`)
506
+ end
497
507
  return c
498
508
  end
499
509
  function Covenant:worldTag()