mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
All repair actions are now functional
This commit is contained in:
parent
9adbb07367
commit
872d026cd0
@ -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);
|
||||
|
@ -8,7 +8,7 @@ class ACE_Repair {
|
||||
requiredEngineer = 0;
|
||||
repairingTime = 5;
|
||||
repairingTimeSelfCoef = 1;
|
||||
items[] = {};
|
||||
items[] = {"ToolKit"};
|
||||
condition = QUOTE(call FUNC(canReplaceWheel));
|
||||
itemConsumed = 0;
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
};
|
||||
};
|
@ -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 = "<img image='\A3\ui_f\data\igui\cfg\actions\repair_ca.paa' size='1.8' shadow=2 />";
|
||||
_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;
|
||||
|
||||
|
@ -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));
|
||||
|
||||
|
@ -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;
|
||||
|
||||
{
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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"];
|
||||
|
Loading…
Reference in New Issue
Block a user