diff --git a/ArmA_3/A3_EPOCH_virtualGarage/serverSide/a3_epoch_virtualGarage/config.cpp b/ArmA_3/A3_EPOCH_virtualGarage/serverSide/a3_epoch_virtualGarage/config.cpp index 359c4bf..41f5ec6 100644 --- a/ArmA_3/A3_EPOCH_virtualGarage/serverSide/a3_epoch_virtualGarage/config.cpp +++ b/ArmA_3/A3_EPOCH_virtualGarage/serverSide/a3_epoch_virtualGarage/config.cpp @@ -9,6 +9,7 @@ class cfgVGS { debug = 1; // 0 = OFF maxGarageSlots = 7; // Self-explenatory, right? + persistentVehicles = 1; // Are vehicles read from the garage made persistent on the server? vehBlacklist[] = {"O_Truck_Big_cock_F"}; // Put classnames of disallowed vehicles in here expiresVirtualGarage = 604800; // time is in seconds }; diff --git a/ArmA_3/A3_EPOCH_virtualGarage/serverSide/a3_epoch_virtualGarage/functions_VGS/fn_vgsReadFromGarage.sqf b/ArmA_3/A3_EPOCH_virtualGarage/serverSide/a3_epoch_virtualGarage/functions_VGS/fn_vgsReadFromGarage.sqf index bf61233..629e185 100644 --- a/ArmA_3/A3_EPOCH_virtualGarage/serverSide/a3_epoch_virtualGarage/functions_VGS/fn_vgsReadFromGarage.sqf +++ b/ArmA_3/A3_EPOCH_virtualGarage/serverSide/a3_epoch_virtualGarage/functions_VGS/fn_vgsReadFromGarage.sqf @@ -1,7 +1,7 @@ /* Author: IT07 - Contributor: DirtySanchez from DonkeyPunch.INFO + Contributor: DirtySanchez from DonkeyPunch.INFO, Grahame (added vehicle persistence on read from garage) Description: Read from client Garage @@ -10,7 +10,7 @@ remoteExecCall to client garage contents */ -private["_slots", "_debug", "_playerUID", "_response", "_vehsFriendly", "_vehsRaw", "_toSpawn", "_veh", "_safePOS", "_allHitpoints", "_actualHitpoints", "_dmg", "_response2"]; +private["_persistentVics", "_slots", "_debug", "_playerUID", "_response", "_vehsFriendly", "_vehsRaw", "_toSpawn", "_veh", "_safePOS", "_allHitpoints", "_actualHitpoints", "_dmg", "_response2"]; params [ ["_slot", -1, [0]], ["_playerObj", objNull, [objNull]], @@ -26,6 +26,7 @@ if !([_playerObj, _playerKey] in (uiNamespace getVariable "EPOCH_vgsKeys"))exitW if (_slot isEqualTo -1) exitWith {diag_log format["[EPOCH VGS]: ReadFromGarage Error - slot number is -1 - data:%1", _slot]}; +_persistentVics = "persistentVehicles" call VGS_fnc_vgsGetServerSetting; _slots = "maxGarageSlots" call VGS_fnc_vgsGetServerSetting; if !(_slot < _slots) exitWith {diag_log format["[EPOCH VGS]: ReadFromGarage Error - slot not less than max slots - data:%1", [_slot, _slots]]}; @@ -67,7 +68,14 @@ if ((_response select 0) isEqualTo 1) then [_veh,_gear] call EPOCH_server_CargoFill; _veh setOwner (owner _playerObj); - // apply persistent textures + if (_persistentVics == 1) then { + _veh call EPOCH_server_setVToken; + _epochslot = if(EPOCH_VehicleSlots isEqualTo[])then{ str(count EPOCH_VehicleSlots) } else { EPOCH_VehicleSlots select 0 }; + EPOCH_VehicleSlots = EPOCH_VehicleSlots - [_epochslot]; + missionNamespace setVariable ['EPOCH_VehicleSlotCount', count EPOCH_VehicleSlots, true]; + _veh setVariable['VEHICLE_SLOT',_epochslot,true]; + }; + _cfgEpochVehicles = 'CfgEpochVehicles' call EPOCH_returnConfig; _availableColorsConfig = (_cfgEpochVehicles >> _vehClass >> "availableColors"); if (isArray(_availableColorsConfig)) then { @@ -136,6 +144,11 @@ if ((_response select 0) isEqualTo 1) then } forEach _actualHitpoints; }; }; + + if (_persistentVics == 1) then { + _veh call EPOCH_server_save_vehicle; + _veh call EPOCH_server_vehicleInit; // apply persistent textures + }; // Refetch the vehicles from db and send it to Client _response2 = ["VirtualGarage", _playerUID] call EPOCH_fnc_server_hiveGETRANGE; @@ -153,4 +166,4 @@ if ((_response select 0) isEqualTo 1) then }; }; }; -}; \ No newline at end of file +};