Add hospitals, fix get closest hospital util

This commit is contained in:
Vortrex
2021-07-15 09:47:57 -05:00
parent ffb89d6968
commit e29bf420de
2 changed files with 21 additions and 7 deletions

View File

@@ -2912,7 +2912,9 @@ let gameData = {
hospitals: [ hospitals: [
[], [],
[ // GTA III [ // GTA III
[1144.25, -596.875, 14.97], // Portland
[183.5, -17.75, 16.21], // Staunton Island
[-1259.5, -44.5, 58.89], // Shoreside Vale
], ],
[ // GTA Vice City [ // GTA Vice City
@@ -2920,6 +2922,18 @@ let gameData = {
[-885.08, -470.44, 13.11], // Little Havana (West Haven Community Health Care Center) [-885.08, -470.44, 13.11], // Little Havana (West Haven Community Health Care Center)
[-133.19, -980.76, 10.46], // Ocean Beach (Ocean View Hospital) [-133.19, -980.76, 10.46], // Ocean Beach (Ocean View Hospital)
], ],
[ // GTA San Andreas
[1182.67, -1323.81, 13.579], // Los Santos West (All Saints General Hospital)
[2034.7567,-1403.1083,17.293], // Los Santos East (County General)
],
[ // GTA IV
[1199.59, 196.78, 33.554], // Shottler Medical Center
[980.71, 1831.61, 23.898], // Northern Gardens Medical Center
[-1317.27, 1277.20, 22.370], // Leftwood Hospital
[-1538.43, 344.58, 20.943], // Acter Medical Center
],
], ],
payAndSprays: [ payAndSprays: [
[], [],

View File

@@ -926,26 +926,26 @@ function getSkinIdFromName(params, gameId = getServerGame()) {
function getClosestHospital(position) { function getClosestHospital(position) {
let closest = 0; let closest = 0;
for(let i in getServerData().hospitals[getServerGame()]) { for(let i in getGameData().hospitals[getServerGame()]) {
if(getDistance(getServerData().hospitals[getServerGame()][i].position, position) < getDistance(getServerData().hospitals[getServerGame()][closest].position, position)) { if(getDistance(getGameData().hospitals[getServerGame()][i], position) < getDistance(getGameData().hospitals[getServerGame()][closest], position)) {
closest = i; closest = i;
} }
} }
return getServerData().hospitals[getServerGame()][closest]; return getGameData().hospitals[getServerGame()][closest];
} }
// =========================================================================== // ===========================================================================
function getClosestPoliceStation(position) { function getClosestPoliceStation(position) {
let closest = 0; let closest = 0;
for(let i in getServerData().policeStations[getServerGame()]) { for(let i in getGameData().policeStations[getServerGame()]) {
if(getServerData().policeStations[getServerGame()][i].position.distance(position) < getServerData().policeStations[getServerGame()][closest].position) { if(getGameData().policeStations[getServerGame()][i].distance(position) < getGameData().policeStations[getServerGame()][closest]) {
closest = i; closest = i;
} }
} }
return getServerData().policeStations[getServerGame()][closest]; return getGameData().policeStations[getServerGame()][closest];
} }
// =========================================================================== // ===========================================================================