@rbxts/replecs 0.2.4 → 0.3.0-test1

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.
@@ -47,26 +47,28 @@ export type EntityLookup = Lookup & {
47
47
  }
48
48
 
49
49
  export type EntityChanges = {
50
- tagged: Set<Component>,
51
- component: Map<Component, any>,
52
- removed: {
53
- component: Set<Component>,
54
- tag: Set<Component>,
55
- },
56
-
57
- pair_changed: Map<Component, any>,
58
- pair_added: Set<Component>,
59
- pair_removed: {
60
- component: Set<Component>,
61
- tag: Set<Component>,
62
- },
63
-
64
- relation_added: { [Component]: Set<Entity> },
65
- relation_value: { [Component]: Map<Entity, any> },
66
- relation_removed: {
67
- component: { [Component]: Set<Entity> },
68
- tag: { [Component]: Set<Entity> },
69
- },
50
+ changed: ComponentIndex<any>,
51
+ removed: ComponentIndex<any>,
52
+
53
+ -- these are just aliases for changes.changed, and changes.removed
54
+ -- changes need specific types, so you access these if you need the types, as the other ones are just arrays
55
+ tag_removed: Set<Component>,
56
+ component_removed: Set<Component>,
57
+ unreliable_removed: Set<Component>,
58
+ unreliable_pair_removed: Set<Component>,
59
+ pair_tag_removed: Set<Component>,
60
+ pair_component_removed: Set<Component>,
61
+ relation_tag_removed: { [Component]: Set<Entity> },
62
+ relation_component_removed: { [Component]: Set<Entity> },
63
+
64
+ tag_added: Set<Component>,
65
+ component_changed: Map<Component, any>,
66
+ unreliable_added: Set<Component>,
67
+ unreliable_pair_added: Set<Component>,
68
+ pair_tag_added: Set<Component>,
69
+ pair_component_changed: Map<Component, any>,
70
+ relation_tag_added: { [Component]: Set<Entity> },
71
+ relation_component_changed: { [Component]: Map<Entity, any> },
70
72
  }
71
73
 
72
74
  type PostponedList = ComponentIndex<{ filter: MemberFilter? }>
@@ -147,8 +149,9 @@ local COMPONENT_TYPES = {
147
149
  pair_tag = 3,
148
150
  pair_component = 4,
149
151
  relation = 5,
150
- relation_value = 6,
152
+ relation_component = 6,
151
153
  unreliable = 7,
154
+ unreliable_pair = 8,
152
155
  }
153
156
 
154
157
  local COMPONENT_TYPES_COUNT = COMPONENT_TYPES.unreliable
@@ -189,27 +192,72 @@ local function create_component_indexes<T>(): ComponentIndex<T>
189
192
  end
190
193
 
191
194
  local function create_entity_changes(): EntityChanges
192
- return {
193
- tagged = {},
194
- component = {},
195
- removed = {
196
- component = {},
197
- tag = {},
198
- },
195
+ local tag_removed = {}
196
+ local component_removed = {}
197
+ local unreliable_removed = {}
198
+ local unreliable_pair_removed = {}
199
+ local pair_tag_removed = {}
200
+ local pair_component_removed = {}
201
+ local relation_tag_removed = {}
202
+ local relation_component_removed = {}
199
203
 
200
- pair_added = {},
201
- pair_changed = {},
202
- pair_removed = {
203
- component = {},
204
- tag = {},
205
- },
204
+ local tag_added = {}
205
+ local component_changed = {}
206
+ local unreliable_added = {}
207
+ local unreliable_pair_added = {}
208
+ local pair_tag_added = {}
209
+ local pair_component_changed = {}
210
+ local relation_tag_added = {}
211
+ local relation_component_changed = {}
206
212
 
207
- relation_added = {},
208
- relation_value = {},
209
- relation_removed = {
210
- component = {},
211
- tag = {},
212
- },
213
+ local changed_changes = create_component_indexes() :: ComponentIndex<any>
214
+ local removed_changes = create_component_indexes() :: ComponentIndex<any>
215
+
216
+ changed_changes[COMPONENT_TYPES.tag] = tag_added
217
+ changed_changes[COMPONENT_TYPES.component] = component_changed
218
+
219
+ changed_changes[COMPONENT_TYPES.unreliable] = unreliable_added
220
+ changed_changes[COMPONENT_TYPES.unreliable_pair] = unreliable_pair_added
221
+
222
+ changed_changes[COMPONENT_TYPES.pair_tag] = pair_tag_added
223
+ changed_changes[COMPONENT_TYPES.pair_component] = pair_component_changed
224
+
225
+ changed_changes[COMPONENT_TYPES.relation] = relation_tag_added
226
+ changed_changes[COMPONENT_TYPES.relation_component] = relation_component_changed
227
+
228
+ removed_changes[COMPONENT_TYPES.tag] = tag_removed
229
+ removed_changes[COMPONENT_TYPES.component] = component_removed
230
+
231
+ removed_changes[COMPONENT_TYPES.unreliable] = unreliable_removed
232
+ removed_changes[COMPONENT_TYPES.unreliable_pair] = unreliable_pair_removed
233
+
234
+ removed_changes[COMPONENT_TYPES.pair_tag] = pair_tag_removed
235
+ removed_changes[COMPONENT_TYPES.pair_component] = pair_component_removed
236
+
237
+ removed_changes[COMPONENT_TYPES.relation] = relation_tag_removed
238
+ removed_changes[COMPONENT_TYPES.relation_component] = relation_component_removed
239
+
240
+ return {
241
+ removed = removed_changes,
242
+ changed = changed_changes,
243
+
244
+ tag_removed = tag_removed,
245
+ component_removed = component_removed,
246
+ unreliable_removed = unreliable_removed,
247
+ unreliable_pair_removed = unreliable_pair_removed,
248
+ pair_tag_removed = pair_tag_removed,
249
+ pair_component_removed = pair_component_removed,
250
+ relation_tag_removed = relation_tag_removed,
251
+ relation_component_removed = relation_component_removed,
252
+
253
+ tag_added = tag_added,
254
+ component_changed = component_changed,
255
+ unreliable_added = unreliable_added,
256
+ unreliable_pair_added = unreliable_pair_added,
257
+ pair_tag_added = pair_tag_added,
258
+ pair_component_changed = pair_component_changed,
259
+ relation_tag_added = relation_tag_added,
260
+ relation_component_changed = relation_component_changed,
213
261
  }
214
262
  end
215
263
 
@@ -371,7 +419,7 @@ local function remove_active(storage: StorageGroup, entity: Entity): ActiveEntit
371
419
  return common.log_error "attempted to remove an entity that wasn't active"
372
420
  end
373
421
 
374
- local function get_or_set_component_active(active: ActiveEntity, component: Component, component_type: number)
422
+ local function set_component_active(active: ActiveEntity, component: Component, component_type: number)
375
423
  local components = active.components[component_type]
376
424
  if components[component] == nil then
377
425
  components[component] = true
@@ -440,7 +488,7 @@ local function dissect_component_actives(
440
488
  if is_shared then
441
489
  new_active = new_active or create_new_active()
442
490
 
443
- get_or_set_component_active(new_active, component, component_type)
491
+ set_component_active(new_active, component, component_type)
444
492
  remove_component_active(storage, entity, component, component_type)
445
493
  end
446
494
  end
@@ -464,140 +512,56 @@ local function dissect_component_additions(added: ComponentIndex<boolean>, share
464
512
  return new_added
465
513
  end
466
514
 
467
- local function dissect_component_changes(changes: EntityChanges, shared_index: ComponentIndex<boolean>)
468
- local new_changes: EntityChanges
469
-
470
- -- COMPONENTS
471
-
472
- local shared_component = shared_index[COMPONENT_TYPES.component]
473
- local shared_tag = shared_index[COMPONENT_TYPES.tag]
474
-
475
- for component, change in changes.component do
476
- local is_shared = shared_component and shared_component[component]
477
- if is_shared then
478
- new_changes = new_changes or create_entity_changes()
479
- new_changes.component[component] = change
480
- changes.component[component] = nil
481
- end
482
- end
483
- for tag in changes.tagged do
484
- local is_shared = shared_tag and shared_tag[tag]
485
- if is_shared then
486
- new_changes = new_changes or create_entity_changes()
487
- new_changes.tagged[tag] = true
488
- changes.tagged[tag] = nil
489
- end
490
- end
491
-
492
- local removed_changes = changes.removed
493
- for component in removed_changes.component do
494
- local is_shared = shared_component and shared_component[component]
495
- if is_shared then
496
- new_changes = new_changes or create_entity_changes()
497
- new_changes.removed.component[component] = true
498
- removed_changes.component[component] = nil
499
- end
500
- end
501
- for component in removed_changes.tag do
502
- local is_shared = shared_tag and shared_tag[component]
503
- if is_shared then
504
- new_changes = new_changes or create_entity_changes()
505
- new_changes.removed.tag[component] = true
506
- removed_changes.tag[component] = nil
507
- end
508
- end
509
-
510
- -- PAIRS
511
-
512
- local shared_pair_component = shared_index[COMPONENT_TYPES.pair_component]
513
- local shared_pair_tag = shared_index[COMPONENT_TYPES.pair_tag]
514
-
515
- for id, change in changes.pair_changed do
516
- local is_shared = shared_pair_component and shared_pair_component[id]
517
- if is_shared then
518
- new_changes = new_changes or create_entity_changes()
519
- new_changes.pair_changed[id] = change
520
- changes.pair_changed[id] = nil
521
- end
522
- end
523
- for id in changes.pair_added do
524
- local is_shared = shared_pair_tag and shared_pair_tag[id]
525
- if is_shared then
526
- new_changes = new_changes or create_entity_changes()
527
- new_changes.pair_added[id] = true
528
- changes.pair_added[id] = nil
529
- end
530
- end
531
-
532
- local removed_pairs = changes.pair_removed
533
- for id in removed_pairs.component do
534
- local is_shared = shared_pair_component and shared_pair_component[id]
535
- if is_shared then
536
- new_changes = new_changes or create_entity_changes()
537
- new_changes.pair_removed.component[id] = true
538
- removed_pairs.component[id] = nil
539
- end
540
- end
541
- for id in removed_pairs.tag do
542
- local is_shared = shared_pair_tag and shared_pair_tag[id]
543
- if is_shared then
544
- new_changes = new_changes or create_entity_changes()
545
- new_changes.pair_removed.tag[id] = true
546
- removed_pairs.tag[id] = nil
547
- end
548
- end
549
-
550
- -- RELATIONS
551
-
552
- local shared_relation_value = shared_index[COMPONENT_TYPES.relation_value]
553
- local shared_relation = shared_index[COMPONENT_TYPES.relation]
554
-
555
- for relation, target_values in changes.relation_value do
556
- local is_shared = shared_relation_value and shared_relation_value[relation]
557
-
558
- if is_shared then
559
- new_changes = new_changes or create_entity_changes()
560
- new_changes.relation_value[relation] = target_values
561
- changes.relation_value[relation] = nil
562
- end
563
- end
564
- for relation, targets_added in changes.relation_added do
565
- local is_shared = shared_relation and shared_relation[relation]
566
-
567
- if is_shared then
568
- new_changes = new_changes or create_entity_changes()
569
- new_changes.relation_added[relation] = targets_added
570
- changes.relation_added[relation] = nil
515
+ local function dissect_component_changes(
516
+ entity_changes: EntityChanges,
517
+ shared_index: ComponentIndex<boolean>
518
+ ): EntityChanges
519
+ local new_entity_changes: EntityChanges = nil :: any
520
+ local new_removed: ComponentIndex<boolean> = nil :: any
521
+ local new_changed: ComponentIndex<any> = nil :: any
522
+
523
+ for component_type, components_changed in entity_changes.changed do
524
+ local shared_set = shared_index[component_type]
525
+ for component, change in components_changed do
526
+ local is_shared = shared_set and shared_set[component]
527
+ if is_shared then
528
+ if new_changed then
529
+ new_changed[component_type][component] = change
530
+ components_changed[component] = nil
531
+ else
532
+ new_entity_changes = create_entity_changes()
533
+ new_changed = new_entity_changes.changed
534
+ new_removed = new_entity_changes.removed
535
+ end
536
+ end
571
537
  end
572
538
  end
573
539
 
574
- local removed_relations = changes.relation_removed
575
- for relation, targets_removed in removed_relations.component do
576
- local is_shared = shared_relation and shared_relation[relation]
577
-
578
- if is_shared then
579
- new_changes = new_changes or create_entity_changes()
580
- new_changes.relation_removed.component[relation] = targets_removed
581
- removed_relations.component[relation] = nil
582
- end
583
- end
584
- for relation, targets_removed in removed_relations.tag do
585
- local is_shared = shared_relation and shared_relation[relation]
540
+ for component_type, components_removed in entity_changes.removed do
541
+ local shared_set = shared_index[component_type]
542
+ for component in components_removed do
543
+ local is_shared = shared_set and shared_set[component]
586
544
 
587
- if is_shared then
588
- new_changes = new_changes or create_entity_changes()
589
- new_changes.relation_removed.tag[relation] = targets_removed
590
- removed_relations.tag[relation] = nil
545
+ if is_shared then
546
+ if new_removed then
547
+ new_removed[component_type][component] = true
548
+ components_removed[component] = nil
549
+ else
550
+ new_entity_changes = create_entity_changes()
551
+ new_changed = new_entity_changes.changed
552
+ new_removed = new_entity_changes.removed
553
+ end
554
+ end
591
555
  end
592
556
  end
593
557
 
594
- return new_changes
558
+ return new_entity_changes
595
559
  end
596
560
 
597
561
  local function merge_component_actives(current: ActiveEntity, target: ActiveEntity)
598
562
  for component_type, components in current.components do
599
563
  for component in components do
600
- get_or_set_component_active(target, component, component_type)
564
+ set_component_active(target, component, component_type)
601
565
  end
602
566
  end
603
567
  end
@@ -612,54 +576,21 @@ end
612
576
 
613
577
  local function merge_component_changes(current: EntityChanges, destination: EntityChanges)
614
578
  -- COMPONENTS/TAGS
579
+ local destination_changed = destination.changed
580
+ local destination_removed = destination.removed
615
581
 
616
- for component, change in current.component do
617
- destination.component[component] = change
618
- end
619
- for tag in current.tagged do
620
- destination.tagged[tag] = true
621
- end
622
-
623
- local components_removed = current.removed
624
- for tag in components_removed.component do
625
- destination.removed.component[tag] = true
626
- end
627
- for tag in components_removed.tag do
628
- destination.removed.tag[tag] = true
629
- end
630
-
631
- -- PAIRS
632
-
633
- for id, change in current.pair_changed do
634
- destination.pair_changed[id] = change
635
- end
636
- for id in current.pair_added do
637
- destination.pair_added[id] = true
638
- end
639
-
640
- local pairs_removed = current.pair_removed
641
- for id in pairs_removed.component do
642
- destination.pair_removed.component[id] = true
643
- end
644
- for id in pairs_removed.tag do
645
- destination.pair_removed.tag[id] = true
646
- end
647
-
648
- -- RELATIONS
649
-
650
- for relation, target_values in current.relation_value do
651
- destination.relation_value[relation] = target_values
652
- end
653
- for relation, added_targets in current.relation_added do
654
- destination.relation_added[relation] = added_targets
582
+ for component_type, components_changed in current.changed do
583
+ local destination_components = destination_changed[component_type]
584
+ for component, change in components_changed do
585
+ destination_components[component] = change
586
+ end
655
587
  end
656
588
 
657
- local relation_removed = current.relation_removed
658
- for relation, removed_targets in relation_removed.component do
659
- destination.relation_removed.component[relation] = removed_targets
660
- end
661
- for relation, removed_targets in relation_removed.tag do
662
- destination.relation_removed.tag[relation] = removed_targets
589
+ for component_type, components_removed in current.removed do
590
+ local destination_components = destination_removed[component_type]
591
+ for component, change in components_removed do
592
+ destination_components[component] = change
593
+ end
663
594
  end
664
595
  end
665
596
 
@@ -685,7 +616,7 @@ function masking_controller.merge_component_filter(
685
616
  entity_lookup.filtered_components[component_type][component] = nil
686
617
  remove_component_index_entry(new_storage.shared_with, entity, component, component_type)
687
618
  else
688
- get_or_set_component_active(entity_lookup.storage_group.active[entity], component, component_type)
619
+ set_component_active(entity_lookup.storage_group.active[entity], component, component_type)
689
620
  end
690
621
  entity_lookup.components[component_type][component] = true
691
622
  end
@@ -782,7 +713,7 @@ function masking_controller.move_component_storage(
782
713
  local new_active = get_or_set_active(destination_storage, entity)
783
714
 
784
715
  remove_component_active(storage, entity, component, component_type)
785
- get_or_set_component_active(new_active, component, component_type)
716
+ set_component_active(new_active, component, component_type)
786
717
 
787
718
  set_component_index_entry(destination_storage.shared_with, entity, component, component_type, true)
788
719
  remove_component_index_entry(storage.shared_with, entity, component, component_type)
@@ -797,43 +728,11 @@ function masking_controller.move_component_storage(
797
728
  local changes = storage.changes.changed[entity]
798
729
  if changes then
799
730
  local destination_changes = get_or_set_changed(destination_storage, entity)
800
- if component_type == COMPONENT_TYPES.tag then
801
- destination_changes.tagged[component] = changes.tagged[component]
802
- destination_changes.removed.tag[component] = changes.removed.tag[component]
803
-
804
- changes.tagged[component] = nil
805
- changes.removed.tag[component] = nil
806
- elseif component_type == COMPONENT_TYPES.component then
807
- destination_changes.component[component] = changes.component[component]
808
- destination_changes.removed.component[component] = changes.removed.component[component]
809
-
810
- changes.component[component] = nil
811
- changes.removed.component[component] = nil
812
- elseif component_type == COMPONENT_TYPES.pair_tag then
813
- destination_changes.pair_added[component] = changes.pair_added[component]
814
- destination_changes.pair_removed.tag[component] = changes.pair_removed.tag[component]
815
-
816
- changes.pair_added[component] = nil
817
- changes.pair_removed.tag[component] = nil
818
- elseif component_type == COMPONENT_TYPES.pair_component then
819
- destination_changes.pair_changed[component] = changes.pair_changed[component]
820
- destination_changes.pair_removed.component[component] = changes.pair_removed.component[component]
821
-
822
- changes.pair_changed[component] = nil
823
- changes.pair_removed.component[component] = nil
824
- elseif component_type == COMPONENT_TYPES.relation then
825
- destination_changes.relation_added[component] = changes.relation_added[component]
826
- destination_changes.relation_removed.tag[component] = changes.relation_removed.tag[component]
827
-
828
- changes.relation_added[component] = nil
829
- changes.relation_removed.tag[component] = nil
830
- elseif component_type == COMPONENT_TYPES.relation_value then
831
- destination_changes.relation_value[component] = changes.relation_value[component]
832
- destination_changes.relation_removed.component[component] = changes.relation_removed.component[component]
833
-
834
- changes.relation_value[component] = nil
835
- changes.relation_removed.component[component] = nil
836
- end
731
+ destination_changes.changed[component_type][component] = changes.changed[component_type][component]
732
+ destination_changes.removed[component_type][component] = changes.removed[component_type][component]
733
+
734
+ changes.changed[component_type][component] = nil
735
+ changes.removed[component_type][component] = nil
837
736
  end
838
737
 
839
738
  return destination_storage
@@ -1059,7 +958,7 @@ function masking_controller.start_component(
1059
958
 
1060
959
  if filter == nil then
1061
960
  lookup.components[component_type][component] = true
1062
- get_or_set_component_active(lookup.storage_group.active[entity], component, component_type)
961
+ set_component_active(lookup.storage_group.active[entity], component, component_type)
1063
962
  return
1064
963
  end
1065
964
 
@@ -1067,7 +966,7 @@ function masking_controller.start_component(
1067
966
  local storage_group = masking:get_or_create_storage_group(band_generator.result)
1068
967
  local active = get_or_set_active(storage_group, entity)
1069
968
 
1070
- get_or_set_component_active(active, component, component_type)
969
+ set_component_active(active, component, component_type)
1071
970
  set_component_index_entry(storage_group.shared_with, entity, component, component_type, true)
1072
971
 
1073
972
  local component_lookup: ComponentLookup = {
@@ -1252,19 +1151,6 @@ function masking_controller.allocate_component_stop(
1252
1151
  end
1253
1152
  end
1254
1153
 
1255
- function masking_controller.deallocate_component_start(
1256
- masking: MaskingController,
1257
- entity: Entity,
1258
- component: Component,
1259
- component_type: number
1260
- )
1261
- local storage: StorageGroup = masking:get_component_storage_group(entity, component, component_type)
1262
- local additions = storage.changes.added_components[entity]
1263
- if additions then
1264
- additions[component_type][component] = nil
1265
- end
1266
- end
1267
-
1268
1154
  function masking_controller.deallocate_entity_stop(masking: MaskingController, entity: Entity)
1269
1155
  local deletion_lookup = masking.lookups.deletions.entities[entity]
1270
1156
  if not deletion_lookup then
@@ -1278,6 +1164,19 @@ function masking_controller.deallocate_entity_stop(masking: MaskingController, e
1278
1164
  end
1279
1165
  end
1280
1166
 
1167
+ function masking_controller.deallocate_component_start(
1168
+ masking: MaskingController,
1169
+ entity: Entity,
1170
+ component: Component,
1171
+ component_type: number
1172
+ )
1173
+ local storage: StorageGroup = masking:get_component_storage_group(entity, component, component_type)
1174
+ local additions = storage.changes.added_components[entity]
1175
+ if additions then
1176
+ additions[component_type][component] = nil
1177
+ end
1178
+ end
1179
+
1281
1180
  function masking_controller.deallocate_component_stop(
1282
1181
  masking: MaskingController,
1283
1182
  entity: Entity,
@@ -1299,6 +1198,14 @@ function masking_controller.deallocate_component_stop(
1299
1198
  end
1300
1199
  end
1301
1200
 
1201
+ function masking_controller.allocate_tag_addition(masking: MaskingController, entity: Entity, tag: Component)
1202
+ local storage = masking:get_component_storage_group(entity, tag, COMPONENT_TYPES.tag)
1203
+ local changes = get_or_set_changed(storage, entity)
1204
+
1205
+ changes.tag_added[tag] = true
1206
+ changes.tag_removed[tag] = nil
1207
+ end
1208
+
1302
1209
  function masking_controller.allocate_component_change(
1303
1210
  masking: MaskingController,
1304
1211
  entity: Entity,
@@ -1308,57 +1215,66 @@ function masking_controller.allocate_component_change(
1308
1215
  local storage = masking:get_component_storage_group(entity, component, COMPONENT_TYPES.component)
1309
1216
  local changes = get_or_set_changed(storage, entity)
1310
1217
 
1311
- changes.component[component] = value
1312
- changes.removed.component[component] = nil
1218
+ changes.component_changed[component] = value
1219
+ changes.component_removed[component] = nil
1313
1220
  end
1314
1221
 
1315
- function masking_controller.allocate_tag_addition(masking: MaskingController, entity: Entity, tag: Component)
1316
- local storage = masking:get_component_storage_group(entity, tag, COMPONENT_TYPES.tag)
1222
+ function masking_controller.allocate_unreliable_addition(
1223
+ masking: MaskingController,
1224
+ entity: Entity,
1225
+ component: Component
1226
+ )
1227
+ local storage = masking:get_component_storage_group(entity, component, COMPONENT_TYPES.unreliable)
1317
1228
  local changes = get_or_set_changed(storage, entity)
1318
1229
 
1319
- changes.tagged[tag] = true
1320
- changes.removed.tag[tag] = nil
1230
+ changes.unreliable_added[component] = true
1231
+ changes.unreliable_removed[component] = nil
1321
1232
  end
1322
1233
 
1323
- function masking_controller.allocate_pair_change(masking: MaskingController, entity: Entity, id: Component, value: any)
1324
- local storage = masking:get_component_storage_group(entity, id, COMPONENT_TYPES.pair_component)
1234
+ function masking_controller.allocate_pair_tag_addition(masking: MaskingController, entity: Entity, id: Component)
1235
+ local storage = masking:get_component_storage_group(entity, id, COMPONENT_TYPES.pair_tag)
1325
1236
  local changes = get_or_set_changed(storage, entity)
1326
1237
 
1327
- changes.pair_removed.component[id] = nil
1328
- changes.pair_changed[id] = value
1238
+ changes.pair_tag_added[id] = true
1239
+ changes.pair_tag_removed[id] = nil
1329
1240
  end
1330
1241
 
1331
- function masking_controller.allocate_pair_addition(masking: MaskingController, entity: Entity, id: Component)
1332
- local storage = masking:get_component_storage_group(entity, id, COMPONENT_TYPES.pair_tag)
1242
+ function masking_controller.allocate_pair_component_change(
1243
+ masking: MaskingController,
1244
+ entity: Entity,
1245
+ id: Component,
1246
+ value: any
1247
+ )
1248
+ local storage = masking:get_component_storage_group(entity, id, COMPONENT_TYPES.pair_component)
1333
1249
  local changes = get_or_set_changed(storage, entity)
1334
1250
 
1335
- changes.pair_removed.tag[id] = nil
1336
- changes.pair_added[id] = true
1251
+ changes.pair_component_changed[id] = value
1252
+ changes.pair_component_removed[id] = nil
1337
1253
  end
1338
1254
 
1339
- function masking_controller.allocate_relation_value_change(
1255
+ function masking_controller.allocate_relation_component_change(
1340
1256
  masking: MaskingController,
1341
1257
  entity: Entity,
1342
1258
  relation: Component,
1343
1259
  target: Entity,
1344
1260
  value: any
1345
1261
  )
1346
- local storage = masking:get_component_storage_group(entity, relation, COMPONENT_TYPES.relation_value)
1262
+ local storage = masking:get_component_storage_group(entity, relation, COMPONENT_TYPES.relation_component)
1347
1263
  local changes = get_or_set_changed(storage, entity)
1348
- local values = changes.relation_value[relation]
1264
+ local values = changes.relation_component_changed[relation]
1349
1265
  if values == nil then
1350
1266
  values = {}
1351
- changes.relation_value[relation] = values
1267
+ changes.relation_component_changed[relation] = values
1352
1268
  end
1353
1269
  values[target] = value
1354
1270
 
1355
- local removed = changes.relation_removed.component[relation]
1271
+ local removed = changes.relation_component_removed[relation]
1356
1272
  if removed ~= nil then
1357
1273
  removed[target] = nil
1358
1274
  end
1359
1275
  end
1360
1276
 
1361
- function masking_controller.allocate_relation_addition(
1277
+ function masking_controller.allocate_relation_tag_addition(
1362
1278
  masking: MaskingController,
1363
1279
  entity: Entity,
1364
1280
  relation: Component,
@@ -1366,52 +1282,64 @@ function masking_controller.allocate_relation_addition(
1366
1282
  )
1367
1283
  local storage = masking:get_component_storage_group(entity, relation, COMPONENT_TYPES.relation)
1368
1284
  local changes = get_or_set_changed(storage, entity)
1369
- local targets = changes.relation_added[relation]
1285
+ local targets = changes.relation_tag_added[relation]
1370
1286
  if targets == nil then
1371
1287
  targets = {}
1372
- changes.relation_added[relation] = targets
1288
+ changes.relation_tag_added[relation] = targets
1373
1289
  end
1374
1290
  targets[target] = true
1375
1291
 
1376
- local removed = changes.relation_removed.tag[relation]
1292
+ local removed = changes.relation_tag_removed[relation]
1377
1293
  if removed then
1378
1294
  removed[target] = nil
1379
1295
  end
1380
1296
  end
1381
1297
 
1298
+ function masking_controller.allocate_tag_removal(masking: MaskingController, entity: Entity, tag: Component)
1299
+ local storage = masking:get_component_storage_group(entity, tag, COMPONENT_TYPES.tag)
1300
+ local changes = get_or_set_changed(storage, entity)
1301
+
1302
+ changes.tag_added[tag] = nil
1303
+ changes.tag_removed[tag] = true
1304
+ end
1305
+
1382
1306
  function masking_controller.allocate_component_removal(masking: MaskingController, entity: Entity, component: Component)
1383
1307
  local storage = masking:get_component_storage_group(entity, component, COMPONENT_TYPES.component)
1384
1308
  local changes = get_or_set_changed(storage, entity)
1385
1309
 
1386
- changes.component[component] = nil
1387
- changes.removed.component[component] = true
1310
+ changes.component_changed[component] = nil
1311
+ changes.component_removed[component] = true
1388
1312
  end
1389
1313
 
1390
- function masking_controller.allocate_tag_removal(masking: MaskingController, entity: Entity, tag: Component)
1391
- local storage = masking:get_component_storage_group(entity, tag, COMPONENT_TYPES.tag)
1314
+ function masking_controller.allocate_unreliable_removal(
1315
+ masking: MaskingController,
1316
+ entity: Entity,
1317
+ component: Component
1318
+ )
1319
+ local storage = masking:get_component_storage_group(entity, component, COMPONENT_TYPES.unreliable)
1392
1320
  local changes = get_or_set_changed(storage, entity)
1393
1321
 
1394
- changes.tagged[tag] = nil
1395
- changes.removed.tag[tag] = true
1322
+ changes.unreliable_added[component] = nil
1323
+ changes.unreliable_removed[component] = true
1396
1324
  end
1397
1325
 
1398
1326
  function masking_controller.allocate_pair_tag_removal(masking: MaskingController, entity: Entity, id: Component)
1399
1327
  local storage = masking:get_component_storage_group(entity, id, COMPONENT_TYPES.pair_tag)
1400
1328
  local changes = get_or_set_changed(storage, entity)
1401
1329
 
1402
- changes.pair_added[id] = nil
1403
- changes.pair_removed.tag[id] = true
1330
+ changes.pair_tag_added[id] = nil
1331
+ changes.pair_tag_removed[id] = true
1404
1332
  end
1405
1333
 
1406
1334
  function masking_controller.allocate_pair_component_removal(masking: MaskingController, entity: Entity, id: Component)
1407
1335
  local storage = masking:get_component_storage_group(entity, id, COMPONENT_TYPES.pair_component)
1408
1336
  local changes = get_or_set_changed(storage, entity)
1409
1337
 
1410
- changes.pair_changed[id] = nil
1411
- changes.pair_removed.component[id] = true
1338
+ changes.pair_component_changed[id] = nil
1339
+ changes.pair_component_removed[id] = true
1412
1340
  end
1413
1341
 
1414
- function masking_controller.allocate_relation_value_removal(
1342
+ function masking_controller.allocate_relation_tag_removal(
1415
1343
  masking: MaskingController,
1416
1344
  entity: Entity,
1417
1345
  relation: Component,
@@ -1419,37 +1347,37 @@ function masking_controller.allocate_relation_value_removal(
1419
1347
  )
1420
1348
  local storage = masking:get_component_storage_group(entity, relation, COMPONENT_TYPES.relation)
1421
1349
  local changes = get_or_set_changed(storage, entity)
1422
- local targets = changes.relation_removed.component[relation]
1350
+ local targets = changes.relation_tag_removed[relation]
1423
1351
  if targets == nil then
1424
1352
  targets = {}
1425
- changes.relation_removed.component[relation] = targets
1353
+ changes.relation_tag_removed[relation] = targets
1426
1354
  end
1427
1355
  targets[target] = true
1428
1356
 
1429
- local values = changes.relation_value[relation]
1430
- if values then
1431
- values[target] = nil
1357
+ local added = changes.relation_tag_added[relation]
1358
+ if added then
1359
+ added[target] = nil
1432
1360
  end
1433
1361
  end
1434
1362
 
1435
- function masking_controller.allocate_relation_removal(
1363
+ function masking_controller.allocate_relation_component_removal(
1436
1364
  masking: MaskingController,
1437
1365
  entity: Entity,
1438
1366
  relation: Component,
1439
1367
  target: Entity
1440
1368
  )
1441
- local storage = masking:get_component_storage_group(entity, relation, COMPONENT_TYPES.relation)
1369
+ local storage = masking:get_component_storage_group(entity, relation, COMPONENT_TYPES.relation_component)
1442
1370
  local changes = get_or_set_changed(storage, entity)
1443
- local targets = changes.relation_removed.tag[relation]
1371
+ local targets = changes.relation_component_removed[relation]
1444
1372
  if targets == nil then
1445
1373
  targets = {}
1446
- changes.relation_removed.tag[relation] = targets
1374
+ changes.relation_component_removed[relation] = targets
1447
1375
  end
1448
1376
  targets[target] = true
1449
1377
 
1450
- local added = changes.relation_added[relation]
1451
- if added then
1452
- added[target] = nil
1378
+ local values = changes.relation_component_changed[relation]
1379
+ if values then
1380
+ values[target] = nil
1453
1381
  end
1454
1382
  end
1455
1383