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,29 +2,33 @@
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 {
_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 1;
_requirements = _upgrade select 2;
_missingQty = 0;
_missing = "";
_bpMags = [];
@@ -68,7 +72,7 @@ if ((count _upgrade) > 0) then {
_tobe_removed_total = _tobe_removed_total + _countIn;
{
if( (_removed < _countIn) && ((_x == _itemIn) || configName(inheritsFrom(configFile >> "cfgMagazines" >> _x)) == _itemIn)) 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;
@@ -159,8 +163,16 @@ if ((count _upgrade) > 0) then {
} else {
_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;
};
};
};
} 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;