mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge pull request #2535 from acemod/commoncleanup7
common code cleanup part 7
This commit is contained in:
commit
4c4785c140
@ -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
|
||||
|
@ -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
|
||||
|
@ -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"];
|
||||
[[],[]]
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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 = [];
|
||||
|
@ -1,6 +1,18 @@
|
||||
//fnc_hashListCreateList.sqf
|
||||
/*
|
||||
* Author: ?
|
||||
*
|
||||
* ?
|
||||
*
|
||||
* Arguments:
|
||||
* ?
|
||||
*
|
||||
* Return Value:
|
||||
* ?
|
||||
*
|
||||
* Public: ?
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_1(_keys);
|
||||
params ["_keys"];
|
||||
|
||||
[_keys,[]];
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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];
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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]);
|
||||
|
@ -20,4 +20,4 @@
|
||||
|
||||
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
|
||||
|
@ -14,4 +14,4 @@
|
||||
|
||||
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
|
||||
|
@ -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
|
||||
|
@ -10,7 +10,6 @@
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
isClass (configFile >> "cfgPatches" >> _this select 0)
|
||||
isClass (configFile >> "cfgPatches" >> _this select 0) // return
|
||||
|
@ -16,4 +16,4 @@
|
||||
|
||||
params ["_unit", ["_excludeRemoteControlled", false]];
|
||||
|
||||
isPlayer _unit || (!_excludeRemoteControlled && {_unit == call FUNC(player)})
|
||||
isPlayer _unit || (!_excludeRemoteControlled && {_unit == call FUNC(player)}) // return
|
||||
|
@ -1,6 +1,5 @@
|
||||
/*
|
||||
* Author: Nou
|
||||
*
|
||||
* Execute a local event on this client only.
|
||||
*
|
||||
* Arguments:
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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];
|
||||
|
@ -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];
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -1,6 +1,5 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
*
|
||||
* hint the Variable ACE_isUsedBy from the input Object every frame
|
||||
*
|
||||
* Argument:
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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];
|
||||
};
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user