mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Added CSE common port.
This commit is contained in:
parent
7678193ca1
commit
afc103a946
@ -38,5 +38,8 @@ class Extended_Respawn_EventHandlers {
|
||||
class GVAR(setName) {
|
||||
respawn = QUOTE(_this call FUNC(setName));
|
||||
};
|
||||
class GVAR(RESETDefaults) {
|
||||
respawn = QUOTE(_this call FUNC(resetAllDefaults_F));
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -72,6 +72,7 @@ enableCamShake true;
|
||||
if (alive _oldPlayer) then {
|
||||
[_oldPlayer] call FUNC(setName)
|
||||
};
|
||||
|
||||
}] call FUNC(addEventhandler);
|
||||
|
||||
GVAR(OldPlayerInventory) = ACE_player call FUNC(getAllGear);
|
||||
@ -133,3 +134,17 @@ GVAR(OldPlayerTurret) = [ACE_player] call FUNC(getTurretIndex);
|
||||
};
|
||||
|
||||
}, 0, []] call cba_fnc_addPerFrameHandler;
|
||||
|
||||
|
||||
[QGVAR(ENABLE_REVIVE_COUNTER), 0, false, QGVAR(ADDON)] call FUNC(defineVariable);
|
||||
[QGVAR(inReviveState), false, true, QGVAR(ADDON)] call FUNC(defineVariable);
|
||||
[QGVAR(isDead),false,true,QUOTE(ADDON)] call FUNC(defineVariable);
|
||||
[QGVAR(isDeadPlayer), false, true, QUOTE(ADDON)] call FUNC(defineVariable);
|
||||
[QGVAR(StateArrested),false,true,QUOTE(ADDON)] call FUNC(defineVariable);
|
||||
[QGVAR(StateUnconscious),false,true,QUOTE(ADDON)] call FUNC(defineVariable);
|
||||
[QGVAR(ENABLE_REVIVE_SETDEAD_F),0,false,QUOTE(ADDON)] call FUNC(defineVariable);
|
||||
[QGVAR(carriedBy),objNull,false,QUOTE(ADDON)] call FUNC(defineVariable);
|
||||
|
||||
if (isNil QGVAR(ENABLE_REVIVE_F)) then {
|
||||
GVAR(ENABLE_REVIVE_F) = 0;
|
||||
};
|
@ -180,6 +180,92 @@ if (hasInterface) then {
|
||||
};
|
||||
|
||||
|
||||
PREP(stringCompare);
|
||||
PREP(string_removeWhiteSpace);
|
||||
PREP(isHC);
|
||||
PREP(sendRequest_f);
|
||||
PREP(requestCallback);
|
||||
PREP(receiveRequest);
|
||||
PREP(onAnswerRequest);
|
||||
PREP(debug);
|
||||
PREP(debugModule);
|
||||
PREP(defineVariable);
|
||||
PREP(setDefinedVariable);
|
||||
PREP(getDefinedVariable);
|
||||
PREP(getAllDefinedSetVariables);
|
||||
PREP(getDefinedVariableInfo);
|
||||
PREP(getDefinedVariableDefault);
|
||||
PREP(sendHintTo);
|
||||
PREP(sendMessageTo);
|
||||
PREP(sendDisplayInformationTo);
|
||||
PREP(sendDisplayMessageTo);
|
||||
PREP(broadcastAnim);
|
||||
PREP(getDeathAnim);
|
||||
PREP(switchAnim);
|
||||
PREP(playMoveNow);
|
||||
PREP(localAnim);
|
||||
PREP(insertionSort);
|
||||
PREP(uniqueElementsOnly);
|
||||
PREP(sortAlphabeticallyBy);
|
||||
PREP(hasMagazine);
|
||||
PREP(useMagazine);
|
||||
PREP(findMagazine);
|
||||
PREP(hasItem);
|
||||
PREP(useItem);
|
||||
PREP(findItem);
|
||||
PREP(getNumberMagazinesIn);
|
||||
PREP(setCanInteract);
|
||||
PREP(getCanInteract);
|
||||
PREP(canInteract);
|
||||
PREP(resetAllDefaults_f);
|
||||
PREP(broadcastSound3D_f);
|
||||
PREP(setDead);
|
||||
PREP(isAwake);
|
||||
PREP(setProne);
|
||||
|
||||
PREP(disableUserInput_f);
|
||||
|
||||
PREP(dropWeapon_f);
|
||||
PREP(inWater_f);
|
||||
PREP(setVolume_f);
|
||||
PREP(closeAllDialogs_f);
|
||||
PREP(disableAI_f);
|
||||
PREP(moduleBasicRevive);
|
||||
PREP(switchToGroupSide_f);
|
||||
PREP(hasItem_f);
|
||||
PREP(getFirstObjectIntersection);
|
||||
PREP(getFirstTerrainIntersection);
|
||||
PREP(setHearingCapability);
|
||||
PREP(revealObject_f);
|
||||
PREP(getWeaponItems_f);
|
||||
PREP(isModLoaded_f);
|
||||
PREP(inheritsFrom);
|
||||
PREP(getVersion);
|
||||
PREP(carryObj);
|
||||
PREP(carriedByObj);
|
||||
PREP(getCarriedObj);
|
||||
PREP(getCarriedBy);
|
||||
PREP(beingCarried);
|
||||
PREP(setCarriedBy);
|
||||
PREP(setUnconsciousState);
|
||||
PREP(isUnconscious);
|
||||
PREP(getUnconsciousCondition);
|
||||
PREP(registerUnconsciousCondition);
|
||||
PREP(setCaptiveSwitch);
|
||||
PREP(moveToTempGroup);
|
||||
PREP(canGoUnconsciousState);
|
||||
PREP(setWeaponsCorrectUnconscious);
|
||||
PREP(effectPain);
|
||||
PREP(effectBleeding);
|
||||
PREP(effectBlackOut);
|
||||
PREP(limitMovementSpeed);
|
||||
PREP(limitSpeed);
|
||||
PREP(setArrestState);
|
||||
PREP(isArrested);
|
||||
PREP(loadPerson_F);
|
||||
PREP(loadPersonLocal_F);
|
||||
PREP(makeCopyOfBody_F);
|
||||
PREP(unloadPerson_F);
|
||||
PREP(cleanUpCopyOfBody_F);
|
||||
|
||||
ADDON = true;
|
||||
|
@ -5,7 +5,7 @@ class CfgPatches {
|
||||
units[] = {"ACE_Box_Misc"};
|
||||
weapons[] = {"ACE_ItemCore","ACE_FakePrimaryWeapon"};
|
||||
requiredVersion = REQUIRED_VERSION;
|
||||
requiredAddons[] = {"ace_main"};
|
||||
requiredAddons[] = {"ace_main", "ace_gui"};
|
||||
author[] = {"KoffeinFlummi"};
|
||||
authorUrl = "https://github.com/KoffeinFlummi/";
|
||||
VERSION_CONFIG;
|
||||
@ -80,3 +80,4 @@ class RscAttributeInventory: RscControlsGroupNoScrollbars {
|
||||
#include <FixPickup.hpp>
|
||||
#include <FixAnimations.hpp>
|
||||
#include <NoVoice.hpp>
|
||||
|
||||
|
12
addons/common/functions/fnc_beingCarried.sqf
Normal file
12
addons/common/functions/fnc_beingCarried.sqf
Normal file
@ -0,0 +1,12 @@
|
||||
/**
|
||||
* fn_beingCarried.sqf
|
||||
* @Descr: Check if object is being carried
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: [object OBJECT]
|
||||
* @Return: BOOL True if object is being carried
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
!(isNull ([_this select 0] call FUNC(getCarriedObj)));
|
21
addons/common/functions/fnc_broadcastAnim.sqf
Normal file
21
addons/common/functions/fnc_broadcastAnim.sqf
Normal file
@ -0,0 +1,21 @@
|
||||
/**
|
||||
* fn_broadcastAnim.sqf
|
||||
* @Descr: Broadcast an animation across the network using switchMove
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: [unit OBJECt, animation STRING]
|
||||
* @Return: void
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit","_anim","_persistent"];
|
||||
_unit = [_this, 0, ObjNull,[ObjNull]] call BIS_fnc_Param;
|
||||
_anim = [_this, 1, "",[""]] call BIS_fnc_Param;
|
||||
|
||||
if (count _this >2) then {
|
||||
_persistent = [_this, 2, false, [false]] call BIS_fnc_Param;
|
||||
[[_unit,_anim], QUOTE(FUNC(switchAnim)), true, _persistent] spawn EFUNC(common,execRemoteFnc);
|
||||
} else {
|
||||
[[_unit,_anim], QUOTE(FUNC(switchAnim)), true, false] spawn EFUNC(common,execRemoteFnc);
|
||||
};
|
16
addons/common/functions/fnc_broadcastSound3D_f.sqf
Normal file
16
addons/common/functions/fnc_broadcastSound3D_f.sqf
Normal file
@ -0,0 +1,16 @@
|
||||
/**
|
||||
* fn_broadcastSound3D_f.sqf
|
||||
* @Descr: Plays a sound in 3D
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: [unit OBJECT, sound STRING]
|
||||
* @Return: void
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
if (isDedicated) exitwith{};
|
||||
_unit = [_this, 0, ObjNull,[ObjNull]] call BIS_fnc_Param;
|
||||
_sound = [_this, 1, "",[""]] call BIS_fnc_Param;
|
||||
_unit say3D _sound;
|
17
addons/common/functions/fnc_canGoUnconsciousState.sqf
Normal file
17
addons/common/functions/fnc_canGoUnconsciousState.sqf
Normal file
@ -0,0 +1,17 @@
|
||||
/**
|
||||
* fn_canGoUnconsciousState.sqf
|
||||
* @Descr: Checks if an object can move into unconscious state
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: [unit OBJECT]
|
||||
* @Return: BOOL true if object can move into unconscious state
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit"];
|
||||
_unit = _this select 0;
|
||||
|
||||
(!(isNull _unit) && {(_unit isKindOf "CaManBase") && ([_unit] call FUNC(isAwake))})
|
13
addons/common/functions/fnc_canInteract.sqf
Normal file
13
addons/common/functions/fnc_canInteract.sqf
Normal file
@ -0,0 +1,13 @@
|
||||
/**
|
||||
* fn_canInteract.sqf
|
||||
* @Descr: Check if unit can interact with enviroment. Unit has to be awake and not be in arrested state.
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: [unit OBJECT]
|
||||
* @Return: BOOL True if unit can interact with enviroment.
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
private ["_unit","_return"];
|
||||
_unit = _this select 0;
|
||||
(((_unit getvariable [QGVAR(canInteract),0]) < 1) && ([_unit] call FUNC(isAwake)) && !([_unit] call FUNC(isArrested)))
|
17
addons/common/functions/fnc_carriedByObj.sqf
Normal file
17
addons/common/functions/fnc_carriedByObj.sqf
Normal file
@ -0,0 +1,17 @@
|
||||
/**
|
||||
* fn_carriedByObj.sqf
|
||||
* @Descr: Check if object A is being carried by object B.
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: [object OBJECT, unit OBJECT]
|
||||
* @Return: BOOL True if B is carrying A.
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit","_to"];
|
||||
_to = _this select 0;
|
||||
_unit = _this select 1;
|
||||
|
||||
([_to] call FUNC(getCarriedBy) == [_unit] call FUNC(getCarriedBy));
|
74
addons/common/functions/fnc_carryObj.sqf
Normal file
74
addons/common/functions/fnc_carryObj.sqf
Normal file
@ -0,0 +1,74 @@
|
||||
/**
|
||||
* fn_carryObj.sqf
|
||||
* @Descr: Have a unit carry an object. Use ObjNull for second parameter if you want the unit to carry nothing
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: [unit OBJECT, objectToCarry OBJECT, attachToVector ARRAY (Optional)]
|
||||
* @Return: BOOL Returns true if succesful
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit","_to","_return", "_fallDown", "_carriedObj", "_positionUnit"];
|
||||
_unit = [_this, 0,ObjNull, [ObjNull]] call bis_fnc_param;
|
||||
_to = [_this, 1,ObjNull, [ObjNull]] call bis_fnc_param;
|
||||
_fallDown = false;
|
||||
if (count _this > 3) then {
|
||||
_fallDown = _this select 3;
|
||||
};
|
||||
_return = false;
|
||||
|
||||
[format["fnc_carryObj - UNIT: %1 ATTEMPTS TO CARRY %2",_unit,_to],2] call FUNC(debug);
|
||||
|
||||
if (((typeName _to) == "OBJECT" && (isNull ([_unit] call FUNC(getCarriedObj)))) || isNull _to) then {
|
||||
if (vehicle _unit != _unit) exitwith {};
|
||||
if (!isNull _to) then {
|
||||
if ((isNull ([_to] call FUNC(getCarriedObj))) && ([_unit] call FUNC(canInteract))) then {
|
||||
_return = true;
|
||||
_unit setvariable [QGVAR(carriedObj),_to,true];
|
||||
if (_fallDown) then {
|
||||
// [_unit,_fallDown] call FUNC(limitMovementSpeed);
|
||||
};
|
||||
[_to, _unit] call FUNC(setCarriedBy);
|
||||
if (count _this > 2) then {
|
||||
if (count (_this select 2) == 3) then {
|
||||
_to attachTo [_unit,(_this select 2)];
|
||||
[format["fnc_carryObj - UNIT: %1 TO %2 - attachTo offset: %3",_unit,_to,(_this select 2)],2] call FUNC(debug);
|
||||
};
|
||||
} else {
|
||||
[format["fnc_carryObj - UNIT: %1 TO %2 - Script expects external handling of attachTo Command. Exiting",_unit,_to],2] call FUNC(debug);
|
||||
};
|
||||
|
||||
[[_unit, _to, _fallDown],"carryObject"] call FUNC(customEventHandler_F);
|
||||
|
||||
};
|
||||
} else {
|
||||
if (!isNull ([_unit] call FUNC(getCarriedObj))) then {
|
||||
[format["fnc_carryObj - UNIT: %1 DROPING CARRIED OBJECT",_unit],2] call FUNC(debug);
|
||||
_carriedObj = ([_unit] call FUNC(getCarriedObj));
|
||||
|
||||
detach _carriedObj;
|
||||
//_carriedObj setPosATL [(getPosATL _carriedObj) select 0, (getPosATL _carriedObj) select 1,0];
|
||||
if (!surfaceIsWater getPos _unit) then {
|
||||
_positionUnit = getPosATL _carriedObj;
|
||||
_positionUnit set [2, ((getPosATL _unit) select 2) + 0.1];
|
||||
_carriedObj setPosATL _positionUnit;
|
||||
} else {
|
||||
_positionUnit = getPosASL _carriedObj;
|
||||
_positionUnit set [2, ((getPosASL _unit) select 2) + 0.1];
|
||||
_carriedObj setPosASL _positionUnit;
|
||||
};
|
||||
[[_unit, _carriedObj],"carryObjectDropped"] call FUNC(customEventHandler_F);
|
||||
|
||||
[[_unit] call FUNC(getCarriedObj), objNull] call FUNC(setCarriedBy);
|
||||
_unit setvariable [QGVAR(carriedObj),_to,true];
|
||||
_return = true;
|
||||
|
||||
[[_unit, _to, _fallDown],"carryObject"] call FUNC(customEventHandler_F);
|
||||
};
|
||||
};
|
||||
} else {
|
||||
[format["fnc_carryObj - UNIT: %1 FAILED TO CARRY %2 - not an object or already carrying",_unit,_to],2] call FUNC(debug);
|
||||
};
|
||||
_return
|
26
addons/common/functions/fnc_cleanUpCopyOfBody_f.sqf
Normal file
26
addons/common/functions/fnc_cleanUpCopyOfBody_f.sqf
Normal file
@ -0,0 +1,26 @@
|
||||
/**
|
||||
* fn_cleanUpCopyOfBody_f.sqf
|
||||
* @Descr: Called from a custom eventhandler to ensure that any copies of bodies are cleaned up.
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: [unit OBJECT]
|
||||
* @Return: BOOL
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit", "_copy"];
|
||||
_unit = _this select 0;
|
||||
|
||||
_copy = _unit getvariable QGVAR(copyOfBody_f);
|
||||
if (isnil "_copy") exitwith {false};
|
||||
[format["Cleaning up a copy of Body: %1 %2", _unit, _copy]] call FUNC(debug);
|
||||
// lets clean it up
|
||||
_unit setvariable [QGVAR(originalCopy_f), nil, true];
|
||||
_unit setvariable [QGVAR(copyOfBody_f), nil, true];
|
||||
if (!isNull _copy) then {
|
||||
deleteVehicle _copy;
|
||||
};
|
||||
|
||||
true;
|
14
addons/common/functions/fnc_closeAllDialogs_f.sqf
Normal file
14
addons/common/functions/fnc_closeAllDialogs_f.sqf
Normal file
@ -0,0 +1,14 @@
|
||||
/**
|
||||
* fn_closeAllDialogs_f.sqf
|
||||
* @Descr: Close all dialogs
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: []
|
||||
* @Return: void
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
while {dialog} do {
|
||||
closeDialog 0;
|
||||
};
|
64
addons/common/functions/fnc_customEventHandler_f.sqf
Normal file
64
addons/common/functions/fnc_customEventHandler_f.sqf
Normal file
@ -0,0 +1,64 @@
|
||||
/**
|
||||
* fn_customEventHandler_f.sqf
|
||||
* @Descr: Execute a custom defined eventhandler.
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: [arguments ANY, handle STRING (The name of the eventhandler)]
|
||||
* @Return: ARRAY Array containing the results of the called eventhandlers.
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_arguments","_handle","_ehCfg","_eventHandlerCollection","_eventHandlerName","_cfg","_code","_classType", "_return"];
|
||||
_arguments = _this select 0;
|
||||
_handle = _this select 1;
|
||||
|
||||
// TODO figure out how we want to handle custom eventhandlers
|
||||
|
||||
_eventHandlerName = (QGVAR(f_custom_eventhandlers_) + _handle);
|
||||
_eventHandlerCollection = missionNamespace getvariable _eventHandlerName;
|
||||
if (isnil "_eventHandlerCollection") then {
|
||||
_eventHandlerCollection = [];
|
||||
[format["caching Custom Eventhandler: %1",_handle]] call FUNC(debug);
|
||||
_cfg = (ConfigFile >> "ACE_Eventhandlers" >> "CustomEventHandlers" >> _handle);
|
||||
if (isClass _cfg) then {
|
||||
_numberOfEH = count _cfg;
|
||||
|
||||
for "_EHiterator" from 0 to (_numberOfEH -1) /* step +1 */ do {
|
||||
//for [{_EHiterator=0}, {(_EHiterator< _numberOfEH)}, {_EHiterator=_EHiterator+1}] do {
|
||||
_ehCfg = _cfg select _EHiterator;
|
||||
if (isClass _ehCfg) then {
|
||||
_classType = (ConfigName _ehCfg);
|
||||
_code = (compile getText(_ehCfg >> "onCall"));
|
||||
_eventHandlerCollection pushback [_classType, _code];
|
||||
true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
_cfg = (MissionConfigFile >> "ACE_Eventhandlers" >> "CustomEventHandlers" >> _handle);
|
||||
if (isClass _cfg) then {
|
||||
_numberOfEH = count _cfg;
|
||||
for "_EHiterator" from 0 to (_numberOfEH -1) /* step +1 */ do {
|
||||
//for [{_EHiterator=0}, {(_EHiterator< _numberOfEH)}, {_EHiterator=_EHiterator+1}] do {
|
||||
_ehCfg = _cfg select _EHiterator;
|
||||
if (isClass _ehCfg) then {
|
||||
_classType = (ConfigName _ehCfg);
|
||||
_code = (compile getText(_ehCfg >> "onCall"));
|
||||
_eventHandlerCollection pushback [_classType, _code];
|
||||
true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
missionNamespace setvariable [_eventHandlerName, _eventHandlerCollection];
|
||||
[format["Custom Eventhandler: %1 cache: %2",_handle, _eventHandlerCollection]] call FUNC(debug);
|
||||
};
|
||||
|
||||
_return = [];
|
||||
{
|
||||
_return pushback (_arguments call (_x select 1));
|
||||
}foreach _eventHandlerCollection;
|
||||
|
||||
_return
|
53
addons/common/functions/fnc_debug.sqf
Normal file
53
addons/common/functions/fnc_debug.sqf
Normal file
@ -0,0 +1,53 @@
|
||||
/**
|
||||
* fn_debug.sqf
|
||||
* @Descr: Print logging messages through the ACE framework.
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: [message ANY, level NUMBER (Optional)]
|
||||
* @Return: BOOL True if message has been printed
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
#define DEFAULT_LOGGING_LEVEL -1
|
||||
#define DEFAULT_TEXT_DISPLAY -1
|
||||
|
||||
private ["_msg", "_level", "_prefix", "_defaultLoglevel","_defaultLogDisplayLevel", "_message", "_from"];
|
||||
_msg = _this select 0;
|
||||
_level = if (count _this > 1) then {_this select 1} else { 2 };
|
||||
|
||||
_defaultLoglevel = if (isNil QGVAR(LOGLEVEL)) then {
|
||||
DEFAULT_LOGGING_LEVEL;
|
||||
} else {
|
||||
GVAR(LOGLEVEL);
|
||||
};
|
||||
|
||||
_defaultLogDisplayLevel = if (isnil QGVAR(LOGDISPLAY_LEVEL)) then {
|
||||
DEFAULT_TEXT_DISPLAY;
|
||||
} else {
|
||||
GVAR(LOGDISPLAY_LEVEL);
|
||||
};
|
||||
|
||||
if (_defaultLoglevel < 0) exitwith {
|
||||
false
|
||||
};
|
||||
if (_level <= _defaultLoglevel) then {
|
||||
|
||||
_prefix = switch (_level) do {
|
||||
case 0: { "ACE Error" };
|
||||
case 1: { "ACE Warn" };
|
||||
case 2: { "ACE Debug" };
|
||||
case 3: { "ACE Info" };
|
||||
default { "ACE Unknown" };
|
||||
};
|
||||
_message = format["[%1] %2",_prefix,_msg];
|
||||
|
||||
if (_level >= _defaultLogDisplayLevel) then {
|
||||
systemChat _message;
|
||||
};
|
||||
diag_log _message;
|
||||
|
||||
// pass it onwards to the log function:
|
||||
// [0, [], compile format["%1",_msg], true] call FUNC(log);
|
||||
};
|
||||
true
|
15
addons/common/functions/fnc_debugModule.sqf
Normal file
15
addons/common/functions/fnc_debugModule.sqf
Normal file
@ -0,0 +1,15 @@
|
||||
/**
|
||||
* fn_debugModule.sqf
|
||||
* @Descr: N/A
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: []
|
||||
* @Return:
|
||||
* @PublicAPI: false
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
private ["_entity"];
|
||||
_entity = _this select 0;
|
||||
|
||||
GVAR(LOGDISPLAY_LEVEL) = call compile (_entity getvariable ["logDisplayLevel","4"]);
|
||||
GVAR(LOGLEVEL) = call compile (_entity getvariable ["logLevel","4"]);
|
40
addons/common/functions/fnc_defineVariable.sqf
Normal file
40
addons/common/functions/fnc_defineVariable.sqf
Normal file
@ -0,0 +1,40 @@
|
||||
/**
|
||||
* fn_defineVariable.sqf
|
||||
* @Descr: Define a variable for the ACE variable framework
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: [name STRING, defaultValue ANY, publicFlag BOOL, category STRING, type NUMBER, persistentFlag BOOL]
|
||||
* @Return:
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_name","_value","_defaultGlobal","_catagory","_code","_persistent"];
|
||||
_name = _this select 0;
|
||||
_value = _this select 1;
|
||||
_defaultGlobal = _this select 2;
|
||||
_catagory = _this select 3;
|
||||
_code = 0;
|
||||
_persistent = false;
|
||||
|
||||
if (count _this < 3) exitwith {};
|
||||
if (count _this > 4) then {
|
||||
_code = _this select 4;
|
||||
if (count _this > 5) then {
|
||||
_persistent = _this select 5;
|
||||
};
|
||||
};
|
||||
|
||||
if (typeName _name != typeName "") then {
|
||||
throw "IllegalArgument";
|
||||
};
|
||||
|
||||
if (isnil QGVAR(OBJECT_VARIABLES_STORAGE)) then {
|
||||
GVAR(OBJECT_VARIABLES_STORAGE) = [];
|
||||
};
|
||||
|
||||
GVAR(OBJECT_VARIABLES_STORAGE) pushback [_name,_value,_defaultGlobal,_catagory,_code, _persistent];
|
||||
|
||||
missionNamespace setvariable ["GVAR(OBJECT_VARIABLES_STORAGE)_" + _name, [_name,_value,_defaultGlobal,_catagory,_code, _persistent]];
|
||||
|
||||
[[_name,_value,_defaultGlobal,_catagory,_code, _persistent],"variableDefined"] call FUNC(customEventHandler_F);
|
23
addons/common/functions/fnc_disableAI_f.sqf
Normal file
23
addons/common/functions/fnc_disableAI_f.sqf
Normal file
@ -0,0 +1,23 @@
|
||||
/**
|
||||
* fn_disableAI_f.sqf
|
||||
* @Descr: N/A
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: []
|
||||
* @Return:
|
||||
* @PublicAPI: false
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
private ["_unit","_disable"];
|
||||
_unit = [_this, 0,ObjNull,[ObjNull]] call BIS_fnc_Param;
|
||||
_disable = [_this, 1,false,[false]] call BIS_fnc_Param;
|
||||
|
||||
if (local _unit && !(IsPlayer _unit)) then {
|
||||
if (_disable) then {
|
||||
_unit disableAI "Move";
|
||||
_unit disableAI "TARGET";
|
||||
} else {
|
||||
_unit enableAI "Move";
|
||||
_unit enableAI "TARGET";
|
||||
};
|
||||
};
|
28
addons/common/functions/fnc_disableUserInput_f.sqf
Normal file
28
addons/common/functions/fnc_disableUserInput_f.sqf
Normal file
@ -0,0 +1,28 @@
|
||||
/**
|
||||
* fn_disableUserInput_f.sqf
|
||||
* @Descr: Disables the user input. Works stacked.
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: [id STRING, disable BOOL]
|
||||
* @Return: void
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
private ["_id","_disable"];
|
||||
_id = _this select 0;
|
||||
_disable = _this select 1;
|
||||
|
||||
|
||||
if (isnil QGVAR(DISABLE_USER_INPUT_COLLECTION_F)) then {
|
||||
GVAR(DISABLE_USER_INPUT_COLLECTION_F) = [];
|
||||
};
|
||||
|
||||
if (_disable) then {
|
||||
GVAR(DISABLE_USER_INPUT_COLLECTION_F) pushback _id;
|
||||
[true] call FUNC(disableUserInput);
|
||||
} else {
|
||||
GVAR(DISABLE_USER_INPUT_COLLECTION_F) = GVAR(DISABLE_USER_INPUT_COLLECTION_F) - [_id];
|
||||
if (GVAR(DISABLE_USER_INPUT_COLLECTION_F) isEqualTo []) then {
|
||||
[false] call FUNC(disableUserInput);
|
||||
};
|
||||
};
|
39
addons/common/functions/fnc_dropWeapon_f.sqf
Normal file
39
addons/common/functions/fnc_dropWeapon_f.sqf
Normal file
@ -0,0 +1,39 @@
|
||||
/**
|
||||
* fn_dropWeapon_f.sqf
|
||||
* @Descr: N/A
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: []
|
||||
* @Return:
|
||||
* @PublicAPI: false
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
private ["_unit","_currentWeapon","_currentAnimation", "_WeaponHolder"];
|
||||
_unit = [_this, 0, ObjNull,[ObjNull]] call BIS_fnc_Param;
|
||||
|
||||
_currentWeapon = currentWeapon _unit;
|
||||
_currentAnimation = animationState _unit;
|
||||
_WeaponHolder = "GroundWeaponHolder" createVehicle position _unit;
|
||||
|
||||
_unit removeWeapon _currentWeapon;
|
||||
_weaponHolder addWeaponCargoGlobal [_currentWeapon, 1];
|
||||
//_unit action [ "DropWeapon", _WeaponHolder, _currentWeapon ];
|
||||
_WeaponHolder setPos (getPos _unit);
|
||||
//_unit switchMove _currentAnimation;
|
||||
|
||||
_primairyWeapon = primaryWeapon _unit;
|
||||
_secondairyWeapon = secondaryWeapon _unit;
|
||||
_handGunWeapon = handgunWeapon _unit;
|
||||
|
||||
switch (_currentWeapon) do {
|
||||
case _primairyWeapon: {
|
||||
|
||||
};
|
||||
case _secondairyWeapon: {
|
||||
|
||||
};
|
||||
case _handGunWeapon: {
|
||||
|
||||
};
|
||||
default {};
|
||||
};
|
21
addons/common/functions/fnc_effectBlackOut.sqf
Normal file
21
addons/common/functions/fnc_effectBlackOut.sqf
Normal file
@ -0,0 +1,21 @@
|
||||
/**
|
||||
* fn_effectBlackOut.sqf
|
||||
* @Descr: Displays the blacked out effect for clients.
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: [displayEffect BOOL]
|
||||
* @Return: void
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_displayEffect","_effect"];
|
||||
_displayEffect = [_this, 0, false,[false]] call bis_fnc_param;
|
||||
disableSerialization;
|
||||
_effect = uiNamespace getVariable QGVAR(ScreenEffectsBlack);
|
||||
if (_displayEffect) then {
|
||||
(_effect displayCtrl 11112) ctrlSetTextColor [0.0,0.0,0.0,0.9];
|
||||
} else {
|
||||
(_effect displayCtrl 11112) ctrlSetTextColor [0.0,0.0,0.0,0.0];
|
||||
};
|
36
addons/common/functions/fnc_effectBleeding.sqf
Normal file
36
addons/common/functions/fnc_effectBleeding.sqf
Normal file
@ -0,0 +1,36 @@
|
||||
/**
|
||||
* fn_effectBleeding.sqf
|
||||
* @Descr: Displays the ACE Bleeding effect
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: [bloodLoss NUMBER]
|
||||
* @Return: void
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
if (isnil QGVAR(DisplayingBleedingEffect)) then {
|
||||
GVAR(DisplayingBleedingEffect) = false;
|
||||
};
|
||||
if (GVAR(DisplayingBleedingEffect)) exitwith {};
|
||||
private ["_bloodLoss","_time"];
|
||||
_bloodLoss = _this select 0;
|
||||
if (!(_bloodLoss > 0)) exitwith{};
|
||||
|
||||
_time = 10 - _bloodLoss;
|
||||
if (_time < 1.5) then {
|
||||
_time = 1.5;
|
||||
};
|
||||
GVAR(DisplayingBleedingEffect) = true;
|
||||
47 cutRsc [QGVAR(ScreenEffectsBleeding),"PLAIN"];
|
||||
|
||||
[{
|
||||
if !(isnil QGVAR(DisplayingBleedingEffect_ran)) then {
|
||||
GVAR(DisplayingBleedingEffect_ran) = nil;
|
||||
GVAR(DisplayingBleedingEffect) = false;
|
||||
[(_this select 1)] call cba_fnc_removePerFrameHandler;
|
||||
} else {
|
||||
GVAR(DisplayingBleedingEffect_ran) = true;
|
||||
};
|
||||
}, _time, [] ] call CBA_fnc_addPerFrameHandler;
|
32
addons/common/functions/fnc_effectPain.sqf
Normal file
32
addons/common/functions/fnc_effectPain.sqf
Normal file
@ -0,0 +1,32 @@
|
||||
/**
|
||||
* fn_effectPain.sqf
|
||||
* @Descr: Displays the ACE Pain effect
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: [painRatio NUMBER]
|
||||
* @Return: void
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
if (isnil QGVAR(DisplayingPainEffect)) then {
|
||||
GVAR(DisplayingPainEffect) = false;
|
||||
};
|
||||
|
||||
if (GVAR(DisplayingPainEffect)) exitwith {};
|
||||
|
||||
private ["_ratio","_time"];
|
||||
_ratio = _this select 0;
|
||||
if (!(_ratio > 0)) exitwith{};
|
||||
_time = 6 - _ratio;
|
||||
if (_time <1.5) then {
|
||||
_time = 1.5;
|
||||
};
|
||||
GVAR(DisplayingPainEffect) = true;
|
||||
46 cutRsc [QGVAR(ScreenEffectsPain),"PLAIN"];
|
||||
|
||||
[{
|
||||
GVAR(DisplayingPainEffect) = false;
|
||||
[(_this select 1)] call cba_fnc_removePerFrameHandler;
|
||||
}, _time, [] ] call CBA_fnc_addPerFrameHandler;
|
29
addons/common/functions/fnc_endRadioTransmission_f.sqf
Normal file
29
addons/common/functions/fnc_endRadioTransmission_f.sqf
Normal file
@ -0,0 +1,29 @@
|
||||
/**
|
||||
* fn_endRadioTransmission_f.sqf
|
||||
* @Descr: force end all radio transmissions by TFAR or ACRE
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: []
|
||||
* @Return: nil
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
if (["acre_api"] call FUNC(isModLoaded_F)) then {
|
||||
[-1] call acre_sys_core_fnc_handleMultiPttKeyPressUp;
|
||||
[0] call acre_sys_core_fnc_handleMultiPttKeyPressUp;
|
||||
[1] call acre_sys_core_fnc_handleMultiPttKeyPressUp;
|
||||
[2] call acre_sys_core_fnc_handleMultiPttKeyPressUp;
|
||||
};
|
||||
|
||||
if (["task_force_radio"] call FUNC(isModLoaded_F)) then {
|
||||
call TFAR_fnc_onSwTangentReleased;
|
||||
call TFAR_fnc_onAdditionalSwTangentReleased;
|
||||
|
||||
call TFAR_fnc_onLRTangentReleased;
|
||||
call TFAR_fnc_onAdditionalLRTangentReleased;
|
||||
|
||||
call TFAR_fnc_onDDTangentReleased;
|
||||
};
|
||||
|
||||
nil;
|
25
addons/common/functions/fnc_findItem.sqf
Normal file
25
addons/common/functions/fnc_findItem.sqf
Normal file
@ -0,0 +1,25 @@
|
||||
/**
|
||||
* fn_findItem.sqf
|
||||
* @Descr:
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: []
|
||||
* @Return:
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
private ["_unit","_magazine","_return"];
|
||||
_unit = _this select 0;
|
||||
_item = _this select 1;
|
||||
|
||||
if (_item in (uniformItems _unit)) exitwith {1};
|
||||
if (_item in (vestItems _unit)) exitwith {2};
|
||||
if (_item in (backpackItems _unit)) exitwith {3};
|
||||
if (_item in (assignedItems _unit)) exitwith {4};
|
||||
if (_item in (primaryWeaponItems _unit)) exitwith {5};
|
||||
if (_item in (secondaryWeaponItems _unit)) exitwith {6};
|
||||
if (_item in (handgunItems _unit)) exitwith {7};
|
||||
if (_item in (items _unit)) exitwith {8}; // in case it is in items but cannot be found in any other container (should never reach this)
|
||||
|
||||
// If we cannot find the item, return 0.
|
||||
0;
|
21
addons/common/functions/fnc_findMagazine.sqf
Normal file
21
addons/common/functions/fnc_findMagazine.sqf
Normal file
@ -0,0 +1,21 @@
|
||||
/**
|
||||
* fn_findMagazine.sqf
|
||||
* @Descr: Find where the current magazines are. Order: uniform, vest, backpack, any.
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: [unit OBJECT, magazine STRING (Classname of magazine)]
|
||||
* @Return: NUMBER 0 = none, 1 = in uniform, 2 = in vest, 3 = in backpack, 4 = found outside container
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
private ["_unit","_magazine"];
|
||||
_unit = _this select 0;
|
||||
_magazine = _this select 1;
|
||||
|
||||
if (_magazine in (getMagazineCargo uniformContainer _unit)) exitwith {1};
|
||||
if (_magazine in (getMagazineCargo vestContainer _unit)) exitwith {2};
|
||||
if (_magazine in (getMagazineCargo backpackContainer _unit)) exitwith {3};
|
||||
if (_magazine in (magazines _unit)) exitwith {4}; // in case it cannot be found in any other container. Most likely loaded in a weapon.
|
||||
|
||||
// If we cannot find the item, return 0.
|
||||
0;
|
21
addons/common/functions/fnc_foreachDo.sqf
Normal file
21
addons/common/functions/fnc_foreachDo.sqf
Normal file
@ -0,0 +1,21 @@
|
||||
/**
|
||||
* fn_foreachDo.sqf
|
||||
* @Descr: Execute code for each element in an array and collect the return values.
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: [array ARRAY, do CODE (Code executed for each element)]
|
||||
* @Return: ARRAY Array with return values.
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
private ["_array", "_do", "_return"];
|
||||
_array = _this select 0;
|
||||
_do = _this select 1;
|
||||
|
||||
_return = [];
|
||||
{
|
||||
_return pushback(_x call _do);
|
||||
false;
|
||||
}count _array;
|
||||
|
||||
_return;
|
27
addons/common/functions/fnc_getAllDefinedSetVariables.sqf
Normal file
27
addons/common/functions/fnc_getAllDefinedSetVariables.sqf
Normal file
@ -0,0 +1,27 @@
|
||||
/**
|
||||
* fn_getAllSetVariables.sqf
|
||||
* @Descr: Returns an 2d array of all variables that have been set on the object
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @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
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
private ["_object", "_return", "_val", "_category"];
|
||||
_object = _this select 0;
|
||||
_category = if (count _this > 1) then { _this select 1 } else { "" };
|
||||
|
||||
if (isnil QGVAR(OBJECT_VARIABLES_STORAGE)) then {
|
||||
GVAR(OBJECT_VARIABLES_STORAGE) = [];
|
||||
};
|
||||
_return = [];
|
||||
{
|
||||
_val = _object getvariable (_x select 0);
|
||||
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];
|
||||
};
|
||||
};
|
||||
}foreach GVAR(OBJECT_VARIABLES_STORAGE);
|
||||
_return
|
12
addons/common/functions/fnc_getCanInteract.sqf
Normal file
12
addons/common/functions/fnc_getCanInteract.sqf
Normal file
@ -0,0 +1,12 @@
|
||||
/**
|
||||
* fn_getCanInteract.sqf
|
||||
* @Descr: N/A
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: []
|
||||
* @Return:
|
||||
* @PublicAPI: false
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
((_this select 0) getvariable [QGVAR(canInteract),0])
|
13
addons/common/functions/fnc_getCarriedBy.sqf
Normal file
13
addons/common/functions/fnc_getCarriedBy.sqf
Normal file
@ -0,0 +1,13 @@
|
||||
/**
|
||||
* fn_getCarriedBy.sqf
|
||||
* @Descr: Get the object that is carrying given unit or object
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: [unit OBJECT]
|
||||
* @Return: OBJECT Returns the object that is carrying the unit. Otherwise returns ObjNull
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
((_this select 0) getvariable [QGVAR(carriedBy),objNull]);
|
13
addons/common/functions/fnc_getCarriedObj.sqf
Normal file
13
addons/common/functions/fnc_getCarriedObj.sqf
Normal file
@ -0,0 +1,13 @@
|
||||
/**
|
||||
* fn_getCarriedObj.sqf
|
||||
* @Descr: Grab the registered carried object
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: [unit OBJECT]
|
||||
* @Return: OBJECT Returns the object that the unit is currently carrying. If not carrying, returns ObjNull
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
((_this select 0) getvariable [QGVAR(carriedObj),objNull]);
|
43
addons/common/functions/fnc_getCustomResults_f.sqf
Normal file
43
addons/common/functions/fnc_getCustomResults_f.sqf
Normal file
@ -0,0 +1,43 @@
|
||||
/**
|
||||
* fn_getCustomResults_f.sqf
|
||||
* @Descr: Executes custom results eventhandlers, collects their output and returns this.
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: [arguments ANY, handle STRING]
|
||||
* @Return: ARRAY Collection of all return values of all executed CustomResult handlers
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_arguments","_handle","_ehCfg","_eventHandlerCollection","_eventHandlerName","_cfg","_code","_classType", "_return"];
|
||||
_arguments = _this select 0;
|
||||
_handle = _this select 1;
|
||||
|
||||
_eventHandlerName = ("ace_f_custom_results_eventhandler_" + _handle);
|
||||
_eventHandlerCollection = missionNamespace getvariable _eventHandlerName;
|
||||
if (isnil "_eventHandlerCollection") then {
|
||||
_eventHandlerCollection = [];
|
||||
|
||||
_cfg = (ConfigFile >> "Combat_Space_Enhancement" >> "CustomResults" >> _handle);
|
||||
if (isClass _cfg) then {
|
||||
_numberOfEH = count _cfg;
|
||||
for [{_EHiterator=0}, {(_EHiterator< _numberOfEH)}, {_EHiterator=_EHiterator+1}] do {
|
||||
_ehCfg = _cfg select _EHiterator;
|
||||
if (isClass _ehCfg) then {
|
||||
_classType = (ConfigName _ehCfg);
|
||||
_code = (compile getText(_ehCfg >> "onCall"));
|
||||
_eventHandlerCollection set [ count _eventHandlerCollection, [_classType, _code]];
|
||||
true;
|
||||
};
|
||||
};
|
||||
};
|
||||
missionNamespace setvariable [_eventHandlerName, _eventHandlerCollection];
|
||||
};
|
||||
|
||||
_return = [];
|
||||
{
|
||||
_return set [ count _return, _arguments call (_x select 1) ];
|
||||
}foreach _eventHandlerCollection;
|
||||
|
||||
_return
|
33
addons/common/functions/fnc_getDeathAnim.sqf
Normal file
33
addons/common/functions/fnc_getDeathAnim.sqf
Normal file
@ -0,0 +1,33 @@
|
||||
/**
|
||||
* fn_getDeathAnim.sqf
|
||||
* @Descr: Get the death animation for the unit at current time
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: [unit OBJECT]
|
||||
* @Return: STRING animation
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit", "_curAnim", "_animation", "_cfg","_unitAnimation", "_animationState"];
|
||||
_unit = _this select 0;
|
||||
_animation = "";
|
||||
_animationState = (animationState _unit);
|
||||
_unitAnimation = (configFile >> "CfgMovesMaleSdr" >> "States" >> _animationState);
|
||||
if (isText (_unitAnimation >> "actions")) then {
|
||||
if ((vehicle _unit) != _unit) then {
|
||||
_cfg = (configFile >> "CfgMovesMaleSdr" >> "States" >> _animationState);
|
||||
if (isArray (_cfg >> "interpolateTo")) then {
|
||||
_animation = getArray (_cfg >> "interpolateTo") select 0;
|
||||
};
|
||||
} else {
|
||||
_cfg = (configFile >> "CfgMovesBasic" >> "Actions" >> (getText (_unitAnimation >> "actions")) >> "die");
|
||||
if (isText _cfg) then {
|
||||
_animation = getText _cfg;
|
||||
};
|
||||
};
|
||||
};
|
||||
if (isnil "_animation") then {
|
||||
_animation = "";
|
||||
};
|
||||
_animation
|
33
addons/common/functions/fnc_getDefinedVariable.sqf
Normal file
33
addons/common/functions/fnc_getDefinedVariable.sqf
Normal file
@ -0,0 +1,33 @@
|
||||
/**
|
||||
* fn_getVariable.sqf
|
||||
* @Descr: Grabs a variable. If variable has not been set, attempts to use default defined value
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: [unit OBJECT, variableName STRING]
|
||||
* @Return: ANY
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
#define UNIT (_this select 0)
|
||||
#define VARIABLE (_this select 1)
|
||||
|
||||
private "_value";
|
||||
|
||||
_value = UNIT getvariable VARIABLE;
|
||||
if (isnil "_value") then {
|
||||
if (count _this >2) then {
|
||||
_value = _this select 2;
|
||||
} else {
|
||||
private "_definedVariable";
|
||||
_definedVariable = ([VARIABLE] call FUNC(getDefinedVariableInfo));
|
||||
if (count _definedVariable > 1) then {
|
||||
_value = _definedVariable select 1;
|
||||
};
|
||||
};
|
||||
if (isnil "_value") then {
|
||||
_value = 0;
|
||||
};
|
||||
};
|
||||
_value
|
19
addons/common/functions/fnc_getDefinedVariableDefault.sqf
Normal file
19
addons/common/functions/fnc_getDefinedVariableDefault.sqf
Normal file
@ -0,0 +1,19 @@
|
||||
/**
|
||||
* fn_getvariableDefault.sqf
|
||||
* @Descr: Get the variable default value
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: [variableName STRING]
|
||||
* @Return: ANY
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private "_variableDefinition";
|
||||
_variableDefinition = ([_this select 0] call FUNC(getDefinedVariableInfo));
|
||||
if (count _variableDefinition > 0) exitwith {
|
||||
_variableDefinition select 1;
|
||||
};
|
||||
|
||||
nil;
|
11
addons/common/functions/fnc_getDefinedVariableInfo.sqf
Normal file
11
addons/common/functions/fnc_getDefinedVariableInfo.sqf
Normal file
@ -0,0 +1,11 @@
|
||||
/**
|
||||
* fn_getvariableInfo.sqf
|
||||
* @Descr: N/A
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: []
|
||||
* @Return:
|
||||
* @PublicAPI: false
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
+(missionNamespace getvariable ["GVAR(OBJECT_VARIABLES_STORAGE)_" + (_this select 0),[]])
|
44
addons/common/functions/fnc_getFirstObjectIntersection.sqf
Normal file
44
addons/common/functions/fnc_getFirstObjectIntersection.sqf
Normal file
@ -0,0 +1,44 @@
|
||||
/**
|
||||
* fn_getFirstIntersection.sqf
|
||||
* @Descr: Returns the the first intersection with an object between two positions
|
||||
* @Author: Ruthberg
|
||||
*
|
||||
* @Arguments: [position PositionASL, position PositionASL, accuracy FLOAT]
|
||||
* @Return: [intersects BOOL, intersection PositionASL]
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_source", "_destination", "_accuracy", "_distance", "_lower", "_upper", "_mid", "_intersections", "_result"];
|
||||
_source = _this select 0;
|
||||
_destination = _this select 1;
|
||||
_accuracy = _this select 2;
|
||||
|
||||
_result = [false, [0, 0, 0]];
|
||||
|
||||
_distance = _source vectorDistance _destination;
|
||||
|
||||
if (count (lineIntersectsWith [_source, _destination]) > 0) then {
|
||||
_lower = 0;
|
||||
_upper = 1;
|
||||
_mid = 0.5;
|
||||
|
||||
_dir = _source vectorFromTo _destination;
|
||||
|
||||
while {(_upper - _lower) * _distance > _accuracy} do {
|
||||
_mid = _lower + (_upper - _lower) / 2;
|
||||
|
||||
_intersections = count (lineIntersectsWith [_source, _source vectorAdd (_dir vectorMultiply (_mid * _distance))]);
|
||||
|
||||
if (_intersections > 0) then {
|
||||
_upper = _mid;
|
||||
} else {
|
||||
_lower = _mid;
|
||||
};
|
||||
};
|
||||
|
||||
_mid = _lower + (_upper - _lower) / 2;
|
||||
_result = [true, _source vectorAdd (_dir vectorMultiply (_mid * _distance))];
|
||||
};
|
||||
|
||||
_result
|
44
addons/common/functions/fnc_getFirstTerrainIntersection.sqf
Normal file
44
addons/common/functions/fnc_getFirstTerrainIntersection.sqf
Normal file
@ -0,0 +1,44 @@
|
||||
/**
|
||||
* fn_getFirstIntersection.sqf
|
||||
* @Descr: Returns the the first intersection with an object between two positions
|
||||
* @Author: Ruthberg
|
||||
*
|
||||
* @Arguments: [position PositionASL, position PositionASL, accuracy FLOAT]
|
||||
* @Return: [intersects BOOL, intersection PositionASL]
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_source", "_destination", "_accuracy", "_distance", "_lower", "_upper", "_mid", "_intersection", "_result"];
|
||||
_source = _this select 0;
|
||||
_destination = _this select 1;
|
||||
_accuracy = _this select 2;
|
||||
|
||||
_result = [false, [0, 0, 0]];
|
||||
|
||||
_distance = _source vectorDistance _destination;
|
||||
|
||||
if (terrainIntersectASL [_source, _destination]) then {
|
||||
_lower = 0;
|
||||
_upper = 1;
|
||||
_mid = 0.5;
|
||||
|
||||
_dir = _source vectorFromTo _destination;
|
||||
|
||||
while {(_upper - _lower) * _distance > _accuracy} do {
|
||||
_mid = _lower + (_upper - _lower) / 2;
|
||||
|
||||
_intersection = terrainIntersectASL [_source, _source vectorAdd (_dir vectorMultiply (_mid * _distance))];
|
||||
|
||||
if (_intersection) then {
|
||||
_upper = _mid;
|
||||
} else {
|
||||
_lower = _mid;
|
||||
};
|
||||
};
|
||||
|
||||
_mid = _lower + (_upper - _lower) / 2;
|
||||
_result = [true, _source vectorAdd (_dir vectorMultiply (_mid * _distance))];
|
||||
};
|
||||
|
||||
_result
|
28
addons/common/functions/fnc_getNumberMagazinesIn.sqf
Normal file
28
addons/common/functions/fnc_getNumberMagazinesIn.sqf
Normal file
@ -0,0 +1,28 @@
|
||||
/**
|
||||
* fn_getNumberMagazinesIn.sqf
|
||||
* @Descr:
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: []
|
||||
* @Return:
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit","_magazine"];
|
||||
_unit = _this select 0;
|
||||
_magazine = _this select 1;
|
||||
|
||||
_return = 0;
|
||||
if (_unit isKindOf "CAManBase") then {
|
||||
_return = {_x == _magazine} count magazines _unit;
|
||||
} else {
|
||||
{
|
||||
_return = _return + {_x == _magazine} count magazines _x;
|
||||
}foreach (crew _unit);
|
||||
|
||||
_return = _return + ({_x == _magazine} count getMagazineCargo _unit);
|
||||
};
|
||||
|
||||
_return
|
29
addons/common/functions/fnc_getUnconsciousCondition.sqf
Normal file
29
addons/common/functions/fnc_getUnconsciousCondition.sqf
Normal file
@ -0,0 +1,29 @@
|
||||
/**
|
||||
* fn_getUnconsciousCondition.sqf
|
||||
* @Descr: get whatever or not a unit should be or stay unconscious
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: [unit OBJECT]
|
||||
* @Return: BOOL True when the unit should be unconscious
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit","_return"];
|
||||
_unit = _this select 0;
|
||||
|
||||
if (isnil QGVAR(unconsciousConditions_F)) then {
|
||||
GVAR(unconsciousConditions_F) = [];
|
||||
};
|
||||
|
||||
_return = false;
|
||||
{
|
||||
if (typeName _x == typeName {}) then {
|
||||
if (([_unit] call _x)) then {
|
||||
_return = true;
|
||||
};
|
||||
};
|
||||
if (_return) exitwith{};
|
||||
}foreach GVAR(unconsciousConditions_F);
|
||||
_return
|
11
addons/common/functions/fnc_getVersion.sqf
Normal file
11
addons/common/functions/fnc_getVersion.sqf
Normal file
@ -0,0 +1,11 @@
|
||||
/**
|
||||
* fn_getVersion.sqf
|
||||
* @Descr: Get the version number of the current ACE Build
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: []
|
||||
* @Return: STRING String containing the version
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
getText (configFile >> "cfgPatches" >> "ACE_main" >> "version");
|
14
addons/common/functions/fnc_getWeaponItems_f.sqf
Normal file
14
addons/common/functions/fnc_getWeaponItems_f.sqf
Normal file
@ -0,0 +1,14 @@
|
||||
/**
|
||||
* fn_getWeaponItems_f.sqf
|
||||
* @Descr: Get the weapon items from the unit.
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: [unit OBJECT]
|
||||
* @Return:
|
||||
* @PublicAPI: false
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
private "_unit";
|
||||
_unit = _this select 0;
|
||||
|
||||
[primaryWeaponItems _unit, secondaryWeaponItems _unit, handgunItems _unit];
|
13
addons/common/functions/fnc_hasItem.sqf
Normal file
13
addons/common/functions/fnc_hasItem.sqf
Normal file
@ -0,0 +1,13 @@
|
||||
/**
|
||||
* fn_hasItem.sqf
|
||||
* @Descr: Check if unit has item
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: [unit OBJECT, item STRING (Classname of item)]
|
||||
* @Return: BOOL
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
// item classname in items unit
|
||||
((_this select 1) in items (_this select 0));
|
13
addons/common/functions/fnc_hasItem_f.sqf
Normal file
13
addons/common/functions/fnc_hasItem_f.sqf
Normal file
@ -0,0 +1,13 @@
|
||||
/**
|
||||
* fn_hasItem_f.sqf
|
||||
* @Descr: Check if a unit has item
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: [unit OBJECT, item STRING (Classname of item)]
|
||||
* @Return: BOOL True if unit has the item in it's inventory
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
call FUNC(hasItem)
|
22
addons/common/functions/fnc_hasMagazine.sqf
Normal file
22
addons/common/functions/fnc_hasMagazine.sqf
Normal file
@ -0,0 +1,22 @@
|
||||
/**
|
||||
* fn_hasMagazine.sqf
|
||||
* @Descr: Check if given unit has a magazine of given classname
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: [unit OBJECT, magazine STRING]
|
||||
* @Return: BOOL True if unith as given magazine
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit","_magazine","_return"];
|
||||
_unit = _this select 0;
|
||||
_magazine = _this select 1;
|
||||
|
||||
if (_magazine != "") then {
|
||||
_return = (_magazine in magazines _unit);
|
||||
} else {
|
||||
_return = false;
|
||||
};
|
||||
_return
|
22
addons/common/functions/fnc_inWater_f.sqf
Normal file
22
addons/common/functions/fnc_inWater_f.sqf
Normal file
@ -0,0 +1,22 @@
|
||||
/**
|
||||
* fn_inWater_f.sqf
|
||||
* @Descr: Check if unit is underwater
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: [unit OBJECT]
|
||||
* @Return: BOOL True if unit is in the water
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit","_return","_aslPos"];
|
||||
_unit = _this select 0;
|
||||
_return = false;
|
||||
if ((surfaceIsWater getPos _unit)) then {
|
||||
_aslPos = _unit modelToWorld (_unit selectionPosition "head");
|
||||
if ((_aslPos select 2) <= 0) then {
|
||||
_return = true;
|
||||
};
|
||||
};
|
||||
_return;
|
26
addons/common/functions/fnc_inheritsFrom.sqf
Normal file
26
addons/common/functions/fnc_inheritsFrom.sqf
Normal file
@ -0,0 +1,26 @@
|
||||
/**
|
||||
* fn_inheritsFrom.sqf
|
||||
* @Descr: Checks whether a given configuration name appears in the inheritance tree of a specific configuration entry.
|
||||
* @Author: Ruthberg
|
||||
*
|
||||
* @Arguments: [configEntry CONFIG, configname STRING]
|
||||
* @Return: BOOL
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_configEntry","_configMatch", "_match"];
|
||||
_configEntry = _this select 0;
|
||||
_configMatch = _this select 1;
|
||||
|
||||
if (configName _configEntry == _configMatch) exitWith { true };
|
||||
if (configName _configEntry == ",") exitWith { false };
|
||||
|
||||
_match = false;
|
||||
while {configName _configEntry != ""} do {
|
||||
if (configName _configEntry == _configMatch) exitWith { _match = true };
|
||||
_configEntry = inheritsFrom(_configEntry);
|
||||
};
|
||||
|
||||
_match
|
34
addons/common/functions/fnc_insertionSort.sqf
Normal file
34
addons/common/functions/fnc_insertionSort.sqf
Normal file
@ -0,0 +1,34 @@
|
||||
/**
|
||||
* fn_insertionSort.sqf
|
||||
* @Descr: Sorts an array of numbers
|
||||
* @Author: Ruthberg
|
||||
*
|
||||
* @Arguments: [array ARRAY, (optional) ascending BOOL]
|
||||
* @Return: sortedArray ARRAY
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
|
||||
#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;
|
||||
};
|
||||
|
||||
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];
|
||||
};
|
||||
|
||||
if (!_ascending) then {
|
||||
reverse _list;
|
||||
};
|
||||
|
||||
_list
|
13
addons/common/functions/fnc_isArrested.sqf
Normal file
13
addons/common/functions/fnc_isArrested.sqf
Normal file
@ -0,0 +1,13 @@
|
||||
/**
|
||||
* fn_isArrested.sqf
|
||||
* @Descr: Check if unit is in arrested state
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: [unit OBJECT]
|
||||
* @Return: BOOL Returns true if unit or object is in arrest state
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
((_this select 0) getvariable [QGVAR(StateArrested),false])
|
15
addons/common/functions/fnc_isAwake.sqf
Normal file
15
addons/common/functions/fnc_isAwake.sqf
Normal file
@ -0,0 +1,15 @@
|
||||
/**
|
||||
* fn_isAwake.sqf
|
||||
* @Descr: Check if unit is awake. Will be false when death or unit is unconscious.
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: [unit OBJECT]
|
||||
* @Return: BOOL True if unit is awake
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit","_return"];
|
||||
_unit = _this select 0;
|
||||
(!([_unit] call FUNC(isUnconscious))) && alive _unit && !(_unit getvariable [QGVAR(isDead),false]);
|
24
addons/common/functions/fnc_isHC.sqf
Normal file
24
addons/common/functions/fnc_isHC.sqf
Normal file
@ -0,0 +1,24 @@
|
||||
/**
|
||||
* fn_isHC.sqf
|
||||
* @Descr: Check if current locality is a headless client
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: []
|
||||
* @Return: BOOL True if locality is headless client OR is not in multiplayer
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_return"];
|
||||
|
||||
if (!isMultiplayer) then {
|
||||
_return = true;
|
||||
} else {
|
||||
if (isServer && !isDedicated) then {
|
||||
_return = true;
|
||||
} else {
|
||||
_return = !(hasInterface || isDedicated);
|
||||
};
|
||||
};
|
||||
_return
|
13
addons/common/functions/fnc_isModLoaded_f.sqf
Normal file
13
addons/common/functions/fnc_isModLoaded_f.sqf
Normal file
@ -0,0 +1,13 @@
|
||||
/**
|
||||
* fn_isModLoaded_f.sqf
|
||||
* Descr: Check in cfgPatches if modification is loaded
|
||||
* Author: Glowbal
|
||||
*
|
||||
* Arguments: [modName STRING (Classname of the mod in cfgPatches)]
|
||||
* Return: BOOL true if modification is loaded
|
||||
* PublicAPI: true
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
(isClass (configFile >> "cfgPatches" >> (_this select 0)))
|
13
addons/common/functions/fnc_isUnconscious.sqf
Normal file
13
addons/common/functions/fnc_isUnconscious.sqf
Normal file
@ -0,0 +1,13 @@
|
||||
/**
|
||||
* fn_isUnconscious.sqf
|
||||
* @Descr: Checks whatever given object is in the unconscious state
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: [unit OBJECT]
|
||||
* @Return: BOOL True when object is in unconscious state
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
((_this select 0) getvariable [QGVAR(StateUnconscious),false]);
|
36
addons/common/functions/fnc_limitMovementSpeed.sqf
Normal file
36
addons/common/functions/fnc_limitMovementSpeed.sqf
Normal file
@ -0,0 +1,36 @@
|
||||
/**
|
||||
* fn_limitMovementSpeed.sqf
|
||||
* @Descr: Limits the movement speed of a unit
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: [unit OBJECT, fallDown BOOL (Optional)]
|
||||
* @Return: void
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
_this spawn {
|
||||
private ["_unit","_carriedObj"];
|
||||
_unit = _this select 0;
|
||||
_fallDown = false;
|
||||
if (count _this > 1) then {
|
||||
_fallDown = _this select 1;
|
||||
};
|
||||
_carriedObj = [_unit] call FUNC(getCarriedObj);
|
||||
while {sleep 1;_carriedObj = [_unit] call FUNC(getCarriedObj); ((!isNull _carriedObj) && (alive _unit))} do {
|
||||
if (speed _unit > 12 && vehicle _unit == _unit) then {
|
||||
[format["Unit ran to fast (Speed: %1, is now dropping carrying obj",speed _unit],2] call FUNC(debug);
|
||||
if (_fallDown) then {
|
||||
_unit playMove "amovppnemstpsraswrfldnon";
|
||||
};
|
||||
|
||||
if (_carriedObj isKindOf "Man") then {
|
||||
hint "You can not move this fast while transporting this person.";
|
||||
} else {
|
||||
hint "You can not move this fast while carrying this object";
|
||||
};
|
||||
[_unit,ObjNull] call FUNC(carryObj);
|
||||
};
|
||||
};
|
||||
};
|
40
addons/common/functions/fnc_limitSpeed.sqf
Normal file
40
addons/common/functions/fnc_limitSpeed.sqf
Normal file
@ -0,0 +1,40 @@
|
||||
/**
|
||||
* fn_limitSpeed.sqf
|
||||
* @Descr: Limits the speed of an object
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: [vehicle OBJECT, maxSpeed NUMBER]
|
||||
* @Return: void
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
_this spawn {
|
||||
private ["_vehicle", "_maxSpeed", "_velocity"];
|
||||
|
||||
_vehicle = _this select 0;
|
||||
_maxSpeed = _this select 1;
|
||||
if ((_vehicle getvariable [QGVAR(limitSpeed_f),false])) then {
|
||||
_vehicle setvariable [QGVAR(limitSpeed_f),nil,true];
|
||||
};
|
||||
|
||||
if (_maxSpeed < 0) exitwith {};
|
||||
_vehicle setvariable [QGVAR(limitSpeed_f),true,true];
|
||||
|
||||
waitUntil {
|
||||
_speed = speed _vehicle;
|
||||
if (_speed > _maxSpeed) then {
|
||||
_velocity = velocity _vehicle;
|
||||
_x = _velocity select 0;
|
||||
_y = _velocity select 1;
|
||||
_z = _velocity select 2;
|
||||
|
||||
_diff = _speed - _maxSpeed;
|
||||
_percentage = (_speed / 100) * _diff;
|
||||
_newVelocity = [_x - (_x * _percentage), _y - (_y * _percentage), _z - (_z * _percentage)];
|
||||
_vehicle setVelocity _newVelocity;
|
||||
};
|
||||
!(_vehicle getvariable [QGVAR(limitSpeed_f),false])
|
||||
};
|
||||
};
|
39
addons/common/functions/fnc_loadPersonLocal_f.sqf
Normal file
39
addons/common/functions/fnc_loadPersonLocal_f.sqf
Normal file
@ -0,0 +1,39 @@
|
||||
/**
|
||||
* fn_loadPersonLocal_f.sqf
|
||||
* @Descr: Load a person, local
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: [unit OBJECT, vehicle OBJECT, caller OBJECT]
|
||||
* @Return: void
|
||||
* @PublicAPI: false
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit","_vehicle","_caller","_handle","_loaded"];
|
||||
_unit = [_this, 0, ObjNull,[ObjNull]] call BIS_fnc_Param;
|
||||
_vehicle = [_this, 1, ObjNull,[ObjNull]] call BIS_fnc_Param;
|
||||
_caller = [_this, 2, ObjNull,[ObjNull]] call BIS_fnc_Param;
|
||||
|
||||
if (!alive _unit) then {
|
||||
_unit = [_unit,_caller] call FUNC(makeCopyOfBody_F);
|
||||
};
|
||||
|
||||
_unit moveInCargo _vehicle;
|
||||
_loaded = _vehicle getvariable [QGVAR(loaded_persons_F),[]];
|
||||
_loaded pushback _unit;
|
||||
_vehicle setvariable [QGVAR(loaded_persons_F),_loaded,true];
|
||||
if (!([_unit] call FUNC(isAwake))) then {
|
||||
_handle = [_unit,_vehicle] spawn {
|
||||
private ["_unit","_vehicle"];
|
||||
_unit = _this select 0;
|
||||
_vehicle = _this select 1;
|
||||
waituntil {vehicle _unit == _vehicle};
|
||||
sleep 0.5;
|
||||
[_unit,([_unit] call FUNC(getDeathAnim))] call FUNC(broadcastAnim);
|
||||
};
|
||||
} else {
|
||||
if ([_unit] call FUNC(isArrested)) then {
|
||||
|
||||
};
|
||||
};
|
42
addons/common/functions/fnc_loadPerson_f.sqf
Normal file
42
addons/common/functions/fnc_loadPerson_f.sqf
Normal file
@ -0,0 +1,42 @@
|
||||
/**
|
||||
* fn_loadPerson_f.sqf
|
||||
* @Descr: Loads a specified unit into any nearby vehicle
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: [caller OBJECT, unitToBeLoaded OBJECT]
|
||||
* @Return: OBJECT Returns the vehicle that the unitToBeloaded has been loaded in. Returns ObjNull if function failed
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
#define GROUP_SWITCH_ID QUOTE(FUNC(loadPerson_F))
|
||||
|
||||
private ["_caller", "_unit","_vehicle", "_loadcar", "_loadhelicopter", "_loadtank"];
|
||||
_caller = [_this, 0, ObjNull,[ObjNull]] call BIS_fnc_Param;
|
||||
_unit = [_this, 1, ObjNull,[ObjNull]] call BIS_fnc_Param;
|
||||
_vehicle = ObjNull;
|
||||
|
||||
if (!([_caller] call FUNC(canInteract)) || {_caller == _unit}) exitwith {_vehicle};
|
||||
|
||||
_loadcar = nearestObject [_unit, "car"];
|
||||
if (_unit distance _loadcar <= 10) then {
|
||||
_vehicle = _loadcar;
|
||||
} else {
|
||||
_loadhelicopter = nearestObject [_unit, "air"];
|
||||
if (_unit distance _loadhelicopter <= 10) then {
|
||||
_vehicle = _loadhelicopter;
|
||||
} else {
|
||||
_loadtank = nearestObject [_unit, "tank"];
|
||||
if (_unit distance _loadtank <= 10) then {
|
||||
_vehicle = _loadtank;
|
||||
};
|
||||
};
|
||||
};
|
||||
if (!isNull _vehicle) then {
|
||||
[_unit, true, GROUP_SWITCH_ID, side group _caller] call FUNC(switchToGroupSide_f);
|
||||
[_caller,objNull] call FUNC(carryObj);
|
||||
[_unit,objNull] call FUNC(carryObj);
|
||||
[[_unit, _vehicle,_caller], QUOTE(FUNC(loadPersonLocal_F)), _unit, false] call EFUNC(common,execRemoteFnc);
|
||||
};
|
||||
_vehicle
|
26
addons/common/functions/fnc_localAnim.sqf
Normal file
26
addons/common/functions/fnc_localAnim.sqf
Normal file
@ -0,0 +1,26 @@
|
||||
/**
|
||||
* fn_localAnim.sqf
|
||||
* @Descr: Play an animation on a local machine using playMoveNow
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: [unit OBJECT, animation STRING]
|
||||
* @Return: void
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit","_anim","_persistent"];
|
||||
_unit = [_this, 0, ObjNull,[ObjNull]] call BIS_fnc_Param;
|
||||
_anim = [_this, 1, "",[""]] call BIS_fnc_Param;
|
||||
|
||||
if (!local _unit) then {
|
||||
if (count _this >2) then {
|
||||
_persistent = [_this, 2, false, [false]] call BIS_fnc_Param;
|
||||
[[_unit,_anim], QUOTE(FUNC(playMoveNow)), _unit, _persistent] call EFUNC(common,execRemoteFnc);
|
||||
} else {
|
||||
[[_unit,_anim], QUOTE(FUNC(playMoveNow)), _unit, false] call EFUNC(common,execRemoteFnc);
|
||||
};
|
||||
} else {
|
||||
[_unit,_anim] call FUNC(playMoveNow);
|
||||
};
|
75
addons/common/functions/fnc_makeCopyOfBody_f.sqf
Normal file
75
addons/common/functions/fnc_makeCopyOfBody_f.sqf
Normal file
@ -0,0 +1,75 @@
|
||||
/**
|
||||
* fn_makeCopyOfBody_f.sqf
|
||||
* @Descr: Makes a copy of a dead body. For handling dead bodies for actions such as load and carry.
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: [oldBody OBJECT, caller OBJECT]
|
||||
* @Return: newUnit OBJECT Returns the copy of the unit. If no copy could be made, returns the oldBody
|
||||
* @PublicAPI: false
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_oldBody","_newUnit","_class","_group","_position","_side","_allVariables"];
|
||||
_oldBody = _this select 0;
|
||||
_caller = _this select 1;
|
||||
|
||||
if (alive _oldBody) exitwith {_oldBody}; // we only want to do this for dead bodies
|
||||
_name = _oldBody getvariable [QGVAR(name),"unknown"];
|
||||
_class = typeof _oldBody;
|
||||
_side = side _caller;
|
||||
_group = createGroup _side;
|
||||
_position = getPos _oldBody;
|
||||
|
||||
_newUnit = _group createUnit [typeof _oldBody, _position, [], 0, "NONE"];
|
||||
|
||||
_allVariables = [_oldBody] call FUNC(getAllDefinedSetVariables);
|
||||
// [NAME (STRING), TYPENAME (STRING), VALUE (ANY), DEFAULT GLOBAL (BOOLEAN)]
|
||||
{
|
||||
[_newUnit,_x select 0, _x select 2] call FUNC(setDefinedVariable);
|
||||
}foreach _allVariables;
|
||||
_newUnit setVariable [QGVAR(name),_name,true];
|
||||
|
||||
_newUnit disableAI "TARGET";
|
||||
_newUnit disableAI "AUTOTARGET";
|
||||
_newUnit disableAI "MOVE";
|
||||
_newUnit disableAI "ANIM";
|
||||
_newUnit disableAI "FSM";
|
||||
_newUnit setvariable [QGVAR(isDead),true,true];
|
||||
|
||||
removeallweapons _newUnit;
|
||||
removeallassigneditems _newUnit;
|
||||
removeUniform _newUnit;
|
||||
removeHeadgear _newUnit;
|
||||
removeBackpack _newUnit;
|
||||
removeVest _newUnit;
|
||||
|
||||
_newUnit addHeadgear (headgear _oldBody);
|
||||
_newUnit addBackpack (backpack _oldBody);
|
||||
clearItemCargoGlobal (backpackContainer _newUnit);
|
||||
clearMagazineCargoGlobal (backpackContainer _newUnit);
|
||||
clearWeaponCargoGlobal (backpackContainer _newUnit);
|
||||
|
||||
_newUnit addVest (vest _oldBody);
|
||||
clearItemCargoGlobal (backpackContainer _newUnit);
|
||||
clearMagazineCargoGlobal (backpackContainer _newUnit);
|
||||
clearWeaponCargoGlobal (backpackContainer _newUnit);
|
||||
|
||||
_newUnit addUniform (uniform _oldBody);
|
||||
clearItemCargoGlobal (backpackContainer _newUnit);
|
||||
clearMagazineCargoGlobal (backpackContainer _newUnit);
|
||||
clearWeaponCargoGlobal (backpackContainer _newUnit);
|
||||
|
||||
{_newUnit addMagazine _x} count (magazines _oldBody);
|
||||
{_newUnit addWeapon _x} count (weapons _oldBody);
|
||||
{_newUnit addItem _x} count (items _oldBody);
|
||||
|
||||
_newUnit selectWeapon (primaryWeapon _newUnit);
|
||||
//_newUnit playMoveNow ([_newUnit] call FUNC(getDeathAnim));
|
||||
|
||||
deleteVehicle _oldBody;
|
||||
|
||||
// TODO sometimes the old body does not get cleaned up properly. Look into garbage collection.
|
||||
|
||||
_newUnit setDamage 0.9;
|
||||
_newUnit
|
24
addons/common/functions/fnc_moduleBasicRevive.sqf
Normal file
24
addons/common/functions/fnc_moduleBasicRevive.sqf
Normal file
@ -0,0 +1,24 @@
|
||||
/**
|
||||
* fn_moduleEnableBasicRevive.sqf
|
||||
* @Descr: N/A
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: []
|
||||
* @Return:
|
||||
* @PublicAPI: false
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_logic"];
|
||||
_logic = _this select 0;
|
||||
|
||||
GVAR(Module) = true;
|
||||
|
||||
[_logic, QGVAR(ENABLE_REVIVE_F), "enableFor" ] call EFUNC(common,readNumericParameterFromModule);
|
||||
[_logic, QGVAR(REVIVE_TIMER_MAX_F), "timer" ] call EFUNC(common,readNumericParameterFromModule);
|
||||
[_logic, QGVAR(REVIVE_NUMBER_MAX_F), "amountOf" ] call EFUNC(common,readNumericParameterFromModule);
|
||||
|
||||
[
|
||||
{(((_this select 0) getvariable[QGVAR(ENABLE_REVIVE_SETDEAD_F),0]) > 0)}
|
||||
] call FUNC(registerUnconsciousCondition);
|
32
addons/common/functions/fnc_moveToTempGroup.sqf
Normal file
32
addons/common/functions/fnc_moveToTempGroup.sqf
Normal file
@ -0,0 +1,32 @@
|
||||
/**
|
||||
* fn_moveToTempGroup_f.sqf
|
||||
* Moves a unit into a temporarly group and stores its original group to allow rejoining.
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: [unit OBJECT, moveToTempGroup BOOL]
|
||||
* @Return: void
|
||||
* @PublicAPI: false
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit","_moveTo","_previousGroup","_newGroup", "_currentGroup", "_switchToGroup"];
|
||||
_unit = [_this, 0,ObjNull,[ObjNull]] call BIS_fnc_Param;
|
||||
_moveTo = [_this, 1,false,[false]] call BIS_fnc_Param;
|
||||
|
||||
if (_moveTo) then {
|
||||
_previousGroup = group _unit;
|
||||
_newGroup = createGroup (side _previousGroup);
|
||||
[_unit] joinSilent _newGroup;
|
||||
_unit setvariable [QGVAR(previousGroup_F),_previousGroup];
|
||||
} else {
|
||||
_previousGroup = _unit getvariable QGVAR(previousGroup_F);
|
||||
if (!isnil "_previousGroup") then {
|
||||
_currentGroup = group _unit;
|
||||
_unit setvariable [QGVAR(previousGroup_F),nil];
|
||||
[_unit] joinSilent _previousGroup;
|
||||
if (count units _currentGroup == 0) then {
|
||||
deleteGroup _currentGroup;
|
||||
};
|
||||
};
|
||||
};
|
38
addons/common/functions/fnc_onAnswerRequest.sqf
Normal file
38
addons/common/functions/fnc_onAnswerRequest.sqf
Normal file
@ -0,0 +1,38 @@
|
||||
/**
|
||||
* fn_onAnswerRequest.sqf
|
||||
* @Descr: N/A
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: []
|
||||
* @Return:
|
||||
* @PublicAPI: false
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit","_requestID", "_id", "_accepted", "_info", "_callBack", "_caller", "_replyParams", "_requestMessage", "_target"];
|
||||
_unit = _this select 0;
|
||||
_id = _this select 1;
|
||||
_accepted = _this select 2;
|
||||
|
||||
_info = _unit getvariable _id;
|
||||
if (!isnil "_info") then {
|
||||
_caller = _info select 0;
|
||||
_target = _info select 1;
|
||||
_requestID = _info select 2;
|
||||
_requestMessage = _info select 3;
|
||||
_callBack = _info select 4;
|
||||
_replyParams = [_info, _accepted];
|
||||
[_replyParams, QUOTE(FUNC(requestCallback)), _caller, false] call FUNC(execRemoteFnc);
|
||||
_unit setvariable [_id, nil];
|
||||
};
|
||||
|
||||
GVAR(RECIEVE_REQUEST_ID_KEY_BINDING) = nil;
|
||||
|
||||
if (!isnil QGVAR(RECIEVE_REQUEST_ADD_ACTION_ACCEPT)) then {
|
||||
_unit removeAction GVAR(RECIEVE_REQUEST_ADD_ACTION_ACCEPT);
|
||||
GVAR(RECIEVE_REQUEST_ADD_ACTION_ACCEPT) = nil;
|
||||
};
|
||||
if (!isnil QGVAR(RECIEVE_REQUEST_ADD_ACTION_DECLINE)) then {
|
||||
_unit removeAction GVAR(RECIEVE_REQUEST_ADD_ACTION_DECLINE);
|
||||
GVAR(RECIEVE_REQUEST_ADD_ACTION_DECLINE) = nil;
|
||||
};
|
16
addons/common/functions/fnc_playMoveNow.sqf
Normal file
16
addons/common/functions/fnc_playMoveNow.sqf
Normal file
@ -0,0 +1,16 @@
|
||||
/**
|
||||
* fn_playMoveNow.sqf
|
||||
* @Descr: N/A
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: []
|
||||
* @Return:
|
||||
* @PublicAPI: false
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit", "_anim"];
|
||||
_unit = [_this,0,objNull,[objNull]] call BIS_fnc_Param;
|
||||
_anim = [_this,1,"",[""]] call BIS_fnc_Param;
|
||||
_unit playMoveNow _anim;
|
69
addons/common/functions/fnc_receiveRequest.sqf
Normal file
69
addons/common/functions/fnc_receiveRequest.sqf
Normal file
@ -0,0 +1,69 @@
|
||||
/**
|
||||
* fn_recieveRequest.sqf
|
||||
* @Descr: N/A
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: []
|
||||
* @Return:
|
||||
* @PublicAPI: false
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_caller", "_target", "_requestID", "_requestMessage", "_callBack"];
|
||||
_caller = _this select 0;
|
||||
_target = _this select 1;
|
||||
_requestID = _this select 2;
|
||||
_requestMessage = _this select 3;
|
||||
_callBack = _this select 4;
|
||||
|
||||
_requestID = ("ace_recieveRequest_f_id_"+_requestID);
|
||||
|
||||
_target setvariable [_requestID, _this];
|
||||
|
||||
if (isLocalized _requestMessage) then {
|
||||
_requestMessage = format[localize _requestMessage,[_caller] call FUNC(getName)];
|
||||
} else {
|
||||
_requestMessage = format[_requestMessage,[_caller] call FUNC(getName)];
|
||||
};
|
||||
|
||||
hint format["%1",_requestMessage];
|
||||
if !(isnil QGVAR(RECIEVE_REQUEST_TIME_OUT_SCRIPT)) then {
|
||||
terminate GVAR(RECIEVE_REQUEST_TIME_OUT_SCRIPT);
|
||||
};
|
||||
|
||||
if (!isnil QGVAR(RECIEVE_REQUEST_ADD_ACTION_ACCEPT)) then {
|
||||
_target removeAction GVAR(RECIEVE_REQUEST_ADD_ACTION_ACCEPT);
|
||||
GVAR(RECIEVE_REQUEST_ADD_ACTION_ACCEPT) = nil;
|
||||
};
|
||||
if (!isnil QGVAR(RECIEVE_REQUEST_ADD_ACTION_DECLINE)) then {
|
||||
_target removeAction GVAR(RECIEVE_REQUEST_ADD_ACTION_DECLINE);
|
||||
GVAR(RECIEVE_REQUEST_ADD_ACTION_DECLINE) = nil;
|
||||
};
|
||||
|
||||
GVAR(RECIEVE_REQUEST_ADD_ACTION_ACCEPT) = _target addAction ["Accept", compile format["[player,'%1', true] call FUNC(onAnswerRequest);", _requestID]];
|
||||
GVAR(RECIEVE_REQUEST_ADD_ACTION_DECLINE) = _target addAction ["Decline", compile format["[player,'%1', false] call FUNC(onAnswerRequest);", _requestID]];
|
||||
|
||||
GVAR(RECIEVE_REQUEST_ID_KEY_BINDING) = _requestID;
|
||||
|
||||
GVAR(RECIEVE_REQUEST_TIME_OUT_SCRIPT) = [time, _target, _requestID] spawn {
|
||||
_t = (_this select 0) + 40;
|
||||
_target = _this select 1;
|
||||
_requestID = _this select 2;
|
||||
_id = _target getvariable _requestID;
|
||||
waituntil {
|
||||
_id = _target getvariable _requestID;
|
||||
|
||||
(time > _t || isnil "_id")};
|
||||
_target setvariable [_requestID, nil];
|
||||
GVAR(RECIEVE_REQUEST_ID_KEY_BINDING) = nil;
|
||||
if (!isnil QGVAR(RECIEVE_REQUEST_ADD_ACTION_ACCEPT)) then {
|
||||
_target removeAction GVAR(RECIEVE_REQUEST_ADD_ACTION_ACCEPT);
|
||||
GVAR(RECIEVE_REQUEST_ADD_ACTION_ACCEPT) = nil;
|
||||
};
|
||||
if (!isnil QGVAR(RECIEVE_REQUEST_ADD_ACTION_DECLINE)) then {
|
||||
_target removeAction GVAR(RECIEVE_REQUEST_ADD_ACTION_DECLINE);
|
||||
GVAR(RECIEVE_REQUEST_ADD_ACTION_DECLINE) = nil;
|
||||
};
|
||||
|
||||
};
|
22
addons/common/functions/fnc_registerUnconsciousCondition.sqf
Normal file
22
addons/common/functions/fnc_registerUnconsciousCondition.sqf
Normal file
@ -0,0 +1,22 @@
|
||||
/**
|
||||
* fn_registerUnconsciousCondition.sqf
|
||||
* @Descr: Register new condition for the unconscious state. Conditions are not actively checked for units unless unit is in unconscious state.
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: [code CODE]
|
||||
* @Return: void
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
if (isnil QGVAR(unconsciousConditions_F)) then {
|
||||
GVAR(unconsciousConditions_F) = [];
|
||||
};
|
||||
if (typeName _this == typeName []) then {
|
||||
{
|
||||
if (typeName _x == typeName {}) then {
|
||||
GVAR(unconsciousConditions_F) pushback _x;
|
||||
};
|
||||
}foreach _this;
|
||||
};
|
25
addons/common/functions/fnc_releaseMutex.sqf
Normal file
25
addons/common/functions/fnc_releaseMutex.sqf
Normal file
@ -0,0 +1,25 @@
|
||||
/**
|
||||
* fn_releaseMutex.sqf
|
||||
* @Descr: Releases or unlocks a mutex.
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: [mutexName STRING]
|
||||
* @Return: True if succesfully unlocked or mutex was never locked.
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_mutexName","_initalStatus","_return"];
|
||||
_mutexName = [_this, 0, "", [""]] call BIS_fnc_param;
|
||||
|
||||
_return = false;
|
||||
if (_mutexName != "")then {
|
||||
private["_mutexCombinedName"];
|
||||
_mutexCombinedName = format["ACE_FRAMEWORK_MUTEX_%1",_mutexName];
|
||||
if !(isnil _mutexCombinedName) then {
|
||||
missionNamespace setvariable [_mutexCombinedName, 0];
|
||||
_return = true;
|
||||
};
|
||||
};
|
||||
_return
|
23
addons/common/functions/fnc_requestCallback.sqf
Normal file
23
addons/common/functions/fnc_requestCallback.sqf
Normal file
@ -0,0 +1,23 @@
|
||||
/**
|
||||
* fn_requestCallback.sqf
|
||||
* @Descr: N/A
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: []
|
||||
* @Return:
|
||||
* @PublicAPI: false
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_info", "_accepted", "_caller", "_target", "_requestID", "_requestMessage", "_callBack"];
|
||||
_info = _this select 0;
|
||||
_accepted = _this select 1;
|
||||
|
||||
_caller = _info select 0;
|
||||
_target = _info select 1;
|
||||
_requestID = _info select 2;
|
||||
_requestMessage = _info select 3;
|
||||
_callBack = _info select 4;
|
||||
|
||||
[_caller, _target, _accepted] call compile _callBack;
|
53
addons/common/functions/fnc_resetAllDefaults_f.sqf
Normal file
53
addons/common/functions/fnc_resetAllDefaults_f.sqf
Normal file
@ -0,0 +1,53 @@
|
||||
/**
|
||||
* fn_resetAllDefaults_f.sqf
|
||||
* @Descr: reset all variables that have been defined
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: []
|
||||
* @Return:
|
||||
* @PublicAPI: false
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit","_oldUnit","_sets"];
|
||||
_unit = [_this, 0, objNull, [objNull]] call BIS_fnc_param;
|
||||
_oldUnit = [_this, 1, objNull, [objNull]] call BIS_fnc_param;
|
||||
|
||||
//_unit setvariable[QGVAR(unconscious_non_captive_f),nil];
|
||||
if (missionNamespace getvariable [QGVAR(unconscious_non_captive_f),false]) then {
|
||||
_unit setCaptive false;
|
||||
missionNamespace setvariable[QGVAR(unconscious_non_captive_f),nil];
|
||||
[format["Detected unit as a non captive but in captive state. RESETTING"]] call FUNC(debug);
|
||||
} else {
|
||||
[format["didn't trigger but unit is: %1 - %2", captive _unit, (missionNamespace getvariable [QGVAR(unconscious_non_captive_f),false])]] call FUNC(debug);
|
||||
};
|
||||
|
||||
_unit setvariable [QGVAR(isDead),nil,true];
|
||||
_unit setvariable [QGVAR(stateUnconscious), nil, true];
|
||||
|
||||
if (isPlayer _unit) then {
|
||||
[true] call FUNC(setVolume_f);
|
||||
[false] call FUNC(disableKeyInput_f);
|
||||
[false] call FUNC(effectBlackOut);
|
||||
[player, -1] call FUNC(limitSpeed);
|
||||
if (isnil QGVAR(DISABLE_USER_INPUT_COLLECTION_F)) then {
|
||||
GVAR(DISABLE_USER_INPUT_COLLECTION_F) = [];
|
||||
};
|
||||
{
|
||||
[_X, false] call FUNC(disableUserInput_f);
|
||||
}foreach GVAR(DISABLE_USER_INPUT_COLLECTION_F);
|
||||
};
|
||||
_sets = [_unit] call FUNC(getAllDefinedSetVariables);
|
||||
[format["defaults for %1 : %2",_unit,_sets]] call FUNC(debug);
|
||||
if ((count _sets) > 0) then {
|
||||
{
|
||||
if (!(_x select 4)) then {
|
||||
_unit setvariable [(_x select 0),nil,_x select 3];
|
||||
[format["RESETTING: %1",[(_x select 0),_unit, _x select 1, (_unit getvariable (_x select 0))]]] call FUNC(debug);
|
||||
};
|
||||
}foreach _sets;
|
||||
} else {
|
||||
["No defaults have been set"] call FUNC(debug);
|
||||
};
|
||||
[[_unit],"resetToDefaults"] call FUNC(customEventHandler_F);
|
5
addons/common/functions/fnc_revealObject_f.sqf
Normal file
5
addons/common/functions/fnc_revealObject_f.sqf
Normal file
@ -0,0 +1,5 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
if (hasInterface) then {
|
||||
player reveal (_this select 0);
|
||||
};
|
48
addons/common/functions/fnc_sendDisplayInformationTo.sqf
Normal file
48
addons/common/functions/fnc_sendDisplayInformationTo.sqf
Normal file
@ -0,0 +1,48 @@
|
||||
/**
|
||||
* fn_sendDisplayInformationTo.sqf
|
||||
* @Descr: Sends a display information hint to a receiver
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: [receiver OBJECT, title STRING, content ARRAY (An array with strings), type NUMBER (Optional)]
|
||||
* @Return: void
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_reciever","_title","_content","_type", "_parameters", "_localizationArray"];
|
||||
_reciever = [_this, 0, ObjNull,[ObjNull]] call BIS_fnc_Param;
|
||||
_title = [_this, 1, "",[""]] call BIS_fnc_Param;
|
||||
_content = [_this, 2, [""],[[""]]] call BIS_fnc_Param;
|
||||
_type = [_this, 3, 0,[0]] call BIS_fnc_Param;
|
||||
_parameters = [_this, 4, [], [[]]] call BIS_fnc_Param;
|
||||
|
||||
if (isPlayer _reciever) then {
|
||||
if (!local _reciever) then {
|
||||
[_this, QUOTE(FUNC(sendDisplayInformationTo)), _reciever, false] call EFUNC(common,execRemoteFnc);
|
||||
} else {
|
||||
|
||||
if (isLocalized _title) then {
|
||||
_title = localize _title;
|
||||
};
|
||||
_localizationArray = [_title];
|
||||
{
|
||||
_localizationArray pushback _x;
|
||||
}foreach _parameters;
|
||||
_title = format _localizationArray;
|
||||
|
||||
{
|
||||
if (isLocalized _x) then {
|
||||
_localizationArray = [localize _x];
|
||||
{
|
||||
_localizationArray pushback _x;
|
||||
}foreach _parameters;
|
||||
|
||||
_content set [_foreachIndex, format _localizationArray];
|
||||
};
|
||||
|
||||
}foreach _content;
|
||||
|
||||
[_title,_content,_type] call EFUNC(gui,displayInformation);
|
||||
};
|
||||
};
|
48
addons/common/functions/fnc_sendDisplayMessageTo.sqf
Normal file
48
addons/common/functions/fnc_sendDisplayMessageTo.sqf
Normal file
@ -0,0 +1,48 @@
|
||||
/**
|
||||
* fn_sendDisplayMessageTo.sqf
|
||||
* @Descr: Displays a message on locality of receiver
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: [receiver OBJECT, title STRING, content STRING, type NUMBER (Optional)]
|
||||
* @Return: void
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_reciever","_title","_content","_type", "_parameters", "_localizationArray"];
|
||||
_reciever = [_this, 0, ObjNull,[ObjNull]] call BIS_fnc_Param;
|
||||
_title = [_this, 1, "",[""]] call BIS_fnc_Param;
|
||||
_content = [_this, 2, "",[""]] call BIS_fnc_Param;
|
||||
_type = [_this, 3, 0,[0]] call BIS_fnc_Param;
|
||||
_parameters = [_this, 4, [], [[]]] call BIS_fnc_Param;
|
||||
|
||||
[_this] call FUNC(debug);
|
||||
|
||||
if (isPlayer _reciever) then {
|
||||
if (!local _reciever) then {
|
||||
[_this, QUOTE(FUNC(sendDisplayMessageTo)), _reciever, false] call EFUNC(common,execRemoteFnc);
|
||||
} else {
|
||||
|
||||
if (isLocalized _title) then {
|
||||
_title = localize _title;
|
||||
};
|
||||
if (isLocalized _content) then {
|
||||
_content = localize _content;
|
||||
};
|
||||
|
||||
_localizationArray = [_title];
|
||||
{
|
||||
_localizationArray pushback _x;
|
||||
}foreach _parameters;
|
||||
_title = format _localizationArray;
|
||||
|
||||
_localizationArray = [_content];
|
||||
{
|
||||
_localizationArray pushback _x;
|
||||
}foreach _parameters;
|
||||
_content = format _localizationArray;
|
||||
|
||||
[_title,_content,_type] call EFUNC(gui,displayMessage);
|
||||
};
|
||||
};
|
24
addons/common/functions/fnc_sendHintTo.sqf
Normal file
24
addons/common/functions/fnc_sendHintTo.sqf
Normal file
@ -0,0 +1,24 @@
|
||||
/**
|
||||
* fn_sendHintTo.sqf
|
||||
* @Descr: Sends a hint to player unit across network
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: [reciever OBJECT, message STRING]
|
||||
* @Return: void
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_reciever","_message"];
|
||||
_reciever = _this select 0;
|
||||
_message = _this select 1;
|
||||
//[_reciever,_message] call cms_fnc_sendChatMessageTo;
|
||||
|
||||
if (isPlayer _reciever) then {
|
||||
if (!local _reciever) then {
|
||||
[_this, QUOTE(FUNC(sendHintTo)), _reciever, false] spawn EFUNC(common,execRemoteFnc);
|
||||
} else {
|
||||
hintsilent format ["%1",_message];
|
||||
};
|
||||
};
|
24
addons/common/functions/fnc_sendMessageTo.sqf
Normal file
24
addons/common/functions/fnc_sendMessageTo.sqf
Normal file
@ -0,0 +1,24 @@
|
||||
/**
|
||||
* fn_sendMessageTo.sqf
|
||||
* @Descr: Sends a chat message to player unit across the network
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: [reciever OBJECT, message STRING]
|
||||
* @Return: void
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_reciever","_message"];
|
||||
_reciever = _this select 0;
|
||||
_message = _this select 1;
|
||||
|
||||
|
||||
if (isPlayer _reciever) then {
|
||||
if (!local _reciever) then {
|
||||
[_this, QUOTE(FUNC(sendMessageTo)), _reciever, false] spawn EFUNC(common,execRemoteFnc);
|
||||
} else {
|
||||
GVAR(LOGIC_OBJECT) globalChat format ["%1",_message];
|
||||
};
|
||||
};
|
26
addons/common/functions/fnc_sendRequest_f.sqf
Normal file
26
addons/common/functions/fnc_sendRequest_f.sqf
Normal file
@ -0,0 +1,26 @@
|
||||
/**
|
||||
* fn_sendRequest_f.sqf
|
||||
* @Descr: Send a request to an unit and execute code based upon results.
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: [caller OBJECT, target OBJECT, requestID STRING, requestMessage STRING (Will be localized for other target object), callback CODE (Code called upon accept or decline.)]
|
||||
* @Return: void
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_caller", "_target", "_requestMessage", "_requestID", "_callBack"];
|
||||
_caller = _this select 0;
|
||||
_target = _this select 1;
|
||||
_requestID = _this select 2;
|
||||
_requestMessage = _this select 3;
|
||||
_callBack = _this select 4;
|
||||
|
||||
if (isPlayer _target) then {
|
||||
// Pass request on to target locality for player accept/decline.
|
||||
[[_caller, _target, _requestID, _requestMessage, _callBack], QUOTE(FUNC(receiveRequest)), _target, false] spawn EFUNC(common,execRemoteFnc);
|
||||
} else {
|
||||
// accept it, since it's an AI.
|
||||
[_caller, _target, true] spawn compile _callBack;
|
||||
};
|
45
addons/common/functions/fnc_setArrestState.sqf
Normal file
45
addons/common/functions/fnc_setArrestState.sqf
Normal file
@ -0,0 +1,45 @@
|
||||
/**
|
||||
* fn_setArrestState.sqf
|
||||
* @Descr: Set a unit in arrest state
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: [unitToBeArrested OBJECT, setArrested BOOL]
|
||||
* @Return: void
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit","_setArrest"];
|
||||
_unit = [_this, 0, objNull, [objNull]] call BIS_fnc_Param;
|
||||
_setArrest = [_this, 1, false, [false]] call BIS_fnc_Param;
|
||||
|
||||
if (_setArrest) then {
|
||||
[_unit, QGVAR(StateArrested), true] call FUNC(setDefinedVariable);
|
||||
|
||||
if ([_unit] call FUNC(isAwake)) then {
|
||||
if (vehicle _unit == _unit) then {
|
||||
[_unit,"UnaErcPoslechVelitele2",true] call FUNC(broadcastAnim);
|
||||
};
|
||||
};
|
||||
if (IsPlayer _unit) then {
|
||||
[["arrested", true],QUOTE(FUNC(disableUserInput_f)),_unit,false] call EFUNC(common,execRemoteFnc);
|
||||
};
|
||||
_unit disableAI "Move";
|
||||
_unit disableAI "ANIM";
|
||||
} else {
|
||||
[_unit, QGVAR(StateArrested), false] call FUNC(setDefinedVariable);
|
||||
|
||||
if ([_unit] call FUNC(isAwake)) then {
|
||||
if (vehicle _unit == _unit) then {
|
||||
[_unit,"",true] call FUNC(broadcastAnim);
|
||||
};
|
||||
_unit enableAI "Move";
|
||||
_unit enableAI "ANIM";
|
||||
};
|
||||
if (IsPlayer _unit) then {
|
||||
[["arrested", false],QUOTE(FUNC(disableUserInput_f)),_unit,false] call EFUNC(common,execRemoteFnc);
|
||||
};
|
||||
};
|
||||
|
||||
[[_unit, _setArrest],"setArrestState"] call FUNC(customEventHandler_F);
|
28
addons/common/functions/fnc_setCanInteract.sqf
Normal file
28
addons/common/functions/fnc_setCanInteract.sqf
Normal file
@ -0,0 +1,28 @@
|
||||
/**
|
||||
* fn_setCanInteract.sqf
|
||||
* @Descr: N/A
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: []
|
||||
* @Return:
|
||||
* @PublicAPI: false
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit","_to","_return"];
|
||||
_unit = [_this, 0, objNull, [objNull]] call BIS_fnc_param;
|
||||
_to = _this select 1;
|
||||
_return = false;
|
||||
if (((typeName _to) == "SCALAR")) then {
|
||||
if (_to <-1) then {
|
||||
_to = -1;
|
||||
} else {
|
||||
if (_to > 1) then {
|
||||
_to = 1;
|
||||
};
|
||||
};
|
||||
_unit setvariable [QGVAR(canInteract), ([_unit] call FUNC(getCanInteract)) + _to,false];
|
||||
_return = true;
|
||||
};
|
||||
_return
|
40
addons/common/functions/fnc_setCaptiveSwitch.sqf
Normal file
40
addons/common/functions/fnc_setCaptiveSwitch.sqf
Normal file
@ -0,0 +1,40 @@
|
||||
/**
|
||||
* fn_setCaptiveSwitch.sqf
|
||||
* @Descr: Register a unit as captive for the unconscious state
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: [unit OBJECT, setCaptive BOOL]
|
||||
* @Return: BOOL True if unit is put as set captive, otherwise false
|
||||
* @PublicAPI: false
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit", "_captiveSwitch", "_setCaptive"];
|
||||
_unit = [_this, 0, objNull, [objNull]] call BIS_fnc_Param;
|
||||
_setCaptive = [_this, 1, false, [false]] call BIS_fnc_Param;
|
||||
|
||||
|
||||
_captiveSwitch = true;
|
||||
if (_setCaptive) then {
|
||||
if (captive _unit) then {
|
||||
_captiveSwitch = false;
|
||||
} else {
|
||||
if (player == _unit) then {
|
||||
missionNamespace setvariable[QGVAR(unconscious_non_captive_f),true];
|
||||
};
|
||||
_unit setCaptive true;
|
||||
[format["USED SETCAPTIVE",_unit]] call FUNC(debug);
|
||||
};
|
||||
} else {
|
||||
if (alive _unit) then {
|
||||
_unit setCaptive false;
|
||||
if (!isnil QGVAR(unconscious_non_captive_f)) then {
|
||||
missionNamespace setvariable[QGVAR(unconscious_non_captive_f),nil];
|
||||
};
|
||||
} else {
|
||||
_unit setCaptive false;
|
||||
};
|
||||
};
|
||||
|
||||
_captiveSwitch
|
21
addons/common/functions/fnc_setCarriedBy.sqf
Normal file
21
addons/common/functions/fnc_setCarriedBy.sqf
Normal file
@ -0,0 +1,21 @@
|
||||
/**
|
||||
* fn_setCarriedBy.sqf
|
||||
* @Descr: Registers an object being carried by another object
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: [unitToBeCarried OBJECT, objectCarrying OBJECT]
|
||||
* @Return: BOOL True if succesfully registered
|
||||
* @PublicAPI: false
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit","_to","_return"];
|
||||
_unit = [_this, 0, ObjNull,[ObjNull]] call BIS_fnc_Param;
|
||||
_to = [_this, 1, ObjNull,[ObjNull]] call BIS_fnc_Param;
|
||||
_return = false;
|
||||
if ((isNull ([_unit] call FUNC(getCarriedBy))) || isNull _to) then {
|
||||
_return = true;
|
||||
_unit setvariable [QGVAR(carriedBy),_to,true];
|
||||
};
|
||||
_return
|
102
addons/common/functions/fnc_setDead.sqf
Normal file
102
addons/common/functions/fnc_setDead.sqf
Normal file
@ -0,0 +1,102 @@
|
||||
/**
|
||||
* fn_setDead.sqf
|
||||
* @Descr: Kills a unit
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: [unit OBJECT]
|
||||
* @Return: void
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit"];
|
||||
_unit = _this select 0;
|
||||
_force = false;
|
||||
if (count _this >= 2) then {
|
||||
_force = _this select 1;
|
||||
};
|
||||
|
||||
if (!alive _unit) exitwith{};
|
||||
if (!local _unit) exitwith {
|
||||
[[_unit, _force], QUOTE(FUNC(setDead)), _unit, false] call BIS_fnc_MP;
|
||||
diag_log format["WARNING: ace_common_fnc_setDead triggered on non local unit %1", _unit];
|
||||
};
|
||||
if (isnil QGVAR(ENABLE_REVIVE_F)) then {
|
||||
GVAR(ENABLE_REVIVE_F) = 0;
|
||||
};
|
||||
_name = _unit getvariable QGVAR(name);
|
||||
if (isnil "_name") then {
|
||||
_unit setvariable [QGVAR(name), name _unit, true];
|
||||
};
|
||||
|
||||
if (((GVAR(ENABLE_REVIVE_F) == 1 && isPlayer _unit) || (GVAR(ENABLE_REVIVE_F) == 2)) && !_force) then {
|
||||
[format["GVAR(ENABLE_REVIVE_F) %1",_unit]] call FUNC(debug);
|
||||
_unit spawn {
|
||||
private ["_unit","_counter"];
|
||||
_unit = _this;
|
||||
_playerDead = isPlayer _unit;
|
||||
|
||||
if ((_unit getvariable[QGVAR(ENABLE_REVIVE_SETDEAD_F),0]) > 0) exitwith {
|
||||
_unit setvariable[QGVAR(ENABLE_REVIVE_SETDEAD_F),(_unit getvariable[QGVAR(ENABLE_REVIVE_SETDEAD_F),0]) + 1];
|
||||
};
|
||||
_unit setvariable[QGVAR(ENABLE_REVIVE_SETDEAD_F),1];
|
||||
[_unit] call FUNC(setUnconsciousState);
|
||||
if (isnil QGVAR(REVIVE_TIMER_F)) then {
|
||||
GVAR(REVIVE_TIMER_F) = 10;
|
||||
};
|
||||
if (isnil QGVAR(REVIVE_NUMBER_MAX_F)) then {
|
||||
GVAR(REVIVE_NUMBER_MAX_F) = -1;
|
||||
};
|
||||
waituntil {([_unit] call FUNC(isUnconscious))};
|
||||
_counter = 0;
|
||||
if (alive (vehicle _unit)) then {
|
||||
_unit setvariable [QGVAR(inReviveState), true, true];
|
||||
while {([_unit] call FUNC(isUnconscious))} do {
|
||||
_counter = _unit getvariable [QGVAR(ENABLE_REVIVE_COUNTER),_counter];
|
||||
if (_counter > GVAR(REVIVE_TIMER_F) || (((_unit getvariable[QGVAR(ENABLE_REVIVE_SETDEAD_F),0]) > GVAR(REVIVE_NUMBER_MAX_F)) && (GVAR(REVIVE_NUMBER_MAX_F) > 0))) exitwith{
|
||||
if (_counter > GVAR(REVIVE_TIMER_F)) then {
|
||||
[format["Timer ran out for %1",_unit]] call FUNC(debug);
|
||||
};
|
||||
if (((_unit getvariable[QGVAR(ENABLE_REVIVE_SETDEAD_F),0]) > GVAR(REVIVE_NUMBER_MAX_F)) && (GVAR(REVIVE_TIMER_F) > 0)) then {
|
||||
[format["amount of calls for setDead ran out for %1",_unit]] call FUNC(debug);
|
||||
};
|
||||
if (isPlayer _unit) then {
|
||||
titleText ["You died..","PLAIN DOWN"];
|
||||
};
|
||||
[format["ace_isDead %1",_unit]] call FUNC(debug);
|
||||
[_unit,QGVAR(isDead),true,true] call FUNC(setDefinedVariable);
|
||||
if (_playerDead) then {
|
||||
[_unit,QGVAR(isDeadPlayer),true,true] call FUNC(setDefinedVariable);
|
||||
};
|
||||
_unit setdamage 1;
|
||||
[[_unit, true],"killed"] call FUNC(customEventHandler_F);
|
||||
};
|
||||
sleep 1;
|
||||
_unit setvariable [QGVAR(ENABLE_REVIVE_COUNTER),_counter + 1];
|
||||
_counter = _counter + 1;
|
||||
};
|
||||
_unit setvariable [QGVAR(inReviveState), nil, true];
|
||||
[format["no longer unconscious %1",_unit]] call FUNC(debug);
|
||||
} else {
|
||||
if (isPlayer _unit) then {
|
||||
titleText ["You died..","PLAIN DOWN"];
|
||||
};
|
||||
[_unit,QGVAR(isDead),true,true] call FUNC(setDefinedVariable);
|
||||
_unit setdamage 1;
|
||||
[[_unit, false],"killed"] call FUNC(customEventHandler_F);
|
||||
};
|
||||
};
|
||||
} else {
|
||||
[format["INSTANT KILL %1",_unit]] call FUNC(debug);
|
||||
if (isPlayer _unit) then {
|
||||
titleText ["You died..","PLAIN DOWN"];
|
||||
};
|
||||
if (isPLayer _unit) then {
|
||||
[_unit,QGVAR(isDeadPlayer),true,true] call FUNC(setDefinedVariable);
|
||||
};
|
||||
_unit setdamage 1;
|
||||
[_unit,QGVAR(isDead),true,true] call FUNC(setDefinedVariable);
|
||||
|
||||
[[_unit, false],"killed"] call FUNC(customEventHandler_F);
|
||||
};
|
31
addons/common/functions/fnc_setDefinedVariable.sqf
Normal file
31
addons/common/functions/fnc_setDefinedVariable.sqf
Normal file
@ -0,0 +1,31 @@
|
||||
/**
|
||||
* fn_setVariable.sqf
|
||||
* @Descr: Setvariable value
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: [unit OBJECT, variableName STRING, value ANY]
|
||||
* @Return: void
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit","_variable","_value","_update","_global","_definedVariable","_defaultGlobal","_currentValue"];
|
||||
_unit = _this select 0;
|
||||
_variable = _this select 1;
|
||||
_value = _this select 2;
|
||||
_global = false;
|
||||
|
||||
if (count _this > 3) then {
|
||||
_global = _this select 3;
|
||||
} else {
|
||||
_definedVariable = ([_variable] call FUNC(getDefinedVariableInfo));
|
||||
if (count _definedVariable > 2) then {
|
||||
_global = _definedVariable select 2;
|
||||
};
|
||||
};
|
||||
|
||||
if (!isNil "_value") exitwith {
|
||||
_unit setvariable [_variable, _value, _global];
|
||||
};
|
||||
_unit setvariable [_variable, nil, _global];
|
55
addons/common/functions/fnc_setHearingCapability.sqf
Normal file
55
addons/common/functions/fnc_setHearingCapability.sqf
Normal file
@ -0,0 +1,55 @@
|
||||
/**
|
||||
* fn_setHearingCapability.sqf
|
||||
* @Descr: Handle set volume calls. Will use the lowest available volume setting.
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: [id STRING, settings NUMBER, add BOOL (Optional. True will add, false will remove. Default value is true)]
|
||||
* @Return: nil
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_id", "_settings", "_add", "_exists", "_map", "_lowestVolume"];
|
||||
_id = _this select 0;
|
||||
_settings = _this select 1;
|
||||
_add = true;
|
||||
if (count _this > 2) then {
|
||||
_add = _this select 2;
|
||||
};
|
||||
|
||||
_map = missionNamespace getVariable [QGVAR(setHearingCapabilityMap),[]];
|
||||
|
||||
_exists = false;
|
||||
{
|
||||
if (_id == _x select 0) exitWith {
|
||||
_exists = true;
|
||||
if (_add) then {
|
||||
_x set [1, _settings];
|
||||
} else {
|
||||
_map set [_forEachIndex, 0];
|
||||
_map = _map - [0];
|
||||
};
|
||||
};
|
||||
} forEach _map;
|
||||
|
||||
if (!_exists && _add) then {
|
||||
_map pushBack [_id, _settings];
|
||||
};
|
||||
|
||||
missionNamespace setVariable [QGVAR(setHearingCapabilityMap), _map];
|
||||
|
||||
// find lowest volume
|
||||
_lowestVolume = 1;
|
||||
{
|
||||
_lowestVolume = (_x select 1) min _lowestVolume;
|
||||
} forEach _map;
|
||||
|
||||
// in game sounds
|
||||
0 fadeSound _lowestVolume;
|
||||
0 fadeRadio _lowestVolume;
|
||||
0 fadeMusic _lowestVolume;
|
||||
|
||||
// Set Radio mod variables.
|
||||
player setVariable ["tf_globalVolume", _lowestVolume];
|
||||
player setVariable ["acre_sys_core_globalVolume", _lowestVolume];
|
28
addons/common/functions/fnc_setProne.sqf
Normal file
28
addons/common/functions/fnc_setProne.sqf
Normal file
@ -0,0 +1,28 @@
|
||||
/**
|
||||
* fn_setProne.sqf
|
||||
* @Descr: Force a unit to go prone
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: [unit OBJECT]
|
||||
* @Return: void
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
|
||||
#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);
|
||||
};
|
||||
};
|
93
addons/common/functions/fnc_setUnconsciousState.sqf
Normal file
93
addons/common/functions/fnc_setUnconsciousState.sqf
Normal file
@ -0,0 +1,93 @@
|
||||
/**
|
||||
* fn_setUnconsciousState.sqf
|
||||
* @Descr: Sets a unit in the unconscious state
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: [unit OBJECT]
|
||||
* @Return: void
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit", "_animState", "_dAnim"];
|
||||
_unit = _this select 0;
|
||||
|
||||
_dAnim = ([_unit] call FUNC(getDeathAnim));
|
||||
if !([_unit] call FUNC(canGoUnconsciousState)) exitwith{};
|
||||
if (!local _unit) exitwith {
|
||||
[[_unit], QUOTE(FUNC(setUnconsciousState)), _unit, false] spawn EFUNC(common,execRemoteFnc);
|
||||
};
|
||||
|
||||
// get rid of the object we are carrying, before we go unconscious.
|
||||
[_unit, ObjNull, [0,0,0]] call FUNC(carryObj);
|
||||
|
||||
_unit setvariable [QGVAR(StateUnconscious),true,true];
|
||||
[_unit] call FUNC(setWeaponsCorrectUnconscious);
|
||||
|
||||
_animState = animationState _unit;
|
||||
|
||||
_originalPos = unitPos _unit;
|
||||
if (isPlayer _unit) then {
|
||||
[] call FUNC(closeAllDialogs_f);
|
||||
[true] call FUNC(effectBlackOut);
|
||||
["unconscious", true] call FUNC(disableUserInput_f);
|
||||
[false] call FUNC(setVolume_f);
|
||||
} else {
|
||||
_unit setUnitPos "DOWN";
|
||||
[_unit, true] call FUNC(disableAI_F);
|
||||
};
|
||||
[_unit, true, QGVAR(StateUnconscious), side group _unit] call FUNC(switchToGroupSide_f);
|
||||
|
||||
_captiveSwitch = [_unit, true] call FUNC(setCaptiveSwitch);
|
||||
_unit setUnconscious true;
|
||||
[_unit, _dAnim] call FUNC(localAnim);
|
||||
|
||||
[_unit,_animState, _captiveSwitch, _originalPos] spawn {
|
||||
private ["_unit", "_vehicleOfUnit","_lockSwitch","_minWaitingTime", "_oldAnimation", "_captiveSwitch"];
|
||||
_unit = _this select 0;
|
||||
_oldAnimation = _this select 1;
|
||||
_captiveSwitch = _this select 2;
|
||||
_originalPos = _this select 3;
|
||||
|
||||
_minWaitingTime = (round(random(10)+5));
|
||||
_counter = time;
|
||||
while {(((time - _counter) < _minWaitingTime) && {alive _unit})} do {
|
||||
if (vehicle _unit == _unit && {animationState _unit != "deadState" && animationState _unit != "unconscious"} && {(alive _unit)} && {(isNull ([_unit] call FUNC(getCarriedBy)))}) then {
|
||||
[_unit,([_unit] call FUNC(getDeathAnim))] call FUNC(broadcastAnim);
|
||||
};
|
||||
sleep 0.1;
|
||||
};
|
||||
waituntil{(!([_unit] call FUNC(getUnconsciousCondition)) || !alive _unit)};
|
||||
[format["setUnconsciousState false - %1",_unit]] call FUNC(debug);
|
||||
sleep 0.5;
|
||||
if (_captiveSwitch) then {
|
||||
[_unit, false] call FUNC(setCaptiveSwitch);
|
||||
};
|
||||
_unit setUnconscious false;
|
||||
[_unit, false, QGVAR(StateUnconscious), side group _unit] call FUNC(switchToGroupSide_f);
|
||||
|
||||
if (isPlayer _unit) then {
|
||||
[false] call FUNC(effectBlackOut);
|
||||
[true] call FUNC(setVolume_f);
|
||||
["unconscious", false] call FUNC(disableUserInput_f);
|
||||
} else {
|
||||
[_unit, false] call FUNC(disableAI_F);
|
||||
_unit setUnitPos _originalPos; // This is not position but stance (DOWN, MIDDLE, UP)
|
||||
};
|
||||
|
||||
waituntil {!([_unit] call FUNC(beingCarried))};
|
||||
if (alive _unit) then {
|
||||
if (vehicle _unit == _unit) then {
|
||||
[format["Resetting unit animiation to normal %1",_unit]] call FUNC(debug);
|
||||
//[_unit,"",false] call FUNC(broadcastAnim);
|
||||
[_unit,"amovppnemstpsnonwnondnon",false] call FUNC(broadcastAnim);
|
||||
} else {
|
||||
[format["Resetting unit animiation to oldAnimation %1 - %2",_unit, _oldAnimation]] call FUNC(debug);
|
||||
[_unit, _oldAnimation,false] call FUNC(broadcastAnim);
|
||||
};
|
||||
_unit setvariable [QGVAR(StateUnconscious), false, true];
|
||||
};
|
||||
[[_unit, false],"setUnconsciousState"] call FUNC(customEventHandler_F);
|
||||
};
|
||||
[[_unit, true],"setUnconsciousState"] call FUNC(customEventHandler_F);
|
48
addons/common/functions/fnc_setVolume_f.sqf
Normal file
48
addons/common/functions/fnc_setVolume_f.sqf
Normal file
@ -0,0 +1,48 @@
|
||||
/**
|
||||
* fn_setVolume_f.sqf
|
||||
* @Descr: Sets the volume of the game, including third party radio modifications such as TFAR and ACRE.
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: [setVolume BOOL]
|
||||
* @Return: void
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
|
||||
#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;
|
||||
|
||||
if (_setVolume) then {
|
||||
// Vanilla Game
|
||||
2 fadeSound NORMAL_LEVEL;
|
||||
|
||||
// TFAR
|
||||
player setVariable ["tf_voiceVolume", NORMAL_LEVEL, true];
|
||||
player setVariable ["tf_globalVolume", NORMAL_LEVEL];
|
||||
player setVariable ["tf_unable_to_use_radio", false];
|
||||
|
||||
// ACRE2
|
||||
player setVariable ["acre_sys_core_globalVolume", NORMAL_LEVEL];
|
||||
player setVariable ["acre_sys_core_isDisabled", false, true];
|
||||
|
||||
} else {
|
||||
// Vanilla Game
|
||||
2 fadeSound MUTED_LEVEL;
|
||||
|
||||
// TFAR
|
||||
player setVariable ["tf_voiceVolume", NO_SOUND, true];
|
||||
player setVariable ["tf_globalVolume", MUTED_LEVEL];
|
||||
player setVariable ["tf_unable_to_use_radio", true];
|
||||
|
||||
// ACRE2
|
||||
player setVariable ["acre_sys_core_globalVolume", MUTED_LEVEL];
|
||||
player setVariable ["acre_sys_core_isDisabled", true, true];
|
||||
|
||||
};
|
||||
|
||||
[[_setVolume],"setVolume"] call FUNC(customEventHandler_F);
|
38
addons/common/functions/fnc_setWeaponsCorrectUnconscious.sqf
Normal file
38
addons/common/functions/fnc_setWeaponsCorrectUnconscious.sqf
Normal file
@ -0,0 +1,38 @@
|
||||
/**
|
||||
* fn_setWeaponsCorrectUnconscious.sqf
|
||||
* @Descr: Ensures the weapon of a unit is selected correctly for the unconscious state. Prefents wierd animation behaviour
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: [unit OBJECT]
|
||||
* @Return: void
|
||||
* @PublicAPI: false
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit"];
|
||||
_unit = _this select 0;
|
||||
|
||||
if ((vehicle _unit) isKindOf "StaticWeapon") then {
|
||||
moveOut _unit;
|
||||
unassignVehicle _unit;
|
||||
//unassignVehicle _unit;
|
||||
//_unit action ["eject", vehicle _unit];
|
||||
};
|
||||
if (vehicle _unit == _unit) then {
|
||||
if (currentWeapon _unit == secondaryWeapon _unit) then {
|
||||
reload _unit;
|
||||
};
|
||||
};
|
||||
|
||||
if (animationState _unit in ["ladderriflestatic","laddercivilstatic"]) then {
|
||||
_unit action ["ladderOff", (nearestBuilding _unit)];
|
||||
};
|
||||
|
||||
if (vehicle _unit == _unit) then {
|
||||
if (currentWeapon _unit == secondaryWeapon _unit) then {
|
||||
_unit selectWeapon (primaryWeapon _unit);
|
||||
_unit switchMove "";
|
||||
_unit playmoveNow "";
|
||||
};
|
||||
};
|
44
addons/common/functions/fnc_sortAlphabeticallyBy.sqf
Normal file
44
addons/common/functions/fnc_sortAlphabeticallyBy.sqf
Normal file
@ -0,0 +1,44 @@
|
||||
/**
|
||||
* fn_sortAlphabeticallyBy.sqf
|
||||
* @Descr:
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: []
|
||||
* @Return:
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_array", "_elements", "_elementN", "_indexes", "_theElement", "_tmp", "_tempIndex", "_j", "_i", "_returnArray"];
|
||||
_array = _this select 0;
|
||||
_elementN = _this select 1;
|
||||
|
||||
_indexes = [];
|
||||
_elements = [];
|
||||
|
||||
{
|
||||
_theElement = toArray (_x select _elementN);
|
||||
_indexes pushback _foreachIndex;
|
||||
_elements pushback _theElement;
|
||||
}foreach _array;
|
||||
|
||||
for "_i" from 1 to (count _elements) - 1 do {
|
||||
_tmp = _elements select _i;
|
||||
_tempIndex = _indexes select _i;
|
||||
_j = _i;
|
||||
while {_j >= 1 && {_tmp < _elements select (_j - 1)}} do {
|
||||
_elements set [_j, _elements select (_j - 1)];
|
||||
_indexes set [_j, _indexes select (_j - 1)];
|
||||
_j = _j - 1;
|
||||
};
|
||||
_elements set[_j, _tmp];
|
||||
_indexes set [_j, _tempIndex];
|
||||
};
|
||||
|
||||
_returnArray = [];
|
||||
{
|
||||
_returnArray pushback (_array select _x);
|
||||
}foreach _indexes;
|
||||
|
||||
_returnArray;
|
35
addons/common/functions/fnc_stringCompare.sqf
Normal file
35
addons/common/functions/fnc_stringCompare.sqf
Normal file
@ -0,0 +1,35 @@
|
||||
/**
|
||||
* fn_stringCompare.sqf
|
||||
* @Descr: Determines whether one string matches another and how many characters match. Case insensitive.
|
||||
* @Author: bovine3dom
|
||||
*
|
||||
* @Arguments: [stringA STRING, stringB STRING]
|
||||
* @Return: NUMBER Number of matching characters
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_searchTerm", "_string", "_arraySearchTerm", "_arrayString", "_sizeSearchTerm", "_sizeString", "_matchingCharacters", "_searchIterator", "_targetIterator"];
|
||||
_string = toLower (_this select 0); // removes case sensitivity
|
||||
_searchTerm = toLower (_this select 1);
|
||||
|
||||
|
||||
_arraySearchTerm = toArray _searchTerm; // splits string into array of unicode decimals
|
||||
_arrayString = toArray _string;
|
||||
_sizeSearchTerm = count _arraySearchTerm; // We only measure the array once
|
||||
_sizeString = count _arrayString;
|
||||
|
||||
|
||||
_matchingCharacters = 0;
|
||||
_targetIterator = 0;
|
||||
_searchIterator = 0;
|
||||
while {(_searchIterator < _sizeSearchTerm) && (_targetIterator < _sizeString)} do { // Prevents us from going out of bounds
|
||||
if ((_arraySearchTerm select _searchIterator) == (_arrayString select _targetIterator)) then { // If we have a match, start looking for the next character in the search term
|
||||
_matchingCharacters = _matchingCharacters + 1;
|
||||
_searchIterator = _searchIterator + 1
|
||||
};
|
||||
_targetIterator = _targetIterator + 1; // Look at the next character in the string
|
||||
};
|
||||
|
||||
_matchingCharacters
|
21
addons/common/functions/fnc_string_removeWhiteSpace.sqf
Normal file
21
addons/common/functions/fnc_string_removeWhiteSpace.sqf
Normal file
@ -0,0 +1,21 @@
|
||||
/**
|
||||
* fn_stringTrim.sqf
|
||||
* @Descr: Removes white spaces from string
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: [string STRING]
|
||||
* @Return: STRING copy of string
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
#define WHITE_SPACE [20]
|
||||
|
||||
private ["_string", "_charArray", "_returnString"];
|
||||
_string = [_this, 0, "",[""]] call bis_fnc_param;
|
||||
_charArray = toArray _string;
|
||||
_charArray = _charArray - [((toArray " ") select 0)];
|
||||
_returnString = toString _charArray;
|
||||
|
||||
_returnString;
|
17
addons/common/functions/fnc_switchAnim.sqf
Normal file
17
addons/common/functions/fnc_switchAnim.sqf
Normal file
@ -0,0 +1,17 @@
|
||||
/**
|
||||
* fn_switchAnim.sqf
|
||||
* @Descr: N/A
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: []
|
||||
* @Return:
|
||||
* @PublicAPI: false
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit", "_anim"];
|
||||
_unit = [_this,0,objNull,[objNull]] call BIS_fnc_Param;
|
||||
_anim = [_this,1,"",[""]] call BIS_fnc_Param;
|
||||
_unit switchMove _anim;
|
||||
_unit playMove _anim;
|
66
addons/common/functions/fnc_switchToGroupSide_f.sqf
Normal file
66
addons/common/functions/fnc_switchToGroupSide_f.sqf
Normal file
@ -0,0 +1,66 @@
|
||||
/**
|
||||
* fn_switchToGroupSide_f.sqf
|
||||
* @Descr: Stack group switches. Will always trace back to original group.
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: [unit OBJECT, switch BOOL, id STRING, side SIDE]
|
||||
* @Return: void
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
|
||||
#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;
|
||||
|
||||
_previousGroupsList = _unit getvariable [QGVAR(previousGroupSwitchTo_F),[]];
|
||||
if (_switch) then {
|
||||
// go forward
|
||||
_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);
|
||||
};
|
||||
|
||||
_newGroup = createGroup _side;
|
||||
[_unit] joinSilent _newGroup;
|
||||
|
||||
_previousGroupsList pushback [_previousGroup, _originalSide, _id, true];
|
||||
_unit setvariable [QGVAR(previousGroupSwitchTo_F), _previousGroupsList, true];
|
||||
} else {
|
||||
// go one back
|
||||
{
|
||||
if (_id == (_x select 2)) exitwith {
|
||||
_x set [ 3, false];
|
||||
_previousGroupsList set [_foreachIndex, _x];
|
||||
[format["found group with ID: %1", _id]] call FUNC(debug);
|
||||
};
|
||||
}foreach _previousGroupsList;
|
||||
reverse _previousGroupsList;
|
||||
|
||||
{
|
||||
if (_x select 3) exitwith {}; // stop at first id set to true
|
||||
if !(_x select 3) then {
|
||||
_currentGroup = group _unit;
|
||||
if (!isNull (_x select 0)) then {
|
||||
[_unit] joinSilent (_x select 0);
|
||||
} else {
|
||||
_newGroup = createGroup (_x select 1);
|
||||
[_unit] joinSilent _newGroup;
|
||||
};
|
||||
if (count units _currentGroup == 0) then {
|
||||
deleteGroup _currentGroup;
|
||||
};
|
||||
_previousGroupsList set [_foreachIndex, ObjNull];
|
||||
};
|
||||
}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_F), _previousGroupsList, true];
|
||||
};
|
||||
|
||||
[[_unit, _switch, _id, _side],"switchToGroupSide"] call FUNC(customEventHandler_F);
|
24
addons/common/functions/fnc_uniqueElementsOnly.sqf
Normal file
24
addons/common/functions/fnc_uniqueElementsOnly.sqf
Normal file
@ -0,0 +1,24 @@
|
||||
/**
|
||||
* fn_uniqueElementsOnly.sqf
|
||||
* @Descr: Make a copy of an array with only the unique elements.
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: [array ARRAY]
|
||||
* @Return: ARRAY Copy of original array
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_array", "_result", "_value"];
|
||||
_array = _this select 0;
|
||||
|
||||
_result = [];
|
||||
{
|
||||
_value = _x;
|
||||
if ({_x isEqualTo _value} count _result == 0) then {
|
||||
_result pushback _x;
|
||||
};
|
||||
}foreach _array;
|
||||
|
||||
_result;
|
59
addons/common/functions/fnc_unloadPerson_f.sqf
Normal file
59
addons/common/functions/fnc_unloadPerson_f.sqf
Normal file
@ -0,0 +1,59 @@
|
||||
/**
|
||||
* fn_unloadPerson_f.sqf
|
||||
* @Descr: Unload a person from a vehicle
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: [caller OBJECT, unit OBJECT]
|
||||
* @Return: BOOL Returns true if succesfully unloaded person
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
#define GROUP_SWITCH_ID QUOTE(FUNC(loadPerson_F))
|
||||
|
||||
private ["_caller", "_unit","_vehicle", "_loaded"];
|
||||
_caller = [_this, 0, ObjNull,[ObjNull]] call BIS_fnc_Param;
|
||||
_unit = [_this, 1, ObjNull,[ObjNull]] call BIS_fnc_Param;
|
||||
_vehicle = vehicle _unit;
|
||||
|
||||
if (_vehicle == _unit) exitwith {false;};
|
||||
if !(speed _vehicle <1 && (((getpos _vehicle) select 2) < 2)) exitwith {false;};
|
||||
if (!([_caller] call FUNC(isAwake))) exitwith{false;};
|
||||
|
||||
moveOut _unit;
|
||||
unassignVehicle _unit;
|
||||
if (!alive _unit) then {
|
||||
_unit action ["Eject", vehicle _unit];
|
||||
};
|
||||
|
||||
[_unit, false, GROUP_SWITCH_ID, side group _caller] call FUNC(switchToGroupSide_f);
|
||||
|
||||
_loaded = _vehicle getvariable [QGVAR(loaded_persons_F),[]];
|
||||
_loaded = _loaded - [_unit];
|
||||
_vehicle setvariable [QGVAR(loaded_persons_F),_loaded,true];
|
||||
|
||||
if (!([_unit] call FUNC(isAwake))) then {
|
||||
_handle = [_unit,_vehicle] spawn {
|
||||
private ["_unit","_vehicle"];
|
||||
_unit = _this select 0;
|
||||
_vehicle = _this select 1;
|
||||
waituntil {vehicle _unit != _vehicle};
|
||||
[_unit,([_unit] call FUNC(getDeathAnim))] call FUNC(broadcastAnim);
|
||||
[format["Unit should move into death anim: %1", _unit]] call FUNC(debug);
|
||||
};
|
||||
} else {
|
||||
if ([_unit] call FUNC(isArrested)) then {
|
||||
_handle = [_unit,_vehicle] spawn {
|
||||
_unit = _this select 0;
|
||||
_vehicle = _this select 1;
|
||||
waituntil {vehicle _unit != _vehicle};
|
||||
[_unit,"UnaErcPoslechVelitele2",true] call FUNC(broadcastAnim);
|
||||
[format["Unit should move into arrested anim: %1", _unit]] call FUNC(debug);
|
||||
};
|
||||
} else {
|
||||
[format["Unit should move into normal anim: %1", _unit]] call FUNC(debug);
|
||||
};
|
||||
};
|
||||
|
||||
true;
|
38
addons/common/functions/fnc_useItem.sqf
Normal file
38
addons/common/functions/fnc_useItem.sqf
Normal file
@ -0,0 +1,38 @@
|
||||
/**
|
||||
* fn_useItem.sqf
|
||||
* @Descr:
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: []
|
||||
* @Return:
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit","_item","_return"];
|
||||
_unit = _this select 0;
|
||||
_item = _this select 1;
|
||||
_vehicleUsage = [_this, 2, false, [false]] call BIS_fnc_Param;
|
||||
|
||||
if (!_vehicleUsage) then {
|
||||
if (_item != "") then {
|
||||
if (_item in (items _unit)) then {
|
||||
_unit removeItem _item;
|
||||
_return = true;
|
||||
} else {
|
||||
if (_item in (assignedItems _unit)) then {
|
||||
_unit unassignItem _item;
|
||||
_unit removeItem _item;
|
||||
_return = true;
|
||||
};
|
||||
};
|
||||
} else {
|
||||
_return = false;
|
||||
};
|
||||
[format["fnc_useItem: %1 | %2",_this,_return]] call FUNC(debug);
|
||||
_return
|
||||
} else
|
||||
{
|
||||
// TODO implement shared item functionality
|
||||
};
|
30
addons/common/functions/fnc_useMagazine.sqf
Normal file
30
addons/common/functions/fnc_useMagazine.sqf
Normal file
@ -0,0 +1,30 @@
|
||||
/**
|
||||
* fn_useMagazine.sqf
|
||||
* @Descr: Use magazine
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: [unit OBJECt, magazine STRING]
|
||||
* @Return: BOOL True if magazine has been used.
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit","_magazine","_return"];
|
||||
_unit = _this select 0;
|
||||
_magazine = _this select 1;
|
||||
_vehicleUsage = [_this, 2, false, [false]] call BIS_fnc_Param;
|
||||
|
||||
if (!_vehicleUsage) then {
|
||||
if (_magazine != "") then {
|
||||
_unit removeMagazine _magazine;
|
||||
_return = true;
|
||||
} else {
|
||||
_return = false;
|
||||
};
|
||||
[format["fnc_useMagazine: %1 | %2",_this,_return]] call FUNC(debug);
|
||||
_return
|
||||
} else
|
||||
{
|
||||
// TODO implement shared magazine functionality
|
||||
};
|
@ -463,5 +463,26 @@
|
||||
<Russian>Без голоса</Russian>
|
||||
<Hungarian>Nincs hang</Hungarian>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_ACTION_ACCEPT_REQUEST_KEY_TITLE">
|
||||
<Original>Accept Requests</Original>
|
||||
<Polish>Akceptuj prośby</Polish>
|
||||
<Spanish>Aceptar Peticiones</Spanish>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_ACTION_DECLINE_REQUEST_KEY_TITLE">
|
||||
<Original>Decline Requests</Original>
|
||||
<Polish>Ignoruj prośby</Polish>
|
||||
<Spanish>Rechazar Peticiones</Spanish>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_ACTION_ACCEPT_REQUEST_KEY_TOOLTIP">
|
||||
<Original>Accept Requests send by other players. These can be requests to use / share equipment, perform certain actions.</Original>
|
||||
<Polish>Akceptuj prośby wysłane przez innych graczy. Akceptacji wymagają między innymi akcje używania / współdzielenia wyposażenia, wykonywania określonych czynności.</Polish>
|
||||
<Spanish>Acepta Peticiones de otros jugadores. Pueden ser solicitudes para usar / compartir equipamiento, realizar ciertas acciones.</Spanish>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_ACTION_DECLINE_REQUEST_KEY_TOOLTIP">
|
||||
<Original>Decline Requests send by other players. These can be requests to use / share equipment, perform certain actions.</Original>
|
||||
<Polish>Ignoruj prośby wysłane przez innych graczy. Akceptacji wymagają między innymi akcje używania / współdzielenia wyposażenia, wykonywania określonych czynności.</Polish>
|
||||
<Spanish>Rechazar Peticiones de otros jugadores. Pueden ser solicitudes para usar / compartir equipamiento, realizar ciertas acciones.</Spanish>
|
||||
</Key>
|
||||
</Package>
|
||||
|
||||
</Project>
|
Loading…
Reference in New Issue
Block a user