@@ -34,6 +34,8 @@ typedef enum ecs_script_node_kind_t {
3434typedef struct ecs_script_node_t {
3535 ecs_script_node_kind_t kind ;
3636 const char * pos ;
37+ uint64_t depends_on ;
38+ bool contains_entities ;
3739} ecs_script_node_t ;
3840
3941struct ecs_script_scope_t {
@@ -45,6 +47,13 @@ struct ecs_script_scope_t {
4547 /* Array with component ids that are added in scope. Used to limit
4648 * archetype moves. */
4749 ecs_vec_t components ; /* vec<ecs_id_t> */
50+
51+ int32_t slot_start ;
52+ int32_t slot_end ;
53+ int32_t dyn_start ;
54+ int32_t dyn_end ;
55+ int32_t control_start ;
56+ int32_t control_end ;
4857};
4958
5059typedef struct ecs_script_id_t {
@@ -66,6 +75,9 @@ typedef struct ecs_script_id_t {
6675 * for entities that are defined inside of templates, which have different
6776 * values for each instantiation. */
6877 bool dynamic ;
78+
79+ int32_t target_slot ;
80+ int32_t id_slot ;
6981} ecs_script_id_t ;
7082
7183typedef struct ecs_script_tag_t {
@@ -107,12 +119,17 @@ struct ecs_script_entity_t {
107119 ecs_script_entity_t * parent ;
108120 ecs_entity_t eval ;
109121 ecs_entity_t eval_kind ;
122+
123+ int32_t slot ;
124+ int32_t dyn_slot ;
125+ uint64_t name_depends_on ;
110126};
111127
112128typedef struct ecs_script_with_t {
113129 ecs_script_node_t node ;
114130 ecs_script_scope_t * expressions ;
115131 ecs_script_scope_t * scope ;
132+ uint64_t expr_depends_on ;
116133} ecs_script_with_t ;
117134
118135typedef struct ecs_script_inherit_t {
@@ -124,6 +141,7 @@ typedef struct ecs_script_pair_scope_t {
124141 ecs_script_node_t node ;
125142 ecs_script_id_t id ;
126143 ecs_script_scope_t * scope ;
144+ uint64_t expr_depends_on ;
127145} ecs_script_pair_scope_t ;
128146
129147typedef struct ecs_script_using_t {
@@ -160,6 +178,8 @@ typedef struct ecs_script_if_t {
160178 ecs_script_scope_t * if_true ;
161179 ecs_script_scope_t * if_false ;
162180 ecs_expr_node_t * expr ;
181+ uint64_t expr_depends_on ;
182+ int32_t control_slot ;
163183} ecs_script_if_t ;
164184
165185typedef struct ecs_script_for_range_t {
@@ -168,6 +188,12 @@ typedef struct ecs_script_for_range_t {
168188 ecs_expr_node_t * from ;
169189 ecs_expr_node_t * to ;
170190 ecs_script_scope_t * scope ;
191+ uint64_t expr_depends_on ;
192+
193+ /* Set when the loop contains a pair with a dynamic element that is added
194+ * to a persistent entity. Such pairs can't be tracked per slot, so the
195+ * matching wildcard is cleared before the loop is re-evaluated. */
196+ bool has_clear_ids ;
171197} ecs_script_for_range_t ;
172198
173199typedef struct ecs_script_include_t {
0 commit comments