diff --git a/addons/common/CfgEventHandlers.hpp b/addons/common/CfgEventHandlers.hpp index beb07e35e7..895b3fd13a 100644 --- a/addons/common/CfgEventHandlers.hpp +++ b/addons/common/CfgEventHandlers.hpp @@ -26,11 +26,6 @@ class Extended_DisplayLoad_EventHandlers { }; class Extended_InitPost_EventHandlers { - class All { - class GVAR(executePersistent) { - init = QUOTE([_this select 0] call FUNC(executePersistent)); - }; - }; class CAManBase { class GVAR(setName) { init = QUOTE(if (local (_this select 0)) then {[ARR_2(FUNC(setName),_this)] call CBA_fnc_execNextFrame};); diff --git a/addons/common/XEH_PREP.hpp b/addons/common/XEH_PREP.hpp index fbf588097e..d8b22a8198 100644 --- a/addons/common/XEH_PREP.hpp +++ b/addons/common/XEH_PREP.hpp @@ -39,10 +39,6 @@ PREP(endRadioTransmission); PREP(eraseCache); PREP(errorMessage); PREP(execNextFrame); -PREP(execPersistentFnc); -PREP(execRemoteFnc); -PREP(executePersistent); -PREP(filter); PREP(findUnloadPosition); PREP(firedEH); PREP(fixCollision); @@ -50,16 +46,13 @@ PREP(fixFloating); PREP(fixLoweredRifleAnimation); PREP(fixPosition); PREP(getAllDefinedSetVariables); -PREP(getAllGear); PREP(getDeathAnim); -PREP(getCaptivityStatus); PREP(getDefaultAnim); PREP(getDefinedVariable); PREP(getDefinedVariableDefault); PREP(getDefinedVariableInfo); PREP(getFirstObjectIntersection); PREP(getFirstTerrainIntersection); -PREP(getForceWalkStatus); PREP(getGunner); PREP(getInPosition); PREP(getMapData); @@ -114,7 +107,6 @@ PREP(loadPersonLocal); PREP(loadSettingsFromProfile); PREP(loadSettingsOnServer); PREP(loadSettingsLocalizedText); -PREP(map); PREP(moduleCheckPBOs); PREP(moduleLSDVehicles); PREP(muteUnit); @@ -143,12 +135,9 @@ PREP(runAfterSettingsInit); PREP(sanitizeString); PREP(sendRequest); PREP(serverLog); -PREP(setAllGear); PREP(setApproximateVariablePublic); -PREP(setCaptivityStatus); PREP(setDefinedVariable); PREP(setDisableUserInputStatus); -PREP(setForceWalkStatus); PREP(setHearingCapability); PREP(setName); PREP(setParameter); @@ -212,7 +201,6 @@ PREP(getVehicleCrew); PREP(getVehicleUAVCrew); // turrets -PREP(getTurrets); PREP(getTurretIndex); PREP(getTurretConfigPath); PREP(getTurretGunner); diff --git a/addons/common/XEH_postInit.sqf b/addons/common/XEH_postInit.sqf index 361a168419..3f7b564811 100644 --- a/addons/common/XEH_postInit.sqf +++ b/addons/common/XEH_postInit.sqf @@ -160,14 +160,6 @@ if (isServer) then { [FUNC(syncedEventPFH), 0.5, []] call CBA_fnc_addPerFrameHandler; }; -// @todo deprecated -QGVAR(remoteFnc) addPublicVariableEventHandler { - (_this select 1) call FUNC(execRemoteFnc); -}; - -// @todo figure out what this does. -[missionNamespace] call FUNC(executePersistent); - ////////////////////////////////////////////////// // Check files, previous installed version etc. @@ -326,7 +318,37 @@ enableCamShake true; // "playerInventoryChanged" event ["loadout", { - ["ace_playerInventoryChanged", [ACE_player, [ACE_player, false] call FUNC(getAllGear)]] call CBA_fnc_localEvent; + private _fnc_getAllGear = { + if (isNull _this) exitWith {[ + "", + "", + "", [], + "", [], + "", [], + "", ["","","",""], [], + "", ["","","",""], [], + "", ["","","",""], [], + [], + "", + "" + ]}; + + [ + headgear _this, + goggles _this, + uniform _this, uniformItems _this, + vest _this, vestItems _this, + backpack _this, backpackItems _this, + primaryWeapon _this, primaryWeaponItems _this, primaryWeaponMagazine _this, + secondaryWeapon _this, secondaryWeaponItems _this, secondaryWeaponMagazine _this, + handgunWeapon _this, handgunItems _this, handgunMagazine _this, + assignedItems _this, + binocular _this, + _this call CBA_fnc_binocularMagazine + ] + }; + + ["ace_playerInventoryChanged", [ACE_player, ACE_player call _fnc_getAllGear]] call CBA_fnc_localEvent; }] call CBA_fnc_addPlayerEventHandler; // "playerVisionModeChanged" event diff --git a/addons/common/XEH_preInit.sqf b/addons/common/XEH_preInit.sqf index 8be20c5e8f..eca1aebf36 100644 --- a/addons/common/XEH_preInit.sqf +++ b/addons/common/XEH_preInit.sqf @@ -5,17 +5,6 @@ ADDON = false; #include "XEH_PREP.hpp" -// backwards comp -DFUNC(canUseWeapon) = { - ACE_DEPRECATED("ace_common_fnc_canUseWeapon","3.7.0","CBA_fnc_canUseWeapon"); - _this call CBA_fnc_canUseWeapon; -}; - -DFUNC(selectWeaponMode) = { - ACE_DEPRECATED("ace_common_fnc_selectWeaponMode","3.7.0","CBA_fnc_selectWeapon"); - _this call CBA_fnc_selectWeapon; -}; - GVAR(syncedEvents) = [] call CBA_fnc_hashCreate; GVAR(showHudHash) = [] call CBA_fnc_hashCreate; diff --git a/addons/common/functions/fnc_execPersistentFnc.sqf b/addons/common/functions/fnc_execPersistentFnc.sqf deleted file mode 100644 index af015cf55d..0000000000 --- a/addons/common/functions/fnc_execPersistentFnc.sqf +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Author: commy2 - * Execute a function on every machine. Function will also be called upon JIP (postInit). The arguments are stored in (_this select 0), while the assigned namespace is stored in (_this select 1). - * - * Arguments: - * 0: Function arguments - * 1: Function to execute, has to be defined on the remote machine first - * 2: Namespace to save that variable in - * 3: Name. Will overwrite previously defined functions with that name - * - * Return Value: - * None - * - * Public: No - * - * Deprecated - */ -#include "script_component.hpp" - -ACE_DEPRECATED("ace_common_fnc_execPersistentFnc","3.7.0","ace_common_fnc_globalEvent"); - -GVAR(remoteFnc) = _this; - -params ["_arguments", "_function", "_unit", "_name"]; -TRACE_4("params", _arguments, _function, _unit, _name); - -_function = call compile _function; - -// execute function on every currently connected machine -[[_arguments, _unit], _this select 1, 2] call FUNC(execRemoteFnc); - -// save persistent function for JIP -private _persistentFunctions = _unit getVariable ["ACE_PersistentFunctions", []]; - -// find index to overwrite function with the same name, add to end otherwise -private _index = count _persistentFunctions; - -{ - if (_x select 2 == _name) exitWith { - _index = _forEachIndex; - }; -} forEach _persistentFunctions; - -// set new value -_persistentFunctions set [_index, [_arguments, _function, _name]]; - -// broadcast variable -if (typeName _unit == "NAMESPACE") then { - ACE_PersistentFunctions = _persistentFunctions; - publicVariable "ACE_PersistentFunctions"; -} else { - _unit setVariable ["ACE_PersistentFunctions", _persistentFunctions, true]; -}; diff --git a/addons/common/functions/fnc_execRemoteFnc.sqf b/addons/common/functions/fnc_execRemoteFnc.sqf deleted file mode 100644 index 945d181e4e..0000000000 --- a/addons/common/functions/fnc_execRemoteFnc.sqf +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Author: commy2 - * Execute a function on a remote machine in mp. - * - * Arguments: - * 0: Function arguments - * 1: Function to execute, has to be defined on the remote machine first - * 2: The function will be executed where this unit is local OR the mode were this function should be executed. (default: 2) - * 0 = execute on this machine only - * 1 = execute on server - * 2 = execute on all clients + server - * 3 = execute on dedicated only - * - * Return Value: - * None - * - * Public: No - * - * Deprecated - */ -#include "script_component.hpp" - -ACE_DEPRECATED("ace_common_fnc_execRemoteFnc","3.7.0","ace_common_fnc_globalEvent"); - -GVAR(remoteFnc) = _this; - -params ["_arguments", "_function", ["_unit", 2]]; -TRACE_3("params", _arguments, _function, _unit); - -_function = call compile _function; - -if (_unit isEqualType 0) exitWith { - switch (_unit) do { - case 0 : { - _arguments call _function; - }; - case 1 : { - if (isServer) then { - _arguments call _function; - } else { - publicVariableServer QGVAR(remoteFnc); - }; - }; - case 2 : { - _arguments call _function; - - GVAR(remoteFnc) set [2, 0]; - publicVariable QGVAR(remoteFnc); - }; - case 3 : { - if (isDedicated) then { - _arguments call _function; - } else { - if (!isServer) then {publicVariableServer QGVAR(remoteFnc)}; - }; - }; - }; -}; - -if (local _unit) then { - _arguments call _function; -} else { - if (isServer) then { - (owner _unit) publicVariableClient QGVAR(remoteFnc); - } else { - publicVariableServer QGVAR(remoteFnc); - }; -}; diff --git a/addons/common/functions/fnc_executePersistent.sqf b/addons/common/functions/fnc_executePersistent.sqf deleted file mode 100644 index d8f54995bd..0000000000 --- a/addons/common/functions/fnc_executePersistent.sqf +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Author: commy2 - * Execute all Persistent Functions - * - * Arguments: - * ? - * - * Return Value: - * None - * - * Public: No - */ -#include "script_component.hpp" - -params ["_target"]; - -{ - if (isNil "_x") then { - ACE_LOGERROR_1("No arguments and function for remote function. ID: %1",_forEachIndex); - } else { - if (_x isEqualType []) then { - [_x select 0, _target] call (_x select 1); - }; - }; -} forEach (_target getVariable ["ACE_PersistentFunctions", []]); diff --git a/addons/common/functions/fnc_filter.sqf b/addons/common/functions/fnc_filter.sqf deleted file mode 100644 index acee28eaa2..0000000000 --- a/addons/common/functions/fnc_filter.sqf +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Author: KoffeinFlummi, commy2 - * Filters array and removes every element not fitting the condition - * - * Arguments: - * 0: Array to be filtered. - * 1: Code to be evaluated. - * - * Return Value: - * Final array - * - * Public: Yes - * - * Deprecated - */ -#include "script_component.hpp" - -params [["_array", [], [[]]], ["_code", {}, [{}]]]; - -ACE_DEPRECATED("ace_common_fnc_filter","3.7.0","select CODE"); - -private _result = []; - -{ - if (_x call _code) then { - _result pushBack _x; - }; - false -} count _array; - -_result diff --git a/addons/common/functions/fnc_getAllGear.sqf b/addons/common/functions/fnc_getAllGear.sqf deleted file mode 100644 index de6ea62dff..0000000000 --- a/addons/common/functions/fnc_getAllGear.sqf +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Author: bux578, commy2 - * Returns an array containing all items of a given unit - * - * Arguments: - * 0: Unit - * - * Return Value: - * 0: Headgear - * 1: Goggles - * 2: Uniform - * 3: Uniform Items - * 4: Vest - * 5: Vest Items - * 6: Backback - * 7: Backpack Items - * 8: Rifle - * 9: Rifle Items - * 10: Rifle Magazines - * 11: Launcher - * 12: Launcher Items - * 13: Launcher Magazines - * 14: Handgun - * 15: Handgun Items - * 16: Handgun Magazines - * 17: Assigned Items (map, compass, watch, etc.) - * 18: Binoculars - * 19: Binocular Magazine (E.g. Laserbatteries) - * - * Public: Yes - * - * Note: Element 17 includes the Head Mounted Display (HMD) - */ -#include "script_component.hpp" - -params ["_unit", ["_showDeprecated", true]]; - -if (_showDeprecated) then { - ACE_DEPRECATED("ace_common_fnc_getAllGear","3.7.0","getUnitLoadout"); -}; - -if (isNull _unit) exitWith {[ - "", - "", - "", [], - "", [], - "", [], - "", ["","","",""], [], - "", ["","","",""], [], - "", ["","","",""], [], - [], - "", - "" -]}; - -[ - headgear _unit, - goggles _unit, - uniform _unit, uniformItems _unit, - vest _unit, vestItems _unit, - backpack _unit, backpackItems _unit, - primaryWeapon _unit, primaryWeaponItems _unit, primaryWeaponMagazine _unit, - secondaryWeapon _unit, secondaryWeaponItems _unit, secondaryWeaponMagazine _unit, - handgunWeapon _unit, handgunItems _unit, handgunMagazine _unit, - assignedItems _unit, - binocular _unit, - [_unit] call CBA_fnc_binocularMagazine -] diff --git a/addons/common/functions/fnc_getCaptivityStatus.sqf b/addons/common/functions/fnc_getCaptivityStatus.sqf deleted file mode 100644 index ab4c27956e..0000000000 --- a/addons/common/functions/fnc_getCaptivityStatus.sqf +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Author: commy2 - * Return the captivity status of an unit. - * - * Arguments: - * 0: Unit - * - * Return Value: - * Captivity Reasons, empty if not captive - * - * Public: Yes - */ -#include "script_component.hpp" - -params ["_unit"]; - -//Now just a wrapper for FUNC(statusEffect_get) [No longer used in ace as of 3.5] -ACE_DEPRECATED("ace_common_fnc_getCaptivityStatus","3.7.0","ace_common_fnc_statusEffect_get"); - -([_unit, "setCaptive"] call FUNC(statusEffect_get)) select 1 diff --git a/addons/common/functions/fnc_getForceWalkStatus.sqf b/addons/common/functions/fnc_getForceWalkStatus.sqf deleted file mode 100644 index 89042b19dd..0000000000 --- a/addons/common/functions/fnc_getForceWalkStatus.sqf +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Author: PabstMirror, commy2 - * Returns reasons why the unit is forceWalk-ing. - * - * Arguments: - * 0: unit - * - * Return Value: - * Force Walk reasons - * - * Example: - * [ACE_Player] call ace_common_fnc_getForceWalkStatus - * - * Public: Yes - */ -#include "script_component.hpp" - -params ["_unit"]; - -//Now just a wrapper for FUNC(statusEffect_get) [No longer used in ace as of 3.5] -ACE_DEPRECATED("ace_common_fnc_getForceWalkStatus","3.7.0","ace_common_fnc_statusEffect_get"); - -([_unit, "forceWalk"] call FUNC(statusEffect_get)) select 1 diff --git a/addons/common/functions/fnc_getTurrets.sqf b/addons/common/functions/fnc_getTurrets.sqf deleted file mode 100644 index 0479580764..0000000000 --- a/addons/common/functions/fnc_getTurrets.sqf +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Author: commy2 - * Get all turret indicies of a vehicle type. - * - * Arguments: - * 0: Vehicle type - * - * Return Value: - * Turret Indecies - * - * Public: No - * - * Note: It's advised to use allTurrets [_vehicle, true] instead whenever possible - */ -#include "script_component.hpp" - -ACE_DEPRECATED("ace_common_fnc_getTurrets","3.7.0","allTurrets [_vehicle, true]"); - -params ["_type"]; - -private _varName = format [QGVAR(CachedTurrets_%1), _type]; -private _turrets = + (uiNamespace getVariable _varName); - -if (!isNil "_turrets") exitWith {_turrets}; - -private _config = configFile >> "CfgVehicles" >> _type; - -_turrets = []; - -private _fnc_addTurret = { - params ["_config", "_path"]; - - _config = _config >> "Turrets"; - - private _offset = 0; - - for "_index" from 0 to (count _config - 1) do { - private _path2 = _path + [_index - _offset]; - private _config2 = _config select _index; - - if (isClass _config2) then { - _turrets pushBack _path2; - [_config2, _path2] call _fnc_addTurret; - } else { - _offset = _offset + 1; - }; - }; -}; - -[_config, []] call _fnc_addTurret; - -uiNamespace setVariable [_varName, _turrets]; - -_turrets diff --git a/addons/common/functions/fnc_map.sqf b/addons/common/functions/fnc_map.sqf deleted file mode 100644 index c92a4eb588..0000000000 --- a/addons/common/functions/fnc_map.sqf +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Author: KoffeinFlummi, commy2 - * Applies given code to every element in an array, LIKE SOMETHING SQF SHOULD HAVE BY DEFAULT. <- :kappa: - * - * Arguments: - * 0: Array to be thingied. - * 1: Code to be applied to every element. - * - * Return Value: - * Final array - * - * Public: Yes - * - * Deprecated - */ -#include "script_component.hpp" - -params [["_array", [], [[]]], ["_code", {}, [{}]]]; - -ACE_DEPRECATED("ace_common_fnc_map","3.7.0","apply"); - -// copy array to not alter the original one -_array = + _array; - -{ - _array set [_forEachIndex, _x call _code]; -} forEach _array; - -_array diff --git a/addons/common/functions/fnc_setAllGear.sqf b/addons/common/functions/fnc_setAllGear.sqf deleted file mode 100644 index 6334991796..0000000000 --- a/addons/common/functions/fnc_setAllGear.sqf +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Author: bux578, commy2 - * Applies gear to unit. It must be called in the machine in which the unit is local. - * - * Arguments: - * 0: Unit - * 1: All Gear based on return value of ACE_common_fnc_getAllGear - * 2: Remove all attachments from weapons? (default: false) - * 3: Remove all items from prefilled backpacks? (default: false) - * - * Return Value: - * None - * - * Example: - * [player, gear_array, true, true] call ace_common_fnc_setAllGear - * - * Public: Yes - */ -#include "script_component.hpp" - -ACE_DEPRECATED("ace_common_fnc_setAllGear","3.7.0","setUnitLoadout"); - -params ["_unit", "_allGear", ["_clearAttachments", false], ["_clearBackpack", false]]; - -if (!local _unit) exitWith { - ACE_LOGWARNING_1("setAllGear - %1 has to be local.",_unit); -}; - -// remove all starting gear of a player -removeAllWeapons _unit; -removeGoggles _unit; -removeHeadgear _unit; -removeVest _unit; -removeUniform _unit; -removeAllAssignedItems _unit; -removeBackpack _unit; - -_allGear params [ - "_headgear", "_goggles", - "_uniform", "_uniformitems", - "_vest", "_vestitems", - "_backpack", "_backpackitems", - "_primaryweapon", "_primaryweaponitems", "_primaryweaponmagazine", - "_secondaryweapon", "_secondaryweaponitems", "_secondaryweaponmagazine", - "_handgunweapon", "_handgunweaponitems", "_handgunweaponmagazine", - "_assigneditems", - "_binocular", - "_binocularmagazine" -]; - -// start restoring the items -if (_headgear != "") then {_unit addHeadgear _headgear}; -if (_goggles != "") then {_unit addGoggles _goggles}; - -// ensure all weapons being loaded -_unit addBackpack "ACE_FakeBackpack"; - -// primaryWeapon -if (_primaryweapon != "") then { - { - _unit addMagazine _x; - false - } count _primaryweaponmagazine; - - _unit addWeapon _primaryweapon; - - if (_clearAttachments) then { - removeAllPrimaryWeaponItems _unit; - }; - - { - if (_x != "") then { - _unit addPrimaryWeaponItem _x; - }; - false - } count _primaryweaponitems; -}; - -// secondaryWeapon -if (_secondaryweapon != "") then { - { - _unit addMagazine _x; - false - } count _secondaryweaponmagazine; - - _unit addWeapon _secondaryweapon; - - if (_clearAttachments) then { - //removeAllSecondaryWeaponItems _unit; - { - _unit removeSecondaryWeaponItem _x; - false - } count secondaryWeaponItems _unit; - }; - - { - if (_x != "") then { - _unit addSecondaryWeaponItem _x; - }; - false - } count _secondaryweaponitems; -}; - -// handgun -if (_handgunweapon != "") then { - { - _unit addMagazine _x; - false - } count _handgunweaponmagazine; - - _unit addWeapon _handgunweapon; - - if (_clearAttachments) then { - removeAllHandgunItems _unit; - }; - - { - if (_x != "") then { - _unit addHandgunItem _x; - }; - false - } count _handgunweaponitems; -}; - -// binocular -_unit addWeapon _binocular; -_unit addMagazine _binocularmagazine; - -// done with dummy backpack. now remove -removeBackpack _unit; - -// uniform -if (_uniform != "") then { - _unit forceAddUniform _uniform; -}; - -{ - _unit addItemToUniform _x; - false -} count _uniformitems; - -// vest -if (_vest != "") then { - _unit addVest _vest; -}; - -{ - _unit addItemToVest _x; - false -} count _vestitems; - -// backpack -if (_backpack != "") then { - _unit addBackpack _backpack; - - if (_clearBackpack) then { - private _backpackObject = unitBackpack _unit; - - clearMagazineCargoGlobal _backpackObject; - clearWeaponCargoGlobal _backpackObject; - clearItemCargoGlobal _backpackObject; - }; - - { - _unit addItemToBackpack _x; - false - } count _backpackitems; -}; - -// assigned items -_assignedItems deleteAt (_assignedItems find _binocular); - -{ - _unit linkItem _x; - false -} count _assignedItems; - -nil diff --git a/addons/common/functions/fnc_setCaptivityStatus.sqf b/addons/common/functions/fnc_setCaptivityStatus.sqf deleted file mode 100644 index 062c126f81..0000000000 --- a/addons/common/functions/fnc_setCaptivityStatus.sqf +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Author: commy2 - * Set the captivity status of an unit. This allows the handling of more than one reason to set a unit captive. - * - * Arguments: - * 0: Unit - * 1: The reason of the captivity - * 2: Is the reason still valid? True for setting this reason, false for removing it - * - * Return Value: - * None - * - * Public: Yes - */ -#include "script_component.hpp" - -params ["_unit", "_reason", "_status"]; - -//Now just a wrapper for FUNC(statusEffect_set) [No longer used in ace as of 3.5] -ACE_DEPRECATED("ace_common_fnc_setCaptivityStatus","3.7.0","ace_common_fnc_statusEffect_set"); - -[_unit, "setCaptive", _reason, _status] call FUNC(statusEffect_set); diff --git a/addons/common/functions/fnc_setForceWalkStatus.sqf b/addons/common/functions/fnc_setForceWalkStatus.sqf deleted file mode 100644 index 800040d978..0000000000 --- a/addons/common/functions/fnc_setForceWalkStatus.sqf +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Author: Pabst Mirror (from captivity by commy2) - * Sets the forceWalk status of an unit. This allows the handling of more than one reason to set forceWalk. - * Unit will force walk until all reasons are removed. - * - * Arguments: - * 0: Unit - * 1: Reason for forcing walking - * 2: Is the reason still valid. True to force walk, false to remove restriction. - * - * Returns: - * None - * - * Example: - * [ACE_Player, "BrokenLeg", true] call FUNC(setForceWalkStatus) - * - * Public: Yes -*/ -#include "script_component.hpp" - -params ["_unit", "_reason", "_status"]; - -//Now just a wrapper for FUNC(statusEffect_set) [No longer used in ace as of 3.5] -ACE_DEPRECATED("ace_common_fnc_setForceWalkStatus","3.7.0","ace_common_fnc_statusEffect_set"); - -[_unit, "forceWalk", _reason, _status] call FUNC(statusEffect_set);