Files
2021-04-22 17:52:39 +02:00

22 lines
553 B
TypeScript

import polygons from ".";
setInterval(() => {
const { position, dimension } = mp.players.local;
polygons.pool.map((polygon) => {
if (polygon.colliding) {
if (!polygons.isPositionWithinPolygon(position, polygon, dimension)) {
polygon.colliding = false;
mp.events.call('playerLeavePolygon', polygon);
}
}
else {
if (polygons.isPositionWithinPolygon(position, polygon, dimension)) {
polygon.colliding = true;
mp.events.call('playerEnterPolygon', polygon);
}
}
});
}, 100);