Merge branch 'master' into miscFixNilFunctions

Conflicts:
	addons/common/functions/fnc_resetAllDefaults.sqf
This commit is contained in:
PabstMirror 2015-09-20 11:25:33 -05:00
commit 7687374fcf
102 changed files with 1204 additions and 1038 deletions

View File

@ -27,7 +27,6 @@ PREP(checkPBOs);
PREP(claim);
PREP(codeToLetter);
PREP(codeToString);
PREP(convertKeyCode);
PREP(createOrthonormalReference);
PREP(currentChannel);
PREP(debug);
@ -132,7 +131,6 @@ PREP(loadSettingsLocalizedText);
PREP(map);
PREP(moduleCheckPBOs);
PREP(moduleLSDVehicles);
PREP(moveToTempGroup);
PREP(muteUnit);
PREP(muteUnitHandleInitPost);
PREP(muteUnitHandleRespawn);
@ -145,7 +143,6 @@ PREP(player);
PREP(playerSide);
PREP(positionToASL);
PREP(progressBar);
PREP(queueAnimation);
PREP(readSettingFromModule);
PREP(receiveRequest);
PREP(removeCanInteractWithCondition);
@ -153,7 +150,6 @@ PREP(removeSpecificMagazine);
PREP(requestCallback);
PREP(resetAllDefaults);
PREP(restoreVariablesJIP);
PREP(revertKeyCodeLocalized);
PREP(runAfterSettingsInit);
PREP(sanitizeString);
PREP(sendRequest);

View File

@ -10,6 +10,8 @@
*
* Return Value:
* ID of the action (used to remove it later) <NUMBER>
*
* Public: No
*/
#include "script_component.hpp"

View File

@ -14,7 +14,7 @@
*
* Return Value:
* ID of the action (used to remove it later) <NUMBER>
*
*
* Public: No
*/
#include "script_component.hpp"

View File

@ -3,12 +3,14 @@
* Converts some keys to an Arma Dik Code.
*
* Arguments:
* 0: Key <CODE, STRING>
* 0: Key <STRING>
*
* Return Value:
* Dik Code <STRING>
* Dik Code <NUMBER>
*
* Public: Yes
*
* Deprecated
*/
#include "script_component.hpp"

View File

@ -1,30 +0,0 @@
/*
* Author: commy2
* Get a key code used in AGM key input eh.
*
* Arguments:
* 0: Arma DIK code <NUMBER>
* 1: Key state for shift left and shift right key <BOOL>
* 2: Key state for ctrl left and ctrl right key <BOOL>
* 3: Key state for alt and alt gr key <BOOL>
*
* Return Value:
* Key code <NUMBER>
*
* Public: Yes
*
* Deprecated
*/
#include "script_component.hpp"
#define KEY_MODIFIERS [42, 54, 29, 157, 56, 184]
params ["_key", "_stateShift", "_stateCtrl", "_stateAlt"];
if (_key in KEY_MODIFIERS) exitWith {_key};
if (_stateShift) then {_key = _key + 0.1};
if (_stateCtrl) then {_key = _key + 0.2};
if (_stateAlt) then {_key = _key + 0.4};
_key

View File

@ -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];

View File

@ -18,7 +18,6 @@
* 14-16: pistol (String, Array, Array)
* 17: map, compass, watch, etc. (Array)
* 18: binocluar (String)
* 19: active weapon, active muzzle, active weaponMode (Array)
*
*/
#include "script_component.hpp"
@ -35,8 +34,7 @@ if (isNull _unit) exitWith {[
"", ["","","",""], [],
"", ["","","",""], [],
[],
"",
["","",""]
""
]};
[
@ -49,6 +47,5 @@ if (isNull _unit) exitWith {[
secondaryWeapon _unit, secondaryWeaponItems _unit, secondaryWeaponMagazine _unit,
handgunWeapon _unit, handgunItems _unit, handgunMagazine _unit,
assignedItems _unit,
binocular _unit,
[currentWeapon _unit, currentMuzzle _unit, currentWeaponMode _unit]
binocular _unit
]

View File

@ -1,13 +1,18 @@
/**
* fn_hasItem.sqf
* @Descr: Check if unit has item
* @Author: Glowbal
/*
* Author: Glowbal
* Check if unit has item
*
* @Arguments: [unit OBJECT, item STRING (Classname of item)]
* @Return: BOOL
* @PublicAPI: true
* Arguments:
* 0: Unit <OBJECT>
* 1: Item Classname <STRING>
*
* Return Value:
* has Item <BOOL>
*
* Public: yes
*/
#include "script_component.hpp"
#include "script_component.hpp"
// item classname in items unit
((_this select 1) in items (_this select 0));
params ["_unit", "_item"];
_item in items _unit // return

View File

@ -1,22 +1,18 @@
/**
* fn_hasMagazine.sqf
* @Descr: Check if given unit has a magazine of given classname
* @Author: Glowbal
/*
* Author: Glowbal
* Check if given unit has a magazine of given classname
*
* @Arguments: [unit OBJECT, magazine STRING]
* @Return: BOOL True if unith as given magazine
* @PublicAPI: true
* Arguments:
* 0: Unit <OBJECT>
* 1: Magazine Classname <STRING>
*
* Return Value:
* has Magazine <BOOL>
*
* Public: yes
*/
#include "script_component.hpp"
private ["_return"];
PARAMS_2(_unit,_magazine);
params ["_unit", "_magazine"];
if (_magazine != "") then {
_return = (_magazine in magazines _unit);
} else {
_return = false;
};
_return
_magazine in magazines _unit // return

View File

@ -1,5 +1,15 @@
//fnc_hashCreate.sqf
/*
* Author: ?
* Returns an empty hash structure
*
* Arguments:
* None
*
* Return Value:
* Empty Hash Structure <ARRAY>
*
* Public: No
*/
#include "script_component.hpp"
// diag_log text format["%1 HASH CREATE"];
[[],[]]

View File

@ -1,10 +1,21 @@
//fnc_hashGet.sqf
/*
* Author: ?
* Returns value attached to key in given hash.
*
* Arguments:
* 0: Hash <ARRAY>
* 1: Key <STRING>
*
* Return Value:
* Value <ANY>
*
* Public: No
*/
#include "script_component.hpp"
private ["_val", "_index"];
// diag_log text format["%1 HASH GET: %2", ACE_diagTime, _this];
PARAMS_2(_hash,_key);
params ["_hash", "_key"];
ERRORDATA(2);
_val = nil;
@ -25,4 +36,5 @@ try {
};
if (isNil "_val") exitWith { nil };
_val;
_val

View File

@ -1,10 +1,22 @@
//fnc_hashHasKey.sqf
/*
* Author: ?
*
* ?
*
* Arguments:
* ?
*
* Return Value:
* ?
*
* Public: ?
*/
#include "script_component.hpp"
private ["_val", "_index"];
// diag_log text format["%1 HASH HAS KEY: %2", ACE_diagTime, _this];
PARAMS_2(_hash,_key);
params ["_hash", "_key"];
ERRORDATA(2);
_val = false;

View File

@ -1,9 +1,21 @@
//fnc_hashListCreateHash.sqf
/*
* Author: ?
*
* ?
*
* Arguments:
* ?
*
* Return Value:
* ?
*
* Public: ?
*/
#include "script_component.hpp"
private ["_hashKeys"];
PARAMS_1(_hashList);
params ["_hashList"];
ERRORDATA(1);
_hashKeys = [];

View File

@ -1,6 +1,18 @@
//fnc_hashListCreateList.sqf
/*
* Author: ?
*
* ?
*
* Arguments:
* ?
*
* Return Value:
* ?
*
* Public: ?
*/
#include "script_component.hpp"
PARAMS_1(_keys);
params ["_keys"];
[_keys,[]];

View File

@ -1,7 +1,19 @@
//fnc_hashListPush.sqf
/*
* Author: ?
*
* ?
*
* Arguments:
* ?
*
* Return Value:
* ?
*
* Public: ?
*/
#include "script_component.hpp"
PARAMS_2(_hashList,_value);
params ["_hashList", "_value"];
ERRORDATA(2);
try {

View File

@ -1,9 +1,22 @@
//fnc_hashListSelect.sqf
/*
* Author: ?
*
* ?
*
* Arguments:
* ?
*
* Return Value:
* ?
*
* Public: ?
*/
#include "script_component.hpp"
private ["_hash", "_keys", "_hashes", "_values"];
PARAMS_2(_hashList,_index);
params ["_hashList", "_index"];
ERRORDATA(2);
_hash = nil;
try {

View File

@ -1,9 +1,22 @@
//fnc_hashListSet.sqf
/*
* Author: ?
*
* ?
*
* Arguments:
* ?
*
* Return Value:
* ?
*
* Public: ?
*/
#include "script_component.hpp"
private ["_vals"];
PARAMS_3(_hashList,_index,_value);
params ["_hashList", "_index", "_value"];
ERRORDATA(3);
try {
if(VALIDHASH(_hashList)) then {

View File

@ -1,9 +1,22 @@
//fnc_hashRem.sqf
/*
* Author: ?
*
* ?
*
* Arguments:
* ?
*
* Return Value:
* ?
*
* Public: ?
*/
#include "script_component.hpp"
private ["_val", "_index"];
PARAMS_2(_hash,_key);
params ["_hash", "_key"];
ERRORDATA(2);
_val = nil;
try {

View File

@ -1,10 +1,22 @@
//fnc_hashSet.sqf
/*
* Author: ?
*
* ?
*
* Arguments:
* ?
*
* Return Value:
* ?
*
* Public: ?
*/
#include "script_component.hpp"
private ["_index"];
// diag_log text format["%1 HASH SET: %2", ACE_diagTime, _this];
PARAMS_3(_hash,_key,_val);
params ["_hash", "_key", "_val"];
ERRORDATA(3);
try {

View File

@ -34,7 +34,7 @@ titleCut ["", "BLACK"];
_dummy = createVehicle ["ACE_Headbug_Fix", _pos, [], 0, "NONE"];
_dummy setDir _dir;
_unit moveInAny _dummy;
sleep 0.1;
sleep 0.1; // @todo
unassignVehicle _unit;
_unit action ["Eject", vehicle _unit];

View File

@ -12,4 +12,4 @@
*/
#include "script_component.hpp"
getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> animationState (_this select 0) >> "looped") == 0
getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> animationState (_this select 0) >> "looped") == 0 // return

View File

@ -1,25 +1,36 @@
/**
* fn_inheritsFrom.sqf
* @Descr: Checks whether a given configuration name appears in the inheritance tree of a specific configuration entry.
* @Author: Ruthberg
/*
* Author: Ruthberg
* Checks whether a given configuration name appears in the inheritance tree of a specific configuration entry.
*
* @Arguments: [configEntry CONFIG, configname STRING]
* @Return: BOOL
* @PublicAPI: true
* Arguments:
* 0: configEntry (CONFIG)
* 1: configname (STING)
*
* Return Value:
* BOOLEAN
*
* Public: Yes
*
* Note: Not to be confused with the inheritsFrom scripting command.
*
* Deprecated
*/
#include "script_component.hpp"
private ["_match"];
PARAMS_2(_configEntry,_configMatch);
params ["_configEntry", "_configMatch"];
if (configName _configEntry == _configMatch) exitWith { true };
if (configName _configEntry == ",") exitWith { false };
if (configName _configEntry == _configMatch) exitWith {true};
if (configName _configEntry == ",") exitWith {false};
private "_match";
_match = false;
while {configName _configEntry != ""} do {
if (configName _configEntry == _configMatch) exitWith { _match = true };
_configEntry = inheritsFrom(_configEntry);
if (configName _configEntry == _configMatch) exitWith {
_match = true;
};
_configEntry = inheritsFrom _configEntry;
};
_match
_match

View File

@ -1,34 +1,38 @@
/**
* fn_insertionSort.sqf
* @Descr: Sorts an array of numbers
* @Author: Ruthberg
/*
* Author: Ruthberg
* Sorts an array of numbers
*
* @Arguments: [array ARRAY, (optional) ascending BOOL]
* @Return: sortedArray ARRAY
* @PublicAPI: true
* Arguments:
* 0: array <ARRAY>
* 1: ascending (optional) <BOOL>
*
* Return Value:
* sortedArray (ARRAY)
*
* Public: Yes
*/
#include "script_component.hpp"
private ["_list", "_ascending", "_tmp", "_i", "_j"];
_list = +(_this select 0);
_ascending = true;
if (count _this > 1) then {
_ascending = _this select 1;
};
params ["_list", ["_ascending", true]];
for "_i" from 1 to (count _list) - 1 do {
_list = + _list; // copy array to not alter the original one
private "_tmp";
for "_i" from 1 to (count _list - 1) do {
_tmp = _list select _i;
_j = _i;
while {_j >= 1 && {_tmp < _list select (_j - 1)}} do {
_list set [_j, _list select (_j - 1)];
_j = _j - 1;
};
_list set[_j, _tmp];
_list set [_j, _tmp];
};
if (!_ascending) then {
reverse _list;
};
_list
_list

View File

@ -1,11 +1,23 @@
// by commy2
/*
* Author: commy2
* Interpolates between two set points in a curve.
*
* Arguments:
* 0: List of numbers to interpolate from <ARRAY>
* 1: Value / index <NUMBER>
*
* Return Value:
* Interpolation result <NUMBER>
*
* Public: Yes
*/
#include "script_component.hpp"
private ["_min", "_max"];
params ["_array", "_value"];
PARAMS_2(_array,_value);
private ["_min", "_max"];
_min = _array select floor _value;
_max = _array select ceil _value;
_min + (_max - _min) * (_value % 1)
_min + (_max - _min) * (_value % 1) // return

View File

@ -1,14 +1,15 @@
/*
* Author: commy2
*
* Check if wind is set on auto.
*
* Argument:
* None.
* Arguments
* None
*
* Return value:
* This mission has automatic wind? (Bool)
* Return Value:
* This mission has automatic wind? <BOOL>
*
* Public: Yes
*/
#include "script_component.hpp"
["Mission", "Intel", "windForced"] call FUNC(getNumberFromMissionSQM) != 1
["Mission", "Intel", "windForced"] call FUNC(getNumberFromMissionSQM) != 1 // return

View File

@ -1,15 +1,18 @@
/**
* fn_isAwake.sqf
* @Descr: Check if unit is awake. Will be false when death or unit is unconscious.
* @Author: Glowbal
/*
* Author: Glowbal
*
* @Arguments: [unit OBJECT]
* @Return: BOOL True if unit is awake
* @PublicAPI: true
* Check if unit is awake. Will be false when death or unit is unconscious.
*
* Arguments:
* 0: Unit <OBJECT>
*
* Return Value:
* if unit is awake <BOOL>
*
* Public: Yes
*/
#include "script_component.hpp"
PARAMS_1(_unit);
params ["_unit"];
(!(_unit getvariable ["ACE_isUnconscious",false]) && alive _unit && !(_unit getvariable ["ACE_isDead",false]));
!(_unit getvariable ["ACE_isUnconscious", false]) && alive _unit && !(_unit getvariable ["ACE_isDead", false]);

View File

@ -1,25 +1,23 @@
/*
Name: FUNC(isEOD)
Author: Garth de Wet (LH)
Description:
Checks whether the passed unit is an explosive specialist.
Either through config entry: "canDeactivateMines"
or
unit setVariable ["ACE_isEOD", true]
Parameters:
0: OBJECT - Unit to check if is a specialist
Returns:
BOOLEAN
Example:
isSpecialist = [player] call FUNC(isEOD);
*/
* Author: Garth de Wet (LH)
* Checks whether the passed unit is an explosive specialist.
* Either through config entry: "canDeactivateMines"
* or
* unit setVariable ["ACE_isEOD", true]
*
* Arguments:
* 0: Unit to check if is a specialist <OBJECT>
*
* Return Value:
* is the unit an EOD <BOOL>
*
* Example:
* isSpecialist = [player] call FUNC(isEOD);
*
* Public: Yes
*/
#include "script_component.hpp"
PARAMS_1(_unit);
params ["_unit"];
_unit getVariable ["ACE_isEOD", getNumber (configFile >> "CfgVehicles" >> typeOf _unit >> "canDeactivateMines") == 1]
_unit getVariable ["ACE_isEOD", getNumber (configFile >> "CfgVehicles" >> typeOf _unit >> "canDeactivateMines") == 1] // return

View File

@ -1,16 +1,17 @@
/*
* Author: marc_book, edited by commy2
*
* Checks if a unit is an engineer.
*
* Arguments:
* 0: unit to be checked (object)
* 0: unit to be checked <OBJECT>
*
* Return Value:
* Bool: is the unit an engineer?
* is the unit an engineer <BOOL>
*
* Public: Yes
*/
#include "script_component.hpp"
PARAMS_1(_unit);
params ["_unit"];
_unit getVariable ["ACE_IsEngineer", getNumber (configFile >> "CfgVehicles" >> typeOf _unit >> "engineer") == 1]
_unit getVariable ["ACE_isEngineer", getNumber (configFile >> "CfgVehicles" >> typeOf _unit >> "engineer") == 1] // return

View File

@ -19,9 +19,8 @@
* Example:
* [] call ace_common_fnc_isFeatureCameraActive
*
* Public: No
* Public: Yes
*/
#include "script_component.hpp"
!(
@ -32,4 +31,4 @@
{isNull (GETMVAR(BIS_fnc_camera_cam, objNull))} && // Splendid camera
{isNull (GETUVAR(BIS_fnc_animViewer_cam, objNull))} && // Animation viewer camera
{isNull (GETMVAR(BIS_DEBUG_CAM, objNull))} // Classic camera
)
) // return

View File

@ -1,45 +1,44 @@
/*
* Author: commy2
*
* Check if the unit is in a building. Will return true if the unit is sitting in a bush.
*
* Argument:
* 0: Unit (Object)
* Arguments:
* 0: Unit <OBJECT>
*
* Return value:
* Is the unit in a building? (Bool)
* Is the unit in a building? <BOOL>
*
* Public: Yes
*/
#include "script_component.hpp"
#define DISTANCE 10
#define CHECK_DISTANCE 10
private ["_position", "_positionX", "_positionY", "_positionZ", "_intersections"];
params ["_unit"];
PARAMS_1(_unit);
private ["_position", "_intersections"];
_position = eyePos _unit;
_positionX = _position select 0;
_positionY = _position select 1;
_positionZ = _position select 2;
_intersections = 0;
if (lineIntersects [_position, [_positionX, _positionY, _positionZ + DISTANCE]]) then {
if (lineIntersects [_position, _position vectorAdd [0, 0, +CHECK_DISTANCE]]) then {
_intersections = _intersections + 1;
};
if (lineIntersects [_position, [_positionX + DISTANCE, _positionY, _positionZ]]) then {
if (lineIntersects [_position, _position vectorAdd [+CHECK_DISTANCE, 0, 0]]) then {
_intersections = _intersections + 1;
};
if (lineIntersects [_position, [_positionX - DISTANCE, _positionY, _positionZ]]) then {
if (lineIntersects [_position, _position vectorAdd [-CHECK_DISTANCE, 0, 0]]) then {
_intersections = _intersections + 1;
};
if (lineIntersects [_position, [_positionX, _positionY + DISTANCE, _positionZ]]) then {
if (lineIntersects [_position, _position vectorAdd [0, +CHECK_DISTANCE, 0]]) then {
_intersections = _intersections + 1;
};
if (lineIntersects [_position, [_positionX, _positionY - DISTANCE, _positionZ]]) then {
if (lineIntersects [_position, _position vectorAdd [0, -CHECK_DISTANCE, 0]]) then {
_intersections = _intersections + 1;
};

View File

@ -1,13 +1,15 @@
/**
* fn_isModLoaded_f.sqf
* Descr: Check in cfgPatches if modification is loaded
/*
* Author: Glowbal
* Check in cfgPatches if modification is loaded
*
* Arguments: [modName STRING (Classname of the mod in cfgPatches)]
* Return: BOOL true if modification is loaded
* PublicAPI: true
* Arguments:
* 0: Mod Name or Classname of the mod in cfgPatches <STRING>
*
* Return Value:
* if modification is loaded <BOOL>
*
* Public: Yes
*/
#include "script_component.hpp"
(isClass (configFile >> "cfgPatches" >> (_this select 0)))
isClass (configFile >> "cfgPatches" >> _this select 0) // return

View File

@ -1,21 +1,19 @@
/*
* Author: bux578, commy2, akalegman
*
* Checks if a unit is a player / curator controlled unit.
* Currently returns false for non-local remote controlled zeus units. (Remotes from another zeus machine)
*
* Arguments:
* 0: unit to be checked (object)
* 1: exclude remote controlled units (boolean)
* 0: unit to be checked <OBJECT>
* 1: exclude remote controlled units <BOOL>
*
* Return Value:
* Bool: is unit a player?
* Is unit a player? <BOOL>
*
* Public: Yes
*/
#include "script_component.hpp"
private ["_unit", "_excludeRemoteControlled"];
params ["_unit", ["_excludeRemoteControlled", false]];
_unit = _this select 0;
_excludeRemoteControlled = if (count _this > 1) then {_this select 1} else {false};
isPlayer _unit || (!_excludeRemoteControlled && {_unit == call FUNC(player)})
isPlayer _unit || (!_excludeRemoteControlled && {_unit == call FUNC(player)}) // return

View File

@ -1,39 +1,19 @@
/*
* Author: commy2
*
* Check if the unit is in a vehicle and turned out.
*
* Argument:
* 0: Unit, not the vehicle (Object)
* Arguments:
* 0: Unit, not the vehicle <OBJECT>
*
* Return value:
* Is the unit turned out or not? Will return false if there is no option to turn out in the first place. (Bool)
* Return Value:
* Is the unit turned out or not? Will return false if there is no option to turn out in the first place. <BOOL>
*
* Public: Yes
*
* Deprecated
*/
#include "script_component.hpp"
private ["_vehicle", "_config", "_animation", "_action", "_inAction", "_turretIndex"];
params ["_unit"];
PARAMS_1(_unit);
_vehicle = vehicle _unit;
_config = configFile >> "CfgVehicles" >> typeOf _vehicle;
_animation = animationState _unit;
if (_unit == driver _vehicle) then {
_action = getText (_config >> "driverAction");
_inAction = getText (_config >> "driverInAction");
} else {
_turretIndex = [_unit] call FUNC(getTurretIndex);
_config = [_config, _turretIndex] call FUNC(getTurretConfigPath);
_action = getText (_config >> "gunnerAction");
_inAction = getText (_config >> "gunnerInAction");
};
if (_action == "" || {_inAction == ""} || {_action == _inAction}) exitWith {false};
_animation = toArray _animation;
_animation resize (count toArray _action);
_animation = toString _animation;
_animation == _action
isTurnedOut _unit // return

View File

@ -1,4 +1,17 @@
// by commy2
/*
* Author: commy2
* Converts some Arma Dik Codes to a key.
*
* Arguments:
* 0: Dik Code <NUMBER>
*
* Return Value:
* Key <STRING>
*
* Public: Yes
*
* Deprecated
*/
#include "script_component.hpp"
[-1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 30, 48, 46, 32, 18, 33, 34, 35, 23, 36, 37, 38, 50, 49, 24, 25, 16, 19, 31, 20, 22, 47, 17, 45, 44, 21] select (["1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"] find toUpper (_this select 0)) + 1

View File

@ -3,18 +3,19 @@
* Calculate light intensity object 1 recieves from object 2
*
* Arguments:
* 0: Object that recieves light (Object)
* 1: Object that emits light (Object)
* 0: Object that recieves light <OBJECT>
* 1: Object that emits light <OBJECT>
*
* Return Value:
* Brightest light level
*
* Public: Yes
*/
#include "script_component.hpp"
private ["_unitPos","_lightLevel"];
params ["_unit", "_lightSource"];
PARAMS_2(_unit,_lightSource);
private ["_unitPos", "_lightLevel"];
_unitPos = _unit modelToWorld (_unit selectionPosition "spine3");
_lightLevel = 0;

View File

@ -13,7 +13,7 @@
*/
#include "script_component.hpp"
#define GROUP_SWITCH_ID QUOTE(FUNC(loadPerson))
#define GROUP_SWITCH_ID QFUNC(loadPerson)
params ["_caller", "_unit"];

View File

@ -12,39 +12,42 @@
*/
#include "script_component.hpp"
private ["_parseConfigForDisplayNames", "_name"];
private "_fnc_parseConfigForDisplayNames";
_fnc_parseConfigForDisplayNames = {
params ["_optionEntry"];
_parseConfigForDisplayNames = {
private ["_optionEntry", "_values", "_text"];
_optionEntry = _this select 0;
if !(isClass _optionEntry) exitwith {false};
private "_values";
_values = getArray (_optionEntry >> "values");
_x set [3, getText (_optionEntry >> "displayName")];
_x set [4, getText (_optionEntry >> "description")];
_x set [5, _values];
_x set [8, getText (_optionEntry >> "category")];
{
private "_text";
_text = _x;
if (((typeName _text) == "STRING") && {(count _text) > 1} && {(_text select [0,1]) == "$"}) then {
_text = localize (_text select [1, ((count _text) - 1)]); //chop off the leading $
if (typeName _text == "STRING" && {count _text > 1} && {_text select [0, 1] == "$"}) then {
_text = localize (_text select [1]); //chop off the leading $
_values set [_forEachIndex, _text];
};
} forEach _values;
true;
true
};
// Iterate through settings
{
_name = _x select 0;
_x params ["_name"];
if !([configFile >> "ACE_Settings" >> _name] call _parseConfigForDisplayNames) then {
if !([configFile >> "ACE_ServerSettings" >> _name] call _parseConfigForDisplayNames) then {
if !([missionConfigFile >> "ACE_Settings" >> _name] call _parseConfigForDisplayNames) then {
if !([configFile >> "ACE_Settings" >> _name] call _fnc_parseConfigForDisplayNames) then {
if !([configFile >> "ACE_ServerSettings" >> _name] call _fnc_parseConfigForDisplayNames) then {
if !([missionConfigFile >> "ACE_Settings" >> _name] call _fnc_parseConfigForDisplayNames) then {
ACE_LOGWARNING_1("Setting found, but couldn't localize [%1] (server has but we don't?)",_name);
};
};
};
} forEach GVAR(settings);
false
} count GVAR(settings);

View File

@ -1,6 +1,5 @@
/*
* Author: Nou
*
* Execute a local event on this client only.
*
* Arguments:

View File

@ -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];

View File

@ -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 {};

View File

@ -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.");

View File

@ -1,6 +1,5 @@
/*
* Author: commy2
*
* hint retun value of given function every frame
*
* Argument:

View File

@ -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;
};
};
};

View File

@ -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 {};

View File

@ -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 {

View File

@ -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];

View File

@ -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
*/

View File

@ -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
*/

View File

@ -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
*/

View File

@ -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];
};

View File

@ -7,7 +7,7 @@
* None
*
* Return Value:
* current local side (Side)
* current local side <SIDE>
*
* Public: Yes
*/

View File

@ -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;

View File

@ -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);
};

View File

@ -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 {

View File

@ -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;
};
};
};

View File

@ -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 {};

View File

@ -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];

View File

@ -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, []];
};

View File

@ -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;

View File

@ -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];
};

View File

@ -1,25 +1,23 @@
/*
* Author: commy2
*
* Remove a map marker creation event handler.
*
* Argument:
* 0: ID of the event handler (Number)
* Arguments:
* 0: ID of the event handler <NUMBER>
*
* Return value:
* None.
* Return Value:
* None
*
* Public: Yes
*/
#include "script_component.hpp"
private ["_actionsVar", "_currentId", "_actionIDs", "_actions"];
PARAMS_1(_id);
params ["_id"];
private "_actionsVar";
_actionsVar = missionNamespace getVariable ["ACE_EventHandler_MapMarker", [-1, [], []]];
_currentId = _actionsVar select 0;
_actionIDs = _actionsVar select 1;
_actions = _actionsVar select 2;
_actionsVar params ["_currentId", "_actionIDs", "_actions"];
_id = _actionIDs find _id;

View File

@ -1,25 +1,23 @@
/*
* Author: commy2
*
* Remove a scroll wheel event handler.
*
* Argument:
* 0: ID of the event handler (Number)
* Arguments:
* 0: ID of the event handler <NUMBER>
*
* Return value:
* None.
* Return Value:
* None
*
* Public: Yes
*/
#include "script_component.hpp"
private ["_actionsVar", "_currentId", "_actionIDs", "_actions"];
PARAMS_1(_id);
params ["_id"];
private "_actionsVar";
_actionsVar = missionNamespace getVariable ["ACE_EventHandler_ScrollWheel", [-1, [], []]];
_currentId = _actionsVar select 0;
_actionIDs = _actionsVar select 1;
_actions = _actionsVar select 2;
_actionsVar params ["_currentId", "_actionIDs", "_actions"];
_id = _actionIDs find _id;

View File

@ -2,68 +2,77 @@
* Author: esteldunedain
* Removes a magazine from the unit that has an specific ammo count
*
* Argument:
* 0: Player <OBJECT>
* Arguments:
* 0: Unit <OBJECT>
* 1: Magazine <STRING>
* 2: Ammo count <NUMBER>
*
* Return value:
* Return Value:
* None
*
* Public: No
*/
#include "script_component.hpp"
EXPLODE_3_PVT(_this,_player,_magazineType,_ammoCount);
params ["_unit", "_magazineType", "_ammoCount"];
private ["_isRemoved", "_magazines", "_index"];
private ["_magazines","_index","_isRemoved"];
_isRemoved = false;
// Check uniform
_magazines = [magazinesAmmoCargo uniformContainer _player, {_this select 0 == _magazineType}] call FUNC(filter);
_index = _magazines find [_magazineType,_ammoCount];
_magazines = [magazinesAmmoCargo uniformContainer _unit, {_this select 0 == _magazineType}] call FUNC(filter);
_index = _magazines find [_magazineType, _ammoCount];
if (_index > -1) exitWith {
{
_player removeItemFromUniform (_x select 0);
} forEach _magazines;
_unit removeItemFromUniform (_x select 0);
false
} count _magazines;
{
if (!_isRemoved && (_x isEqualTo [_magazineType,_ammoCount])) then {
_isRemoved = true;
} else {
(uniformContainer _player) addMagazineAmmoCargo [_x select 0, 1, _x select 1];
(uniformContainer _unit) addMagazineAmmoCargo [_x select 0, 1, _x select 1];
};
} forEach _magazines;
false
} count _magazines;
};
// Check vest
_magazines = [magazinesAmmoCargo vestContainer _player, {_this select 0 == _magazineType}] call FUNC(filter);
_magazines = [magazinesAmmoCargo vestContainer _unit, {_this select 0 == _magazineType}] call FUNC(filter);
_index = _magazines find [_magazineType,_ammoCount];
if (_index > -1) exitWith {
{
_player removeItemFromVest (_x select 0);
} forEach _magazines;
_unit removeItemFromVest (_x select 0);
false
} count _magazines;
{
if (!_isRemoved && (_x isEqualTo [_magazineType,_ammoCount])) then {
_isRemoved = true;
} else {
(vestContainer _player) addMagazineAmmoCargo [_x select 0, 1, _x select 1];
(vestContainer _unit) addMagazineAmmoCargo [_x select 0, 1, _x select 1];
};
} forEach _magazines;
false
} count _magazines;
};
// Check backpack
_magazines = [magazinesAmmoCargo backpackContainer _player, {_this select 0 == _magazineType}] call FUNC(filter);
_magazines = [magazinesAmmoCargo backpackContainer _unit, {_this select 0 == _magazineType}] call FUNC(filter);
_index = _magazines find [_magazineType,_ammoCount];
if (_index > -1) exitWith {
{
_player removeItemFromBackpack (_x select 0);
} forEach _magazines;
_unit removeItemFromBackpack (_x select 0);
false
} count _magazines;
{
if (!_isRemoved && (_x isEqualTo [_magazineType,_ammoCount])) then {
_isRemoved = true;
} else {
(backpackContainer _player) addMagazineAmmoCargo [_x select 0, 1, _x select 1];
(backpackContainer _unit) addMagazineAmmoCargo [_x select 0, 1, _x select 1];
};
} forEach _magazines;
false
} count _magazines;
};

View File

@ -1,27 +1,28 @@
/*
* Author: jaynus
*
* Remove a synced event handler
*
* Argument:
* 0: Name (String)
* Arguments:
* 0: Name <STRING>
*
* Return value:
* Return Value:
* Boolean of success
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_1(_name);
private ["_data", "_eventId"];
params ["_name"];
if (!HASH_HASKEY(GVAR(syncedEvents),_name)) exitWith {
ACE_LOGERROR("Synced event key not found.");
false
};
private ["_data", "_eventId"];
_data = HASH_GET(GVAR(syncedEvents),_name);
_eventId = _data select 3;
[_eventId] call ace_common_fnc_removeEventHandler;
[_eventId] call FUNC(removeEventHandler);
HASH_REM(GVAR(syncedEvents),_name);

View File

@ -1,22 +1,19 @@
/**
* fn_requestCallback.sqf
* @Descr: N/A
* @Author: Glowbal
/*
* Author: Glowbal
* N/A
*
* @Arguments: []
* @Return:
* @PublicAPI: false
* Arguments:
* ?
*
* Return Value:
* ?
*
* Public: No
*/
#include "script_component.hpp"
private ["_caller", "_target", "_requestID", "_requestMessage", "_callBack"];
PARAMS_2(_info,_accepted);
params ["_info", "_accepted"];
_caller = _info select 0;
_target = _info select 1;
_requestID = _info select 2;
_requestMessage = _info select 3;
_callBack = _info select 4;
_info params ["_caller", "_target", "_requestID", "_requestMessage", "_callBack"];
[_caller, _target, _accepted] call compile _callBack;
[_caller, _target, _accepted] call compile _callBack;

View File

@ -1,19 +1,20 @@
/*
* Author: jaynus
*
* Send a request to synchronize an event name from the client->server. Execute on client only.
*
* Argument:
* 0: eventName (String)
* Arguments:
* 0: eventName <STRING>
*
* Return value:
* Return Value:
* Boolean of success
*
* Public: No
*/
//#define DEBUG_MODE_FULL
#include "script_component.hpp"
PARAMS_1(_eventName);
params ["_eventName"];
// Only JIP machines on initialization send this off, requesting sync on events with the serverCommand
if(isServer) exitWith { false };
if (isServer) exitWith {false};
["SEH_s", [_eventName, ACE_player] ] call ace_common_fnc_serverEvent;
["SEH_s", [_eventName, ACE_player] ] call FUNC(serverEvent);

View File

@ -3,18 +3,19 @@
*
* Called from respawn eventhandler. Resets all public object namespace variables that are added via FUNC(setVariableJIP).
*
* Argument:
* 0: Object (Object)
* Arguments:
* 0: Object <OBJECT>
*
* Return value:
* Nothing.
* Return Value:
* None
*
* Public: No
*/
#include "script_component.hpp"
params ["_unit"];
private "_respawnVariables";
PARAMS_1(_unit);
_respawnVariables = _unit getVariable ["ACE_respawnVariables", []];
// yes those
@ -22,4 +23,6 @@ _respawnVariables pushBack "ACE_PersistentFunctions";
{
_unit setVariable [_x, _unit getVariable _x, true];
} forEach _respawnVariables;
false
} count _respawnVariables;
nil

View File

@ -1,39 +0,0 @@
/*
* Author: commy2
*
* Revert a key code to a readible text.
*
* Argument:
* 0: Key code (Number)
*
* Return value:
* What input will result in the given key code? (String)
*/
#include "script_component.hpp"
private ["_key", "_alt", "_ctrl", "_shift"];
PARAMS_1(_keyCode);
_key = toString ((toArray keyName floor _keyCode) - [34]);
_keyCode = round ((_keyCode % 1) * 10);
switch (_keyCode) do {
case 8 : {format [localize QUOTE(DOUBLES(STR,GVAR(DoubleTapKey))), _key]};
case 9 : {format [localize QUOTE(DOUBLES(STR,GVAR(HoldKey))), _key]};
default {
_keyCode = toArray ([_keyCode, 3] call FUNC(toBin));
_alt = "1" == toString [_keyCode select 0];
_ctrl = "1" == toString [_keyCode select 1];
_shift = "1" == toString [_keyCode select 2];
format ["%1%2%3%4",
["", format ["%1 + ", localize QUOTE(DOUBLES(STR,GVAR(Alt)))]] select _alt,
["", format ["%1 + ", localize QUOTE(DOUBLES(STR,GVAR(Ctrl)))]] select _ctrl,
["", format ["%1 + ", localize QUOTE(DOUBLES(STR,GVAR(Shift)))]] select _shift,
_key
]
};
};

View File

@ -1,23 +1,22 @@
/*
* Author: esteldunedain, based on Killzone-Kid code
*
* Removes quotation marks to avoid exploits and optionally html tags from text to avoid conflicts with structured text.
*
* Arguments:
* 0: Source string (String)
* 1: Remove html tags (Bool, optional)
* 0: Source string <STRING>
* 1: Remove html tags (optional) <BOOL>
*
* Return Value:
* Sanitized string
*
* Public: Yes
*/
#include "script_component.hpp"
params ["_string", ["_removeTags", false]];
private ["_array", "_arrayNew"];
PARAMS_2(_string,_removeTags);
if (isNil "_removeTags") then {_removeTags = false};
_array = toArray _string;
_arrayNew = [];
@ -37,6 +36,7 @@ _arrayNew = [];
_arrayNew = _arrayNew + [_x];
};
};
} forEach _array;
false
} count _array;
toString _arrayNew

View File

@ -1,47 +1,53 @@
/**
* fn_sendDisplayInformationTo.sqf
* @Descr: Sends a display information hint to a receiver
* @Author: Glowbal
/*
* Author: Glowbal
* Sends a display information hint to a receiver
*
* @Arguments: [receiver OBJECT, title STRING, content ARRAY (An array with strings), type NUMBER (Optional)]
* @Return: void
* @PublicAPI: true
* Arguments:
* 0: receiver <OBJECT>
* 1: title <STRING>
* 2: content <ARRAY>
* 3: type (optional) <NUMBER>
*
* Return Value:
* None
*
* Public: Yes
*/
#include "script_component.hpp"
private ["_reciever","_title","_content","_type", "_parameters", "_localizationArray"];
_reciever = [_this, 0, ObjNull,[ObjNull]] call BIS_fnc_Param;
_title = [_this, 1, "",[""]] call BIS_fnc_Param;
_content = [_this, 2, [""],[[""]]] call BIS_fnc_Param;
_type = [_this, 3, 0,[0]] call BIS_fnc_Param;
_parameters = [_this, 4, [], [[]]] call BIS_fnc_Param;
params [["_reciever", objNull], ["_title", ""], ["_content", ""], ["_type", 0], ["_parameters", []]];
if (isPlayer _reciever) then {
if (!local _reciever) then {
[_this, QUOTE(FUNC(sendDisplayInformationTo)), _reciever, false] call EFUNC(common,execRemoteFnc);
[_this, QFUNC(sendDisplayInformationTo), _reciever, false] call FUNC(execRemoteFnc);
} else {
if (isLocalized _title) then {
_title = localize _title;
};
private "_localizationArray";
_localizationArray = [_title];
{
_localizationArray pushback _x;
} forEach _parameters;
false
} count _parameters;
_title = format _localizationArray;
{
if (isLocalized _x) then {
_localizationArray = [localize _x];
{
_localizationArray pushback _x;
} forEach _parameters;
_localizationArray pushBack _x;
false
} count _parameters;
_content set [_foreachIndex, format _localizationArray];
_content set [_forEachIndex, format _localizationArray];
};
} forEach _content;
}foreach _content;
[_title,_content,_type] call EFUNC(common,displayInformation);
[_title, _content, _type] call FUNC(displayInformation);
};
};
};

View File

@ -1,46 +1,53 @@
/**
* fn_sendDisplayMessageTo.sqf
* @Descr: Displays a message on locality of receiver
* @Author: Glowbal
/*
* Author: Glowbal
* Displays a message on locality of receiver
*
* @Arguments: [receiver OBJECT, title STRING, content STRING, type NUMBER (Optional)]
* @Return: void
* @PublicAPI: true
* Arguments:
* 0: receiver <OBJECT>
* 1: title <STRING>
* 2: content <ARRAY>
* 3: type (optional) <NUMBER>
*
* Return Value:
* None
*
* Public: Yes
*/
#include "script_component.hpp"
private ["_reciever","_title","_content","_type", "_parameters", "_localizationArray"];
_reciever = [_this, 0, ObjNull,[ObjNull]] call BIS_fnc_Param;
_title = [_this, 1, "",[""]] call BIS_fnc_Param;
_content = [_this, 2, "",[""]] call BIS_fnc_Param;
_type = [_this, 3, 0,[0]] call BIS_fnc_Param;
_parameters = [_this, 4, [], [[]]] call BIS_fnc_Param;
params [["_reciever", objNull], ["_title", ""], ["_content", ""], ["_type", 0], ["_parameters", []]];
if (isPlayer _reciever) then {
if (!local _reciever) then {
[_this, QUOTE(FUNC(sendDisplayMessageTo)), _reciever, false] call EFUNC(common,execRemoteFnc);
[_this, QFUNC(sendDisplayMessageTo), _reciever, false] call FUNC(execRemoteFnc);
} else {
if (isLocalized _title) then {
_title = localize _title;
};
if (isLocalized _content) then {
_content = localize _content;
};
private "_localizationArray";
_localizationArray = [_title];
{
_localizationArray pushback _x;
}foreach _parameters;
_localizationArray pushBack _x;
false
} count _parameters;
_title = format _localizationArray;
_localizationArray = [_content];
{
_localizationArray pushback _x;
}foreach _parameters;
_localizationArray pushBack _x;
false
} count _parameters;
_content = format _localizationArray;
[_title,_content,_type] call EFUNC(common,displayMessage);
[_title, _content, _type] call FUNC(displayMessage);
};
};
};

View File

@ -1,20 +1,26 @@
/**
* fn_sendRequest_f.sqf
* @Descr: Send a request to an unit and execute code based upon results.
* @Author: Glowbal
/*
* Author: Glowbal
* Send a request to an unit and execute code based upon results.
*
* @Arguments: [caller OBJECT, target OBJECT, requestID STRING, requestMessage STRING (Will be localized for other target object), callback CODE (Code called upon accept or decline.)]
* @Return: void
* @PublicAPI: true
* Arguments:
* 0: caller <OBJECT>
* 1: target <OBJECT>
* 2: requestID (STRING)
* 3: requestMessage Will be localized for other target object. (STRING)
* 4: callback Code called upon accept or decline. (CODE)
*
* Return Value:
* None
*
* Public: Yes
*/
#include "script_component.hpp"
PARAMS_5(_caller,_target,_requestID,_requestMessage,_callBack);
params ["_caller", "_target", "_requestID", "_requestMessage", "_callBack"];
if (isPlayer _target) then {
// Pass request on to target locality for player accept/decline.
[[_caller, _target, _requestID, _requestMessage, _callBack], QUOTE(FUNC(receiveRequest)), _target, false] call EFUNC(common,execRemoteFnc);
[[_caller, _target, _requestID, _requestMessage, _callBack], QFUNC(receiveRequest), _target, false] call FUNC(execRemoteFnc);
} else {
// accept it, since it's an AI.
[_caller, _target, true] call compile _callBack;

View File

@ -1,26 +1,27 @@
/*
* Author: Nou
*
* Execute a event only on the server.
*
* Argument:
* 0: Event name (string)
* 1: Event args (any)
* 0: Event name <STRING>
* 1: Event args <ANY>
*
* Return value:
* Nothing
* Return Value:
* None
*
* Public: Yes
*/
#include "script_component.hpp"
//IGNORE_PRIVATE_WARNING("_handleNetEvent");
PARAMS_2(_eventName,_eventArgs);
params ["_eventName", "_eventArgs"];
#ifdef DEBUG_EVENTS
ACE_LOGINFO_1("* Server Event: %1",_eventName);
ACE_LOGINFO_1(" args=%1",_eventArgs);
#endif
#ifdef DEBUG_EVENTS
ACE_LOGINFO_1("* Server Event: %1",_eventName);
ACE_LOGINFO_1(" args=%1",_eventArgs);
#endif
ACEg = [_eventName, _eventArgs];
if (!isServer) then {
publicVariableServer "ACEg";
} else {

View File

@ -1,8 +1,19 @@
// by esteldunedain
/*
* Author: esteldunedain
* ?
*
* Arguments:
* ?
*
* Return Value:
* None
*
* Public: no
*/
#include "script_component.hpp"
if (isServer) then {
diag_log _this;
} else {
[_this, QUOTE(FUNC(serverLog)), 1] call FUNC(execRemoteFnc);
[_this, QFUNC(serverLog), 1] call FUNC(execRemoteFnc);
};

View File

@ -1,21 +1,22 @@
/*
* Author: commy2
*
* Set the captivity status of an unit. This allows the handling of more than one reason to set a unit captive.
*
* Argument:
* 0: Unit (Object)
* 1: The reason of the captivity (String)
* 2: Is the reason still valid? True for setting this reason, false for removing it (Bool)
* Arguments:
* 0: Unit <OBJECT>
* 1: The reason of the captivity <STRING>
* 2: Is the reason still valid? True for setting this reason, false for removing it <BOOL>
*
* Return value:
* None.
* Return Value:
* None
*
* Public: No
*/
#include "script_component.hpp"
private ["_captivityReasons", "_unitCaptivityReasons", "_captivityReasonsBooleans", "_bitmask"];
params ["_unit", "_reason", "_status"];
PARAMS_3(_unit,_reason,_status);
private ["_captivityReasons", "_unitCaptivityReasons", "_captivityReasonsBooleans", "_bitmask"];
_captivityReasons = missionNamespace getVariable ["ACE_captivityReasons", []];

View File

@ -1,31 +1,30 @@
/**
* fn_setVariable.sqf
* @Descr: Setvariable value
* @Author: Glowbal
/*
* Author: Glowbal
* Setvariable value
*
* @Arguments: [unit OBJECT, variableName STRING, value ANY]
* @Return: void
* @PublicAPI: true
* Arguments:
* 0: Unit <OBJECT>
* 1: variableName <STRING>
* 2: value <ANY>
*
* Return Value:
* None
*
* Public: Yes
*/
#include "script_component.hpp"
private ["_global","_definedVariable"];
params ["_unit", "_variable", "_value", "_global"];
PARAMS_3(_unit,_variable,_value);
if (isNil "_global") then {
private "_definedVariable";
_definedVariable = [_variable] call FUNC(getDefinedVariableInfo);
_global = false;
if (count _this > 3) then {
_global = _this select 3;
} else {
_definedVariable = ([_variable] call FUNC(getDefinedVariableInfo));
if (count _definedVariable > 2) then {
_global = _definedVariable select 2;
};
_definedVariable params ["", "", ["_global", false]];
};
if (!isNil "_value") exitwith {
_unit setvariable [_variable, _value, _global];
_unit setVariable [_variable, _value, _global];
};
_unit setvariable [_variable, nil, _global];
_unit setVariable [_variable, nil, _global];

View File

@ -1,26 +1,30 @@
/**
* fn_setDisableUserInputStatus.sqf
* @Descr: Disables the user input. Works stacked.
* @Author: Glowbal
/*
* Author: Glowbal
* Disables the user input. Works stacked.
*
* @Arguments: [id STRING, disable BOOL]
* @Return: void
* @PublicAPI: true
* Arguments:
* 0: id <STRING>
* 1: disable <BOOL>
*
* Return Value:
* None
*
* Public: Yes
*/
#include "script_component.hpp"
PARAMS_2(_id,_disable);
params ["_id", "_disable"];
if (isnil QGVAR(DISABLE_USER_INPUT_COLLECTION)) then {
if (isNil QGVAR(DISABLE_USER_INPUT_COLLECTION)) then {
GVAR(DISABLE_USER_INPUT_COLLECTION) = [];
};
if (_disable) then {
GVAR(DISABLE_USER_INPUT_COLLECTION) pushback _id;
GVAR(DISABLE_USER_INPUT_COLLECTION) pushBack _id;
[true] call FUNC(disableUserInput);
} else {
GVAR(DISABLE_USER_INPUT_COLLECTION) = GVAR(DISABLE_USER_INPUT_COLLECTION) - [_id];
if (GVAR(DISABLE_USER_INPUT_COLLECTION) isEqualTo []) then {
[false] call FUNC(disableUserInput);
};
};
};

View File

@ -1,36 +1,34 @@
/*
Name: FUNC(setForceWalkStatus)
Author: Pabst Mirror (from captivity by commy2)
Description:
Sets the forceWalk status of an unit. This allows the handling of more than one reason to set forceWalk.
Unit will force walk until all reasons are removed.
Parameters:
0: OBJECT - Unit
1: STRING - Reason for forcing walking
2: BOOL - Is the reason still valid. True to force walk, false to remove restriction.
Returns:
None
Example:
[ACE_Player, "BrokenLeg", true] call FUNC(setForceWalkStatus)
* Author: Pabst Mirror (from captivity by commy2)
* Sets the forceWalk status of an unit. This allows the handling of more than one reason to set forceWalk.
* Unit will force walk until all reasons are removed.
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Reason for forcing walking <STRING>
* 2: Is the reason still valid. True to force walk, false to remove restriction. <BOOL>
*
* Returns:
* None
*
* Example:
* [ACE_Player, "BrokenLeg", true] call FUNC(setForceWalkStatus)
*
* Public: No
*/
#include "script_component.hpp"
private ["_forceWalkReasons", "_unitForceWalkReasons", "_forceWalkReasonsBooleans", "_bitmaskNumber"];
params ["_unit", "_reason", "_status"];
PARAMS_3(_unit,_reason,_status);
private ["_forceWalkReasons", "_unitForceWalkReasons", "_forceWalkReasonsBooleans", "_bitmaskNumber"];
_forceWalkReasons = missionNamespace getVariable ["ACE_forceWalkReasons", []];
// register new reason (these reasons are shared publicly, since units can change ownership, but keep their forceWalk status)
if !(_reason in _forceWalkReasons) then {
_forceWalkReasons pushBack _reason;
ACE_forceWalkReasons = _forceWalkReasons;
publicVariable "ACE_forceWalkReasons";
_forceWalkReasons pushBack _reason;
ACE_forceWalkReasons = _forceWalkReasons;
publicVariable "ACE_forceWalkReasons";
};
// get reasons why the unit is forceWalking already and update to the new status
@ -38,7 +36,7 @@ _unitForceWalkReasons = [_unit] call FUNC(getForceWalkStatus);
_forceWalkReasonsBooleans = [];
{
_forceWalkReasonsBooleans set [_forEachIndex, (_forceWalkReasons select _forEachIndex) in _unitForceWalkReasons];
_forceWalkReasonsBooleans set [_forEachIndex, (_forceWalkReasons select _forEachIndex) in _unitForceWalkReasons];
} forEach _forceWalkReasons;
_forceWalkReasonsBooleans set [_forceWalkReasons find _reason, _status];
@ -48,4 +46,4 @@ _bitmaskNumber = _forceWalkReasonsBooleans call FUNC(toBitmask);
_unit setVariable ["ACE_forceWalkStatusNumber", _bitmaskNumber, true];
// actually apply the forceWalk command globaly
[[_unit], QUOTE(FUNC(applyForceWalkStatus)), 2] call FUNC(execRemoteFnc);
[[_unit], QFUNC(applyForceWalkStatus), 2] call FUNC(execRemoteFnc);

View File

@ -1,23 +1,22 @@
/**
* fn_setHearingCapability.sqf
* @Descr: Handle set volume calls. Will use the lowest available volume setting.
* @Author: Glowbal
/*
* Author: Glowbal
* Handle set volume calls. Will use the lowest available volume setting.
*
* @Arguments: [id STRING, settings NUMBER, add BOOL (Optional. True will add, false will remove. Default value is true)]
* @Return: nil
* @PublicAPI: true
* Arguments:
* 0: id <STRING>
* 1: settings <NUMBER>
* 2: add (default: true) <BOOL>
*
* Return Value:
* None
*
* Public: Yes
*/
#include "script_component.hpp"
private ["_add", "_exists", "_map", "_lowestVolume"];
params ["_id", "_settings", ["_add", true]];
PARAMS_2(_id,_settings);
_add = true;
if (count _this > 2) then {
_add = _this select 2;
};
private ["_map", "_exists", "_lowestVolume"];
_map = missionNamespace getVariable [QGVAR(setHearingCapabilityMap),[]];
@ -44,7 +43,8 @@ missionNamespace setVariable [QGVAR(setHearingCapabilityMap), _map];
_lowestVolume = 1;
{
_lowestVolume = (_x select 1) min _lowestVolume;
} forEach _map;
false
} count _map;
// in game sounds
0 fadeSound _lowestVolume;

View File

@ -4,19 +4,23 @@
* Sets the value of an ACE_Parameter and makes it public.
*
* Arguments:
* 0: Parameter name (string)
* 0: Parameter name <STRING>
* 1: Value
*
* Return Value:
* None
*
* Public: Yes
*
* Deprecated *@todo commy
*/
#include "script_component.hpp"
PARAMS_2(_name,_value);
params ["_name", "_value"];
// Hack to keep backward compatibility for the moment
if ((typeName (missionNamespace getVariable _name)) == "BOOL") then {
if ((typeName _value) == "SCALAR") then {
if (typeName (missionNamespace getVariable _name) == "BOOL") then {
if (typeName _value == "SCALAR") then {
_value = _value > 0;
};
};

View File

@ -1,26 +1,25 @@
/*
* Taken From:
* https://community.bistudio.com/wiki/BIS_fnc_setPitchBank
* Edited By:
* KoffeinFlummi
* Author: Bohemia Interactive edit by KoffeinFlummi
* Sets the value of an ACE_Parameter and makes it public.
*
* Arguments:
* 0: Unit/Vehicle
* 1: Pitch (degrees)
* 2: Yaw (degrees)
* 3: Bank (degrees)
* 0: Unit/Vehicle <OBJECT>
* 1: Pitch <NUMBER>
* 2: Yaw <NUMBER>
* 3: Bank <NUMBER>
*
* Return Value:
* None
*
* Public: Yes
*/
#include "script_component.hpp"
private ["_object", "_aroundX", "_aroundY", "_aroundZ", "_dirX", "_dirY", "_dirZ", "_upX", "_upY", "_upZ", "_dir", "_up", "_dirXTemp", "_upXTemp"];
params ["_object", "_aroundX", "_aroundY", "_aroundZ"];
_object = _this select 0;
_aroundX = _this select 1;
_aroundY = _this select 2;
_aroundZ = (360 - (_this select 3)) - 360;
_aroundZ = - _aroundZ;
private ["_dirX", "_dirY", "_dirZ", "_upX", "_upY", "_upZ", "_dir", "_up"];
_dirX = 0;
_dirY = 1;
@ -28,28 +27,34 @@ _dirZ = 0;
_upX = 0;
_upY = 0;
_upZ = 1;
if (_aroundX != 0) then {
_dirY = cos _aroundX;
_dirZ = sin _aroundX;
_upY = -sin _aroundX;
_upZ = cos _aroundX;
};
if (_aroundY != 0) then {
_dirX = _dirZ * sin _aroundY;
_dirZ = _dirZ * cos _aroundY;
_upX = _upZ * sin _aroundY;
_upZ = _upZ * cos _aroundY;
};
if (_aroundZ != 0) then {
_dirXTemp = _dirX;
_dirX = (_dirXTemp* cos _aroundZ) - (_dirY * sin _aroundZ);
_dirY = (_dirY * cos _aroundZ) + (_dirXTemp * sin _aroundZ);
_upXTemp = _upX;
_upX = (_upXTemp * cos _aroundZ) - (_upY * sin _aroundZ);
_upY = (_upY * cos _aroundZ) + (_upXTemp * sin _aroundZ);
_dirY = cos _aroundX;
_dirZ = sin _aroundX;
_upY = -sin _aroundX;
_upZ = cos _aroundX;
};
_dir = [_dirX,_dirY,_dirZ];
_up = [_upX,_upY,_upZ];
if (_aroundY != 0) then {
_dirX = _dirZ * sin _aroundY;
_dirZ = _dirZ * cos _aroundY;
_upX = _upZ * sin _aroundY;
_upZ = _upZ * cos _aroundY;
};
if (_aroundZ != 0) then {
private ["_dirXTemp", "_upXTemp"];
_dirXTemp = _dirX;
_dirX = (_dirXTemp* cos _aroundZ) - (_dirY * sin _aroundZ);
_dirY = (_dirY * cos _aroundZ) + (_dirXTemp * sin _aroundZ);
_upXTemp = _upX;
_upX = (_upXTemp * cos _aroundZ) - (_upY * sin _aroundZ);
_upY = (_upY * cos _aroundZ) + (_upXTemp * sin _aroundZ);
};
_dir = [_dirX, _dirY, _dirZ];
_up = [_upX, _upY, _upZ];
_object setVectorDirAndUp [_dir,_up];

View File

@ -1,28 +1,22 @@
/**
* fn_setProne.sqf
* @Descr: Force a unit to go prone
* @Author: Glowbal
/*
* Author: Glowbal
* Force a unit to go prone
*
* @Arguments: [unit OBJECT]
* @Return: void
* @PublicAPI: true
* Arguments:
* 0: Unit <OBJECT>
*
* Return Value:
* None
*
* Public: Yes
*
* Note: Not functional, because FUNC(localAnim) does no longer exist
*/
#include "script_component.hpp"
private ["_unit"];
_unit = [_this,0, ObjNull,[ObjNull]] call BIS_fnc_Param;
switch (currentWeapon _unit) do {
case (primaryWeapon _unit): {
[_unit,"amovppnemstpsraswrfldnon"] call FUNC(localAnim);
};
case (secondaryWeapon _unit): {
[_unit,"amovppnemstpsraswlnrdnon"] call FUNC(localAnim);
};
case (handgunWeapon _unit): {
[_unit,"AmovPpneMstpSrasWpstDnon"] call FUNC(localAnim);
};
default {
[_unit,"amovppnemstpsnonwnondnon"] call FUNC(localAnim);
};
};
params ["_unit"];
[
_unit,
["amovppnemstpsnonwnondnon", "amovppnemstpsraswrfldnon", "amovppnemstpsraswlnrdnon", "amovppnemstpsraswpstdnon"] select (([primaryWeapon _unit, secondaryWeapon _unit, handgunWeapon _unit] find currentWeapon _unit) + 1)
] call FUNC(localAnim);

View File

@ -5,10 +5,10 @@
* If executed on server it can have global effect if the last parameter is set to true.
*
* Arguments:
* 0: Setting name (String)
* 1: Value (Any)
* 2: Force it? (Bool) (Optional)
* 3: Broadcast the change to all clients (Bool) (Optional)
* 0: Setting name <STRING>
* 1: Value <ANY>
* 2: Force it? (default: false) <BOOL>
* 3: Broadcast the change to all clients (default: false) <BOOL>
*
* Return Value:
* None
@ -17,15 +17,9 @@
*/
#include "script_component.hpp"
private ["_force", "_settingData","_failed"];
params ["_name", "_value", ["_force", false], ["_broadcastChanges", false]];
PARAMS_2(_name,_value);
private ["_force"];
_force = false;
if (count _this > 2) then {
_force = _this select 2;
};
private ["_settingData", "_failed"];
_settingData = [_name] call FUNC(getSettingData);
@ -37,9 +31,9 @@ if (_settingData select 6) exitWith {};
// If the type is not equal, try to cast it
_failed = false;
if ((typeName _value) != (_settingData select 1)) then {
if (typeName _value != _settingData select 1) then {
_failed = true;
if ((_settingData select 1) == "BOOL" and (typeName _value) == "SCALAR") then {
if (_settingData select 1 == "BOOL" && typeName _value == "SCALAR") then {
// If value is not 0 or 1 consider it invalid and don't set anything
if (_value isEqualTo 0) then {
_value = false;
@ -50,10 +44,11 @@ if ((typeName _value) != (_settingData select 1)) then {
_failed = false;
};
};
if ((_settingData select 1) == "COLOR" and (typeName _value) == "ARRAY") then {
if (_settingData select 1 == "COLOR" && typeName _value == "ARRAY") then {
_failed = false;
};
};
if (_failed) exitWith {};
// Force it if it was required
@ -66,7 +61,7 @@ if (_value isEqualTo (missionNamespace getVariable _name)) exitWith {};
TRACE_2("Variable Updated",_name,_value);
missionNamespace setVariable [_name, _value];
if (isServer && {count _this > 3} && {_this select 3}) then {
if (isServer && {_broadcastChanges}) then {
// Publicize the new value
publicVariable _name;

View File

@ -3,7 +3,7 @@
* Load a setting from config if it was not previosuly forced. Force if neccesary.
*
* Arguments:
* 0: Config entry (config entry)
* 0: Config entry <CONFIG>
*
* Return Value:
* None
@ -12,12 +12,12 @@
*/
#include "script_component.hpp"
PARAMS_1(_optionEntry);
params ["_optionEntry"];
private ["_fnc_getValueWithType", "_value","_name", "_typeName", "_settingData", "_valueConfig", "_text"];
private ["_fnc_getValueWithType", "_value", "_name", "_typeName", "_settingData", "_valueConfig", "_text"];
_fnc_getValueWithType = {
EXPLODE_2_PVT(_this,_optionEntry,_typeName);
params ["_optionEntry", "_typeName"];
_valueConfig = (_optionEntry >> "value");
_value = if (isNumber (_optionEntry >> "value")) then {getNumber (_optionEntry >> "value")} else {0};
@ -103,11 +103,8 @@ if (isNil _name) then {
// The setting is not forced, so update the value
// Get the type from the existing variable
_typeName = _settingData select 1;
// Read entry and cast it to the correct type
_value = [_optionEntry, _typeName] call _fnc_getValueWithType;
// Read entry and cast it to the correct type from the existing variable
_value = [_optionEntry, _settingData select 1] call _fnc_getValueWithType;
// Update the variable
missionNamespace setVariable [_name, _value];

View File

@ -3,25 +3,26 @@
*
* Sets a public object namespace variable that gets reset with the same value after respawn, so JIP clients keep the value.
*
* Argument:
* 0: Object (Object)
* 1: Variable name (String)
* 2: Any value (Anything)
* Arguments:
* 0: Object <OBJECT>
* 1: Variable name <STRING>
* 2: Any value <ANY>
*
* Return value:
* Nothing.
* Return Value:
* None
*
* Public: No
*/
#include "script_component.hpp"
private ["_respawnVariables"];
PARAMS_3(_unit,_varName,_value);
params ["_unit", "_varName", "_value"];
private "_respawnVariables";
_respawnVariables = _unit getVariable ["ACE_respawnVariables", []];
if !(_varName in _respawnVariables) then {
_respawnVariables pushBack _varName;
_unit setVariable ["ACE_respawnVariables", _respawnVariables, true];
_respawnVariables pushBack _varName;
_unit setVariable ["ACE_respawnVariables", _respawnVariables, true];
};
_unit setVariable [_varName, _value, true];

View File

@ -1,54 +1,60 @@
/*
* Author: commy2
* Author: commy2 and joko // Jonas
*
* Sets a public variable, but wait a certain amount of ACE_time to transfer the value over the network. Changing the value by calling this function again resets the windup timer.
*
* Argument:
* 0: Object the variable should be assigned to (Object)
* 1: Name of the variable (String)
* 2: Value of the variable (Any)
* 3: Windup ACE_time (Number, optional. Default: 1)
* Arguments:
* 0: Object the variable should be assigned to <OBJECT>
* 1: Name of the variable <STRING>
* 2: Value of the variable <ANY>
* 3: Windup ACE_time <NUMBER> (default: 1)
*
* Return value:
* Nothing.
* Return Value:
* None
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_4(_object,_varName,_value,_sync);
if (isNil "_sync") then {
_sync = 1;
};
params ["_object", "_varName", "_value", ["_sync", 1]];
// set value locally
_object setVariable [_varName, _value];
// "duh"
// Exit if in SP
if (!isMultiplayer) exitWith {};
// generate stacked eventhandler id
private "_idName";
private ["_idName", "_syncTime"];
_idName = format ["ACE_setVariablePublic_%1", _varName];
// exit now if an eh for that variable already exists
private "_allIdNames";
_allIdNames = [GETMVAR(BIS_stackedEventHandlers_onEachFrame,[]), {_this select 0}] call FUNC(map);
if (_idName in GVAR(setVariableNames)) exitWith {};
if (_idName in _allIdNames) exitWith {};
// when to push the value
private "_syncTime";
_syncTime = ACE_diagTime + _sync;
// add eventhandler
[_idName, "onEachFrame", {
// wait to sync the variable
if (ACE_diagTime > _this select 2) then {
// set value public
(_this select 0) setVariable [_this select 1, (_this select 0) getVariable (_this select 1), true];
GVAR(setVariableNames) pushBack _idName;
// remove eventhandler
[_this select 3, "onEachFrame"] call BIS_fnc_removeStackedEventHandler
GVAR(setVariablePublicArray) pushBack [_object, _varName, _syncTime, _idName];
if (isNil QGVAR(setVariablePublicPFH)) exitWith {};
GVAR(setVariablePublicPFH) = [{
private "_delete";
_delete = 0;
{
_x params ["_object", "_varName", "_syncTime", "_idName"];
if (ACE_diagTime > _syncTime) then {
// set value public
_object setVariable [_varName, _object getVariable _varName, true];
GVAR(setVariablePublicArray) deleteAt _forEachIndex - _delete;
GVAR(setVariableNames) deleteAt _forEachIndex - _delete;
_delete = _delete + 1;
};
} forEach GVAR(setVariablePublicArray);
if (GVAR(setVariablePublicArray) isEqualTo []) then {
[GVAR(setVariablePublicPFH)] call CBA_fnc_removePerFrameHandler;
GVAR(setVariablePublicPFH) = nil;
};
}, [_object, _varName, _syncTime, _idName]] call BIS_fnc_addStackedEventHandler;
nil
}, 0, []] call CBA_fnc_addPerFrameHandler;

View File

@ -1,21 +1,24 @@
/**
* fn_setVolume_f.sqf
* @Descr: Sets the volume of the game, including third party radio modifications such as TFAR and ACRE.
* @Author: Glowbal
/*
* Author: Glowbal
* Sets the volume of the game, including third party radio modifications such as TFAR and ACRE.
*
* @Arguments: [setVolume BOOL]
* @Return: void
* @PublicAPI: true
* Arguments:
* 0: setVolume (default: false) <BOOL>
*
* Return Value:
* None
*
* Public: Yes
*
* Note: Uses player
*/
#include "script_component.hpp"
#define MUTED_LEVEL 0.2
#define NORMAL_LEVEL 1
#define NO_SOUND 0
private ["_setVolume"];
_setVolume = [_this, 0, false, [false]] call BIS_fnc_Param;
params [["_setVolume", false]];
if (_setVolume) then {
// Vanilla Game

View File

@ -1,6 +1,5 @@
/*
* Author: commy2
*
* hint the Variable ACE_isUsedBy from the input Object every frame
*
* Argument:

View File

@ -1,18 +1,22 @@
/**
* fn_sortAlphabeticallyBy.sqf
* @Descr:
* @Author: Glowbal
/*
* Author: Glowbal
* ? deprecated
*
* @Arguments: []
* @Return:
* @PublicAPI: true
* Arguments:
* ?
*
* Return Value:
* ?
*
* Public: Yes
*
* Deprecated
*/
#include "script_component.hpp"
private ["_elements","_indexes", "_theElement", "_tmp", "_tempIndex", "_j", "_i", "_returnArray"];
params ["_array", "_elementN"];
PARAMS_2(_array,_elementN);
private ["_elements", "_indexes", "_theElement", "_tmp", "_tempIndex", "_returnArray"];
_indexes = [];
_elements = [];
@ -37,8 +41,9 @@ for "_i" from 1 to (count _elements) - 1 do {
};
_returnArray = [];
{
_returnArray pushback (_array select _x);
} forEach _indexes;
_returnArray;
_returnArray

View File

@ -1,21 +1,26 @@
/**
* fn_stringTrim.sqf
* @Descr: Removes white spaces from string
* @Author: Glowbal
/*
* Author: Glowbal
* Removes white spaces from string
*
* @Arguments: [string STRING]
* @Return: STRING copy of string
* @PublicAPI: true
* Arguments:
* 0: stringA <STRING>
* 1: stringB <STRING>
*
* Return Value:
* copy of string <STRING>
*
* Public: Yes
*
* Deprecated
*/
#include "script_component.hpp"
#define WHITE_SPACE [20]
params ["_string", ""];
private ["_charArray", "_returnString"];
private ["_string", "_charArray", "_returnString"];
_string = [_this, 0, "",[""]] call bis_fnc_param;
_charArray = toArray _string;
_charArray = _charArray - [((toArray " ") select 0)];
_returnString = toString _charArray;
_returnString;
_returnString

View File

@ -1,45 +1,53 @@
/**
* fn_switchToGroupSide_f.sqf
* @Descr: Stack group switches. Will always trace back to original group.
* @Author: Glowbal
/*
* Author: Glowbal
* Stack group switches. Will always trace back to original group.
*
* @Arguments: [unit OBJECT, switch BOOL, id STRING, side SIDE]
* @Return: void
* @PublicAPI: true
* Arguments:
* 0: Unit <OBJECT>
* 1: switch <BOOLEAN>
* 2: id <STRING>
* 3: side <SIDE>
*
* Return Value:
* None
*
* Public: Yes
*/
#include "script_component.hpp"
private ["_unit","_side","_previousGroup","_newGroup", "_currentGroup", "_switch", "_originalSide", "_previousGroupsList", "_id"];
_unit = [_this, 0,ObjNull,[ObjNull]] call BIS_fnc_Param;
_switch = [_this, 1, false,[false]] call BIS_fnc_Param;
_id = [_this, 2, "", [""]] call BIS_fnc_Param;
_side = [_this, 3, side _unit,[west]] call BIS_fnc_Param;
params [["_unit", objNull], ["_switch", false], ["_id", ""], ["_side", side _unit]];
private "_previousGroupsList";
_previousGroupsList = _unit getvariable [QGVAR(previousGroupSwitchTo), []];
_previousGroupsList = _unit getvariable [QGVAR(previousGroupSwitchTo),[]];
if (_switch) then {
// go forward
private ["_previousGroup", "_originalSide", "_newGroup"];
_previousGroup = group _unit;
_originalSide = side group _unit;
if (count units _previousGroup == 1 && _originalSide == _side) exitwith {
[format["Current group has only 1 member and is of same side as switch. Not switching unit %1", _id]] call FUNC(debug);
[format ["Current group has only 1 member and is of same side as switch. Not switching unit %1", _id]] call FUNC(debug);
};
_newGroup = createGroup _side;
[_unit] joinSilent _newGroup;
_previousGroupsList pushback [_previousGroup, _originalSide, _id, true];
_unit setvariable [QGVAR(previousGroupSwitchTo), _previousGroupsList, true];
_previousGroupsList pushBack [_previousGroup, _originalSide, _id, true];
_unit setVariable [QGVAR(previousGroupSwitchTo), _previousGroupsList, true];
} else {
// go one back
private ["_currentGroup", "_newGroup"];
{
if (_id == (_x select 2)) exitwith {
_x set [ 3, false];
_previousGroupsList set [_foreachIndex, _x];
_previousGroupsList set [_forEachIndex, _x];
[format["found group with ID: %1", _id]] call FUNC(debug);
};
}foreach _previousGroupsList;
} forEach _previousGroupsList;
reverse _previousGroupsList;
{
@ -55,10 +63,12 @@ if (_switch) then {
if (count units _currentGroup == 0) then {
deleteGroup _currentGroup;
};
_previousGroupsList set [_foreachIndex, ObjNull];
_previousGroupsList set [_forEachIndex, objNull];
};
}foreach _previousGroupsList;
} forEach _previousGroupsList;
_previousGroupsList = _previousGroupsList - [objNull];
reverse _previousGroupsList; // we have to reverse again, to ensure the list is in the right order.
_unit setvariable [QGVAR(previousGroupSwitchTo), _previousGroupsList, true];
_unit setVariable [QGVAR(previousGroupSwitchTo), _previousGroupsList, true];
};

View File

@ -1,24 +1,23 @@
/*
* Author: Nou
*
* Execute a event only on specific clients.
*
* Argument:
* 0: Event name (string)
* 1: Event targets (object or array of objects)
* 2: Event args (any)
* Arguments:
* 0: Event name (STRING)
* 1: Event targets <OBJECT, ARRAY>
* 2: Event args <ANY>
*
* Note: If local executor is in list of targets, event will execute with
* network delay, and not immediatly.
*
* Return value:
* Nothing
* Return Value:
* None
*
* Public: Yes
*/
#include "script_component.hpp"
//IGNORE_PRIVATE_WARNING("_handleNetEvent");
PARAMS_3(_eventName,_eventTargets,_eventArgs);
params ["_eventName", "_eventTargets", "_eventArgs"];
#ifdef DEBUG_EVENTS
ACE_LOGINFO_2("* Target Event: %1 - %2",_eventName,_eventTargets);
@ -26,7 +25,8 @@ PARAMS_3(_eventName,_eventTargets,_eventArgs);
#endif
ACEc = [_eventName, _eventTargets, _eventArgs];
if(!isServer) then {
if (!isServer) then {
publicVariableServer "ACEc";
} else {
["ACEc", ACEc] call FUNC(_handleNetEvent);

View File

@ -1,7 +1,18 @@
//#define DEBUG_MODE_FULL
/*
* Author: ?
* ?
*
* Arguments:
* ?
*
* Return Value:
* ?
*
* Public: ?
*/
#include "script_component.hpp"
private["_lastTickTime", "_lastGameTime", "_delta"];
private ["_lastTickTime", "_lastGameTime", "_delta"];
_lastTickTime = ACE_diagTime;
_lastGameTime = ACE_gameTime;
@ -10,7 +21,7 @@ ACE_gameTime = time;
ACE_diagTime = diag_tickTime;
_delta = ACE_diagTime - _lastTickTime;
if(ACE_gameTime <= _lastGameTime) then {
if (ACE_gameTime <= _lastGameTime) then {
TRACE_1("paused",_delta);
ACE_paused = true;
// Game is paused or not running

View File

@ -1,13 +1,12 @@
/*
* Author: commy2
*
* Converts number to binary number
*
* Arguments:
* A number
* A number <NUMBER>
*
* Return Value:
* A binary number, String
* A binary number as string <STRING>
*
* Public: Yes
*/
@ -32,4 +31,4 @@ while {count toArray _bin < _minLength} do {
_bin = "0" + _bin;
};
_sign + _bin
_sign + _bin // return

View File

@ -1,13 +1,12 @@
/*
* Author: commy2
*
* Convert an array of booleans into a number.
*
* Arguments:
* N: Booleans <ARRAY of Booleans>
* N: Booleans <ARRAY>
*
* Return Value:
* Bitmask (Number)
* Bitmask <NUMBER>
*
* Public: Yes
*/
@ -18,6 +17,7 @@ private ["_array", "_result"];
_array = _this;
_result = 0;
{
if (_x) then {_result = _result + 2 ^ _forEachIndex};
} forEach _array;

View File

@ -1,26 +1,28 @@
/*
* Author: commy2, esteldunedain
*
* Converts number to hexadecimal number
*
* Arguments:
* A number between 0 and 255 <NUMBER>
*
* Return Value:
* A hexadecimal number, <STRING>
* A hexadecimal number as string <STRING>
*
* Public: Yes
*/
#include "script_component.hpp"
private ["_number"];
_number = ((round abs (_this select 0)) max 0) min 255;
params ["_number"];
_number = ((round abs _number) max 0) min 255;
if (isNil QGVAR(hexArray)) then {
private ["_minLength", "_i", "_num", "_hex", "_rest"];
GVAR(hexArray) = [];
private ["_minLength", "_num", "_hex", "_rest"];
_minLength = 2;
for [{_i = 0;}, {_i < 256}, {_i = _i + 1}] do {
_num = _i;
_hex = ["", "0"] select (_i == 0);
@ -39,11 +41,13 @@ if (isNil QGVAR(hexArray)) then {
_num = floor (_num / 16);
_hex = _rest + _hex;
};
while {count toArray _hex < _minLength} do {
_hex = "0" + _hex;
};
GVAR(hexArray) pushBack _hex;
};
};
(GVAR(hexArray) select _number)
GVAR(hexArray) select _number // return

View File

@ -1,25 +1,23 @@
/*
Name: FUNC(toNumber)
Author(s):
Garth de Wet (LH)
Description:
Takes a string/number and returns the number.
Parameters:
0: TYPE - Value to attempt to convert to number or if number simply return number.
Returns:
NUMBER
Example:
number = ["102"] call FUNC(toNumber);
*/
* Author: Garth de Wet (LH)
*
* Takes a string/number and returns the number.
*
* Arguments:
* 0: Value to attempt to convert to number or if number simply return number. <STRING, NUMBER>
*
* Return Value:
* <NUMBER>
*
* Example:
* number = ["102"] call ace_common_fnc_toNumber;
*
* Public: Yes
*/
#include "script_component.hpp"
if (typeName (_this select 0) == "SCALAR") exitWith {
(_this select 0)
};
params ["_value"];
(parseNumber (_this select 0))
if (typeName _value == "SCALAR") exitWith {_value};
parseNumber _value // return

View File

@ -1,20 +1,25 @@
/*
* Author: ?
*
* ?
*
* Arguments:
* ?
*
* Return Value:
* ?
*
* Public: ?
*/
#include "script_component.hpp"
private["_matrix", "_object", "_offset", "_origin", "_out", "_xVec", "_y", "_yVec", "_z", "_zVec"];
params ["_object", "_matrix", "_offset"];
_object = _this select 0;
private "_origin";
_origin = getPosASL _object;
_matrix = _this select 1;
_xVec = _matrix select 0;
_yVec = _matrix select 1;
_zVec = _matrix select 2;
_offset = _this select 2;
_matrix params ["_xVec", "_yVec", "_zVec"];
_x = _offset select 0;
_y = _offset select 1;
_z = _offset select 2;
_offset params ["_x", "_y", "_z"];
_out = (((_xVec vectorMultiply _x) vectorAdd (_yVec vectorMultiply _y)) vectorAdd (_zVec vectorMultiply _z)) vectorAdd _origin;
_out;
(_xVec vectorMultiply _x) vectorAdd (_yVec vectorMultiply _y) vectorAdd (_zVec vectorMultiply _z) vectorAdd _origin // return

View File

@ -1,26 +1,31 @@
/*
* Author: ?
*
* ?
*
* Arguments:
* ?
*
* Return Value:
* ?
*
* Public: ?
*/
#include "script_component.hpp"
private["_matrix", "_object", "_offset", "_origin", "_out", "_xVec", "_y", "_yVec", "_z", "_zVec"];
params ["_object", "_matrix", "_offset"];
_object = _this select 0;
private "_origin";
_origin = getPosASL _object;
_matrix = _this select 1;
_xVec = _matrix select 0;
_yVec = _matrix select 1;
_zVec = _matrix select 2;
_offset = _this select 2;
_matrix params ["_xVec", "_yVec", "_zVec"];
_offset = _offset vectorDiff _origin;
_x = _offset select 0;
_y = _offset select 1;
_z = _offset select 2;
_offset params ["_x", "_y", "_z"];
_out = [
((_xVec select 0)*_x) + ((_xVec select 1)*_y) + ((_xVec select 2)*_z),
((_yVec select 0)*_x) + ((_yVec select 1)*_y) + ((_yVec select 2)*_z),
((_zVec select 0)*_x) + ((_zVec select 1)*_y) + ((_zVec select 2)*_z)
];
_out;
[
((_xVec select 0) * _x) + ((_xVec select 1) * _y) + ((_xVec select 2) * _z),
((_yVec select 0) * _x) + ((_yVec select 1) * _y) + ((_yVec select 2) * _z),
((_zVec select 0) * _x) + ((_zVec select 1) * _y) + ((_zVec select 2) * _z)
] // return

View File

@ -107,7 +107,7 @@ addMissionEventHandler ["Draw3D", DFUNC(render)];
//Debug to help end users identify mods that break CBA's XEH
["SettingsInitialized", {
[{
private ["_badClassnames"];
_badClassnames = [];
{
@ -122,7 +122,11 @@ addMissionEventHandler ["Draw3D", DFUNC(render)];
ACE_LOGINFO("All compile checks passed");
} else {
ACE_LOGERROR_1("%1 Classnames failed compile check!!! (bad XEH / missing cba_enable_auto_xeh.pbo)", (count _badClassnames));
["ACE Interaction failed to compile for some units (try adding cba_enable_auto_xeh.pbo)"] call BIS_fnc_error;
};
}] call EFUNC(common,addEventHandler);
//Only show visual error if they are actually missing the pbo:
#define SUPMON configFile>>"CfgSettings">>"CBA">>"XEH">>"supportMonitor"
if ((!isNumber(SUPMON)) || {getNumber(SUPMON) != 1}) then {
["ACE Interaction failed to compile for some units (try adding cba_enable_auto_xeh.pbo)"] call BIS_fnc_error;
};
};
}, [], 5] call EFUNC(common,waitAndExecute); //ensure CBASupMon has time to run first

Some files were not shown because too many files have changed in this diff Show More