Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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]],
Expand All @@ -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]]};

Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
Expand All @@ -153,4 +166,4 @@ if ((_response select 0) isEqualTo 1) then
};
};
};
};
};