From a56e8a4c659415cd41525fbc287f75fda60aa907 Mon Sep 17 00:00:00 2001 From: Kex Date: Fri, 8 Jan 2021 01:51:07 +0100 Subject: [PATCH 1/2] Save roll and pitch --- addons/common/functions/fnc_deserializeObjects.sqf | 14 +++++++++++--- addons/common/functions/fnc_serializeObjects.sqf | 6 +++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/addons/common/functions/fnc_deserializeObjects.sqf b/addons/common/functions/fnc_deserializeObjects.sqf index a4944f60e..4f5824a48 100644 --- a/addons/common/functions/fnc_deserializeObjects.sqf +++ b/addons/common/functions/fnc_deserializeObjects.sqf @@ -135,7 +135,11 @@ private _fnc_deserializeVehicle = { private _placement = ["CAN_COLLIDE", "FLY"] select (_type isKindOf "Air" && {_position select 2 > 5}); private _vehicle = createVehicle [_type, _position, [], 0, _placement]; - _vehicle setDir _direction; + if (_direction isEqualType 0) then { + _vehicle setDir _direction; + } else { + _vehicle setVectorDirAndUp _direction; + }; // FLY placement always places aircraft at the same height relative to the ground if (_placement == "FLY") then { @@ -151,7 +155,7 @@ private _fnc_deserializeVehicle = { [_vehicle, "", []] call BIS_fnc_initVehicle; } else { _customization params ["_textures", "_animations"]; - [_vehicle, _textures, _animations, true] call BIS_fnc_initVehicle; + [_vehicle, _textures, _animations, true] call FUNC(customizeVehicle); }; { @@ -223,7 +227,11 @@ private _fnc_deserializeStatic = { private _object = createVehicle [_type, [0, 0, 0], [], 0, "CAN_COLLIDE"]; _object setPos _position; - _object setDir _direction; + if (_direction isEqualType 0) then { + _object setDir _direction; + } else { + _object setVectorDirAndUp _direction; + }; // Composition placement aligns objects to the surface normal if they are close to the ground // This also helps in preventing objects from being destroyed by cliping into the ground diff --git a/addons/common/functions/fnc_serializeObjects.sqf b/addons/common/functions/fnc_serializeObjects.sqf index ba8c38c48..de885f77a 100644 --- a/addons/common/functions/fnc_serializeObjects.sqf +++ b/addons/common/functions/fnc_serializeObjects.sqf @@ -114,11 +114,11 @@ private _fnc_serializeVehicle = { private _type = typeOf _vehicle; private _position = ASLtoAGL getPosASL _vehicle vectorDiff _centerPos; - private _direction = getDir _vehicle; + private _direction = [vectorDir _vehicle, vectorUp _vehicle]; private _fuel = fuel _vehicle; private _inventory = _vehicle call FUNC(serializeInventory); - private _customization = _vehicle call BIS_fnc_getVehicleCustomization; + private _customization = _vehicle call FUNC(getVehicleCustomization); private _flagTexture = getForcedFlagTexture _vehicle; private _pylonMagazines = getPylonMagazines _vehicle; @@ -177,7 +177,7 @@ private _fnc_serializeStatic = { private _type = typeOf _object; private _position = ASLtoAGL getPosASL _object vectorDiff _centerPos; - private _direction = getDir _object; + private _direction = [vectorDir _object, vectorUp _object]; private _simulationEnabled = simulationEnabled _object; private _inventory = _object call FUNC(serializeInventory); From a5c74f331dde2665810bff8b5834071731a32163 Mon Sep 17 00:00:00 2001 From: Kex Date: Sat, 23 Jan 2021 17:51:26 +0100 Subject: [PATCH 2/2] Remove vehicle customization part --- addons/common/functions/fnc_deserializeObjects.sqf | 2 +- addons/common/functions/fnc_serializeObjects.sqf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/common/functions/fnc_deserializeObjects.sqf b/addons/common/functions/fnc_deserializeObjects.sqf index 4f5824a48..5882c2125 100644 --- a/addons/common/functions/fnc_deserializeObjects.sqf +++ b/addons/common/functions/fnc_deserializeObjects.sqf @@ -155,7 +155,7 @@ private _fnc_deserializeVehicle = { [_vehicle, "", []] call BIS_fnc_initVehicle; } else { _customization params ["_textures", "_animations"]; - [_vehicle, _textures, _animations, true] call FUNC(customizeVehicle); + [_vehicle, _textures, _animations, true] call BIS_fnc_initVehicle; }; { diff --git a/addons/common/functions/fnc_serializeObjects.sqf b/addons/common/functions/fnc_serializeObjects.sqf index de885f77a..221cbed3f 100644 --- a/addons/common/functions/fnc_serializeObjects.sqf +++ b/addons/common/functions/fnc_serializeObjects.sqf @@ -118,7 +118,7 @@ private _fnc_serializeVehicle = { private _fuel = fuel _vehicle; private _inventory = _vehicle call FUNC(serializeInventory); - private _customization = _vehicle call FUNC(getVehicleCustomization); + private _customization = _vehicle call BIS_fnc_getVehicleCustomization; private _flagTexture = getForcedFlagTexture _vehicle; private _pylonMagazines = getPylonMagazines _vehicle;