House and business pickup stuff
This commit is contained in:
@@ -391,4 +391,20 @@ function syncElementProperties(element) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ===========================================================================
|
||||||
|
|
||||||
|
function receiveBlipFromServer(model, position) {
|
||||||
|
if(getGame() == VRR_GAME_GTA_IV) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===========================================================================
|
||||||
|
|
||||||
|
function receivePickupFromServer(model, position) {
|
||||||
|
if(getGame() == VRR_GAME_GTA_IV) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -1336,6 +1336,10 @@ function createAllBusinessBlips() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function createBusinessEntrancePickup(businessId) {
|
function createBusinessEntrancePickup(businessId) {
|
||||||
|
if(!areServerElementsSupported()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if(!getServerConfig().createBusinessPickups) {
|
if(!getServerConfig().createBusinessPickups) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1348,18 +1352,24 @@ function createBusinessEntrancePickup(businessId) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_VERBOSE, `[VRR.Job]: Creating entrance pickup for business ${getBusinessData(businessId).name} (model ${pickupModelId})`);
|
logToConsole(LOG_VERBOSE, `[VRR.Job]: Creating entrance pickup for business ${getBusinessData(businessId).name} (model ${pickupModelId})`);
|
||||||
|
|
||||||
getBusinessData(businessId).entrancePickup = createGamePickup(pickupModelId, getBusinessData(businessId).entrancePosition, getGameConfig().pickupTypes[getServerGame()].business);
|
if(areServerElementsSupported()) {
|
||||||
setElementOnAllDimensions(getBusinessData(businessId).entrancePickup, false);
|
getBusinessData(businessId).entrancePickup = createGamePickup(pickupModelId, getBusinessData(businessId).entrancePosition, getGameConfig().pickupTypes[getServerGame()].business);
|
||||||
setElementDimension(getBusinessData(businessId).entrancePickup, getBusinessData(businessId).entranceDimension);
|
setElementOnAllDimensions(getBusinessData(businessId).entrancePickup, false);
|
||||||
updateBusinessPickupLabelData(businessId);
|
setElementDimension(getBusinessData(businessId).entrancePickup, getBusinessData(businessId).entranceDimension);
|
||||||
addToWorld(getBusinessData(businessId).entrancePickup);
|
updateBusinessPickupLabelData(businessId);
|
||||||
|
addToWorld(getBusinessData(businessId).entrancePickup);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function createBusinessEntranceBlip(businessId) {
|
function createBusinessEntranceBlip(businessId) {
|
||||||
|
if(!areServerElementsSupported()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if(!getServerConfig().createBusinessBlips) {
|
if(!getServerConfig().createBusinessBlips) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1372,11 +1382,13 @@ function createBusinessEntranceBlip(businessId) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_VERBOSE, `[VRR.Job]: Creating entrance blip for business ${getBusinessData(businessId).name} (model ${blipModelId})`);
|
logToConsole(LOG_VERBOSE, `[VRR.Job]: Creating entrance blip for business ${getBusinessData(businessId).name} (model ${blipModelId})`);
|
||||||
|
|
||||||
getBusinessData(businessId).entranceBlip = createGameBlip(getBusinessData(businessId).entrancePosition, blipModelId, 1, getColourByName("businessBlue"));
|
if(areServerElementsSupported()) {
|
||||||
setElementOnAllDimensions(getBusinessData(businessId).entranceBlip, false);
|
getBusinessData(businessId).entranceBlip = createGameBlip(getBusinessData(businessId).entrancePosition, blipModelId, 1, getColourByName("businessBlue"));
|
||||||
setElementDimension(getBusinessData(businessId).entranceBlip, getBusinessData(businessId).entranceDimension);
|
setElementOnAllDimensions(getBusinessData(businessId).entranceBlip, false);
|
||||||
addToWorld(getBusinessData(businessId).entranceBlip);
|
setElementDimension(getBusinessData(businessId).entranceBlip, getBusinessData(businessId).entranceDimension);
|
||||||
|
addToWorld(getBusinessData(businessId).entranceBlip);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1396,12 +1408,14 @@ function createBusinessExitPickup(businessId) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_VERBOSE, `[VRR.Job]: Creating exit pickup for business ${getBusinessData(businessId).name} (model ${pickupModelId})`);
|
logToConsole(LOG_VERBOSE, `[VRR.Job]: Creating exit pickup for business ${getBusinessData(businessId).name} (model ${pickupModelId})`);
|
||||||
|
|
||||||
getBusinessData(businessId).exitPickup = createGamePickup(pickupModelId, getBusinessData(businessId).exitPosition, getGameConfig().pickupTypes[getServerGame()].business);
|
if(areServerElementsSupported()) {
|
||||||
setElementDimension(getBusinessData(businessId).exitPickup, getBusinessData(businessId).exitDimension);
|
getBusinessData(businessId).exitPickup = createGamePickup(pickupModelId, getBusinessData(businessId).exitPosition, getGameConfig().pickupTypes[getServerGame()].business);
|
||||||
setElementOnAllDimensions(getBusinessData(businessId).exitPickup, false);
|
setElementDimension(getBusinessData(businessId).exitPickup, getBusinessData(businessId).exitDimension);
|
||||||
updateBusinessPickupLabelData(businessId);
|
setElementOnAllDimensions(getBusinessData(businessId).exitPickup, false);
|
||||||
addToWorld(getBusinessData(businessId).exitPickup);
|
updateBusinessPickupLabelData(businessId);
|
||||||
|
addToWorld(getBusinessData(businessId).exitPickup);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1421,15 +1435,17 @@ function createBusinessExitBlip(businessId) {
|
|||||||
blipModelId = getBusinessData(businessId).exitBlipModel;
|
blipModelId = getBusinessData(businessId).exitBlipModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_VERBOSE, `[VRR.Job]: Creating exit blip for business ${getBusinessData(businessId).name} (model ${blipModelId})`);
|
if(areServerElementsSupported()) {
|
||||||
|
logToConsole(LOG_VERBOSE, `[VRR.Job]: Creating exit blip for business ${getBusinessData(businessId).name} (model ${blipModelId})`);
|
||||||
|
|
||||||
getBusinessData(businessId).exitBlip = createGameBlip(getBusinessData(businessId).exitPosition, blipModelId, 1, getColourByName("businessBlue"));
|
getBusinessData(businessId).exitBlip = createGameBlip(getBusinessData(businessId).exitPosition, blipModelId, 1, getColourByName("businessBlue"));
|
||||||
setElementDimension(getBusinessData(businessId).exitBlip, getBusinessData(businessId).entranceDimension);
|
setElementDimension(getBusinessData(businessId).exitBlip, getBusinessData(businessId).entranceDimension);
|
||||||
setElementOnAllDimensions(getBusinessData(businessId).exitBlip, false);
|
setElementOnAllDimensions(getBusinessData(businessId).exitBlip, false);
|
||||||
//getBusinessData(businessId).exitBlip.interior = getBusinessData(businessId).exitInterior;
|
//getBusinessData(businessId).exitBlip.interior = getBusinessData(businessId).exitInterior;
|
||||||
//setEntityData(getBusinessData(businessId).exitBlip, "vrr.owner.type", VRR_BLIP_BUSINESS_EXIT, false);
|
//setEntityData(getBusinessData(businessId).exitBlip, "vrr.owner.type", VRR_BLIP_BUSINESS_EXIT, false);
|
||||||
//setEntityData(getBusinessData(businessId).exitBlip, "vrr.owner.id", businessId, false);
|
//setEntityData(getBusinessData(businessId).exitBlip, "vrr.owner.id", businessId, false);
|
||||||
addToWorld(getBusinessData(businessId).exitBlip);
|
addToWorld(getBusinessData(businessId).exitBlip);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1907,6 +1923,10 @@ function getBusinessIdFromDatabaseId(databaseId) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function updateBusinessPickupLabelData(businessId) {
|
function updateBusinessPickupLabelData(businessId) {
|
||||||
|
if(!areServerElementsSupported()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if(getBusinessData(businessId).exitPickup != null) {
|
if(getBusinessData(businessId).exitPickup != null) {
|
||||||
setEntityData(getBusinessData(businessId).exitPickup, "vrr.owner.type", VRR_PICKUP_BUSINESS_EXIT, false);
|
setEntityData(getBusinessData(businessId).exitPickup, "vrr.owner.type", VRR_PICKUP_BUSINESS_EXIT, false);
|
||||||
setEntityData(getBusinessData(businessId).exitPickup, "vrr.owner.id", businessId, false);
|
setEntityData(getBusinessData(businessId).exitPickup, "vrr.owner.id", businessId, false);
|
||||||
|
|||||||
@@ -873,11 +873,13 @@ function createHouseEntrancePickup(houseId) {
|
|||||||
pickupModelId = getHouseData(houseId).entrancePickupModel;
|
pickupModelId = getHouseData(houseId).entrancePickupModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
getHouseData(houseId).entrancePickup = createGamePickup(pickupModelId, getHouseData(houseId).entrancePosition, getGameConfig().pickupTypes[getServerGame()].house);
|
if(areServerElementsSupported()) {
|
||||||
setElementOnAllDimensions(getHouseData(houseId).entrancePickup, false);
|
getHouseData(houseId).entrancePickup = createGamePickup(pickupModelId, getHouseData(houseId).entrancePosition, getGameConfig().pickupTypes[getServerGame()].house);
|
||||||
setElementDimension(getHouseData(houseId).entrancePickup, getHouseData(houseId).entranceDimension);
|
setElementOnAllDimensions(getHouseData(houseId).entrancePickup, false);
|
||||||
|
setElementDimension(getHouseData(houseId).entrancePickup, getHouseData(houseId).entranceDimension);
|
||||||
addToWorld(getHouseData(houseId).entrancePickup);
|
addToWorld(getHouseData(houseId).entrancePickup);
|
||||||
|
}
|
||||||
|
updateHousePickupLabelData(houseId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -895,14 +897,16 @@ function createHouseEntranceBlip(houseId) {
|
|||||||
blipModelId = getHouseData(houseId).entranceBlipModel;
|
blipModelId = getHouseData(houseId).entranceBlipModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
getHouseData(houseId).entranceBlip = createGameBlip(getHouseData(houseId).entrancePosition, blipModelId, 1, getColourByName("houseGreen"));
|
if(areServerElementsSupported()) {
|
||||||
setElementDimension(getHouseData(houseId).entranceBlip, getHouseData(houseId).entranceDimension);
|
getHouseData(houseId).entranceBlip = createGameBlip(getHouseData(houseId).entrancePosition, blipModelId, 1, getColourByName("houseGreen"));
|
||||||
setElementOnAllDimensions(getHouseData(houseId).entranceBlip, false);
|
setElementDimension(getHouseData(houseId).entranceBlip, getHouseData(houseId).entranceDimension);
|
||||||
//getHouseData(houseId).entranceBlip.streamInDistance = 300;
|
setElementOnAllDimensions(getHouseData(houseId).entranceBlip, false);
|
||||||
//getHouseData(houseId).entranceBlip.streamOutDistance = 350;
|
//getHouseData(houseId).entranceBlip.streamInDistance = 300;
|
||||||
setEntityData(getHouseData(houseId).entranceBlip, "vrr.owner.type", VRR_BLIP_HOUSE_ENTRANCE, false);
|
//getHouseData(houseId).entranceBlip.streamOutDistance = 350;
|
||||||
setEntityData(getHouseData(houseId).entranceBlip, "vrr.owner.id", houseId, false);
|
setEntityData(getHouseData(houseId).entranceBlip, "vrr.owner.type", VRR_BLIP_HOUSE_ENTRANCE, false);
|
||||||
addToWorld(getHouseData(houseId).entranceBlip);
|
setEntityData(getHouseData(houseId).entranceBlip, "vrr.owner.id", houseId, false);
|
||||||
|
addToWorld(getHouseData(houseId).entranceBlip);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -921,11 +925,13 @@ function createHouseExitPickup(houseId) {
|
|||||||
pickupModelId = getHouseData(houseId).exitPickupModel;
|
pickupModelId = getHouseData(houseId).exitPickupModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
getHouseData(houseId).exitPickup = createGamePickup(pickupModelId, getHouseData(houseId).exitPosition, getGameConfig().pickupTypes[getServerGame()].house);
|
if(areServerElementsSupported()) {
|
||||||
setElementDimension(getHouseData(houseId).exitPickup, getHouseData(houseId).exitDimension);
|
getHouseData(houseId).exitPickup = createGamePickup(pickupModelId, getHouseData(houseId).exitPosition, getGameConfig().pickupTypes[getServerGame()].house);
|
||||||
setElementOnAllDimensions(getHouseData(houseId).exitPickup, false);
|
setElementDimension(getHouseData(houseId).exitPickup, getHouseData(houseId).exitDimension);
|
||||||
updateHousePickupLabelData(houseId);
|
setElementOnAllDimensions(getHouseData(houseId).exitPickup, false);
|
||||||
addToWorld(getHouseData(houseId).exitPickup);
|
addToWorld(getHouseData(houseId).exitPickup);
|
||||||
|
}
|
||||||
|
updateHousePickupLabelData(houseId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -945,12 +951,14 @@ function createHouseExitBlip(houseId) {
|
|||||||
blipModelId = getHouseData(houseId).exitBlipModel;
|
blipModelId = getHouseData(houseId).exitBlipModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
getHouseData(houseId).exitBlip = createGameBlip(blipModelId, getHouseData(houseId).exitPosition, 1, getColourByName("houseGreen"));
|
if(areServerElementsSupported()) {
|
||||||
setElementDimension(getHouseData(houseId).exitBlip, getHouseData(houseId).entranceDimension);
|
getHouseData(houseId).exitBlip = createGameBlip(blipModelId, getHouseData(houseId).exitPosition, 1, getColourByName("houseGreen"));
|
||||||
setElementOnAllDimensions(getHouseData(houseId).exitBlip, false);
|
setElementDimension(getHouseData(houseId).exitBlip, getHouseData(houseId).entranceDimension);
|
||||||
setEntityData(getHouseData(houseId).exitBlip, "vrr.owner.type", VRR_BLIP_HOUSE_EXIT, false);
|
setElementOnAllDimensions(getHouseData(houseId).exitBlip, false);
|
||||||
setEntityData(getHouseData(houseId).exitBlip, "vrr.owner.id", houseId, false);
|
setEntityData(getHouseData(houseId).exitBlip, "vrr.owner.type", VRR_BLIP_HOUSE_EXIT, false);
|
||||||
addToWorld(getHouseData(houseId).exitBlip);
|
setEntityData(getHouseData(houseId).exitBlip, "vrr.owner.id", houseId, false);
|
||||||
|
addToWorld(getHouseData(houseId).exitBlip);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1403,6 +1411,10 @@ function getHouseFromParams(params) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function updateHousePickupLabelData(houseId) {
|
function updateHousePickupLabelData(houseId) {
|
||||||
|
if(!areServerElementsSupported()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
let houseData = getHouseData(houseId);
|
let houseData = getHouseData(houseId);
|
||||||
|
|
||||||
if(houseData.entrancePickup != null) {
|
if(houseData.entrancePickup != null) {
|
||||||
|
|||||||
@@ -120,40 +120,70 @@ function enterExitPropertyCommand(command, params, client) {
|
|||||||
let isEntrance = false;
|
let isEntrance = false;
|
||||||
let isBusiness = false;
|
let isBusiness = false;
|
||||||
|
|
||||||
if(!getPlayerData(client).currentPickup) {
|
if(areServerElementsSupported()) {
|
||||||
return false;
|
if(!getPlayerData(client).currentPickup) {
|
||||||
}
|
|
||||||
|
|
||||||
let ownerType = getEntityData(getPlayerData(client).currentPickup, "vrr.owner.type");
|
|
||||||
let ownerId = getEntityData(getPlayerData(client).currentPickup, "vrr.owner.id");
|
|
||||||
|
|
||||||
switch(ownerType) {
|
|
||||||
case VRR_PICKUP_BUSINESS_ENTRANCE:
|
|
||||||
isBusiness = true;
|
|
||||||
isEntrance = true;
|
|
||||||
closestProperty = getServerData().businesses[ownerId];
|
|
||||||
break;
|
|
||||||
|
|
||||||
case VRR_PICKUP_BUSINESS_EXIT:
|
|
||||||
isBusiness = true;
|
|
||||||
isEntrance = false;
|
|
||||||
closestProperty = getServerData().businesses[ownerId];
|
|
||||||
break;
|
|
||||||
|
|
||||||
case VRR_PICKUP_HOUSE_ENTRANCE:
|
|
||||||
isBusiness = false;
|
|
||||||
isEntrance = true;
|
|
||||||
closestProperty = getServerData().houses[ownerId];
|
|
||||||
break;
|
|
||||||
|
|
||||||
case VRR_PICKUP_HOUSE_EXIT:
|
|
||||||
isBusiness = false;
|
|
||||||
isEntrance = false;
|
|
||||||
closestProperty = getServerData().houses[ownerId];
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
let ownerType = getEntityData(getPlayerData(client).currentPickup, "vrr.owner.type");
|
||||||
|
let ownerId = getEntityData(getPlayerData(client).currentPickup, "vrr.owner.id");
|
||||||
|
|
||||||
|
switch(ownerType) {
|
||||||
|
case VRR_PICKUP_BUSINESS_ENTRANCE:
|
||||||
|
isBusiness = true;
|
||||||
|
isEntrance = true;
|
||||||
|
closestProperty = getServerData().businesses[ownerId];
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VRR_PICKUP_BUSINESS_EXIT:
|
||||||
|
isBusiness = true;
|
||||||
|
isEntrance = false;
|
||||||
|
closestProperty = getServerData().businesses[ownerId];
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VRR_PICKUP_HOUSE_ENTRANCE:
|
||||||
|
isBusiness = false;
|
||||||
|
isEntrance = true;
|
||||||
|
closestProperty = getServerData().houses[ownerId];
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VRR_PICKUP_HOUSE_EXIT:
|
||||||
|
isBusiness = false;
|
||||||
|
isEntrance = false;
|
||||||
|
closestProperty = getServerData().houses[ownerId];
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for(let i in getServerData().businesses) {
|
||||||
|
if(getPlayerDimension(client) == mainWorldDimension[getGame()] && getPlayerInterior(client) == mainWorldInterior[getGame()]) {
|
||||||
|
let businessId = getClosestBusinessEntrance(getPlayerPosition(client), dimension);
|
||||||
|
isBusiness = true;
|
||||||
|
isEntrance = true;
|
||||||
|
closestProperty = getServerData().businesses[businessId];
|
||||||
|
} else {
|
||||||
|
let businessId = getClosestBusinessExit(getPlayerPosition(client), dimension);
|
||||||
|
isBusiness = true;
|
||||||
|
isEntrance = false;
|
||||||
|
closestProperty = getServerData().businesses[businessId];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for(let j in getServerData().houses) {
|
||||||
|
if(getPlayerDimension(client) == mainWorldDimension[getGame()] && getPlayerInterior(client) == mainWorldInterior[getGame()]) {
|
||||||
|
let houseId = getClosestHouseEntrance(getPlayerPosition(client), dimension);
|
||||||
|
isBusiness = false;
|
||||||
|
isEntrance = true;
|
||||||
|
closestProperty = getServerData().businesses[houseId];
|
||||||
|
} else {
|
||||||
|
let houseId = getClosestHouseExit(getPlayerPosition(client), dimension);
|
||||||
|
isBusiness = false;
|
||||||
|
isEntrance = false;
|
||||||
|
closestProperty = getServerData().businesses[houseId];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(closestProperty == null) {
|
if(closestProperty == null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user