diff --git a/.travis.yml b/.travis.yml index 0aadd9cd0b..313b0a11c7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,15 +1,30 @@ branches: only: - - master + - master language: python python: - - "3.4" +- '3.4' before_script: - - pip install pygithub - - pip install pygithub3 +- if [ -n "${GH_TOKEN}" ] && [ "${TRAVIS_BRANCH}" == "master" ] && [ "${TRAVIS_PULL_REQUEST}" == "false" ]; then + pip install pygithub; + pip install pygithub3; + fi script: - - python3 tools/deploy.py - - python3 tools/sqf_validator.py +- python3 tools/sqf_validator.py +- if [ -n "${GH_TOKEN}" ] && [ "${TRAVIS_BRANCH}" == "master" ] && [ "${TRAVIS_PULL_REQUEST}" == "false" ]; then + python3 tools/deploy.py; + fi env: global: - - secure: "KcJQbknBOdC5lA4nFGKPXVRVIGLDXDRzC8XkHuXJCE9pIR/wbxbkvx8fHKcC6SC9eHgzneC3+o4m4+CjIbVvIwDgslRbJ8Y59i90ncONmdoRx1HUYHwuYWVZm9HJFjCsIbrEqhSyyKS+PB3WZVOLbErtNHsgS8f43PTh5Ujg7Vg=" + - secure: KcJQbknBOdC5lA4nFGKPXVRVIGLDXDRzC8XkHuXJCE9pIR/wbxbkvx8fHKcC6SC9eHgzneC3+o4m4+CjIbVvIwDgslRbJ8Y59i90ncONmdoRx1HUYHwuYWVZm9HJFjCsIbrEqhSyyKS+PB3WZVOLbErtNHsgS8f43PTh5Ujg7Vg= +notifications: + slack: + secure: aWYF/YX7vxEdXJ5w1jhYJQ2TtTP2NRdnXzJDMYXTv2dlXYhO9qp2qjxDGW3dezuPY7B1mPBgebfSKRx3Robkt1rAfEwPWivOiEztL30rwzOy+5Q1wpORv1JkvTC/q2wqQzxQCU/FPVjD2GkF1wtq1Rnx3ESWD8gbvzYoMNdIw1g= + on_success: change + on_failure: always + on_start: never + rooms: + secure: MvxmqL1NGwiGTVv6uIVTM7jeNLQH95KYtTgSWlXaSw4jdjnf4cmrb/ofHQ3FHhhNVdhRN6W8n0cJfTC3DBZ90bionVh+528qw2mDnDbKljVdIwmoFSexBcH7H1uTLF3gsEz0tbrHtLcnAyTMxdjsdIXDLZ5hwxABNmW5/03jOgs= + email: + on_success: never + on_failure: change diff --git a/AUTHORS.txt b/AUTHORS.txt index caa19109a7..8c22096033 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -53,6 +53,7 @@ Dharma Bellamkonda Dimaslg Drill Dudakov +Dslyecxi eRazeri evromalarkey F3 Project diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000000..6b7f1006fa --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,64 @@ +# Reporting an issue + +## Before reporting + +If you have found an issue with ACE3 please make sure that ACE3 is really the cause of the problem. To do this try to reproduce the issue with using only `@CBA_A3` and `@ace` on a newly created mission. + +Indicate if the issue appears on stable or development version. In case it is the development version, please also include the commit SHA-1 hash. + +
+
Please note:
+

It's not a valid to simply remove @ace from the mod list to confirm that ACE3 is the culprit.

+

If the error happens when using a third-party mod contact the author of the appropriate mod and report the issue there.

+
+ +## Reporting the issue + +Head over to the ACE3 GitHub issue tracker and press the "New issue" button in the top right corner. Add a descriptive title and copy the following issue template in to the text area: + +``` +ACE3 Version: 3.x.x +(indicate if stable or dev, if dev indicate the commit the version is based on) + +**Mods:** +* `@CBA_A3` +* `@ace` + +**Placed ACE3 Modules:** +* *Add the list of modules you have placed on the map. Use 'None' if the error occurs without using any modules.* +* You can also press the `Debug to` button in the ACE3 option menu (escape -> ACE3 options -> Debug to) and add a link (pastebin.com) to the results. + +**Description:** +* Add a detailed description of the error. This makes it easier for us to fix the issue.* + +**Steps to reproduce:** +* *Add the steps needed to reproduce the issue.* + +**Where did the issue occur?** +* A possible answer might be "Multiplayer", "Editor" or "Singleplayer"* + +**RPT log file:** +* Add a link (pastebin.com) to the client or server RPT file.* +``` + +A video of the issue might be helpful in resolving it faster. + + +Github uses "Markdown" to style the output. If you want to know more about it (e.g. how to turn text bold, how to denote code blocks or inline code) have a look at the GitHub markdown documentation. + +# Feature Requests + +## Background +ACE2, AGM and CSE had a lot of features implemented or planned. All of them are or have been evaluated for inclusion in ACE3 itself, and we'd like to port the majority of them eventually. However, due to time constraints, we have managed to finish only a fraction of the job so far. + +Please refrain from making requests for any planned or existing features from either ACE2, AGM or CSE. Most of them are already being or have been considered for porting or a rewrite. + +## Requesting a feature +In order to avoid duplicates and keep the issue tracker organized, we have created a common issue for ACE 3 Feature requests. Any and all relevant requests should be submitted there, where they will also get discussed and evaluated. Before adding a new one, make sure to check the previous entries from the thread and do a quick search for similar suggestions; please don't reiterate requests for features that had already been accepted for inclusion, or those which were disregarded earlier. + +Following their approval, feature requests may be moved by moderators to a separate issue for further discussion. + +# Regarding Pull Requests (PRs) +- You want to help but don't know where to start ? Check the wiki entry for [setting up the development environment](http://ace3mod.com/wiki/development/setting-up-the-development-environment.html) +- [Make sure to respect the file structure](http://ace3mod.com/wiki/development/modularity-and-pbo-structure.html) +- [Make sure to respect the coding guidelines](http://ace3mod.com/wiki/development/coding-guidelines.html) diff --git a/README.md b/README.md index 5a01e5d5de..ecbc0dd01d 100644 --- a/README.md +++ b/README.md @@ -6,19 +6,22 @@ ACE3 Version - ACE3 Download + ACE3 Download - ACE3 Issues + ACE3 Issues BIF Thread - ACE3 License + ACE3 License - - ACE3 Slack + + ACE3 Slack + + + ACE3 Build Status

Requires the latest version of CBA A3. Visit us on Facebook | YouTube | Twitter | Reddit

@@ -66,7 +69,8 @@ The mod is **built modularly**, so almost any included PBO can be easily removed ### Guides & how-tos If you installed ACE3 but have trouble understanding how it all works, or where to start, read this first: -- [Getting started](http://ace3mod.com/wiki/user/getting-started.html) +- [Installation guide](http://ace3mod.com/wiki/user/installation-guide.html) +- [Information center](http://ace3mod.com/wiki/user/information-center.html) #### Contributing You can help out with the ongoing development by looking for potential bugs in our code base, or by contributing new features. To contribute something to ACE3, simply fork this repository and submit your pull requests for review by other collaborators. Remember to add yourself to the author array of any PBO you will be editing and the [`AUTHORS.txt`](https://github.com/acemod/ACE3/blob/master/AUTHORS.txt) file; including a valid email address. diff --git a/addons/cargo/CfgVehicles.hpp b/addons/cargo/CfgVehicles.hpp index 1fae56749f..111c4d9956 100644 --- a/addons/cargo/CfgVehicles.hpp +++ b/addons/cargo/CfgVehicles.hpp @@ -222,12 +222,6 @@ class CfgVehicles { class B_supplyCrate_F: ReammoBox_F { GVAR(size) = 6; }; - class O_supplyCrate_F: ReammoBox_F { - GVAR(size) = 6; - }; - class I_supplyCrate_F: ReammoBox_F { - GVAR(size) = 6; - }; class IG_supplyCrate_F: ReammoBox_F { GVAR(size) = 6; }; diff --git a/addons/common/XEH_postInit.sqf b/addons/common/XEH_postInit.sqf index 912acce7c4..032b6148be 100644 --- a/addons/common/XEH_postInit.sqf +++ b/addons/common/XEH_postInit.sqf @@ -9,11 +9,11 @@ //Singe PFEH to handle execNextFrame, waitAndExec and waitUntilAndExec: [{ - private ["_entry", "_deleted"]; + BEGIN_COUNTER(waitAndExec); //Handle the waitAndExec array: while {!(GVAR(waitAndExecArray) isEqualTo []) && {GVAR(waitAndExecArray) select 0 select 0 <= ACE_Time}} do { - _entry = GVAR(waitAndExecArray) deleteAt 0; + local _entry = GVAR(waitAndExecArray) deleteAt 0; (_entry select 2) call (_entry select 1); }; @@ -29,7 +29,7 @@ GVAR(nextFrameNo) = diag_frameno + 1; //Handle the waitUntilAndExec array: - _deleted = 0; + local _deleted = 0; { // if condition is satisifed call statement if ((_x select 2) call (_x select 0)) then { @@ -39,6 +39,8 @@ (_x select 2) call (_x select 1); }; } forEach GVAR(waitUntilAndExecArray); + + END_COUNTER(waitAndExec); }, 0, []] call CBA_fnc_addPerFrameHandler; diff --git a/addons/common/XEH_preInit.sqf b/addons/common/XEH_preInit.sqf index ff06c1c3e3..e1cc807bdc 100644 --- a/addons/common/XEH_preInit.sqf +++ b/addons/common/XEH_preInit.sqf @@ -133,6 +133,7 @@ PREP(numberToDigitsString); PREP(numberToString); PREP(onAnswerRequest); PREP(owned); +PREP(parseList); PREP(player); PREP(playerSide); PREP(positionToASL); diff --git a/addons/common/functions/fnc_assignObjectsInList.sqf b/addons/common/functions/fnc_assignObjectsInList.sqf index 6bbb31d2dc..a09447a43a 100644 --- a/addons/common/functions/fnc_assignObjectsInList.sqf +++ b/addons/common/functions/fnc_assignObjectsInList.sqf @@ -4,50 +4,41 @@ * Used by moduleAssign* within various parts of the ACE3 project. * * Arguments: - * 0: list - * 1: variableName - * 2: value + * 0: List + * 1: Variable Name + * 2: Value * 3: Global + * 4: Vehicle (default: false) * * Return Value: - * None + * None + * + * Example: + * ["text", "variable", value, true] call ace_common_fnc_assignObjectsInList * * Public: No */ #include "script_component.hpp" -params ["_list", "_variable", "_setting", "_global"]; +params ["_list", "_variable", "_setting", "_global", ["_vehicle", false]]; if (typeName _list == "STRING") then { - private ["_splittedList", "_nilCheckPassedList"]; - - _splittedList = [_list, ","] call BIS_fnc_splitString; - _nilCheckPassedList = ""; - - { - _x = [_x] call FUNC(stringRemoveWhiteSpace); - if !(isNil _x) then { - if (_nilCheckPassedList == "") then { - _nilCheckPassedList = _x; - } else { - _nilCheckPassedList = _nilCheckPassedList + ","+ _x; - }; - }; - false - } count _splittedList; - - _list = [] call compile format["[%1]",_nilCheckPassedList]; + _list = [_list, true, true] call FUNC(parseList); + TRACE_1("Parsed",_list) }; { if (!isNil "_x") then { if (typeName _x == typeName objNull) then { if (local _x) then { - _x setvariable [_variable, _setting, _global]; + if (_vehicle) then { + (vehicle _x) setVariable [_variable, _setting, _global]; + TRACE_6("Set variable vehicle",_x,vehicle _x,typeOf (vehicle _x),_variable,_setting,_global); + } else { + _x setVariable [_variable, _setting, _global]; + TRACE_5("Set variable",_x,typeOf _x,_variable,_setting,_global); + }; }; }; }; - false } count _list; - -true diff --git a/addons/common/functions/fnc_dumpArray.sqf b/addons/common/functions/fnc_dumpArray.sqf index 182c542df2..010736d3a9 100644 --- a/addons/common/functions/fnc_dumpArray.sqf +++ b/addons/common/functions/fnc_dumpArray.sqf @@ -1,22 +1,24 @@ /* * Author: ? - * ? + * Dumps an array to the RPT, showing the depth of each element. * * Arguments: * 0: Array to be dumped - * 1: Depth + * 1: Depth * * Return Value: * None * + * Example: + * [[0, [1,2], [[3]]]] call ace_common_fnc_dumpArray + * * Public: No */ #include "script_component.hpp" -params ["_var", "_depth"]; +params ["_var", ["_depth", 0, [0]]]; -private "_pad"; -_pad = ""; +local _pad = ""; for "_i" from 0 to _depth do { _pad = _pad + toString [9]; @@ -38,5 +40,5 @@ if (IS_ARRAY(_var)) then { diag_log text format ["%1],", _pad]; }; } else { - diag_log text format ["%1%2", _pad, [_var] call FUNC(formatVar)]; + diag_log text format ["%1%2", _pad, _var]; }; diff --git a/addons/common/functions/fnc_execPersistentFnc.sqf b/addons/common/functions/fnc_execPersistentFnc.sqf index dc88a7c3c9..0b7bccb69a 100644 --- a/addons/common/functions/fnc_execPersistentFnc.sqf +++ b/addons/common/functions/fnc_execPersistentFnc.sqf @@ -20,11 +20,10 @@ GVAR(remoteFnc) = _this; params ["_arguments", "_function", "_unit", "_name"]; +TRACE_4("params", _arguments, _function, _unit, _name); _function = call compile _function; -//["Remote", [_arguments, _this select 1, _name], {format ["%1 call %2 id: %3", _this select 0, _this select 1, _this select 2]}, false] call FUNC(log); - // execute function on every currently connected machine [[_arguments, _unit], _this select 1, 2] call FUNC(execRemoteFnc); diff --git a/addons/common/functions/fnc_execRemoteFnc.sqf b/addons/common/functions/fnc_execRemoteFnc.sqf index 6b617bf92f..0dd0653a33 100644 --- a/addons/common/functions/fnc_execRemoteFnc.sqf +++ b/addons/common/functions/fnc_execRemoteFnc.sqf @@ -23,11 +23,10 @@ GVAR(remoteFnc) = _this; params ["_arguments", "_function", ["_unit", 2]]; +TRACE_3("params", _arguments, _function, _unit); _function = call compile _function; -//["Remote", [_arguments, _this select 1, _unit], {format ["%1 call %2 to: %3", _this select 0, _this select 1, _this select 2]}, false] call FUNC(log); - if (typeName _unit == "SCALAR") exitWith { switch (_unit) do { case 0 : { diff --git a/addons/common/functions/fnc_getTurretIndex.sqf b/addons/common/functions/fnc_getTurretIndex.sqf index b2f28c5f90..050f3e1c4f 100644 --- a/addons/common/functions/fnc_getTurretIndex.sqf +++ b/addons/common/functions/fnc_getTurretIndex.sqf @@ -8,29 +8,23 @@ * Return Value: * Turret Index * + * Example: + * [ace_player] call ace_common_fnc_getTurretIndex + * * Public: Yes */ #include "script_component.hpp" params ["_unit"]; -private ["_vehicle", "_turrets", "_units", "_index"]; - -_vehicle = vehicle _unit; - +local _vehicle = vehicle _unit; if (_unit == _vehicle) exitWith {[]}; -_turrets = allTurrets [_vehicle, true]; - -_units = []; +scopeName "main"; { - _units pushBack (_vehicle turretUnit _x); - false -} count _turrets; + if (_unit == (_vehicle turretUnit _x)) then {_x breakOut "main"}; + nil +} count allTurrets [_vehicle, true]; -_index = _units find _unit; - -if (_index == -1) exitWith {[]}; - -_turrets select _index; +[] diff --git a/addons/common/functions/fnc_loadPerson.sqf b/addons/common/functions/fnc_loadPerson.sqf index 377412bd4c..da729ed0d7 100644 --- a/addons/common/functions/fnc_loadPerson.sqf +++ b/addons/common/functions/fnc_loadPerson.sqf @@ -21,7 +21,7 @@ private ["_vehicle", "_loadcar", "_loadair", "_loadtank", "_loadboat"]; _vehicle = objNull; -if (!([_caller] call FUNC(canInteract)) || {_caller == _unit}) exitwith {_vehicle}; +if (!([_caller, _unit, ["isNotDragging", "isNotCarrying"]] call FUNC(canInteractWith)) || {_caller == _unit}) exitwith {_vehicle}; _loadcar = nearestObject [_unit, "Car"]; diff --git a/addons/common/functions/fnc_parseList.sqf b/addons/common/functions/fnc_parseList.sqf new file mode 100644 index 0000000000..ef7eaae92a --- /dev/null +++ b/addons/common/functions/fnc_parseList.sqf @@ -0,0 +1,59 @@ +/* + * Author: Glowbal, Jonpas + * Makes a list from a string using comma as a delimiter, optionally trim or remove whitespace and check each for object existence. + * + * Arguments: + * 0: List + * 1: Remove or Trim Whitespace (default: false (trim)) + * 2: Check Nil (default: false) + * + * Return Value: + * Parsed List + * + * Example: + * ["text", true, false] call ace_common_fnc_parseList + * + * Public: No + */ +#include "script_component.hpp" + +params ["_list", ["_removeWhitespace", false], ["_checkNil", false]]; + +private ["_whitespaceList", "_nilCheckedList"]; + +// Split using comma delimiter +_list = _list splitString ","; +TRACE_1("Splitted List",_list); + + +// Remove or Trim Whitespace +_whitespaceList = []; +{ + if (_removeWhitespace) then { + _whitespaceList pushBack ([_x] call FUNC(stringRemoveWhiteSpace)); + } else { + _whitespaceList pushBack ([_x] call CBA_fnc_trim); + }; + nil +} count _list; + +_list = _whitespaceList; +TRACE_1("Whitespace List",_list); + + +// Check for object existence +if (_checkNil) then { + _nilCheckedList = []; + { + if !(isNil _x) then { + _nilCheckedList pushBack (missionNamespace getVariable _x); + }; + nil + } count _list; + + _list = _nilCheckedList; +}; + +TRACE_1("Final List",_list); + +_list diff --git a/addons/common/functions/fnc_sendDisplayInformationTo.sqf b/addons/common/functions/fnc_sendDisplayInformationTo.sqf deleted file mode 100644 index aa3dba2365..0000000000 --- a/addons/common/functions/fnc_sendDisplayInformationTo.sqf +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Author: Glowbal - * Sends a display information hint to a receiver - * - * Arguments: - * 0: receiver - * 1: title - * 2: content - * 3: type (optional) - * - * Return Value: - * None - * - * Public: Yes - */ -#include "script_component.hpp" - -params [["_reciever", objNull], ["_title", ""], ["_content", ""], ["_type", 0], ["_parameters", []]]; - -if (isPlayer _reciever) then { - if (!local _reciever) then { - [_this, QFUNC(sendDisplayInformationTo), _reciever, false] call FUNC(execRemoteFnc); - } else { - if (isLocalized _title) then { - _title = localize _title; - }; - - private "_localizationArray"; - _localizationArray = [_title]; - - { - _localizationArray pushback _x; - false - } count _parameters; - - _title = format _localizationArray; - - { - if (isLocalized _x) then { - _localizationArray = [localize _x]; - - { - _localizationArray pushBack _x; - false - } count _parameters; - - _content set [_forEachIndex, format _localizationArray]; - }; - } forEach _content; - - [_title, _content, _type] call FUNC(displayInformation); - }; -}; diff --git a/addons/common/functions/fnc_sendDisplayMessageTo.sqf b/addons/common/functions/fnc_sendDisplayMessageTo.sqf deleted file mode 100644 index 6f16ec8006..0000000000 --- a/addons/common/functions/fnc_sendDisplayMessageTo.sqf +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Author: Glowbal - * Displays a message on locality of receiver - * - * Arguments: - * 0: receiver - * 1: title - * 2: content - * 3: type (optional) - * - * Return Value: - * None - * - * Public: Yes - */ -#include "script_component.hpp" - -params [["_reciever", objNull], ["_title", ""], ["_content", ""], ["_type", 0], ["_parameters", []]]; - -if (isPlayer _reciever) then { - if (!local _reciever) then { - [_this, QFUNC(sendDisplayMessageTo), _reciever, false] call FUNC(execRemoteFnc); - } else { - if (isLocalized _title) then { - _title = localize _title; - }; - - if (isLocalized _content) then { - _content = localize _content; - }; - - private "_localizationArray"; - _localizationArray = [_title]; - - { - _localizationArray pushBack _x; - false - } count _parameters; - - _title = format _localizationArray; - - _localizationArray = [_content]; - - { - _localizationArray pushBack _x; - false - } count _parameters; - - _content = format _localizationArray; - - [_title, _content, _type] call FUNC(displayMessage); - }; -}; diff --git a/addons/common/functions/fnc_timePFH.sqf b/addons/common/functions/fnc_timePFH.sqf index 4f099ea68c..152eceee3f 100644 --- a/addons/common/functions/fnc_timePFH.sqf +++ b/addons/common/functions/fnc_timePFH.sqf @@ -1,26 +1,26 @@ /* - * Author: ? - * ? + * Author: jaynus + * PFEH to set all Ace Time Variables * * Arguments: - * ? + * None * * Return Value: - * ? + * None * - * Public: ? + * Public: No */ #include "script_component.hpp" -private ["_lastTickTime", "_lastGameTime", "_delta"]; +BEGIN_COUNTER(timePFH); -_lastTickTime = ACE_diagTime; -_lastGameTime = ACE_gameTime; +local _lastTickTime = ACE_diagTime; +local _lastGameTime = ACE_gameTime; ACE_gameTime = time; ACE_diagTime = diag_tickTime; -_delta = ACE_diagTime - _lastTickTime; +local _delta = ACE_diagTime - _lastTickTime; if (ACE_gameTime <= _lastGameTime) then { TRACE_1("paused",_delta); @@ -36,3 +36,5 @@ if (ACE_gameTime <= _lastGameTime) then { ACE_virtualTime = ACE_virtualTime + (_delta * accTime); ACE_time = ACE_virtualTime; }; + +END_COUNTER(timePFH); diff --git a/addons/concertina_wire/XEH_init.sqf b/addons/concertina_wire/XEH_init.sqf index dbce4a9b92..dc6424f172 100644 --- a/addons/concertina_wire/XEH_init.sqf +++ b/addons/concertina_wire/XEH_init.sqf @@ -1,4 +1,3 @@ #include "script_component.hpp" - -PARAMS_1(_wire); -_wire addEventHandler ["HandleDamage", {_this call FUNC(handleDamage)}]; \ No newline at end of file +params ["_wire"]; +_wire addEventHandler ["HandleDamage", FUNC(handleDamage)]; diff --git a/addons/concertina_wire/functions/fnc_deploy.sqf b/addons/concertina_wire/functions/fnc_deploy.sqf index 5548cad649..aedc8b9608 100644 --- a/addons/concertina_wire/functions/fnc_deploy.sqf +++ b/addons/concertina_wire/functions/fnc_deploy.sqf @@ -8,10 +8,9 @@ * 1: unit * * Return Value: - * Nothing - * - * Return value: * None + * + * Public: No */ #include "script_component.hpp" @@ -22,7 +21,7 @@ private ["_wireNoGeo", "_dir", "_pos", "_wireNoGeoPos"]; _wireNoGeo = "ACE_ConcertinaWireNoGeo" createVehicle [0,0,0]; { _wireNoGeo animate [_x, 1]; -} foreach WIRE_FAST; +} count WIRE_FAST; GVAR(placer) = _unit; _dir = getDir _unit; @@ -37,8 +36,9 @@ deleteVehicle _wirecoil; _unit setVariable [QGVAR(wireDeployed), false]; GVAR(deployPFH) = [{ - EXPLODE_3_PVT(_this select 0,_wireNoGeo,_wireNoGeoPos,_unit); - + params ["_args", "_idPFH"]; + _args params ["_wireNoGeo", "_wireNoGeoPos", "_unit"]; + private ["_range", "_posStart", "_posEnd", "_dirVect", "_dir", "_anim", "_wire"]; _posStart = (_wireNoGeo modelToWorldVisual (_wireNoGeo selectionPosition "start")) call EFUNC(common,positionToASL); _posEnd = (getPosASL _unit) vectorAdd (vectorDir _unit); @@ -46,37 +46,38 @@ GVAR(deployPFH) = [{ _dir = _dirVect call CBA_fnc_vectDir; _range = vectorMagnitude _dirVect; _anim = 0 max (1 - (_range / 12)); - + if (!(alive _unit) || _range >= 12 || (_unit getVariable [QGVAR(wireDeployed), false])) exitWith { _wire = "ACE_ConcertinaWire" createvehicle [0, 0, 0]; { _wire animate [_x, _anim]; - } foreach WIRE_FAST; - + } count WIRE_FAST; + [{ - EXPLODE_5_PVT(_this select 0,_wireNoGeo,_wire,_anim,_dir,_wireNoGeoPos); + params ["_args", "_idPFH"]; + _args params ["_wireNoGeo", "_wire", "_anim", "_dir", "_wireNoGeoPos"]; if (_wire animationPhase "wire_2" == _anim) then { deleteVehicle _wireNoGeo; _wire setDir _dir; _wire setPosASL _wireNoGeoPos; - [_this select 1] call CBA_fnc_removePerFrameHandler; + [_idPFH] call CBA_fnc_removePerFrameHandler; }; }, 0, [_wireNoGeo, _wire, _anim, _dir, _wireNoGeoPos]] call CBA_fnc_addPerFrameHandler; - + [_unit, "DefaultAction", _unit getVariable [QGVAR(Deploy), -1]] call EFUNC(Common,removeActionEventHandler); call EFUNC(interaction,hideMouseHint); - - [_this select 1] call CBA_fnc_removePerFrameHandler; + + [_idPFH] call CBA_fnc_removePerFrameHandler; }; - + _wireNoGeo setDir _dir; { _wireNoGeo animate [_x, _anim]; - } foreach WIRE_FAST; + } count WIRE_FAST; }, 0, [_wireNoGeo, _wireNoGeoPos, _unit]] call CBA_fnc_addPerFrameHandler; [localize "STR_ACE_ROLLWIRE", "", ""] call EFUNC(interaction,showMouseHint); - + GVAR(placer) setVariable [QGVAR(Deploy), [GVAR(placer), "DefaultAction", {GVAR(deployPFH) != -1}, diff --git a/addons/concertina_wire/functions/fnc_dismount.sqf b/addons/concertina_wire/functions/fnc_dismount.sqf index c9a5d1f9ff..c7ba3f50b1 100644 --- a/addons/concertina_wire/functions/fnc_dismount.sqf +++ b/addons/concertina_wire/functions/fnc_dismount.sqf @@ -8,10 +8,9 @@ * 1: unit * * Return Value: - * Nothing - * - * Return value: * None + * + * Public: No */ #include "script_component.hpp" @@ -21,8 +20,7 @@ if (uiNamespace getVariable [QEGVAR(interact_menu,cursorMenuOpened),false]) exit _this call FUNC(dismount); }, _this] call EFUNC(common,execNextFrame); }; - -PARAMS_2(_wire,_unit); +params ["_wire", "_unit"]; private ["_config", "_delay"]; _config = (configFile >> "CfgVehicles" >> typeOf _unit); diff --git a/addons/concertina_wire/functions/fnc_dismountSuccess.sqf b/addons/concertina_wire/functions/fnc_dismountSuccess.sqf index a6e34fe44f..a3f5081271 100644 --- a/addons/concertina_wire/functions/fnc_dismountSuccess.sqf +++ b/addons/concertina_wire/functions/fnc_dismountSuccess.sqf @@ -7,10 +7,9 @@ * 0: wire * * Return Value: - * Nothing - * - * Return value: * None + * + * Public: No */ #include "script_component.hpp" @@ -18,25 +17,26 @@ PARAMS_1(_wire); { _wire animate [_x, 1]; -} foreach WIRE_FAST; +} count WIRE_FAST; [{ - EXPLODE_1_PVT(_this select 0,_wire); - + params ["_args", "_idPFH"]; + _args params ["_wire"]; + if (_wire animationPhase "wire_2" == 1) then { private ["_dir", "_pos", "_wirecoil"]; - + _dir = getDir _wire; _pos = getPosASL _wire; - + _wirecoil = "ACE_ConcertinaWireCoil" createvehicle [0, 0, 0]; deleteVehicle _wire; - + _wirecoil setDir _dir; _wirecoil setPosASL _pos; _wirecoil setVelocity [0, 0, 0]; - - [_this select 1] call CBA_fnc_removePerFrameHandler; + + [_idPFH] call CBA_fnc_removePerFrameHandler; }; }, 0, [_wire]] call CBA_fnc_addPerFrameHandler; diff --git a/addons/concertina_wire/functions/fnc_handleDamage.sqf b/addons/concertina_wire/functions/fnc_handleDamage.sqf index 61cd1c4e7c..43a04641dd 100644 --- a/addons/concertina_wire/functions/fnc_handleDamage.sqf +++ b/addons/concertina_wire/functions/fnc_handleDamage.sqf @@ -11,15 +11,12 @@ * 4: projectile * * Return Value: - * Nothing - * - * Return value: * None + * + * Public: No */ #include "script_component.hpp" - -PARAMS_5(_wire,_selectionName,_damage,_source,_projectile); - +params ["_wire", "", "_damage", "_source", ""]; if (_damage < 0.5) exitWith { 0 }; if (!(isNull _source)) then { diff --git a/addons/concertina_wire/functions/fnc_handleKilled.sqf b/addons/concertina_wire/functions/fnc_handleKilled.sqf index f5f84a6afa..ac59798d10 100644 --- a/addons/concertina_wire/functions/fnc_handleKilled.sqf +++ b/addons/concertina_wire/functions/fnc_handleKilled.sqf @@ -8,14 +8,12 @@ * 1: killer (vehicle) * * Return Value: - * Nothing - * - * Return value: * None + * + * Public: No */ #include "script_component.hpp" - -PARAMS_2(_wire,_killer); +params ["_wire", "_killer"]; private ["_distance", "_vehicle"]; diff --git a/addons/concertina_wire/functions/fnc_vehicleDamage.sqf b/addons/concertina_wire/functions/fnc_vehicleDamage.sqf index e7dff30000..41050eb9b9 100644 --- a/addons/concertina_wire/functions/fnc_vehicleDamage.sqf +++ b/addons/concertina_wire/functions/fnc_vehicleDamage.sqf @@ -7,14 +7,12 @@ * 1: vehicle * * Return Value: - * Nothing - * - * Return value: * None + * + * Public: No */ #include "script_component.hpp" - -PARAMS_2(_wire,_vehicle); +params ["_wire", "_vehicle"]; private ["_type", "_mode", "_anim", "_parts", "_selectionPart", "_selection", "_pos_w", "_dir_w"]; @@ -43,8 +41,8 @@ _dir_w = getDir _wire; if (_mode == 0) then { private ["_x", "_y", "_found", "_wireCheckPosAr", "_no"]; - _x = _pos_w select 0; - _y = _pos_w select 1; + _pos_w params ["_x","_y"]; + // Check if two Single coils are placed next to each other (i.e playes have built a big wire obstacle) _wireCheckPosAr = [ [_x + (sin (_dir_w+90) * 1.5),_y + (cos (_dir_w+90) * 1.5)], diff --git a/addons/dragging/CfgEventHandlers.hpp b/addons/dragging/CfgEventHandlers.hpp index 7276bc4284..6a64491e00 100644 --- a/addons/dragging/CfgEventHandlers.hpp +++ b/addons/dragging/CfgEventHandlers.hpp @@ -22,12 +22,7 @@ class Extended_Init_EventHandlers { init = QUOTE(_this call DFUNC(initObject)); }; }; - class ReammoBox_F { - class ADDON { - init = QUOTE(_this call DFUNC(initObject)); - }; - }; - class ACE_RepairItem_Base { + class ThingX { class ADDON { init = QUOTE(_this call DFUNC(initObject)); }; diff --git a/addons/kestrel4500/XEH_preInit.sqf b/addons/kestrel4500/XEH_preInit.sqf index 7b36167a16..b3f8ba755f 100644 --- a/addons/kestrel4500/XEH_preInit.sqf +++ b/addons/kestrel4500/XEH_preInit.sqf @@ -15,5 +15,6 @@ PREP(restoreUserData); PREP(storeUserData); PREP(updateDisplay); PREP(updateImpellerState); - +PREP(updateMemory); +PREP(dayOfWeek); ADDON = true; diff --git a/addons/kestrel4500/functions/fnc_buttonPressed.sqf b/addons/kestrel4500/functions/fnc_buttonPressed.sqf index 8f38568462..83c471092a 100644 --- a/addons/kestrel4500/functions/fnc_buttonPressed.sqf +++ b/addons/kestrel4500/functions/fnc_buttonPressed.sqf @@ -3,10 +3,10 @@ * Handles the Kestrel 4500 dialog button actions * * Arguments: - * buttonID + * button ID * * Return Value: - * Nothing + * None * * Example: * 2 call ace_kestrel4500_fnc_buttonPressed diff --git a/addons/kestrel4500/functions/fnc_canShow.sqf b/addons/kestrel4500/functions/fnc_canShow.sqf index 0c9e29f9bc..f563138f5c 100644 --- a/addons/kestrel4500/functions/fnc_canShow.sqf +++ b/addons/kestrel4500/functions/fnc_canShow.sqf @@ -3,13 +3,13 @@ * Tests if the Kestrel 4500 can be shown * * Arguments: - * Nothing + * None * * Return Value: - * canShow (bool) + * canShow * * Example: - * [mode] call ace_kestrel4500_fnc_canShow + * call ace_kestrel4500_fnc_canShow * * Public: No */ diff --git a/addons/kestrel4500/functions/fnc_collectData.sqf b/addons/kestrel4500/functions/fnc_collectData.sqf index 244e719b37..2e25fbcf60 100644 --- a/addons/kestrel4500/functions/fnc_collectData.sqf +++ b/addons/kestrel4500/functions/fnc_collectData.sqf @@ -3,18 +3,19 @@ * Gathers the weather data for the Kestrel 4500 * * Arguments: - * Nothing + * None * * Return Value: - * Nothing + * None * * Example: + * call ace_kestrel4500_fnc_collectData * * Public: No */ #include "script_component.hpp" -private ["_playerDir", "_playerAltitude", "_temperature", "_humidity", "_barometricPressure", "_altitude", "_airDensity", "_densityAltitude", "_chill", "_heatIndex", "_dewPoint", "_wetBulb", "_fnc_updateMemory", "_windSpeed", "_crosswind", "_headwind"]; +private ["_playerDir", "_playerAltitude", "_temperature", "_humidity", "_barometricPressure", "_altitude", "_airDensity", "_densityAltitude", "_chill", "_heatIndex", "_dewPoint", "_wetBulb", "_windSpeed", "_crosswind", "_headwind"]; _playerDir = getDir ACE_player; _playerAltitude = (getPosASL ACE_player) select 2; _temperature = _playerAltitude call EFUNC(weather,calculateTemperatureAtHeight); @@ -35,25 +36,19 @@ if (isNil QGVAR(MIN) || isNil QGVAR(MAX)) then { { GVAR(ENTRIES) set [_x, (GVAR(ENTRIES) select _x) + 1]; -} forEach [1, 5, 6, 7, 8, 9, 10, 11, 12, 13]; +} count [1, 5, 6, 7, 8, 9, 10, 11, 12, 13]; -_fnc_updateMemory = { - PARAMS_2(_slot,_value); - GVAR(MIN) set [_slot, (GVAR(MIN) select _slot) min _value]; - GVAR(MAX) set [_slot, _value max (GVAR(MAX) select _slot)]; - GVAR(TOTAL) set [_slot, (GVAR(TOTAL) select _slot) + _value]; -}; -[0, _playerDir] call _fnc_updateMemory; +[0, _playerDir] call FUNC(updateMemory); if (GVAR(MinAvgMaxMode) == 1) then { { GVAR(ENTRIES) set [_x, (GVAR(ENTRIES) select _x) + 1]; - } forEach [2, 3, 4]; + } count [2, 3, 4]; // Wind SPD _windSpeed = call FUNC(measureWindSpeed); - [2, _windSpeed] call _fnc_updateMemory; + [2, _windSpeed] call FUNC(updateMemory); // CROSSWIND _crosswind = 0; @@ -62,7 +57,7 @@ if (GVAR(MinAvgMaxMode) == 1) then { } else { _crosswind = abs(sin(GVAR(RefHeading)) * _windSpeed); }; - [3, _crosswind] call _fnc_updateMemory; + [3, _crosswind] call FUNC(updateMemory); // HEADWIND _headwind = 0; @@ -80,12 +75,4 @@ if (GVAR(MinAvgMaxMode) == 1) then { GVAR(TOTAL) set [4, (GVAR(TOTAL) select 4) + _headwind]; }; -[5, _temperature] call _fnc_updateMemory; -[6, _chill] call _fnc_updateMemory; -[7, _humidity] call _fnc_updateMemory; -[8, _heatIndex] call _fnc_updateMemory; -[9, _dewPoint] call _fnc_updateMemory; -[10, _wetBulb] call _fnc_updateMemory; -[11, _barometricPressure] call _fnc_updateMemory; -[12, _altitude] call _fnc_updateMemory; -[13, _densityAltitude] call _fnc_updateMemory; +{ _x call FUNC(updateMemory); true } count [[5, _temperature],[6, _chill],[7, _humidity],[8, _heatIndex],[9, _dewPoint],[10, _wetBulb],[11, _barometricPressure],[12, _altitude],[13, _densityAltitude]]; diff --git a/addons/kestrel4500/functions/fnc_createKestrelDialog.sqf b/addons/kestrel4500/functions/fnc_createKestrelDialog.sqf index 289d0825fc..a11982968c 100644 --- a/addons/kestrel4500/functions/fnc_createKestrelDialog.sqf +++ b/addons/kestrel4500/functions/fnc_createKestrelDialog.sqf @@ -3,12 +3,13 @@ * Opens the Kestrel 4500 dialog * * Arguments: - * Nothing + * None * * Return Value: - * Nothing + * None * * Example: + * call ace_kestrel4500_fnc_createKestrelDialog * * Public: No */ @@ -29,7 +30,7 @@ createDialog 'Kestrel4500_Display'; GVAR(Kestrel4500) = false; [_this select 1] call CBA_fnc_removePerFrameHandler; }; - + [] call FUNC(updateDisplay); }, 1, _this select 0] call CBA_fnc_addPerFrameHandler; diff --git a/addons/kestrel4500/functions/fnc_dayOfWeek.sqf b/addons/kestrel4500/functions/fnc_dayOfWeek.sqf new file mode 100644 index 0000000000..f63a3969b0 --- /dev/null +++ b/addons/kestrel4500/functions/fnc_dayOfWeek.sqf @@ -0,0 +1,26 @@ +/* + * Author: Ruthberg + * Calculate Current Day in the Week + * + * Arguments: + * 0: Year + * 1: Month + * 2: Day + * + * Return Value: + * Day of The Week + * + * Example: + * [1995, 10, 21] call ace_kestrel4500_fnc_buttonPressed + * + * Public: No + */ +#include "script_component.hpp" +private "_table"; +params ["_year", "_month", "_day"]; + +_table = [0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4]; +if (_month < 3) then { + _year = _year - 1; +}; +(_year + floor(_year/4) - floor(_year/100) + floor(_year/400) + (_table select (_month - 1)) + _day) % 7 diff --git a/addons/kestrel4500/functions/fnc_displayKestrel.sqf b/addons/kestrel4500/functions/fnc_displayKestrel.sqf index 679ecce6af..64d06fea1c 100644 --- a/addons/kestrel4500/functions/fnc_displayKestrel.sqf +++ b/addons/kestrel4500/functions/fnc_displayKestrel.sqf @@ -3,12 +3,13 @@ * Shows the Kestrel 4500 as rsc title * * Arguments: - * Nothing + * None * * Return Value: - * Nothing + * None * * Example: + * call ace_kestrel4500_fnc_displayKestrel * * Public: No */ @@ -50,49 +51,66 @@ if (GVAR(Kestrel4500) && dialog) then { GVAR(Overlay) = true; -[{ +[{ // abort condition if (!GVAR(Overlay) || {!(("ACE_Kestrel4500" in (uniformItems ACE_player)) || ("ACE_Kestrel4500" in (vestItems ACE_player)))}) exitWith { GVAR(Overlay) = false; 3 cutText ["", "PLAIN"]; [_this select 1] call CBA_fnc_removePerFrameHandler; }; - + if (ACE_diagTime > GVAR(updateTimer)) then { GVAR(updateTimer) = ACE_diagTime + 1; - + private ["_outputData"]; _outputData = [] call FUNC(generateOutputData); - + 3 cutRsc ["RscKestrel4500", "PLAIN", 1, false]; - - __ctrlTop ctrlSetText (_outputData select 0); - __ctrlCenterBig ctrlSetText (_outputData select 1); - - __ctrlTop ctrlSetText (_outputData select 0); - __ctrlCenterBig ctrlSetText (_outputData select 1); - __ctrlCenter ctrlSetText (_outputData select 2); - - __ctrlCenterLine1Left ctrlSetText (_outputData select 3); - __ctrlCenterLine2Left ctrlSetText (_outputData select 4); - __ctrlCenterLine3Left ctrlSetText (_outputData select 5); + _outputData params [ + "_ctrlTop", + "_ctrlCenterBig", + "_ctrlCenter", + "_ctrlCenterLine1Left", + "_ctrlCenterLine2Left", + "_ctrlCenterLine3Left", + "_ctrlCenterLine1Right", + "_ctrlCenterLine2Right", + "_ctrlCenterLine3Right", + "_ctrlInfoLine1", + "_ctrlInfoLine2", + "_ctrlBottomBig", + "_ctrlCenterLine1", + "_ctrlCenterLine2", + "_ctrlCenterLine3", + "_ctrlCenterLine4", + "_ctrlCenterLine5", + "_ctrlCenterLine6" + ]; - __ctrlCenterLine1Right ctrlSetText (_outputData select 6); - __ctrlCenterLine2Right ctrlSetText (_outputData select 7); - __ctrlCenterLine3Right ctrlSetText (_outputData select 8); + __ctrlTop ctrlSetText _ctrlTop; + __ctrlCenterBig ctrlSetText _ctrlCenterBig; + __ctrlCenter ctrlSetText _ctrlCenter; + + __ctrlCenterLine1Left ctrlSetText _ctrlCenterLine1Left; + __ctrlCenterLine2Left ctrlSetText _ctrlCenterLine2Left; + __ctrlCenterLine3Left ctrlSetText _ctrlCenterLine3Left; + + __ctrlCenterLine1Right ctrlSetText _ctrlCenterLine1Right; + __ctrlCenterLine2Right ctrlSetText _ctrlCenterLine2Right; + __ctrlCenterLine3Right ctrlSetText _ctrlCenterLine3Right; + + __ctrlInfoLine1 ctrlSetText _ctrlInfoLine1; + __ctrlInfoLine2 ctrlSetText _ctrlInfoLine2; + + __ctrlBottomBig ctrlSetText _ctrlBottomBig; + + __ctrlCenterLine1 ctrlSetText _ctrlCenterLine1; + __ctrlCenterLine2 ctrlSetText _ctrlCenterLine2; + __ctrlCenterLine3 ctrlSetText _ctrlCenterLine3; + __ctrlCenterLine4 ctrlSetText _ctrlCenterLine4; + __ctrlCenterLine5 ctrlSetText _ctrlCenterLine5; + __ctrlCenterLine6 ctrlSetText _ctrlCenterLine6; - __ctrlInfoLine1 ctrlSetText (_outputData select 9); - __ctrlInfoLine2 ctrlSetText (_outputData select 10); - - __ctrlBottomBig ctrlSetText (_outputData select 11); - - __ctrlCenterLine1 ctrlSetText (_outputData select 12); - __ctrlCenterLine2 ctrlSetText (_outputData select 13); - __ctrlCenterLine3 ctrlSetText (_outputData select 14); - __ctrlCenterLine4 ctrlSetText (_outputData select 15); - __ctrlCenterLine5 ctrlSetText (_outputData select 16); - __ctrlCenterLine6 ctrlSetText (_outputData select 17); - if (GVAR(referenceHeadingMenu) == 1) then { if (GVAR(referenceHeadingAutoSet)) then { __ctrlCenterLine3 ctrlSetTextColor [0, 0, 0, 0.6]; @@ -106,10 +124,10 @@ GVAR(Overlay) = true; __ctrlCenterLine4 ctrlSetTextColor [0, 0, 0, 1.0]; }; }; - + call FUNC(updateImpellerState); __ctrlKestrel4500 ctrlSetText format [QUOTE(PATHTOF(UI\Kestrel4500_%1.paa)), floor(GVAR(ImpellerState) % 7)]; - + }, 0.01, []] call CBA_fnc_addPerFrameHandler; true diff --git a/addons/kestrel4500/functions/fnc_generateOutputData.sqf b/addons/kestrel4500/functions/fnc_generateOutputData.sqf index d61a1f48e4..016baebef7 100644 --- a/addons/kestrel4500/functions/fnc_generateOutputData.sqf +++ b/addons/kestrel4500/functions/fnc_generateOutputData.sqf @@ -3,12 +3,29 @@ * Generates the Kestrel 4500 output text. * * Arguments: - * Nothing + * None * * Return Value: - * [top , centerBig , CenterLine1Left , CenterLine2Left , CenterLine3Left , CenterLine1Right , CenterLine2Right , CenterLine3Right , InfoLine1 , InfoLine2 ] + * 0: top + * 1: centerBig + * 2: CenterLine1Left + * 3: CenterLine2Left + * 4: CenterLine3Left + * 5: CenterLine1Right + * 6: CenterLine2Right + * 7: CenterLine3Right + * 8: InfoLine1 + * 9: InfoLine2 + * 10: Bottom Big + * 11: Center Line 1 + * 11: Center Line 2 + * 12: Center Line 3 + * 13: Center Line 4 + * 14: Center Line 5 + * 15: Center Line 6 * * Example: + * _var = call ace_kestrel4500_fnc_generateOutputData * * Public: No */ @@ -16,7 +33,7 @@ if (ACE_diagTime - GVAR(headingSetDisplayTimer) < 0.8) exitWith {["", "", " Heading Set", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""]}; -private ["_playerDir", "_playerAltitude", "_temperature", "_humidity", "_barometricPressure", "_airDensity", "_densityAltitude", "_chill", "_heatIndex", "_dewPoint", "_wetBulb", "_fnc_dayOfWeek", "_dayString", "_monthString", "_windSpeed", "_windDir", "_textTop", "_textCenterBig", "_textCenter", "_textCenterLine1Left", "_textCenterLine2Left", "_textCenterLine3Left", "_textCenterLine1Right", "_textCenterLine2Right", "_textCenterLine3Right", "_textInfoLine1", "_textInfoLine2", "_textBottomBig", "_textCenterLine1", "_textCenterLine2", "_textCenterLine3", "_textCenterLine4", "_textCenterLine5", "_textCenterLine6"]; +private ["_playerDir", "_playerAltitude", "_temperature", "_humidity", "_barometricPressure", "_airDensity", "_densityAltitude", "_chill", "_heatIndex", "_dewPoint", "_wetBulb", "_dayString", "_monthString", "_windSpeed", "_windDir", "_textTop", "_textCenterBig", "_textCenter", "_textCenterLine1Left", "_textCenterLine2Left", "_textCenterLine3Left", "_textCenterLine1Right", "_textCenterLine2Right", "_textCenterLine3Right", "_textInfoLine1", "_textInfoLine2", "_textBottomBig", "_textCenterLine1", "_textCenterLine2", "_textCenterLine3", "_textCenterLine4", "_textCenterLine5", "_textCenterLine6"]; [] call FUNC(collectData); @@ -59,19 +76,6 @@ _heatIndex = [_temperature, _humidity] call EFUNC(weather,calculateHeatIndex); _dewPoint = [_temperature, _humidity] call EFUNC(weather,calculateDewPoint); _wetBulb = [_temperature, _barometricPressure, _humidity] call EFUNC(weather,calculateWetBulb); -_fnc_dayOfWeek = { - private ["_year", "_month", "_day", "_table"]; - _year = _this select 0; - _month = _this select 1; - _day = _this select 2; - - _table = [0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4]; - if (_month < 3) then { - _year = _year - 1; - }; - (_year + floor(_year/4) - floor(_year/100) + floor(_year/400) + (_table select (_month - 1)) + _day) % 7 -}; - GVAR(Direction) = 4 * floor(_playerDir / 90); if (_playerDir % 90 > 10) then { GVAR(Direction) = GVAR(Direction) + 1}; if (_playerDir % 90 > 35) then { GVAR(Direction) = GVAR(Direction) + 1}; @@ -82,8 +86,8 @@ GVAR(Direction) = GVAR(Direction) % 16; if (GVAR(referenceHeadingMenu) == 0) then { switch (GVAR(Menu)) do { case 0: { // Date - EXPLODE_3_PVT(date,_year,_month,_day); - _dayString = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"] select (date call _fnc_dayOfWeek); + date params ["_year", "_month", "_day"]; + _dayString = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"] select (date call FUNC(dayOfWeek)); _monthString = localize (["str_january","str_february","str_march","str_april","str_may","str_june","str_july","str_august","str_september","str_october","str_november","str_december"] select (_month - 1)); _textTop = _dayString; _textCenter = format["%1 %2 %3", _day, _monthString, _year]; diff --git a/addons/kestrel4500/functions/fnc_measureWindSpeed.sqf b/addons/kestrel4500/functions/fnc_measureWindSpeed.sqf index 73b4e228d6..2a8a4bbbb3 100644 --- a/addons/kestrel4500/functions/fnc_measureWindSpeed.sqf +++ b/addons/kestrel4500/functions/fnc_measureWindSpeed.sqf @@ -3,12 +3,13 @@ * Measures the wind speed, stores the information in GVAR(MeasuredWindSpeed) and updates GVAR(ImpellerState) * * Arguments: - * Nothing + * None * * Return Value: * wind speed * * Example: + * call ace_kestrel4500_fnc_canShow * * Public: No */ diff --git a/addons/kestrel4500/functions/fnc_onCloseDialog.sqf b/addons/kestrel4500/functions/fnc_onCloseDialog.sqf index a45a9decc3..2474f30d94 100644 --- a/addons/kestrel4500/functions/fnc_onCloseDialog.sqf +++ b/addons/kestrel4500/functions/fnc_onCloseDialog.sqf @@ -1,3 +1,18 @@ +/* + * Author: Ruthberg + * Called if Kestrel Dialog is closed + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * call ace_kestrel4500_fnc_onCloseDialog + * + * Public: No + */ #include "script_component.hpp" uiNamespace setVariable ['Kestrel4500_Display', nil]; diff --git a/addons/kestrel4500/functions/fnc_onCloseDisplay.sqf b/addons/kestrel4500/functions/fnc_onCloseDisplay.sqf index efb60b322a..bdc701ddb1 100644 --- a/addons/kestrel4500/functions/fnc_onCloseDisplay.sqf +++ b/addons/kestrel4500/functions/fnc_onCloseDisplay.sqf @@ -1,3 +1,18 @@ +/* + * Author: Ruthberg + * Called if Kestrel Display is closed + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * call ace_kestrel4500_fnc_onCloseDisplay + * + * Public: No + */ #include "script_component.hpp" uiNamespace setVariable ['RscKestrel4500', nil]; diff --git a/addons/kestrel4500/functions/fnc_restoreUserData.sqf b/addons/kestrel4500/functions/fnc_restoreUserData.sqf index 0ce463ad67..c1d9c0ebb3 100644 --- a/addons/kestrel4500/functions/fnc_restoreUserData.sqf +++ b/addons/kestrel4500/functions/fnc_restoreUserData.sqf @@ -6,7 +6,7 @@ * Nothing * * Return Value: - * Nothing + * None * * Example: * call ace_kestrel4500_fnc_restore_user_data diff --git a/addons/kestrel4500/functions/fnc_storeUserData.sqf b/addons/kestrel4500/functions/fnc_storeUserData.sqf index a5d069b31d..80fa219a3c 100644 --- a/addons/kestrel4500/functions/fnc_storeUserData.sqf +++ b/addons/kestrel4500/functions/fnc_storeUserData.sqf @@ -3,10 +3,10 @@ * Saves user data into profileNamespace * * Arguments: - * Nothing + * None * * Return Value: - * Nothing + * None * * Example: * call ace_kestrel4500_fnc_store_user_data diff --git a/addons/kestrel4500/functions/fnc_updateDisplay.sqf b/addons/kestrel4500/functions/fnc_updateDisplay.sqf index 90f77f5f6a..e63b18bcfc 100644 --- a/addons/kestrel4500/functions/fnc_updateDisplay.sqf +++ b/addons/kestrel4500/functions/fnc_updateDisplay.sqf @@ -3,10 +3,10 @@ * Updates the Kestrel 4500 dialog text boxes. * * Arguments: - * Nothing + * None * * Return Value: - * Nothing + * None * * Example: * @@ -22,29 +22,9 @@ private ["_outputData"]; _outputData = [] call FUNC(generateOutputData); -ctrlSetText [74100, _outputData select 0]; -ctrlSetText [74200, _outputData select 1]; -ctrlSetText [74201, _outputData select 2]; - -ctrlSetText [74300, _outputData select 3]; -ctrlSetText [74301, _outputData select 4]; -ctrlSetText [74302, _outputData select 5]; - -ctrlSetText [74303, _outputData select 6]; -ctrlSetText [74304, _outputData select 7]; -ctrlSetText [74305, _outputData select 8]; - -ctrlSetText [74400, _outputData select 9]; -ctrlSetText [74401, _outputData select 10]; - -ctrlSetText [74500, _outputData select 11]; - -ctrlSetText [74600, _outputData select 12]; -ctrlSetText [74601, _outputData select 13]; -ctrlSetText [74602, _outputData select 14]; -ctrlSetText [74603, _outputData select 15]; -ctrlSetText [74604, _outputData select 16]; -ctrlSetText [74605, _outputData select 17]; +{ + ctrlSetText [_x , _outputData select _foreachindex]; +} forEach [74100, 74200, 74201, 74300, 74301, 74302, 74303, 74304, 74305, 74400, 74401, 74500, 74600, 74601, 74602, 74603, 74604, 74605]; if (GVAR(referenceHeadingMenu) == 1) then { if (GVAR(referenceHeadingAutoSet)) then { diff --git a/addons/kestrel4500/functions/fnc_updateImpellerState.sqf b/addons/kestrel4500/functions/fnc_updateImpellerState.sqf index 075ed80080..75a0d10f4c 100644 --- a/addons/kestrel4500/functions/fnc_updateImpellerState.sqf +++ b/addons/kestrel4500/functions/fnc_updateImpellerState.sqf @@ -3,10 +3,10 @@ * Updates the Kestrel 4500 Impeller state * * Arguments: - * Nothing + * None * * Return Value: - * Nothing + * None * * Example: * diff --git a/addons/kestrel4500/functions/fnc_updateMemory.sqf b/addons/kestrel4500/functions/fnc_updateMemory.sqf new file mode 100644 index 0000000000..c393aee14f --- /dev/null +++ b/addons/kestrel4500/functions/fnc_updateMemory.sqf @@ -0,0 +1,21 @@ +/* + * Author: Ruthberg + * Update Memory of Kestrel + * + * Arguments: + * 0: Slot + * 1: Value + * + * Return Value: + * None + * + * Example: + * [1, "test"] call ace_kestrel4500_fnc_updateMemory + * + * Public: No + */ +#include "script_component.hpp" +params ["_slot", "_value"]; +GVAR(MIN) set [_slot, (GVAR(MIN) select _slot) min _value]; +GVAR(MAX) set [_slot, _value max (GVAR(MAX) select _slot)]; +GVAR(TOTAL) set [_slot, (GVAR(TOTAL) select _slot) + _value]; diff --git a/addons/kestrel4500/functions/script_component.hpp b/addons/kestrel4500/functions/script_component.hpp index 32c774cd89..bc42218de7 100644 --- a/addons/kestrel4500/functions/script_component.hpp +++ b/addons/kestrel4500/functions/script_component.hpp @@ -1 +1 @@ -#include "\z\ace\addons\kestrel4500\script_component.hpp" \ No newline at end of file +#include "\z\ace\addons\kestrel4500\script_component.hpp" diff --git a/addons/laser_selfdesignate/CfgWeapons.hpp b/addons/laser_selfdesignate/CfgWeapons.hpp index a62974ce40..70e1afde88 100644 --- a/addons/laser_selfdesignate/CfgWeapons.hpp +++ b/addons/laser_selfdesignate/CfgWeapons.hpp @@ -2,7 +2,7 @@ class CfgWeapons { // Disable locking unless newb mode class LauncherCore; class RocketPods: LauncherCore { - canLock = 1; + // canLock = 1; }; class missiles_DAGR: RocketPods { diff --git a/addons/map/ACE_Settings.hpp b/addons/map/ACE_Settings.hpp index 4e2a5d5706..c0d2718c1f 100644 --- a/addons/map/ACE_Settings.hpp +++ b/addons/map/ACE_Settings.hpp @@ -2,33 +2,55 @@ class ACE_Settings { class GVAR(BFT_Interval) { value = 1.0; typeName = "SCALAR"; + displayName = CSTRING(BFT_Interval_DisplayName); + description = CSTRING(BFT_Interval_Description); }; class GVAR(BFT_Enabled) { value = 0; typeName = "BOOL"; + displayName = CSTRING(BFT_Enabled_DisplayName); + description = CSTRING(BFT_Enabled_Description); }; class GVAR(BFT_HideAiGroups) { value = 0; typeName = "BOOL"; + displayName = CSTRING(BFT_HideAiGroups_DisplayName); + description = CSTRING(BFT_HideAiGroups_Description); }; class GVAR(mapIllumination) { value = 1; typeName = "BOOL"; + displayName = CSTRING(MapIllumination_DisplayName); + description = CSTRING(MapIllumination_Description); }; class GVAR(mapGlow) { value = 1; typeName = "BOOL"; + displayName = CSTRING(MapGlow_DisplayName); + description = CSTRING(MapGlow_Description); }; class GVAR(mapShake) { value = 1; typeName = "BOOL"; + displayName = CSTRING(MapShake_DisplayName); + description = CSTRING(MapShake_Description); }; class GVAR(mapLimitZoom) { value = 0; typeName = "BOOL"; + displayName = CSTRING(MapLimitZoom_DisplayName); + description = CSTRING(MapLimitZoom_Description); }; class GVAR(mapShowCursorCoordinates) { value = 0; typeName = "BOOL"; + displayName = CSTRING(MapShowCursorCoordinates_DisplayName); + description = CSTRING(MapShowCursorCoordinates_Description); + }; + class GVAR(DefaultChannel) { + value = -1; + typeName = "SCALAR"; + displayName = CSTRING(DefaultChannel_DisplayName); + description = CSTRING(DefaultChannel_Description); }; }; diff --git a/addons/map/CfgVehicles.hpp b/addons/map/CfgVehicles.hpp index 560453b416..7906de8bb7 100644 --- a/addons/map/CfgVehicles.hpp +++ b/addons/map/CfgVehicles.hpp @@ -55,6 +55,20 @@ class CfgVehicles { typeName = "BOOL"; defaultValue = 0; }; + class DefaultChannel { + displayName = CSTRING(DefaultChannel_DisplayName); + description = CSTRING(DefaultChannel_Description); + typeName = "NUMBER"; + class values { + class disable {name = ECSTRING(common,Disabled); value = -1; default = 1;}; + class global {name = "$STR_channel_global"; value = 0;}; + class side {name = "$STR_channel_side"; value = 1;}; + class command {name = "$STR_channel_command"; value = 2;}; + class group {name = "$STR_channel_group"; value = 3;}; + class vehicle {name = "$STR_channel_vehicle"; value = 4;}; + class direct {name = "$STR_channel_direct"; value = 5;}; + }; + }; }; class ModuleDescription { description = CSTRING(Module_Description); diff --git a/addons/map/XEH_postInitClient.sqf b/addons/map/XEH_postInitClient.sqf index 02800c2540..c162f8802d 100644 --- a/addons/map/XEH_postInitClient.sqf +++ b/addons/map/XEH_postInitClient.sqf @@ -56,6 +56,21 @@ call FUNC(determineZoom); }, 0] call CBA_fnc_addPerFrameHandler; ["SettingsInitialized", { + if (isMultiplayer && {GVAR(DefaultChannel) != -1}) then { + //Set the chat channel once the map has finished loading + [{ + if ((isNull findDisplay 37) && {isNull findDisplay 52} && {isNull findDisplay 53} && {isNull findDisplay 12}) exitWith {}; + [_this select 1] call CBA_fnc_removePerFrameHandler; + + setCurrentChannel GVAR(DefaultChannel); + if (currentChannel == GVAR(DefaultChannel)) then { + // ACE_LOGINFO_1("Channel Set - %1", currentChannel); + } else { + ACE_LOGERROR_2("Failed To Set Channel %1 (is %2)", GVAR(DefaultChannel), currentChannel); + }; + }, 0, []] call CBA_fnc_addPerFrameHandler; + }; + // Start Blue Force Tracking if Enabled if (GVAR(BFT_Enabled)) then { GVAR(BFT_markers) = []; diff --git a/addons/map/functions/fnc_moduleMap.sqf b/addons/map/functions/fnc_moduleMap.sqf index b7db6996d6..605c15127e 100644 --- a/addons/map/functions/fnc_moduleMap.sqf +++ b/addons/map/functions/fnc_moduleMap.sqf @@ -13,7 +13,7 @@ if !(isServer) exitWith {}; -params ["_logic", "_units", "_activated"]; +params ["_logic", "", "_activated"]; if !(_activated) exitWith {}; @@ -22,5 +22,6 @@ if !(_activated) exitWith {}; [_logic, QGVAR(mapShake), "MapShake" ] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(mapLimitZoom), "MapLimitZoom" ] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(mapShowCursorCoordinates), "MapShowCursorCoordinates"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(DefaultChannel), "DefaultChannel" ] call EFUNC(common,readSettingFromModule); ACE_LOGINFO("Map Module Initialized."); diff --git a/addons/map/functions/fnc_simulateMapLight.sqf b/addons/map/functions/fnc_simulateMapLight.sqf index 9554409e15..ec08f14d4c 100644 --- a/addons/map/functions/fnc_simulateMapLight.sqf +++ b/addons/map/functions/fnc_simulateMapLight.sqf @@ -22,7 +22,7 @@ _hmd = hmd ACE_player; _flashlight = GVAR(flashlightInUse); //map width (on screen) in pixels -_screenSize = 640 * safeZoneW; +_screenSize = 640 * safeZoneWAbs; //resolution params (every frame in case resolution change) getResolution params ["_resX", "_resY", "_viewPortX", "_viewPortY", "", "_uiScale"]; @@ -58,7 +58,7 @@ if (_flashlight == "") then { if !(_colour in ["white", "red", "green", "blue", "yellow"]) then {_colour = "white"}; _size = getNumber (configFile >> "CfgWeapons" >> _flashlight >> "ItemInfo" >> "FlashLight" >> "ACE_Flashlight_Size"); _flashTex = format[QUOTE(PATHTOF_SYS(ace,flashlights,UI\Flashlight_Beam_%1_ca.paa)), _colour]; - _beamSize = _screenSize / _size; + _beamSize = (safeZoneW/safeZoneWAbs) * _screenSize / _size; //after 5x zoom, it's simulated to be fixed (it actually gets bigger relative to zoom) if (_mapScale < 0.2) then {_beamSize = _beamSize / (_mapScale * (1 / 0.2))}; diff --git a/addons/map/stringtable.xml b/addons/map/stringtable.xml index 8f693ef37a..0488a13493 100644 --- a/addons/map/stringtable.xml +++ b/addons/map/stringtable.xml @@ -256,5 +256,13 @@ Snížit jas Reducir brillo + + Set Channel At Start + Ust. domyślny kanał + + + Change the starting marker channel at mission start + Ustaw domyślny kanał dla markerów przy starcie misji + \ No newline at end of file diff --git a/addons/map_gestures/$PBOPREFIX$ b/addons/map_gestures/$PBOPREFIX$ new file mode 100644 index 0000000000..8672ea58f4 --- /dev/null +++ b/addons/map_gestures/$PBOPREFIX$ @@ -0,0 +1 @@ +z\ace\addons\map_gestures diff --git a/addons/map_gestures/ACE_Settings.hpp b/addons/map_gestures/ACE_Settings.hpp new file mode 100644 index 0000000000..0038027e3b --- /dev/null +++ b/addons/map_gestures/ACE_Settings.hpp @@ -0,0 +1,61 @@ +class ACE_Settings { + class GVAR(enabled) { + displayName = CSTRING(enabled_displayName); + description = CSTRING(enabled_description); + category = CSTRING(mapGestures_category); + typeName = "BOOL"; + value = 1; + }; + class GVAR(maxRange) { + displayName = CSTRING(maxRange_displayName); + description = CSTRING(maxRange_description); + category = CSTRING(mapGestures_category); + typeName = "SCALAR"; + value = 7; + }; + class GVAR(interval) { + displayName = CSTRING(interval_displayName); + description = CSTRING(interval_description); + category = CSTRING(mapGestures_category); + typeName = "SCALAR"; + value = 0.03; + }; + class GVAR(nameTextColor) { + displayName = CSTRING(nameTextColor_displayName); + description = CSTRING(nameTextColor_description); + category = CSTRING(mapGestures_category); + isClientSettable = 1; + typeName = "COLOR"; + value[] = {0.2, 0.2, 0.2, 0.3}; + }; + class GVAR(defaultLeadColor) { + displayName = CSTRING(defaultLeadColor_displayName); + description = CSTRING(defaultLeadColor_description); + category = CSTRING(mapGestures_category); + isClientSettable = 1; + typeName = "COLOR"; + value[] = {1, 0.88, 0, 0.95}; + }; + class GVAR(defaultColor) { + displayName = CSTRING(defaultColor_displayName); + description = CSTRING(defaultColor_description); + category = CSTRING(mapGestures_category); + isClientSettable = 1; + typeName = "COLOR"; + value[] = {1, 0.88, 0, 0.7}; + }; + class GVAR(GroupColorConfigurations) { + displayName = CSTRING(GroupColorConfigurations_displayName); + description = CSTRING(GroupColorConfigurations_description); + category = CSTRING(mapGestures_category); + typeName = "ARRAY"; + value[] = {}; + }; + class GVAR(GroupColorConfigurationMapping) { + displayName = CSTRING(GroupColorConfigurationMapping_displayName); + description = CSTRING(GroupColorConfigurationMapping_description); + category = CSTRING(mapGestures_category); + typeName = "ARRAY"; + value[] = {{}, {}}; + }; +}; diff --git a/addons/map_gestures/CfgEventHandlers.hpp b/addons/map_gestures/CfgEventHandlers.hpp new file mode 100644 index 0000000000..7e0c8d2ce3 --- /dev/null +++ b/addons/map_gestures/CfgEventHandlers.hpp @@ -0,0 +1,12 @@ +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preInit)); + }; +}; + +class Extended_PostInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_postInit)); + serverInit = QUOTE(call COMPILE_FILE(XEH_serverPostInit)); + }; +}; diff --git a/addons/map_gestures/CfgVehicles.hpp b/addons/map_gestures/CfgVehicles.hpp new file mode 100644 index 0000000000..f5c2ae8f38 --- /dev/null +++ b/addons/map_gestures/CfgVehicles.hpp @@ -0,0 +1,66 @@ +class CfgVehicles { + class ACE_Module; + class GVAR(moduleSettings): ACE_Module { + scope = 2; + category = "ACE"; + displayName = CSTRING(moduleSettings_displayName); + function = QFUNC(moduleSettings); + isGlobal = 0; + author = ECSTRING(common,ACETeam); + icon = PATHTOF(ui\icon_module_map_gestures_ca.paa); + class Arguments { + class enabled { + displayName = CSTRING(enabled_DisplayName); + typeName = "BOOL"; + defaultValue = 1; + }; + class maxRange { + displayName = CSTRING(maxRange_displayName); + description = CSTRING(maxRange_description); + typeName = "NUMBER"; + defaultValue = 4; + }; + class interval { + displayName = CSTRING(interval_displayName); + description = CSTRING(interval_description); + typeName = "NUMBER"; + defaultValue = 0.03; + }; + class defaultLeadColor { + displayName = CSTRING(defaultLeadColor_displayName); + description = CSTRING(defaultLeadColor_description); + typeName = "STRING"; + defaultValue = "0,0,0,0"; + }; + class defaultColor { + displayName = CSTRING(defaultColor_displayName); + description = CSTRING(defaultColor_description); + typeName = "STRING"; + defaultValue = "0,0,0,0"; + }; + }; + }; + class GVAR(moduleGroupSettings): ACE_Module { + scope = 2; + category = "ACE"; + displayName = CSTRING(moduleGroupSettings_displayName); + function = QFUNC(moduleGroupSettings); + isGlobal = 0; + author = ECSTRING(common,ACETeam); + icon = PATHTOF(ui\icon_module_map_gestures_ca.paa); + class Arguments { + class leadColor { + displayName = CSTRING(leadColor_displayName); + description = CSTRING(leadColor_description); + typeName = "STRING"; + defaultValue = "0,0,0,0"; + }; + class color { + displayName = CSTRING(color_displayName); + description = CSTRING(color_description); + typeName = "STRING"; + defaultValue = "0,0,0,0"; + }; + }; + }; +}; diff --git a/addons/map_gestures/XEH_postInit.sqf b/addons/map_gestures/XEH_postInit.sqf new file mode 100644 index 0000000000..777463e86a --- /dev/null +++ b/addons/map_gestures/XEH_postInit.sqf @@ -0,0 +1,16 @@ +#include "script_component.hpp" + +if (!hasInterface) exitWith {}; + +["SettingsInitialized", { + [{ + if (isNull (findDisplay 12)) exitWith {}; + + params ["", "_pfhId"]; + + call FUNC(receiverInit); + call FUNC(transmitterInit); + + [_pfhId] call CBA_fnc_removePerFrameHandler; + }, 1, []] call CBA_fnc_addPerFrameHandler; +}] call EFUNC(common,addEventHandler); diff --git a/addons/map_gestures/XEH_preInit.sqf b/addons/map_gestures/XEH_preInit.sqf new file mode 100644 index 0000000000..8154106fd6 --- /dev/null +++ b/addons/map_gestures/XEH_preInit.sqf @@ -0,0 +1,17 @@ +#include "script_component.hpp" + +ADDON = false; + +PREP(assignClientIDOnServer); +PREP(drawMapGestures); +PREP(endTransmit); +PREP(getProximityPlayers); +PREP(initTransmit); +PREP(isValidColorArray); +PREP(moduleGroupSettings); +PREP(moduleSettings); +PREP(receiverInit); +PREP(transmit); +PREP(transmitterInit); + +ADDON = true; diff --git a/addons/map_gestures/XEH_serverPostInit.sqf b/addons/map_gestures/XEH_serverPostInit.sqf new file mode 100644 index 0000000000..bde1cdc55b --- /dev/null +++ b/addons/map_gestures/XEH_serverPostInit.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +[EVENT_PLAYER_HAS_NO_OWNER_ID, FUNC(assignClientIDOnServer)] call EFUNC(common,addEventHandler); diff --git a/addons/map_gestures/config.cpp b/addons/map_gestures/config.cpp new file mode 100644 index 0000000000..72e7f82078 --- /dev/null +++ b/addons/map_gestures/config.cpp @@ -0,0 +1,17 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"ace_common"}; + author[] = {"Dslyecxi", "MikeMatrix"}; + authorUrl = "https://github.com/MikeMatrix"; + VERSION_CONFIG; + }; +}; + +#include "ACE_Settings.hpp" +#include "CfgEventHandlers.hpp" +#include "CfgVehicles.hpp" diff --git a/addons/map_gestures/functions/fnc_assignClientIDOnServer.sqf b/addons/map_gestures/functions/fnc_assignClientIDOnServer.sqf new file mode 100644 index 0000000000..92b1e95ab5 --- /dev/null +++ b/addons/map_gestures/functions/fnc_assignClientIDOnServer.sqf @@ -0,0 +1,24 @@ +/* + * Author: Dslyecxi, MikeMatrix + * Assign readable client ID to unit on the server. + * + * Arguments: + * 0: Unit name + * + * Return Value: + * None + * + * Example: + * ["MikeMatrix"] call ace_map_gestures_fnc_assignClientIDOnServer + * + * Public: No + */ +#include "script_component.hpp" + +params ["_unitName"]; + +{ + if (name _x == _unitName) exitWith { + _x setVariable [QGVAR(owner_id), owner _x, true]; + }; +} count playableUnits; diff --git a/addons/map_gestures/functions/fnc_drawMapGestures.sqf b/addons/map_gestures/functions/fnc_drawMapGestures.sqf new file mode 100644 index 0000000000..b369686501 --- /dev/null +++ b/addons/map_gestures/functions/fnc_drawMapGestures.sqf @@ -0,0 +1,61 @@ +/* + * Author: Dslyecxi, MikeMatrix + * Receives and draws map gestures from nearby players. + * + * Arguments: + * 0: Map Handle + * + * Return Value: + * None + * + * Example: + * [findDisplay 12 displayCtrl 51] call ace_map_gesutres_fnc_drawMapGestures + * + * Public: No + */ +#include "script_component.hpp" + +#define ICON_RENDER_SIZE 55 +#define ICON_TEXT_ALIGN "left" +#define ICON_ANGLE 0 +#define ICON_SHADOW 1 +#define TEXT_FONT "PuristaBold" +#define TEXT_ICON_RENDER_SIZE 20 +#define TEXT_SIZE 0.030 +#define TEXT_SHADOW 0 + +if (!GVAR(enabled) || !visibleMap) exitWith {}; + +private["_color", "_drawPosVariableName", "_group", "_grpName", "_pos", "_unitUID"]; + +params ["_mapHandle"]; + +// Iterate over all nearby players and render their pointer if player is transmitting. +{ + // Data variable name for unit + _unitUID = getPlayerUID _x; + _drawPosVariableName = if (!isNil "_unitUID" && _unitUID != "") then {format [QGVAR(%1_DrawPos), _unitUID]} else {nil}; + + if (!isNil "_drawPosVariableName") then { + if (isNil {missionNamespace getVariable _drawPosVariableName}) then {missionNamespace setVariable [_drawPosVariableName, [1, 1, 1]];}; + _pos = missionNamespace getVariable _drawPosVariableName; + + // Only render if the unit is alive and transmitting + if (alive _x && {_x getVariable QGVAR(Transmit)}) then { + _group = group _x; + _grpName = groupID _group; + + // If color settings for the group exist, then use those, otherwise fall back to the default colors + _color = if (HASH_HASKEY(GVAR(GroupColorConfigurationMapping),_grpName)) then { + (GVAR(GroupColorConfigurations) select (HASH_GET(GVAR(GroupColorConfigurationMapping),_grpName))) select (_x != leader _group) + } else { + if (_x == leader _group) then {GVAR(defaultLeadColor)} else {GVAR(defaultColor)}; + }; + + // Render icon and player name + _mapHandle drawIcon ["\a3\ui_f\data\gui\cfg\Hints\icon_text\group_1_ca.paa", _color, _pos, ICON_RENDER_SIZE, ICON_RENDER_SIZE, ICON_ANGLE, "", ICON_SHADOW, TEXT_SIZE, TEXT_FONT, ICON_TEXT_ALIGN]; + _mapHandle drawIcon ["#(argb,8,8,3)color(0,0,0,0)", GVAR(nameTextColor), _pos, TEXT_ICON_RENDER_SIZE, TEXT_ICON_RENDER_SIZE, ICON_ANGLE, name _x, TEXT_SHADOW, TEXT_SIZE, TEXT_FONT, ICON_TEXT_ALIGN]; + }; + }; + nil +} count ([ACE_player, GVAR(maxRange)] call FUNC(getProximityPlayers)); diff --git a/addons/map_gestures/functions/fnc_endTransmit.sqf b/addons/map_gestures/functions/fnc_endTransmit.sqf new file mode 100644 index 0000000000..fc3e0e81e1 --- /dev/null +++ b/addons/map_gestures/functions/fnc_endTransmit.sqf @@ -0,0 +1,21 @@ +/* + * Author: Dslyecxi, MikeMatrix + * Ensure that all variables used to indicate transmission are disabled. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * [] call ace_map_gestures_fnc_endTransmit + * + * Public: No + */ +#include "script_component.hpp" + +if (!GVAR(enabled)) exitWith {}; + +ACE_player setVariable [QGVAR(Transmit), false, true]; +GVAR(EnableTransmit) = false; diff --git a/addons/map_gestures/functions/fnc_getProximityPlayers.sqf b/addons/map_gestures/functions/fnc_getProximityPlayers.sqf new file mode 100644 index 0000000000..dded0b1273 --- /dev/null +++ b/addons/map_gestures/functions/fnc_getProximityPlayers.sqf @@ -0,0 +1,26 @@ +/* + * Author: Dslyecxi, MikeMatrix + * Returns all players in a given range and in the units vehicle. + * + * Arguments: + * 0: Unit + * 1: Range + * + * Return Value: + * All units in proximity + * + * Example: + * ["example value"] call ace_module_fnc_functionName + * + * Public: No + */ +#include "script_component.hpp" + +private "_proximityPlayers"; + +params ["_unit", "_range"]; + +_proximityPlayers = (getPos _unit) nearEntities [["CAMAnBase"], _range]; +_proximityPlayers deleteAt (_proximityPlayers find _unit); +_proximityPlayers append (crew vehicle _unit); +_proximityPlayers diff --git a/addons/map_gestures/functions/fnc_initTransmit.sqf b/addons/map_gestures/functions/fnc_initTransmit.sqf new file mode 100644 index 0000000000..604bf9e233 --- /dev/null +++ b/addons/map_gestures/functions/fnc_initTransmit.sqf @@ -0,0 +1,21 @@ +/* + * Author: Dslyecxi, MikeMatrix + * Initializes transmitting map gestures. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * [] call ace_map_gestures_fnc_initTransmit + * + * Public: No + */ +#include "script_component.hpp" + +if (!GVAR(enabled)) exitWith {}; + +GVAR(EnableTransmit) = true; +[FUNC(transmit), GVAR(interval), []] call CBA_fnc_addPerFrameHandler; diff --git a/addons/map_gestures/functions/fnc_isValidColorArray.sqf b/addons/map_gestures/functions/fnc_isValidColorArray.sqf new file mode 100644 index 0000000000..809bbaf117 --- /dev/null +++ b/addons/map_gestures/functions/fnc_isValidColorArray.sqf @@ -0,0 +1,30 @@ +/* + * Author: MikeMatrix + * Validate if an array is in the propper color format. + * + * Arguments: + * 0: Color Array + * + * Return Value: + * Is valid Color Array + * + * Example: + * [[1, 0.2, 1, 0.5]] call ace_map_gestures_fnc_isValidColorArray + * + * Public: No + */ +#include "script_component.hpp" + +scopeName "main"; + +params ["_colorArray"]; + +if (isNil "_colorArray") exitWith {false}; +if ((typeName _colorArray) != "ARRAY") exitWith {false}; +if (count _colorArray != 4) exitWith {false}; + +{ + if ((typeName _x) != "SCALAR" || _x < 0 || _x > 1) exitWith {false breakOut "main"}; +} count _colorArray; + +true diff --git a/addons/map_gestures/functions/fnc_moduleGroupSettings.sqf b/addons/map_gestures/functions/fnc_moduleGroupSettings.sqf new file mode 100644 index 0000000000..9c21bf867d --- /dev/null +++ b/addons/map_gestures/functions/fnc_moduleGroupSettings.sqf @@ -0,0 +1,45 @@ +/* + * Author: Dslyecxi, MikeMatrix + * Initializes Settings for the groups modules and transcodes settings to a useable format. + * + * Arguments: + * 0: Logic + * 1: Units + * 2: Activated + * + * Return Value: + * None + * + * Example: + * [module, [player], true] call ace_map_gestures_fnc_moduleGroupSettings + * + * Public: No + */ +#include "script_component.hpp" + +private ["_color", "_configurationGroupMappings", "_configurationIndex", "_configurations", "_leadColor"]; + +params ["_logic", "_units", "_activated"]; + +if (!_activated || !isServer) exitWith {}; + +// Transcode string setting into usable array. Example: "1,1,1,1" -> [1, 1, 1, 1] +_leadColor = call compile ("[" + (_logic getVariable ["leadColor", ""]) + "]"); +if (!([_leadColor] call FUNC(isValidColorArray))) exitWith {ERROR("leadColor is not a valid color array.")}; +_color = call compile ("[" + (_logic getVariable ["color", ""]) + "]"); +if (!([_color] call FUNC(isValidColorArray))) exitWith {ERROR("color is not a valid color array.")}; + +// If we already have color configurations from another source, use those, otherwise use default. +_configurations = if (isNil QGVAR(GroupColorConfigurations)) then { [] } else { +GVAR(GroupColorConfigurations) }; +_configurationGroupMappings = if(isNil QGVAR(GroupColorConfigurationMapping)) then { HASH_CREATE } else { +GVAR(GroupColorConfigurationMapping) }; + +// Save custom color configuration and keep the index of the entry. +_configurationIndex = _configurations pushBack [_leadColor, _color]; + +// Add all synchronized groups and reference custom configuration for them +{ + HASH_SET(_configurationGroupMappings,groupID (group _x),_configurationIndex); +} count _units; + +[QGVAR(GroupColorConfigurations), _configurations, false, true] call EFUNC(common,setSetting); +[QGVAR(GroupColorConfigurationMapping), _configurationGroupMappings, false, true] call EFUNC(common,setSetting); diff --git a/addons/map_gestures/functions/fnc_moduleSettings.sqf b/addons/map_gestures/functions/fnc_moduleSettings.sqf new file mode 100644 index 0000000000..99583074fc --- /dev/null +++ b/addons/map_gestures/functions/fnc_moduleSettings.sqf @@ -0,0 +1,37 @@ +/* + * Author: Dslyecxi, MikeMatrix + * Initializes Settings for the module and transcodes settings to a useable format. + * + * Arguments: + * 0: Logic + * 1: Units + * 2: Activated + * + * Return Value: + * None + * + * Example: + * [module, [player], true] call ace_map_gestures_fnc_moduleGroupSettings + * + * Public: No + */ +#include "script_component.hpp" + +private ["_defaultColor", "_defaultLeadColor"]; + +params ["_logic", "", "_activated"]; + +if (!_activated || !isServer) exitWith {}; + +[_logic, QGVAR(enabled), "enabled"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(maxRange), "maxRange"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(interval), "interval"] call EFUNC(common,readSettingFromModule); + +_defaultLeadColor = call compile ("[" + (_logic getVariable ["defaultLeadColor", ""]) + "]"); +if (!([_defaultLeadColor] call FUNC(isValidColorArray))) exitWith {ERROR("defaultLeadColor is not a valid color array.")}; + +_defaultColor = call compile ("[" + (_logic getVariable ["defaultColor", ""]) + "]"); +if (!([_defaultColor] call FUNC(isValidColorArray))) exitWith {ERROR("defaultColor is not a valid color array.")}; + +[QGVAR(defaultLeadColor), _defaultLeadColor, false, true] call EFUNC(common,setSetting); +[QGVAR(defaultColor), _defaultColor, false, true] call EFUNC(common,setSetting); diff --git a/addons/map_gestures/functions/fnc_receiverInit.sqf b/addons/map_gestures/functions/fnc_receiverInit.sqf new file mode 100644 index 0000000000..b132dad1d7 --- /dev/null +++ b/addons/map_gestures/functions/fnc_receiverInit.sqf @@ -0,0 +1,25 @@ +/* + * Author: Dslyecxi, MikeMatrix + * Initializes the receiver and hooks it to the Draw event of the map. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * [] call ace_map_gestures_fnc_receiverInit + * + * Public: No + */ +#include "script_component.hpp" + +ACE_player setVariable [QGVAR(Transmit), false, true]; +GVAR(EnableTransmit) = false; + +if (!isNil QGVAR(DrawMapHandlerID)) then { + (findDisplay 12 displayCtrl 51) ctrlRemoveEventHandler ["Draw", GVAR(DrawMapHandlerID)]; + GVAR(DrawMapHandlerID) = nil; +}; +GVAR(DrawMapHandlerID) = findDisplay 12 displayCtrl 51 ctrlAddEventHandler ["Draw", FUNC(drawMapGestures)]; diff --git a/addons/map_gestures/functions/fnc_transmit.sqf b/addons/map_gestures/functions/fnc_transmit.sqf new file mode 100644 index 0000000000..c9dc487db2 --- /dev/null +++ b/addons/map_gestures/functions/fnc_transmit.sqf @@ -0,0 +1,45 @@ +/* + * Author: Dslyecxi, MikeMatrix + * Transmit PFH + * + * Arguments: + * 0: Arguments + * 1: PFH ID + * + * Return Value: + * Return description + * + * Example: + * [[], 2] call ace_map_gestures_fnc_transmit + * + * Public: No + */ +#include "script_component.hpp" + +private ["_ownerID", "_unitUID", "_drawPosVariableName", "_playerOwnerID"]; + +params ["", "_pfhId"]; + +if (!visibleMap) then { + call FUNC(endTransmit); +}; + +if (!GVAR(EnableTransmit) || !visibleMap) exitWith { + [_pfhId] call CBA_fnc_removePerFrameHandler; +}; + +{ + _ownerID = _x getVariable QGVAR(owner_id); + if (isNil "_ownerID") then { + [EVENT_PLAYER_HAS_NO_OWNER_ID, [name _x]] call EFUNC(common,serverEvent); + } else { + _playerOwnerID = ACE_player getVariable QGVAR(owner_id); + if (!isNil "_playerOwnerID" && _ownerID != _playerOwnerID) then { + _unitUID = getPlayerUID ACE_Player; + _drawPosVariableName = if (!isNil "_unitUID" && _unitUID != "") then {format [QGVAR(%1_DrawPos), _unitUID]} else {nil}; + if (!isNil "_drawPosVariableName") then { + _ownerID publicVariableClient _drawPosVariableName; + }; + }; + }; +} count ([ACE_player, GVAR(maxRange)] call FUNC(getProximityPlayers)); diff --git a/addons/map_gestures/functions/fnc_transmitterInit.sqf b/addons/map_gestures/functions/fnc_transmitterInit.sqf new file mode 100644 index 0000000000..897855dc00 --- /dev/null +++ b/addons/map_gestures/functions/fnc_transmitterInit.sqf @@ -0,0 +1,70 @@ +/* + * Author: Dslyecxi, MikeMatrix + * Initializes the transmitting event handlers. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * [] call ace_map_gestures_fnc_transmitterInit + * + * Public: No + */ +#include "script_component.hpp" + +private ["_mapCtrl", "_unitUID", "_drawPosVariableName"]; + +disableSerialization; + +_mapCtrl = findDisplay 12 displayCtrl 51; + +// MouseMoving EH. +if (!isNil QGVAR(MouseMoveHandlerID)) then { + _mapCtrl ctrlRemoveEventHandler ["MouseMoving", GVAR(MouseMoveHandlerID)]; + GVAR(MouseMoveHandlerID) = nil; +}; +GVAR(MouseMoveHandlerID) = _mapCtrl ctrlAddEventHandler ["MouseMoving", { + // Don't transmit any data if we're using the map tools + if (!GVAR(EnableTransmit) || EGVAR(maptools,drawing_isDrawing) || EGVAR(maptools,mapTool_isDragging) || EGVAR(maptools,mapTool_isRotating)) exitWith {}; + + params ["_control", "_posX", "_posY"]; + + if (!(ACE_player getVariable QGVAR(Transmit))) then { + ACE_player setVariable [QGVAR(Transmit), true, true]; + }; + + _unitUID = getPlayerUID ACE_player; + _drawPosVariableName = if (!isNil "_unitUID" && _unitUID != "") then {format [QGVAR(%1_DrawPos), _unitUID]} else {nil}; + if (!isNil "_drawPosVariableName") then { + missionNamespace setVariable [_drawPosVariableName, _control ctrlMapScreenToWorld [_posX, _posY]]; + }; +}]; + +// MouseDown EH +if (!isNil QGVAR(MouseDownHandlerID)) then { + _mapCtrl ctrlRemoveEventHandler ["MouseButtonDown",GVAR(MouseDownHandlerID)]; + GVAR(MouseDownHandlerID) = nil; +}; +GVAR(MouseDownHandlerID) = _mapCtrl ctrlAddEventHandler ["MouseButtonDown", { + if (!GVAR(enabled)) exitWith {}; + + params ["", "_button"]; + + if (_button == 0) then {call FUNC(initTransmit);}; +}]; + +// MouseUp EH +if (!isNil QGVAR(MouseUpHandlerID)) then { + _mapCtrl ctrlRemoveEventHandler ["MouseButtonUp", GVAR(MouseUpHandlerID)]; + GVAR(MouseUpHandlerID) = nil; +}; +GVAR(MouseUpHandlerID) = _mapCtrl ctrlAddEventHandler ["MouseButtonUp", { + if (!GVAR(enabled)) exitWith {}; + + params ["", "_button"]; + + if (_button == 0) then {call FUNC(endTransmit);}; +}]; diff --git a/addons/map_gestures/functions/script_component.hpp b/addons/map_gestures/functions/script_component.hpp new file mode 100644 index 0000000000..65841c15f9 --- /dev/null +++ b/addons/map_gestures/functions/script_component.hpp @@ -0,0 +1 @@ +#include "\z\ace\addons\map_gestures\script_component.hpp" diff --git a/addons/map_gestures/script_component.hpp b/addons/map_gestures/script_component.hpp new file mode 100644 index 0000000000..1a5ecada12 --- /dev/null +++ b/addons/map_gestures/script_component.hpp @@ -0,0 +1,14 @@ +#define COMPONENT map_gestures +#include "\z\ace\addons\main\script_mod.hpp" + +#ifdef DEBUG_ENABLED_MAP_GESTURES + #define DEBUG_MODE_FULL +#endif + +#ifdef DEBUG_SETTINGS_MAP_GESTURES + #define DEBUG_SETTINGS DEBUG_SETTINGS_MAP_GESTURES +#endif + +#include "\z\ace\addons\main\script_macros.hpp" + +#define EVENT_PLAYER_HAS_NO_OWNER_ID "PlayerNameHasNoOwnerID" diff --git a/addons/map_gestures/stringtable.xml b/addons/map_gestures/stringtable.xml new file mode 100644 index 0000000000..e5eab426a3 --- /dev/null +++ b/addons/map_gestures/stringtable.xml @@ -0,0 +1,98 @@ + + + + + Map Gestures + + + Enabled + + + Map Gesture Max Range + + + Max range between players to show the map gesture indicator [default: 7 meters] + + + Lead Default Alpha + + + Fallback Alpha value for group leaders. + + + Default Alpha + + + Fallback Alpha value. + + + Lead Default Color + + + Fallback Color value for group leaders. + + + Default Color + + + Fallback Color value. + + + Lead Alpha + + + Alpha value for group leaders of groups synced with this module. + + + Alpha + + + Alpha value for group members of groups synced with this module. + + + Lead Color + + + Color value for group leaders of groups synced with this module. + + + Color + + + Color value for group members of groups synced with this module. + + + Map Gestures - Group Settings + + + Update Interval + + + Time between data updates. + + + Group color configurations + + + Group color configuration containing arrays of color pairs ([leadColor, color]). + + + Hash of Group ID mapped to the Group color configuration index. + + + GroupID Color configuration mapping + + + Enables the Map Gestures. + + + Name Text Color + + + Color of the name tag text besides the map gestures mark. + + + Map Gestures + + + diff --git a/addons/map_gestures/ui/icon_module_map_gestures_ca.paa b/addons/map_gestures/ui/icon_module_map_gestures_ca.paa new file mode 100644 index 0000000000..2d2bcbdf07 Binary files /dev/null and b/addons/map_gestures/ui/icon_module_map_gestures_ca.paa differ diff --git a/addons/medical/functions/fnc_moduleAssignMedicRoles.sqf b/addons/medical/functions/fnc_moduleAssignMedicRoles.sqf index e295c55a2e..92814ed052 100644 --- a/addons/medical/functions/fnc_moduleAssignMedicRoles.sqf +++ b/addons/medical/functions/fnc_moduleAssignMedicRoles.sqf @@ -1,61 +1,26 @@ /* * Author: Glowbal - * Assign a medical role to a unit + * Assign a medical role to a unit. * * Arguments: - * 0: The module logic - * 1: units - * 2: activated + * 0: The module logic + * 1: Synchronized units + * 2: Activated * * Return Value: * None * * Public: No */ - #include "script_component.hpp" -private ["_setting", "_objects", "_list", "_splittedList", "_nilCheckPassedList", "_parsedList"]; -params [["_logic", objNull, [objNull]]]; +params ["_logic"]; if (!isNull _logic) then { - _list = _logic getvariable ["EnableList",""]; + private ["_list", "_setting"]; + _list = _logic getVariable ["EnableList", ""]; + _setting = _logic getVariable ["role", 0]; - _splittedList = [_list, ","] call BIS_fnc_splitString; - _nilCheckPassedList = ""; - { - _x = [_x] call EFUNC(common,stringRemoveWhiteSpace); - if !(isnil _x) then { - if (_nilCheckPassedList == "") then { - _nilCheckPassedList = _x; - } else { - _nilCheckPassedList = _nilCheckPassedList + ","+ _x; - }; - }; - } foreach _splittedList; - - _list = "[" + _nilCheckPassedList + "]"; - _parsedList = [] call compile _list; - _setting = _logic getvariable ["role",0]; - _objects = synchronizedObjects _logic; - if (!(_objects isEqualTo []) && _parsedList isEqualTo []) then { - { - if (!isnil "_x") then { - if (typeName _x == typeName objNull) then { - if (local _x) then { - _x setvariable [QGVAR(medicClass), _setting, true]; - }; - }; - }; - } foreach _objects; - }; - { - if (!isnil "_x") then { - if (typeName _x == typeName objNull) then { - if (local _x) then { - _x setvariable [QGVAR(medicClass), _setting, true]; - }; - }; - }; - } foreach _parsedList; - }; + [_list, QGVAR(medicClass), _setting, true] call EFUNC(common,assignObjectsInList); + [synchronizedObjects _logic, QGVAR(medicClass), _setting, true] call EFUNC(common,assignObjectsInList); +}; diff --git a/addons/medical/functions/fnc_moduleAssignMedicalVehicle.sqf b/addons/medical/functions/fnc_moduleAssignMedicalVehicle.sqf index 8481aaf293..2bc6d3a332 100644 --- a/addons/medical/functions/fnc_moduleAssignMedicalVehicle.sqf +++ b/addons/medical/functions/fnc_moduleAssignMedicalVehicle.sqf @@ -1,11 +1,11 @@ /* * Author: Glowbal - * Assign vehicle as a medical vehicle + * Assign vehicle as a medical vehicle. * * Arguments: - * 0: The module logic - * 1: units - * 2: activated + * 0: The module logic + * 1: Synchronized units + * 2: Activated * * Return Value: * None @@ -14,50 +14,13 @@ */ #include "script_component.hpp" -private ["_setting", "_objects", "_list", "_splittedList", "_nilCheckPassedList", "_parsedList", "_xVehicle"]; -params [["_logic", objNull, [objNull]]]; +params ["_logic"]; if (!isNull _logic) then { - _list = _logic getvariable ["EnableList",""]; + private ["_list", "_setting"]; + _list = _logic getVariable ["EnableList", ""]; + _setting = _logic getVariable ["enabled", 0]; - _splittedList = [_list, ","] call BIS_fnc_splitString; - _nilCheckPassedList = ""; - { - _x = [_x] call EFUNC(common,stringRemoveWhiteSpace); - if !(isnil _x) then { - if (_nilCheckPassedList == "") then { - _nilCheckPassedList = _x; - } else { - _nilCheckPassedList = _nilCheckPassedList + ","+ _x; - }; - }; - } foreach _splittedList; - - _list = "[" + _nilCheckPassedList + "]"; - _parsedList = [] call compile _list; - _setting = _logic getvariable ["enabled", 0]; - _objects = synchronizedObjects _logic; - if (!(_objects isEqualTo []) && _parsedList isEqualTo []) then { - { - if (!isnil "_x") then { - if (typeName _x == typeName objNull) then { - if (local _x) then { - _xVehicle = vehicle _x; - TRACE_3("setting medical vehicle", _x, _xVehicle, (typeOf _xVehicle)); - _xVehicle setvariable [QGVAR(medicClass), _setting, true]; - }; - }; - }; - } foreach _objects; - }; - { - if (!isnil "_x") then { - if (typeName _x == typeName objNull) then { - if (local _x) then { - TRACE_2("setting medical vehicle", _x, (typeOf _x)); - _x setvariable [QGVAR(medicClass), _setting, true]; - }; - }; - }; - } foreach _parsedList; + [_list, QGVAR(medicClass), _setting, true] call EFUNC(common,assignObjectsInList); + [synchronizedObjects _logic, QGVAR(medicClass), _setting, true, true] call EFUNC(common,assignObjectsInList); }; diff --git a/addons/medical/stringtable.xml b/addons/medical/stringtable.xml index 13e2e32e38..8b4282c555 100644 --- a/addons/medical/stringtable.xml +++ b/addons/medical/stringtable.xml @@ -3276,7 +3276,7 @@ Elsősegélycsomag helyek - Where can the Personal Aid Kit be used? + Where can the PAK be used? Где может использоваться аптечка? Gdzie można korzystać z apteczek osobistych? ¿Dónde se puede utilizar el equipo de primeros auxilios? @@ -3297,7 +3297,7 @@ Условие использования аптечки - When can the Personal Aid Kit be used? + When can the PAK be used? Kde může být použita osobní lékárnička? ¿Cuando se puede utilizar el Equipo de primeros auxilios? Quand peut être utilisé le Kit de Premier Secours @@ -3351,7 +3351,7 @@ Járművek & létesítmény - Allow Surgical kit (Adv) + Allow Surgical Kit (Adv) Хирургический набор может использоваться (усл.) Ust. zestawu chirurg. Permitir equipo quirúrgico (Avanzado) @@ -3362,7 +3362,7 @@ Sebészkészlet (Fejlett) engedélyezése - Who can use the surgical kit? + Who can use the Surgical Kit? Кто может использовать хирургический набор? Kto może skorzystać z zestawu chirurgicznego w celu zszycia ran? ¿Quién puede utilizar el equipo quirúrgico? @@ -3373,7 +3373,7 @@ Ki használhatja a sebészkészletet? - Remove Surgical kit (Adv) + Remove Surgical Kit (Adv) Удалять хирургический набор (усл.) Usuń zest. chir. po użyciu Eliminar equipo quirúrgico (Avanzado) @@ -3395,7 +3395,7 @@ Eltávolítódjon a sebészkészlet használatkor? - Locations Surgical kit (Adv) + Locations Surgical Kit (Adv) Место использования хирургического набора (усл.) Ogr. zestawu chirurg. Ubicaciones del equipo quirúrgico (Avanzado) @@ -3406,7 +3406,7 @@ Sebészkészlet (Fejlett) helyei - Where can the Surgical kit be used? + Where can the Surgical Kit be used? Где может использоваться хирургический набор? Gdzie można korzystać z zestawu chirurgicznego? Dónde se puede utilizar el equipo quirúrgico @@ -3417,7 +3417,7 @@ Hol lehet a sebészkészletet használni? - Condition Surgical kit (Adv) + Condition Surgical Kit (Adv) Podmínka chirurgické soupravy (Pokr.) Condición de equipo quirúrgico (Av) Conditions d'utilisation du kit de chirurgie @@ -3427,7 +3427,7 @@ Условие использования хирургического набора (усл.) - When can the Surgical kit be used? + When can the Surgical Kit be used? Kde může být použita chirurgická souprava? ¿Cuando se puede utilizar el equipo quirúrgico? Quand peut être utilisé les kit de chirurgie diff --git a/addons/missileguidance/CfgAmmo.hpp b/addons/missileguidance/CfgAmmo.hpp index 779d2a82eb..64146b8e7e 100644 --- a/addons/missileguidance/CfgAmmo.hpp +++ b/addons/missileguidance/CfgAmmo.hpp @@ -6,7 +6,7 @@ enum { class CfgAmmo { class MissileBase; - class M_PG_AT : MissileBase { + class M_PG_AT: MissileBase { model = "\A3\Weapons_F\Ammo\Rocket_01_fly_F"; proxyShape = "\A3\Weapons_F\Ammo\Rocket_01_F"; @@ -68,15 +68,18 @@ class CfgAmmo { }; }; - class ACE_Hydra70_DAGR : M_PG_AT { + class ACE_Hydra70_DAGR: M_PG_AT { displayName = CSTRING(Hydra70_DAGR); displayNameShort = CSTRING(Hydra70_DAGR_Short); description = CSTRING(Hydra70_DAGR_Desc); descriptionShort = CSTRING(Hydra70_DAGR_Desc); + + //Explicity add guidance config + class ADDON: ADDON {}; }; - class ACE_Hellfire_AGM114K : ACE_Hydra70_DAGR { + class ACE_Hellfire_AGM114K: ACE_Hydra70_DAGR { displayName = CSTRING(Hellfire_AGM114K); displayNameShort = CSTRING(Hellfire_AGM114K_Short); @@ -91,10 +94,13 @@ class CfgAmmo { indirectHit = 71; indirectHitRange = 4.5; effectsMissile = "missile2"; + + //Explicity add guidance config + class ADDON: ADDON {}; }; // Titan - class M_Titan_AT : MissileBase {}; + class M_Titan_AT: MissileBase {}; class ACE_Javelin_FGM148: M_Titan_AT { irLock = 0; @@ -145,8 +151,8 @@ class CfgAmmo { //Take config changes from (M_Titan_AT_static: M_Titan_AT) initTime = 0.25; //"How long (in seconds) the projectile waits before starting it's engine.", - but doesn't seem to do anything effectsMissileInit = "RocketBackEffectsStaticRPG"; - class ADDON: ADDON { - enabled = 1; - }; + + //Explicity add guidance config + class ADDON: ADDON {}; }; }; diff --git a/addons/missileguidance/CfgWeapons.hpp b/addons/missileguidance/CfgWeapons.hpp index ab36d4dd52..a922c6b82e 100644 --- a/addons/missileguidance/CfgWeapons.hpp +++ b/addons/missileguidance/CfgWeapons.hpp @@ -4,7 +4,7 @@ class CfgWeapons { class LauncherCore; class RocketPods: LauncherCore { - canLock = 1; + // canLock = 1; }; class missiles_DAGR : RocketPods { canLock = 1; diff --git a/addons/missileguidance/functions/fnc_seekerType_Optic.sqf b/addons/missileguidance/functions/fnc_seekerType_Optic.sqf index 872f33a917..1cc71c1d94 100644 --- a/addons/missileguidance/functions/fnc_seekerType_Optic.sqf +++ b/addons/missileguidance/functions/fnc_seekerType_Optic.sqf @@ -17,7 +17,7 @@ TRACE_1("", _launchParams); // TODO:: Make sure the missile maintains LOS _foundTargetPos = [0,0,0]; if(!isNil "_target") then { - _foundTargetPos = getPosASL _target; + _foundTargetPos = aimPos _target ; //_foundTargetPos = (_target modelToWorldVisual (getCenterOfMass _target)); }; @@ -48,4 +48,4 @@ if(!_angleOkay || !_losOkay) then { }; -_foundTargetPos; \ No newline at end of file +_foundTargetPos; diff --git a/addons/repair/functions/fnc_moduleAddSpareParts.sqf b/addons/repair/functions/fnc_moduleAddSpareParts.sqf index 46689951a7..cceb62e10c 100644 --- a/addons/repair/functions/fnc_moduleAddSpareParts.sqf +++ b/addons/repair/functions/fnc_moduleAddSpareParts.sqf @@ -11,51 +11,35 @@ * None * * Example: - * function = "ace_repair_fnc_moduleAssignRepairVehicle" + * function = "ace_repair_fnc_moduleAddSpareParts" * * Public: No */ -#define DEBUG_MODE_FULL #include "script_component.hpp" params ["_logic"]; if (!isNull _logic) then { - private ["_list", "_part", "_amount", "_nilCheckPassedList"]; - // Module settings + private ["_list", "_part", "_amount"]; _list = _logic getVariable ["List", ""]; _part = _logic getVariable ["Part", 0]; _amount = _logic getVariable ["Amount", 1]; // Parse list - _nilCheckPassedList = ""; - { - _x = [_x] call EFUNC(common,stringRemoveWhiteSpace); - if !(isnil _x) then { - if (_nilCheckPassedList == "") then { - _nilCheckPassedList = _x; - } else { - _nilCheckPassedList = _nilCheckPassedList + "," + _x; - }; - }; - } forEach ([_list, ","] call BIS_fnc_splitString); - _list = "[" + _nilCheckPassedList + "]"; - _list = [] call compile _list; + _list = [_list, true, true] call EFUNC(common,parseList); // Add synchronized objects to list { _list pushBack _x; - } forEach (synchronizedObjects _logic); + nil + } count (synchronizedObjects _logic); if (_list isEqualTo []) exitWith {}; - TRACE_3("module info parsed",_list,_part,_amount); + TRACE_3("Module info parsed",_list,_part,_amount); + // Add spare parts { - if (!isNil "_x" && {typeName _x == typeName objNull}) then { - [_x, _amount, _part, true] call FUNC(addSpareParts); - }; - } forEach _list; + [_x, _amount, _part, true] call FUNC(addSpareParts); + } count _list; }; - -true diff --git a/addons/repair/functions/fnc_moduleAssignEngineer.sqf b/addons/repair/functions/fnc_moduleAssignEngineer.sqf index 9fb9ed8431..240a8c3b62 100644 --- a/addons/repair/functions/fnc_moduleAssignEngineer.sqf +++ b/addons/repair/functions/fnc_moduleAssignEngineer.sqf @@ -21,11 +21,9 @@ params ["_logic"]; if (!isNull _logic) then { private ["_list", "_setting"]; - _list = _logic getVariable ["EnableList",""]; - _setting = _logic getVariable ["role",0]; + _list = _logic getVariable ["EnableList", ""]; + _setting = _logic getVariable ["role", 0]; [_list, "ACE_IsEngineer", _setting, true] call EFUNC(common,assignObjectsInList); [synchronizedObjects _logic, "ACE_IsEngineer", _setting, true] call EFUNC(common,assignObjectsInList); - }; - -true +}; diff --git a/addons/repair/functions/fnc_moduleAssignRepairFacility.sqf b/addons/repair/functions/fnc_moduleAssignRepairFacility.sqf index 00cb847866..7150d0226b 100644 --- a/addons/repair/functions/fnc_moduleAssignRepairFacility.sqf +++ b/addons/repair/functions/fnc_moduleAssignRepairFacility.sqf @@ -21,11 +21,9 @@ params ["_logic"]; if (!isNull _logic) then { private ["_list", "_setting"]; - _list = _logic getVariable ["EnableList",""]; - _setting = _logic getVariable ["role",0]; + _list = _logic getVariable ["EnableList", ""]; + _setting = _logic getVariable ["role", 0]; [_list, "ACE_isRepairFacility", _setting, true] call EFUNC(common,assignObjectsInList); [synchronizedObjects _logic, "ACE_isRepairFacility", _setting, true] call EFUNC(common,assignObjectsInList); }; - -true diff --git a/addons/repair/functions/fnc_moduleAssignRepairVehicle.sqf b/addons/repair/functions/fnc_moduleAssignRepairVehicle.sqf index 69d2a2c52f..647b5fe52c 100644 --- a/addons/repair/functions/fnc_moduleAssignRepairVehicle.sqf +++ b/addons/repair/functions/fnc_moduleAssignRepairVehicle.sqf @@ -21,11 +21,9 @@ params ["_logic"]; if (!isNull _logic) then { private ["_list", "_setting"]; - _list = _logic getVariable ["EnableList",""]; - _setting = _logic getVariable ["role",0]; + _list = _logic getVariable ["EnableList", ""]; + _setting = _logic getVariable ["role", 0]; [_list, "ACE_isRepairVehicle", _setting, true] call EFUNC(common,assignObjectsInList); [synchronizedObjects _logic, "ACE_isRepairVehicle", _setting, true] call EFUNC(common,assignObjectsInList); - }; - -true +}; diff --git a/addons/sitting/CfgEventHandlers.hpp b/addons/sitting/CfgEventHandlers.hpp index 1e804e8cc9..da7efe1601 100644 --- a/addons/sitting/CfgEventHandlers.hpp +++ b/addons/sitting/CfgEventHandlers.hpp @@ -17,3 +17,12 @@ class Extended_Killed_EventHandlers { }; }; }; + +// Need initPost or there are problems with setVariable +class Extended_InitPost_EventHandlers { + class ThingX { + class ADDON { + init = QUOTE(_this call DFUNC(addSitActions)) + }; + }; +}; diff --git a/addons/sitting/CfgVehicles.hpp b/addons/sitting/CfgVehicles.hpp index a156d5e87e..4ac0d0edb7 100644 --- a/addons/sitting/CfgVehicles.hpp +++ b/addons/sitting/CfgVehicles.hpp @@ -34,79 +34,67 @@ class CfgVehicles { }; }; - #define MACRO_SEAT_ACTION \ - class ACE_Actions { \ - class ACE_MainActions { \ - displayName = ECSTRING(interaction,MainAction); \ - selection = ""; \ - distance = 1.5; \ - condition = "true"; \ - class GVAR(Sit) { \ - displayName = CSTRING(Sit); \ - condition = QUOTE(_this call FUNC(canSit)); \ - statement = QUOTE(_this call FUNC(sit)); \ - showDisabled = 0; \ - priority = 0; \ - icon = PATHTOF(UI\sit_ca.paa); \ - }; \ - }; \ - }; - class ThingX; // Folding Chair class Land_CampingChair_V1_F: ThingX { XEH_ENABLED; - MACRO_SEAT_ACTION GVAR(canSit) = 1; GVAR(sitDirection) = 180; GVAR(sitPosition[]) = {0, -0.1, -0.45}; - GVAR(sitRotation) = 10; + EGVAR(dragging,canCarry) = 1; + EGVAR(dragging,carryPosition[]) = {0, 0.75, 0.5}; + EGVAR(dragging,carryDirection) = 180; }; // Camping Chair class Land_CampingChair_V2_F: ThingX { XEH_ENABLED; - MACRO_SEAT_ACTION GVAR(canSit) = 1; GVAR(sitDirection) = 180; GVAR(sitPosition[]) = {0, -0.1, -0.45}; - GVAR(sitRotation) = 45; + EGVAR(dragging,canCarry) = 1; + EGVAR(dragging,carryPosition[]) = {0, 0.75, 0.5}; + EGVAR(dragging,carryDirection) = 180; }; class Furniture_base_F; // Chair (Plastic) class Land_ChairPlastic_F: Furniture_base_F { XEH_ENABLED; - MACRO_SEAT_ACTION GVAR(canSit) = 1; GVAR(sitDirection) = 90; GVAR(sitPosition[]) = {0, 0, -0.5}; - GVAR(sitRotation) = 5; + EGVAR(dragging,canCarry) = 1; + EGVAR(dragging,carryPosition[]) = {0, 0.75, 0.5}; + EGVAR(dragging,carryDirection) = 270; }; // Chair (Wooden) class Land_ChairWood_F: Furniture_base_F { XEH_ENABLED; - MACRO_SEAT_ACTION GVAR(canSit) = 1; GVAR(sitDirection) = 180; GVAR(sitPosition[]) = {0, -0.05, 0}; - GVAR(sitRotation) = 75; + EGVAR(dragging,canCarry) = 1; + EGVAR(dragging,carryPosition[]) = {0, 0.75, 0.5}; + EGVAR(dragging,carryDirection) = 180; }; // Office Chair class Land_OfficeChair_01_F: Furniture_base_F { XEH_ENABLED; - MACRO_SEAT_ACTION GVAR(canSit) = 1; GVAR(sitDirection) = 180; GVAR(sitPosition[]) = {0, 0, -0.6}; - GVAR(sitRotation) = 15; + EGVAR(dragging,canCarry) = 1; + EGVAR(dragging,carryPosition[]) = {0, 0.75, 0.5}; + EGVAR(dragging,carryDirection) = 180; }; // Rattan Chair class Land_RattanChair_01_F: Furniture_base_F { XEH_ENABLED; - MACRO_SEAT_ACTION GVAR(canSit) = 1; GVAR(sitDirection) = 180; GVAR(sitPosition[]) = {0, -0.1, -1}; // Z must be -1 due to chair's geometry (magic floating seat point) - GVAR(sitRotation) = 2; + EGVAR(dragging,canCarry) = 1; + EGVAR(dragging,carryPosition[]) = {0, 0.75, 0.5}; + EGVAR(dragging,carryDirection) = 180; }; }; diff --git a/addons/sitting/XEH_clientInit.sqf b/addons/sitting/XEH_clientInit.sqf index 9cf8278877..23816bd8d7 100644 --- a/addons/sitting/XEH_clientInit.sqf +++ b/addons/sitting/XEH_clientInit.sqf @@ -4,7 +4,7 @@ if (!hasInterface) exitWith {}; // Add interaction menu exception -["isNotSitting", {!((_this select 0) getVariable [QGVAR(isSitting), false])}] call EFUNC(common,addCanInteractWithCondition); +["isNotSitting", {isNil {(_this select 0) getVariable QGVAR(isSitting)}}] call EFUNC(common,addCanInteractWithCondition); // Handle interruptions ["medical_onUnconscious", {_this call DFUNC(handleInterrupt)}] call EFUNC(common,addEventhandler); diff --git a/addons/sitting/XEH_preInit.sqf b/addons/sitting/XEH_preInit.sqf index 86912ada6b..15ffe281c8 100644 --- a/addons/sitting/XEH_preInit.sqf +++ b/addons/sitting/XEH_preInit.sqf @@ -2,6 +2,7 @@ ADDON = false; +PREP(addSitActions); PREP(canSit); PREP(canStand); PREP(getRandomAnimation); @@ -10,4 +11,6 @@ PREP(moduleInit); PREP(sit); PREP(stand); +GVAR(initializedClasses) = []; + ADDON = true; diff --git a/addons/sitting/functions/fnc_addSitActions.sqf b/addons/sitting/functions/fnc_addSitActions.sqf new file mode 100644 index 0000000000..18779d9229 --- /dev/null +++ b/addons/sitting/functions/fnc_addSitActions.sqf @@ -0,0 +1,42 @@ +/* + * Author: Jonpas + * Adds sit actions. + * + * Arguments: + * 0: Seat + * + * Return Value: + * None + * + * Example: + * [seat] call ace_sitting_fnc_addSitActions + * + * Public: No + */ +#include "script_component.hpp" + +params ["_seat"]; +private ["_type", "_sitAction"]; + +_type = typeOf _seat; + +// Exit if the object is not specified as a seat +if (getNumber (configFile >> "CfgVehicles" >> _type >> QGVAR(canSit)) != 1) exitWith {}; + +// Exit if class already initialized +if (_type in GVAR(initializedClasses)) exitWith {}; + +GVAR(initializedClasses) pushBack _type; + +_sitAction = [ + QGVAR(Sit), + localize LSTRING(Sit), + QUOTE(PATHTOF(UI\sit_ca.paa)), + {_this call FUNC(sit)}, + {_this call FUNC(canSit)}, + {}, + [], + [0, 0, 0], + 1.5 +] call EFUNC(interact_menu,createAction); +[_type, 0, ["ACE_MainActions"], _sitAction] call EFUNC(interact_menu,addActionToClass); diff --git a/addons/sitting/functions/fnc_canSit.sqf b/addons/sitting/functions/fnc_canSit.sqf index fef36b4bbd..1dd0c9676f 100644 --- a/addons/sitting/functions/fnc_canSit.sqf +++ b/addons/sitting/functions/fnc_canSit.sqf @@ -4,22 +4,20 @@ * * Arguments: * 0: Seat - * 1: Player * * Return Value: * Can Sit Down * * Example: - * [seat, player] call ace_sitting_fnc_canSit + * [seat] call ace_sitting_fnc_canSit * * Public: No */ #include "script_component.hpp" -params ["_seat", "_player"]; +params ["_seat"]; // Sitting enabled, is seat object, not occupied and standing up (or not on a big slope) GVAR(enable) && -{getNumber (configFile >> "CfgVehicles" >> typeOf _seat >> QGVAR(canSit)) == 1} && {isNil {_seat getVariable QGVAR(seatOccupied)}} && {round (vectorUp _seat select 0) == 0 && {round (vectorUp _seat select 1) == 0} && {round (vectorUp _seat select 2) == 1}} diff --git a/addons/sitting/functions/fnc_canStand.sqf b/addons/sitting/functions/fnc_canStand.sqf index c516485a82..a051e1784e 100644 --- a/addons/sitting/functions/fnc_canStand.sqf +++ b/addons/sitting/functions/fnc_canStand.sqf @@ -18,4 +18,4 @@ params ["_player"]; // Sitting -(_player getVariable [QGVAR(isSitting), false]) +!isNil {_player getVariable QGVAR(isSitting)} diff --git a/addons/sitting/functions/fnc_handleInterrupt.sqf b/addons/sitting/functions/fnc_handleInterrupt.sqf index 328675c172..c7e0a545ff 100644 --- a/addons/sitting/functions/fnc_handleInterrupt.sqf +++ b/addons/sitting/functions/fnc_handleInterrupt.sqf @@ -17,6 +17,6 @@ params ["_player"]; -if (_player getVariable [QGVAR(isSitting), false]) then { +if (!isNil {_player getVariable QGVAR(isSitting)}) then { _player call FUNC(stand); }; diff --git a/addons/sitting/functions/fnc_sit.sqf b/addons/sitting/functions/fnc_sit.sqf index 5e9c36947e..24245699bc 100644 --- a/addons/sitting/functions/fnc_sit.sqf +++ b/addons/sitting/functions/fnc_sit.sqf @@ -16,23 +16,14 @@ */ #include "script_component.hpp" -private ["_actionID", "_configFile", "_sitDirection", "_sitPosition", "_sitRotation", "_seatPosOrig"]; +private ["_actionID", "_configFile", "_sitDirection", "_sitPosition", "_seatPosOrig"]; params ["_seat", "_player"]; -// Set global variable for standing up -GVAR(seat) = _seat; - // Overwrite weird position, because Arma decides to set it differently based on current animation/stance... _player switchMove "amovpknlmstpsraswrfldnon"; // Add scroll-wheel action to release object -_actionID = _player getVariable [QGVAR(StandUpActionID), -1]; - -if (_actionID != -1) then { - _player removeAction _actionID; -}; - _actionID = _player addAction [ format ["%1", localize LSTRING(Stand)], QUOTE((_this select 0) call FUNC(stand)), @@ -44,13 +35,10 @@ _actionID = _player addAction [ QUOTE(_this call FUNC(canStand)) ]; -_player setVariable [QGVAR(StandUpActionID), _actionID]; - // Read config _configFile = configFile >> "CfgVehicles" >> typeOf _seat; _sitDirection = (getDir _seat) + getNumber (_configFile >> QGVAR(sitDirection)); _sitPosition = getArray (_configFile >> QGVAR(sitPosition)); -_sitRotation = if (isNumber (_configFile >> QGVAR(sitRotation))) then {getNumber (_configFile >> QGVAR(sitRotation))} else {45}; // Apply default if config entry not present // Get random animation and perform it (before moving player to ensure correct placement) [_player, call FUNC(getRandomAnimation), 2] call EFUNC(common,doAnimation); // Correctly places when using non-transitional animations @@ -58,11 +46,11 @@ _sitRotation = if (isNumber (_configFile >> QGVAR(sitRotation))) then {getNumber // Set direction and position _player setDir _sitDirection; -// No need for ATL/ASL as modelToWorld returns in format position -_player setPos (_seat modelToWorld _sitPosition); +//modelToWorld returns AGL +_player setPosASL (AGLtoASL (_seat modelToWorld _sitPosition)); -// Set variables -_player setVariable [QGVAR(isSitting), true]; +// Set variables, save seat object on player +_player setVariable [QGVAR(isSitting), [_seat, _actionID]]; _seat setVariable [QGVAR(seatOccupied), true, true]; // To prevent multiple people sitting on one seat @@ -73,7 +61,7 @@ _seatPosOrig = getPosASL _seat; _args params ["_player", "_seat", "_seatPosOrig"]; // Remove PFH if not sitting any more - if !(_player getVariable [QGVAR(isSitting), false]) exitWith { + if (isNil {_player getVariable QGVAR(isSitting)}) exitWith { [_pfhId] call CBA_fnc_removePerFrameHandler; TRACE_1("Remove PFH",_player getVariable [ARR_2(QGVAR(isSitting), false)]); }; diff --git a/addons/sitting/functions/fnc_stand.sqf b/addons/sitting/functions/fnc_stand.sqf index ef19d5f586..4c08461746 100644 --- a/addons/sitting/functions/fnc_stand.sqf +++ b/addons/sitting/functions/fnc_stand.sqf @@ -16,12 +16,14 @@ #include "script_component.hpp" params ["_player"]; +private ["_animation"]; -// remove scroll wheel action -_player removeAction (_player getVariable [QGVAR(StandUpActionID), -1]); +(_player getVariable QGVAR(isSitting)) params ["_seat", "_actionID"]; + +// Remove scroll-wheel action +_player removeAction _actionID; // Restore animation -private "_animation"; _animation = switch (currentWeapon _player) do { case "": {"amovpercmstpsnonwnondnon"}; case (primaryWeapon _player): {"amovpercmstpslowwrfldnon"}; @@ -33,5 +35,5 @@ _animation = switch (currentWeapon _player) do { // Set variables to nil _player setVariable [QGVAR(isSitting), nil]; -GVAR(seat) setVariable [QGVAR(seatOccupied), nil, true]; -GVAR(seat) = nil; +if (isNull _seat) exitWith {}; +_seat setVariable [QGVAR(seatOccupied), nil, true]; diff --git a/addons/slideshow/XEH_preInit.sqf b/addons/slideshow/XEH_preInit.sqf index 0f9e270896..152c02ec77 100644 --- a/addons/slideshow/XEH_preInit.sqf +++ b/addons/slideshow/XEH_preInit.sqf @@ -5,7 +5,6 @@ ADDON = false; PREP(addSlideActions); PREP(autoTransition); PREP(createSlideshow); -PREP(makeList); PREP(moduleInit); GVAR(slideshows) = 0; diff --git a/addons/slideshow/functions/fnc_makeList.sqf b/addons/slideshow/functions/fnc_makeList.sqf deleted file mode 100644 index e550e462a7..0000000000 --- a/addons/slideshow/functions/fnc_makeList.sqf +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Author: Jonpas - * Makes a list from a string using comma as a delimiter, optionally remove whitespace and check each for object existence. - * - * Arguments: - * 0: Text - * 1: Trim Whitespace - * 2: Check Nil - * - * Return Value: - * Parsed List - * - * Example: - * ["text", true, false] call ace_slideshow_fnc_makeList - * - * Public: No - */ -#include "script_component.hpp" - -private ["_splittedList", "_listTrimmedWhitespace", "_nilCheckPassedList"]; -params ["_list", "_trimWhitespace", "_checkNil"]; - -// Split using comma delimiter -_splittedList = [_list, ","] call BIS_fnc_splitString; - -// Remove whitespace -_listTrimmedWhitespace = []; -if (_trimWhitespace) then { - { - _listTrimmedWhitespace pushBack ([_x] call CBA_fnc_trim); - nil - } count _splittedList; - _list = _listTrimmedWhitespace; -}; - -// Check for object existence -_nilCheckPassedList = ""; -if (_checkNil) then { - { - if !(isNil _x) then { - if (_nilCheckPassedList == "") then { - _nilCheckPassedList = _x; - } else { - _nilCheckPassedList = _nilCheckPassedList + "," + _x; - }; - }; - } count _list; - - // Add Array characters and parse into array - _list = "[" + _nilCheckPassedList + "]"; - _list = [] call compile _list; -}; - -TRACE_4("Lists",_splittedList,_listTrimmedWhitespace,_nilCheckPassedList,_list); - -_list // return diff --git a/addons/slideshow/functions/fnc_moduleInit.sqf b/addons/slideshow/functions/fnc_moduleInit.sqf index f09dab678d..9c99d15a11 100644 --- a/addons/slideshow/functions/fnc_moduleInit.sqf +++ b/addons/slideshow/functions/fnc_moduleInit.sqf @@ -24,10 +24,10 @@ if !(_activated) exitWith {}; if (isNull _logic) exitWith {}; // Extract variables from logic -_objects = [_logic getVariable ["Objects", ""], true, true] call FUNC(makeList); -_controllers = [_logic getVariable ["Controllers", ""], true, true] call FUNC(makeList); -_images = [_logic getVariable ["Images", ""], true, false] call FUNC(makeList); -_names = [_logic getVariable ["Names", ""], true, false] call FUNC(makeList); +_objects = [_logic getVariable ["Objects", ""], true, true] call EFUNC(common,parseList); +_controllers = [_logic getVariable ["Controllers", ""], true, true] call EFUNC(common,parseList); +_images = [_logic getVariable ["Images", ""], false, false] call EFUNC(common,parseList); +_names = [_logic getVariable ["Names", ""], false, false] call EFUNC(common,parseList); _duration = _logic getVariable ["Duration", 0]; // Objects synced to the module diff --git a/docs/README_DE.md b/docs/README_DE.md index 9921bf3fc6..24be427392 100644 --- a/docs/README_DE.md +++ b/docs/README_DE.md @@ -3,22 +3,25 @@

- ACE3 Version + ACE3 Version - - ACE3 Download + + ACE3 Download - ACE3 Issues + ACE3 Issues BIF Thread - ACE3 License + ACE3 License - - ACE3 Slack + + ACE3 Slack + + + ACE3 Build Status

Benötigt die aktuellste Version von CBA A3. Besucht uns auf Facebook | YouTube | Twitter | Reddit

diff --git a/docs/README_PL.md b/docs/README_PL.md index aa7023a9e4..b12f574b6f 100644 --- a/docs/README_PL.md +++ b/docs/README_PL.md @@ -3,22 +3,25 @@

- ACE3 Wersja + ACE3 Wersja - - ACE3 Pobierz + + ACE3 Pobierz - ACE3 Zagadnienia + ACE3 Zagadnienia Temat BIF - ACE3 Licencja + ACE3 Licencja - - ACE3 Slack + + ACE3 Slack + + + ACE3 Build Status

Wymaga najnowszej wersji CBA A3. Odwiedź nas na Facebook | YouTube | Twitter | Reddit

diff --git a/tools/deploy.py b/tools/deploy.py index 0b3a730470..2bc894176d 100755 --- a/tools/deploy.py +++ b/tools/deploy.py @@ -16,8 +16,7 @@ from pygithub3 import Github TRANSLATIONISSUE = 367 -TRANSLATIONBODY = """**How to translate ACE3:** -http://ace3mod.com/wiki/development/how-to-translate-ace3.html +TRANSLATIONBODY = """**[ACE3 Translation Guide](http://ace3mod.com/wiki/development/how-to-translate-ace3.html)** {} """ diff --git a/tools/sqf_validator.py b/tools/sqf_validator.py index e4af90f50f..7e7c0183d6 100644 --- a/tools/sqf_validator.py +++ b/tools/sqf_validator.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python3 import fnmatch import os @@ -6,6 +7,16 @@ import ntpath import sys import argparse +def validKeyWordAfterCode(content, index): + keyWords = ["for", "do", "count", "each", "forEach", "else", "and", "not", "isEqualTo", "in", "call", "spawn", "execVM", "catch"]; + for word in keyWords: + try: + subWord = content.index(word, index, index+len(word)) + return True; + except: + pass + return False + def check_sqf_syntax(filepath): bad_count_file = 0 def pushClosing(t): @@ -15,63 +26,98 @@ def check_sqf_syntax(filepath): def popClosing(): closing << closingStack.pop() - with open(filepath, 'r') as file: + with open(filepath, 'r', encoding='utf-8', errors='ignore') as file: content = file.read() + + # Store all brackets we find in this file, so we can validate everything on the end brackets_list = [] + # To check if we are in a comment block isInCommentBlock = False checkIfInComment = False + # Used in case we are in a line comment (//) ignoreTillEndOfLine = False + # Used in case we are in a comment block (/* */). This is true if we detect a * inside a comment block. + # If the next character is a /, it means we end our comment block. checkIfNextIsClosingBlock = False - isInString = False + # We ignore everything inside a string + isInString = False + # Used to store the starting type of a string, so we can match that to the end of a string + inStringType = ''; + + lastIsCurlyBrace = False + checkForSemiColumn = False + + # Extra information so we know what line we find errors at lineNumber = 0 + indexOfCharacter = 0 + # Parse all characters in the content of this file to search for potential errors for c in content: - if c == '\n': + if (lastIsCurlyBrace): + lastIsCurlyBrace = False + checkForSemiColumn = True + + if c == '\n': # Keeping track of our line numbers lineNumber += 1 # so we can print accurate line number information when we detect a possible error - if (isInString): + if (isInString): # while we are in a string, we can ignore everything else, except the end of the string if (c == inStringType): isInString = False - elif (isInCommentBlock == False): # if we are not in a comment block, we will check if we are at the start of one or count the () {} and [] - if (checkIfInComment): # This means we have encountered a /, so we are now checking if this is an inline comment or a comment block + # if we are not in a comment block, we will check if we are at the start of one or count the () {} and [] + elif (isInCommentBlock == False): + + # This means we have encountered a /, so we are now checking if this is an inline comment or a comment block + if (checkIfInComment): checkIfInComment = False if c == '*': # if the next character after / is a *, we are at the start of a comment block isInCommentBlock = True - if (c == '/'): # Otherwise, will check if we are in an line comment + elif (c == '/'): # Otherwise, will check if we are in an line comment ignoreTillEndOfLine = True # and an line comment is a / followed by another / (//) We won't care about anything that comes after it + if (isInCommentBlock == False): if (ignoreTillEndOfLine): # we are in a line comment, just continue going through the characters until we find an end of line if (c == '\n'): ignoreTillEndOfLine = False - else: - if (c == '"'): + else: # validate brackets + if (c == '"' or c == "'"): isInString = True inStringType = c + elif (c == '#'): + ignoreTillEndOfLine = True elif (c == '/'): checkIfInComment = True elif (c == '('): brackets_list.append('(') elif (c == ')'): if (brackets_list[-1] in ['{', '[']): - print("Possible missing round bracket ')' detected at {0} Line number: {1}".format(filepath,lineNumber)) + print("ERROR: Possible missing round bracket ')' detected at {0} Line number: {1}".format(filepath,lineNumber)) bad_count_file += 1 brackets_list.append(')') elif (c == '['): brackets_list.append('[') elif (c == ']'): if (brackets_list[-1] in ['{', '(']): - print("Possible missing square bracket ']' detected at {0} Line number: {1}".format(filepath,lineNumber)) + print("ERROR: Possible missing square bracket ']' detected at {0} Line number: {1}".format(filepath,lineNumber)) bad_count_file += 1 brackets_list.append(']') elif (c == '{'): brackets_list.append('{') elif (c == '}'): + lastIsCurlyBrace = True if (brackets_list[-1] in ['(', '[']): - print("Possible missing curly brace '}}' detected at {0} Line number: {1}".format(filepath,lineNumber)) + print("ERROR: Possible missing curly brace '}}' detected at {0} Line number: {1}".format(filepath,lineNumber)) bad_count_file += 1 brackets_list.append('}') - else: + + if (checkForSemiColumn): + if (c not in [' ', '\t', '\n', '/']): # keep reading until no white space or comments + checkForSemiColumn = False + if (c not in [']', ')', '}', ';', ',', '&', '!', '|', '='] and not validKeyWordAfterCode(content, indexOfCharacter)): # , 'f', 'd', 'c', 'e', 'a', 'n', 'i']): + print("ERROR: Possible missing semi-column ';' detected at {0} Line number: {1}".format(filepath,lineNumber)) + bad_count_file += 1 + + else: # Look for the end of our comment block if (c == '*'): checkIfNextIsClosingBlock = True; elif (checkIfNextIsClosingBlock): @@ -79,39 +125,49 @@ def check_sqf_syntax(filepath): isInCommentBlock = False elif (c != '*'): checkIfNextIsClosingBlock = False + indexOfCharacter += 1 if brackets_list.count('[') != brackets_list.count(']'): - print("A possible missing square bracket [ or ] in file {0} [ = {1} ] = {2}".format(filepath,brackets_list.count('['),brackets_list.count(']'))) + print("ERROR: A possible missing square bracket [ or ] in file {0} [ = {1} ] = {2}".format(filepath,brackets_list.count('['),brackets_list.count(']'))) bad_count_file += 1 if brackets_list.count('(') != brackets_list.count(')'): - print("A possible missing round bracket ( or ) in file {0} ( = {1} ) = {2}".format(filepath,brackets_list.count('('),brackets_list.count(')'))) + print("ERROR: A possible missing round bracket ( or ) in file {0} ( = {1} ) = {2}".format(filepath,brackets_list.count('('),brackets_list.count(')'))) bad_count_file += 1 if brackets_list.count('{') != brackets_list.count('}'): - print("A possible missing curly brace {{ or }} in file {0} {{ = {1} }} = {2}".format(filepath,brackets_list.count('{'),brackets_list.count('}'))) + print("ERROR: A possible missing curly brace {{ or }} in file {0} {{ = {1} }} = {2}".format(filepath,brackets_list.count('{'),brackets_list.count('}'))) bad_count_file += 1 return bad_count_file def main(): - print("#########################") - print("# Validate SQF files missing brackets #") - print("#########################") + print("Validating SQF") sqf_list = [] bad_count = 0 parser = argparse.ArgumentParser() - parser.add_argument('-m','--module', help='only search specified module addon folder', required=False, default=".") + parser.add_argument('-m','--module', help='only search specified module addon folder', required=False, default="") args = parser.parse_args() - for root, dirnames, filenames in os.walk('../addons' + '/' + args.module): + # Allow running from root directory as well as from inside the tools directory + rootDir = "../addons" + if (os.path.exists("addons")): + rootDir = "addons" + + for root, dirnames, filenames in os.walk(rootDir + '/' + args.module): for filename in fnmatch.filter(filenames, '*.sqf'): sqf_list.append(os.path.join(root, filename)) for filename in sqf_list: bad_count = bad_count + check_sqf_syntax(filename) - print("Bad Count {0}".format(bad_count)) + + print("------\nChecked {0} files\nErrors detected: {1}".format(len(sqf_list), bad_count)) + if (bad_count == 0): + print("SQF validation PASSED") + else: + print("SQF validation FAILED") + return bad_count if __name__ == "__main__":