mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
New Function to Show BIS Style Curator Messages (#4844)
* Add showMessage fnc that shows BIS curator messages * Add documentation * Make function simpler * Modify to fir new syntax * Handle non-string args
This commit is contained in:
parent
512592b79d
commit
3aa55b1452
@ -20,6 +20,7 @@ PREP(moduleSurrender);
|
||||
PREP(moduleTeleportPlayers);
|
||||
PREP(moduleUnconscious);
|
||||
PREP(moduleZeusSettings);
|
||||
PREP(showMessage);
|
||||
PREP(ui_attributeCargo);
|
||||
//PREP(ui_attributePosition);
|
||||
PREP(ui_attributeRadius);
|
||||
|
@ -19,27 +19,27 @@ params ["_logic", "_units", "_activated"];
|
||||
if !(_activated && {local _logic}) exitWith {};
|
||||
|
||||
if !(["ace_fastroping"] call EFUNC(common,isModLoaded)) then {
|
||||
[LSTRING(RequiresAddon)] call EFUNC(common,displayTextStructured);
|
||||
[LSTRING(RequiresAddon)] call FUNC(showMessage);
|
||||
} else {
|
||||
(GETMVAR(BIS_fnc_curatorObjectPlaced_mouseOver,[""])) params ["_mouseOverType", "_mouseOverUnit"];
|
||||
|
||||
if (_mouseOverType != "OBJECT") then {
|
||||
[LSTRING(NothingSelected)] call EFUNC(common,displayTextStructured);
|
||||
[LSTRING(NothingSelected)] call FUNC(showMessage);
|
||||
} else {
|
||||
if !(alive _mouseOverUnit) then {
|
||||
[LSTRING(OnlyAlive)] call EFUNC(common,displayTextStructured);
|
||||
[LSTRING(OnlyAlive)] call FUNC(showMessage);
|
||||
} else {
|
||||
private _config = configFile >> "CfgVehicles" >> typeOf _mouseOverUnit;
|
||||
private _displayName = getText (_config >> "displayName");
|
||||
if !(isNumber (_config >> QEGVAR(fastroping,enabled))) then {
|
||||
[[LSTRING(NotFastRopeCompatible), _displayName]] call EFUNC(common,displayTextStructured);
|
||||
[LSTRING(NotFastRopeCompatible), _displayName] call FUNC(showMessage);
|
||||
} else {
|
||||
private _fries = GETVAR(_mouseOverUnit,EGVAR(fastroping,FRIES),objNull);
|
||||
if (isNull _fries) then {
|
||||
[QGVAR(equipFries), [_mouseOverUnit]] call CBA_fnc_serverEvent;
|
||||
} else {
|
||||
if ([_mouseOverUnit] call EFUNC(fastroping,canCutRopes)) then {
|
||||
[[LSTRING(CantRemoveFRIES), _displayName]] call EFUNC(common,displayTextStructured);
|
||||
[LSTRING(CantRemoveFRIES), _displayName] call FUNC(showMessage);
|
||||
} else {
|
||||
[_mouseOverUnit] call EFUNC(fastroping,cutRopes);
|
||||
deleteVehicle _fries;
|
||||
|
@ -19,18 +19,18 @@ params ["_logic", "_units", "_activated"];
|
||||
if !(_activated && local _logic) exitWith {};
|
||||
|
||||
if !(["ace_cargo"] call EFUNC(common,isModLoaded) && ["ace_repair"] call EFUNC(common,isModLoaded)) then {
|
||||
[LSTRING(RequiresAddon)] call EFUNC(common,displayTextStructured);
|
||||
[LSTRING(RequiresAddon)] call FUNC(showMessage);
|
||||
} else {
|
||||
(GETMVAR(bis_fnc_curatorObjectPlaced_mouseOver,[""])) params ["_mouseOverType", "_mouseOverUnit"];
|
||||
|
||||
if (_mouseOverType != "OBJECT") then {
|
||||
[LSTRING(NothingSelected)] call EFUNC(common,displayTextStructured);
|
||||
[LSTRING(NothingSelected)] call FUNC(showMessage);
|
||||
} else {
|
||||
if !(alive _mouseOverUnit) then {
|
||||
[LSTRING(OnlyAlive)] call EFUNC(common,displayTextStructured);
|
||||
[LSTRING(OnlyAlive)] call FUNC(showMessage);
|
||||
} else {
|
||||
if (getNumber (configFile >> "CfgVehicles" >> "ACE_Track" >> QEGVAR(cargo,size)) > [_mouseOverUnit] call EFUNC(cargo,getCargoSpaceLeft)) then {
|
||||
[LSTRING(OnlyEnoughCargoSpace)] call EFUNC(common,displayTextStructured);
|
||||
[LSTRING(OnlyEnoughCargoSpace)] call FUNC(showMessage);
|
||||
} else {
|
||||
["ace_addCargo", ["ACE_Track", _mouseOverUnit, 1, true]] call CBA_fnc_localEvent;
|
||||
};
|
||||
|
@ -19,18 +19,18 @@ params ["_logic", "_units", "_activated"];
|
||||
if !(_activated && local _logic) exitWith {};
|
||||
|
||||
if !(["ace_cargo"] call EFUNC(common,isModLoaded) && ["ace_repair"] call EFUNC(common,isModLoaded)) then {
|
||||
[LSTRING(RequiresAddon)] call EFUNC(common,displayTextStructured);
|
||||
[LSTRING(RequiresAddon)] call FUNC(showMessage);
|
||||
} else {
|
||||
(GETMVAR(bis_fnc_curatorObjectPlaced_mouseOver,[""])) params ["_mouseOverType", "_mouseOverUnit"];
|
||||
|
||||
if (_mouseOverType != "OBJECT") then {
|
||||
[LSTRING(NothingSelected)] call EFUNC(common,displayTextStructured);
|
||||
[LSTRING(NothingSelected)] call FUNC(showMessage);
|
||||
} else {
|
||||
if !(alive _mouseOverUnit) then {
|
||||
[LSTRING(OnlyAlive)] call EFUNC(common,displayTextStructured);
|
||||
[LSTRING(OnlyAlive)] call FUNC(showMessage);
|
||||
} else {
|
||||
if (getNumber (configFile >> "CfgVehicles" >> "ACE_Wheel" >> QEGVAR(cargo,size)) > [_mouseOverUnit] call EFUNC(cargo,getCargoSpaceLeft)) then {
|
||||
[LSTRING(OnlyEnoughCargoSpace)] call EFUNC(common,displayTextStructured);
|
||||
[LSTRING(OnlyEnoughCargoSpace)] call FUNC(showMessage);
|
||||
} else {
|
||||
["ace_addCargo", ["ACE_Wheel", _mouseOverUnit, 1, true]] call CBA_fnc_localEvent;
|
||||
};
|
||||
|
@ -21,20 +21,20 @@ private ["_mouseOver", "_unit", "_captive"];
|
||||
if !(_activated && local _logic) exitWith {};
|
||||
|
||||
if (isNil QEFUNC(captives,setHandcuffed)) then {
|
||||
[LSTRING(RequiresAddon)] call EFUNC(common,displayTextStructured);
|
||||
[LSTRING(RequiresAddon)] call FUNC(showMessage);
|
||||
} else {
|
||||
_mouseOver = GETMVAR(bis_fnc_curatorObjectPlaced_mouseOver,[""]);
|
||||
|
||||
if ((_mouseOver select 0) != "OBJECT") then {
|
||||
[LSTRING(NothingSelected)] call EFUNC(common,displayTextStructured);
|
||||
[LSTRING(NothingSelected)] call FUNC(showMessage);
|
||||
} else {
|
||||
_unit = effectivecommander (_mouseOver select 1);
|
||||
|
||||
if !(_unit isKindOf "CAManBase") then {
|
||||
[LSTRING(OnlyInfantry)] call EFUNC(common,displayTextStructured);
|
||||
[LSTRING(OnlyInfantry)] call FUNC(showMessage);
|
||||
} else {
|
||||
if !(alive _unit) then {
|
||||
[LSTRING(OnlyAlive)] call EFUNC(common,displayTextStructured);
|
||||
[LSTRING(OnlyAlive)] call FUNC(showMessage);
|
||||
} else {
|
||||
_captive = GETVAR(_unit,EGVAR(captives,isHandcuffed),false);
|
||||
// Event initalized by ACE_Captives
|
||||
|
@ -27,7 +27,7 @@ scopeName "Main";
|
||||
private _fnc_errorAndClose = {
|
||||
params ["_msg"];
|
||||
deleteVehicle _logic;
|
||||
[_msg] call EFUNC(common,displayTextStructured);
|
||||
[_msg] call FUNC(showMessage);
|
||||
breakOut "Main";
|
||||
};
|
||||
|
||||
|
@ -21,23 +21,23 @@ private ["_mouseOver", "_unit", "_medicN"];
|
||||
if !(_activated && local _logic) exitWith {};
|
||||
|
||||
if !(["ACE_Medical"] call EFUNC(common,isModLoaded)) then {
|
||||
[LSTRING(RequiresAddon)] call EFUNC(common,displayTextStructured);
|
||||
[LSTRING(RequiresAddon)] call FUNC(showMessage);
|
||||
} else {
|
||||
_mouseOver = GETMVAR(bis_fnc_curatorObjectPlaced_mouseOver,[""]);
|
||||
|
||||
if ((_mouseOver select 0) != "OBJECT") then {
|
||||
[LSTRING(NothingSelected)] call EFUNC(common,displayTextStructured);
|
||||
[LSTRING(NothingSelected)] call FUNC(showMessage);
|
||||
} else {
|
||||
_unit = effectivecommander (_mouseOver select 1);
|
||||
|
||||
if !(_unit isKindOf "CAManBase") then {
|
||||
[LSTRING(OnlyInfantry)] call EFUNC(common,displayTextStructured);
|
||||
[LSTRING(OnlyInfantry)] call FUNC(showMessage);
|
||||
} else {
|
||||
if !(alive _unit) then {
|
||||
[LSTRING(OnlyAlive)] call EFUNC(common,displayTextStructured);
|
||||
[LSTRING(OnlyAlive)] call FUNC(showMessage);
|
||||
} else {
|
||||
if (GETVAR(_unit,EGVAR(captives,isHandcuffed),false)) then {
|
||||
[LSTRING(OnlyNonCaptive)] call EFUNC(common,displayTextStructured);
|
||||
[LSTRING(OnlyNonCaptive)] call FUNC(showMessage);
|
||||
} else {
|
||||
_medicN = GETVAR(_unit,EGVAR(medical,medicClass),0);
|
||||
if (_medicN < 1) then {
|
||||
|
@ -21,23 +21,23 @@ private ["_mouseOver", "_unit"];
|
||||
if !(_activated && local _logic) exitWith {};
|
||||
|
||||
if !(["ACE_Medical"] call EFUNC(common,isModLoaded)) then {
|
||||
[LSTRING(RequiresAddon)] call EFUNC(common,displayTextStructured);
|
||||
[LSTRING(RequiresAddon)] call FUNC(showMessage);
|
||||
} else {
|
||||
_mouseOver = GETMVAR(bis_fnc_curatorObjectPlaced_mouseOver,[""]);
|
||||
|
||||
if ((_mouseOver select 0) != "OBJECT") then {
|
||||
[LSTRING(NothingSelected)] call EFUNC(common,displayTextStructured);
|
||||
[LSTRING(NothingSelected)] call FUNC(showMessage);
|
||||
} else {
|
||||
_unit = (_mouseOver select 1);
|
||||
|
||||
if (_unit isKindOf "Man" || {!(_unit isKindOf "Building")}) then {
|
||||
[LSTRING(OnlyStructures)] call EFUNC(common,displayTextStructured);
|
||||
[LSTRING(OnlyStructures)] call FUNC(showMessage);
|
||||
} else {
|
||||
if !(alive _unit) then {
|
||||
[LSTRING(OnlyAlive)] call EFUNC(common,displayTextStructured);
|
||||
[LSTRING(OnlyAlive)] call FUNC(showMessage);
|
||||
} else {
|
||||
if (GETVAR(_unit,EGVAR(captives,isHandcuffed),false)) then {
|
||||
[LSTRING(OnlyNonCaptive)] call EFUNC(common,displayTextStructured);
|
||||
[LSTRING(OnlyNonCaptive)] call FUNC(showMessage);
|
||||
} else {
|
||||
if (!(GETVAR(_unit,EGVAR(medical,isMedicalFacility),false))) then {
|
||||
_unit setVariable [QEGVAR(medical,isMedicalFacility), true, true];
|
||||
|
@ -21,23 +21,23 @@ private ["_mouseOver", "_unit", "_medicN"];
|
||||
if !(_activated && local _logic) exitWith {};
|
||||
|
||||
if !(["ACE_Medical"] call EFUNC(common,isModLoaded)) then {
|
||||
[LSTRING(RequiresAddon)] call EFUNC(common,displayTextStructured);
|
||||
[LSTRING(RequiresAddon)] call FUNC(showMessage);
|
||||
} else {
|
||||
_mouseOver = GETMVAR(bis_fnc_curatorObjectPlaced_mouseOver,[""]);
|
||||
|
||||
if ((_mouseOver select 0) != "OBJECT") then {
|
||||
[LSTRING(NothingSelected)] call EFUNC(common,displayTextStructured);
|
||||
[LSTRING(NothingSelected)] call FUNC(showMessage);
|
||||
} else {
|
||||
_unit = (_mouseOver select 1);
|
||||
|
||||
if (_unit isKindOf "Man" || {_unit isKindOf "Building"}) then {
|
||||
[LSTRING(OnlyVehicles)] call EFUNC(common,displayTextStructured);
|
||||
[LSTRING(OnlyVehicles)] call FUNC(showMessage);
|
||||
} else {
|
||||
if !(alive _unit) then {
|
||||
[LSTRING(OnlyAlive)] call EFUNC(common,displayTextStructured);
|
||||
[LSTRING(OnlyAlive)] call FUNC(showMessage);
|
||||
} else {
|
||||
if (GETVAR(_unit,EGVAR(captives,isHandcuffed),false)) then {
|
||||
[LSTRING(OnlyNonCaptive)] call EFUNC(common,displayTextStructured);
|
||||
[LSTRING(OnlyNonCaptive)] call FUNC(showMessage);
|
||||
} else {
|
||||
_medicN = GETVAR(_unit,EGVAR(medical,medicClass),0);
|
||||
if (_medicN < 1) then {
|
||||
|
@ -19,7 +19,7 @@ if !(local _logic) exitWith {};
|
||||
|
||||
private _object = attachedTo _logic;
|
||||
if (isNull _object) then {
|
||||
[LSTRING(NothingSelected)] call EFUNC(common,displayTextStructured);
|
||||
[LSTRING(NothingSelected)] call FUNC(showMessage);
|
||||
} else {
|
||||
[QEGVAR(common,enableSimulationGlobal), [_object, !(simulationEnabled _object)]] call CBA_fnc_serverEvent;
|
||||
};
|
||||
|
@ -21,23 +21,23 @@ private ["_mouseOver", "_unit", "_surrendering"];
|
||||
if !(_activated && local _logic) exitWith {};
|
||||
|
||||
if (isNil QEFUNC(captives,setSurrendered)) then {
|
||||
[LSTRING(RequiresAddon)] call EFUNC(common,displayTextStructured);
|
||||
[LSTRING(RequiresAddon)] call FUNC(showMessage);
|
||||
} else {
|
||||
_mouseOver = GETMVAR(bis_fnc_curatorObjectPlaced_mouseOver,[""]);
|
||||
|
||||
if ((_mouseOver select 0) != "OBJECT") then {
|
||||
[LSTRING(NothingSelected)] call EFUNC(common,displayTextStructured);
|
||||
[LSTRING(NothingSelected)] call FUNC(showMessage);
|
||||
} else {
|
||||
_unit = effectivecommander (_mouseOver select 1);
|
||||
|
||||
if !(_unit isKindOf "CAManBase") then {
|
||||
[LSTRING(OnlyInfantry)] call EFUNC(common,displayTextStructured);
|
||||
[LSTRING(OnlyInfantry)] call FUNC(showMessage);
|
||||
} else {
|
||||
if !(alive _unit) then {
|
||||
[LSTRING(OnlyAlive)] call EFUNC(common,displayTextStructured);
|
||||
[LSTRING(OnlyAlive)] call FUNC(showMessage);
|
||||
} else {
|
||||
if (GETVAR(_unit,EGVAR(captives,isHandcuffed),false)) then {
|
||||
[LSTRING(OnlyNonCaptive)] call EFUNC(common,displayTextStructured);
|
||||
[LSTRING(OnlyNonCaptive)] call FUNC(showMessage);
|
||||
} else {
|
||||
_surrendering = GETVAR(_unit,EGVAR(captives,isSurrendering),false);
|
||||
// Event initalized by ACE_Captives
|
||||
|
@ -21,20 +21,20 @@ private ["_mouseOver", "_unit", "_conscious"];
|
||||
if !(_activated && local _logic) exitWith {};
|
||||
|
||||
if (isNil QEFUNC(medical,setUnconscious)) then {
|
||||
[LSTRING(RequiresAddon)] call EFUNC(common,displayTextStructured);
|
||||
[LSTRING(RequiresAddon)] call FUNC(showMessage);
|
||||
} else {
|
||||
_mouseOver = GETMVAR(bis_fnc_curatorObjectPlaced_mouseOver,[""]);
|
||||
|
||||
if ((_mouseOver select 0) != "OBJECT") then {
|
||||
[LSTRING(NothingSelected)] call EFUNC(common,displayTextStructured);
|
||||
[LSTRING(NothingSelected)] call FUNC(showMessage);
|
||||
} else {
|
||||
_unit = effectivecommander (_mouseOver select 1);
|
||||
|
||||
if !(_unit isKindOf "CAManBase") then {
|
||||
[LSTRING(OnlyInfantry)] call EFUNC(common,displayTextStructured);
|
||||
[LSTRING(OnlyInfantry)] call FUNC(showMessage);
|
||||
} else {
|
||||
if !(alive _unit) then {
|
||||
[LSTRING(OnlyAlive)] call EFUNC(common,displayTextStructured);
|
||||
[LSTRING(OnlyAlive)] call FUNC(showMessage);
|
||||
} else {
|
||||
_conscious = GETVAR(_unit,ACE_isUnconscious,false);
|
||||
// Function handles locality for me
|
||||
|
24
addons/zeus/functions/fnc_showMessage.sqf
Normal file
24
addons/zeus/functions/fnc_showMessage.sqf
Normal file
@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Author: 654wak654
|
||||
* Shows a zeus message through the BIS function, handles localization.
|
||||
* If multiple args are given, they get formatted.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: The message <STRING>
|
||||
* N: Anything <ANY><OPTIONAL>
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* ["something"] call ace_zeus_fnc_showMessage
|
||||
* ["something %1 in %2", "strange", getPos neighborhood] call ace_zeus_fnc_showMessage
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
if (!(_this isEqualTypeParams [""])) exitWith {ERROR_1("First arg must be string [%1]",_this);};
|
||||
|
||||
private _message = _this apply {if ((_x isEqualType "") && {isLocalized _x}) then {localize _x} else {_x}};
|
||||
[objNull, format _message] call BIS_fnc_showCuratorFeedbackMessage;
|
@ -28,7 +28,7 @@ private _fnc_errorAndClose = {
|
||||
params ["_msg"];
|
||||
_display closeDisplay 0;
|
||||
deleteVehicle _logic;
|
||||
[_msg] call EFUNC(common,displayTextStructured);
|
||||
[_msg] call FUNC(showMessage);
|
||||
breakOut "Main";
|
||||
};
|
||||
|
||||
|
@ -33,7 +33,7 @@ private _fnc_errorAndClose = {
|
||||
params ["_msg"];
|
||||
_display closeDisplay 0;
|
||||
deleteVehicle _logic;
|
||||
[_msg] call EFUNC(common,displayTextStructured);
|
||||
[_msg] call FUNC(showMessage);
|
||||
breakOut "Main";
|
||||
};
|
||||
|
||||
|
@ -28,7 +28,7 @@ private _fnc_errorAndClose = {
|
||||
params ["_msg"];
|
||||
_display closeDisplay 0;
|
||||
deleteVehicle _logic;
|
||||
[_msg] call EFUNC(common,displayTextStructured);
|
||||
[_msg] call FUNC(showMessage);
|
||||
breakOut "Main";
|
||||
};
|
||||
|
||||
|
@ -28,7 +28,7 @@ private _fnc_errorAndClose = {
|
||||
params ["_msg"];
|
||||
_display closeDisplay 0;
|
||||
deleteVehicle _logic;
|
||||
[_msg] call EFUNC(common,displayTextStructured);
|
||||
[_msg] call FUNC(showMessage);
|
||||
breakOut "Main";
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user