Fix get pos above/below pos util
This commit is contained in:
@@ -420,23 +420,18 @@ function getPosBehindPos(pos, angle, distance) {
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
function getPosAbovePos(pos, distance) {
|
function getPosAbovePos(pos, distance) {
|
||||||
let z = pos.z+distance;
|
return toVector3(pos.x, pos.y, pos.z+distancez);
|
||||||
|
|
||||||
return toVector3(pos.x, pos.y, z);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
function getPosBelowPos(pos, distance) {
|
function getPosBelowPos(pos, distance) {
|
||||||
let z = pos.z-distance;
|
return toVector3(pos.x, pos.y, pos.z-distance);
|
||||||
|
|
||||||
return toVector3(pos.x, pos.y, z);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
function getHeadingFromPosToPos(pos1, pos2) {
|
function getHeadingFromPosToPos(pos1, pos2) {
|
||||||
|
|
||||||
let x = pos2.x-pos1.x;
|
let x = pos2.x-pos1.x;
|
||||||
let y = pos2.y-pos1.y;
|
let y = pos2.y-pos1.y;
|
||||||
let rad = Math.atan2(y, x);
|
let rad = Math.atan2(y, x);
|
||||||
@@ -768,19 +763,19 @@ function getPlayerFromParams(params) {
|
|||||||
let clients = getClients();
|
let clients = getClients();
|
||||||
if(isNaN(params)) {
|
if(isNaN(params)) {
|
||||||
for(let i in clients) {
|
for(let i in clients) {
|
||||||
if(toLowerCase(clients[i].name).indexOf(toLowerCase(params)) != -1) {
|
if(!clients[i].console) {
|
||||||
return clients[i];
|
if(toLowerCase(clients[i].name).indexOf(toLowerCase(params)) != -1) {
|
||||||
}
|
return clients[i];
|
||||||
|
}
|
||||||
|
|
||||||
let charName = getCharacterFullName(clients[i]);
|
if(toLowerCase(getCharacterFullName(clients[i])).indexOf(toLowerCase(params)) != -1) {
|
||||||
if(toLowerCase(charName).indexOf(toLowerCase(clientName)) != -1) {
|
return clients[i];
|
||||||
return clients[i];
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let playerId = toInteger(params) || 0;
|
if(typeof clients[toInteger(params)] != "undefined") {
|
||||||
if(typeof clients[playerId] != "undefined") {
|
return clients[toInteger(params)];
|
||||||
return clients[playerId];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1573,13 +1568,12 @@ function getWeatherFromParams(params) {
|
|||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
} else {
|
} else {
|
||||||
if(typeof getGameData().weatherNames[getServerGame()][params] != "undefined") {
|
if(typeof getGameData().weatherNames[getServerGame()][params] != "undefined") {
|
||||||
return toInteger(params);
|
return toInteger(params);
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
@@ -1591,12 +1585,10 @@ function getClanFromParams(params) {
|
|||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
} else {
|
} else {
|
||||||
if(typeof getServerData().clans[params] != "undefined") {
|
if(typeof getServerData().clans[params] != "undefined") {
|
||||||
return toInteger(params);
|
return toInteger(params);
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1609,13 +1601,13 @@ function getJobFromParams(params) {
|
|||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
} else {
|
} else {
|
||||||
if(typeof getServerData().jobs[params] != "undefined") {
|
if(typeof getServerData().jobs[params] != "undefined") {
|
||||||
return toInteger(params);
|
return toInteger(params);
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
@@ -1627,31 +1619,29 @@ function getBusinessFromParams(params) {
|
|||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
} else {
|
} else {
|
||||||
if(typeof getServerData().businesses[params] != "undefined") {
|
if(typeof getServerData().businesses[params] != "undefined") {
|
||||||
return toInteger(params);
|
return toInteger(params);
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
function getHousesFromParams(params) {
|
function getHouseFromParams(params) {
|
||||||
if(isNaN(params)) {
|
if(isNaN(params)) {
|
||||||
for(let i in getServerData().houses) {
|
for(let i in getServerData().houses) {
|
||||||
if(toLowerCase(getServerData().houses[i].description).indexOf(toLowerCase(params)) != -1) {
|
if(toLowerCase(getServerData().houses[i].description).indexOf(toLowerCase(params)) != -1) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
} else {
|
} else {
|
||||||
if(typeof getServerData().houses[params] != "undefined") {
|
if(typeof getServerData().houses[params] != "undefined") {
|
||||||
return toInteger(params);
|
return toInteger(params);
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
@@ -1840,11 +1830,3 @@ function resetClientStuff(client) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
function sendAllLabelsToPlayer(client) {
|
|
||||||
sendAllBusinessLabelsToPlayer(client);
|
|
||||||
sendAllHouseLabelsToPlayer(client);
|
|
||||||
sendAllJobLabelsToPlayer(client);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
Reference in New Issue
Block a user