Use game feature util for scale
This commit is contained in:
@@ -111,7 +111,7 @@ function syncVehicleProperties(vehicle) {
|
|||||||
vehicle.setSuspensionHeight(suspensionHeight);
|
vehicle.setSuspensionHeight(suspensionHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getGame() == AGRP_GAME_GTA_SA) {
|
if (isGameFeatureSupported("vehicleUpgrades")) {
|
||||||
//let allUpgrades = getGameConfig().vehicleUpgrades[getGame()];
|
//let allUpgrades = getGameConfig().vehicleUpgrades[getGame()];
|
||||||
//for(let i in allUpgrades) {
|
//for(let i in allUpgrades) {
|
||||||
// vehicle.removeUpgrade(i);
|
// vehicle.removeUpgrade(i);
|
||||||
@@ -146,7 +146,7 @@ function syncCivilianProperties(civilian) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getGame() == AGRP_GAME_GTA_III) {
|
if (isGameFeatureSupported("pedScale")) {
|
||||||
if (doesEntityDataExist(civilian, "agrp.scale")) {
|
if (doesEntityDataExist(civilian, "agrp.scale")) {
|
||||||
let scaleFactor = getEntityData(civilian, "agrp.scale");
|
let scaleFactor = getEntityData(civilian, "agrp.scale");
|
||||||
let tempMatrix = civilian.matrix;
|
let tempMatrix = civilian.matrix;
|
||||||
@@ -165,7 +165,7 @@ function syncCivilianProperties(civilian) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getGame() == AGRP_GAME_GTA_III) {
|
if (getGame() == AGRP_GAME_GTA_SA) {
|
||||||
if (doesEntityDataExist(civilian, "agrp.walkStyle")) {
|
if (doesEntityDataExist(civilian, "agrp.walkStyle")) {
|
||||||
let walkStyle = getEntityData(civilian, "agrp.walkStyle");
|
let walkStyle = getEntityData(civilian, "agrp.walkStyle");
|
||||||
civilian.walkStyle = walkStyle;
|
civilian.walkStyle = walkStyle;
|
||||||
@@ -238,12 +238,32 @@ function syncCivilianProperties(civilian) {
|
|||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
|
function syncObjectProperties(object) {
|
||||||
|
if (!areServerElementsSupported()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isGameFeatureSupported("objectScale")) {
|
||||||
|
if (doesEntityDataExist(object, "agrp.scale")) {
|
||||||
|
let scaleFactor = getEntityData(object, "agrp.scale");
|
||||||
|
let tempMatrix = object.matrix;
|
||||||
|
tempMatrix.setScale(toVector3(scaleFactor.x, scaleFactor.y, scaleFactor.z));
|
||||||
|
let tempPosition = object.position;
|
||||||
|
object.matrix = tempMatrix;
|
||||||
|
tempPosition.z += scaleFactor.z;
|
||||||
|
object.position = tempPosition;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===========================================================================
|
||||||
|
|
||||||
function syncPlayerProperties(player) {
|
function syncPlayerProperties(player) {
|
||||||
if (!areServerElementsSupported()) {
|
if (!areServerElementsSupported()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getGame() == AGRP_GAME_GTA_III) {
|
if (isGameFeatureSupported("pedScale")) {
|
||||||
if (doesEntityDataExist(player, "agrp.scale")) {
|
if (doesEntityDataExist(player, "agrp.scale")) {
|
||||||
let scaleFactor = getEntityData(player, "agrp.scale");
|
let scaleFactor = getEntityData(player, "agrp.scale");
|
||||||
let tempMatrix = player.matrix;
|
let tempMatrix = player.matrix;
|
||||||
@@ -356,11 +376,19 @@ function syncElementProperties(element) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isGameFeatureSupported("interior")) {
|
||||||
if (doesEntityDataExist(element, "agrp.interior")) {
|
if (doesEntityDataExist(element, "agrp.interior")) {
|
||||||
if (typeof element.interior != "undefined") {
|
if (typeof element.interior != "undefined") {
|
||||||
element.interior = getEntityData(element, "agrp.interior");
|
element.interior = getEntityData(element, "agrp.interior");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isGameFeatureSupported("toggleCollision")) {
|
||||||
|
if (doesEntityDataExist(element, "agrp.collisions")) {
|
||||||
|
element.collisionsEnabled = getEntityData(element, "agrp.collisions");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (getGame() == AGRP_GAME_MAFIA_ONE) {
|
if (getGame() == AGRP_GAME_MAFIA_ONE) {
|
||||||
switch (element.type) {
|
switch (element.type) {
|
||||||
@@ -393,6 +421,10 @@ function syncElementProperties(element) {
|
|||||||
syncPlayerProperties(element);
|
syncPlayerProperties(element);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case ELEMENT_OBJECT:
|
||||||
|
syncObjectProperties(element);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user