mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-17 09:10:27 +03:00
Consolidate weapon/magazine/backpack adding to function
This moves a lot of duplicated code from a server side only function (server_addCargo) to a client/server function called fn_addCargo.
This commit is contained in:
@@ -12,7 +12,7 @@ dayz_actionInProgress = true;
|
||||
private ["_cursorTarget","_item","_classname","_requiredTools","_requiredParts","_upgrade","_upgradeConfig",
|
||||
"_upgradeDisplayname","_onLadder","_isWater","_upgradeParts","_startUpgrade","_missingPartsConfig","_textMissingParts","_dis",
|
||||
"_sfx","_ownerID","_objectID","_objectUID","_dir","_weapons","_magazines","_backpacks","_object",
|
||||
"_objWpnTypes","_objWpnQty","_countr","_itemName","_vector","_playerNear","_finished"];
|
||||
"_itemName","_vector","_playerNear","_finished"];
|
||||
|
||||
_cursorTarget = _this select 3;
|
||||
|
||||
@@ -152,33 +152,7 @@ if ((_startUpgrade) AND (isClass(_upgradeConfig))) then {
|
||||
//Make sure player knows about the new object
|
||||
player reveal _object;
|
||||
|
||||
//Add contents back
|
||||
//Add Weapons
|
||||
_objWpnTypes = _weapons select 0;
|
||||
_objWpnQty = _weapons select 1;
|
||||
_countr = 0;
|
||||
{
|
||||
_object addweaponcargoGlobal [_x,(_objWpnQty select _countr)];
|
||||
_countr = _countr + 1;
|
||||
} count _objWpnTypes;
|
||||
|
||||
//Add Magazines
|
||||
_objWpnTypes = _magazines select 0;
|
||||
_objWpnQty = _magazines select 1;
|
||||
_countr = 0;
|
||||
{
|
||||
_object addmagazinecargoGlobal [_x,(_objWpnQty select _countr)];
|
||||
_countr = _countr + 1;
|
||||
} count _objWpnTypes;
|
||||
|
||||
//Add Backpacks
|
||||
_objWpnTypes = _backpacks select 0;
|
||||
_objWpnQty = _backpacks select 1;
|
||||
_countr = 0;
|
||||
{
|
||||
_object addbackpackcargoGlobal [_x,(_objWpnQty select _countr)];
|
||||
_countr = _countr + 1;
|
||||
} count _objWpnTypes;
|
||||
[_weapons,_magazines,_backpacks,_object] call fn_addCargo;
|
||||
|
||||
//publish new tent
|
||||
if (DZE_permanentPlot) then {
|
||||
@@ -188,7 +162,7 @@ if ((_startUpgrade) AND (isClass(_upgradeConfig))) then {
|
||||
PVDZ_obj_Publish = [dayz_characterID,_object,[_dir,_pos],[_weapons,_magazines,_backpacks],player,dayz_authKey];
|
||||
};
|
||||
publicVariableServer "PVDZ_obj_Publish";
|
||||
diag_log [diag_ticktime, __FILE__, "New Networked object, request to save to hive. PVDZ_obj_Publish:", PVDZ_obj_Publish];
|
||||
//diag_log [diag_ticktime, __FILE__, "New Networked object, request to save to hive. PVDZ_obj_Publish:", PVDZ_obj_Publish];
|
||||
|
||||
localize "str_upgradeDone" call dayz_rollingMessages;
|
||||
/*
|
||||
@@ -197,4 +171,4 @@ if ((_startUpgrade) AND (isClass(_upgradeConfig))) then {
|
||||
*/
|
||||
};
|
||||
|
||||
dayz_actionInProgress = false;
|
||||
dayz_actionInProgress = false;
|
||||
|
||||
Reference in New Issue
Block a user