Use game ID consts as indexes for gamedata
This commit is contained in:
@@ -729,7 +729,7 @@ function updateHeadingInVehicleData(client, vehicle, heading) {
|
||||
// ===========================================================================
|
||||
|
||||
function forcePlayerIntoSkinSelect(client) {
|
||||
if(getGameConfig().skinChangePosition[getServerGame()].length > 0) {
|
||||
if(typeof getGameConfig().skinChangePosition[getServerGame()] != "undefined") {
|
||||
getPlayerData(client).returnToPosition = getPlayerPosition(client);
|
||||
getPlayerData(client).returnToHeading = getPlayerHeading(client);
|
||||
getPlayerData(client).returnToInterior = getPlayerInterior(client);
|
||||
|
||||
@@ -149,27 +149,35 @@ function getFightStyleFromParams(params) {
|
||||
// ===========================================================================
|
||||
|
||||
function getClosestHospital(position) {
|
||||
let closest = 0;
|
||||
for(let i in getGameConfig().hospitals[getServerGame()]) {
|
||||
if(getDistance(getGameConfig().hospitals[getServerGame()][i].position, position) < getDistance(getGameConfig().hospitals[getServerGame()][closest].position, position)) {
|
||||
closest = i;
|
||||
if(typeof getGameConfig().hospitals[getServerGame()] == "undefined") {
|
||||
return {position: getServerConfig().newCharacter.spawnPosition};
|
||||
} else {
|
||||
let closest = 0;
|
||||
for(let i in getGameConfig().hospitals[getServerGame()]) {
|
||||
if(getDistance(getGameConfig().hospitals[getServerGame()][i].position, position) < getDistance(getGameConfig().hospitals[getServerGame()][closest].position, position)) {
|
||||
closest = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return getGameConfig().hospitals[getServerGame()][closest];
|
||||
return getGameConfig().hospitals[getServerGame()][closest];
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getClosestPoliceStation(position) {
|
||||
let closest = 0;
|
||||
for(let i in getGameConfig().policeStations[getServerGame()]) {
|
||||
if(getDistance(getGameConfig().policeStations[getServerGame()][i].position, position) < getDistance(getGameConfig().policeStations[getServerGame()][closest].position, position)) {
|
||||
closest = i;
|
||||
if(typeof getGameConfig().policeStations[getServerGame()] == "undefined") {
|
||||
return {position: getServerConfig().newCharacter.spawnPosition};
|
||||
} else {
|
||||
let closest = 0;
|
||||
for(let i in getGameConfig().policeStations[getServerGame()]) {
|
||||
if(getDistance(getGameConfig().policeStations[getServerGame()][i].position, position) < getDistance(getGameConfig().policeStations[getServerGame()][closest].position, position)) {
|
||||
closest = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return getGameConfig().policeStations[getServerGame()][closest];
|
||||
return getGameConfig().policeStations[getServerGame()][closest];
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user