@@ -1171,6 +1171,28 @@ static auto get_with_field_ids(
11711171 return with_field_ids;
11721172}
11731173
1174+ static auto find_capabilities_for ( //
1175+ auto sys_like_id,
1176+ auto id
1177+ ) -> std::optional<ecsact_system_capability> {
1178+ for (auto && [comp_id, caps] : ecsact::meta::system_capabilities (sys_like_id)) {
1179+ if (ecsact_id_cast<decltype (id)>(comp_id) == id) {
1180+ return caps;
1181+ }
1182+ }
1183+
1184+ auto parent = ecsact::meta::get_parent_system_id (
1185+ // NOTE: this cast only works because we wrote the meta runtime for the
1186+ // interpreter. This is bad practice.
1187+ static_cast <ecsact_system_id>(sys_like_id)
1188+ );
1189+ if (parent) {
1190+ return find_capabilities_for (*parent, id);
1191+ }
1192+
1193+ return {};
1194+ }
1195+
11741196static auto eval_system_with_statement_data_common (
11751197 ecsact_system_like_id sys_like_id,
11761198 ecsact_component_like_id comp_like_id,
@@ -1201,6 +1223,23 @@ static auto eval_system_with_statement_data_common(
12011223 };
12021224 }
12031225
1226+ auto field_type =
1227+ ecsact::meta::get_field_type (comp_like_id, *assoc_field_id);
1228+
1229+ if (field_type.kind == ECSACT_TYPE_KIND_BUILTIN) {
1230+ if (field_type.type .builtin != ECSACT_ENTITY_TYPE) {
1231+ return ecsact_eval_error{
1232+ .code = ECSACT_EVAL_ERR_INVALID_ASSOC_FIELD_TYPE,
1233+ .relevant_content = fields[i],
1234+ };
1235+ }
1236+ } else if (field_type.kind != ECSACT_TYPE_KIND_FIELD_INDEX) {
1237+ return ecsact_eval_error{
1238+ .code = ECSACT_EVAL_ERR_INVALID_ASSOC_FIELD_TYPE,
1239+ .relevant_content = fields[i],
1240+ };
1241+ }
1242+
12041243 with_field_ids.emplace_back (*assoc_field_id);
12051244 }
12061245
0 commit comments