mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge pull request #2510 from acemod/commoncleanup5
common code cleanup part 5
This commit is contained in:
commit
6ee5c6d9f8
@ -132,7 +132,6 @@ PREP(loadSettingsLocalizedText);
|
||||
PREP(map);
|
||||
PREP(moduleCheckPBOs);
|
||||
PREP(moduleLSDVehicles);
|
||||
PREP(moveToTempGroup);
|
||||
PREP(muteUnit);
|
||||
PREP(muteUnitHandleInitPost);
|
||||
PREP(muteUnitHandleRespawn);
|
||||
@ -145,7 +144,6 @@ PREP(player);
|
||||
PREP(playerSide);
|
||||
PREP(positionToASL);
|
||||
PREP(progressBar);
|
||||
PREP(queueAnimation);
|
||||
PREP(readSettingFromModule);
|
||||
PREP(receiveRequest);
|
||||
PREP(removeCanInteractWithCondition);
|
||||
|
@ -10,6 +10,8 @@
|
||||
*
|
||||
* Return Value:
|
||||
* ID of the action (used to remove it later) <NUMBER>
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
*
|
||||
* Return Value:
|
||||
* ID of the action (used to remove it later) <NUMBER>
|
||||
*
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
@ -29,13 +29,7 @@ _defaultLogDisplayLevel = [GVAR(LOGDISPLAY_LEVEL), DEFAULT_TEXT_DISPLAY] select
|
||||
if (_level <= _defaultLoglevel) then {
|
||||
private ["_prefix", "_message"];
|
||||
|
||||
switch (_level) do {
|
||||
case 0: {_prefix = "Error"};
|
||||
case 1: {_prefix = "Warn"};
|
||||
case 2: {_prefix = "Debug"};
|
||||
case 3: {_prefix = "Info"};
|
||||
default {_prefix = "Unknown"};
|
||||
};
|
||||
_prefix = ["Unknown", "Error", "Warn", "Debug", "Info"] select ([0, 1, 2, 3] find _level + 1);
|
||||
|
||||
_message = format ["[ACE %1] %2", _prefix, _msg];
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
/*
|
||||
* Author: KoffeinFlummi, commy2
|
||||
*
|
||||
* Applies given code to every element in an array, LIKE SOMETHING SQF SHOULD HAVE BY DEFAULT.
|
||||
*
|
||||
* Arguments:
|
||||
@ -12,18 +11,15 @@
|
||||
*
|
||||
* Usage:
|
||||
* [["2", "gobblecock", "25"], {parseNumber _this}] call FUNC(map) ==> [2, 0, 25]
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_array", "_code"];
|
||||
params ["_array", "_code"];
|
||||
|
||||
_array = + _this select 0;
|
||||
_code = _this select 1;
|
||||
|
||||
if (isNil "_array") exitWith {
|
||||
ACE_LOGERROR_1("No array for function map in %1.",_fnc_scriptNameParent);
|
||||
[]
|
||||
};
|
||||
// copy array to not alter the original one
|
||||
_array = + _array;
|
||||
|
||||
{
|
||||
_array set [_forEachIndex, _x call _code];
|
||||
|
@ -9,12 +9,14 @@
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
if !(isServer) exitWith {};
|
||||
|
||||
PARAMS_3(_logic,_units,_activated);
|
||||
params ["_logic", "_units", "_activated"];
|
||||
|
||||
if !(_activated) exitWith {};
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Author: KoffeinFlummi
|
||||
* Author: KoffeinFlummi, joko // Jonas
|
||||
*
|
||||
* Nothing to see here, move along.
|
||||
*
|
||||
@ -8,40 +8,53 @@
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_3(_logic,_units,_activated);
|
||||
|
||||
private["_colors", "_hSCount", "_hiddenSelections", "_i", "_index", "_vehicle"];
|
||||
params ["", "_units", "_activated"];
|
||||
|
||||
if !(_activated) exitWith {};
|
||||
|
||||
if (isNil QGVAR(LSD_Vehicles)) then {
|
||||
GVAR(LSD_Vehicles) = [];
|
||||
};
|
||||
|
||||
{
|
||||
_hiddenSelections = count (getArray (configFile >> "CfgVehicles" >> (typeOf _x) >> "hiddenSelections"));
|
||||
if (_hiddenSelections > 0) then {
|
||||
nul = [_x, _hiddenSelections] spawn {
|
||||
_vehicle = _this select 0;
|
||||
_hSCount = _this select 1;
|
||||
_colors = [
|
||||
"#(argb,8,8,3)color(1,0,0,1,co)",
|
||||
"#(argb,8,8,3)color(1,0.5,0,1,co)",
|
||||
"#(argb,8,8,3)color(1,1,0,1,co)",
|
||||
"#(argb,8,8,3)color(0,1,0,1,co)",
|
||||
"#(argb,8,8,3)color(0,0,1,1,co)",
|
||||
"#(argb,8,8,3)color(0.2,0,0.5,1,co)",
|
||||
"#(argb,8,8,3)color(0.5,0,1,1,co)"
|
||||
];
|
||||
_index = 0;
|
||||
while {True} do {
|
||||
for "_i" from 0 to (_hSCount - 1) do {
|
||||
_vehicle setObjectTexture [_i, (_colors select _index)];
|
||||
};
|
||||
_index = (_index + 1) % 7;
|
||||
sleep 0.02;
|
||||
};
|
||||
};
|
||||
_hSCount = count (getArray (configFile >> "CfgVehicles" >> typeOf _x >> "hiddenSelections"));
|
||||
if (_hSCount > 0) then {
|
||||
GVAR(LSD_Vehicles) pushBack [_x, _hSCount];
|
||||
};
|
||||
nil
|
||||
} count _units;
|
||||
|
||||
ACE_LOGINFO("WEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE.");
|
||||
if (isNil QGVAR(LSD_Colors)) then {
|
||||
GVAR(LSD_Colors) = [
|
||||
"#(argb,8,8,3)color(1,0,0,1,co)",
|
||||
"#(argb,8,8,3)color(1,0.5,0,1,co)",
|
||||
"#(argb,8,8,3)color(1,1,0,1,co)",
|
||||
"#(argb,8,8,3)color(0,1,0,1,co)",
|
||||
"#(argb,8,8,3)color(0,0,1,1,co)",
|
||||
"#(argb,8,8,3)color(0.2,0,0.5,1,co)",
|
||||
"#(argb,8,8,3)color(0.5,0,1,1,co)"
|
||||
];
|
||||
};
|
||||
|
||||
if (isNil QGVAR(LSD_PFH)) then {
|
||||
GVAR(LSD_PFH) = [{
|
||||
(_this select 0) params ["_index"];
|
||||
{
|
||||
_x params ["_vehicle", "_hSCount"];
|
||||
for "_i" from 0 to (_hSCount - 1) do {
|
||||
_vehicle setObjectTexture [_i, GVAR(LSD_Colors) select _index];
|
||||
};
|
||||
nil
|
||||
} count GVAR(LSD_Vehicles);
|
||||
|
||||
_index = ((_index + 1) % 7) mod count GVAR(LSD_Colors);
|
||||
(_this select 0) set [0, _index];
|
||||
|
||||
}, 0.02, [0]] call CBA_fnc_addPerFrameHandler;
|
||||
};
|
||||
ACE_LOGINFO("WEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEED.");
|
||||
|
@ -1,6 +1,5 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
*
|
||||
* hint retun value of given function every frame
|
||||
*
|
||||
* Argument:
|
||||
|
@ -1,32 +0,0 @@
|
||||
/**
|
||||
* fn_moveToTempGroup_f.sqf
|
||||
* Moves a unit into a temporarly group and stores its original group to allow rejoining.
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: [unit OBJECT, moveToTempGroup BOOL]
|
||||
* @Return: void
|
||||
* @PublicAPI: false
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit","_moveTo","_previousGroup","_newGroup", "_currentGroup"];
|
||||
_unit = [_this, 0,ObjNull,[ObjNull]] call BIS_fnc_Param;
|
||||
_moveTo = [_this, 1,false,[false]] call BIS_fnc_Param;
|
||||
|
||||
if (_moveTo) then {
|
||||
_previousGroup = group _unit;
|
||||
_newGroup = createGroup (side _previousGroup);
|
||||
[_unit] joinSilent _newGroup;
|
||||
_unit setvariable [QGVAR(previousGroup),_previousGroup];
|
||||
} else {
|
||||
_previousGroup = _unit getvariable QGVAR(previousGroup);
|
||||
if (!isnil "_previousGroup") then {
|
||||
_currentGroup = group _unit;
|
||||
_unit setvariable [QGVAR(previousGroup),nil];
|
||||
[_unit] joinSilent _previousGroup;
|
||||
if (count units _currentGroup == 0) then {
|
||||
deleteGroup _currentGroup;
|
||||
};
|
||||
};
|
||||
};
|
@ -1,23 +1,25 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
*
|
||||
* Mutes the unit. It won't trigger auto generated chat messages either.
|
||||
*
|
||||
* Argument:
|
||||
* 0: Unit (Object)
|
||||
* 1: Reason to mute the unit (String)
|
||||
* Arguments:
|
||||
* 0: Unit <OBJECT>
|
||||
* 1: Reason to mute the unit <STRING>
|
||||
*
|
||||
* Return value:
|
||||
* Nothing
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_2(_unit,_reason);
|
||||
params ["_unit", "_reason"];
|
||||
|
||||
if (isNull _unit) exitWith {};
|
||||
|
||||
private ["_muteUnitReasons", "_speaker"];
|
||||
|
||||
// add reason to mute to the unit
|
||||
private "_muteUnitReasons";
|
||||
_muteUnitReasons = _unit getVariable [QGVAR(muteUnitReasons), []];
|
||||
|
||||
if !(_reason in _muteUnitReasons) then {
|
||||
@ -25,7 +27,6 @@ if !(_reason in _muteUnitReasons) then {
|
||||
_unit setVariable [QGVAR(muteUnitReasons), _muteUnitReasons, true];
|
||||
};
|
||||
|
||||
private "_speaker";
|
||||
_speaker = speaker _unit;
|
||||
|
||||
if (_speaker == "ACE_NoVoice") exitWith {};
|
||||
|
@ -1,7 +1,18 @@
|
||||
// by commy2
|
||||
/*
|
||||
* Author: commy2
|
||||
* Applies speaker changes on init post. Used because setSpeaker is broken on init.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: unit <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_1(_unit);
|
||||
params ["_unit"];
|
||||
|
||||
// setSpeaker gets overwritten after init on remote units; if unit is muted, setSpeaker again
|
||||
if (count (_unit getVariable [QGVAR(muteUnitReasons), []]) > 0) then {
|
||||
|
@ -1,7 +1,18 @@
|
||||
// by commy2
|
||||
/*
|
||||
* Author: commy2
|
||||
* Applies speaker changes on respawn. Used because speaker is respawning breaks the speaker on non-local clients. Also resets the public object variable (broken for JIP clients, that join after respawn)
|
||||
*
|
||||
* Arguments:
|
||||
* 0: unit <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_1(_unit);
|
||||
params ["_unit"];
|
||||
|
||||
// setVariable is broken on JIP after respawn
|
||||
_unit setVariable [QGVAR(muteUnitReasons), _unit getVariable [QGVAR(muteUnitReasons), []], true];
|
||||
|
@ -1,6 +1,5 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
*
|
||||
* Transforms a number to an array of the correspondending digits.
|
||||
*
|
||||
* Arguments:
|
||||
@ -8,7 +7,7 @@
|
||||
* 1: Set the minimal length of the returned array. Useful for getting left hand zeroes. <NUMBER>, optional
|
||||
*
|
||||
* Return Value:
|
||||
* Digits. The maximum count is six digits. (Array)
|
||||
* Digits. The maximum count is six digits. <ARRAY>
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
|
@ -1,6 +1,5 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
*
|
||||
* Transforms a number to an string of the correspondending digits.
|
||||
*
|
||||
* Arguments:
|
||||
@ -8,7 +7,7 @@
|
||||
* 1: Set the minimal length of the returned string. Useful for getting left hand zeroes. (Number, optional)
|
||||
*
|
||||
* Return Value:
|
||||
* Digits. The maximum length is six digits. (String)
|
||||
* Digits. The maximum length is six digits. <STRING>
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
|
@ -1,13 +1,12 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
*
|
||||
* Converts a number to a string without losing as much precission as str or format.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: A number <NUMBER>
|
||||
*
|
||||
* Return Value:
|
||||
* The number as string (String)
|
||||
* The number as string <STRING>
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
|
@ -1,19 +1,23 @@
|
||||
/**
|
||||
* fn_onAnswerRequest.sqf
|
||||
* @Descr: N/A
|
||||
* @Author: Glowbal
|
||||
/*
|
||||
* Author: Glowbal
|
||||
* N/A
|
||||
*
|
||||
* @Arguments: []
|
||||
* @Return:
|
||||
* @PublicAPI: false
|
||||
* Arguments:
|
||||
* ?
|
||||
*
|
||||
* Return Value:
|
||||
* ?
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_unit", "_id", "_accepted"];
|
||||
|
||||
private ["_requestID", "_info", "_callBack", "_caller", "_replyParams", "_requestMessage", "_target"];
|
||||
|
||||
PARAMS_3(_unit,_id,_accepted);
|
||||
|
||||
_info = _unit getvariable _id;
|
||||
|
||||
if (!isnil "_info") then {
|
||||
_caller = _info select 0;
|
||||
_target = _info select 1;
|
||||
@ -21,7 +25,7 @@ if (!isnil "_info") then {
|
||||
_requestMessage = _info select 3;
|
||||
_callBack = _info select 4;
|
||||
_replyParams = [_info, _accepted];
|
||||
[_replyParams, QUOTE(FUNC(requestCallback)), _caller, false] call FUNC(execRemoteFnc);
|
||||
[_replyParams, QFUNC(requestCallback), _caller, false] call FUNC(execRemoteFnc);
|
||||
_unit setvariable [_id, nil];
|
||||
};
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
* None
|
||||
*
|
||||
* Return Value:
|
||||
* current local side (Side)
|
||||
* current local side <SIDE>
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
|
@ -1,10 +1,9 @@
|
||||
/*
|
||||
* Author: commy2, Glowbal, PabstMirror
|
||||
*
|
||||
* Draw progress bar and execute given function if succesful.
|
||||
* Finish/Failure/Conditional are all passed [_args, _elapsedTime, _totalTime, _errorCode]
|
||||
*
|
||||
* Argument:
|
||||
* Arguments:
|
||||
* 0: NUMBER - Total Time (in game "ACE_time" seconds)
|
||||
* 1: ARRAY - Arguments, passed to condition, fail and finish
|
||||
* 2: CODE or STRING - On Finish: Code called or STRING raised as event.
|
||||
@ -13,26 +12,26 @@
|
||||
* 5: CODE - (Optional) Code to check each frame
|
||||
* 6: ARRAY - (Optional) Exceptions for checking EFUNC(common,canInteractWith)
|
||||
*
|
||||
* Return value:
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* [5, [], {Hint "Finished!"}, {hint "Failure!"}, "My Title"] call ace_common_fnc_progressBar
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_4(_totalTime,_args,_onFinish,_onFail);
|
||||
DEFAULT_PARAM(4,_localizedTitle,"");
|
||||
DEFAULT_PARAM(5,_condition,{true});
|
||||
DEFAULT_PARAM(6,_exceptions,[]);
|
||||
private ["_player", "_perFrameFunction", "_ctrlPos"];
|
||||
params ["_totalTime", "_args", "_onFinish", "_onFail", ["_localizedTitle", ""], ["_condition", {true}], ["_exceptions", []]];
|
||||
|
||||
private ["_player", "_ctrlPos", "_fnc_perFrameFunction"];
|
||||
|
||||
_player = ACE_player;
|
||||
|
||||
//Open Dialog and set the title
|
||||
closeDialog 0;
|
||||
createDialog QGVAR(ProgressBar_Dialog);
|
||||
|
||||
(uiNamespace getVariable QGVAR(ctrlProgressBarTitle)) ctrlSetText _localizedTitle;
|
||||
|
||||
//Adjust position based on user setting:
|
||||
@ -46,11 +45,9 @@ _ctrlPos set [1, ((0 + 29 * GVAR(SettingProgressBarLocation)) * ((((safezoneW /
|
||||
(uiNamespace getVariable QGVAR(ctrlProgressBarTitle)) ctrlSetPosition _ctrlPos;
|
||||
(uiNamespace getVariable QGVAR(ctrlProgressBarTitle)) ctrlCommit 0;
|
||||
|
||||
_fnc_perFrameFunction = {
|
||||
(_this select 0) params ["_args", "_onFinish", "_onFail", "_condition", "_player", "_startTime", "_totalTime", "_exceptions"];
|
||||
|
||||
|
||||
_perFrameFunction = {
|
||||
PARAMS_2(_parameters,_pfhID);
|
||||
EXPLODE_8_PVT(_parameters,_args,_onFinish,_onFail,_condition,_player,_startTime,_totalTime,_exceptions);
|
||||
private ["_elapsedTime", "_errorCode"];
|
||||
|
||||
_elapsedTime = ACE_time - _startTime;
|
||||
@ -63,10 +60,10 @@ _perFrameFunction = {
|
||||
if (ACE_player != _player || !alive _player) then {
|
||||
_errorCode = 2;
|
||||
} else {
|
||||
if (!([_args, _elapsedTime, _totalTime, _errorCode] call _condition)) then {
|
||||
if !([_args, _elapsedTime, _totalTime, _errorCode] call _condition) then {
|
||||
_errorCode = 3;
|
||||
} else {
|
||||
if (!([_player, objNull, _exceptions] call EFUNC(common,canInteractWith))) then {
|
||||
if !([_player, objNull, _exceptions] call EFUNC(common,canInteractWith)) then {
|
||||
_errorCode = 4;
|
||||
} else {
|
||||
if (_elapsedTime >= _totalTime) then {
|
||||
@ -84,16 +81,17 @@ _perFrameFunction = {
|
||||
if (!isNull (uiNamespace getVariable [QGVAR(ctrlProgressBar), controlNull])) then {
|
||||
closeDialog 0;
|
||||
};
|
||||
[_pfhID] call CBA_fnc_removePerFrameHandler;
|
||||
|
||||
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
||||
|
||||
if (_errorCode == 0) then {
|
||||
if ((typeName _onFinish) == (typeName "")) then {
|
||||
if (typeName _onFinish == "STRING") then {
|
||||
[_onFinish, [_args, _elapsedTime, _totalTime, _errorCode]] call FUNC(localEvent);
|
||||
} else {
|
||||
[_args, _elapsedTime, _totalTime, _errorCode] call _onFinish;
|
||||
};
|
||||
} else {
|
||||
if ((typeName _onFail) == (typeName "")) then {
|
||||
if (typeName _onFail == "STRING") then {
|
||||
[_onFail, [_args, _elapsedTime, _totalTime, _errorCode]] call FUNC(localEvent);
|
||||
} else {
|
||||
[_args, _elapsedTime, _totalTime, _errorCode] call _onFail;
|
||||
@ -105,4 +103,4 @@ _perFrameFunction = {
|
||||
};
|
||||
};
|
||||
|
||||
[_perFrameFunction, 0, [_args, _onFinish, _onFail, _condition, _player, ACE_time, _totalTime, _exceptions]] call CBA_fnc_addPerFrameHandler;
|
||||
[_fnc_perFrameFunction, 0, [_args, _onFinish, _onFail, _condition, _player, ACE_time, _totalTime, _exceptions]] call CBA_fnc_addPerFrameHandler;
|
||||
|
@ -1,10 +0,0 @@
|
||||
// by commy2
|
||||
#include "script_component.hpp"
|
||||
|
||||
terminate (missionNamespace getVariable [QGVAR(waitForAnimationHandle), scriptNull]);
|
||||
|
||||
GVAR(waitForAnimationHandle) = _this spawn {
|
||||
waitUntil {!([_this select 0] call FUNC(inTransitionAnim))};
|
||||
|
||||
_this call FUNC(doAnimation);
|
||||
};
|
@ -5,18 +5,20 @@
|
||||
* Must be called on the server, effect is global.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Module (Object)
|
||||
* 1: ACE_Parameter name (string)
|
||||
* 2: Module parameter name (string)
|
||||
* 0: Module <OBJECT>
|
||||
* 1: ACE_Parameter name <STRING>
|
||||
* 2: Module parameter name <STRING>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
if !(isServer) exitWith {};
|
||||
|
||||
PARAMS_3(_logic,_settingName,_moduleVariable);
|
||||
params ["_logic", "_settingName", "_moduleVariable"];
|
||||
|
||||
// Check if the parameter is defined in the module
|
||||
if (isNil {_logic getVariable _moduleVariable}) exitWith {
|
||||
|
@ -1,37 +1,41 @@
|
||||
/**
|
||||
* fn_recieveRequest.sqf
|
||||
* @Descr: N/A
|
||||
* @Author: Glowbal
|
||||
/*
|
||||
* Author: Glowbal
|
||||
* N/A
|
||||
*
|
||||
* @Arguments: []
|
||||
* @Return:
|
||||
* @PublicAPI: false
|
||||
* Arguments:
|
||||
* ?
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_5(_caller,_target,_requestID,_requestMessage,_callBack);
|
||||
params ["_caller", "_target", "_requestID", "_requestMessage", "_callBack"];
|
||||
|
||||
_requestID = ("ace_recieveRequest_f_id_"+_requestID);
|
||||
|
||||
_target setvariable [_requestID, _this];
|
||||
_target setVariable [_requestID, _this];
|
||||
|
||||
if (isLocalized _requestMessage) then {
|
||||
_requestMessage = format[localize _requestMessage,[_caller] call FUNC(getName)];
|
||||
_requestMessage = format [localize _requestMessage, [_caller] call FUNC(getName)];
|
||||
} else {
|
||||
_requestMessage = format[_requestMessage,[_caller] call FUNC(getName)];
|
||||
_requestMessage = format [_requestMessage, [_caller] call FUNC(getName)];
|
||||
};
|
||||
|
||||
hint format["%1",_requestMessage];
|
||||
if !(isnil QGVAR(RECIEVE_REQUEST_TIME_OUT_SCRIPT)) then {
|
||||
hint format ["%1", _requestMessage]; // @todo ?
|
||||
|
||||
if !(isNil QGVAR(RECIEVE_REQUEST_TIME_OUT_SCRIPT)) then {
|
||||
terminate GVAR(RECIEVE_REQUEST_TIME_OUT_SCRIPT);
|
||||
};
|
||||
|
||||
if (!isnil QGVAR(RECIEVE_REQUEST_ADD_ACTION_ACCEPT)) then {
|
||||
if (!isNil QGVAR(RECIEVE_REQUEST_ADD_ACTION_ACCEPT)) then {
|
||||
_target removeAction GVAR(RECIEVE_REQUEST_ADD_ACTION_ACCEPT);
|
||||
GVAR(RECIEVE_REQUEST_ADD_ACTION_ACCEPT) = nil;
|
||||
};
|
||||
if (!isnil QGVAR(RECIEVE_REQUEST_ADD_ACTION_DECLINE)) then {
|
||||
|
||||
if (!isNil QGVAR(RECIEVE_REQUEST_ADD_ACTION_DECLINE)) then {
|
||||
_target removeAction GVAR(RECIEVE_REQUEST_ADD_ACTION_DECLINE);
|
||||
GVAR(RECIEVE_REQUEST_ADD_ACTION_DECLINE) = nil;
|
||||
};
|
||||
@ -41,24 +45,31 @@ GVAR(RECIEVE_REQUEST_ADD_ACTION_DECLINE) = _target addAction ["Decline", compile
|
||||
|
||||
GVAR(RECIEVE_REQUEST_ID_KEY_BINDING) = _requestID;
|
||||
|
||||
GVAR(RECIEVE_REQUEST_TIME_OUT_SCRIPT) = [ACE_time, _target, _requestID] spawn {
|
||||
private["_id", "_t", "_requestID", "_target"];
|
||||
_t = (_this select 0) + 40;
|
||||
_target = _this select 1;
|
||||
_requestID = _this select 2;
|
||||
_id = _target getvariable _requestID;
|
||||
waituntil {
|
||||
_id = _target getvariable _requestID;
|
||||
GVAR(RECIEVE_REQUEST_TIME_OUT_SCRIPT) = [ACE_time, _target, _requestID] spawn { // @todo
|
||||
params ["_time", "_target", "_requestID"];
|
||||
|
||||
_time = _time + 40;
|
||||
|
||||
private "_id";
|
||||
_id = _target getVariable _requestID;
|
||||
|
||||
waituntil {
|
||||
_id = _target getVariable _requestID;
|
||||
|
||||
(ACE_time > _time || isNil "_id")
|
||||
};
|
||||
|
||||
_target setVariable [_requestID, nil];
|
||||
|
||||
(ACE_time > _t || isnil "_id")};
|
||||
_target setvariable [_requestID, nil];
|
||||
GVAR(RECIEVE_REQUEST_ID_KEY_BINDING) = nil;
|
||||
if (!isnil QGVAR(RECIEVE_REQUEST_ADD_ACTION_ACCEPT)) then {
|
||||
|
||||
if (!isNil QGVAR(RECIEVE_REQUEST_ADD_ACTION_ACCEPT)) then {
|
||||
_target removeAction GVAR(RECIEVE_REQUEST_ADD_ACTION_ACCEPT);
|
||||
GVAR(RECIEVE_REQUEST_ADD_ACTION_ACCEPT) = nil;
|
||||
};
|
||||
if (!isnil QGVAR(RECIEVE_REQUEST_ADD_ACTION_DECLINE)) then {
|
||||
|
||||
if (!isNil QGVAR(RECIEVE_REQUEST_ADD_ACTION_DECLINE)) then {
|
||||
_target removeAction GVAR(RECIEVE_REQUEST_ADD_ACTION_DECLINE);
|
||||
GVAR(RECIEVE_REQUEST_ADD_ACTION_DECLINE) = nil;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -1,34 +1,30 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
*
|
||||
* Remove an addAction event from a unit.
|
||||
*
|
||||
* Argument:
|
||||
* 0: Unit the action is assigned to (Object)
|
||||
* 1: Name of the action, e.g. "DefaultAction" (String)
|
||||
* 2: ID of the action (Number)
|
||||
* Arguments:
|
||||
* 0: Unit the action is assigned to <OBJECT>
|
||||
* 1: Name of the action, e.g. "DefaultAction" <STRING>
|
||||
* 2: ID of the action <NUMBER>
|
||||
*
|
||||
* Return value:
|
||||
* None.
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_name", "_actionsVar", "_actionID", "_actions", "_currentID", "_actionIDs"];
|
||||
|
||||
PARAMS_3(_unit,_action,_id);
|
||||
params ["_unit", "_action", "_id"];
|
||||
|
||||
if (_id == -1) exitWith {};
|
||||
|
||||
_name = format ["ACE_Action_%1", _action];
|
||||
private ["_name", "_actionsVar"];
|
||||
|
||||
_name = format ["ACE_Action_%1", _action];
|
||||
_actionsVar = _unit getVariable [_name, [-1, [-1, [], []], objNull]];
|
||||
|
||||
_actionID = _actionsVar select 0;
|
||||
_actions = _actionsVar select 1;
|
||||
|
||||
_currentID = _actions select 0;
|
||||
_actionIDs = _actions select 1;
|
||||
_actions = _actions select 2;
|
||||
_actionsVar params ["_actionID", "_actionsArray"];
|
||||
_actionsArray params ["_currentID", "_actionIDs", "_actions"];
|
||||
|
||||
if (_unit != _actionsVar select 2) exitWith {};
|
||||
|
||||
|
@ -1,39 +1,37 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
* Remove an addAction menu event from a unit.
|
||||
*
|
||||
* Remove an addAction event from a unit.
|
||||
* Arguments:
|
||||
* 0: Unit the action is assigned to <OBJECT>
|
||||
* 1: Name of the action, e.g. "DefaultAction" <STRING>
|
||||
* 2: ID of the action <NUMBER>
|
||||
*
|
||||
* Argument:
|
||||
* 0: Unit the action is assigned to (Object)
|
||||
* 1: Name of the action, e.g. "DefaultAction" (String)
|
||||
* 2: ID of the action (Number)
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Return value:
|
||||
* None.
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_name", "_actionsVar", "_currentID", "_actionIDs", "_actions", "_actionID", "_nameVar"];
|
||||
|
||||
PARAMS_3(_unit,_action,_id);
|
||||
params ["_unit", "_action", "_id"];
|
||||
|
||||
if (_id == -1) exitWith {};
|
||||
|
||||
_name = format ["ACE_ActionMenu_%1", _action];
|
||||
private ["_name", "_actionsVar"];
|
||||
|
||||
_name = format ["ACE_ActionMenu_%1", _action];
|
||||
_actionsVar = _unit getVariable [_name, [-1, [-1, [], []]]];
|
||||
|
||||
_currentID = _actionsVar select 0;
|
||||
_actionIDs = _actionsVar select 1;
|
||||
_actions = _actionsVar select 2;
|
||||
_actionsVar params ["_currentID", "_actionIDs", "_actions"];
|
||||
|
||||
_id = _actionIDs find _id;
|
||||
|
||||
if (_id == -1) exitWith {};
|
||||
|
||||
_action = _actions select _id;
|
||||
_actionID = _action select 0;
|
||||
_nameVar = _action select 1;
|
||||
|
||||
_action params ["_actionID", "_nameVar"];
|
||||
|
||||
missionNamespace setVariable [_nameVar, nil];
|
||||
|
||||
|
@ -1,21 +1,26 @@
|
||||
/*
|
||||
* Author: Nou
|
||||
*
|
||||
* Remove all events of a certain event type.
|
||||
*
|
||||
* Argument:
|
||||
* 0: Event name (string)
|
||||
* 0: Event name <STRING>
|
||||
*
|
||||
* Return value:
|
||||
* Nothing
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
private ["_eventNames", "_eventFunctions", "_eventIndex"];
|
||||
PARAMS_1(_eventName);
|
||||
|
||||
_eventNames = GVAR(events) select 0;
|
||||
params ["_eventName"];
|
||||
|
||||
GVAR(events) params ["_eventNames", "_events"];
|
||||
|
||||
private ["_eventFunctions", "_eventIndex"];
|
||||
|
||||
_eventFunctions = [];
|
||||
_eventIndex = _eventNames find _eventName;
|
||||
|
||||
if (_eventIndex != -1) then {
|
||||
(GVAR(events) select 1) set [_eventIndex, []];
|
||||
};
|
||||
_events set [_eventIndex, []];
|
||||
};
|
||||
|
@ -4,24 +4,23 @@
|
||||
* Remove a condition that gets checked by ace_common_fnc_canInteractWith.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: The conditions id. (String)
|
||||
* 0: The conditions id. <STRING>
|
||||
*
|
||||
* Return Value:
|
||||
* Unit can interact?
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private "_conditionName";
|
||||
params ["_conditionName"];
|
||||
|
||||
_conditionName = toLower (_this select 0);
|
||||
|
||||
private ["_conditions", "_conditionNames", "_conditionFuncs"];
|
||||
_conditionName = toLower _conditionName;
|
||||
|
||||
private "_conditions";
|
||||
_conditions = missionNamespace getVariable [QGVAR(InteractionConditions), [[],[]]];
|
||||
|
||||
_conditionNames = _conditions select 0;
|
||||
_conditionFuncs = _conditions select 1;
|
||||
_conditions params ["_conditionNames", "_conditionFuncs"];
|
||||
|
||||
private "_index";
|
||||
_index = _conditionNames find _conditionName;
|
||||
@ -31,4 +30,4 @@ if (_index == -1) exitWith {};
|
||||
_conditionNames deleteAt _index;
|
||||
_conditionFuncs deleteAt _index;
|
||||
|
||||
GVAR(InteractionConditions) = [_conditionNames, _conditionFuncs];
|
||||
GVAR(InteractionConditions) = _conditions;
|
||||
|
@ -1,25 +1,28 @@
|
||||
/*
|
||||
* Author: Nou
|
||||
*
|
||||
* Remove an event handler.
|
||||
*
|
||||
* Argument:
|
||||
* 0: Event name (string)
|
||||
* 1: Event code (number)
|
||||
* 0: Event name <STRING>
|
||||
* 1: Event code <NUMBER>
|
||||
*
|
||||
* Return value:
|
||||
* Nothing
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
private ["_eventNames", "_eventFunctions", "_eventIndex"];
|
||||
|
||||
PARAMS_2(_eventName,_eventCodeIndex);
|
||||
params ["_eventName", "_eventCodeIndex"];
|
||||
|
||||
GVAR(events) params ["_eventNames", "_events"];
|
||||
|
||||
private ["_eventFunctions", "_eventIndex"];
|
||||
|
||||
_eventNames = GVAR(events) select 0;
|
||||
_eventFunctions = [];
|
||||
_eventIndex = _eventNames find _eventName;
|
||||
|
||||
if (_eventIndex != -1) then {
|
||||
_eventFunctions = (GVAR(events) select 1) select _eventIndex;
|
||||
_eventFunctions set[_eventCodeIndex, nil];
|
||||
};
|
||||
_eventFunctions = _events select _eventIndex;
|
||||
_eventFunctions set [_eventCodeIndex, nil];
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user