Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added new repair action #1203

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cScripts/CfgFunctions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ class cScripts {

class vehicle_addRegearAction {};
class vehicle_addRepairAction {};
class vehicle_addRepairRefuelAction {};

class vehicle_addCosmeticSelection {};
class vehicle_addPylonSelection {};
Expand Down
3 changes: 3 additions & 0 deletions cScripts/functions/init/fn_init_vehicle.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ if !(EGVAR(Settings,enableVehicleSystem)) exitWith {};
INFO_2("VehicleInit", "Applying Client Init: (%1 [%2])...", _vehicle, typeOf _vehicle);
_vehicle call EFUNC(vehicle,addFunctions);
_vehicle call EFUNC(vehicle,addStagingActions);

[_vehicle, 300] call EFUNC(vehicle,addRepairRefuelAction);

INFO_2("VehicleInit", "Init applied to %1 [%2]", _vehicle, typeOf _vehicle);
}, true, ["man"], true] call CBA_fnc_addClassEventHandler;

Expand Down
45 changes: 31 additions & 14 deletions cScripts/functions/vehicle/fn_vehicle_addRepairAction.sqf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "..\script_component.hpp";
/*
* Author: CPL.Brostrom.A
* This function add a repair action to a vehicle inside of a staging zone.
* This function add a repair action to a vehicle
*
* Arguments:
* 0: Vehicle <OBJECT>
Expand All @@ -15,23 +15,40 @@
* Public: No
*/

params [["_vehicle", objNull, [objNull]]];
params [
["_vehicle", objNull, [objNull]],
["_duration", 0, [0]]
];

if (isNull _vehicle) exitWith {};


private _lable = "Fully repair vehicle";
private _icon = "\A3\ui_f\data\igui\cfg\actions\repair_ca.paa" call FUNC(getIcon);

private _condition = { call FUNC(checkStagingZone) };
private _stagingCat = [QEGVAR(Actions_Vehicle,Repair), "Repair and Refuel", _icon, {
private _condition = { true };

private _action = {
params ["_vehicle", "_caller", "_params"];
["", _vehicle] call ace_repair_fnc_doFullRepair;
_vehicle setFuel 1;
[
[],
["Vehicle have been refueld and repaired."],
[""],
[""]
] call CBA_fnc_notify;
}, _condition] call ace_interact_menu_fnc_createAction;
[_vehicle, 1, ["ACE_SelfActions", QEGVAR(Actions_Vehicle,Main_Cat)], _stagingCat] call ace_interact_menu_fnc_addActionToObject;

["Fully repairing vehicle", _duration, {_condition}, {
["", _vehicle] call ace_repair_fnc_doFullRepair;
[
[],
["Vehicle have been repaired."],
[""],
[""]
] call CBA_fnc_notify;
},{
[
[],
["Failed to repair vehicle."],
[""],
[""]
] call CBA_fnc_notify;
}] call CBA_fnc_progressBar;
};

private _stagingCat = [QEGVAR(Actions_Vehicle,Repair), _lable, _icon, _action, _condition] call ace_interact_menu_fnc_createAction;
[_vehicle, 1, ["ACE_MainActions"], _stagingCat] call ace_interact_menu_fnc_addActionToObject;

39 changes: 39 additions & 0 deletions cScripts/functions/vehicle/fn_vehicle_addRepairRefuelAction.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#include "..\script_component.hpp";
/*
* Author: CPL.Brostrom.A
* This function add a repair action to a vehicle inside of a staging zone.
*
* Arguments:
* 0: Vehicle <OBJECT>
*
* Return Value:
* nothing
*
* Example:
* [_vehicle] call cScripts_fnc_vehicle_addRepairRefuelAction
*
* Public: No
*/

params [
["_vehicle", objNull, [objNull]],
["_duration", 0, [0]]
];

if (isNull _vehicle) exitWith {};

private _icon = "\A3\ui_f\data\igui\cfg\actions\repair_ca.paa" call FUNC(getIcon);

private _condition = { call FUNC(checkStagingZone) };
private _stagingCat = [QEGVAR(Actions_Vehicle,RefuelRepair), "Repair and Refuel", _icon, {
params ["_vehicle", "_caller", "_params"];
["", _vehicle] call ace_repair_fnc_doFullRepair;
_vehicle setFuel 1;
[
[],
["Vehicle have been refueld and repaired."],
[""],
[""]
] call CBA_fnc_notify;
}, _condition] call ace_interact_menu_fnc_createAction;
[_vehicle, 1, ["ACE_SelfActions", QEGVAR(Actions_Vehicle,Main_Cat)], _stagingCat] call ace_interact_menu_fnc_addActionToObject;
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ private _stagingCat = [QEGVAR(Actions_Vehicle,Cosmetic_Cat), "Vehicle Cosmetics"
[_vehicle, 1, ["ACE_SelfActions", QEGVAR(Actions_Vehicle,Main_Cat)], _stagingCat] call ace_interact_menu_fnc_addActionToObject;

[_vehicle] call EFUNC(vehicle,addRegearAction);
[_vehicle] call EFUNC(vehicle,addRepairAction);
[_vehicle] call EFUNC(vehicle,addRepairRefuelAction);
[_vehicle] call EFUNC(vehicle,addCosmeticSelection);
[_vehicle] call EFUNC(vehicle,setupPylonCategories);

Expand Down