@rbxts/replecs 0.4.0-rc.2.ts.1 → 0.4.0-rc.3

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.
@@ -891,20 +891,11 @@ local function process_entity_updates(
891
891
  end
892
892
  end
893
893
 
894
- -- one update group: [u16 group mask, deleted ids, added ids, per entity
895
- -- blocks] in read order. deletions come first so a server id reused by an
896
- -- addition in the same group starts from a fresh entity
894
+ -- one update group: [u16 group mask, added ids, per entity blocks, deleted
895
+ -- ids] in read order. creations, then updates, then deletions
897
896
  local function process_update_group(self: Client, c: Cursor, custom_ids: CustomIdMap, variants: Array<any>?)
898
897
  local mask = cursor.readu16(c)
899
898
 
900
- local total_deleted = read_vlq_bitmask(c, mask, UPDATE_GROUP_BITS.deleted_entities)
901
- for _ = 1, total_deleted do
902
- local entity, server_id = find_entity(self, c)
903
- if entity then
904
- delete_entity(self, entity, server_id)
905
- end
906
- end
907
-
908
899
  local total_added = read_vlq_bitmask(c, mask, UPDATE_GROUP_BITS.added_entities)
909
900
  for _ = 1, total_added do
910
901
  process_entity(self, c, custom_ids)
@@ -916,6 +907,14 @@ local function process_update_group(self: Client, c: Cursor, custom_ids: CustomI
916
907
  process_entity_updates(self, entity, c, custom_ids, variants)
917
908
  end)
918
909
  end
910
+
911
+ local total_deleted = read_vlq_bitmask(c, mask, UPDATE_GROUP_BITS.deleted_entities)
912
+ for _ = 1, total_deleted do
913
+ local entity, server_id = find_entity(self, c)
914
+ if entity then
915
+ delete_entity(self, entity, server_id)
916
+ end
917
+ end
919
918
  end
920
919
 
921
920
  local function apply_command_buffer(
@@ -2263,7 +2263,6 @@ end
2263
2263
 
2264
2264
  -- layout (read order is the reverse of write order):
2265
2265
  -- u16 group mask GROUP_BITS, vlq count per set bit
2266
- -- deleted entities entity ids
2267
2266
  -- added entities entity ids
2268
2267
  -- updates per entity:
2269
2268
  -- entity id
@@ -2276,12 +2275,20 @@ end
2276
2275
  -- changed / added / removed, each vlq counted
2277
2276
  -- full relations components then tags, each vlq counted
2278
2277
  -- relations removed relation ids, vlq
2278
+ -- deleted entities entity ids
2279
2279
  local function serialize_update_group(self: Server, group: SerializeGroup): (buffer, Array<any>)
2280
2280
  local c = cursor.new()
2281
2281
  local variants: Array<any> = {}
2282
2282
  local group_mask = 0
2283
2283
 
2284
2284
  local total = 0
2285
+ for _, entity in group.deleted_entities do
2286
+ write_entity_id(self, c, entity)
2287
+ total += 1
2288
+ end
2289
+ group_mask = write_vlq_bitmask(c, total, group_mask, GROUP_BITS.deleted_entities)
2290
+
2291
+ total = 0
2285
2292
  for entity, entry in group.updates do
2286
2293
  serialize_entity_updates(self, c, entity, entry, variants)
2287
2294
  total += 1
@@ -2295,13 +2302,6 @@ local function serialize_update_group(self: Server, group: SerializeGroup): (buf
2295
2302
  end
2296
2303
  group_mask = write_vlq_bitmask(c, total, group_mask, GROUP_BITS.added_entities)
2297
2304
 
2298
- total = 0
2299
- for _, entity in group.deleted_entities do
2300
- write_entity_id(self, c, entity)
2301
- total += 1
2302
- end
2303
- group_mask = write_vlq_bitmask(c, total, group_mask, GROUP_BITS.deleted_entities)
2304
-
2305
2305
  cursor.writeu16(c, group_mask)
2306
2306
 
2307
2307
  return cursor.close(c), variants
@@ -1 +1 @@
1
- return "0.4.0-rc.2.ts.1"
1
+ return "v0.4.0-rc.3"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rbxts/replecs",
3
- "version": "0.4.0-rc.2.ts.1",
3
+ "version": "0.4.0-rc.3",
4
4
  "description": "Replication library for Jecs",
5
5
  "main": "out/init.luau",
6
6
  "types": "out/index.d.ts",