Skip to content

Commit

Permalink
Merge pull request #800 from ColdEvul/flagsaber
Browse files Browse the repository at this point in the history
Added ability to add flag to M1A1
  • Loading branch information
AndreasBrostrom authored Oct 25, 2021
2 parents f4b53e6 + d8b1735 commit e698e5a
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cScripts/CfgFunctions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@ class cScripts {

class vehicle_addPylonSelection {};
class vehicle_setupPylonCategories {};

// Other
class vehicle_addFlagAction {};
};
class modules {
file = "cScripts\functions\modules";
Expand Down
47 changes: 47 additions & 0 deletions cScripts/functions/vehicle/fn_vehicle_addFlagAction.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#include "..\script_component.hpp";
/*
* Author: CPL.Brostrom.A
* This function adds a takedown and put up flag action to the given vehicle.
*
* Arguments:
* 0: Vehicle <OBJECT>
*
* Return Value:
* nothing
*
* Example:
* [this] call cScripts_fnc_vehicle_addFlagAction;
*
* Public: No
*/

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

if (isNull _vehicle) exitWith {};

private _icon = "iconLogic" call FUNC(getIcon);

private _addCondition = {
params ["_vehicle", "_caller", "_params"];
!(_vehicle getVariable [QEGVAR(Vehicle,hasFlag), false]) && isTurnedOut _caller;
};
private _putFlag = [QEGVAR(Actions_Vehicle,PutFlag), "Put up flag", _icon, {
params ["_vehicle", "_caller", "_params"];
private _flagTexture = "z\cav\addons\flag\data\flag_01_ca.paa"; //"\A3\Data_F\Flags\Flag_red_CO.paa"
_vehicle forceFlagTexture _flagTexture;
_vehicle setVariable [QEGVAR(Vehicle,hasFlag), true];

}, _addCondition] call ace_interact_menu_fnc_createAction;
[_vehicle, 1, ["ACE_SelfActions"], _putFlag] call ace_interact_menu_fnc_addActionToObject;


private _remCondition = {
params ["_vehicle", "_caller", "_params"];
_vehicle getVariable [QEGVAR(Vehicle,hasFlag), false] && isTurnedOut _caller;
};
private _takeFlag = [QEGVAR(Actions_Vehicle,TakeFlag), "Take down flag", _icon, {
params ["_vehicle", "_caller", "_params"];
_vehicle forceFlagTexture "";
_vehicle setVariable [QEGVAR(Vehicle,hasFlag), false];
}, _remCondition] call ace_interact_menu_fnc_createAction;
[_vehicle, 1, ["ACE_SelfActions"], _takeFlag] call ace_interact_menu_fnc_addActionToObject;
4 changes: 4 additions & 0 deletions cScripts/functions/vehicle/fn_vehicle_addFunctions.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ if (_vehicle iskindOf "Truck_01_base_F") then {
};
};

if (_vehicle iskindOf "rhsusf_m1a1tank_base") then {
[_vehicle] call FUNC(vehicle_addFlagAction);
};

if (_vehicle iskindOf "rhsusf_stryker_base") then {
switch (_vehicleType) do {
case "MED": {_vehicle setVariable ["ace_medical_isMedicalVehicle", true, true];};
Expand Down

0 comments on commit e698e5a

Please sign in to comment.