don't enter 2 cars at once on overlap

isolation_bkp/dynres
Dominik Madarász 2021-09-09 00:10:11 +02:00
parent 4449738580
commit 9ed12e35f6
1 changed files with 5 additions and 0 deletions

View File

@ -44,9 +44,13 @@ void EnterVehicle(ecs_iter_t *it) {
size_t ents_count; size_t ents_count;
int64_t *ents = world_chunk_query_entities(it->entities[i], &ents_count, 2); int64_t *ents = world_chunk_query_entities(it->entities[i], &ents_count, 2);
bool has_entered_veh = false;
for (size_t j = 0; j < ents_count; j++) { for (size_t j = 0; j < ents_count; j++) {
Vehicle *veh = 0; Vehicle *veh = 0;
if (has_entered_veh) break;
if ((veh = ecs_get_mut_if(it->world, ents[j], Vehicle))) { if ((veh = ecs_get_mut_if(it->world, ents[j], Vehicle))) {
Position const* p2 = ecs_get(it->world, ents[j], Position); Position const* p2 = ecs_get(it->world, ents[j], Position);
@ -64,6 +68,7 @@ void EnterVehicle(ecs_iter_t *it) {
}); });
p[i] = *p2; p[i] = *p2;
in[i].use = false; in[i].use = false;
has_entered_veh = true;
break; break;
} }
} }