mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge pull request #2545 from acemod/commoncleanup9
common code cleanup part 9
This commit is contained in:
commit
ef099861a3
@ -80,6 +80,7 @@ if (_eventType == "ACEc") then {
|
||||
["ACEg", ACEg] call FUNC(_handleNetEvent);
|
||||
};
|
||||
};
|
||||
} forEach _eventTargets;
|
||||
false
|
||||
} count _eventTargets;
|
||||
};
|
||||
};
|
||||
|
@ -21,6 +21,7 @@ params ["_client"];
|
||||
_eventLog = _eventEntry select 1;
|
||||
|
||||
["SEH_s", _client, [_x, _eventLog]] call FUNC(targetEvent);
|
||||
} forEach (GVAR(syncedEvents) select 0);
|
||||
false
|
||||
} count (GVAR(syncedEvents) select 0);
|
||||
|
||||
true
|
||||
|
@ -41,7 +41,8 @@ if (isServer) then {
|
||||
{
|
||||
_x params ["", "_eventArgs","_ttl"];
|
||||
[_eventName, _eventArgs, _ttl] call FUNC(_handleSyncedEvent);
|
||||
} forEach _eventLog;
|
||||
false
|
||||
} count _eventLog;
|
||||
|
||||
ACE_LOGINFO_1("[%1] synchronized",_eventName);
|
||||
};
|
||||
|
@ -17,11 +17,11 @@ params ["_conditionName", "_conditionFunc"];
|
||||
|
||||
_conditionName = toLower _conditionName;
|
||||
|
||||
private "_conditions";
|
||||
private ["_conditions", "_index"];
|
||||
|
||||
_conditions = missionNamespace getVariable [QGVAR(InteractionConditions), [[],[]]];
|
||||
_conditions params ["_conditionNames", "_conditionFuncs"];
|
||||
|
||||
private "_index";
|
||||
_index = _conditionNames find _conditionName;
|
||||
|
||||
if (_index == -1) then {
|
||||
|
@ -1,6 +1,5 @@
|
||||
/*
|
||||
* Author: commy2, idea by Falke
|
||||
*
|
||||
* Returns a brightness value depending on the sun and moon state. Ranges from 0 to 1 (dark ... bright).
|
||||
*
|
||||
* Arguments:
|
||||
|
@ -9,10 +9,10 @@
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [ACE_Player] call FUNC(applyForceWalkStatus)
|
||||
* [ACE_Player] call ace_common_fnc_applyForceWalkStatus
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_unit"];
|
||||
|
@ -14,37 +14,40 @@
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_splittedList", "_nilCheckPassedList"];
|
||||
params ["_list", "_variable", "_setting", "_global"];
|
||||
|
||||
if (typeName _list == "STRING") then {
|
||||
private ["_splittedList", "_nilCheckPassedList"];
|
||||
|
||||
_splittedList = [_list, ","] call BIS_fnc_splitString;
|
||||
_nilCheckPassedList = "";
|
||||
|
||||
{
|
||||
_x = [_x] call FUNC(stringRemoveWhiteSpace);
|
||||
if !(isnil _x) then {
|
||||
if !(isNil _x) then {
|
||||
if (_nilCheckPassedList == "") then {
|
||||
_nilCheckPassedList = _x;
|
||||
} else {
|
||||
_nilCheckPassedList = _nilCheckPassedList + ","+ _x;
|
||||
};
|
||||
};
|
||||
}foreach _splittedList;
|
||||
false
|
||||
} count _splittedList;
|
||||
|
||||
_list = [] call compile format["[%1]",_nilCheckPassedList];
|
||||
};
|
||||
|
||||
{
|
||||
if (!isnil "_x") then {
|
||||
if (!isNil "_x") then {
|
||||
if (typeName _x == typeName objNull) then {
|
||||
if (local _x) then {
|
||||
_x setvariable [_variable, _setting, _global];
|
||||
};
|
||||
};
|
||||
};
|
||||
}foreach _list;
|
||||
false
|
||||
} count _list;
|
||||
|
||||
true
|
||||
|
@ -10,7 +10,6 @@
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
if (!hasInterface) exitWith {};
|
||||
|
@ -1,6 +1,5 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
*
|
||||
* Is the unit able to enter the vehicle in the given position?
|
||||
*
|
||||
* Arguments:
|
||||
|
@ -10,6 +10,7 @@
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
*
|
||||
* Returns the current radio / chat / marker channel.
|
||||
*
|
||||
* Arguments:
|
||||
|
@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
* ?
|
||||
*
|
||||
* Arguments:
|
||||
* None
|
||||
@ -9,7 +10,6 @@
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_entity"];
|
||||
|
@ -5,23 +5,20 @@
|
||||
* Arguments:
|
||||
* 0: True to disable key inputs, false to re-enable them <BOOL>
|
||||
*
|
||||
* Return value:
|
||||
* Nothing
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: Yes
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_dlg"];
|
||||
|
||||
PARAMS_1(_state);
|
||||
params ["_state"];
|
||||
|
||||
if (_state) then {
|
||||
disableSerialization;
|
||||
|
||||
if (!isNull (uiNamespace getVariable [QGVAR(dlgDisableMouse), displayNull])) exitWith {};
|
||||
if ("ACE_DisableUserInput" in ([BIS_stackedEventHandlers_onEachFrame, {_this select 0}] call FUNC(map))) exitWith {};
|
||||
if (!isNil QGVAR(disableInputPFH)) exitWith {};
|
||||
|
||||
// end TFAR and ACRE2 radio transmissions
|
||||
call FUNC(endRadioTransmission);
|
||||
@ -34,19 +31,22 @@ if (_state) then {
|
||||
closeDialog 0;
|
||||
createDialog QGVAR(DisableMouse_Dialog);
|
||||
|
||||
private "_dlg";
|
||||
_dlg = uiNamespace getVariable QGVAR(dlgDisableMouse);
|
||||
|
||||
_dlg displayAddEventHandler ["KeyDown", {
|
||||
private ["_key", "_dlg", "_ctrl", "_config", "_acc", "_index"];
|
||||
_key = _this select 1;
|
||||
params ["", "_key"];
|
||||
|
||||
if (_key == 1 && {alive player}) then {
|
||||
createDialog (["RscDisplayInterrupt", "RscDisplayMPInterrupt"] select isMultiplayer);
|
||||
|
||||
disableSerialization;
|
||||
|
||||
private ["_dlg", "_ctrl"];
|
||||
|
||||
_dlg = finddisplay 49;
|
||||
_dlg displayAddEventHandler ["KeyDown", {
|
||||
_key = _this select 1;
|
||||
params ["", "_key"];
|
||||
!(_key == 1)
|
||||
}];
|
||||
|
||||
@ -62,13 +62,15 @@ if (_state) then {
|
||||
|
||||
_ctrl = _dlg displayctrl ([104, 1010] select isMultiplayer);
|
||||
_ctrl ctrlSetEventHandler ["buttonClick", QUOTE(closeDialog 0; player setDamage 1; [false] call DFUNC(disableUserInput);)];
|
||||
_ctrl ctrlEnable (call {_config = missionConfigFile >> "respawnButton"; !isNumber _config || {getNumber _config == 1}});
|
||||
_ctrl ctrlEnable (call {private "_config"; _config = missionConfigFile >> "respawnButton"; !isNumber _config || {getNumber _config == 1}});
|
||||
_ctrl ctrlSetText "RESPAWN";
|
||||
_ctrl ctrlSetTooltip "Respawn.";
|
||||
};
|
||||
|
||||
if (_key in actionKeys "TeamSwitch" && {teamSwitchEnabled}) then {
|
||||
(uiNamespace getVariable [QGVAR(dlgDisableMouse), displayNull]) closeDisplay 0;
|
||||
|
||||
private "_acc";
|
||||
_acc = accTime;
|
||||
teamSwitch;
|
||||
setAccTime _acc;
|
||||
|
@ -1,25 +1,21 @@
|
||||
/*
|
||||
* Author: commy2, Glowbal
|
||||
*
|
||||
* Display a structured text with image.
|
||||
*
|
||||
* Argument:
|
||||
* Arguments:
|
||||
* 0: Text <ANY>
|
||||
* 1: Image <STRING>
|
||||
* 2: Image color <ARRAY> <OPTIONAL>
|
||||
* 3: Target Unit. Will only display if target is the player controlled object <OBJECT> <OPTIONAL>
|
||||
* 2: Image color (default: [0, 0, 0, 0]) <ARRAY>
|
||||
* 3: Target Unit. Will only display if target is the player controlled object (default: ACE_player) <OBJECT>
|
||||
*
|
||||
* Return value:
|
||||
* Nothing
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_imageColor", "_target"];
|
||||
PARAMS_2(_text,_image);
|
||||
_imageColor = if (count _this > 2) then {_this select 2} else {[1,1,1]};
|
||||
_imageColor resize 3;
|
||||
_target = if (count _this > 3) then {_this select 3} else {ACE_player};
|
||||
params ["_text", "_image", ["_imageColor", [1,1,1]], ["_target", ACE_player]];
|
||||
|
||||
if (_target != ACE_player) exitWith {};
|
||||
|
||||
@ -28,16 +24,21 @@ if (typeName _text != "TEXT") then {
|
||||
if (count _text > 0) then {
|
||||
{
|
||||
if (typeName _x == "STRING" && {isLocalized _x}) then {
|
||||
_text set [_foreachIndex, localize _x];
|
||||
_text set [_forEachIndex, localize _x];
|
||||
};
|
||||
}foreach _text;
|
||||
} forEach _text;
|
||||
|
||||
_text = format _text;
|
||||
};
|
||||
};
|
||||
|
||||
if (typeName _text == "STRING" && {isLocalized _text}) then {
|
||||
_text = localize _text;
|
||||
};
|
||||
|
||||
_text = parseText format ["<t align='center'>%1</t>", _text];
|
||||
};
|
||||
|
||||
_text = composeText [parseText format ["<img size='2' align='center' color='%2' image='%1'/>", _image, _imageColor call BIS_fnc_colorRGBtoHTML], lineBreak, _text];
|
||||
|
||||
[_text, 2] call FUNC(displayTextStructured);
|
||||
|
@ -1,23 +1,20 @@
|
||||
/*
|
||||
* Author: commy2, Glowbal
|
||||
*
|
||||
* Display a structured text.
|
||||
*
|
||||
* Argument:
|
||||
* Arguments:
|
||||
* 0: Text <ANY>
|
||||
* 1: Size of the textbox <NUMBER> <OPTIONAL>
|
||||
* 2: Target Unit. Will only display if target is the player controlled object <OBJECT> <OPTIONAL>
|
||||
* 1: Size of the textbox (default: 1.5) <NUMBER>
|
||||
* 2: Target Unit. Will only display if target is the player controlled object (default: ACE_player) <OBJECT>
|
||||
*
|
||||
* Return value:
|
||||
* Nothing
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_text", "_size", "_isShown", "_ctrlHint", "_yPos", "_xPos", "_wPos", "_hPos", "_position", "_target"];
|
||||
_text = _this select 0;
|
||||
_size = if (count _this > 1) then {_this select 1} else {1.5;};
|
||||
_target = if (count _this > 2) then {_this select 2} else {ACE_player};
|
||||
params ["_text", ["_size", 1.5], ["_target", ACE_player]];
|
||||
|
||||
if (_target != ACE_player) exitWith {};
|
||||
|
||||
@ -38,6 +35,8 @@ if (typeName _text != "TEXT") then {
|
||||
_text = composeText [lineBreak, parseText format ["<t align='center'>%1</t>", _text]];
|
||||
};
|
||||
|
||||
private ["_isShown", "_ctrlHint", "_xPos", "_yPos", "_wPos", "_hPos", "_position"];
|
||||
|
||||
_isShown = ctrlShown (uiNamespace getVariable ["ACE_ctrlHint", controlNull]);
|
||||
|
||||
("ACE_RscHint" call BIS_fnc_rscLayer) cutRsc ["ACE_RscHint", "PLAIN", 0, true];
|
||||
@ -60,8 +59,8 @@ _yPos = safeZoneY + 0.175 * safezoneH;
|
||||
_wPos = (10 *(((safezoneW / safezoneH) min 1.2) / 40));
|
||||
_hPos = (2 *((((safezoneW / safezoneH) min 1.2) / 1.2) / 25));
|
||||
|
||||
//Zeus Interface Open and Display would be under the "CREATE" list
|
||||
if (!isnull curatorCamera) then {
|
||||
// Zeus Interface Open and Display would be under the "CREATE" list
|
||||
if (!isNull curatorCamera) then {
|
||||
_xPos = _xPos min ((safezoneX + safezoneW - 12.5 * (((safezoneW / safezoneH) min 1.2) / 40)) - _wPos);
|
||||
};
|
||||
|
||||
|
@ -3,35 +3,22 @@
|
||||
*
|
||||
* Execute an animation. This is used to not break things like the unconsciousness animation.
|
||||
*
|
||||
* Argument:
|
||||
* 0: Unit (Object)
|
||||
* 1: Animation (String)
|
||||
* 2: Priority of the animation. (Number, optional default: 0)
|
||||
* 0: PlayMove
|
||||
* 1: PlayMoveNow
|
||||
* 2: SwitchMove (no transitional animation, doesn't overwrite priority 1)
|
||||
* Arguments:
|
||||
* 0: Unit <OBJECT>
|
||||
* 1: Animation <STRING>
|
||||
* 2: Priority of the animation. (default: 0) <NUMBER>
|
||||
* 0 = PlayMove
|
||||
* 1 = PlayMoveNow
|
||||
* 2 = SwitchMove (no transitional animation, doesn't overwrite priority 1)
|
||||
*
|
||||
* Return value:
|
||||
* Nothing
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_force"];
|
||||
|
||||
PARAMS_3(_unit,_animation,_priority);
|
||||
_force = False;
|
||||
|
||||
// no animation given
|
||||
if (isNil "_animation") exitWith {
|
||||
ACE_LOGERROR_1("No animation specified in %1.",_fnc_scriptNameParent);
|
||||
};
|
||||
|
||||
if (isNil "_priority") then {
|
||||
_priority = 0;
|
||||
};
|
||||
if (count _this > 3) then {
|
||||
_force = _this select 3;
|
||||
};
|
||||
params ["_unit", "_animation", ["_priority", 0], ["_force", false]];
|
||||
|
||||
// don't overwrite more important animations
|
||||
if (_unit getVariable ["ACE_isUnconscious", false] && {(_animation != "Unconscious")} && {!_force}) exitWith {};
|
||||
@ -47,7 +34,7 @@ if (_animation == "") then {
|
||||
//if (_animation == animationState _unit) exitWith {};
|
||||
|
||||
switch (_priority) do {
|
||||
case 0 : {
|
||||
case 0: {
|
||||
if (_unit == vehicle _unit) then {
|
||||
[_unit, format ["{_this playMove '%1'}", _animation], _unit] call FUNC(execRemoteFnc);
|
||||
} else {
|
||||
@ -55,7 +42,7 @@ switch (_priority) do {
|
||||
[_unit, format ["{_this playMove '%1'}", _animation]] call FUNC(execRemoteFnc);
|
||||
};
|
||||
};
|
||||
case 1 : {
|
||||
case 1: {
|
||||
if (_unit == vehicle _unit) then {
|
||||
[_unit, format ["{_this playMoveNow '%1'}", _animation], _unit] call FUNC(execRemoteFnc);
|
||||
} else {
|
||||
@ -63,7 +50,7 @@ switch (_priority) do {
|
||||
[_unit, format ["{_this playMoveNow '%1'}", _animation]] call FUNC(execRemoteFnc);
|
||||
};
|
||||
};
|
||||
case 2 : {
|
||||
case 2: {
|
||||
// try playMoveNow first
|
||||
if (_unit == vehicle _unit) then {
|
||||
[_unit, format ["{_this playMoveNow '%1'}", _animation], _unit] call FUNC(execRemoteFnc);
|
||||
@ -80,5 +67,3 @@ switch (_priority) do {
|
||||
};
|
||||
default {};
|
||||
};
|
||||
|
||||
["Anim", [_priority, _animation]] call FUNC(log);
|
||||
|
@ -1,30 +1,24 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
*
|
||||
* Drops a backback. Also returns the ground wepaon holder object of the dropped backpack.
|
||||
*
|
||||
* Argument:
|
||||
* 0: Unit that has a backpack (Object)
|
||||
* Arguments:
|
||||
* 0: Unit that has a backpack <OBJECT>
|
||||
*
|
||||
* Return value:
|
||||
* Ground wepaon holder with backpack (Object)
|
||||
* Ground wepaon holder with backpack <OBJECT>
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_1(_unit);
|
||||
params ["_unit"];
|
||||
|
||||
private ["_backpackObject","_holder"];
|
||||
private ["_backpackObject", "_holder"];
|
||||
|
||||
_backpackObject = backpackContainer _unit;
|
||||
|
||||
_unit addBackpack "Bag_Base";
|
||||
removeBackpack _unit;
|
||||
_holder = objNull;
|
||||
|
||||
{
|
||||
if (_backpackObject in everyBackpack _x) exitWith {
|
||||
_holder = _x;
|
||||
};
|
||||
} forEach (position _unit nearObjects ["WeaponHolder", 5]);
|
||||
|
||||
_holder
|
||||
objectParent _backpackObject // return
|
||||
|
@ -1,10 +1,21 @@
|
||||
//fnc_dumpArray.sqf
|
||||
/*
|
||||
* Author: ?
|
||||
* ?
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Array to be dumped <ARRAY>
|
||||
* 1: Depth <NUMBER>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_pad", "_i", "_x"];
|
||||
|
||||
PARAMS_2(_var,_depth);
|
||||
params ["_var", "_depth"];
|
||||
|
||||
private "_pad";
|
||||
_pad = "";
|
||||
|
||||
for "_i" from 0 to _depth do {
|
||||
@ -14,15 +25,18 @@ for "_i" from 0 to _depth do {
|
||||
_depth = _depth + 1;
|
||||
|
||||
if (IS_ARRAY(_var)) then {
|
||||
if ((count _var) > 0) then {
|
||||
diag_log text format["%1[", _pad];
|
||||
if (_var isEqualTo []) then {
|
||||
diag_log text format ["%1[],", _pad];
|
||||
} else {
|
||||
diag_log text format ["%1[", _pad];
|
||||
|
||||
{
|
||||
[_x, _depth] call FUNC(dumpArray);
|
||||
} forEach _var;
|
||||
diag_log text format["%1],", _pad];
|
||||
} else {
|
||||
diag_log text format["%1[],", _pad];
|
||||
false
|
||||
} count _var;
|
||||
|
||||
diag_log text format ["%1],", _pad];
|
||||
};
|
||||
} else {
|
||||
diag_log text format["%1%2", _pad, [_var] call FUNC(formatVar)];
|
||||
diag_log text format ["%1%2", _pad, [_var] call FUNC(formatVar)];
|
||||
};
|
||||
|
@ -1,49 +1,68 @@
|
||||
//fnc_dumpPerformanceCounters.sqf
|
||||
#define DEBUG_MODE_FULL
|
||||
/*
|
||||
* Author: ?
|
||||
* Dumps performance counter statistics into Logs.
|
||||
*
|
||||
* Arguments:
|
||||
* None
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
diag_log text format ["REGISTERED ACE PFH HANDLERS"];
|
||||
diag_log text format ["-------------------------------------------"];
|
||||
|
||||
diag_log text format["REGISTERED ACE PFH HANDLERS"];
|
||||
diag_log text format["-------------------------------------------"];
|
||||
if (!isNil "ACE_PFH_COUNTER") then {
|
||||
{
|
||||
private ["_isActive"];
|
||||
_x params ["_pfh", "_parameters"];
|
||||
_isActive = if (!isNil {cba_common_PFHhandles select (_pfh select 0)}) then {"ACTIVE"} else {"REMOVED"};
|
||||
diag_log text format["Registered PFH: id=%1 [%2, delay %3], %4:%5", (_pfh select 0), (_isActive), (_parameters select 1), (_pfh select 1), (_pfh select 2) ];
|
||||
} forEach ACE_PFH_COUNTER;
|
||||
|
||||
private "_isActive";
|
||||
_isActive = ["ACTIVE", "REMOVED"] select isNil {CBA_common_PFHhandles select (_pfh select 0)};
|
||||
|
||||
diag_log text format ["Registered PFH: id=%1 [%2, delay %3], %4:%5", _pfh select 0, _isActive, _parameters select 1, _pfh select 1, _pfh select 2];
|
||||
false
|
||||
} count ACE_PFH_COUNTER;
|
||||
};
|
||||
|
||||
diag_log text format["ACE COUNTER RESULTS"];
|
||||
diag_log text format["-------------------------------------------"];
|
||||
diag_log text format ["ACE COUNTER RESULTS"];
|
||||
diag_log text format ["-------------------------------------------"];
|
||||
|
||||
{
|
||||
private ["_counterEntry", "_iter", "_total", "_count", "_delta", "_averageResult"];
|
||||
private ["_counterEntry", "_iter", "_total", "_count", "_averageResult", "_delta"];
|
||||
|
||||
_counterEntry = _x;
|
||||
_iter = 0;
|
||||
_total = 0;
|
||||
_count = 0;
|
||||
_averageResult = 0;
|
||||
if( (count _counterEntry) > 3) then {
|
||||
|
||||
if (count _counterEntry > 3) then {
|
||||
// calc
|
||||
{
|
||||
if(_iter > 2) then {
|
||||
if (_iter > 2) then {
|
||||
_count = _count + 1;
|
||||
_delta = (_x select 1) - (_x select 0);
|
||||
|
||||
_total = _total + _delta;
|
||||
};
|
||||
|
||||
_iter = _iter + 1;
|
||||
} forEach _counterEntry;
|
||||
false
|
||||
} count _counterEntry;
|
||||
|
||||
// results
|
||||
_averageResult = (_total / _count) * 1000;
|
||||
|
||||
// dump results
|
||||
diag_log text format["%1: Average: %2s / %3 = %4ms", (_counterEntry select 0), _total, _count, _averageResult];
|
||||
diag_log text format ["%1: Average: %2s / %3 = %4ms", _counterEntry select 0, _total, _count, _averageResult];
|
||||
} else {
|
||||
diag_log text format["%1: No results", (_counterEntry select 0) ];
|
||||
diag_log text format ["%1: No results", _counterEntry select 0];
|
||||
};
|
||||
} forEach ACE_COUNTERS;
|
||||
false
|
||||
} count ACE_COUNTERS;
|
||||
|
||||
/*
|
||||
// Dump PFH Trackers
|
||||
|
@ -1,30 +1,40 @@
|
||||
/**
|
||||
* fn_getAllSetVariables.sqf
|
||||
* @Descr: Returns an 2d array of all variables that have been set on the object
|
||||
* @Author: Glowbal
|
||||
/*
|
||||
* Author: Glowbal
|
||||
* Returns an 2d array of all variables that have been set on the object
|
||||
*
|
||||
* @Arguments: [unit OBJECT, category STRING (Optional. Only get the variables from the specified category. Default is "" == all)]
|
||||
* @Return: ARRAY REturns an array with the format [ [name STRING, typeName STRING, value ANY, publicFlag BOOL, peristentFlag BOOL] ]
|
||||
* @PublicAPI: true
|
||||
* Arguments:
|
||||
* 0: Unit <OBJECT>
|
||||
* 1: Limiting Category (default: "") <STRING>
|
||||
*
|
||||
* Return Value:
|
||||
* Variable Data <ARRAY>
|
||||
* 0: Name <STRING>
|
||||
* 1: typeName <STRING>
|
||||
* 2: value <ANY>
|
||||
* 3: publicFlag <BOOL>
|
||||
* 4: peristentFlag <BOOL>
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_return", "_val", "_category"];
|
||||
PARAMS_1(_object);
|
||||
_category = if (count _this > 1) then { _this select 1 } else { "" };
|
||||
params ["_object", ["_category", ""]];
|
||||
|
||||
if (isnil QGVAR(OBJECT_VARIABLES_STORAGE)) exitwith {
|
||||
[];
|
||||
};
|
||||
if (isNil QGVAR(OBJECT_VARIABLES_STORAGE)) exitwith {[]};
|
||||
|
||||
private ["_return", "_val"];
|
||||
|
||||
_return = [];
|
||||
|
||||
{
|
||||
_val = _object getvariable (_x select 0);
|
||||
if (!isnil "_val") then {
|
||||
|
||||
if (!isNil "_val") then {
|
||||
if (_category == "" || _category == _x select 3) then {
|
||||
_return pushback [_x select 0, typeName _val, _val, _x select 2, _x select 5];
|
||||
_return pushBack [_x select 0, typeName _val, _val, _x select 2, _x select 5];
|
||||
};
|
||||
};
|
||||
}foreach GVAR(OBJECT_VARIABLES_STORAGE);
|
||||
false
|
||||
} count GVAR(OBJECT_VARIABLES_STORAGE);
|
||||
|
||||
_return
|
@ -1,28 +1,38 @@
|
||||
/*
|
||||
* Author: bux578, commy2
|
||||
*
|
||||
* Returns an array containing all items of a given unit
|
||||
*
|
||||
* Argument:
|
||||
* 0: Unit (Object)
|
||||
* Arguments:
|
||||
* 0: Unit <OBJECT>
|
||||
*
|
||||
* Return value:
|
||||
* Array with all the gear, format:
|
||||
* 0: headgear (String)
|
||||
* 1: goggles (String)
|
||||
* 2,3: uniform (String, Array)
|
||||
* 4,5: vest (String, Array)
|
||||
* 6,7: backpack (String, Array)
|
||||
* 8-10: rifle (String, Array, Array)
|
||||
* 11-13: launcher (String, Array, Array)
|
||||
* 14-16: pistol (String, Array, Array)
|
||||
* 17: map, compass, watch, etc. (Array)
|
||||
* 18: binocluar (String)
|
||||
* Return Value:
|
||||
* 0: Headgear <STRING>
|
||||
* 1: Goggles <STRING>
|
||||
* 2: Uniform <STRING>
|
||||
* 3: Uniform Items <ARRAY>
|
||||
* 4: Vest <String>
|
||||
* 5: Vest Items <ARRAY>
|
||||
* 6: Backback <STRING>
|
||||
* 7: Backpack Items <ARRAY>
|
||||
* 8: Rifle <STRING>
|
||||
* 9: Rifle Items <ARRAY>
|
||||
* 10: Rifle Magazines <ARRAY>
|
||||
* 11: Launcher <STRING>
|
||||
* 12: Launcher Items <ARRAY>
|
||||
* 13: Launcher Magazines <ARRAY>
|
||||
* 14: Handgun <STRING>
|
||||
* 15: Handgun Items <ARRAY>
|
||||
* 16: Handgun Magazines <ARRAY>
|
||||
* 17: Assigned Items (map, compass, watch, etc.) <ARRAY>
|
||||
* 18: Binoculars <STRING>
|
||||
*
|
||||
* Public: Yes
|
||||
*
|
||||
* Note: Element 17 includes the Head Mounted Display (HMD)
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_1(_unit);
|
||||
params ["_unit"];
|
||||
|
||||
if (isNull _unit) exitWith {[
|
||||
"",
|
||||
|
@ -1,25 +1,27 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
*
|
||||
* Return the captivity status of an unit.
|
||||
*
|
||||
* Argument:
|
||||
* 0: Unit (Object)
|
||||
* Arguments:
|
||||
* 0: Unit <OBJECT>
|
||||
*
|
||||
* Return value:
|
||||
* Reasons, why the unit is a captive. An empty array is returned if the unit is not a captive (Array of Strings)
|
||||
* Return Value:
|
||||
* Captivity Reasons, empty if not captive <ARRAY>
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_captivityReasons", "_unitCaptivityStatus", "_unitCaptivityReasons"];
|
||||
params ["_unit"];
|
||||
|
||||
PARAMS_1(_unit);
|
||||
private ["_captivityReasons", "_unitCaptivityStatus", "_unitCaptivityReasons"];
|
||||
|
||||
_captivityReasons = missionNamespace getVariable ["ACE_captivityReasons", []];
|
||||
|
||||
_unitCaptivityStatus = [captiveNum _unit, count _captivityReasons] call FUNC(binarizeNumber);
|
||||
|
||||
_unitCaptivityReasons = [];
|
||||
|
||||
{
|
||||
if (_unitCaptivityStatus select _forEachIndex) then {
|
||||
_unitCaptivityReasons pushBack _x;
|
||||
|
@ -1,10 +1,20 @@
|
||||
// by commy2
|
||||
/*
|
||||
* Author: commy2
|
||||
* Obtain children of a config entry
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Unit <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* Parent Entry Class Children <ARRAY>
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_classes"];
|
||||
|
||||
PARAMS_2(_name,_cfgClass);
|
||||
params ["_name", "_cfgClass"];
|
||||
|
||||
private "_classes";
|
||||
_classes = format ["configName inheritsFrom _x == '%1'", _name] configClasses (configFile >> _cfgClass);
|
||||
_classes = [_classes, {configName _this}] call FUNC(map);
|
||||
_classes
|
||||
|
||||
[_classes, {configName _this}] call FUNC(map) // return
|
||||
|
@ -1,21 +1,22 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
*
|
||||
* Get the commander config of a vehicles turret.
|
||||
*
|
||||
* Argument:
|
||||
* 0: vehicle (Object)
|
||||
* Arguments:
|
||||
* 0: vehicle <OBJECT>
|
||||
*
|
||||
* Return value:
|
||||
* Commander config (Config)
|
||||
* Return Value:
|
||||
* Commander config <CONFIG>
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_config", "_turret"];
|
||||
params ["_vehicle"];
|
||||
|
||||
PARAMS_1(_vehicle);
|
||||
private ["_config", "_turret"];
|
||||
|
||||
_config = configFile >> "CfgVehicles" >> typeOf _vehicle;
|
||||
_turret = [_vehicle] call FUNC(getTurretCommander);
|
||||
|
||||
[_config, _turret] call FUNC(getTurretConfigPath)
|
||||
[_config, _turret] call FUNC(getTurretConfigPath) // return
|
||||
|
@ -1,21 +1,22 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
*
|
||||
* Get the gunner config of a vehicles turret.
|
||||
*
|
||||
* Argument:
|
||||
* 0: vehicle (Object)
|
||||
* Arguments:
|
||||
* 0: vehicle <OBJECT>
|
||||
*
|
||||
* Return value:
|
||||
* Gunner config (Config)
|
||||
* Return Value:
|
||||
* Gunner config <CONFIG>
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_config", "_turret"];
|
||||
params ["_vehicle"];
|
||||
|
||||
PARAMS_1(_vehicle);
|
||||
private ["_config", "_turret"];
|
||||
|
||||
_config = configFile >> "CfgVehicles" >> typeOf _vehicle;
|
||||
_turret = [_vehicle] call FUNC(getTurretGunner);
|
||||
|
||||
[_config, _turret] call FUNC(getTurretConfigPath)
|
||||
[_config, _turret] call FUNC(getTurretConfigPath) // return
|
||||
|
@ -1,17 +1,18 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
* Determins type of item. Can be CfgMagaines, CfgWeapons or CfgGlasses.
|
||||
*
|
||||
* What kind of Cfg is the item. Works for CfgMagaines, CfgWeapons and CfgGlasses
|
||||
* Arguments:
|
||||
* 0: Item Classname <STRING>
|
||||
*
|
||||
* Argument:
|
||||
* 0: A item's classname. (String)
|
||||
* Return Value:
|
||||
* Config category ("CfgWeapons", "CfgMagazines", "CfgGlasses", "") <STRING>
|
||||
*
|
||||
* Return value:
|
||||
* CfgWhatever (String)
|
||||
* Public: Yes
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_1(_item);
|
||||
params ["_item"];
|
||||
|
||||
if (isClass (configFile >> "CfgWeapons" >> _item)) exitWith {"CfgWeapons"};
|
||||
|
||||
|
@ -1,17 +1,18 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
* Determins type of object. Can be CfgVehicles or CfgAmmo.
|
||||
*
|
||||
* What kind of Cfg is the object. Works for CfgVehicles and CfgAmmo
|
||||
* Arguments:
|
||||
* 0: Object classname <STRING>
|
||||
*
|
||||
* Argument:
|
||||
* 0: An object's classname. (String)
|
||||
* Return Value:
|
||||
* Config category ("CfgWeapons", "Cfgmagazines", "CfgGlasses", "") <STRING>
|
||||
*
|
||||
* Return value:
|
||||
* CfgWhatever (String)
|
||||
* Public: Yes
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_1(_object);
|
||||
params ["_object"];
|
||||
|
||||
if (isClass (configFile >> "CfgVehicles" >> _object)) exitWith {"CfgVehicles"};
|
||||
|
||||
|
@ -9,35 +9,38 @@
|
||||
* animation <STRING>
|
||||
*
|
||||
* Example:
|
||||
* [bob] call ace_common_fnc_getDeathAnim;
|
||||
* [bob] call ace_common_fnc_getDeathAnim
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_1(_unit);
|
||||
params ["_unit"];
|
||||
|
||||
private ["_returnAnimation", "_animationState", "_unitAnimationCfg", "_unitActionsCfg", "_interpolateArray", "_indexAnimation", "_index"];
|
||||
private ["_returnAnimation", "_animationState", "_unitAnimationCfg", "_unitActionsCfg", "_interpolateArray", "_indexAnimation"];
|
||||
|
||||
_returnAnimation = "";
|
||||
|
||||
_animationState = (animationState _unit);
|
||||
_unitAnimationCfg = (configFile >> "CfgMovesMaleSdr" >> "States" >> _animationState);
|
||||
//If we're already in a terminal animation just return current
|
||||
if ((getNumber (_unitAnimationCfg >> "terminal")) == 1) exitWith {_animationState};
|
||||
_animationState = animationState _unit;
|
||||
_unitAnimationCfg = configFile >> "CfgMovesMaleSdr" >> "States" >> _animationState;
|
||||
|
||||
_unitActionsCfg = (configFile >> "CfgMovesBasic" >> "Actions" >> (getText (_unitAnimationCfg >> "actions")));
|
||||
//If we're already in a terminal animation just return current
|
||||
if (getNumber (_unitAnimationCfg >> "terminal") == 1) exitWith {_animationState};
|
||||
|
||||
_unitActionsCfg = configFile >> "CfgMovesBasic" >> "Actions" >> getText (_unitAnimationCfg >> "actions");
|
||||
|
||||
TRACE_2("Animation/Action", configName _unitAnimationCfg, configName _unitActionsCfg);
|
||||
|
||||
if ((vehicle _unit) != _unit) then {
|
||||
if (vehicle _unit != _unit) then {
|
||||
_interpolateArray = getArray (_unitAnimationCfg >> "interpolateTo");
|
||||
|
||||
for "_index" from 0 to (count _interpolateArray - 1) step 2 do {
|
||||
_indexAnimation = _interpolateArray select _index;
|
||||
|
||||
//No guarentee that first animation will be right so scan for the first "terminal" animation
|
||||
//E.G.: interpolateTo[] = {"passenger_apc_generic04still",1,"KIA_passenger_apc_generic04",1};
|
||||
|
||||
if ((getNumber ((configFile >> "CfgMovesMaleSdr" >> "States" >> _indexAnimation) >> "terminal")) == 1) exitWith {
|
||||
if (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> _indexAnimation >> "terminal") == 1) exitWith {
|
||||
_returnAnimation = _indexAnimation;
|
||||
};
|
||||
};
|
||||
|
@ -1,19 +1,37 @@
|
||||
// by commy2
|
||||
/*
|
||||
* Author: commy2
|
||||
* Get the Defualt animation for the unit
|
||||
*
|
||||
* Arguments:
|
||||
* 0: unit <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* animation <STRING>
|
||||
*
|
||||
* Example:
|
||||
* [bob] call ace_common_fnc_getDefaultAnim;
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_unit"];
|
||||
|
||||
private ["_anim", "_stance"];
|
||||
|
||||
PARAMS_1(_unit);
|
||||
_anim = toLower (animationState _unit);
|
||||
_anim = toLower animationState _unit;
|
||||
|
||||
// stance is broken for some animations.
|
||||
_stance = stance _unit;
|
||||
|
||||
if (_anim find "ppne" == 4) then {
|
||||
_stance = "PRONE";
|
||||
};
|
||||
|
||||
if (_anim find "pknl" == 4) then {
|
||||
_stance = "CROUCH";
|
||||
};
|
||||
|
||||
if (_anim find "perc" == 4) then {
|
||||
_stance = "STAND";
|
||||
};
|
||||
|
@ -1,33 +1,38 @@
|
||||
/**
|
||||
* fn_getVariable.sqf
|
||||
* @Descr: Grabs a variable. If variable has not been set, attempts to use default defined value
|
||||
* @Author: Glowbal
|
||||
/*
|
||||
* Author: Glowbal
|
||||
* Grabs a variable. If variable has not been set, attempts to use default defined value
|
||||
*
|
||||
* @Arguments: [unit OBJECT, variableName STRING]
|
||||
* @Return: ANY
|
||||
* @PublicAPI: true
|
||||
* Arguments:
|
||||
* 0: unit <OBJECT>
|
||||
* 1: Variable Name <STRING>
|
||||
*
|
||||
* Return Value:
|
||||
* Value of variable or default value, if the variable is undefined <ANY>
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
#define UNIT (_this select 0)
|
||||
#define VARIABLE (_this select 1)
|
||||
params ["_unit", "_variable", "_defaultValue"];
|
||||
|
||||
private "_value";
|
||||
_value = _unit getvariable _variable;
|
||||
|
||||
_value = UNIT getvariable VARIABLE;
|
||||
if (isnil "_value") then {
|
||||
if (count _this >2) then {
|
||||
_value = _this select 2;
|
||||
if (isNil "_value") then {
|
||||
if (!isNil "_defaultValue") then {
|
||||
_value = _defaultValue;
|
||||
} else {
|
||||
private "_definedVariable";
|
||||
_definedVariable = ([VARIABLE] call FUNC(getDefinedVariableInfo));
|
||||
_definedVariable = [_variable] call FUNC(getDefinedVariableInfo);
|
||||
|
||||
if (count _definedVariable > 1) then {
|
||||
_value = _definedVariable select 1;
|
||||
};
|
||||
};
|
||||
if (isnil "_value") then {
|
||||
|
||||
if (isNil "_value") then {
|
||||
_value = 0;
|
||||
};
|
||||
};
|
||||
|
||||
_value
|
@ -1,19 +1,24 @@
|
||||
/**
|
||||
* fn_getvariableDefault.sqf
|
||||
* @Descr: Get the variable default value
|
||||
* @Author: Glowbal
|
||||
/*
|
||||
* Author: Glowbal
|
||||
* Get the variable default value
|
||||
*
|
||||
* @Arguments: [variableName STRING]
|
||||
* @Return: ANY
|
||||
* @PublicAPI: true
|
||||
* Arguments:
|
||||
* 0: Variable Name <STRING>
|
||||
*
|
||||
* Return Value:
|
||||
* Default value of variable <ANY>
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_varName"];
|
||||
|
||||
private "_variableDefinition";
|
||||
_variableDefinition = ([_this select 0] call FUNC(getDefinedVariableInfo));
|
||||
if (count _variableDefinition > 0) exitwith {
|
||||
_variableDefinition = [_varName] call FUNC(getDefinedVariableInfo);
|
||||
|
||||
if !(_variableDefinition isEqualTo []) exitwith {
|
||||
_variableDefinition select 1;
|
||||
};
|
||||
|
||||
nil;
|
||||
nil
|
||||
|
@ -1,12 +1,17 @@
|
||||
/**
|
||||
* fn_getvariableInfo.sqf
|
||||
* @Descr: N/A
|
||||
* @Author: Glowbal
|
||||
/*
|
||||
* Author: Glowbal
|
||||
* Get the variable Informations
|
||||
*
|
||||
* @Arguments: []
|
||||
* @Return:
|
||||
* @PublicAPI: false
|
||||
* Arguments:
|
||||
* 0: Variable Name <STRING>
|
||||
*
|
||||
* Return Value:
|
||||
* Variable Metadata <ARRAY>
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
+(missionNamespace getvariable [QGVAR(OBJECT_VARIABLES_STORAGE_) + (_this select 0),[]])
|
||||
|
||||
params ["_varName"];
|
||||
|
||||
+ (missionNamespace getVariable [format [QGVAR(OBJECT_VARIABLES_STORAGE_%1), _varName], []])
|
||||
|
@ -1,15 +1,31 @@
|
||||
// by commy2
|
||||
/*
|
||||
* Author: commy2
|
||||
* Get display classnames from config with given idd.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Display ID (idd) <NUMBER>
|
||||
*
|
||||
* Return Value:
|
||||
* Display Classnames <ARRAY>
|
||||
*
|
||||
* Public: Yes
|
||||
*
|
||||
* Note: Really slow due to iteration through whole config. Meant for debugging.
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_configName", "_index", "_config"];
|
||||
params ["_idd"];
|
||||
|
||||
_configName = "";
|
||||
private ["_configNames", "_config"];
|
||||
|
||||
_configNames = [];
|
||||
|
||||
for "_index" from 0 to (count configFile - 1) do {
|
||||
_config = configFile select _index;
|
||||
if (isClass _config && {isNumber (_config >> "idd")} && {getNumber (_config >> "idd") == _this}) exitWith {
|
||||
_configName = configName _config;
|
||||
|
||||
if (isClass _config && {isNumber (_config >> "idd")} && {getNumber (_config >> "idd") == _idd}) then {
|
||||
_configNames pushBack configName _config;
|
||||
};
|
||||
};
|
||||
|
||||
_configName
|
||||
_configNames
|
||||
|
@ -1,19 +1,20 @@
|
||||
/*
|
||||
* Author: bux578
|
||||
* Returns all turret indecies of door gunners.
|
||||
*
|
||||
* Gets the turret index of door gunners
|
||||
* Arguments:
|
||||
* 0: Vehicle <OBJECT>
|
||||
*
|
||||
* Argument:
|
||||
* 0: Vehicle (Object)
|
||||
* Return Value:
|
||||
* All turret indecies of the Vehicle <ARRAY>
|
||||
*
|
||||
* Return value:
|
||||
* Turret indexes of the door gunner. Empty array means no gunner position. (Array)
|
||||
* Public: Yes
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_turrets", "_doorTurrets", "_config"];
|
||||
params ["_vehicle"];
|
||||
|
||||
PARAMS_1(_vehicle);
|
||||
private ["_turrets", "_doorTurrets", "_config"];
|
||||
|
||||
_turrets = allTurrets [_vehicle, true];
|
||||
|
||||
@ -21,11 +22,13 @@ _doorTurrets = [];
|
||||
|
||||
{
|
||||
_config = configFile >> "CfgVehicles" >> typeOf _vehicle;
|
||||
|
||||
_config = [_config, _x] call FUNC(getTurretConfigPath);
|
||||
|
||||
if ((getNumber (_config >> "isCopilot") == 0) && count (getArray (_config >> "weapons")) > 0 ) then {
|
||||
if (getNumber (_config >> "isCopilot" == 0) && {count getArray (_config >> "weapons") > 0}) then {
|
||||
_doorTurrets pushBack _x;
|
||||
};
|
||||
} forEach _turrets;
|
||||
false
|
||||
} count _turrets;
|
||||
|
||||
_doorTurrets
|
||||
|
@ -1,25 +1,23 @@
|
||||
/*
|
||||
Name: FUNC(getForceWalkStatus)
|
||||
|
||||
Author: Pabst Mirror (from captivity by commy2)
|
||||
|
||||
Description:
|
||||
Returns reasons why the unit is forceWalk-ing, empty if not forced.
|
||||
|
||||
Parameters:
|
||||
0: OBJECT - Unit
|
||||
|
||||
Returns:
|
||||
ARRAY(of strings) - Reason why the unit is force walking
|
||||
|
||||
Example:
|
||||
[ACE_Player] call FUNC(getForceWalkStatus)
|
||||
*/
|
||||
* Author: PabstMirror, commy2
|
||||
* Returns reasons why the unit is forceWalk-ing.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: unit <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* Force Walk reasons <ARRAY>
|
||||
*
|
||||
* Example:
|
||||
* [ACE_Player] call ace_common_fnc_getForceWalkStatus
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_forceWalkReasons", "_unitForceWalkNumber", "_unitForceWalkStatus", "_unitForceWalkReasons"];
|
||||
params ["_unit"];
|
||||
|
||||
PARAMS_1(_unit);
|
||||
private ["_forceWalkReasons", "_unitForceWalkNumber", "_unitForceWalkStatus", "_unitForceWalkReasons"];
|
||||
|
||||
_forceWalkReasons = missionNamespace getVariable ["ACE_forceWalkReasons", []];
|
||||
|
||||
@ -28,6 +26,7 @@ _unitForceWalkNumber = _unit getVariable ["ACE_forceWalkStatusNumber", 0];
|
||||
_unitForceWalkStatus = [_unitForceWalkNumber, count _forceWalkReasons] call FUNC(binarizeNumber);
|
||||
|
||||
_unitForceWalkReasons = [];
|
||||
|
||||
{
|
||||
if (_unitForceWalkStatus select _forEachIndex) then {
|
||||
_unitForceWalkReasons pushBack _x;
|
||||
|
@ -1,20 +1,19 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
* Returns gunner using specified weapon type in vehicle. Only works if all turrets have different weapons.
|
||||
*
|
||||
* Get the gunner of a vehicle who uses the given weapon type. Requires every turret to have a different weapon.
|
||||
* Arguments:
|
||||
* 0: Vehicle <OBJECT>
|
||||
* 1: Weapon <STRING>
|
||||
*
|
||||
* Argument:
|
||||
* 0: The vehicle (Object)
|
||||
* 1: weapon of the vehicle (String)
|
||||
* Return Value:
|
||||
* Gunner <OBJECT>
|
||||
*
|
||||
* Return value:
|
||||
* The turret gunner with this weapon (Object)
|
||||
* Public: Yes
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_vehicle", "_weapon"];
|
||||
|
||||
_vehicle = _this select 0;
|
||||
_weapon = _this select 1;
|
||||
params ["_vehicle", "_weapon"];
|
||||
|
||||
// on foot
|
||||
if (gunner _vehicle == _vehicle && {_weapon in weapons _vehicle || {toLower _weapon in ["throw", "put"]}}) exitWith {gunner _vehicle};
|
||||
@ -27,7 +26,8 @@ _gunner = objNull;
|
||||
if (_weapon in (_vehicle weaponsTurret _x)) exitWith {
|
||||
_gunner = _vehicle turretUnit _x;
|
||||
};
|
||||
} forEach allTurrets [_vehicle, true];
|
||||
false
|
||||
} count allTurrets [_vehicle, true];
|
||||
|
||||
// ensure that at least the pilot is returned if there is no gunner
|
||||
if (isManualFire _vehicle && {isNull _gunner}) then {
|
||||
|
@ -1,31 +1,26 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
*
|
||||
* Move unit into given vehicle position. Or switch to that position if the unit is already inside the vehicle.
|
||||
* Move unit into given vehicle position or switch to that position if the unit is already inside the vehicle.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Unit to enter the vehicle (Object)
|
||||
* 1: The vehicle to be entered (Object)
|
||||
* 2: Position. Can be "Driver", "Pilot", "Gunner", "Commander", "Copilot", "Turret", "FFV", "Codriver" or "Cargo" (String)
|
||||
* 3: Index. "Turret", "FFV", "Codriver" and "Cargo" support this optional parameter. Which position should be taken.
|
||||
* Note: This index is diffrent from Armas "cargoIndex". (Number, optional default: next free index)
|
||||
* 0: Unit <OBJECT>
|
||||
* 1: Vehicle <OBJECT>
|
||||
* 2: Position ("Driver", "Pilot", "Gunner", "Commander", "Copilot", "Turret", "FFV", "Codriver", "Cargo") <STRING>
|
||||
* 3: Index (only applies to "Turret", "FFV", "Codriver", "Cargo") (default: next free index) <NUMBER>
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
* None
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
#define CANGETINDRIVER (isNull (driver _vehicle) || {!alive driver _vehicle}) && {!lockedDriver _vehicle} && {getNumber (_config >> "isUav") != 1}
|
||||
#define CANGETINTURRETINDEX (isNull (_vehicle turretUnit _turret) || {!alive (_vehicle turretUnit _turret)}) && {!(_vehicle lockedTurret _turret)} && {getNumber (_config >> "isUav") != 1}
|
||||
|
||||
private ["_position", "_index"];
|
||||
params ["_unit", "_vehicle", "_position", ["_index", -1]];
|
||||
|
||||
PARAMS_2(_unit,_vehicle);
|
||||
|
||||
_position = toLower (_this select 2);
|
||||
_index = _this select 3; // optional, please don't use
|
||||
|
||||
if (isNil "_index") then {_index = -1};
|
||||
_position = toLower _position;
|
||||
|
||||
// general
|
||||
if (!alive _vehicle || {locked _vehicle > 1}) exitWith {false};
|
||||
@ -39,9 +34,11 @@ _isInside = vehicle _unit == _vehicle;
|
||||
|
||||
_script = {};
|
||||
_enemiesInVehicle = false; //Possible Side Restriction
|
||||
|
||||
{
|
||||
if (side _unit getFriend side _x < 0.6) exitWith {_enemiesInVehicle = true};
|
||||
} forEach crew _vehicle;
|
||||
false
|
||||
} count crew _vehicle;
|
||||
|
||||
switch (_position) do {
|
||||
case "driver" : {
|
||||
|
@ -1,83 +1,78 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
* Returns item type of given classname.
|
||||
*
|
||||
* What kind of item is given classname
|
||||
* Arguments:
|
||||
* 0: Item <STRING>
|
||||
*
|
||||
* Argument:
|
||||
* 0: Classname of a item. (String)
|
||||
*
|
||||
* Return value:
|
||||
* Item type. (Array)
|
||||
* 0: "weapon", "item", "magazine" or "" (String)
|
||||
* 1: A description of the item (e.g. "primary" for a weapon or "vest" for a vest item)
|
||||
* Return Value:
|
||||
* 0: Type ("weapon", "item", "magazine", "") <STRING>
|
||||
* 1: Item Description <STRING>
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_1(_item);
|
||||
params ["_item"];
|
||||
|
||||
private ["_cfgType"];
|
||||
private ["_cfgType", "_config", "_type", "_default"];
|
||||
|
||||
_cfgType = [_item] call FUNC(getConfigType);
|
||||
|
||||
if (_cfgType == "") exitWith {["",""]};
|
||||
if (_cfgType == "") exitWith {["", ""]};
|
||||
|
||||
if (_cfgType == "CfgGlasses") exitWith {["item","glasses"]};
|
||||
|
||||
private ["_config", "_type"];
|
||||
if (_cfgType == "CfgGlasses") exitWith {["item", "glasses"]};
|
||||
|
||||
_config = configFile >> _cfgType >> _item;
|
||||
|
||||
_type = getNumber (_config >> "type");
|
||||
|
||||
if (isNumber (_config >> "ItemInfo" >> "type")) then {
|
||||
_type = getNumber (_config >> "ItemInfo" >> "type");
|
||||
};
|
||||
|
||||
private "_default";
|
||||
_default = ["item", "magazine"] select (_cfgType == "CfgMagazines");
|
||||
|
||||
switch (true) do {
|
||||
case (_type == 0): {[_default,"unknown"]};
|
||||
case (_type == 2^0): {["weapon","primary"]};
|
||||
case (_type == 2^1): {["weapon","handgun"]};
|
||||
case (_type == 2^2): {["weapon","secondary"]};
|
||||
case (_type < 2^4): {["weapon","unknown"]};
|
||||
case (_type == 2^4): {["magazine","handgun"]}; // handgun
|
||||
case (_type == 2^8): {["magazine","primary"]}; // rifle
|
||||
case (_type == 2^9): {["magazine","secondary"]}; // rpg, mg, mines
|
||||
//case (_type < 2^11): {["magazine","unknown"]};
|
||||
case (_type == 0): {[_default, "unknown"]};
|
||||
case (_type == 2^0): {["weapon", "primary"]};
|
||||
case (_type == 2^1): {["weapon", "handgun"]};
|
||||
case (_type == 2^2): {["weapon", "secondary"]};
|
||||
case (_type < 2^4): {["weapon", "unknown"]};
|
||||
case (_type == 2^4): {["magazine", "handgun"]}; // handgun
|
||||
case (_type == 2^8): {["magazine", "primary"]}; // rifle
|
||||
case (_type == 2^9): {["magazine", "secondary"]}; // rpg, mg, mines
|
||||
//case (_type < 2^11): {["magazine", "unknown"]};
|
||||
|
||||
case (_type == 101): {["item","muzzle"]};
|
||||
case (_type == 201): {["item","optics"]};
|
||||
case (_type == 301): {["item","flashlight"]};
|
||||
case (_type == 302): {["item","under"]}; // czech for bipod item
|
||||
case (_type == 401): {["item","first_aid_kit"]};
|
||||
case (_type == 501): {["item","fins"]}; // not implemented
|
||||
case (_type == 601): {["item","breathing_bomb"]}; // not implemented
|
||||
case (_type == 603): {["item","goggles"]};
|
||||
case (_type == 604): {["item","scuba"]}; // not implemented
|
||||
case (_type == 605): {["item","headgear"]};
|
||||
case (_type == 611): {["item","radio"]};
|
||||
case (_type == 616): {["item","hmd"]};
|
||||
case (_type == 617): {["item","binocular"]};
|
||||
case (_type == 619): {["item","medikit"]};
|
||||
case (_type == 620): {["item","toolkit"]};
|
||||
case (_type == 621): {["item","uav_terminal"]};
|
||||
case (_type == 701): {["item","vest"]};
|
||||
case (_type == 801): {["item","uniform"]};
|
||||
case (_type == 101): {["item", "muzzle"]};
|
||||
case (_type == 201): {["item", "optics"]};
|
||||
case (_type == 301): {["item", "flashlight"]};
|
||||
case (_type == 302): {["item", "under"]}; // czech for bipod item
|
||||
case (_type == 401): {["item", "first_aid_kit"]};
|
||||
case (_type == 501): {["item", "fins"]}; // not implemented
|
||||
case (_type == 601): {["item", "breathing_bomb"]}; // not implemented
|
||||
case (_type == 603): {["item", "goggles"]};
|
||||
case (_type == 604): {["item", "scuba"]}; // not implemented
|
||||
case (_type == 605): {["item", "headgear"]};
|
||||
case (_type == 611): {["item", "radio"]};
|
||||
case (_type == 616): {["item", "hmd"]};
|
||||
case (_type == 617): {["item", "binocular"]};
|
||||
case (_type == 619): {["item", "medikit"]};
|
||||
case (_type == 620): {["item", "toolkit"]};
|
||||
case (_type == 621): {["item", "uav_terminal"]};
|
||||
case (_type == 701): {["item", "vest"]};
|
||||
case (_type == 801): {["item", "uniform"]};
|
||||
|
||||
case (_type == 2^12): {
|
||||
switch (toLower getText (_config >> "simulation")) do {
|
||||
case ("weapon"): {["weapon","binocular"]};
|
||||
case ("binocular"): {["weapon","binocular"]};
|
||||
case ("nvgoggles"): {["item","nvgoggles"]};
|
||||
case ("itemminedetector"): {["item","minedetector"]};
|
||||
default {[_default,"unknown"]};
|
||||
case ("weapon"): {["weapon", "binocular"]};
|
||||
case ("binocular"): {["weapon", "binocular"]};
|
||||
case ("nvgoggles"): {["item", "nvgoggles"]};
|
||||
case ("itemminedetector"): {["item", "minedetector"]};
|
||||
default {[_default, "unknown"]};
|
||||
};
|
||||
};
|
||||
|
||||
case (_type == 2^16): {["weapon","vehicle"]};
|
||||
case (_type == 2^17): {[_default,"unknown"]}; // ???
|
||||
default {[_default,"unknown"]};
|
||||
case (_type == 2^16): {["weapon", "vehicle"]};
|
||||
case (_type == 2^17): {[_default, "unknown"]}; // ???
|
||||
default {[_default, "unknown"]};
|
||||
};
|
||||
|
@ -3,22 +3,26 @@
|
||||
* Read properties of given vehicles light.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Object with lights (Object)
|
||||
* 1: Light classname (String)
|
||||
* 0: Object with lights <OBJECT>
|
||||
* 1: Light classname <STRING>
|
||||
*
|
||||
* Return Value:
|
||||
* Stuff from config (Array)
|
||||
* 0: Light intensity <NUMBER>
|
||||
* 1: Light position <STRING>
|
||||
* 2: Light direction <STRING>
|
||||
* 3: Light inner angle <NUMBER>
|
||||
* 4: Light outer angle <NUMBER>
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_2(_vehicle,_light);
|
||||
params ["_vehicle", "_light"];
|
||||
|
||||
private ["_config", "_intensity", "_position", "_direction", "_innerAngle", "_outerAngle"];
|
||||
|
||||
private "_config";
|
||||
_config = configFile >> "CfgVehicles" >> typeOf _vehicle >> "Reflectors" >> _light;
|
||||
|
||||
private ["_intensity", "_position", "_direction", "_innerAngle", "_outerAngle"];
|
||||
|
||||
_intensity = getNumber (_config >> "intensity");
|
||||
_position = getText (_config >> "position");
|
||||
_direction = getText (_config >> "direction");
|
||||
@ -26,35 +30,3 @@ _innerAngle = getNumber (_config >> "innerAngle");
|
||||
_outerAngle = getNumber (_config >> "outerAngle");
|
||||
|
||||
[_intensity, _position, _direction, _innerAngle, _outerAngle]
|
||||
|
||||
/*
|
||||
class Reflectors
|
||||
{
|
||||
class Light_1
|
||||
{
|
||||
color[] = {1000,1000,1100};
|
||||
ambient[] = {10,10,11};
|
||||
intensity = 5;
|
||||
size = 1;
|
||||
innerAngle = 90;
|
||||
outerAngle = 130;
|
||||
coneFadeCoef = 2;
|
||||
position = "Light_1_pos";
|
||||
direction = "Light_1_dir";
|
||||
hitpoint = "Light_1_hitpoint";
|
||||
selection = "Light_1_hide";
|
||||
useFlare = 1;
|
||||
flareSize = 0.9;
|
||||
flareMaxDistance = 85;
|
||||
class Attenuation
|
||||
{
|
||||
start = 0;
|
||||
constant = 0;
|
||||
linear = 0;
|
||||
quadratic = 0.9;
|
||||
hardLimitStart = 40;
|
||||
hardLimitEnd = 60;
|
||||
};
|
||||
};
|
||||
};
|
||||
*/
|
||||
|
@ -1,23 +1,29 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
* Read properties of given flashlight. @todo, Can weapons themselves still have flashlights (no attachment)?
|
||||
* Read properties of given flashlight.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: A flashlight (String)
|
||||
* 0: Flashlight <STRING>
|
||||
*
|
||||
* Return Value:
|
||||
* Stuff from config (Array)
|
||||
* 0: Light intensity <NUMBER>
|
||||
* 1: Light position <STRING>
|
||||
* 2: Light direction <STRING>
|
||||
* 3: Light inner angle <NUMBER>
|
||||
* 4: Light outer angle <NUMBER>
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_1(_weapon);
|
||||
params ["_weapon"];
|
||||
|
||||
// @todo: Can weapons themselves still have flashlights (no attachment)?
|
||||
|
||||
private ["_config", "_intensity", "_position", "_direction", "_innerAngle", "_outerAngle"];
|
||||
|
||||
private "_config";
|
||||
_config = configFile >> "CfgWeapons" >> _weapon >> "ItemInfo" >> "FlashLight";
|
||||
|
||||
private ["_intensity", "_position", "_direction", "_innerAngle", "_outerAngle"];
|
||||
|
||||
_intensity = getNumber (_config >> "intensity");
|
||||
_position = getText (_config >> "position");
|
||||
_direction = getText (_config >> "direction");
|
||||
@ -25,32 +31,3 @@ _innerAngle = getNumber (_config >> "innerAngle");
|
||||
_outerAngle = getNumber (_config >> "outerAngle");
|
||||
|
||||
[_intensity, _position, _direction, _innerAngle, _outerAngle]
|
||||
|
||||
/*
|
||||
class FlashLight
|
||||
{
|
||||
color[] = {180,156,120};
|
||||
ambient[] = {0.9,0.78,0.6};
|
||||
intensity = 20;
|
||||
size = 1;
|
||||
innerAngle = 20;
|
||||
outerAngle = 80;
|
||||
coneFadeCoef = 5;
|
||||
position = "flash dir";
|
||||
direction = "flash";
|
||||
useFlare = 1;
|
||||
flareSize = 1.4;
|
||||
flareMaxDistance = "100.0f";
|
||||
dayLight = 0;
|
||||
class Attenuation
|
||||
{
|
||||
start = 0.5;
|
||||
constant = 0;
|
||||
linear = 0;
|
||||
quadratic = 1.1;
|
||||
hardLimitStart = 20;
|
||||
hardLimitEnd = 30;
|
||||
};
|
||||
scale[] = {0};
|
||||
};
|
||||
*/
|
||||
|
@ -1,25 +1,21 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
*
|
||||
* Returns the name of the object. Used to prevent issues with the name command.
|
||||
*
|
||||
* Argument:
|
||||
* 0: Object (Object)
|
||||
* 1: Show effective commander name? (Bool, optinal default: false)
|
||||
* Arguments:
|
||||
* 0: Object <OBJECT>
|
||||
* 1: Use effective commander name when used on vehicles (default: false) <BOOL>
|
||||
*
|
||||
* Return value:
|
||||
* The name.
|
||||
* Return Value:
|
||||
* Object Name <STRING>
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_name"];
|
||||
|
||||
PARAMS_2(_unit,_showEffective);
|
||||
|
||||
if (isNil "_showEffective") then {
|
||||
_showEffective = false;
|
||||
};
|
||||
params ["_unit", ["_showEffective", false]];
|
||||
|
||||
private "_name";
|
||||
_name = "";
|
||||
|
||||
if (_unit isKindOf "CAManBase") then {
|
||||
|
@ -1,14 +1,19 @@
|
||||
/*
|
||||
* Author: KoffeinFlummi
|
||||
*
|
||||
* Returns [pitch, bank, yaw] for given vehicle in degrees.
|
||||
* Returns pitch, bank, yaw for given vehicle in degrees.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Unit/Vehicle
|
||||
* 0: Unit/Vehicle <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* [pitch, bank, yaw]
|
||||
* 0: pitch <NUMBER>
|
||||
* 1: bank <NUMBER>
|
||||
* 2: yaw <NUMBER>
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
((_this select 0) call BIS_fnc_getPitchBank) + [getDir (_this select 0)]
|
||||
private ["_vehicle"];
|
||||
|
||||
(_vehicle call BIS_fnc_getPitchBank) + [getDir _vehicle]
|
||||
|
@ -1,23 +1,25 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
*
|
||||
* Get the turret index of a vehicles commander.
|
||||
*
|
||||
* Argument:
|
||||
* 0: Vehicle (Object)
|
||||
* Arguments:
|
||||
* 0: Vehicle <OBJECT>
|
||||
*
|
||||
* Return value:
|
||||
* Turret index of the vehicles commander. Empty array means no observer position. (Array)
|
||||
* Return Value:
|
||||
* Vehicle commander turrent indecies <ARRAY>
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_turrets", "_turret", "_config"];
|
||||
params ["_vehicle"];
|
||||
|
||||
PARAMS_1(_vehicle);
|
||||
private ["_turrets", "_turret", "_config"];
|
||||
|
||||
_turrets = allTurrets [_vehicle, true];
|
||||
|
||||
_turret = [];
|
||||
|
||||
{
|
||||
_config = configFile >> "CfgVehicles" >> typeOf _vehicle;
|
||||
|
||||
@ -26,5 +28,7 @@ _turret = [];
|
||||
if (getNumber (_config >> "primaryObserver") == 1) exitWith {
|
||||
_turret = _x;
|
||||
};
|
||||
} forEach _turrets;
|
||||
false
|
||||
} count _turrets;
|
||||
|
||||
_turret
|
||||
|
@ -1,28 +1,29 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
*
|
||||
* Get the config path of a vehicles turret.
|
||||
*
|
||||
* Argument:
|
||||
* 0: vehicles config (Config)
|
||||
* 1: Turret index (Array)
|
||||
* Arguments:
|
||||
* 0: Vehicle Config <CONFIG>
|
||||
* 1: Turret indecies <ARRAY>
|
||||
*
|
||||
* Return value:
|
||||
* Turret config (Config)
|
||||
* Return Value:
|
||||
* Turret config <CONFIG>
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_index", "_offset", "_config2", "_foundClasses", "_a"];
|
||||
params ["_config", "_turretIndex"];
|
||||
|
||||
PARAMS_2(_config,_turretIndex);
|
||||
private ["_offset", "_config2", "_foundClasses"];
|
||||
|
||||
for "_index" from 0 to (count _turretIndex - 1) do {
|
||||
_config = _config >> "Turrets";
|
||||
|
||||
_offset = 0;
|
||||
_config2 = _config select 0;
|
||||
|
||||
_foundClasses = 0;
|
||||
|
||||
for "_a" from 0 to (count _config - 1) do {
|
||||
if (isClass _config2) then {
|
||||
_foundClasses = _foundClasses + 1;
|
||||
@ -33,6 +34,8 @@ for "_index" from 0 to (count _turretIndex - 1) do {
|
||||
|
||||
if (_foundClasses == _turretIndex select _index) exitWith {};
|
||||
};
|
||||
|
||||
_config = _config2;
|
||||
};
|
||||
|
||||
_config
|
||||
|
@ -1,23 +1,25 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
*
|
||||
* Get the turret index of a vehicles copilot.
|
||||
*
|
||||
* Argument:
|
||||
* 0: Vehicle (Object)
|
||||
* Arguments:
|
||||
* 0: Vehicle <OBJECT>
|
||||
*
|
||||
* Return value:
|
||||
* Turret index of the vehicles gunner. Empty array means no copilot position. (Array)
|
||||
* Return Value:
|
||||
* Vehicle Copilot Turret indecies <ARRAY>
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_turrets", "_turret", "_config"];
|
||||
params ["_vehicle"];
|
||||
|
||||
PARAMS_1(_vehicle);
|
||||
private ["_turrets", "_turret", "_config"];
|
||||
|
||||
_turrets = allTurrets [_vehicle, true];
|
||||
|
||||
_turret = [];
|
||||
|
||||
{
|
||||
_config = configFile >> "CfgVehicles" >> typeOf _vehicle;
|
||||
|
||||
@ -26,6 +28,7 @@ _turret = [];
|
||||
if (getNumber (_config >> "isCopilot") == 1 && {getNumber (_config >> "primaryGunner") != 1} && {getNumber (_config >> "primaryObserver") != 1}) exitWith {
|
||||
_turret = _x;
|
||||
};
|
||||
} forEach _turrets;
|
||||
false
|
||||
} count _turrets;
|
||||
|
||||
_turret
|
||||
|
@ -1,36 +1,46 @@
|
||||
/*
|
||||
* Author: jaynus
|
||||
*
|
||||
* Get the absolute turret direction for FOV/PIP turret.
|
||||
*
|
||||
* Argument:
|
||||
* 0: Vehicle (Object)
|
||||
* 1: Turret Position
|
||||
* Arguments:
|
||||
* 0: Vehicle <OBJECT>
|
||||
* 1: Turret Position <ARRAY>
|
||||
*
|
||||
* Return value:
|
||||
* [position, direction]
|
||||
* Return Value:
|
||||
* 0: Position ASL <ARRAY>
|
||||
* 1: Direction <ARRAY>
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_2(_vehicle,_position);
|
||||
private ["_turret", "_povPos", "_povDir", "_gunBeginPos", "_gunEndPos", "_pov", "_gunBeg", "_gunEnd", "_pipDir"];
|
||||
params ["_vehicle", "_position"];
|
||||
|
||||
private ["_turret", "_pov", "_gunBeg", "_gunEnd", "_povPos", "_povDir"];
|
||||
|
||||
_turret = [_vehicle, _position] call CBA_fnc_getTurret;
|
||||
|
||||
_pov = getText (_turret >> "memoryPointGunnerOptics");
|
||||
_gunBeg = getText (_turret >> "gunBeg");
|
||||
_gunEnd = getText (_turret >> "gunEnd");
|
||||
|
||||
TRACE_3("", _pov, _gunBeg, _gunEnd);
|
||||
|
||||
// Pull the PIP pov or barrel direction, depending on how the model is set up
|
||||
_povPos = ATLtoASL ( _vehicle modelToWorldVisual (_vehicle selectionPosition _pov ) );
|
||||
_povPos = ATLtoASL (_vehicle modelToWorldVisual (_vehicle selectionPosition _pov)); //@todo AGLToASL ?
|
||||
_povDir = [0,0,0];
|
||||
|
||||
if (_pov == "pip0_pos") then {
|
||||
_pipDir = ATLtoASL ( _vehicle modelToWorldVisual (_vehicle selectionPosition "pip0_dir" ) );
|
||||
private "_pipDir";
|
||||
_pipDir = ATLtoASL (_vehicle modelToWorldVisual (_vehicle selectionPosition "pip0_dir"));
|
||||
|
||||
_povDir = _pipDir vectorDiff _povPos;
|
||||
} else {
|
||||
_gunBeginPos = ATLtoASL ( _vehicle modelToWorldVisual (_vehicle selectionPosition _gunBeg ) );
|
||||
_gunEndPos = ATLtoASL ( _vehicle modelToWorldVisual (_vehicle selectionPosition _gunEnd ) );
|
||||
private ["_gunBeginPos", "_gunEndPos"];
|
||||
|
||||
_gunBeginPos = ATLtoASL (_vehicle modelToWorldVisual (_vehicle selectionPosition _gunBeg));
|
||||
_gunEndPos = ATLtoASL (_vehicle modelToWorldVisual (_vehicle selectionPosition _gunEnd));
|
||||
|
||||
_povDir = _gunBeginPos vectorDiff _gunEndPos;
|
||||
};
|
||||
|
||||
|
@ -1,23 +1,25 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
*
|
||||
* Get the turret index of a vehicles gunner.
|
||||
*
|
||||
* Argument:
|
||||
* 0: Vehicle (Object)
|
||||
* Arguments:
|
||||
* 0: Vehicle <OBJECT>
|
||||
*
|
||||
* Return value:
|
||||
* Turret index of the vehicles gunner. Empty array means no gunner position. (Array)
|
||||
* Return Value:
|
||||
* Vehicle Gunner Turret indecies <ARRAY>
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_turrets", "_turret", "_config"];
|
||||
params ["_vehicle"];
|
||||
|
||||
PARAMS_1(_vehicle);
|
||||
private ["_turrets", "_turret", "_config"];
|
||||
|
||||
_turrets = allTurrets [_vehicle, true];
|
||||
|
||||
_turret = [];
|
||||
|
||||
{
|
||||
_config = configFile >> "CfgVehicles" >> typeOf _vehicle;
|
||||
|
||||
@ -26,6 +28,7 @@ _turret = [];
|
||||
if (getNumber (_config >> "primaryGunner") == 1) exitWith {
|
||||
_turret = _x;
|
||||
};
|
||||
} forEach _turrets;
|
||||
false
|
||||
} count _turrets;
|
||||
|
||||
_turret
|
||||
|
@ -1,19 +1,21 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
*
|
||||
* Get the turret index of a units current turret.
|
||||
*
|
||||
* Argument:
|
||||
* 0: Unit, not the vehicle (as in not a car but the player) (Object)
|
||||
* Arguments:
|
||||
* 0: Unit <OBJECT>
|
||||
*
|
||||
* Return value:
|
||||
* Turret index array or config path. E.g: [0] for gunner or [0,0] for commander. Returns empty array if unit is not in a turret. (Array)
|
||||
* Return Value:
|
||||
* Turret Index <ARRAY>
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_unit"];
|
||||
|
||||
private ["_vehicle", "_turrets", "_units", "_index"];
|
||||
|
||||
PARAMS_1(_unit);
|
||||
_vehicle = vehicle _unit;
|
||||
|
||||
if (_unit == _vehicle) exitWith {[]};
|
||||
@ -21,9 +23,11 @@ if (_unit == _vehicle) exitWith {[]};
|
||||
_turrets = allTurrets [_vehicle, true];
|
||||
|
||||
_units = [];
|
||||
|
||||
{
|
||||
_units pushBack (_vehicle turretUnit _x);
|
||||
} forEach _turrets;
|
||||
false
|
||||
} count _turrets;
|
||||
|
||||
_index = _units find _unit;
|
||||
|
||||
|
@ -1,37 +1,45 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
* Get all turret indicies of a vehicle type.
|
||||
*
|
||||
* Get all turret indicies of a vehicle.
|
||||
* Arguments:
|
||||
* 0: Vehicle type <STRING>
|
||||
*
|
||||
* Argument:
|
||||
* 0: Vehicle type (String)
|
||||
* Return Value:
|
||||
* Turret Indecies <ARRAY>
|
||||
*
|
||||
* Return value:
|
||||
* All turret index arrays of the vehicle. E.g: [[0], [0,0]] (Array)
|
||||
* Public: Yes
|
||||
*
|
||||
* Note: It's advised to use allTurrets [_vehicle, true] instead whenever possible
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_config", "_turrets", "_fnc_addTurret", "_varName"];
|
||||
params ["_type"];
|
||||
|
||||
PARAMS_1(_type);
|
||||
private ["_varName", "_turrets"];
|
||||
|
||||
_varName = format ["ACE_CachedTurrets_%1", _type];
|
||||
_varName = format [QGVAR(CachedTurrets_%1), _type];
|
||||
_turrets = + (uiNamespace getVariable _varName);
|
||||
|
||||
if (!isNil "_turrets") exitWith {_turrets};
|
||||
|
||||
private ["_config", "_fnc_addTurret"];
|
||||
|
||||
_config = configFile >> "CfgVehicles" >> _type;
|
||||
|
||||
_turrets = [];
|
||||
_fnc_addTurret = {
|
||||
private ["_count", "_offset", "_index", "_path2", "_config2"];
|
||||
|
||||
PARAMS_2(_config,_path);
|
||||
_fnc_addTurret = {
|
||||
params ["_config", "_path"];
|
||||
|
||||
_config = _config >> "Turrets";
|
||||
|
||||
private ["_count", "_offset", "_path2", "_config2"];
|
||||
|
||||
_count = count _config;
|
||||
|
||||
_offset = 0;
|
||||
|
||||
for "_index" from 0 to (_count - 1) do {
|
||||
_path2 = _path + [_index - _offset];
|
||||
_config2 = _config select _index;
|
||||
|
@ -1,23 +1,25 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
*
|
||||
* Get the turret indices of ffv turrets.
|
||||
*
|
||||
* Argument:
|
||||
* 0: Vehicle (Object)
|
||||
* Arguments:
|
||||
* 0: Vehicle <OBJECT>
|
||||
*
|
||||
* Return value:
|
||||
* Turret index of the vehicles gunner. Empty array means no ffv turrets. (Array)
|
||||
* Return Value:
|
||||
* Vehicle FFV Turret indecies <ARRAY>
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_turrets", "_turret", "_config"];
|
||||
params ["_vehicle"];
|
||||
|
||||
PARAMS_1(_vehicle);
|
||||
private ["_turrets", "_turret", "_config"];
|
||||
|
||||
_turrets = allTurrets [_vehicle, true];
|
||||
|
||||
_turret = [];
|
||||
|
||||
{
|
||||
_config = configFile >> "CfgVehicles" >> typeOf _vehicle;
|
||||
|
||||
@ -26,5 +28,7 @@ _turret = [];
|
||||
if (getNumber (_config >> "isPersonTurret") == 1) then {
|
||||
_turret pushBack _x;
|
||||
};
|
||||
} forEach _turrets;
|
||||
false
|
||||
} count _turrets;
|
||||
|
||||
_turret
|
||||
|
@ -1,23 +1,25 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
*
|
||||
* Get the turret indices of other turrets (not gunner, commander, copilot or ffv).
|
||||
*
|
||||
* Argument:
|
||||
* 0: Vehicle (Object)
|
||||
* Arguments:
|
||||
* 0: Vehicle <OBJECT>
|
||||
*
|
||||
* Return value:
|
||||
* Turret index of the vehicles gunner. Empty array means no other turrets. (Array)
|
||||
* Return Value:
|
||||
* Vehicle Other Turret indecies <ARRAY>
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_turrets", "_turret", "_config"];
|
||||
params ["_vehicle"];
|
||||
|
||||
PARAMS_1(_vehicle);
|
||||
private ["_turrets", "_turret", "_config"];
|
||||
|
||||
_turrets = allTurrets [_vehicle, true];
|
||||
|
||||
_turret = [];
|
||||
|
||||
{
|
||||
_config = configFile >> "CfgVehicles" >> typeOf _vehicle;
|
||||
|
||||
@ -30,5 +32,7 @@ _turret = [];
|
||||
) then {
|
||||
_turret pushBack _x;
|
||||
};
|
||||
} forEach _turrets;
|
||||
false
|
||||
} count _turrets;
|
||||
|
||||
_turret
|
||||
|
@ -1,31 +1,33 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
*
|
||||
* Get the compass direction the wind is blowing from.
|
||||
*
|
||||
* Argument:
|
||||
* None.
|
||||
* Arguments:
|
||||
* None
|
||||
*
|
||||
* Return value:
|
||||
* Wind direction. (String)
|
||||
* Return Value:
|
||||
* Wind cardinal direction <STRING>
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
switch (round (windDir / 360 * 16)) do {
|
||||
case 1 : {localize QUOTE(DOUBLES(STR,GVAR(SSW)))};
|
||||
case 2 : {localize QUOTE(DOUBLES(STR,GVAR(SW)))};
|
||||
case 3 : {localize QUOTE(DOUBLES(STR,GVAR(WSW)))};
|
||||
case 4 : {localize QUOTE(DOUBLES(STR,GVAR(W)))};
|
||||
case 5 : {localize QUOTE(DOUBLES(STR,GVAR(WNW)))};
|
||||
case 6 : {localize QUOTE(DOUBLES(STR,GVAR(NW)))};
|
||||
case 7 : {localize QUOTE(DOUBLES(STR,GVAR(NNW)))};
|
||||
case 8 : {localize QUOTE(DOUBLES(STR,GVAR(N)))};
|
||||
case 9 : {localize QUOTE(DOUBLES(STR,GVAR(NNE)))};
|
||||
case 10 : {localize QUOTE(DOUBLES(STR,GVAR(NE)))};
|
||||
case 11 : {localize QUOTE(DOUBLES(STR,GVAR(ENE)))};
|
||||
case 12 : {localize QUOTE(DOUBLES(STR,GVAR(E)))};
|
||||
case 13 : {localize QUOTE(DOUBLES(STR,GVAR(ESE)))};
|
||||
case 14 : {localize QUOTE(DOUBLES(STR,GVAR(SE)))};
|
||||
case 15 : {localize QUOTE(DOUBLES(STR,GVAR(SSE)))};
|
||||
default {localize QUOTE(DOUBLES(STR,GVAR(S)))};
|
||||
};
|
||||
localize ([
|
||||
LSTRING(S),
|
||||
LSTRING(SSW),
|
||||
LSTRING(SW),
|
||||
LSTRING(WSW),
|
||||
LSTRING(W),
|
||||
LSTRING(WNW),
|
||||
LSTRING(NW),
|
||||
LSTRING(NNW),
|
||||
LSTRING(N),
|
||||
LSTRING(NNE),
|
||||
LSTRING(NE),
|
||||
LSTRING(ENE),
|
||||
LSTRING(E),
|
||||
LSTRING(ESE),
|
||||
LSTRING(SE),
|
||||
LSTRING(SSE),
|
||||
LSTRING(S)
|
||||
] select (round (windDir / 360 * 16))) // return
|
||||
|
@ -1,14 +1,17 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
*
|
||||
* Returns a value depending on current zoom level.
|
||||
*
|
||||
* Argument:
|
||||
* None.
|
||||
* Arguments:
|
||||
* None
|
||||
*
|
||||
* Return value:
|
||||
* Zoom. (Number)
|
||||
* Return Value:
|
||||
* Zoom <NUMBER>
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
(0.5 - ((worldToScreen positionCameraToWorld [0,1,1]) select 1)) * (getResolution select 5)
|
||||
if (!hasInterface) exitWith {0};
|
||||
|
||||
(0.5 - ((worldToScreen positionCameraToWorld [0, 1, 1]) select 1)) * (getResolution select 5)
|
||||
|
@ -1,6 +1,5 @@
|
||||
/*
|
||||
* Author: Nou
|
||||
*
|
||||
* Execute a global event on all clients, including self.
|
||||
*
|
||||
* Arguments:
|
||||
|
Loading…
Reference in New Issue
Block a user