mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-17 09:10:27 +03:00
Add function for vehicle addons
This adds a remove and add ammo function for vehicles. Also a keep flares check if the vehicle ammo got removed. Server admins can add/remove different weapons to vehicles by just editing server_spawnVehicle.
This commit is contained in:
@@ -141,52 +141,18 @@ if (_outcome != "PASS") then {
|
||||
processInitCommands;
|
||||
[_weapons,_magazines,_backpacks,_object] call fn_addCargo;
|
||||
|
||||
_clearTurrets = {
|
||||
//By denvdmj (probably, I found it on the biki)
|
||||
private ["_weaponArray","_findRecurse","_class","_obj","_turret","_mags"];
|
||||
_obj = _this;
|
||||
|
||||
_weaponArray = [];
|
||||
_weaponArray set [count _weaponArray,[-1]];
|
||||
|
||||
_findRecurse = {
|
||||
private ["_root", "_class", "_path", "_currentPath", "_thisThis"];
|
||||
_root = (_this select 0);
|
||||
_path = +(_this select 1);
|
||||
_thisThis = _this select 2;
|
||||
for "_i" from 0 to count _root -1 do {
|
||||
_class = _root select _i;
|
||||
if (isClass _class) then {
|
||||
_currentPath = _path + [_i];
|
||||
{_weaponArray set [count _weaponArray, _currentPath];} count getArray (_class >> "weapons");
|
||||
_class = _class >> "turrets";
|
||||
if (isClass _class) then {[_class, _currentPath, _thisThis] call _findRecurse;};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
[configFile >> "CfgVehicles" >> typeOf (_obj) >> "turrets", [], _this] call _findRecurse;
|
||||
|
||||
{
|
||||
_turret = _x;
|
||||
_mags = _obj magazinesTurret _turret;
|
||||
{_obj removeMagazinesTurret[_x,_turret];} count _mags;
|
||||
} forEach _weaponArray;
|
||||
};
|
||||
|
||||
_object setFuel _fuel;
|
||||
|
||||
[_object,_newHitpoints] call server_setHitpoints;
|
||||
|
||||
[_object,"all",true] call server_updateObject;
|
||||
|
||||
[_object,DZE_clearVehicleAmmo,false] call server_vehicleAddons;
|
||||
|
||||
_object call fnc_veh_ResetEH;
|
||||
// for non JIP users this should make sure everyone has eventhandlers for vehicles.
|
||||
PVDZE_veh_Init = _object;
|
||||
publicVariable "PVDZE_veh_Init";
|
||||
|
||||
{if (_object isKindOf _x) exitWith {_object disableTIEquipment true;}} count vkc_disableThermal;
|
||||
if (vkc_clearAmmo) then {_object call _clearTurrets;};
|
||||
publicVariable "PVDZE_veh_Init";
|
||||
|
||||
dze_waiting = "success";
|
||||
(owner _activatingPlayer) publicVariableClient "dze_waiting";
|
||||
|
||||
Reference in New Issue
Block a user