trapw0w / PRAE_Modules

Github for the source of @PRAE_Modules
GNU General Public License v3.0
0 stars 0 forks source link

Add check prior to applying ACE addAction #3

Closed trapw0w closed 5 years ago

trapw0w commented 5 years ago

Prior to applying an ACE interaction via ace_interact_menu_fnc_addActionToObject to an object. Use setVariable & getVariable to check if the current object already has the action added.

Fault scenario on this is if the user/admin disables and then reenables via the addon options.

trapw0w commented 5 years ago
22:10:16 "[PRAE Evactuate Civilians] - Initialising"
22:10:16 "[PRAE Evactuate Civilians] - Interaction added to Vehicle: vehicle_0 - B_T_Truck_01_cargo_F"
22:10:16 "[PRAE Evactuate Civilians] - Interaction added to Vehicle: vehicle_1 - UK3CB_BAF_Coyote_Passenger_L111A1_D"
22:10:16 "[PRAE Evactuate Civilians] - Interaction added to Vehicle: vehicle_2 - UK3CB_BAF_LandRover_Amb_FFR_Sand_A"
22:10:16 "[PRAE Evactuate Civilians] - Interaction added to Vehicle: vehicle_3 - UK3CB_BAF_MAN_HX58_Repair_Sand"
22:10:16 "[PRAE Evactuate Civilians] - Interaction added to Vehicle: vehicle_6 - B_Quadbike_01_F"
22:10:39 "[PRAE Evactuate Civilians] - Initialising"
22:10:39 "[PRAE Evactuate Civilians] - Interaction already present on vehicle_0 - B_T_Truck_01_cargo_F"
22:10:39 "[PRAE Evactuate Civilians] - Interaction already present on vehicle_1 - UK3CB_BAF_Coyote_Passenger_L111A1_D"
22:10:39 "[PRAE Evactuate Civilians] - Interaction already present on vehicle_2 - UK3CB_BAF_LandRover_Amb_FFR_Sand_A"
22:10:39 "[PRAE Evactuate Civilians] - Interaction already present on vehicle_3 - UK3CB_BAF_MAN_HX58_Repair_Sand"
22:10:39 "[PRAE Evactuate Civilians] - Interaction already present on vehicle_6 - B_Quadbike_01_F"

Added a check onto the target object (vehicle) to check a pre-defined set variable: if (_x getVariable["PRAE_EVAC_ACTION", false]) exitWith { format["[PRAE Evactuate Civilians] - Interaction already present on %1 - %2", _x, (typeOf _x)] remoteExec ["diag_log", 2]};