mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-14 12:12:34 +03:00
Update upgrade vehicle
- Server admins can exclude certain vehicles from a vehicle upgrade now. - Vehicle upgrade has a tool check now and all needed materials will be displayed. The configs for the vehicle upgrades will be updated soon for the new changes.
This commit is contained in:
@@ -5,165 +5,175 @@
|
||||
if (dayz_actionInProgress) exitWith {localize "STR_EPOCH_PLAYER_52" call dayz_rollingMessages;};
|
||||
dayz_actionInProgress = true;
|
||||
|
||||
private ["_proceed","_itemIn","_countIn","_missing","_missingQty","_qty","_removed","_tobe_removed_total","_textMissing","_num_removed","_removed_total","_objectID","_objectUID","_location","_dir","_objectCharacterID","_classname","_newclassname","_upgrade","_vehicle","_findNearestVehicles","_findNearestVehicle","_IsNearVehicle","_finished","_temp_removed_array_mag","_temp_removed_array_wep","_notNearestPlayer","_requirementsWeapon","_requirementsMagazine"];
|
||||
private ["_text","_requirementsTools","_upgradeName","_displayname","_vehicle","_proceed","_itemIn","_countIn","_missing","_missingQty","_qty","_removed","_tobe_removed_total","_textMissing","_num_removed","_removed_total","_objectID","_objectUID","_location","_dir","_objectCharacterID","_classname","_newclassname","_upgrade","_vehicle","_finished","_temp_removed_array_mag","_temp_removed_array_wep","_notNearestPlayer","_requirementsWeapon","_requirementsMagazine"];
|
||||
|
||||
// This is used to find correct upgrade based what upgrades was called allows multiple upgrades per vehicle.
|
||||
_upgrade = _this;
|
||||
_vehicle = cursorTarget;
|
||||
|
||||
if (isNull _vehicle || !(_vehicle isKindOf "AllVehicles") || !(alive _vehicle)) exitWith {dayz_actionInProgress = false; systemChat localize "str_cursorTargetNotFound";};
|
||||
|
||||
if (vehicle player != player) exitWith {dayz_actionInProgress = false; localize "STR_EPOCH_ACTIONS_18" call dayz_rollingMessages;};
|
||||
|
||||
// look for nearest empty vehicle
|
||||
_findNearestVehicles = player nearEntities [["LandVehicle"],10];
|
||||
_findNearestVehicle = [];
|
||||
{
|
||||
if (alive _x && {(count (crew _x)) == 0}) exitWith {
|
||||
_findNearestVehicle set [(count _findNearestVehicle),_x];
|
||||
};
|
||||
} count _findNearestVehicles;
|
||||
_classname = typeOf _vehicle;
|
||||
_displayname = getText (configFile >> "CfgVehicles" >> _classname >> "displayname");
|
||||
|
||||
_IsNearVehicle = count (_findNearestVehicle);
|
||||
if (_IsNearVehicle >= 1) then {
|
||||
if (_classname in DZE_DisableVehicleUpgrade) exitWith {dayz_actionInProgress = false; format [localize "STR_EPOCH_VEHUP_NOT_ALLOWED",_displayname] call dayz_rollingMessages;};
|
||||
|
||||
_vehicle = _findNearestVehicle select 0;
|
||||
if ((player distance _vehicle) > 6) exitWith {dayz_actionInProgress = false; format [localize "STR_EPOCH_VEHUP_DISTANCE_TOO_FAR",_displayname] call dayz_rollingMessages;};
|
||||
|
||||
if (count (crew _vehicle) == 0) then {
|
||||
_notNearestPlayer = _vehicle call dze_isnearest_player;
|
||||
|
||||
if (!isNull _vehicle && {local _vehicle} && {!_notNearestPlayer}) then {
|
||||
|
||||
_classname = typeOf _vehicle;
|
||||
|
||||
if (local _vehicle && !_notNearestPlayer) then {
|
||||
// lookup vehicle and find if any upgrades are available
|
||||
_upgradeName = getText (configFile >> "CfgMagazines" >> _upgrade >> "displayname");
|
||||
_upgrade = getArray (configFile >> "CfgVehicles" >> _classname >> "Upgrades" >> _upgrade);
|
||||
|
||||
if (!isNil "_upgrade" && {(count _upgrade) > 0}) then {
|
||||
|
||||
closeDialog 0;
|
||||
_newclassname = _upgrade select 0;
|
||||
_requirementsWeapon = _upgrade select 1;
|
||||
_requirementsMagazine = _upgrade select 2;
|
||||
_requirementsTools = _upgrade select 1;
|
||||
|
||||
_missingQty = 0;
|
||||
_missing = "";
|
||||
if (["",_requirementsTools,"none"] call dze_requiredItemsCheck) then {
|
||||
_requirementsWeapon = _upgrade select 2;
|
||||
_requirementsMagazine = _upgrade select 3;
|
||||
|
||||
_proceed = true;
|
||||
{
|
||||
_itemIn = _x select 0;
|
||||
_countIn = _x select 1;
|
||||
_qty = { (_x == _itemIn) || (configName(inheritsFrom(configFile >> "cfgMagazines" >> _x)) == _itemIn) } count magazines player;
|
||||
if(_qty < _countIn) exitWith { _missing = _itemIn; _missingQty = (_countIn - _qty); _proceed = false; };
|
||||
} count _requirementsMagazine;
|
||||
{
|
||||
_itemIn = _x select 0;
|
||||
_countIn = _x select 1;
|
||||
_qty = { (_x == _itemIn) || (configName(inheritsFrom(configFile >> "cfgWeapons" >> _x)) == _itemIn) } count weapons player;
|
||||
if(_qty < _countIn) exitWith { _missing = _itemIn; _missingQty = (_countIn - _qty); _proceed = false; };
|
||||
} count _requirementsWeapon;
|
||||
|
||||
if (_proceed) then {
|
||||
[player,20,true,(getPosATL player)] spawn player_alertZombies;
|
||||
_finished = ["Medic",1] call fn_loopAction;
|
||||
if (!_finished) exitWith {};
|
||||
|
||||
_temp_removed_array_mag = [];
|
||||
_temp_removed_array_wep = [];
|
||||
_removed_total = 0;
|
||||
_tobe_removed_total = 0;
|
||||
_missingQty = 0;
|
||||
_missing = "";
|
||||
|
||||
_proceed = true;
|
||||
{
|
||||
_removed = 0;
|
||||
_itemIn = _x select 0;
|
||||
_countIn = _x select 1;
|
||||
//diag_log format["Recipe Finish: %1 %2", _itemIn,_countIn];
|
||||
_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_mag set [count _temp_removed_array_mag,_x];
|
||||
};
|
||||
};
|
||||
} count magazines player;
|
||||
} forEach _requirementsMagazine;
|
||||
_qty = { (_x == _itemIn) || (configName(inheritsFrom(configFile >> "cfgMagazines" >> _x)) == _itemIn) } count magazines player;
|
||||
if (_qty < _countIn) exitWith { _missing = _itemIn; _missingQty = (_countIn - _qty); _proceed = false; };
|
||||
} count _requirementsMagazine;
|
||||
|
||||
{
|
||||
_removed = 0;
|
||||
_itemIn = _x select 0;
|
||||
_countIn = _x select 1;
|
||||
//diag_log format["Recipe Finish: %1 %2", _itemIn,_countIn];
|
||||
_tobe_removed_total = _tobe_removed_total + _countIn;
|
||||
_itemIn = _x;
|
||||
_countIn = 1;
|
||||
_qty = { (_x == _itemIn) || (configName(inheritsFrom(configFile >> "cfgWeapons" >> _x)) == _itemIn) } count weapons player;
|
||||
if (_qty < _countIn) exitWith { _missing = _itemIn; _missingQty = (_countIn - _qty); _proceed = false; };
|
||||
} count _requirementsWeapon;
|
||||
|
||||
if (_proceed) then {
|
||||
[player,20,true,(getPosATL player)] spawn player_alertZombies;
|
||||
_finished = ["Medic",1] call fn_loopAction;
|
||||
if (!_finished) exitWith {};
|
||||
if (count (crew _vehicle) > 0) exitWith {format [localize "STR_CL_LOG_FAIL_PLAYER",_displayname] call dayz_rollingMessages;};
|
||||
|
||||
_temp_removed_array_mag = [];
|
||||
_temp_removed_array_wep = [];
|
||||
_removed_total = 0;
|
||||
_tobe_removed_total = 0;
|
||||
|
||||
{
|
||||
if( (_removed < _countIn) && {(_x == _itemIn) || {configName(inheritsFrom(configFile >> "cfgWeapons" >> _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_wep set [count _temp_removed_array_wep,_x];
|
||||
_removed = 0;
|
||||
_itemIn = _x select 0;
|
||||
_countIn = _x select 1;
|
||||
//diag_log format["Recipe Finish: %1 %2", _itemIn,_countIn];
|
||||
_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_mag set [count _temp_removed_array_mag,_x];
|
||||
};
|
||||
};
|
||||
};
|
||||
} count weapons player;
|
||||
} forEach _requirementsWeapon;
|
||||
} count magazines player;
|
||||
} forEach _requirementsMagazine;
|
||||
|
||||
// all parts removed proceed
|
||||
if (_tobe_removed_total == _removed_total) then {
|
||||
{
|
||||
_removed = 0;
|
||||
_itemIn = _x;
|
||||
_countIn = 1;
|
||||
//diag_log format["Recipe Finish: %1 %2", _itemIn,_countIn];
|
||||
_tobe_removed_total = _tobe_removed_total + _countIn;
|
||||
|
||||
_objectID = _vehicle getVariable ["ObjectID","0"];
|
||||
_objectUID = _vehicle getVariable ["ObjectUID","0"];
|
||||
{
|
||||
if ((_removed < _countIn) && {(_x == _itemIn) || {configName(inheritsFrom(configFile >> "cfgWeapons" >> _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_wep set [count _temp_removed_array_wep,_x];
|
||||
};
|
||||
};
|
||||
} count weapons player;
|
||||
} forEach _requirementsWeapon;
|
||||
|
||||
if(_objectID == "0" && {_objectUID == "0"}) then {
|
||||
localize "str_epoch_player_50" call dayz_rollingMessages;
|
||||
}
|
||||
else {
|
||||
// Get position
|
||||
_location = getposATL _vehicle;
|
||||
// all parts removed proceed
|
||||
if (_tobe_removed_total == _removed_total) then {
|
||||
|
||||
// Get direction
|
||||
_dir = getDir _vehicle;
|
||||
_objectID = _vehicle getVariable ["ObjectID","0"];
|
||||
_objectUID = _vehicle getVariable ["ObjectUID","0"];
|
||||
|
||||
// Current charID
|
||||
_objectCharacterID = _vehicle getVariable ["CharacterID","0"];
|
||||
localize "STR_EPOCH_VEHUP_IN_PROGRESS" call dayz_rollingMessages;
|
||||
[_newclassname,objNull] call fn_waitForObject;
|
||||
dze_waiting = nil;
|
||||
PVDZE_veh_Upgrade = [_vehicle,[_dir,_location],_newclassname,true,_objectCharacterID,player,dayz_authKey];
|
||||
publicVariableServer "PVDZE_veh_Upgrade";
|
||||
|
||||
//Wait for hive to finish spawning vehicle. Prevents dupe via player queuing multiple upgrades.
|
||||
waitUntil {!isNil "dze_waiting"};
|
||||
|
||||
if (dze_waiting == "fail") then {
|
||||
{player addMagazine _x;} count _temp_removed_array_mag;
|
||||
{player addWeapon _x;} count _temp_removed_array_wep;
|
||||
format[localize "str_crafting_failed",_newclassname] call dayz_rollingMessages;
|
||||
if (_objectID == "0" && {_objectUID == "0"}) then {
|
||||
localize "str_epoch_player_50" call dayz_rollingMessages;
|
||||
} else {
|
||||
localize "STR_EPOCH_VEHUP_SUCCESS" call dayz_rollingMessages;
|
||||
["Working",0,[3,2,4,0]] call dayz_NutritionSystem;
|
||||
// Get position
|
||||
_location = getposATL _vehicle;
|
||||
|
||||
// Get direction
|
||||
_dir = getDir _vehicle;
|
||||
|
||||
// Current charID
|
||||
_objectCharacterID = _vehicle getVariable ["CharacterID","0"];
|
||||
localize "STR_EPOCH_VEHUP_IN_PROGRESS" call dayz_rollingMessages;
|
||||
[_newclassname,objNull] call fn_waitForObject;
|
||||
dze_waiting = nil;
|
||||
PVDZE_veh_Upgrade = [_vehicle,[_dir,_location],_newclassname,true,_objectCharacterID,player,dayz_authKey];
|
||||
publicVariableServer "PVDZE_veh_Upgrade";
|
||||
|
||||
//Wait for hive to finish spawning vehicle. Prevents dupe via player queuing multiple upgrades.
|
||||
waitUntil {!isNil "dze_waiting"};
|
||||
|
||||
if (dze_waiting == "fail") then {
|
||||
{player addMagazine _x;} count _temp_removed_array_mag;
|
||||
{player addWeapon _x;} count _temp_removed_array_wep;
|
||||
format[localize "str_crafting_failed",_newclassname] call dayz_rollingMessages;
|
||||
} else {
|
||||
localize "STR_EPOCH_VEHUP_SUCCESS" call dayz_rollingMessages;
|
||||
["Working",0,[3,2,4,0]] call dayz_NutritionSystem;
|
||||
};
|
||||
};
|
||||
} else {
|
||||
{player addMagazine _x;} count _temp_removed_array_mag;
|
||||
{player addWeapon _x;} count _temp_removed_array_wep;
|
||||
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;
|
||||
|
||||
systemchat localize "STR_CRAFTING_NEEDED_ITEMS";
|
||||
|
||||
if (count _requirementsMagazine > 0) then {
|
||||
{
|
||||
_text = getText(configFile >> "CfgMagazines" >> (_x select 0) >> "displayName");
|
||||
systemchat format ["%2x %1",_text,(_x select 1)];
|
||||
} count _requirementsMagazine;
|
||||
};
|
||||
if (count _requirementsWeapon > 0) then {
|
||||
{
|
||||
_text = getText(configFile >> "CfgWeapons" >> _x >> "displayName");
|
||||
systemchat format ["1x %1",_text];
|
||||
|
||||
} count _requirementsWeapon;
|
||||
};
|
||||
}
|
||||
else {
|
||||
{player addMagazine _x;} count _temp_removed_array_mag;
|
||||
{player addWeapon _x;} count _temp_removed_array_wep;
|
||||
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;
|
||||
} else {
|
||||
format [localize "STR_EPOCH_VEHUP_NO_UPGRADE_FOR_VEHICLE",_upgradeName,_displayname] call dayz_rollingMessages;
|
||||
};
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
localize "str_epoch_player_245" call dayz_rollingMessages;
|
||||
};
|
||||
}
|
||||
else {
|
||||
localize "STR_EPOCH_PLAYER_27" call dayz_rollingMessages;
|
||||
} else {
|
||||
format [localize "STR_CL_LOG_FAIL_PLAYER",_displayname] call dayz_rollingMessages;
|
||||
};
|
||||
|
||||
dayz_actionInProgress = false;
|
||||
|
||||
@@ -53,6 +53,7 @@ if (!isDedicated) then {
|
||||
dayz_bleedingeffect = 2; //1 = blood on the ground (negatively impacts FPS), 2 = partical effect, 3 = both
|
||||
dayz_temperature_override = true; // Set to true to disable all temperature changes.
|
||||
dayz_nutritionValuesSystem = false; //true, Enables nutrition system, false, disables nutrition system.
|
||||
DZE_DisableVehicleUpgrade = []; // List of vehicles that cannot be upgraded with manuals E.g.: ["ArmoredSUV_PMC_DZE","LandRover_CZ_EP1_DZE"]
|
||||
|
||||
// Build restrictions
|
||||
DZE_NoBuildNear = []; //Array of object class names that are blacklisted to build near. i.e ["Land_Mil_ControlTower","Land_SS_hangar"] etc.
|
||||
|
||||
@@ -13607,8 +13607,8 @@
|
||||
<Russian>100п. ПК лента</Russian>
|
||||
</Key>
|
||||
<Key ID="STR_DZ_MAG_10RND_762x54_SVD_NAME">
|
||||
<English>10Rnd. SVD mag.</English>
|
||||
<Russian>10п. СВД маг.</Russian>
|
||||
<English>10Rnd. SVD/SVU mag.</English>
|
||||
<Russian>10п. СВД/СВУ маг.</Russian>
|
||||
</Key>
|
||||
|
||||
<Key ID="STR_DZ_MAG_BOLT_TRQ_NAME">
|
||||
@@ -15105,6 +15105,17 @@
|
||||
<German>Typ: Leuchtgeschoss <br/>Schuss: 1 <br/>Verwendet in: GP-25 Granatwerfer</German>
|
||||
<Czech>Typ: světlice <br/>Nábojů: 1 <br/>Pro: granátomet GP-25</Czech>
|
||||
</Key>
|
||||
<Key ID="STR_DZ_MAG_10RND_SVD_DESC">
|
||||
<English>Caliber: 7.62x54mm<br/>Rounds: 10<br/>Used in: SVD, SVU</English>
|
||||
<French>Calibre: 7.62x54mm<br/>Munitions : 10<br/>Utilisé avec: SVD, SVU</French>
|
||||
<Spanish>Calibre: 7.62x54mm<br/>Cartuchos: 10<br/>Usado en: SVD, SVU</Spanish>
|
||||
<Italian>Calibro: 7.62x54mm<br/>Munizioni: 10<br/>Usato in: SVD, SVU</Italian>
|
||||
<Polish>Kaliber: 7.62x54mm<br/>Naboje: 10<br/>Uzywany w: SVD, SVU</Polish>
|
||||
<Russian>Патрон: 7.62x54mm <br/>Количество: 10<br/>Исп. в: SVD, SVU</Russian>
|
||||
<German>Kaliber: 7.62x54mm<br/>Patronen: 10<br/>Verwendet in: SVD, SVU</German>
|
||||
<Czech>Kalibr: 7.62x54mm<br/>Nábojů: 10<br/>Pro: SVD, SVU</Czech>
|
||||
<Hungarian>Kaliber: 7.62x54mm<br/> Töltények: 10<br/> Hozzá tartozó fegyver: SVD, SVU</Hungarian>
|
||||
</Key>
|
||||
|
||||
<!-- **** Vehicle Ammo **** -->
|
||||
|
||||
@@ -15221,7 +15232,7 @@
|
||||
<German>Kaliber: 7.62x54mm<br/>Patronen: 200<br/>Verwendet in: PKT</German>
|
||||
<Czech>Kalibr: 7.62x54mm<br/>Nábojů: 200<br/>Pro: PKT</Czech>
|
||||
<Hungarian>Kaliber: 7.62x54mm<br/> Töltények: 200<br/> Hozzá tartozó fegyver: PKT</Hungarian>
|
||||
</Key>
|
||||
</Key>
|
||||
<Key ID="STR_DZ_MAG_29RND_AGS30_NAME">
|
||||
<English>29Rnd. AGS-30</English>
|
||||
<Russian>29п. AGS-30</Russian>
|
||||
@@ -25926,6 +25937,18 @@
|
||||
<English>Cooking tripod</English>
|
||||
<German>Schwenkgrill</German>
|
||||
</Key>
|
||||
<Key ID="STR_EPOCH_VEHUP_DISTANCE_TOO_FAR">
|
||||
<English>You are too far away to upgrade %1!</English>
|
||||
<German>Du bist zu weit entfernt, um %1 abzugraden!</German>
|
||||
</Key>
|
||||
<Key ID="STR_EPOCH_VEHUP_NO_UPGRADE_FOR_VEHICLE">
|
||||
<English>There is no %1 upgrade for %2 available!</English>
|
||||
<German>Es ist kein %1 Upgrade für %2 verfügbar!</German>
|
||||
</Key>
|
||||
<Key ID="STR_EPOCH_VEHUP_NOT_ALLOWED">
|
||||
<English>The vehicle upgrade for %1 got disabled on this server!</English>
|
||||
<German>Das Fahrzeug-Upgrade für %1 wurde auf diesem Server deaktiviert!</German>
|
||||
</Key>
|
||||
|
||||
<!--Fix for missing strings from the buildings3.pbo, this is just a placeholder-->
|
||||
<Key ID="STR_FAL_Street_Sign">
|
||||
|
||||
Reference in New Issue
Block a user