Fixed #1893 - Menu closes when patient is more as 10 meters away

This commit is contained in:
Glowbal 2015-08-09 09:14:42 +02:00
parent 58fc69c2a6
commit 3cac137851
3 changed files with 16 additions and 0 deletions

View File

@ -13,6 +13,7 @@
*/
#include "script_component.hpp"
#define MAX_DISTANCE 10
// Exit for basic medical
if (GVAR(level) < 2) exitWith {};
@ -39,6 +40,11 @@ if (_show) then {
if (GVAR(displayPatientInformationTarget) != _target || GVAR(currentSelectedSelectionN) != _selectionN) exitwith {
[_this select 1] call CBA_fnc_removePerFrameHandler;
};
if (ACE_player distance _target > MAX_DISTANCE) exitwith {
("ACE_MedicalRscDisplayInformation" call BIS_fnc_rscLayer) cutText ["","PLAIN"];
[_this select 1] call CBA_fnc_removePerFrameHandler;
["displayTextStructured", [ACE_player], [[LSTRING(DistanceToFar), [_target] call EFUNC(common,getName)], 1.75, ACE_player]] call EFUNC(common,targetEvent);
};
disableSerialization;
_display = uiNamespace getvariable QGVAR(DisplayInformation);

View File

@ -3609,5 +3609,8 @@
<Spanish>Médico</Spanish>
<Hungarian>Orvosi</Hungarian>
</Key>
<Key ID="STR_ACE_Medical_DistanceToFar">
<English>Distance to %1 has become to far for treatment</English>
</Key>
</Package>
</Project>

View File

@ -14,6 +14,7 @@
* Public: No
*/
#include "script_component.hpp"
#define MAX_DISTANCE 10
private "_target";
@ -72,6 +73,12 @@ setMousePosition [0.4, 0.4];
_status = [GVAR(INTERACTION_TARGET)] call FUNC(getTriageStatus);
(_display displayCtrl 2000) ctrlSetText (_status select 0);
(_display displayCtrl 2000) ctrlSetBackgroundColor (_status select 2);
if (ACE_player distance _target > MAX_DISTANCE) exitwith {
closeDialog 314412;
["displayTextStructured", [ACE_player], [[ELSTRING(medical,DistanceToFar), [_target] call EFUNC(common,getName)], 1.75, ACE_player]] call EFUNC(common,targetEvent);
};
}, [_display]] call BIS_fnc_addStackedEventHandler;
["Medical_onMenuOpen", [ACE_player, _interactionTarget]] call EFUNC(common,localEvent);