mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-14 12:12:34 +03:00
Add tools as requirement for upgrade buildings
player_upgrade.sqf can upgrade storage buildings too now.
This commit is contained in:
@@ -283,7 +283,7 @@ class Land_DZE_WoodDoor: Land_DZE_WoodDoor_Base {
|
|||||||
model = "\z\addons\dayz_epoch\models\small_wall_door_anim.p3d";
|
model = "\z\addons\dayz_epoch\models\small_wall_door_anim.p3d";
|
||||||
displayName = $STR_EPOCH_WALLWITHDOOR;
|
displayName = $STR_EPOCH_WALLWITHDOOR;
|
||||||
GhostPreview = "WoodDoor_Preview_DZ";
|
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*/
|
/* Arma needs to know, how the animation trigger is triggered*/
|
||||||
class AnimationSources {
|
class AnimationSources {
|
||||||
/* name must be identical to the one given by the model.cfg ("Open_Door")" */
|
/* 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";
|
model = "\z\addons\dayz_epoch\models\large_wall_door_anim.p3d";
|
||||||
displayName = $STR_EPOCH_LARGEWALLWITHDOOR;
|
displayName = $STR_EPOCH_LARGEWALLWITHDOOR;
|
||||||
GhostPreview = "LargeWoodDoor_Preview_DZ";
|
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*/
|
/* Arma needs to know, how the animation trigger is triggered*/
|
||||||
class AnimationSources {
|
class AnimationSources {
|
||||||
/* name must be identical to the one given by the model.cfg ("Open_Door")" */
|
/* 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";
|
model = "\z\addons\dayz_epoch\models\Garage_door_anim.p3d";
|
||||||
displayName = $STR_EPOCH_WOODGARAGEDOOR;
|
displayName = $STR_EPOCH_WOODGARAGEDOOR;
|
||||||
GhostPreview = "GarageWoodDoor_Preview_DZ";
|
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*/
|
/* Arma needs to know, how the animation trigger is triggered*/
|
||||||
class AnimationSources {
|
class AnimationSources {
|
||||||
/* name must be identical to the one given by the model.cfg ("Open_Door")" */
|
/* 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";
|
model = "\z\addons\dayz_epoch\models\steel_garage_door.p3d";
|
||||||
displayName = $STR_EPOCH_BLOCKGARAGEDOOR;
|
displayName = $STR_EPOCH_BLOCKGARAGEDOOR;
|
||||||
GhostPreview = "CinderWallDoorway_Preview_DZ";
|
GhostPreview = "CinderWallDoorway_Preview_DZ";
|
||||||
upgradeBuilding[] = {"CinderWallDoorLocked_DZ",{{"ItemComboLock",1}}};
|
upgradeBuilding[] = {"CinderWallDoorLocked_DZ",{},{{"ItemComboLock",1}}};
|
||||||
/* Arma needs to know, how the animation trigger is triggered*/
|
/* Arma needs to know, how the animation trigger is triggered*/
|
||||||
class AnimationSources {
|
class AnimationSources {
|
||||||
/* name must be identical to the one given by the model.cfg ("Open_Door")" */
|
/* 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";
|
model = "\z\addons\dayz_epoch\models\Steel_door.p3d";
|
||||||
displayName = $STR_EPOCH_BLOCKDOOR;
|
displayName = $STR_EPOCH_BLOCKDOOR;
|
||||||
GhostPreview = "CinderWallSmallDoorway_Preview_DZ";
|
GhostPreview = "CinderWallSmallDoorway_Preview_DZ";
|
||||||
upgradeBuilding[] = {"CinderWallDoorSmallLocked_DZ",{{"ItemComboLock",1}}};
|
upgradeBuilding[] = {"CinderWallDoorSmallLocked_DZ",{},{{"ItemComboLock",1}}};
|
||||||
/* Arma needs to know, how the animation trigger is triggered*/
|
/* Arma needs to know, how the animation trigger is triggered*/
|
||||||
class AnimationSources {
|
class AnimationSources {
|
||||||
/* name must be identical to the one given by the model.cfg ("Open_Door")" */
|
/* name must be identical to the one given by the model.cfg ("Open_Door")" */
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ class CinderWallHalf_DZ: ModularItems {
|
|||||||
armor = 2200;
|
armor = 2200;
|
||||||
displayName = $STR_EPOCH_CINDERBLOCKWALL_HALF;
|
displayName = $STR_EPOCH_CINDERBLOCKWALL_HALF;
|
||||||
vehicleClass = "Fortifications";
|
vehicleClass = "Fortifications";
|
||||||
upgradeBuilding[] = {"CinderWall_DZ",{{"CinderBlocks",4},{"MortarBucket",1}}};
|
upgradeBuilding[] = {"CinderWall_DZ",{"ItemToolbox"},{{"CinderBlocks",4},{"MortarBucket",1}}};
|
||||||
maintainBuilding[] = {{"MortarBucket",1}};
|
maintainBuilding[] = {{"MortarBucket",1}};
|
||||||
GhostPreview = "CinderWallHalf_Preview_DZ";
|
GhostPreview = "CinderWallHalf_Preview_DZ";
|
||||||
class DestructionEffects : DestructionEffects {
|
class DestructionEffects : DestructionEffects {
|
||||||
@@ -127,7 +127,7 @@ class CinderWallDoorway_DZ: ModularItems {
|
|||||||
displayName = $STR_EPOCH_BLOCKGARAGEDOORWAY;
|
displayName = $STR_EPOCH_BLOCKGARAGEDOORWAY;
|
||||||
vehicleClass = "Fortifications";
|
vehicleClass = "Fortifications";
|
||||||
maintainBuilding[] = {{"MortarBucket",1}};
|
maintainBuilding[] = {{"MortarBucket",1}};
|
||||||
upgradeBuilding[] = {"CinderWallDoor_DZ",{{"ItemPole",3},{"ItemTankTrap",3}}};
|
upgradeBuilding[] = {"CinderWallDoor_DZ",{"ItemToolbox"},{{"ItemPole",3},{"ItemTankTrap",3}}};
|
||||||
GhostPreview = "CinderWallDoorway_Preview_DZ";
|
GhostPreview = "CinderWallDoorway_Preview_DZ";
|
||||||
class DestructionEffects : DestructionEffects {
|
class DestructionEffects : DestructionEffects {
|
||||||
class Ruin1 {
|
class Ruin1 {
|
||||||
@@ -153,7 +153,7 @@ class CinderWallSmallDoorway_DZ: ModularItems {
|
|||||||
displayName = $STR_EPOCH_BLOCKDOORWAY;
|
displayName = $STR_EPOCH_BLOCKDOORWAY;
|
||||||
vehicleClass = "Fortifications";
|
vehicleClass = "Fortifications";
|
||||||
maintainBuilding[] = {{"MortarBucket",1}};
|
maintainBuilding[] = {{"MortarBucket",1}};
|
||||||
upgradeBuilding[] = {"CinderWallDoorSmall_DZ",{{"ItemPole",1},{"ItemTankTrap",1}}};
|
upgradeBuilding[] = {"CinderWallDoorSmall_DZ",{"ItemToolbox"},{{"ItemPole",1},{"ItemTankTrap",1}}};
|
||||||
GhostPreview = "CinderWallSmallDoorway_Preview_DZ";
|
GhostPreview = "CinderWallSmallDoorway_Preview_DZ";
|
||||||
class DestructionEffects : DestructionEffects {
|
class DestructionEffects : DestructionEffects {
|
||||||
class Ruin1 {
|
class Ruin1 {
|
||||||
@@ -257,7 +257,7 @@ class WoodLargeWall_DZ: ModularItems {
|
|||||||
armor = 2200;
|
armor = 2200;
|
||||||
displayName = $STR_EPOCH_LARGEWOODWALL;
|
displayName = $STR_EPOCH_LARGEWOODWALL;
|
||||||
vehicleClass = "Fortifications";
|
vehicleClass = "Fortifications";
|
||||||
upgradeBuilding[] = {"WoodLargeWallWin_DZ",{{"PartGlass",1}}};
|
upgradeBuilding[] = {"WoodLargeWallWin_DZ",{"ItemToolbox"},{{"PartGlass",1}}};
|
||||||
maintainBuilding[] = {{"PartWoodPlywood",1},{"PartWoodLumber",1}};
|
maintainBuilding[] = {{"PartWoodPlywood",1},{"PartWoodLumber",1}};
|
||||||
GhostPreview = "WoodLargeWall_Preview_DZ";
|
GhostPreview = "WoodLargeWall_Preview_DZ";
|
||||||
class DestructionEffects : DestructionEffects {
|
class DestructionEffects : DestructionEffects {
|
||||||
@@ -284,7 +284,7 @@ class WoodLargeWallDoor_DZ: ModularItems {
|
|||||||
displayName = $STR_EPOCH_LARGEWALLWITHDOORWAY;
|
displayName = $STR_EPOCH_LARGEWALLWITHDOORWAY;
|
||||||
vehicleClass = "Fortifications";
|
vehicleClass = "Fortifications";
|
||||||
maintainBuilding[] = {{"PartWoodPlywood",1},{"PartWoodLumber",1}};
|
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";
|
GhostPreview = "WoodLargeWallDoor_Preview_DZ";
|
||||||
class DestructionEffects : DestructionEffects {
|
class DestructionEffects : DestructionEffects {
|
||||||
class Ruin1 {
|
class Ruin1 {
|
||||||
@@ -334,7 +334,7 @@ class WoodSmallWall_DZ: ModularItems {
|
|||||||
displayName = $STR_EPOCH_WOODWALL;
|
displayName = $STR_EPOCH_WOODWALL;
|
||||||
vehicleClass = "Fortifications";
|
vehicleClass = "Fortifications";
|
||||||
maintainBuilding[] = {{"PartWoodPlywood",1},{"PartWoodLumber",1}};
|
maintainBuilding[] = {{"PartWoodPlywood",1},{"PartWoodLumber",1}};
|
||||||
upgradeBuilding[] = {"WoodSmallWallWin_DZ",{{"PartGlass",1}}};
|
upgradeBuilding[] = {"WoodSmallWallWin_DZ",{"ItemToolbox"},{{"PartGlass",1}}};
|
||||||
GhostPreview = "WoodSmallWall_Preview_DZ";
|
GhostPreview = "WoodSmallWall_Preview_DZ";
|
||||||
class DestructionEffects : DestructionEffects {
|
class DestructionEffects : DestructionEffects {
|
||||||
class Ruin1 {
|
class Ruin1 {
|
||||||
@@ -407,7 +407,7 @@ class WoodSmallWallDoor_DZ: ModularItems {
|
|||||||
armor = 2000;
|
armor = 2000;
|
||||||
displayName = $STR_EPOCH_WALLWITHDOORWAY;
|
displayName = $STR_EPOCH_WALLWITHDOORWAY;
|
||||||
vehicleClass = "Fortifications";
|
vehicleClass = "Fortifications";
|
||||||
upgradeBuilding[] = {"Land_DZE_WoodDoor",{{"PartWoodPlywood",1},{"PartWoodLumber",1}}};
|
upgradeBuilding[] = {"Land_DZE_WoodDoor",{"ItemToolbox"},{{"PartWoodPlywood",1},{"PartWoodLumber",1}}};
|
||||||
maintainBuilding[] = {{"PartWoodPlywood",1},{"PartWoodLumber",1}};
|
maintainBuilding[] = {{"PartWoodPlywood",1},{"PartWoodLumber",1}};
|
||||||
GhostPreview = "WoodSmallWallDoor_Preview_DZ";
|
GhostPreview = "WoodSmallWallDoor_Preview_DZ";
|
||||||
class DestructionEffects : DestructionEffects {
|
class DestructionEffects : DestructionEffects {
|
||||||
@@ -434,7 +434,7 @@ class WoodStairs_DZ: ModularItems {
|
|||||||
displayName = $STR_EPOCH_WOODSTAIRSWITHSUPPORTS;
|
displayName = $STR_EPOCH_WOODSTAIRSWITHSUPPORTS;
|
||||||
vehicleClass = "Fortifications";
|
vehicleClass = "Fortifications";
|
||||||
maintainBuilding[] = {{"PartWoodLumber",1}};
|
maintainBuilding[] = {{"PartWoodLumber",1}};
|
||||||
upgradeBuilding[] = {"WoodStairsRails_DZ",{{"PartWoodLumber",2}}};
|
upgradeBuilding[] = {"WoodStairsRails_DZ",{"ItemToolbox"},{{"PartWoodLumber",2}}};
|
||||||
GhostPreview = "WoodStairs_Preview_DZ";
|
GhostPreview = "WoodStairs_Preview_DZ";
|
||||||
};
|
};
|
||||||
class WoodLadder_DZ: ModularItems {
|
class WoodLadder_DZ: ModularItems {
|
||||||
@@ -480,7 +480,7 @@ class WoodStairsSans_DZ: ModularItems {
|
|||||||
displayName = $STR_EPOCH_WOODSTAIRS;
|
displayName = $STR_EPOCH_WOODSTAIRS;
|
||||||
vehicleClass = "Fortifications";
|
vehicleClass = "Fortifications";
|
||||||
maintainBuilding[] = {{"PartWoodLumber",1}};
|
maintainBuilding[] = {{"PartWoodLumber",1}};
|
||||||
upgradeBuilding[] = {"WoodStairs_DZ",{{"PartWoodLumber",2}}};
|
upgradeBuilding[] = {"WoodStairs_DZ",{"ItemToolbox"},{{"PartWoodLumber",2}}};
|
||||||
GhostPreview = "WoodStairsSans_Preview_DZ";
|
GhostPreview = "WoodStairsSans_Preview_DZ";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -2,165 +2,177 @@
|
|||||||
DayZ Base Building Upgrades
|
DayZ Base Building Upgrades
|
||||||
Made for DayZ Epoch please ask permission to use/edit/distrubute email vbawol@veteranbastards.com.
|
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;};
|
if (dayz_actionInProgress) exitWith {localize "str_epoch_player_52" call dayz_rollingMessages;};
|
||||||
dayz_actionInProgress = true;
|
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;
|
player removeAction s_player_upgrade_build;
|
||||||
s_player_upgrade_build = 1;
|
s_player_upgrade_build = 1;
|
||||||
|
|
||||||
_obj = _this select 3;
|
_obj = _this select 3;
|
||||||
_objectID = _obj getVariable ["ObjectID","0"];
|
_objectID = _obj getVariable ["ObjectID","0"];
|
||||||
_objectUID = _obj getVariable ["ObjectUID","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;
|
_classname = typeOf _obj;
|
||||||
_text = getText (configFile >> "CfgVehicles" >> _classname >> "displayName");
|
_text = getText (configFile >> "CfgVehicles" >> _classname >> "displayName");
|
||||||
_upgrade = getArray (configFile >> "CfgVehicles" >> _classname >> "upgradeBuilding");
|
_upgrade = getArray (configFile >> "CfgVehicles" >> _classname >> "upgradeBuilding");
|
||||||
|
|
||||||
if ((count _upgrade) > 0) then {
|
if ((count _upgrade) > 0) then {
|
||||||
_newclassname = _upgrade select 0;
|
_neededTools = _upgrade select 1;
|
||||||
_lockable = 0;
|
if (["",_neededTools,"none"] call dze_requiredItemsCheck) then {
|
||||||
if(isNumber (configFile >> "CfgVehicles" >> _newclassname >> "lockable")) then {
|
_newclassname = _upgrade select 0;
|
||||||
_lockable = getNumber(configFile >> "CfgVehicles" >> _newclassname >> "lockable");
|
_lockable = 0;
|
||||||
};
|
if(isNumber (configFile >> "CfgVehicles" >> _newclassname >> "lockable")) then {
|
||||||
_requirements = _upgrade select 1;
|
_lockable = getNumber(configFile >> "CfgVehicles" >> _newclassname >> "lockable");
|
||||||
_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);
|
|
||||||
};
|
};
|
||||||
|
_requirements = _upgrade select 2;
|
||||||
if ((_qty < _countIn) && {_qtyBP < (_countIn - _qty)}) exitWith { _missing = _itemIn; _missingQty = (_countIn - (_qty + _qtyBP)); _proceed = false; };
|
_missingQty = 0;
|
||||||
} forEach _requirements;
|
_missing = "";
|
||||||
|
_bpMags = [];
|
||||||
if (_proceed) then {
|
_bp2Remove = [];
|
||||||
[player,20,true,(getPosATL player)] spawn player_alertZombies;
|
_qtyBP = 0;
|
||||||
_finished = ["Medic",1] call fn_loopAction;
|
_proceed = true;
|
||||||
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;
|
_itemIn = _x select 0;
|
||||||
_countIn = _x select 1;
|
_countIn = _x select 1;
|
||||||
_tobe_removed_total = _tobe_removed_total + _countIn;
|
_qty = { (_x == _itemIn) || {configName(inheritsFrom(configFile >> "cfgMagazines" >> _x)) == _itemIn} } count magazines player;
|
||||||
|
|
||||||
{
|
if (!isNull (UnitBackpack Player) && {_qty < _countIn}) then {
|
||||||
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));
|
_bpMags = (getMagazineCargo (unitbackpack player));
|
||||||
clearMagazineCargoGlobal (unitbackpack player);
|
|
||||||
|
|
||||||
{
|
{
|
||||||
_count = ((_bpMags select 1) select _forEachIndex);
|
if ((_x == _itemIn) || {configName(inheritsFrom(configFile >> "cfgMagazines" >> _x)) == _itemIn}) exitWith {
|
||||||
_countNew = _count;
|
_qtyBP = ((_bpMags select 1) select _forEachIndex);
|
||||||
if (_x in _bp2Remove && {(_x == _itemIn) || {configName(inheritsFrom(configFile >> "cfgMagazines" >> _x)) == _itemIn}}) then {
|
_bp2Remove set [(count _bp2Remove), _x];
|
||||||
_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 (_bpMags select 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if ((_qty < _countIn) && {_qtyBP < (_countIn - _qty)}) exitWith { _missing = _itemIn; _missingQty = (_countIn - (_qty + _qtyBP)); _proceed = false; };
|
||||||
} forEach _requirements;
|
} forEach _requirements;
|
||||||
|
|
||||||
if (_tobe_removed_total == _removed_total) then {
|
if (_proceed) then {
|
||||||
_location = _obj getVariable["OEMPos",(getposATL _obj)];
|
[player,20,true,(getPosATL player)] spawn player_alertZombies;
|
||||||
_dir = getDir _obj;
|
_finished = ["Medic",1] call fn_loopAction;
|
||||||
_vector = [(vectorDir _obj),(vectorUp _obj)];
|
if (!_finished) exitWith {};
|
||||||
_objectCharacterID = _obj getVariable ["CharacterID","0"];
|
["Working",0,[3,2,4,0]] call dayz_NutritionSystem;
|
||||||
_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 {
|
_temp_removed_array = [];
|
||||||
|
_temp_BP_removed_array = [];
|
||||||
|
_removed_total = 0;
|
||||||
|
_tobe_removed_total = 0;
|
||||||
|
|
||||||
_combination_1 = floor(random 10);
|
{
|
||||||
_combination_2 = floor(random 10);
|
_removed = 0;
|
||||||
_combination_3 = floor(random 10);
|
_itemIn = _x select 0;
|
||||||
_combination = format["%1%2%3",_combination_1,_combination_2,_combination_3];
|
_countIn = _x select 1;
|
||||||
|
_tobe_removed_total = _tobe_removed_total + _countIn;
|
||||||
|
|
||||||
_objectCharacterID = _combination;
|
{
|
||||||
DZE_Lock_Door = _combination;
|
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;
|
||||||
|
|
||||||
format[localize "str_epoch_player_158",_combination,_text] call dayz_rollingMessages;
|
if (!isNull (UnitBackpack Player) && {_removed < _countIn}) then {
|
||||||
systemChat format[localize "str_epoch_player_158",_combination,_text];
|
_bpMags = (getMagazineCargo (unitbackpack player));
|
||||||
} else {
|
clearMagazineCargoGlobal (unitbackpack player);
|
||||||
format[localize "str_epoch_player_159",_text] call dayz_rollingMessages;
|
|
||||||
};
|
{
|
||||||
if (DZE_GodModeBase && {!(_classname in DZE_GodModeBaseExclude)}) then {
|
_count = ((_bpMags select 1) select _forEachIndex);
|
||||||
_object addEventHandler ["HandleDamage",{false}];
|
_countNew = _count;
|
||||||
};
|
if (_x in _bp2Remove && {(_x == _itemIn) || {configName(inheritsFrom(configFile >> "cfgMagazines" >> _x)) == _itemIn}}) then {
|
||||||
if (DZE_permanentPlot) then {
|
_countNew = (_count - (_countIn - _removed));
|
||||||
_ownerID = _obj getVariable["ownerPUID","0"];
|
_bp2Remove = _bp2Remove - [_x];
|
||||||
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 (_countNew > 0) then {
|
||||||
if (_lockable == 3) then {
|
(unitbackpack player) addMagazineCargoGlobal [_x, _countNew];
|
||||||
_friendsArr = [[dayz_playerUID,toArray (name player)]];
|
};
|
||||||
_object setVariable ["doorfriends", _friendsArr, true];
|
_num_removed = (_count - _countNew);
|
||||||
PVDZE_obj_Swap = [_objectCharacterID,_object,[_dir,_location,_ownerID,_vector],_classname,_obj,player,_friendsArr,dayz_authKey];
|
_temp_BP_removed_array set [(count _temp_BP_removed_array), [_x, _num_removed]];
|
||||||
} else {
|
_removed_total = _removed_total + _num_removed;
|
||||||
PVDZE_obj_Swap = [_objectCharacterID,_object,[_dir,_location,_ownerID,_vector],_classname,_obj,player,[],dayz_authKey];
|
} 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 {
|
} else {
|
||||||
PVDZE_obj_Swap = [_objectCharacterID,_object,[_dir,_location,_vector],_classname,_obj,player,[],dayz_authKey];
|
{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;
|
||||||
|
|
||||||
};
|
};
|
||||||
publicVariableServer "PVDZE_obj_Swap";
|
|
||||||
|
|
||||||
player reveal _object;
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
{player addMagazine _x;} count _temp_removed_array;
|
_textMissing = getText(configFile >> "CfgMagazines" >> _missing >> "displayName");
|
||||||
if (count _temp_BP_removed_array > 0) then {
|
format[localize "STR_EPOCH_ACTIONS_6",_missingQty, _textMissing] call dayz_rollingMessages;
|
||||||
{(unitbackpack player) addMagazineCargoGlobal _x} count _temp_BP_removed_array;
|
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 {
|
} else {
|
||||||
localize "str_epoch_player_82" call dayz_rollingMessages;
|
localize "str_epoch_player_82" call dayz_rollingMessages;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -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";};
|
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;
|
_exitReason = [_this,"SwapObject",(_worldspace select 1),_clientKey,_playerUID,_activatingPlayer] call server_verifySender;
|
||||||
if (_exitReason != "") exitWith {diag_log _exitReason};
|
if (_exitReason != "") exitWith {diag_log _exitReason};
|
||||||
|
|
||||||
if(!isNull(_obj)) then {
|
if (!isNull(_obj)) then {
|
||||||
// Find objectID
|
// Find objectID
|
||||||
_objectID = _obj getVariable ["ObjectID","0"];
|
_objectID = _obj getVariable ["ObjectID","0"];
|
||||||
// Find objectUID
|
// Find objectUID
|
||||||
@@ -26,6 +26,12 @@ if(!isNull(_obj)) then {
|
|||||||
if !(DZE_GodModeBase) then {
|
if !(DZE_GodModeBase) then {
|
||||||
_obj removeAllMPEventHandlers "MPKilled";
|
_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
|
// Remove old object
|
||||||
deleteVehicle _obj;
|
deleteVehicle _obj;
|
||||||
|
|
||||||
@@ -76,6 +82,11 @@ if (DZE_GodModeBase && {!(_class in DZE_GodModeBaseExclude)}) then {
|
|||||||
} else {
|
} else {
|
||||||
_object addMPEventHandler ["MPKilled",{_this call vehicle_handleServerKilled;}];
|
_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.
|
// Test disabling simulation server side on buildables only.
|
||||||
_object enableSimulation false;
|
_object enableSimulation false;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user