Start using IDs instead of element objects

This commit is contained in:
Vortrex
2022-05-31 08:35:40 -05:00
parent eabf63cf86
commit ee014b2578
4 changed files with 15 additions and 18 deletions

View File

@@ -1086,12 +1086,6 @@ function getVehiclesInRange(position, range) {
// ===========================================================================
function getClosestVehicle(position) {
return getClosestElementByType(ELEMENT_VEHICLE, position);
}
// ===========================================================================
function getClosestElementByType(elementType, position) {
return getElementsByType(elementType).reduce((i, j) => (getDistance(position, getElementPosition(i)) <= getDistance(position, getElementPosition(j))) ? i : j);
}