@rbxts/replecs 0.2.4 → 0.3.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/out/replecs/client.luau +7 -3
- package/out/replecs/index.d.ts +39 -12
- package/out/replecs/init.luau +22 -0
- package/out/replecs/masking/init.luau +237 -309
- package/out/replecs/server.luau +172 -120
- package/out/replecs/ver.luau +2 -1
- package/out/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -5
|
@@ -47,26 +47,28 @@ export type EntityLookup = Lookup & {
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
export type EntityChanges = {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
},
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
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
|
-
|
|
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
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
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
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
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
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
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
|
|
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
|
-
|
|
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(
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
local
|
|
473
|
-
local
|
|
474
|
-
|
|
475
|
-
for
|
|
476
|
-
local
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
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
|
-
|
|
575
|
-
|
|
576
|
-
|
|
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
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
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
|
|
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
|
-
|
|
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
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
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
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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.
|
|
1312
|
-
changes.
|
|
1218
|
+
changes.component_changed[component] = value
|
|
1219
|
+
changes.component_removed[component] = nil
|
|
1313
1220
|
end
|
|
1314
1221
|
|
|
1315
|
-
function masking_controller.
|
|
1316
|
-
|
|
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.
|
|
1320
|
-
changes.
|
|
1230
|
+
changes.unreliable_added[component] = true
|
|
1231
|
+
changes.unreliable_removed[component] = nil
|
|
1321
1232
|
end
|
|
1322
1233
|
|
|
1323
|
-
function masking_controller.
|
|
1324
|
-
local storage = masking:get_component_storage_group(entity, id, COMPONENT_TYPES.
|
|
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.
|
|
1328
|
-
changes.
|
|
1238
|
+
changes.pair_tag_added[id] = true
|
|
1239
|
+
changes.pair_tag_removed[id] = nil
|
|
1329
1240
|
end
|
|
1330
1241
|
|
|
1331
|
-
function masking_controller.
|
|
1332
|
-
|
|
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.
|
|
1336
|
-
changes.
|
|
1251
|
+
changes.pair_component_changed[id] = value
|
|
1252
|
+
changes.pair_component_removed[id] = nil
|
|
1337
1253
|
end
|
|
1338
1254
|
|
|
1339
|
-
function masking_controller.
|
|
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.
|
|
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.
|
|
1264
|
+
local values = changes.relation_component_changed[relation]
|
|
1349
1265
|
if values == nil then
|
|
1350
1266
|
values = {}
|
|
1351
|
-
changes.
|
|
1267
|
+
changes.relation_component_changed[relation] = values
|
|
1352
1268
|
end
|
|
1353
1269
|
values[target] = value
|
|
1354
1270
|
|
|
1355
|
-
local removed = changes.
|
|
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.
|
|
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.
|
|
1285
|
+
local targets = changes.relation_tag_added[relation]
|
|
1370
1286
|
if targets == nil then
|
|
1371
1287
|
targets = {}
|
|
1372
|
-
changes.
|
|
1288
|
+
changes.relation_tag_added[relation] = targets
|
|
1373
1289
|
end
|
|
1374
1290
|
targets[target] = true
|
|
1375
1291
|
|
|
1376
|
-
local removed = changes.
|
|
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.
|
|
1387
|
-
changes.
|
|
1310
|
+
changes.component_changed[component] = nil
|
|
1311
|
+
changes.component_removed[component] = true
|
|
1388
1312
|
end
|
|
1389
1313
|
|
|
1390
|
-
function masking_controller.
|
|
1391
|
-
|
|
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.
|
|
1395
|
-
changes.
|
|
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.
|
|
1403
|
-
changes.
|
|
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.
|
|
1411
|
-
changes.
|
|
1338
|
+
changes.pair_component_changed[id] = nil
|
|
1339
|
+
changes.pair_component_removed[id] = true
|
|
1412
1340
|
end
|
|
1413
1341
|
|
|
1414
|
-
function masking_controller.
|
|
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.
|
|
1350
|
+
local targets = changes.relation_tag_removed[relation]
|
|
1423
1351
|
if targets == nil then
|
|
1424
1352
|
targets = {}
|
|
1425
|
-
changes.
|
|
1353
|
+
changes.relation_tag_removed[relation] = targets
|
|
1426
1354
|
end
|
|
1427
1355
|
targets[target] = true
|
|
1428
1356
|
|
|
1429
|
-
local
|
|
1430
|
-
if
|
|
1431
|
-
|
|
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.
|
|
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.
|
|
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.
|
|
1371
|
+
local targets = changes.relation_component_removed[relation]
|
|
1444
1372
|
if targets == nil then
|
|
1445
1373
|
targets = {}
|
|
1446
|
-
changes.
|
|
1374
|
+
changes.relation_component_removed[relation] = targets
|
|
1447
1375
|
end
|
|
1448
1376
|
targets[target] = true
|
|
1449
1377
|
|
|
1450
|
-
local
|
|
1451
|
-
if
|
|
1452
|
-
|
|
1378
|
+
local values = changes.relation_component_changed[relation]
|
|
1379
|
+
if values then
|
|
1380
|
+
values[target] = nil
|
|
1453
1381
|
end
|
|
1454
1382
|
end
|
|
1455
1383
|
|