From 7a4c37c0854cab20cb6211f379823b37ce6f6a2c Mon Sep 17 00:00:00 2001
From: commy2 <commy-2@gmx.de>
Date: Sun, 30 Aug 2015 22:03:45 +0200
Subject: [PATCH 1/2] disable all actions on ladders by default, close #2289

---
 .../functions/fnc_compileMenuSelfAction.sqf    |  2 +-
 addons/interact_menu/functions/fnc_keyDown.sqf |  2 +-
 addons/interaction/CfgVehicles.hpp             | 18 +++++++++---------
 addons/interaction/XEH_postInit.sqf            |  1 +
 4 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/addons/interact_menu/functions/fnc_compileMenuSelfAction.sqf b/addons/interact_menu/functions/fnc_compileMenuSelfAction.sqf
index f486b3ee58..2c8cdc279c 100644
--- a/addons/interact_menu/functions/fnc_compileMenuSelfAction.sqf
+++ b/addons/interact_menu/functions/fnc_compileMenuSelfAction.sqf
@@ -122,7 +122,7 @@ _actions = if (_isMan) then {
                     // Dummy statement so it's not collapsed when there's no available actions
                     true
                 },
-                {[ACE_player, _target, ["isNotInside","isNotDragging", "isNotCarrying", "isNotSwimming", "notOnMap", "isNotEscorting", "isNotSurrendering", "isNotSitting"]] call EFUNC(common,canInteractWith)},
+                {[ACE_player, _target, ["isNotInside","isNotDragging", "isNotCarrying", "isNotSwimming", "notOnMap", "isNotEscorting", "isNotSurrendering", "isNotSitting", "isNotOnLadder"]] call EFUNC(common,canInteractWith)},
                 {},
                 {},
                 "Spine3",
diff --git a/addons/interact_menu/functions/fnc_keyDown.sqf b/addons/interact_menu/functions/fnc_keyDown.sqf
index ca06e25eb6..8c8ecf0c20 100644
--- a/addons/interact_menu/functions/fnc_keyDown.sqf
+++ b/addons/interact_menu/functions/fnc_keyDown.sqf
@@ -18,7 +18,7 @@ if (GVAR(openedMenuType) == _menuType) exitWith {true};
 
 // Conditions: canInteract (these don't apply to zeus)
 if ((isNull curatorCamera) && {
-    !([ACE_player, objNull, ["isNotInside","isNotDragging", "isNotCarrying", "isNotSwimming", "notOnMap", "isNotEscorting", "isNotSurrendering", "isNotSitting"]] call EFUNC(common,canInteractWith))
+    !([ACE_player, objNull, ["isNotInside","isNotDragging", "isNotCarrying", "isNotSwimming", "notOnMap", "isNotEscorting", "isNotSurrendering", "isNotSitting", "isNotOnLadder"]] call EFUNC(common,canInteractWith))
 }) exitWith {false};
 
 while {dialog} do {
diff --git a/addons/interaction/CfgVehicles.hpp b/addons/interaction/CfgVehicles.hpp
index d2cef4c9ef..abfdb976ab 100644
--- a/addons/interaction/CfgVehicles.hpp
+++ b/addons/interaction/CfgVehicles.hpp
@@ -191,7 +191,7 @@ class CfgVehicles {
             class ACE_TeamManagement {
                 displayName = CSTRING(TeamManagement);
                 condition = QUOTE(GVAR(EnableTeamManagement));
-                exceptions[] = {"isNotInside", "isNotSitting"};
+                exceptions[] = {"isNotInside", "isNotSitting", "isNotOnLadder"};
                 statement = "";
                 showDisabled = 1;
                 priority = 3.2;
@@ -201,7 +201,7 @@ class CfgVehicles {
                 class ACE_JoinTeamRed {
                     displayName = CSTRING(JoinTeamRed);
                     condition = QUOTE(true);
-                    exceptions[] = {"isNotInside", "isNotSitting"};
+                    exceptions[] = {"isNotInside", "isNotSitting", "isNotOnLadder"};
                     statement = QUOTE([ARR_2(_player,'RED')] call DFUNC(joinTeam));
                     showDisabled = 1;
                     priority = 2.4;
@@ -211,7 +211,7 @@ class CfgVehicles {
                 class ACE_JoinTeamGreen {
                     displayName = CSTRING(JoinTeamGreen);
                     condition = QUOTE(true);
-                    exceptions[] = {"isNotInside", "isNotSitting"};
+                    exceptions[] = {"isNotInside", "isNotSitting", "isNotOnLadder"};
                     statement = QUOTE([ARR_2(_player,'GREEN')] call DFUNC(joinTeam));
                     showDisabled = 1;
                     priority = 2.3;
@@ -221,7 +221,7 @@ class CfgVehicles {
                 class ACE_JoinTeamBlue {
                     displayName = CSTRING(JoinTeamBlue);
                     condition = QUOTE(true);
-                    exceptions[] = {"isNotInside", "isNotSitting"};
+                    exceptions[] = {"isNotInside", "isNotSitting", "isNotOnLadder"};
                     statement = QUOTE([ARR_2(_player,'BLUE')] call DFUNC(joinTeam));
                     showDisabled = 1;
                     priority = 2.2;
@@ -231,7 +231,7 @@ class CfgVehicles {
                 class ACE_JoinTeamYellow {
                     displayName = CSTRING(JoinTeamYellow);
                     condition = QUOTE(true);
-                    exceptions[] = {"isNotInside", "isNotSitting"};
+                    exceptions[] = {"isNotInside", "isNotSitting", "isNotOnLadder"};
                     statement = QUOTE([ARR_2(_player,'YELLOW')] call DFUNC(joinTeam));
                     showDisabled = 1;
                     priority = 2.1;
@@ -242,7 +242,7 @@ class CfgVehicles {
                 class ACE_LeaveTeam {
                     displayName = CSTRING(LeaveTeam);
                     condition = QUOTE(assignedTeam _player != 'MAIN');
-                    exceptions[] = {"isNotInside", "isNotSitting"};
+                    exceptions[] = {"isNotInside", "isNotSitting", "isNotOnLadder"};
                     statement = QUOTE([ARR_2(_player,'MAIN')] call DFUNC(joinTeam));
                     showDisabled = 1;
                     priority = 2.5;
@@ -252,7 +252,7 @@ class CfgVehicles {
                 class ACE_BecomeLeader {
                     displayName = CSTRING(BecomeLeader);
                     condition = QUOTE(_this call DFUNC(canBecomeLeader));
-                    exceptions[] = {"isNotInside", "isNotSitting"};
+                    exceptions[] = {"isNotInside", "isNotSitting", "isNotOnLadder"};
                     statement = QUOTE(_this call DFUNC(doBecomeLeader));
                     showDisabled = 1;
                     priority = 1.0;
@@ -262,7 +262,7 @@ class CfgVehicles {
                 class ACE_LeaveGroup {
                     displayName = CSTRING(LeaveGroup);
                     condition = QUOTE(count (units group _player) > 1);
-                    exceptions[] = {"isNotInside", "isNotSitting"};
+                    exceptions[] = {"isNotInside", "isNotSitting", "isNotOnLadder"};
                     statement = QUOTE(_oldGroup = units group _player; _newGroup = createGroup side _player; [_player] joinSilent _newGroup; {_player reveal _x} forEach _oldGroup;);
                     showDisabled = 1;
                     priority = 1.2;
@@ -379,7 +379,7 @@ class CfgVehicles {
             class ACE_Equipment {
                 displayName = CSTRING(Equipment);
                 condition = QUOTE(true);
-                exceptions[] = {"isNotInside","notOnMap", "isNotSitting"};
+                exceptions[] = {"isNotInside", "notOnMap", "isNotSitting"};
                 statement = "";
                 showDisabled = 1;
                 priority = 4.5;
diff --git a/addons/interaction/XEH_postInit.sqf b/addons/interaction/XEH_postInit.sqf
index 8db2d34ad1..0906e48d35 100644
--- a/addons/interaction/XEH_postInit.sqf
+++ b/addons/interaction/XEH_postInit.sqf
@@ -82,3 +82,4 @@ private ["_team"];
 [29, [false, false, false]], false] call cba_fnc_addKeybind;
 
 ["isNotSwimming", {!underwater (_this select 0)}] call EFUNC(common,addCanInteractWithCondition);
+["isNotOnLadder", {getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> animationState (_this select 0) >> "ACE_isLadder") != 1}] call EFUNC(common,addCanInteractWithCondition);

From 37aec2b3c3e984417ff0de0227806a61b5661a8b Mon Sep 17 00:00:00 2001
From: commy2 <commy-2@gmx.de>
Date: Mon, 31 Aug 2015 21:22:22 +0200
Subject: [PATCH 2/2] enable repairing while on ladder

---
 addons/repair/CfgVehicles.hpp                   | 1 +
 addons/repair/functions/fnc_canRepairTrack.sqf  | 2 +-
 addons/repair/functions/fnc_canReplaceTrack.sqf | 2 +-
 addons/repair/functions/fnc_canReplaceWheel.sqf | 2 +-
 addons/repair/functions/fnc_doRepairTrack.sqf   | 2 +-
 addons/repair/functions/fnc_doReplaceTrack.sqf  | 2 +-
 addons/repair/functions/fnc_doReplaceWheel.sqf  | 2 +-
 addons/repair/functions/fnc_repair.sqf          | 2 +-
 8 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/addons/repair/CfgVehicles.hpp b/addons/repair/CfgVehicles.hpp
index 47459f532d..27e8890dbc 100644
--- a/addons/repair/CfgVehicles.hpp
+++ b/addons/repair/CfgVehicles.hpp
@@ -10,6 +10,7 @@
                 priority = 2; \
                 icon = "\A3\ui_f\data\igui\cfg\actions\repair_ca.paa"; \
                 distance = 4; \
+                exceptions[] = {"isNotOnLadder"}; \
             }; \
         }; \
     };
diff --git a/addons/repair/functions/fnc_canRepairTrack.sqf b/addons/repair/functions/fnc_canRepairTrack.sqf
index 34165068d7..806fa14b2e 100644
--- a/addons/repair/functions/fnc_canRepairTrack.sqf
+++ b/addons/repair/functions/fnc_canRepairTrack.sqf
@@ -30,7 +30,7 @@ if (typeName _wheel == "OBJECT") then {
     _wheel = objNull;
 
     {
-        if ([_unit, _x, ["isNotDragging", "isNotCarrying"]] call EFUNC(common,canInteractWith)) exitWith {
+        if ([_unit, _x, ["isNotDragging", "isNotCarrying", "isNotOnLadder"]] call EFUNC(common,canInteractWith)) exitWith {
             _wheel = _x;
         };
     } forEach nearestObjects [_unit, ["ACE_Track"], 5];
diff --git a/addons/repair/functions/fnc_canReplaceTrack.sqf b/addons/repair/functions/fnc_canReplaceTrack.sqf
index 94a62a5289..3f4ae77581 100644
--- a/addons/repair/functions/fnc_canReplaceTrack.sqf
+++ b/addons/repair/functions/fnc_canReplaceTrack.sqf
@@ -31,7 +31,7 @@ if (typeName _track == "OBJECT") then {
     _track = objNull;
 
     {
-        if ([_unit, _x, ["isNotDragging", "isNotCarrying"]] call EFUNC(common,canInteractWith)) exitWith {
+        if ([_unit, _x, ["isNotDragging", "isNotCarrying", "isNotOnLadder"]] call EFUNC(common,canInteractWith)) exitWith {
             _track = _x;
         };
     } forEach nearestObjects [_unit, ["ACE_Track"], 5];
diff --git a/addons/repair/functions/fnc_canReplaceWheel.sqf b/addons/repair/functions/fnc_canReplaceWheel.sqf
index 9497504370..e0a2fbbed2 100644
--- a/addons/repair/functions/fnc_canReplaceWheel.sqf
+++ b/addons/repair/functions/fnc_canReplaceWheel.sqf
@@ -37,7 +37,7 @@ if (typeName _wheel == "OBJECT") then {
     _wheel = objNull;
 
     {
-        if ([_unit, _x, ["isNotDragging", "isNotCarrying"]] call EFUNC(common,canInteractWith)) exitWith {
+        if ([_unit, _x, ["isNotDragging", "isNotCarrying", "isNotOnLadder"]] call EFUNC(common,canInteractWith)) exitWith {
             _wheel = _x;
         };
     } forEach nearestObjects [_unit, ["ACE_Wheel"], 5];
diff --git a/addons/repair/functions/fnc_doRepairTrack.sqf b/addons/repair/functions/fnc_doRepairTrack.sqf
index 4803518e3d..de04e71920 100644
--- a/addons/repair/functions/fnc_doRepairTrack.sqf
+++ b/addons/repair/functions/fnc_doRepairTrack.sqf
@@ -27,7 +27,7 @@ private ["_hitPointDamage", "_newDamage", "_wheel"];
 _wheel = objNull;
 
 {
-    if ([_unit, _x, ["isNotDragging", "isNotCarrying"]] call EFUNC(common,canInteractWith)) exitWith {
+    if ([_unit, _x, ["isNotDragging", "isNotCarrying", "isNotOnLadder"]] call EFUNC(common,canInteractWith)) exitWith {
         _wheel = _x;
     };
 } forEach nearestObjects [_unit, ["ACE_Track"], 5];
diff --git a/addons/repair/functions/fnc_doReplaceTrack.sqf b/addons/repair/functions/fnc_doReplaceTrack.sqf
index 13e53b3f3a..a95a669159 100644
--- a/addons/repair/functions/fnc_doReplaceTrack.sqf
+++ b/addons/repair/functions/fnc_doReplaceTrack.sqf
@@ -27,7 +27,7 @@ private["_hitPointDamage", "_wheel"];
 _wheel = objNull;
 
 {
-    if ([_unit, _x, ["isNotDragging", "isNotCarrying"]] call EFUNC(common,canInteractWith)) exitWith {
+    if ([_unit, _x, ["isNotDragging", "isNotCarrying", "isNotOnLadder"]] call EFUNC(common,canInteractWith)) exitWith {
         _wheel = _x;
     };
 } forEach nearestObjects [_unit, ["ACE_Track"], 5];
diff --git a/addons/repair/functions/fnc_doReplaceWheel.sqf b/addons/repair/functions/fnc_doReplaceWheel.sqf
index 62db39aa6d..f10712d65d 100644
--- a/addons/repair/functions/fnc_doReplaceWheel.sqf
+++ b/addons/repair/functions/fnc_doReplaceWheel.sqf
@@ -27,7 +27,7 @@ private ["_hitPointDamage", "_wheel"];
 _wheel = objNull;
 
 {
-    if ([_unit, _x, ["isNotDragging", "isNotCarrying"]] call EFUNC(common,canInteractWith)) exitWith {
+    if ([_unit, _x, ["isNotDragging", "isNotCarrying", "isNotOnLadder"]] call EFUNC(common,canInteractWith)) exitWith {
         _wheel = _x;
     };
 } forEach nearestObjects [_unit, ["ACE_Wheel"], 5];
diff --git a/addons/repair/functions/fnc_repair.sqf b/addons/repair/functions/fnc_repair.sqf
index 8fa7f498bd..4fa1c2d903 100644
--- a/addons/repair/functions/fnc_repair.sqf
+++ b/addons/repair/functions/fnc_repair.sqf
@@ -177,7 +177,7 @@ _processText = getText (_config >> "displayNameProgress");
     DFUNC(repair_failure),
     _text,
     _callbackProgress,
-    []
+    ["isNotOnLadder"]
 ] call EFUNC(common,progressBar);
 
 // Display Icon