diff --git a/addons/repair/ACE_Settings.hpp b/addons/repair/ACE_Settings.hpp index 3d2685e172..e05002c3f3 100644 --- a/addons/repair/ACE_Settings.hpp +++ b/addons/repair/ACE_Settings.hpp @@ -24,7 +24,7 @@ class ACE_Settings { displayName = CSTRING(repairDamageThreshold_name); description = CSTRING(repairDamageThreshold_description); typeName = "SCALAR"; - value = 0; + value = 0.3; }; class GVAR(repairDamageThreshold_Engineer) { displayName = CSTRING(repairDamageThreshold_Engineer_name); diff --git a/addons/repair/ACE_repair.hpp b/addons/repair/ACE_repair.hpp index 965188a06c..fb0604e49f 100644 --- a/addons/repair/ACE_repair.hpp +++ b/addons/repair/ACE_repair.hpp @@ -8,7 +8,7 @@ class ACE_Repair { requiredEngineer = 0; repairingTime = 5; repairingTimeSelfCoef = 1; - items[] = {}; + items[] = {"ToolKit"}; condition = QUOTE(call FUNC(canReplaceWheel)); itemConsumed = 0; diff --git a/addons/repair/CfgVehicles.hpp b/addons/repair/CfgVehicles.hpp index a69d2cb99f..52d8f0edf8 100644 --- a/addons/repair/CfgVehicles.hpp +++ b/addons/repair/CfgVehicles.hpp @@ -4,8 +4,8 @@ class ACE_MainActions { \ class GVAR(Repair) { \ displayName = CSTRING(Repair); \ - condition = QUOTE([ARR_2(_this select 0, GVAR(engineerSetting_Repair))] call DFUNC(isEngineer)); \ - statement = "'show a hint with the hitpart damage'"; \ + condition = "true"; \ + statement = ""; \ runOnHover = 1; \ showDisabled = 0; \ priority = 2; \ @@ -53,13 +53,13 @@ class CfgVehicles { displayName = CSTRING(repairDamageThreshold_name); description = CSTRING(repairDamageThreshold_description); typeName = "NUMBER"; - defaultValue = 1; + defaultValue = 0.3; }; class repairDamageThreshold_Engineer { displayName = CSTRING(repairDamageThreshold_Engineer_name); description = CSTRING(repairDamageThreshold_Engineer_description); typeName = "NUMBER"; - defaultValue = 1; + defaultValue = 0; }; class consumeItem_ToolKit { displayName = CSTRING(consumeItem_ToolKit_name); diff --git a/addons/repair/config.cpp b/addons/repair/config.cpp index f6298bd354..08ac6ba108 100644 --- a/addons/repair/config.cpp +++ b/addons/repair/config.cpp @@ -19,3 +19,13 @@ class CfgPatches { #include "ACE_Settings.hpp" #include "ACE_repair.hpp" + +class CfgActions { + class None; + class Repair: None { + show = 0; + }; + class RepairVehicle: None { + show = 0; + }; +}; \ No newline at end of file diff --git a/addons/repair/functions/fnc_addRepairActions.sqf b/addons/repair/functions/fnc_addRepairActions.sqf index 0927bf9918..11ac0390cc 100644 --- a/addons/repair/functions/fnc_addRepairActions.sqf +++ b/addons/repair/functions/fnc_addRepairActions.sqf @@ -9,6 +9,7 @@ * NONE */ #include "script_component.hpp" +#define TRACK_HITPOINTS ["HitLTrack", "HitRTrack"] params ["_vehicle"]; TRACE_1("params", _vehicle); @@ -21,7 +22,6 @@ _initializedClasses = GETMVAR(GVAR(initializedClasses),[]); // do nothing if the class is already initialized if (_type in _initializedClasses) exitWith {}; - // get all hitpoints private "_hitPoints"; _hitPoints = [_vehicle] call EFUNC(common,getHitPointsWithSelections) select 0; @@ -42,7 +42,8 @@ _wheelHitPointSelections = _wheelHitPointsWithSelections select 1; private ["_icon", "_selection"]; _icon = QUOTE(PATHTOF(ui\tire_ca.paa)); - + _icon = "A3\ui_f\data\igui\cfg\actions\repair_ca.paa"; + // textDefault = ""; _selection = _wheelHitPointSelections select (_wheelHitPoints find _x); private ["_name", "_text", "_condition", "_statement"]; @@ -89,16 +90,24 @@ _wheelHitPointSelections = _wheelHitPointsWithSelections select 1; _text = format [localize LSTRING(RepairHitpoint), _x]; }; - _icon = ""; + _icon = "A3\ui_f\data\igui\cfg\actions\repair_ca.paa"; _selection = ""; - _condition = {[_this select 1, _this select 0, _this select 2 select 0, _this select 2 select 1] call DFUNC(canRepair)}; - _statement = {[_this select 1, _this select 0, _this select 2 select 0, _this select 2 select 1] call DFUNC(repairVehicle)}; + _statement = {[_this select 1, _this select 0, _this select 2 select 0, _this select 2 select 1] call DFUNC(repair)}; - private "_action"; - _action = [_name, _text, _icon, _statement, _condition, {}, [_x, "MiscRepair"], _selection, 4] call EFUNC(interact_menu,createAction); - [_type, 0, ["ACE_MainActions", QGVAR(Repair)], _action] call EFUNC(interact_menu,addActionToClass); + /*if (_x in TRACK_HITPOINTS) then { + _selection = getText(configFile >> "CfgVehicles" >> _type >> "HitPoints" >> _x >> "name"); + diag_log format["Selection exists: %1", !(isNil {_vehicle getHit _selection})]; + private "_action"; + _action = [_name, _text, _icon, _statement, _condition, {}, [_x, "MiscRepair"], _selection, 4] call EFUNC(interact_menu,createAction); + [_type, 0, [], _action] call EFUNC(interact_menu,addActionToClass); + } else {*/ + private "_action"; + _action = [_name, _text, _icon, _statement, _condition, {}, [_x, "MiscRepair"], _selection, 4] call EFUNC(interact_menu,createAction); + [_type, 0, ["ACE_MainActions", QGVAR(Repair)], _action] call EFUNC(interact_menu,addActionToClass); + //}; + //diag_log format["Adding repair action for: %1 - %2", _type, _x]; }; } forEach _hitPoints; diff --git a/addons/repair/functions/fnc_doRepair.sqf b/addons/repair/functions/fnc_doRepair.sqf index 69a3510444..8059003845 100644 --- a/addons/repair/functions/fnc_doRepair.sqf +++ b/addons/repair/functions/fnc_doRepair.sqf @@ -10,17 +10,14 @@ */ #include "script_component.hpp" -params ["_args", "_elapsedTime", "_totalTime"]; -_args params ["_unit", "_vehicle", "_hitPoint"]; -TRACE_5("params",_unit,_vehicle,_hitPoint,_elapsedTime,_totalTime); +params ["_unit", "_vehicle", "_hitPoint"]; +TRACE_3("params",_unit,_vehicle,_hitPoint); // get current hitpoint damage private "_hitPointDamage"; _hitPointDamage = _vehicle getHitPointDamage _hitPoint; -// subtract repaired damage -_hitPointDamage = _hitPointDamage - _hitPointDamage * (_elapsedTime / _totalTime); - +_hitPointDamage = _hitPointDamage - 0.5; // don't use negative values for damage _hitPointDamage = _hitPointDamage max ([_unit] call FUNC(getPostRepairDamage)); diff --git a/addons/repair/functions/fnc_doReplaceWheel.sqf b/addons/repair/functions/fnc_doReplaceWheel.sqf index c97b249f0c..74df656922 100644 --- a/addons/repair/functions/fnc_doReplaceWheel.sqf +++ b/addons/repair/functions/fnc_doReplaceWheel.sqf @@ -14,9 +14,6 @@ params ["_unit", "_vehicle", "_hitPoint", "_classname"]; TRACE_4("params",_unit,_vehicle,_hitPoint,_classname); // TODO [_unit, _wheel] call EFUNC(common,claim); on start of action -systemChat format["Calling doReplaceWheel with: %1", _This]; -diag_log format["Calling doReplaceWheel with: %1", _This]; - _wheel = objNull; { diff --git a/addons/repair/functions/fnc_getPostRepairDamage.sqf b/addons/repair/functions/fnc_getPostRepairDamage.sqf index 17ba7bdd82..adb794a473 100644 --- a/addons/repair/functions/fnc_getPostRepairDamage.sqf +++ b/addons/repair/functions/fnc_getPostRepairDamage.sqf @@ -3,8 +3,7 @@ params ["_unit"]; TRACE_1("params",_unit); - +// TODO when near repair station, full repair? if ([_unit, GVAR(engineerSetting_Repair) + 1] call FUNC(isEngineer)) exitWith {GVAR(repairDamageThreshold_Engineer)}; if ([_unit, GVAR(engineerSetting_Repair)] call FUNC(isEngineer)) exitWith {GVAR(repairDamageThreshold)}; - -1 +0.3; diff --git a/addons/repair/functions/fnc_setHitPointDamage.sqf b/addons/repair/functions/fnc_setHitPointDamage.sqf index 8e609917e9..d4595960e4 100644 --- a/addons/repair/functions/fnc_setHitPointDamage.sqf +++ b/addons/repair/functions/fnc_setHitPointDamage.sqf @@ -25,14 +25,14 @@ _hitPoints = [_vehicle] call EFUNC(common,getHitpoints); _hitPointsWithSelections = [_vehicle] call EFUNC(common,getHitpointsWithSelections) select 0; // exit if the hitpoint is not valid -if !(_hitPoint in _hitPoints) exitWith {}; +if !(_hitPoint in _hitPoints) exitWith {systemChat format["NOT A VALID HITPOINT: %1",_hitpoint]}; // save array with damage values of all hitpoints private "_hitPointDamages"; _hitPointDamages = []; { - _hitPointDamages set [_forEachIndex, _vehicle getHitPointDamage _x]; + _hitPointDamages set [_forEachIndex, (_vehicle getHitPointDamage _x)]; } forEach _hitPoints; // save structural damage and sum of hitpoint damages @@ -78,4 +78,4 @@ _vehicle setDamage _damageNew; } forEach _hitPoints; // normalize hitpoints -[_vehicle] call FUNC(normalizeHitPoints); +// [_vehicle] call FUNC(normalizeHitPoints); diff --git a/addons/repair/script_component.hpp b/addons/repair/script_component.hpp index ad532dd1c3..23c52bdec8 100644 --- a/addons/repair/script_component.hpp +++ b/addons/repair/script_component.hpp @@ -13,3 +13,4 @@ #define IGNORED_HITPOINTS ["HitGlass1","HitGlass2","HitGlass3","HitGlass4","HitGlass5","HitGlass6","HitGlass7","HitGlass8","HitGlass9","HitGlass10","HitGlass11","HitGlass12","HitGlass13","HitGlass14","HitGlass15","HitRGlass","HitLGlass"] +// #define TRACK_HITPOINTS ["HitLTrack", "HitRTrack"];