Merge pull request #688 from Ignatz-HeMan/patch-13

Safe/Load all Vehicle Magazines correctly
This commit is contained in:
vbawol 2016-12-29 11:42:00 -06:00 committed by GitHub
commit 03bd6cc796
3 changed files with 36 additions and 23 deletions

View File

@ -206,9 +206,24 @@ for "_i" from 1 to _maxVehicleLimit do {
};
} forEach _objTypes;
} forEach (_arr select 5);
// remove and add back magazines works for armed trucks but not helis ATM
{_vehicle removeMagazineGlobal _x}count (magazines _vehicle);
{_vehicle addMagazine _x}count (_arr select 6);
// remove and add back magazines
if !((_arr select 6) isequalto []) then {
if ((_arr select 6 select 0) isequaltype true) then {
{
_vehicle removeMagazinesTurret [_x select 0, _x select 1];
} foreach magazinesAllTurrets _vehicle;
{
if ((_x select 2) > 0) then {
_vehicle addMagazineTurret [_x select 0,_x select 1,_x select 2];
};
} foreach (_arr select 6 select 1);
}
else {
{_vehicle removeMagazineGlobal _x}count (magazines _vehicle);
{_vehicle addMagazine _x}count (_arr select 6);
};
};
// set damage and hitpoints
_vehicle setDamage _damage;

View File

@ -225,22 +225,23 @@ for "_i" from 1 to _maxVehicleLimit do {
} forEach _objTypes;
} forEach (_arr select 5);
// remove and add back magazines works for armed trucks but not helis ATM
{_vehicle removeMagazineGlobal _x}count (magazines _vehicle);
{_vehicle addMagazine _x}count (_arr select 6);
// turrets
/*
_mags = _vehicle magazinesTurret [0];
{
_object removeMagazinesTurret [_x, [0]];
} forEach _mags;
_mags = _vehicle magazinesTurret [-1];
{
_object removeMagazinesTurret [_x, [-1]];
} forEach _mags;
*/
// remove and add back magazines
if !((_arr select 6) isequalto []) then {
if ((_arr select 6 select 0) isequaltype true) then {
{
_vehicle removeMagazinesTurret [_x select 0, _x select 1];
} foreach magazinesAllTurrets _vehicle;
{
if ((_x select 2) > 0) then {
_vehicle addMagazineTurret [_x select 0,_x select 1,_x select 2];
};
} foreach (_arr select 6 select 1);
}
else {
{_vehicle removeMagazineGlobal _x}count (magazines _vehicle);
{_vehicle addMagazine _x}count (_arr select 6);
};
};
if (EPOCH_DEBUG_VEH) then {
_marker = createMarker [str(_location) , _location];
@ -253,9 +254,6 @@ for "_i" from 1 to _maxVehicleLimit do {
if (_simulationHandler) then{
_vehicle enableSimulationGlobal false;
};
};
};
};

View File

@ -95,7 +95,7 @@ if (!isNull _vehicle) then {
];
_colorSlot = _vehicle getVariable ["VEHICLE_TEXTURE",0];
_VAL = [typeOf _vehicle,[(getposATL _vehicle call EPOCH_precisionPos),vectordir _vehicle,vectorup _vehicle],damage _vehicle,_hitpoints,fuel _vehicle,_inventory,magazinesAmmo _vehicle,_colorSlot];
_VAL = [typeOf _vehicle,[(getposATL _vehicle call EPOCH_precisionPos),vectordir _vehicle,vectorup _vehicle],damage _vehicle,_hitpoints,fuel _vehicle,_inventory,[true,magazinesAllTurrets _vehicle],_colorSlot];
["Vehicle", _vehHiveKey, EPOCH_expiresVehicle, _VAL] call EPOCH_fnc_server_hiveSETEX;
};
};