Don't loop houses if there are none
This commit is contained in:
@@ -659,6 +659,7 @@ function getClosestHouseExit(position, dimension) {
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerHouse(client) {
|
||||
if(getServerData().houses.length > 0) {
|
||||
if(getPlayerDimension(client) == getGameConfig().mainWorldDimension[getGame()]) {
|
||||
let closestEntrance = getClosestHouseEntrance(getPlayerPosition(client), getPlayerDimension(client));
|
||||
if(getDistance(getPlayerPosition(client), getHouseData(closestEntrance).entrancePosition) <= getGlobalConfig().enterPropertyDistance) {
|
||||
@@ -676,6 +677,7 @@ function getPlayerHouse(client) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user