diff --git a/Sources/epoch_code/compile/EPOCH_consumeItem.sqf b/Sources/epoch_code/compile/EPOCH_consumeItem.sqf index d720dd8b..e65e3103 100644 --- a/Sources/epoch_code/compile/EPOCH_consumeItem.sqf +++ b/Sources/epoch_code/compile/EPOCH_consumeItem.sqf @@ -229,9 +229,9 @@ switch _interactOption do { _newDMG = ((_highestDMG - 0.5) max 0); if (local _vehicle) then { - [_vehicle, [_currentHIT, _newDMG]] call EPOCH_client_repairVehicle; + [_vehicle, [[_currentHIT, _newDMG]]] call EPOCH_client_repairVehicle; } else { - [_vehicle,[_currentHIT,_newDMG],player,Epoch_personalToken] remoteExec ["EPOCH_server_repairVehicle",2]; + [_vehicle,[[_currentHIT,_newDMG]],player,Epoch_personalToken] remoteExec ["EPOCH_server_repairVehicle",2]; }; } else { diff --git a/Sources/epoch_code/compile/functions/EPOCH_fnc_playerFired.sqf b/Sources/epoch_code/compile/functions/EPOCH_fnc_playerFired.sqf index 0285320a..d33239dc 100644 --- a/Sources/epoch_code/compile/functions/EPOCH_fnc_playerFired.sqf +++ b/Sources/epoch_code/compile/functions/EPOCH_fnc_playerFired.sqf @@ -60,6 +60,13 @@ switch true do { _currentDMG = 0; { _currentDMG = _x; + if (EPOCH_AdvancedVehicleRepair_Enabled) then { + if (_cursorTarget iskindof "Landvehicle" || _cursorTarget iskindof "SHIP" || _cursorTarget iskindof "AIR" || _cursorTarget iskindof "TANK") then { + if (_currentDMG > 0.9) then { + _currentDMG = 0; + }; + }; + }; if (_currentDMG > _highestDMG) then{ _highestDMG = _currentDMG; _currentHIT = _forEachIndex; @@ -68,9 +75,9 @@ switch true do { if (_highestDMG > 0) then { _newDMG = ((_highestDMG - 0.5) max 0); if (local _cursorTarget) then { - [_cursorTarget,[_currentHIT,_newDMG]] call EPOCH_client_repairVehicle; + [_cursorTarget,[[_currentHIT,_newDMG]]] call EPOCH_client_repairVehicle; } else { - [_cursorTarget,[_currentHIT,_newDMG],player,Epoch_personalToken] remoteExec ["EPOCH_server_repairVehicle",2]; + [_cursorTarget,[[_currentHIT,_newDMG]],player,Epoch_personalToken] remoteExec ["EPOCH_server_repairVehicle",2]; }; } else { if ((damage _cursorTarget) > 0) then { diff --git a/Sources/epoch_code/compile/inventory/EPOCH_itemInteractClick.sqf b/Sources/epoch_code/compile/inventory/EPOCH_itemInteractClick.sqf index c76f0fd2..f0131717 100644 --- a/Sources/epoch_code/compile/inventory/EPOCH_itemInteractClick.sqf +++ b/Sources/epoch_code/compile/inventory/EPOCH_itemInteractClick.sqf @@ -3,7 +3,7 @@ By Aaron Clark - Epoch Mod */ //[[[cog import generate_private_arrays ]]] -private ["_activeControl","_bg","_btn_arr","_buffer","_buttonTXT","_button_gen","_button_texts","_cfgItemInteractions","_config","_control","_data","_display","_interactActions","_interactOption","_magCount","_pos","_start_idc","_type","_y2d"]; +private ["_CfgEpochClient","_Suppressed","_activeControl","_bg","_btn_arr","_buffer","_buttonTXT","_button_gen","_button_texts","_cfgItemInteractions","_config","_control","_data","_display","_interactActions","_interactOption","_magCount","_pos","_start_idc","_type","_y2d"]; //[[[end]]] _button_texts = []; @@ -21,6 +21,8 @@ _buttonTXT = ""; _magCount = 1; _interactActions = []; _config = (configfile >> "CfgWeapons" >> _data); +_CfgEpochClient = 'CfgEpochClient' call EPOCH_returnConfig; +_Suppressed = getarray (_CfgEpochClient >> "SuppressedCraftingItems"); // _cfgItemInteractions = (('CfgItemInteractions' call EPOCH_returnConfig) >> _data); _cfgItemInteractions = ["CfgItemInteractions", _data] call EPOCH_returnConfigV2; if (isClass (_config)) then { @@ -29,6 +31,7 @@ if (isClass (_config)) then { _buttonTXT = getText(_cfgItemInteractions >> "interactText"); _interactActions = getArray(_cfgItemInteractions >> "interactActions"); } else { + if (EPOCH_AdvancedVehicleRepair_Enabled && _data in ["VehicleRepair","VehicleRepairLg"]) exitwith {}; _config = (configfile >> "CfgMagazines" >> _data); _type = getNumber (_config >> "type"); _interactOption = getNumber (_cfgItemInteractions >> "interactAction"); @@ -53,11 +56,12 @@ if (_magCount > 1) then { }; _config = 'CfgCrafting' call EPOCH_returnConfig; -if (isClass (_config >> _data)) then { - EPOCH_CraftingItem = EPOCH_InteractedItem select 0; - _button_texts pushBack ["CRAFT","EPOCH_CraftingItem call EPOCH_crafting_load;"]; -} else { - EPOCH_CraftingItem = ""; +if (isClass (_config >> _data) && !(_data in _Suppressed)) then { + EPOCH_CraftingItem = EPOCH_InteractedItem select 0; + _button_texts pushBack ["CRAFT","EPOCH_CraftingItem call EPOCH_crafting_load;"]; +} +else { + EPOCH_CraftingItem = ""; }; _config = 'CfgVehicleUpgrades' call EPOCH_returnConfig; diff --git a/Sources/epoch_code/compile/vehicles/EPOCH_client_VehicleMaintananceCheck.sqf b/Sources/epoch_code/compile/vehicles/EPOCH_client_VehicleMaintananceCheck.sqf new file mode 100644 index 00000000..bfa632a7 --- /dev/null +++ b/Sources/epoch_code/compile/vehicles/EPOCH_client_VehicleMaintananceCheck.sqf @@ -0,0 +1,88 @@ +/* + Author: He-Man - Ignatz-Gaming + + Contributors: + + Description: + Check for repairable / replaceable and removeable Vehicle-parts + + Licence: + Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike + + Github: + https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/compile/vehicles/EPOCH_client_VehicleMaintananceCheck.sqf +*/ +private ["_veh","_config","_VehicleRepairs","_repairs","_removes","_replaces","_wheels","_wheelcounter","_torepair","_HitPointName","_Hit","_wheel","_repairarrays"]; +_veh = _this; +_config = 'CfgEpochClient' call EPOCH_returnConfig; +_VehicleRepairs = getArray (_config >> "VehicleRepairs"); +_repairs = []; +_removes = []; +_replaces = []; +_wheels = getnumber (configfile >> "cfgvehicles" >> (typeof _veh) >> "numberPhysicalWheels"); +if (_veh iskindof "ebike_epoch") then { + _wheels = 2; +}; +_wheelcounter = 0; +_torepair = (getAllHitPointsDamage _veh) select 0; +{ + _HitPointName = _x; + _Hit = (getAllHitPointsDamage _veh) select 2 select _foreachindex; + { + _x params ["_searchedhit","_limit1","_limit2"]; + if (_searchedhit isequalto _HitPointName) then { + _wheel = ["wheel",tolower _searchedhit] call bis_fnc_instring; + if (_wheel) then { + _wheelcounter = _wheelcounter + 1; + }; + if (_wheel && _wheelcounter > _wheels) exitwith {}; + if (_Hit >= _limit2) exitwith { + _replaces pushback _searchedhit; + }; + if (_Hit >= _limit1) exitwith { + _repairs pushback _searchedhit; + }; + if !((_veh getvariable ["vehicle_slot","-1"]) isequalto "-1") then { + if (_searchedhit in ["HitLFWheel","HitLF2Wheel","HitLMWheel","HitLBWheel","HitRFWheel","HitRF2Wheel","HitRMWheel","HitRBWheel","HitEngine"]) then { + _removes pushback _searchedhit; + }; + }; + } + else { + if (_searchedhit isequalto "glass") then { + if ("glass" in _repairs) exitwith {}; + _glass = ["glass",tolower _HitPointName] call bis_fnc_instring; + if (_glass) then { + if (_Hit >= _limit1) exitwith { + _repairs pushback _searchedhit; + }; + }; + }; + }; + } foreach _VehicleRepairs; +} foreach ((getAllHitPointsDamage _veh) select 0); + +{ + if (_x in _repairs || _x in _replaces) then { + _torepair = _torepair - [_x]; + } + else { + if (["glass",tolower _x] call Bis_fnc_instring) then { + _torepair = _torepair - [_x]; + }; + }; +} foreach ((getAllHitPointsDamage _veh) select 0); + +if !(_torepair isequalto []) then { + _repairarrays = []; + { + _repairarrays pushback [_x,0]; + } foreach _torepair; + if (local _veh) then { + [_veh, _repairarrays] call EPOCH_client_repairVehicle; + } else { + [_veh,_repairarrays,player,Epoch_personalToken] remoteExec ["EPOCH_server_repairVehicle",2]; + }; +}; + +EPOCH_VehicleRepairs = [_repairs,_removes,_replaces]; \ No newline at end of file diff --git a/Sources/epoch_code/compile/vehicles/EPOCH_client_VehicleMaintananceDo.sqf b/Sources/epoch_code/compile/vehicles/EPOCH_client_VehicleMaintananceDo.sqf new file mode 100644 index 00000000..0ab737b4 --- /dev/null +++ b/Sources/epoch_code/compile/vehicles/EPOCH_client_VehicleMaintananceDo.sqf @@ -0,0 +1,132 @@ +/* + Author: He-Man - Ignatz-Gaming + + Contributors: + + Description: + Repair / replac and remove Vehicle-parts + + Licence: + Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike + + Github: + https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/compile/vehicles/EPOCH_client_VehicleMaintananceDo.sqf +*/ +private ["_secondlocalcheck","_repairarrays","_config","_VehicleRepairs","_reqiredMat","_searchname","_line","_returnmat"]; +params ["_veh","_do","_hitpointname"]; +_secondlocalcheck = false; +_returnmat = ""; +_repairarrays = []; +_config = 'CfgEpochClient' call EPOCH_returnConfig; +_VehicleRepairs = getArray (_config >> "VehicleRepairs"); +if (isnull _veh) exitwith { + ['Error - No Vehicle found',5] call Epoch_message; +}; +if !(alive _veh) exitwith { + ['Error - Vehicle already dead',5] call Epoch_message; +}; + +if (EPOCH_Vehicle_MaintainLock) exitwith {}; +EPOCH_Vehicle_MaintainLock = true; + +switch _do do { + case 'repair': { + _reqiredMat = ""; + _searchname = _hitpointname; + if (["glass",tolower _hitpointname] call Bis_fnc_instring) then { + _searchname = "glass"; + }; + { + _x params ["_name","","","_repairmat"]; + if (_searchname isequalto _name) exitwith { + _reqiredMat = _repairmat; + }; + } foreach _VehicleRepairs; + if (_reqiredMat isequalto "") exitwith { + ['Error - Can not find required Material',5] call Epoch_message; + }; + if !(_reqiredMat in (magazines player)) exitwith { + _line = format ['You need %1 to repair',_reqiredMat call EPOCH_itemDisplayName]; + [_line,5] call Epoch_message; + }; + player removemagazine _reqiredMat; + if (_hitpointname isequalto "glass") then { + { + if (["glass",tolower _x] call Bis_fnc_instring) then { + _repairarrays pushback [_x,0]; + }; + } foreach ((getAllHitPointsDamage _veh) select 0); + } + else { + _repairarrays pushback [_hitpointname,0]; + }; + }; + case 'replace': { + _reqiredMat = ""; + _searchname = _hitpointname; + if (["glass",tolower _hitpointname] call Bis_fnc_instring) then { + _searchname = "glass"; + }; + { + _x params ["_name","","","","_replacemat"]; + if (_searchname isequalto _name) exitwith { + _reqiredMat = _replacemat; + }; + } foreach _VehicleRepairs; + if (_reqiredMat isequalto "") exitwith { + ['Error - Can not find required Material',5] call Epoch_message; + }; + if !(_reqiredMat in (magazines player)) exitwith { + _line = format ['You need %1 to repair',_reqiredMat call EPOCH_itemDisplayName]; + [_line,5] call Epoch_message; + }; + player removemagazine _reqiredMat; + if (_hitpointname isequalto "glass") then { + { + if (["glass",tolower _x] call Bis_fnc_instring) then { + _repairarrays pushback [_x,0]; + }; + } foreach ((getAllHitPointsDamage _veh) select 0); + } + else { + _repairarrays pushback [_hitpointname,0]; + }; + }; + case 'remove': { + if !(local _veh) exitwith { + _line = 'Error - Go in as Driver first!'; + ['Error - Go in as Driver first!',5] call Epoch_message; + }; + _searchname = _hitpointname; + { + _x params ["_name","","","","_replacemat"]; + if (_searchname isequalto _name) exitwith { + _returnmat = _replacemat; + }; + } foreach _VehicleRepairs; + if (_returnmat isequalto "") exitwith { + ['Error - Could not find Return Material!',5] call Epoch_message; + }; + _repairarrays pushback [_hitpointname,1]; + }; +}; + +if !(_repairarrays isequalto []) then { + player playMove 'AinvPknlMstpSnonWrflDnon_medic0'; + player playMove 'AinvPknlMstpSnonWrflDnon_medicEnd'; + uisleep 5; + if (_secondlocalcheck && !local _veh) exitwith { + ['Error - Go in as Driver first!',5] call Epoch_message; + }; + if !(_returnmat isequalto "") then { + _returnmat call EPOCH_fnc_addItemOverflow; + }; + + if (local _veh) then { + [_veh, _repairarrays] call EPOCH_client_repairVehicle; + } else { + [_veh,_repairarrays,player,Epoch_personalToken] remoteExec ["EPOCH_server_repairVehicle",2]; + }; +}; + +EPOCH_Vehicle_MaintainLock = false; \ No newline at end of file diff --git a/Sources/epoch_code/compile/vehicles/EPOCH_client_repairVehicle.sqf b/Sources/epoch_code/compile/vehicles/EPOCH_client_repairVehicle.sqf index 38961c07..4bc76d5c 100644 --- a/Sources/epoch_code/compile/vehicles/EPOCH_client_repairVehicle.sqf +++ b/Sources/epoch_code/compile/vehicles/EPOCH_client_repairVehicle.sqf @@ -17,6 +17,26 @@ private ["_currentDMG"]; //[[[end]]] params ["_vehicle","_value"]; if (local _vehicle) then { - _currentDMG = _vehicle getHitIndex (_value select 0); - _vehicle setHitIndex[_value select 0, (_currentDMG - 0.5) max 0]; + { + if ((_x select 0) isequaltype 0) then { +// _currentDMG = _vehicle getHitIndex (_x select 0); +// _vehicle setHitIndex [_x select 0, (_currentDMG - 0.5) max 0]; + _vehicle setHitIndex [_x select 0, _x select 1]; + } + else { +// _currentDMG = _vehicle getHitPointDamage (_x select 0); +// _vehicle setHitPointDamage [_x select 0, (_currentDMG - 0.5) max 0]; + _vehicle setHitPointDamage [_x select 0, _x select 1]; + }; + } foreach _value; + + if !({_x > 0} count ((getAllHitPointsDamage _vehicle) select 2) > 0) then { + [_vehicle,["ALL",0],player,Epoch_personalToken] remoteExec ["EPOCH_server_repairVehicle",2]; + }; + + _vehicle call EPOCH_interact; + if !(EPOCH_arr_interactedObjs isEqualTo[]) then { + [EPOCH_arr_interactedObjs] remoteExec['EPOCH_server_save_vehicles', 2]; + EPOCH_arr_interactedObjs = []; + }; }; diff --git a/Sources/epoch_code/customs/Remove_Engine.paa b/Sources/epoch_code/customs/Remove_Engine.paa new file mode 100644 index 00000000..24738eba Binary files /dev/null and b/Sources/epoch_code/customs/Remove_Engine.paa differ diff --git a/Sources/epoch_code/customs/Remove_Wheel.paa b/Sources/epoch_code/customs/Remove_Wheel.paa new file mode 100644 index 00000000..7196999a Binary files /dev/null and b/Sources/epoch_code/customs/Remove_Wheel.paa differ diff --git a/Sources/epoch_code/customs/Repair_Avionics.paa b/Sources/epoch_code/customs/Repair_Avionics.paa new file mode 100644 index 00000000..9d40d122 Binary files /dev/null and b/Sources/epoch_code/customs/Repair_Avionics.paa differ diff --git a/Sources/epoch_code/customs/Repair_Engine.paa b/Sources/epoch_code/customs/Repair_Engine.paa new file mode 100644 index 00000000..445ad437 Binary files /dev/null and b/Sources/epoch_code/customs/Repair_Engine.paa differ diff --git a/Sources/epoch_code/customs/Repair_Fuel.paa b/Sources/epoch_code/customs/Repair_Fuel.paa new file mode 100644 index 00000000..c5115219 Binary files /dev/null and b/Sources/epoch_code/customs/Repair_Fuel.paa differ diff --git a/Sources/epoch_code/customs/Repair_HullBody.paa b/Sources/epoch_code/customs/Repair_HullBody.paa new file mode 100644 index 00000000..6201f10e Binary files /dev/null and b/Sources/epoch_code/customs/Repair_HullBody.paa differ diff --git a/Sources/epoch_code/customs/Repair_MainRotor.paa b/Sources/epoch_code/customs/Repair_MainRotor.paa new file mode 100644 index 00000000..2cb6d888 Binary files /dev/null and b/Sources/epoch_code/customs/Repair_MainRotor.paa differ diff --git a/Sources/epoch_code/customs/Repair_TailRotor.paa b/Sources/epoch_code/customs/Repair_TailRotor.paa new file mode 100644 index 00000000..f2aea93b Binary files /dev/null and b/Sources/epoch_code/customs/Repair_TailRotor.paa differ diff --git a/Sources/epoch_code/customs/Repair_Wheel.paa b/Sources/epoch_code/customs/Repair_Wheel.paa new file mode 100644 index 00000000..9be2cee1 Binary files /dev/null and b/Sources/epoch_code/customs/Repair_Wheel.paa differ diff --git a/Sources/epoch_code/customs/Replace_Engine.paa b/Sources/epoch_code/customs/Replace_Engine.paa new file mode 100644 index 00000000..64f87f90 Binary files /dev/null and b/Sources/epoch_code/customs/Replace_Engine.paa differ diff --git a/Sources/epoch_code/customs/Replace_Glass.paa b/Sources/epoch_code/customs/Replace_Glass.paa new file mode 100644 index 00000000..b1c0345c Binary files /dev/null and b/Sources/epoch_code/customs/Replace_Glass.paa differ diff --git a/Sources/epoch_code/customs/Replace_HullBody.paa b/Sources/epoch_code/customs/Replace_HullBody.paa new file mode 100644 index 00000000..a4f48f4d Binary files /dev/null and b/Sources/epoch_code/customs/Replace_HullBody.paa differ diff --git a/Sources/epoch_code/customs/Replace_MainRotor.paa b/Sources/epoch_code/customs/Replace_MainRotor.paa new file mode 100644 index 00000000..739fa5ce Binary files /dev/null and b/Sources/epoch_code/customs/Replace_MainRotor.paa differ diff --git a/Sources/epoch_code/customs/Replace_SLG.paa b/Sources/epoch_code/customs/Replace_SLG.paa new file mode 100644 index 00000000..7d85afd1 Binary files /dev/null and b/Sources/epoch_code/customs/Replace_SLG.paa differ diff --git a/Sources/epoch_code/customs/Replace_TailRotor.paa b/Sources/epoch_code/customs/Replace_TailRotor.paa new file mode 100644 index 00000000..2709fae0 Binary files /dev/null and b/Sources/epoch_code/customs/Replace_TailRotor.paa differ diff --git a/Sources/epoch_code/customs/Replace_Wheel.paa b/Sources/epoch_code/customs/Replace_Wheel.paa new file mode 100644 index 00000000..0a7aebe7 Binary files /dev/null and b/Sources/epoch_code/customs/Replace_Wheel.paa differ diff --git a/Sources/epoch_code/gui/scripts/craftingv2/EPOCH_crafting_getConfig.sqf b/Sources/epoch_code/gui/scripts/craftingv2/EPOCH_crafting_getConfig.sqf index 4e95bdac..1d0d561f 100644 --- a/Sources/epoch_code/gui/scripts/craftingv2/EPOCH_crafting_getConfig.sqf +++ b/Sources/epoch_code/gui/scripts/craftingv2/EPOCH_crafting_getConfig.sqf @@ -14,10 +14,13 @@ https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/gui/scripts/craftingv2/EPOCH_crafting_getConfig.sqf */ //[[[cog import generate_private_arrays ]]] -private ["_arr","_arrIn","_cCTime","_cDescFull","_cDescShort","_cDisplayName","_cModel","_cName","_cNearbyArr","_cPicture","_cPreviewArr","_cPreviewScale","_cPreviewVector","_cPriority","_cRecipeArr","_cType","_cUsedInArr","_out","_type0","_type1","_type2","_type3"]; +private ["_cfg","_Suppressed","_arr","_arrIn","_cCTime","_cDescFull","_cDescShort","_cDisplayName","_cModel","_cName","_cNearbyArr","_cPicture","_cPreviewArr","_cPreviewScale","_cPreviewVector","_cPriority","_cRecipeArr","_cType","_cUsedInArr","_out","_type0","_type1","_type2","_type3"]; //[[[end]]] _arrIn = _this; +_cfg = 'CfgEpochClient' call EPOCH_returnConfig; +_Suppressed = getarray (_cfg >> "SuppressedCraftingItems"); + if !(typeName (_arrIn select 0) isEqualTo "CONFIG") exitWith {[]}; _type0 = []; _type1 = []; _type2 = []; _type3 = []; _out = []; @@ -43,6 +46,31 @@ _type0 = []; _type1 = []; _type2 = []; _type3 = []; _out = []; _cPreviewVector = getNumber (_x >> "previewVector"); _cDescFull = getText (_x >> "descriptionFull"); _cType = getNumber (_x >> "type"); + + if !(_Suppressed isequalto []) then { + if (_cName in _Suppressed) then { + _cPriority = -1; + }; + _tmp = _cRecipeArr; + { + if (_x isequaltype []) then { + if ((_x select 0) in _Suppressed) then { + _cRecipeArr = _cRecipeArr - [_x]; + }; + } + else { + if (_x in _Suppressed) then { + _cRecipeArr = _cRecipeArr - [_x]; + }; + }; + } foreach _tmp; + + { + if (_x in _cUsedInArr) then { + _cUsedInArr = _cUsedInArr - [_x]; + }; + } foreach _Suppressed; + }; switch (_cPriority) do { case 0: {_type0 pushBack [_cName,_cDisplayName,_cPicture,_cDescShort,_cModel,_cPriority,_cCTime,_cRecipeArr,_cNearbyArr,_cUsedInArr,_cPreviewArr,_cPreviewScale,_cPreviewVector,_cType,_cDescFull]}; diff --git a/Sources/epoch_code/init/both_init.sqf b/Sources/epoch_code/init/both_init.sqf index eb530b3e..16bc56c8 100644 --- a/Sources/epoch_code/init/both_init.sqf +++ b/Sources/epoch_code/init/both_init.sqf @@ -36,6 +36,13 @@ if (["CfgEpochClient", "madArmaEnabled", true] call EPOCH_fnc_returnConfigEntryV EPOCH_mod_madArma_Enabled = false; }; +// Check if Advanced Vehicle Repair is enabled +if (["CfgEpochClient", "UseAdvancedVehicleRepair", true] call EPOCH_fnc_returnConfigEntryV2) then { + EPOCH_AdvancedVehicleRepair_Enabled = true; + diag_log "Epoch: Advanced Vehicle Repair Enabled"; +} else { + EPOCH_AdvancedVehicleRepair_Enabled = false; +}; // Init Custom vars EPOCH_customVars = []; diff --git a/Sources/epoch_code/init/client_init.sqf b/Sources/epoch_code/init/client_init.sqf index 88f9b1a9..afca0141 100644 --- a/Sources/epoch_code/init/client_init.sqf +++ b/Sources/epoch_code/init/client_init.sqf @@ -12,6 +12,7 @@ Github: https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/init/client_init.sqf */ +EPOCH_Vehicle_MaintainLock = false; EPOCH_CraftingItem = ""; EPOCH_ESP_TARGETS = []; EPOCH_ESPMAP_TARGETS = []; diff --git a/Sources/epoch_config/Configs/CfgActionMenu/CfgActionMenu_target.hpp b/Sources/epoch_config/Configs/CfgActionMenu/CfgActionMenu_target.hpp index e1b6c827..b73b255f 100644 --- a/Sources/epoch_config/Configs/CfgActionMenu/CfgActionMenu_target.hpp +++ b/Sources/epoch_config/Configs/CfgActionMenu/CfgActionMenu_target.hpp @@ -160,3 +160,305 @@ class pack_safe icon = "x\addons\a3_epoch_code\Data\UI\buttons\build_pack.paa"; tooltip = "Pack Safe"; }; + +class VehMaintanance +{ + condition = "dyna_isVehicle && !EPOCH_Vehicle_MaintainLock && EPOCH_AdvancedVehicleRepair_Enabled"; + action = "dyna_cursorTarget call EPOCH_client_VehicleMaintananceCheck;"; + icon = "x\addons\a3_epoch_code\Data\UI\buttons\Repair_man.paa"; + tooltip = "Vehicle Maintanance"; + class Repair + { + condition = "!((EPOCH_VehicleRepairs select 0) isequalto []) || !((EPOCH_VehicleRepairs select 2) isequalto [])"; + action = ""; + icon = "epoch_code\customs\Repair_Wheel.paa"; + tooltip = "Repair Vehicle"; + class RepairHull + { + condition = "'HitHull' in (EPOCH_VehicleRepairs select 0)"; + action = "[dyna_cursorTarget,'repair','HitHull'] spawn EPOCH_client_VehicleMaintananceDo"; + icon = "epoch_code\customs\Repair_HullBody.paa"; + tooltip = "Repair Hull"; + }; + class ReplaceHull + { + condition = "'HitHull' in (EPOCH_VehicleRepairs select 2)"; + action = "[dyna_cursorTarget,'replace','HitHull'] spawn EPOCH_client_VehicleMaintananceDo"; + icon = "epoch_code\customs\Replace_HullBody.paa"; + tooltip = "Repair Hull"; + }; + class RepairEngine + { + condition = "'HitEngine' in (EPOCH_VehicleRepairs select 0)"; + action = "[dyna_cursorTarget,'repair','HitEngine'] spawn EPOCH_client_VehicleMaintananceDo"; + icon = "epoch_code\customs\Repair_Engine.paa"; + tooltip = "Repair Engine"; + }; + class ReplaceEngine + { + condition = "'HitEngine' in (EPOCH_VehicleRepairs select 2)"; + action = "[dyna_cursorTarget,'replace','HitEngine'] spawn EPOCH_client_VehicleMaintananceDo"; + icon = "epoch_code\customs\Replace_Engine.paa"; + tooltip = "Replace Engine"; + }; + class ReplaceGlass + { + condition = "'glass' in (EPOCH_VehicleRepairs select 0) || 'glass' in (EPOCH_VehicleRepairs select 2)"; + action = "[dyna_cursorTarget,'replace','glass'] spawn EPOCH_client_VehicleMaintananceDo"; + icon = "epoch_code\customs\Replace_Glass.paa"; + tooltip = "Replace Glass"; + }; + class RepairBody + { + condition = "'HitBody' in (EPOCH_VehicleRepairs select 0)"; + action = "[dyna_cursorTarget,'repair','HitBody'] spawn EPOCH_client_VehicleMaintananceDo"; + icon = "epoch_code\customs\Repair_HullBody.paa"; + tooltip = "Repair Body"; + }; + class ReplaceBody + { + condition = "'HitBody' in (EPOCH_VehicleRepairs select 2)"; + action = "[dyna_cursorTarget,'replace','HitBody'] spawn EPOCH_client_VehicleMaintananceDo"; + icon = "epoch_code\customs\Replace_HullBody.paa"; + tooltip = "Repair Body"; + }; + class RepairFuel + { + condition = "'HitFuel' in (EPOCH_VehicleRepairs select 0)"; + action = "[dyna_cursorTarget,'repair','HitFuel'] spawn EPOCH_client_VehicleMaintananceDo"; + icon = "epoch_code\customs\Repair_Fuel.paa"; + tooltip = "Repair Fuel Hose"; + }; + class RepairMainRotor + { + condition = "'HitHRotor' in (EPOCH_VehicleRepairs select 0)"; + action = "[dyna_cursorTarget,'repair','HitHRotor'] spawn EPOCH_client_VehicleMaintananceDo"; + icon = "epoch_code\customs\Repair_MainRotor.paa"; + tooltip = "Repair Main Rotor"; + }; + class ReplaceFuel + { + condition = "'HitFuel' in (EPOCH_VehicleRepairs select 2)"; + action = "[dyna_cursorTarget,'replace','HitFuel'] spawn EPOCH_client_VehicleMaintananceDo"; + icon = "epoch_code\customs\Repair_Fuel.paa"; + tooltip = "Replace Fuel Hose"; + }; + class ReplaceMainRotor + { + condition = "'HitHRotor' in (EPOCH_VehicleRepairs select 2)"; + action = "[dyna_cursorTarget,'replace','HitHRotor'] spawn EPOCH_client_VehicleMaintananceDo"; + icon = "epoch_code\customs\Replace_MainRotor.paa"; + tooltip = "Replace Main Rotor"; + }; + class RepairTailRotor + { + condition = "'HitVRotor' in (EPOCH_VehicleRepairs select 0)"; + action = "[dyna_cursorTarget,'repair','HitVRotor'] spawn EPOCH_client_VehicleMaintananceDo"; + icon = "epoch_code\customs\Repair_TailRotor.paa"; + tooltip = "Repair Tail Rotor"; + }; + class ReplaceTailRotor + { + condition = "'HitVRotor' in (EPOCH_VehicleRepairs select 2)"; + action = "[dyna_cursorTarget,'replace','HitVRotor'] spawn EPOCH_client_VehicleMaintananceDo"; + icon = "epoch_code\customs\Replace_TailRotor.paa"; + tooltip = "Replace Tail Rotor"; + }; + class ReplaceWinch + { + condition = "'HitWinch' in (EPOCH_VehicleRepairs select 0) || 'HitWinch' in (EPOCH_VehicleRepairs select 2)"; + action = "[dyna_cursorTarget,'replace','HitWinch'] spawn EPOCH_client_VehicleMaintananceDo"; + icon = "epoch_code\customs\Replace_SLG.paa"; + tooltip = "Replace Winch"; + }; + class RepairTire1 + { + condition = "'HitLFWheel' in (EPOCH_VehicleRepairs select 0)"; + action = "[dyna_cursorTarget,'repair','HitLFWheel'] spawn EPOCH_client_VehicleMaintananceDo"; + icon = "epoch_code\customs\Repair_Wheel.paa"; + tooltip = "Repair 1st Left Wheel"; + }; + class RepairTire2 + { + condition = "'HitLF2Wheel' in (EPOCH_VehicleRepairs select 0)"; + action = "[dyna_cursorTarget,'repair','HitLF2Wheel'] spawn EPOCH_client_VehicleMaintananceDo"; + icon = "epoch_code\customs\Repair_Wheel.paa"; + tooltip = "Repair 2nd Left Wheel"; + }; + class RepairTire3 + { + condition = "'HitLMWheel' in (EPOCH_VehicleRepairs select 0)"; + action = "[dyna_cursorTarget,'repair','HitLMWheel'] spawn EPOCH_client_VehicleMaintananceDo"; + icon = "epoch_code\customs\Repair_Wheel.paa"; + tooltip = "Repair 3rd Left Wheel"; + }; + class RepairTire4 + { + condition = "'HitLBWheel' in (EPOCH_VehicleRepairs select 0)"; + action = "[dyna_cursorTarget,'repair','HitLBWheel'] spawn EPOCH_client_VehicleMaintananceDo"; + icon = "epoch_code\customs\Repair_Wheel.paa"; + tooltip = "Repair 4th Left Wheel"; + }; + class RepairTire5 + { + condition = "'HitRFWheel' in (EPOCH_VehicleRepairs select 0)"; + action = "[dyna_cursorTarget,'repair','HitRFWheel'] spawn EPOCH_client_VehicleMaintananceDo"; + icon = "epoch_code\customs\Repair_Wheel.paa"; + tooltip = "Repair 1st Right Wheel"; + }; + class RepairTire6 + { + condition = "'HitRF2Wheel' in (EPOCH_VehicleRepairs select 0)"; + action = "[dyna_cursorTarget,'repair','HitRF2Wheel'] spawn EPOCH_client_VehicleMaintananceDo"; + icon = "epoch_code\customs\Repair_Wheel.paa"; + tooltip = "Repair 2nd Right Wheel"; + }; + class RepairTire7 + { + condition = "'HitRMWheel' in (EPOCH_VehicleRepairs select 0)"; + action = "[dyna_cursorTarget,'repair','HitRMWheel'] spawn EPOCH_client_VehicleMaintananceDo"; + icon = "epoch_code\customs\Repair_Wheel.paa"; + tooltip = "Repair 3rd Right Wheel"; + }; + class RepairTire8 + { + condition = "'HitRBWheel' in (EPOCH_VehicleRepairs select 0)"; + action = "[dyna_cursorTarget,'repair','HitRBWheel'] spawn EPOCH_client_VehicleMaintananceDo"; + icon = "epoch_code\customs\Repair_Wheel.paa"; + tooltip = "Repair 4th Right Wheel"; + }; + class ReplaceTire1 + { + condition = "'HitLFWheel' in (EPOCH_VehicleRepairs select 2)"; + action = "[dyna_cursorTarget,'replace','HitLFWheel'] spawn EPOCH_client_VehicleMaintananceDo"; + icon = "epoch_code\customs\Replace_Wheel.paa"; + tooltip = "Replace 1st Left Wheel"; + }; + class ReplaceTire2 + { + condition = "'HitLF2Wheel' in (EPOCH_VehicleRepairs select 2)"; + action = "[dyna_cursorTarget,'replace','HitLF2Wheel'] spawn EPOCH_client_VehicleMaintananceDo"; + icon = "epoch_code\customs\Replace_Wheel.paa"; + tooltip = "Replace 2nd Left Wheel"; + }; + class ReplaceTire3 + { + condition = "'HitLMWheel' in (EPOCH_VehicleRepairs select 2)"; + action = "[dyna_cursorTarget,'replace','HitLMWheel'] spawn EPOCH_client_VehicleMaintananceDo"; + icon = "epoch_code\customs\Replace_Wheel.paa"; + tooltip = "Replace 3rd Left Wheel"; + }; + class ReplaceTire4 + { + condition = "'HitLBWheel' in (EPOCH_VehicleRepairs select 2)"; + action = "[dyna_cursorTarget,'replace','HitLBWheel'] spawn EPOCH_client_VehicleMaintananceDo"; + icon = "epoch_code\customs\Replace_Wheel.paa"; + tooltip = "Replace 4th Left Wheel"; + }; + class ReplaceTire5 + { + condition = "'HitRFWheel' in (EPOCH_VehicleRepairs select 2)"; + action = "[dyna_cursorTarget,'replace','HitRFWheel'] spawn EPOCH_client_VehicleMaintananceDo"; + icon = "epoch_code\customs\Replace_Wheel.paa"; + tooltip = "Replace 1st Right Wheel"; + }; + class ReplaceTire6 + { + condition = "'HitRF2Wheel' in (EPOCH_VehicleRepairs select 2)"; + action = "[dyna_cursorTarget,'replace','HitRF2Wheel'] spawn EPOCH_client_VehicleMaintananceDo"; + icon = "epoch_code\customs\Replace_Wheel.paa"; + tooltip = "Replace 2nd Right Wheel"; + }; + class ReplaceTire7 + { + condition = "'HitRMWheel' in (EPOCH_VehicleRepairs select 2)"; + action = "[dyna_cursorTarget,'replace','HitRMWheel'] spawn EPOCH_client_VehicleMaintananceDo"; + icon = "epoch_code\customs\Replace_Wheel.paa"; + tooltip = "Replace 3rd Right Wheel"; + }; + class ReplaceTire8 + { + condition = "'HitRBWheel' in (EPOCH_VehicleRepairs select 2)"; + action = "[dyna_cursorTarget,'replace','HitRBWheel'] spawn EPOCH_client_VehicleMaintananceDo"; + icon = "epoch_code\customs\Replace_Wheel.paa"; + tooltip = "Replace 4th Right Wheel"; + }; + class RepairAvionics + { + condition = "'HitAvionics' in (EPOCH_VehicleRepairs select 0) || 'HitAvionics' in (EPOCH_VehicleRepairs select 2)"; + action = "[dyna_cursorTarget,'replace','HitAvionics'] spawn EPOCH_client_VehicleMaintananceDo"; + icon = "epoch_code\customs\Repair_Avionics.paa"; + tooltip = "Repair Avionics"; + }; + }; + class Remove + { + condition = "!((EPOCH_VehicleRepairs select 1) isequalto [])"; + action = ""; + icon = "epoch_code\customs\Remove_Wheel.paa"; + tooltip = "Remove Parts"; + class RemoveEngine + { + condition = "'HitEngine' in (EPOCH_VehicleRepairs select 1)"; + action = "[dyna_cursorTarget,'remove','HitEngine'] spawn EPOCH_client_VehicleMaintananceDo"; + icon = "epoch_code\customs\Remove_Engine.paa"; + tooltip = "Remove Engine"; + }; + class RemoveTire1 + { + condition = "'HitLFWheel' in (EPOCH_VehicleRepairs select 1)"; + action = "[dyna_cursorTarget,'remove','HitLFWheel'] spawn EPOCH_client_VehicleMaintananceDo"; + icon = "epoch_code\customs\Remove_Wheel.paa"; + tooltip = "Remove 1st Left Wheel"; + }; + class RemoveTire2 + { + condition = "'HitLF2Wheel' in (EPOCH_VehicleRepairs select 1)"; + action = "[dyna_cursorTarget,'remove','HitLF2Wheel'] spawn EPOCH_client_VehicleMaintananceDo"; + icon = "epoch_code\customs\Remove_Wheel.paa"; + tooltip = "Remove 2nd Left Wheel"; + }; + class RemoveTire3 + { + condition = "'HitLMWheel' in (EPOCH_VehicleRepairs select 1)"; + action = "[dyna_cursorTarget,'remove','HitLMWheel'] spawn EPOCH_client_VehicleMaintananceDo"; + icon = "epoch_code\customs\Remove_Wheel.paa"; + tooltip = "Remove 3rd Left Wheel"; + }; + class RemoveTire4 + { + condition = "'HitLBWheel' in (EPOCH_VehicleRepairs select 1)"; + action = "[dyna_cursorTarget,'remove','HitLBWheel'] spawn EPOCH_client_VehicleMaintananceDo"; + icon = "epoch_code\customs\Remove_Wheel.paa"; + tooltip = "Remove 4th Left Wheel"; + }; + class RemoveTire5 + { + condition = "'HitRFWheel' in (EPOCH_VehicleRepairs select 1)"; + action = "[dyna_cursorTarget,'remove','HitRFWheel'] spawn EPOCH_client_VehicleMaintananceDo"; + icon = "epoch_code\customs\Remove_Wheel.paa"; + tooltip = "Remove 1st Right Wheel"; + }; + class RemoveTire6 + { + condition = "'HitRF2Wheel' in (EPOCH_VehicleRepairs select 1)"; + action = "[dyna_cursorTarget,'remove','HitRF2Wheel'] spawn EPOCH_client_VehicleMaintananceDo"; + icon = "epoch_code\customs\Remove_Wheel.paa"; + tooltip = "Remove 2nd Right Wheel"; + }; + class RemoveTire7 + { + condition = "'HitRMWheel' in (EPOCH_VehicleRepairs select 1)"; + action = "[dyna_cursorTarget,'remove','HitRMWheel'] spawn EPOCH_client_VehicleMaintananceDo"; + icon = "epoch_code\customs\Remove_Wheel.paa"; + tooltip = "Remove 3rd Right Wheel"; + }; + class RemoveTire8 + { + condition = "'HitRBWheel' in (EPOCH_VehicleRepairs select 1)"; + action = "[dyna_cursorTarget,'remove','HitRBWheel'] spawn EPOCH_client_VehicleMaintananceDo"; + icon = "epoch_code\customs\Remove_Wheel.paa"; + tooltip = "Remove 4th Right Wheel"; + }; + }; +}; \ No newline at end of file diff --git a/Sources/epoch_config/Configs/CfgClientFunctions.hpp b/Sources/epoch_config/Configs/CfgClientFunctions.hpp index bcb986e5..f8b60b88 100644 --- a/Sources/epoch_config/Configs/CfgClientFunctions.hpp +++ b/Sources/epoch_config/Configs/CfgClientFunctions.hpp @@ -150,6 +150,8 @@ class CfgClientFunctions class client_fillVehicle {}; class client_gearVehicle {}; class client_upgradeVehicle {}; + class client_VehicleMaintananceCheck {}; + class client_VehicleMaintananceDo {}; }; class missions { diff --git a/Sources/epoch_config/Configs/CfgEpochClient.hpp b/Sources/epoch_config/Configs/CfgEpochClient.hpp index 1fa74020..65f81e3b 100644 --- a/Sources/epoch_config/Configs/CfgEpochClient.hpp +++ b/Sources/epoch_config/Configs/CfgEpochClient.hpp @@ -90,6 +90,29 @@ class CfgEpochClient playerDisableRevenge = 0; playerRevengeMinAliveTime = 900; bankTransferTime[] = {0.0006,1.2,0.06}; + + SuppressedCraftingItems[] = {"VehicleRepair","VehicleRepairLg"}; // Suppresed for usage of "Advanced Vehicle Repair" + UseAdvancedVehicleRepair = "true"; + VehicleRepairs[] = { + {"HitHull",0.33,0.66,"ItemScraps","ItemCorrugated"}, + {"HitBody",0.33,1,"ItemScraps","ItemCorrugated"}, + {"HitLFWheel",0.33,1,"VehicleRepair","SpareTire"}, + {"HitLF2Wheel",0.33,1,"VehicleRepair","SpareTire"}, + {"HitLMWheel",0.33,1,"VehicleRepair","SpareTire"}, + {"HitLBWheel",0.33,1,"VehicleRepair","SpareTire"}, + {"HitRFWheel",0.33,1,"VehicleRepair","SpareTire"}, + {"HitRF2Wheel",0.33,1,"VehicleRepair","SpareTire"}, + {"HitRMWheel",0.33,1,"VehicleRepair","SpareTire"}, + {"HitRBWheel",0.33,1,"VehicleRepair","SpareTire"}, + {"HitEngine",0.33,0.91,"Ignatz_SparkPlug","Ignatz_Engine"}, + {"glass",0.33,1,"Ignatz_Glass","Ignatz_Glass"}, + {"HitFuel",0.1,0.66,"ItemDuctTape","Ignatz_FuelHose"}, + {"HitHRotor",0.33,1,"ItemCorrugated","Ignatz_Rotor_Main"}, + {"HitVRotor",0.33,1,"ItemCorrugated","Ignatz_Rotor_Tail"}, + {"HitWinch",0.33,0.91,"ItemCables","ItemCables"}, + {"HitAvionics",0.33,0.91,"CircuitParts","CircuitParts"} + }; + // include configs #include "CfgEpochClient\Altis.hpp" #include "CfgEpochClient\australia.hpp" diff --git a/Sources/epoch_server/compile/epoch_vehicle/EPOCH_server_repairVehicle.sqf b/Sources/epoch_server/compile/epoch_vehicle/EPOCH_server_repairVehicle.sqf index 92333f80..41949b52 100644 --- a/Sources/epoch_server/compile/epoch_vehicle/EPOCH_server_repairVehicle.sqf +++ b/Sources/epoch_server/compile/epoch_vehicle/EPOCH_server_repairVehicle.sqf @@ -19,11 +19,24 @@ if (_player distance _vehicle > 20) exitWith{}; if ((_value select 0) isEqualTo "ALL") then { _vehicle setDamage (_value select 1); -} else { +} +else { if (local _vehicle) then { - _vehicle setHitIndex _value; + { + if ((_x select 0) isequaltype 0) then { + _vehicle setHitIndex _x; + } + else { + _vehicle setHitPointDamage _x; + }; + } foreach _value; } else { [_vehicle, _value] remoteExec ['EPOCH_client_repairVehicle',_vehicle]; }; }; + +if !({_x > 0} count ((getAllHitPointsDamage _vehicle) select 2) > 0) then { + _vehicle setdamage 0; +}; + _vehicle call EPOCH_server_save_vehicle;