@rbxts/replecs 0.1.0-alpha8 → 0.1.0-alpha9

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.
@@ -531,10 +531,14 @@ local function tobinary(n: number): string
531
531
  return string.rep("0", 8 - #result) .. result
532
532
  end
533
533
 
534
+ local BYTES = table.create(6)
535
+
534
536
  function bitmask.tostring(self: Bitmask): string
537
+ local buf = self.buffer
538
+
535
539
  local highest_entry = -1
536
540
  for i = self.entries - 1, 0, -1 do
537
- local value = bitmask.read(self, i)
541
+ local value = buffer.readu32(buf, i * BYTES_PER_ENTRY)
538
542
  if value ~= 0 then
539
543
  highest_entry = i
540
544
  break
@@ -545,12 +549,12 @@ function bitmask.tostring(self: Bitmask): string
545
549
  return ""
546
550
  end
547
551
 
548
- local str = ""
552
+ table.clear(BYTES)
549
553
  for i = 0, highest_entry do
550
- local value = bitmask.read(self, i)
551
- str ..= tobinary(value)
554
+ table.insert(BYTES, buffer.readu32(buf, i * BYTES_PER_ENTRY))
552
555
  end
553
- return str
556
+
557
+ return table.concat(BYTES, "-")
554
558
  end
555
559
 
556
560
  utils.bitmask = {
@@ -633,36 +637,6 @@ function utils.read_number(buf: buffer, offset: number, span: number): (number,
633
637
  end
634
638
  end
635
639
 
636
- function utils.remove_all_relations(world: World, entity: Entity, relation: Entity)
637
- local entity_index = jecs.entity_index_try_get_fast(world.entity_index :: any, entity :: any)
638
- if not entity_index then
639
- return
640
- end
641
- local archetype = entity_index.archetype
642
-
643
- local wildcard = PAIR(relation, WILDCARD) :: any
644
- local idr = world.component_index[wildcard]
645
- if not idr then
646
- return
647
- end
648
-
649
- local archetype_id = archetype.id
650
- local count = idr.counts[archetype_id]
651
- if not count then
652
- return
653
- end
654
-
655
- local start = idr.records[archetype_id]
656
- if not start then
657
- return
658
- end
659
-
660
- for i = start, start + count - 1 do
661
- local pair = archetype.types[i]
662
- world:remove(entity, pair :: any)
663
- end
664
- end
665
-
666
640
  function utils.setbit(mask: number, bit: number)
667
641
  return bit32.bor(mask, bit32.lshift(1, bit))
668
642
  end
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rbxts/replecs",
3
- "version": "0.1.0-alpha8",
3
+ "version": "0.1.0-alpha9",
4
4
  "description": "Replication library for Jecs",
5
5
  "main": "out/init.lua",
6
6
  "types": "out/index.d.ts",
@@ -13,6 +13,7 @@
13
13
  },
14
14
  "files": [
15
15
  "out",
16
+ "!docs/**/*",
16
17
  "!**/*.tsbuildinfo",
17
18
  "!**/*.spec.lua",
18
19
  "!**/*.spec.d.ts"