don't enter 2 cars at once on overlap
parent
4449738580
commit
9ed12e35f6
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue