mirror of
https://github.com/EpochModTeam/Epoch.git
synced 2024-08-30 18:22:13 +00:00
More precise Vehicle saving / loading
This change will save / load Vehicles much more accurate (especially on Ramps / slopy terrain. Background: If use VectorDir / VectorUp, the Vehicle will be tilted around the model Center and PosWorld also use the Modelcenter, while PosATL / PosASL use the lowest level of the Vehicle.
This commit is contained in:
parent
ad7d7ddb2d
commit
af6318940b
@ -68,10 +68,8 @@ for "_i" from 1 to _maxVehicleLimit do {
|
||||
|
||||
if (_class != "" && _damage < 1) then {
|
||||
// remove location from worldspace and set to new var
|
||||
_location = _worldspace deleteAt 0;
|
||||
|
||||
_worldspace params [["_location",[]],["_VectorDir",[0,0,0]],["_VectorUp",[0,0,1]],["_useposworld",false]];
|
||||
if !(_location isEqualTo []) then {
|
||||
|
||||
// increased position precision
|
||||
if (count _location == 2) then{
|
||||
_location = (_location select 0) vectorAdd (_location select 1);
|
||||
@ -117,9 +115,13 @@ for "_i" from 1 to _maxVehicleLimit do {
|
||||
_vehicle call EPOCH_server_setVToken;
|
||||
_vehicle call EPOCH_server_vehicleInit;
|
||||
// set final direction and postion of vehicle
|
||||
_vehicle setVectorDirAndUp _worldspace;
|
||||
_vehicle setposATL _location;
|
||||
|
||||
_vehicle setVectorDirAndUp [_VectorDir,_VectorUp];
|
||||
if (_useposworld) then {
|
||||
_vehicle setposWorld _location;
|
||||
}
|
||||
else {
|
||||
_vehicle setposATL _location;
|
||||
};
|
||||
// set fuel level
|
||||
_vehicle setFuel _fuel;
|
||||
// apply persistent textures
|
||||
|
@ -51,7 +51,7 @@ for "_i" from 1 to _maxVehicleLimit do {
|
||||
_damage = _arr select 2;
|
||||
|
||||
if (_class != "" && _damage < 1) then {
|
||||
_location = _worldspace deleteAt 0;
|
||||
_worldspace params [["_location",[]],["_VectorDir",[0,0,0]],["_VectorUp",[0,0,1]],["_useposworld",false]];
|
||||
|
||||
if !(_location isEqualTo []) then {
|
||||
|
||||
@ -68,11 +68,16 @@ for "_i" from 1 to _maxVehicleLimit do {
|
||||
_class = ["O_Heli_Transport_04_EPOCH","O_Heli_Transport_04_bench_EPOCH","O_Heli_Transport_04_box_EPOCH","O_Heli_Transport_04_covered_EPOCH","B_Heli_Transport_03_unarmed_EPOCH","O_Truck_03_covered_EPOCH"] select _found;
|
||||
};
|
||||
|
||||
_vehicle = createVehicle [_class, _location, [], 0, "CAN_COLLIDE"];
|
||||
_vehicle = createVehicle [_class, [random 500, random 500,500], [], 0, "CAN_COLLIDE"];
|
||||
_allVehicles pushBack _vehicle;
|
||||
_vehicle call EPOCH_server_setVToken;
|
||||
_vehicle setposATL _location;
|
||||
_vehicle setVectorDirAndUp _worldspace;
|
||||
if (_useposworld) then {
|
||||
_vehicle setposWorld _location;
|
||||
}
|
||||
else {
|
||||
_vehicle setposATL _location;
|
||||
};
|
||||
_vehicle setVectorDirAndUp [_VectorDir,_VectorUp];
|
||||
_vehicle setDamage _damage;
|
||||
|
||||
_allHitpoints = getAllHitPointsDamage _vehicle;
|
||||
|
@ -31,7 +31,7 @@ if (!isNull _vehicle) then {
|
||||
|
||||
_colorSlot = _vehicle getVariable ["VEHICLE_TEXTURE",0];
|
||||
_baseType = _vehicle getVariable ["VEHICLE_BASECLASS",""];
|
||||
_VAL = [typeOf _vehicle,[(getposATL _vehicle call EPOCH_precisionPos),vectordir _vehicle,vectorup _vehicle],damage _vehicle,_hitpoints,fuel _vehicle,_inventory,[true,magazinesAllTurrets _vehicle],_colorSlot,_baseType];
|
||||
_VAL = [typeOf _vehicle,[getposworld _vehicle,vectordir _vehicle,vectorup _vehicle,true],damage _vehicle,_hitpoints,fuel _vehicle,_inventory,[true,magazinesAllTurrets _vehicle],_colorSlot,_baseType];
|
||||
["Vehicle", _vehHiveKey, EPOCH_expiresVehicle, _VAL] call EPOCH_fnc_server_hiveSETEX;
|
||||
};
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user