Add tools as requirement for upgrade buildings

player_upgrade.sqf can upgrade storage buildings too now.
This commit is contained in:
A Man
2020-05-13 01:34:25 +02:00
parent d7bca8465d
commit 5724d452cb
4 changed files with 161 additions and 138 deletions

View File

@@ -283,7 +283,7 @@ class Land_DZE_WoodDoor: Land_DZE_WoodDoor_Base {
model = "\z\addons\dayz_epoch\models\small_wall_door_anim.p3d";
displayName = $STR_EPOCH_WALLWITHDOOR;
GhostPreview = "WoodDoor_Preview_DZ";
upgradeBuilding[] = {"Land_DZE_WoodDoorLocked",{{"ItemComboLock",1}}};
upgradeBuilding[] = {"Land_DZE_WoodDoorLocked",{},{{"ItemComboLock",1}}};
/* Arma needs to know, how the animation trigger is triggered*/
class AnimationSources {
/* name must be identical to the one given by the model.cfg ("Open_Door")" */
@@ -382,7 +382,7 @@ class Land_DZE_LargeWoodDoor: Land_DZE_WoodDoor_Base {
model = "\z\addons\dayz_epoch\models\large_wall_door_anim.p3d";
displayName = $STR_EPOCH_LARGEWALLWITHDOOR;
GhostPreview = "LargeWoodDoor_Preview_DZ";
upgradeBuilding[] = {"Land_DZE_LargeWoodDoorLocked",{{"ItemComboLock",1}}};
upgradeBuilding[] = {"Land_DZE_LargeWoodDoorLocked",{},{{"ItemComboLock",1}}};
/* Arma needs to know, how the animation trigger is triggered*/
class AnimationSources {
/* name must be identical to the one given by the model.cfg ("Open_Door")" */
@@ -481,7 +481,7 @@ class Land_DZE_GarageWoodDoor: Land_DZE_WoodDoor_Base {
model = "\z\addons\dayz_epoch\models\Garage_door_anim.p3d";
displayName = $STR_EPOCH_WOODGARAGEDOOR;
GhostPreview = "GarageWoodDoor_Preview_DZ";
upgradeBuilding[] = {"Land_DZE_GarageWoodDoorLocked",{{"ItemComboLock",1}}};
upgradeBuilding[] = {"Land_DZE_GarageWoodDoorLocked",{},{{"ItemComboLock",1}}};
/* Arma needs to know, how the animation trigger is triggered*/
class AnimationSources {
/* name must be identical to the one given by the model.cfg ("Open_Door")" */
@@ -645,7 +645,7 @@ class CinderWallDoor_DZ: CinderWallDoor_DZ_Base {
model = "\z\addons\dayz_epoch\models\steel_garage_door.p3d";
displayName = $STR_EPOCH_BLOCKGARAGEDOOR;
GhostPreview = "CinderWallDoorway_Preview_DZ";
upgradeBuilding[] = {"CinderWallDoorLocked_DZ",{{"ItemComboLock",1}}};
upgradeBuilding[] = {"CinderWallDoorLocked_DZ",{},{{"ItemComboLock",1}}};
/* Arma needs to know, how the animation trigger is triggered*/
class AnimationSources {
/* name must be identical to the one given by the model.cfg ("Open_Door")" */
@@ -747,7 +747,7 @@ class CinderWallDoorSmall_DZ: CinderWallDoor_DZ_Base {
model = "\z\addons\dayz_epoch\models\Steel_door.p3d";
displayName = $STR_EPOCH_BLOCKDOOR;
GhostPreview = "CinderWallSmallDoorway_Preview_DZ";
upgradeBuilding[] = {"CinderWallDoorSmallLocked_DZ",{{"ItemComboLock",1}}};
upgradeBuilding[] = {"CinderWallDoorSmallLocked_DZ",{},{{"ItemComboLock",1}}};
/* Arma needs to know, how the animation trigger is triggered*/
class AnimationSources {
/* name must be identical to the one given by the model.cfg ("Open_Door")" */

View File

@@ -74,7 +74,7 @@ class CinderWallHalf_DZ: ModularItems {
armor = 2200;
displayName = $STR_EPOCH_CINDERBLOCKWALL_HALF;
vehicleClass = "Fortifications";
upgradeBuilding[] = {"CinderWall_DZ",{{"CinderBlocks",4},{"MortarBucket",1}}};
upgradeBuilding[] = {"CinderWall_DZ",{"ItemToolbox"},{{"CinderBlocks",4},{"MortarBucket",1}}};
maintainBuilding[] = {{"MortarBucket",1}};
GhostPreview = "CinderWallHalf_Preview_DZ";
class DestructionEffects : DestructionEffects {
@@ -127,7 +127,7 @@ class CinderWallDoorway_DZ: ModularItems {
displayName = $STR_EPOCH_BLOCKGARAGEDOORWAY;
vehicleClass = "Fortifications";
maintainBuilding[] = {{"MortarBucket",1}};
upgradeBuilding[] = {"CinderWallDoor_DZ",{{"ItemPole",3},{"ItemTankTrap",3}}};
upgradeBuilding[] = {"CinderWallDoor_DZ",{"ItemToolbox"},{{"ItemPole",3},{"ItemTankTrap",3}}};
GhostPreview = "CinderWallDoorway_Preview_DZ";
class DestructionEffects : DestructionEffects {
class Ruin1 {
@@ -153,7 +153,7 @@ class CinderWallSmallDoorway_DZ: ModularItems {
displayName = $STR_EPOCH_BLOCKDOORWAY;
vehicleClass = "Fortifications";
maintainBuilding[] = {{"MortarBucket",1}};
upgradeBuilding[] = {"CinderWallDoorSmall_DZ",{{"ItemPole",1},{"ItemTankTrap",1}}};
upgradeBuilding[] = {"CinderWallDoorSmall_DZ",{"ItemToolbox"},{{"ItemPole",1},{"ItemTankTrap",1}}};
GhostPreview = "CinderWallSmallDoorway_Preview_DZ";
class DestructionEffects : DestructionEffects {
class Ruin1 {
@@ -257,7 +257,7 @@ class WoodLargeWall_DZ: ModularItems {
armor = 2200;
displayName = $STR_EPOCH_LARGEWOODWALL;
vehicleClass = "Fortifications";
upgradeBuilding[] = {"WoodLargeWallWin_DZ",{{"PartGlass",1}}};
upgradeBuilding[] = {"WoodLargeWallWin_DZ",{"ItemToolbox"},{{"PartGlass",1}}};
maintainBuilding[] = {{"PartWoodPlywood",1},{"PartWoodLumber",1}};
GhostPreview = "WoodLargeWall_Preview_DZ";
class DestructionEffects : DestructionEffects {
@@ -284,7 +284,7 @@ class WoodLargeWallDoor_DZ: ModularItems {
displayName = $STR_EPOCH_LARGEWALLWITHDOORWAY;
vehicleClass = "Fortifications";
maintainBuilding[] = {{"PartWoodPlywood",1},{"PartWoodLumber",1}};
upgradeBuilding[] = {"Land_DZE_LargeWoodDoor",{{"PartWoodPlywood",1},{"PartWoodLumber",1}}};
upgradeBuilding[] = {"Land_DZE_LargeWoodDoor",{"ItemToolbox"},{{"PartWoodPlywood",1},{"PartWoodLumber",1}}};
GhostPreview = "WoodLargeWallDoor_Preview_DZ";
class DestructionEffects : DestructionEffects {
class Ruin1 {
@@ -334,7 +334,7 @@ class WoodSmallWall_DZ: ModularItems {
displayName = $STR_EPOCH_WOODWALL;
vehicleClass = "Fortifications";
maintainBuilding[] = {{"PartWoodPlywood",1},{"PartWoodLumber",1}};
upgradeBuilding[] = {"WoodSmallWallWin_DZ",{{"PartGlass",1}}};
upgradeBuilding[] = {"WoodSmallWallWin_DZ",{"ItemToolbox"},{{"PartGlass",1}}};
GhostPreview = "WoodSmallWall_Preview_DZ";
class DestructionEffects : DestructionEffects {
class Ruin1 {
@@ -407,7 +407,7 @@ class WoodSmallWallDoor_DZ: ModularItems {
armor = 2000;
displayName = $STR_EPOCH_WALLWITHDOORWAY;
vehicleClass = "Fortifications";
upgradeBuilding[] = {"Land_DZE_WoodDoor",{{"PartWoodPlywood",1},{"PartWoodLumber",1}}};
upgradeBuilding[] = {"Land_DZE_WoodDoor",{"ItemToolbox"},{{"PartWoodPlywood",1},{"PartWoodLumber",1}}};
maintainBuilding[] = {{"PartWoodPlywood",1},{"PartWoodLumber",1}};
GhostPreview = "WoodSmallWallDoor_Preview_DZ";
class DestructionEffects : DestructionEffects {
@@ -434,7 +434,7 @@ class WoodStairs_DZ: ModularItems {
displayName = $STR_EPOCH_WOODSTAIRSWITHSUPPORTS;
vehicleClass = "Fortifications";
maintainBuilding[] = {{"PartWoodLumber",1}};
upgradeBuilding[] = {"WoodStairsRails_DZ",{{"PartWoodLumber",2}}};
upgradeBuilding[] = {"WoodStairsRails_DZ",{"ItemToolbox"},{{"PartWoodLumber",2}}};
GhostPreview = "WoodStairs_Preview_DZ";
};
class WoodLadder_DZ: ModularItems {
@@ -480,7 +480,7 @@ class WoodStairsSans_DZ: ModularItems {
displayName = $STR_EPOCH_WOODSTAIRS;
vehicleClass = "Fortifications";
maintainBuilding[] = {{"PartWoodLumber",1}};
upgradeBuilding[] = {"WoodStairs_DZ",{{"PartWoodLumber",2}}};
upgradeBuilding[] = {"WoodStairs_DZ",{"ItemToolbox"},{{"PartWoodLumber",2}}};
GhostPreview = "WoodStairsSans_Preview_DZ";
};

View File

@@ -2,165 +2,177 @@
DayZ Base Building Upgrades
Made for DayZ Epoch please ask permission to use/edit/distrubute email vbawol@veteranbastards.com.
*/
private ["_location","_dir","_classname","_missing","_text","_proceed","_num_removed","_object","_missingQty","_itemIn","_countIn","_qty","_removed","_removed_total","_tobe_removed_total","_objectID","_objectUID","_temp_removed_array","_textMissing","_newclassname","_requirements","_obj","_upgrade","_lockable","_combination_1","_combination_2","_combination_3","_combination","_objectCharacterID","_ownerID","_qtyBP","_bpMags","_countNew","_bp2Remove","_count","_friendsArr","_vector","_temp_BP_removed_array","_finished"];
if (dayz_actionInProgress) exitWith {localize "str_epoch_player_52" call dayz_rollingMessages;};
dayz_actionInProgress = true;
private ["_location","_dir","_classname","_missing","_text","_proceed","_num_removed","_object","_missingQty","_itemIn","_countIn","_qty","_removed","_removed_total","_tobe_removed_total","_objectID","_objectUID","_temp_removed_array","_textMissing","_newclassname","_requirements","_obj","_upgrade","_lockable","_combination_1","_combination_2","_combination_3","_combination","_objectCharacterID","_ownerID","_qtyBP","_bpMags","_countNew","_bp2Remove","_count","_friendsArr","_vector","_temp_BP_removed_array","_finished","_neededTools"];
player removeAction s_player_upgrade_build;
s_player_upgrade_build = 1;
_obj = _this select 3;
_objectID = _obj getVariable ["ObjectID","0"];
_objectUID = _obj getVariable ["ObjectUID","0"];
if (_objectID == "0" && _objectUID == "0") exitWith {dayz_actionInProgress = false; s_player_upgrade_build = -1; localize "str_epoch_player_50" call dayz_rollingMessages;};
if (_objectID == "0" && {_objectUID == "0"}) exitWith {dayz_actionInProgress = false; s_player_upgrade_build = -1; localize "str_epoch_player_50" call dayz_rollingMessages;};
_classname = typeOf _obj;
_text = getText (configFile >> "CfgVehicles" >> _classname >> "displayName");
_upgrade = getArray (configFile >> "CfgVehicles" >> _classname >> "upgradeBuilding");
if ((count _upgrade) > 0) then {
_newclassname = _upgrade select 0;
_lockable = 0;
if(isNumber (configFile >> "CfgVehicles" >> _newclassname >> "lockable")) then {
_lockable = getNumber(configFile >> "CfgVehicles" >> _newclassname >> "lockable");
};
_requirements = _upgrade select 1;
_missingQty = 0;
_missing = "";
_bpMags = [];
_bp2Remove = [];
_qtyBP = 0;
_proceed = true;
{
_itemIn = _x select 0;
_countIn = _x select 1;
_qty = { (_x == _itemIn) || {configName(inheritsFrom(configFile >> "cfgMagazines" >> _x)) == _itemIn} } count magazines player;
if (!isNull (UnitBackpack Player) && {_qty < _countIn}) then {
_bpMags = (getMagazineCargo (unitbackpack player));
{
if ((_x == _itemIn) || {configName(inheritsFrom(configFile >> "cfgMagazines" >> _x)) == _itemIn}) exitWith {
_qtyBP = ((_bpMags select 1) select _forEachIndex);
_bp2Remove set [(count _bp2Remove), _x];
};
} forEach (_bpMags select 0);
_neededTools = _upgrade select 1;
if (["",_neededTools,"none"] call dze_requiredItemsCheck) then {
_newclassname = _upgrade select 0;
_lockable = 0;
if(isNumber (configFile >> "CfgVehicles" >> _newclassname >> "lockable")) then {
_lockable = getNumber(configFile >> "CfgVehicles" >> _newclassname >> "lockable");
};
_requirements = _upgrade select 2;
_missingQty = 0;
_missing = "";
_bpMags = [];
_bp2Remove = [];
_qtyBP = 0;
_proceed = true;
if ((_qty < _countIn) && {_qtyBP < (_countIn - _qty)}) exitWith { _missing = _itemIn; _missingQty = (_countIn - (_qty + _qtyBP)); _proceed = false; };
} forEach _requirements;
if (_proceed) then {
[player,20,true,(getPosATL player)] spawn player_alertZombies;
_finished = ["Medic",1] call fn_loopAction;
if (!_finished) exitWith {};
["Working",0,[3,2,4,0]] call dayz_NutritionSystem;
_temp_removed_array = [];
_temp_BP_removed_array = [];
_removed_total = 0;
_tobe_removed_total = 0;
{
_removed = 0;
_itemIn = _x select 0;
_countIn = _x select 1;
_tobe_removed_total = _tobe_removed_total + _countIn;
_qty = { (_x == _itemIn) || {configName(inheritsFrom(configFile >> "cfgMagazines" >> _x)) == _itemIn} } count magazines player;
{
if( (_removed < _countIn) && ((_x == _itemIn) || configName(inheritsFrom(configFile >> "cfgMagazines" >> _x)) == _itemIn)) then {
_num_removed = ([player,_x] call BIS_fnc_invRemove);
_removed = _removed + _num_removed;
_removed_total = _removed_total + _num_removed;
if(_num_removed >= 1) then {
_temp_removed_array set [count _temp_removed_array,_x];
};
};
} forEach magazines player;
if (!isNull (UnitBackpack Player) && {_removed < _countIn}) then {
if (!isNull (UnitBackpack Player) && {_qty < _countIn}) then {
_bpMags = (getMagazineCargo (unitbackpack player));
clearMagazineCargoGlobal (unitbackpack player);
{
_count = ((_bpMags select 1) select _forEachIndex);
_countNew = _count;
if (_x in _bp2Remove && {(_x == _itemIn) || {configName(inheritsFrom(configFile >> "cfgMagazines" >> _x)) == _itemIn}}) then {
_countNew = (_count - (_countIn - _removed));
_bp2Remove = _bp2Remove - [_x];
if ((_x == _itemIn) || {configName(inheritsFrom(configFile >> "cfgMagazines" >> _x)) == _itemIn}) exitWith {
_qtyBP = ((_bpMags select 1) select _forEachIndex);
_bp2Remove set [(count _bp2Remove), _x];
};
if (_countNew > 0) then {
(unitbackpack player) addMagazineCargoGlobal [_x, _countNew];
};
_num_removed = (_count - _countNew);
_temp_BP_removed_array set [(count _temp_BP_removed_array), [_x, _num_removed]];
_removed_total = _removed_total + _num_removed;
} forEach (_bpMags select 0);
};
if ((_qty < _countIn) && {_qtyBP < (_countIn - _qty)}) exitWith { _missing = _itemIn; _missingQty = (_countIn - (_qty + _qtyBP)); _proceed = false; };
} forEach _requirements;
if (_tobe_removed_total == _removed_total) then {
_location = _obj getVariable["OEMPos",(getposATL _obj)];
_dir = getDir _obj;
_vector = [(vectorDir _obj),(vectorUp _obj)];
_objectCharacterID = _obj getVariable ["CharacterID","0"];
_classname = _newclassname;
_object = createVehicle [_classname, [0,0,0], [], 0, "CAN_COLLIDE"];
_object setDir _dir;
_object setVariable["memDir",_dir,true];
_object setVectorDirAndUp _vector;
_object setPosATL _location;
if (_proceed) then {
[player,20,true,(getPosATL player)] spawn player_alertZombies;
_finished = ["Medic",1] call fn_loopAction;
if (!_finished) exitWith {};
["Working",0,[3,2,4,0]] call dayz_NutritionSystem;
if (_lockable == 3) then {
_temp_removed_array = [];
_temp_BP_removed_array = [];
_removed_total = 0;
_tobe_removed_total = 0;
_combination_1 = floor(random 10);
_combination_2 = floor(random 10);
_combination_3 = floor(random 10);
_combination = format["%1%2%3",_combination_1,_combination_2,_combination_3];
_objectCharacterID = _combination;
DZE_Lock_Door = _combination;
format[localize "str_epoch_player_158",_combination,_text] call dayz_rollingMessages;
systemChat format[localize "str_epoch_player_158",_combination,_text];
} else {
format[localize "str_epoch_player_159",_text] call dayz_rollingMessages;
};
if (DZE_GodModeBase && {!(_classname in DZE_GodModeBaseExclude)}) then {
_object addEventHandler ["HandleDamage",{false}];
};
if (DZE_permanentPlot) then {
_ownerID = _obj getVariable["ownerPUID","0"];
if (_ownerID == "0") then { _ownerID = dayz_playerUID; }; //APFL is on but UID is 0 so we will claim it to record the ownership.
_object setVariable ["ownerPUID",_ownerID,true];
if (_lockable == 3) then {
_friendsArr = [[dayz_playerUID,toArray (name player)]];
_object setVariable ["doorfriends", _friendsArr, true];
PVDZE_obj_Swap = [_objectCharacterID,_object,[_dir,_location,_ownerID,_vector],_classname,_obj,player,_friendsArr,dayz_authKey];
} else {
PVDZE_obj_Swap = [_objectCharacterID,_object,[_dir,_location,_ownerID,_vector],_classname,_obj,player,[],dayz_authKey];
{
_removed = 0;
_itemIn = _x select 0;
_countIn = _x select 1;
_tobe_removed_total = _tobe_removed_total + _countIn;
{
if( (_removed < _countIn) && {(_x == _itemIn) || {configName(inheritsFrom(configFile >> "cfgMagazines" >> _x)) == _itemIn}}) then {
_num_removed = ([player,_x] call BIS_fnc_invRemove);
_removed = _removed + _num_removed;
_removed_total = _removed_total + _num_removed;
if(_num_removed >= 1) then {
_temp_removed_array set [count _temp_removed_array,_x];
};
};
} forEach magazines player;
if (!isNull (UnitBackpack Player) && {_removed < _countIn}) then {
_bpMags = (getMagazineCargo (unitbackpack player));
clearMagazineCargoGlobal (unitbackpack player);
{
_count = ((_bpMags select 1) select _forEachIndex);
_countNew = _count;
if (_x in _bp2Remove && {(_x == _itemIn) || {configName(inheritsFrom(configFile >> "cfgMagazines" >> _x)) == _itemIn}}) then {
_countNew = (_count - (_countIn - _removed));
_bp2Remove = _bp2Remove - [_x];
};
if (_countNew > 0) then {
(unitbackpack player) addMagazineCargoGlobal [_x, _countNew];
};
_num_removed = (_count - _countNew);
_temp_BP_removed_array set [(count _temp_BP_removed_array), [_x, _num_removed]];
_removed_total = _removed_total + _num_removed;
} forEach (_bpMags select 0);
};
} forEach _requirements;
if (_tobe_removed_total == _removed_total) then {
_location = _obj getVariable["OEMPos",(getposATL _obj)];
_dir = getDir _obj;
_vector = [(vectorDir _obj),(vectorUp _obj)];
_objectCharacterID = _obj getVariable ["CharacterID","0"];
_classname = _newclassname;
_object = createVehicle [_classname, [0,0,0], [], 0, "CAN_COLLIDE"];
_object setDir _dir;
_object setVariable["memDir",_dir,true];
_object setVectorDirAndUp _vector;
_object setPosATL _location;
if (_lockable == 3) then {
_combination_1 = floor(random 10);
_combination_2 = floor(random 10);
_combination_3 = floor(random 10);
_combination = format["%1%2%3",_combination_1,_combination_2,_combination_3];
_objectCharacterID = _combination;
DZE_Lock_Door = _combination;
format[localize "str_epoch_player_158",_combination,_text] call dayz_rollingMessages;
systemChat format[localize "str_epoch_player_158",_combination,_text];
} else {
format[localize "str_epoch_player_159",_text] call dayz_rollingMessages;
};
if (DZE_GodModeBase && {!(_classname in DZE_GodModeBaseExclude)}) then {
_object addEventHandler ["HandleDamage",{false}];
};
if (DZE_permanentPlot) then {
_ownerID = _obj getVariable["ownerPUID","0"];
if (_ownerID == "0") then { _ownerID = dayz_playerUID; }; //APFL is on but UID is 0 so we will claim it to record the ownership.
_object setVariable ["ownerPUID",_ownerID,true];
if (_lockable == 3) then {
_friendsArr = [[dayz_playerUID,toArray (name player)]];
_object setVariable ["doorfriends", _friendsArr, true];
PVDZE_obj_Swap = [_objectCharacterID,_object,[_dir,_location,_ownerID,_vector],_classname,_obj,player,_friendsArr,dayz_authKey];
} else {
PVDZE_obj_Swap = [_objectCharacterID,_object,[_dir,_location,_ownerID,_vector],_classname,_obj,player,[],dayz_authKey];
};
} else {
PVDZE_obj_Swap = [_objectCharacterID,_object,[_dir,_location,_vector],_classname,_obj,player,[],dayz_authKey];
};
publicVariableServer "PVDZE_obj_Swap";
player reveal _object;
} else {
PVDZE_obj_Swap = [_objectCharacterID,_object,[_dir,_location,_vector],_classname,_obj,player,[],dayz_authKey];
};
publicVariableServer "PVDZE_obj_Swap";
{player addMagazine _x;} count _temp_removed_array;
if (count _temp_BP_removed_array > 0) then {
{(unitbackpack player) addMagazineCargoGlobal _x} count _temp_BP_removed_array;
};
format[localize "str_epoch_player_145",_removed_total,_tobe_removed_total] call dayz_rollingMessages;
player reveal _object;
};
} else {
{player addMagazine _x;} count _temp_removed_array;
if (count _temp_BP_removed_array > 0) then {
{(unitbackpack player) addMagazineCargoGlobal _x} count _temp_BP_removed_array;
_textMissing = getText(configFile >> "CfgMagazines" >> _missing >> "displayName");
format[localize "STR_EPOCH_ACTIONS_6",_missingQty, _textMissing] call dayz_rollingMessages;
systemchat localize "STR_CRAFTING_NEEDED_ITEMS";
if (count _requirements > 0) then {
{
_text = getText(configFile >> "CfgMagazines" >> (_x select 0) >> "displayName");
systemchat format ["%2x %1",_text,(_x select 1)];
} count _requirements;
};
format[localize "str_epoch_player_145",_removed_total,_tobe_removed_total] call dayz_rollingMessages;
};
} else {
_textMissing = getText(configFile >> "CfgMagazines" >> _missing >> "displayName");
format[localize "STR_EPOCH_ACTIONS_6",_missingQty, _textMissing] call dayz_rollingMessages;
};
} else {
localize "str_epoch_player_82" call dayz_rollingMessages;
};

View File

@@ -1,4 +1,4 @@
private ["_class","_uid","_charID","_object","_worldspace","_key","_allowed","_obj","_inv","_objectID","_objectUID","_proceed","_activatingplayer","_clientKey","_exitReason","_playerUID"];
private ["_class","_uid","_charID","_object","_worldspace","_key","_allowed","_obj","_inv","_objectID","_objectUID","_proceed","_activatingplayer","_clientKey","_exitReason","_playerUID","_weapons","_obj","_magazines","_backpacks"];
if (count _this < 8) exitWith {diag_log "Server_SwapObject error: Wrong parameter format";};
@@ -18,7 +18,7 @@ _playerUID = getPlayerUID _activatingPlayer;
_exitReason = [_this,"SwapObject",(_worldspace select 1),_clientKey,_playerUID,_activatingPlayer] call server_verifySender;
if (_exitReason != "") exitWith {diag_log _exitReason};
if(!isNull(_obj)) then {
if (!isNull(_obj)) then {
// Find objectID
_objectID = _obj getVariable ["ObjectID","0"];
// Find objectUID
@@ -26,6 +26,12 @@ if(!isNull(_obj)) then {
if !(DZE_GodModeBase) then {
_obj removeAllMPEventHandlers "MPKilled";
};
if (_class isKindOf "Land_A_tent" || {_class in DZE_isNewStorage}) then {
_weapons = getWeaponCargo _obj;
_magazines = getMagazineCargo _obj;
_backpacks = getBackpackCargo _obj;
_inv = [_weapons,_magazines,_backpacks];
};
// Remove old object
deleteVehicle _obj;
@@ -76,6 +82,11 @@ if (DZE_GodModeBase && {!(_class in DZE_GodModeBaseExclude)}) then {
} else {
_object addMPEventHandler ["MPKilled",{_this call vehicle_handleServerKilled;}];
};
if (count _inv > 0) then {
[_weapons,_magazines,_backpacks,_object] call fn_addCargo;
};
// Test disabling simulation server side on buildables only.
_object enableSimulation false;