Change "Remove Wheel" Action's Color Based on Damage (#5415)

* Change repair action's colors on wheels

* Add dots.
This commit is contained in:
Ozan Eğitmen 2017-08-10 14:32:55 +03:00 committed by jonpas
parent 292844690a
commit ff1247daef
16 changed files with 41 additions and 10 deletions

View File

@ -24,6 +24,7 @@ PREP(isInRepairFacility);
PREP(isNearRepairVehicle);
PREP(isRepairVehicle);
PREP(modifyInteraction);
PREP(modifySelectionInteraction);
PREP(moduleAddSpareParts);
PREP(moduleAssignEngineer);
PREP(moduleAssignRepairVehicle);

View File

@ -39,6 +39,7 @@ _hitPointsAddedNames = [];
_hitPointsAddedStrings = [];
_hitPointsAddedAmount = [];
_processedHitpoints = [];
_icon = QPATHTOF(ui\repair_0_ca.paa);
{
_selection = _x;
@ -48,8 +49,6 @@ _processedHitpoints = [];
// Wheels should always be unique
if (_hitpoint in _processedHitpoints) exitWith {TRACE_3("Duplicate Wheel",_hitpoint,_forEachIndex,_selection);};
_icon = "A3\ui_f\data\igui\cfg\actions\repair_ca.paa";
_position = compile format ["_target selectionPosition ['%1', 'HitPoints'];", _selection];
TRACE_3("Adding Wheel Actions",_hitpoint,_forEachIndex,_selection);
@ -59,7 +58,7 @@ _processedHitpoints = [];
private _text = localize LSTRING(RemoveWheel);
_condition = {[_this select 1, _this select 0, _this select 2 select 0, "RemoveWheel"] call DFUNC(canRepair)};
_statement = {[_this select 1, _this select 0, _this select 2 select 0, "RemoveWheel"] call DFUNC(repair)};
_action = [_name, _text, _icon, _statement, _condition, {}, [_hitpoint], _position, 2] call EFUNC(interact_menu,createAction);
_action = [_name, _text, _icon, _statement, _condition, {}, [_hitpoint], _position, 2, nil, FUNC(modifySelectionInteraction)] call EFUNC(interact_menu,createAction);
[_type, 0, [], _action] call EFUNC(interact_menu,addActionToClass);
// An action to replace the wheel is required
@ -121,7 +120,6 @@ _processedHitpoints = [];
// Prepair the repair action
_name = format ["Repair_%1_%2", _forEachIndex, _selection];
_icon = "A3\ui_f\data\igui\cfg\actions\repair_ca.paa";
// Find localized string and track those added for numerization
([_hitpoint, "%1", _hitpoint, [_hitPointsAddedNames, _hitPointsAddedStrings, _hitPointsAddedAmount]] call FUNC(getHitPointString)) params ["_text", "_trackArray"];
@ -161,7 +159,7 @@ _processedHitpoints = [];
_condition = {[_this select 1, _this select 0, "", "fullRepair"] call DFUNC(canRepair)};
_statement = {[_this select 1, _this select 0, "", "fullRepair"] call DFUNC(repair)};
_action = [QGVAR(fullRepair), localize LSTRING(fullRepair), "A3\ui_f\data\igui\cfg\actions\repair_ca.paa", _statement, _condition, {}, [], "", 4] call EFUNC(interact_menu,createAction);
_action = [QGVAR(fullRepair), localize LSTRING(fullRepair), _icon, _statement, _condition, {}, [], "", 4] call EFUNC(interact_menu,createAction);
[_type, 0, ["ACE_MainActions", QGVAR(Repair)], _action] call EFUNC(interact_menu,addActionToClass);
// set class as initialized

View File

@ -1,6 +1,6 @@
/*
* Author: Glowbal
* Fully repairs vehicle
* Fully repairs vehicle.
*
* Arguments:
* 0: Unit that does the repairing (not used) <OBJECT>

View File

@ -1,6 +1,6 @@
/*
* Author: PabstMirror
* Returns array of required nearby repair objects (wheels/tracks)
* Returns array of required nearby repair objects (wheels/tracks).
*
* Arguments:
* 0: Unit that does the repairing <OBJECT>

View File

@ -1,6 +1,6 @@
/*
* Author: PabstMirror
* Modifies the base interaction point for repair items to show it's current damage
* Modifies the base interaction point for repair items to show it's current damage.
*
* Arguments:
* 0: Target <OBJECT>
@ -12,7 +12,7 @@
* None
*
* Example:
* [cursorObject, player, [], []] call ace_repair_fnc_modifyInteraction;
* [cursorObject, ace_player, [], []] call ace_repair_fnc_modifyInteraction;
*
* Public: No
*/

View File

@ -0,0 +1,32 @@
/*
* Author: 654wak654
* Modifies interaction color of vehicle selection to show it's current damage.
*
* Arguments:
* 0: Target <OBJECT>
* 1: Player <OBJECT>
* 2: Args <Any>
* 3: Action Data <ARRAY>
*
* Return Value:
* None
*
* Example:
* [cursorObject, ace_player, [], []] call ace_repair_fnc_modifySelectionInteraction;
*
* Public: No
*/
#include "script_component.hpp"
params ["_target", "_player", "_args", "_actionData"];
TRACE_4("params",_target,_player,_args,_actionData);
// Interaction wrenches numbered 0..8, white to red.
// Convert damage to number (rounding up), so that even slight damage can bee seen
private _fileName = format [
QPATHTOF(ui\repair_%1_ca.paa),
ceil (linearConversion [0, 1, _target getHitPointDamage (_args select 0), 0, 8, true])
];
_actionData set [2, _fileName];

View File

@ -1,7 +1,7 @@
/*
* Author: commy2
* Set the hitpoint damage and change the structural damage acordingly, requires local vehicle.
* Handles the ace_repair_setVehicleHitPointDamage event
* Handles the ace_repair_setVehicleHitPointDamage event.
*
* Arguments:
* 0: Local Vehicle to Damage <OBJECT>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.