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