mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-20 10:26:28 +03:00
Add option to clear the ammo of all static guns, compile vehicle functions for server and client
This commit is contained in:
@@ -90,7 +90,7 @@ if (_outcome != "PASS") then {
|
||||
|
||||
[_object,"all",true] call server_updateObject;
|
||||
|
||||
[_object,vg_clearAmmo,false] call server_vehicleAddons;
|
||||
[_object,vg_clearAmmo,false] call fn_vehicleAddons;
|
||||
|
||||
dayz_serverObjectMonitor set [count dayz_serverObjectMonitor,_object];
|
||||
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
//By denvdmj (probably, I found it on the biki)
|
||||
|
||||
local _obj = _this;
|
||||
|
||||
local _weaponArray = [];
|
||||
_weaponArray set [count _weaponArray,[-1]];
|
||||
|
||||
local _findRecurse = {
|
||||
local _root = (_this select 0);
|
||||
local _path = +(_this select 1);
|
||||
local _thisThis = _this select 2;
|
||||
|
||||
for "_i" from 0 to count _root -1 do {
|
||||
local _class = _root select _i;
|
||||
|
||||
if (isClass _class) then {
|
||||
local _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", [], _obj] call _findRecurse;
|
||||
|
||||
{
|
||||
local _turret = _x;
|
||||
local _mags = _obj magazinesTurret _turret;
|
||||
|
||||
{
|
||||
local _mag = _x;
|
||||
if !(["horn",_mag] call fnc_inString) then {
|
||||
if (DZE_clearVehicleFlares) then {
|
||||
_obj removeMagazinesTurret[_mag,_turret];
|
||||
} else {
|
||||
if !(["flare",_mag] call fnc_inString) then {
|
||||
_obj removeMagazinesTurret[_mag,_turret];
|
||||
};
|
||||
};
|
||||
};
|
||||
} count _mags;
|
||||
} forEach _weaponArray;
|
||||
@@ -1,47 +0,0 @@
|
||||
local _obj = _this select 0;
|
||||
local _countMags = _this select 1;
|
||||
|
||||
local _weaponArray = [];
|
||||
_weaponArray set [count _weaponArray,["",[-1]]];
|
||||
|
||||
local _findRecurse = {
|
||||
local _root = (_this select 0);
|
||||
local _path = +(_this select 1);
|
||||
local _thisThis = _this select 2;
|
||||
|
||||
for "_i" from 0 to count _root -1 do {
|
||||
local _class = _root select _i;
|
||||
|
||||
if (isClass _class) then {
|
||||
local _currentPath = _path + [_i];
|
||||
{
|
||||
_weaponArray set [count _weaponArray,[_x,_currentPath]];
|
||||
} count getArray (_class >> "weapons");
|
||||
_class = _class >> "turrets";
|
||||
if (isClass _class) then {[_class, _currentPath, _thisThis] call _findRecurse;};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
[configFile >> "CfgVehicles" >> typeOf (_obj) >> "turrets", [], _obj] call _findRecurse;
|
||||
|
||||
{
|
||||
local _type = _x select 0;
|
||||
local _turret = _x select 1;
|
||||
local _mags = getArray(configFile >> "CfgWeapons" >> _type >> "magazines");
|
||||
local _mag = _mags select 0;
|
||||
|
||||
if (!isNil "_mag" && {!(["horn",_mag] call fnc_inString)})then {
|
||||
for "_i" from 1 to _countMags do {
|
||||
_obj addMagazineTurret[_mag,_turret];
|
||||
};
|
||||
};
|
||||
} forEach _weaponArray;
|
||||
|
||||
{
|
||||
local _mags = getArray(configFile >> "CfgWeapons" >> _x >> "magazines");
|
||||
local _mag = _mags select 0;
|
||||
for "_i" from 1 to _countMags do {
|
||||
_obj addMagazine _mag;
|
||||
};
|
||||
} count (weapons _obj);
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "\z\addons\dayz_server\compile\server_toggle_debug.hpp"
|
||||
|
||||
private ["_type","_objectUID","_characterID","_object","_worldspace","_key","_ownerArray","_inventory","_clientKey","_exitReason","_player","_playerUID"];
|
||||
private ["_isStatic","_type","_objectUID","_characterID","_object","_worldspace","_key","_ownerArray","_inventory","_clientKey","_exitReason","_player","_playerUID"];
|
||||
|
||||
if (count _this < 6) exitWith {diag_log "Server_PublishObj error: Wrong parameter format";};
|
||||
|
||||
@@ -36,6 +36,7 @@ if ([_object, "Server"] call check_publishobject) then {
|
||||
_object addMPEventHandler ["MPKilled",{if !(isServer) exitWith {};_this call vehicle_handleServerKilled;}];
|
||||
};
|
||||
};
|
||||
|
||||
// Test disabling simulation server side on buildables only.
|
||||
_object enableSimulation false;
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ if (_outcome != "PASS") then {
|
||||
|
||||
[_object,"all",true] call server_updateObject;
|
||||
|
||||
[_object,DZE_clearVehicleAmmo,DZE_addVehicleAmmo] call server_vehicleAddons;
|
||||
[_object,DZE_clearVehicleAmmo,DZE_addVehicleAmmo] call fn_vehicleAddons;
|
||||
|
||||
_object call fnc_veh_ResetEH;
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ if (_outcome != "PASS") then {
|
||||
};
|
||||
};
|
||||
|
||||
[_object,DZE_clearVehicleAmmo,DZE_addVehicleAmmo] call server_vehicleAddons;
|
||||
[_object,DZE_clearVehicleAmmo,DZE_addVehicleAmmo] call fn_vehicleAddons;
|
||||
|
||||
_object call fnc_veh_ResetEH;
|
||||
|
||||
|
||||
@@ -130,7 +130,7 @@ if (_outcome != "PASS") then {
|
||||
|
||||
[_object,"all",true] call server_updateObject;
|
||||
|
||||
[_object,DZE_clearVehicleAmmo,false] call server_vehicleAddons;
|
||||
[_object,DZE_clearVehicleAmmo,false] call fn_vehicleAddons;
|
||||
|
||||
_object call fnc_veh_ResetEH;
|
||||
// for non JIP users this should make sure everyone has eventhandlers for vehicles.
|
||||
|
||||
@@ -159,7 +159,7 @@ if (_outcome != "PASS") then {
|
||||
|
||||
[_object,"all",true] call server_updateObject;
|
||||
|
||||
[_object,DZE_clearVehicleAmmo,false] call server_vehicleAddons;
|
||||
[_object,DZE_clearVehicleAmmo,false] call fn_vehicleAddons;
|
||||
|
||||
_object call fnc_veh_ResetEH;
|
||||
// for non JIP users this should make sure everyone has eventhandlers for vehicles.
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
local _vehicle = _this select 0;
|
||||
local _clearAmmo = _this select 1;
|
||||
local _addAmmo = _this select 2;
|
||||
local _type = typeOf _vehicle;
|
||||
|
||||
local _skipAmmoClear = []; // Add vehicle classnames you do not want to clear the ammo
|
||||
local _skipAmmoFill = []; // Add vehicle classnames you do not want to fill the ammo
|
||||
|
||||
if (_type in DZE_disableThermal) then {
|
||||
_vehicle disableTIEquipment true;
|
||||
};
|
||||
|
||||
if (_clearAmmo && {!(_type in _skipAmmoClear)}) then {
|
||||
_vehicle call server_clearTurrets;
|
||||
};
|
||||
|
||||
if (_addAmmo && {!(_type in _skipAmmoFill)}) then {
|
||||
local _countMags = 2; // Number of how many magazines will be added to the vehicle
|
||||
[_vehicle,_countMags] call server_fillTurrets;
|
||||
};
|
||||
|
||||
|
||||
// Add/Remove extra weapons and ammo
|
||||
|
||||
/*
|
||||
|
||||
if (_type == "GNT_C185T") exitwith {
|
||||
_vehicle removeWeapon "FFARLauncher_12";
|
||||
_vehicle addWeapon "pook_M60_dual_DZ";
|
||||
_vehicle addMagazine "pook_1300Rnd_762x51_M60";
|
||||
_vehicle addMagazine "pook_1300Rnd_762x51_M60";
|
||||
};
|
||||
|
||||
*/
|
||||
Reference in New Issue
Block a user