diff --git a/.travis.yml b/.travis.yml index 388b1f114f..0aadd9cd0b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,6 +9,7 @@ before_script: - pip install pygithub3 script: - python3 tools/deploy.py + - python3 tools/sqf_validator.py env: global: - secure: "KcJQbknBOdC5lA4nFGKPXVRVIGLDXDRzC8XkHuXJCE9pIR/wbxbkvx8fHKcC6SC9eHgzneC3+o4m4+CjIbVvIwDgslRbJ8Y59i90ncONmdoRx1HUYHwuYWVZm9HJFjCsIbrEqhSyyKS+PB3WZVOLbErtNHsgS8f43PTh5Ujg7Vg=" diff --git a/AUTHORS.txt b/AUTHORS.txt index 62329d7c1d..caa19109a7 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -1,4 +1,4 @@ -# ACE 3 CONTRIBUTOR LIST +# ACE3 CONTRIBUTOR LIST # If you contributed, but are not listed here, contact me: # koffeinflummi@gmail.com # @@ -14,6 +14,7 @@ Garth "L-H" de Wet Giallustio Glowbal Janus +jokoho482 ` Kieran NouberNou PabstMirror @@ -50,6 +51,8 @@ Coren Crusty Dharma Bellamkonda Dimaslg +Drill +Dudakov eRazeri evromalarkey F3 Project @@ -68,8 +71,7 @@ Hamburger SV Harakhti havena Hawkins -Head -jokoho482 ` +Head Jonpas Karneck Kavinsky @@ -81,6 +83,7 @@ Macusercom MarcBook meat Michail Nikolaev +MikeMatrix nic547 nikolauska nomisum @@ -106,5 +109,3 @@ Valentin Torikian VyMajoris(W-Cephei) Winter zGuba -Drill -MikeMatrix diff --git a/README.md b/README.md index 2739ce55be..5a01e5d5de 100644 --- a/README.md +++ b/README.md @@ -3,75 +3,78 @@

- ACE3 version + ACE3 Version - - ACE3 download + + ACE3 Download - ACE3 issues + ACE3 Issues - - BIF thread + + BIF Thread - ACE3 license + ACE3 License + + + ACE3 Slack

-

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

+

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

**ACE3** is a joint effort by the teams behind **ACE2**, **AGM** and **CSE** to improve the realism and authenticity of Arma 3. The project is entirely **open-source** and all contributions are welcome. Feel free to maintain your own custom version, so long as the changes you make are open to the public in accordance with the GNU General Public License ([GPLv2](https://github.com/acemod/ACE3/blob/master/LICENSE)). -The mod is **built modularly**, so almost any included PBO can be easily removed from the configuration. This way, a team can maintain its own tailored version of ACE by simply excluding any components they don't need, or those possibly in conflict with other add-ons. Modules themselves, e.g. the medical system, also include various customization options, allowing mission designers to tweak the overall experience. +The mod is **built modularly**, so almost any included PBO can be easily removed from the configuration. This way, a team can maintain its own tailored version of ACE3 by simply excluding any components they don't need, or those possibly in conflict with other mods. Modules themselves, e.g. the medical system, also include various customization options, allowing mission designers to tweak the overall experience. ### Core features -* Brand new 3D interaction/action system -* Performance and reliability framework -* Focus on modularity and customization -* New flexible client and server settings & configuration -* Improved medical system with various levels (basic/advanced) focus on gameplay/realism -* Proper & consistent network-synced weather -* Wind and weather-based ballistics -* Captivity system -* Explosives system, including different trigger types -* Map screen improvements – marker placement and map tools -* Advanced missile guidance and laser designation +- Brand new 3D interaction/action system +- Performance and reliability framework +- Focus on modularity and customization +- New flexible client and server settings & configuration +- Improved medical system with various levels (basic/advanced) focus on gameplay/realism +- Proper & consistent network-synced weather +- Wind and weather-based ballistics +- Captivity system +- Explosives system, including different trigger types +- Map screen improvements – marker placement and map tools +- Advanced missile guidance and laser designation #### Additional features -* Carrying and dragging -* Realistic names for vehicles and weapons -* A fire control system (FCS) for armored vehicles and helicopters -* Realistic ballistics/FCS calculated in C/C++ extensions -* Backblast area and overpressure simulation -* Disposable launchers -* Realistic G-forces -* Vehicle locking -* Realistic night and thermal vision modes -* Magazine repacking -* Realistic weapon overheating mechanic -* Combat deafness (temporary loss of hearing) simulation -* Improved ragdoll physics -* Improved interactions for AARs and ammo bearers -* Adjustable sniper scopes -* No idle animation with lowered weapon -* No talking player avatar -* Jumping over obstacles, climbing over walls and cutting down fences -* Vector, MicroDAGR and Kestrel devices
+- Carrying and dragging +- Realistic names for vehicles and weapons +- A fire control system (FCS) for armored vehicles and helicopters +- Realistic ballistics/FCS calculated in C/C++ extensions +- Backblast area and overpressure simulation +- Disposable launchers +- Realistic G-forces +- Vehicle locking +- Realistic night and thermal vision modes +- Magazine repacking +- Realistic weapon overheating mechanic +- Combat deafness (temporary loss of hearing) simulation +- Improved ragdoll physics +- Improved interactions for AARs and ammo bearers +- Adjustable sniper scopes +- No idle animation with lowered weapon +- No talking player avatar +- Jumping over obstacles, climbing over walls and cutting down fences +- Vector, MicroDAGR and Kestrel devices
***and much more...*** ### 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) +- [Getting started](http://ace3mod.com/wiki/user/getting-started.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 ACE, 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. +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. Please, use our [Issue Tracker](https://github.com/acemod/ACE3/issues) to report a bug, propose a feature, or suggest changes to the existing ones. See also: -* [How to report an issue](http://ace3mod.com/wiki/user/how-to-report-an-issue.html) -* [How to make a feature request](http://ace3mod.com/wiki/user/how-to-make-a-feature-request.html) +- [How to report an issue](http://ace3mod.com/wiki/user/how-to-report-an-issue.html) +- [How to make a feature request](http://ace3mod.com/wiki/user/how-to-make-a-feature-request.html) #### Testing & building To help us test the latest development changes, download our master branch ([directly](https://github.com/acemod/ACE3/archive/master.zip), or [with git](https://help.github.com/articles/fetching-a-remote/)), then assemble a test build: -* [Setting up the development environment](http://ace3mod.com/wiki/development/setting-up-the-development-environment.html) – step-by-step instructions on how to properly setup and build a version of ACE for testing purposes. +- [Setting up the development environment](http://ace3mod.com/wiki/development/setting-up-the-development-environment.html) – step-by-step instructions on how to properly setup and build a version of ACE3 for testing purposes. diff --git a/ace_medical.dll b/ace_medical.dll index 790154d4c4..c54febf34f 100644 Binary files a/ace_medical.dll and b/ace_medical.dll differ diff --git a/addons/advanced_ballistics/README.md b/addons/advanced_ballistics/README.md index ef98bcd2b6..122769b191 100644 --- a/addons/advanced_ballistics/README.md +++ b/addons/advanced_ballistics/README.md @@ -3,8 +3,9 @@ ace_advanced_ballistics The Advanced Ballistics module introduces advanced external- and internal ballistics to the game. + ## Maintainers The people responsible for merging changes to this component or answering potential questions. -- [Ruthberg] (http://github.com/Ulteq) \ No newline at end of file +- [Ruthberg](http://github.com/Ulteq) diff --git a/addons/advanced_ballistics/XEH_postInit.sqf b/addons/advanced_ballistics/XEH_postInit.sqf index b199acb9e5..1f9002e606 100644 --- a/addons/advanced_ballistics/XEH_postInit.sqf +++ b/addons/advanced_ballistics/XEH_postInit.sqf @@ -6,9 +6,8 @@ GVAR(currentbulletID) = -1; GVAR(Protractor) = false; GVAR(ProtractorStart) = ACE_time; - +GVAR(allBullets) = []; GVAR(currentGrid) = 0; -GVAR(initMessageEnabled) = false; GVAR(extensionAvailable) = true; /* @TODO: Remove this until versioning is in sync with cmake/build versioning diff --git a/addons/advanced_ballistics/XEH_preInit.sqf b/addons/advanced_ballistics/XEH_preInit.sqf index 12018ad412..f722d9c573 100644 --- a/addons/advanced_ballistics/XEH_preInit.sqf +++ b/addons/advanced_ballistics/XEH_preInit.sqf @@ -13,5 +13,5 @@ PREP(initializeTerrainExtension); PREP(initModuleSettings); PREP(readAmmoDataFromConfig); PREP(readWeaponDataFromConfig); - +PREP(handleFirePFH); ADDON = true; diff --git a/addons/advanced_ballistics/functions/fnc_calculateAmmoTemperatureVelocityShift.sqf b/addons/advanced_ballistics/functions/fnc_calculateAmmoTemperatureVelocityShift.sqf index 28df9d1d97..8b0c78e86c 100644 --- a/addons/advanced_ballistics/functions/fnc_calculateAmmoTemperatureVelocityShift.sqf +++ b/addons/advanced_ballistics/functions/fnc_calculateAmmoTemperatureVelocityShift.sqf @@ -8,29 +8,29 @@ * 1: temperature - degrees celcius * * Return Value: - * 0: muzzle velocity shift - m/s + * muzzle velocity shift - m/s * - * Return value: - * None + * Public: No */ #include "script_component.hpp" -private ["_muzzleVelocityShiftTable", "_temperature", "_muzzleVelocityShift", "_temperatureIndexA", "_temperatureIndexB", "_temperatureRatio"]; -_muzzleVelocityShiftTable = _this select 0; -_temperature = _this select 1; +private ["_muzzleVelocityShiftTableUpperLimit", "_temperatureIndexFunction", + "_temperatureIndexA", "_temperatureIndexB", "_interpolationRatio"]; +params["_muzzleVelocityShiftTable", "_temperature"]; -if (count _muzzleVelocityShiftTable != 11) exitWith { 0 }; +// Check if muzzleVelocityShiftTable is Larger Than 11 Entrys +_muzzleVelocityShiftTableUpperLimit = _muzzleVelocityShiftTable select 10; +if (isNil "_muzzleVelocityShiftTableUpperLimit") exitWith { 0 }; -_temperatureIndexA = floor((_temperature + 15) / 5); -_temperatureIndexA = 0 max _temperatureIndexA; -_temperatureIndexA = _temperatureIndexA min 10; +// Find exact data index required for given temperature +_temperatureIndexFunction = (_temperature + 15) / 5; -_temperatureIndexB = ceil((_temperature + 15) / 5); -_temperatureIndexB = 0 max _temperatureIndexB; -_temperatureIndexB = _temperatureIndexB min 10; +// lower and upper data index used for interpolation +_temperatureIndexA = (0 max (floor(_temperatureIndexFunction))) min 10; +_temperatureIndexB = (0 max (ceil(_temperatureIndexFunction))) min 10; -_temperatureRatio = ((_temperature + 15) / 5) - floor((_temperature + 15) / 5); +// Interpolation ratio +_interpolationRatio = _temperatureIndexFunction - floor(_temperatureIndexFunction); -_muzzleVelocityShift = (_muzzleVelocityShiftTable select _temperatureIndexA) * (1 - _temperatureRatio) + (_muzzleVelocityShiftTable select _temperatureIndexB) * _temperatureRatio; - -_muzzleVelocityShift +// Interpolation +(_muzzleVelocityShiftTable select _temperatureIndexA) * (1 - _interpolationRatio) + (_muzzleVelocityShiftTable select _temperatureIndexB) * _interpolationRatio // Return diff --git a/addons/advanced_ballistics/functions/fnc_calculateAtmosphericCorrection.sqf b/addons/advanced_ballistics/functions/fnc_calculateAtmosphericCorrection.sqf index b0166109f5..fac048c061 100644 --- a/addons/advanced_ballistics/functions/fnc_calculateAtmosphericCorrection.sqf +++ b/addons/advanced_ballistics/functions/fnc_calculateAtmosphericCorrection.sqf @@ -17,12 +17,9 @@ */ #include "script_component.hpp" -private ["_ballisticCoefficient", "_temperature", "_pressure", "_relativeHumidity", "_atmosphereModel", "_airDensity"]; -_ballisticCoefficient = _this select 0; -_temperature = _this select 1; // in C -_pressure = _this select 2; // in hPa -_relativeHumidity = _this select 3; // as ratio 0-1 -_atmosphereModel = _this select 4; // "ICAO" or "ASM" +private "_airDensity"; + +params ["_ballisticCoefficient", "_temperature"/*in C*/, "_pressure"/*in hPa*/, "_relativeHumidity"/*as ratio 0-1*/, "_atmosphereModel"/*"ICAO" or "ASM"*/]; _airDensity = [_temperature, _pressure, _relativeHumidity] call EFUNC(weather,calculateAirDensity); diff --git a/addons/advanced_ballistics/functions/fnc_calculateBarrelLengthVelocityShift.sqf b/addons/advanced_ballistics/functions/fnc_calculateBarrelLengthVelocityShift.sqf index de037f49bc..9c46cc2423 100644 --- a/addons/advanced_ballistics/functions/fnc_calculateBarrelLengthVelocityShift.sqf +++ b/addons/advanced_ballistics/functions/fnc_calculateBarrelLengthVelocityShift.sqf @@ -1,5 +1,5 @@ /* - * Author: Ruthberg + * Author: Ruthberg, MikeMatrix, joko // Jonas * * Calculates the muzzle velocity shift caused by different barrel lengths * @@ -10,46 +10,61 @@ * 3: muzzle velocity - m/s * * Return Value: - * 0: muzzle velocity shift - m/s + * muzzle velocity shift - m/s * - * Return value: - * None + * Public: No */ #include "script_component.hpp" -private ["_barrelLength", "_muzzleVelocityTable", "_barrelLengthTable", "_muzzleVelocity", "_lowerIndex", "_upperIndex", "_barrelLengthRatio", "_muzzleVelocityNew"]; -_barrelLength = _this select 0; -_muzzleVelocityTable = _this select 1; -_barrelLengthTable = _this select 2; -_muzzleVelocity = _this select 3; +scopeName "main"; +private ["_muzzleVelocityTableCount", "_barrelLengthTableCount", "_lowerDataIndex", + "_upperDataIndex", "_lowerBarrelLength", "_upperBarrelLength", "_lowerMuzzleVelocity", + "_upperMuzzleVelocity", "_interpolationRatio"]; +params ["_barrelLength", "_muzzleVelocityTable", "_barrelLengthTable", "_muzzleVelocity"]; + +// If barrel length is not defined, then there is no point in calculating muzzle velocity if (_barrelLength == 0) exitWith { 0 }; -if (count _muzzleVelocityTable != count _barrelLengthTable) exitWith { 0 }; -if (count _muzzleVelocityTable == 0 || count _barrelLengthTable == 0) exitWith { 0 }; -if (count _muzzleVelocityTable == 1) exitWith { (_muzzleVelocityTable select 0) - _muzzleVelocity }; -_lowerIndex = 0; -_upperIndex = (count _barrelLengthTable) - 1; +_muzzleVelocityTableCount = count _muzzleVelocityTable; +_barrelLengthTableCount = count _barrelLengthTable; -if (_barrelLength <= (_barrelLengthTable select _lowerIndex)) exitWith { (_muzzleVelocityTable select _lowerIndex) - _muzzleVelocity }; -if (_barrelLength >= (_barrelLengthTable select _upperIndex)) exitWith { (_muzzleVelocityTable select _upperIndex) - _muzzleVelocity }; +// Exit if tables are different sizes, have no elements or have only one element +if (_muzzleVelocityTableCount != _barrelLengthTableCount || _muzzleVelocityTableCount == 0 || _barrelLengthTableCount == 0) exitWith { 0 }; +if (_muzzleVelocityTableCount == 1) exitWith { (_muzzleVelocityTable select 0) - _muzzleVelocity }; -for "_i" from 0 to (count _barrelLengthTable) - 1 do { - if (_barrelLength >= _barrelLengthTable select _i) then { - _lowerIndex = _i; - }; -}; -for "_i" from (count _barrelLengthTable) - 1 to 0 step -1 do { - if (_barrelLength <= _barrelLengthTable select _i) then { - _upperIndex = _i; +// If we have the precise barrel length value, return result immediately +if (_barrelLength in _barrelLengthTable) exitWith { + (_muzzleVelocityTable select (_barrelLengthTable find _barrelLength)) - _muzzleVelocity +}; + +// Limit values to lower and upper bound of data we have available +if (_barrelLength <= (_barrelLengthTable select 0)) exitWith { (_muzzleVelocityTable select 0) - _muzzleVelocity }; +if (_barrelLength >= (_barrelLengthTable select _barrelLengthTableCount - 1)) exitWith { (_muzzleVelocityTable select _barrelLengthTableCount - 1) - _muzzleVelocity }; + +// Find closest bordering values for barrel length +{ + if (_barrelLength <= _x) then { + _upperDataIndex = _forEachIndex; + _lowerDataIndex = _upperDataIndex - 1; + breakTo "main"; }; +} forEach _barrelLengthTable; + +// Worst case scenario +if (isNil "_lowerDataIndex" || isNil "_upperDataIndex") exitWith {0}; + +_lowerBarrelLength = _barrelLengthTable select _lowerDataIndex; +_upperBarrelLength = _barrelLengthTable select _upperDataIndex; +_lowerMuzzleVelocity = _muzzleVelocityTable select _lowerDataIndex; +_upperMuzzleVelocity = _muzzleVelocityTable select _upperDataIndex; + +// Calculate interpolation ratio +_interpolationRatio = if (abs (_lowerBarrelLength - _upperBarrelLength) > 0) then { + (_upperBarrelLength - _barrelLength) / (_upperBarrelLength - _lowerBarrelLength) +} else { + 0 }; -_barrelLengthRatio = 0; -if ((_barrelLengthTable select _upperIndex) - (_barrelLengthTable select _lowerIndex) > 0) then { - _barrelLengthRatio = ((_barrelLengthTable select _upperIndex) - _barrelLength) / ((_barrelLengthTable select _upperIndex) - (_barrelLengthTable select _lowerIndex)); -}; - -_muzzleVelocityNew = (_muzzleVelocityTable select _lowerIndex) + ((_muzzleVelocityTable select _upperIndex) - (_muzzleVelocityTable select _lowerIndex)) * (1 - _barrelLengthRatio); - -_muzzleVelocityNew - _muzzleVelocity +// Calculate interpolated muzzle velocity shift +(_lowerMuzzleVelocity + ((_upperMuzzleVelocity - _lowerMuzzleVelocity) * (1 - _interpolationRatio))) - _muzzleVelocity // Return diff --git a/addons/advanced_ballistics/functions/fnc_calculateRetardation.sqf b/addons/advanced_ballistics/functions/fnc_calculateRetardation.sqf index 433dafbe10..0bd801c6b9 100644 --- a/addons/advanced_ballistics/functions/fnc_calculateRetardation.sqf +++ b/addons/advanced_ballistics/functions/fnc_calculateRetardation.sqf @@ -4,142 +4,129 @@ * Calculates the retardation of the bullet * * Arguments: - * 0: drag model - 1-7 + * 0: drag model - integer 1-7 * 1: drag coefficient - bc * 2: velocity - m/s * * Return Value: - * 0: retardation - m/(s^2) + * retardation - m/(s^2) * - * Return value: - * None + * Public: No */ #include "script_component.hpp" // Source: GNU Exterior Ballistics -private ["_dragModel", "_dragCoefficient", "_velocity", "_A", "_M", "_result"]; -_dragModel = _this select 0; -_dragCoefficient = _this select 1; -_velocity = (_this select 2) * 3.2808399; - -_A = -1; -_M = -1; -_result = 0; +private ["_A", "_M"]; +params ["_dragModel", "_dragCoefficient", "_velocity"]; +_velocity = _velocity * 3.2808399; switch _dragModel do { - case 1: - { - switch true do { - case (_velocity > 4230) : { _A = 0.0001477404177730177; _M = 1.9565; }; - case (_velocity > 3680) : { _A = 0.0001920339268755614; _M = 1.925 ; }; - case (_velocity > 3450) : { _A = 0.0002894751026819746; _M = 1.875 ; }; - case (_velocity > 3295) : { _A = 0.0004349905111115636; _M = 1.825 ; }; - case (_velocity > 3130) : { _A = 0.0006520421871892662; _M = 1.775 ; }; - case (_velocity > 2960) : { _A = 0.0009748073694078696; _M = 1.725 ; }; - case (_velocity > 2830) : { _A = 0.001453721560187286; _M = 1.675 ; }; - case (_velocity > 2680) : { _A = 0.002162887202930376; _M = 1.625 ; }; - case (_velocity > 2460) : { _A = 0.003209559783129881; _M = 1.575 ; }; - case (_velocity > 2225) : { _A = 0.003904368218691249; _M = 1.55 ; }; - case (_velocity > 2015) : { _A = 0.003222942271262336; _M = 1.575 ; }; - case (_velocity > 1890) : { _A = 0.002203329542297809; _M = 1.625 ; }; - case (_velocity > 1810) : { _A = 0.001511001028891904; _M = 1.675 ; }; - case (_velocity > 1730) : { _A = 0.0008609957592468259; _M = 1.75 ; }; - case (_velocity > 1595) : { _A = 0.0004086146797305117; _M = 1.85 ; }; - case (_velocity > 1520) : { _A = 0.0001954473210037398; _M = 1.95 ; }; - case (_velocity > 1420) : { _A = 0.00005431896266462351; _M = 2.125 ; }; - case (_velocity > 1360) : { _A = 0.000008847742581674416; _M = 2.375 ; }; - case (_velocity > 1315) : { _A = 0.000001456922328720298; _M = 2.625 ; }; - case (_velocity > 1280) : { _A = 0.0000002419485191895565; _M = 2.875 ; }; - case (_velocity > 1220) : { _A = 0.00000001657956321067612; _M = 3.25 ; }; - case (_velocity > 1185) : { _A = 0.0000000004745469537157371; _M = 3.75 ; }; - case (_velocity > 1150) : { _A = 0.00000000001379746590025088; _M = 4.25 ; }; - case (_velocity > 1100) : { _A = 0.0000000000004070157961147882; _M = 4.75 ; }; - case (_velocity > 1060) : { _A = 0.00000000000002938236954847331; _M = 5.125 ; }; - case (_velocity > 1025) : { _A = 0.00000000000001228597370774746; _M = 5.25 ; }; - case (_velocity > 980) : { _A = 0.00000000000002916938264100495; _M = 5.125 ; }; - case (_velocity > 945) : { _A = 0.0000000000003855099424807451; _M = 4.75 ; }; - case (_velocity > 905) : { _A = 0.00000000001185097045689854; _M = 4.25 ; }; - case (_velocity > 860) : { _A = 0.0000000003566129470974951; _M = 3.75 ; }; - case (_velocity > 810) : { _A = 0.00000001045513263966272; _M = 3.25 ; }; - case (_velocity > 780) : { _A = 0.0000001291159200846216; _M = 2.875 ; }; - case (_velocity > 750) : { _A = 0.0000006824429329105383; _M = 2.625 ; }; - case (_velocity > 700) : { _A = 0.000003569169672385163; _M = 2.375 ; }; - case (_velocity > 640) : { _A = 0.00001839015095899579; _M = 2.125 ; }; - case (_velocity > 600) : { _A = 0.00005711174688734240; _M = 1.950 ; }; - case (_velocity > 550) : { _A = 0.00009226557091973427; _M = 1.875 ; }; - case (_velocity > 250) : { _A = 0.00009337991957131389; _M = 1.875 ; }; - case (_velocity > 100) : { _A = 0.00007225247327590413; _M = 1.925 ; }; - case (_velocity > 65) : { _A = 0.00005792684957074546; _M = 1.975 ; }; - case (_velocity > 0) : { _A = 0.00005206214107320588; _M = 2.000 ; }; + case 1: { + call { + if (_velocity > 4230) exitWith { _A = 0.0001477404177730177; _M = 1.9565; }; + if (_velocity > 3680) exitWith { _A = 0.0001920339268755614; _M = 1.925; }; + if (_velocity > 3450) exitWith { _A = 0.0002894751026819746; _M = 1.875; }; + if (_velocity > 3295) exitWith { _A = 0.0004349905111115636; _M = 1.825; }; + if (_velocity > 3130) exitWith { _A = 0.0006520421871892662; _M = 1.775; }; + if (_velocity > 2960) exitWith { _A = 0.0009748073694078696; _M = 1.725; }; + if (_velocity > 2830) exitWith { _A = 0.001453721560187286; _M = 1.675; }; + if (_velocity > 2680) exitWith { _A = 0.002162887202930376; _M = 1.625; }; + if (_velocity > 2460) exitWith { _A = 0.003209559783129881; _M = 1.575; }; + if (_velocity > 2225) exitWith { _A = 0.003904368218691249; _M = 1.55; }; + if (_velocity > 2015) exitWith { _A = 0.003222942271262336; _M = 1.575; }; + if (_velocity > 1890) exitWith { _A = 0.002203329542297809; _M = 1.625; }; + if (_velocity > 1810) exitWith { _A = 0.001511001028891904; _M = 1.675; }; + if (_velocity > 1730) exitWith { _A = 0.0008609957592468259; _M = 1.75; }; + if (_velocity > 1595) exitWith { _A = 0.0004086146797305117; _M = 1.85; }; + if (_velocity > 1520) exitWith { _A = 0.0001954473210037398; _M = 1.95; }; + if (_velocity > 1420) exitWith { _A = 0.00005431896266462351; _M = 2.125; }; + if (_velocity > 1360) exitWith { _A = 0.000008847742581674416; _M = 2.375; }; + if (_velocity > 1315) exitWith { _A = 0.000001456922328720298; _M = 2.625; }; + if (_velocity > 1280) exitWith { _A = 0.0000002419485191895565; _M = 2.875; }; + if (_velocity > 1220) exitWith { _A = 0.00000001657956321067612; _M = 3.25; }; + if (_velocity > 1185) exitWith { _A = 0.0000000004745469537157371; _M = 3.75; }; + if (_velocity > 1150) exitWith { _A = 0.00000000001379746590025088; _M = 4.25; }; + if (_velocity > 1100) exitWith { _A = 0.0000000000004070157961147882; _M = 4.75; }; + if (_velocity > 1060) exitWith { _A = 0.00000000000002938236954847331; _M = 5.125; }; + if (_velocity > 1025) exitWith { _A = 0.00000000000001228597370774746; _M = 5.25; }; + if (_velocity > 980) exitWith { _A = 0.00000000000002916938264100495; _M = 5.125; }; + if (_velocity > 945) exitWith { _A = 0.0000000000003855099424807451; _M = 4.75; }; + if (_velocity > 905) exitWith { _A = 0.00000000001185097045689854; _M = 4.25; }; + if (_velocity > 860) exitWith { _A = 0.0000000003566129470974951; _M = 3.75; }; + if (_velocity > 810) exitWith { _A = 0.00000001045513263966272; _M = 3.25; }; + if (_velocity > 780) exitWith { _A = 0.0000001291159200846216; _M = 2.875; }; + if (_velocity > 750) exitWith { _A = 0.0000006824429329105383; _M = 2.625; }; + if (_velocity > 700) exitWith { _A = 0.000003569169672385163; _M = 2.375; }; + if (_velocity > 640) exitWith { _A = 0.00001839015095899579; _M = 2.125; }; + if (_velocity > 600) exitWith { _A = 0.00005711174688734240; _M = 1.950; }; + if (_velocity > 550) exitWith { _A = 0.00009226557091973427; _M = 1.875; }; + if (_velocity > 250) exitWith { _A = 0.00009337991957131389; _M = 1.875; }; + if (_velocity > 100) exitWith { _A = 0.00007225247327590413; _M = 1.925; }; + if (_velocity > 65) exitWith { _A = 0.00005792684957074546; _M = 1.975; }; + if (_velocity > 0) exitWith { _A = 0.00005206214107320588; _M = 2.000; }; }; }; - case 2: - { - switch true do { - case (_velocity > 1674) : { _A = 0.0079470052136733; _M = 1.36999902851493; }; - case (_velocity > 1172) : { _A = 0.00100419763721974; _M = 1.65392237010294; }; - case (_velocity > 1060) : { _A = 0.0000000000000000000000715571228255369; _M = 7.91913562392361; }; - case (_velocity > 949) : { _A = 0.000000000139589807205091; _M = 3.81439537623717; }; - case (_velocity > 670) : { _A = 0.000234364342818625; _M = 1.71869536324748; }; - case (_velocity > 335) : { _A = 0.000177962438921838; _M = 1.76877550388679; }; - case (_velocity > 0) : { _A = 0.0000518033561289704; _M = 1.98160270524632; }; + case 2: { + call { + if (_velocity > 1674) exitWith { _A = 0.0079470052136733; _M = 1.36999902851493; }; + if (_velocity > 1172) exitWith { _A = 0.00100419763721974; _M = 1.65392237010294; }; + if (_velocity > 1060) exitWith { _A = 0.0000000000000000000000715571228255369; _M = 7.91913562392361; }; + if (_velocity > 949) exitWith { _A = 0.000000000139589807205091; _M = 3.81439537623717; }; + if (_velocity > 670) exitWith { _A = 0.000234364342818625; _M = 1.71869536324748; }; + if (_velocity > 335) exitWith { _A = 0.000177962438921838; _M = 1.76877550388679; }; + if (_velocity > 0) exitWith { _A = 0.0000518033561289704; _M = 1.98160270524632; }; }; }; - case 5: - { - switch true do { - case (_velocity > 1730) : { _A = 0.00724854775171929; _M = 1.41538574492812; }; - case (_velocity > 1228) : { _A = 0.0000350563361516117; _M = 2.13077307854948; }; - case (_velocity > 1116) : { _A = 0.000000000000184029481181151; _M = 4.81927320350395; }; - case (_velocity > 1004) : { _A = 0.000000000000000000000134713064017409; _M = 7.8100555281422 ; }; - case (_velocity > 837) : { _A = 0.000000103965974081168; _M = 2.84204791809926; }; - case (_velocity > 335) : { _A = 0.0001093015938698234; _M = 1.81096361579504; }; - case (_velocity > 0) : { _A = 0.0000351963178524273; _M = 2.00477856801111; }; + case 5: { + call { + if (_velocity > 1730) exitWith { _A = 0.00724854775171929; _M = 1.41538574492812; }; + if (_velocity > 1228) exitWith { _A = 0.0000350563361516117; _M = 2.13077307854948; }; + if (_velocity > 1116) exitWith { _A = 0.000000000000184029481181151; _M = 4.81927320350395; }; + if (_velocity > 1004) exitWith { _A = 0.000000000000000000000134713064017409; _M = 7.8100555281422; }; + if (_velocity > 837) exitWith { _A = 0.000000103965974081168; _M = 2.84204791809926; }; + if (_velocity > 335) exitWith { _A = 0.0001093015938698234; _M = 1.81096361579504; }; + if (_velocity > 0) exitWith { _A = 0.0000351963178524273; _M = 2.00477856801111; }; }; }; - case 6: - { - switch true do { - case (_velocity > 3236) : { _A = 0.0455384883480781; _M = 1.15997674041274; }; - case (_velocity > 2065) : { _A = 0.07167261849653769; _M = 1.10704436538885; }; - case (_velocity > 1311) : { _A = 0.00166676386084348; _M = 1.60085100195952; }; - case (_velocity > 1144) : { _A = 0.000000101482730119215; _M = 2.9569674731838 ; }; - case (_velocity > 1004) : { _A = 0.00000000000000000431542773103552; _M = 6.34106317069757; }; - case (_velocity > 670) : { _A = 0.0000204835650496866; _M = 2.11688446325998; }; - case (_velocity > 0) : { _A = 0.0000750912466084823; _M = 1.92031057847052; }; + case 6: { + call { + if (_velocity > 3236) exitWith { _A = 0.0455384883480781; _M = 1.15997674041274; }; + if (_velocity > 2065) exitWith { _A = 0.07167261849653769; _M = 1.10704436538885; }; + if (_velocity > 1311) exitWith { _A = 0.00166676386084348; _M = 1.60085100195952; }; + if (_velocity > 1144) exitWith { _A = 0.000000101482730119215; _M = 2.9569674731838; }; + if (_velocity > 1004) exitWith { _A = 0.00000000000000000431542773103552; _M = 6.34106317069757; }; + if (_velocity > 670) exitWith { _A = 0.0000204835650496866; _M = 2.11688446325998; }; + if (_velocity > 0) exitWith { _A = 0.0000750912466084823; _M = 1.92031057847052; }; }; }; - case 7: - { - switch true do { - case (_velocity > 4200) : { _A = 0.00000000129081656775919; _M = 3.24121295355962; }; - case (_velocity > 3000) : { _A = 0.0171422231434847; _M = 1.27907168025204; }; - case (_velocity > 1470) : { _A = 0.00233355948302505; _M = 1.52693913274526; }; - case (_velocity > 1260) : { _A = 0.000797592111627665; _M = 1.67688974440324; }; - case (_velocity > 1110) : { _A = 0.00000000000571086414289273; _M = 4.3212826264889 ; }; - case (_velocity > 960) : { _A = 0.0000000000000000302865108244904; _M = 5.99074203776707; }; - case (_velocity > 670) : { _A = 0.00000752285155782535; _M = 2.1738019851075 ; }; - case (_velocity > 540) : { _A = 0.0000131766281225189; _M = 2.08774690257991; }; - case (_velocity > 0) : { _A = 0.0000134504843776525; _M = 2.08702306738884; }; + case 7: { + call { + if (_velocity > 4200) exitWith { _A = 0.00000000129081656775919; _M = 3.24121295355962; }; + if (_velocity > 3000) exitWith { _A = 0.0171422231434847; _M = 1.27907168025204; }; + if (_velocity > 1470) exitWith { _A = 0.00233355948302505; _M = 1.52693913274526; }; + if (_velocity > 1260) exitWith { _A = 0.000797592111627665; _M = 1.67688974440324; }; + if (_velocity > 1110) exitWith { _A = 0.00000000000571086414289273; _M = 4.3212826264889; }; + if (_velocity > 960) exitWith { _A = 0.0000000000000000302865108244904; _M = 5.99074203776707; }; + if (_velocity > 670) exitWith { _A = 0.00000752285155782535; _M = 2.1738019851075; }; + if (_velocity > 540) exitWith { _A = 0.0000131766281225189; _M = 2.08774690257991; }; + if (_velocity > 0) exitWith { _A = 0.0000134504843776525; _M = 2.08702306738884; }; }; }; - case 8: - { - switch true do { - case (_velocity > 3571) : { _A = 0.0112263766252305; _M = 1.33207346655961; }; - case (_velocity > 1841) : { _A = 0.0167252613732636; _M = 1.28662041261785; }; - case (_velocity > 1120) : { _A = 0.00220172456619625; _M = 1.55636358091189; }; - case (_velocity > 1088) : { _A = 0.00000000000000020538037167098; _M = 5.80410776994789; }; - case (_velocity > 976) : { _A = 0.00000000000592182174254121; _M = 4.29275576134191; }; - case (_velocity > 0) : { _A = 0.000043917343795117; _M = 1.99978116283334; }; + case 8: { + call { + if (_velocity > 3571) exitWith { _A = 0.0112263766252305; _M = 1.33207346655961; }; + if (_velocity > 1841) exitWith { _A = 0.0167252613732636; _M = 1.28662041261785; }; + if (_velocity > 1120) exitWith { _A = 0.00220172456619625; _M = 1.55636358091189; }; + if (_velocity > 1088) exitWith { _A = 0.00000000000000020538037167098; _M = 5.80410776994789; }; + if (_velocity > 976) exitWith { _A = 0.00000000000592182174254121; _M = 4.29275576134191; }; + if (_velocity > 0) exitWith { _A = 0.000043917343795117; _M = 1.99978116283334; }; }; }; }; -if (_A != -1 && _M != -1 && _velocity > 0 && _velocity < 10000) then { - _result = _A * (_velocity ^ _M) / _dragCoefficient; - _result = _result / 3.2808399; +if (!isNil "_A" && !isNil "_M" && _velocity > 0 && _velocity < 10000) then { + (_A * (_velocity ^ _M) / _dragCoefficient) / 3.2808399 +} else { + 0 }; - -_result diff --git a/addons/advanced_ballistics/functions/fnc_calculateStabilityFactor.sqf b/addons/advanced_ballistics/functions/fnc_calculateStabilityFactor.sqf index 9b205c3ec2..671ab2ccb0 100644 --- a/addons/advanced_ballistics/functions/fnc_calculateStabilityFactor.sqf +++ b/addons/advanced_ballistics/functions/fnc_calculateStabilityFactor.sqf @@ -13,33 +13,23 @@ * 6: barometric Pressure - hPA * * Return Value: - * 0: stability factor + * stability factor * * Public: No */ #include "script_component.hpp" -private ["_caliber", "_bulletLength", "_bulletMass", "_barrelTwist", "_muzzleVelocity", "_temperature", "_barometricPressure", "_l", "_t", "_stabilityFactor"]; -_caliber = _this select 0; -_bulletLength = _this select 1; -_bulletMass = _this select 2; -_barrelTwist = _this select 3; -_muzzleVelocity = _this select 4; -_temperature = _this select 5; -_barometricPressure = _this select 6; +private ["_twist", "_length", "_stabilityFactor"]; +params ["_caliber", "_bulletLength", "_bulletMass", "_barrelTwist", "_muzzleVelocity", "_temperature", "_barometricPressure"]; // Source: http://www.jbmballistics.com/ballistics/bibliography/articles/miller_stability_1.pdf -_t = _barrelTwist / _caliber; -_l = _bulletLength / _caliber; +_twist = _barrelTwist / _caliber; +_length = _bulletLength / _caliber; -_stabilityFactor = 7587000 * _bulletMass / (_t^2 * _caliber^3 * _l * (1 + _l^2)); +_stabilityFactor = 7587000 * _bulletMass / (_twist^2 * _caliber^3 * _length * (1 + _length^2)); if (_muzzleVelocity > 341.376) then { - _stabilityFactor = _stabilityFactor * (_muzzleVelocity / 853.44) ^ (1/3); + (_stabilityFactor * (_muzzleVelocity / 853.44) ^ (1/3)) * KELVIN(_temperature) / KELVIN(15) * 1013.25 / _barometricPressure } else { - _stabilityFactor = _stabilityFactor * (_muzzleVelocity / 341.376) ^ (1/3); + (_stabilityFactor * (_muzzleVelocity / 341.376) ^ (1/3)) * KELVIN(_temperature) / KELVIN(15) * 1013.25 / _barometricPressure }; - -_stabilityFactor = _stabilityFactor * KELVIN(_temperature) / KELVIN(15) * 1013.25 / _barometricPressure; - -_stabilityFactor diff --git a/addons/advanced_ballistics/functions/fnc_displayProtractor.sqf b/addons/advanced_ballistics/functions/fnc_displayProtractor.sqf index 1a4c344b2e..9debec1dc8 100644 --- a/addons/advanced_ballistics/functions/fnc_displayProtractor.sqf +++ b/addons/advanced_ballistics/functions/fnc_displayProtractor.sqf @@ -8,6 +8,8 @@ * * Return value: * None + * + * Public: No */ #include "script_component.hpp" @@ -15,8 +17,6 @@ #define __ctrl1 (__dsp displayCtrl 132950) #define __ctrl2 (__dsp displayCtrl 132951) -private ["_inclinationAngle", "_refPosition"]; - if (GVAR(Protractor)) exitWith { GVAR(Protractor) = false; 1 cutText ["", "PLAIN"]; @@ -32,30 +32,26 @@ EGVAR(weather,WindInfo) = false; GVAR(Protractor) = true; [{ + params ["","_idPFH"]; if !(GVAR(Protractor) && !(weaponLowered ACE_player) && currentWeapon ACE_player == primaryWeapon ACE_player) exitWith { GVAR(Protractor) = false; 1 cutText ["", "PLAIN"]; - [_this select 1] call cba_fnc_removePerFrameHandler; + [_idPFH] call cba_fnc_removePerFrameHandler; }; - - _refPosition = [SafeZoneX + 0.001, SafeZoneY + 0.001, 0.2, 0.2 * 4/3]; - - _inclinationAngle = asin((ACE_player weaponDirection currentWeapon ACE_player) select 2); - _inclinationAngle = -58 max _inclinationAngle min 58; - + 1 cutRsc ["RscProtractor", "PLAIN", 1, false]; - + __ctrl1 ctrlSetScale 1; __ctrl1 ctrlCommit 0; __ctrl1 ctrlSetText QUOTE(PATHTOF(UI\protractor.paa)); __ctrl1 ctrlSetTextColor [1, 1, 1, 1]; - + __ctrl2 ctrlSetScale 1; - __ctrl2 ctrlSetPosition [(_refPosition select 0), (_refPosition select 1) - 0.0012 * _inclinationAngle, (_refPosition select 2), (_refPosition select 3)]; + __ctrl2 ctrlSetPosition [SafeZoneX + 0.001, SafeZoneY + 0.001 - 0.0012 * (-58 max (asin((ACE_player weaponDirection currentWeapon ACE_player) select 2)) min 58), 0.2, 0.2 * 4/3]; __ctrl2 ctrlCommit 0; __ctrl2 ctrlSetText QUOTE(PATHTOF(UI\protractor_marker.paa)); __ctrl2 ctrlSetTextColor [1, 1, 1, 1]; - + }, 0.1, []] call CBA_fnc_addPerFrameHandler; true diff --git a/addons/advanced_ballistics/functions/fnc_handleFirePFH.sqf b/addons/advanced_ballistics/functions/fnc_handleFirePFH.sqf new file mode 100644 index 0000000000..7a432831ad --- /dev/null +++ b/addons/advanced_ballistics/functions/fnc_handleFirePFH.sqf @@ -0,0 +1,46 @@ +/* + * Author: Glowbal, Ruthberg, joko // Jonas + * Handle the PFH for Bullets + * + * Arguments: + * None + * + * Return Value: + * None + * + * Public: No + */ +#include "script_component.hpp" + +private "_deleted"; + +_deleted = 0; + +_aceTimeSecond = floor ACE_time; + +{ + private ["_bulletVelocity", "_bulletPosition", "_bulletSpeed"]; + _x params["_bullet","_caliber","_bulletTraceVisible","_index"]; + + _bulletVelocity = velocity _bullet; + + _bulletSpeed = vectorMagnitude _bulletVelocity; + + if (!alive _bullet || _bulletSpeed < 100) exitWith { + GVAR(allBullets) deleteAt (_forEachIndex - _deleted); + _deleted = _deleted + 1; + }; + + _bulletPosition = getPosASL _bullet; + + if (_bulletTraceVisible && _bulletSpeed > 500) then { + drop ["\A3\data_f\ParticleEffects\Universal\Refract","","Billboard",1,0.1,getPos _bullet,[0,0,0],0,1.275,1,0,[0.02*_caliber,0.01*_caliber],[[0,0,0,0.65],[0,0,0,0.2]],[1,0],0,0,"","",""]; + }; + + call compile ("ace_advanced_ballistics" callExtension format["simulate:%1:%2:%3:%4:%5:%6:%7", _index, _bulletVelocity, _bulletPosition, ACE_wind, ASLToATL(_bulletPosition) select 2, _aceTimeSecond, ACE_time - _aceTimeSecond]); +} forEach GVAR(allBullets); + +if (GVAR(allBullets) isEqualTo []) then { + [_this select 1] call CBA_fnc_removePerFrameHandler; + GVAR(BulletPFH) = nil; +}; diff --git a/addons/advanced_ballistics/functions/fnc_handleFired.sqf b/addons/advanced_ballistics/functions/fnc_handleFired.sqf index 7c01bd9f23..d97c9b952a 100644 --- a/addons/advanced_ballistics/functions/fnc_handleFired.sqf +++ b/addons/advanced_ballistics/functions/fnc_handleFired.sqf @@ -13,28 +13,28 @@ * 6: projectile - Object of the projectile that was shot * * Return Value: - * Nothing + * None * * Public: No */ #include "script_component.hpp" -private ["_unit", "_weapon", "_mode", "_ammo", "_magazine", "_caliber", "_bullet", "_abort", "_AmmoCacheEntry", "_WeaponCacheEntry", "_opticsName", "_opticType", "_bulletTraceVisible", "_temperature", "_barometricPressure", "_bulletMass", "_bulletLength", "_muzzleVelocity", "_muzzleVelocityShift", "_bulletVelocity", "_bulletSpeed", "_bulletLength", "_barrelTwist", "_stabilityFactor"]; -_unit = _this select 0; -_weapon = _this select 1; -_mode = _this select 3; -_ammo = _this select 4; -_magazine = _this select 5; -_bullet = _this select 6; +// Early Quiting +if (!hasInterface) exitWith {}; +if (!GVAR(enabled)) exitWith {}; + +// Parameterization +private ["_abort", "_AmmoCacheEntry", "_WeaponCacheEntry", "_opticsName", "_opticType", "_bulletTraceVisible", "_temperature", "_barometricPressure", "_bulletMass", "_bulletLength", "_muzzleVelocity", "_muzzleVelocityShift", "_bulletVelocity", "_bulletSpeed", "_bulletLength", "_barrelTwist", "_stabilityFactor"]; +params ["_unit", "_weapon", "", "_mode", "_ammo", "_magazine", "_bullet"]; _abort = false; -if (!hasInterface) exitWith {}; -if (!alive _bullet) exitWith {}; -if (!GVAR(enabled)) exitWith {}; -if (!([_unit] call EFUNC(common,isPlayer))) exitWith {}; -if (underwater _unit) exitWith {}; + + if (!(_ammo isKindOf "BulletBase")) exitWith {}; +if (!alive _bullet) exitWith {}; +if (!([_unit] call EFUNC(common,isPlayer))) exitWith {}; if (_unit distance ACE_player > GVAR(simulationRadius)) exitWith {}; +if (underwater _unit) exitWith {}; if (!GVAR(simulateForEveryone) && !(local _unit)) then { // The shooter is non local _abort = true; @@ -58,34 +58,41 @@ if (_abort || !(GVAR(extensionAvailable))) exitWith { }; }; +// Get Weapon and Ammo Configurations _AmmoCacheEntry = uiNamespace getVariable format[QGVAR(%1), _ammo]; -if (isNil {_AmmoCacheEntry}) then { +if (isNil "_AmmoCacheEntry") then { _AmmoCacheEntry = _ammo call FUNC(readAmmoDataFromConfig); }; _WeaponCacheEntry = uiNamespace getVariable format[QGVAR(%1), _weapon]; -if (isNil {_WeaponCacheEntry}) then { +if (isNil "_WeaponCacheEntry") then { _WeaponCacheEntry = _weapon call FUNC(readWeaponDataFromConfig); }; +_AmmoCacheEntry params ["_airFriction", "_caliber", "_bulletLength", "_bulletMass", "_transonicStabilityCoef", "_dragModel", "_ballisticCoefficients", "_velocityBoundaries", "_atmosphereModel", "_ammoTempMuzzleVelocityShifts", "_muzzleVelocityTable", "_barrelLengthTable"]; +_WeaponCacheEntry params ["_barrelTwist", "_twistDirection", "_barrelLength"]; + + _bulletVelocity = velocity _bullet; _muzzleVelocity = vectorMagnitude _bulletVelocity; if (GVAR(barrelLengthInfluenceEnabled)) then { - _muzzleVelocityShift = [_WeaponCacheEntry select 2, _AmmoCacheEntry select 10, _AmmoCacheEntry select 11, _muzzleVelocity] call FUNC(calculateBarrelLengthVelocityShift); - if (_muzzleVelocityShift != 0) then { - _bulletVelocity = _bulletVelocity vectorAdd ((vectorNormalized _bulletVelocity) vectorMultiply (_muzzleVelocityShift)); - _bullet setVelocity _bulletVelocity; - _muzzleVelocity = _muzzleVelocity + _muzzleVelocityShift; + _barrelVelocityShift = uiNamespace getVariable [format [QGVAR(%1_muzzleVelocityShift),_weapon],nil]; + if (isNil "_barrelVelocityShift") then { + _barrelVelocityShift = [_barrelLength, _muzzleVelocityTable, _barrelLengthTable, _muzzleVelocity] call FUNC(calculateBarrelLengthVelocityShift); + uiNamespace setVariable [format [QGVAR(%1_muzzleVelocityShift),_weapon],_muzzleVelocityShift]; }; }; if (GVAR(ammoTemperatureEnabled)) then { _temperature = ((getPosASL _unit) select 2) call EFUNC(weather,calculateTemperatureAtHeight); - _muzzleVelocityShift = [_AmmoCacheEntry select 9, _temperature] call FUNC(calculateAmmoTemperatureVelocityShift); + _temperatureVelocityShift = ([_ammoTempMuzzleVelocityShifts, _temperature] call FUNC(calculateAmmoTemperatureVelocityShift)); +}; + +if (GVAR(ammoTemperatureEnabled) || GVAR(barrelLengthInfluenceEnabled)) then { if (_muzzleVelocityShift != 0) then { + _muzzleVelocity = _muzzleVelocity + (_barrelVelocityShift + _ammoTemperatureVelocityShift); _bulletVelocity = _bulletVelocity vectorAdd ((vectorNormalized _bulletVelocity) vectorMultiply (_muzzleVelocityShift)); _bullet setVelocity _bulletVelocity; - _muzzleVelocity = _muzzleVelocity + _muzzleVelocityShift; }; }; @@ -102,43 +109,22 @@ if (GVAR(bulletTraceEnabled) && cameraView == "GUNNER") then { }; }; -_caliber = _AmmoCacheEntry select 1; -_bulletLength = _AmmoCacheEntry select 2; -_bulletMass = _AmmoCacheEntry select 3; -_barrelTwist = _WeaponCacheEntry select 0; _stabilityFactor = 1.5; - if (_caliber > 0 && _bulletLength > 0 && _bulletMass > 0 && _barrelTwist > 0) then { - _temperature = ((getPosASL _unit) select 2) call EFUNC(weather,calculateTemperatureAtHeight); + if (isNil "_temperature") then { + _temperature = ((getPosASL _unit) select 2) call EFUNC(weather,calculateTemperatureAtHeight); + }; _barometricPressure = ((getPosASL _bullet) select 2) call EFUNC(weather,calculateBarometricPressure); _stabilityFactor = [_caliber, _bulletLength, _bulletMass, _barrelTwist, _muzzleVelocity, _temperature, _barometricPressure] call FUNC(calculateStabilityFactor); }; GVAR(currentbulletID) = (GVAR(currentbulletID) + 1) % 10000; -"ace_advanced_ballistics" callExtension format["new:%1:%2:%3:%4:%5:%6:%7:%8:%9:%10:%11:%12:%13:%14:%15:%16:%17:%18", GVAR(currentbulletID), _AmmoCacheEntry select 0, _AmmoCacheEntry select 6, _AmmoCacheEntry select 7, _AmmoCacheEntry select 8, _AmmoCacheEntry select 5, _stabilityFactor, _WeaponCacheEntry select 1, _muzzleVelocity, _AmmoCacheEntry select 4, getPosASL _bullet, EGVAR(common,mapLatitude), EGVAR(weather,currentTemperature), EGVAR(common,mapAltitude), EGVAR(weather,currentHumidity), overcast, floor(ACE_time), ACE_time - floor(ACE_time)]; +_aceTimeSecond = floor ACE_time; +"ace_advanced_ballistics" callExtension format["new:%1:%2:%3:%4:%5:%6:%7:%8:%9:%10:%11:%12:%13:%14:%15:%16:%17:%18", GVAR(currentbulletID), _airFriction, _ballisticCoefficients, _velocityBoundaries, _atmosphereModel, _dragModel, _stabilityFactor, _twistDirection, _muzzleVelocity, _transonicStabilityCoef, getPosASL _bullet, EGVAR(common,mapLatitude), EGVAR(weather,currentTemperature), EGVAR(common,mapAltitude), EGVAR(weather,currentHumidity), overcast, _aceTimeSecond, ACE_time - _aceTimeSecond]; -[{ - private ["_args", "_index", "_bullet", "_caliber", "_bulletTraceVisible", "_bulletVelocity", "_bulletPosition"]; - _args = _this select 0; - _bullet = _args select 0; - _caliber = _args select 1; - _bulletTraceVisible = _args select 2; - _index = _args select 3; - - _bulletVelocity = velocity _bullet; - _bulletPosition = getPosASL _bullet; - - _bulletSpeed = vectorMagnitude _bulletVelocity; - - if (!alive _bullet || _bulletSpeed < 100) exitWith { - [_this select 1] call cba_fnc_removePerFrameHandler; - }; - - if (_bulletTraceVisible && _bulletSpeed > 500) then { - drop ["\A3\data_f\ParticleEffects\Universal\Refract","","Billboard",1,0.1,getPos _bullet,[0,0,0],0,1.275,1,0,[0.02*_caliber,0.01*_caliber],[[0,0,0,0.65],[0,0,0,0.2]],[1,0],0,0,"","",""]; - }; +GVAR(allBullets) pushBack [_bullet, _caliber, _bulletTraceVisible, GVAR(currentbulletID)]; - call compile ("ace_advanced_ballistics" callExtension format["simulate:%1:%2:%3:%4:%5:%6:%7", _index, _bulletVelocity, _bulletPosition, ACE_wind, ASLToATL(_bulletPosition) select 2, floor(ACE_time), ACE_time - floor(ACE_time)]); - -}, GVAR(simulationInterval), [_bullet, _caliber, _bulletTraceVisible, GVAR(currentbulletID)]] call CBA_fnc_addPerFrameHandler; +if (isNil QGVAR(BulletPFH)) then { + GVAR(BulletPFH) = [FUNC(handleFirePFH), GVAR(simulationInterval), []] call CBA_fnc_addPerFrameHandler; +}; diff --git a/addons/advanced_ballistics/functions/fnc_initModuleSettings.sqf b/addons/advanced_ballistics/functions/fnc_initModuleSettings.sqf index 186c0d0649..4898c51c10 100644 --- a/addons/advanced_ballistics/functions/fnc_initModuleSettings.sqf +++ b/addons/advanced_ballistics/functions/fnc_initModuleSettings.sqf @@ -8,17 +8,13 @@ * 2: activated * * Return Value: - * None + * None * * Public: No */ - #include "script_component.hpp" -private ["_logic", "_units", "_activated"]; -_logic = _this select 0; -_units = _this select 1; -_activated = _this select 2; +params ["_logic","_units", "_activated"]; if !(_activated) exitWith {}; diff --git a/addons/advanced_ballistics/functions/fnc_initializeTerrainExtension.sqf b/addons/advanced_ballistics/functions/fnc_initializeTerrainExtension.sqf index b2fc7ba084..53ac6aa874 100644 --- a/addons/advanced_ballistics/functions/fnc_initializeTerrainExtension.sqf +++ b/addons/advanced_ballistics/functions/fnc_initializeTerrainExtension.sqf @@ -3,10 +3,10 @@ * Initializes the advanced ballistics dll extension with terrain data * * Arguments: - * Nothing + * None * * Return Value: - * Nothing + * None * * Public: No */ @@ -22,9 +22,9 @@ _initStartTime = ACE_time; _mapSize = getNumber (configFile >> "CfgWorlds" >> worldName >> "MapSize"); if (("ace_advanced_ballistics" callExtension format["init:%1:%2", worldName, _mapSize]) == "Terrain already initialized") exitWith { - if (GVAR(initMessageEnabled)) then { + #ifdef DEBUG_MODE_FULL systemChat "AdvancedBallistics: Terrain already initialized"; - }; + #endIf }; _mapGrids = ceil(_mapSize / 50) + 1; @@ -33,19 +33,16 @@ _gridCells = _mapGrids * _mapGrids; GVAR(currentGrid) = 0; [{ - private ["_args", "_mapGrids", "_gridCells", "_initStartTime"]; - _args = _this select 0; - _mapGrids = _args select 0; - _gridCells = _args select 1; - _initStartTime = _args select 2; - + params ["_args","_idPFH"]; + _args params ["_mapGrids", "_gridCells", "_initStartTime"]; + if (GVAR(currentGrid) >= _gridCells) exitWith { - if (GVAR(initMessageEnabled)) then { + #ifdef DEBUG_MODE_FULL systemChat format["AdvancedBallistics: Finished terrain initialization in %1 seconds", ceil(ACE_time - _initStartTime)]; - }; - [_this select 1] call cba_fnc_removePerFrameHandler; + #endif + [_idPFH] call cba_fnc_removePerFrameHandler; }; - + for "_i" from 1 to 50 do { _x = floor(GVAR(currentGrid) / _mapGrids) * 50; _y = (GVAR(currentGrid) - floor(GVAR(currentGrid) / _mapGrids) * _mapGrids) * 50; @@ -57,5 +54,5 @@ GVAR(currentGrid) = 0; GVAR(currentGrid) = GVAR(currentGrid) + 1; if (GVAR(currentGrid) >= _gridCells) exitWith {}; }; - + }, 0, [_mapGrids, _gridCells, _initStartTime]] call CBA_fnc_addPerFrameHandler diff --git a/addons/advanced_ballistics/functions/fnc_readAmmoDataFromConfig.sqf b/addons/advanced_ballistics/functions/fnc_readAmmoDataFromConfig.sqf index 10e7e60df2..9839c1dcc3 100644 --- a/addons/advanced_ballistics/functions/fnc_readAmmoDataFromConfig.sqf +++ b/addons/advanced_ballistics/functions/fnc_readAmmoDataFromConfig.sqf @@ -4,61 +4,53 @@ * Reads the ammo class config and updates the config cache * * Arguments: - * 0: ammo - classname + * ammo - classname * * Return Value: - * 0: [_airFriction, _caliber, _bulletLength, _bulletMass, _transonicStabilityCoef, _dragModel, _ballisticCoefficients, _velocityBoundaries, _atmosphereModel, _ammoTempMuzzleVelocityShifts, _muzzleVelocityTable, _barrelLengthTable] + * 0: _airFriction + * 1: _caliber + * 2: _bulletLength + * 3: _bulletMass + * 4: _transonicStabilityCoef + * 5: _dragModel + * 6: _ballisticCoefficients + * 7: _velocityBoundaries + * 8: _atmosphereModel + * 9: _ammoTempMuzzleVelocityShifts + * 10: _muzzleVelocityTable + * 11: _barrelLengthTable * - * Return value: - * None + * Public: No */ #include "script_component.hpp" private ["_ammo", "_airFriction", "_caliber", "_bulletLength", "_bulletMass", "_transonicStabilityCoef", "_dragModel", "_ballisticCoefficients", "_velocityBoundaries", "_atmosphereModel", "_ammoTempMuzzleVelocityShifts", "_muzzleVelocityTable", "_barrelLengthTable", "_result"]; -_ammo = _this; +_ammoConfig = configFile >> "CfgAmmo" >> _this; -_airFriction = getNumber(configFile >> "CfgAmmo" >> _ammo >> "airFriction"); -_caliber = getNumber(configFile >> "CfgAmmo" >> _ammo >> "ACE_caliber"); -_bulletLength = getNumber(configFile >> "CfgAmmo" >> _ammo >> "ACE_bulletLength"); -_bulletMass = getNumber(configFile >> "CfgAmmo" >> _ammo >> "ACE_bulletMass"); -_transonicStabilityCoef = 0.5; -if (isNumber(configFile >> "CfgAmmo" >> _ammo >> "ACE_transonicStabilityCoef")) then { - _transonicStabilityCoef = getNumber(configFile >> "CfgAmmo" >> _ammo >> "ACE_transonicStabilityCoef"); +_airFriction = getNumber(_ammoConfig >> "airFriction"); +_caliber = getNumber(_ammoConfig >> "ACE_caliber"); +_bulletLength = getNumber(_ammoConfig >> "ACE_bulletLength"); +_bulletMass = getNumber(_ammoConfig >> "ACE_bulletMass"); +_transonicStabilityCoef = getNumber(_ammoConfig >> "ACE_transonicStabilityCoef"); +if (_transonicStabilityCoef == 0) then { + _transonicStabilityCoef = 0.5; }; -_dragModel = 1; -_ballisticCoefficients = []; -_velocityBoundaries = []; -_atmosphereModel = "ICAO"; -if (isNumber(configFile >> "CfgAmmo" >> _ammo >> "ACE_dragModel")) then { - _dragModel = getNumber(configFile >> "CfgAmmo" >> _ammo >> "ACE_dragModel"); - if (!(_dragModel in [1, 2, 5, 6, 7, 8])) then { - _dragModel = 1; - }; +_dragModel = getNumber(_ammoConfig >> "ACE_dragModel"); +if (_dragModel == 0 || !(_dragModel in [1, 2, 5, 6, 7, 8])) then { + _dragModel = 1; }; -if (isArray(configFile >> "CfgAmmo" >> _ammo >> "ACE_ballisticCoefficients")) then { - _ballisticCoefficients = getArray(configFile >> "CfgAmmo" >> _ammo >> "ACE_ballisticCoefficients"); -}; -if (isArray(configFile >> "CfgAmmo" >> _ammo >> "ACE_velocityBoundaries")) then { - _velocityBoundaries = getArray(configFile >> "CfgAmmo" >> _ammo >> "ACE_velocityBoundaries"); -}; -if (isText(configFile >> "CfgAmmo" >> _ammo >> "ACE_standardAtmosphere")) then { - _atmosphereModel = getText(configFile >> "CfgAmmo" >> _ammo >> "ACE_standardAtmosphere"); -}; -_ammoTempMuzzleVelocityShifts = []; -if (isArray(configFile >> "CfgAmmo" >> _ammo >> "ACE_ammoTempMuzzleVelocityShifts")) then { - _ammoTempMuzzleVelocityShifts = getArray(configFile >> "CfgAmmo" >> _ammo >> "ACE_ammoTempMuzzleVelocityShifts"); -}; -_muzzleVelocityTable = []; -_barrelLengthTable = []; -if (isArray(configFile >> "CfgAmmo" >> _ammo >> "ACE_muzzleVelocities")) then { - _muzzleVelocityTable = getArray(configFile >> "CfgAmmo" >> _ammo >> "ACE_muzzleVelocities"); -}; -if (isArray(configFile >> "CfgAmmo" >> _ammo >> "ACE_barrelLengths")) then { - _barrelLengthTable = getArray(configFile >> "CfgAmmo" >> _ammo >> "ACE_barrelLengths"); +_ballisticCoefficients = getArray(_ammoConfig >> "ACE_ballisticCoefficients"); +_velocityBoundaries = getArray(_ammoConfig >> "ACE_velocityBoundaries"); +_atmosphereModel = getText(_ammoConfig >> "ACE_standardAtmosphere"); +if (_atmosphereModel isEqualTo "") then { + _atmosphereModel = "ICAO"; }; +_ammoTempMuzzleVelocityShifts = getArray(_ammoConfig >> "ACE_ammoTempMuzzleVelocityShifts"); +_muzzleVelocityTable = getArray(_ammoConfig >> "ACE_muzzleVelocities"); +_barrelLengthTable = getArray(_ammoConfig >> "ACE_barrelLengths"); _result = [_airFriction, _caliber, _bulletLength, _bulletMass, _transonicStabilityCoef, _dragModel, _ballisticCoefficients, _velocityBoundaries, _atmosphereModel, _ammoTempMuzzleVelocityShifts, _muzzleVelocityTable, _barrelLengthTable]; -uiNamespace setVariable [format[QGVAR(%1), _ammo], _result]; +uiNamespace setVariable [format[QGVAR(%1), _this], _result]; _result diff --git a/addons/advanced_ballistics/functions/fnc_readWeaponDataFromConfig.sqf b/addons/advanced_ballistics/functions/fnc_readWeaponDataFromConfig.sqf index 8a1a29f7b0..8e13dc04dc 100644 --- a/addons/advanced_ballistics/functions/fnc_readWeaponDataFromConfig.sqf +++ b/addons/advanced_ballistics/functions/fnc_readWeaponDataFromConfig.sqf @@ -4,28 +4,28 @@ * Reads the weapon class config and updates the config cache * * Arguments: - * 0: weapon - classname + * weapon - classname * * Return Value: - * 0: [_barrelTwist, _twistDirection, _barrelLength] + * 0: _barrelTwist + * 1: _twistDirection + * 2: _barrelLength * - * Return value: - * None + * Public: No */ #include "script_component.hpp" -private ["_weapon", "_barrelTwist", "_twistDirection", "_barrelLength", "_result"]; -_weapon = _this; +private ["_weaponConfig", "_barrelTwist", "_twistDirection", "_barrelLength", "_result"]; +_weaponConfig = (configFile >> "CfgWeapons" >> _this); -_barrelTwist = getNumber(configFile >> "CfgWeapons" >> _weapon >> "ACE_barrelTwist"); +_barrelTwist = getNumber(_weaponConfig >> "ACE_barrelTwist"); _twistDirection = 1; -if (isNumber(configFile >> "CfgWeapons" >> _weapon >> "ACE_twistDirection")) then { - _twistDirection = getNumber(configFile >> "CfgWeapons" >> _weapon >> "ACE_twistDirection"); - if (_twistDirection != -1 && _twistDirection != 0 && _twistDirection != 1) then { - _twistDirection = 1; - }; +_twistDirection = getNumber(_weaponConfig >> "ACE_twistDirection"); +if !(_twistDirection in [-1, 0, 1]) then { + _twistDirection = 1; }; -_barrelLength = getNumber(configFile >> "CfgWeapons" >> _weapon >> "ACE_barrelLength"); + +_barrelLength = getNumber(_weaponConfig >> "ACE_barrelLength"); _result = [_barrelTwist, _twistDirection, _barrelLength]; diff --git a/addons/advanced_ballistics/stringtable.xml b/addons/advanced_ballistics/stringtable.xml index b30485aae6..5ea26cd906 100644 --- a/addons/advanced_ballistics/stringtable.xml +++ b/addons/advanced_ballistics/stringtable.xml @@ -32,6 +32,9 @@ Erweiterte Ballistik Pokročilá balistika Balística avançada + Balistique avancée + Fejlett ballisztika + Продвинутая баллистика Advanced Ballistics @@ -40,6 +43,9 @@ Erweiterte Ballistik Pokročilá balistika Balística avançada + Balistique avancée + Fejlett ballisztika + Продвинутая баллистика Enables advanced ballistics @@ -48,6 +54,9 @@ Aktiviert die erweiterte Ballistik Aktivuje pokročilou balistiku Ativa balística avançada + Activer la balistique avancée + Engedélyezi a fejlett ballisztikát + Включает продвинутую баллистику Enabled For Snipers @@ -56,6 +65,9 @@ Für Scharfschützen aktiviert Povoleno pro odstřelovače Ativar para caçadores + Activer pour les snipers + Mesterlövészeknek engedélyezve + Включена для снайперов Enables advanced ballistics for non local snipers (when using high power optics) @@ -64,6 +76,9 @@ Aktiviert die erweiterte Ballistik für nicht lokale Scharfschützen (bei Benutzung von Optiken mit starker Vergrößerung) Aktivuje pokročilou balistiku pro nelokální odstřelovače (když používá výkonnou optiku) Ativa balística avançada para caçadores não locais (quando usando miras telescópicas) + Active la balistique avancée pour les snipers non locaux (en utilisant les optiques avancées) + Engedélyezi a fejlett ballisztikát nem-helyi mesterlövészeknek (nagy-teljesítményű optika használatakor) + Включает продвинутую баллистику для нелокальных снайперов (при использовании мощной оптики) Enabled For Group Members @@ -72,6 +87,9 @@ Für Gruppenmitglieder aktiviert Povoleno pro členy skupiny Ativada para membros do grupo + Activer pour les membres groupés + Csoporttagoknak engedélyezve + Включена для группы Enables advanced ballistics for non local group members @@ -80,6 +98,9 @@ Aktiviert die erweiterte Ballistik für nicht lokale Gruppenmitglieder Aktivuje pokročilou balistiku pro nelokální členy skupiny Ativa balística avançada para membros de grupo não locais + Active la balistique avancée pour les membres groupés non locaux + Engedélyezi a fejlett ballisztikát nem-helyi csoporttagoknak + Включает продвинутую баллистику для нелокальных членов группы Enabled For Everyone @@ -88,6 +109,9 @@ Für jeden aktiviert Povoleno pro všechny Ativada para todos + Activer pour tout le monde + Mindenkinek engedélyezve + Включена для всех Enables advanced ballistics for all non local players (enabling this may degrade performance during heavy firefights in multiplayer) @@ -96,6 +120,9 @@ Aktiviert die erweiterte Ballistik für alle nicht lokalen Spieler (das Aktivieren dieser Funktion kann zur Beeinträchtigung des Spielerlebnisses im Multiplayer führen) Aktivovat pokročilou balistiku pro všechny nelokální hráče (aktivace této možnosti způsobuje pokles snímu za sekundu během těžké přestřelky v multiplayeru) Ativa balística avançada para todos os jogadores não locais (ativando isso pode degradar a performance durante troca de tiros intensas no multiplayer) + Active la balistique avancé pour tous les joueurs non locaux (activer cette option peut avoir un impact sur les performance en multi durant les grands échanges de tirs) + Engedélyezi a fejlett ballisztikát az összes nem-helyi játékosnak (ez a funkció leronthatja a teljesítményt intenzív többjátékos tűzharcok alatt) + Включает продвинутую баллистику для всех нелокальных игроков (включение этой опции может снизить производительность при массовых перестрелках в мультиплеере) Always Enabled For Group Members @@ -104,6 +131,9 @@ Für Gruppenmitglieder immer aktiviert Vždy povoleno pro členy skupiny Sempre ativada para membros do grupo + Toujours activer pour les membres groupés + Mindig engedélyezve csoporttagoknak + Всегда включена для членов группы Always enables advanced ballistics when a group member fires @@ -112,6 +142,9 @@ Aktiviert die erweiterte Ballistik immer, wenn ein Gruppenmitglied schießt Aktivuje pokročilou balistiku pro členy skupiny Sempre ative balística avançada quando um membro do grupo disparar + Active tout le temps la balistique avancée quand un membre du groupe ouvre le feu + Mindig engedélyezi a fejlett ballisztikát, ha egy csoporttag tüzel + Всегда включает продвинутую баллистику когда стреляет член группы Disabled In FullAuto Mode @@ -120,6 +153,9 @@ Beim vollautomatischen Feuern deaktiviert Zakázáno v automatickém režimu střelby Desabilitar no modo automático + Désactiver en mode rafale libre + Automata módban letiltva + Выкл. для автомат. режима Disables the advanced ballistics during full auto fire @@ -128,6 +164,9 @@ Deaktiviert die erweiterte Ballistik beim vollautomatischen Feuern Zákáže pokročilou balistiku během střelby v režimu automat Desabilitar a balística avançada durante fogo automático + Désactive la balistique avancée pour les tirs en rafale libre + Letiltja a fejlett ballisztikát automata tüzelés folyamán + Выключает продвинутую баллистику при стрельбе в полностью автоматическом режиме Enable Ammo Temperature Simulation @@ -136,6 +175,9 @@ Simulation der Munitionstemperatur aktivieren Povolit simulaci teploty munice Ativar simulação de temperatura de munição + Activer la simulation de la température + Lőszer-hő szimuláció engedélyezése + Симуляция температуры для боеприпасов Muzzle velocity varies with ammo temperature @@ -144,6 +186,9 @@ Munitionstemperatur hat Einfluss auf die Mündungsgeschwindigkeit Úsťová rychlost je závislá na teplotě munice A velocidade de saída varia com a temperatura da munição + La température de la munition influe sur la vélocité intiale + A kezdősebesség a lőszer hőmérsékletétől függően változó + Начальная скорость пули зависит от температуры Enable Barrel Length Simulation @@ -152,6 +197,9 @@ Simulation der Lauflänge aktivieren Povolit simulaci délky hlavně Ativar a simulação de comprimento do cano + Activer la simulation de la longueur de canon + Csőhossz-szimuláció engedélyezése + Симуляция длины ствола Muzzle velocity varies with barrel length @@ -160,6 +208,9 @@ Lauflänge beeinflusst Mündungsgeschwindigkeit Úsťová rychlost je závislá na délce hlavně A velocidade de saída caria com o comprimento do cano + La longueur du canon influe sur la vélocité initale + A kezdősebesség a cső hosszától függően változó + Начальная скорость пули зависит от длины ствола Enable Bullet Trace Effect @@ -168,6 +219,9 @@ Geschossspureffekt aktivieren Povolit efekt trasírek Ativa efeito traçante de projétil + Activer l'effet traçante + Nyomkövető-effekt engedélyezése + Следы пуль Enables a bullet trace effect to high caliber bullets (only visible when looking through high power optics) @@ -176,6 +230,9 @@ Aktiviere Geschossspureffekt für hohe Kaliber (bei Benutzung von Optiken mit starker Vergrößerung) Aktivuje efekt trasírek z vysokokaliberních zbraní (viditelné pouze skrze výkonnou optiku) Ativa o efeito traçante de projétil para projéteis de alto calibre (somente visível quando observado por miras telescópicas) + Active une tracante pour les munitions de gros calibre (seulement visible en utilisant des optiques avancées) + Engedélyezi a nagy kaliberű lövedékek nyomának vizuális követését (csak nagy teljesítményű optikán keresztül látható) + Включает эффект следов пуль для больших калибров (видны только через мощную оптику) Simulation Interval @@ -184,6 +241,9 @@ Simulationsintervall Interval simulace Intervalo da simulação + Intervalle de simulation + Szimuláció intervalluma + Интервал симуляции Defines the interval between every calculation step @@ -192,6 +252,9 @@ Legt das Intervall zwischen den Berechnungsschritten fest Určuje interval mezi každým výpočtem Define o intervalo entre cada cálculo + Défini un intervalle de calcul entre deux simulations + Meghatározza a számítási lépések közötti időintervallumot + Определяет временной интервал между вычислениями Simulation Radius @@ -200,6 +263,9 @@ Simulationsradius Rozsah simulace Raio de simulação + Rayon de simulation + Szimuláció hatóköre + Радиус симуляции Defines the radius around the player (in meters) at which advanced ballistics are applied to projectiles @@ -208,12 +274,19 @@ Gibt den Radius (in Metern) um den Spieler an, bei dem die erweiterte Ballistik auf Geschosse angewendet wird Určuje oblast kolem hráče (v metrech), kde je pokročilá balistika použita na projektil Define o raio ao redor do jogador (em metros) onde a balística avançada será aplicada aos projéteis + Défini le rayon autour du joueur (en mètres) d'application de la balistique avancée + Meghatározza a játékos körüli hatókört (méterben), ahol a lövedékek fejlett ballisztikát használnak + Определяет радиус вокруг игрока (в метрах), в котором продвинутая баллистика применяется к снарядам This module enables advanced ballistics simulation - meaning the trajectory of projectiles is influenced by variables like air temperature, atmospheric pressure, humidity, gravity, the type of ammunition and the weapon from which it was fired. Moduł ten pozwala aktywować zaawansowaną balistykę biorącą przy obliczeniach trajektorii lotu pocisku pod uwagę takie rzeczy jak temperatura powietrza, ciśnienie atmosferyczne, wilgotność powietrza, siły Coriolisa i Eotvosa, grawitację a także broń z jakiej wykonywany jest strzał oraz rodzaj amunicji. Wszystko to sprowadza się na bardzo dokładne odwzorowanie balistyki. Tento modul umožňuje aktivovat pokročilou balistiku, která vypočítává trajektorii kulky a bere do úvahy věci jako je teplota vzduchu, atmosférický tlak, vlhkost vzduchu, gravitaci, typ munice a zbraň, ze které je náboj vystřelen. To vše přispívá k velmi přesné balistice. Este módulo permite que você ative cálculos de balística avançada, fazendo a trajetória do projétil levar em consideração coisas como temperatura do ar, pressão atmosférica, umidade, força de Coriolis, a gravidade, o modelo da arma no qual o disparo é realizado e o tipo de munição. Tudo isso acrescenta-se a um balística muito precisa. + Ce module active la simulation de balistique avancée - ie les projectiles sont influencé par des varibles comme le vent, la température, la pression atmosphérique, l'humidité, la gravité, le type de munition et l'arme avec laquelles ils sont tirés + Ez a modul engedélyezi a fejlett ballisztikai szimulációt - a lövedékek röppályáját befolyásolni fogja a levegő hőmérséklete, légnyomás, páratartalom, gravitáció, a lövedék fajtája, valamint a fegyver, amiből kilőtték a lövedéket. + Этот модуль включает симуляцию продвинутой баллистики - при этом на траекторию полета снаряда влияют различные параметры, такие как температура воздуха, атмосферное давление, влажность, гравитация, тип боеприпаса и оружия, из которого произвели выстрел. + Este módulo permite la simulación balística avanzada - es decir, la trayectoria de los proyectiles está influenciada por variables como la temperatura del aire, la presión atmosférica, la humedad, la gravedad, el tipo de municiones y el arma desde el que fue disparada. - \ No newline at end of file + diff --git a/addons/aircraft/README.md b/addons/aircraft/README.md index 1049493f45..3db71ca51a 100644 --- a/addons/aircraft/README.md +++ b/addons/aircraft/README.md @@ -1,9 +1,10 @@ ace_aircraft ============ -Changes to air weaponry, flightmodels and HUDs. +Changes to air weaponry, flight models and HUDs. + +- Contributions by Kimi (geraldbolso1899) for HUD updates -* Contributations by Kimi (geraldbolso1899) for HUD updates ## Maintainers @@ -11,4 +12,4 @@ The people responsible for merging changes to this component or answering potent - [KoffeinFlummi](https://github.com/KoffeinFlummi) - [commy2](https://github.com/commy2) -- [jaynus](https://github.com/walterpearce) \ No newline at end of file +- [jaynus](https://github.com/walterpearce) diff --git a/addons/aircraft/stringtable.xml b/addons/aircraft/stringtable.xml index e917ca7e9d..d91af73a1c 100644 --- a/addons/aircraft/stringtable.xml +++ b/addons/aircraft/stringtable.xml @@ -1,4 +1,4 @@ - + diff --git a/addons/apl/README.md b/addons/apl/README.md new file mode 100644 index 0000000000..13b5f9d268 --- /dev/null +++ b/addons/apl/README.md @@ -0,0 +1,11 @@ +ace_apl +============ + +Assets licensed under Arma Public License (APL). + + +## Maintainers + +The people responsible for merging changes to this component or answering potential questions. + +- None diff --git a/addons/atragmx/README.md b/addons/atragmx/README.md index f68b38c4a3..1b68573051 100644 --- a/addons/atragmx/README.md +++ b/addons/atragmx/README.md @@ -3,8 +3,9 @@ ace_atragmx ATragMX - Handheld ballistics calculator + ## Maintainers The people responsible for merging changes to this component or answering potential questions. -- [Ruthberg] (http://github.com/Ulteq) \ No newline at end of file +- [Ruthberg](http://github.com/Ulteq) diff --git a/addons/atragmx/stringtable.xml b/addons/atragmx/stringtable.xml index fce50a4e1d..a8e23ffbda 100644 --- a/addons/atragmx/stringtable.xml +++ b/addons/atragmx/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -50,4 +50,4 @@ Abrir ATragMX - \ No newline at end of file + diff --git a/addons/attach/CfgEventHandlers.hpp b/addons/attach/CfgEventHandlers.hpp index 3daad1425a..c050fbd1c7 100644 --- a/addons/attach/CfgEventHandlers.hpp +++ b/addons/attach/CfgEventHandlers.hpp @@ -8,3 +8,24 @@ class Extended_PostInit_EventHandlers { clientInit = QUOTE( call COMPILE_FILE(XEH_clientInit) ); }; }; +class Extended_GetIn_EventHandlers { + class All { + class ADDON { + getIn = QUOTE(_this call FUNC(handleGetIn)); + }; + }; +}; +class Extended_GetOut_EventHandlers { + class All { + class ADDON { + getOut = QUOTE(_this call FUNC(handleGetOut)); + }; + }; +}; +class Extended_Killed_EventHandlers { + class All { + class ADDON { + killed = QUOTE(_this call FUNC(handleKilled)); + }; + }; +}; diff --git a/addons/attach/README.md b/addons/attach/README.md index 5fb73d0645..3bce88839c 100644 --- a/addons/attach/README.md +++ b/addons/attach/README.md @@ -2,7 +2,9 @@ ace_attach ========== Introducing the ability to attach various throwables to yourself or vehicles, to mark your position and assist in IFF. -Adds item `ACE_IR_Strobe_Item`. + +#### Items Added: +`ACE_IR_Strobe_Item` ## Maintainers diff --git a/addons/attach/XEH_preInit.sqf b/addons/attach/XEH_preInit.sqf index 06c6ed1b01..17b8490a77 100644 --- a/addons/attach/XEH_preInit.sqf +++ b/addons/attach/XEH_preInit.sqf @@ -7,6 +7,9 @@ PREP(canAttach); PREP(canDetach); PREP(detach); PREP(getChildrenAttachActions); +PREP(handleGetIn); +PREP(handleGetOut); +PREP(handleKilled); PREP(placeApprove); ADDON = true; diff --git a/addons/attach/functions/fnc_attach.sqf b/addons/attach/functions/fnc_attach.sqf index bd363b1307..6362edb33c 100644 --- a/addons/attach/functions/fnc_attach.sqf +++ b/addons/attach/functions/fnc_attach.sqf @@ -17,15 +17,14 @@ */ #include "script_component.hpp" -private ["_itemVehClass", "_onAtachText", "_selfAttachPosition", "_attachedItem", "_tempObject", "_actionID", "_model"]; -params ["_attachToVehicle","_unit","_args"]; +params ["_attachToVehicle","_unit","_args", ["_silentScripted", false]]; _args params [["_itemClassname","", [""]]]; -TRACE_3("params",_attachToVehicle,_unit,_itemClassname); +TRACE_4("params",_attachToVehicle,_unit,_itemClassname,_silentScripted); + +private ["_itemVehClass", "_onAtachText", "_selfAttachPosition", "_attachedItem", "_tempObject", "_actionID", "_model"]; //Sanity Check (_unit has item in inventory, not over attach limit) -if ((_itemClassname == "") || {!(_this call FUNC(canAttach))}) exitWith {ERROR("Tried to attach, but check failed");}; - -_selfAttachPosition = [_unit, [-0.05, 0, 0.12], "rightshoulder"]; +if ((_itemClassname == "") || {(!_silentScripted) && {!(_this call FUNC(canAttach))}}) exitWith {ERROR("Tried to attach, but check failed");}; _itemVehClass = getText (configFile >> "CfgWeapons" >> _itemClassname >> "ACE_Attachable"); _onAtachText = getText (configFile >> "CfgWeapons" >> _itemClassname >> "displayName"); @@ -40,12 +39,13 @@ if (_itemVehClass == "") exitWith {ERROR("no ACE_Attachable for Item");}; _onAtachText = format [localize LSTRING(Item_Attached), _onAtachText]; if (_unit == _attachToVehicle) then { //Self Attachment - _unit removeItem _itemClassname; // Remove item _attachedItem = _itemVehClass createVehicle [0,0,0]; - _attachedItem attachTo _selfAttachPosition; - [_onAtachText] call EFUNC(common,displayTextStructured); - _attachToVehicle setVariable [QGVAR(Objects), [_attachedItem], true]; - _attachToVehicle setVariable [QGVAR(ItemNames), [_itemClassname], true]; + _attachedItem attachTo [_unit, [-0.05, 0, 0.12], "rightshoulder"]; + if (!_silentScripted) then { + _unit removeItem _itemClassname; // Remove item + [_onAtachText] call EFUNC(common,displayTextStructured); + }; + _unit setVariable [QGVAR(attached), [[_attachedItem, _itemClassname]], true]; } else { GVAR(placeAction) = PLACE_WAITING; diff --git a/addons/attach/functions/fnc_canAttach.sqf b/addons/attach/functions/fnc_canAttach.sqf index 20a49c09be..37d92e8908 100644 --- a/addons/attach/functions/fnc_canAttach.sqf +++ b/addons/attach/functions/fnc_canAttach.sqf @@ -17,14 +17,17 @@ */ #include "script_component.hpp" -private ["_attachLimit", "_attachedObjects","_playerPos"]; params ["_attachToVehicle","_player","_args"]; _args params [["_itemClassname","", [""]]]; -TRACE_3("params",_attachToVehicle,_unit,_itemClassname); +TRACE_3("params",_attachToVehicle,_player,_itemClassname); + +private ["_attachLimit", "_attachedObjects"]; _attachLimit = [6, 1] select (_player == _attachToVehicle); -_attachedObjects = _attachToVehicle getVariable [QGVAR(Objects), []]; +_attachedObjects = _attachToVehicle getVariable [QGVAR(attached), []]; -_playerPos = (ACE_player modelToWorldVisual (ACE_player selectionPosition "pilot")); - -(canStand _player) && {(_attachToVehicle distance _player) < 7} && {alive _attachToVehicle} && {(count _attachedObjects) < _attachLimit} && {_itemClassname in ((itemsWithMagazines _player) + [""])}; +((_player == _attachToVehicle) || {canStand _player}) && +{(_attachToVehicle distance _player) < 7} && +{alive _attachToVehicle} && +{(count _attachedObjects) < _attachLimit} && +{_itemClassname in ((itemsWithMagazines _player) + [""])}; diff --git a/addons/attach/functions/fnc_canDetach.sqf b/addons/attach/functions/fnc_canDetach.sqf index ba3182ddea..d9796a5a5c 100644 --- a/addons/attach/functions/fnc_canDetach.sqf +++ b/addons/attach/functions/fnc_canDetach.sqf @@ -16,25 +16,27 @@ */ #include "script_component.hpp" -private ["_attachedObjects", "_inRange"]; params ["_attachToVehicle", "_unit"]; TRACE_2("params",_attachToVehicle,_unit); -_attachedObjects = _attachToVehicle getVariable [QGVAR(Objects), []]; +if ((vehicle _unit) != _unit) exitWith {false}; + +_attachedList = _attachToVehicle getVariable [QGVAR(attached), []]; +if ((count _attachedList) == 0) exitWith {false}; + +private ["_inRange"]; _inRange = false; -if (_unit == _attachToVehicle) then { - _inRange = count _attachedObjects > 0; -} else { - //Scan if unit is within range (using 2d distance) - private ["_unitPos", "_objectPos"]; - _unitPos = getPos _unit; - _unitPos set [2,0]; - { - _objectPos = getPos _x; - _objectPos set [2, 0]; - if (_objectPos distance _unitPos < 4) exitWith {_inRange = true}; - } forEach _attachedObjects; -}; +{ + _x params ["_xObject"]; + if (isNull _xObject) exitWith { + TRACE_1("Null attached",_x); + _attachedList deleteAt _forEachIndex; + _attachToVehicle setVariable [QGVAR(attached), _attachedList, true]; + }; + if (((getPos _unit) distance2d (getPos _xObject)) < 4) exitWith {_inRange = true}; +} forEach _attachedList; -canStand _unit && {_inRange} && {alive _attachToVehicle} +_inRange && +{(_unit == _attachToVehicle) || {canStand _unit}} && +{alive _attachToVehicle} diff --git a/addons/attach/functions/fnc_detach.sqf b/addons/attach/functions/fnc_detach.sqf index 98f482f17b..05c625b374 100644 --- a/addons/attach/functions/fnc_detach.sqf +++ b/addons/attach/functions/fnc_detach.sqf @@ -16,15 +16,12 @@ */ #include "script_component.hpp" -private ["_attachedObjects", "_attachedItems", "_itemDisplayName", - "_attachedObject", "_attachedIndex", "_itemName", "_minDistance", - "_unitPos", "_objectPos" -]; params ["_attachToVehicle","_unit"], TRACE_2("params",_attachToVehicle,_unit); -_attachedObjects = _attachToVehicle getVariable [QGVAR(Objects), []]; -_attachedItems = _attachToVehicle getVariable [QGVAR(ItemNames), []]; +private ["_attachedList", "_itemDisplayName", "_attachedObject", "_attachedIndex", "_itemName", "_minDistance"]; + +_attachedList = _attachToVehicle getVariable [QGVAR(attached), []]; _attachedObject = objNull; _attachedIndex = -1; @@ -32,18 +29,17 @@ _itemName = ""; //Find closest attached object _minDistance = 1000; -_unitPos = getPos _unit; -_unitPos set [2,0]; + { - _objectPos = getPos _x; - _objectPos set [2, 0]; - if (_objectPos distance _unitPos < _minDistance) then { - _minDistance = _objectPos distance _unitPos; - _attachedObject = _x; - _itemName = _attachedItems select _forEachIndex; + _x params ["_xObject", "_xItemName"]; + + if (((getPos _unit) distance2d (getPos _xObject)) < _minDistance) then { + _minDistance = ((getPos _unit) distance2d (getPos _xObject)); + _attachedObject = _xObject; + _itemName = _xItemName; _attachedIndex = _forEachIndex; }; -} forEach _attachedObjects; +} forEach _attachedList; // Check if unit has an attached item if (isNull _attachedObject || {_itemName == ""}) exitWith {ERROR("Could not find attached object")}; @@ -68,10 +64,8 @@ if (toLower _itemName in ["b_ir_grenade", "o_ir_grenade", "i_ir_grenade"]) then }; // Reset unit variables -_attachedObjects deleteAt _attachedIndex; -_attachedItems deleteAt _attachedIndex; -_attachToVehicle setVariable [QGVAR(Objects), _attachedObjects, true]; -_attachToVehicle setVariable [QGVAR(ItemNames), _attachedItems, true]; +_attachedList deleteAt _attachedIndex; +_attachToVehicle setVariable [QGVAR(attached), _attachedList, true]; // Display message _itemDisplayName = getText (configFile >> "CfgWeapons" >> _itemName >> "displayName"); diff --git a/addons/attach/functions/fnc_handleGetIn.sqf b/addons/attach/functions/fnc_handleGetIn.sqf new file mode 100644 index 0000000000..d9f469eee2 --- /dev/null +++ b/addons/attach/functions/fnc_handleGetIn.sqf @@ -0,0 +1,43 @@ +/* + * Author: PabstMirror + * Handles when a unit gets in to a vehicle. + * + * Arguments: + * 0: vehicle + * 1: dunno + * 2: unit + * + * Return Value: + * None + * + * Example: + * [car2, x, player] call ACE_attach_fnc_handleGetIn + * + * Public: No + */ +#include "script_component.hpp" + +params ["", "", "_unit"]; +TRACE_1("params",_unit); + +if (!local _unit) exitWith {}; + +private ["_attachedList"]; + +_attachedList = _unit getVariable [QGVAR(attached), []]; +if ((count _attachedList) == 0) exitWith {}; + +(_attachedList select 0) params ["_xObject"]; +if (!isNull _xObject) then { + TRACE_1("detaching and moving attached light",_xObject); + detach _xObject; + _xObject setPos ((getPos _unit) vectorAdd [0, 0, -1000]); + [{ + params ["_detachedLight"]; + TRACE_1("delayed delete",_detachedLight); + deleteVehicle _detachedLight; + }, [_xObject], 2] call EFUNC(common,waitAndExecute); + (_attachedList select 0) set [0, objNull]; +}; + +_unit setVariable [QGVAR(attached), _attachedList, true]; diff --git a/addons/attach/functions/fnc_handleGetOut.sqf b/addons/attach/functions/fnc_handleGetOut.sqf new file mode 100644 index 0000000000..4ed268d5dc --- /dev/null +++ b/addons/attach/functions/fnc_handleGetOut.sqf @@ -0,0 +1,35 @@ +/* + * Author: PabstMirror + * Handles when a unit gets in to a vehicle. + * + * Arguments: + * 0: vehicle + * 1: dunno + * 2: unit + * + * Return Value: + * None + * + * Example: + * [car2, x, player] call ACE_attach_fnc_handleGetOut + * + * Public: No + */ +#include "script_component.hpp" + +params ["", "", "_unit"]; +TRACE_1("params",_unit); + +if (!local _unit) exitWith {}; + +private ["_attachedList"]; + +_attachedList = _unit getVariable [QGVAR(attached), []]; +if ((count _attachedList) == 0) exitWith {}; + +(_attachedList select 0) params ["_xObject", "_xItemName"]; +if (isNull _xObject) then { + TRACE_1("null attached when exiting vehicle, scripted reattach",_xItemName); + _unit setVariable [QGVAR(attached), [], true]; + [_unit, _unit, _xItemName, true] call FUNC(attach); +}; diff --git a/addons/attach/functions/fnc_handleKilled.sqf b/addons/attach/functions/fnc_handleKilled.sqf new file mode 100644 index 0000000000..06c5473c88 --- /dev/null +++ b/addons/attach/functions/fnc_handleKilled.sqf @@ -0,0 +1,39 @@ +/* + * Author: PabstMirror + * Handles when vehicle or man is killed. + * Note: Runs where unit is local. + * + * Arguments: + * 0: DeadVehicle + * + * Return Value: + * None + * + * Example: + * [bob1] call ACE_attach_fnc_handleKilled + * + * Public: No + */ +#include "script_component.hpp" + +params ["_deadUnit"]; +TRACE_1("params",_deadUnit); + +private ["_attachedList"]; + +_attachedList = _deadUnit getVariable [QGVAR(attached), []]; + +if ((count _attachedList) == 0) exitWith {}; + +{ + _x params ["_xObject"]; + TRACE_2("detaching",_xObject,_deadUnit); + detach _xObject; + //If it's a vehicle, also delete the attached + if (!(_deadUnit isKindOf "CAManBase")) then { + _xObject setPos ((getPos _deadUnit) vectorAdd [0, 0, -1000]); + [{deleteVehicle (_this select 0)}, [_xObject], 2] call EFUNC(common,waitAndExecute); + }; +} forEach _attachedList; + +_deadUnit setVariable [QGVAR(attached), nil, true]; diff --git a/addons/attach/functions/fnc_placeApprove.sqf b/addons/attach/functions/fnc_placeApprove.sqf index 0656e7880f..b8e2cc17fb 100644 --- a/addons/attach/functions/fnc_placeApprove.sqf +++ b/addons/attach/functions/fnc_placeApprove.sqf @@ -25,7 +25,7 @@ */ #include "script_component.hpp" -private ["_startingOffset", "_startDistanceFromCenter", "_closeInUnitVector", "_closeInMax", "_closeInMin", "_closeInDistance", "_endPosTestOffset", "_endPosTest", "_doesIntersect", "_startingPosShifted", "_startASL", "_endPosShifted", "_endASL", "_attachedObject", "_currentObjects", "_currentItemNames"]; +private ["_startingOffset", "_startDistanceFromCenter", "_closeInUnitVector", "_closeInMax", "_closeInMin", "_closeInDistance", "_endPosTestOffset", "_endPosTest", "_doesIntersect", "_startingPosShifted", "_startASL", "_endPosShifted", "_endASL", "_attachedObject", "_attachList"]; params ["_unit", "_attachToVehicle", "_itemClassname", "_itemVehClass", "_onAtachText", "_startingPosition"]; TRACE_6("params",_unit,_attachToVehicle,_itemClassname,_itemVehClass,_onAtachText,_startingPosition); @@ -87,12 +87,9 @@ _attachedObject attachTo [_attachToVehicle, _endPosTestOffset]; //Remove Item from inventory _unit removeItem _itemClassname; -//Add Object to ACE_AttachedObjects and ACE_AttachedItemNames -_currentObjects = _attachToVehicle getVariable [QGVAR(Objects), []]; -_currentObjects pushBack _attachedObject; -_attachToVehicle setVariable [QGVAR(Objects), _currentObjects, true]; -_currentItemNames = _attachToVehicle getVariable [QGVAR(ItemNames), []]; -_currentItemNames pushBack _itemClassname; -_attachToVehicle setVariable [QGVAR(ItemNames), _currentItemNames, true]; +//Add Object to attached array +_attachList = _attachToVehicle getVariable [QGVAR(attached), []]; +_attachList pushBack [_attachedObject, _itemClassname]; +_attachToVehicle setVariable [QGVAR(attached), _attachList, true]; [_onAtachText] call EFUNC(common,displayTextStructured); diff --git a/addons/attach/stringtable.xml b/addons/attach/stringtable.xml index 299a1575ac..cc09e8f45d 100644 --- a/addons/attach/stringtable.xml +++ b/addons/attach/stringtable.xml @@ -1,11 +1,11 @@ - + Attach item >> Gegenstand befestigen >> Acoplar objeto >> - Przyczep przedmiot >> + Przyczep >> Attacher l'objet >> Připnout předmět >> Fixar item >> @@ -185,7 +185,7 @@ %1<br/>Attached %1<br/>befestigt %1<br/>acoplada - %1<br/>przyczepiono + Przyczepiono<br/>%1 %1<br/>attachée %1<br/>Připnutý %1<br/>Fixada @@ -197,7 +197,7 @@ %1<br/>Detached %1<br/>entfernt %1<br/>quitada - %1<br/>odczepiono + Odczepiono<br/>%1 %1<br/>détachée %1<br/>Odepnutý %1<br/>Separada @@ -206,4 +206,4 @@ %1<br/>отсоединен(-а) - + \ No newline at end of file diff --git a/addons/backpacks/README.md b/addons/backpacks/README.md index 6fa54a9897..64e37f337b 100644 --- a/addons/backpacks/README.md +++ b/addons/backpacks/README.md @@ -1,7 +1,8 @@ ace_backpacks ================= -Adds indication when someone else opens your backpack (soundeffect / camShake). +Adds indication when someone else opens your backpack (sound effect and camera shake). + ## Maintainers diff --git a/addons/backpacks/XEH_preInit.sqf b/addons/backpacks/XEH_preInit.sqf index a47825d0b0..f4c6a1a5d8 100644 --- a/addons/backpacks/XEH_preInit.sqf +++ b/addons/backpacks/XEH_preInit.sqf @@ -3,7 +3,6 @@ ADDON = false; PREP(backpackOpened); -PREP(getBackpackAssignedUnit); PREP(isBackpack); PREP(onOpenInventory); diff --git a/addons/backpacks/functions/fnc_backpackOpened.sqf b/addons/backpacks/functions/fnc_backpackOpened.sqf index 3f5cf53994..4e61e8fbcc 100644 --- a/addons/backpacks/functions/fnc_backpackOpened.sqf +++ b/addons/backpacks/functions/fnc_backpackOpened.sqf @@ -1,26 +1,27 @@ /* * Author: commy2 + * Someone opened your backpack. Play sound and camshake. Execute locally. * - * Someone opened your backpack. Execute locally. - * - * Argument: + * Arguments: * 0: Who accessed your inventory? (Object) * 1: Unit that wields the backpack (Object) * 2: The backpack object (Object) - * - * Return value: - * None. + * + * Return Value: + * None + * + * Public: No */ #include "script_component.hpp" -PARAMS_3(_unit,_target,_backpack); +params ["_target", "_backpack"]; // do cam shake if the target is the player if ([_target] call EFUNC(common,isPlayer)) then { addCamShake [4, 0.5, 5]; }; -// play a rustling sound +// play a zipper sound effect private ["_sounds", "_position"]; _sounds = [ @@ -33,8 +34,7 @@ _sounds = [ QUOTE(PATHTO_R(sounds\zip_out.wav)) ]; -_position = _target modelToWorldVisual (_target selectionPosition "Spine3"); -_position = _position call EFUNC(common,positionToASL); +_position = AGLToASL (_target modelToWorldVisual (_target selectionPosition "Spine3")); playSound3D [ _sounds select floor random count _sounds, diff --git a/addons/backpacks/functions/fnc_getBackpackAssignedUnit.sqf b/addons/backpacks/functions/fnc_getBackpackAssignedUnit.sqf deleted file mode 100644 index 562dc84da2..0000000000 --- a/addons/backpacks/functions/fnc_getBackpackAssignedUnit.sqf +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Author: commy2 - * - * Returns the unit that has the given backpack object equipped. - * - * Argument: - * 0: A backpack object (Object) - * - * Return value: - * Unit that has the backpack equipped. (Object) - */ -#include "script_component.hpp" - -private ["_backpack", "_unit"]; - -_backpack = _this select 0; - -_unit = objNull; -{ - if (backpackContainer _x == _backpack) exitWith {_unit = _x}; -} forEach (allUnits + allDeadMen); -_unit diff --git a/addons/backpacks/functions/fnc_isBackpack.sqf b/addons/backpacks/functions/fnc_isBackpack.sqf index b1d55f9ce6..fab82c505f 100644 --- a/addons/backpacks/functions/fnc_isBackpack.sqf +++ b/addons/backpacks/functions/fnc_isBackpack.sqf @@ -1,24 +1,24 @@ /* * Author: commy2 + * Check if the given backpack is an actual backpack that can store items. Parachute, static weapon packs, etc. will return false. * - * Check if the given backpack is an actual backpack that can store items. Parachute backpacks will return false for example. + * Arguments: + * 0: Backpack * - * Argument: - * 0: A backpack (Object or String) + * Return Value: + * Boolean * - * Return value: - * Boolean (Bool) + * Public: Yes */ #include "script_component.hpp" -private ["_backpack", "_config"]; - -_backpack = _this select 0; +params ["_backpack"]; if (typeName _backpack == "OBJECT") then { _backpack = typeOf _backpack; }; +private "_config"; _config = configFile >> "CfgVehicles" >> _backpack; -getText (_config >> "vehicleClass") == "backpacks" && {getNumber (_config >> "maximumLoad") > 0} +getText (_config >> "vehicleClass") == "backpacks" && {getNumber (_config >> "maximumLoad") > 0} // return diff --git a/addons/backpacks/functions/fnc_onOpenInventory.sqf b/addons/backpacks/functions/fnc_onOpenInventory.sqf index 63e4aa87a3..154000202d 100644 --- a/addons/backpacks/functions/fnc_onOpenInventory.sqf +++ b/addons/backpacks/functions/fnc_onOpenInventory.sqf @@ -1,30 +1,31 @@ /* * Author: commy2 + * Handle the open inventory event. Camshake and sound on target client. * - * Handle the open inventory event. Display message on traget client. - * - * Argument: - * Input from "InventoryOpened" eventhandler - * - * Return value: + * Arguments: + * 0: Unit + * 1: Backpack + * + * Return Value: * false. Always open the inventory dialog. (Bool) + * + * Public: No */ #include "script_component.hpp" -private ["_unit", "_backpack"]; +params ["_unit", "_backpack"]; -_unit = _this select 0; -_backpack = _this select 1; - -// exit if the target is not a backpack -if !([_backpack] call FUNC(isBackpack)) exitWith {}; +// exit if the target is not a real backpack, i.e. parachute, static weapon bag etc. +if !([_backpack] call FUNC(isBackpack)) exitWith {false}; // get the unit that wears the backpack object private "_target"; -_target = [_backpack] call FUNC(getBackpackAssignedUnit); +_target = objectParent _backpack; + +if (isNull _target) exitWith {false}; // raise event on target unit -["backpackOpened", _target, [_unit, _target, _backpack]] call EFUNC(common,targetEvent); +["backpackOpened", _target, [_target, _backpack]] call EFUNC(common,targetEvent); // return false to open inventory as usual false diff --git a/addons/ballistics/CfgAmmo.hpp b/addons/ballistics/CfgAmmo.hpp index 5ffe94ac45..eeb64fec47 100644 --- a/addons/ballistics/CfgAmmo.hpp +++ b/addons/ballistics/CfgAmmo.hpp @@ -6,23 +6,11 @@ class CfgAmmo { timeToLive=6; }; - class B_20mm : BulletBase { - timeToLive=30; - }; - class B_25mm : BulletBase { - timeToLive=30; - }; - class B_35mm_AA : BulletBase { - timeToLive=30; - }; - class B_30mm_AP : BulletBase { - timeToLive=30; - }; - class B_556x45_Ball : BulletBase { airFriction=-0.00126466; hit=8; typicalSpeed=750; + tracerScale = 1; tracerStartTime=0.073; // M856 tracer burns out to 800m tracerEndTime=1.57123; // Time in seconds calculated with ballistics calculator ACE_caliber=5.69; @@ -128,9 +116,13 @@ class CfgAmmo { ACE_muzzleVelocities[]={785, 883, 925}; ACE_barrelLengths[]={254.0, 414.02, 508.0}; }; + class B_56x15_dual: BulletBase { + tracerScale = 0.5; + }; class B_65x39_Caseless : BulletBase { airFriction=-0.00075308; typicalSpeed=800; + tracerScale = 1.1; //1.0; ACE_caliber=6.706; ACE_bulletLength=32.893; ACE_bulletMass=7.9704; @@ -180,10 +172,15 @@ class CfgAmmo { ACE_muzzleVelocities[]={750, 820, 840, 852, 860}; ACE_barrelLengths[]={254.0, 406.4, 508.0, 609.6, 660.4}; }; + class SubmunitionBullet; + class B_65x39_Minigun_Caseless: SubmunitionBullet { + tracerScale = 1.1; //1.0; + }; class B_762x51_Ball : BulletBase { airFriction=-0.00100957; typicalSpeed=833; hit=9; + tracerScale = 1.2; //0.6; tracerStartTime=0.073; // Based on the British L5A1 which burns out to 1000m tracerEndTime=2.15957; // Time in seconds calculated with ballistics calculator ACE_caliber=7.823; @@ -479,6 +476,7 @@ class CfgAmmo { class B_9x21_Ball : BulletBase { airFriction=-0.00226847; typicalSpeed=390; + tracerScale = 0.5; hit=6; ACE_caliber=9.042; ACE_bulletLength=15.494; @@ -491,6 +489,9 @@ class CfgAmmo { ACE_muzzleVelocities[]={440, 460, 480}; ACE_barrelLengths[]={101.6, 127.0, 228.6}; }; + class B_9x21_Ball_Tracer_Green: B_9x21_Ball { + tracerScale = 0.5; + }; class ACE_9x18_Ball_57N181S : B_9x21_Ball { hit=5; airFriction=-0.00190333; @@ -584,6 +585,7 @@ class CfgAmmo { timeToLive=10; airFriction=-0.00038944; typicalSpeed=910; + tracerScale = 1.3; //1.2; ACE_caliber=10.363; ACE_bulletLength=54.0; ACE_bulletMass=26.568; @@ -670,9 +672,13 @@ class CfgAmmo { ACE_muzzleVelocities[]={880, 915, 925}; ACE_barrelLengths[]={508.0, 660.4, 711.2}; }; + class B_127x33_Ball: BulletBase { + tracerScale = 1.3; //1.2; + }; class B_127x54_Ball : BulletBase { airFriction=-0.00019268; typicalSpeed=300; + tracerScale = 1.3;// ACE_caliber=12.954; ACE_bulletLength=64.516; ACE_bulletMass=48.6; @@ -688,6 +694,7 @@ class CfgAmmo { timeToLive=10; airFriction=-0.00057503; typicalSpeed=900; + tracerScale = 1.3; //1.2; ACE_caliber=12.954; ACE_bulletLength=58.674; ACE_bulletMass=41.9256; @@ -703,6 +710,7 @@ class CfgAmmo { timeToLive=10; airFriction=-0.00057503; typicalSpeed=900; + tracerScale = 1.3;// hit=25; caliber=4.0; ACE_caliber=12.954; @@ -736,6 +744,7 @@ class CfgAmmo { timeToLive=10; airFriction=-0.00063800; typicalSpeed=820; + tracerScale = 1.3; //1.5; ACE_caliber=12.979; ACE_bulletLength=64.008; ACE_bulletMass=48.276; @@ -750,6 +759,7 @@ class CfgAmmo { class B_45ACP_Ball : BulletBase { airFriction=-0.00081221; typicalSpeed=250; + tracerScale = 0.6; ACE_caliber=11.481; ACE_bulletLength=17.272; ACE_bulletMass=14.904; @@ -761,4 +771,36 @@ class CfgAmmo { ACE_muzzleVelocities[]={230, 250, 285}; ACE_barrelLengths[]={101.6, 127.0, 228.6}; }; + class B_19mm_HE: BulletBase { + tracerScale = 1; + }; + class B_30mm_HE: B_19mm_HE { + tracerScale = 2.5; + }; + class B_20mm: BulletBase { + timeToLive=30; + tracerScale = 1.5; //1; + }; + class B_25mm: BulletBase { + timeToLive=30; + tracerScale = 2.0; //1; + }; + class B_30mm_AP: BulletBase { + timeToLive=30; + tracerScale = 2.5; + }; + class B_35mm_AA: BulletBase { + timeToLive=30; + tracerScale = 2.75; //1.85; + }; + class ShellBase; + class Sh_120mm_HE: ShellBase { + tracerScale = 3; + }; + class Sh_120mm_APFSDS: ShellBase { + tracerScale = 3; + }; + class Gatling_30mm_HE_Plane_CAS_01_F: BulletBase { + tracerScale = 2.5; + }; }; diff --git a/addons/ballistics/README.md b/addons/ballistics/README.md index ac727f83c6..18d81bceb3 100644 --- a/addons/ballistics/README.md +++ b/addons/ballistics/README.md @@ -3,10 +3,11 @@ ace_ballistics Changes to weapon, magazine and ammunition values. + ## Maintainers The people responsible for merging changes to this component or answering potential questions. -- [Ruthberg] (http://github.com/Ulteq) +- [Ruthberg](http://github.com/Ulteq) - [KoffeinFlummi](https://github.com/KoffeinFlummi) - [commy2](https://github.com/commy2) diff --git a/addons/ballistics/stringtable.xml b/addons/ballistics/stringtable.xml index db44078980..0cc8c0be6b 100644 --- a/addons/ballistics/stringtable.xml +++ b/addons/ballistics/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -1599,6 +1599,9 @@ [ACE] Munitionskiste [ACE] Bedna s municí [ACE] Caixa com suprimentos de munição + [ACE] Caisse de munitions + [ACE] Lőszeres láda + [ACE] Ящик с боеприпасами - \ No newline at end of file + diff --git a/addons/captives/CfgEventHandlers.hpp b/addons/captives/CfgEventHandlers.hpp index 9d1a69f4fd..4d12dc10c4 100644 --- a/addons/captives/CfgEventHandlers.hpp +++ b/addons/captives/CfgEventHandlers.hpp @@ -25,14 +25,6 @@ class Extended_GetOut_EventHandlers { }; }; }; -//reset captivity and escorting status when getting killed -class Extended_Killed_EventHandlers { - class CAManBase { - class GVAR(AutoDetachCaptive) { - killed = QUOTE(_this call FUNC(handleKilled)); - }; - }; -}; //mission start class Extended_InitPost_EventHandlers { class CAManBase { diff --git a/addons/captives/CfgMoves.hpp b/addons/captives/CfgMoves.hpp index aa64e85e22..8fa3440706 100644 --- a/addons/captives/CfgMoves.hpp +++ b/addons/captives/CfgMoves.hpp @@ -18,6 +18,11 @@ class CfgMovesBasic { default = "ACE_AmovPercMstpSsurWnonDnon"; PutDown = ""; }; + class ACE_CivilHandCuffedFFVActions: ACE_CivilStandHandcuffedActions { + stop = "ACE_HandcuffedFFV"; + StopRelaxed = "ACE_HandcuffedFFV"; + default = "ACE_HandcuffedFFV"; + }; }; }; @@ -30,6 +35,12 @@ class CfgMovesMaleSdr: CfgMovesBasic { class CutSceneAnimationBase; + #define MACRO_ANIMATION \ + head = "headDefault"; \ + aimingBody = "aimingNo"; \ + forceAim = 1; \ + static = 1; + //Handcuffed Anims: class ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon: CutSceneAnimationBase { actions = "ACE_CivilStandHandcuffedActions"; @@ -40,6 +51,7 @@ class CfgMovesMaleSdr: CfgMovesBasic { ConnectTo[] = {"ACE_AmovPercMstpScapWnonDnon",0.1}; InterpolateTo[] = {"Unconscious",0.01,"ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon",0.1}; canReload = 0; + MACRO_ANIMATION }; class ACE_AmovPercMstpScapWnonDnon: ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon { file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\non\non\AmovPercMstpSnonWnonDnon_Ease"; @@ -47,14 +59,25 @@ class CfgMovesMaleSdr: CfgMovesBasic { ConnectTo[] = {"ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon",0.1}; InterpolateTo[] = {"Unconscious",0.01}; looped = 1; + MACRO_ANIMATION }; class ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon: ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon { actions = "CivilStandActions"; file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\non\non\amovpercmstpsnonwnondnon_easeout"; ConnectTo[] = {"AmovPercMstpSnonWnonDnon",0.1}; InterpolateTo[] = {"Unconscious",0.01,"ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon",0.1}; + MACRO_ANIMATION }; + //Handcuffed-FFV: + class ACE_HandcuffedFFV: ACE_AmovPercMstpScapWnonDnon { + file = "\A3\cargoposes_F_heli\anim\passenger_flatground_3idleunarmed.rtm"; + actions = "ACE_CivilHandCuffedFFVActions"; + ConnectTo[] = {}; + MACRO_ANIMATION + }; + + //Surrender Anims: class ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon: CutSceneAnimationBase { actions = "ACE_CivilStandSurrenderActions"; @@ -65,6 +88,7 @@ class CfgMovesMaleSdr: CfgMovesBasic { ConnectTo[] = {"ACE_AmovPercMstpSsurWnonDnon",0.1}; InterpolateTo[] = {"Unconscious",0.01,"ACE_AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon",0.1}; canReload = 0; + MACRO_ANIMATION }; class ACE_AmovPercMstpSsurWnonDnon: ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon { file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\sur\non\AmovPercMstpSsurWnonDnon"; @@ -72,6 +96,7 @@ class CfgMovesMaleSdr: CfgMovesBasic { looped = 1; ConnectTo[] = {"ACE_AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon",0.1}; InterpolateTo[] = {"Unconscious",0.01}; + MACRO_ANIMATION }; class ACE_AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon: ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon { speed = 0.5; //for gameplay reasons, slow this down @@ -79,6 +104,7 @@ class CfgMovesMaleSdr: CfgMovesBasic { file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\sur\non\AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon"; ConnectTo[] = {"AmovPercMstpSnonWnonDnon",0.1}; InterpolateTo[] = {"Unconscious",0.01,"ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon",0.1}; + MACRO_ANIMATION }; }; }; diff --git a/addons/captives/CfgVehicles.hpp b/addons/captives/CfgVehicles.hpp index 187fe1a746..afda86cfda 100644 --- a/addons/captives/CfgVehicles.hpp +++ b/addons/captives/CfgVehicles.hpp @@ -12,17 +12,17 @@ class CfgVehicles { exceptions[] = {}; icon = QUOTE(PATHTOF(UI\handcuff_ca.paa)); }; - class ACE_RemoveHandcuffs { - displayName = CSTRING(ReleaseCaptive); - selection = "righthand"; - distance = 2; - condition = QUOTE([ARR_2(_player, _target)] call FUNC(canRemoveHandcuffs)); - statement = QUOTE([ARR_2(_player, _target)] call FUNC(doRemoveHandcuffs)); - exceptions[] = {}; - icon = QUOTE(PATHTOF(UI\handcuff_ca.paa)); - }; class ACE_MainActions { + class ACE_RemoveHandcuffs { + displayName = CSTRING(ReleaseCaptive); + selection = "righthand"; + distance = 2; + condition = QUOTE([ARR_2(_player, _target)] call FUNC(canRemoveHandcuffs)); + statement = QUOTE([ARR_2(_player, _target)] call FUNC(doRemoveHandcuffs)); + exceptions[] = {}; + icon = QUOTE(PATHTOF(UI\handcuff_ca.paa)); + }; class ACE_EscortCaptive { displayName = CSTRING(EscortCaptive); distance = 4; @@ -97,7 +97,7 @@ class CfgVehicles { }; }; -#define MACRO_LOADUNLOADCAPTIVE \ +#define MACRO_LOADCAPTIVE \ class ACE_Actions { \ class ACE_MainActions { \ class GVAR(LoadCaptive) { \ @@ -113,27 +113,27 @@ class CfgVehicles { class LandVehicle; class Car: LandVehicle { - MACRO_LOADUNLOADCAPTIVE + MACRO_LOADCAPTIVE }; class Tank: LandVehicle { - MACRO_LOADUNLOADCAPTIVE + MACRO_LOADCAPTIVE }; class Air; class Helicopter: Air { - MACRO_LOADUNLOADCAPTIVE + MACRO_LOADCAPTIVE }; class Plane: Air { - MACRO_LOADUNLOADCAPTIVE + MACRO_LOADCAPTIVE }; class Ship; class Ship_F: Ship { - MACRO_LOADUNLOADCAPTIVE + MACRO_LOADCAPTIVE }; class StaticWeapon: LandVehicle { - MACRO_LOADUNLOADCAPTIVE + MACRO_LOADCAPTIVE }; class Box_NATO_Support_F; @@ -190,8 +190,8 @@ class CfgVehicles { defaultValue = 1; }; class requireSurrender { - displayName = CSTRING(ModuleSettings_allowSurrender_name); - description = CSTRING(ModuleSettings_allowSurrender_description); + displayName = CSTRING(ModuleSettings_requireSurrender_name); + description = CSTRING(ModuleSettings_requireSurrender_description); typeName = "NUMBER"; class values { class disable { diff --git a/addons/captives/README.md b/addons/captives/README.md index 3938720f08..37c26db159 100644 --- a/addons/captives/README.md +++ b/addons/captives/README.md @@ -1,10 +1,10 @@ ace_captives ============ -Allows taking people captive/handcuffed +Adds ability to handcuff and surrender. -####Items: -`ACE_CableTie` - adds ability to take someone captive +#### Items Added: +`ACE_CableTie` ## Maintainers diff --git a/addons/captives/XEH_postInit.sqf b/addons/captives/XEH_postInit.sqf index da2192d3d6..26f84e6bd9 100644 --- a/addons/captives/XEH_postInit.sqf +++ b/addons/captives/XEH_postInit.sqf @@ -6,12 +6,11 @@ if (isServer) then { addMissionEventHandler ["HandleDisconnect", { - PARAMS_1(_disconnectedPlayer); + params ["_disconnectedPlayer"]; private "_escortedUnit"; _escortedUnit = _disconnectedPlayer getVariable [QGVAR(escortedUnit), objNull]; if ((!isNull _escortedUnit) && {(attachedTo _escortedUnit) == _disconnectedPlayer}) then { detach _escortedUnit; - //systemChat "debug: DC detach"; }; if (_disconnectedPlayer getVariable [QGVAR(isEscorting), false]) then { _disconnectedPlayer setVariable [QGVAR(isEscorting), false, true]; @@ -19,7 +18,6 @@ if (isServer) then { }]; }; -["playerVehicleChanged", {_this call FUNC(handleVehicleChanged)}] call EFUNC(common,addEventHandler); ["zeusDisplayChanged", {_this call FUNC(handleZeusDisplayChanged)}] call EFUNC(common,addEventHandler); ["playerChanged", {_this call FUNC(handlePlayerChanged)}] call EFUNC(common,addEventhandler); ["MoveInCaptive", {_this call FUNC(vehicleCaptiveMoveIn)}] call EFUNC(common,addEventHandler); @@ -28,7 +26,7 @@ if (isServer) then { ["SetHandcuffed", {_this call FUNC(setHandcuffed)}] call EFUNC(common,addEventHandler); ["SetSurrendered", {_this call FUNC(setSurrendered)}] call EFUNC(common,addEventHandler); -//Medical Integration Events??? +//Medical Integration Events ["medical_onUnconscious", {_this call ACE_Captives_fnc_handleOnUnconscious}] call EFUNC(common,addEventHandler); if (!hasInterface) exitWith {}; diff --git a/addons/captives/XEH_preInit.sqf b/addons/captives/XEH_preInit.sqf index 31bcbe8e02..b59249b937 100644 --- a/addons/captives/XEH_preInit.sqf +++ b/addons/captives/XEH_preInit.sqf @@ -16,9 +16,9 @@ PREP(doFriskPerson); PREP(doLoadCaptive); PREP(doRemoveHandcuffs); PREP(doUnloadCaptive); +PREP(findEmptyNonFFVCargoSeat); PREP(handleGetIn); PREP(handleGetOut); -PREP(handleKilled); PREP(handleOnUnconscious); PREP(handlePlayerChanged); PREP(handleRespawn); diff --git a/addons/captives/functions/fnc_canApplyHandcuffs.sqf b/addons/captives/functions/fnc_canApplyHandcuffs.sqf index 5e7eb34a76..368ce3cb7a 100644 --- a/addons/captives/functions/fnc_canApplyHandcuffs.sqf +++ b/addons/captives/functions/fnc_canApplyHandcuffs.sqf @@ -23,4 +23,9 @@ params ["_unit", "_target"]; ("ACE_CableTie" in (items _unit)) && {alive _target} && {!(_target getVariable [QGVAR(isHandcuffed), false])} && -(GVAR(requireSurrender) == 0 || ((_target getVariable [QGVAR(isSurrendering), false]) || (currentWeapon _target == "" && GVAR(requireSurrender) == 2))) +{ + (_target getVariable ["ACE_isUnconscious", false]) || //isUnconscious + {GVAR(requireSurrender) == 0} || //or don't require surrendering + {_target getVariable [QGVAR(isSurrendering), false]} || //or is surrendering + {(GVAR(requireSurrender) == 2) && {(currentWeapon _target) == ""}} //or "SurrenderOrNoWeapon" and no weapon +} diff --git a/addons/captives/functions/fnc_canLoadCaptive.sqf b/addons/captives/functions/fnc_canLoadCaptive.sqf index 3f2677da76..a59c2e3be6 100644 --- a/addons/captives/functions/fnc_canLoadCaptive.sqf +++ b/addons/captives/functions/fnc_canLoadCaptive.sqf @@ -11,28 +11,36 @@ * The return value * * Example: - * [player, bob] call ACE_captives_fnc_canLoadCaptive + * [player, bob, car] call ACE_captives_fnc_canLoadCaptive * * Public: No */ #include "script_component.hpp" -private ["_objects"]; params ["_unit", "_target","_vehicle"]; -if (isNull _target) then { - _objects = attachedObjects _unit; - _objects = [_objects, {_this getVariable [QGVAR(isHandcuffed), false]}] call EFUNC(common,filter); - if ((count _objects) > 0) then {_target = _objects select 0;}; +if ((isNull _target) && {_unit getVariable [QGVAR(isEscorting), false]}) then { + //Looking at a vehicle while escorting, get target from attached objects: + { + if (_x getVariable [QGVAR(isHandcuffed), false]) exitWith { + _target = _x; + }; + } forEach (attachedObjects _unit); }; +if ((isNull _target) || {(vehicle _target) != _target} || {!(_target getVariable [QGVAR(isHandcuffed), false])}) exitWith {false}; if (isNull _vehicle) then { - _objects = nearestObjects [_unit, ["Car", "Tank", "Helicopter", "Plane", "Ship_F"], 10]; - if ((count _objects) > 0) then {_vehicle = _objects select 0;}; + //Looking at a captive unit, search for nearby vehicles with valid seats: + { + if ((_x emptyPositions "cargo") > 0) exitWith { + _vehicle = _x; + }; + } forEach (nearestObjects [_unit, ["Car", "Tank", "Helicopter", "Plane", "Ship"], 10]); +} else { + //We have a vehicle picked, make sure it has empty seats: + if ((_vehicle emptyPositions "cargo") == 0) then { + _vehicle = objNull; + }; }; -(!isNull _target) -&& {!isNull _vehicle} -&& {_unit getVariable [QGVAR(isEscorting), false]} -&& {_target getVariable [QGVAR(isHandcuffed), false]} -&& {_vehicle emptyPositions "cargo" > 0} +(!isNull _vehicle) diff --git a/addons/captives/functions/fnc_canRemoveHandcuffs.sqf b/addons/captives/functions/fnc_canRemoveHandcuffs.sqf index e8bbe3b50e..e36ba5cd5b 100644 --- a/addons/captives/functions/fnc_canRemoveHandcuffs.sqf +++ b/addons/captives/functions/fnc_canRemoveHandcuffs.sqf @@ -20,4 +20,5 @@ params ["_unit", "_target"]; //Unit is handcuffed and not currently being escorted _target getVariable [QGVAR(isHandcuffed), false] && -{isNull (attachedTo _target)} +{isNull (attachedTo _target)} && +{(vehicle _target) == _target} diff --git a/addons/captives/functions/fnc_doEscortCaptive.sqf b/addons/captives/functions/fnc_doEscortCaptive.sqf index bb070b057a..08b64195f3 100644 --- a/addons/captives/functions/fnc_doEscortCaptive.sqf +++ b/addons/captives/functions/fnc_doEscortCaptive.sqf @@ -35,7 +35,9 @@ if (_state) then { nil, 20, false, true, "", QUOTE(!isNull (GETVAR(_target,QGVAR(escortedUnit),objNull)))]; [{ - EXPLODE_3_PVT((_this select 0),_unit,_target,_actionID); + params ["_args", "_pfID"]; + _args params ["_unit", "_target", "_actionID"]; + if (_unit getVariable [QGVAR(isEscorting), false]) then { if (!alive _target || {!alive _unit} || {!canStand _target} || {!canStand _unit} || {_target getVariable ["ACE_isUnconscious", false]} || {_unit getVariable ["ACE_isUnconscious", false]} || {!isNull (attachedTo _unit)}) then { _unit setVariable [QGVAR(isEscorting), false, true]; diff --git a/addons/captives/functions/fnc_doFriskPerson.sqf b/addons/captives/functions/fnc_doFriskPerson.sqf index e14025b88f..9a8a423dc3 100644 --- a/addons/captives/functions/fnc_doFriskPerson.sqf +++ b/addons/captives/functions/fnc_doFriskPerson.sqf @@ -18,7 +18,6 @@ private ["_weapon", "_listedItemClasses", "_actions", "_allGear"]; -PARAMS_2(_player,_unit); params ["_player", "_unit"]; _weapon = currentWeapon _player; diff --git a/addons/captives/functions/fnc_doLoadCaptive.sqf b/addons/captives/functions/fnc_doLoadCaptive.sqf index 69b7276142..a4d7df8892 100644 --- a/addons/captives/functions/fnc_doLoadCaptive.sqf +++ b/addons/captives/functions/fnc_doLoadCaptive.sqf @@ -1,6 +1,6 @@ /* * Author: commy2 - * Unit loads the target object into a vehicle. + * Unit loads the target object into a vehicle. (logic same as canLoadCaptive) * * Arguments: * 0: Unit that wants to load a captive @@ -17,24 +17,34 @@ */ #include "script_component.hpp" -private "_objects"; - params ["_unit", "_target","_vehicle"]; -if (isNull _target) then { - _objects = attachedObjects _unit; - _objects = [_objects, {_this getVariable [QGVAR(isHandcuffed), false]}] call EFUNC(common,filter); - if ((count _objects) > 0) then {_target = _objects select 0;}; +if ((isNull _target) && {_unit getVariable [QGVAR(isEscorting), false]}) then { + //Looking at a vehicle while escorting, get target from attached objects: + { + if (_x getVariable [QGVAR(isHandcuffed), false]) exitWith { + _target = _x; + }; + } forEach (attachedObjects _unit); }; -if (isNull _target) exitWith {}; +if ((isNull _target) || {(vehicle _target) != _target} || {!(_target getVariable [QGVAR(isHandcuffed), false])}) exitWith {ERROR("");}; if (isNull _vehicle) then { - _objects = nearestObjects [_unit, ["Car_F", "Tank_F", "Helicopter_F", "Boat_F", "Plane_F"], 10]; - if ((count _objects) > 0) then {_vehicle = _objects select 0;}; + //Looking at a captive unit, search for nearby vehicles with valid seats: + { + // if (([_x] call FUNC(findEmptyNonFFVCargoSeat)) != -1) exitWith { + if ((_x emptyPositions "cargo") > 0) exitWith { + _vehicle = _x; + }; + } forEach (nearestObjects [_unit, ["Car", "Tank", "Helicopter", "Plane", "Ship"], 10]); +} else { + // if (([_vehicle] call FUNC(findEmptyNonFFVCargoSeat)) == -1) then { + if ((_vehicle emptyPositions "cargo") == 0) then { + _vehicle = objNull; + }; }; -if (isNull _vehicle) exitWith {}; -if ((!isNil "_target") && {!isNil "_vehicle"}) then { - _unit setVariable [QGVAR(isEscorting), false, true]; - ["MoveInCaptive", [_target], [_target, _vehicle]] call EFUNC(common,targetEvent); -}; +if (isNull _vehicle) exitWith {ERROR("");}; + +_unit setVariable [QGVAR(isEscorting), false, true]; +["MoveInCaptive", [_target], [_target, _vehicle]] call EFUNC(common,targetEvent); diff --git a/addons/captives/functions/fnc_findEmptyNonFFVCargoSeat.sqf b/addons/captives/functions/fnc_findEmptyNonFFVCargoSeat.sqf new file mode 100644 index 0000000000..cf67614f91 --- /dev/null +++ b/addons/captives/functions/fnc_findEmptyNonFFVCargoSeat.sqf @@ -0,0 +1,67 @@ +/* + * Author: PabstMirror + * Finds a free cargo seat, searching non FFV first + * + * Arguments: + * 0: The Vehicle + * + * Return Value: + * ARRAY [seat index , is FFV ] + * + * Example: + * [car1] call ACE_captives_fnc_findEmptyNonFFVCargoSeat + * + * Public: No + */ +#include "script_component.hpp" + +params ["_vehicle"]; +TRACE_1("params", _vehicle); + +_vehicleConfig = configFile >> "CfgVehicles" >> (typeOf _vehicle); + +_proxyOrder = getArray (_vehicleConfig >> "getInProxyOrder"); +_transportSoldier = getNumber (_vehicleConfig >> "transportSoldier"); +_realCargoCount = if (isArray (_vehicleConfig >> "getInProxyOrder")) then {count _proxyOrder} else {_transportSoldier}; + +//Find FFV turrets: +_ffvCargoIndexes = []; +{ + _turretConfig = [_vehicleConfig, _x] call EFUNC(common,getTurretConfigPath); + _isCargoProxy = ((getText (_turretConfig >> "proxyType")) == "CPCargo") && {isNumber (_turretConfig >> "proxyIndex")}; + + if (_isCargoProxy) then { + _proxyCargoIndex = getNumber (_turretConfig >> "proxyIndex"); + _cargoIndex = _proxyOrder find _proxyCargoIndex; + _ffvCargoIndexes pushBack _cargoIndex; + }; +} forEach (allTurrets [_vehicle, true]); + +//Find Empty Seats: +_occupiedSeats = []; +{ + _x params ["", "", "_xIndex"]; + if (_xIndex > -1) then {_occupiedSeats pushBack _xIndex;}; +} forEach (fullCrew _vehicle); + +TRACE_3("Searching for empty seat",_realCargoCount,_ffvCargoIndexes,_occupiedSeats); + +_emptyCargoSeatReturn = [-1, false]; + +//First seach for non-ffv seats: +for "_index" from 0 to (_realCargoCount - 1) do { + if ((!(_index in _ffvCargoIndexes)) && {!(_index in _occupiedSeats)}) exitWith { + _emptyCargoSeatReturn = [_index, false]; + }; +}; + +//Only use FFV if none found: +if (_emptyCargoSeatReturn isEqualTo [-1, false]) then { + for "_index" from 0 to (_realCargoCount - 1) do { + if (!(_index in _occupiedSeats)) exitWith { + _emptyCargoSeatReturn = [_index, true]; + }; + }; +}; + +_emptyCargoSeatReturn diff --git a/addons/captives/functions/fnc_handleGetIn.sqf b/addons/captives/functions/fnc_handleGetIn.sqf index 487e7d4179..d89049a031 100644 --- a/addons/captives/functions/fnc_handleGetIn.sqf +++ b/addons/captives/functions/fnc_handleGetIn.sqf @@ -4,8 +4,8 @@ * * Arguments: * 0: _vehicle - * 2: dunno - * 1: _unit + * 1: dunno + * 2: _unit * * Return Value: * The return value @@ -17,7 +17,8 @@ */ #include "script_component.hpp" -params ["_vehicle", "_dontcare","_unit"]; +params ["_vehicle", "","_unit"]; +TRACE_2("params",_vehicle,_unit); if (local _unit) then { if (_unit getVariable [QGVAR(isEscorting), false]) then { @@ -25,6 +26,20 @@ if (local _unit) then { }; if (_unit getVariable [QGVAR(isSurrendering), false]) then { - [_unit, false] call FUNC(setSurrender); + [_unit, false] call FUNC(setSurrendered); + }; + + if (_unit getVariable [QGVAR(isHandcuffed), false]) then { + //Need to force animation for FFV turrets + _turretPath = []; + { + _x params ["_xUnit", "", "", "_xTurretPath"]; + if (_unit == _xUnit) exitWith {_turretPath = _xTurretPath}; + } forEach (fullCrew (vehicle _unit)); + if (!(_turretPath isEqualTo [])) then { + TRACE_1("Setting FFV Handcuffed Animation",_turretPath); + [_unit, "ACE_HandcuffedFFV", 2] call EFUNC(common,doAnimation); + [_unit, "ACE_HandcuffedFFV", 1] call EFUNC(common,doAnimation); + }; }; }; diff --git a/addons/captives/functions/fnc_handleGetOut.sqf b/addons/captives/functions/fnc_handleGetOut.sqf index daf88b7e34..dea97eb600 100644 --- a/addons/captives/functions/fnc_handleGetOut.sqf +++ b/addons/captives/functions/fnc_handleGetOut.sqf @@ -4,8 +4,8 @@ * * Arguments: * 0: _vehicle - * 2: dunno - * 1: _unit + * 1: dunno + * 2: _unit * * Return Value: * The return value @@ -17,17 +17,21 @@ */ #include "script_component.hpp" -params ["_vehicle", "_dontcare","_unit"]; +params ["_vehicle", "", "_unit"]; +TRACE_2("params",_vehicle,_unit); if ((local _unit) && {_unit getVariable [QGVAR(isHandcuffed), false]}) then { private ["_cargoIndex"]; _cargoIndex = _unit getVariable [QGVAR(CargoIndex), -1]; - //If captive was not "unloaded", then move them back into the vehicle. - if (_cargoIndex != -1) exitWith { + if (_cargoIndex != -1) then { + //If captive was not "unloaded", then move them back into the vehicle. + TRACE_1("forcing back into vehicle",_cargoIndex); _unit moveInCargo [_vehicle, _cargoIndex]; + } else { + //Getting out of vehicle: + [_unit, "ACE_AmovPercMstpScapWnonDnon", 2] call EFUNC(common,doAnimation); + [_unit, "ACE_AmovPercMstpScapWnonDnon", 1] call EFUNC(common,doAnimation); }; - - [_unit, "ACE_AmovPercMstpScapWnonDnon", 2] call EFUNC(common,doAnimation); }; diff --git a/addons/captives/functions/fnc_handleKilled.sqf b/addons/captives/functions/fnc_handleKilled.sqf deleted file mode 100644 index f7b15ec117..0000000000 --- a/addons/captives/functions/fnc_handleKilled.sqf +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Author: PabstMirror - * Handles when a unit is kill. Reset captivity and escorting status - * - * Arguments: - * 0: _oldUnit - * - * Return Value: - * None - * - * Example: - * [bob1] call ACE_captives_fnc_handleKilled - * - * Public: No - */ -#include "script_component.hpp" - -params ["_oldUnit"]; - -if (!local _oldUnit) exitWith {}; - -if (_oldUnit getVariable [QGVAR(isHandcuffed), false]) then { - [_oldUnit, false] call FUNC(setHandcuffed); -}; - -if (_oldUnit getVariable [QGVAR(isEscorting), false]) then { - _oldUnit setVariable [QGVAR(isEscorting), false, true]; -}; - -if (_oldUnit getVariable [QGVAR(isSurrendering), false]) then { - [_oldUnit, false] call FUNC(setSurrendered); -}; diff --git a/addons/captives/functions/fnc_handleRespawn.sqf b/addons/captives/functions/fnc_handleRespawn.sqf index 6f68aea2fe..7e97501576 100644 --- a/addons/captives/functions/fnc_handleRespawn.sqf +++ b/addons/captives/functions/fnc_handleRespawn.sqf @@ -20,20 +20,34 @@ params ["_unit","_dead"]; if (!local _unit) exitWith {}; -//With respawn="group", we could be respawning into a unit that is handcuffed/captive -//If they are, reset and rerun the SET function -//if not, make sure to explicity disable the setCaptivityStatus, because captiveNum does not work correctly on respawn +// Group and side respawn can potentially respawn you as a captive unit +// Base and instant respawn cannot, so captive should be entirely reset +// So we explicity account for the respawn type +private ["_respawn"]; +_respawn = [0] call BIS_fnc_missionRespawnType; -if (_unit getVariable [QGVAR(isHandcuffed), false]) then { - _unit setVariable [QGVAR(isHandcuffed), false]; - [_unit, true] call FUNC(setHandcuffed); +if (_respawn > 3) then { + if (_unit getVariable [QGVAR(isHandcuffed), false]) then { + _unit setVariable [QGVAR(isHandcuffed), false]; + [_unit, true] call FUNC(setHandcuffed); + }; + + if (_unit getVariable [QGVAR(isSurrendering), false]) then { + _unit setVariable [QGVAR(isSurrendering), false]; + [_unit, true] call FUNC(setSurrendered); + }; } else { + if (_unit getVariable [QGVAR(isHandcuffed), false]) then { + [_unit, false] call FUNC(setHandcuffed); + }; [_unit, QGVAR(Handcuffed), false] call EFUNC(common,setCaptivityStatus); -}; -if (_unit getVariable [QGVAR(isSurrendering), false]) then { - _unit setVariable [QGVAR(isSurrendering), false]; - [_unit, true] call FUNC(setSurrendered); -} else { + if (_unit getVariable [QGVAR(isSurrendering), false]) then { + [_unit, false] call FUNC(setSurrendered); + }; [_unit, QGVAR(Surrendered), false] call EFUNC(common,setCaptivityStatus); + + if (_oldUnit getVariable [QGVAR(isEscorting), false]) then { + _oldUnit setVariable [QGVAR(isEscorting), false, true]; + }; }; diff --git a/addons/captives/functions/fnc_handleUnitInitPost.sqf b/addons/captives/functions/fnc_handleUnitInitPost.sqf index 66cbcff794..52957acd68 100644 --- a/addons/captives/functions/fnc_handleUnitInitPost.sqf +++ b/addons/captives/functions/fnc_handleUnitInitPost.sqf @@ -18,7 +18,7 @@ params ["_unit"]; // prevent players from throwing grenades (added to all units) -[_unit, "Throw", {((_this select 1) getVariable [QGVAR(isHandcuffed), false]) || {(_this select 1) getVariable [QGVAR(isSurrendering), false]}}, {}] call EFUNC(common,addActionEventhandler); +// [_unit, "Throw", {systemChat "a"; ((_this select 1) getVariable [QGVAR(isHandcuffed), false]) || {(_this select 1) getVariable [QGVAR(isSurrendering), false]}; true}, {systemChat "b";}] call EFUNC(common,addActionEventhandler); if (local _unit) then { // reset status on mission start diff --git a/addons/captives/functions/fnc_moduleSurrender.sqf b/addons/captives/functions/fnc_moduleSurrender.sqf index 64c80af35c..bdb0f7c1b5 100644 --- a/addons/captives/functions/fnc_moduleSurrender.sqf +++ b/addons/captives/functions/fnc_moduleSurrender.sqf @@ -26,11 +26,11 @@ if (!_activated) exitWith {}; if (local _logic) then { //Modules run before postInit can instal the event handler, so we need to wait a little bit [{ - PARAMS_1(_units); + params ["_units"]; { ["SetSurrendered", [_x], [_x, true]] call EFUNC(common,targetEvent); } forEach _units; - }, [_units], 0.05, 0.05]call EFUNC(common,waitAndExecute); + }, [_units], 0.05]call EFUNC(common,waitAndExecute); deleteVehicle _logic; }; diff --git a/addons/captives/functions/fnc_setHandcuffed.sqf b/addons/captives/functions/fnc_setHandcuffed.sqf index 9bde3b399d..00122862eb 100644 --- a/addons/captives/functions/fnc_setHandcuffed.sqf +++ b/addons/captives/functions/fnc_setHandcuffed.sqf @@ -17,6 +17,7 @@ #include "script_component.hpp" params ["_unit","_state"]; +TRACE_2("params",_unit,_state); if (!local _unit) exitwith { ERROR("running setHandcuffed on remote unit"); @@ -43,24 +44,47 @@ if (_state) then { // fix anim on mission start (should work on dedicated servers) [{ params ["_unit"]; - if (_unit getVariable [QGVAR(isHandcuffed), false] && {vehicle _unit == _unit}) then { + if (!(_unit getVariable [QGVAR(isHandcuffed), false])) exitWith {}; + + if ((vehicle _unit) == _unit) then { [_unit] call EFUNC(common,fixLoweredRifleAnimation); [_unit, "ACE_AmovPercMstpScapWnonDnon", 1] call EFUNC(common,doAnimation); + } else { + [_unit, "ACE_HandcuffedFFV", 2] call EFUNC(common,doAnimation); + [_unit, "ACE_HandcuffedFFV", 1] call EFUNC(common,doAnimation); + }; - //Adds an animation changed eh - //If we get a change in animation then redo the animation (handles people vaulting to break the animation chain) - private "_animChangedEHID"; - _animChangedEHID = _unit addEventHandler ["AnimChanged", { - PARAMS_2(_unit,_newAnimation); + //Adds an animation changed eh + //If we get a change in animation then redo the animation (handles people vaulting to break the animation chain) + private "_animChangedEHID"; + + _animChangedEHID = _unit addEventHandler ["AnimChanged", { + params ["_unit", "_newAnimation"]; + TRACE_2("AnimChanged",_unit,_newAnimation); + if (_unit == (vehicle _unit)) then { if ((_newAnimation != "ACE_AmovPercMstpSsurWnonDnon") && {!(_unit getVariable ["ACE_isUnconscious", false])}) then { TRACE_1("Handcuff animation interrupted",_newAnimation); [_unit, "ACE_AmovPercMstpScapWnonDnon", 1] call EFUNC(common,doAnimation); }; - }]; - _unit setVariable [QGVAR(handcuffAnimEHID), _animChangedEHID]; + } else { - }; - }, [_unit], 0.01, 0] call EFUNC(common,waitAndExecute); + _turretPath = []; + { + _x params ["_xUnit", "", "", "_xTurretPath"]; + if (_unit == _xUnit) exitWith {_turretPath = _xTurretPath}; + } forEach (fullCrew (vehicle _unit)); + TRACE_1("turret Path",_turretPath); + if (_turretPath isEqualTo []) exitWith {}; + + TRACE_1("Handcuff (FFV) animation interrupted",_newAnimation); + [_unit, "ACE_HandcuffedFFV", 2] call EFUNC(common,doAnimation); + [_unit, "ACE_HandcuffedFFV", 1] call EFUNC(common,doAnimation); + }; + }]; + TRACE_2("Adding animChangedEH",_unit,_animChangedEHID); + _unit setVariable [QGVAR(handcuffAnimEHID), _animChangedEHID]; + + }, [_unit], 0.01] call EFUNC(common,waitAndExecute); } else { _unit setVariable [QGVAR(isHandcuffed), false, true]; [_unit, QGVAR(Handcuffed), false] call EFUNC(common,setCaptivityStatus); @@ -68,6 +92,7 @@ if (_state) then { //remove AnimChanged EH private "_animChangedEHID"; _animChangedEHID = _unit getVariable [QGVAR(handcuffAnimEHID), -1]; + TRACE_1("removing animChanged EH",_animChangedEHID); _unit removeEventHandler ["AnimChanged", _animChangedEHID]; _unit setVariable [QGVAR(handcuffAnimEHID), -1]; @@ -84,3 +109,6 @@ if (_state) then { showHUD true; }; }; + +//Global Event after changes: +["CaptiveStatusChanged", [_unit, _state, "SetHandcuffed"]] call EFUNC(common,globalEvent); diff --git a/addons/captives/functions/fnc_setSurrendered.sqf b/addons/captives/functions/fnc_setSurrendered.sqf index 4fad2d3853..cdba47a406 100644 --- a/addons/captives/functions/fnc_setSurrendered.sqf +++ b/addons/captives/functions/fnc_setSurrendered.sqf @@ -17,6 +17,7 @@ #include "script_component.hpp" params ["_unit","_state"]; +TRACE_2("params",_unit,_state); if (!local _unit) exitwith { ERROR("running surrender on remote unit"); @@ -43,13 +44,13 @@ if (_state) then { // fix anim on mission start (should work on dedicated servers) [{ - PARAMS_1(_unit); + params ["_unit"]; if (_unit getVariable [QGVAR(isSurrendering), false] && {(vehicle _unit) == _unit}) then { //Adds an animation changed eh //If we get a change in animation then redo the animation (handles people vaulting to break the animation chain) private "_animChangedEHID"; _animChangedEHID = _unit addEventHandler ["AnimChanged", { - PARAMS_2(_unit,_newAnimation); + params ["_unit", "_newAnimation"]; if ((_newAnimation != "ACE_AmovPercMstpSsurWnonDnon") && {!(_unit getVariable ["ACE_isUnconscious", false])}) then { TRACE_1("Surrender animation interrupted",_newAnimation); [_unit, "ACE_AmovPercMstpSsurWnonDnon", 1] call EFUNC(common,doAnimation); @@ -57,7 +58,7 @@ if (_state) then { }]; _unit setVariable [QGVAR(surrenderAnimEHID), _animChangedEHID]; }; - }, [_unit], 0.01, 0] call EFUNC(common,waitAndExecute); + }, [_unit], 0.01] call EFUNC(common,waitAndExecute); } else { _unit setVariable [QGVAR(isSurrendering), false, true]; [_unit, QGVAR(Surrendered), false] call EFUNC(common,setCaptivityStatus); @@ -85,8 +86,8 @@ if (_state) then { //spin up a PFEH, to watching animationState for the next 20 seconds to make sure we don't enter "hands up" //Handles long animation chains [{ - PARAMS_2(_args,_pfID); - EXPLODE_2_PVT(_args,_unit,_maxTime); + params ["_args", "_pfID"]; + _args params ["_unit", "_maxTime"]; //If waited long enough or they re-surrendered or they are unconscious, exit loop if ((ACE_time > _maxTime) || {_unit getVariable [QGVAR(isSurrendering), false]} || {_unit getVariable ["ACE_isUnconscious", false]}) exitWith { [_pfID] call CBA_fnc_removePerFrameHandler; @@ -100,3 +101,6 @@ if (_state) then { }, 0, [_unit, (ACE_time + 20)]] call CBA_fnc_addPerFrameHandler; }; }; + +//Global Event after changes: +["CaptiveStatusChanged", [_unit, _state, "SetSurrendered"]] call EFUNC(common,globalEvent); diff --git a/addons/captives/functions/fnc_vehicleCaptiveMoveIn.sqf b/addons/captives/functions/fnc_vehicleCaptiveMoveIn.sqf index 7e30fe4af4..0839c61ea1 100644 --- a/addons/captives/functions/fnc_vehicleCaptiveMoveIn.sqf +++ b/addons/captives/functions/fnc_vehicleCaptiveMoveIn.sqf @@ -16,11 +16,17 @@ */ #include "script_component.hpp" +params ["_target","_vehicle"]; +TRACE_2("params",_target,_vehicle); + private ["_cargoIndex"]; -params ["_target","_vehicle"]; +_getSeat = [_vehicle] call FUNC(findEmptyNonFFVCargoSeat); +TRACE_1("free cargo seat",_getSeat); +_cargoIndex = _getSeat select 0; +if (_cargoIndex == -1) exitWith {ERROR("cargo index -1");}; + +_target moveInCargo [_vehicle, _cargoIndex]; +_target assignAsCargoIndex [_vehicle, _cargoIndex]; -_target moveInCargo _vehicle; -_target assignAsCargo _vehicle; -_cargoIndex = _vehicle getCargoIndex _target; _target setVariable [QGVAR(CargoIndex), _cargoIndex, true]; diff --git a/addons/captives/functions/fnc_vehicleCaptiveMoveOut.sqf b/addons/captives/functions/fnc_vehicleCaptiveMoveOut.sqf index 000d5ef568..ce44b5926f 100644 --- a/addons/captives/functions/fnc_vehicleCaptiveMoveOut.sqf +++ b/addons/captives/functions/fnc_vehicleCaptiveMoveOut.sqf @@ -16,8 +16,11 @@ #include "script_component.hpp" params ["_unit"]; +TRACE_1("params",_unit); + _unit setVariable [QGVAR(CargoIndex), -1, true]; moveOut _unit; [_unit, "ACE_AmovPercMstpScapWnonDnon", 2] call EFUNC(common,doAnimation); +[_unit, "ACE_AmovPercMstpScapWnonDnon", 1] call EFUNC(common,doAnimation); unassignVehicle _unit; diff --git a/addons/captives/script_component.hpp b/addons/captives/script_component.hpp index e68eb19d2f..375c956129 100644 --- a/addons/captives/script_component.hpp +++ b/addons/captives/script_component.hpp @@ -1,6 +1,8 @@ #define COMPONENT captives #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL + #ifdef DEBUG_ENABLED_CAPTIVES #define DEBUG_MODE_FULL #endif diff --git a/addons/captives/stringtable.xml b/addons/captives/stringtable.xml index 8ce7ab90c1..864fa7c437 100644 --- a/addons/captives/stringtable.xml +++ b/addons/captives/stringtable.xml @@ -164,6 +164,9 @@ Einheit kapitulieren lassen Vzdávající se jednotka Fazer unidade se render + Faire capituler l'unité + Egység kapitulálása + Сделать юнита пленным Sync a unit to make them surrender.<br />Source: ace_captives @@ -172,6 +175,9 @@ Einheit synchronisieren, um sie kapitulieren zu lassen.<br />Quelle: ace_captives Synchronizuj s jednotkou, která se má vzdát.<br />Zdroj: ace_captives Sincroniza uma unidade para fazer com que ela se renda. <br/>Fonte: ace_captives + Synchronise une unité pour la rendre captive. <br/>Source: ace_captives + Egység szinkronizálása, hogy kapituláljon.<br />Forrás: ace_captives + Синхронизируйте с юнитами, чтобы сделать их пленными.<br />Источник: ace_captives Captives Settings @@ -180,6 +186,9 @@ Nastavení zajatce Gefangenen-Einstellungen Ajustes de prisioneiros + Options de capitulation + Fogoly-beállítások + Настройки пленения Controls settings for surrender and cable ties @@ -188,6 +197,9 @@ Toto kontroluje nastavení kapitulace a pout Einstellungen zur Kapitulation und Kabelbindern Controla as configurações de rendição e abraçadeiras + Contrôle les paramètres de la rédition et des Serflex + Szabályozza a kapituláció és bilincselés beállításait + Управляет настройками сдачи в плен и связывания Can handcuff own side @@ -196,6 +208,9 @@ Může spoutat spolubojovníky Kann Teamkollegen fesseln Pode algemar o próprio lado + Peut libérer sa propre faction + Saját oldal megbilincselhető + Связать союзника Can players cabletie units on their own side @@ -204,6 +219,9 @@ Mohou hráči spoutat jednotky na své straně Können Spieler eigene Einheiten fesseln Os jogadores podem algemar unidades do seu lado + Les joueurs peuvent utiliser les Serflex sur leur propre camp + A játékosok megkötözhetik-e a saját oldalukon lévő egységeket + Разрешить игрокам связывать юнитов своей стороны Allow surrendering @@ -212,6 +230,9 @@ Povolit vzdávání Kapitulation erlauben Permite rendição + Permettre la capitulation + Kapituláció engedélyezése + Сдаться в плен Players can surrender after holstering their weapon @@ -220,18 +241,37 @@ Hráč se může vzdát poté, co si skryje zbraň Spieler können kapitulieren, nachdem sie ihre Waffe geholstert haben Jogadores podem se render depois de guardar sua arma + Les joueurs peuvent se rendre après avoir rangé leur arme + A játékosok megadhatják magukat a fegyverük elrakása után + Игроки могут сдаться в плен после того, как уберут оружие Require surrendering + Wymagaj kapitulacji + Requer rendição + Требовать пленения + Requiere rendición Require Players to surrender before they can be arrested + Wymagaj od graczy kapitulacji zanim będzie można ich zaaresztować + Requer que jogadores se rendam antes de poderem ser presos + Требуется, чтобы игрок сдался в плен прежде, чем его можно будет связать + Requiere que los Jugadores se rindan antes de arrestarlos Surrendering only + Tylko kapitulacja + Somente rendição + Только сдавшийся в плен + Solo rendición Surrendering or No weapon + Kapitulacja lub brak broni + Rendição ou desarmado + Сдавшийся или безоружный + Rendición o desarme diff --git a/addons/cargo/$PBOPREFIX$ b/addons/cargo/$PBOPREFIX$ new file mode 100644 index 0000000000..74e5e4186e --- /dev/null +++ b/addons/cargo/$PBOPREFIX$ @@ -0,0 +1 @@ +z\ace\addons\cargo \ No newline at end of file diff --git a/addons/cargo/ACE_Settings.hpp b/addons/cargo/ACE_Settings.hpp new file mode 100644 index 0000000000..574000155e --- /dev/null +++ b/addons/cargo/ACE_Settings.hpp @@ -0,0 +1,9 @@ +class ACE_Settings { + class GVAR(enable) { + displayName = CSTRING(ModuleSettings_enable); + description = CSTRING(ModuleSettings_enable_Description); + typeName = "BOOL"; + value = 1; + category = ECSTRING(OptionsMenu,CategoryLogistics); + }; +}; diff --git a/addons/cargo/CfgEventHandlers.hpp b/addons/cargo/CfgEventHandlers.hpp new file mode 100644 index 0000000000..689ba5f19e --- /dev/null +++ b/addons/cargo/CfgEventHandlers.hpp @@ -0,0 +1,91 @@ +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)); + }; +}; + +class Extended_Killed_EventHandlers { + class All { + init = QUOTE(call FUNC(handleDestroyed)); + }; +}; + +//Need initPost or we have problems with setVariable with 'ACE_Cargo' +class Extended_InitPost_EventHandlers { + class StaticWeapon { + class ADDON { + init = QUOTE(_this call DFUNC(initObject)); + }; + }; + class ReammoBox_F { + class ADDON { + init = QUOTE(_this call DFUNC(initObject)); + }; + }; + class Cargo_base_F { + class ADDON { + init = QUOTE(_this call DFUNC(initObject); _this call DFUNC(initVehicle)); + }; + }; + class CargoNet_01_box_F { + class ADDON { + init = QUOTE(_this call DFUNC(initObject); _this call DFUNC(initVehicle)); + }; + }; + class Land_CargoBox_V1_F { + class ADDON { + init = QUOTE(_this call DFUNC(initObject); _this call DFUNC(initVehicle)); + }; + }; + class Land_PaperBox_closed_F { + class ADDON { + init = QUOTE(_this call DFUNC(initObject); _this call DFUNC(initVehicle)); + }; + }; + class Car { + class ADDON { + init = QUOTE(_this call DFUNC(initVehicle)); + }; + }; + class Tank { + class ADDON { + init = QUOTE(_this call DFUNC(initVehicle)); + }; + }; + class Helicopter { + class ADDON { + init = QUOTE(_this call DFUNC(initVehicle)); + }; + }; + class Plane { + class ADDON { + init = QUOTE(_this call DFUNC(initVehicle)); + }; + }; + class Ship_F { + class ADDON { + init = QUOTE(_this call DFUNC(initVehicle)); + }; + }; + class ACE_RepairItem_Base { + class ADDON { + init = QUOTE(_this call DFUNC(initObject)); + }; + }; + class ACE_bodyBagObject { + class ADDON { + init = QUOTE(_this call DFUNC(initObject)); + }; + }; + class ACE_ConcertinaWireCoil { + class ADDON { + init = QUOTE(_this call DFUNC(initObject)); + }; + }; +}; diff --git a/addons/cargo/CfgVehicles.hpp b/addons/cargo/CfgVehicles.hpp new file mode 100644 index 0000000000..ccc23a99aa --- /dev/null +++ b/addons/cargo/CfgVehicles.hpp @@ -0,0 +1,429 @@ +class CfgVehicles { + class ACE_Module; + class ACE_moduleCargoSettings: ACE_Module { + scope = 2; + displayName = CSTRING(SettingsModule_DisplayName); + icon = QUOTE(PATHTOF(UI\Icon_Module_Cargo_ca.paa)); + category = "ACE_Logistics"; + function = QFUNC(moduleSettings); + functionPriority = 1; + isGlobal = 1; + isTriggerActivated = 0; + author = ECSTRING(common,ACETeam); + + class Arguments { + class enable { + displayName = CSTRING(ModuleSettings_enable); + description = CSTRING(ModuleSettings_enable_Description); + typeName = "BOOL"; + defaultValue = 1; + }; + }; + + class ModuleDescription { + description = CSTRING(SettingsModule_Description); + sync[] = {}; + }; + }; + + class LandVehicle; + class Car: LandVehicle { + GVAR(space) = 4; + GVAR(hasCargo) = 1; + class ACE_Cargo { + /* + class Cargo { + class ACE_medicalSupplyCrate { + type = "ACE_medicalSupplyCrate"; + amount = 1; + }; + };*/ + }; + }; + + class Tank: LandVehicle { + GVAR(space) = 4; + GVAR(hasCargo) = 1; + }; + + class Car_F; + class Truck_F: Car_F { + GVAR(space) = 8; + GVAR(hasCargo) = 1; + }; + + // hemets + class Truck_01_base_F: Truck_F { + GVAR(space) = 8; + }; + class B_Truck_01_transport_F: Truck_01_base_F { + GVAR(space) = 20; + }; + class B_Truck_01_covered_F: B_Truck_01_transport_F { + GVAR(space) = 20; + }; + class B_Truck_01_mover_F: B_Truck_01_transport_F { + GVAR(space) = 4; + }; + class B_Truck_01_box_F: B_Truck_01_mover_F { + GVAR(space) = 40; + }; + class B_Truck_01_Repair_F: B_Truck_01_mover_F { + GVAR(space) = 20; + }; + class B_Truck_01_ammo_F: B_Truck_01_mover_F { + GVAR(space) = 8; + }; + class B_Truck_01_fuel_F: B_Truck_01_mover_F { + GVAR(space) = 4; + }; + class B_Truck_01_medical_F: B_Truck_01_transport_F { + GVAR(space) = 8; + }; + + // kamaz' + class Truck_02_base_F: Truck_F { //covers "covered" variants + GVAR(space) = 20; + }; + class Truck_02_transport_base_F: Truck_02_base_F { + GVAR(space) = 20; + }; + class Truck_02_box_base_F: Truck_02_base_F { // repair variant, not actually cargo box like hemet + GVAR(space) = 12; + }; + class Truck_02_medical_base_F: Truck_02_box_base_F { + GVAR(space) = 8; + }; + class Truck_02_Ammo_base_F: Truck_02_base_F { + GVAR(space) = 12; + }; + class Truck_02_fuel_base_F: Truck_02_base_F { + GVAR(space) = 4; + }; + + // typhoon + class Truck_03_base_F: Truck_F { + GVAR(space) = 8; + }; + class O_Truck_03_transport_F: Truck_03_base_F { + GVAR(space) = 20; + }; + class O_Truck_03_covered_F: Truck_03_base_F { + GVAR(space) = 20; + }; + class O_Truck_03_repair_F: Truck_03_base_F { + GVAR(space) = 12; + }; + class O_Truck_03_ammo_F: Truck_03_base_F { + GVAR(space) = 8; + }; + class O_Truck_03_fuel_F: Truck_03_base_F { + GVAR(space) = 4; + }; + class O_Truck_03_medical_F: Truck_03_base_F { + GVAR(space) = 8; + }; + class O_Truck_03_device_F: Truck_03_base_F { + GVAR(space) = 4; + }; + + // civ trucks + class Van_01_base_F: Truck_F { + GVAR(space) = 8; + }; + class Van_01_transport_base_F: Van_01_base_F { + GVAR(space) = 8; + }; + class Van_01_box_base_F: Van_01_base_F { // repair variant, not actually cargo box like hemet + GVAR(space) = 12; + }; + class Van_01_fuel_base_F: Van_01_base_F { + GVAR(space) = 4; + }; + + // misc. vehicles + class Quadbike_01_base_F: Car_F { + GVAR(space) = 0; + GVAR(hasCargo) = 0; + }; + + class Kart_01_Base_F: Car_F { + GVAR(space) = 0; + GVAR(hasCargo) = 0; + }; + + // helicopters + class Air; + class Helicopter: Air { + GVAR(space) = 8; + GVAR(hasCargo) = 1; + }; + + class Heli_Transport_02_base_F; + class I_Heli_Transport_02_F : Heli_Transport_02_base_F { + GVAR(space) = 20; + GVAR(hasCargo) = 1; + }; + + // jets + class Plane: Air { + GVAR(space) = 0; + GVAR(hasCargo) = 0; + }; + + // boats + class Ship; + class Ship_F: Ship { + GVAR(space) = 4; + GVAR(hasCargo) = 1; + }; + + class Boat_Civil_01_base_F: Ship_F { + GVAR(space) = 4; + GVAR(hasCargo) = 1; + }; + + class Boat_F: Ship_F {}; + class Rubber_duck_base_F: Boat_F { + GVAR(space) = 0; + GVAR(hasCargo) = 0; + }; + + class Boat_Armed_01_base_F: Boat_F { + GVAR(space) = 8; + GVAR(hasCargo) = 1; + }; + + // submarines + class SDV_01_base_F: Boat_F { + GVAR(space) = 0; + GVAR(hasCargo) = 0; + }; + + // Static weapons + class StaticWeapon: LandVehicle { + GVAR(size) = 2; // 1 = small, 2 = large + GVAR(canLoad) = 1; + }; + + class StaticMortar; + class Mortar_01_base_F: StaticMortar { + GVAR(size) = 2; // 1 = small, 2 = large + GVAR(canLoad) = 1; + }; + + // Ammo boxes + class ThingX; + class ReammoBox_F: ThingX { + GVAR(size) = 2; // 1 = small, 2 = large + GVAR(canLoad) = 1; + }; + + class Scrapyard_base_F; + class Land_PaperBox_closed_F: Scrapyard_base_F { + GVAR(space) = 10; + GVAR(hasCargo) = 1; + GVAR(size) = 11; + GVAR(canLoad) = 1; + XEH_ENABLED; + + class ACE_Actions { + class ACE_MainActions { + displayName = ECSTRING(interaction,MainAction); + distance = 5; + condition = QUOTE(true); + statement = ""; + icon = "\a3\ui_f\data\IGUI\Cfg\Actions\eject_ca.paa"; + selection = ""; + }; + }; + }; + + class Cargo_base_F: ThingX { + GVAR(space) = 4; + GVAR(hasCargo) = 1; + GVAR(size) = 4; + GVAR(canLoad) = 1; + + class ACE_Actions { + class ACE_MainActions { + displayName = ECSTRING(interaction,MainAction); + distance = 5; + condition = QUOTE(true); + statement = ""; + icon = "\a3\ui_f\data\IGUI\Cfg\Actions\eject_ca.paa"; + selection = ""; + }; + }; + }; + class Cargo10_base_F: Cargo_base_F { + GVAR(space) = 14; + GVAR(size) = 15; + XEH_ENABLED; + }; + class Land_Cargo20_blue_F: Cargo_base_F { + GVAR(space) = 49; + GVAR(size) = 50; + XEH_ENABLED; + }; + class Land_Cargo20_brick_red_F: Cargo_base_F { + GVAR(space) = 49; + GVAR(size) = 50; + XEH_ENABLED; + }; + class Land_Cargo20_cyan_F: Cargo_base_F { + GVAR(space) = 49; + GVAR(size) = 50; + XEH_ENABLED; + }; + class Land_Cargo20_grey_F: Cargo_base_F { + GVAR(space) = 49; + GVAR(size) = 50; + XEH_ENABLED; + }; + class Land_Cargo20_light_blue_F: Cargo_base_F { + GVAR(space) = 49; + GVAR(size) = 50; + XEH_ENABLED; + }; + class Land_Cargo20_light_green_F: Cargo_base_F { + GVAR(space) = 49; + GVAR(size) = 50; + XEH_ENABLED; + }; + class Land_Cargo20_military_green_F: Cargo_base_F { + GVAR(space) = 49; + GVAR(size) = 50; + XEH_ENABLED; + }; + + class Ruins_F; + class Land_Cargo20_military_ruins_F: Ruins_F { + GVAR(space) = 49; + GVAR(size) = 50; + XEH_ENABLED; + }; + + class Land_Cargo20_orange_F: Cargo_base_F { + GVAR(space) = 49; + GVAR(size) = 50; + XEH_ENABLED; + }; + class Land_Cargo20_red_F: Cargo_base_F { + GVAR(space) = 49; + GVAR(size) = 50; + XEH_ENABLED; + }; + class Land_Cargo20_sand_F: Cargo_base_F { + GVAR(space) = 49; + GVAR(size) = 50; + XEH_ENABLED; + }; + class Land_Cargo20_vr_F: Cargo_base_F { + GVAR(space) = 49; + GVAR(size) = 50; + XEH_ENABLED; + }; + class Land_Cargo20_white_F: Cargo_base_F { + GVAR(space) = 49; + GVAR(size) = 50; + XEH_ENABLED; + }; + class Land_Cargo20_yellow_F: Cargo_base_F { + GVAR(space) = 49; + GVAR(size) = 50; + XEH_ENABLED; + }; + + class Land_Cargo40_blue_F: Cargo_base_F { + GVAR(space) = 99; + GVAR(size) = 100; + XEH_ENABLED; + }; + class Land_Cargo40_brick_red_F: Cargo_base_F { + GVAR(space) = 99; + GVAR(size) = 100; + XEH_ENABLED; + }; + class Land_Cargo40_cyan_F: Cargo_base_F { + GVAR(space) = 99; + GVAR(size) = 100; + XEH_ENABLED; + }; + class Land_Cargo40_grey_F: Cargo_base_F { + GVAR(space) = 99; + GVAR(size) = 100; + XEH_ENABLED; + }; + class Land_Cargo40_light_blue_F: Cargo_base_F { + GVAR(space) = 99; + GVAR(size) = 100; + XEH_ENABLED; + }; + class Land_Cargo40_light_green_F: Cargo_base_F { + GVAR(space) = 99; + GVAR(size) = 100; + XEH_ENABLED; + }; + class Land_Cargo40_military_green_F: Cargo_base_F { + GVAR(space) = 99; + GVAR(size) = 100; + XEH_ENABLED; + }; + + class Land_Cargo40_military_ruins_F: Ruins_F { + GVAR(space) = 99; + GVAR(size) = 100; + XEH_ENABLED; + }; + + class Land_Cargo40_orange_F: Cargo_base_F { + GVAR(space) = 99; + GVAR(size) = 100; + XEH_ENABLED; + }; + class Land_Cargo40_red_F: Cargo_base_F { + GVAR(space) = 99; + GVAR(size) = 100; + XEH_ENABLED; + }; + class Land_Cargo40_sand_F: Cargo_base_F { + GVAR(space) = 99; + GVAR(size) = 100; + XEH_ENABLED; + }; + class Land_Cargo40_vr_F: Cargo_base_F { + GVAR(space) = 99; + GVAR(size) = 100; + XEH_ENABLED; + }; + class Land_Cargo40_white_F: Cargo_base_F { + GVAR(space) = 99; + GVAR(size) = 100; + XEH_ENABLED; + }; + class Land_Cargo40_yellow_F: Cargo_base_F { + GVAR(space) = 99; + GVAR(size) = 100; + XEH_ENABLED; + }; + + // small + class Land_CargoBox_V1_F: ThingX { + GVAR(space) = 7; + GVAR(hasCargo) = 1; + GVAR(size) = 7; + XEH_ENABLED; + + class ACE_Actions { + class ACE_MainActions { + displayName = ECSTRING(interaction,MainAction); + distance = 5; + condition = QUOTE(true); + statement = ""; + icon = "\a3\ui_f\data\IGUI\Cfg\Actions\eject_ca.paa"; + selection = ""; + }; + }; + }; +}; diff --git a/addons/cargo/README.md b/addons/cargo/README.md new file mode 100644 index 0000000000..eda7079b7b --- /dev/null +++ b/addons/cargo/README.md @@ -0,0 +1,12 @@ +ace_cargo +============ + +Adds cargo menu to vehicles and allows loading and unloading of cargo items. + + +## Maintainers + +The people responsible for merging changes to this component or answering potential questions. + +- [commy2](https://github.com/commy2) +- [Glowbal](https://github.com/Glowbal) diff --git a/addons/cargo/UI/Icon_Module_Cargo_ca.paa b/addons/cargo/UI/Icon_Module_Cargo_ca.paa new file mode 100644 index 0000000000..a292fb4227 Binary files /dev/null and b/addons/cargo/UI/Icon_Module_Cargo_ca.paa differ diff --git a/addons/cargo/UI/Icon_load.paa b/addons/cargo/UI/Icon_load.paa new file mode 100644 index 0000000000..ccd77761e4 Binary files /dev/null and b/addons/cargo/UI/Icon_load.paa differ diff --git a/addons/cargo/XEH_postInit.sqf b/addons/cargo/XEH_postInit.sqf new file mode 100644 index 0000000000..6501044c9d --- /dev/null +++ b/addons/cargo/XEH_postInit.sqf @@ -0,0 +1,5 @@ +#include "script_component.hpp" + +["LoadCargo", {_this call FUNC(loadItem)}] call EFUNC(common,addEventHandler); +["UnloadCargo", {_this call FUNC(unloadItem)}] call EFUNC(common,addEventHandler); +["AddCargoByClass", {_this call FUNC(addCargoItem)}] call EFUNC(common,addEventHandler); diff --git a/addons/cargo/XEH_preInit.sqf b/addons/cargo/XEH_preInit.sqf new file mode 100644 index 0000000000..8924cacfd5 --- /dev/null +++ b/addons/cargo/XEH_preInit.sqf @@ -0,0 +1,25 @@ +#include "script_component.hpp" + +ADDON = false; + +PREP(addCargoItem); +PREP(canLoad); +PREP(canLoadItemIn); +PREP(canUnloadItem); +PREP(findNearestVehicle); +PREP(getCargoSpaceLeft); +PREP(getSizeItem); +PREP(handleDestroyed); +PREP(initObject); +PREP(initVehicle); +PREP(loadItem); +PREP(moduleSettings); +PREP(onMenuOpen); +PREP(startLoadIn); +PREP(startUnload); +PREP(unloadItem); +PREP(validateCargoSpace); + +GVAR(initializedItemClasses) = []; + +ADDON = true; diff --git a/optionals/compat_bwa3/config.cpp b/addons/cargo/config.cpp similarity index 50% rename from optionals/compat_bwa3/config.cpp rename to addons/cargo/config.cpp index 5f9c254235..1aefa49616 100644 --- a/optionals/compat_bwa3/config.cpp +++ b/addons/cargo/config.cpp @@ -5,13 +5,14 @@ class CfgPatches { units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; - requiredAddons[] = {"BWA3_Weapons","BWA3_Tracked"}; - author[]={"Ruthberg", "GitHawk"}; + requiredAddons[] = {"ace_interaction"}; + author[] = {"commy2", "Glowbal"}; + authorUrl = "https://ace3mod.com/"; VERSION_CONFIG; }; }; -#include "CfgAmmo.hpp" -#include "CfgWeapons.hpp" -#include "CfgMagazines.hpp" +#include "ACE_Settings.hpp" +#include "CfgEventHandlers.hpp" #include "CfgVehicles.hpp" +#include "menu.hpp" diff --git a/addons/cargo/functions/fnc_addCargoItem.sqf b/addons/cargo/functions/fnc_addCargoItem.sqf new file mode 100644 index 0000000000..9f349153c0 --- /dev/null +++ b/addons/cargo/functions/fnc_addCargoItem.sqf @@ -0,0 +1,41 @@ +/* + * Author: Glowbal, Jonpas + * Adds a cargo item to the vehicle. + * + * Arguments: + * 0: Item Classname + * 1: Vehicle + * 2: Amount (default: 1) + * 3: Show Hint (default: false) + * + * Return Value: + * None + * + * Example: + * ["item", vehicle] call ace_cargo_fnc_addCargoItem + * + * Public: No + */ +#include "script_component.hpp" + +private ["_position", "_item", "_i"]; +params ["_itemClass", "_vehicle", ["_amount", 1], ["_showHint", false, [false]] ]; +TRACE_3("params",_itemClass,_vehicle,_amount); + +_position = getPos _vehicle; +_position set [1, (_position select 1) + 1]; +_position set [2, (_position select 2) + 7.5]; + +for "_i" from 1 to _amount do { + _item = createVehicle [_itemClass, _position, [], 0, "CAN_COLLIDE"]; + + // Load item or delete it if no space left + if !([_item, _vehicle, _showHint] call FUNC(loadItem)) exitWith { + TRACE_1("no room to load item - deleting",_item); + deleteVehicle _item; + }; + TRACE_1("Item Loaded",_item); + + // Invoke listenable event + ["cargoAddedByClass", [_itemClass, _vehicle, _amount]] call EFUNC(common,globalEvent); +}; diff --git a/addons/cargo/functions/fnc_canLoad.sqf b/addons/cargo/functions/fnc_canLoad.sqf new file mode 100644 index 0000000000..f18ceb5835 --- /dev/null +++ b/addons/cargo/functions/fnc_canLoad.sqf @@ -0,0 +1,36 @@ +/* + * Author: Glowbal + * Check if player can load an item into the nearest vehicle. + * + * Arguments: + * 0: Player + * 1: Object to load + * + * Return value: + * Can load + * + * Example: + * [player, object] call ace_cargo_fnc_canLoad + * + * Public: No + */ +#include "script_component.hpp" + +params ["_player", "_object"]; + +if (!([_player, _object, []] call EFUNC(common,canInteractWith))) exitWith {false}; + +private ["_nearestVehicle"]; +_nearestVehicle = [_player] call FUNC(findNearestVehicle); + +if (_nearestVehicle isKindOf "Cargo_Base_F" || isNull _nearestVehicle) then { + { + if ([_object, _x] call FUNC(canLoadItemIn)) exitWith {_nearestVehicle = _x}; + } forEach (nearestObjects [_player, ["Cargo_base_F", "Land_PaperBox_closed_F"], MAX_LOAD_DISTANCE]); +}; + +if (isNull _nearestVehicle) exitWith {false}; + +if ((locked _nearestVehicle) >= 2) exitWith {false}; + +[_object, _nearestVehicle] call FUNC(canLoadItemIn) diff --git a/addons/cargo/functions/fnc_canLoadItemIn.sqf b/addons/cargo/functions/fnc_canLoadItemIn.sqf new file mode 100644 index 0000000000..8cfe9e194b --- /dev/null +++ b/addons/cargo/functions/fnc_canLoadItemIn.sqf @@ -0,0 +1,29 @@ +/* + * Author: Glowbal + * Check if item can be loaded into other Object. + * + * Arguments: + * 0: Item Object + * 1: Holder Object (Vehicle) + * + * Return value: + * Can load in + * + * Example: + * [item, holder] call ace_cargo_fnc_canLoadItemIn + * + * Public: No + */ +#include "script_component.hpp" + +params ["_item", "_vehicle"]; + +if (speed _vehicle > 1 || (((getPos _vehicle) select 2) > 3)) exitWith {false}; + +private "_itemSize"; +_itemSize = ([_item] call FUNC(getSizeItem)); + +(_itemSize > 0) && +{alive _item && alive _vehicle} && +{(_item distance _vehicle <= MAX_LOAD_DISTANCE)} && +{_itemSize <= ([_vehicle] call FUNC(getCargoSpaceLeft))} diff --git a/addons/cargo/functions/fnc_canUnloadItem.sqf b/addons/cargo/functions/fnc_canUnloadItem.sqf new file mode 100644 index 0000000000..779a7533a9 --- /dev/null +++ b/addons/cargo/functions/fnc_canUnloadItem.sqf @@ -0,0 +1,44 @@ +/* + * Author: Glowbal, ViperMaul + * Check if item can be unloaded. + * + * Arguments: + * 0: loaded Object + * 1: Object + * + * Return value: + * Can be unloaded + * + * Example: + * [item, holder] call ace_cargo_fnc_canUnloadItem + * + * Public: No + */ +#include "script_component.hpp" + +private ["_loaded", "_validVehiclestate", "_emptyPos"]; + +params ["_item", "_vehicle"]; + +_loaded = _vehicle getVariable [QGVAR(loaded), []]; +if !(_item in _loaded) exitWith {false}; + +_validVehiclestate = true; +_emptyPos = []; +if (_vehicle isKindOf "Ship" ) then { + if !(speed _vehicle <1 && {(((getPosATL _vehicle) select 2) < 2)}) then {_validVehiclestate = false}; + _emptyPos = ((getPosASL _vehicle) call EFUNC(common,ASLtoPosition) findEmptyPosition [0, 15, typeOf _item]); // TODO: if spot is underwater pick another spot. +} else { + if (_vehicle isKindOf "Air" ) then { + if !(speed _vehicle <1 && {isTouchingGround _vehicle}) then {_validVehiclestate = false}; + _emptyPos = (getPosASL _vehicle) call EFUNC(common,ASLtoPosition); + _emptyPos = [(_emptyPos select 0) + random(5), (_emptyPos select 1) + random(5), _emptyPos select 2 ]; + } else { + if !(speed _vehicle <1 && {(((getPosATL _vehicle) select 2) < 2)}) then {_validVehiclestate = false}; + _emptyPos = ((getPosASL _vehicle) call EFUNC(common,ASLtoPosition) findEmptyPosition [0, 15, typeOf _item]); + }; +}; + +if (!_validVehiclestate) exitWith {false}; + +(count _emptyPos != 0) diff --git a/addons/cargo/functions/fnc_findNearestVehicle.sqf b/addons/cargo/functions/fnc_findNearestVehicle.sqf new file mode 100644 index 0000000000..c0ec154d47 --- /dev/null +++ b/addons/cargo/functions/fnc_findNearestVehicle.sqf @@ -0,0 +1,37 @@ +/* + * Author: Glowbal + * Get nearest vehicle from unit, priority: Car-Air-Tank-Ship. + * + * Arguments: + * 0: Unit + * + * Return value: + * Vehicle in Distance + * + * Example: + * [unit] call ace_cargo_fnc_findNearestVehicle + * + * Public: No + */ +#include "script_component.hpp" + +private ["_loadCar", "_loadHelicopter", "_loadTank", "_loadShip", "_loadContainer"]; + +params ["_unit"]; + +_loadCar = nearestObject [_unit, "car"]; +if (_unit distance _loadCar <= MAX_LOAD_DISTANCE) exitWith {_loadCar}; + +_loadHelicopter = nearestObject [_unit, "air"]; +if (_unit distance _loadHelicopter <= MAX_LOAD_DISTANCE) exitWith {_loadHelicopter}; + +_loadTank = nearestObject [_unit, "tank"]; +if (_unit distance _loadTank <= MAX_LOAD_DISTANCE) exitWith {_loadTank}; + +_loadShip = nearestObject [_unit, "ship"]; +if (_unit distance _loadShip <= MAX_LOAD_DISTANCE) exitWith {_loadShip}; + +_loadContainer = nearestObject [_unit,"Cargo_base_F"]; +if (_unit distance _loadContainer <= MAX_LOAD_DISTANCE) exitWith {_loadContainer}; + +objNull diff --git a/addons/cargo/functions/fnc_getCargoSpaceLeft.sqf b/addons/cargo/functions/fnc_getCargoSpaceLeft.sqf new file mode 100644 index 0000000000..cae27a2d58 --- /dev/null +++ b/addons/cargo/functions/fnc_getCargoSpaceLeft.sqf @@ -0,0 +1,20 @@ +/* + * Author: Glowbal + * Get the cargo space left on object. + * + * Arguments: + * 0: Object + * + * Return value: + * Cargo space left + * + * Example: + * [object] call ace_cargo_fnc_getCargoSpaceLeft + * + * Public: No + */ +#include "script_component.hpp" + +params ["_object"]; + +_object getVariable [QGVAR(space), getNumber (configFile >> "CfgVehicles" >> typeof _object >> QGVAR(space))] diff --git a/addons/cargo/functions/fnc_getSizeItem.sqf b/addons/cargo/functions/fnc_getSizeItem.sqf new file mode 100644 index 0000000000..dacd6a4982 --- /dev/null +++ b/addons/cargo/functions/fnc_getSizeItem.sqf @@ -0,0 +1,28 @@ +/* + * Author: Glowbal + * Get the cargo size of an object. + * + * Arguments: + * 0: Object + * + * Return value: + * Cargo size (default: -1) + * + * Example: + * [object] call ace_cargo_fnc_getSizeItem + * + * Public: No + */ +#include "script_component.hpp" + +private "_config"; + +params ["_item"]; + +_config = (configFile >> "CfgVehicles" >> typeOf _item >> QGVAR(size)); + +if (isNumber (_config)) exitWith { + _item getVariable [QGVAR(size), getNumber (_config)] +}; + +-1 diff --git a/addons/cargo/functions/fnc_handleDestroyed.sqf b/addons/cargo/functions/fnc_handleDestroyed.sqf new file mode 100644 index 0000000000..c11dd3bfad --- /dev/null +++ b/addons/cargo/functions/fnc_handleDestroyed.sqf @@ -0,0 +1,31 @@ +/* + * Author: Glowbal + * Handle object being destroyed. + * + * Arguments: + * 0: Object + * + * Return value: + * None + * + * Example: + * [object] call ace_cargo_fnc_handleDestroyed + * + * Public: No + */ +#include "script_component.hpp" + +params ["_vehicle"]; + +private["_loaded"]; + +_loaded = _vehicle getVariable [QGVAR(loaded), []]; +if (count _loaded == 0) exitWith {}; + +{ + // TODO deleteVehicle or just delete vehicle? Do we want to be able to recover destroyed equipment? + deleteVehicle _x; + //_x setDamage 1; +} count _loaded; + +[_vehicle] call FUNC(validateCargoSpace); diff --git a/addons/cargo/functions/fnc_initObject.sqf b/addons/cargo/functions/fnc_initObject.sqf new file mode 100644 index 0000000000..f9b48b19e1 --- /dev/null +++ b/addons/cargo/functions/fnc_initObject.sqf @@ -0,0 +1,30 @@ +/* + * Author: Glowbal + * Initializes variables for loadable objects. Called from init EH. + * + * Arguments: + * 0: Object + * + * Return value: + * None + * + * Example: + * [object] call ace_cargo_fnc_initObject + * + * Public: No + */ +#include "script_component.hpp" + +params ["_object"]; + +if (getNumber (configFile >> "CfgVehicles" >> typeOf _object >> QGVAR(canLoad)) != 1) exitWith {}; + +private ["_type", "_action"]; +_type = typeOf _object; + +// do nothing if the class is already initialized +if (_type in GVAR(initializedItemClasses)) exitWith {}; +GVAR(initializedItemClasses) pushBack _type; + +_action = [QGVAR(load), localize LSTRING(loadObject), QUOTE(PATHTOF(UI\Icon_load.paa)), {[_player, _target] call FUNC(startLoadIn)}, {GVAR(enable) && {[_player, _target] call FUNC(canLoad)}}] call EFUNC(interact_menu,createAction); +[_type, 0, ["ACE_MainActions"], _action] call EFUNC(interact_menu,addActionToClass); diff --git a/addons/cargo/functions/fnc_initVehicle.sqf b/addons/cargo/functions/fnc_initVehicle.sqf new file mode 100644 index 0000000000..8857030cb7 --- /dev/null +++ b/addons/cargo/functions/fnc_initVehicle.sqf @@ -0,0 +1,55 @@ +/* + * Author: Glowbal + * Initializes vehicle, adds open cargo menu action if available. + * + * Arguments: + * 0: Vehicle + * + * Return Value: + * None + * + * Example: + * [vehicle] call ace_cargo_fnc_initVehicle + * + * Public: No + */ +#include "script_component.hpp" + +params ["_vehicle"]; +TRACE_1("params", _vehicle); + +private ["_type", "_initializedClasses"]; +_type = typeOf _vehicle; +_initializedClasses = GETMVAR(GVAR(initializedClasses),[]); + +if (isServer) then { + { + if (isClass _x) then { + private ["_cargoClassname", "_cargoCount"]; + _cargoClassname = getText (_x >> "type"); + _cargoCount = getNumber (_x >> "amount"); + TRACE_3("adding ACE_Cargo", (configName _x), _cargoClassname, _cargoCount); + ["AddCargoByClass", [_cargoClassname, _vehicle, _cargoCount]] call EFUNC(common,localEvent); + }; + } count ("true" configClasses (configFile >> "CfgVehicles" >> _type >> "ACE_Cargo" >> "Cargo")); +}; + +// do nothing if the class is already initialized +if (_type in _initializedClasses) exitWith {}; +// set class as initialized +_initializedClasses pushBack _type; +SETMVAR(GVAR(initializedClasses),_initializedClasses); + +if (getNumber (configFile >> "CfgVehicles" >> _type >> QGVAR(hasCargo)) != 1) exitWith {}; + +private ["_text", "_condition", "_statement", "_icon", "_action"]; +_condition = { + params ["_target", "_player"]; + GVAR(enable) && {locked _target < 2} && {alive _target} && {[_player, _target, []] call EFUNC(common,canInteractWith)} +}; +_text = localize LSTRING(openMenu); +_statement = {GVAR(interactionVehicle) = _target; createDialog QGVAR(menu);}; +_icon = ""; + +_action = [QGVAR(openMenu), _text, _icon, _statement, _condition] call EFUNC(interact_menu,createAction); +[_type, 0, ["ACE_MainActions"], _action] call EFUNC(interact_menu,addActionToClass); diff --git a/addons/cargo/functions/fnc_loadItem.sqf b/addons/cargo/functions/fnc_loadItem.sqf new file mode 100644 index 0000000000..11e7638f1b --- /dev/null +++ b/addons/cargo/functions/fnc_loadItem.sqf @@ -0,0 +1,57 @@ +/* + * Author: Glowbal + * Load object into vehicle. + * + * Arguments: + * 0: Object + * 1: Vehicle + * 2: Show Hint (default: true) + * + * Return value: + * Object loaded + * + * Example: + * [object, vehicle] call ace_cargo_fnc_loadItem + * + * Public: No + */ +#include "script_component.hpp" + +private ["_loaded", "_space", "_itemSize"]; + +params ["_item", "_vehicle", ["_showHint", true, [true]] ]; +TRACE_2("params",_item,_vehicle); + +if !([_item, _vehicle] call FUNC(canLoadItemIn)) exitWith { + TRACE_2("canLoadItemIn failed",_item,_vehicle); + false +}; + +_loaded = _vehicle getVariable [QGVAR(loaded), []]; +_loaded pushback _item; +_vehicle setVariable [QGVAR(loaded), _loaded, true]; + +TRACE_1("added to loaded array",_loaded); + +_space = [_vehicle] call FUNC(getCargoSpaceLeft); +_itemSize = [_item] call FUNC(getSizeItem); +_vehicle setVariable [QGVAR(space), _space - _itemSize, true]; + +detach _item; +_item attachTo [_vehicle,[0,0,100]]; +["hideObjectGlobal", [_item, true]] call EFUNC(common,serverEvent); + +// show hint +private ["_itemName", "_vehicleName"]; + +_itemName = getText (configFile >> "CfgVehicles" >> typeOf _item >> "displayName"); +_vehicleName = getText (configFile >> "CfgVehicles" >> typeOf _vehicle >> "displayName"); + +if (_showHint) then { + ["displayTextStructured", [[localize LSTRING(LoadedItem), _itemName, _vehicleName], 3.0]] call EFUNC(common,localEvent); +}; + +// Invoke listenable event +["cargoLoaded", [_item, _vehicle]] call EFUNC(common,globalEvent); + +true diff --git a/addons/cargo/functions/fnc_moduleSettings.sqf b/addons/cargo/functions/fnc_moduleSettings.sqf new file mode 100644 index 0000000000..2027fb4bbb --- /dev/null +++ b/addons/cargo/functions/fnc_moduleSettings.sqf @@ -0,0 +1,28 @@ +/* + * Author: Glowbal + * Module for adjusting the cargo settings + * + * Arguments: + * 0: The module logic + * 1: Synchronized units + * 2: Activated + * + * Return Value: + * None + * + * Example: + * function = "ace_cargo_fnc_loadItem" + * + * Public: No + */ +#include "script_component.hpp" + +if (!isServer) exitWith {}; + +params ["_logic", "_units", "_activated"]; + +if (!_activated) exitWith {}; + +[_logic, QGVAR(enable), "enable"] call EFUNC(common,readSettingFromModule); + +ACE_LOGINFO("Cargo Module Initialized."); diff --git a/addons/cargo/functions/fnc_onMenuOpen.sqf b/addons/cargo/functions/fnc_onMenuOpen.sqf new file mode 100644 index 0000000000..031bea01cc --- /dev/null +++ b/addons/cargo/functions/fnc_onMenuOpen.sqf @@ -0,0 +1,48 @@ +/* + * Author: Glowbal + * Handle the UI data display. + * + * Arguments: + * 0: Display + * + * Return value: + * None + * + * Example: + * [display] call ace_cargo_fnc_onMenuOpen + * + * Public: No + */ +#include "script_component.hpp" + +disableSerialization; + +params ["_display"]; + +uiNamespace setVariable [QGVAR(menuDisplay), _display]; + +[{ + private ["_display","_loaded", "_ctrl", "_label"]; + disableSerialization; + _display = uiNamespace getVariable QGVAR(menuDisplay); + if (isnil "_display") exitWith { + [_this select 1] call CBA_fnc_removePerFrameHandler; + }; + + if (isNull GVAR(interactionVehicle) || ACE_player distance GVAR(interactionVehicle) >= 10) exitWith { + closeDialog 0; + [_this select 1] call CBA_fnc_removePerFrameHandler; + }; + + _loaded = GVAR(interactionVehicle) getVariable [QGVAR(loaded), []]; + _ctrl = _display displayCtrl 100; + _label = _display displayCtrl 2; + + lbClear _ctrl; + { + _ctrl lbAdd (getText(configfile >> "CfgVehicles" >> typeOf _x >> "displayName")); + true + } count _loaded; + + _label ctrlSetText format[localize LSTRING(labelSpace), [GVAR(interactionVehicle)] call DFUNC(getCargoSpaceLeft)]; +}, 0, []] call CBA_fnc_addPerFrameHandler; diff --git a/addons/cargo/functions/fnc_startLoadIn.sqf b/addons/cargo/functions/fnc_startLoadIn.sqf new file mode 100644 index 0000000000..b4ba50fbb6 --- /dev/null +++ b/addons/cargo/functions/fnc_startLoadIn.sqf @@ -0,0 +1,31 @@ +/* + * Author: Glowbal + * Start load item. + * + * Arguments: + * 0: Object + * + * Return value: + * Object loaded + * + * Example: + * [object] call ace_cargo_fnc_starLoadIn + * + * Public: No + */ +#include "script_component.hpp" + +params ["_player", "_object"]; + +private ["_nearestVehicle"]; +_nearestVehicle = [_player] call FUNC(findNearestVehicle); + +if (isNull _nearestVehicle || _nearestVehicle isKindOf "Cargo_Base_F") then { + { + if ([_object, _x] call FUNC(canLoadItemIn)) exitWith {_nearestVehicle = _x}; + } foreach (nearestObjects [_player, ["Cargo_base_F", "Land_PaperBox_closed_F"], MAX_LOAD_DISTANCE]); +}; + +if (isNull _nearestVehicle) exitWith {false}; + +[_object, _nearestVehicle] call FUNC(loadItem) diff --git a/addons/cargo/functions/fnc_startUnload.sqf b/addons/cargo/functions/fnc_startUnload.sqf new file mode 100644 index 0000000000..28ae034167 --- /dev/null +++ b/addons/cargo/functions/fnc_startUnload.sqf @@ -0,0 +1,35 @@ +/* + * Author: Glowbal + * Start unload action. + * + * Arguments: + * None + * + * Return value: + * None + * + * Example: + * [] call ace_cargo_fnc_startUnload + * + * Public: No + */ +#include "script_component.hpp" + +private ["_display", "_loaded", "_ctrl", "_selected", "_item"]; + +disableSerialization; + +_display = uiNamespace getVariable QGVAR(menuDisplay); +if (isnil "_display") exitWith {}; + +_loaded = GVAR(interactionVehicle) getVariable [QGVAR(loaded), []]; +if (count _loaded == 0) exitWith {}; + +_ctrl = _display displayCtrl 100; + +_selected = (lbCurSel _ctrl) max 0; + +if (count _loaded <= _selected) exitWith {}; +_item = _loaded select _selected; + +[_item, GVAR(interactionVehicle)] call FUNC(unloadItem); diff --git a/addons/cargo/functions/fnc_unloadItem.sqf b/addons/cargo/functions/fnc_unloadItem.sqf new file mode 100644 index 0000000000..2630f2104a --- /dev/null +++ b/addons/cargo/functions/fnc_unloadItem.sqf @@ -0,0 +1,76 @@ +/* + * Author: Glowbal, ViperMaul + * Unload object from vehicle. + * + * Arguments: + * 0: Object + * 1: Vehicle + * + * Return value: + * Object unloaded + * + * Example: + * [object, vehicle] call ace_cargo_fnc_unloadItem + * + * Public: No + */ +#include "script_component.hpp" + +private ["_loaded", "_space", "_itemSize", "_emptyPos", "_validVehiclestate"]; + +params ["_item", "_vehicle"]; + +if !([_item, _vehicle] call FUNC(canUnloadItem)) exitWith { + false +}; + +_validVehiclestate = true; +_emptyPos = []; +if (_vehicle isKindOf "Ship" ) then { + if !(speed _vehicle <1 && {(((getPosATL _vehicle) select 2) < 2)}) then {_validVehiclestate = false}; + TRACE_1("SHIP Ground Check", getPosATL _vehicle ); + _emptyPos = ((getPosASL _vehicle) call EFUNC(common,ASLtoPosition) findEmptyPosition [0, 15, typeOf _item]); // TODO: if spot is underwater pick another spot. +} else { + if (_vehicle isKindOf "Air" ) then { + if !(speed _vehicle <1 && {isTouchingGround _vehicle}) then {_validVehiclestate = false}; + TRACE_1("Vehicle Ground Check", isTouchingGround _vehicle); + _emptyPos = (getPosASL _vehicle) call EFUNC(common,ASLtoPosition); + _emptyPos = [(_emptyPos select 0) + random(5), (_emptyPos select 1) + random(5), _emptyPos select 2 ]; + } else { + if !(speed _vehicle <1 && {(((getPosATL _vehicle) select 2) < 2)}) then {_validVehiclestate = false}; + TRACE_1("Vehicle Ground Check", isTouchingGround _vehicle); + _emptyPos = ((getPosASL _vehicle) call EFUNC(common,ASLtoPosition) findEmptyPosition [0, 13, typeOf _item]); + }; +}; + +TRACE_1("getPosASL Vehicle Check", getPosASL _vehicle); +if (!_validVehiclestate) exitWith {false}; + +if (count _emptyPos == 0) exitWith {false}; //consider displaying text saying there are no safe places to exit the vehicle + +_loaded = _vehicle getVariable [QGVAR(loaded), []]; +_loaded = _loaded - [_item]; +_vehicle setVariable [QGVAR(loaded), _loaded, true]; + +_space = [_vehicle] call FUNC(getCargoSpaceLeft); +_itemSize = [_item] call FUNC(getSizeItem); +_vehicle setVariable [QGVAR(space), (_space + _itemSize), true]; + +detach _item; +_item setPosASL (_emptyPos call EFUNC(common,PositiontoASL)); +["hideObjectGlobal", [_item, false]] call EFUNC(common,serverEvent); + +// show hint +private ["_itemName", "_vehicleName"]; + +_itemName = getText (configFile >> "CfgVehicles" >> typeOf _item >> "displayName"); +_vehicleName = getText (configFile >> "CfgVehicles" >> typeOf _vehicle >> "displayName"); + +["displayTextStructured", [[localize LSTRING(UnloadedItem), _itemName, _vehicleName], 3.0]] call EFUNC(common,localEvent); + +// TOOO maybe drag/carry the unloaded item? + +// Invoke listenable event +["cargoUnloaded", [_item, _vehicle]] call EFUNC(common,globalEvent); + +true diff --git a/addons/cargo/functions/fnc_validateCargoSpace.sqf b/addons/cargo/functions/fnc_validateCargoSpace.sqf new file mode 100644 index 0000000000..6caf664ca5 --- /dev/null +++ b/addons/cargo/functions/fnc_validateCargoSpace.sqf @@ -0,0 +1,38 @@ +/* + * Author: Glowbal + * Validate the vehicle cargo space. + * + * Arguments: + * 0: Object + * + * Return value: + * None + * + * Example: + * [object] call ace_cargo_fnc_validateCargoSpace + * + * Public: No + */ +#include "script_component.hpp" + +private ["_loaded", "_newLoaded", "_totalSpaceOccupied"]; + +params ["_vehicle"]; + +_loaded = _vehicle getVariable [QGVAR(loaded), []]; + +_newLoaded = []; +_totalSpaceOccupied = 0; +{ + if !(isNull _x) then { + _newLoaded pushback _x; + _totalSpaceOccupied = _totalSpaceOccupied + ([_x] call FUNC(getSizeItem)); + }; + true +} count _loaded; + +if (count _loaded != count _newLoaded) then { + _vehicle setVariable [QGVAR(loaded), _newLoaded, true]; +}; + +_vehicle setVariable [QGVAR(space), getNumber (configFile >> "CfgVehicles" >> typeof _vehicle >> QGVAR(space)) - _totalSpaceOccupied, true]; diff --git a/addons/cargo/functions/script_component.hpp b/addons/cargo/functions/script_component.hpp new file mode 100644 index 0000000000..cc6204b83b --- /dev/null +++ b/addons/cargo/functions/script_component.hpp @@ -0,0 +1 @@ +#include "\z\ace\addons\cargo\script_component.hpp" diff --git a/addons/cargo/menu.hpp b/addons/cargo/menu.hpp new file mode 100644 index 0000000000..bde617b311 --- /dev/null +++ b/addons/cargo/menu.hpp @@ -0,0 +1,103 @@ +#include "\z\ace\addons\common\define.hpp" + +class GVAR(menu) { + idd = 314614; + movingEnable = true; + onLoad = QUOTE([_this select 0] call FUNC(onMenuOpen)); + onUnload = QUOTE(uiNamespace setVariable [ARR_2(QUOTE(QGVAR(menuDisplay)),nil)];); + class controlsBackground { + class HeaderBackground: ACE_gui_backgroundBase{ + idc = -1; + SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + x = "13 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; + y = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; + w = "13 * (((safezoneW / safezoneH) min 1.2) / 40)"; + h = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; + text = "#(argb,8,8,3)color(0,0,0,0)"; + }; + class CenterBackground: HeaderBackground { + y = "2.1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; + h = "14 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; + text = "#(argb,8,8,3)color(0,0,0,0.8)"; + colorText[] = {0, 0, 0, "(profilenamespace getVariable ['GUI_BCG_RGB_A',0.9])"}; + colorBackground[] = {0,0,0,"(profilenamespace getVariable ['GUI_BCG_RGB_A',0.9])"}; + }; + }; + + class controls { + class HeaderName { + idc = 1; + type = CT_STATIC; + x = "13 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; + y = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; + w = "13 * (((safezoneW / safezoneH) min 1.2) / 40)"; + h = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; + style = ST_LEFT + ST_SHADOW; + font = "PuristaMedium"; + SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + colorText[] = {0.95, 0.95, 0.95, 0.75}; + colorBackground[] = {"(profilenamespace getVariable ['GUI_BCG_RGB_R',0.69])","(profilenamespace getVariable ['GUI_BCG_RGB_G',0.75])","(profilenamespace getVariable ['GUI_BCG_RGB_B',0.5])", "(profilenamespace getVariable ['GUI_BCG_RGB_A',0.9])"}; + text = CSTRING(cargoMenu); + }; + class SubHeader: HeaderName { + idc = 2; + x = "13 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; + y = "2.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; + w = "13 * (((safezoneW / safezoneH) min 1.2) / 40)"; + h = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; + style = ST_CENTER; + colorText[] = {1, 1, 1.0, 0.9}; + colorBackground[] = {0,0,0,0}; + SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1.2)"; + text = ""; + }; + class cargoList: ACE_gui_listBoxBase { + idc = 100; + x = "13.1 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; + y = "4 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; + w = "12.8 * (((safezoneW / safezoneH) min 1.2) / 40)"; + h = "10 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; + SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 0.7)"; + rowHeight = 0.03; + colorBackground[] = {0, 0, 0, 0.2}; + colorText[] = {1, 1, 1, 1.0}; + colorScrollbar[] = {0.95, 0.95, 0.95, 1}; + colorSelect[] = {1, 1, 1, 1.0}; + colorSelect2[] = {1, 1, 1, 1.0}; + colorSelectBackground[] = {0.3, 0.3, 0.3, 1.0}; + colorSelectBackground2[] = {0.3, 0.3, 0.3, 1.0}; + }; + class btnUnload: ACE_gui_buttonBase { + text = "Cancel"; + idc = 11; + x = "13.1 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; + y = "14.1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; + w = "5 * (((safezoneW / safezoneH) min 1.2) / 40)"; + h = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; + size = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 0.7)"; + animTextureNormal = "#(argb,8,8,3)color(0,0,0,0.9)"; + animTextureDisabled = "#(argb,8,8,3)color(0,0,0,0.8)"; + animTextureOver = "#(argb,8,8,3)color(1,1,1,1)"; + animTextureFocused = "#(argb,8,8,3)color(1,1,1,1)"; + animTexturePressed = "#(argb,8,8,3)color(1,1,1,1)"; + animTextureDefault = "#(argb,8,8,3)color(1,1,1,1)"; + color[] = {1, 1, 1, 1}; + color2[] = {0,0,0, 1}; + colorBackgroundFocused[] = {1,1,1,1}; + colorBackground[] = {1,1,1,1}; + colorbackground2[] = {1,1,1,1}; + colorDisabled[] = {1,1,1,1}; + colorFocused[] = {0,0,0,1}; + periodFocus = 1; + periodOver = 1; + action = QUOTE(closeDialog 0); + }; + class btnCancel: btnUnload { + text = CSTRING(unloadObject); + idc = 12; + x = "20.9 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; + action = QUOTE([] call FUNC(startUnload);); + }; + }; +}; diff --git a/addons/cargo/script_component.hpp b/addons/cargo/script_component.hpp new file mode 100644 index 0000000000..3f4d6c5d51 --- /dev/null +++ b/addons/cargo/script_component.hpp @@ -0,0 +1,16 @@ +#define COMPONENT cargo +#include "\z\ace\addons\main\script_mod.hpp" + +// #define DEBUG_MODE_FULL + +#ifdef DEBUG_ENABLED_CARGO + #define DEBUG_MODE_FULL +#endif + +#ifdef DEBUG_ENABLED_CARGO + #define DEBUG_SETTINGS DEBUG_ENABLED_CARGO +#endif + +#include "\z\ace\addons\main\script_macros.hpp" + +#define MAX_LOAD_DISTANCE 10 diff --git a/addons/cargo/stringtable.xml b/addons/cargo/stringtable.xml new file mode 100644 index 0000000000..7f9ac40a15 --- /dev/null +++ b/addons/cargo/stringtable.xml @@ -0,0 +1,99 @@ + + + + + Load + Załaduj + Carregar + Загрузить + Naložit + Cargar + + + Unload + Wyładuj + Descarregar + Выгрузить + Vyložit + Descargar + + + Cargo + Ładunek + Carga + Грузовой отсек + Náklad + Carga + + + Cargo Menu + Menu ładunku + Menu de carga + Грузовой отсек + Menu nákladu + Menu de carga + + + Cargo space left: %1 + Pozostałe miejsce: %1 + Espaço de carga restante: %1 + Осталось мест: %1 + Volný prostor: %1 + Espacio de carga restante: %1 + + + Enable Cargo + Aktywuj cargo + Ativar carga + Включить модуль перевозки грузов + Povolit náklad + Habilitar carga + + + Enable the load in cargo module + Aktywuj możliwość załadunku skrzyń i przedmiotów do pojazdów. + Ativar o módulo de carregamento de carga + Включает модуль погрузки и перевозки грузов + Habilitar la carga en el módulo de carga + + + Cargo Settings + Ustawienia cargo + Preferências de carregamento + Перевозка грузов + Nastavení nákladu + Ajustes de carga + + + Configure the cargo module settings + Skonfiguruj ustawienia modułu cargo. + Configura as preferências do módulo de carga + Конфигурирует настройки модуля перевозки грузов + Configure los ajustes del módulo de carga + + + %1<br/>loaded into<br/>%2 + %1<br/>cargado en<br/>%2 + %1<br/>chargé dans<br/>%2 + %1<br/>in<br/>%2 verladen + %1<br/>załadowano do<br/>%2 + %1<br/>naloženo do<br/>%2 + %1<br/>carregado em<br/>%2 + %1<br/>caricato su<br/>%2 + %1<br/>berakodva ide:<br/>%2 + %1<br/>загружен в<br/>%2 + + + Unloaded<br/>%1 from<br/>%2 + %1<br/>von<br/>%2 abgeladen + Descargado/a<br/>%1 de<br/>%2 + Déchargé<br/>%1 de<br/>%2 + %1<br/>rozładowano z<br/>%2 + Nezatížený<br/>%1 do<br/>%2 + %1<br/>descarregado de<br/>%2 + Hai scaricato<br/>%1 da<br/>%2 + 1%<br/>kirakodva ebből:<br/>%2 + %1<br/>разгружен из<br/>%2 + + + diff --git a/addons/common/CfgVehicles.hpp b/addons/common/CfgVehicles.hpp index 69d6f99924..7c5c9295f9 100644 --- a/addons/common/CfgVehicles.hpp +++ b/addons/common/CfgVehicles.hpp @@ -140,4 +140,10 @@ class CfgVehicles { isBicycle = 1; XEH_DISABLED; }; + + class Bag_Base; + class ACE_FakeBackpack: Bag_Base { + scope = 1; + maximumLoad = 1E6; + }; }; diff --git a/addons/common/XEH_postInit.sqf b/addons/common/XEH_postInit.sqf index ee34f1308d..912acce7c4 100644 --- a/addons/common/XEH_postInit.sqf +++ b/addons/common/XEH_postInit.sqf @@ -1,14 +1,18 @@ // ACE - Common #include "script_component.hpp" -//IGNORE_PRIVATE_WARNING("_handleNetEvent", "_handleRequestAllSyncedEvents", "_handleRequestSyncedEvent", "_handleSyncedEvent"); +// #define ENABLE_PERFORMANCE_COUNTERS -//Singe PFEH to handle execNextFrame and waitAndExec: +////////////////////////////////////////////////// +// PFHs +////////////////////////////////////////////////// + +//Singe PFEH to handle execNextFrame, waitAndExec and waitUntilAndExec: [{ - private ["_entry"]; + private ["_entry", "_deleted"]; //Handle the waitAndExec array: - while {((count GVAR(waitAndExecArray)) > 0) && {((GVAR(waitAndExecArray) select 0) select 0) <= ACE_Time}} do { + while {!(GVAR(waitAndExecArray) isEqualTo []) && {GVAR(waitAndExecArray) select 0 select 0 <= ACE_Time}} do { _entry = GVAR(waitAndExecArray) deleteAt 0; (_entry select 2) call (_entry select 1); }; @@ -16,47 +20,68 @@ //Handle the execNextFrame array: { (_x select 0) call (_x select 1); - } forEach GVAR(nextFrameBufferA); + false + } count GVAR(nextFrameBufferA); + //Swap double-buffer: GVAR(nextFrameBufferA) = GVAR(nextFrameBufferB); GVAR(nextFrameBufferB) = []; GVAR(nextFrameNo) = diag_frameno + 1; + + //Handle the waitUntilAndExec array: + _deleted = 0; + { + // if condition is satisifed call statement + if ((_x select 2) call (_x select 0)) then { + // make sure to delete the correct handle when multiple conditions are met in one frame + GVAR(waitUntilAndExecArray) deleteAt (_forEachIndex - _deleted); + _deleted = _deleted + 1; + (_x select 2) call (_x select 1); + }; + } forEach GVAR(waitUntilAndExecArray); }, 0, []] call CBA_fnc_addPerFrameHandler; -// Listens for global "SettingChanged" events, to update the force status locally -["SettingChanged", { - PARAMS_2(_name,_value); - if !(count _this > 2) exitWith {}; - private ["_force", "_settingData"]; - _force = _this select 2; - if (_force) then { - _settingData = [_name] call FUNC(getSettingData); - if (count _settingData == 0) exitWith {}; - _settingData set [6,_force]; - }; -}] call FUNC(addEventhandler); +////////////////////////////////////////////////// +// Get Map Data +////////////////////////////////////////////////// - -["HeadbugFixUsed", { - PARAMS_2(_profileName,_animation); - diag_log text format ["[ACE] Headbug Used: Name: %1, Animation: %2", _profileName, _animation]; -}] call FUNC(addEventHandler); - - -//~~~~~Get Map Data~~~~~ //Find MGRS zone and 100km grid for current map [] call FUNC(getMGRSdata); //Prepare variables for FUNC(getMapGridFromPos)/FUNC(getMapPosFromGrid) [] call FUNC(getMapGridData); +////////////////////////////////////////////////// +// Eventhandlers +////////////////////////////////////////////////// -["fixCollision", DFUNC(fixCollision)] call FUNC(addEventhandler); -["fixFloating", DFUNC(fixFloating)] call FUNC(addEventhandler); -["fixPosition", DFUNC(fixPosition)] call FUNC(addEventhandler); +// Listens for global "SettingChanged" events, to update the force status locally +["SettingChanged", { + params ["_name", "_value", "_force"]; -["unloadPersonEvent", DFUNC(unloadPersonLocal)] call FUNC(addEventhandler); + if (_force) then { + private "_settingData"; + _settingData = [_name] call FUNC(getSettingData); + + if (_settingData isEqualTo []) exitWith {}; + + _settingData set [6, _force]; + }; +}] call FUNC(addEventhandler); + + +// Event to log Fix Headbug output +["HeadbugFixUsed", { + params ["_profileName", "_animation"]; + ACE_LOGINFO_2("Headbug Used: Name: %1, Animation: %2",_profileName,_animation); +}] call FUNC(addEventHandler); + +["fixCollision", FUNC(fixCollision)] call FUNC(addEventhandler); +["fixFloating", FUNC(fixFloating)] call FUNC(addEventhandler); +["fixPosition", FUNC(fixPosition)] call FUNC(addEventhandler); + +["unloadPersonEvent", FUNC(unloadPersonLocal)] call FUNC(addEventhandler); ["lockVehicle", { _this setVariable [QGVAR(lockStatus), locked _this]; @@ -70,78 +95,102 @@ ["setDir", {(_this select 0) setDir (_this select 1)}] call FUNC(addEventhandler); ["setFuel", {(_this select 0) setFuel (_this select 1)}] call FUNC(addEventhandler); ["setSpeaker", {(_this select 0) setSpeaker (_this select 1)}] call FUNC(addEventhandler); +["selectLeader", {(_this select 0) selectLeader (_this select 1)}] call FUNC(addEventHandler); +["assignTeam", {(_this select 0) assignTeam (_this select 1)}] call FUNC(addEventHandler); +["setVelocity", {(_this select 0) setVelocity (_this select 1)}] call FUNC(addEventHandler); if (isServer) then { ["hideObjectGlobal", {(_this select 0) hideObjectGlobal (_this select 1)}] call FUNC(addEventHandler); + ["enableSimulationGlobal", {(_this select 0) enableSimulationGlobal (_this select 1)}] call FUNC(addEventHandler); }; -// hack to get PFH to work in briefing -[QGVAR(onBriefingPFH), "onEachFrame", { - if (ACE_time > 0) exitWith { - [QGVAR(onBriefingPFH), "onEachFrame"] call BIS_fnc_removeStackedEventHandler; - }; - call cba_common_fnc_onFrame; -}] call BIS_fnc_addStackedEventHandler; -///// +////////////////////////////////////////////////// +// Set up remote execution +////////////////////////////////////////////////// +// ACE events +"ACEg" addPublicVariableEventHandler {_this call FUNC(_handleNetEvent)}; +"ACEc" addPublicVariableEventHandler {_this call FUNC(_handleNetEvent)}; + +// Synced ACE events +// Handle JIP scenario +if (!isServer) then { + ["PlayerJip", { + ACE_LOGINFO("JIP event synchronization initialized"); + ["SEH_all", [player]] call FUNC(serverEvent); + }] call FUNC(addEventHandler); +} else { + ["SEH_all", FUNC(_handleRequestAllSyncedEvents)] call FUNC(addEventHandler); +}; + +["SEH", FUNC(_handleSyncedEvent)] call FUNC(addEventHandler); +["SEH_s", FUNC(_handleRequestSyncedEvent)] call FUNC(addEventHandler); + +if (isServer) then { + [FUNC(syncedEventPFH), 0.5, []] call CBA_fnc_addPerFrameHandler; +}; + +// @todo deprecated QGVAR(remoteFnc) addPublicVariableEventHandler { (_this select 1) call FUNC(execRemoteFnc); }; +// @todo figure out what this does. [missionNamespace] call FUNC(executePersistent); + +////////////////////////////////////////////////// +// Check files, previous installed version etc. +////////////////////////////////////////////////// + private ["_currentVersion", "_previousVersion"]; -// check previous version number from profile + _currentVersion = getText (configFile >> "CfgPatches" >> QUOTE(ADDON) >> "version"); _previousVersion = profileNamespace getVariable ["ACE_VersionNumberString", ""]; +// check previous version number from profile if (_currentVersion != _previousVersion) then { // do something profileNamespace setVariable ["ACE_VersionNumberString", _currentVersion]; }; -// ACE events -"ACEg" addPublicVariableEventHandler { _this call FUNC(_handleNetEvent); }; -"ACEc" addPublicVariableEventHandler { _this call FUNC(_handleNetEvent); }; - -// Synced ACE events -// Handle JIP scenario -if(!isServer) then { - ["PlayerJip", { - diag_log text format["[ACE] * JIP event synchronization initialized"]; - ["SEH_all", [player]] call FUNC(serverEvent); - }] call FUNC(addEventHandler); -} else { - ["SEH_all", FUNC(_handleRequestAllSyncedEvents)] call FUNC(addEventHandler); -}; -["SEH", FUNC(_handleSyncedEvent)] call FUNC(addEventHandler); -["SEH_s", FUNC(_handleRequestSyncedEvent)] call FUNC(addEventHandler); -if (isServer) then { - [FUNC(syncedEventPFH), 0.5, []] call CBA_fnc_addPerFrameHandler; -}; call FUNC(checkFiles); +////////////////////////////////////////////////// +// Set up SettingsInitialized eventhandler +////////////////////////////////////////////////// + +["SettingsInitialized", { + [ + GVAR(checkPBOsAction), + GVAR(checkPBOsCheckAll), + call compile GVAR(checkPBOsWhitelist) + ] call FUNC(checkPBOs) +}] call FUNC(addEventHandler); + // Create a pfh to wait until all postinits are ready and settings are initialized [{ - PARAMS_1(_args); - EXPLODE_1_PVT(_args,_waitingMsgSent); + params ["_args"]; + + _args params ["_waitingMsgSent"]; + // If post inits are not ready then wait if !(SLX_XEH_MACHINE select 8) exitWith {}; // If settings are not initialized then wait - if (isNil QGVAR(settings) || {(!isServer) && (isNil QEGVAR(modules,serverModulesRead))}) exitWith { - if (!_waitingMsgSent) then { + if (isNil QGVAR(settings) || {!isServer && isNil QEGVAR(modules,serverModulesRead)}) exitWith { + if !(_waitingMsgSent) then { _args set [0, true]; - diag_log text format["[ACE] Waiting on settings from server"]; + ACE_LOGINFO("Waiting on settings from server..."); }; }; - [(_this select 1)] call cba_fnc_removePerFrameHandler; + [_this select 1] call CBA_fnc_removePerFrameHandler; - diag_log text format["[ACE] Settings received from server"]; + ACE_LOGINFO("Settings received from server."); // Event so that ACE_Modules have their settings loaded: ["InitSettingsFromModules", []] call FUNC(localEvent); @@ -152,225 +201,300 @@ call FUNC(checkFiles); call FUNC(loadSettingsLocalizedText); }; - diag_log text format["[ACE] Settings initialized"]; + ACE_LOGINFO("Settings initialized."); //Event that settings are safe to use: ["SettingsInitialized", []] call FUNC(localEvent); + //Set init finished and run all delayed functions: + GVAR(settingsInitFinished) = true; + ACE_LOGINFO_1("%1 delayed functions running.",count GVAR(runAtSettingsInitialized)); + + { + (_x select 1) call (_x select 0); + false + } count GVAR(runAtSettingsInitialized); + + GVAR(runAtSettingsInitialized) = nil; //cleanup }, 0, [false]] call CBA_fnc_addPerFrameHandler; -["SettingsInitialized", { - [ - GVAR(checkPBOsAction), - GVAR(checkPBOsCheckAll), - call compile GVAR(checkPBOsWhitelist) - ] call FUNC(checkPBOs) -}] call FUNC(addEventHandler); +/***************************************************************************/ +/***************************************************************************/ +/** everything that only player controlled machines need, goes below this **/ +/***************************************************************************/ +/***************************************************************************/ - -/***************************************************************/ -/***************************************************************/ -/***************************************************************/ -/***************************************************************/ -/***************************************************************/ - -// everything that only player controlled machines need, goes below this if (!hasInterface) exitWith {}; -call COMPILE_FILE(scripts\assignedItemFix); -call COMPILE_FILE(scripts\initScrollWheel); +////////////////////////////////////////////////// +// Set up mouse wheel eventhandler +////////////////////////////////////////////////// -DFUNC(mouseZHandler) = { - waitUntil {!isNull (findDisplay 46)}; sleep 0.1; - findDisplay 46 displayAddEventHandler ["MouseZChanged", QUOTE( _this call GVAR(onScrollWheel) )]; - [false] call FUNC(disableUserInput); -}; +call FUNC(assignedItemFix); -addMissionEventHandler ["Loaded", {[] spawn FUNC(mouseZHandler)}]; -[] spawn FUNC(mouseZHandler); +GVAR(ScrollWheelFrame) = diag_frameno; - -enableCamShake true; - -// Set the name for the current player -["playerChanged", { - EXPLODE_2_PVT(_this,_newPlayer,_oldPlayer); - - if (alive _newPlayer) then { - [_newPlayer] call FUNC(setName) - }; - if (alive _oldPlayer) then { - [_oldPlayer] call FUNC(setName) - }; - -}] call FUNC(addEventhandler); - -GVAR(OldPlayerInventory) = [ACE_player] call FUNC(getAllGear); -GVAR(OldPlayerVisionMode) = currentVisionMode ACE_player; -GVAR(OldZeusDisplayIsOpen) = !(isNull findDisplay 312); -GVAR(OldCameraView) = cameraView; -GVAR(OldPlayerVehicle) = vehicle ACE_player; -GVAR(OldPlayerTurret) = [ACE_player] call FUNC(getTurretIndex); -GVAR(OldPlayerWeapon) = currentWeapon ACE_player; - -// PFH to raise varios events -[{ - private ["_newCameraView", "_newInventoryDisplayIsOpen", "_newPlayerInventory", "_newPlayerTurret", "_newPlayerVehicle", "_newPlayerVisionMode", "_newPlayerWeapon", "_newZeusDisplayIsOpen"]; - // "playerInventoryChanged" event - _newPlayerInventory = [ACE_player] call FUNC(getAllGear); - if !(_newPlayerInventory isEqualTo GVAR(OldPlayerInventory)) then { - // Raise ACE event locally - GVAR(OldPlayerInventory) = _newPlayerInventory; - ["playerInventoryChanged", [ACE_player, _newPlayerInventory]] call FUNC(localEvent); - }; - - // "playerVisionModeChanged" event - _newPlayerVisionMode = currentVisionMode ACE_player; - if !(_newPlayerVisionMode isEqualTo GVAR(OldPlayerVisionMode)) then { - // Raise ACE event locally - GVAR(OldPlayerVisionMode) = _newPlayerVisionMode; - ["playerVisionModeChanged", [ACE_player, _newPlayerVisionMode]] call FUNC(localEvent); - }; - - // "inventoryDisplayChanged" event - _newInventoryDisplayIsOpen = !(isNull findDisplay 602); - if !(_newInventoryDisplayIsOpen isEqualTo GVAR(OldInventoryDisplayIsOpen)) then { - // Raise ACE event locally - GVAR(OldInventoryDisplayIsOpen) = _newInventoryDisplayIsOpen; - ["inventoryDisplayChanged", [ACE_player, _newInventoryDisplayIsOpen]] call FUNC(localEvent); - }; - - // "zeusDisplayChanged" event - _newZeusDisplayIsOpen = !(isNull findDisplay 312); - if !(_newZeusDisplayIsOpen isEqualTo GVAR(OldZeusDisplayIsOpen)) then { - // Raise ACE event locally - GVAR(OldZeusDisplayIsOpen) = _newZeusDisplayIsOpen; - ["zeusDisplayChanged", [ACE_player, _newZeusDisplayIsOpen]] call FUNC(localEvent); - }; - - // "cameraViewChanged" event - _newCameraView = cameraView; - if !(_newCameraView isEqualTo GVAR(OldCameraView)) then { - // Raise ACE event locally - GVAR(OldCameraView) = _newCameraView; - ["cameraViewChanged", [ACE_player, _newCameraView]] call FUNC(localEvent); - }; - - // "playerVehicleChanged" event - _newPlayerVehicle = vehicle ACE_player; - if !(_newPlayerVehicle isEqualTo GVAR(OldPlayerVehicle)) then { - // Raise ACE event locally - GVAR(OldPlayerVehicle) = _newPlayerVehicle; - ["playerVehicleChanged", [ACE_player, _newPlayerVehicle]] call FUNC(localEvent); - }; - - // "playerTurretChanged" event - _newPlayerTurret = [ACE_player] call FUNC(getTurretIndex); - if !(_newPlayerTurret isEqualTo GVAR(OldPlayerTurret)) then { - // Raise ACE event locally - GVAR(OldPlayerTurret) = _newPlayerTurret; - ["playerTurretChanged", [ACE_player, _newPlayerTurret]] call FUNC(localEvent); - }; - - // "playerWeaponChanged" event - _newPlayerWeapon = currentWeapon ACE_player; - if (_newPlayerWeapon != GVAR(OldPlayerWeapon)) then { - // Raise ACE event locally - GVAR(OldPlayerWeapon) = _newPlayerWeapon; - ["playerWeaponChanged", [ACE_player, _newPlayerWeapon]] call FUNC(localEvent); - }; - -}, 0, []] call CBA_fnc_addPerFrameHandler; - - -// PFH to raise camera created event. Only works on these cams by BI. -#define ALL_CAMERAS [ \ - missionNamespace getVariable ["BIS_DEBUG_CAM", objNull], \ - missionNamespace getVariable ["BIS_fnc_camera_cam", objNull], \ - uiNamespace getVariable ["BIS_fnc_arsenal_cam", objNull], \ - uiNamespace getVariable ["BIS_fnc_animViewer_cam", objNull], \ - missionNamespace getVariable ["BIS_fnc_establishingShot_fakeUAV", objNull] \ -] - -GVAR(OldIsCamera) = false; - -[{ - - // "activeCameraChanged" event - private ["_isCamera"]; - _isCamera = {!isNull _x} count ALL_CAMERAS > 0; - if !(_isCamera isEqualTo GVAR(OldIsCamera)) then { - // Raise ACE event locally - GVAR(OldIsCamera) = _isCamera; - ["activeCameraChanged", [ACE_player, _isCamera]] call FUNC(localEvent); - }; - -}, 1, []] call CBA_fnc_addPerFrameHandler; // feel free to decrease the sleep ACE_time if you need it. - - -[QGVAR(StateArrested),false,true,QUOTE(ADDON)] call FUNC(defineVariable); - -["displayTextStructured", FUNC(displayTextStructured)] call FUNC(addEventhandler); -["displayTextPicture", FUNC(displayTextPicture)] call FUNC(addEventhandler); -["medical_onUnconscious", {if (local (_this select 0) && {!(_this select 1)}) then {[ _this select 0, false, QUOTE(FUNC(loadPerson)), west /* dummy side */] call FUNC(switchToGroupSide);};}] call FUNC(addEventhandler); - -["notOnMap", {!visibleMap}] call FUNC(addCanInteractWithCondition); -["isNotInside", { - // Players can always interact with himself if not boarded - vehicle (_this select 0) == (_this select 0) || - // Players can always interact with his vehicle - {vehicle (_this select 0) == (_this select 1)} || - // Players can always interact with passengers of the same vehicle - {!((_this select 0) isEqualTo (_this select 1)) && {vehicle (_this select 0) == vehicle (_this select 1)}} -}] call FUNC(addCanInteractWithCondition); - -// Lastly, do JIP events -// JIP Detection and event trigger. Run this at the very end, just in case anything uses it -if(isMultiplayer && { ACE_time > 0 || isNull player } ) then { - // We are jipping! Get ready and wait, and throw the event +["mainDisplayLoaded", { [{ - if(!(isNull player)) then { - ["PlayerJip", [player] ] call FUNC(localEvent); - [(_this select 1)] call cba_fnc_removePerFrameHandler; + call FUNC(handleScrollWheelInit); + call FUNC(handleModifierKeyInit); + }, [], 0.1] call FUNC(waitAndExecute); // needs delay, otherwise doesn't work without pressing "RESTART" in editor once. Tested in 1.52RC +}] call FUNC(addEventHandler); + +// add PFH to execute event that fires when the main display (46) is created +private "_fnc_initMainDisplayCheck"; +_fnc_initMainDisplayCheck = { + [{ + if !(isNull findDisplay 46) then { + // Raise ACE event locally + ["mainDisplayLoaded", [findDisplay 46]] call FUNC(localEvent); + [_this select 1] call CBA_fnc_removePerFrameHandler; }; }, 0, []] call CBA_fnc_addPerFrameHandler; }; +call _fnc_initMainDisplayCheck; + +// repeat this every time a savegame is loaded +addMissionEventHandler ["Loaded", _fnc_initMainDisplayCheck]; + +// @todo remove? +enableCamShake true; + + +////////////////////////////////////////////////// +// Eventhandler to set player names +////////////////////////////////////////////////// + +// Set the name for the current player +["playerChanged", { + params ["_newPlayer","_oldPlayer"]; + + if (alive _newPlayer) then { + [_newPlayer] call FUNC(setName); + }; + + if (alive _oldPlayer) then { + [_oldPlayer] call FUNC(setName); + }; +}] call FUNC(addEventhandler); + + +////////////////////////////////////////////////// +// Set up numerous eventhanders for player controlled units +////////////////////////////////////////////////// + +// default variables +GVAR(OldPlayerVehicle) = vehicle objNull; +GVAR(OldPlayerTurret) = [objNull] call FUNC(getTurretIndex); +GVAR(OldPlayerWeapon) = currentWeapon objNull; +GVAR(OldPlayerInventory) = [objNull] call FUNC(getAllGear); +GVAR(OldPlayerVisionMode) = currentVisionMode objNull; +GVAR(OldCameraView) = ""; +GVAR(OldVisibleMap) = false; +GVAR(OldInventoryDisplayIsOpen) = nil; //@todo check this +GVAR(OldZeusDisplayIsOpen) = false; +GVAR(OldIsCamera) = false; + +// clean up playerChanged eventhandler from preinit and put it in the same PFH as the other events to reduce overhead and guarantee advantageous execution order +if (!isNil QGVAR(PreInit_playerChanged_PFHID)) then { + [GVAR(PreInit_playerChanged_PFHID)] call CBA_fnc_removePerFrameHandler; + GVAR(PreInit_playerChanged_PFHID) = nil; +}; + +// PFH to raise varios events +[{ + BEGIN_COUNTER(stateChecker); + private "_data"; // reuse one variable to reduce number of variables that have to be set to private each frame + + // "playerChanged" event + _data = call FUNC(player); + if !(_data isEqualTo ACE_player) then { + private "_oldPlayer"; + _oldPlayer = ACE_player; + + ACE_player = _data; + uiNamespace setVariable ["ACE_player", _data]; + + // Raise ACE event locally + ["playerChanged", [ACE_player, _oldPlayer]] call FUNC(localEvent); + }; + + // "playerVehicleChanged" event + _data = vehicle ACE_player; + if !(_data isEqualTo GVAR(OldPlayerVehicle)) then { + // Raise ACE event locally + GVAR(OldPlayerVehicle) = _data; + ["playerVehicleChanged", [ACE_player, _data]] call FUNC(localEvent); + }; + + // "playerTurretChanged" event + _data = [ACE_player] call FUNC(getTurretIndex); + if !(_data isEqualTo GVAR(OldPlayerTurret)) then { + // Raise ACE event locally + GVAR(OldPlayerTurret) = _data; + ["playerTurretChanged", [ACE_player, _data]] call FUNC(localEvent); + }; + + // "playerWeaponChanged" event + _data = currentWeapon ACE_player; + if (_data != GVAR(OldPlayerWeapon)) then { + // Raise ACE event locally + GVAR(OldPlayerWeapon) = _data; + ["playerWeaponChanged", [ACE_player, _data]] call FUNC(localEvent); + }; + + // "playerInventoryChanged" event + _data = [ACE_player] call FUNC(getAllGear); + if !(_data isEqualTo GVAR(OldPlayerInventory)) then { + // Raise ACE event locally + GVAR(OldPlayerInventory) = _data; + ["playerInventoryChanged", [ACE_player, _data]] call FUNC(localEvent); + }; + + // "playerVisionModeChanged" event + _data = currentVisionMode ACE_player; + if !(_data isEqualTo GVAR(OldPlayerVisionMode)) then { + // Raise ACE event locally + GVAR(OldPlayerVisionMode) = _data; + ["playerVisionModeChanged", [ACE_player, _data]] call FUNC(localEvent); + }; + + // "cameraViewChanged" event + _data = cameraView; + if !(_data isEqualTo GVAR(OldCameraView)) then { + // Raise ACE event locally + GVAR(OldCameraView) = _data; + ["cameraViewChanged", [ACE_player, _data]] call FUNC(localEvent); + }; + + // "visibleMapChanged" event + _data = visibleMap; + if (!_data isEqualTo GVAR(OldVisibleMap)) then { + // Raise ACE event locally + GVAR(OldVisibleMap) = _data; + ["visibleMapChanged", [ACE_player, _data]] call FUNC(localEvent); + }; + + // "inventoryDisplayChanged" event + _data = !(isNull findDisplay 602); + if !(_data isEqualTo GVAR(OldInventoryDisplayIsOpen)) then { + // Raise ACE event locally + GVAR(OldInventoryDisplayIsOpen) = _data; + ["inventoryDisplayChanged", [ACE_player, _data]] call FUNC(localEvent); + }; + + // "zeusDisplayChanged" event + _data = !(isNull findDisplay 312); + if !(_data isEqualTo GVAR(OldZeusDisplayIsOpen)) then { + // Raise ACE event locally + GVAR(OldZeusDisplayIsOpen) = _data; + ["zeusDisplayChanged", [ACE_player, _data]] call FUNC(localEvent); + }; + + // "activeCameraChanged" event + _data = call FUNC(isfeatureCameraActive); + if !(_data isEqualTo GVAR(OldIsCamera)) then { + // Raise ACE event locally + GVAR(OldIsCamera) = _data; + ["activeCameraChanged", [ACE_player, _data]] call FUNC(localEvent); + }; + + END_COUNTER(stateChecker); +}, 0, []] call CBA_fnc_addPerFrameHandler; + + +////////////////////////////////////////////////// +// Eventhandlers for player controlled machines +////////////////////////////////////////////////// + +// @todo still needed? +[QGVAR(StateArrested), false, true, QUOTE(ADDON)] call FUNC(defineVariable); + +["displayTextStructured", {_this call FUNC(displayTextStructured)}] call FUNC(addEventhandler); +["displayTextPicture", {_this call FUNC(displayTextPicture)}] call FUNC(addEventhandler); + +["medical_onUnconscious", { + params ["_unit", "_isUnconscious"]; + + if (local _unit && {!_isUnconscious}) then { + [_unit, false, QFUNC(loadPerson), west /* dummy side */] call FUNC(switchToGroupSide); + }; +}] call FUNC(addEventhandler); + + +////////////////////////////////////////////////// +// Add various canInteractWith conditions +////////////////////////////////////////////////// + +["notOnMap", {!visibleMap}] call FUNC(addCanInteractWithCondition); + +["isNotInside", { + params ["_unit", "_target"]; + + // Players can always interact with himself if not boarded + vehicle _unit == _unit || + // Players can always interact with his vehicle + {vehicle _unit == _target} || + // Players can always interact with passengers of the same vehicle + {_unit != _target && {vehicle _unit == vehicle _target}} +}] call FUNC(addCanInteractWithCondition); + + +////////////////////////////////////////////////// +// Set up PlayerJIP eventhandler +////////////////////////////////////////////////// + +// Lastly, do JIP events +// JIP Detection and event trigger. Run this at the very end, just in case anything uses it +// Note: usage of player is most likely on purpose +if (didJip) then { + // We are jipping! Get ready and wait, and throw the event + [{ + if(!isNull player && GVAR(settingsInitFinished)) then { + ["PlayerJip", [player]] call FUNC(localEvent); + [_this select 1] call CBA_fnc_removePerFrameHandler; + }; + }, 0, []] call CBA_fnc_addPerFrameHandler; +}; + + +////////////////////////////////////////////////// +// CBA key input handling +////////////////////////////////////////////////// + //Device Handler: GVAR(deviceKeyHandlingArray) = []; GVAR(deviceKeyCurrentIndex) = -1; // Register localizations for the Keybinding categories -["ACE3 Equipment", localize LSTRING(ACEKeybindCategoryEquipment)] call cba_fnc_registerKeybindModPrettyName; -["ACE3 Common", localize LSTRING(ACEKeybindCategoryCommon)] call cba_fnc_registerKeybindModPrettyName; -["ACE3 Weapons", localize LSTRING(ACEKeybindCategoryWeapons)] call cba_fnc_registerKeybindModPrettyName; -["ACE3 Movement", localize LSTRING(ACEKeybindCategoryMovement)] call cba_fnc_registerKeybindModPrettyName; -["ACE3 Scope Adjustment", localize LSTRING(ACEKeybindCategoryScopeAdjustment)] call cba_fnc_registerKeybindModPrettyName; -["ACE3 Vehicles", localize LSTRING(ACEKeybindCategoryVehicles)] call cba_fnc_registerKeybindModPrettyName; +["ACE3 Equipment", localize LSTRING(ACEKeybindCategoryEquipment)] call CBA_fnc_registerKeybindModPrettyName; +["ACE3 Common", localize LSTRING(ACEKeybindCategoryCommon)] call CBA_fnc_registerKeybindModPrettyName; +["ACE3 Weapons", localize LSTRING(ACEKeybindCategoryWeapons)] call CBA_fnc_registerKeybindModPrettyName; +["ACE3 Movement", localize LSTRING(ACEKeybindCategoryMovement)] call CBA_fnc_registerKeybindModPrettyName; +["ACE3 Scope Adjustment", localize LSTRING(ACEKeybindCategoryScopeAdjustment)] call CBA_fnc_registerKeybindModPrettyName; +["ACE3 Vehicles", localize LSTRING(ACEKeybindCategoryVehicles)] call CBA_fnc_registerKeybindModPrettyName; -["ACE3 Equipment", QGVAR(openDevice), (localize "STR_ACE_Common_toggleHandheldDevice"), -{ +["ACE3 Equipment", QGVAR(openDevice), (localize "STR_ACE_Common_toggleHandheldDevice"), { [] call FUNC(deviceKeyFindValidIndex); if (GVAR(deviceKeyCurrentIndex) == -1) exitWith {false}; [] call ((GVAR(deviceKeyHandlingArray) select GVAR(deviceKeyCurrentIndex)) select 3); true }, {false}, -[0xC7, [false, false, false]], false] call cba_fnc_addKeybind; //Home Key +[0xC7, [false, false, false]], false] call CBA_fnc_addKeybind; //Home Key -["ACE3 Equipment", QGVAR(closeDevice), (localize "STR_ACE_Common_closeHandheldDevice"), -{ +["ACE3 Equipment", QGVAR(closeDevice), (localize "STR_ACE_Common_closeHandheldDevice"), { [] call FUNC(deviceKeyFindValidIndex); if (GVAR(deviceKeyCurrentIndex) == -1) exitWith {false}; [] call ((GVAR(deviceKeyHandlingArray) select GVAR(deviceKeyCurrentIndex)) select 4); true }, {false}, -[0xC7, [false, true, false]], false] call cba_fnc_addKeybind; //CTRL + Home Key +[0xC7, [false, true, false]], false] call CBA_fnc_addKeybind; //CTRL + Home Key -["ACE3 Equipment", QGVAR(cycleDevice), (localize "STR_ACE_Common_cycleHandheldDevices"), -{ +["ACE3 Equipment", QGVAR(cycleDevice), (localize "STR_ACE_Common_cycleHandheldDevices"), { [1] call FUNC(deviceKeyFindValidIndex); if (GVAR(deviceKeyCurrentIndex) == -1) exitWith {false}; _displayName = ((GVAR(deviceKeyHandlingArray) select GVAR(deviceKeyCurrentIndex)) select 0); @@ -379,7 +503,6 @@ GVAR(deviceKeyCurrentIndex) = -1; true }, {false}, -[0xC7, [true, false, false]], false] call cba_fnc_addKeybind; //SHIFT + Home Key - +[0xC7, [true, false, false]], false] call CBA_fnc_addKeybind; //SHIFT + Home Key GVAR(commonPostInited) = true; diff --git a/addons/common/XEH_preInit.sqf b/addons/common/XEH_preInit.sqf index 8285a15519..ff06c1c3e3 100644 --- a/addons/common/XEH_preInit.sqf +++ b/addons/common/XEH_preInit.sqf @@ -1,16 +1,14 @@ // by commy2 #include "script_component.hpp" -//IGNORE_PRIVATE_WARNING("_handleNetEvent", "_handleRequestAllSyncedEvents", "_handleRequestSyncedEvent", "_handleSyncedEvent"); - ADDON = false; -// ACE Common Function - PREP(addCanInteractWithCondition); PREP(addLineToDebugDraw); PREP(addSetting); PREP(addToInventory); +PREP(assignedItemFix); +PREP(assignObjectsInList); PREP(ambientBrightness); PREP(applyForceWalkStatus); PREP(ASLToPosition); @@ -18,17 +16,14 @@ PREP(binarizeNumber); PREP(blurScreen); PREP(cachedCall); PREP(canGetInPosition); -PREP(canInteract); PREP(canInteractWith); PREP(canUseWeapon); PREP(changeProjectileDirection); PREP(checkFiles); PREP(checkPBOs); PREP(claim); -PREP(closeDialogIfTargetMoves); PREP(codeToLetter); PREP(codeToString); -PREP(convertKeyCode); PREP(createOrthonormalReference); PREP(currentChannel); PREP(debug); @@ -84,14 +79,6 @@ PREP(getTargetAzimuthAndInclination); PREP(getTargetDistance); PREP(getTargetObject); PREP(getTurnedOnLights); -PREP(getTurretCommander); -PREP(getTurretConfigPath); -PREP(getTurretCopilot); -PREP(getTurretGunner); -PREP(getTurretIndex); -PREP(getTurrets); -PREP(getTurretsFFV); -PREP(getTurretsOther); PREP(getTurretDirection); PREP(getUavControlPosition); PREP(getVehicleCargo); @@ -104,6 +91,11 @@ PREP(getWindDirection); PREP(getZoom); PREP(goKneeling); PREP(hadamardProduct); +PREP(handleModifierKey); +PREP(handleModifierKeyUp); +PREP(handleModifierKeyInit); +PREP(handleScrollWheel); +PREP(handleScrollWheelInit); PREP(hasItem); PREP(hasMagazine); PREP(headBugFix); @@ -114,7 +106,6 @@ PREP(interpolateFromArray); PREP(inTransitionAnim); PREP(inWater); PREP(isAlive); -PREP(isArrested); PREP(isAutoWind); PREP(isAwake); PREP(isEngineer); @@ -134,7 +125,6 @@ PREP(loadSettingsLocalizedText); PREP(map); PREP(moduleCheckPBOs); PREP(moduleLSDVehicles); -PREP(moveToTempGroup); PREP(muteUnit); PREP(muteUnitHandleInitPost); PREP(muteUnitHandleRespawn); @@ -147,7 +137,6 @@ PREP(player); PREP(playerSide); PREP(positionToASL); PREP(progressBar); -PREP(queueAnimation); PREP(readSettingFromModule); PREP(receiveRequest); PREP(removeCanInteractWithCondition); @@ -155,12 +144,12 @@ PREP(removeSpecificMagazine); PREP(requestCallback); PREP(resetAllDefaults); PREP(restoreVariablesJIP); -PREP(revertKeyCodeLocalized); +PREP(runAfterSettingsInit); PREP(sanitizeString); +PREP(selectWeaponMode); PREP(sendRequest); PREP(serverLog); -PREP(setArrestState); -PREP(setCanInteract); +PREP(setAllGear); PREP(setCaptivityStatus); PREP(setDefinedVariable); PREP(setDisableUserInputStatus); @@ -186,6 +175,7 @@ PREP(toBitmask); PREP(toHex); PREP(toNumber); PREP(unhideUnit); +PREP(uniqueElements); PREP(uniqueElementsOnly); PREP(unloadPerson); PREP(unloadPersonLocal); @@ -193,6 +183,7 @@ PREP(unmuteUnit); PREP(useItem); PREP(useMagazine); PREP(waitAndExecute); +PREP(waitUntilAndExecute); PREP(waveHeightAt); PREP(translateToWeaponSpace); @@ -214,10 +205,12 @@ PREP(getConfigGunner); PREP(getConfigCommander); PREP(getHitPoints); PREP(getHitPointsWithSelections); +PREP(getSelectionsWithoutHitPoints); PREP(getReflectorsWithSelections); PREP(getLightProperties); PREP(getLightPropertiesWeapon); PREP(getVehicleCrew); +PREP(getVehicleUAVCrew); // turrets PREP(getTurrets); @@ -230,14 +223,14 @@ PREP(getDoorTurrets); PREP(getTurretsFFV); PREP(getTurretsOther); +// missing inventory commands +PREP(binocularMagazine); +PREP(removeBinocularMagazine); + // ACE_Debug PREP(exportConfig); PREP(getChildren); PREP(getDisplayConfigName); -PREP(log); -PREP(logControls); -PREP(logDisplays); -PREP(logModEntries); PREP(monitor); PREP(showUser); @@ -260,6 +253,17 @@ PREP(localEvent); PREP(removeEventHandler); PREP(removeAlLEventHandlers); +// Synchronized Events +PREP(syncedEventPFH); +PREP(addSyncedEventHandler); +PREP(removeSyncedEventHandler); +PREP(requestSyncedEvent); +PREP(syncedEvent); + +PREP(_handleSyncedEvent); +PREP(_handleRequestSyncedEvent); +PREP(_handleRequestAllSyncedEvents); + // other eventhandlers PREP(addActionEventHandler); PREP(addActionMenuEventHandler); @@ -283,26 +287,19 @@ PREP(hashListSelect); PREP(hashListSet); PREP(hashListPush); -// Synchronized Events -PREP(syncedEventPFH); -PREP(addSyncedEventHandler); -PREP(removeSyncedEventHandler); -PREP(requestSyncedEvent); -PREP(syncedEvent); - -PREP(_handleSyncedEvent); -PREP(_handleRequestSyncedEvent); -PREP(_handleRequestAllSyncedEvents); - GVAR(syncedEvents) = HASH_CREATE; -//GVARS for execNextFrame and waitAndExec +//GVARS for execNextFrame and waitAndExec and waitUntilAndExecute GVAR(waitAndExecArray) = []; GVAR(nextFrameNo) = diag_frameno; GVAR(nextFrameBufferA) = []; GVAR(nextFrameBufferB) = []; +GVAR(waitUntilAndExecArray) = []; -// @TODO: Generic local-managed global-synced objects (createVehicleLocal) +GVAR(settingsInitFinished) = false; +GVAR(runAtSettingsInitialized) = []; + +// @todo: Generic local-managed global-synced objects (createVehicleLocal) //Debug ACE_COUNTERS = []; @@ -312,11 +309,18 @@ if (isServer) then { call FUNC(loadSettingsOnServer); }; -ACE_player = player; +////////////////////////////////////////////////// +// Set up PlayerChanged eventhandler for pre init +////////////////////////////////////////////////// + +ACE_player = objNull; +uiNamespace setVariable ["ACE_player", objNull]; + +// @todo check if this can be removed if (hasInterface) then { // PFH to update the ACE_player variable - [{ + GVAR(PreInit_playerChanged_PFHID) = [{ if !(ACE_player isEqualTo (call FUNC(player))) then { private ["_oldPlayer"]; _oldPlayer = ACE_player; @@ -330,7 +334,11 @@ if (hasInterface) then { }, 0, []] call CBA_fnc_addPerFrameHandler; }; + +////////////////////////////////////////////////// // Time handling +////////////////////////////////////////////////// + ACE_time = diag_tickTime; ACE_realTime = diag_tickTime; ACE_virtualTime = diag_tickTime; @@ -345,6 +353,8 @@ PREP(timePFH); // Init toHex [0] call FUNC(toHex); -ADDON = true; +isHC = !hasInterface && !isDedicated; // deprecated because no tag +missionNamespace setVariable ["ACE_isHC", ACE_isHC]; +uiNamespace setVariable ["ACE_isHC", ACE_isHC]; -isHC = !(hasInterface || isDedicated); +ADDON = true; diff --git a/addons/common/functions/fnc_ASLToPosition.sqf b/addons/common/functions/fnc_ASLToPosition.sqf index 4ff880c019..a5afb1db75 100644 --- a/addons/common/functions/fnc_ASLToPosition.sqf +++ b/addons/common/functions/fnc_ASLToPosition.sqf @@ -3,9 +3,9 @@ * Converts ASL to Arma "Position" * * Arguments: - * 0: position x - * 1: position y - * 2: position z + * 0: position x + * 1: position y + * 2: position z * * Return Value: * None diff --git a/addons/common/functions/fnc__handleNetEvent.sqf b/addons/common/functions/fnc__handleNetEvent.sqf index 7ee1f9c502..e409afe6a3 100644 --- a/addons/common/functions/fnc__handleNetEvent.sqf +++ b/addons/common/functions/fnc__handleNetEvent.sqf @@ -1,32 +1,41 @@ -//fnc__handleNetEvent.sqf -// internal handler for net events +/* + * Author: jaynus + * Internal net event handler. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Public: No + */ #include "script_component.hpp" -private ["_eventName", "_eventArgs", "_eventNames", "_eventIndex", "_eventTargets", "_sentEvents", "_owner", "_serverFlagged", "_events"]; -//IGNORE_PRIVATE_WARNING("_handleNetEvent"); - - -PARAMS_2(_eventType,_event); +params ["_eventType", "_event"]; if (_eventType == "ACEg") then { - _eventName = _event select 0; - _eventArgs = _event select 1; - + _event params ["_eventName", "_eventArgs"]; + + private ["_eventNames", "_eventIndex"]; + _eventNames = GVAR(events) select 0; _eventIndex = _eventNames find _eventName; + if (_eventIndex != -1) then { + private "_events"; _events = (GVAR(events) select 1) select _eventIndex; - + #ifdef DEBUG_EVENTS - diag_log text format[ARR_2("* Net Event %1",_eventName)]; - diag_log text format[ARR_2(" args=%1",_eventArgs)]; + ACE_LOGINFO_1("* Net Event %1",_eventName); + ACE_LOGINFO_1(" args=%1",_eventArgs); #endif - + { if (!isNil "_x") then { - _eventArgs call CALLSTACK_NAMED(_x, format[ARR_3("Net Event %1 ID: %2",_eventName,_forEachIndex)]); + _eventArgs call CALLSTACK_NAMED(_x, FORMAT_2("Net Event %1 ID: %2",_eventName,_forEachIndex)); #ifdef DEBUG_EVENTS_CALLSTACK - diag_log text format[ARR_2(" ID: %1",_forEachIndex)]; + ACE_LOGINFO_1(" ID: %1",_forEachIndex); #endif }; } forEach _events; @@ -35,30 +44,31 @@ if (_eventType == "ACEg") then { if (_eventType == "ACEc") then { if (isServer) then { - _eventName = _event select 0; - _eventTargets = _event select 1; - _eventArgs = _event select 2; - + _event params ["_eventName", "_eventTargets", "_eventArgs"]; + + private ["_sentEvents", "_owner", "_serverFlagged"]; + _sentEvents = []; if (!IS_ARRAY(_eventTargets)) then { _eventTargets = [_eventTargets]; }; //If not multiplayer, and there are targets, then just run localy - if ((!isMultiplayer) && {(count _eventTargets) > 0}) exitWith { - ACEg = [_eventName, _eventArgs]; - ["ACEg", ACEg] call FUNC(_handleNetEvent); + if (!isMultiplayer && {count _eventTargets > 0}) exitWith { + ACEg = [_eventName, _eventArgs]; + ["ACEg", ACEg] call FUNC(_handleNetEvent); }; _serverFlagged = false; { _owner = _x; if (IS_OBJECT(_x)) then { - _owner = owner _x; + _owner = owner _x; }; - if (!(_owner in _sentEvents)) then { - PUSH(_sentEvents, _owner); + if !(_owner in _sentEvents) then { + _sentEvents pushBack _owner; ACEg = [_eventName, _eventArgs]; + if (isDedicated || {_x != ACE_player}) then { if (isDedicated && {local _x} && {!_serverFlagged}) then { _serverFlagged = true; @@ -70,6 +80,7 @@ if (_eventType == "ACEc") then { ["ACEg", ACEg] call FUNC(_handleNetEvent); }; }; - } forEach _eventTargets; + false + } count _eventTargets; }; -}; \ No newline at end of file +}; diff --git a/addons/common/functions/fnc__handleRequestAllSyncedEvents.sqf b/addons/common/functions/fnc__handleRequestAllSyncedEvents.sqf index 7c566ce4d1..4e755562b5 100644 --- a/addons/common/functions/fnc__handleRequestAllSyncedEvents.sqf +++ b/addons/common/functions/fnc__handleRequestAllSyncedEvents.sqf @@ -1,25 +1,27 @@ /* * Author: jaynus - * * Handles a server-side request for synchronization ALL events on JIP to a client. * - * Argument: - * 0: client (object) - * - * Return value: - * Boolean of success + * Arguments: + * 0: client + * + * Return Value: + * Event is successed + * + * Public: No */ -//#define DEBUG_MODE_FULL #include "script_component.hpp" -PARAMS_1(_client); + +params ["_client"]; { - private["_eventName", "_eventEntry", "_eventLog"]; - _eventName = _x; - _eventEntry = HASH_GET(GVAR(syncedEvents),_eventName); + private ["_eventEntry", "_eventLog"]; + + _eventEntry = HASH_GET(GVAR(syncedEvents),_x); _eventLog = _eventEntry select 1; - ["SEH_s", _client, [_eventName, _eventLog] ] call FUNC(targetEvent); -} forEach (GVAR(syncedEvents) select 0); + ["SEH_s", _client, [_x, _eventLog]] call FUNC(targetEvent); + false +} count (GVAR(syncedEvents) select 0); -true \ No newline at end of file +true diff --git a/addons/common/functions/fnc__handleRequestSyncedEvent.sqf b/addons/common/functions/fnc__handleRequestSyncedEvent.sqf index fe05bc498b..d4d9b2cf76 100644 --- a/addons/common/functions/fnc__handleRequestSyncedEvent.sqf +++ b/addons/common/functions/fnc__handleRequestSyncedEvent.sqf @@ -1,48 +1,50 @@ /* * Author: jaynus - * * Receives either requests for synchronization from clients, or the synchronization data from the server. * * Arguments [Client] : - * 0: eventName (String) - * 1: eventLog (Array) - * + * 0: eventName + * 1: eventLog + * * Arguments [Server] : - * 0: eventName (String) - * 1: client (Object) - * - * Return value: - * Boolean of success + * 0: eventName + * 1: client + * + * Return Value: + * Event is successed + * + * Public: No */ -//#define DEBUG_MODE_FULL #include "script_component.hpp" -//IGNORE_PRIVATE_WARNING("_handleSyncedEvent"); - //SEH_s -if(isServer) then { +if (isServer) then { // Find the event name, and shovel out the events to the client - PARAMS_2(_eventName,_client); - private["_eventEntry", "_eventLog"]; - - if(!HASH_HASKEY(GVAR(syncedEvents),_eventName)) exitWith { - diag_log text format["[ACE] Error, request for synced event - key not found."]; + params ["_eventName", "_client"]; + + if (!HASH_HASKEY(GVAR(syncedEvents),_eventName)) exitWith { + ACE_LOGERROR("Request for synced event - key not found."); false }; + + private ["_eventEntry", "_eventLog"]; + _eventEntry = HASH_GET(GVAR(syncedEvents),_eventName); _eventLog = _eventEntry select 1; - - ["SEH_s", _client, [_eventName, _eventLog] ] call FUNC(targetEvent); + + ["SEH_s", _client, [_eventName, _eventLog]] call FUNC(targetEvent); } else { - PARAMS_2(_eventName,_eventLog); - private ["_eventArgs"]; + params ["_eventName", "_eventLog"]; + // This is the client handling the response from the server // Start running the events { - _eventArgs = _x select 1; - [_eventName, _eventArgs, (_x select 2)] call FUNC(_handleSyncedEvent); - } forEach _eventLog; - diag_log text format["[ACE] + [%1] synchronized", _eventName]; + _x params ["", "_eventArgs","_ttl"]; + [_eventName, _eventArgs, _ttl] call FUNC(_handleSyncedEvent); + false + } count _eventLog; + + ACE_LOGINFO_1("[%1] synchronized",_eventName); }; -true \ No newline at end of file +true diff --git a/addons/common/functions/fnc__handleSyncedEvent.sqf b/addons/common/functions/fnc__handleSyncedEvent.sqf index 053ecb60b7..3ea516513f 100644 --- a/addons/common/functions/fnc__handleSyncedEvent.sqf +++ b/addons/common/functions/fnc__handleSyncedEvent.sqf @@ -1,36 +1,40 @@ /* * Author: jaynus - * * Handles synced events being received. Server will log them, and server/client will execute them. * * Arguments [Client] : - * 0: eventName (String) - * 1: arguments (Array) - * 2: ttl (Scalar) - * - * Return value: - * Boolean of success + * 0: eventName + * 1: arguments + * 2: ttl + * + * Return Value: + * Boolean of success + * + * Public: No */ -//#define DEBUG_MODE_FULL #include "script_component.hpp" -PARAMS_3(_name,_args,_ttl); -private["_internalData", "_eventLog", "_eventCode"]; -if(!HASH_HASKEY(GVAR(syncedEvents),_name)) exitWith { - diag_log text format["[ACE] Error, synced event key not found."]; +params ["_name", "_args", "_ttl"]; + +if (!HASH_HASKEY(GVAR(syncedEvents),_name)) exitWith { + ACE_LOGERROR("Synced event key not found."); false }; +private ["_internalData", "_eventCode"]; + _internalData = HASH_GET(GVAR(syncedEvents),_name); -if(isServer) then { +if (isServer) then { // Server needs to internally log it for synchronization - if(_ttl > -1) then { + if (_ttl > -1) then { _internalData = HASH_GET(GVAR(syncedEvents),_name); + + private "_eventLog"; _eventLog = _internalData select 1; _eventLog pushback [ACE_diagTime, _args, _ttl]; }; }; _eventCode = _internalData select 0; -_args call _eventCode; \ No newline at end of file +_args call _eventCode; diff --git a/addons/common/functions/fnc_addActionEventHandler.sqf b/addons/common/functions/fnc_addActionEventHandler.sqf index 29b058487b..4d7d96bd44 100644 --- a/addons/common/functions/fnc_addActionEventHandler.sqf +++ b/addons/common/functions/fnc_addActionEventHandler.sqf @@ -1,73 +1,66 @@ /* * Author: commy2 - * * Add an addAction event to a unit. Used to handle multiple addAction events. Global arguments, local effects. Does only work for player controlled units. * - * Argument: - * 0: Unit the action should be assigned to (Object) - * 1: Name of the action, e.g. "DefaultAction" (String) - * 2: Condition (Code or String) - * 3: Code to execute (Code or String) + * Arguments: + * 0: Unit the action should be assigned to + * 1: Name of the action, e.g. "DefaultAction" + * 2: Condition + * 3: Code to execute * - * Return value: - * ID of the action (used to remove it later). + * Return Value: + * ID of the action (used to remove it later) + * + * Public: No */ #include "script_component.hpp" -private ["_unit", "_action", "_condition", "_statement", "_name", "_actionsVar", "_actionID", "_actions", "_id", "_actionIDs"]; -//IGNORE_PRIVATE_WARNING("_count", "_index", "_return", "_target"); - -_unit = _this select 0; -_action = _this select 1; -_condition = _this select 2; -_statement = _this select 3; +params ["_unit", "_action", "_condition", "_statement"]; if (typeName _condition == "STRING") then { - _condition = compile _condition; + _condition = compile _condition; }; if (typeName _statement == "STRING") then { - _statement = compile _statement; + _statement = compile _statement; }; -_name = format ["ACE_Action_%1", _action]; +private ["_name", "_actionsVar"]; +_name = format ["ACE_Action_%1", _action]; _actionsVar = _unit getVariable [_name, [-1, [-1, [], []], objNull]]; if (_unit != _actionsVar select 2) then { // check if the unit is still valid, fixes respawn issues - _actionsVar = [-1, [-1, [], []], objNull]; + _actionsVar = [-1, [-1, [], []], objNull]; }; -_actionID = _actionsVar select 0; -_actions = _actionsVar select 1; +_actionsVar params ["_actionID", "_actionsArray"]; +_actionsArray params ["_id", "_actionIDs", "_actions"]; -_id = (_actions select 0) + 1; -_actionIDs = _actions select 1; -_actions = _actions select 2; +_id = _id + 1; _actionIDs pushBack _id; _actions pushBack [_condition, _statement]; // first action to add, unit needs addAction command if (_actionID == -1) then { - private "_addAction"; + private "_addAction"; + _addAction = call compile format [ + "[ + '', + {if (inputAction '%1' == 0) exitWith {}; {if (_this call (_x select 0)) then {_this call (_x select 1)}} forEach (((_this select 0) getVariable '%2') select 1 select 2)}, + nil, + -1, + false, + true, + '%1', + ""if (_this != ACE_player || {vehicle _this != _target}) exitWith {false}; _actions = (_this getVariable '%2') select 1 select 2; _count = count _actions; _index = 0; _return = false; while {_index < _count && {!_return}} do {_return = [_target, _this] call ((_actions select _index) select 0); _index = _index + 1}; _return"" + ]", + _action, + _name + ]; - _addAction = call compile format [ - "[ - '', - {if (inputAction '%1' == 0) exitWith {}; {if (_this call (_x select 0)) then {_this call (_x select 1)}} forEach (((_this select 0) getVariable '%2') select 1 select 2)}, - nil, - -1, - false, - true, - '%1', - ""if (_this != ACE_player || {vehicle _this != _target}) exitWith {false}; _actions = (_this getVariable '%2') select 1 select 2; _count = count _actions; _index = 0; _return = false; while {_index < _count && {!_return}} do {_return = [_target, _this] call ((_actions select _index) select 0); _index = _index + 1}; _return"" - ]", - _action, - _name - ]; - - _actionID = _unit addAction _addAction; + _actionID = _unit addAction _addAction; }; _unit setVariable [_name, [_actionID, [_id, _actionIDs, _actions], _unit], false]; diff --git a/addons/common/functions/fnc_addActionMenuEventHandler.sqf b/addons/common/functions/fnc_addActionMenuEventHandler.sqf index 268cc18d5a..279842ae5c 100644 --- a/addons/common/functions/fnc_addActionMenuEventHandler.sqf +++ b/addons/common/functions/fnc_addActionMenuEventHandler.sqf @@ -1,29 +1,25 @@ /* * Author: commy2 - * * Add an addAction event to a unit. Used to handle multiple addAction events and add a action to the mouse wheel menu. Global arguments, local effects. Does only work for player controlled units. * - * Argument: - * 0: Unit the action should be assigned to (Object) - * 1: Menu title of the action (String) - * 2: Name of the action, e.g. "DefaultAction" (String) - * 3: Condition (Code or String) - * 4: Code to execute by the action (Code or String) - * 5: Condition for the menu action (Code or String) - * 6: Code to execute from the menu (Code or String) - * 7: Priority of the action (Number, optional default: 0) + * Arguments: + * 0: Unit the action should be assigned to + * 1: Menu title of the action + * 2: Name of the action, e.g. "DefaultAction" + * 3: Condition + * 4: Code to execute by the action + * 5: Condition for the menu action + * 6: Code to execute from the menu + * 7: Priority of the action (default: 0) * - * Return value: - * ID of the action (used to remove it later). + * Return Value: + * ID of the action (used to remove it later) + * + * Public: No */ #include "script_component.hpp" -private ["_name", "_actionsVar", "_id", "_actionIDs", "_actions", "_nameVar", "_addAction", "_actionID"]; -//IGNORE_PRIVATE_WARNING("_target"); - -PARAMS_8(_unit,_displayName,_action,_condition,_statement,_condition2,_statement2,_priority); - -if (isNil "_priority") then {_priority = 0}; +params ["_unit", "_displayName", "_action", "_condition", "_statement", "_condition2", "_statement2", ["_priority", 0]]; if (typeName _condition == "STRING") then { _condition = compile _condition; @@ -41,13 +37,16 @@ if (typeName _statement2 == "STRING") then { _statement2 = compile _statement2; }; -_name = format ["ACE_ActionMenu_%1", _action]; +private ["_name", "_actionsVar"]; +_name = format ["ACE_ActionMenu_%1", _action]; _actionsVar = _unit getVariable [_name, [-1, [], []]]; -_id = (_actionsVar select 0) + 1; -_actionIDs = _actionsVar select 1; -_actions = _actionsVar select 2; +_actionsVar params ["_id", "_actionIDs", "_actions"]; + +_id = _id + 1; + +private ["_nameVar", "_addAction", "_actionID"]; _nameVar = format ["%1_ID%2", _name, _id]; missionNamespace setVariable [_nameVar, [_condition, _statement, _condition2, _statement2]]; @@ -56,14 +55,14 @@ _actionIDs pushBack _id; _addAction = call compile format [ "[ - '%2', - {if (inputAction '%1' == 0) then {if (_this call (%3 select 2)) then {_this call (%3 select 3)}} else {_this call (%3 select 1)}}, - nil, - %4, - false, - true, - '%1', - ""if (_this != ACE_player || {vehicle _this != _target}) exitWith {false}; [_target, _this] call (%3 select 0)"" + '%2', + {if (inputAction '%1' == 0) then {if (_this call (%3 select 2)) then {_this call (%3 select 3)}} else {_this call (%3 select 1)}}, + nil, + %4, + false, + true, + '%1', + ""if (_this != ACE_player || {vehicle _this != _target}) exitWith {false}; [_target, _this] call (%3 select 0)"" ]", _action, _displayName, diff --git a/addons/common/functions/fnc_addCanInteractWithCondition.sqf b/addons/common/functions/fnc_addCanInteractWithCondition.sqf index 10ea084858..740fa9bb9f 100644 --- a/addons/common/functions/fnc_addCanInteractWithCondition.sqf +++ b/addons/common/functions/fnc_addCanInteractWithCondition.sqf @@ -1,33 +1,27 @@ /* * Author: commy2 - * * Add a condition that gets checked by ace_common_fnc_canInteractWith. * * Arguments: - * 0: The conditions id. Used to remove later or as exception name. An already existing name overwrites. (String) - * 1: The condition to check. format of "_this" is "[_player, _target]". (Code) + * 0: The conditions id. Used to remove later or as exception name. An already existing name overwrites. + * 1: The condition to check. format of "_this" is "[_player, _target]". * * Return Value: - * Unit can interact? + * None * + * Public: No */ #include "script_component.hpp" -private ["_conditionName", "_conditionFunc"]; -//IGNORE_PRIVATE_WARNING("_player", "_target"); +params ["_conditionName", "_conditionFunc"]; +_conditionName = toLower _conditionName; -_conditionName = toLower (_this select 0); -_conditionFunc = _this select 1; - -private ["_conditions", "_conditionNames", "_conditionFuncs"]; +private ["_conditions", "_index"]; _conditions = missionNamespace getVariable [QGVAR(InteractionConditions), [[],[]]]; +_conditions params ["_conditionNames", "_conditionFuncs"]; -_conditionNames = _conditions select 0; -_conditionFuncs = _conditions select 1; - -private "_index"; _index = _conditionNames find _conditionName; if (_index == -1) then { @@ -37,4 +31,4 @@ if (_index == -1) then { _conditionNames set [_index, _conditionName]; _conditionFuncs set [_index, _conditionFunc]; -GVAR(InteractionConditions) = [_conditionNames, _conditionFuncs]; +GVAR(InteractionConditions) = _conditions; diff --git a/addons/common/functions/fnc_addCuratorUnloadEventhandler.sqf b/addons/common/functions/fnc_addCuratorUnloadEventhandler.sqf index 4623bb4ddb..95cce02e41 100644 --- a/addons/common/functions/fnc_addCuratorUnloadEventhandler.sqf +++ b/addons/common/functions/fnc_addCuratorUnloadEventhandler.sqf @@ -1,9 +1,19 @@ -// by commy2 +/* + * Author: commy2 + * + * Arguments: + * Display where the Unload event was added + * + * Return Value: + * None + * + * Public: No + */ #include "script_component.hpp" -private "_dlg"; - disableSerialization; + +private "_dlg"; _dlg = ctrlParent _this; _dlg displayAddEventHandler ["unload", { diff --git a/addons/common/functions/fnc_addEventHandler.sqf b/addons/common/functions/fnc_addEventHandler.sqf index 86e034a0d9..599e937918 100644 --- a/addons/common/functions/fnc_addEventHandler.sqf +++ b/addons/common/functions/fnc_addEventHandler.sqf @@ -1,33 +1,34 @@ /* * Author: Nou + * Add an event handler. * - * Add a event handler. + * Arguments: + * 0: Event name + * 1: Event code * - * Argument: - * 0: Event name (string) - * 1: Event code (code) + * Return Value: + * Event handler ID number (for use with fnc_removeEventHandler) * - * Return value: - * Event handler ID number (for use with fnc_removeEventHandler) + * Public: Yes */ #include "script_component.hpp" -private ["_eventNames", "_eventFunctions", "_eventNameCount", "_eventIndex", "_eventFunctionCount"]; +params ["_eventName", "_eventCode"]; -PARAMS_2(_eventName,_eventCode); +private ["_eventNames", "_eventFunctions", "_eventIndex"]; _eventNames = GVAR(events) select 0; _eventFunctions = []; _eventIndex = _eventNames find _eventName; + if (_eventIndex != -1) then { _eventFunctions = (GVAR(events) select 1) select _eventIndex; } else { + private "_eventNameCount"; _eventNameCount = count _eventNames; - _eventNames set[_eventNameCount, _eventName]; - (GVAR(events) select 1) set[_eventNameCount, _eventFunctions]; + + _eventNames set [_eventNameCount, _eventName]; + (GVAR(events) select 1) set [_eventNameCount, _eventFunctions]; }; -_eventFunctionCount = count _eventFunctions; -_eventFunctions set [_eventFunctionCount, _eventCode]; - -_eventFunctionCount; \ No newline at end of file +_eventFunctions pushBack _eventCode // Return event function count diff --git a/addons/common/functions/fnc_addLineToDebugDraw.sqf b/addons/common/functions/fnc_addLineToDebugDraw.sqf index 4b8b235811..f0a643e922 100644 --- a/addons/common/functions/fnc_addLineToDebugDraw.sqf +++ b/addons/common/functions/fnc_addLineToDebugDraw.sqf @@ -1,15 +1,15 @@ /* * Author: esteldunedain - * * Add line to draw on debug * - * Argument: - * 0: Start point ASL (Array) - * 1: End point ASL (Array) - * 2: Color (Array) + * Arguments: + * 0: Start point ASL + * 1: End point ASL + * 2: Color * - * Return value: + * None * + * Public: No */ #include "script_component.hpp" @@ -45,4 +45,4 @@ if (isNil QGVAR(debugDrawHandler)) then { drawLine3D [_p0, _p1, _x select 2]; } forEach GVAR(debugLines); }]; -}; \ No newline at end of file +}; diff --git a/addons/common/functions/fnc_addMapMarkerCreatedEventHandler.sqf b/addons/common/functions/fnc_addMapMarkerCreatedEventHandler.sqf index c3975be496..1e060f056a 100644 --- a/addons/common/functions/fnc_addMapMarkerCreatedEventHandler.sqf +++ b/addons/common/functions/fnc_addMapMarkerCreatedEventHandler.sqf @@ -1,29 +1,29 @@ /* * Author: commy2 - * * Add a map marker creation event handler. * - * Argument: - * 0: Code to execute (Code or String) + * Arguments: + * 0: Code to execute * - * Return value: - * ID of the event script (used to remove it later). + * Return Value: + * ID of the event script (used to remove it later). + * + * Public: Yes */ #include "script_component.hpp" -private ["_actionsVar", "_id", "_actionIDs", "_actions"]; - -PARAMS_1(_statement); +params ["_statement"]; if (typeName _statement == "STRING") then { _statement = compile _statement; }; +private "_actionsVar"; _actionsVar = missionNamespace getVariable ["ACE_EventHandler_MapMarker", [-1, [], []]]; -_id = (_actionsVar select 0) + 1; -_actionIDs = _actionsVar select 1; -_actions = _actionsVar select 2; +_actionsVar params ["_id", "_actionIDs", "_actions"]; + +_id = _id + 1; if (_id == 0) then { uiNamespace setVariable ["ACE_EventHandler_MapMarker", count allMapMarkers]; diff --git a/addons/common/functions/fnc_addScrollWheelEventHandler.sqf b/addons/common/functions/fnc_addScrollWheelEventHandler.sqf index d079b4b17e..ef60270695 100644 --- a/addons/common/functions/fnc_addScrollWheelEventHandler.sqf +++ b/addons/common/functions/fnc_addScrollWheelEventHandler.sqf @@ -1,29 +1,30 @@ /* * Author: commy2 + * Add an event handler that executes every ACE_time the scroll wheel is used. This is needed, because adding a MouseZ display event handler to display 46 will break in save games. + * _this will be [Interval] where 'Interval' is a number. * - * Add an event handler that executes every ACE_time the scroll wheel is used. This is needed, because adding a MouseZ display event handler to display 46 will break in save games. Argument will be [Interval] where 'Interval' is a number. + * Arguments: + * 0: Code to execute * - * Argument: - * 0: Code to execute (Code or String) + * Return Value: + * ID of the event script (used to remove it later). * - * Return value: - * ID of the event script (used to remove it later). + * Public: Yes */ #include "script_component.hpp" -private ["_actionsVar", "_id", "_actionIDs", "_actions"]; - -PARAMS_1(_statement); +params ["_statement"]; if (typeName _statement == "STRING") then { - _statement = compile _statement; + _statement = compile _statement; }; +private "_actionsVar"; _actionsVar = missionNamespace getVariable ["ACE_EventHandler_ScrollWheel", [-1, [], []]]; -_id = (_actionsVar select 0) + 1; -_actionIDs = _actionsVar select 1; -_actions = _actionsVar select 2; +_actionsVar params ["_id", "_actionIDs", "_actions"]; + +_id = _id + 1; _actionIDs pushBack _id; _actions pushBack _statement; diff --git a/addons/common/functions/fnc_addSetting.sqf b/addons/common/functions/fnc_addSetting.sqf index 42299e6458..06162de6b1 100644 --- a/addons/common/functions/fnc_addSetting.sqf +++ b/addons/common/functions/fnc_addSetting.sqf @@ -11,7 +11,7 @@ * 4: localizedDescription * 5: possibleValues * 6: isForced - * 7: defaultValue (Any) + * 7: defaultValue * * Return Value: * None @@ -20,10 +20,9 @@ */ #include "script_component.hpp" -PARAMS_8(_name,_typeName,_isClientSetable,_localizedName,_localizedDescription,_possibleValues,_isForced,_value); - -private ["_settingData"]; +params ["_name", "", "", "", "", "", "", "_value"]; //["_name", "_typeName", "_isClientSetable", "_localizedName", "_localizedDescription", "_possibleValues", "_isForced", "_value"]; +private "_settingData"; _settingData = [_name] call FUNC(getSettingData); // Exit if the setting already exists diff --git a/addons/common/functions/fnc_addSyncedEventHandler.sqf b/addons/common/functions/fnc_addSyncedEventHandler.sqf index 60c90672ef..801a915dc5 100644 --- a/addons/common/functions/fnc_addSyncedEventHandler.sqf +++ b/addons/common/functions/fnc_addSyncedEventHandler.sqf @@ -1,34 +1,29 @@ /* * Author: jaynus - * * Register an event handler for an ACE synced event * - * Argument: - * 0: Name (String) - * 1: Handler (Code) - * 2: TTL (Number or Code) [Optional] - * - * Return value: - * Boolean of success + * Arguments: + * 0: Name + * 1: Handler + * 2: TTL (optional: 0) + * + * Return Value: + * Boolean of success + * + * Public: Yes */ -//#define DEBUG_MODE_FULL #include "script_component.hpp" -//IGNORE_PRIVATE_WARNING("_handleSyncedEvent"); -PARAMS_2(_name,_handler); +params ["_name", "_handler", ["_ttl", 0]]; -private["_ttl", "_eventId", "_data"]; -if( (count _this) > 2) then { - _ttl = _this select 2; -} else { - _ttl = 0; -}; - -if(HASH_HASKEY(GVAR(syncedEvents),_name)) exitWith { - diag_log text format["[ACE] Error, duplicate synced event creation."]; +if (HASH_HASKEY(GVAR(syncedEvents),_name)) exitWith { + ACE_LOGERROR("Duplicate synced event creation."); false }; +private ["_eventId", "_data"]; + _eventId = [_name, FUNC(_handleSyncedEvent)] call FUNC(addEventHandler); -_data = [_handler,[],_ttl,_eventId]; -HASH_SET(GVAR(syncedEvents),_name,_data); \ No newline at end of file +_data = [_handler, [], _ttl, _eventId]; + +HASH_SET(GVAR(syncedEvents),_name,_data); diff --git a/addons/common/functions/fnc_addToInventory.sqf b/addons/common/functions/fnc_addToInventory.sqf index ba76831ba4..4019de93ac 100644 --- a/addons/common/functions/fnc_addToInventory.sqf +++ b/addons/common/functions/fnc_addToInventory.sqf @@ -1,93 +1,141 @@ /* * Author: Garth 'L-H' de Wet - * Adds an item,weapon,magazine to the unit's inventory - * or places it in a weaponHolder if no space. + * Adds an item, weapon, or magazine to the unit's inventory or places it in a weaponHolder if no space. * * Arguments: * 0: Unit * 1: Classname - * 2: Container (uniform, vest, backpack) - * 3: Magazine Ammo Count + * 2: Container (uniform, vest, backpack) (default: "") + * 3: Magazine Ammo Count (default: -1) * * Return Value: - * Array: - * 0: Added to player (Bool) - * 1: weaponholder (OBJECT) + * 0: Added to player + * 1: weaponholder * * Public: Yes */ -//#define DEBUG_MODE_FULL #include "script_component.hpp" -PARAMS_2(_unit,_classname); -DEFAULT_PARAM(2,_container,""); -DEFAULT_PARAM(3,_ammoCount,-1); +params ["_unit", "_classname", ["_container", ""], ["_ammoCount", -1]]; -private ["_addedToPlayer", "_canAdd", "_type", "_pos"]; +private ["_type", "_canAdd", "_addedToUnit"]; -_canAdd = false; -_addedToPlayer = true; - -_type = [_classname] call EFUNC(common,getItemType); +_type = [_classname] call FUNC(getItemType); switch (_container) do { - case "vest": { _canAdd = _unit canAddItemToVest _classname; }; - case "backpack": { _canAdd = _unit canAddItemToBackpack _classname; }; - case "uniform": { _canAdd = _unit canAddItemToUniform _classname; }; - default {_canAdd = _unit canAdd _classname;}; + case "vest": { + _canAdd = _unit canAddItemToVest _classname; + }; + case "backpack": { + _canAdd = _unit canAddItemToBackpack _classname; + }; + case "uniform": { + _canAdd = _unit canAddItemToUniform _classname; + }; + default { + _canAdd = _unit canAdd _classname; + }; }; -switch ((_type select 0)) do { +switch (_type select 0) do { case "weapon": { if (_canAdd) then { + _addedToUnit = true; + switch (_container) do { - case "vest": { (vestContainer _unit) addWeaponCargoGlobal [_classname, 1]; }; - case "backpack": { (backpackContainer _unit) addWeaponCargoGlobal [_classname, 1]; }; - case "uniform": { (uniformContainer _unit) addWeaponCargoGlobal [_classname, 1]; }; - default { _unit addWeaponGlobal _classname; }; + case "vest": { + (vestContainer _unit) addWeaponCargoGlobal [_classname, 1]; + }; + case "backpack": { + (backpackContainer _unit) addWeaponCargoGlobal [_classname, 1]; + }; + case "uniform": { + (uniformContainer _unit) addWeaponCargoGlobal [_classname, 1]; + }; + default { + _unit addWeaponGlobal _classname; + }; }; } else { - _addedToPlayer = false; + _addedToUnit = false; + + private "_pos"; _pos = _unit modelToWorldVisual [0,1,0.05]; - _unit = createVehicle ["WeaponHolder_Single_F",_pos,[],0,"NONE"]; - _unit addWeaponCargoGlobal [_classname,1]; + + _unit = createVehicle ["WeaponHolder_Single_F", _pos, [], 0, "NONE"]; + _unit addWeaponCargoGlobal [_classname, 1]; _unit setPosATL _pos; }; }; + case "magazine": { - if (_ammoCount == -1) then {_ammoCount = getNumber (configFile >> "CfgMagazines" >> _classname >> "count");}; + if (_ammoCount == -1) then { + _ammoCount = getNumber (configFile >> "CfgMagazines" >> _classname >> "count"); + }; + if (_canAdd) then { + _addedToUnit = true; + switch (_container) do { - case "vest": { (vestContainer _unit) addMagazineCargoGlobal [_classname, _ammoCount]; }; - case "backpack": { (backpackContainer _unit) addMagazineCargoGlobal [_classname, _ammoCount]; }; - case "uniform": { (uniformContainer _unit) addMagazineCargoGlobal [_classname, _ammoCount]; }; - default {_unit addMagazine [_classname, _ammoCount]; }; + case "vest": { + (vestContainer _unit) addMagazineCargoGlobal [_classname, 1/*_ammoCount*/]; //@todo Bug! This isn't really the ammo, but magazine count. No such command. + }; + case "backpack": { + (backpackContainer _unit) addMagazineCargoGlobal [_classname, 1/*_ammoCount*/]; //@todo Bug! This isn't really the ammo, but magazine count. No such command. + }; + case "uniform": { + (uniformContainer _unit) addMagazineCargoGlobal [_classname, 1/*_ammoCount*/]; //@todo Bug! This isn't really the ammo, but magazine count. No such command. + }; + default { + _unit addMagazine [_classname, _ammoCount]; + }; }; } else { - _addedToPlayer = false; + _addedToUnit = false; + + private "_pos"; _pos = _unit modelToWorldVisual [0,1,0.05]; - _unit = createVehicle ["WeaponHolder_Single_F",_pos,[],0,"NONE"]; - _unit addMagazineCargoGlobal [_classname, _ammoCount]; + + _unit = createVehicle ["WeaponHolder_Single_F", _pos, [], 0, "NONE"]; + _unit addMagazineCargoGlobal [_classname, 1/*_ammoCount*/]; //@todo Bug! This isn't really the ammo, but magazine count. No such command. _unit setPosATL _pos; }; }; + case "item": { if (_canAdd) then { + _addedToUnit = true; + switch (_container) do { - case "vest": { _unit addItemToVest _classname; }; - case "backpack": { _unit addItemToBackpack _classname; }; - case "uniform": { _unit addItemToUniform _classname; }; - default { _unit addItem _classname; }; + case "vest": { + _unit addItemToVest _classname; + }; + case "backpack": { + _unit addItemToBackpack _classname; + }; + case "uniform": { + _unit addItemToUniform _classname; + }; + default { + _unit addItem _classname; + }; }; } else { - _addedToPlayer = false; + _addedToUnit = false; + + private "_pos"; _pos = _unit modelToWorldVisual [0,1,0.05]; - _unit = createVehicle ["WeaponHolder_Single_F",_pos,[],0,"NONE"]; - _unit addItemCargoGlobal [_classname,1]; + + _unit = createVehicle ["WeaponHolder_Single_F", _pos, [], 0, "NONE"]; + _unit addItemCargoGlobal [_classname, 1]; _unit setPosATL _pos; }; }; - default {diag_log format ["ACE: Incorrect item type passed to %1, passed: %2",QFUNC(AddToInventory),_type];}; + + default { + _addedToUnit = false; + ACE_LOGWARNING_2("Incorrect item type passed to %1, passed: %2",QFUNC(AddToInventory),_type); + }; }; -[_addedToPlayer,_unit] +[_addedToUnit, _unit] diff --git a/addons/common/functions/fnc_ambientBrightness.sqf b/addons/common/functions/fnc_ambientBrightness.sqf index 172739247f..4ec2840e47 100644 --- a/addons/common/functions/fnc_ambientBrightness.sqf +++ b/addons/common/functions/fnc_ambientBrightness.sqf @@ -1,14 +1,15 @@ /* * Author: commy2, idea by Falke - * * Returns a brightness value depending on the sun and moon state. Ranges from 0 to 1 (dark ... bright). * - * Argument: - * None. + * Arguments: + * None * - * Return value: - * Ambient brightness (Number) + * Return Value: + * Ambient brightness + * + * Public: Yes */ #include "script_component.hpp" -(sunOrMoon * sunOrMoon * (1 - overcast * 0.25) + (moonIntensity/5) * (1 - overcast)) min 1 +(sunOrMoon * sunOrMoon * (1 - overcast * 0.25) + (moonIntensity / 5) * (1 - overcast)) min 1 diff --git a/addons/common/functions/fnc_applyForceWalkStatus.sqf b/addons/common/functions/fnc_applyForceWalkStatus.sqf index 2e1c36db4a..d3b58a25a4 100644 --- a/addons/common/functions/fnc_applyForceWalkStatus.sqf +++ b/addons/common/functions/fnc_applyForceWalkStatus.sqf @@ -1,25 +1,23 @@ /* -Name: FUNC(applyForceWalkStatus) - -Author: Pabst Mirror - -Description: - Applys the forceWalk status of an unit. Called from Extended_InitPost_EventHandlers. - -Parameters: - 0: OBJECT - Unit - -Returns: - None - -Example: - [ACE_Player] call FUNC(applyForceWalkStatus) -*/ + * Author: Pabst Mirror + * Applys the forceWalk status of an unit. Called from Extended_InitPost_EventHandlers. + * + * Arguments: + * 0: Unit + * + * Return Value: + * None + * + * Example: + * [ACE_Player] call ace_common_fnc_applyForceWalkStatus + * + * Public: No + */ #include "script_component.hpp" -private ["_forceWalkNumber"]; +params ["_unit"]; -PARAMS_1(_unit); +private "_forceWalkNumber"; _forceWalkNumber = _unit getVariable ["ACE_forceWalkStatusNumber", 0]; _unit forceWalk (_forceWalkNumber > 0); diff --git a/addons/common/functions/fnc_assignObjectsInList.sqf b/addons/common/functions/fnc_assignObjectsInList.sqf new file mode 100644 index 0000000000..6bbb31d2dc --- /dev/null +++ b/addons/common/functions/fnc_assignObjectsInList.sqf @@ -0,0 +1,53 @@ +/* + * Author: Glowbal + * Loops through a string and filters out object names/variables to assign a value for given variable. + * Used by moduleAssign* within various parts of the ACE3 project. + * + * Arguments: + * 0: list + * 1: variableName + * 2: value + * 3: Global + * + * Return Value: + * None + * + * Public: No + */ +#include "script_component.hpp" + +params ["_list", "_variable", "_setting", "_global"]; + +if (typeName _list == "STRING") then { + private ["_splittedList", "_nilCheckPassedList"]; + + _splittedList = [_list, ","] call BIS_fnc_splitString; + _nilCheckPassedList = ""; + + { + _x = [_x] call FUNC(stringRemoveWhiteSpace); + if !(isNil _x) then { + if (_nilCheckPassedList == "") then { + _nilCheckPassedList = _x; + } else { + _nilCheckPassedList = _nilCheckPassedList + ","+ _x; + }; + }; + false + } count _splittedList; + + _list = [] call compile format["[%1]",_nilCheckPassedList]; +}; + +{ + if (!isNil "_x") then { + if (typeName _x == typeName objNull) then { + if (local _x) then { + _x setvariable [_variable, _setting, _global]; + }; + }; + }; + false +} count _list; + +true diff --git a/addons/common/functions/fnc_assignedItemFix.sqf b/addons/common/functions/fnc_assignedItemFix.sqf new file mode 100644 index 0000000000..9f804eaa4d --- /dev/null +++ b/addons/common/functions/fnc_assignedItemFix.sqf @@ -0,0 +1,75 @@ +/* + * Author: commy2 + * Initialized the assigned item fix. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Public : No + */ +#include "script_component.hpp" + +private "_config"; + +ACE_isMapEnabled = call {_config = missionConfigFile >> "showMap"; !isNumber _config || {getNumber _config == 1}}; // default value is 1, so do isNumber check first +ACE_isCompassEnabled = call {_config = missionConfigFile >> "showCompass"; !isNumber _config || {getNumber _config == 1}}; +ACE_isWatchEnabled = call {_config = missionConfigFile >> "showWatch"; !isNumber _config || {getNumber _config == 1}}; +ACE_isRadioEnabled = call {_config = missionConfigFile >> "showRadio"; !isNumber _config || {getNumber _config == 1}}; +ACE_isGPSEnabled = call {_config = missionConfigFile >> "showGPS"; !isNumber _config || {getNumber _config == 1}}; + +GVAR(AssignedItems) = []; +GVAR(AssignedItemsInfo) = []; +GVAR(AssignedItemsShownItems) = [ + ACE_isMapEnabled, + ACE_isCompassEnabled, + ACE_isWatchEnabled, + ACE_isRadioEnabled, + ACE_isGPSEnabled +]; + +["playerInventoryChanged", { + params ["_unit", "_assignedItems"]; + + _assignedItems = _assignedItems select 17; + + GVAR(AssignedItemsShownItems) = [true, true, true, true, true]; + + { + if !(_x in GVAR(AssignedItems)) then { + GVAR(AssignedItems) pushBack _x; + GVAR(AssignedItemsInfo) pushBack toLower getText (configFile >> "CfgWeapons" >> _x >> "ACE_hideItemType"); + }; + + switch (GVAR(AssignedItemsInfo) select (GVAR(AssignedItems) find _x)) do { + case ("map"): { + GVAR(AssignedItemsShownItems) set [0, false]; + }; + case ("compass"): { + GVAR(AssignedItemsShownItems) set [1, false]; + }; + case ("watch"): { + GVAR(AssignedItemsShownItems) set [2, false]; + }; + case ("radio"): { + GVAR(AssignedItemsShownItems) set [3, false]; + }; + case ("gps"): { + GVAR(AssignedItemsShownItems) set [4, false]; + }; + }; + false + } count _assignedItems; + + //systemChat str GVAR(AssignedItemsShownItems); + + GVAR(AssignedItemsShownItems) params ["_showMap", "_showCompass", "_showWatch", "_showRadio", "_showGPS"]; + + showMap _showMap; + showCompass _showCompass; + showWatch _showWatch; + showRadio _showRadio; + showGPS (_showGPS || {cameraOn == getConnectedUAV _unit}); //If player is activly controling a UAV, showGPS controls showing the map (m key) +}] call FUNC(addEventHandler); diff --git a/addons/common/functions/fnc_binarizeNumber.sqf b/addons/common/functions/fnc_binarizeNumber.sqf index 0bf968b7ee..aff2f9dc17 100644 --- a/addons/common/functions/fnc_binarizeNumber.sqf +++ b/addons/common/functions/fnc_binarizeNumber.sqf @@ -1,23 +1,23 @@ /* * Author: commy2 - * * Get a binary equivalent of a decimal number. * - * Argument: - * 0: Decimal Number (Number) - * 1: Minimum length of the returned Array, note: returned array can be larger (Number, optional default 8) + * Arguments: + * 0: Decimal Number + * 1: Minimum length of the returned Array, note: returned array can be larger (default: 8) * - * Return value: - * Booleans (Array) + * Return Value: + * Booleans + * + * Public: Yes */ #include "script_component.hpp" -private ["_number", "_minLength", "_array", "_index", "_rest"]; +params ["_number", ["_minLength", 8]]; -_number = round (_this select 0); -_minLength = _this select 1; +_number = round _number; -if (isNil "_minLength") then {_minLength = 8}; +private ["_array", "_index", "_rest"]; _array = []; _array resize _minLength; @@ -35,4 +35,5 @@ while {_number > 0} do { _array set [_index, _rest == 1]; _index = _index + 1; }; + _array diff --git a/addons/common/functions/fnc_binocularMagazine.sqf b/addons/common/functions/fnc_binocularMagazine.sqf new file mode 100644 index 0000000000..f097b90841 --- /dev/null +++ b/addons/common/functions/fnc_binocularMagazine.sqf @@ -0,0 +1,40 @@ +/* + * Author: commy2 + * Returns the magazine of the units rangefinder. + * + * Arguments: + * 0: Unit + * + * Return Value: + * Magazine of the units binocular + * + * Example: + * [player] call ace_common_fnc_binocularMagazine + * + * Public: Yes + * + * Note: Doesn't work on dead units + */ +#include "script_component.hpp" + +params ["_unit"]; + +private ["_binocular", "_muzzle", "_mode", "_magazine"]; + +_binocular = binocular _unit; + +if (_binocular == "") exitWith {""}; + +_muzzle = currentMuzzle _unit; +_mode = currentWeaponMode _unit; + +_unit selectWeapon _binocular; + +// didn't select the binocular (unit probably dead or not local). function won't work. quit with empty string +if (currentWeapon _unit != _binocular) exitWith {""}; + +_magazine = currentMagazine _unit; + +[_unit, _muzzle, _mode] call FUNC(selectWeaponMode); + +_magazine diff --git a/addons/common/functions/fnc_blurScreen.sqf b/addons/common/functions/fnc_blurScreen.sqf index 57714b63cd..a3394a1fbf 100644 --- a/addons/common/functions/fnc_blurScreen.sqf +++ b/addons/common/functions/fnc_blurScreen.sqf @@ -1,28 +1,32 @@ -/** - * fn_gui_blurScreen.sqf - * @Descr: - * @Author: Glowbal +/* + * Author: Glowbal * - * @Arguments: [] - * @Return: - * @PublicAPI: true + * Arguments: + * 0: ID + * 1: Show? + * + * Return Value: + * None + * + * Public: Yes */ - #include "script_component.hpp" -private ["_show"]; -PARAMS_1(_id); -_show = if (count _this > 1) then {_this select 1} else {false}; +if (!hasInterface) exitWith {}; + +params ["_id", ["_show", false]]; + +if (typeName _show == "SCALAR") then { + _show = _show == 1; +}; if (isNil QGVAR(SHOW_BLUR_SCREEN_COLLECTION)) then { GVAR(SHOW_BLUR_SCREEN_COLLECTION) = []; }; -if (typeName _show == typeName 0) then { - _show = (_show == 1); -}; if (_show) then { - GVAR(SHOW_BLUR_SCREEN_COLLECTION) pushback _id; + GVAR(SHOW_BLUR_SCREEN_COLLECTION) pushBack _id; + // show blur if (isnil QGVAR(MENU_ppHandle_GUI_BLUR_SCREEN)) then { GVAR(MENU_ppHandle_GUI_BLUR_SCREEN) = ppEffectCreate ["DynamicBlur", 102]; @@ -32,9 +36,10 @@ if (_show) then { }; } else { GVAR(SHOW_BLUR_SCREEN_COLLECTION) = GVAR(SHOW_BLUR_SCREEN_COLLECTION) - [_id]; + if (GVAR(SHOW_BLUR_SCREEN_COLLECTION) isEqualTo []) then { // hide blur - if (!isnil QGVAR(MENU_ppHandle_GUI_BLUR_SCREEN)) then { + if (!isNil QGVAR(MENU_ppHandle_GUI_BLUR_SCREEN)) then { ppEffectDestroy GVAR(MENU_ppHandle_GUI_BLUR_SCREEN); GVAR(MENU_ppHandle_GUI_BLUR_SCREEN) = nil; }; diff --git a/addons/common/functions/fnc_cachedCall.sqf b/addons/common/functions/fnc_cachedCall.sqf index f9d9c74dd3..e1e0e16118 100644 --- a/addons/common/functions/fnc_cachedCall.sqf +++ b/addons/common/functions/fnc_cachedCall.sqf @@ -1,5 +1,5 @@ /* - * Author: esteldunedain and Jaynus + * Author: esteldunedain, Jaynus * Returns the result of the function and caches it up to a given ACE_time or event * * Arguments: @@ -8,7 +8,7 @@ * 2: Namespace to store the cache on * 3: Cache uid * 4: Max duration of the cache - * 5: Event that clears the cache (Optional) + * 5: Event that clears the cache (default: nil) * * Return Value: * Result of the function @@ -17,33 +17,31 @@ */ #include "script_component.hpp" -PARAMS_5(_params,_function,_namespace,_uid,_duration); +params ["_params", "_function", "_namespace", "_uid", "_duration", "_event"]; -//IGNORE_PRIVATE_WARNING("_eventName"); - -if (((_namespace getVariable [_uid, [-99999]]) select 0) < ACE_diagTime) then { +if ((_namespace getVariable [_uid, [-99999]]) select 0 < ACE_diagTime) then { _namespace setVariable [_uid, [ACE_diagTime + _duration, _params call _function]]; // Does the cache needs to be cleared on an event? - if (count _this > 5) then { - private ["_event","_varName","_cacheList"]; - _event = _this select 5; - _varName = format [QGVAR(clearCache_%1),_event]; + if (!isNil "_event") then { + private ["_varName", "_cacheList"]; + + _varName = format [QGVAR(clearCache_%1), _event]; _cacheList = missionNamespace getVariable _varName; // If there was no EH to clear these caches, add one - if (isNil {_cacheList}) then { + if (isNil "_cacheList") then { _cacheList = []; missionNamespace setVariable [_varName, _cacheList]; [_event, { - private ["_varName","_cacheList"]; + private ["_varName", "_cacheList"]; // _eventName is defined on the function that calls the event #ifdef DEBUG_MODE_FULL - diag_log text format ["ACE: Clear cached variables on event: %1", _eventName]; + ACE_LOGINFO_1("Clear cached variables on event: %1",_eventName); #endif // Get the list of caches to clear - _varName = format [QGVAR(clearCache_%1),_eventName]; + _varName = format [QGVAR(clearCache_%1), _eventName]; _cacheList = missionNamespace getVariable [_varName, []]; // Erase all the cached results { @@ -57,11 +55,13 @@ if (((_namespace getVariable [_uid, [-99999]]) select 0) < ACE_diagTime) then { // Add this cache to the list of the event _cacheList pushBack [_namespace, _uid]; }; + #ifdef DEBUG_MODE_FULL - diag_log format ["Calculated result: %1 %2", _namespace, _uid]; + ACE_LOGINFO_2("Calculated result: %1 %2",_namespace,_uid); } else { - diag_log format ["Cached result : %1 %2", _namespace, _uid]; + ACE_LOGINFO_2("Cached result: %1 %2",_namespace,_uid); #endif + }; (_namespace getVariable _uid) select 1 diff --git a/addons/common/functions/fnc_canGetInPosition.sqf b/addons/common/functions/fnc_canGetInPosition.sqf index 2c84f11b4d..45a2642655 100644 --- a/addons/common/functions/fnc_canGetInPosition.sqf +++ b/addons/common/functions/fnc_canGetInPosition.sqf @@ -1,35 +1,28 @@ /* * Author: commy2 - * * Is the unit able to enter the vehicle in the given position? * * Arguments: - * 0: Unit to enter the vehicle (Object) - * 1: The vehicle to be entered (Object) - * 2: Position. Can be "Driver", "Pilot", "Gunner", "Commander", "Copilot", "Turret", "FFV", "Codriver" or "Cargo" (String) - * 3: Check current distance to vehicles memory point? (Bool, optional default: false) + * 0: Unit to enter the vehicle + * 1: The vehicle to be entered + * 2: Position. Can be "Driver", "Pilot", "Gunner", "Commander", "Copilot", "Turret", "FFV", "Codriver" or "Cargo" + * 3: Check current distance to vehicles memory point? (default: false) * 4: Index. "Turret", "FFV", "Codriver" and "Cargo" support this optional parameter. Which position should be taken. - * Note: This index is diffrent from Armas "cargoIndex". (Number, optional default: next free index) + * Note: This index is diffrent from Armas "cargoIndex". (default: next free index) * * Return Value: - * Nothing + * None + * + * Public: No */ #include "script_component.hpp" #define CANGETINDRIVER (isNull (driver _vehicle) || {!alive driver _vehicle}) && {!lockedDriver _vehicle} && {getNumber (_config >> "isUav") != 1} #define CANGETINTURRETINDEX (isNull (_vehicle turretUnit _turret) || {!alive (_vehicle turretUnit _turret)}) && {!(_vehicle lockedTurret _turret)} && {getNumber (_config >> "isUav") != 1} -private ["_position", "_checkDistance", "_index"]; +params ["_unit", "_vehicle", "_position", ["_checkDistance", false], ["_index", -1]]; -_this resize 5; - -PARAMS_2(_unit,_vehicle); -_position = toLower (_this select 2); -_checkDistance = _this select 3; -_index = _this select 4; // optional, please don't use - -if (isNil "_checkDistance") then {_checkDistance = false}; -if (isNil "_index") then {_index = -1}; +_position = toLower _position; // general if (!alive _vehicle || {locked _vehicle > 1}) exitWith {false}; diff --git a/addons/common/functions/fnc_canInteract.sqf b/addons/common/functions/fnc_canInteract.sqf deleted file mode 100644 index 4b3e22f646..0000000000 --- a/addons/common/functions/fnc_canInteract.sqf +++ /dev/null @@ -1,14 +0,0 @@ -/** - * fn_canInteract.sqf - * @Descr: Check if unit can interact with enviroment. Unit has to be awake and not be in arrested state. - * @Author: Glowbal - * - * @Arguments: [unit OBJECT] - * @Return: BOOL True if unit can interact with enviroment. - * @PublicAPI: true - */ -#include "script_component.hpp" - -PARAMS_1(_unit); - -(((_unit getvariable [QGVAR(canInteract),0]) < 1) && ([_unit] call FUNC(isAwake)) && !([_unit] call FUNC(isArrested))) \ No newline at end of file diff --git a/addons/common/functions/fnc_canInteractWith.sqf b/addons/common/functions/fnc_canInteractWith.sqf index 1a6e766855..31ebf6b89f 100644 --- a/addons/common/functions/fnc_canInteractWith.sqf +++ b/addons/common/functions/fnc_canInteractWith.sqf @@ -5,45 +5,33 @@ * Arguments: * 0: The player. * 1: The interaction target. objNull to ignore. - * 2: Exceptions. What general conditions are to skip? (Optional) + * 2: Exceptions. What general conditions are to skip? (default: []) * * Return Value: * Unit can interact? * - * Public: No + * Public: Yes */ #include "script_component.hpp" -private ["_exceptions"]; - -PARAMS_2(_unit,_target); - -_exceptions = if (count _this > 2) then { - _this select 2; -} else { - []; -}; +params ["_unit", "_target", ["_exceptions", []]]; _exceptions = [_exceptions, {toLower _this}] call FUNC(map); -// exit if the target is not free to interact private "_owner"; _owner = _target getVariable [QGVAR(owner), objNull]; +// exit if the target is not free to interact if (!isNull _owner && {_unit != _owner}) exitWith {false}; // check general conditions - -private ["_conditions", "_conditionNames", "_conditionFuncs"]; +private ["_conditions", "_canInteract"]; _conditions = missionNamespace getVariable [QGVAR(InteractionConditions), [[],[]]]; -_conditionNames = _conditions select 0; -_conditionFuncs = _conditions select 1; +_conditions params ["_conditionNames", "_conditionFuncs"]; -private "_canInteract"; _canInteract = true; - { if (!(_x in _exceptions) && {!([_unit, _target] call (_conditionFuncs select _forEachIndex))}) exitWith { _canInteract = false; diff --git a/addons/common/functions/fnc_canUseWeapon.sqf b/addons/common/functions/fnc_canUseWeapon.sqf index ed478a4470..31aaba17a2 100644 --- a/addons/common/functions/fnc_canUseWeapon.sqf +++ b/addons/common/functions/fnc_canUseWeapon.sqf @@ -1,14 +1,23 @@ -// by commy2 +/* + * Author: commy2 + * Check if the unit can use a Weapon. + * Returns true if the unit is on foot or in a FFV position. + * + * Arguments: + * 0: The Unit + * + * Return Value: + * Can the Unit use Weapons + * + * Public: Yes + */ #include "script_component.hpp" -// returns true if the unit is on foot or in a ffv position - -private ["_config"]; - -PARAMS_1(_unit); +params ["_unit"]; if (_unit == vehicle _unit) exitWith {true}; +private "_config"; _config = configFile >> "CfgMovesMaleSdr" >> "States" >> animationState _unit; isClass _config diff --git a/addons/common/functions/fnc_changeProjectileDirection.sqf b/addons/common/functions/fnc_changeProjectileDirection.sqf index 5a65ccff41..79b8c8aeea 100644 --- a/addons/common/functions/fnc_changeProjectileDirection.sqf +++ b/addons/common/functions/fnc_changeProjectileDirection.sqf @@ -1,30 +1,23 @@ /* * Author: commy2 - * * Adjust a projectiles velocity and dir + up vector. * - * Argument: - * 0: Projectile (Object, CfgAmmo) - * 1: Adjust azimuth this much. (Number) - * 2: Adjust inclination this much. (Number) - * 3: Adjust projectile speed this much. In m/s. (Number, optional default: 0 m/s) + * Arguments: + * 0: Projectile + * 1: Adjust azimuth this much. + * 2: Adjust inclination this much. + * 3: Adjust projectile speed this much. In m/s. (optional: 0) * - * Return value: - * None. + * Return Value: + * None + * + * Public: No */ #include "script_component.hpp" -private ["_adjustSpeed", "_vdir", "_dir", "_up", "_vup", "_vel", "_vlat"]; +params ["_projectile", "_adjustDir", "_adjustUp", ["_adjustSpeed",0]]; -PARAMS_3(_projectile,_adjustDir,_adjustUp); - -_adjustSpeed = if (count _this > 3) then { - _this select 3 -} else { - 0 -}; - -["CPD", [_fnc_scriptNameParent, _adjustDir, _adjustUp, _adjustSpeed], nil, false] call FUNC(log); +private ["_vdir", "_dir", "_up", "_vlat", "_vup", "_vel"]; // get old direction vector _vdir = vectorNormalized velocity _projectile; diff --git a/addons/common/functions/fnc_checkFiles.sqf b/addons/common/functions/fnc_checkFiles.sqf index 647a1b00a6..2c8976f042 100644 --- a/addons/common/functions/fnc_checkFiles.sqf +++ b/addons/common/functions/fnc_checkFiles.sqf @@ -1,13 +1,14 @@ /* * Author: commy2 - * * Compares version numbers of PBOs and DLLs. * - * Argument: - * None. + * Arguments: + * None * - * Return value: - * None. + * Return Value: + * None + * + * Public: No */ #include "script_component.hpp" @@ -17,10 +18,12 @@ private "_version"; _version = getText (configFile >> "CfgPatches" >> "ace_main" >> "versionStr"); -diag_log text format ["[ACE]: ACE is version %1.", _version]; +ACE_LOGINFO_1("ACE is version %1.",_version); private "_addons"; -_addons = activatedAddons; +//_addons = activatedAddons; // broken with High-Command module, see #2134 +_addons = "true" configClasses (configFile >> "CfgPatches");// +_addons = [_addons, {toLower configName _this}] call FUNC(map);// _addons = [_addons, {_this find "ace_" == 0}] call FUNC(filter); { @@ -28,37 +31,45 @@ _addons = [_addons, {_this find "ace_" == 0}] call FUNC(filter); private "_errorMsg"; _errorMsg = format ["File %1.pbo is outdated.", _x]; - diag_log text format ["[ACE] ERROR: %1", _errorMsg]; + ACE_LOGERROR(_errorMsg); if (hasInterface) then { ["[ACE] ERROR", _errorMsg, {findDisplay 46 closeDisplay 0}] call FUNC(errorMessage); }; }; -} forEach _addons; + false +} count _addons; /////////////// // check dlls /////////////// { - if (_x callExtension "version" == "") then { + private "_versionEx"; + _versionEx = _x callExtension "version"; + + if (_versionEx == "") then { private "_errorMsg"; _errorMsg = format ["Extension %1.dll not installed.", _x]; - diag_log text format ["[ACE] ERROR: %1", _errorMsg]; + ACE_LOGERROR(_errorMsg); if (hasInterface) then { ["[ACE] ERROR", _errorMsg, {findDisplay 46 closeDisplay 0}] call FUNC(errorMessage); }; } else { // Print the current extension version - diag_log text format ["[ACE] Extension version: %1: %2", _x, (_x callExtension "version")]; + ACE_LOGINFO_2("Extension version: %1: %2",_x,_versionEx); }; -} forEach getArray (configFile >> "ACE_Extensions" >> "extensions"); + false +} count getArray (configFile >> "ACE_Extensions" >> "extensions"); /////////////// // check server version/addons /////////////// if (isMultiplayer) then { + // don't check optional addons + _addons = [_addons, {getNumber (configFile >> "CfgPatches" >> _this >> "ACE_isOptional") != 1}] call FUNC(filter); + if (isServer) then { // send servers version of ACE to all clients GVAR(ServerVersion) = _version; @@ -70,17 +81,15 @@ if (isMultiplayer) then { [{ if (isNil QGVAR(ServerVersion) || isNil QGVAR(ServerAddons)) exitWith {}; - private ["_version","_addons"]; - _version = (_this select 0) select 0; - _addons = (_this select 0) select 1; + (_this select 0) params ["_version", "_addons"]; if (_version != GVAR(ServerVersion)) then { private "_errorMsg"; _errorMsg = format ["Client/Server Version Mismatch. Server: %1, Client: %2.", GVAR(ServerVersion), _version]; - diag_log text format ["[ACE] ERROR: %1", _errorMsg]; + ACE_LOGERROR(_errorMsg); - if (hasInterface) then {diag_log str "1"; + if (hasInterface) then { ["[ACE] ERROR", _errorMsg, {findDisplay 46 closeDisplay 0}] call FUNC(errorMessage); }; }; @@ -89,9 +98,9 @@ if (isMultiplayer) then { if !(_addons isEqualTo []) then { _errorMsg = format ["Client/Server Addon Mismatch. Client has extra addons: %1.",_addons]; - diag_log text format ["[ACE] ERROR: %1", _errorMsg]; + ACE_LOGERROR(_errorMsg); - if (hasInterface) then {diag_log str "1"; + if (hasInterface) then { ["[ACE] ERROR", _errorMsg, {findDisplay 46 closeDisplay 0}] call FUNC(errorMessage); }; }; diff --git a/addons/common/functions/fnc_checkPBOs.sqf b/addons/common/functions/fnc_checkPBOs.sqf index ac6d8fb270..9cb5ed4d61 100644 --- a/addons/common/functions/fnc_checkPBOs.sqf +++ b/addons/common/functions/fnc_checkPBOs.sqf @@ -5,45 +5,40 @@ * * Arguments: * 0: Mode - * 0: Warn once - * 1: Warn permanently - * 2: Kick - * 1: Check all PBOs? (Optional - default: false) - * 2: Whitelist (Optinal - default: "[]") + * 0 = Warn once + * 1 = Warn permanently + * 2 = Kick + * 1: Check all PBOs? (default: false) + * 2: Whitelist (default: "[]") * - * Return value: + * Return Value: * None + * + * Public: Yes */ #include "script_component.hpp" -private ["_mode", "_checkAll", "_whitelist"]; - -_mode = _this select 0; -_checkAll = if (count _this > 1) then {_this select 1} else {false}; -_whitelist = if (count _this > 2) then {_this select 2} else {"[]"}; +params ["_mode", ["_checkAll", false], ["_whitelist", "[]"]]; _whitelist = [_whitelist, {toLower _this}] call FUNC(map); ACE_Version_CheckAll = _checkAll; ACE_Version_Whitelist = _whitelist; +if (!_checkAll) exitWith {}; //ACE is checked by FUNC(checkFiles) + if (!isServer) then { - [_mode, _checkAll, _whitelist] spawn { - private ["_missingAddon", "_missingAddonServer", "_oldVersionClient", "_oldVersionServer", "_text", "_error", "_rscLayer", "_ctrlHint"]; - PARAMS_3(_mode,_checkAll,_whitelist); + [{ + if (isNil "ACE_Version_ClientErrors") exitWith {}; - waitUntil { - sleep 1; - !isNil "ACE_Version_ClientErrors" - }; + ACE_Version_ClientErrors params ["_missingAddon", "_missingAddonServer", "_oldVersionClient", "_oldVersionServer"]; - _missingAddon = ACE_Version_ClientErrors select 0; - _missingAddonServer = ACE_Version_ClientErrors select 1; - _oldVersionClient = ACE_Version_ClientErrors select 2; - _oldVersionServer = ACE_Version_ClientErrors select 3; + (_this select 0) params ["_mode", "_checkAll", "_whitelist"]; // Display error message. if (_missingAddon || {_missingAddonServer} || {_oldVersionClient} || {_oldVersionServer}) then { + private ["_text", "_error"]; + _text = "[ACE] Version mismatch:

"; _error = format ["ACE version mismatch: %1: ", profileName]; @@ -65,11 +60,13 @@ if (!isServer) then { }; //[_error, "{systemChat _this}"] call FUNC(execRemoteFnc); - diag_log text _error; + ACE_LOGERROR(_error); if (_mode < 2) then { _text = composeText [lineBreak, parseText format ["%1", _text]]; + private ["_rscLayer", "_ctrlHint"]; + _rscLayer = "ACE_RscErrorHint" call BIS_fnc_rscLayer; _rscLayer cutRsc ["ACE_RscErrorHint", "PLAIN", 0, true]; @@ -89,9 +86,11 @@ if (!isServer) then { ["[ACE] ERROR", _text, {findDisplay 46 closeDisplay 0}] call FUNC(errorMessage); }; }; - }; + + [_this select 1] call CBA_fnc_removePerFrameHandler; + }, 1, [_mode, _checkAll, _whitelist]] call CBA_fnc_addPerFrameHandler; }; if (_checkAll) then { - 0 spawn COMPILE_FILE(scripts\Version\checkVersionNumber); + 0 spawn COMPILE_FILE(scripts\checkVersionNumber); // @todo }; diff --git a/addons/common/functions/fnc_claim.sqf b/addons/common/functions/fnc_claim.sqf index f97b69e194..ac89a80172 100644 --- a/addons/common/functions/fnc_claim.sqf +++ b/addons/common/functions/fnc_claim.sqf @@ -1,28 +1,26 @@ /* * Author: commy2 - * * Unit claims the ownership over an object. This is used to prevent multiple players from draging the same ammo box or using up the same wheel when repairing etc. * * Arguments: - * 0: Unit that claims another object. ObjNull to remove claim. (Object) - * 1: The object that gets claimed. (Object) - * 2: Lock the claimed object aswell? (Bool) + * 0: Unit that claims another object. ObjNull to remove claim. + * 1: The object that gets claimed. + * 2: Lock the claimed object aswell? (optional: false) * * Return Value: - * NONE + * None * + * Public: No */ #include "script_component.hpp" - -PARAMS_3(_unit,_target,_lockTarget); -if (isNil "_lockTarget") then {_lockTarget = false}; +params ["_unit", "_target", ["_lockTarget", false]]; private "_owner"; _owner = _target getVariable [QGVAR(owner), objNull]; if (!isNull _owner && {!isNull _unit} && {_unit != _owner}) then { - diag_log text "[ACE] ERROR: Claiming already owned object."; + ACE_LOGERROR("Claiming already owned object."); }; // transfer this immediately diff --git a/addons/common/functions/fnc_closeDialogIfTargetMoves.sqf b/addons/common/functions/fnc_closeDialogIfTargetMoves.sqf deleted file mode 100644 index db60180bd1..0000000000 --- a/addons/common/functions/fnc_closeDialogIfTargetMoves.sqf +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Author: commy2 - * - * Closes the current dialog if the target moves, changes vehicle etc. - * - * Arguments: - * 0: Target unit - * 1: Ignore the unit being dead? (Optional, default: No) - * - * Return Value: - * None - */ -#include "script_component.hpp" - -_this spawn { - PARAMS_2(_target,_ignoreDead); - private["_inVehicle", "_position", "_vehiclePlayer", "_vehicleTarget"]; - - if (isNil "_ignoreDead") then {_ignoreDead = false}; - - _vehicleTarget = vehicle _target; - _vehiclePlayer = vehicle ACE_player; - _inVehicle = _target != _vehicleTarget; - - _position = getPosASL _target; - - _fnc_check = { - // either unit changed vehicles - if (_vehiclePlayer != vehicle ACE_player) exitWith {True}; - if (_vehicleTarget != vehicle _target) exitWith {True}; - - // target died - if (!alive _target && {!_ignoreDead}) exitWith {True}; - - // player fell unconscious - if (ACE_player getVariable ["ACE_isUnconscious", False]) exitWith {True}; - - // target moved (outside of vehicle) - (!_inVehicle && {getPosASL _target distanceSqr _position > 1}) - }; - - waitUntil { - if (call _fnc_check) then { - closeDialog 0; - call EFUNC(interaction,hideMenu); - }; - (isNil QEGVAR(interaction,MainButton) && !dialog) || {!isNull (uiNamespace getVariable [QGVAR(dlgDisableMouse), displayNull])} //Exit loop if DisableMouse dialog open - }; -}; diff --git a/addons/common/functions/fnc_codeToLetter.sqf b/addons/common/functions/fnc_codeToLetter.sqf index 8e8a9c8a3e..80f6291d0f 100644 --- a/addons/common/functions/fnc_codeToLetter.sqf +++ b/addons/common/functions/fnc_codeToLetter.sqf @@ -1,4 +1,19 @@ -// by commy2 +/* + * Author: commy2 + * Converts some keys to an Arma Dik Code. + * + * Arguments: + * 0: Key + * + * Return Value: + * Dik Code + * + * Public: Yes + * + * Deprecated + */ #include "script_component.hpp" +ACE_DEPRECATED("ace_common_fnc_codeToLetter","3.5.0","-"); + ["", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"] select ([2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 30, 48, 46, 32, 18, 33, 34, 35, 23, 36, 37, 38, 50, 49, 24, 25, 16, 19, 31, 20, 22, 47, 17, 45, 44, 21] find (_this select 0)) + 1 diff --git a/addons/common/functions/fnc_codeToString.sqf b/addons/common/functions/fnc_codeToString.sqf index 1698182051..4a1b158f21 100644 --- a/addons/common/functions/fnc_codeToString.sqf +++ b/addons/common/functions/fnc_codeToString.sqf @@ -1,22 +1,23 @@ /* * Author: commy2 - * * Removes the brackets around a code and returns the code as a string. It does nothing if the code is already a string. * - * Argument: - * 0: Code (Code or String) + * Arguments: + * 0: Code * * Return value: - * Code (String) + * Code + * + * Public: Yes */ #include "script_component.hpp" -PARAMS_1(_function); +params ["_function"]; if (typeName _function == "STRING") exitWith {_function}; _function = toArray str _function; -_function set [0, -1]; -_function set [count _function - 1, -1]; -_function = toString (_function - [-1]); -_function +_function deleteAt 0; +_function deleteAt (count _function - 1); + +toString _function // return diff --git a/addons/common/functions/fnc_convertKeyCode.sqf b/addons/common/functions/fnc_convertKeyCode.sqf deleted file mode 100644 index 498a3eb706..0000000000 --- a/addons/common/functions/fnc_convertKeyCode.sqf +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Author: commy2 - * - * Get a key code used in ACE key input eh. - * - * Argument: - * 0: Arma DIK code (Number) - * 1: Key state for shift left and shift right key (Bool) - * 2: Key state for ctrl left and ctrl right key (Bool) - * 3: Key state for alt and alt gr key (Bool) - * - * Return value: - * Key code (Number) - */ -#include "script_component.hpp" - -#define KEY_MODIFIERS [42, 54, 29, 157, 56, 184] - -PARAMS_1(_key); - -if (_key in KEY_MODIFIERS) exitWith {_key}; - -if (_this select 1) then {_key = _key + 0.1}; -if (_this select 2) then {_key = _key + 0.2}; -if (_this select 3) then {_key = _key + 0.4}; - -_key diff --git a/addons/common/functions/fnc_createOrthonormalReference.sqf b/addons/common/functions/fnc_createOrthonormalReference.sqf index 346127c658..4a8db8bba1 100644 --- a/addons/common/functions/fnc_createOrthonormalReference.sqf +++ b/addons/common/functions/fnc_createOrthonormalReference.sqf @@ -1,19 +1,21 @@ /* * Author: esteldunedain - * * Returns a orthonormal system of reference aligned with the supplied vector * - * Argument: - * Vector to align the coordinate system with (Array) + * Arguments: + * Vector to align the coordinate system with * - * Return value: - * 0: v1 (Array) - * 1: v2 (Array) - * 2: v3 (Array) + * Return Value: + * 0: Vector Normalized + * 1: Normalized Cross Product Vector + * 2: Vector Cross Product + * + * Public: Yes */ #include "script_component.hpp" -private ["_v1","_v2","_v3"]; +private ["_v1", "_v2", "_v3"]; + _v1 = vectorNormalized _this; _v2 = vectorNormalized (_v1 vectorCrossProduct [0,0,1]); _v3 = _v2 vectorCrossProduct _v1; diff --git a/addons/common/functions/fnc_currentChannel.sqf b/addons/common/functions/fnc_currentChannel.sqf index 127f3b7a54..82dd66b485 100644 --- a/addons/common/functions/fnc_currentChannel.sqf +++ b/addons/common/functions/fnc_currentChannel.sqf @@ -1,13 +1,14 @@ /* * Author: commy2 - * * Returns the current radio / chat / marker channel. * - * Argument: - * NONE. + * Arguments: + * None * - * Return value: - * The current channel. Can be "group", "side", "global", "command", "vehicle", "direct" or "custom_X" (String) + * Return Value: + * The current channel ("group", "side", "global", "command", "vehicle", "direct", "custom_X") + * + * Public: Yes */ #include "script_component.hpp" diff --git a/addons/common/functions/fnc_debug.sqf b/addons/common/functions/fnc_debug.sqf index fd1d3d59fa..6430a7bb11 100644 --- a/addons/common/functions/fnc_debug.sqf +++ b/addons/common/functions/fnc_debug.sqf @@ -1,58 +1,44 @@ -/** - * fn_debug.sqf - * @Descr: Print logging messages through the ACE framework. - * @Author: Glowbal +/* + * Author: Glowbal + * Print logging messages through the ACE framework. * - * @Arguments: [message ANY, level NUMBER (Optional)] - * @Return: BOOL True if message has been printed - * @PublicAPI: true + * Arguments: + * 0: Message + * 1: Level (default: 2) + * + * Return Value: + * Message is Printed + * + * Public: Yes */ #include "script_component.hpp" #define DEFAULT_LOGGING_LEVEL -1 #define DEFAULT_TEXT_DISPLAY -1 -private ["_level", "_prefix", "_defaultLoglevel","_defaultLogDisplayLevel", "_message"]; -PARAMS_1(_msg); -_level = if (count _this > 1) then {_this select 1} else { 2 }; +params ["_msg", ["_level", 2, [0]]]; -if (typeName _level != "NUMBER") then { - _level = 2; -}; +private ["_defaultLoglevel", "_defaultLogDisplayLevel"]; -_defaultLoglevel = if (isNil QGVAR(LOGLEVEL)) then { - DEFAULT_LOGGING_LEVEL; -} else { - GVAR(LOGLEVEL); -}; +_defaultLoglevel = [GVAR(LOGLEVEL), DEFAULT_LOGGING_LEVEL] select isNil QGVAR(LOGLEVEL); -if (_defaultLoglevel < 0) exitwith { - false -}; +if (_defaultLoglevel < 0) exitwith {false}; -_defaultLogDisplayLevel = if (isnil QGVAR(LOGDISPLAY_LEVEL)) then { - DEFAULT_TEXT_DISPLAY; -} else { - GVAR(LOGDISPLAY_LEVEL); -}; +_defaultLogDisplayLevel = [GVAR(LOGDISPLAY_LEVEL), DEFAULT_TEXT_DISPLAY] select isNil QGVAR(LOGDISPLAY_LEVEL); if (_level <= _defaultLoglevel) then { + private ["_prefix", "_message"]; - _prefix = switch (_level) do { - case 0: { "ACE Error" }; - case 1: { "ACE Warn" }; - case 2: { "ACE Debug" }; - case 3: { "ACE Info" }; - default { "ACE Unknown" }; - }; - _message = format["[%1] %2",_prefix,_msg]; + _prefix = ["Unknown", "Error", "Warn", "Debug", "Info"] select ([0, 1, 2, 3] find _level + 1); + + _message = format ["[ACE %1] %2", _prefix, _msg]; if (_level <= _defaultLogDisplayLevel) then { systemChat _message; }; diag_log _message; - // pass it onwards to the log function: - // [0, [], compile format["%1",_msg], true] call FUNC(log); + }; -true \ No newline at end of file + +true diff --git a/addons/common/functions/fnc_debugModule.sqf b/addons/common/functions/fnc_debugModule.sqf index 262ae9c02d..4f3da4d7cb 100644 --- a/addons/common/functions/fnc_debugModule.sqf +++ b/addons/common/functions/fnc_debugModule.sqf @@ -1,16 +1,18 @@ -/** - * fn_debugModule.sqf - * @Descr: N/A - * @Author: Glowbal +/* + * Author: Glowbal + * ? * - * @Arguments: [] - * @Return: - * @PublicAPI: false + * Arguments: + * None + * + * Return Value: + * None + * + * Public: No */ - #include "script_component.hpp" -PARAMS_1(_entity); +params ["_entity"]; GVAR(LOGDISPLAY_LEVEL) = call compile (_entity getvariable ["logDisplayLevel","4"]); GVAR(LOGLEVEL) = call compile (_entity getvariable ["logLevel","4"]); diff --git a/addons/common/functions/fnc_defineVariable.sqf b/addons/common/functions/fnc_defineVariable.sqf index 28ed5b2015..6ea15adc43 100644 --- a/addons/common/functions/fnc_defineVariable.sqf +++ b/addons/common/functions/fnc_defineVariable.sqf @@ -1,38 +1,34 @@ -/** - * fn_defineVariable.sqf - * @Descr: Define a variable for the ACE variable framework - * @Author: Glowbal +/* + * Author: Glowbal + * Define a variable for the ACE variable framework * - * @Arguments: [name STRING, defaultValue ANY, publicFlag BOOL, category STRING, type NUMBER, persistentFlag BOOL] - * @Return: - * @PublicAPI: true + * Arguments: + * 0: Name + * 1: defaultValue + * 2: publicFlag + * 3: category + * 4: type (default: 0) + * 5: persistentFlag (default: false) + * + * Return Value: + * None + * + * Public: Yes */ #include "script_component.hpp" -private ["_code","_persistent"]; +params ["_name", "_value", "_defaultGlobal", "_category", ["_code", 0], ["_persistent", false]]; -PARAMS_4(_name,_value,_defaultGlobal,_catagory); +if (isNil "_defaultGlobal") exitWith {}; -_code = 0; -_persistent = false; - -if (count _this < 3) exitwith {}; -if (count _this > 4) then { - _code = _this select 4; - if (count _this > 5) then { - _persistent = _this select 5; - }; +if (typeName _name != "STRING") exitwith { + [format ["Tried to the deinfe a variable with an invalid name: %1 Arguments: %2", _name, _this]] call FUNC(debug); }; -if (typeName _name != typeName "") exitwith { - [format["Tried to the deinfe a variable with an invalid name: %1 Arguments: %2", _name, _this]] call FUNC(debug); -}; - -if (isnil QGVAR(OBJECT_VARIABLES_STORAGE)) then { +if (isNil QGVAR(OBJECT_VARIABLES_STORAGE)) then { GVAR(OBJECT_VARIABLES_STORAGE) = []; }; -GVAR(OBJECT_VARIABLES_STORAGE) pushback [_name,_value,_defaultGlobal,_catagory,_code, _persistent]; - -missionNamespace setvariable [QGVAR(OBJECT_VARIABLES_STORAGE_) + _name, [_name,_value,_defaultGlobal,_catagory,_code, _persistent]]; +GVAR(OBJECT_VARIABLES_STORAGE) pushBack [_name, _value, _defaultGlobal, _category, _code, _persistent]; +missionNamespace setVariable [QGVAR(OBJECT_VARIABLES_STORAGE_) + _name, [_name, _value, _defaultGlobal, _category, _code, _persistent]]; diff --git a/addons/common/functions/fnc_deviceKeyFindValidIndex.sqf b/addons/common/functions/fnc_deviceKeyFindValidIndex.sqf index a8418cd4cd..681ab946e0 100644 --- a/addons/common/functions/fnc_deviceKeyFindValidIndex.sqf +++ b/addons/common/functions/fnc_deviceKeyFindValidIndex.sqf @@ -3,7 +3,7 @@ * Finds next valid index for the device array. * * Arguments: - * 0: Offset from currentIndex (use 1 to find next valid after current) or a displayName string or + * 0: Offset from currentIndex (use 1 to find next valid after current) or a displayName string (default: 0) * * Return Value: * The new index (-1 if no valid) @@ -16,23 +16,25 @@ */ #include "script_component.hpp" -DEFAULT_PARAM(0,_searchOffsetOrName,0); +params [["_searchOffsetOrName", 0]]; -private ["_validIndex", "_offsetBy", "_realIndex", "_offset"]; +private ["_validIndex", "_realIndex"]; _validIndex = -1; -if ((typeName _searchOffsetOrName) == "STRING") then { +if (typeName _searchOffsetOrName == "STRING") then { { - if ((_x select 0) == _searchOffsetOrName) exitWith { + if (_x select 0 == _searchOffsetOrName) exitWith { _validIndex = _forEachIndex; }; } forEach GVAR(deviceKeyHandlingArray); } else { - if ((count GVAR(deviceKeyHandlingArray)) > 0) then { - _baseIndex = if (GVAR(deviceKeyCurrentIndex) == -1) then {0} else {GVAR(deviceKeyCurrentIndex) + _searchOffsetOrName}; - for "_offset" from _baseIndex to ((count GVAR(deviceKeyHandlingArray)) - 1 + _baseIndex) do { + if (count GVAR(deviceKeyHandlingArray) > 0) then { + _baseIndex = [GVAR(deviceKeyCurrentIndex) + _searchOffsetOrName, 0] select (GVAR(deviceKeyCurrentIndex) == -1); + + for "_offset" from _baseIndex to (count GVAR(deviceKeyHandlingArray) - 1 + _baseIndex) do { _realIndex = _offset % (count GVAR(deviceKeyHandlingArray)); + if ([] call ((GVAR(deviceKeyHandlingArray) select _realIndex) select 2)) exitWith { _validIndex = _realIndex; }; diff --git a/addons/common/functions/fnc_deviceKeyRegisterNew.sqf b/addons/common/functions/fnc_deviceKeyRegisterNew.sqf index 88ffa84af7..416eef2c77 100644 --- a/addons/common/functions/fnc_deviceKeyRegisterNew.sqf +++ b/addons/common/functions/fnc_deviceKeyRegisterNew.sqf @@ -10,7 +10,7 @@ * 4: Close Code (on ctrl-home press) * * Return Value: - * Nothing + * None * * Example: * [(localize "STR_ACE_microdagr_itemName"), QUOTE(PATHTOF(images\microDAGR_item.paa)), _conditionCode, _toggleCode, _closeCode] call ace_common_fnc_deviceKeyRegisterNew @@ -19,7 +19,8 @@ */ #include "script_component.hpp" -PARAMS_5(_displayName,_iconImage,_conditionCode,_toggleCode,_closeCode); +params ["_displayName", "_iconImage", "_conditionCode", "_toggleCode", "_closeCode"]; + +GVAR(deviceKeyHandlingArray) pushBack [_displayName, _iconImage, _conditionCode, _toggleCode, _closeCode]; -GVAR(deviceKeyHandlingArray) pushBack [_displayName,_iconImage,_conditionCode,_toggleCode,_closeCode]; [] call FUNC(deviceKeyFindValidIndex); diff --git a/addons/common/functions/fnc_disableAI.sqf b/addons/common/functions/fnc_disableAI.sqf index 0e1985eced..1a66628ffb 100644 --- a/addons/common/functions/fnc_disableAI.sqf +++ b/addons/common/functions/fnc_disableAI.sqf @@ -10,15 +10,17 @@ * None * * Example: - * [bob, true] call ace_common_fnc_disableAI; + * [bob, true] call ace_common_fnc_disableAI * * Public: No */ #include "script_component.hpp" -PARAMS_2(_unit,_disable); +params ["_unit", "_disable"]; -if ((local _unit) && {!([_unit] call EFUNC(common,isPlayer))}) then { +if (!local _unit) exitWith {}; + +if !([_unit] call EFUNC(common,isPlayer)) then { if (_disable) then { _unit disableAI "MOVE"; _unit disableAI "TARGET"; @@ -27,7 +29,10 @@ if ((local _unit) && {!([_unit] call EFUNC(common,isPlayer))}) then { _unit disableConversation true; } else { //Sanity check to make sure we don't enable unconsious AI - if (_unit getVariable ["ace_isunconscious", false] && alive _unit) exitWith {ERROR("Enabling AI for unconsious unit");}; + if (_unit getVariable ["ace_isunconscious", false] && alive _unit) exitWith { + ERROR("Enabling AI for unconsious unit"); + }; + _unit enableAI "MOVE"; _unit enableAI "TARGET"; _unit enableAI "AUTOTARGET"; diff --git a/addons/common/functions/fnc_disableUserInput.sqf b/addons/common/functions/fnc_disableUserInput.sqf index 520e4131b2..8b00cedeac 100644 --- a/addons/common/functions/fnc_disableUserInput.sqf +++ b/addons/common/functions/fnc_disableUserInput.sqf @@ -5,23 +5,20 @@ * Arguments: * 0: True to disable key inputs, false to re-enable them * - * Return value: - * Nothing + * Return Value: + * None * - * Public: Yes + * Public: No */ - #include "script_component.hpp" -private ["_dlg"]; - -PARAMS_1(_state); +params ["_state"]; if (_state) then { disableSerialization; if (!isNull (uiNamespace getVariable [QGVAR(dlgDisableMouse), displayNull])) exitWith {}; - if ("ACE_DisableUserInput" in ([BIS_stackedEventHandlers_onEachFrame, {_this select 0}] call FUNC(map))) exitWith {}; + if (!isNil QGVAR(disableInputPFH)) exitWith {}; // end TFAR and ACRE2 radio transmissions call FUNC(endRadioTransmission); @@ -34,21 +31,20 @@ if (_state) then { closeDialog 0; createDialog QGVAR(DisableMouse_Dialog); + private "_dlg"; _dlg = uiNamespace getVariable QGVAR(dlgDisableMouse); _dlg displayAddEventHandler ["KeyDown", { - private ["_key", "_dlg", "_ctrl", "_config", "_acc", "_index"]; - _key = _this select 1; + params ["", "_key"]; if (_key == 1 && {alive player}) then { createDialog (["RscDisplayInterrupt", "RscDisplayMPInterrupt"] select isMultiplayer); disableSerialization; - _dlg = finddisplay 49; - _dlg displayAddEventHandler ["KeyDown", { - _key = _this select 1; - !(_key == 1) - }]; + + private ["_dlg", "_ctrl"]; + + _dlg = findDisplay 49; for "_index" from 100 to 2000 do { (_dlg displayCtrl _index) ctrlEnable false; @@ -62,19 +58,21 @@ if (_state) then { _ctrl = _dlg displayctrl ([104, 1010] select isMultiplayer); _ctrl ctrlSetEventHandler ["buttonClick", QUOTE(closeDialog 0; player setDamage 1; [false] call DFUNC(disableUserInput);)]; - _ctrl ctrlEnable (call {_config = missionConfigFile >> "respawnButton"; !isNumber _config || {getNumber _config == 1}}); + _ctrl ctrlEnable (call {private "_config"; _config = missionConfigFile >> "respawnButton"; !isNumber _config || {getNumber _config == 1}}); _ctrl ctrlSetText "RESPAWN"; _ctrl ctrlSetTooltip "Respawn."; }; if (_key in actionKeys "TeamSwitch" && {teamSwitchEnabled}) then { (uiNamespace getVariable [QGVAR(dlgDisableMouse), displayNull]) closeDisplay 0; + + private "_acc"; _acc = accTime; teamSwitch; setAccTime _acc; }; - if (_key in actionKeys "CuratorInterface" && {getAssignedCuratorLogic player in allCurators}) then { + if (_key in actionKeys "CuratorInterface" && {getAssignedCuratorLogic player in allCurators}) then { (uiNamespace getVariable [QGVAR(dlgDisableMouse), displayNull]) closeDisplay 0; openCuratorInterface; }; @@ -84,7 +82,7 @@ if (_state) then { openMap true; }; - if (serverCommandAvailable "#missions" || {player getVariable ["ACE_isUnconscious", false] && {(call FUNC(player)) getVariable [QEGVAR(medical,AllowChatWhileUnconscious), missionNamespace getVariable [QEGVAR(medical,AllowChatWhileUnconscious), false]]}}) then { + if (isServer || {serverCommandAvailable "#kick"} || {player getVariable ["ACE_isUnconscious", false] && {(call FUNC(player)) getVariable [QEGVAR(medical,AllowChatWhileUnconscious), missionNamespace getVariable [QEGVAR(medical,AllowChatWhileUnconscious), false]]}}) then { if (!(_key in (actionKeys "DefaultAction" + actionKeys "Throw")) && {_key in (actionKeys "Chat" + actionKeys "PrevChannel" + actionKeys "NextChannel")}) then { _key = 0; }; @@ -95,16 +93,17 @@ if (_state) then { _dlg displayAddEventHandler ["KeyUp", {true}]; - ["ACE_DisableUserInput", "onEachFrame", { + GVAR(disableInputPFH) = [{ if (isNull (uiNamespace getVariable [QGVAR(dlgDisableMouse), displayNull]) && {!visibleMap && isNull findDisplay 49 && isNull findDisplay 312 && isNull findDisplay 632}) then { - ["ACE_DisableUserInput", "onEachFrame"] call BIS_fnc_removeStackedEventHandler; + [GVAR(disableInputPFH)] call CBA_fnc_removePerFrameHandler; + GVAR(disableInputPFH) = nil; [true] call FUNC(disableUserInput); }; - }] call BIS_fnc_addStackedEventHandler; - + }, 0, []] call CBA_fnc_addPerFrameHandler; } else { - if ("ACE_DisableUserInput" in ([BIS_stackedEventHandlers_onEachFrame, {_this select 0}] call FUNC(map))) then { - ["ACE_DisableUserInput", "onEachFrame"] call BIS_fnc_removeStackedEventHandler; + if (!isNil QGVAR(disableInputPFH)) then { + [GVAR(disableInputPFH)] call CBA_fnc_removePerFrameHandler; + GVAR(disableInputPFH) = nil; }; (uiNamespace getVariable [QGVAR(dlgDisableMouse), displayNull]) closeDisplay 0; diff --git a/addons/common/functions/fnc_displayIcon.sqf b/addons/common/functions/fnc_displayIcon.sqf index 2fd5245465..8421f5be7e 100644 --- a/addons/common/functions/fnc_displayIcon.sqf +++ b/addons/common/functions/fnc_displayIcon.sqf @@ -1,24 +1,23 @@ /* -* Author: Glowbal -* -* Draw progress bar and execute given function if succesful. -* Finish/Failure/Conditional are all passed [args, elapsedTime, totalTime, errorCode] -* -* Argument: -* 0: icon ID -* 1: show -* 2: Icon Path -* 3: Icon color -* 4: timeAlive. -1 = forever -* -* Return value: -* Nothing -* -* Example: -* ["myID", true, QUOTE(PATHTOF(data\icon_group.paa)), [1,1,1,1], 0] call ace_gui_fnc_displayIcon; -*/ - - + * Author: Glowbal + * Draw progress bar and execute given function if succesful. + * Finish/Failure/Conditional are all passed [args, elapsedTime, totalTime, errorCode] + * + * Arguments: + * 0: icon ID + * 1: show + * 2: Icon Path + * 3: Icon color + * 4: timeAlive. -1 = forever (default: 6) + * + * Return Value: + * None + * + * Example: + * ["myID", true, QUOTE(PATHTOF(data\icon_group.paa)), [1,1,1,1], 0] call ace_gui_fnc_displayIcon; + * + * Public: Yes + */ #include "script_component.hpp" // positions for the icon UI @@ -42,31 +41,37 @@ // other constants #define DEFAULT_TIME 6 -private ["_allControls", "_refresh", "_timeAlive", "_list"]; - -PARAMS_4(_iconId,_show,_icon,_color); - -_timeAlive = if (count _this > 4) then {_this select 4} else {DEFAULT_TIME}; - disableSerialization; -_list = missionNamespace getvariable [QGVAR(displayIconList),[]]; + +params ["_iconId", "_show", "_icon", "_color", ["_timeAlive", DEFAULT_TIME]]; + +private ["_list", "_refresh"]; + +_list = missionNamespace getVariable [QGVAR(displayIconList), []]; _refresh = { - private ["_allControls"]; // Refreshing of all icons.. - _allControls = missionNamespace getvariable [QGVAR(displayIconListControls), []]; + private "_allControls"; + _allControls = missionNamespace getVariable [QGVAR(displayIconListControls), []]; + { ctrlDelete _x; - }foreach _allControls; + false + } count _allControls; _allControls = []; - private ["_ctrl", "_setting", "_position"]; - _setting = missionNamespace getvariable[QGVAR(settingFeedbackIcons), 0]; + private ["_setting", "_ctrl", "_position"]; + + _setting = missionNamespace getVariable [QGVAR(settingFeedbackIcons), 0]; + if (_setting > 0) then { { + _x params ["", "_xicon", "_xcolor"]; + // +19000 because we want to make certain we are using free IDCs.. - _ctrl = ((findDisplay 46) ctrlCreate ["RscPicture", _foreachIndex + 19000]); + _ctrl = (findDisplay 46) ctrlCreate ["RscPicture", _forEachIndex + 19000]; + _position = switch (_setting) do { case TOP_RIGHT_DOWN: {[X_POS_ICONS, Y_POS_ICONS + (_foreachIndex * DIFFERENCE_ICONS), ICON_WIDTH, ICON_WIDTH]}; case TOP_RIGHT_LEFT: {[X_POS_ICONS_SECOND - ((_foreachIndex+3) * DIFFERENCE_ICONS), Y_POS_ICONS_SECOND - (ICON_WIDTH / 2), ICON_WIDTH, ICON_WIDTH]}; @@ -74,46 +79,53 @@ _refresh = { case TOP_LEFT_RIGHT: {[LEFT_SIDE + (0.5 * ICON_WIDTH) - ((_foreachIndex+3) * DIFFERENCE_ICONS), Y_POS_ICONS_SECOND, ICON_WIDTH, ICON_WIDTH]}; default {[X_POS_ICONS, Y_POS_ICONS + (_foreachIndex * DIFFERENCE_ICONS), ICON_WIDTH, ICON_WIDTH]}; }; + _ctrl ctrlSetPosition _position; - _ctrl ctrlsetText (_x select 1); - _ctrl ctrlSetTextColor (_x select 2); + _ctrl ctrlSetText _xicon; + _ctrl ctrlSetTextColor _xcolor; _ctrl ctrlCommit 0; - _allControls pushback _ctrl; - }foreach (missionNamespace getvariable [QGVAR(displayIconList),[]]); + _allControls pushBack _ctrl; + false + } forEach (missionNamespace getVariable [QGVAR(displayIconList),[]]); }; - missionNamespace setvariable [QGVAR(displayIconListControls), _allControls]; + + missionNamespace setVariable [QGVAR(displayIconListControls), _allControls]; }; if (_show) then { - if ({(_x select 0 == _iconId)} count _list == 0) then { - _list pushback [_iconId, _icon, _color, ACE_time]; + if ({_x select 0 == _iconId} count _list == 0) then { + _list pushBack [_iconId, _icon, _color, ACE_time]; } else { { if (_x select 0 == _iconId) exitwith { - _list set [_foreachIndex, [_iconId, _icon, _color, ACE_time]]; + _list set [_forEachIndex, [_iconId, _icon, _color, ACE_time]]; }; } forEach _list; }; - missionNamespace setvariable [QGVAR(displayIconList), _list]; + + missionNamespace setVariable [QGVAR(displayIconList), _list]; call _refresh; if (_timeAlive >= 0) then { [{ - [_this select 0, false, "", [0,0,0], 0] call FUNC(displayIcon); - }, [_iconId], _timeAlive, _timeAlive] call EFUNC(common,waitAndExecute); + [_this select 0, false, "", [0,0,0], 0] call FUNC(displayIcon); + }, [_iconId], _timeAlive, _timeAlive] call FUNC(waitAndExecute); }; } else { - if ({(_x select 0 == _iconId)} count _list == 1) then { + + if ({_x select 0 == _iconId} count _list == 1) then { private "_newList"; _newList = []; + { if (_x select 0 != _iconId) then { - _newList pushback _x; + _newList pushBack _x; }; - } forEach _list; + false + } count _list; - missionNamespace setvariable [QGVAR(displayIconList), _newList]; + missionNamespace setVariable [QGVAR(displayIconList), _newList]; call _refresh; }; }; diff --git a/addons/common/functions/fnc_displayText.sqf b/addons/common/functions/fnc_displayText.sqf index 22349962ac..fce8fdd832 100644 --- a/addons/common/functions/fnc_displayText.sqf +++ b/addons/common/functions/fnc_displayText.sqf @@ -1,42 +1,35 @@ /* * Author: commy2 - * * Display a message. * - * Argument: - * 0: Message (String) - * 1: Play a clicking sound (Bool, optional default: false) - * 2: How long before hiding the message in seconds (Number, optional default: 2 sec) - * 3: Priority, higher priority messages will override lesser important ones (Number, optional default: 0) + * Arguments: + * 0: Message + * 1: Play a clicking sound (default: false) + * 2: How long before hiding the message in seconds (default: 2) + * 3: Priority, higher priority messages will override lesser important ones (default: 0) * - * Return value: - * Nothing + * Return Value: + * None + * + * Public: Yes */ #include "script_component.hpp" -#define DEFAULT_PLAY_SOUND false -#define DEFAULT_DELAY 2 -#define DEFAULT_PRIORITY 0 - -_this resize 4; - -private ["_lastHintTime", "_lastHintPriority", "_time"]; - -PARAMS_4(_text,_sound,_delay,_priority); +params ["_text", ["_sound", false], ["_delay", 2], ["_priority", 0]]; if (isNil QGVAR(lastHint)) then { GVAR(lastHint) = [0, 0]; }; +if !(typeName _text in ["STRING", "TEXT"]) then {_text = str _text}; + +private ["_lastHintTime", "_lastHintPriority", "_time"]; + _lastHintTime = GVAR(lastHint) select 0; _lastHintPriority = GVAR(lastHint) select 1; -if !(typeName _text in ["STRING", "TEXT"]) then {_text = str _text}; -if (isNil "_sound") then {_sound = DEFAULT_PLAY_SOUND}; -if (isNil "_delay") then {_delay = DEFAULT_DELAY}; -if (isNil "_priority") then {_priority = DEFAULT_PRIORITY}; - _time = ACE_time; + if (_time > _lastHintTime + _delay || {_priority >= _lastHintPriority}) then { hintSilent _text; if (_sound) then {playSound "ACE_Sound_Click"}; diff --git a/addons/common/functions/fnc_displayTextPicture.sqf b/addons/common/functions/fnc_displayTextPicture.sqf index 93d4d38df7..3bdf908d16 100644 --- a/addons/common/functions/fnc_displayTextPicture.sqf +++ b/addons/common/functions/fnc_displayTextPicture.sqf @@ -1,25 +1,21 @@ /* * Author: commy2, Glowbal - * * Display a structured text with image. * - * Argument: + * Arguments: * 0: Text * 1: Image - * 2: Image color - * 3: Target Unit. Will only display if target is the player controlled object + * 2: Image color (default: [0, 0, 0, 0]) + * 3: Target Unit. Will only display if target is the player controlled object (default: ACE_player) * - * Return value: - * Nothing + * Return Value: + * None + * + * Public: Yes */ - #include "script_component.hpp" -private ["_imageColor", "_target"]; -PARAMS_2(_text,_image); -_imageColor = if (count _this > 2) then {_this select 2} else {[1,1,1]}; -_imageColor resize 3; -_target = if (count _this > 3) then {_this select 3} else {ACE_player}; +params ["_text", "_image", ["_imageColor", [1,1,1]], ["_target", ACE_player]]; if (_target != ACE_player) exitWith {}; @@ -28,16 +24,21 @@ if (typeName _text != "TEXT") then { if (count _text > 0) then { { if (typeName _x == "STRING" && {isLocalized _x}) then { - _text set [_foreachIndex, localize _x]; + _text set [_forEachIndex, localize _x]; }; - }foreach _text; + } forEach _text; + _text = format _text; }; }; + if (typeName _text == "STRING" && {isLocalized _text}) then { _text = localize _text; }; + _text = parseText format ["%1", _text]; }; + _text = composeText [parseText format ["", _image, _imageColor call BIS_fnc_colorRGBtoHTML], lineBreak, _text]; + [_text, 2] call FUNC(displayTextStructured); diff --git a/addons/common/functions/fnc_displayTextStructured.sqf b/addons/common/functions/fnc_displayTextStructured.sqf index cfe2feb3cb..255a014b6f 100644 --- a/addons/common/functions/fnc_displayTextStructured.sqf +++ b/addons/common/functions/fnc_displayTextStructured.sqf @@ -1,23 +1,20 @@ /* * Author: commy2, Glowbal - * * Display a structured text. * - * Argument: + * Arguments: * 0: Text - * 1: Size of the textbox - * 2: Target Unit. Will only display if target is the player controlled object + * 1: Size of the textbox (default: 1.5) + * 2: Target Unit. Will only display if target is the player controlled object (default: ACE_player) * - * Return value: - * Nothing + * Return Value: + * None + * + * Public: Yes */ - #include "script_component.hpp" -private ["_text", "_size", "_isShown", "_ctrlHint", "_yPos", "_xPos", "_wPos", "_hPos", "_position", "_target"]; -_text = _this select 0; -_size = if (count _this > 1) then {_this select 1} else {1.5;}; -_target = if (count _this > 2) then {_this select 2} else {ACE_player}; +params ["_text", ["_size", 1.5], ["_target", ACE_player]]; if (_target != ACE_player) exitWith {}; @@ -38,6 +35,8 @@ if (typeName _text != "TEXT") then { _text = composeText [lineBreak, parseText format ["%1", _text]]; }; +private ["_isShown", "_ctrlHint", "_xPos", "_yPos", "_wPos", "_hPos", "_position"]; + _isShown = ctrlShown (uiNamespace getVariable ["ACE_ctrlHint", controlNull]); ("ACE_RscHint" call BIS_fnc_rscLayer) cutRsc ["ACE_RscHint", "PLAIN", 0, true]; @@ -60,8 +59,8 @@ _yPos = safeZoneY + 0.175 * safezoneH; _wPos = (10 *(((safezoneW / safezoneH) min 1.2) / 40)); _hPos = (2 *((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)); -//Zeus Interface Open and Display would be under the "CREATE" list -if (!isnull curatorCamera) then { +// Zeus Interface Open and Display would be under the "CREATE" list +if (!isNull curatorCamera) then { _xPos = _xPos min ((safezoneX + safezoneW - 12.5 * (((safezoneW / safezoneH) min 1.2) / 40)) - _wPos); }; diff --git a/addons/common/functions/fnc_doAnimation.sqf b/addons/common/functions/fnc_doAnimation.sqf index 07d9ec9e35..42d59f0b72 100644 --- a/addons/common/functions/fnc_doAnimation.sqf +++ b/addons/common/functions/fnc_doAnimation.sqf @@ -3,35 +3,22 @@ * * Execute an animation. This is used to not break things like the unconsciousness animation. * - * Argument: - * 0: Unit (Object) - * 1: Animation (String) - * 2: Priority of the animation. (Number, optional default: 0) - * 0: PlayMove - * 1: PlayMoveNow - * 2: SwitchMove (no transitional animation, doesn't overwrite priority 1) + * Arguments: + * 0: Unit + * 1: Animation + * 2: Priority of the animation. (default: 0) + * 0 = PlayMove + * 1 = PlayMoveNow + * 2 = SwitchMove (no transitional animation, doesn't overwrite priority 1) * - * Return value: - * Nothing + * Return Value: + * None + * + * Public: Yes */ #include "script_component.hpp" -private ["_force"]; - -PARAMS_3(_unit,_animation,_priority); -_force = False; - -// no animation given -if (isNil "_animation") exitWith { - diag_log format ["[ACE] ERROR: No animation specified in %1", _fnc_scriptNameParent]; -}; - -if (isNil "_priority") then { - _priority = 0; -}; -if (count _this > 3) then { - _force = _this select 3; -}; +params ["_unit", "_animation", ["_priority", 0], ["_force", false]]; // don't overwrite more important animations if (_unit getVariable ["ACE_isUnconscious", false] && {(_animation != "Unconscious")} && {!_force}) exitWith {}; @@ -44,8 +31,10 @@ if (_animation == "") then { _animation = [_unit] call FUNC(getDefaultAnim); }; +//if (_animation == animationState _unit) exitWith {}; + switch (_priority) do { - case 0 : { + case 0: { if (_unit == vehicle _unit) then { [_unit, format ["{_this playMove '%1'}", _animation], _unit] call FUNC(execRemoteFnc); } else { @@ -53,7 +42,7 @@ switch (_priority) do { [_unit, format ["{_this playMove '%1'}", _animation]] call FUNC(execRemoteFnc); }; }; - case 1 : { + case 1: { if (_unit == vehicle _unit) then { [_unit, format ["{_this playMoveNow '%1'}", _animation], _unit] call FUNC(execRemoteFnc); } else { @@ -61,11 +50,20 @@ switch (_priority) do { [_unit, format ["{_this playMoveNow '%1'}", _animation]] call FUNC(execRemoteFnc); }; }; - case 2 : { - // Execute on all machines. SwitchMove has local effects. - [_unit, format ["{_this switchMove '%1'}", _animation]] call FUNC(execRemoteFnc); + case 2: { + // try playMoveNow first + if (_unit == vehicle _unit) then { + [_unit, format ["{_this playMoveNow '%1'}", _animation], _unit] call FUNC(execRemoteFnc); + } else { + // Execute on all machines. PlayMove and PlayMoveNow are bugged: They have no global effects when executed on remote machines inside vehicles. + [_unit, format ["{_this playMoveNow '%1'}", _animation]] call FUNC(execRemoteFnc); + }; + + // if animation doesn't respond, do switchMove + if (animationState _unit != _animation) then { + // Execute on all machines. SwitchMove has local effects. + [_unit, format ["{_this switchMove '%1'}", _animation]] call FUNC(execRemoteFnc); + }; }; default {}; }; - -["Anim", [_priority, _animation]] call FUNC(log); diff --git a/addons/common/functions/fnc_dropBackpack.sqf b/addons/common/functions/fnc_dropBackpack.sqf index 05ee3ab750..26c902a057 100644 --- a/addons/common/functions/fnc_dropBackpack.sqf +++ b/addons/common/functions/fnc_dropBackpack.sqf @@ -1,30 +1,24 @@ /* * Author: commy2 - * * Drops a backback. Also returns the ground wepaon holder object of the dropped backpack. * - * Argument: - * 0: Unit that has a backpack (Object) + * Arguments: + * 0: Unit that has a backpack * * Return value: - * Ground wepaon holder with backpack (Object) + * Ground wepaon holder with backpack * + * Public: Yes */ #include "script_component.hpp" -PARAMS_1(_unit); +params ["_unit"]; -private ["_backpackObject","_holder"]; +private ["_backpackObject", "_holder"]; _backpackObject = backpackContainer _unit; -_unit addBackpack "Bag_Base"; + +_unit addBackpack "ACE_FakeBackpack"; removeBackpack _unit; -_holder = objNull; -{ - if (_backpackObject in everyBackpack _x) exitWith { - _holder = _x; - }; -} forEach (position _unit nearObjects ["WeaponHolder", 5]); - -_holder +objectParent _backpackObject // return diff --git a/addons/common/functions/fnc_dumpArray.sqf b/addons/common/functions/fnc_dumpArray.sqf index 8572aaf134..182c542df2 100644 --- a/addons/common/functions/fnc_dumpArray.sqf +++ b/addons/common/functions/fnc_dumpArray.sqf @@ -1,10 +1,21 @@ -//fnc_dumpArray.sqf +/* + * Author: ? + * ? + * + * Arguments: + * 0: Array to be dumped + * 1: Depth + * + * Return Value: + * None + * + * Public: No + */ #include "script_component.hpp" -private ["_pad", "_i", "_x"]; - -PARAMS_2(_var,_depth); +params ["_var", "_depth"]; +private "_pad"; _pad = ""; for "_i" from 0 to _depth do { @@ -14,15 +25,18 @@ for "_i" from 0 to _depth do { _depth = _depth + 1; if (IS_ARRAY(_var)) then { - if ((count _var) > 0) then { - diag_log text format["%1[", _pad]; + if (_var isEqualTo []) then { + diag_log text format ["%1[],", _pad]; + } else { + diag_log text format ["%1[", _pad]; + { [_x, _depth] call FUNC(dumpArray); - } forEach _var; - diag_log text format["%1],", _pad]; - } else { - diag_log text format["%1[],", _pad]; + false + } count _var; + + diag_log text format ["%1],", _pad]; }; } else { - diag_log text format["%1%2", _pad, [_var] call FUNC(formatVar)]; + diag_log text format ["%1%2", _pad, [_var] call FUNC(formatVar)]; }; diff --git a/addons/common/functions/fnc_dumpPerformanceCounters.sqf b/addons/common/functions/fnc_dumpPerformanceCounters.sqf index 0c3d6c8e78..e076831c6f 100644 --- a/addons/common/functions/fnc_dumpPerformanceCounters.sqf +++ b/addons/common/functions/fnc_dumpPerformanceCounters.sqf @@ -1,49 +1,68 @@ -//fnc_dumpPerformanceCounters.sqf -#define DEBUG_MODE_FULL +/* + * Author: ? + * Dumps performance counter statistics into Logs. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Public: No + */ #include "script_component.hpp" +diag_log text format ["REGISTERED ACE PFH HANDLERS"]; +diag_log text format ["-------------------------------------------"]; -diag_log text format["REGISTERED ACE PFH HANDLERS"]; -diag_log text format["-------------------------------------------"]; if (!isNil "ACE_PFH_COUNTER") then { { - private ["_isActive"]; _x params ["_pfh", "_parameters"]; - _isActive = if (!isNil {cba_common_PFHhandles select (_pfh select 0)}) then {"ACTIVE"} else {"REMOVED"}; - diag_log text format["Registered PFH: id=%1 [%2, delay %3], %4:%5", (_pfh select 0), (_isActive), (_parameters select 1), (_pfh select 1), (_pfh select 2) ]; - } forEach ACE_PFH_COUNTER; + + private "_isActive"; + _isActive = ["ACTIVE", "REMOVED"] select isNil {CBA_common_PFHhandles select (_pfh select 0)}; + + diag_log text format ["Registered PFH: id=%1 [%2, delay %3], %4:%5", _pfh select 0, _isActive, _parameters select 1, _pfh select 1, _pfh select 2]; + false + } count ACE_PFH_COUNTER; }; -diag_log text format["ACE COUNTER RESULTS"]; -diag_log text format["-------------------------------------------"]; +diag_log text format ["ACE COUNTER RESULTS"]; +diag_log text format ["-------------------------------------------"]; + { - private ["_counterEntry", "_iter", "_total", "_count", "_delta", "_averageResult"]; + private ["_counterEntry", "_iter", "_total", "_count", "_averageResult", "_delta"]; + _counterEntry = _x; _iter = 0; _total = 0; _count = 0; _averageResult = 0; - if( (count _counterEntry) > 3) then { + + if (count _counterEntry > 3) then { // calc { - if(_iter > 2) then { + if (_iter > 2) then { _count = _count + 1; _delta = (_x select 1) - (_x select 0); _total = _total + _delta; }; + _iter = _iter + 1; - } forEach _counterEntry; - + false + } count _counterEntry; + // results _averageResult = (_total / _count) * 1000; - + // dump results - diag_log text format["%1: Average: %2s / %3 = %4ms", (_counterEntry select 0), _total, _count, _averageResult]; + diag_log text format ["%1: Average: %2s / %3 = %4ms", _counterEntry select 0, _total, _count, _averageResult]; } else { - diag_log text format["%1: No results", (_counterEntry select 0) ]; + diag_log text format ["%1: No results", _counterEntry select 0]; }; -} forEach ACE_COUNTERS; + false +} count ACE_COUNTERS; /* // Dump PFH Trackers @@ -71,4 +90,4 @@ diag_log text format["-------------------------------------------"]; // //} forEach ACRE_EXCESSIVE_FRAME_TRACKER; -*/ \ No newline at end of file +*/ diff --git a/addons/common/functions/fnc_endRadioTransmission.sqf b/addons/common/functions/fnc_endRadioTransmission.sqf index 78a50e9f2c..4597426d67 100644 --- a/addons/common/functions/fnc_endRadioTransmission.sqf +++ b/addons/common/functions/fnc_endRadioTransmission.sqf @@ -4,11 +4,12 @@ * End radio transmissions of addons TFAR and ACRE2. TFAR v0.9.7, ACRE Public Beta 2.0.3.571 * * Arguments: - * None. + * None * * Return Value: - * None. + * None * + * Public: No */ #include "script_component.hpp" diff --git a/addons/common/functions/fnc_eraseCache.sqf b/addons/common/functions/fnc_eraseCache.sqf index 9521bb3630..ae988ced28 100644 --- a/addons/common/functions/fnc_eraseCache.sqf +++ b/addons/common/functions/fnc_eraseCache.sqf @@ -13,6 +13,6 @@ */ #include "script_component.hpp" -PARAMS_2(_namespace,_uid); +params ["_namespace", "_uid"]; _namespace setVariable [_uid, nil]; diff --git a/addons/common/functions/fnc_errorMessage.sqf b/addons/common/functions/fnc_errorMessage.sqf index 3929477e76..f06aa2d30d 100644 --- a/addons/common/functions/fnc_errorMessage.sqf +++ b/addons/common/functions/fnc_errorMessage.sqf @@ -29,11 +29,7 @@ if (isNull (call BIS_fnc_displayMission)) exitWith { }, 1, _this] call CBA_fnc_addPerFrameHandler; }; -private ["_onOK", "_onCancel"]; - -PARAMS_2(_textHeader,_textMessage); -_onOK = ARR_SELECT(_this,2,{}); -_onCancel = ARR_SELECT(_this,3,{}); +params ["_textHeader", "_textMessage", ["_onOK", {}], ["_onCancel", {}]]; if (typeName _textMessage == "STRING") then { _textMessage = parseText _textMessage; diff --git a/addons/common/functions/fnc_execNextFrame.sqf b/addons/common/functions/fnc_execNextFrame.sqf index ddd36be073..7b3f034c6d 100644 --- a/addons/common/functions/fnc_execNextFrame.sqf +++ b/addons/common/functions/fnc_execNextFrame.sqf @@ -1,18 +1,19 @@ /* * Author: esteldunedain - * * Executes a code on the next frame * - * Argument: - * 0: Code to execute (Code) - * 1: Parameters to run the code with (Array) + * Arguments: + * 0: Code to execute + * 1: Parameters to run the code with * - * Return value: - * PFH handler ID + * Return Value: + * PFH handler ID + * + * Public: Yes */ #include "script_component.hpp" -PARAMS_2(_func,_params); +params ["_func", "_params"]; if (diag_frameno != GVAR(nextFrameNo)) then { GVAR(nextFrameBufferA) pushBack [_params, _func]; diff --git a/addons/common/functions/fnc_execPersistentFnc.sqf b/addons/common/functions/fnc_execPersistentFnc.sqf index dd160b8bfd..dc88a7c3c9 100644 --- a/addons/common/functions/fnc_execPersistentFnc.sqf +++ b/addons/common/functions/fnc_execPersistentFnc.sqf @@ -1,29 +1,29 @@ /* * Author: commy2 - * * Execute a function on every machine. Function will also be called upon JIP (postInit). The arguments are stored in (_this select 0), while the assigned namespace is stored in (_this select 1). * - * Argument: - * 0: Function arguments (Array) - * 1: Function to execute, has to be defined on the remote machine first (String) - * 2: Namespace to save that variable in (Object or Namespace) - * 3: Name. Will overwrite previously defined functions with that name (String) + * Arguments: + * 0: Function arguments + * 1: Function to execute, has to be defined on the remote machine first + * 2: Namespace to save that variable in + * 3: Name. Will overwrite previously defined functions with that name * - * Return value: - * Nothing. + * Return Value: + * None + * + * Public: No + * + * Deprecated */ #include "script_component.hpp" -private ["_arguments", "_function", "_unit", "_name"]; - GVAR(remoteFnc) = _this; -_arguments = _this select 0; -_function = call compile (_this select 1); -_unit = _this select 2; -_name = _this select 3; +params ["_arguments", "_function", "_unit", "_name"]; -["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); +_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 1df17050e6..6b617bf92f 100644 --- a/addons/common/functions/fnc_execRemoteFnc.sqf +++ b/addons/common/functions/fnc_execRemoteFnc.sqf @@ -1,35 +1,32 @@ /* * Author: commy2 - * * Execute a function on a remote machine in mp. * - * Argument: - * 0: Function arguments (Array) - * 1: Function to execute, has to be defined on the remote machine first (String) - * 2: The function will be executed where this unit is local OR the mode were this function should be executed. (Object OR Number, optional default: 2) - * Mode 0: execute on this machine only - * Mode 1: execute on server - * Mode 2: execute on all clients + server - * Mode 3: execute on dedicated only + * Arguments: + * 0: Function arguments + * 1: Function to execute, has to be defined on the remote machine first + * 2: The function will be executed where this unit is local OR the mode were this function should be executed. (default: 2) + * 0 = execute on this machine only + * 1 = execute on server + * 2 = execute on all clients + server + * 3 = execute on dedicated only * - * Return value: - * Nothing + * Return Value: + * None + * + * Public: No + * + * Deprecated */ #include "script_component.hpp" -private ["_arguments", "_function", "_unit", "_id"]; - GVAR(remoteFnc) = _this; -_arguments = _this select 0; -_function = call compile (_this select 1); -_unit = _this select 2; +params ["_arguments", "_function", ["_unit", 2]]; -if (isNil "_unit") then { - _unit = 2; -}; +_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); +//["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 { @@ -63,8 +60,7 @@ if (local _unit) then { _arguments call _function; } else { if (isServer) then { - _id = owner _unit; - _id publicVariableClient QGVAR(remoteFnc); + (owner _unit) publicVariableClient QGVAR(remoteFnc); } else { publicVariableServer QGVAR(remoteFnc); }; diff --git a/addons/common/functions/fnc_executePersistent.sqf b/addons/common/functions/fnc_executePersistent.sqf index a11fbb07aa..3763d1bb58 100644 --- a/addons/common/functions/fnc_executePersistent.sqf +++ b/addons/common/functions/fnc_executePersistent.sqf @@ -1,11 +1,22 @@ -// by commy2 +/* + * Author: commy2 + * Execute all Persistent Functions + * + * Arguments: + * ? + * + * Return Value: + * None + * + * Public: No + */ #include "script_component.hpp" -PARAMS_1(_target); +params ["_target"]; { if (isNil "_x") then { - diag_log text format ["[ACE] ERROR: No argument and function for remote function. ID: %1", _forEachIndex]; + ACE_LOGERROR_1("No arguments and function for remote function. ID: %1",_forEachIndex); } else { if (typeName _x == "ARRAY") then { [_x select 0, _target] call (_x select 1); diff --git a/addons/common/functions/fnc_exportConfig.sqf b/addons/common/functions/fnc_exportConfig.sqf index e8370c8f0f..9b28786e43 100644 --- a/addons/common/functions/fnc_exportConfig.sqf +++ b/addons/common/functions/fnc_exportConfig.sqf @@ -1,17 +1,25 @@ -// by commy2 /* - usage: - - (configFile >> "CfgAmmo") call FUNC(exportConfig); -*/ + * Author: commy2 + * Export Config Entrys to RPT logs + * + * Arguments: + * Config Path + * + * Return Value: + * None + * + * Example: + * [configFile >> "CfgAmmo"] call ace_common_fnc_exportConfig; + * + * Public: No + */ #include "script_component.hpp" private "_fnc_logEntries"; - _fnc_logEntries = { - private ["_p", "_t", "_e", "_a", "_i"]; + params ["_c", "_d"]; - PARAMS_2(_c,_d); + private ["_p", "_t", "_e", "_a", "_i"]; _p = inheritsFrom _c; diff --git a/addons/common/functions/fnc_filter.sqf b/addons/common/functions/fnc_filter.sqf index 8d4146faa5..0b30e59cf9 100644 --- a/addons/common/functions/fnc_filter.sqf +++ b/addons/common/functions/fnc_filter.sqf @@ -1,6 +1,5 @@ /* * Author: KoffeinFlummi, commy2 - * * Filters array and removes every element not fitting the condition * * Arguments: @@ -12,22 +11,21 @@ * * Usage: * [[0,1,2,3,4], {_this > 2}] call FUNC(filter) ==> [3,4] + * + * Public: Yes */ #include "script_component.hpp" -private ["_newArray", "_index"]; +params ["_array", "_code"]; -PARAMS_2(_array,_code); +private "_result"; +_result = []; -if (isNil "_array") exitWith { - diag_log text format ["[ACE] ERROR: No array for function filter in %1", _fnc_scriptNameParent]; - [] -}; - -_newArray = []; -for "_index" from 0 to (count _array - 1) do { - if ((_array select _index) call _code) then { - _newArray pushBack (_array select _index); +{ + if (_x call _code) then { + _result pushBack _x; }; -}; -_newArray + false +} count _array; + +_result diff --git a/addons/common/functions/fnc_fixCollision.sqf b/addons/common/functions/fnc_fixCollision.sqf index 6b43cec469..1d55eb1454 100644 --- a/addons/common/functions/fnc_fixCollision.sqf +++ b/addons/common/functions/fnc_fixCollision.sqf @@ -1,13 +1,14 @@ /* * Author: commy2 - * Attempt to fix physx collisions causing unreasonable impact forces and damage. + * Attempt to fix PhysX collisions causing unreasonable impact forces and damage. * * Arguments: - * 0: Object + * Object * * Return Value: - * Nothing + * None * + * Public: No */ #include "script_component.hpp" diff --git a/addons/common/functions/fnc_fixCrateContent.sqf b/addons/common/functions/fnc_fixCrateContent.sqf index ad3ed8e528..a067c29c63 100644 --- a/addons/common/functions/fnc_fixCrateContent.sqf +++ b/addons/common/functions/fnc_fixCrateContent.sqf @@ -1,9 +1,20 @@ -// by commy2 +/* + * Author: commy2 + * Fixes zeus placed crates containing buged mine detectors and ace items. + * + * Arguments: + * 0: Crate + * + * Return Value: + * None + * + * Public: No + */ #include "script_component.hpp" -private ["_weapons", "_items"]; +params ["_crate"]; -PARAMS_1(_crate); +private ["_weapons", "_items"]; // get all weapons inside the crate _weapons = weaponCargo _crate; diff --git a/addons/common/functions/fnc_fixFloating.sqf b/addons/common/functions/fnc_fixFloating.sqf index 6f08af1482..24084d2c11 100644 --- a/addons/common/functions/fnc_fixFloating.sqf +++ b/addons/common/functions/fnc_fixFloating.sqf @@ -3,30 +3,33 @@ * Attempt to fix floating physx with disabled damage after setPosXXX commands. * * Arguments: - * Physx object (Object) + * PhysX object * * Return Value: - * Nothing + * None * + * Public: No */ #include "script_component.hpp" private "_object"; - _object = _this; // setHitPointDamage requires local object if (!local _object) exitWith {}; // save and restore hitpoints, see below why -private ["_hitPoints", "_hitPointDamages"]; +private "_hitPointDamages"; +_hitPointDamages = getAllHitPointsDamage _object; -_hitPoints = [_object] call FUNC(getHitpoints); -_hitPointDamages = [_hitPoints, {_object getHitPointDamage _this}] call FUNC(map); +// get correct format for objects without hitpoints +if (_hitPointDamages isEqualTo []) then { + _hitPointDamages = [[],[],[]]; +}; // this prevents physx objects from floating when near other physx objects with allowDamage false _object setDamage damage _object; { - _object setHitPointDamage [_x, _hitPointDamages select _forEachIndex]; -} forEach _hitPoints; + _object setHitIndex [_forEachIndex, _x]; +} forEach (_hitPointDamages select 2); diff --git a/addons/common/functions/fnc_fixLoweredRifleAnimation.sqf b/addons/common/functions/fnc_fixLoweredRifleAnimation.sqf index f39f85cc94..9e230b00ad 100644 --- a/addons/common/functions/fnc_fixLoweredRifleAnimation.sqf +++ b/addons/common/functions/fnc_fixLoweredRifleAnimation.sqf @@ -15,8 +15,8 @@ */ #include "script_component.hpp" -PARAMS_1(_unit); +params ["_unit"]; -if (currentWeapon _unit != "" && {currentWeapon _unit == primaryWeapon _unit} && {weaponLowered _unit} && {stance _unit == "STAND"} && {(vehicle _unit) == _unit}) then { +if (currentWeapon _unit != "" && {currentWeapon _unit == primaryWeapon _unit} && {weaponLowered _unit} && {stance _unit == "STAND"} && {vehicle _unit == _unit}) then { [_unit, "amovpercmstpsraswrfldnon", 0] call FUNC(doAnimation); }; diff --git a/addons/common/functions/fnc_fixPosition.sqf b/addons/common/functions/fnc_fixPosition.sqf index 32cde87e52..54d0cdfbf6 100644 --- a/addons/common/functions/fnc_fixPosition.sqf +++ b/addons/common/functions/fnc_fixPosition.sqf @@ -4,10 +4,12 @@ * Fixes position of an object. E.g. moves object above ground and adjusts to terrain slope. Requires local object. * * Argument: - * Object (Object) + * Object * - * Return value: - * NONE + * Return Value: + * None + * + * Public: No */ #include "script_component.hpp" diff --git a/addons/common/functions/fnc_getAllDefinedSetVariables.sqf b/addons/common/functions/fnc_getAllDefinedSetVariables.sqf index 2163accae2..18c8a18c72 100644 --- a/addons/common/functions/fnc_getAllDefinedSetVariables.sqf +++ b/addons/common/functions/fnc_getAllDefinedSetVariables.sqf @@ -1,30 +1,40 @@ -/** - * fn_getAllSetVariables.sqf - * @Descr: Returns an 2d array of all variables that have been set on the object - * @Author: Glowbal +/* + * Author: Glowbal + * Returns an 2d array of all variables that have been set on the object * - * @Arguments: [unit OBJECT, category STRING (Optional. Only get the variables from the specified category. Default is "" == all)] - * @Return: ARRAY REturns an array with the format [ [name STRING, typeName STRING, value ANY, publicFlag BOOL, peristentFlag BOOL] ] - * @PublicAPI: true + * Arguments: + * 0: Unit + * 1: Limiting Category (default: "") + * + * Return Value: + * Variable Data + * 0: Name + * 1: typeName + * 2: value + * 3: publicFlag + * 4: peristentFlag + * + * Public: Yes */ - #include "script_component.hpp" -private ["_return", "_val", "_category"]; -PARAMS_1(_object); -_category = if (count _this > 1) then { _this select 1 } else { "" }; +params ["_object", ["_category", ""]]; -if (isnil QGVAR(OBJECT_VARIABLES_STORAGE)) exitwith { - []; -}; +if (isNil QGVAR(OBJECT_VARIABLES_STORAGE)) exitwith {[]}; + +private ["_return", "_val"]; _return = []; + { _val = _object getvariable (_x select 0); - if (!isnil "_val") then { + + if (!isNil "_val") then { if (_category == "" || _category == _x select 3) then { - _return pushback [_x select 0, typeName _val, _val, _x select 2, _x select 5]; + _return pushBack [_x select 0, typeName _val, _val, _x select 2, _x select 5]; }; }; -}foreach GVAR(OBJECT_VARIABLES_STORAGE); -_return \ No newline at end of file + false +} count GVAR(OBJECT_VARIABLES_STORAGE); + +_return diff --git a/addons/common/functions/fnc_getAllGear.sqf b/addons/common/functions/fnc_getAllGear.sqf index aa2289309e..715966b176 100644 --- a/addons/common/functions/fnc_getAllGear.sqf +++ b/addons/common/functions/fnc_getAllGear.sqf @@ -1,28 +1,39 @@ /* * Author: bux578, commy2 - * * Returns an array containing all items of a given unit * - * Argument: - * 0: Unit (Object) + * Arguments: + * 0: Unit * - * Return value: - * Array with all the gear, format: - * 0: headgear (String) - * 1: goggles (String) - * 2,3: uniform (String, Array) - * 4,5: vest (String, Array) - * 6,7: backpack (String, Array) - * 8-10: rifle (String, Array, Array) - * 11-13: launcher (String, Array, Array) - * 14-16: pistol (String, Array, Array) - * 17: map, compass, watch, etc. (Array) - * 18: binocluar (String) + * Return Value: + * 0: Headgear + * 1: Goggles + * 2: Uniform + * 3: Uniform Items + * 4: Vest + * 5: Vest Items + * 6: Backback + * 7: Backpack Items + * 8: Rifle + * 9: Rifle Items + * 10: Rifle Magazines + * 11: Launcher + * 12: Launcher Items + * 13: Launcher Magazines + * 14: Handgun + * 15: Handgun Items + * 16: Handgun Magazines + * 17: Assigned Items (map, compass, watch, etc.) + * 18: Binoculars + * 19: Binocular Magazine (E.g. Laserbatteries) * + * Public: Yes + * + * Note: Element 17 includes the Head Mounted Display (HMD) */ #include "script_component.hpp" -PARAMS_1(_unit); +params ["_unit"]; if (isNull _unit) exitWith {[ "", @@ -34,6 +45,7 @@ if (isNull _unit) exitWith {[ "", ["","","",""], [], "", ["","","",""], [], [], + "", "" ]}; @@ -47,5 +59,6 @@ if (isNull _unit) exitWith {[ secondaryWeapon _unit, secondaryWeaponItems _unit, secondaryWeaponMagazine _unit, handgunWeapon _unit, handgunItems _unit, handgunMagazine _unit, assignedItems _unit, - binocular _unit + binocular _unit, + [_unit] call FUNC(binocularMagazine) ] diff --git a/addons/common/functions/fnc_getCaptivityStatus.sqf b/addons/common/functions/fnc_getCaptivityStatus.sqf index 50aeeced3a..36bf0ff183 100644 --- a/addons/common/functions/fnc_getCaptivityStatus.sqf +++ b/addons/common/functions/fnc_getCaptivityStatus.sqf @@ -1,25 +1,27 @@ /* * Author: commy2 - * * Return the captivity status of an unit. * - * Argument: - * 0: Unit (Object) + * Arguments: + * 0: Unit * - * Return value: - * Reasons, why the unit is a captive. An empty array is returned if the unit is not a captive (Array of Strings) + * Return Value: + * Captivity Reasons, empty if not captive + * + * Public: Yes */ #include "script_component.hpp" -private ["_captivityReasons", "_unitCaptivityStatus", "_unitCaptivityReasons"]; +params ["_unit"]; -PARAMS_1(_unit); +private ["_captivityReasons", "_unitCaptivityStatus", "_unitCaptivityReasons"]; _captivityReasons = missionNamespace getVariable ["ACE_captivityReasons", []]; _unitCaptivityStatus = [captiveNum _unit, count _captivityReasons] call FUNC(binarizeNumber); _unitCaptivityReasons = []; + { if (_unitCaptivityStatus select _forEachIndex) then { _unitCaptivityReasons pushBack _x; diff --git a/addons/common/functions/fnc_getChildren.sqf b/addons/common/functions/fnc_getChildren.sqf index d28ba7cb70..d5212dd9a5 100644 --- a/addons/common/functions/fnc_getChildren.sqf +++ b/addons/common/functions/fnc_getChildren.sqf @@ -1,10 +1,20 @@ -// by commy2 +/* + * Author: commy2 + * Obtain children of a config entry + * + * Arguments: + * 0: Unit + * + * Return Value: + * Parent Entry Class Children + * + * Public: Yes + */ #include "script_component.hpp" -private ["_classes"]; - -PARAMS_2(_name,_cfgClass); +params ["_name", "_cfgClass"]; +private "_classes"; _classes = format ["configName inheritsFrom _x == '%1'", _name] configClasses (configFile >> _cfgClass); -_classes = [_classes, {configName _this}] call FUNC(map); -_classes + +[_classes, {configName _this}] call FUNC(map) // return diff --git a/addons/common/functions/fnc_getConfigCommander.sqf b/addons/common/functions/fnc_getConfigCommander.sqf index 44f02cbeb1..bfa5fbc379 100644 --- a/addons/common/functions/fnc_getConfigCommander.sqf +++ b/addons/common/functions/fnc_getConfigCommander.sqf @@ -1,21 +1,22 @@ /* * Author: commy2 - * * Get the commander config of a vehicles turret. * - * Argument: - * 0: vehicle (Object) + * Arguments: + * 0: vehicle * - * Return value: - * Commander config (Config) + * Return Value: + * Commander config + * + * Public: Yes */ #include "script_component.hpp" -private ["_config", "_turret"]; +params ["_vehicle"]; -PARAMS_1(_vehicle); +private ["_config", "_turret"]; _config = configFile >> "CfgVehicles" >> typeOf _vehicle; _turret = [_vehicle] call FUNC(getTurretCommander); -[_config, _turret] call FUNC(getTurretConfigPath) +[_config, _turret] call FUNC(getTurretConfigPath) // return diff --git a/addons/common/functions/fnc_getConfigGunner.sqf b/addons/common/functions/fnc_getConfigGunner.sqf index a28491bfff..bc3131d798 100644 --- a/addons/common/functions/fnc_getConfigGunner.sqf +++ b/addons/common/functions/fnc_getConfigGunner.sqf @@ -1,21 +1,22 @@ /* * Author: commy2 - * * Get the gunner config of a vehicles turret. * - * Argument: - * 0: vehicle (Object) + * Arguments: + * 0: vehicle * - * Return value: - * Gunner config (Config) + * Return Value: + * Gunner config + * + * Public: Yes */ #include "script_component.hpp" -private ["_config", "_turret"]; +params ["_vehicle"]; -PARAMS_1(_vehicle); +private ["_config", "_turret"]; _config = configFile >> "CfgVehicles" >> typeOf _vehicle; _turret = [_vehicle] call FUNC(getTurretGunner); -[_config, _turret] call FUNC(getTurretConfigPath) +[_config, _turret] call FUNC(getTurretConfigPath) // return diff --git a/addons/common/functions/fnc_getConfigType.sqf b/addons/common/functions/fnc_getConfigType.sqf index b2d601c121..1496cfa2b9 100644 --- a/addons/common/functions/fnc_getConfigType.sqf +++ b/addons/common/functions/fnc_getConfigType.sqf @@ -1,17 +1,18 @@ /* * Author: commy2 + * Determins type of item. Can be CfgMagaines, CfgWeapons or CfgGlasses. * - * What kind of Cfg is the item. Works for CfgMagaines, CfgWeapons and CfgGlasses + * Arguments: + * 0: Item Classname * - * Argument: - * 0: A item's classname. (String) + * Return Value: + * Config category ("CfgWeapons", "CfgMagazines", "CfgGlasses", "") * - * Return value: - * CfgWhatever (String) + * Public: Yes */ #include "script_component.hpp" -PARAMS_1(_item); +params ["_item"]; if (isClass (configFile >> "CfgWeapons" >> _item)) exitWith {"CfgWeapons"}; diff --git a/addons/common/functions/fnc_getConfigTypeObject.sqf b/addons/common/functions/fnc_getConfigTypeObject.sqf index ef39ce22c7..6186ad6bff 100644 --- a/addons/common/functions/fnc_getConfigTypeObject.sqf +++ b/addons/common/functions/fnc_getConfigTypeObject.sqf @@ -1,17 +1,18 @@ /* * Author: commy2 + * Determins type of object. Can be CfgVehicles or CfgAmmo. * - * What kind of Cfg is the object. Works for CfgVehicles and CfgAmmo + * Arguments: + * 0: Object classname * - * Argument: - * 0: An object's classname. (String) + * Return Value: + * Config category ("CfgWeapons", "Cfgmagazines", "CfgGlasses", "") * - * Return value: - * CfgWhatever (String) + * Public: Yes */ #include "script_component.hpp" -PARAMS_1(_object); +params ["_object"]; if (isClass (configFile >> "CfgVehicles" >> _object)) exitWith {"CfgVehicles"}; diff --git a/addons/common/functions/fnc_getDeathAnim.sqf b/addons/common/functions/fnc_getDeathAnim.sqf index 539c8d2616..c88f89d35f 100644 --- a/addons/common/functions/fnc_getDeathAnim.sqf +++ b/addons/common/functions/fnc_getDeathAnim.sqf @@ -9,35 +9,38 @@ * animation * * Example: - * [bob] call ace_common_fnc_getDeathAnim; + * [bob] call ace_common_fnc_getDeathAnim * * Public: No */ #include "script_component.hpp" -PARAMS_1(_unit); +params ["_unit"]; -private ["_returnAnimation", "_animationState", "_unitAnimationCfg", "_unitActionsCfg", "_interpolateArray", "_indexAnimation", "_index"]; +private ["_returnAnimation", "_animationState", "_unitAnimationCfg", "_unitActionsCfg", "_interpolateArray", "_indexAnimation"]; _returnAnimation = ""; -_animationState = (animationState _unit); -_unitAnimationCfg = (configFile >> "CfgMovesMaleSdr" >> "States" >> _animationState); -//If we're already in a terminal animation just return current -if ((getNumber (_unitAnimationCfg >> "terminal")) == 1) exitWith {_animationState}; +_animationState = animationState _unit; +_unitAnimationCfg = configFile >> "CfgMovesMaleSdr" >> "States" >> _animationState; -_unitActionsCfg = (configFile >> "CfgMovesBasic" >> "Actions" >> (getText (_unitAnimationCfg >> "actions"))); +//If we're already in a terminal animation just return current +if (getNumber (_unitAnimationCfg >> "terminal") == 1) exitWith {_animationState}; + +_unitActionsCfg = configFile >> "CfgMovesBasic" >> "Actions" >> getText (_unitAnimationCfg >> "actions"); TRACE_2("Animation/Action", configName _unitAnimationCfg, configName _unitActionsCfg); -if ((vehicle _unit) != _unit) then { +if (vehicle _unit != _unit) then { _interpolateArray = getArray (_unitAnimationCfg >> "interpolateTo"); + for "_index" from 0 to (count _interpolateArray - 1) step 2 do { _indexAnimation = _interpolateArray select _index; + //No guarentee that first animation will be right so scan for the first "terminal" animation //E.G.: interpolateTo[] = {"passenger_apc_generic04still",1,"KIA_passenger_apc_generic04",1}; - if ((getNumber ((configFile >> "CfgMovesMaleSdr" >> "States" >> _indexAnimation) >> "terminal")) == 1) exitWith { + if (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> _indexAnimation >> "terminal") == 1) exitWith { _returnAnimation = _indexAnimation; }; }; diff --git a/addons/common/functions/fnc_getDefaultAnim.sqf b/addons/common/functions/fnc_getDefaultAnim.sqf index fbcca2712e..372a2424eb 100644 --- a/addons/common/functions/fnc_getDefaultAnim.sqf +++ b/addons/common/functions/fnc_getDefaultAnim.sqf @@ -1,29 +1,47 @@ -// by commy2 +/* + * Author: commy2 + * Get the Defualt animation for the unit + * + * Arguments: + * 0: unit + * + * Return Value: + * animation + * + * Example: + * [bob] call ace_common_fnc_getDefaultAnim; + * + * Public: No + */ #include "script_component.hpp" +params ["_unit"]; + private ["_anim", "_stance"]; -PARAMS_1(_unit); -_anim = toLower (animationState _unit); +_anim = toLower animationState _unit; // stance is broken for some animations. _stance = stance _unit; + if (_anim find "ppne" == 4) then { - _stance = "PRONE"; + _stance = "PRONE"; }; + if (_anim find "pknl" == 4) then { - _stance = "CROUCH"; + _stance = "CROUCH"; }; + if (_anim find "perc" == 4) then { - _stance = "STAND"; + _stance = "STAND"; }; _anim = format ["AmovP%1M%2S%3W%4D%5", - ["erc", "knl", "pne"] select (["STAND", "CROUCH", "PRONE"] find _stance) max 0, - ["stp", "run"] select (vectorMagnitude velocity _unit > 1), - [["ras", "low"] select weaponLowered _unit, "non"] select (currentWeapon _unit == ""), - ["non", "rfl", "lnr", "pst", "bin"] select (["", primaryWeapon _unit, secondaryWeapon _unit, handgunWeapon _unit, binocular _unit] find currentWeapon _unit) max 0, - ["non", _anim select [count _anim - 1, 1]] select (_anim select [count _anim - 2, 2] in ["df", "db", "dl", "dr"]) + ["erc", "knl", "pne"] select (["STAND", "CROUCH", "PRONE"] find _stance) max 0, + ["stp", "run"] select (vectorMagnitude velocity _unit > 1), + [["ras", "low"] select weaponLowered _unit, "non"] select (currentWeapon _unit == ""), + ["non", "rfl", "lnr", "pst", "bin"] select (["", primaryWeapon _unit, secondaryWeapon _unit, handgunWeapon _unit, binocular _unit] find currentWeapon _unit) max 0, + ["non", _anim select [count _anim - 1, 1]] select (_anim select [count _anim - 2, 2] in ["df", "db", "dl", "dr"]) ]; ["", _anim] select isClass (configFile >> "CfgMovesMaleSdr" >> "States" >> _anim) diff --git a/addons/common/functions/fnc_getDefinedVariable.sqf b/addons/common/functions/fnc_getDefinedVariable.sqf index 6c10c4f682..c0d7ce8d83 100644 --- a/addons/common/functions/fnc_getDefinedVariable.sqf +++ b/addons/common/functions/fnc_getDefinedVariable.sqf @@ -1,33 +1,38 @@ -/** - * fn_getVariable.sqf - * @Descr: Grabs a variable. If variable has not been set, attempts to use default defined value - * @Author: Glowbal +/* + * Author: Glowbal + * Grabs a variable. If variable has not been set, attempts to use default defined value * - * @Arguments: [unit OBJECT, variableName STRING] - * @Return: ANY - * @PublicAPI: true + * Arguments: + * 0: unit + * 1: Variable Name + * + * Return Value: + * Value of variable or default value, if the variable is undefined + * + * Public: No */ - #include "script_component.hpp" -#define UNIT (_this select 0) -#define VARIABLE (_this select 1) +params ["_unit", "_variable", "_defaultValue"]; private "_value"; +_value = _unit getvariable _variable; -_value = UNIT getvariable VARIABLE; -if (isnil "_value") then { - if (count _this >2) then { - _value = _this select 2; +if (isNil "_value") then { + if (!isNil "_defaultValue") then { + _value = _defaultValue; } else { private "_definedVariable"; - _definedVariable = ([VARIABLE] call FUNC(getDefinedVariableInfo)); + _definedVariable = [_variable] call FUNC(getDefinedVariableInfo); + if (count _definedVariable > 1) then { _value = _definedVariable select 1; }; }; - if (isnil "_value") then { + + if (isNil "_value") then { _value = 0; }; }; -_value \ No newline at end of file + +_value diff --git a/addons/common/functions/fnc_getDefinedVariableDefault.sqf b/addons/common/functions/fnc_getDefinedVariableDefault.sqf index cd4e4f08f2..4bb4b12253 100644 --- a/addons/common/functions/fnc_getDefinedVariableDefault.sqf +++ b/addons/common/functions/fnc_getDefinedVariableDefault.sqf @@ -1,19 +1,24 @@ -/** - * fn_getvariableDefault.sqf - * @Descr: Get the variable default value - * @Author: Glowbal +/* + * Author: Glowbal + * Get the variable default value * - * @Arguments: [variableName STRING] - * @Return: ANY - * @PublicAPI: true + * Arguments: + * 0: Variable Name + * + * Return Value: + * Default value of variable + * + * Public: Yes */ - #include "script_component.hpp" +params ["_varName"]; + private "_variableDefinition"; -_variableDefinition = ([_this select 0] call FUNC(getDefinedVariableInfo)); -if (count _variableDefinition > 0) exitwith { +_variableDefinition = [_varName] call FUNC(getDefinedVariableInfo); + +if !(_variableDefinition isEqualTo []) exitwith { _variableDefinition select 1; }; -nil; \ No newline at end of file +nil diff --git a/addons/common/functions/fnc_getDefinedVariableInfo.sqf b/addons/common/functions/fnc_getDefinedVariableInfo.sqf index 03b50b0649..adcb70c6ee 100644 --- a/addons/common/functions/fnc_getDefinedVariableInfo.sqf +++ b/addons/common/functions/fnc_getDefinedVariableInfo.sqf @@ -1,12 +1,17 @@ -/** - * fn_getvariableInfo.sqf - * @Descr: N/A - * @Author: Glowbal +/* + * Author: Glowbal + * Get the variable Informations * - * @Arguments: [] - * @Return: - * @PublicAPI: false + * Arguments: + * 0: Variable Name + * + * Return Value: + * Variable Metadata + * + * Public: No */ - #include "script_component.hpp" -+(missionNamespace getvariable [QGVAR(OBJECT_VARIABLES_STORAGE_) + (_this select 0),[]]) + +params ["_varName"]; + ++ (missionNamespace getVariable [format [QGVAR(OBJECT_VARIABLES_STORAGE_%1), _varName], []]) diff --git a/addons/common/functions/fnc_getDisplayConfigName.sqf b/addons/common/functions/fnc_getDisplayConfigName.sqf index 92b6700238..7a0d9ffa95 100644 --- a/addons/common/functions/fnc_getDisplayConfigName.sqf +++ b/addons/common/functions/fnc_getDisplayConfigName.sqf @@ -1,15 +1,31 @@ -// by commy2 +/* + * Author: commy2 + * Get display classnames from config with given idd. + * + * Arguments: + * 0: Display ID (idd) + * + * Return Value: + * Display Classnames + * + * Public: Yes + * + * Note: Really slow due to iteration through whole config. Meant for debugging. + */ #include "script_component.hpp" -private ["_configName", "_index", "_config"]; +params ["_idd"]; -_configName = ""; +private ["_configNames", "_config"]; + +_configNames = []; for "_index" from 0 to (count configFile - 1) do { _config = configFile select _index; - if (isClass _config && {isNumber (_config >> "idd")} && {getNumber (_config >> "idd") == _this}) exitWith { - _configName = configName _config; + + if (isClass _config && {isNumber (_config >> "idd")} && {getNumber (_config >> "idd") == _idd}) then { + _configNames pushBack configName _config; }; }; -_configName +_configNames diff --git a/addons/common/functions/fnc_getDoorTurrets.sqf b/addons/common/functions/fnc_getDoorTurrets.sqf index f304c1714c..cab259a214 100644 --- a/addons/common/functions/fnc_getDoorTurrets.sqf +++ b/addons/common/functions/fnc_getDoorTurrets.sqf @@ -1,19 +1,20 @@ /* * Author: bux578 + * Returns all turret indecies of door gunners. * - * Gets the turret index of door gunners + * Arguments: + * 0: Vehicle * - * Argument: - * 0: Vehicle (Object) + * Return Value: + * All turret indecies of the Vehicle * - * Return value: - * Turret indexes of the door gunner. Empty array means no gunner position. (Array) + * Public: Yes */ #include "script_component.hpp" -private ["_turrets", "_doorTurrets", "_config"]; +params ["_vehicle"]; -PARAMS_1(_vehicle); +private ["_turrets", "_doorTurrets", "_config"]; _turrets = allTurrets [_vehicle, true]; @@ -21,11 +22,13 @@ _doorTurrets = []; { _config = configFile >> "CfgVehicles" >> typeOf _vehicle; + _config = [_config, _x] call FUNC(getTurretConfigPath); - if ((getNumber (_config >> "isCopilot") == 0) && count (getArray (_config >> "weapons")) > 0 ) then { + if (getNumber (_config >> "isCopilot" == 0) && {count getArray (_config >> "weapons") > 0}) then { _doorTurrets pushBack _x; }; -} forEach _turrets; + false +} count _turrets; _doorTurrets diff --git a/addons/common/functions/fnc_getFirstObjectIntersection.sqf b/addons/common/functions/fnc_getFirstObjectIntersection.sqf index 3a99f244ed..1111094ed0 100644 --- a/addons/common/functions/fnc_getFirstObjectIntersection.sqf +++ b/addons/common/functions/fnc_getFirstObjectIntersection.sqf @@ -1,23 +1,31 @@ -/** - * fn_getFirstIntersection.sqf - * @Descr: Returns the the first intersection with an object between two positions - * @Author: Ruthberg +/* + * Author: Ruthberg + * Returns the the first intersection with terrain between two positions. @todo rewrite using lineIntersectsSurfaces? * - * @Arguments: [position PositionASL, position PositionASL, accuracy FLOAT] - * @Return: [intersects BOOL, intersection PositionASL] - * @PublicAPI: true + * Arguments: + * 0: PositionASL + * 1: PositionATL + * 2: Accuracy + * + * Return Value: + * 0: Intersects + * 1: Intersection Position ASL + * + * Public: Yes */ - #include "script_component.hpp" +#include "script_component.hpp" -private ["_distance", "_lower", "_upper", "_mid", "_intersections", "_result", "_dir"]; +params ["_source", "_destination", "_accuracy"]; -PARAMS_3(_source,_destination,_accuracy); +private ["_result", "_distance"]; _result = [false, [0, 0, 0]]; _distance = _source vectorDistance _destination; -if (count (lineIntersectsWith [_source, _destination]) > 0) then { +if !(lineIntersectsWith [_source, _destination] isEqualTo []) then { + private ["_lower", "_upper", "_mid", "_dir"]; + _lower = 0; _upper = 1; _mid = 0.5; @@ -27,9 +35,7 @@ if (count (lineIntersectsWith [_source, _destination]) > 0) then { while {(_upper - _lower) * _distance > _accuracy} do { _mid = _lower + (_upper - _lower) / 2; - _intersections = count (lineIntersectsWith [_source, _source vectorAdd (_dir vectorMultiply (_mid * _distance))]); - - if (_intersections > 0) then { + if !(lineIntersectsWith [_source, _source vectorAdd (_dir vectorMultiply (_mid * _distance))] isEqualTo []) then { _upper = _mid; } else { _lower = _mid; diff --git a/addons/common/functions/fnc_getFirstTerrainIntersection.sqf b/addons/common/functions/fnc_getFirstTerrainIntersection.sqf index 2fe8242c15..a5065413d9 100644 --- a/addons/common/functions/fnc_getFirstTerrainIntersection.sqf +++ b/addons/common/functions/fnc_getFirstTerrainIntersection.sqf @@ -1,23 +1,31 @@ -/** - * fn_getFirstIntersection.sqf - * @Descr: Returns the the first intersection with an object between two positions - * @Author: Ruthberg +/* + * Author: Ruthberg + * Returns the the first intersection with an object between two positions. @todo rewrite using lineIntersectsSurfaces? * - * @Arguments: [position PositionASL, position PositionASL, accuracy FLOAT] - * @Return: [intersects BOOL, intersection PositionASL] - * @PublicAPI: true + * Arguments: + * 0: PositionASL + * 1: PositionATL + * 2: Accuracy + * + * Return Value: + * 0: Intersects + * 1: Intersection Position ASL + * + * Public: Yes */ #include "script_component.hpp" -private ["_distance", "_lower", "_upper", "_mid", "_intersection", "_result", "_dir"]; +params ["_source", "_destination", "_accuracy"]; -PARAMS_3(_source,_destination,_accuracy); +private ["_result", "_distance"]; _result = [false, [0, 0, 0]]; _distance = _source vectorDistance _destination; if (terrainIntersectASL [_source, _destination]) then { + private ["_lower", "_upper", "_mid", "_dir"]; + _lower = 0; _upper = 1; _mid = 0.5; @@ -27,9 +35,7 @@ if (terrainIntersectASL [_source, _destination]) then { while {(_upper - _lower) * _distance > _accuracy} do { _mid = _lower + (_upper - _lower) / 2; - _intersection = terrainIntersectASL [_source, _source vectorAdd (_dir vectorMultiply (_mid * _distance))]; - - if (_intersection) then { + if (terrainIntersectASL [_source, _source vectorAdd (_dir vectorMultiply (_mid * _distance))]) then { _upper = _mid; } else { _lower = _mid; diff --git a/addons/common/functions/fnc_getForceWalkStatus.sqf b/addons/common/functions/fnc_getForceWalkStatus.sqf index dbab640d86..acdc2f1a05 100644 --- a/addons/common/functions/fnc_getForceWalkStatus.sqf +++ b/addons/common/functions/fnc_getForceWalkStatus.sqf @@ -1,25 +1,23 @@ /* -Name: FUNC(getForceWalkStatus) - -Author: Pabst Mirror (from captivity by commy2) - -Description: - Returns reasons why the unit is forceWalk-ing, empty if not forced. - -Parameters: - 0: OBJECT - Unit - -Returns: - ARRAY(of strings) - Reason why the unit is force walking - -Example: - [ACE_Player] call FUNC(getForceWalkStatus) -*/ + * Author: PabstMirror, commy2 + * Returns reasons why the unit is forceWalk-ing. + * + * Arguments: + * 0: unit + * + * Return Value: + * Force Walk reasons + * + * Example: + * [ACE_Player] call ace_common_fnc_getForceWalkStatus + * + * Public: Yes + */ #include "script_component.hpp" -private ["_forceWalkReasons", "_unitForceWalkNumber", "_unitForceWalkStatus", "_unitForceWalkReasons"]; +params ["_unit"]; -PARAMS_1(_unit); +private ["_forceWalkReasons", "_unitForceWalkNumber", "_unitForceWalkStatus", "_unitForceWalkReasons"]; _forceWalkReasons = missionNamespace getVariable ["ACE_forceWalkReasons", []]; @@ -28,6 +26,7 @@ _unitForceWalkNumber = _unit getVariable ["ACE_forceWalkStatusNumber", 0]; _unitForceWalkStatus = [_unitForceWalkNumber, count _forceWalkReasons] call FUNC(binarizeNumber); _unitForceWalkReasons = []; + { if (_unitForceWalkStatus select _forEachIndex) then { _unitForceWalkReasons pushBack _x; diff --git a/addons/common/functions/fnc_getGunner.sqf b/addons/common/functions/fnc_getGunner.sqf index ce73019f70..dac42ce535 100644 --- a/addons/common/functions/fnc_getGunner.sqf +++ b/addons/common/functions/fnc_getGunner.sqf @@ -1,20 +1,19 @@ /* * Author: commy2 + * Returns gunner using specified weapon type in vehicle. Only works if all turrets have different weapons. * - * Get the gunner of a vehicle who uses the given weapon type. Requires every turret to have a different weapon. + * Arguments: + * 0: Vehicle + * 1: Weapon * - * Argument: - * 0: The vehicle (Object) - * 1: weapon of the vehicle (String) + * Return Value: + * Gunner * - * Return value: - * The turret gunner with this weapon (Object) + * Public: Yes */ +#include "script_component.hpp" -private ["_vehicle", "_weapon"]; - -_vehicle = _this select 0; -_weapon = _this select 1; +params ["_vehicle", "_weapon"]; // on foot if (gunner _vehicle == _vehicle && {_weapon in weapons _vehicle || {toLower _weapon in ["throw", "put"]}}) exitWith {gunner _vehicle}; @@ -27,11 +26,12 @@ _gunner = objNull; if (_weapon in (_vehicle weaponsTurret _x)) exitWith { _gunner = _vehicle turretUnit _x; }; -} forEach allTurrets [_vehicle, true]; + false +} count allTurrets [_vehicle, true]; // ensure that at least the pilot is returned if there is no gunner if (isManualFire _vehicle && {isNull _gunner}) then { - _gunner = driver _vehicle; + _gunner = driver _vehicle; }; -_gunner \ No newline at end of file +_gunner diff --git a/addons/common/functions/fnc_getHitPoints.sqf b/addons/common/functions/fnc_getHitPoints.sqf index 06b2b8d40b..84099b659a 100644 --- a/addons/common/functions/fnc_getHitPoints.sqf +++ b/addons/common/functions/fnc_getHitPoints.sqf @@ -1,56 +1,29 @@ /* * Author: commy2 - * - * Returns all hitpoints of any vehicle. Non unique hitpoints in turrets are ignored. + * Returns all hitpoints and their selections of any vehicle. Might contain duplicates if the turrets contain non unique hitpoints with different selection names. * * Arguments: - * 0: A vehicle, not the classname (Object) + * 0: Vehicle * * Return Value: - * The hitpoints (Array) + * Hitpoints + * + * Public: Yes + * + * Deprecated */ #include "script_component.hpp" -private ["_config", "_hitpoints", "_i"]; +ACE_DEPRECATED("ace_common_fnc_getHitPoints","3.5.0","getAllHitPointsDamage"); -PARAMS_1(_vehicle); +params ["_vehicle"]; -_config = configFile >> "CfgVehicles" >> typeOf _vehicle; +private "_hitPointsWithSelections"; +_hitPointsWithSelections = getAllHitPointsDamage _vehicle; -_hitpoints = []; +// get correct format on vehicles without any hitpoints +if (_hitPointsWithSelections isEqualTo []) then { + _hitPointsWithSelections = [[],[],[]]; +}; -// get all classes that can contain hitpoints -private "_hitpointClasses"; -_hitpointClasses = [_config >> "HitPoints"]; -{ - private "_class"; - _class = ([_config, _x] call FUNC(getTurretConfigPath)) >> "HitPoints"; - - if (isClass _class) then { - _hitpointClasses pushBack _class; - }; - -} forEach allTurrets _vehicle; - -// iterate through all classes with hitpoints and their parents -{ - private "_class"; - _class = _x; - - while {isClass _class} do { - - for "_i" from 0 to (count _class - 1) do { - private "_entry"; - _entry = configName (_class select _i); - - if (!(_entry in _hitpoints) && {!isNil {_vehicle getHitPointDamage _entry}}) then { - _hitpoints pushBack _entry; - }; - }; - - _class = inheritsFrom _class; - }; - -} forEach _hitpointClasses; - -_hitpoints +(_hitPointsWithSelections select 0) - [""] diff --git a/addons/common/functions/fnc_getHitPointsWithSelections.sqf b/addons/common/functions/fnc_getHitPointsWithSelections.sqf index 2bf568ec8a..b0b9867cf7 100644 --- a/addons/common/functions/fnc_getHitPointsWithSelections.sqf +++ b/addons/common/functions/fnc_getHitPointsWithSelections.sqf @@ -1,60 +1,32 @@ /* * Author: commy2 - * - * Returns all hitpoints and their selections of any vehicle. Might contain duplicates if the turrets contain non unique hitpoints with different selection names. + * Returns all hitpoints and their respective selections of any vehicle. Might contain duplicates for non unique hitpoints in turrets. * * Arguments: - * 0: A vehicle, not the classname (Object) + * 0: Vehicle * * Return Value: - * The hitpoints with selections. Format: [hitpoints, selections]. They correspond by index. (Array) + * 0: Hitpoints + * 1: Selections + * + * Public: Yes + * + * Deprecated */ #include "script_component.hpp" -private ["_config", "_hitpoints", "_selections", "_i"]; +ACE_DEPRECATED("ace_common_fnc_getHitPointsWithSelections","3.5.0","getAllHitPointsDamage"); -PARAMS_1(_vehicle); +params ["_vehicle"]; -_config = configFile >> "CfgVehicles" >> typeOf _vehicle; +private "_hitPointsWithSelections"; +_hitPointsWithSelections = getAllHitPointsDamage _vehicle; -_hitpoints = []; -_selections = []; +// get correct format on vehicles without any hitpoints +if (_hitPointsWithSelections isEqualTo []) then { + _hitPointsWithSelections = [[],[],[]]; +}; -// get all classes that can contain hitpoints -private "_hitpointClasses"; -_hitpointClasses = [_config >> "HitPoints"]; -{ - private "_class"; - _class = ([_config, _x] call FUNC(getTurretConfigPath)) >> "HitPoints"; +_hitPointsWithSelections resize 2; - if (isClass _class) then { - _hitpointClasses pushBack _class; - }; - -} forEach allTurrets _vehicle; - -// iterate through all classes with hitpoints and their parents -{ - private "_class"; - _class = _x; - - while {isClass _class} do { - - for "_i" from 0 to (count _class - 1) do { - private ["_entry", "_selection"]; - - _entry = configName (_class select _i); - _selection = getText (_class select _i >> "name"); - - if (!(_selection in _selections) && {!isNil {_vehicle getHit _selection}}) then { - _hitpoints pushBack _entry; - _selections pushBack _selection; - }; - }; - - _class = inheritsFrom _class; - }; - -} forEach _hitpointClasses; - -[_hitpoints, _selections] +_hitPointsWithSelections diff --git a/addons/common/functions/fnc_getInPosition.sqf b/addons/common/functions/fnc_getInPosition.sqf index d80c387b5d..dc3ad38cde 100644 --- a/addons/common/functions/fnc_getInPosition.sqf +++ b/addons/common/functions/fnc_getInPosition.sqf @@ -1,31 +1,26 @@ /* * Author: commy2 + * Move unit into given vehicle position or switch to that position if the unit is already inside the vehicle. + * + * Arguments: + * 0: Unit + * 1: Vehicle + * 2: Position ("Driver", "Pilot", "Gunner", "Commander", "Copilot", "Turret", "FFV", "Codriver", "Cargo") + * 3: Index (only applies to "Turret", "FFV", "Codriver", "Cargo") (default: next free index) + * + * Return Value: + * None * - * Move unit into given vehicle position. Or switch to that position if the unit is already inside the vehicle. - * - * Arguments: - * 0: Unit to enter the vehicle (Object) - * 1: The vehicle to be entered (Object) - * 2: Position. Can be "Driver", "Pilot", "Gunner", "Commander", "Copilot", "Turret", "FFV", "Codriver" or "Cargo" (String) - * 3: Index. "Turret", "FFV", "Codriver" and "Cargo" support this optional parameter. Which position should be taken. - * Note: This index is diffrent from Armas "cargoIndex". (Number, optional default: next free index) - * - * Return Value: - * Nothing + * Public: Yes */ #include "script_component.hpp" #define CANGETINDRIVER (isNull (driver _vehicle) || {!alive driver _vehicle}) && {!lockedDriver _vehicle} && {getNumber (_config >> "isUav") != 1} #define CANGETINTURRETINDEX (isNull (_vehicle turretUnit _turret) || {!alive (_vehicle turretUnit _turret)}) && {!(_vehicle lockedTurret _turret)} && {getNumber (_config >> "isUav") != 1} -private ["_position", "_index"]; +params ["_unit", "_vehicle", "_position", ["_index", -1]]; -PARAMS_2(_unit,_vehicle); - -_position = toLower (_this select 2); -_index = _this select 3; // optional, please don't use - -if (isNil "_index") then {_index = -1}; +_position = toLower _position; // general if (!alive _vehicle || {locked _vehicle > 1}) exitWith {false}; @@ -39,27 +34,29 @@ _isInside = vehicle _unit == _vehicle; _script = {}; _enemiesInVehicle = false; //Possible Side Restriction + { if (side _unit getFriend side _x < 0.6) exitWith {_enemiesInVehicle = true}; -} forEach crew _vehicle; + false +} count crew _vehicle; switch (_position) do { case "driver" : { if (CANGETINDRIVER) then { - _script = [ - {_unit action [["GetInDriver", "MoveToDriver"] select _isInside, _vehicle];}, - {if (_isInside) then {moveOut _unit}; _unit moveInDriver _vehicle; call _fnc_getInEH;} - ] select _enemiesInVehicle; + _script = [ + {_unit action [["GetInDriver", "MoveToDriver"] select _isInside, _vehicle];}, + {if (_isInside) then {moveOut _unit}; _unit moveInDriver _vehicle; call _fnc_getInEH;} + ] select _enemiesInVehicle; }; }; case "pilot" : { if (CANGETINDRIVER) then { - _script = [ - {_unit action [["GetInPilot", "MoveToPilot"] select _isInside, _vehicle];}, - {if (_isInside) then {moveOut _unit}; _unit moveInDriver _vehicle; call _fnc_getInEH;} - ] select _enemiesInVehicle; - _position = "driver"; + _script = [ + {_unit action [["GetInPilot", "MoveToPilot"] select _isInside, _vehicle];}, + {if (_isInside) then {moveOut _unit}; _unit moveInDriver _vehicle; call _fnc_getInEH;} + ] select _enemiesInVehicle; + _position = "driver"; }; }; @@ -67,10 +64,10 @@ switch (_position) do { _turret = [_vehicle] call FUNC(getTurretGunner); if (CANGETINTURRETINDEX) then { - _script = [ - {_unit action [["GetInGunner", "MoveToGunner"] select _isInside, _vehicle];}, - {if (_isInside) then {moveOut _unit}; _unit moveInGunner _vehicle; call _fnc_getInEH;} - ] select _enemiesInVehicle; + _script = [ + {_unit action [["GetInGunner", "MoveToGunner"] select _isInside, _vehicle];}, + {if (_isInside) then {moveOut _unit}; _unit moveInGunner _vehicle; call _fnc_getInEH;} + ] select _enemiesInVehicle; }; }; @@ -78,10 +75,10 @@ switch (_position) do { _turret = [_vehicle] call FUNC(getTurretCommander); if (CANGETINTURRETINDEX) then { - _script = [ - {_unit action [["GetInCommander", "MoveToCommander"] select _isInside, _vehicle];}, - {if (_isInside) then {moveOut _unit}; _unit moveInCommander _vehicle; call _fnc_getInEH;} - ] select _enemiesInVehicle; + _script = [ + {_unit action [["GetInCommander", "MoveToCommander"] select _isInside, _vehicle];}, + {if (_isInside) then {moveOut _unit}; _unit moveInCommander _vehicle; call _fnc_getInEH;} + ] select _enemiesInVehicle; }; }; @@ -89,12 +86,12 @@ switch (_position) do { _turret = [_vehicle] call FUNC(getTurretCopilot); if (CANGETINTURRETINDEX) then { - _script = [ - {_unit action [["GetInTurret", "moveToTurret"] select _isInside, _vehicle, _turret];}, - {if (_isInside) then {moveOut _unit}; _unit moveInTurret [_vehicle, _turret]; call _fnc_getInEH;} - ] select _enemiesInVehicle; + _script = [ + {_unit action [["GetInTurret", "moveToTurret"] select _isInside, _vehicle, _turret];}, + {if (_isInside) then {moveOut _unit}; _unit moveInTurret [_vehicle, _turret]; call _fnc_getInEH;} + ] select _enemiesInVehicle; - _position = "gunner"; // I think. It's a turret after all and turrets supposedly return "gunner" + _position = "gunner"; // I think. It's a turret after all and turrets supposedly return "gunner" }; }; @@ -104,8 +101,8 @@ switch (_position) do { if (_index != -1 && {_turret = _turrets select _index; CANGETINTURRETINDEX}) then { _script = [ - {_unit action [["GetInTurret", "moveToTurret"] select _isInside, _vehicle, _turret];}, - {if (_isInside) then {moveOut _unit}; _unit moveInTurret [_vehicle, _turret]; call _fnc_getInEH;} + {_unit action [["GetInTurret", "moveToTurret"] select _isInside, _vehicle, _turret];}, + {if (_isInside) then {moveOut _unit}; _unit moveInTurret [_vehicle, _turret]; call _fnc_getInEH;} ] select _enemiesInVehicle; _position = "gunner"; @@ -114,13 +111,13 @@ switch (_position) do { _turret = _turrets select _index; if (CANGETINTURRETINDEX) exitWith { _script = [ - {_unit action [["GetInTurret", "moveToTurret"] select _isInside, _vehicle, _turret];}, - {if (_isInside) then {moveOut _unit}; _unit moveInTurret [_vehicle, _turret]; call _fnc_getInEH;} + {_unit action [["GetInTurret", "moveToTurret"] select _isInside, _vehicle, _turret];}, + {if (_isInside) then {moveOut _unit}; _unit moveInTurret [_vehicle, _turret]; call _fnc_getInEH;} ] select _enemiesInVehicle; _position = "gunner"; }; - }; + }; }; }; @@ -130,22 +127,22 @@ switch (_position) do { if (_index != -1 && {_turret = _turrets select _index; CANGETINTURRETINDEX}) then { _script = [ - {_unit action [["GetInTurret", "moveToTurret"] select _isInside, _vehicle, _turret];}, - {if (_isInside) then {moveOut _unit}; _unit moveInTurret [_vehicle, _turret]; call _fnc_getInEH;} + {_unit action [["GetInTurret", "moveToTurret"] select _isInside, _vehicle, _turret];}, + {if (_isInside) then {moveOut _unit}; _unit moveInTurret [_vehicle, _turret]; call _fnc_getInEH;} ] select _enemiesInVehicle; _position = "gunner"; // I think. It's a turret after all and turrets supposedly return "gunner" } else { for "_index" from 0 to (count _turrets - 1) do { - _turret = _turrets select _index; - if (CANGETINTURRETINDEX) exitWith { - _script = [ - {_unit action [["GetInTurret", "moveToTurret"] select _isInside, _vehicle, _turret];}, - {if (_isInside) then {moveOut _unit}; _unit moveInTurret [_vehicle, _turret]; call _fnc_getInEH;} - ] select _enemiesInVehicle; + _turret = _turrets select _index; + if (CANGETINTURRETINDEX) exitWith { + _script = [ + {_unit action [["GetInTurret", "moveToTurret"] select _isInside, _vehicle, _turret];}, + {if (_isInside) then {moveOut _unit}; _unit moveInTurret [_vehicle, _turret]; call _fnc_getInEH;} + ] select _enemiesInVehicle; - _position = "gunner"; // I think. It's a turret after all and turrets supposedly return "gunner" - }; + _position = "gunner"; // I think. It's a turret after all and turrets supposedly return "gunner" + }; }; }; }; @@ -160,8 +157,8 @@ switch (_position) do { if (_index != -1 && {_index in _positions}) then { _script = [ - {_unit action [["GetInCargo", "MoveToCargo"] select _isInside, _vehicle, _index];}, - {if (_isInside) then {moveOut _unit}; _unit moveInCargo [_vehicle, _index]; call _fnc_getInEH;} + {_unit action [["GetInCargo", "MoveToCargo"] select _isInside, _vehicle, _index];}, + {if (_isInside) then {moveOut _unit}; _unit moveInCargo [_vehicle, _index]; call _fnc_getInEH;} ] select _enemiesInVehicle; _position = "cargo"; @@ -169,8 +166,8 @@ switch (_position) do { _index = _positions select 0; if (!isNil "_index") then { _script = [ - {_unit action [["GetInCargo", "MoveToCargo"] select _isInside, _vehicle, _index];}, - {if (_isInside) then {moveOut _unit}; _unit moveInCargo [_vehicle, _index]; call _fnc_getInEH;} + {_unit action [["GetInCargo", "MoveToCargo"] select _isInside, _vehicle, _index];}, + {if (_isInside) then {moveOut _unit}; _unit moveInCargo [_vehicle, _index]; call _fnc_getInEH;} ] select _enemiesInVehicle; _position = "cargo"; @@ -188,8 +185,8 @@ switch (_position) do { if (_index != -1 && {_index in _positions}) then { _script = [ - {_unit action [["GetInCargo", "MoveToCargo"] select _isInside, _vehicle, _index];}, - {if (_isInside) then {moveOut _unit}; _unit moveInCargo [_vehicle, _index]; call _fnc_getInEH;} + {_unit action [["GetInCargo", "MoveToCargo"] select _isInside, _vehicle, _index];}, + {if (_isInside) then {moveOut _unit}; _unit moveInCargo [_vehicle, _index]; call _fnc_getInEH;} ] select _enemiesInVehicle; _position = "cargo"; @@ -197,8 +194,8 @@ switch (_position) do { _index = _positions select 0; if (!isNil "_index") then { _script = [ - {_unit action [["GetInCargo", "MoveToCargo"] select _isInside, _vehicle, _index];}, - {if (_isInside) then {moveOut _unit}; _unit moveInCargo [_vehicle, _index]; call _fnc_getInEH;} + {_unit action [["GetInCargo", "MoveToCargo"] select _isInside, _vehicle, _index];}, + {if (_isInside) then {moveOut _unit}; _unit moveInCargo [_vehicle, _index]; call _fnc_getInEH;} ] select _enemiesInVehicle; _position = "cargo"; diff --git a/addons/common/functions/fnc_getItemType.sqf b/addons/common/functions/fnc_getItemType.sqf index 4de2bfa862..ec20b46f74 100644 --- a/addons/common/functions/fnc_getItemType.sqf +++ b/addons/common/functions/fnc_getItemType.sqf @@ -1,83 +1,88 @@ /* * Author: commy2 + * Returns item type of given classname. * - * What kind of item is given classname + * Arguments: + * 0: Item * - * Argument: - * 0: Classname of a item. (String) - * - * Return value: - * Item type. (Array) - * 0: "weapon", "item", "magazine" or "" (String) - * 1: A description of the item (e.g. "primary" for a weapon or "vest" for a vest item) + * Return Value: + * 0: Type ("weapon", "item", "magazine", "") + * 1: Item Description * + * Public: Yes */ #include "script_component.hpp" -PARAMS_1(_item); +params ["_item"]; -private ["_cfgType"]; +private ["_cfgType", "_config", "_type", "_simulation", "_default"]; _cfgType = [_item] call FUNC(getConfigType); -if (_cfgType == "") exitWith {["",""]}; +if (_cfgType == "") exitWith {["", ""]}; -if (_cfgType == "CfgGlasses") exitWith {["item","glasses"]}; - -private ["_config", "_type"]; +if (_cfgType == "CfgGlasses") exitWith {["item", "glasses"]}; _config = configFile >> _cfgType >> _item; - _type = getNumber (_config >> "type"); +_simulation = getText (_config >> "simulation"); if (isNumber (_config >> "ItemInfo" >> "type")) then { _type = getNumber (_config >> "ItemInfo" >> "type"); }; -private "_default"; _default = ["item", "magazine"] select (_cfgType == "CfgMagazines"); switch (true) do { - case (_type == 0): {[_default,"unknown"]}; - case (_type == 2^0): {["weapon","primary"]}; - case (_type == 2^1): {["weapon","handgun"]}; - case (_type == 2^2): {["weapon","secondary"]}; - case (_type < 2^4): {["weapon","unknown"]}; - case (_type == 2^4): {["magazine","handgun"]}; // handgun - case (_type == 2^8): {["magazine","primary"]}; // rifle - case (_type == 2^9): {["magazine","secondary"]}; // rpg, mg, mines - //case (_type < 2^11): {["magazine","unknown"]}; + case (_type == 0): {[_default, "unknown"]}; + case (_type == 2^0): {["weapon", "primary"]}; + case (_type == 2^1): {["weapon", "handgun"]}; + case (_type == 2^2): {["weapon", "secondary"]}; + case (_type < 2^4): {["weapon", "unknown"]}; + case (_type == 2^4): {["magazine", "handgun"]}; // handgun + case (_type == 2^8): {["magazine", "primary"]}; // rifle + case (_type == 2^9): {["magazine", "secondary"]}; // rpg, mg, mines + //case (_type < 2^11): {["magazine", "unknown"]}; - case (_type == 101): {["item","muzzle"]}; - case (_type == 201): {["item","optics"]}; - case (_type == 301): {["item","flashlight"]}; - case (_type == 302): {["item","under"]}; // czech for bipod item - case (_type == 401): {["item","first_aid_kit"]}; - case (_type == 501): {["item","fins"]}; // not implemented - case (_type == 601): {["item","breathing_bomb"]}; // not implemented - case (_type == 603): {["item","goggles"]}; - case (_type == 604): {["item","scuba"]}; // not implemented - case (_type == 605): {["item","headgear"]}; - case (_type == 611): {["item","radio"]}; - case (_type == 616): {["item","hmd"]}; - case (_type == 617): {["item","binocular"]}; - case (_type == 619): {["item","medikit"]}; - case (_type == 620): {["item","toolkit"]}; - case (_type == 621): {["item","uav_terminal"]}; - case (_type == 701): {["item","vest"]}; - case (_type == 801): {["item","uniform"]}; + case (_type == 101): {["item", "muzzle"]}; + case (_type == 201): {["item", "optics"]}; + case (_type == 301): {["item", "flashlight"]}; + case (_type == 302): {["item", "under"]}; // czech for bipod item + case (_type == 401): {["item", "first_aid_kit"]}; + case (_type == 501): {["item", "fins"]}; // not implemented + case (_type == 601): {["item", "breathing_bomb"]}; // not implemented + case (_type == 603): {["item", "goggles"]}; + case (_type == 604): {["item", "scuba"]}; // not implemented + case (_type == 605): {["item", "headgear"]}; + case (_type == 611): {["item", "radio"]}; + case (_type == 616): {["item", "hmd"]}; + case (_type == 617): {["item", "binocular"]}; + case (_type == 619): {["item", "medikit"]}; + case (_type == 620): {["item", "toolkit"]}; + case (_type == 621): {["item", "uav_terminal"]}; + case (_type == 701): {["item", "vest"]}; + case (_type == 801): {["item", "uniform"]}; case (_type == 2^12): { - switch (toLower getText (_config >> "simulation")) do { - case ("weapon"): {["weapon","binocular"]}; - case ("binocular"): {["weapon","binocular"]}; - case ("nvgoggles"): {["item","nvgoggles"]}; - case ("itemminedetector"): {["item","minedetector"]}; - default {[_default,"unknown"]}; + switch (toLower _simulation) do { + case ("weapon"): {["weapon", "binocular"]}; + case ("binocular"): {["weapon", "binocular"]}; + case ("nvgoggles"): {["item", "nvgoggles"]}; + case ("itemminedetector"): {["item", "minedetector"]}; + default {[_default, "unknown"]}; }; }; - case (_type == 2^16): {["weapon","vehicle"]}; - case (_type == 2^17): {[_default,"unknown"]}; // ??? - default {[_default,"unknown"]}; + case (_type == 2^16): {["weapon", "vehicle"]}; + case (_type == 2^17): { + switch (toLower _simulation) do { + case ("itemmap"): {["item", "map"]}; + case ("itemgps"): {["item", "gps"]}; + case ("itemradio"): {["item", "radio"]}; + case ("itemcompass"): {["item", "compass"]}; + case ("itemwatch"): {["item", "watch"]}; + default {[_default, "unknown"]}; + }; + }; + default {[_default, "unknown"]}; }; diff --git a/addons/common/functions/fnc_getLightProperties.sqf b/addons/common/functions/fnc_getLightProperties.sqf index 456084c3f9..bbaf955a8b 100644 --- a/addons/common/functions/fnc_getLightProperties.sqf +++ b/addons/common/functions/fnc_getLightProperties.sqf @@ -3,22 +3,26 @@ * Read properties of given vehicles light. * * Arguments: - * 0: Object with lights (Object) - * 1: Light classname (String) + * 0: Object with lights + * 1: Light classname * * Return Value: - * Stuff from config (Array) + * 0: Light intensity + * 1: Light position + * 2: Light direction + * 3: Light inner angle + * 4: Light outer angle * + * Public: Yes */ #include "script_component.hpp" -PARAMS_2(_vehicle,_light); +params ["_vehicle", "_light"]; + +private ["_config", "_intensity", "_position", "_direction", "_innerAngle", "_outerAngle"]; -private "_config"; _config = configFile >> "CfgVehicles" >> typeOf _vehicle >> "Reflectors" >> _light; -private ["_intensity", "_position", "_direction", "_innerAngle", "_outerAngle"]; - _intensity = getNumber (_config >> "intensity"); _position = getText (_config >> "position"); _direction = getText (_config >> "direction"); @@ -26,35 +30,3 @@ _innerAngle = getNumber (_config >> "innerAngle"); _outerAngle = getNumber (_config >> "outerAngle"); [_intensity, _position, _direction, _innerAngle, _outerAngle] - -/* -class Reflectors -{ - class Light_1 - { - color[] = {1000,1000,1100}; - ambient[] = {10,10,11}; - intensity = 5; - size = 1; - innerAngle = 90; - outerAngle = 130; - coneFadeCoef = 2; - position = "Light_1_pos"; - direction = "Light_1_dir"; - hitpoint = "Light_1_hitpoint"; - selection = "Light_1_hide"; - useFlare = 1; - flareSize = 0.9; - flareMaxDistance = 85; - class Attenuation - { - start = 0; - constant = 0; - linear = 0; - quadratic = 0.9; - hardLimitStart = 40; - hardLimitEnd = 60; - }; - }; -}; -*/ diff --git a/addons/common/functions/fnc_getLightPropertiesWeapon.sqf b/addons/common/functions/fnc_getLightPropertiesWeapon.sqf index 03c6753a76..01567fee58 100644 --- a/addons/common/functions/fnc_getLightPropertiesWeapon.sqf +++ b/addons/common/functions/fnc_getLightPropertiesWeapon.sqf @@ -1,23 +1,29 @@ /* * Author: commy2 - * Read properties of given flashlight. @todo, Can weapons themselves still have flashlights (no attachment)? + * Read properties of given flashlight. * * Arguments: - * 0: A flashlight (String) + * 0: Flashlight * * Return Value: - * Stuff from config (Array) + * 0: Light intensity + * 1: Light position + * 2: Light direction + * 3: Light inner angle + * 4: Light outer angle * + * Public: Yes */ #include "script_component.hpp" -PARAMS_1(_weapon); +params ["_weapon"]; + +// @todo: Can weapons themselves still have flashlights (no attachment)? + +private ["_config", "_intensity", "_position", "_direction", "_innerAngle", "_outerAngle"]; -private "_config"; _config = configFile >> "CfgWeapons" >> _weapon >> "ItemInfo" >> "FlashLight"; -private ["_intensity", "_position", "_direction", "_innerAngle", "_outerAngle"]; - _intensity = getNumber (_config >> "intensity"); _position = getText (_config >> "position"); _direction = getText (_config >> "direction"); @@ -25,32 +31,3 @@ _innerAngle = getNumber (_config >> "innerAngle"); _outerAngle = getNumber (_config >> "outerAngle"); [_intensity, _position, _direction, _innerAngle, _outerAngle] - -/* -class FlashLight -{ - color[] = {180,156,120}; - ambient[] = {0.9,0.78,0.6}; - intensity = 20; - size = 1; - innerAngle = 20; - outerAngle = 80; - coneFadeCoef = 5; - position = "flash dir"; - direction = "flash"; - useFlare = 1; - flareSize = 1.4; - flareMaxDistance = "100.0f"; - dayLight = 0; - class Attenuation - { - start = 0.5; - constant = 0; - linear = 0; - quadratic = 1.1; - hardLimitStart = 20; - hardLimitEnd = 30; - }; - scale[] = {0}; -}; -*/ diff --git a/addons/common/functions/fnc_getMGRSdata.sqf b/addons/common/functions/fnc_getMGRSdata.sqf index 775f439174..b4f10db8a4 100644 --- a/addons/common/functions/fnc_getMGRSdata.sqf +++ b/addons/common/functions/fnc_getMGRSdata.sqf @@ -1,28 +1,28 @@ /* * Author: VKing * Gets the current map's MGRS grid zone designator and 100km square. - * Also gets longitude, latitude and altitude offset for the map + * Also gets longitude, latitude and altitude offset for the map. + * Writes return values to GVAR(MGRS_data) if run on the current map. * * Argument: - * 0: Optional: Map name, if undefined the current map is used (String) + * 0: Map name (default: worldName) * - * Return value: - * 0: Grid zone designator (String) - * 1: 100km square (String) - * 2: GZD + 100km sq. as a single string (String) - * Writes return values to GVAR(MGRS_data) if run on the current map + * Return Value: + * 0: Grid zone designator + * 1: 100km square + * 2: GZD + 100km sq. as a single string + * + * Public: No */ - -// #define DEBUG_MODE_FULL #include "script_component.hpp" -private ["_zone","_band","_GZD","_long","_lat","_UTM","_easting","_northing", "_altitude"]; +params [["_map", worldName]]; -DEFAULT_PARAM(0,_map,worldName); +private ["_long", "_lat", "_altitude", "_UTM", "_easting", "_northing", "_zone", "_band", "_GZD"]; -_long = getNumber (ConfigFile >> "CfgWorlds" >> _map >> "longitude"); -_lat = getNumber (ConfigFile >> "CfgWorlds" >> _map >> "latitude"); -_altitude = getNumber (ConfigFile >> "CfgWorlds" >> _map >> "elevationOffset"); +_long = getNumber (configFile >> "CfgWorlds" >> _map >> "longitude"); +_lat = getNumber (configFile >> "CfgWorlds" >> _map >> "latitude"); +_altitude = getNumber (configFile >> "CfgWorlds" >> _map >> "elevationOffset"); if (_map in ["Chernarus", "Bootcamp_ACR", "Woodland_ACR", "utes"]) then { _lat = 50; _altitude = 0; }; if (_map in ["Altis", "Stratis"]) then { _lat = 40; _altitude = 0; }; @@ -46,11 +46,10 @@ if (_map in ["lingor"]) then { _lat = -4; _altitude = 0; }; if (_map in ["Panthera3"]) then { _lat = 46; _altitude = 0; }; if (_map in ["Kunduz"]) then { _lat = 37; _altitude = 400; }; - _UTM = [_long,_lat] call BIS_fnc_posDegToUTM; _easting = _UTM select 0; _northing = _UTM select 1; -// _zone = _UTM select 2; +//_zone = _UTM select 2; TRACE_4("",_UTM,_easting,_northing,_zone); /* @@ -76,9 +75,11 @@ _band = switch (true) do { case (_lat>8): {"P"}; case (_lat>=0): {"N"}; }; - */ +*/ + _zone = 1 + (floor ((_long + 180) / 6)); _band = "Z"; + if (_lat <= -80) then { _band = "A"; } else { @@ -86,13 +87,13 @@ if (_lat <= -80) then { _band = "CDEFGHJKLMNPQRSTUVWXX" select [(floor ((_lat / 8) + 10)), 1]; }; }; + if (_map == "VR") then {_zone = 0; _band = "RV";}; _GZD = format ["%1%2",_zone,_band]; TRACE_3("",_zone,_band,_GZD); - -private ["_set1","_set2","_set3","_set4","_set5","_set6","_metaE","_metaN","_letterE","_letterN","_grid100km"]; +private ["_set1", "_set2", "_set3", "_set4", "_set5", "_set6", "_metaE", "_metaN", "_letterE", "_letterN", "_grid100km"]; _set1 = [1,7,13,19,25,31,37,43,49,55]; _set2 = [2,8,14,20,26,32,38,44,50,56]; @@ -102,25 +103,25 @@ _set5 = [5,11,17,23,29,35,41,47,53,59]; _set6 = [6,12,18,24,30,36,42,48,54,60]; switch (true) do { -case (_zone in _set1): {_metaE = 1; _metaN = 1;}; -case (_zone in _set2): {_metaE = 2; _metaN = 2;}; -case (_zone in _set3): {_metaE = 3; _metaN = 1;}; -case (_zone in _set4): {_metaE = 1; _metaN = 2;}; -case (_zone in _set5): {_metaE = 2; _metaN = 1;}; -case (_zone in _set6): {_metaE = 3; _metaN = 2;}; + case (_zone in _set1): {_metaE = 1; _metaN = 1;}; + case (_zone in _set2): {_metaE = 2; _metaN = 2;}; + case (_zone in _set3): {_metaE = 3; _metaN = 1;}; + case (_zone in _set4): {_metaE = 1; _metaN = 2;}; + case (_zone in _set5): {_metaE = 2; _metaN = 1;}; + case (_zone in _set6): {_metaE = 3; _metaN = 2;}; }; TRACE_2("",_metaE,_metaN); switch (true) do { -case (_zone == 0): {_letterE = "E"}; -case (_easting > 800000): {LOG("E8"); switch (_metaE) do {case 1: {_letterE="H"}; case 2: {_letterE="R"}; case 3: {_letterE="Z"}; }; }; -case (_easting > 700000): {LOG("E7"); switch (_metaE) do {case 1: {_letterE="G"}; case 2: {_letterE="Q"}; case 3: {_letterE="Y"}; }; }; -case (_easting > 600000): {LOG("E6"); switch (_metaE) do {case 1: {_letterE="F"}; case 2: {_letterE="P"}; case 3: {_letterE="X"}; }; }; -case (_easting > 500000): {LOG("E5"); switch (_metaE) do {case 1: {_letterE="E"}; case 2: {_letterE="N"}; case 3: {_letterE="W"}; }; }; -case (_easting > 400000): {LOG("E4"); switch (_metaE) do {case 1: {_letterE="D"}; case 2: {_letterE="M"}; case 3: {_letterE="V"}; }; }; -case (_easting > 300000): {LOG("E3"); switch (_metaE) do {case 1: {_letterE="C"}; case 2: {_letterE="L"}; case 3: {_letterE="U"}; }; }; -case (_easting > 200000): {LOG("E2"); switch (_metaE) do {case 1: {_letterE="B"}; case 2: {_letterE="K"}; case 3: {_letterE="T"}; }; }; -case (_easting > 100000): {LOG("E1"); switch (_metaE) do {case 1: {_letterE="A"}; case 2: {_letterE="J"}; case 3: {_letterE="S"}; }; }; + case (_zone == 0): {_letterE = "E"}; + case (_easting > 800000): {LOG("E8"); switch (_metaE) do {case 1: {_letterE="H"}; case 2: {_letterE="R"}; case 3: {_letterE="Z"}; }; }; + case (_easting > 700000): {LOG("E7"); switch (_metaE) do {case 1: {_letterE="G"}; case 2: {_letterE="Q"}; case 3: {_letterE="Y"}; }; }; + case (_easting > 600000): {LOG("E6"); switch (_metaE) do {case 1: {_letterE="F"}; case 2: {_letterE="P"}; case 3: {_letterE="X"}; }; }; + case (_easting > 500000): {LOG("E5"); switch (_metaE) do {case 1: {_letterE="E"}; case 2: {_letterE="N"}; case 3: {_letterE="W"}; }; }; + case (_easting > 400000): {LOG("E4"); switch (_metaE) do {case 1: {_letterE="D"}; case 2: {_letterE="M"}; case 3: {_letterE="V"}; }; }; + case (_easting > 300000): {LOG("E3"); switch (_metaE) do {case 1: {_letterE="C"}; case 2: {_letterE="L"}; case 3: {_letterE="U"}; }; }; + case (_easting > 200000): {LOG("E2"); switch (_metaE) do {case 1: {_letterE="B"}; case 2: {_letterE="K"}; case 3: {_letterE="T"}; }; }; + case (_easting > 100000): {LOG("E1"); switch (_metaE) do {case 1: {_letterE="A"}; case 2: {_letterE="J"}; case 3: {_letterE="S"}; }; }; default {_letterE="@"}; }; TRACE_1("",_letterE); @@ -129,37 +130,38 @@ _northing = _northing mod 2000000; TRACE_1("",_northing); switch (true) do { -case (_zone == 0): {_letterN = "N"}; -case (_northing > 1900000): {LOG("N19"); switch (_metaN) do {case 1: {_letterN = "V"}; case 2: {_letterN = "E"}; }; }; -case (_northing > 1800000): {LOG("N18"); switch (_metaN) do {case 1: {_letterN = "U"}; case 2: {_letterN = "D"}; }; }; -case (_northing > 1700000): {LOG("N17"); switch (_metaN) do {case 1: {_letterN = "T"}; case 2: {_letterN = "C"}; }; }; -case (_northing > 1600000): {LOG("N16"); switch (_metaN) do {case 1: {_letterN = "S"}; case 2: {_letterN = "B"}; }; }; -case (_northing > 1500000): {LOG("N15"); switch (_metaN) do {case 1: {_letterN = "R"}; case 2: {_letterN = "A"}; }; }; -case (_northing > 1400000): {LOG("N14"); switch (_metaN) do {case 1: {_letterN = "Q"}; case 2: {_letterN = "V"}; }; }; -case (_northing > 1300000): {LOG("N13"); switch (_metaN) do {case 1: {_letterN = "P"}; case 2: {_letterN = "U"}; }; }; -case (_northing > 1200000): {LOG("N12"); switch (_metaN) do {case 1: {_letterN = "N"}; case 2: {_letterN = "T"}; }; }; -case (_northing > 1100000): {LOG("N11"); switch (_metaN) do {case 1: {_letterN = "M"}; case 2: {_letterN = "S"}; }; }; -case (_northing > 1000000): {LOG("N10"); switch (_metaN) do {case 1: {_letterN = "L"}; case 2: {_letterN = "R"}; }; }; -case (_northing > 900000): {LOG("N09"); switch (_metaN) do {case 1: {_letterN = "K"}; case 2: {_letterN = "Q"}; }; }; -case (_northing > 800000): {LOG("N08"); switch (_metaN) do {case 1: {_letterN = "J"}; case 2: {_letterN = "P"}; }; }; -case (_northing > 700000): {LOG("N07"); switch (_metaN) do {case 1: {_letterN = "H"}; case 2: {_letterN = "N"}; }; }; -case (_northing > 600000): {LOG("N06"); switch (_metaN) do {case 1: {_letterN = "G"}; case 2: {_letterN = "M"}; }; }; -case (_northing > 500000): {LOG("N05"); switch (_metaN) do {case 1: {_letterN = "F"}; case 2: {_letterN = "L"}; }; }; -case (_northing > 400000): {LOG("N04"); switch (_metaN) do {case 1: {_letterN = "E"}; case 2: {_letterN = "K"}; }; }; -case (_northing > 300000): {LOG("N03"); switch (_metaN) do {case 1: {_letterN = "D"}; case 2: {_letterN = "J"}; }; }; -case (_northing > 200000): {LOG("N02"); switch (_metaN) do {case 1: {_letterN = "C"}; case 2: {_letterN = "H"}; }; }; -case (_northing > 100000): {LOG("N01"); switch (_metaN) do {case 1: {_letterN = "B"}; case 2: {_letterN = "G"}; }; }; -case (_northing > 0): {LOG("N00"); switch (_metaN) do {case 1: {_letterN = "A"}; case 2: {_letterN = "F"}; }; }; + case (_zone == 0): {_letterN = "N"}; + case (_northing > 1900000): {LOG("N19"); switch (_metaN) do {case 1: {_letterN = "V"}; case 2: {_letterN = "E"}; }; }; + case (_northing > 1800000): {LOG("N18"); switch (_metaN) do {case 1: {_letterN = "U"}; case 2: {_letterN = "D"}; }; }; + case (_northing > 1700000): {LOG("N17"); switch (_metaN) do {case 1: {_letterN = "T"}; case 2: {_letterN = "C"}; }; }; + case (_northing > 1600000): {LOG("N16"); switch (_metaN) do {case 1: {_letterN = "S"}; case 2: {_letterN = "B"}; }; }; + case (_northing > 1500000): {LOG("N15"); switch (_metaN) do {case 1: {_letterN = "R"}; case 2: {_letterN = "A"}; }; }; + case (_northing > 1400000): {LOG("N14"); switch (_metaN) do {case 1: {_letterN = "Q"}; case 2: {_letterN = "V"}; }; }; + case (_northing > 1300000): {LOG("N13"); switch (_metaN) do {case 1: {_letterN = "P"}; case 2: {_letterN = "U"}; }; }; + case (_northing > 1200000): {LOG("N12"); switch (_metaN) do {case 1: {_letterN = "N"}; case 2: {_letterN = "T"}; }; }; + case (_northing > 1100000): {LOG("N11"); switch (_metaN) do {case 1: {_letterN = "M"}; case 2: {_letterN = "S"}; }; }; + case (_northing > 1000000): {LOG("N10"); switch (_metaN) do {case 1: {_letterN = "L"}; case 2: {_letterN = "R"}; }; }; + case (_northing > 900000): {LOG("N09"); switch (_metaN) do {case 1: {_letterN = "K"}; case 2: {_letterN = "Q"}; }; }; + case (_northing > 800000): {LOG("N08"); switch (_metaN) do {case 1: {_letterN = "J"}; case 2: {_letterN = "P"}; }; }; + case (_northing > 700000): {LOG("N07"); switch (_metaN) do {case 1: {_letterN = "H"}; case 2: {_letterN = "N"}; }; }; + case (_northing > 600000): {LOG("N06"); switch (_metaN) do {case 1: {_letterN = "G"}; case 2: {_letterN = "M"}; }; }; + case (_northing > 500000): {LOG("N05"); switch (_metaN) do {case 1: {_letterN = "F"}; case 2: {_letterN = "L"}; }; }; + case (_northing > 400000): {LOG("N04"); switch (_metaN) do {case 1: {_letterN = "E"}; case 2: {_letterN = "K"}; }; }; + case (_northing > 300000): {LOG("N03"); switch (_metaN) do {case 1: {_letterN = "D"}; case 2: {_letterN = "J"}; }; }; + case (_northing > 200000): {LOG("N02"); switch (_metaN) do {case 1: {_letterN = "C"}; case 2: {_letterN = "H"}; }; }; + case (_northing > 100000): {LOG("N01"); switch (_metaN) do {case 1: {_letterN = "B"}; case 2: {_letterN = "G"}; }; }; + case (_northing > 0): {LOG("N00"); switch (_metaN) do {case 1: {_letterN = "A"}; case 2: {_letterN = "F"}; }; }; }; TRACE_1("",_letterN); -_grid100km = _letterE+_letterN; +_grid100km = _letterE + _letterN; TRACE_1("",_grid100km); if (_map == worldName) then { - GVAR(MGRS_data) = [_GZD,_grid100km,_GZD+_grid100km]; + GVAR(MGRS_data) = [_GZD, _grid100km, _GZD + _grid100km]; GVAR(mapAltitude) = _altitude; GVAR(mapLatitude) = _lat; GVAR(mapLongitude) = _long; }; -[_GZD,_grid100km,_GZD+_grid100km] \ No newline at end of file + +[_GZD, _grid100km, _GZD + _grid100km] diff --git a/addons/common/functions/fnc_getMapGridData.sqf b/addons/common/functions/fnc_getMapGridData.sqf index 308772bfff..c74f378d75 100644 --- a/addons/common/functions/fnc_getMapGridData.sqf +++ b/addons/common/functions/fnc_getMapGridData.sqf @@ -1,12 +1,13 @@ /* - * Author: PabstMirror (ideas from Nou's mapGridToPos and BIS_fnc_gridToPos) + * Author: PabstMirror * Finds real x/y offset and map step for a 10 digit grid * Save time by preparing data one time at startup + * Ideas from Nou's mapGridToPos and BIS_fnc_gridToPos * - * Argument: + * Arguments: * None * - * Return values: + * Return Value: * None * * Example: @@ -16,10 +17,10 @@ */ #include "script_component.hpp" -private["_cfgGrid", "_formatX", "_formatY", "_heightOffset", "_offsetX", "_offsetY", "_originGrid", "_realOffsetY", "_startGrid", "_stepX", "_stepY", "_zoom", "_zoomMax", "_letterGrid"]; - GVAR(mapGridData) = []; +private ["_cfgGrid", "_offsetX", "_offsetY", "_zoomMax", "_formatX", "_formatY", "_stepX", "_stepY", "_zoom", "_letterGrid", "_heightOffset", "_startGrid", "_originGrid", "_realOffsetY"]; + //--- Extract grid values from world config (Borrowed from BIS_fnc_gridToPos) _cfgGrid = configFile >> "CfgWorlds" >> worldName >> "Grid"; _offsetX = getNumber (_cfgGrid >> "offsetX"); @@ -29,6 +30,7 @@ _formatX = ""; _formatY = ""; _stepX = 1e10; _stepY = 1e10; + { _zoom = getnumber (_x >> "zoomMax"); if (_zoom < _zoomMax) then { @@ -38,39 +40,45 @@ _stepY = 1e10; _stepX = getNumber (_x >> "stepX"); _stepY = getNumber (_x >> "stepY"); }; -} foreach configProperties [_cfgGrid, "isClass _x", false]; + false +} count configProperties [_cfgGrid, "isClass _x", false]; _letterGrid = false; -if (((toLower _formatX) find "a") != -1) then {_letterGrid = true}; -if (((toLower _formatY) find "a") != -1) then {_letterGrid = true}; + +if (toLower _formatX find "a" != -1) then {_letterGrid = true}; +if (toLower _formatY find "a" != -1) then {_letterGrid = true}; + if (_letterGrid) exitWith { - diag_log text format ["[ACE] Map Grid Warning (%1) - Map uses letter grids [%2,%3]", worldName, _formatX, _formatY]; + ACE_LOGWARNING_3("Map Grid Warning (%1) - Map uses letter grids [%2, %3]",worldName,_formatX,_formatY); }; //Start at [0, 500] and move north until we get a change in grid _heightOffset = 500; _startGrid = mapGridPosition [0, _heightOffset]; _originGrid = _startGrid; + while {_startGrid == _originGrid} do { _heightOffset = _heightOffset + 1; _originGrid = mapGridPosition [0, _heightOffset]; }; //Calculate the real y offset -_realOffsetY = parseNumber (_originGrid select [(count _formatX), (count _formatY)]) * _stepY + _heightOffset - 1; +_realOffsetY = (parseNumber (_originGrid select [count _formatX, count _formatY])) * _stepY + _heightOffset - 1; //Calculate MGRS 10digit step - they should both be 1 meter: _stepXat5 = _stepX * 10 ^ ((count _formatX) - 5); _stepYat5 = -1 * _stepY * 10 ^ ((count _formatY) - 5); if (_stepYat5 < 0) then { - diag_log text format ["[ACE] Map Grid Warning (%1) - Northing is reversed", worldName]; + ACE_LOGWARNING_1("Map Grid Warning (%1) - Northing is reversed.",worldName); }; + if (_stepXat5 != 1) then { - diag_log text format ["[ACE] Map Grid Warning (%1) - MGRS 10 digit grid does not equal 1 meter: (%2) for x", worldName, _stepXat5]; + ACE_LOGWARNING_2("Map Grid Warning (%1) - MGRS 10 digit grid does not equal 1 meter: (%2) for x.",worldName,_stepXat5); }; -if ((_stepYat5 != 1) && {_stepYat5 != -1}) then { - diag_log text format ["[ACE] Map Grid Warning (%1) - MGRS 10 digit grid does not equal 1 meter: (%2) for y", worldName, _stepXat5]; + +if (_stepYat5 != 1 && {_stepYat5 != -1}) then { + ACE_LOGWARNING_2("Map Grid Warning (%1) - MGRS 10 digit grid does not equal 1 meter: (%2) for y.",worldName,_stepXat5); }; GVAR(mapGridData) = [_offsetX, _realOffsetY, _stepXat5, _stepYat5]; diff --git a/addons/common/functions/fnc_getMapGridFromPos.sqf b/addons/common/functions/fnc_getMapGridFromPos.sqf index 983b78ffff..1f946a6e80 100644 --- a/addons/common/functions/fnc_getMapGridFromPos.sqf +++ b/addons/common/functions/fnc_getMapGridFromPos.sqf @@ -2,57 +2,58 @@ * Author: VKing, PabstMirror * Gets a 10-digit map grid for the given world position * - * Argument: + * Arguments: * 0: Position (2D Position) - * 1: Return type; false for array of easting and northing, true for single string + * 1: Return type; false for array of easting and northing, true for single string (default: false) * - * Return values: + * Return Value: * 0: Easting * 1: Northing * * Example: - * [(getPos player)] call ace_common_fnc_getMapGridFromPos; + * [getPos player] call ace_common_fnc_getMapGridFromPos * * Public: Yes */ -// #define DEBUG_MODE_FULL #include "script_component.hpp" -PARAMS_1(_pos); -DEFAULT_PARAM(1,_returnSingleString,false); +params ["_pos", ["_returnSingleString", false]]; -private["_count", "_easting", "_nativeGrid", "_northing"]; +private ["_nativeGrid", "_count", "_easting", "_northing"]; //Fallback, when map data is weird (letters) -if ((count GVAR(mapGridData)) == 0) exitWith { +if (GVAR(mapGridData) isEqualTo []) exitWith { _nativeGrid = mapGridPosition _pos; + if (_returnSingleString) then { _nativeGrid } else { _count = floor ((count _nativeGrid) / 2); - [(_nativeGrid select [0, _count]), (_nativeGrid select [_count, _count])] + [_nativeGrid select [0, _count], _nativeGrid select [_count, _count]] }; }; -EXPLODE_4_PVT(GVAR(mapGridData),_offsetX,_realOffsetY,_stepXat5,_stepYat5); +GVAR(mapGridData) params ["_offsetX", "_realOffsetY", "_stepXat5", "_stepYat5"]; + _easting = floor (((_pos select 0) - _offsetX) / _stepXat5); _northing = floor (((_pos select 1) - _realOffsetY) / _stepYat5); //Attempt to handle negative east/north (e.g.: moving west of map bounds) if (_easting > 0) then { _easting = str _easting; - while {count _easting < 5} do {_easting = "0" + _easting;}; + while {count _easting < 5} do {_easting = "0" + _easting}; } else { _easting = str abs _easting; - while {count _easting < 4} do {_easting = "0" + _easting;}; + while {count _easting < 4} do {_easting = "0" + _easting}; _easting = "-" + _easting; }; + if (_northing > 0) then { _northing = str _northing; - while {count _northing < 5} do {_northing = "0" + _northing;}; + while {count _northing < 5} do {_northing = "0" + _northing}; } else { _northing = str abs _northing; - while {count _northing < 4} do {_northing = "0" + _northing;}; + while {count _northing < 4} do {_northing = "0" + _northing}; _northing = "-" + _northing; }; @@ -60,4 +61,4 @@ if (_returnSingleString) then { _easting + _northing } else { [_easting, _northing] -}; +}; // return diff --git a/addons/common/functions/fnc_getMapPosFromGrid.sqf b/addons/common/functions/fnc_getMapPosFromGrid.sqf index 20194df88a..5ba67a40bf 100644 --- a/addons/common/functions/fnc_getMapPosFromGrid.sqf +++ b/addons/common/functions/fnc_getMapPosFromGrid.sqf @@ -2,9 +2,9 @@ * Author: PabstMirror * Gets position from grid cords * - * Argument: + * Arguments: * 0: Grid Cords - * 1: Get Center or bottom right + * 1: Grid center (true), Grid Bottom Right (false) (default: true) * * Return values: * Position @@ -16,24 +16,23 @@ */ #include "script_component.hpp" -PARAMS_1(_inputString); -DEFAULT_PARAM(1,_getCenterOfGrid,true); +params ["_inputString", ["_getCenterOfGrid", true]]; -private["_countInput", "_countInputHalf", "_xPart", "_xPos", "_yPart", "_yPos"]; - -if ((count GVAR(mapGridData)) == 0) exitWith { +if (count GVAR(mapGridData) == 0) exitWith { ERROR("Map has bad data, falling back to BIS_fnc_gridToPos"); (_this call BIS_fnc_gridToPos) select 0 }; -EXPLODE_4_PVT(GVAR(mapGridData),_offsetX,_realOffsetY,_stepXat5,_stepYat5); +GVAR(mapGridData) params ["_offsetX", "_realOffsetY", "_stepXat5", "_stepYat5"]; + +private ["_countInput", "_countInputHalf", "_xPart", "_yPart", "_xPos", "_yPos"]; _countInput = count _inputString; _countInputHalf = floor (_countInput / 2); //Split string, ignoring middle _xPart = _inputString select [0, _countInputHalf]; -_yPart = _inputString select [(ceil (_countInput / 2)), _countInputHalf]; +_yPart = _inputString select [ceil (_countInput / 2), _countInputHalf]; _xPos = ((parseNumber _xPart) * _stepXat5 * 10 ^ (5 - _countInputHalf)) + _offsetX; _yPos = ((parseNumber _yPart) * _stepYat5 * 10 ^ (5 - _countInputHalf)) + _realOffsetY; @@ -43,4 +42,4 @@ if (_getCenterOfGrid) then { _yPos = _yPos + 0.5 * _stepYat5 * 10 ^ (5 - _countInputHalf); }; -[_xPos, _yPos, 0]; +[_xPos, _yPos, 0] diff --git a/addons/common/functions/fnc_getMarkerType.sqf b/addons/common/functions/fnc_getMarkerType.sqf index bba8c15199..7c99302d8f 100644 --- a/addons/common/functions/fnc_getMarkerType.sqf +++ b/addons/common/functions/fnc_getMarkerType.sqf @@ -1,19 +1,20 @@ /* * Author: KoffeinFlummi - * * Get the apropriate marker for a group. * * Arguments: * 0: Group * * Return Value: - * Marker Type (string) + * Marker Type + * + * Public: No */ #include "script_component.hpp" -private ["_leader","_vehicle","_side"]; +params ["_group"]; -PARAMS_1(_group); +private ["_leader", "_vehicle", "_side"]; _leader = leader _group; _vehicle = vehicle _leader; @@ -21,56 +22,61 @@ _side = side _leader; if (_vehicle == _leader) exitWith { if ( - (getNumber (configFile >> "CfgVehicles" >> (typeOf _leader) >> "detectSkill") > 20) or - (getNumber (configFile >> "CfgVehicles" >> (typeOf _leader) >> "camouflage") < 1) or - (getText (configFile >> "CfgVehicles" >> (typeOf _leader) >> "textsingular") == "diver") - ) then { - ["n_recon", "b_recon", "o_recon"] select ((["GUER", "WEST", "EAST"] find (str _side)) max 0) + getNumber (configFile >> "CfgVehicles" >> typeOf _leader >> "detectSkill") > 20 || + getNumber (configFile >> "CfgVehicles" >> typeOf _leader >> "camouflage") < 1 || + getText (configFile >> "CfgVehicles" >> typeOf _leader >> "textsingular") == "diver" + ) then { + ["n_recon", "b_recon", "o_recon"] select ((["GUER", "WEST", "EAST"] find str _side) max 0) } else { - ["n_inf", "b_inf", "o_inf"] select ((["GUER", "WEST", "EAST"] find (str _side)) max 0) + ["n_inf", "b_inf", "o_inf"] select ((["GUER", "WEST", "EAST"] find str _side) max 0) }; }; -if (getNumber (configFile >> "CfgVehicles" >> (typeOf _vehicle) >> "attendant") == 1) exitWith { - ["n_med", "b_med", "o_med"] select ((["GUER", "WEST", "EAST"] find (str _side)) max 0) +if (getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> "attendant") == 1) exitWith { + ["n_med", "b_med", "o_med"] select ((["GUER", "WEST", "EAST"] find str _side) max 0) }; + if ( - (getNumber (configFile >> "CfgVehicles" >> (typeOf _vehicle) >> "transportRepair") > 0) or - (getNumber (configFile >> "CfgVehicles" >> (typeOf _vehicle) >> "transportFuel") > 0) or - (getNumber (configFile >> "CfgVehicles" >> (typeOf _vehicle) >> "transportAmmo") > 0) or - (getNumber (configFile >> "CfgVehicles" >> (typeOf _vehicle) >> "ACE_canRepair") > 0) or - (getNumber (configFile >> "CfgVehicles" >> (typeOf _vehicle) >> "ACE_fuelCapacityCargo") > 0) - ) exitWith { - ["n_maint", "b_maint", "o_maint"] select ((["GUER", "WEST", "EAST"] find (str _side)) max 0) + getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> "transportRepair") > 0 || + getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> "transportFuel") > 0 || + getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> "transportAmmo") > 0 || + getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> "ACE_canRepair") > 0 || + getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> "ACE_fuelCapacityCargo") > 0 +) exitWith { + ["n_maint", "b_maint", "o_maint"] select ((["GUER", "WEST", "EAST"] find str _side) max 0) }; if (_vehicle isKindOf "Plane") exitWith { - ["n_plane", "b_plane", "o_plane"] select ((["GUER", "WEST", "EAST"] find (str _side)) max 0) + ["n_plane", "b_plane", "o_plane"] select ((["GUER", "WEST", "EAST"] find str _side) max 0) }; + if (_vehicle isKindOf "Air") exitWith { - ["n_air", "b_air", "o_air"] select ((["GUER", "WEST", "EAST"] find (str _side)) max 0) + ["n_air", "b_air", "o_air"] select ((["GUER", "WEST", "EAST"] find str _side) max 0) }; if (_vehicle isKindOf "StaticMortar") exitWith { - ["n_mortar", "b_mortar", "o_mortar"] select ((["GUER", "WEST", "EAST"] find (str _side)) max 0) + ["n_mortar", "b_mortar", "o_mortar"] select ((["GUER", "WEST", "EAST"] find str _side) max 0) }; -if (getNumber (configFile >> "CfgVehicles" >> (typeOf _vehicle) >> "artilleryScanner") == 1) exitWith { - ["n_art", "b_art", "o_art"] select ((["GUER", "WEST", "EAST"] find (str _side)) max 0) + +if (getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> "artilleryScanner") == 1) exitWith { + ["n_art", "b_art", "o_art"] select ((["GUER", "WEST", "EAST"] find str _side) max 0) }; if (_vehicle isKindOf "Car") exitWith { - ["n_motor_inf", "b_motor_inf", "o_motor_inf"] select ((["GUER", "WEST", "EAST"] find (str _side)) max 0) -}; -if ((_vehicle isKindOf "Tank") and (getNumber (configFile >> "CfgVehicles" >> (typeOf _vehicle) >> "transportSoldier") > 0)) exitWith { - ["n_mech_inf", "b_mech_inf", "o_mech_inf"] select ((["GUER", "WEST", "EAST"] find (str _side)) max 0) + ["n_motor_inf", "b_motor_inf", "o_motor_inf"] select ((["GUER", "WEST", "EAST"] find str _side) max 0) }; + if (_vehicle isKindOf "Tank") exitWith { - ["n_armor", "b_armor", "o_armor"] select ((["GUER", "WEST", "EAST"] find (str _side)) max 0) + if (getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> "transportSoldier") > 0) then { + ["n_mech_inf", "b_mech_inf", "o_mech_inf"] select ((["GUER", "WEST", "EAST"] find str _side) max 0) + } else { + ["n_armor", "b_armor", "o_armor"] select ((["GUER", "WEST", "EAST"] find str _side) max 0) + }; }; if (_vehicle isKindOf "Ship") exitWith { - ["n_naval", "b_naval", "o_naval"] select ((["GUER", "WEST", "EAST"] find (str _side)) max 0) + ["n_naval", "b_naval", "o_naval"] select ((["GUER", "WEST", "EAST"] find str _side) max 0) }; // generic marker -["n_unknown", "b_unknown", "o_unknown"] select ((["GUER", "WEST", "EAST"] find (str _side)) max 0) +["n_unknown", "b_unknown", "o_unknown"] select ((["GUER", "WEST", "EAST"] find str _side) max 0) diff --git a/addons/common/functions/fnc_getName.sqf b/addons/common/functions/fnc_getName.sqf index 1da59534f0..a7facd2c6d 100644 --- a/addons/common/functions/fnc_getName.sqf +++ b/addons/common/functions/fnc_getName.sqf @@ -1,25 +1,21 @@ /* * Author: commy2 - * * Returns the name of the object. Used to prevent issues with the name command. * - * Argument: - * 0: Object (Object) - * 1: Show effective commander name? (Bool, optinal default: false) + * Arguments: + * 0: Object + * 1: Use effective commander name when used on vehicles (default: false) * - * Return value: - * The name. + * Return Value: + * Object Name + * + * Public: Yes */ #include "script_component.hpp" -private ["_name"]; - -PARAMS_2(_unit,_showEffective); - -if (isNil "_showEffective") then { - _showEffective = false; -}; +params ["_unit", ["_showEffective", false]]; +private "_name"; _name = ""; if (_unit isKindOf "CAManBase") then { diff --git a/addons/common/functions/fnc_getNumberFromMissionSQM.sqf b/addons/common/functions/fnc_getNumberFromMissionSQM.sqf index 1c9fbda77d..6c381d4f54 100644 --- a/addons/common/functions/fnc_getNumberFromMissionSQM.sqf +++ b/addons/common/functions/fnc_getNumberFromMissionSQM.sqf @@ -1,18 +1,16 @@ /* * Author: commy2 - * * Get a number from the mission.sqm file. Mission has to be saved in the Editor. + * On non-existing entries, it might return 0 or the value of an entry with the same name of another calss. * - * Argument: - * 0: Path of the entry in the mission.sqm (Array) + * Arguments: + * 0: Path of the entry in the mission.sqm * - * Return value: - * Value of the entry. Note: If the entry does not exist, it might return 0 or an entry with the same name of another class! (Number) + * Return Value: + * Entry value + * + * Public: No */ #include "script_component.hpp" -private "_number"; - -_number = _this call FUNC(getStringFromMissionSQM); - -parseNumber _number; +parseNumber (_this call FUNC(getStringFromMissionSQM)) // return diff --git a/addons/common/functions/fnc_getNumberMagazinesIn.sqf b/addons/common/functions/fnc_getNumberMagazinesIn.sqf index 91921abd77..df1f7ed64b 100644 --- a/addons/common/functions/fnc_getNumberMagazinesIn.sqf +++ b/addons/common/functions/fnc_getNumberMagazinesIn.sqf @@ -1,26 +1,30 @@ -/** - * fn_getNumberMagazinesIn.sqf - * @Descr: - * @Author: Glowbal +/* + * Author: Glowbal + * Count magazines of unit. * - * @Arguments: [] - * @Return: - * @PublicAPI: true + * Arguments: + * 0: Unit + * 1: Magazine + * + * Return Value: + * Magazine amount + * + * Public: No */ - #include "script_component.hpp" -PARAMS_2(_unit,_magazine); - -private ["_return"]; +params ["_unit", "_magazine"]; +private "_return"; _return = 0; + if (_unit isKindOf "CAManBase") then { _return = {_x == _magazine} count magazines _unit; } else { { _return = _return + {_x == _magazine} count magazines _x; - } forEach (crew _unit); + false + } count crew _unit; _return = _return + ({_x == _magazine} count getMagazineCargo _unit); }; diff --git a/addons/common/functions/fnc_getPitchBankYaw.sqf b/addons/common/functions/fnc_getPitchBankYaw.sqf index 2a9b0bacd1..89fab8d92b 100644 --- a/addons/common/functions/fnc_getPitchBankYaw.sqf +++ b/addons/common/functions/fnc_getPitchBankYaw.sqf @@ -1,14 +1,19 @@ /* * Author: KoffeinFlummi - * - * Returns [pitch, bank, yaw] for given vehicle in degrees. + * Returns pitch, bank, yaw for given vehicle in degrees. * * Arguments: - * 0: Unit/Vehicle + * 0: Unit/Vehicle * * Return Value: - * [pitch, bank, yaw] + * 0: pitch + * 1: bank + * 2: yaw + * + * Public: Yes */ #include "script_component.hpp" -((_this select 0) call BIS_fnc_getPitchBank) + [getDir (_this select 0)] +params ["_vehicle"]; + +(_vehicle call BIS_fnc_getPitchBank) + [getDir _vehicle] diff --git a/addons/common/functions/fnc_getReflectorsWithSelections.sqf b/addons/common/functions/fnc_getReflectorsWithSelections.sqf index d50269ade8..ef2b908bde 100644 --- a/addons/common/functions/fnc_getReflectorsWithSelections.sqf +++ b/addons/common/functions/fnc_getReflectorsWithSelections.sqf @@ -6,16 +6,19 @@ * They behave like having an armor value of 0. * * Arguments: - * 0: A vehicle, not the classname (Object) + * 0: Vehicle * * Return Value: - * The light names and selections (Array) + * 0: Light Hitpoints + * 1: Selections + * + * Public: Yes */ #include "script_component.hpp" -private ["_config", "_hitpoints", "_selections", "_i"]; +params ["_vehicle"]; -PARAMS_1(_vehicle); +private ["_config", "_hitpoints", "_selections"]; _config = configFile >> "CfgVehicles" >> typeOf _vehicle; diff --git a/addons/common/functions/fnc_getSelectionsWithoutHitPoints.sqf b/addons/common/functions/fnc_getSelectionsWithoutHitPoints.sqf new file mode 100644 index 0000000000..277155108a --- /dev/null +++ b/addons/common/functions/fnc_getSelectionsWithoutHitPoints.sqf @@ -0,0 +1,28 @@ +/* + * Author: commy2 + * + * Returns all damageable selections without hitpoints of any vehicle. + * + * Arguments: + * 0: A vehicle, not the classname (Object) + * + * Return Value: + * The selections without hitpoints, i.e. reflectors. (Array) + */ +#include "script_component.hpp" + +params ["_vehicle"]; + +private ["_hitPointsFull", "_allSelectionsWithoutHitpoints"]; + +_hitPointsFull = getAllHitPointsDamage _vehicle; + +_allSelectionsWithoutHitpoints = []; + +{ + if (_x == "") then { + _allSelectionsWithoutHitpoints pushBack (_hitPointsFull select 1 select _forEachIndex); + }; +} forEach (_hitPointsFull select 0); + +_allSelectionsWithoutHitpoints diff --git a/addons/common/functions/fnc_getSettingData.sqf b/addons/common/functions/fnc_getSettingData.sqf index 40ed962a7a..de9ef40447 100644 --- a/addons/common/functions/fnc_getSettingData.sqf +++ b/addons/common/functions/fnc_getSettingData.sqf @@ -3,29 +3,32 @@ * Returns the metadata of a setting if it exists * * Arguments: - * 0: Name of the setting (String) + * 0: Setting Name * * Return Value: * Setting Data (Array) - * 0: _name - * 1: _typeName - * 2: _isClientSetable - * 3: _localizedName - * 4: _localizedDescription - * 5: _possibleValues - * 6: _isForced - * 7: _defaultValue + * 0: Name + * 1: Type Name + * 2: Is Client Settable + * 3: Localized Name + * 4: Localized Description + * 5: Possible Values + * 6: Is Forced + * 7: Default Value + * 8: Localized Category * * Public: No */ #include "script_component.hpp" -PARAMS_1(_name); +params ["_name"]; -private ["_value"]; +private "_value"; _value = []; + { - if ((_x select 0) == _name) exitWith {_value = _x}; -} forEach GVAR(settings); + if (_x select 0 == _name) exitWith {_value = _x}; + false +} count GVAR(settings); _value diff --git a/addons/common/functions/fnc_getStringFromMissionSQM.sqf b/addons/common/functions/fnc_getStringFromMissionSQM.sqf index cfb7495467..6b6a34cfb7 100644 --- a/addons/common/functions/fnc_getStringFromMissionSQM.sqf +++ b/addons/common/functions/fnc_getStringFromMissionSQM.sqf @@ -1,28 +1,34 @@ /* * Author: commy2 + * Get a string from the mission.sqm file. Mission has to be saved in the Editor. + * The string cannot contain the ; character. + * If the entry does not exist, it might return an empty string or an entry with the same name of another class! * - * Get a string from the mission.sqm file. Mission has to be saved in the Editor. The string cannot contain the ; character. + * Arguments: + * 0: Path of the entry in the mission.sqm * - * Argument: - * 0: Path of the entry in the mission.sqm (Array) + * Return Value: + * Value of the entry. * - * Return value: - * Value of the entry. Note: If the entry does not exist, it might return an empty string or an entry with the same name of another class! (String) + * Public: No */ #include "script_component.hpp" -private ["_path", "_mission", "_a", "_class", "_index", "_array", "_b", "_entry"]; +private ["_path", "_mission", "_class", "_index", "_array", "_entry"]; _path = _this; if (missionName == "") exitWith {""}; + _mission = toArray toLower loadFile "mission.sqm"; _mission resize 65536; + { if (_x < 33) then { _mission set [_forEachIndex, -1]; } } forEach _mission; + _mission = toString (_mission - [-1]); {_path set [_forEachIndex, toLower _x]} forEach _path; @@ -33,9 +39,11 @@ for "_a" from 0 to (count _path - 2) do { _index = _mission find _class; _array = toArray _mission; + for "_b" from 0 to (_index + count toArray _class - 1) do { _array set [_b, -1]; }; + _array = _array - [-1]; _mission = toString _array; @@ -43,16 +51,20 @@ for "_a" from 0 to (count _path - 2) do { _entry = format ["%1=", _path select (count _path - 1)]; _index = _mission find _entry; + if (_index == -1) exitWith {""}; _array = toArray _mission; + for "_b" from 0 to (_index + count toArray _entry - 1) do { _array set [_b, -1]; }; + _mission = toString (_array - [-1]); _index = _mission find ";"; _mission = toArray _mission; _mission resize _index; -format ["%1", toString _mission]; + +format ["%1", toString _mission] // return diff --git a/addons/common/functions/fnc_getTargetAzimuthAndInclination.sqf b/addons/common/functions/fnc_getTargetAzimuthAndInclination.sqf index 396a3ec85e..da23e600aa 100644 --- a/addons/common/functions/fnc_getTargetAzimuthAndInclination.sqf +++ b/addons/common/functions/fnc_getTargetAzimuthAndInclination.sqf @@ -1,14 +1,15 @@ /* * Author: commy2 + * Get players viewing direction and slope. * - * Get players viewing direction and slope + * Arguments: + * None * - * Argument: - * None. + * Return Value: + * 0: Azimuth + * 1: Inclination * - * Return value: - * 0: Azimuth (Number) - * 1: Inclination or 'slope' (Number) + * Public: Yes */ #include "script_component.hpp" diff --git a/addons/common/functions/fnc_getTargetDistance.sqf b/addons/common/functions/fnc_getTargetDistance.sqf index ac3c444a73..fe75268cea 100644 --- a/addons/common/functions/fnc_getTargetDistance.sqf +++ b/addons/common/functions/fnc_getTargetDistance.sqf @@ -1,21 +1,22 @@ /* * Author: commy2 - * * Get the distance to the next object the player is looking at. Used for laser distance measurements. * - * Argument: - * 0: How accurate will the measurement be? In meters. (Number) - * 1: Maximal distance to measure. (Number) - * 2: Minimal distance to measure. (optional, Number) + * Arguments: + * 0: Messurement Accuracy + * 1: Maximal messure distance + * 2: Minimal messure distance (default: nil) * - * Return value: - * Measured distance in meters. Can return maximal or minimal distance (Number) + * Return Value: + * Distance in meters + * + * Public: Yes */ #include "script_component.hpp" -private ["_position", "_laser", "_line", "_distance", "_iteration"]; +params ["_interval", "_maxDistance", "_minDistance"]; -PARAMS_3(_interval,_maxDistance,_minDistance); +private ["_position", "_laser", "_line", "_distance", "_iteration"]; _position = ATLToASL positionCameraToWorld [0, 0, 0]; _position set [2, (_position select 2) - (getTerrainHeightASL _position min 0)]; @@ -42,6 +43,6 @@ _distance = _interval * round (_distance / _interval); _distance = _distance min _maxDistance; -if !(isNil "_minDistance") then {_distance = _distance max _minDistance}; +if (!isNil "_minDistance") then {_distance = _distance max _minDistance}; _distance diff --git a/addons/common/functions/fnc_getTargetObject.sqf b/addons/common/functions/fnc_getTargetObject.sqf index 6e3db94763..adaaa3e344 100644 --- a/addons/common/functions/fnc_getTargetObject.sqf +++ b/addons/common/functions/fnc_getTargetObject.sqf @@ -1,19 +1,20 @@ /* * Author: commy2 - * * Get the nearest object the player is looking at. Used for laser designator instead of cursorTarget. * - * Argument: - * 0: Maximal distance to search. (Number) + * Arguments: + * 0: Maximum search distance * - * Return value: - * Nearest object directly in line of sight, if none objNull (Object) + * Return Value: + * Nearest object in line of sight, objNull if none are found + * + * Public: Yes */ #include "script_component.hpp" -private ["_position", "_laser", "_intersects"]; +params ["_maxDistance"]; -PARAMS_1(_maxDistance); +private ["_position", "_laser", "_intersects"]; _position = ATLToASL positionCameraToWorld [0, 0, 0]; _position set [2, (_position select 2) - (getTerrainHeightASL _position min 0)]; @@ -23,4 +24,6 @@ _laser set [2, (_laser select 2) - (getTerrainHeightASL _laser min 0)]; _intersects = lineIntersectsObjs [_position, _laser, objNull, objNull, true, 2]; -if (count _intersects == 0) then {objNull} else {_intersects select 0} +if (_intersects isEqualTo []) exitWith {objNull}; + +_intersects select 0 // return diff --git a/addons/common/functions/fnc_getTurnedOnLights.sqf b/addons/common/functions/fnc_getTurnedOnLights.sqf index b0eb201bca..0d71a3362e 100644 --- a/addons/common/functions/fnc_getTurnedOnLights.sqf +++ b/addons/common/functions/fnc_getTurnedOnLights.sqf @@ -1,21 +1,22 @@ /* * Author: commy2 - * * Returns all turned on lights of any vehicle or streetlamp. * * Arguments: - * 0: A vehicle, not the classname (Object) + * 0: Vehicle * * Return Value: - * All burning lights (Array) + * All burning lights + * + * Public: Yes */ #include "script_component.hpp" -PARAMS_1(_vehicle); +params ["_vehicle"]; if (!isLightOn _vehicle) exitWith {[]}; -private ["_reflectorsWithSelections", "_lights", "_hitpoints"]; +private ["_reflectorsWithSelections", "_lights", "_hitpoints", "_turnedOnLights"]; _reflectorsWithSelections = [[_vehicle], FUNC(getReflectorsWithSelections), uiNamespace, format [QEGVAR(cache,%1_%2), QUOTE(DFUNC(getReflectorsWithSelections)), typeOf _vehicle], 1E11] call FUNC(cachedCall); //_reflectorsWithSelections = [_vehicle] call FUNC(getReflectorsWithSelections); @@ -23,13 +24,12 @@ _reflectorsWithSelections = [[_vehicle], FUNC(getReflectorsWithSelections), uiNa _lights = _reflectorsWithSelections select 0; _hitpoints = _reflectorsWithSelections select 1; -private "_turnedOnLights"; _turnedOnLights = []; + { if (_vehicle getHit _x <= 0.9) then { _turnedOnLights pushBack (_lights select _forEachIndex); }; - } forEach _hitpoints; _turnedOnLights diff --git a/addons/common/functions/fnc_getTurretCommander.sqf b/addons/common/functions/fnc_getTurretCommander.sqf index 99665d03e3..e045c2d46f 100644 --- a/addons/common/functions/fnc_getTurretCommander.sqf +++ b/addons/common/functions/fnc_getTurretCommander.sqf @@ -1,30 +1,34 @@ /* * Author: commy2 - * * Get the turret index of a vehicles commander. * - * Argument: - * 0: Vehicle (Object) + * Arguments: + * 0: Vehicle * - * Return value: - * Turret index of the vehicles commander. Empty array means no observer position. (Array) + * Return Value: + * Vehicle commander turrent indecies + * + * Public: Yes */ #include "script_component.hpp" -private ["_turrets", "_turret", "_config"]; +params ["_vehicle"]; -PARAMS_1(_vehicle); +private ["_turrets", "_turret", "_config"]; _turrets = allTurrets [_vehicle, true]; _turret = []; + { - _config = configFile >> "CfgVehicles" >> typeOf _vehicle; + _config = configFile >> "CfgVehicles" >> typeOf _vehicle; - _config = [_config, _x] call FUNC(getTurretConfigPath); + _config = [_config, _x] call FUNC(getTurretConfigPath); + + if (getNumber (_config >> "primaryObserver") == 1) exitWith { + _turret = _x; + }; + false +} count _turrets; - if (getNumber (_config >> "primaryObserver") == 1) exitWith { - _turret = _x; - }; -} forEach _turrets; _turret diff --git a/addons/common/functions/fnc_getTurretConfigPath.sqf b/addons/common/functions/fnc_getTurretConfigPath.sqf index 1fca65eaac..07d7ac4e0c 100644 --- a/addons/common/functions/fnc_getTurretConfigPath.sqf +++ b/addons/common/functions/fnc_getTurretConfigPath.sqf @@ -1,28 +1,29 @@ /* * Author: commy2 - * * Get the config path of a vehicles turret. * - * Argument: - * 0: vehicles config (Config) - * 1: Turret index (Array) + * Arguments: + * 0: Vehicle Config + * 1: Turret indecies * - * Return value: - * Turret config (Config) + * Return Value: + * Turret config + * + * Public: Yes */ #include "script_component.hpp" -private ["_index", "_offset", "_config2", "_foundClasses", "_a"]; +params ["_config", "_turretIndex"]; -PARAMS_2(_config,_turretIndex); +private ["_offset", "_config2", "_foundClasses"]; for "_index" from 0 to (count _turretIndex - 1) do { _config = _config >> "Turrets"; _offset = 0; _config2 = _config select 0; - _foundClasses = 0; + for "_a" from 0 to (count _config - 1) do { if (isClass _config2) then { _foundClasses = _foundClasses + 1; @@ -33,6 +34,8 @@ for "_index" from 0 to (count _turretIndex - 1) do { if (_foundClasses == _turretIndex select _index) exitWith {}; }; + _config = _config2; }; + _config diff --git a/addons/common/functions/fnc_getTurretCopilot.sqf b/addons/common/functions/fnc_getTurretCopilot.sqf index d496051558..94a30b7697 100644 --- a/addons/common/functions/fnc_getTurretCopilot.sqf +++ b/addons/common/functions/fnc_getTurretCopilot.sqf @@ -1,23 +1,25 @@ /* * Author: commy2 - * * Get the turret index of a vehicles copilot. * - * Argument: - * 0: Vehicle (Object) + * Arguments: + * 0: Vehicle * - * Return value: - * Turret index of the vehicles gunner. Empty array means no copilot position. (Array) + * Return Value: + * Vehicle Copilot Turret indecies + * + * Public: Yes */ #include "script_component.hpp" -private ["_turrets", "_turret", "_config"]; +params ["_vehicle"]; -PARAMS_1(_vehicle); +private ["_turrets", "_turret", "_config"]; _turrets = allTurrets [_vehicle, true]; _turret = []; + { _config = configFile >> "CfgVehicles" >> typeOf _vehicle; @@ -26,6 +28,7 @@ _turret = []; if (getNumber (_config >> "isCopilot") == 1 && {getNumber (_config >> "primaryGunner") != 1} && {getNumber (_config >> "primaryObserver") != 1}) exitWith { _turret = _x; }; -} forEach _turrets; + false +} count _turrets; _turret diff --git a/addons/common/functions/fnc_getTurretDirection.sqf b/addons/common/functions/fnc_getTurretDirection.sqf index 31b68ccabc..ced29a9a85 100644 --- a/addons/common/functions/fnc_getTurretDirection.sqf +++ b/addons/common/functions/fnc_getTurretDirection.sqf @@ -1,37 +1,47 @@ /* * Author: jaynus - * * Get the absolute turret direction for FOV/PIP turret. * - * Argument: - * 0: Vehicle (Object) - * 1: Turret Position + * Arguments: + * 0: Vehicle + * 1: Turret Position * - * Return value: - * [position, direction] + * Return Value: + * 0: Position ASL + * 1: Direction + * + * Public: Yes */ #include "script_component.hpp" -PARAMS_2(_vehicle,_position); -private ["_turret", "_povPos", "_povDir", "_gunBeginPos", "_gunEndPos", "_pov", "_gunBeg", "_gunEnd", "_pipDir"]; +params ["_vehicle", "_position"]; + +private ["_turret", "_pov", "_gunBeg", "_gunEnd", "_povPos", "_povDir"]; _turret = [_vehicle, _position] call CBA_fnc_getTurret; + _pov = getText (_turret >> "memoryPointGunnerOptics"); _gunBeg = getText (_turret >> "gunBeg"); -_gunEnd = getText (_turret >> "gunEnd"); +_gunEnd = getText (_turret >> "gunEnd"); + TRACE_3("", _pov, _gunBeg, _gunEnd); // Pull the PIP pov or barrel direction, depending on how the model is set up -_povPos = ATLtoASL ( _vehicle modelToWorldVisual (_vehicle selectionPosition _pov ) ); +_povPos = ATLtoASL (_vehicle modelToWorldVisual (_vehicle selectionPosition _pov)); //@todo AGLToASL ? _povDir = [0,0,0]; if (_pov == "pip0_pos") then { - _pipDir = ATLtoASL ( _vehicle modelToWorldVisual (_vehicle selectionPosition "pip0_dir" ) ); + private "_pipDir"; + _pipDir = ATLtoASL (_vehicle modelToWorldVisual (_vehicle selectionPosition "pip0_dir")); + _povDir = _pipDir vectorDiff _povPos; } else { - _gunBeginPos = ATLtoASL ( _vehicle modelToWorldVisual (_vehicle selectionPosition _gunBeg ) ); - _gunEndPos = ATLtoASL ( _vehicle modelToWorldVisual (_vehicle selectionPosition _gunEnd ) ); + private ["_gunBeginPos", "_gunEndPos"]; + + _gunBeginPos = ATLtoASL (_vehicle modelToWorldVisual (_vehicle selectionPosition _gunBeg)); + _gunEndPos = ATLtoASL (_vehicle modelToWorldVisual (_vehicle selectionPosition _gunEnd)); + _povDir = _gunBeginPos vectorDiff _gunEndPos; }; -[_povPos, _povDir] \ No newline at end of file +[_povPos, _povDir] diff --git a/addons/common/functions/fnc_getTurretGunner.sqf b/addons/common/functions/fnc_getTurretGunner.sqf index a4bcca54dd..9a71d292bd 100644 --- a/addons/common/functions/fnc_getTurretGunner.sqf +++ b/addons/common/functions/fnc_getTurretGunner.sqf @@ -1,23 +1,25 @@ /* * Author: commy2 - * * Get the turret index of a vehicles gunner. * - * Argument: - * 0: Vehicle (Object) + * Arguments: + * 0: Vehicle * - * Return value: - * Turret index of the vehicles gunner. Empty array means no gunner position. (Array) + * Return Value: + * Vehicle Gunner Turret indecies + * + * Public: Yes */ #include "script_component.hpp" -private ["_turrets", "_turret", "_config"]; +params ["_vehicle"]; -PARAMS_1(_vehicle); +private ["_turrets", "_turret", "_config"]; _turrets = allTurrets [_vehicle, true]; _turret = []; + { _config = configFile >> "CfgVehicles" >> typeOf _vehicle; @@ -26,6 +28,7 @@ _turret = []; if (getNumber (_config >> "primaryGunner") == 1) exitWith { _turret = _x; }; -} forEach _turrets; + false +} count _turrets; _turret diff --git a/addons/common/functions/fnc_getTurretIndex.sqf b/addons/common/functions/fnc_getTurretIndex.sqf index bfb96b4665..b2f28c5f90 100644 --- a/addons/common/functions/fnc_getTurretIndex.sqf +++ b/addons/common/functions/fnc_getTurretIndex.sqf @@ -1,19 +1,21 @@ /* * Author: commy2 - * * Get the turret index of a units current turret. * - * Argument: - * 0: Unit, not the vehicle (as in not a car but the player) (Object) + * Arguments: + * 0: Unit * - * Return value: - * Turret index array or config path. E.g: [0] for gunner or [0,0] for commander. Returns empty array if unit is not in a turret. (Array) + * Return Value: + * Turret Index + * + * Public: Yes */ #include "script_component.hpp" +params ["_unit"]; + private ["_vehicle", "_turrets", "_units", "_index"]; -PARAMS_1(_unit); _vehicle = vehicle _unit; if (_unit == _vehicle) exitWith {[]}; @@ -21,9 +23,11 @@ if (_unit == _vehicle) exitWith {[]}; _turrets = allTurrets [_vehicle, true]; _units = []; + { - _units pushBack (_vehicle turretUnit _x); -} forEach _turrets; + _units pushBack (_vehicle turretUnit _x); + false +} count _turrets; _index = _units find _unit; diff --git a/addons/common/functions/fnc_getTurrets.sqf b/addons/common/functions/fnc_getTurrets.sqf index ea656941e4..9a1a48e2bd 100644 --- a/addons/common/functions/fnc_getTurrets.sqf +++ b/addons/common/functions/fnc_getTurrets.sqf @@ -1,37 +1,45 @@ /* * Author: commy2 + * Get all turret indicies of a vehicle type. * - * Get all turret indicies of a vehicle. + * Arguments: + * 0: Vehicle type * - * Argument: - * 0: Vehicle type (String) + * Return Value: + * Turret Indecies * - * Return value: - * All turret index arrays of the vehicle. E.g: [[0], [0,0]] (Array) + * Public: Yes + * + * Note: It's advised to use allTurrets [_vehicle, true] instead whenever possible */ #include "script_component.hpp" -private ["_config", "_turrets", "_fnc_addTurret", "_varName"]; +params ["_type"]; -PARAMS_1(_type); +private ["_varName", "_turrets"]; -_varName = format ["ACE_CachedTurrets_%1", _type]; +_varName = format [QGVAR(CachedTurrets_%1), _type]; _turrets = + (uiNamespace getVariable _varName); if (!isNil "_turrets") exitWith {_turrets}; +private ["_config", "_fnc_addTurret"]; + _config = configFile >> "CfgVehicles" >> _type; _turrets = []; -_fnc_addTurret = { - private ["_count", "_offset", "_index", "_path2", "_config2"]; - PARAMS_2(_config,_path); +_fnc_addTurret = { + params ["_config", "_path"]; _config = _config >> "Turrets"; + + private ["_count", "_offset", "_path2", "_config2"]; + _count = count _config; _offset = 0; + for "_index" from 0 to (_count - 1) do { _path2 = _path + [_index - _offset]; _config2 = _config select _index; diff --git a/addons/common/functions/fnc_getTurretsFFV.sqf b/addons/common/functions/fnc_getTurretsFFV.sqf index 2eaa8807b0..ff7726d1be 100644 --- a/addons/common/functions/fnc_getTurretsFFV.sqf +++ b/addons/common/functions/fnc_getTurretsFFV.sqf @@ -1,23 +1,25 @@ /* * Author: commy2 - * * Get the turret indices of ffv turrets. * - * Argument: - * 0: Vehicle (Object) + * Arguments: + * 0: Vehicle * - * Return value: - * Turret index of the vehicles gunner. Empty array means no ffv turrets. (Array) + * Return Value: + * Vehicle FFV Turret indecies + * + * Public: Yes */ #include "script_component.hpp" -private ["_turrets", "_turret", "_config"]; +params ["_vehicle"]; -PARAMS_1(_vehicle); +private ["_turrets", "_turret", "_config"]; _turrets = allTurrets [_vehicle, true]; _turret = []; + { _config = configFile >> "CfgVehicles" >> typeOf _vehicle; @@ -26,5 +28,7 @@ _turret = []; if (getNumber (_config >> "isPersonTurret") == 1) then { _turret pushBack _x; }; -} forEach _turrets; + false +} count _turrets; + _turret diff --git a/addons/common/functions/fnc_getTurretsOther.sqf b/addons/common/functions/fnc_getTurretsOther.sqf index 5f373f7c9c..93ab3f2321 100644 --- a/addons/common/functions/fnc_getTurretsOther.sqf +++ b/addons/common/functions/fnc_getTurretsOther.sqf @@ -1,23 +1,25 @@ /* * Author: commy2 - * * Get the turret indices of other turrets (not gunner, commander, copilot or ffv). * - * Argument: - * 0: Vehicle (Object) + * Arguments: + * 0: Vehicle * - * Return value: - * Turret index of the vehicles gunner. Empty array means no other turrets. (Array) + * Return Value: + * Vehicle Other Turret indecies + * + * Public: Yes */ #include "script_component.hpp" -private ["_turrets", "_turret", "_config"]; +params ["_vehicle"]; -PARAMS_1(_vehicle); +private ["_turrets", "_turret", "_config"]; _turrets = allTurrets [_vehicle, true]; _turret = []; + { _config = configFile >> "CfgVehicles" >> typeOf _vehicle; @@ -30,5 +32,7 @@ _turret = []; ) then { _turret pushBack _x; }; -} forEach _turrets; + false +} count _turrets; + _turret diff --git a/addons/common/functions/fnc_getUavControlPosition.sqf b/addons/common/functions/fnc_getUavControlPosition.sqf index ad2487c9c1..a9b5340eb2 100644 --- a/addons/common/functions/fnc_getUavControlPosition.sqf +++ b/addons/common/functions/fnc_getUavControlPosition.sqf @@ -1,32 +1,34 @@ /* -Name: FUNC(getUavControlPosition) - -Author: Pabst Mirror - -Description: - Gets the seat position of a UAV that the unit is activly controlling. - "" - not connected to anything or not activly controling - "DRIVER" - "GUNNER" - -Parameters: - 0: OBJECT - Unit - -Returns: - STRING - Position in the UAV that is currently being controled by the unit. - -Example: - [ACE_Player] call FUNC(getUavControlPosition) -*/ + * Author: PabstMirror + * Returns the seat position of a UAV that the unit is activly controling. + * + * Arguments: + * 0: Unit + * + * Return Value: + * Position + * "" = not connected to anything or activly controling + * "DRIVER" + * "GUNNER" + * + * Example: + * [ACE_Player] call ace_common_fnc_getUavControlPosition + * + * Public: Yes + */ #include "script_component.hpp" +params ["_unit"]; + private ["_uav", "_positionArray", "_playerIndex"]; -PARAMS_1(_unit); _uav = getConnectedUAV _unit; + if (isNull _uav) exitWith {""}; + _positionArray = UAVControl _uav; _playerIndex = _positionArray find _unit; + if (_playerIndex == -1) exitWith {""}; _positionArray select (_playerIndex + 1) diff --git a/addons/common/functions/fnc_getVehicleCargo.sqf b/addons/common/functions/fnc_getVehicleCargo.sqf index 4b8ca63f5c..5be213aa68 100644 --- a/addons/common/functions/fnc_getVehicleCargo.sqf +++ b/addons/common/functions/fnc_getVehicleCargo.sqf @@ -1,19 +1,20 @@ /* * Author: commy2 - * * Get the vehicle cargo positions. Codrivers and ffv positions are not listed. * - * Argument: - * 0: Vehicle type (String) + * Arguments: + * 0: Vehicle type * - * Return value: - * Vehicle cargo positions. (Array) + * Return Value: + * Vehicle cargo positions + * + * Public: Yes */ #include "script_component.hpp" -private ["_config", "_cargo", "_codrivers", "_index"]; +params ["_vehicle"]; -PARAMS_1(_vehicle); +private ["_config", "_cargo", "_codrivers"]; _config = configFile >> "CfgVehicles" >> _vehicle; @@ -25,4 +26,5 @@ for "_index" from 0 to (getNumber (_config >> "transportSoldier") - 1) do { _cargo pushBack _index; }; }; + _cargo diff --git a/addons/common/functions/fnc_getVehicleCodriver.sqf b/addons/common/functions/fnc_getVehicleCodriver.sqf index 019c7b9971..e23cfcd0d4 100644 --- a/addons/common/functions/fnc_getVehicleCodriver.sqf +++ b/addons/common/functions/fnc_getVehicleCodriver.sqf @@ -1,19 +1,20 @@ /* * Author: commy2 - * * Get the vehicle codriver positions. * - * Argument: - * 0: Vehicle type (String) + * Arguments: + * 0: Vehicle type * - * Return value: - * Vehicle codriver positions. (Array) + * Return Value: + * Vehicle codriver positions + * + * Public: Yes */ #include "script_component.hpp" -private ["_config", "_cargo", "_codrivers", "_index"]; +params ["_vehicle"]; -PARAMS_1(_vehicle); +private ["_config", "_cargo", "_codrivers"]; _config = configFile >> "CfgVehicles" >> _vehicle; @@ -25,4 +26,5 @@ for "_index" from 0 to (getNumber (_config >> "transportSoldier") - 1) do { _cargo pushBack _index; }; }; + _cargo diff --git a/addons/common/functions/fnc_getVehicleCrew.sqf b/addons/common/functions/fnc_getVehicleCrew.sqf index 23957c31fd..58d0067b85 100644 --- a/addons/common/functions/fnc_getVehicleCrew.sqf +++ b/addons/common/functions/fnc_getVehicleCrew.sqf @@ -1,36 +1,37 @@ /* * Author: commy2 - * * Returns array of crew member objects. * - * Argument: - * 0: Vehicle (Object) - * 1: Slot types. Can contain "driver", "commander", "gunner", "turret", "cargo" and "ffv". Case sensitive (Array) + * Arguments: + * 0: Vehicle + * 1: Slot types filter (default: ["driver", "commander", "gunner", "turret", "cargo", "ffv"]) * - * Return value: - * Crew (Array) + * Return Value: + * Crew + * + * Public: Yes */ #include "script_component.hpp" -private ["_crew"]; - -PARAMS_2(_vehicle,_types); +params ["_vehicle", ["_types", ["driver", "commander", "gunner", "turret", "cargo", "ffv"]]]; +private "_crew"; _crew = []; // iterate through all crew members { - // this unit is in a ffv position. check if we search for ffv. - if (_x select 4) then { - if ("ffv" in _types) then { - _crew pushBack (_x select 0); + // this unit is in a ffv position. check if we search for ffv. + if (_x select 4) then { + if ("ffv" in _types) then { + _crew pushBack (_x select 0); + }; + } else { + // otherwise check if we search for that type. toLower, because fullCrew returns "driver" vs. "Turret". + if (toLower (_x select 1) in _types) then { + _crew pushBack (_x select 0); + }; }; - } else { - // otherwise check if we search for that type. toLower, because fullCrew returns "driver" vs. "Turret". - if (toLower (_x select 1) in _types) then { - _crew pushBack (_x select 0); - }; - }; -} forEach fullCrew _vehicle; + false +} count fullCrew _vehicle; _crew diff --git a/addons/common/functions/fnc_getVehicleUAVCrew.sqf b/addons/common/functions/fnc_getVehicleUAVCrew.sqf new file mode 100644 index 0000000000..8d9156810a --- /dev/null +++ b/addons/common/functions/fnc_getVehicleUAVCrew.sqf @@ -0,0 +1,17 @@ +/* + * Author: commy2 + * Returns array of uav dummy ais. + * + * Arguments: + * 0: Vehicle + * + * Return Value: + * UAV Dummy Crew + * + * Public: Yes + */ +#include "script_component.hpp" + +params ["_vehicle"]; + +[crew _vehicle, {getText (configFile >> "CfgVehicles" >> typeOf _this >> "simulation") == "UAVPilot"}] call FUNC(filter) // return diff --git a/addons/common/functions/fnc_getVersion.sqf b/addons/common/functions/fnc_getVersion.sqf index e1bd95cdab..24773240b7 100644 --- a/addons/common/functions/fnc_getVersion.sqf +++ b/addons/common/functions/fnc_getVersion.sqf @@ -1,11 +1,15 @@ -/** - * fn_getVersion.sqf - * @Descr: Get the version number of the current ACE Build - * @Author: Glowbal +/* + * Author: Glowbal + * Get the version number of the current ACE build. * - * @Arguments: [] - * @Return: STRING String containing the version - * @PublicAPI: true + * Arguments: + * None + * + * Return Value: + * ACE Version + * + * Public: Yes */ #include "script_component.hpp" -getText (configFile >> "cfgPatches" >> "ACE_main" >> "version"); \ No newline at end of file + +getText (configFile >> "CfgPatches" >> "ACE_main" >> "version") // return diff --git a/addons/common/functions/fnc_getWeaponAzimuthAndInclination.sqf b/addons/common/functions/fnc_getWeaponAzimuthAndInclination.sqf index 03b7b1c707..09968d8e39 100644 --- a/addons/common/functions/fnc_getWeaponAzimuthAndInclination.sqf +++ b/addons/common/functions/fnc_getWeaponAzimuthAndInclination.sqf @@ -1,20 +1,21 @@ /* * Author: commy2 + * Get local players weapon direction and slope. * - * Get players weapon direction and slope + * Arguments: + * 0: Weapon name * - * Argument: - * 0: Weapon name (String) + * Return Value: + * 0: Azimuth + * 1: Inclination * - * Return value: - * 0: Azimuth (Number) - * 1: Inclination or 'slope' (Number) + * Public: Yes */ #include "script_component.hpp" -private ["_direction", "_azimuth", "_inclination"]; +params ["_weapon"]; -PARAMS_1(_weapon); +private ["_direction", "_azimuth", "_inclination"]; _direction = ACE_player weaponDirection _weapon; diff --git a/addons/common/functions/fnc_getWeaponIndex.sqf b/addons/common/functions/fnc_getWeaponIndex.sqf index b11054a5e7..0e24f190a5 100644 --- a/addons/common/functions/fnc_getWeaponIndex.sqf +++ b/addons/common/functions/fnc_getWeaponIndex.sqf @@ -1,20 +1,23 @@ /* * Author: commy2 * Get the index of the weapon. - * 0 = primary, 1 = secondary, 2 = handgun, -1 = other * - * Argument: + * Arguments: * 0: Unit * 1: Weapon * - * Return value: + * Return Value: * Weapon index + * 0 = primary + * 1 = secondary + * 2 = handgun + * -1 = other * - * Public: No + * Public: Yes */ #include "script_component.hpp" -PARAMS_2(_unit,_weapon); +params ["_unit", "_weapon"]; if (_weapon == "") exitWith {-1}; @@ -22,4 +25,4 @@ if (_weapon == "") exitWith {-1}; primaryWeapon _unit, secondaryWeapon _unit, handgunWeapon _unit -] find _weapon +] find _weapon // return diff --git a/addons/common/functions/fnc_getWeaponModes.sqf b/addons/common/functions/fnc_getWeaponModes.sqf index 83e7b7559f..a2bb9c3205 100644 --- a/addons/common/functions/fnc_getWeaponModes.sqf +++ b/addons/common/functions/fnc_getWeaponModes.sqf @@ -1,30 +1,34 @@ /* * Author: commy2 + * Get the available firing modes of a weapon. Will ignore the AI helper modes. * - * Get the available firing modes of a weapon. Will ignore the ai helper modes. + * Arguments: + * 0: Weapon * - * Argument: - * 0: A weapon in cfgWeapons (String) + * Return Value: + * Firing Modes * - * Return value: - * All firing modes (Array) + * Public: Yes */ #include "script_component.hpp" -private ["_modes"]; +params ["_weapon"]; -PARAMS_1(_weapon); +private ["_config", "_modes"]; + +_config = configFile >> "CfgWeapons" >> _weapon; _modes = []; + { - if (getNumber (configFile >> "CfgWeapons" >> _weapon >> _x >> "showToPlayer") == 1) then { + if (getNumber (_config >> _x >> "showToPlayer") == 1) then { _modes pushBack _x; }; if (_x == "this") then { _modes pushBack _weapon; }; - -} forEach getArray (configfile >> "CfgWeapons" >> _weapon >> "modes"); + false +} count getArray (_config >> "modes"); _modes diff --git a/addons/common/functions/fnc_getWeaponMuzzles.sqf b/addons/common/functions/fnc_getWeaponMuzzles.sqf index b0b7173d2f..cdfd58f238 100644 --- a/addons/common/functions/fnc_getWeaponMuzzles.sqf +++ b/addons/common/functions/fnc_getWeaponMuzzles.sqf @@ -1,20 +1,20 @@ /* * Author: commy2 - * * Get the muzzles of a weapon. * - * Argument: - * 0: A weapon in cfgWeapons (String) + * Arguments: + * 0: Weapon * - * Return value: - * All weapon muzzles (Array) + * Return Value: + * All weapon muzzles + * + * Public: Yes */ #include "script_component.hpp" -private ["_muzzles"]; - -PARAMS_1(_weapon); +params ["_weapon"]; +private "_muzzles"; _muzzles = getArray (configFile >> "CfgWeapons" >> _weapon >> "muzzles"); if ("this" in _muzzles) then { diff --git a/addons/common/functions/fnc_getWeaponState.sqf b/addons/common/functions/fnc_getWeaponState.sqf index 543f356b7e..8ee1610f4e 100644 --- a/addons/common/functions/fnc_getWeaponState.sqf +++ b/addons/common/functions/fnc_getWeaponState.sqf @@ -1,46 +1,28 @@ /* * Author: commy2 - * * Return current state of the weapon. Attachments and magazines with ammo. * - * Argument: - * 0: A unit (Object) - * 1: A weapon (String) + * Arguments: + * 0: unit + * 1: weapon * - * Return value: - * Weapon info, format: [attachments, muzzles, magazines, ammo] (Array) + * Return Value: + * 0: Attachements + * 1: Muzzles + * 2: Magazines + * 3: Ammo + * + * Public: Yes */ - #include "script_component.hpp" +#include "script_component.hpp" -PARAMS_2(_unit,_weapon); +params ["_unit", "_weapon"]; + +private ["_muzzles", "_weaponInfo"]; -private "_muzzles"; _muzzles = [_weapon] call FUNC(getWeaponMuzzles); -private "_weaponInfo"; -_weaponInfo = []; - -switch (_weapon) do { - case (primaryWeapon _unit): { - _weaponInfo pushBack primaryWeaponItems _unit; - - }; - - case (secondaryWeapon _unit): { - _weaponInfo pushBack secondaryWeaponItems _unit; - - }; - - case (handgunWeapon _unit): { - _weaponInfo pushBack handgunItems _unit; - - }; - - default { - _weaponInfo pushBack ["","","",""]; - - }; -}; +_weaponInfo = [["","","",""], primaryWeaponItems _unit, secondaryWeaponItems _unit, handgunItems _unit] select ((["", primaryWeapon _unit, secondaryWeapon _unit, handgunWeapon _unit] find _weapon) max 0); // get loaded magazines and ammo private ["_magazines", "_ammo"]; @@ -51,7 +33,8 @@ _ammo = []; { _magazines pushBack ""; _ammo pushBack 0; -} forEach _muzzles; + false +} count _muzzles; { if (_x select 2) then { @@ -63,7 +46,8 @@ _ammo = []; _ammo set [_index, _x select 1]; }; }; -} forEach magazinesAmmoFull _unit; + false +} count magazinesAmmoFull _unit; _weaponInfo append [_muzzles, _magazines, _ammo]; diff --git a/addons/common/functions/fnc_getWeaponType.sqf b/addons/common/functions/fnc_getWeaponType.sqf index c153bb2b3c..f8ee7f9fe4 100644 --- a/addons/common/functions/fnc_getWeaponType.sqf +++ b/addons/common/functions/fnc_getWeaponType.sqf @@ -1,19 +1,24 @@ /* * Author: commy2 + * Check what kind of weapon the given class name is. * - * Check what kind of weapon the given class name is. (primary, secondary or handgun) + * Arguments: + * 0: Weapons * - * Argument: - * 0: Class name of the weapon (String) + * Return Value: + * Slot index + * 1 = primary + * 2 = secondary + * 3 = handgun + * -1 = other * - * Return value: - * Slot index of the given class name, 1: primary, 2: secondary, 3: handgun, else: -1 (Number) + * Public: Yes */ #include "script_component.hpp" -private ["_type", "_index"]; +params ["_weapon"]; -PARAMS_1(_weapon); +private ["_type", "_index"]; _type = [getNumber (configFile >> "CfgWeapons" >> _weapon >> "type")] call FUNC(binarizeNumber); @@ -23,9 +28,4 @@ while {!(_type select _index) && {_index < 16}} do { _index = _index + 1; }; -switch (_index) do { - case 0 : {1}; - case 1 : {3}; - case 2 : {2}; - default {-1}; -} +[-1, 1, 3, 2] select (([0, 1, 2] find _index) + 1) // return diff --git a/addons/common/functions/fnc_getWindDirection.sqf b/addons/common/functions/fnc_getWindDirection.sqf index d93023bfe4..7341ea9c1d 100644 --- a/addons/common/functions/fnc_getWindDirection.sqf +++ b/addons/common/functions/fnc_getWindDirection.sqf @@ -1,31 +1,33 @@ /* * Author: commy2 - * * Get the compass direction the wind is blowing from. * - * Argument: - * None. + * Arguments: + * None * - * Return value: - * Wind direction. (String) + * Return Value: + * Wind cardinal direction + * + * Public: Yes */ #include "script_component.hpp" -switch (round (windDir / 360 * 16)) do { - case 1 : {localize QUOTE(DOUBLES(STR,GVAR(SSW)))}; - case 2 : {localize QUOTE(DOUBLES(STR,GVAR(SW)))}; - case 3 : {localize QUOTE(DOUBLES(STR,GVAR(WSW)))}; - case 4 : {localize QUOTE(DOUBLES(STR,GVAR(W)))}; - case 5 : {localize QUOTE(DOUBLES(STR,GVAR(WNW)))}; - case 6 : {localize QUOTE(DOUBLES(STR,GVAR(NW)))}; - case 7 : {localize QUOTE(DOUBLES(STR,GVAR(NNW)))}; - case 8 : {localize QUOTE(DOUBLES(STR,GVAR(N)))}; - case 9 : {localize QUOTE(DOUBLES(STR,GVAR(NNE)))}; - case 10 : {localize QUOTE(DOUBLES(STR,GVAR(NE)))}; - case 11 : {localize QUOTE(DOUBLES(STR,GVAR(ENE)))}; - case 12 : {localize QUOTE(DOUBLES(STR,GVAR(E)))}; - case 13 : {localize QUOTE(DOUBLES(STR,GVAR(ESE)))}; - case 14 : {localize QUOTE(DOUBLES(STR,GVAR(SE)))}; - case 15 : {localize QUOTE(DOUBLES(STR,GVAR(SSE)))}; - default {localize QUOTE(DOUBLES(STR,GVAR(S)))}; -}; +localize ([ + LSTRING(S), + LSTRING(SSW), + LSTRING(SW), + LSTRING(WSW), + LSTRING(W), + LSTRING(WNW), + LSTRING(NW), + LSTRING(NNW), + LSTRING(N), + LSTRING(NNE), + LSTRING(NE), + LSTRING(ENE), + LSTRING(E), + LSTRING(ESE), + LSTRING(SE), + LSTRING(SSE), + LSTRING(S) +] select (round (windDir / 360 * 16))) // return diff --git a/addons/common/functions/fnc_getZoom.sqf b/addons/common/functions/fnc_getZoom.sqf index 1f319ac768..f4113198a7 100644 --- a/addons/common/functions/fnc_getZoom.sqf +++ b/addons/common/functions/fnc_getZoom.sqf @@ -1,14 +1,17 @@ /* * Author: commy2 - * * Returns a value depending on current zoom level. * - * Argument: - * None. + * Arguments: + * None * - * Return value: - * Zoom. (Number) + * Return Value: + * Zoom + * + * Public: Yes */ #include "script_component.hpp" -(0.5 - ((worldToScreen positionCameraToWorld [0,1,1]) select 1)) * (getResolution select 5) +if (!hasInterface) exitWith {0}; + +(0.5 - ((worldToScreen positionCameraToWorld [0, 1, 1]) select 1)) * (getResolution select 5) diff --git a/addons/common/functions/fnc_globalEvent.sqf b/addons/common/functions/fnc_globalEvent.sqf index b605a406b1..126419b553 100644 --- a/addons/common/functions/fnc_globalEvent.sqf +++ b/addons/common/functions/fnc_globalEvent.sqf @@ -1,20 +1,21 @@ /* * Author: Nou - * * Execute a global event on all clients, including self. * - * Argument: - * 0: Event name (string) - * 1: Event args (any) + * Arguments: + * 0: Event name + * 1: Event args * - * Return value: - * Nothing + * Return Value: + * None + * + * Public: Yes */ #include "script_component.hpp" -//IGNORE_PRIVATE_WARNING("_handleNetEvent"); -PARAMS_2(_eventName,_eventArgs); +params ["_eventName", "_eventArgs"]; ACEg = [_eventName, _eventArgs]; publicVariable "ACEg"; -["ACEg", ACEg] call FUNC(_handleNetEvent); \ No newline at end of file + +["ACEg", ACEg] call FUNC(_handleNetEvent); diff --git a/addons/common/functions/fnc_goKneeling.sqf b/addons/common/functions/fnc_goKneeling.sqf index 0ff25b460f..4ee502f929 100644 --- a/addons/common/functions/fnc_goKneeling.sqf +++ b/addons/common/functions/fnc_goKneeling.sqf @@ -1,32 +1,22 @@ /* * Author: commy2 + * Move unit to kneeling position. * - * Abhocken! Unit goes kneeling if not prone already and lowers weapon. Try, throw, catch because I'm bored. + * Arguments: + * 0: Unit * - * Argument: - * 0: Unit (Object) + * Return Value: + * None * - * Return value: - * None. + * Public: No */ #include "script_component.hpp" -PARAMS_1(_unit); +params ["_unit"]; -//IGNORE_PRIVATE_WARNING("_exception"); +if (stance _unit == "PRONE") exitWith {}; -try { - if (_unit == vehicle _unit) then { - switch (currentWeapon _unit) do { - case "" : {throw "AmovPknlMstpSnonWnonDnon"}; - case (primaryWeapon _unit) : {throw "AmovPknlMstpSlowWrflDnon"}; - case (secondaryWeapon _unit) : {throw "AmovPknlMstpSrasWlnrDnon"}; - case (handgunWeapon _unit) : {throw "AmovPknlMstpSlowWpstDnon"}; - case (binocular _unit) : {throw "AmovPknlMstpSoptWbinDnon"}; - }; - }; -} catch { - if (stance _unit != "PRONE") then { - [_unit, _exception] call FUNC(doAnimation); - }; -}; +[ + _unit, + ["AmovPknlMstpSnonWnonDnon", "AmovPknlMstpSlowWrflDnon", "AmovPknlMstpSrasWlnrDnon", "AmovPknlMstpSlowWpstDnon", "AmovPknlMstpSoptWbinDnon"] select ((["", primaryWeapon _unit, secondaryWeapon _unit, handgunWeapon _unit, binocular _unit] find currentWeapon _unit) max 0) +] call FUNC(doAnimation); diff --git a/addons/common/functions/fnc_hadamardProduct.sqf b/addons/common/functions/fnc_hadamardProduct.sqf index b063b35313..b4ed7f9be1 100644 --- a/addons/common/functions/fnc_hadamardProduct.sqf +++ b/addons/common/functions/fnc_hadamardProduct.sqf @@ -1,25 +1,25 @@ /* * Author: KoffeinFlummi - * * Returns the Hadamard Product of two vectors. * (x hadamard y) = [x1*y1, x2*y2, x3*y3] * * Arguments: - * 0: Vector 1 - * 1: Vector 2 + * 0: Vector 1 + * 1: Vector 2 * * Return Value: - * Hadamard Product + * Hadamard Product + * + * Public: Yes */ #include "script_component.hpp" -PARAMS_2(_vector1,_vector2); - -private ["_newVector", "_i"]; +params ["_vector1", "_vector2"]; +private "_newVector"; _newVector = []; -for "_i" from 0 to (((count _vector1) min (count _vector2)) - 1) do { +for "_i" from 0 to ((count _vector1 min count _vector2) - 1) do { _newVector pushBack ((_vector1 select _i) * (_vector2 select _i)); }; diff --git a/addons/common/functions/fnc_handleModifierKey.sqf b/addons/common/functions/fnc_handleModifierKey.sqf new file mode 100644 index 0000000000..bfb7e84931 --- /dev/null +++ b/addons/common/functions/fnc_handleModifierKey.sqf @@ -0,0 +1,17 @@ +/* + * Author: commy2 + * Handles key down event for modifier key. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Public : No + */ +#include "script_component.hpp" + +if (_this select 3) then {ACE_modifier = 1}; + +false diff --git a/addons/common/functions/fnc_handleModifierKeyInit.sqf b/addons/common/functions/fnc_handleModifierKeyInit.sqf new file mode 100644 index 0000000000..a945f5eba1 --- /dev/null +++ b/addons/common/functions/fnc_handleModifierKeyInit.sqf @@ -0,0 +1,16 @@ +/* + * Author: commy2 + * Initializes the modifier key handler. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Public : No + */ +#include "script_component.hpp" + +(findDisplay 46) displayAddEventHandler ["KeyDown", FUNC(handleModifierKey)]; +(findDisplay 46) displayAddEventHandler ["KeyUp", FUNC(handleModifierKeyUp)]; diff --git a/addons/common/functions/fnc_handleModifierKeyUp.sqf b/addons/common/functions/fnc_handleModifierKeyUp.sqf new file mode 100644 index 0000000000..ffa5855115 --- /dev/null +++ b/addons/common/functions/fnc_handleModifierKeyUp.sqf @@ -0,0 +1,17 @@ +/* + * Author: commy2 + * Handles key up event for modifier key. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Public : No + */ +#include "script_component.hpp" + +ACE_modifier = 0; + +false diff --git a/addons/common/functions/fnc_handleScrollWheel.sqf b/addons/common/functions/fnc_handleScrollWheel.sqf new file mode 100644 index 0000000000..c0b88f9ed7 --- /dev/null +++ b/addons/common/functions/fnc_handleScrollWheel.sqf @@ -0,0 +1,25 @@ +/* + * Author: commy2 + * Handles MouseZChanged event. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Public : No + */ +#include "script_component.hpp" + +// prevents a bug that causes the MouseZChanged to trigger N-times, where N is the number of times you consecutively pressed "Restart" instead of "Preview" in the editor +if (GVAR(ScrollWheelFrame) == diag_frameno) exitWith {}; + +GVAR(ScrollWheelFrame) = diag_frameno; + +{ + [_this select 1] call _x; + false +} count ((missionNamespace getVariable ["ACE_EventHandler_ScrollWheel", [-1, [], []]]) select 2); + +nil diff --git a/addons/common/functions/fnc_handleScrollWheelInit.sqf b/addons/common/functions/fnc_handleScrollWheelInit.sqf new file mode 100644 index 0000000000..12f8b5f337 --- /dev/null +++ b/addons/common/functions/fnc_handleScrollWheelInit.sqf @@ -0,0 +1,15 @@ +/* + * Author: commy2 + * Initializes the MouseZChanged eventhandler. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Public : No + */ +#include "script_component.hpp" + +(findDisplay 46) displayAddEventHandler ["MouseZChanged", QUOTE(_this call FUNC(handleScrollWheel))]; diff --git a/addons/common/functions/fnc_hasItem.sqf b/addons/common/functions/fnc_hasItem.sqf index 00c5ed5846..526f5a46f2 100644 --- a/addons/common/functions/fnc_hasItem.sqf +++ b/addons/common/functions/fnc_hasItem.sqf @@ -1,13 +1,18 @@ -/** - * fn_hasItem.sqf - * @Descr: Check if unit has item - * @Author: Glowbal +/* + * Author: Glowbal + * Check if unit has item * - * @Arguments: [unit OBJECT, item STRING (Classname of item)] - * @Return: BOOL - * @PublicAPI: true + * Arguments: + * 0: Unit + * 1: Item Classname + * + * Return Value: + * has Item + * + * Public: yes */ - #include "script_component.hpp" +#include "script_component.hpp" -// item classname in items unit -((_this select 1) in items (_this select 0)); \ No newline at end of file +params ["_unit", "_item"]; + +_item in items _unit // return diff --git a/addons/common/functions/fnc_hasMagazine.sqf b/addons/common/functions/fnc_hasMagazine.sqf index 52a5ed4cd5..27150ea5d5 100644 --- a/addons/common/functions/fnc_hasMagazine.sqf +++ b/addons/common/functions/fnc_hasMagazine.sqf @@ -1,22 +1,18 @@ -/** - * fn_hasMagazine.sqf - * @Descr: Check if given unit has a magazine of given classname - * @Author: Glowbal +/* + * Author: Glowbal + * Check if given unit has a magazine of given classname * - * @Arguments: [unit OBJECT, magazine STRING] - * @Return: BOOL True if unith as given magazine - * @PublicAPI: true + * Arguments: + * 0: Unit + * 1: Magazine Classname + * + * Return Value: + * has Magazine + * + * Public: yes */ - #include "script_component.hpp" -private ["_return"]; -PARAMS_2(_unit,_magazine); +params ["_unit", "_magazine"]; -if (_magazine != "") then { - _return = (_magazine in magazines _unit); -} else { - _return = false; -}; - -_return \ No newline at end of file +_magazine in magazines _unit // return diff --git a/addons/common/functions/fnc_hashCreate.sqf b/addons/common/functions/fnc_hashCreate.sqf index 56d9b69922..532b2804fe 100644 --- a/addons/common/functions/fnc_hashCreate.sqf +++ b/addons/common/functions/fnc_hashCreate.sqf @@ -1,5 +1,15 @@ -//fnc_hashCreate.sqf +/* + * Author: ? + * Returns an empty hash structure + * + * Arguments: + * None + * + * Return Value: + * Empty Hash Structure + * + * Public: No + */ #include "script_component.hpp" -// diag_log text format["%1 HASH CREATE"]; [[],[]] diff --git a/addons/common/functions/fnc_hashGet.sqf b/addons/common/functions/fnc_hashGet.sqf index 6b47b98ad9..df5d294beb 100644 --- a/addons/common/functions/fnc_hashGet.sqf +++ b/addons/common/functions/fnc_hashGet.sqf @@ -1,10 +1,21 @@ -//fnc_hashGet.sqf +/* + * Author: ? + * Returns value attached to key in given hash. + * + * Arguments: + * 0: Hash + * 1: Key + * + * Return Value: + * Value + * + * Public: No + */ #include "script_component.hpp" private ["_val", "_index"]; -// diag_log text format["%1 HASH GET: %2", ACE_diagTime, _this]; -PARAMS_2(_hash,_key); +params ["_hash", "_key"]; ERRORDATA(2); _val = nil; @@ -25,4 +36,5 @@ try { }; if (isNil "_val") exitWith { nil }; -_val; + +_val diff --git a/addons/common/functions/fnc_hashHasKey.sqf b/addons/common/functions/fnc_hashHasKey.sqf index 8d31a6fcb4..5c6293fc85 100644 --- a/addons/common/functions/fnc_hashHasKey.sqf +++ b/addons/common/functions/fnc_hashHasKey.sqf @@ -1,10 +1,21 @@ -//fnc_hashHasKey.sqf +/* + * Author: ? + * ? + * + * Arguments: + * ? + * + * Return Value: + * ? + * + * Public: ? + */ #include "script_component.hpp" private ["_val", "_index"]; // diag_log text format["%1 HASH HAS KEY: %2", ACE_diagTime, _this]; -PARAMS_2(_hash,_key); +params ["_hash", "_key"]; ERRORDATA(2); _val = false; diff --git a/addons/common/functions/fnc_hashListCreateHash.sqf b/addons/common/functions/fnc_hashListCreateHash.sqf index c7a6085fea..d6a94445eb 100644 --- a/addons/common/functions/fnc_hashListCreateHash.sqf +++ b/addons/common/functions/fnc_hashListCreateHash.sqf @@ -1,9 +1,20 @@ -//fnc_hashListCreateHash.sqf +/* + * Author: ? + * ? + * + * Arguments: + * ? + * + * Return Value: + * ? + * + * Public: ? + */ #include "script_component.hpp" private ["_hashKeys"]; -PARAMS_1(_hashList); +params ["_hashList"]; ERRORDATA(1); _hashKeys = []; diff --git a/addons/common/functions/fnc_hashListCreateList.sqf b/addons/common/functions/fnc_hashListCreateList.sqf index d24b22e7c3..3d02b0cb0b 100644 --- a/addons/common/functions/fnc_hashListCreateList.sqf +++ b/addons/common/functions/fnc_hashListCreateList.sqf @@ -1,6 +1,17 @@ -//fnc_hashListCreateList.sqf +/* + * Author: ? + * ? + * + * Arguments: + * ? + * + * Return Value: + * ? + * + * Public: ? + */ #include "script_component.hpp" -PARAMS_1(_keys); +params ["_keys"]; [_keys,[]]; diff --git a/addons/common/functions/fnc_hashListPush.sqf b/addons/common/functions/fnc_hashListPush.sqf index d8908dbe33..21651c2ed0 100644 --- a/addons/common/functions/fnc_hashListPush.sqf +++ b/addons/common/functions/fnc_hashListPush.sqf @@ -1,7 +1,18 @@ -//fnc_hashListPush.sqf +/* + * Author: ? + * ? + * + * Arguments: + * ? + * + * Return Value: + * ? + * + * Public: ? + */ #include "script_component.hpp" -PARAMS_2(_hashList,_value); +params ["_hashList", "_value"]; ERRORDATA(2); try { diff --git a/addons/common/functions/fnc_hashListSelect.sqf b/addons/common/functions/fnc_hashListSelect.sqf index 9f6f6489d0..df072d55bd 100644 --- a/addons/common/functions/fnc_hashListSelect.sqf +++ b/addons/common/functions/fnc_hashListSelect.sqf @@ -1,9 +1,21 @@ -//fnc_hashListSelect.sqf +/* + * Author: ? + * ? + * + * Arguments: + * ? + * + * Return Value: + * ? + * + * Public: ? + */ #include "script_component.hpp" private ["_hash", "_keys", "_hashes", "_values"]; -PARAMS_2(_hashList,_index); +params ["_hashList", "_index"]; + ERRORDATA(2); _hash = nil; try { diff --git a/addons/common/functions/fnc_hashListSet.sqf b/addons/common/functions/fnc_hashListSet.sqf index fdb19350df..5fea048327 100644 --- a/addons/common/functions/fnc_hashListSet.sqf +++ b/addons/common/functions/fnc_hashListSet.sqf @@ -1,9 +1,21 @@ -//fnc_hashListSet.sqf +/* + * Author: ? + * ? + * + * Arguments: + * ? + * + * Return Value: + * ? + * + * Public: ? + */ #include "script_component.hpp" private ["_vals"]; -PARAMS_3(_hashList,_index,_value); +params ["_hashList", "_index", "_value"]; + ERRORDATA(3); try { if(VALIDHASH(_hashList)) then { diff --git a/addons/common/functions/fnc_hashRem.sqf b/addons/common/functions/fnc_hashRem.sqf index 7f7bb17cc4..4346a509cf 100644 --- a/addons/common/functions/fnc_hashRem.sqf +++ b/addons/common/functions/fnc_hashRem.sqf @@ -1,9 +1,21 @@ -//fnc_hashRem.sqf +/* + * Author: ? + * ? + * + * Arguments: + * ? + * + * Return Value: + * ? + * + * Public: ? + */ #include "script_component.hpp" private ["_val", "_index"]; -PARAMS_2(_hash,_key); +params ["_hash", "_key"]; + ERRORDATA(2); _val = nil; try { diff --git a/addons/common/functions/fnc_hashSet.sqf b/addons/common/functions/fnc_hashSet.sqf index 1b3bded6e9..af7a361dd6 100644 --- a/addons/common/functions/fnc_hashSet.sqf +++ b/addons/common/functions/fnc_hashSet.sqf @@ -1,10 +1,21 @@ -//fnc_hashSet.sqf +/* + * Author: ? + * ? + * + * Arguments: + * ? + * + * Return Value: + * ? + * + * Public: ? + */ #include "script_component.hpp" private ["_index"]; // diag_log text format["%1 HASH SET: %2", ACE_diagTime, _this]; -PARAMS_3(_hash,_key,_val); +params ["_hash", "_key", "_val"]; ERRORDATA(3); try { diff --git a/addons/common/functions/fnc_headBugFix.sqf b/addons/common/functions/fnc_headBugFix.sqf index fe9354f632..78b1a602df 100644 --- a/addons/common/functions/fnc_headBugFix.sqf +++ b/addons/common/functions/fnc_headBugFix.sqf @@ -1,42 +1,49 @@ -/** - * fnc_headbugfix.sqf - * @Descr: Fixes animation issues that may get you stuck - * @Author: rocko +/* + * Author: rocko + * Fixes animation issues that may get you stuck * - * @Arguments: - * @Return: nil - * @PublicAPI: true + * Arguments: + * None + * + * Return Value: + * None + * + * Public: Yes + * + * Note: Has to be spawned not called */ - #include "script_component.hpp" -private ["_pos","_dir","_anim"]; -_anim = animationState ACE_player; +private ["_unit", "_anim", "_pos", "_dir", "_dummy"]; + +_unit = ACE_player; +_anim = animationState _unit; + ["HeadbugFixUsed", [profileName, _anim]] call FUNC(serverEvent); ["HeadbugFixUsed", [profileName, _anim]] call FUNC(localEvent); -if (ACE_player != vehicle ACE_player || { !([ACE_player, objNull, ["isNotSitting"]] call FUNC(canInteractWith)) } ) exitWith {false}; +if (_unit != vehicle _unit || {!([_unit, objNull, ["isNotSitting"]] call FUNC(canInteractWith))}) exitWith {false}; -_pos = getposATL ACE_player; -_dir = getDir ACE_player; +_pos = getPosATL _unit; +_dir = getDir _unit; titleCut ["", "BLACK"]; -[ACE_Player, "headBugFix"] call FUNC(hideUnit); +[_unit, "headBugFix"] call FUNC(hideUnit); // create invisible headbug fix vehicle -_ACE_HeadbugFix = "ACE_Headbug_Fix" createVehicleLocal _pos; -_ACE_HeadbugFix setDir _dir; -ACE_player moveInAny _ACE_HeadbugFix; -sleep 0.1; +_dummy = createVehicle ["ACE_Headbug_Fix", _pos, [], 0, "NONE"]; +_dummy setDir _dir; +_unit moveInAny _dummy; +sleep 0.1; // @todo -unassignVehicle ACE_player; -ACE_player action ["Eject", vehicle ACE_player]; -ACE_player setDir _dir; -ACE_player setposATL _pos; +unassignVehicle _unit; +_unit action ["Eject", vehicle _unit]; +_unit setDir _dir; +_unit setPosATL _pos; sleep 1.0; -deleteVehicle _ACE_HeadbugFix; +deleteVehicle _dummy; -[ACE_Player, "headBugFix"] call FUNC(unhideUnit); +[_unit, "headBugFix"] call FUNC(unhideUnit); titleCut ["", "PLAIN"]; true diff --git a/addons/common/functions/fnc_hideUnit.sqf b/addons/common/functions/fnc_hideUnit.sqf index 94857335f4..7fdd901848 100644 --- a/addons/common/functions/fnc_hideUnit.sqf +++ b/addons/common/functions/fnc_hideUnit.sqf @@ -14,10 +14,9 @@ * * Public: No */ - #include "script_component.hpp" -PARAMS_2(_unit,_reason); +params ["_unit", "_reason"]; if (isNull _unit) exitWith {}; @@ -29,6 +28,6 @@ if !(_reason in _setHiddenReasons) then { _unit setVariable [QGVAR(setHiddenReasons), _setHiddenReasons, true]; }; -//if !(isObjectHidden _unit) then { (Uncomment when isObjectHidden hits stable branch) - ["hideObjectGlobal",[_unit,true]] call FUNC(serverEvent); -//}; +if !(isObjectHidden _unit) then { + ["hideObjectGlobal", [_unit, true]] call FUNC(serverEvent); +}; diff --git a/addons/common/functions/fnc_inTransitionAnim.sqf b/addons/common/functions/fnc_inTransitionAnim.sqf index 4ce16aebf9..fd90291d73 100644 --- a/addons/common/functions/fnc_inTransitionAnim.sqf +++ b/addons/common/functions/fnc_inTransitionAnim.sqf @@ -1,4 +1,15 @@ -// by commy2 +/* + * Author: commy2 + * Check if given unit is in a transitional animation + * + * Arguments: + * 0: A soldier + * + * Return Value: + * + * + * Public: Yes + */ #include "script_component.hpp" -getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> animationState (_this select 0) >> "looped") == 0 +getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> animationState (_this select 0) >> "looped") == 0 // return diff --git a/addons/common/functions/fnc_inWater.sqf b/addons/common/functions/fnc_inWater.sqf index f6f491535f..7c8e2eee21 100644 --- a/addons/common/functions/fnc_inWater.sqf +++ b/addons/common/functions/fnc_inWater.sqf @@ -1,25 +1,29 @@ -/** - * fn_inWater_f.sqf - * @Descr: Check if unit is underwater - * @Author: Glowbal +/* + * Author: Glowbal + * Check if unit is underwater * - * @Arguments: [unit OBJECT] - * @Return: BOOL True if unit is in the water - * @PublicAPI: true + * Arguments: + * 0: Unit + * + * Return Value: + * if unit is in the water (BOOLEAN) + * + * Public: Yes */ - #include "script_component.hpp" -private ["_return","_aslPos"]; +params ["_unit"]; -PARAMS_1(_unit); +private "_return"; _return = false; -if ((surfaceIsWater getPos _unit)) then { - _aslPos = _unit modelToWorldVisual (_unit selectionPosition "head"); - if ((_aslPos select 2) <= 0) then { +if (surfaceIsWater getPosASL _unit) then { + private "_pos"; + _pos = _unit modelToWorldVisual (_unit selectionPosition "head"); + + if (_pos select 2 < 0) then { _return = true; }; }; -_return; +_return diff --git a/addons/common/functions/fnc_inheritsFrom.sqf b/addons/common/functions/fnc_inheritsFrom.sqf index 27d84b9d12..7f881ff746 100644 --- a/addons/common/functions/fnc_inheritsFrom.sqf +++ b/addons/common/functions/fnc_inheritsFrom.sqf @@ -1,25 +1,38 @@ -/** - * fn_inheritsFrom.sqf - * @Descr: Checks whether a given configuration name appears in the inheritance tree of a specific configuration entry. - * @Author: Ruthberg +/* + * Author: Ruthberg + * Checks whether a given configuration name appears in the inheritance tree of a specific configuration entry. * - * @Arguments: [configEntry CONFIG, configname STRING] - * @Return: BOOL - * @PublicAPI: true + * Arguments: + * 0: configEntry (CONFIG) + * 1: configname (STING) + * + * Return Value: + * BOOLEAN + * + * Public: Yes + * + * Note: Not to be confused with the inheritsFrom scripting command. + * + * Deprecated */ - #include "script_component.hpp" - private ["_match"]; -PARAMS_2(_configEntry,_configMatch); +ACE_DEPRECATED("ace_common_fnc_inheritsFrom","3.5.0","inheritsFrom ARRAY"); -if (configName _configEntry == _configMatch) exitWith { true }; -if (configName _configEntry == ",") exitWith { false }; +params ["_configEntry", "_configMatch"]; +if (configName _configEntry == _configMatch) exitWith {true}; +if (configName _configEntry == ",") exitWith {false}; + +private "_match"; _match = false; + while {configName _configEntry != ""} do { - if (configName _configEntry == _configMatch) exitWith { _match = true }; - _configEntry = inheritsFrom(_configEntry); + if (configName _configEntry == _configMatch) exitWith { + _match = true; + }; + + _configEntry = inheritsFrom _configEntry; }; -_match \ No newline at end of file +_match diff --git a/addons/common/functions/fnc_insertionSort.sqf b/addons/common/functions/fnc_insertionSort.sqf index bdafa70592..9f8c95e095 100644 --- a/addons/common/functions/fnc_insertionSort.sqf +++ b/addons/common/functions/fnc_insertionSort.sqf @@ -1,34 +1,38 @@ -/** - * fn_insertionSort.sqf - * @Descr: Sorts an array of numbers - * @Author: Ruthberg +/* + * Author: Ruthberg + * Sorts an array of numbers * - * @Arguments: [array ARRAY, (optional) ascending BOOL] - * @Return: sortedArray ARRAY - * @PublicAPI: true + * Arguments: + * 0: array + * 1: ascending (optional) + * + * Return Value: + * sortedArray (ARRAY) + * + * Public: Yes */ - #include "script_component.hpp" -private ["_list", "_ascending", "_tmp", "_i", "_j"]; -_list = +(_this select 0); -_ascending = true; -if (count _this > 1) then { - _ascending = _this select 1; -}; +params ["_list", ["_ascending", true]]; -for "_i" from 1 to (count _list) - 1 do { +_list = + _list; // copy array to not alter the original one + +private "_tmp"; + +for "_i" from 1 to (count _list - 1) do { _tmp = _list select _i; _j = _i; + while {_j >= 1 && {_tmp < _list select (_j - 1)}} do { _list set [_j, _list select (_j - 1)]; _j = _j - 1; }; - _list set[_j, _tmp]; + + _list set [_j, _tmp]; }; if (!_ascending) then { reverse _list; }; -_list \ No newline at end of file +_list diff --git a/addons/common/functions/fnc_interpolateFromArray.sqf b/addons/common/functions/fnc_interpolateFromArray.sqf index 2427fa47b5..5ce59bde62 100644 --- a/addons/common/functions/fnc_interpolateFromArray.sqf +++ b/addons/common/functions/fnc_interpolateFromArray.sqf @@ -1,11 +1,23 @@ -// by commy2 +/* + * Author: commy2 + * Interpolates between two set points in a curve. + * + * Arguments: + * 0: List of numbers to interpolate from + * 1: Value / index + * + * Return Value: + * Interpolation result + * + * Public: Yes + */ #include "script_component.hpp" -private ["_min", "_max"]; +params ["_array", "_value"]; -PARAMS_2(_array,_value); +private ["_min", "_max"]; _min = _array select floor _value; _max = _array select ceil _value; -_min + (_max - _min) * (_value % 1) +_min + (_max - _min) * (_value % 1) // return diff --git a/addons/common/functions/fnc_isAlive.sqf b/addons/common/functions/fnc_isAlive.sqf index 1d5a99ac6b..b9d94eed5d 100644 --- a/addons/common/functions/fnc_isAlive.sqf +++ b/addons/common/functions/fnc_isAlive.sqf @@ -1,14 +1,21 @@ /* * Author: commy2 - * * Check if the object still exists and is alive. This function exists because 'alive objNull' actually returns true. * * Argument: - * 0: Any object (Object) + * 0: Any object * * Return value: - * The object exists and is alive (Bool). + * The object exists and is alive . + * + * Public: Yes + * + * Deprecated */ #include "script_component.hpp" -!isNull (_this select 0) && {alive (_this select 0)} +ACE_DEPRECATED("ace_common_fnc_isAlive","3.5.0","alive"); + +params ["_unit"]; + +!isNull _unit && {alive _unit} // return diff --git a/addons/common/functions/fnc_isArrested.sqf b/addons/common/functions/fnc_isArrested.sqf deleted file mode 100644 index 36fb44bd1a..0000000000 --- a/addons/common/functions/fnc_isArrested.sqf +++ /dev/null @@ -1,13 +0,0 @@ -/** - * fn_isArrested.sqf - * @Descr: Check if unit is in arrested state - * @Author: Glowbal - * - * @Arguments: [unit OBJECT] - * @Return: BOOL Returns true if unit or object is in arrest state - * @PublicAPI: true - */ - -#include "script_component.hpp" - -((_this select 0) getvariable [QGVAR(StateArrested),false]) \ No newline at end of file diff --git a/addons/common/functions/fnc_isAutoWind.sqf b/addons/common/functions/fnc_isAutoWind.sqf index 50933e40a2..04bb22a785 100644 --- a/addons/common/functions/fnc_isAutoWind.sqf +++ b/addons/common/functions/fnc_isAutoWind.sqf @@ -1,14 +1,15 @@ /* * Author: commy2 - * * Check if wind is set on auto. * - * Argument: - * None. + * Arguments + * None * - * Return value: - * This mission has automatic wind? (Bool) + * Return Value: + * This mission has automatic wind? + * + * Public: Yes */ #include "script_component.hpp" -["Mission", "Intel", "windForced"] call FUNC(getNumberFromMissionSQM) != 1 +["Mission", "Intel", "windForced"] call FUNC(getNumberFromMissionSQM) != 1 // return diff --git a/addons/common/functions/fnc_isAwake.sqf b/addons/common/functions/fnc_isAwake.sqf index c0dd59288e..8a123cfec9 100644 --- a/addons/common/functions/fnc_isAwake.sqf +++ b/addons/common/functions/fnc_isAwake.sqf @@ -1,15 +1,17 @@ -/** - * fn_isAwake.sqf - * @Descr: Check if unit is awake. Will be false when death or unit is unconscious. - * @Author: Glowbal +/* + * Author: Glowbal + * Check if unit is awake. Will be false when death or unit is unconscious. * - * @Arguments: [unit OBJECT] - * @Return: BOOL True if unit is awake - * @PublicAPI: true + * Arguments: + * 0: Unit + * + * Return Value: + * if unit is awake + * + * Public: Yes */ - #include "script_component.hpp" -PARAMS_1(_unit); +params ["_unit"]; -(!(_unit getvariable ["ACE_isUnconscious",false]) && alive _unit && !(_unit getvariable ["ACE_isDead",false])); +!(_unit getvariable ["ACE_isUnconscious", false]) && alive _unit && !(_unit getvariable ["ACE_isDead", false]) // return diff --git a/addons/common/functions/fnc_isEOD.sqf b/addons/common/functions/fnc_isEOD.sqf index 92c5dc6dc4..ee82cf2068 100644 --- a/addons/common/functions/fnc_isEOD.sqf +++ b/addons/common/functions/fnc_isEOD.sqf @@ -1,25 +1,23 @@ /* - Name: FUNC(isEOD) - - Author: Garth de Wet (LH) - - Description: - Checks whether the passed unit is an explosive specialist. - Either through config entry: "canDeactivateMines" - or - unit setVariable ["ACE_isEOD", true] - - Parameters: - 0: OBJECT - Unit to check if is a specialist - - Returns: - BOOLEAN - - Example: - isSpecialist = [player] call FUNC(isEOD); -*/ + * Author: Garth de Wet (LH) + * Checks whether the passed unit is an explosive specialist. + * Either through config entry: "canDeactivateMines" + * or + * unit setVariable ["ACE_isEOD", true] + * + * Arguments: + * 0: Unit to check if is a specialist + * + * Return Value: + * is the unit an EOD + * + * Example: + * isSpecialist = [player] call FUNC(isEOD); + * + * Public: Yes + */ #include "script_component.hpp" -PARAMS_1(_unit); +params ["_unit"]; -_unit getVariable ["ACE_isEOD", getNumber (configFile >> "CfgVehicles" >> typeOf _unit >> "canDeactivateMines") == 1] +_unit getVariable ["ACE_isEOD", getNumber (configFile >> "CfgVehicles" >> typeOf _unit >> "canDeactivateMines") == 1] // return diff --git a/addons/common/functions/fnc_isEngineer.sqf b/addons/common/functions/fnc_isEngineer.sqf index 4cc5f42bc9..9018149c27 100644 --- a/addons/common/functions/fnc_isEngineer.sqf +++ b/addons/common/functions/fnc_isEngineer.sqf @@ -1,16 +1,17 @@ /* * Author: marc_book, edited by commy2 - * * Checks if a unit is an engineer. * * Arguments: - * 0: unit to be checked (object) + * 0: unit to be checked * * Return Value: - * Bool: is the unit an engineer? + * is the unit an engineer + * + * Public: Yes */ #include "script_component.hpp" -PARAMS_1(_unit); +params ["_unit"]; -_unit getVariable ["ACE_IsEngineer", getNumber (configFile >> "CfgVehicles" >> typeOf _unit >> "engineer") == 1] +_unit getVariable ["ACE_isEngineer", getNumber (configFile >> "CfgVehicles" >> typeOf _unit >> "engineer") == 1] // return diff --git a/addons/common/functions/fnc_isFeatureCameraActive.sqf b/addons/common/functions/fnc_isFeatureCameraActive.sqf index 250beaa3ca..7d282109b2 100644 --- a/addons/common/functions/fnc_isFeatureCameraActive.sqf +++ b/addons/common/functions/fnc_isFeatureCameraActive.sqf @@ -1,31 +1,34 @@ /* * Author: Sniperwolf572 + * Checks if one of the following common feature cameras is active: * - * Checks if one of the following BI feature cameras are active: - * - * - Classic camera (BIS_fnc_cameraOld) - * - Splendid camera (BIS_fnc_camera) + * - Curator + * - ACE Spectator * - Arsenal camera (BIS_fnc_arsenal) - * - Animation viewer (BIS_fnc_animViewer) * - Establishing shot (BIS_fnc_establishingShot) + * - Splendid camera (BIS_fnc_camera) + * - Animation viewer (BIS_fnc_animViewer) + * - Classic camera (BIS_fnc_cameraOld) * * Arguments: - * None + * 0: None * - * Return value: - * Is BI feature camera active (bool) + * Return Value: + * A feature camera is active * * Example: - * call ace_common_fnc_isFeatureCameraActive; + * [] call ace_common_fnc_isFeatureCameraActive * + * Public: Yes */ - #include "script_component.hpp" -( - !isNull (missionNamespace getVariable ["BIS_DEBUG_CAM", objNull]) || // Classic camera - {!isNull (missionNamespace getVariable ["BIS_fnc_camera_cam", objNull])} || // Splendid camera - {!isNull (uiNamespace getVariable ["BIS_fnc_arsenal_cam", objNull])} || // Arsenal camera - {!isNull (uiNamespace getVariable ["BIS_fnc_animViewer_cam", objNull])} || // Animation viewer camera - {!isNull (missionNamespace getVariable ["BIS_fnc_establishingShot_fakeUAV", objNull])} // Establishing shot camera -) \ No newline at end of file +!( + isNull curatorCamera && // Curator + {isNull (GETMVAR(EGVAR(spectator,camera),objNull))} && // ACE Spectator + {isNull (GETUVAR(BIS_fnc_arsenal_cam, objNull))} && // Arsenal camera + {isNull (GETMVAR(BIS_fnc_establishingShot_fakeUAV, objNull))} && // Establishing shot camera + {isNull (GETMVAR(BIS_fnc_camera_cam, objNull))} && // Splendid camera + {isNull (GETUVAR(BIS_fnc_animViewer_cam, objNull))} && // Animation viewer camera + {isNull (GETMVAR(BIS_DEBUG_CAM, objNull))} // Classic camera +) // return diff --git a/addons/common/functions/fnc_isInBuilding.sqf b/addons/common/functions/fnc_isInBuilding.sqf index adecf5ac0c..577b865aee 100644 --- a/addons/common/functions/fnc_isInBuilding.sqf +++ b/addons/common/functions/fnc_isInBuilding.sqf @@ -1,45 +1,44 @@ /* * Author: commy2 - * * Check if the unit is in a building. Will return true if the unit is sitting in a bush. * - * Argument: - * 0: Unit (Object) + * Arguments: + * 0: Unit * * Return value: - * Is the unit in a building? (Bool) + * Is the unit in a building? + * + * Public: Yes */ #include "script_component.hpp" -#define DISTANCE 10 +#define CHECK_DISTANCE 10 -private ["_position", "_positionX", "_positionY", "_positionZ", "_intersections"]; +params ["_unit"]; -PARAMS_1(_unit); +private ["_position", "_intersections"]; _position = eyePos _unit; -_positionX = _position select 0; -_positionY = _position select 1; -_positionZ = _position select 2; + _intersections = 0; -if (lineIntersects [_position, [_positionX, _positionY, _positionZ + DISTANCE]]) then { +if (lineIntersects [_position, _position vectorAdd [0, 0, +CHECK_DISTANCE]]) then { _intersections = _intersections + 1; }; -if (lineIntersects [_position, [_positionX + DISTANCE, _positionY, _positionZ]]) then { +if (lineIntersects [_position, _position vectorAdd [+CHECK_DISTANCE, 0, 0]]) then { _intersections = _intersections + 1; }; -if (lineIntersects [_position, [_positionX - DISTANCE, _positionY, _positionZ]]) then { +if (lineIntersects [_position, _position vectorAdd [-CHECK_DISTANCE, 0, 0]]) then { _intersections = _intersections + 1; }; -if (lineIntersects [_position, [_positionX, _positionY + DISTANCE, _positionZ]]) then { +if (lineIntersects [_position, _position vectorAdd [0, +CHECK_DISTANCE, 0]]) then { _intersections = _intersections + 1; }; -if (lineIntersects [_position, [_positionX, _positionY - DISTANCE, _positionZ]]) then { +if (lineIntersects [_position, _position vectorAdd [0, -CHECK_DISTANCE, 0]]) then { _intersections = _intersections + 1; }; diff --git a/addons/common/functions/fnc_isModLoaded.sqf b/addons/common/functions/fnc_isModLoaded.sqf index 622c27a94b..e5f94b202d 100644 --- a/addons/common/functions/fnc_isModLoaded.sqf +++ b/addons/common/functions/fnc_isModLoaded.sqf @@ -1,13 +1,17 @@ -/** - * fn_isModLoaded_f.sqf - * Descr: Check in cfgPatches if modification is loaded +/* * Author: Glowbal + * Check in cfgPatches if modification is loaded * - * Arguments: [modName STRING (Classname of the mod in cfgPatches)] - * Return: BOOL true if modification is loaded - * PublicAPI: true + * Arguments: + * 0: Mod Name or Classname of the mod in cfgPatches + * + * Return Value: + * if modification is loaded + * + * Public: Yes */ - #include "script_component.hpp" -(isClass (configFile >> "cfgPatches" >> (_this select 0))) \ No newline at end of file +params ["_modName"]; + +isClass (configFile >> "cfgPatches" >> _modName) // return diff --git a/addons/common/functions/fnc_isPlayer.sqf b/addons/common/functions/fnc_isPlayer.sqf index 91e54a51c1..8bea7e9771 100644 --- a/addons/common/functions/fnc_isPlayer.sqf +++ b/addons/common/functions/fnc_isPlayer.sqf @@ -1,21 +1,19 @@ /* * Author: bux578, commy2, akalegman - * * Checks if a unit is a player / curator controlled unit. * Currently returns false for non-local remote controlled zeus units. (Remotes from another zeus machine) * * Arguments: - * 0: unit to be checked (object) - * 1: exclude remote controlled units (boolean) + * 0: unit to be checked + * 1: exclude remote controlled units * * Return Value: - * Bool: is unit a player? + * Is unit a player? + * + * Public: Yes */ #include "script_component.hpp" -private ["_unit", "_excludeRemoteControlled"]; +params ["_unit", ["_excludeRemoteControlled", false]]; -_unit = _this select 0; -_excludeRemoteControlled = if (count _this > 1) then {_this select 1} else {false}; - -isPlayer _unit || (!_excludeRemoteControlled && {_unit == call FUNC(player)}) +isPlayer _unit || (!_excludeRemoteControlled && {_unit == call FUNC(player)}) // return diff --git a/addons/common/functions/fnc_isTurnedOut.sqf b/addons/common/functions/fnc_isTurnedOut.sqf index 35270ccfc4..39eb460cc4 100644 --- a/addons/common/functions/fnc_isTurnedOut.sqf +++ b/addons/common/functions/fnc_isTurnedOut.sqf @@ -1,39 +1,21 @@ /* * Author: commy2 - * * Check if the unit is in a vehicle and turned out. * - * Argument: - * 0: Unit, not the vehicle (Object) + * Arguments: + * 0: Unit, not the vehicle * - * Return value: - * Is the unit turned out or not? Will return false if there is no option to turn out in the first place. (Bool) + * Return Value: + * Is the unit turned out or not? Will return false if there is no option to turn out in the first place. + * + * Public: Yes + * + * Deprecated */ #include "script_component.hpp" -private ["_vehicle", "_config", "_animation", "_action", "_inAction", "_turretIndex"]; +ACE_DEPRECATED("ace_common_fnc_isTurnedOut","3.5.0","isTurnedOut"); -PARAMS_1(_unit); -_vehicle = vehicle _unit; -_config = configFile >> "CfgVehicles" >> typeOf _vehicle; -_animation = animationState _unit; +params ["_unit"]; -if (_unit == driver _vehicle) then { - _action = getText (_config >> "driverAction"); - _inAction = getText (_config >> "driverInAction"); -} else { - _turretIndex = [_unit] call FUNC(getTurretIndex); - - _config = [_config, _turretIndex] call FUNC(getTurretConfigPath); - - _action = getText (_config >> "gunnerAction"); - _inAction = getText (_config >> "gunnerInAction"); -}; - -if (_action == "" || {_inAction == ""} || {_action == _inAction}) exitWith {false}; - -_animation = toArray _animation; -_animation resize (count toArray _action); -_animation = toString _animation; - -_animation == _action +isTurnedOut _unit // return diff --git a/addons/common/functions/fnc_letterToCode.sqf b/addons/common/functions/fnc_letterToCode.sqf index 59243915f5..7bbbcf4f3d 100644 --- a/addons/common/functions/fnc_letterToCode.sqf +++ b/addons/common/functions/fnc_letterToCode.sqf @@ -1,4 +1,19 @@ -// by commy2 +/* + * Author: commy2 + * Converts some Arma Dik Codes to a key. + * + * Arguments: + * 0: Dik Code + * + * Return Value: + * Key + * + * Public: Yes + * + * Deprecated + */ #include "script_component.hpp" +ACE_DEPRECATED("ace_common_fnc_letterToCode","3.5.0","-"); + [-1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 30, 48, 46, 32, 18, 33, 34, 35, 23, 36, 37, 38, 50, 49, 24, 25, 16, 19, 31, 20, 22, 47, 17, 45, 44, 21] select (["1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"] find toUpper (_this select 0)) + 1 diff --git a/addons/common/functions/fnc_lightIntensityFromObject.sqf b/addons/common/functions/fnc_lightIntensityFromObject.sqf index 6722c3a554..df88671405 100644 --- a/addons/common/functions/fnc_lightIntensityFromObject.sqf +++ b/addons/common/functions/fnc_lightIntensityFromObject.sqf @@ -3,18 +3,19 @@ * Calculate light intensity object 1 recieves from object 2 * * Arguments: - * 0: Object that recieves light (Object) - * 1: Object that emits light (Object) + * 0: Object that recieves light + * 1: Object that emits light * * Return Value: * Brightest light level * + * Public: Yes */ #include "script_component.hpp" -private ["_unitPos","_lightLevel"]; +params ["_unit", "_lightSource"]; -PARAMS_2(_unit,_lightSource); +private ["_unitPos", "_lightLevel"]; _unitPos = _unit modelToWorld (_unit selectionPosition "spine3"); _lightLevel = 0; @@ -42,6 +43,8 @@ if (_lightSource isKindOf "CAManBase") then { default {""}; }; + if (getNumber (configFile >> "CfgWeapons" >> _flashlight >> "ACE_laserpointer") == 1) exitWith {_lightLevel = 0}; + _properties = [[_flashlight], FUNC(getLightPropertiesWeapon), uiNamespace, format [QEGVAR(cache,%1_%2), QUOTE(DFUNC(getLightPropertiesWeapon)), _flashlight], 1E11] call FUNC(cachedCall); //_properties = [_flashlight] call FUNC(getLightPropertiesWeapon); @@ -88,7 +91,7 @@ if (_lightSource isKindOf "CAManBase") then { _lightLevel = _lightLevel max ((linearConversion [0, 30, _distance, 1, 0, true]) * (linearConversion [_innerAngle, _outerAngle, _angle, 1, 0, true])); - //systemChat format ["%1 %2", (linearConversion [0, 30, _distance, 1, 0, true]), (linearConversion [_innerAngle, _outerAngle, _angle, 1, 0, true])]; + //systemChat format ["%1 %2", (linearConversion [0, 30, _distance, 1, 0, true]), (linearConversion [_innerAngle, _outerAngle, _angle, 1, 0, true])]; } forEach _lights; diff --git a/addons/common/functions/fnc_loadPerson.sqf b/addons/common/functions/fnc_loadPerson.sqf index 30bb6a7e38..377412bd4c 100644 --- a/addons/common/functions/fnc_loadPerson.sqf +++ b/addons/common/functions/fnc_loadPerson.sqf @@ -1,45 +1,55 @@ -/** - * fn_loadPerson_f.sqf - * @Descr: Loads a specified unit into any nearby vehicle - * @Author: Glowbal +/* + * Author: Glowbal + * Loads a specified unit into any nearby vehicle * - * @Arguments: [caller OBJECT, unitToBeLoaded OBJECT] - * @Return: OBJECT Returns the vehicle that the unitToBeloaded has been loaded in. Returns ObjNull if function failed - * @PublicAPI: true + * Arguments: + * 0: Unit that will load + * 1: Unit to be loaded + * + * Return Value: + * the vehicle that the unitToBeloaded has been loaded in. Returns ObjNull if function failed + * + * Public: Yes */ - #include "script_component.hpp" -#define GROUP_SWITCH_ID QUOTE(FUNC(loadPerson)) +#define GROUP_SWITCH_ID QFUNC(loadPerson) -private ["_caller", "_unit","_vehicle", "_loadcar", "_loadhelicopter", "_loadtank","_loadboat"]; -_caller = [_this, 0, ObjNull,[ObjNull]] call BIS_fnc_Param; -_unit = [_this, 1, ObjNull,[ObjNull]] call BIS_fnc_Param; -_vehicle = ObjNull; +params ["_caller", "_unit"]; + +private ["_vehicle", "_loadcar", "_loadair", "_loadtank", "_loadboat"]; + +_vehicle = objNull; if (!([_caller] call FUNC(canInteract)) || {_caller == _unit}) exitwith {_vehicle}; -_loadcar = nearestObject [_unit, "car"]; +_loadcar = nearestObject [_unit, "Car"]; + if (_unit distance _loadcar <= 10) then { _vehicle = _loadcar; } else { - _loadhelicopter = nearestObject [_unit, "air"]; - if (_unit distance _loadhelicopter <= 10) then { - _vehicle = _loadhelicopter; + _loadair = nearestObject [_unit, "Air"]; + + if (_unit distance _loadair <= 10) then { + _vehicle = _loadair; } else { - _loadtank = nearestObject [_unit, "tank"]; + _loadtank = nearestObject [_unit, "Tank"]; + if (_unit distance _loadtank <= 10) then { _vehicle = _loadtank; } else { - _loadboat = nearestObject [_unit, "ship"]; + _loadboat = nearestObject [_unit, "Ship_F"]; + if (_unit distance _loadboat <= 10) then { _vehicle = _loadboat; }; }; }; }; + if (!isNull _vehicle) then { [_unit, true, GROUP_SWITCH_ID, side group _caller] call FUNC(switchToGroupSide); - [[_unit, _vehicle,_caller], QUOTE(FUNC(loadPersonLocal)), _unit, false] call EFUNC(common,execRemoteFnc); + [[_unit, _vehicle, _caller], QFUNC(loadPersonLocal), _unit, false] call FUNC(execRemoteFnc); }; -_vehicle \ No newline at end of file + +_vehicle diff --git a/addons/common/functions/fnc_loadPersonLocal.sqf b/addons/common/functions/fnc_loadPersonLocal.sqf index 8718be1e75..5b52b38b05 100644 --- a/addons/common/functions/fnc_loadPersonLocal.sqf +++ b/addons/common/functions/fnc_loadPersonLocal.sqf @@ -1,25 +1,28 @@ -/** - * fn_loadPersonLocal_f.sqf - * @Descr: Load a person, local - * @Author: Glowbal +/* + * Author: Glowbal + * Load a person, local * - * @Arguments: [unit OBJECT, vehicle OBJECT, caller OBJECT] - * @Return: void - * @PublicAPI: false + * Arguments: + * 0: unit to be loaded + * 1: vehicle that will beloaded + * 2: caller that will load + * + * Return Value: + * None + * + * Public: Yes */ - #include "script_component.hpp" -private ["_unit","_vehicle","_caller","_handle","_loaded","_slotsOpen"]; -_unit = [_this, 0, ObjNull,[ObjNull]] call BIS_fnc_Param; -_vehicle = [_this, 1, ObjNull,[ObjNull]] call BIS_fnc_Param; -_caller = [_this, 2, ObjNull,[ObjNull]] call BIS_fnc_Param; -_slotsOpen = false; +params ["_unit", "_vehicle", "_caller"]; if (!alive _unit) then { - _unit = [_unit,_caller] call FUNC(makeCopyOfBody); + // _unit = [_unit, _caller] call FUNC(makeCopyOfBody); //func does not exist }; +private "_slotsOpen"; + +_slotsOpen = false; if (_vehicle emptyPositions "cargo" > 0) then { _unit moveInCargo _vehicle; @@ -32,26 +35,29 @@ if (_vehicle emptyPositions "cargo" > 0) then { }; if (_slotsOpen) then { - _loaded = _vehicle getvariable [QGVAR(loaded_persons),[]]; - _loaded pushback _unit; - _vehicle setvariable [QGVAR(loaded_persons),_loaded,true]; - if (!([_unit] call FUNC(isAwake))) then { - _handle = [_unit,_vehicle] spawn { - private ["_unit","_vehicle"]; - _unit = _this select 0; - _vehicle = _this select 1; - waituntil {vehicle _unit == _vehicle}; - sleep 0.5; + private "_loaded"; + _loaded = _vehicle getVariable [QGVAR(loaded_persons),[]]; + _loaded pushBack _unit; - //Save the "awake" animation before applying the death animation - if (vehicle _unit == _vehicle) then { - _unit setVariable [QEGVAR(medical,vehicleAwakeAnim), [_vehicle, (animationState _unit)]]; + _vehicle setVariable [QGVAR(loaded_persons), _loaded, true]; + + if !([_unit] call FUNC(isAwake)) then { + [{ + (_this select 0) params ["_unit", "_vehicle"]; + + // wait until the unit is in the vehicle + if (vehicle _unit != _vehicle) exitWith { + // kill this pfh if either one is deleted + if (isNull _unit || isNull _vehicle) then { + [_this select 1] call CBA_fnc_removePerFrameHandler; + }; }; - [_unit,([_unit] call FUNC(getDeathAnim)), 1, true] call FUNC(doAnimation); - }; - } else { - if ([_unit] call FUNC(isArrested)) then { - }; + _unit setVariable [QEGVAR(medical,vehicleAwakeAnim), [_vehicle, animationState _unit]]; + + [_unit, [_unit] call FUNC(getDeathAnim), 1, true] call FUNC(doAnimation); + + [_this select 1] call CBA_fnc_removePerFrameHandler; + }, 0.5, [_unit, _vehicle]] call CBA_fnc_addPerFrameHandler; }; -}; \ No newline at end of file +}; diff --git a/addons/common/functions/fnc_loadSettingsFromProfile.sqf b/addons/common/functions/fnc_loadSettingsFromProfile.sqf index 7cb99e3400..d4806d0c54 100644 --- a/addons/common/functions/fnc_loadSettingsFromProfile.sqf +++ b/addons/common/functions/fnc_loadSettingsFromProfile.sqf @@ -13,28 +13,26 @@ */ #include "script_component.hpp" -private ["_name", "_isClientSetable", "_isForced", "_profileValue"]; - // Iterate through settings { - _name = _x select 0; - _isClientSetable = _x select 2; - _isForced = _x select 6; + _x params ["_name", "", "_isClientSetable", "", "", "", "_isForced"]; // If setting is user setable if (_isClientSetable) then { // If setting is not forced if !(_isForced) then { - _profileValue = profileNamespace getvariable _name; + private "_profileValue"; + _profileValue = profileNamespace getVariable _name; + // If the setting is stored on the profile if !(isNil "_profileValue") then { // If the profile variable has the correct type - if (typeName _profileValue == typeName (missionNamespace getvariable _name)) then { + if (typeName _profileValue == typeName (missionNamespace getVariable _name)) then { // Load the setting from the profile - missionNamespace setvariable [_name, _profileValue]; + missionNamespace setVariable [_name, _profileValue]; }; }; }; }; - -} forEach GVAR(settings); + false +} count GVAR(settings); diff --git a/addons/common/functions/fnc_loadSettingsLocalizedText.sqf b/addons/common/functions/fnc_loadSettingsLocalizedText.sqf index 280a1e9907..1e43359379 100644 --- a/addons/common/functions/fnc_loadSettingsLocalizedText.sqf +++ b/addons/common/functions/fnc_loadSettingsLocalizedText.sqf @@ -12,37 +12,42 @@ */ #include "script_component.hpp" -private ["_parseConfigForDisplayNames", "_name"]; +private "_fnc_parseConfigForDisplayNames"; +_fnc_parseConfigForDisplayNames = { + params ["_optionEntry"]; -_parseConfigForDisplayNames = { - private "_optionEntry"; - _optionEntry = _this select 0; if !(isClass _optionEntry) exitwith {false}; - _x set [3, getText (_optionEntry >> "displayName")]; - _x set [4, getText (_optionEntry >> "description")]; private "_values"; - _values = _x select 5; + _values = getArray (_optionEntry >> "values"); + + _x set [3, getText (_optionEntry >> "displayName")]; + _x set [4, getText (_optionEntry >> "description")]; + _x set [5, _values]; + _x set [8, getText (_optionEntry >> "category")]; + { private "_text"; _text = _x; - if (((typeName _text) == "STRING") && {(count _text) > 1} && {(_text select [0,1]) == "$"}) then { - _text = localize (_text select [1, ((count _text) - 1)]); //chop off the leading $ + + if (typeName _text == "STRING" && {count _text > 1} && {_text select [0, 1] == "$"}) then { + _text = localize (_text select [1]); //chop off the leading $ _values set [_forEachIndex, _text]; }; } forEach _values; - true; + true }; - // Iterate through settings { - _name = _x select 0; + _x params ["_name"]; - if !([configFile >> "ACE_Settings" >> _name] call _parseConfigForDisplayNames) then { - if !([configFile >> "ACE_ServerSettings" >> _name] call _parseConfigForDisplayNames) then { - [missionConfigFile >> "ACE_Settings" >> _name] call _parseConfigForDisplayNames; + if !([configFile >> "ACE_Settings" >> _name] call _fnc_parseConfigForDisplayNames) then { + if !([configFile >> "ACE_ServerSettings" >> _name] call _fnc_parseConfigForDisplayNames) then { + if !([missionConfigFile >> "ACE_Settings" >> _name] call _fnc_parseConfigForDisplayNames) then { + ACE_LOGWARNING_1("Setting found, but couldn't localize [%1] (server has but we don't?)",_name); + }; }; }; - -} forEach GVAR(settings); + false +} count GVAR(settings); diff --git a/addons/common/functions/fnc_loadSettingsOnServer.sqf b/addons/common/functions/fnc_loadSettingsOnServer.sqf index 61431ff220..ea8257ec23 100644 --- a/addons/common/functions/fnc_loadSettingsOnServer.sqf +++ b/addons/common/functions/fnc_loadSettingsOnServer.sqf @@ -13,24 +13,26 @@ */ #include "script_component.hpp" -private ["_parseConfigForSettings"]; - GVAR(settings) = []; -_parseConfigForSettings = { - private ["_config", "_countOptions", "_optionEntry", "_index"]; +private "_fnc_parseConfigForSettings"; +_fnc_parseConfigForSettings = { + private ["_config", "_countOptions", "_optionEntry"]; _config = _this select 0; _countOptions = count _config; + for "_index" from 0 to (_countOptions - 1) do { _optionEntry = _config select _index; [_optionEntry] call FUNC(setSettingFromConfig); }; + // Check if all settings should be forced if (GVAR(forceAllSettings)) then { { _x set [6, true]; - } forEach GVAR(settings); + false + } count GVAR(settings); }; }; @@ -41,17 +43,18 @@ _parseConfigForSettings = { // This ensures that all settings are of their correct type, in case an outdated or corrupt server config is used , as well as have their correct localized display name and description // Regular config -[configFile >> "ACE_Settings"] call _parseConfigForSettings; +[configFile >> "ACE_Settings"] call _fnc_parseConfigForSettings; // Server config -[configFile >> "ACE_ServerSettings"] call _parseConfigForSettings; +[configFile >> "ACE_ServerSettings"] call _fnc_parseConfigForSettings; // mission side settings -[missionConfigFile >> "ACE_Settings"] call _parseConfigForSettings; +[missionConfigFile >> "ACE_Settings"] call _fnc_parseConfigForSettings; // Publish all settings data publicVariable QGVAR(settings); // Publish all setting values { publicVariable (_x select 0); -} forEach GVAR(settings); + false +} count GVAR(settings); diff --git a/addons/common/functions/fnc_localEvent.sqf b/addons/common/functions/fnc_localEvent.sqf index 256282f97f..f5a121c088 100644 --- a/addons/common/functions/fnc_localEvent.sqf +++ b/addons/common/functions/fnc_localEvent.sqf @@ -1,36 +1,41 @@ /* * Author: Nou - * * Execute a local event on this client only. * - * Argument: + * Arguments: * 0: Event name (string) * 1: Event args (any) * - * Return value: - * Nothing + * Return Value: + * None + * + * Public: No */ #include "script_component.hpp" -PARAMS_2(_eventName,_eventArgs); +params ["_eventName", "_eventArgs"]; -private["_eventIndex", "_eventNames", "_events"]; +GVAR(events) params ["_eventNames", "_eventArray"]; -_eventNames = GVAR(events) select 0; +private "_eventIndex"; _eventIndex = _eventNames find _eventName; -if(_eventIndex != -1) then { - _events = (GVAR(events) select 1) select _eventIndex; + +if (_eventIndex != -1) then { + private "_events"; + _events = _eventArray select _eventIndex; + #ifdef DEBUG_EVENTS - diag_log text format[ARR_2("* Local Event: %1",_eventName)]; - diag_log text format[ARR_2(" args=%1",_eventArgs)]; + ACE_LOGINFO_1("* Local Event: %1",_eventName); + ACE_LOGINFO_1(" args=%1",_eventArgs); #endif - + { - if(!isNil "_x") then { - _eventArgs call CALLSTACK_NAMED(_x, format[ARR_3("Local Event %1 ID: %2",_eventName,_forEachIndex)]); + if (!isNil "_x") then { + _eventArgs call CALLSTACK_NAMED(_x,FORMAT_2("Local Event %1 ID: %2",_eventName,_forEachIndex)); + #ifdef DEBUG_EVENTS_CALLSTACK - diag_log text format[ARR_2(" ID: %1",_forEachIndex)]; + ACE_LOGINFO_1(" ID: %1",_forEachIndex); #endif }; } forEach _events; -}; \ No newline at end of file +}; diff --git a/addons/common/functions/fnc_log.sqf b/addons/common/functions/fnc_log.sqf deleted file mode 100644 index 21ae4cfbf8..0000000000 --- a/addons/common/functions/fnc_log.sqf +++ /dev/null @@ -1,25 +0,0 @@ -// by commy2 -#include "script_component.hpp" - -if ((_this select 0) in (missionNamespace getVariable ["ACE_Debug", []])) then { - _this resize 4; - - PARAMS_4(_type,_argument,_function,_showInGame); - - if (isNil "_function") then { - _function = {_this}; - }; - - if (isNil "_showInGame") then { - _showInGame = true; - }; - - private "_result"; - _result = _argument call _function; - - if (_showInGame) then { - systemChat format ["%1", _result]; - }; - - diag_log text format ["[ACE] Debug: %1 : %2 - %3 : %4", _type, diag_frameno, _fnc_scriptNameParent, _result]; -}; diff --git a/addons/common/functions/fnc_logControls.sqf b/addons/common/functions/fnc_logControls.sqf deleted file mode 100644 index 5bcaea779b..0000000000 --- a/addons/common/functions/fnc_logControls.sqf +++ /dev/null @@ -1,4 +0,0 @@ -// by commy2 -#include "script_component.hpp" - -[allControls findDisplay _this, {ctrlIDC _this}] call FUNC(map) diff --git a/addons/common/functions/fnc_logDisplays.sqf b/addons/common/functions/fnc_logDisplays.sqf deleted file mode 100644 index 0ab4fbe5bc..0000000000 --- a/addons/common/functions/fnc_logDisplays.sqf +++ /dev/null @@ -1,4 +0,0 @@ -// by commy2 -#include "script_component.hpp" - -[allDisplays, {ctrlIDD _this}] call FUNC(map) diff --git a/addons/common/functions/fnc_logModEntries.sqf b/addons/common/functions/fnc_logModEntries.sqf deleted file mode 100644 index ec8c94b190..0000000000 --- a/addons/common/functions/fnc_logModEntries.sqf +++ /dev/null @@ -1,18 +0,0 @@ -// by commy2 -#include "script_component.hpp" - -private ["_configs", "_entries", "_name"]; - -_configs = "true" configClasses (configFile >> _this); - -_entries = []; - -{ - { - _name = toLower configName _x; - if !(_name in _entries) then { - diag_log text _name; - _entries pushBack _name; - }; - } forEach configProperties [_x, "toLower configName _x find 'ace' == 0", false]; -} forEach _configs; diff --git a/addons/common/functions/fnc_map.sqf b/addons/common/functions/fnc_map.sqf index 16ed168218..a727de08bf 100644 --- a/addons/common/functions/fnc_map.sqf +++ b/addons/common/functions/fnc_map.sqf @@ -1,6 +1,5 @@ /* * Author: KoffeinFlummi, commy2 - * * Applies given code to every element in an array, LIKE SOMETHING SQF SHOULD HAVE BY DEFAULT. * * Arguments: @@ -12,20 +11,18 @@ * * Usage: * [["2", "gobblecock", "25"], {parseNumber _this}] call FUNC(map) ==> [2, 0, 25] + * + * Public: Yes */ #include "script_component.hpp" -private ["_array", "_code"]; +params ["_array", "_code"]; -_array = + _this select 0; -_code = _this select 1; - -if (isNil "_array") exitWith { - diag_log text format ["[ACE] ERROR: No array for function map in %1", _fnc_scriptNameParent]; - [] -}; +// copy array to not alter the original one +_array = + _array; { _array set [_forEachIndex, _x call _code]; } forEach _array; + _array diff --git a/addons/common/functions/fnc_moduleCheckPBOs.sqf b/addons/common/functions/fnc_moduleCheckPBOs.sqf index c75324c9a3..4585682496 100644 --- a/addons/common/functions/fnc_moduleCheckPBOs.sqf +++ b/addons/common/functions/fnc_moduleCheckPBOs.sqf @@ -9,12 +9,14 @@ * * Return Value: * None + * + * Public: No */ #include "script_component.hpp" if !(isServer) exitWith {}; -PARAMS_3(_logic,_units,_activated); +params ["_logic", "_units", "_activated"]; if !(_activated) exitWith {}; @@ -22,4 +24,4 @@ if !(_activated) exitWith {}; [_logic, QGVAR(checkPBOsCheckAll), "CheckAll" ] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(checkPBOsWhitelist), "Whitelist" ] call EFUNC(common,readSettingFromModule); -diag_log text format ["[ACE]: Check-PBOs Module Initialized. Mode: %1.", GVAR(checkPBOsAction)]; +ACE_LOGINFO_1("Check-PBOs Module Initialized. Mode: %1.",GVAR(checkPBOsAction)); diff --git a/addons/common/functions/fnc_moduleLSDVehicles.sqf b/addons/common/functions/fnc_moduleLSDVehicles.sqf index 59744016ce..8a6cb90eca 100644 --- a/addons/common/functions/fnc_moduleLSDVehicles.sqf +++ b/addons/common/functions/fnc_moduleLSDVehicles.sqf @@ -1,6 +1,5 @@ /* - * Author: KoffeinFlummi - * + * Author: KoffeinFlummi, joko // Jonas * Nothing to see here, move along. * * Arguments: @@ -8,40 +7,53 @@ * * Return Value: * None + * + * Public: No */ #include "script_component.hpp" -PARAMS_3(_logic,_units,_activated); - -private["_colors", "_hSCount", "_hiddenSelections", "_i", "_index", "_vehicle"]; +params ["", "_units", "_activated"]; if !(_activated) exitWith {}; +if (isNil QGVAR(LSD_Vehicles)) then { + GVAR(LSD_Vehicles) = []; +}; + { - _hiddenSelections = count (getArray (configFile >> "CfgVehicles" >> (typeOf _x) >> "hiddenSelections")); - if (_hiddenSelections > 0) then { - nul = [_x, _hiddenSelections] spawn { - _vehicle = _this select 0; - _hSCount = _this select 1; - _colors = [ - "#(argb,8,8,3)color(1,0,0,1,co)", - "#(argb,8,8,3)color(1,0.5,0,1,co)", - "#(argb,8,8,3)color(1,1,0,1,co)", - "#(argb,8,8,3)color(0,1,0,1,co)", - "#(argb,8,8,3)color(0,0,1,1,co)", - "#(argb,8,8,3)color(0.2,0,0.5,1,co)", - "#(argb,8,8,3)color(0.5,0,1,1,co)" - ]; - _index = 0; - while {True} do { - for "_i" from 0 to (_hSCount - 1) do { - _vehicle setObjectTexture [_i, (_colors select _index)]; - }; - _index = (_index + 1) % 7; - sleep 0.02; - }; - }; + _hSCount = count (getArray (configFile >> "CfgVehicles" >> typeOf _x >> "hiddenSelections")); + if (_hSCount > 0) then { + GVAR(LSD_Vehicles) pushBack [_x, _hSCount]; }; + nil } count _units; -diag_log text "[ACE]: WEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE."; +if (isNil QGVAR(LSD_Colors)) then { + GVAR(LSD_Colors) = [ + "#(argb,8,8,3)color(1,0,0,1,co)", + "#(argb,8,8,3)color(1,0.5,0,1,co)", + "#(argb,8,8,3)color(1,1,0,1,co)", + "#(argb,8,8,3)color(0,1,0,1,co)", + "#(argb,8,8,3)color(0,0,1,1,co)", + "#(argb,8,8,3)color(0.2,0,0.5,1,co)", + "#(argb,8,8,3)color(0.5,0,1,1,co)" + ]; +}; + +if (isNil QGVAR(LSD_PFH)) then { + GVAR(LSD_PFH) = [{ + (_this select 0) params ["_index"]; + { + _x params ["_vehicle", "_hSCount"]; + for "_i" from 0 to (_hSCount - 1) do { + _vehicle setObjectTexture [_i, GVAR(LSD_Colors) select _index]; + }; + nil + } count GVAR(LSD_Vehicles); + + _index = ((_index + 1) % 7) mod count GVAR(LSD_Colors); + (_this select 0) set [0, _index]; + + }, 0.02, [0]] call CBA_fnc_addPerFrameHandler; +}; +ACE_LOGINFO("WEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEED."); diff --git a/addons/common/functions/fnc_monitor.sqf b/addons/common/functions/fnc_monitor.sqf index f77aa2dd7c..4672d6eec0 100644 --- a/addons/common/functions/fnc_monitor.sqf +++ b/addons/common/functions/fnc_monitor.sqf @@ -1,11 +1,21 @@ -// by commy2 +/* + * Author: commy2 + * hint retun value of given function every frame + * + * Argument: + * + * + * Return Value: + * None + * + * Public: Yes + */ #include "script_component.hpp" -terminate (missionNamespace getVariable [QGVAR(MonitorFnc), scriptNull]); - -GVAR(MonitorFnc) = _this spawn { - waitUntil { - hintSilent str (call _this); - false - }; +if (!isNil QGVAR(MonitorFnc)) then { + [GVAR(MonitorFnc)] call CBA_fnc_removePerFrameHandler; }; + +GVAR(MonitorFnc) = [{ + hintSilent str (call (_this select 0)); +}, 0, _this] call CBA_fnc_addPerFrameHandler; diff --git a/addons/common/functions/fnc_moveToTempGroup.sqf b/addons/common/functions/fnc_moveToTempGroup.sqf deleted file mode 100644 index be7335c705..0000000000 --- a/addons/common/functions/fnc_moveToTempGroup.sqf +++ /dev/null @@ -1,32 +0,0 @@ -/** - * fn_moveToTempGroup_f.sqf - * Moves a unit into a temporarly group and stores its original group to allow rejoining. - * @Author: Glowbal - * - * @Arguments: [unit OBJECT, moveToTempGroup BOOL] - * @Return: void - * @PublicAPI: false - */ - -#include "script_component.hpp" - -private ["_unit","_moveTo","_previousGroup","_newGroup", "_currentGroup"]; -_unit = [_this, 0,ObjNull,[ObjNull]] call BIS_fnc_Param; -_moveTo = [_this, 1,false,[false]] call BIS_fnc_Param; - -if (_moveTo) then { - _previousGroup = group _unit; - _newGroup = createGroup (side _previousGroup); - [_unit] joinSilent _newGroup; - _unit setvariable [QGVAR(previousGroup),_previousGroup]; -} else { - _previousGroup = _unit getvariable QGVAR(previousGroup); - if (!isnil "_previousGroup") then { - _currentGroup = group _unit; - _unit setvariable [QGVAR(previousGroup),nil]; - [_unit] joinSilent _previousGroup; - if (count units _currentGroup == 0) then { - deleteGroup _currentGroup; - }; - }; -}; \ No newline at end of file diff --git a/addons/common/functions/fnc_muteUnit.sqf b/addons/common/functions/fnc_muteUnit.sqf index 1eceff744c..84d56f92bd 100644 --- a/addons/common/functions/fnc_muteUnit.sqf +++ b/addons/common/functions/fnc_muteUnit.sqf @@ -1,23 +1,25 @@ /* * Author: commy2 - * * Mutes the unit. It won't trigger auto generated chat messages either. * - * Argument: - * 0: Unit (Object) - * 1: Reason to mute the unit (String) + * Arguments: + * 0: Unit + * 1: Reason to mute the unit * - * Return value: - * Nothing + * Return Value: + * None + * + * Public: Yes */ #include "script_component.hpp" -PARAMS_2(_unit,_reason); +params ["_unit", "_reason"]; if (isNull _unit) exitWith {}; +private ["_muteUnitReasons", "_speaker"]; + // add reason to mute to the unit -private "_muteUnitReasons"; _muteUnitReasons = _unit getVariable [QGVAR(muteUnitReasons), []]; if !(_reason in _muteUnitReasons) then { @@ -25,7 +27,6 @@ if !(_reason in _muteUnitReasons) then { _unit setVariable [QGVAR(muteUnitReasons), _muteUnitReasons, true]; }; -private "_speaker"; _speaker = speaker _unit; if (_speaker == "ACE_NoVoice") exitWith {}; diff --git a/addons/common/functions/fnc_muteUnitHandleInitPost.sqf b/addons/common/functions/fnc_muteUnitHandleInitPost.sqf index a257a22ea0..8c5967b0d3 100644 --- a/addons/common/functions/fnc_muteUnitHandleInitPost.sqf +++ b/addons/common/functions/fnc_muteUnitHandleInitPost.sqf @@ -1,7 +1,18 @@ -// by commy2 +/* + * Author: commy2 + * Applies speaker changes on init post. Used because setSpeaker is broken on init. + * + * Arguments: + * 0: unit + * + * Return Value: + * None + * + * Public: No + */ #include "script_component.hpp" -PARAMS_1(_unit); +params ["_unit"]; // setSpeaker gets overwritten after init on remote units; if unit is muted, setSpeaker again if (count (_unit getVariable [QGVAR(muteUnitReasons), []]) > 0) then { diff --git a/addons/common/functions/fnc_muteUnitHandleRespawn.sqf b/addons/common/functions/fnc_muteUnitHandleRespawn.sqf index 5cef18a0b3..a1a64eada3 100644 --- a/addons/common/functions/fnc_muteUnitHandleRespawn.sqf +++ b/addons/common/functions/fnc_muteUnitHandleRespawn.sqf @@ -1,7 +1,18 @@ -// by commy2 +/* + * Author: commy2 + * Applies speaker changes on respawn. Used because speaker is respawning breaks the speaker on non-local clients. Also resets the public object variable (broken for JIP clients, that join after respawn) + * + * Arguments: + * 0: unit + * + * Return Value: + * None + * + * Public: No + */ #include "script_component.hpp" -PARAMS_1(_unit); +params ["_unit"]; // setVariable is broken on JIP after respawn _unit setVariable [QGVAR(muteUnitReasons), _unit getVariable [QGVAR(muteUnitReasons), []], true]; diff --git a/addons/common/functions/fnc_numberToDigits.sqf b/addons/common/functions/fnc_numberToDigits.sqf index 3545b53257..c5e1b6d7b6 100644 --- a/addons/common/functions/fnc_numberToDigits.sqf +++ b/addons/common/functions/fnc_numberToDigits.sqf @@ -1,25 +1,24 @@ /* * Author: commy2 - * * Transforms a number to an array of the correspondending digits. * - * Argument: - * 0: Number to 'digitize' (Number) - * 1: Set the minimal length of the returned array. Useful for getting left hand zeroes. (Number, optional) + * Arguments: + * 0: Number to 'digitize' + * 1: Set the minimal length of the returned array. Useful for getting left hand zeroes. , optional * - * Return value: - * Digits. The maximum count is six digits. (Array) + * Return Value: + * Digits. The maximum count is six digits. + * + * Public: Yes */ #include "script_component.hpp" -private ["_length", "_digits"]; - -PARAMS_2(_number,_minLength); +params ["_number", "_minLength"]; _number = _number min 999999; - _number = str _number; +private "_length"; _length = count _number; if (isNil "_minLength") then {_minLength = _length}; @@ -31,7 +30,9 @@ while {_length < _minLength} do { _length = _length + 1; }; +private "_digits"; _digits = []; + for "_x" from 0 to (_length - 1) do { _digits pushBack parseNumber (_number select [_x, 1]); }; diff --git a/addons/common/functions/fnc_numberToDigitsString.sqf b/addons/common/functions/fnc_numberToDigitsString.sqf index e42f246460..f8f192e0e3 100644 --- a/addons/common/functions/fnc_numberToDigitsString.sqf +++ b/addons/common/functions/fnc_numberToDigitsString.sqf @@ -1,25 +1,24 @@ /* * Author: commy2 - * * Transforms a number to an string of the correspondending digits. * - * Argument: - * 0: Number to 'digitize' (Number) + * Arguments: + * 0: Number to 'digitize' * 1: Set the minimal length of the returned string. Useful for getting left hand zeroes. (Number, optional) * - * Return value: - * Digits. The maximum length is six digits. (String) + * Return Value: + * Digits. The maximum length is six digits. + * + * Public: Yes */ #include "script_component.hpp" -private ["_length"]; - -PARAMS_2(_number,_minLength); +params ["_number", "_minLength"]; _number = _number min 999999; - _number = str _number; +private "_length"; _length = count _number; if (isNil "_minLength") then {_minLength = _length}; diff --git a/addons/common/functions/fnc_numberToString.sqf b/addons/common/functions/fnc_numberToString.sqf index 30efcd8955..4dd810607c 100644 --- a/addons/common/functions/fnc_numberToString.sqf +++ b/addons/common/functions/fnc_numberToString.sqf @@ -1,25 +1,25 @@ /* * Author: commy2 - * * Converts a number to a string without losing as much precission as str or format. * - * Argument: - * 0: A number (Number) + * Arguments: + * 0: A number * - * Return value: - * The number as string (String) + * Return Value: + * The number as string + * + * Public: Yes */ #include "script_component.hpp" -private ["_decimals"]; +params ["_number"]; -PARAMS_1(_number); - -_decimals = str (abs(_number) mod 1); +private "_decimals"; +_decimals = str (abs _number mod 1); _decimals = toArray _decimals; _decimals deleteAt 0; if (_number < 0) exitWith { - format ["-%1%2", floor abs(_number), toString _decimals]; + format ["-%1%2", floor abs _number, toString _decimals]; }; format ["%1%2", floor _number, toString _decimals]; diff --git a/addons/common/functions/fnc_onAnswerRequest.sqf b/addons/common/functions/fnc_onAnswerRequest.sqf index a8dd2ce351..b1639eb970 100644 --- a/addons/common/functions/fnc_onAnswerRequest.sqf +++ b/addons/common/functions/fnc_onAnswerRequest.sqf @@ -1,19 +1,23 @@ -/** - * fn_onAnswerRequest.sqf - * @Descr: N/A - * @Author: Glowbal +/* + * Author: Glowbal + * N/A * - * @Arguments: [] - * @Return: - * @PublicAPI: false + * Arguments: + * ? + * + * Return Value: + * ? + * + * Public: No */ #include "script_component.hpp" +params ["_unit", "_id", "_accepted"]; + private ["_requestID", "_info", "_callBack", "_caller", "_replyParams", "_requestMessage", "_target"]; -PARAMS_3(_unit,_id,_accepted); - _info = _unit getvariable _id; + if (!isnil "_info") then { _caller = _info select 0; _target = _info select 1; @@ -21,7 +25,7 @@ if (!isnil "_info") then { _requestMessage = _info select 3; _callBack = _info select 4; _replyParams = [_info, _accepted]; - [_replyParams, QUOTE(FUNC(requestCallback)), _caller, false] call FUNC(execRemoteFnc); + [_replyParams, QFUNC(requestCallback), _caller, false] call FUNC(execRemoteFnc); _unit setvariable [_id, nil]; }; diff --git a/addons/common/functions/fnc_owned.sqf b/addons/common/functions/fnc_owned.sqf index b76edb31c1..e352795c5e 100644 --- a/addons/common/functions/fnc_owned.sqf +++ b/addons/common/functions/fnc_owned.sqf @@ -1,17 +1,17 @@ /* * Author: commy2 - * * Counterpart of ace_common_fnc_claim. Check if the given object is claimed by another unit. * * Arguments: - * 0: Any object. (Object) + * 0: Any object. * * Return Value: * Is this object claimed by someone? * + * Public: No */ #include "script_component.hpp" -PARAMS_1(_target); +params ["_target"]; !isNull (_target getVariable [QGVAR(owner), objNull]) diff --git a/addons/common/functions/fnc_player.sqf b/addons/common/functions/fnc_player.sqf index 3e5990f84b..1a268515a7 100644 --- a/addons/common/functions/fnc_player.sqf +++ b/addons/common/functions/fnc_player.sqf @@ -1,6 +1,5 @@ /* * Author: bux578, commy2 - * * Returns the player or curator controlled unit. * Use this in INIT and RESPAWN eh scripts, because ACE_player isn't reset yet. * @@ -8,7 +7,9 @@ * NONE. * * Return Value: - * Player controlled unit (object) + * Player controlled unit + * + * Public: Yes */ #include "script_component.hpp" diff --git a/addons/common/functions/fnc_playerSide.sqf b/addons/common/functions/fnc_playerSide.sqf index 632cf11abf..3a7ce5bba9 100644 --- a/addons/common/functions/fnc_playerSide.sqf +++ b/addons/common/functions/fnc_playerSide.sqf @@ -1,4 +1,15 @@ -// by commy2 +/* + * Author: commy2 + * Return the current side of the player + * + * Arguments: + * None + * + * Return Value: + * current local side + * + * Public: Yes + */ #include "script_component.hpp" side group ACE_player diff --git a/addons/common/functions/fnc_positionToASL.sqf b/addons/common/functions/fnc_positionToASL.sqf index d933e67125..267bbf2353 100644 --- a/addons/common/functions/fnc_positionToASL.sqf +++ b/addons/common/functions/fnc_positionToASL.sqf @@ -10,7 +10,7 @@ * Return Value: * None * - * Public: No + * Public: Yes */ #include "script_component.hpp" diff --git a/addons/common/functions/fnc_progressBar.sqf b/addons/common/functions/fnc_progressBar.sqf index adc1b8d4c3..29db1cd0c6 100644 --- a/addons/common/functions/fnc_progressBar.sqf +++ b/addons/common/functions/fnc_progressBar.sqf @@ -1,10 +1,9 @@ /* * Author: commy2, Glowbal, PabstMirror - * * Draw progress bar and execute given function if succesful. * Finish/Failure/Conditional are all passed [_args, _elapsedTime, _totalTime, _errorCode] * - * Argument: + * Arguments: * 0: NUMBER - Total Time (in game "ACE_time" seconds) * 1: ARRAY - Arguments, passed to condition, fail and finish * 2: CODE or STRING - On Finish: Code called or STRING raised as event. @@ -13,26 +12,26 @@ * 5: CODE - (Optional) Code to check each frame * 6: ARRAY - (Optional) Exceptions for checking EFUNC(common,canInteractWith) * - * Return value: + * Return Value: * Nothing * * Example: * [5, [], {Hint "Finished!"}, {hint "Failure!"}, "My Title"] call ace_common_fnc_progressBar + * + * Public: Yes */ - #include "script_component.hpp" -PARAMS_4(_totalTime,_args,_onFinish,_onFail); -DEFAULT_PARAM(4,_localizedTitle,""); -DEFAULT_PARAM(5,_condition,{true}); -DEFAULT_PARAM(6,_exceptions,[]); -private ["_player", "_perFrameFunction", "_ctrlPos"]; +params ["_totalTime", "_args", "_onFinish", "_onFail", ["_localizedTitle", ""], ["_condition", {true}], ["_exceptions", []]]; + +private ["_player", "_ctrlPos", "_fnc_perFrameFunction"]; _player = ACE_player; //Open Dialog and set the title closeDialog 0; createDialog QGVAR(ProgressBar_Dialog); + (uiNamespace getVariable QGVAR(ctrlProgressBarTitle)) ctrlSetText _localizedTitle; //Adjust position based on user setting: @@ -46,11 +45,9 @@ _ctrlPos set [1, ((0 + 29 * GVAR(SettingProgressBarLocation)) * ((((safezoneW / (uiNamespace getVariable QGVAR(ctrlProgressBarTitle)) ctrlSetPosition _ctrlPos; (uiNamespace getVariable QGVAR(ctrlProgressBarTitle)) ctrlCommit 0; +_fnc_perFrameFunction = { + (_this select 0) params ["_args", "_onFinish", "_onFail", "_condition", "_player", "_startTime", "_totalTime", "_exceptions"]; - -_perFrameFunction = { - PARAMS_2(_parameters,_pfhID); - EXPLODE_8_PVT(_parameters,_args,_onFinish,_onFail,_condition,_player,_startTime,_totalTime,_exceptions); private ["_elapsedTime", "_errorCode"]; _elapsedTime = ACE_time - _startTime; @@ -63,10 +60,10 @@ _perFrameFunction = { if (ACE_player != _player || !alive _player) then { _errorCode = 2; } else { - if (!([_args, _elapsedTime, _totalTime, _errorCode] call _condition)) then { + if !([_args, _elapsedTime, _totalTime, _errorCode] call _condition) then { _errorCode = 3; } else { - if (!([_player, objNull, _exceptions] call EFUNC(common,canInteractWith))) then { + if !([_player, objNull, _exceptions] call EFUNC(common,canInteractWith)) then { _errorCode = 4; } else { if (_elapsedTime >= _totalTime) then { @@ -84,16 +81,17 @@ _perFrameFunction = { if (!isNull (uiNamespace getVariable [QGVAR(ctrlProgressBar), controlNull])) then { closeDialog 0; }; - [_pfhID] call CBA_fnc_removePerFrameHandler; + + [_this select 1] call CBA_fnc_removePerFrameHandler; if (_errorCode == 0) then { - if ((typeName _onFinish) == (typeName "")) then { + if (typeName _onFinish == "STRING") then { [_onFinish, [_args, _elapsedTime, _totalTime, _errorCode]] call FUNC(localEvent); } else { [_args, _elapsedTime, _totalTime, _errorCode] call _onFinish; }; } else { - if ((typeName _onFail) == (typeName "")) then { + if (typeName _onFail == "STRING") then { [_onFail, [_args, _elapsedTime, _totalTime, _errorCode]] call FUNC(localEvent); } else { [_args, _elapsedTime, _totalTime, _errorCode] call _onFail; @@ -105,4 +103,4 @@ _perFrameFunction = { }; }; -[_perFrameFunction, 0, [_args, _onFinish, _onFail, _condition, _player, ACE_time, _totalTime, _exceptions]] call CBA_fnc_addPerFrameHandler; +[_fnc_perFrameFunction, 0, [_args, _onFinish, _onFail, _condition, _player, ACE_time, _totalTime, _exceptions]] call CBA_fnc_addPerFrameHandler; diff --git a/addons/common/functions/fnc_queueAnimation.sqf b/addons/common/functions/fnc_queueAnimation.sqf deleted file mode 100644 index 73f3dca109..0000000000 --- a/addons/common/functions/fnc_queueAnimation.sqf +++ /dev/null @@ -1,10 +0,0 @@ -// by commy2 -#include "script_component.hpp" - -terminate (missionNamespace getVariable [QGVAR(waitForAnimationHandle), scriptNull]); - -GVAR(waitForAnimationHandle) = _this spawn { - waitUntil {!([_this select 0] call FUNC(inTransitionAnim))}; - - _this call FUNC(doAnimation); -}; diff --git a/addons/common/functions/fnc_readSettingFromModule.sqf b/addons/common/functions/fnc_readSettingFromModule.sqf index 0bf2693eba..f7cb361c1b 100644 --- a/addons/common/functions/fnc_readSettingFromModule.sqf +++ b/addons/common/functions/fnc_readSettingFromModule.sqf @@ -1,26 +1,27 @@ /* * Author: esteldunedain - * * Reads a setting value from a module, set it and force it. Logs if the setting is missing from the module. * Must be called on the server, effect is global. * * Arguments: - * 0: Module (Object) - * 1: ACE_Parameter name (string) - * 2: Module parameter name (string) + * 0: Module + * 1: ACE_Parameter name + * 2: Module parameter name * * Return Value: * None + * + * Public: No */ #include "script_component.hpp" if !(isServer) exitWith {}; -PARAMS_3(_logic,_settingName,_moduleVariable); +params ["_logic", "_settingName", "_moduleVariable"]; // Check if the parameter is defined in the module if (isNil {_logic getVariable _moduleVariable}) exitWith { - diag_log text format["[ACE]: Warning in %1 module: %2 setting is missing. Probably an obsolete version of the module is used in the mission.", typeOf _logic, _moduleVariable]; + ACE_LOGWARNING_2("Warning in %1 module: %2 setting is missing. Probably an obsolete version of the module is used in the mission.",typeOf _logic,_moduleVariable); }; // Set the setting globally and force it diff --git a/addons/common/functions/fnc_receiveRequest.sqf b/addons/common/functions/fnc_receiveRequest.sqf index dc028724f6..1377f4ec35 100644 --- a/addons/common/functions/fnc_receiveRequest.sqf +++ b/addons/common/functions/fnc_receiveRequest.sqf @@ -1,37 +1,41 @@ -/** - * fn_recieveRequest.sqf - * @Descr: N/A - * @Author: Glowbal +/* + * Author: Glowbal + * N/A * - * @Arguments: [] - * @Return: - * @PublicAPI: false + * Arguments: + * ? + * + * Return Value: + * None + * + * Public: No */ - #include "script_component.hpp" -PARAMS_5(_caller,_target,_requestID,_requestMessage,_callBack); +params ["_caller", "_target", "_requestID", "_requestMessage", "_callBack"]; _requestID = ("ace_recieveRequest_f_id_"+_requestID); -_target setvariable [_requestID, _this]; +_target setVariable [_requestID, _this]; if (isLocalized _requestMessage) then { - _requestMessage = format[localize _requestMessage,[_caller] call FUNC(getName)]; + _requestMessage = format [localize _requestMessage, [_caller] call FUNC(getName)]; } else { - _requestMessage = format[_requestMessage,[_caller] call FUNC(getName)]; + _requestMessage = format [_requestMessage, [_caller] call FUNC(getName)]; }; -hint format["%1",_requestMessage]; -if !(isnil QGVAR(RECIEVE_REQUEST_TIME_OUT_SCRIPT)) then { +hint format ["%1", _requestMessage]; // @todo ? + +if !(isNil QGVAR(RECIEVE_REQUEST_TIME_OUT_SCRIPT)) then { terminate GVAR(RECIEVE_REQUEST_TIME_OUT_SCRIPT); }; -if (!isnil QGVAR(RECIEVE_REQUEST_ADD_ACTION_ACCEPT)) then { +if (!isNil QGVAR(RECIEVE_REQUEST_ADD_ACTION_ACCEPT)) then { _target removeAction GVAR(RECIEVE_REQUEST_ADD_ACTION_ACCEPT); GVAR(RECIEVE_REQUEST_ADD_ACTION_ACCEPT) = nil; }; -if (!isnil QGVAR(RECIEVE_REQUEST_ADD_ACTION_DECLINE)) then { + +if (!isNil QGVAR(RECIEVE_REQUEST_ADD_ACTION_DECLINE)) then { _target removeAction GVAR(RECIEVE_REQUEST_ADD_ACTION_DECLINE); GVAR(RECIEVE_REQUEST_ADD_ACTION_DECLINE) = nil; }; @@ -41,24 +45,31 @@ GVAR(RECIEVE_REQUEST_ADD_ACTION_DECLINE) = _target addAction ["Decline", compile GVAR(RECIEVE_REQUEST_ID_KEY_BINDING) = _requestID; -GVAR(RECIEVE_REQUEST_TIME_OUT_SCRIPT) = [ACE_time, _target, _requestID] spawn { - private["_id", "_t", "_requestID", "_target"]; - _t = (_this select 0) + 40; - _target = _this select 1; - _requestID = _this select 2; - _id = _target getvariable _requestID; - waituntil { - _id = _target getvariable _requestID; +GVAR(RECIEVE_REQUEST_TIME_OUT_SCRIPT) = [ACE_time, _target, _requestID] spawn { // @todo + params ["_time", "_target", "_requestID"]; + + _time = _time + 40; + + private "_id"; + _id = _target getVariable _requestID; + + waituntil { + _id = _target getVariable _requestID; + + (ACE_time > _time || isNil "_id") + }; + + _target setVariable [_requestID, nil]; - (ACE_time > _t || isnil "_id")}; - _target setvariable [_requestID, nil]; GVAR(RECIEVE_REQUEST_ID_KEY_BINDING) = nil; - if (!isnil QGVAR(RECIEVE_REQUEST_ADD_ACTION_ACCEPT)) then { + + if (!isNil QGVAR(RECIEVE_REQUEST_ADD_ACTION_ACCEPT)) then { _target removeAction GVAR(RECIEVE_REQUEST_ADD_ACTION_ACCEPT); GVAR(RECIEVE_REQUEST_ADD_ACTION_ACCEPT) = nil; }; - if (!isnil QGVAR(RECIEVE_REQUEST_ADD_ACTION_DECLINE)) then { + + if (!isNil QGVAR(RECIEVE_REQUEST_ADD_ACTION_DECLINE)) then { _target removeAction GVAR(RECIEVE_REQUEST_ADD_ACTION_DECLINE); GVAR(RECIEVE_REQUEST_ADD_ACTION_DECLINE) = nil; }; -}; \ No newline at end of file +}; diff --git a/addons/common/functions/fnc_removeActionEventHandler.sqf b/addons/common/functions/fnc_removeActionEventHandler.sqf index 805a0bdde9..b22ed0f152 100644 --- a/addons/common/functions/fnc_removeActionEventHandler.sqf +++ b/addons/common/functions/fnc_removeActionEventHandler.sqf @@ -1,34 +1,30 @@ /* * Author: commy2 - * * Remove an addAction event from a unit. * - * Argument: - * 0: Unit the action is assigned to (Object) - * 1: Name of the action, e.g. "DefaultAction" (String) - * 2: ID of the action (Number) + * Arguments: + * 0: Unit the action is assigned to + * 1: Name of the action, e.g. "DefaultAction" + * 2: ID of the action * - * Return value: - * None. + * Return Value: + * None + * + * Public: No */ #include "script_component.hpp" -private ["_name", "_actionsVar", "_actionID", "_actions", "_currentID", "_actionIDs"]; - -PARAMS_3(_unit,_action,_id); +params ["_unit", "_action", "_id"]; if (_id == -1) exitWith {}; -_name = format ["ACE_Action_%1", _action]; +private ["_name", "_actionsVar"]; +_name = format ["ACE_Action_%1", _action]; _actionsVar = _unit getVariable [_name, [-1, [-1, [], []], objNull]]; -_actionID = _actionsVar select 0; -_actions = _actionsVar select 1; - -_currentID = _actions select 0; -_actionIDs = _actions select 1; -_actions = _actions select 2; +_actionsVar params ["_actionID", "_actionsArray"]; +_actionsArray params ["_currentID", "_actionIDs", "_actions"]; if (_unit != _actionsVar select 2) exitWith {}; diff --git a/addons/common/functions/fnc_removeActionMenuEventHandler.sqf b/addons/common/functions/fnc_removeActionMenuEventHandler.sqf index b45476a3da..e5adbe0c01 100644 --- a/addons/common/functions/fnc_removeActionMenuEventHandler.sqf +++ b/addons/common/functions/fnc_removeActionMenuEventHandler.sqf @@ -1,39 +1,37 @@ /* * Author: commy2 + * Remove an addAction menu event from a unit. * - * Remove an addAction event from a unit. + * Arguments: + * 0: Unit the action is assigned to + * 1: Name of the action, e.g. "DefaultAction" + * 2: ID of the action * - * Argument: - * 0: Unit the action is assigned to (Object) - * 1: Name of the action, e.g. "DefaultAction" (String) - * 2: ID of the action (Number) + * Return Value: + * None * - * Return value: - * None. + * Public: No */ #include "script_component.hpp" -private ["_name", "_actionsVar", "_currentID", "_actionIDs", "_actions", "_actionID", "_nameVar"]; - -PARAMS_3(_unit,_action,_id); +params ["_unit", "_action", "_id"]; if (_id == -1) exitWith {}; -_name = format ["ACE_ActionMenu_%1", _action]; +private ["_name", "_actionsVar"]; +_name = format ["ACE_ActionMenu_%1", _action]; _actionsVar = _unit getVariable [_name, [-1, [-1, [], []]]]; -_currentID = _actionsVar select 0; -_actionIDs = _actionsVar select 1; -_actions = _actionsVar select 2; +_actionsVar params ["_currentID", "_actionIDs", "_actions"]; _id = _actionIDs find _id; if (_id == -1) exitWith {}; _action = _actions select _id; -_actionID = _action select 0; -_nameVar = _action select 1; + +_action params ["_actionID", "_nameVar"]; missionNamespace setVariable [_nameVar, nil]; diff --git a/addons/common/functions/fnc_removeAllEventHandlers.sqf b/addons/common/functions/fnc_removeAllEventHandlers.sqf index 6bf4dc742a..1a1a6e255f 100644 --- a/addons/common/functions/fnc_removeAllEventHandlers.sqf +++ b/addons/common/functions/fnc_removeAllEventHandlers.sqf @@ -1,21 +1,26 @@ /* * Author: Nou - * * Remove all events of a certain event type. * * Argument: - * 0: Event name (string) + * 0: Event name * - * Return value: - * Nothing + * Return Value: + * None + * + * Public: Yes */ #include "script_component.hpp" -private ["_eventNames", "_eventFunctions", "_eventIndex"]; -PARAMS_1(_eventName); -_eventNames = GVAR(events) select 0; +params ["_eventName"]; + +GVAR(events) params ["_eventNames", "_events"]; + +private ["_eventFunctions", "_eventIndex"]; + _eventFunctions = []; _eventIndex = _eventNames find _eventName; + if (_eventIndex != -1) then { - (GVAR(events) select 1) set [_eventIndex, []]; -}; \ No newline at end of file + _events set [_eventIndex, []]; +}; diff --git a/addons/common/functions/fnc_removeBinocularMagazine.sqf b/addons/common/functions/fnc_removeBinocularMagazine.sqf new file mode 100644 index 0000000000..3d2252390a --- /dev/null +++ b/addons/common/functions/fnc_removeBinocularMagazine.sqf @@ -0,0 +1,30 @@ +/* + * Author: commy2 + * Removes the magazine of the units rangefinder. + * + * Arguments: + * 0: Unit + * + * Return Value: + * None + * + * Example: + * [player] call ace_common_fnc_removeBinocularMagazine + * + * Public: Yes + */ +#include "script_component.hpp" + +params ["_unit"]; + +private ["_binocular", "_selectBinocular"]; + +_binocular = binocular _unit; + +_selectBinocular = currentWeapon _unit == _binocular; + +_unit addWeapon _binocular; + +if (_selectBinocular) then { + _unit selectWeapon _binocular; +}; diff --git a/addons/common/functions/fnc_removeCanInteractWithCondition.sqf b/addons/common/functions/fnc_removeCanInteractWithCondition.sqf index 6cfd751c4c..6c3fa8354b 100644 --- a/addons/common/functions/fnc_removeCanInteractWithCondition.sqf +++ b/addons/common/functions/fnc_removeCanInteractWithCondition.sqf @@ -1,27 +1,25 @@ /* * Author: commy2 - * * Remove a condition that gets checked by ace_common_fnc_canInteractWith. * * Arguments: - * 0: The conditions id. (String) + * 0: The conditions id. * * Return Value: - * Unit can interact? + * None * + * Public: No */ #include "script_component.hpp" -private "_conditionName"; +params ["_conditionName"]; -_conditionName = toLower (_this select 0); - -private ["_conditions", "_conditionNames", "_conditionFuncs"]; +_conditionName = toLower _conditionName; +private "_conditions"; _conditions = missionNamespace getVariable [QGVAR(InteractionConditions), [[],[]]]; -_conditionNames = _conditions select 0; -_conditionFuncs = _conditions select 1; +_conditions params ["_conditionNames", "_conditionFuncs"]; private "_index"; _index = _conditionNames find _conditionName; @@ -31,4 +29,4 @@ if (_index == -1) exitWith {}; _conditionNames deleteAt _index; _conditionFuncs deleteAt _index; -GVAR(InteractionConditions) = [_conditionNames, _conditionFuncs]; +GVAR(InteractionConditions) = _conditions; diff --git a/addons/common/functions/fnc_removeEventHandler.sqf b/addons/common/functions/fnc_removeEventHandler.sqf index 16954d5523..0c70046706 100644 --- a/addons/common/functions/fnc_removeEventHandler.sqf +++ b/addons/common/functions/fnc_removeEventHandler.sqf @@ -1,25 +1,28 @@ /* * Author: Nou - * * Remove an event handler. * * Argument: - * 0: Event name (string) - * 1: Event code (number) + * 0: Event name + * 1: Event code * - * Return value: - * Nothing + * Return Value: + * None + * + * Public: Yes */ #include "script_component.hpp" -private ["_eventNames", "_eventFunctions", "_eventIndex"]; -PARAMS_2(_eventName,_eventCodeIndex); +params ["_eventName", "_eventCodeIndex"]; + +GVAR(events) params ["_eventNames", "_events"]; + +private ["_eventFunctions", "_eventIndex"]; -_eventNames = GVAR(events) select 0; _eventFunctions = []; _eventIndex = _eventNames find _eventName; if (_eventIndex != -1) then { - _eventFunctions = (GVAR(events) select 1) select _eventIndex; - _eventFunctions set[_eventCodeIndex, nil]; -}; \ No newline at end of file + _eventFunctions = _events select _eventIndex; + _eventFunctions set [_eventCodeIndex, nil]; +}; diff --git a/addons/common/functions/fnc_removeMapMarkerCreatedEventHandler.sqf b/addons/common/functions/fnc_removeMapMarkerCreatedEventHandler.sqf index 39225bf9dd..d156359ebf 100644 --- a/addons/common/functions/fnc_removeMapMarkerCreatedEventHandler.sqf +++ b/addons/common/functions/fnc_removeMapMarkerCreatedEventHandler.sqf @@ -1,25 +1,23 @@ /* * Author: commy2 - * * Remove a map marker creation event handler. * - * Argument: - * 0: ID of the event handler (Number) + * Arguments: + * 0: ID of the event handler * - * Return value: - * None. + * Return Value: + * None + * + * Public: Yes */ #include "script_component.hpp" -private ["_actionsVar", "_currentId", "_actionIDs", "_actions"]; - -PARAMS_1(_id); +params ["_id"]; +private "_actionsVar"; _actionsVar = missionNamespace getVariable ["ACE_EventHandler_MapMarker", [-1, [], []]]; -_currentId = _actionsVar select 0; -_actionIDs = _actionsVar select 1; -_actions = _actionsVar select 2; +_actionsVar params ["_currentId", "_actionIDs", "_actions"]; _id = _actionIDs find _id; diff --git a/addons/common/functions/fnc_removeScrollWheelEventHandler.sqf b/addons/common/functions/fnc_removeScrollWheelEventHandler.sqf index ff7c0c281e..b277467cce 100644 --- a/addons/common/functions/fnc_removeScrollWheelEventHandler.sqf +++ b/addons/common/functions/fnc_removeScrollWheelEventHandler.sqf @@ -1,25 +1,23 @@ /* * Author: commy2 - * * Remove a scroll wheel event handler. * - * Argument: - * 0: ID of the event handler (Number) + * Arguments: + * 0: ID of the event handler * - * Return value: - * None. + * Return Value: + * None + * + * Public: Yes */ #include "script_component.hpp" -private ["_actionsVar", "_currentId", "_actionIDs", "_actions"]; - -PARAMS_1(_id); +params ["_id"]; +private "_actionsVar"; _actionsVar = missionNamespace getVariable ["ACE_EventHandler_ScrollWheel", [-1, [], []]]; -_currentId = _actionsVar select 0; -_actionIDs = _actionsVar select 1; -_actions = _actionsVar select 2; +_actionsVar params ["_currentId", "_actionIDs", "_actions"]; _id = _actionIDs find _id; diff --git a/addons/common/functions/fnc_removeSpecificMagazine.sqf b/addons/common/functions/fnc_removeSpecificMagazine.sqf index ec24dbf618..46950cc1d8 100644 --- a/addons/common/functions/fnc_removeSpecificMagazine.sqf +++ b/addons/common/functions/fnc_removeSpecificMagazine.sqf @@ -2,68 +2,77 @@ * Author: esteldunedain * Removes a magazine from the unit that has an specific ammo count * - * Argument: - * 0: Player + * Arguments: + * 0: Unit * 1: Magazine * 2: Ammo count * - * Return value: + * Return Value: * None + * + * Public: No */ #include "script_component.hpp" -EXPLODE_3_PVT(_this,_player,_magazineType,_ammoCount); +params ["_unit", "_magazineType", "_ammoCount"]; + +private ["_isRemoved", "_magazines", "_index"]; -private ["_magazines","_index","_isRemoved"]; _isRemoved = false; // Check uniform -_magazines = [magazinesAmmoCargo uniformContainer _player, {_this select 0 == _magazineType}] call FUNC(filter); -_index = _magazines find [_magazineType,_ammoCount]; +_magazines = [magazinesAmmoCargo uniformContainer _unit, {_this select 0 == _magazineType}] call FUNC(filter); +_index = _magazines find [_magazineType, _ammoCount]; if (_index > -1) exitWith { { - _player removeItemFromUniform (_x select 0); - } forEach _magazines; + _unit removeItemFromUniform (_x select 0); + false + } count _magazines; { if (!_isRemoved && (_x isEqualTo [_magazineType,_ammoCount])) then { _isRemoved = true; } else { - (uniformContainer _player) addMagazineAmmoCargo [_x select 0, 1, _x select 1]; + (uniformContainer _unit) addMagazineAmmoCargo [_x select 0, 1, _x select 1]; }; - } forEach _magazines; + false + } count _magazines; }; // Check vest -_magazines = [magazinesAmmoCargo vestContainer _player, {_this select 0 == _magazineType}] call FUNC(filter); +_magazines = [magazinesAmmoCargo vestContainer _unit, {_this select 0 == _magazineType}] call FUNC(filter); _index = _magazines find [_magazineType,_ammoCount]; if (_index > -1) exitWith { { - _player removeItemFromVest (_x select 0); - } forEach _magazines; + _unit removeItemFromVest (_x select 0); + false + } count _magazines; { if (!_isRemoved && (_x isEqualTo [_magazineType,_ammoCount])) then { _isRemoved = true; } else { - (vestContainer _player) addMagazineAmmoCargo [_x select 0, 1, _x select 1]; + (vestContainer _unit) addMagazineAmmoCargo [_x select 0, 1, _x select 1]; }; - } forEach _magazines; + false + } count _magazines; }; // Check backpack -_magazines = [magazinesAmmoCargo backpackContainer _player, {_this select 0 == _magazineType}] call FUNC(filter); +_magazines = [magazinesAmmoCargo backpackContainer _unit, {_this select 0 == _magazineType}] call FUNC(filter); _index = _magazines find [_magazineType,_ammoCount]; if (_index > -1) exitWith { { - _player removeItemFromBackpack (_x select 0); - } forEach _magazines; + _unit removeItemFromBackpack (_x select 0); + false + } count _magazines; { if (!_isRemoved && (_x isEqualTo [_magazineType,_ammoCount])) then { _isRemoved = true; } else { - (backpackContainer _player) addMagazineAmmoCargo [_x select 0, 1, _x select 1]; + (backpackContainer _unit) addMagazineAmmoCargo [_x select 0, 1, _x select 1]; }; - } forEach _magazines; + false + } count _magazines; }; diff --git a/addons/common/functions/fnc_removeSyncedEventHandler.sqf b/addons/common/functions/fnc_removeSyncedEventHandler.sqf index 84aa98c0ea..ffc4a364f3 100644 --- a/addons/common/functions/fnc_removeSyncedEventHandler.sqf +++ b/addons/common/functions/fnc_removeSyncedEventHandler.sqf @@ -1,27 +1,28 @@ /* * Author: jaynus - * * Remove a synced event handler * - * Argument: - * 0: Name (String) - * - * Return value: + * Arguments: + * 0: Name + * + * Return Value: * Boolean of success + * + * Public: No */ #include "script_component.hpp" -PARAMS_1(_name); - -private ["_data", "_eventId"]; +params ["_name"]; if (!HASH_HASKEY(GVAR(syncedEvents),_name)) exitWith { - diag_log text format["[ACE] Error, synced event key not found."]; + ACE_LOGERROR("Synced event key not found."); false }; +private ["_data", "_eventId"]; + _data = HASH_GET(GVAR(syncedEvents),_name); _eventId = _data select 3; -[_eventId] call ace_common_fnc_removeEventHandler; -HASH_REM(GVAR(syncedEvents),_name); \ No newline at end of file +[_eventId] call FUNC(removeEventHandler); +HASH_REM(GVAR(syncedEvents),_name); diff --git a/addons/common/functions/fnc_requestCallback.sqf b/addons/common/functions/fnc_requestCallback.sqf index 827519b99c..399f50466d 100644 --- a/addons/common/functions/fnc_requestCallback.sqf +++ b/addons/common/functions/fnc_requestCallback.sqf @@ -1,22 +1,19 @@ -/** - * fn_requestCallback.sqf - * @Descr: N/A - * @Author: Glowbal +/* + * Author: Glowbal + * N/A * - * @Arguments: [] - * @Return: - * @PublicAPI: false + * Arguments: + * ? + * + * Return Value: + * ? + * + * Public: No */ - #include "script_component.hpp" -private ["_caller", "_target", "_requestID", "_requestMessage", "_callBack"]; -PARAMS_2(_info,_accepted); +params ["_info", "_accepted"]; -_caller = _info select 0; -_target = _info select 1; -_requestID = _info select 2; -_requestMessage = _info select 3; -_callBack = _info select 4; +_info params ["_caller", "_target", "_requestID", "_requestMessage", "_callBack"]; -[_caller, _target, _accepted] call compile _callBack; \ No newline at end of file +[_caller, _target, _accepted] call compile _callBack; diff --git a/addons/common/functions/fnc_requestSyncedEvent.sqf b/addons/common/functions/fnc_requestSyncedEvent.sqf index dea0c7adef..7cbc8f6c8d 100644 --- a/addons/common/functions/fnc_requestSyncedEvent.sqf +++ b/addons/common/functions/fnc_requestSyncedEvent.sqf @@ -1,19 +1,20 @@ /* * Author: jaynus - * * Send a request to synchronize an event name from the client->server. Execute on client only. * - * Argument: - * 0: eventName (String) + * Arguments: + * 0: eventName * - * Return value: + * Return Value: * Boolean of success + * + * Public: No */ -//#define DEBUG_MODE_FULL #include "script_component.hpp" -PARAMS_1(_eventName); + +params ["_eventName"]; // Only JIP machines on initialization send this off, requesting sync on events with the serverCommand -if(isServer) exitWith { false }; +if (isServer) exitWith {false}; -["SEH_s", [_eventName, ACE_player] ] call ace_common_fnc_serverEvent; \ No newline at end of file +["SEH_s", [_eventName, ACE_player] ] call FUNC(serverEvent); diff --git a/addons/common/functions/fnc_resetAllDefaults.sqf b/addons/common/functions/fnc_resetAllDefaults.sqf index 3040334ad0..c2ba1bee18 100644 --- a/addons/common/functions/fnc_resetAllDefaults.sqf +++ b/addons/common/functions/fnc_resetAllDefaults.sqf @@ -1,39 +1,44 @@ -/** - * fn_resetAllDefaults_f.sqf - * @Descr: reset all variables that have been defined - * @Author: Glowbal +/* + * Author: Glowbal + * reset all variables that have been defined * - * @Arguments: [] - * @Return: - * @PublicAPI: false + * Arguments: + * ? + * + * Return Value: + * ? + * + * Public: No */ - #include "script_component.hpp" -PARAMS_1(_unit); +params ["_unit"]; -_unit setvariable ["ACE_isDead",nil,true]; +_unit setvariable ["ACE_isDead", nil, true]; _unit setvariable ["ACE_isUnconscious", nil, true]; if (isPlayer _unit) then { [true] call FUNC(setVolume); - [false] call FUNC(disableKeyInput); - if (["ace_medical"] call FUNC(isModLoader)) then { - [false] call EFUNC(medical,effectBlackOut); + // [false] call FUNC(disableKeyInput); //func does not exist + + if (["ace_medical"] call FUNC(isModLoaded)) then { + // [false] call EFUNC(medical,effectBlackOut); //func does not exist }; - if !(isnil QGVAR(DISABLE_USER_INPUT_COLLECTION)) then { + if !(isNil QGVAR(DISABLE_USER_INPUT_COLLECTION)) then { // clear all disable user input { [_x, false] call FUNC(setDisableUserInputStatus); - }foreach GVAR(DISABLE_USER_INPUT_COLLECTION); + false + } count GVAR(DISABLE_USER_INPUT_COLLECTION); }; }; { - if (!(_x select 4)) then { - _unit setvariable [(_x select 0),nil,_x select 3]; + if !(_x select 4) then { + _unit setvariable [_x select 0, nil, _x select 3]; }; -} forEach ([_unit] call FUNC(getAllDefinedSetVariables)); + false +} count ([_unit] call FUNC(getAllDefinedSetVariables)); _unit setVariable ["ACE_forceWalkStatusNumber", 0, true]; diff --git a/addons/common/functions/fnc_restoreVariablesJIP.sqf b/addons/common/functions/fnc_restoreVariablesJIP.sqf index 9ca911d79c..491ce89bb4 100644 --- a/addons/common/functions/fnc_restoreVariablesJIP.sqf +++ b/addons/common/functions/fnc_restoreVariablesJIP.sqf @@ -1,20 +1,20 @@ /* * Author: commy2 - * * Called from respawn eventhandler. Resets all public object namespace variables that are added via FUNC(setVariableJIP). * - * Argument: - * 0: Object (Object) + * Arguments: + * 0: Object * - * Return value: - * Nothing. + * Return Value: + * None + * + * Public: No */ #include "script_component.hpp" +params ["_unit"]; + private "_respawnVariables"; - -PARAMS_1(_unit); - _respawnVariables = _unit getVariable ["ACE_respawnVariables", []]; // yes those @@ -22,4 +22,6 @@ _respawnVariables pushBack "ACE_PersistentFunctions"; { _unit setVariable [_x, _unit getVariable _x, true]; -} forEach _respawnVariables; + false +} count _respawnVariables; +nil diff --git a/addons/common/functions/fnc_revertKeyCodeLocalized.sqf b/addons/common/functions/fnc_revertKeyCodeLocalized.sqf deleted file mode 100644 index 75168d4e84..0000000000 --- a/addons/common/functions/fnc_revertKeyCodeLocalized.sqf +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Author: commy2 - * - * Revert a key code to a readible text. - * - * Argument: - * 0: Key code (Number) - * - * Return value: - * What input will result in the given key code? (String) - */ -#include "script_component.hpp" - -private ["_key", "_alt", "_ctrl", "_shift"]; - -PARAMS_1(_keyCode); - -_key = toString ((toArray keyName floor _keyCode) - [34]); - -_keyCode = round ((_keyCode % 1) * 10); - -switch (_keyCode) do { - case 8 : {format [localize QUOTE(DOUBLES(STR,GVAR(DoubleTapKey))), _key]}; - case 9 : {format [localize QUOTE(DOUBLES(STR,GVAR(HoldKey))), _key]}; - default { - _keyCode = toArray ([_keyCode, 3] call FUNC(toBin)); - - _alt = "1" == toString [_keyCode select 0]; - _ctrl = "1" == toString [_keyCode select 1]; - _shift = "1" == toString [_keyCode select 2]; - - format ["%1%2%3%4", - ["", format ["%1 + ", localize QUOTE(DOUBLES(STR,GVAR(Alt)))]] select _alt, - ["", format ["%1 + ", localize QUOTE(DOUBLES(STR,GVAR(Ctrl)))]] select _ctrl, - ["", format ["%1 + ", localize QUOTE(DOUBLES(STR,GVAR(Shift)))]] select _shift, - _key - ] - }; -}; diff --git a/addons/common/functions/fnc_runAfterSettingsInit.sqf b/addons/common/functions/fnc_runAfterSettingsInit.sqf new file mode 100644 index 0000000000..cf3faa1d7e --- /dev/null +++ b/addons/common/functions/fnc_runAfterSettingsInit.sqf @@ -0,0 +1,27 @@ +/* + * Author: PabstMirror + * Executes code after setting are initilized. + * + * Argument: + * 0: Code to execute + * 1: Parameters to run the code with + * + * Return value: + * None + * + * Example: + * [{if (GVAR(setting) then {x} else {y};}, []] call ace_common_fnc_runAfterSettingsInit + * + * Public: No + */ +#include "script_component.hpp" + +params ["_func", "_params"]; + +if (GVAR(settingsInitFinished)) then { + //Setting Already Finished, Direct Run the code + _params call _func; +} else { + //Waiting on settings, throw it on the delayed run array + GVAR(runAtSettingsInitialized) pushBack [_func, _params]; +}; diff --git a/addons/common/functions/fnc_sanitizeString.sqf b/addons/common/functions/fnc_sanitizeString.sqf index 2bc170872d..fff3288db6 100644 --- a/addons/common/functions/fnc_sanitizeString.sqf +++ b/addons/common/functions/fnc_sanitizeString.sqf @@ -1,42 +1,51 @@ /* * Author: esteldunedain, based on Killzone-Kid code - * * Removes quotation marks to avoid exploits and optionally html tags from text to avoid conflicts with structured text. * * Arguments: - * 0: Source string (String) - * 1: Remove html tags (Bool, optional) + * 0: Source string + * 1: Remove html tags (default: false) * * Return Value: * Sanitized string + * + * Public: Yes */ #include "script_component.hpp" -private ["_array", "_arrayNew"]; +params ["_string", ["_removeTags", false]]; -PARAMS_2(_string,_removeTags); +private "_array"; +_array = []; -if (isNil "_removeTags") then {_removeTags = false}; - -_array = toArray _string; - -_arrayNew = []; { switch _x do { case 60 : { - _arrayNew = if (_removeTags) then {_arrayNew + toArray "<";} else {_arrayNew + [_x];}; + if (_removeTags) then { + _array append toArray "<"; + } else { + _array pushBack _x; + }; }; case 62 : { - _arrayNew = if (_removeTags) then {_arrayNew + toArray ">";} else {_arrayNew + [_x];}; + if (_removeTags) then { + _array append toArray ">"; + } else { + _array pushBack _x; + }; }; + case 34 : { }; + case 39 : { }; + default { - _arrayNew = _arrayNew + [_x]; + _array pushBack _x; }; }; -} forEach _array; + false +} count toArray _string; -toString _arrayNew +toString _array // return diff --git a/addons/common/functions/fnc_selectWeaponMode.sqf b/addons/common/functions/fnc_selectWeaponMode.sqf new file mode 100644 index 0000000000..f255c63e98 --- /dev/null +++ b/addons/common/functions/fnc_selectWeaponMode.sqf @@ -0,0 +1,31 @@ +/* + * Author: commy2 + * Unit selects given muzzle and weapon mode. + * + * Arguments: + * 0: unit + * 1: weapon or Muzzle + * 2: weapon Mode + * + * Return Value: + * Successful? + * + * Example: + * [player, primaryWeapon player, "FullAuto"] call ace_common_fnc_selectWeaponMode + * + * Public: Yes + */ +#include "script_component.hpp" + +params ["_unit", "_muzzle", "_mode"]; + +local _index = 0; + +while { + _index < 100 && {currentMuzzle _unit != _muzzle || {currentWeaponMode _unit != _mode}} +} do { + _unit action ["SwitchWeapon", _unit, _unit, _index]; + _index = _index + 1; +}; + +_index < 100 // return diff --git a/addons/common/functions/fnc_sendDisplayInformationTo.sqf b/addons/common/functions/fnc_sendDisplayInformationTo.sqf index 1ff209dac6..aa3dba2365 100644 --- a/addons/common/functions/fnc_sendDisplayInformationTo.sqf +++ b/addons/common/functions/fnc_sendDisplayInformationTo.sqf @@ -1,47 +1,53 @@ -/** - * fn_sendDisplayInformationTo.sqf - * @Descr: Sends a display information hint to a receiver - * @Author: Glowbal +/* + * Author: Glowbal + * Sends a display information hint to a receiver * - * @Arguments: [receiver OBJECT, title STRING, content ARRAY (An array with strings), type NUMBER (Optional)] - * @Return: void - * @PublicAPI: true + * Arguments: + * 0: receiver + * 1: title + * 2: content + * 3: type (optional) + * + * Return Value: + * None + * + * Public: Yes */ - #include "script_component.hpp" -private ["_reciever","_title","_content","_type", "_parameters", "_localizationArray"]; -_reciever = [_this, 0, ObjNull,[ObjNull]] call BIS_fnc_Param; -_title = [_this, 1, "",[""]] call BIS_fnc_Param; -_content = [_this, 2, [""],[[""]]] call BIS_fnc_Param; -_type = [_this, 3, 0,[0]] call BIS_fnc_Param; -_parameters = [_this, 4, [], [[]]] call BIS_fnc_Param; +params [["_reciever", objNull], ["_title", ""], ["_content", ""], ["_type", 0], ["_parameters", []]]; if (isPlayer _reciever) then { if (!local _reciever) then { - [_this, QUOTE(FUNC(sendDisplayInformationTo)), _reciever, false] call EFUNC(common,execRemoteFnc); + [_this, QFUNC(sendDisplayInformationTo), _reciever, false] call FUNC(execRemoteFnc); } else { if (isLocalized _title) then { _title = localize _title; }; + + private "_localizationArray"; _localizationArray = [_title]; + { _localizationArray pushback _x; - } forEach _parameters; + false + } count _parameters; + _title = format _localizationArray; { if (isLocalized _x) then { _localizationArray = [localize _x]; + { - _localizationArray pushback _x; - } forEach _parameters; + _localizationArray pushBack _x; + false + } count _parameters; - _content set [_foreachIndex, format _localizationArray]; + _content set [_forEachIndex, format _localizationArray]; }; + } forEach _content; - }foreach _content; - - [_title,_content,_type] call EFUNC(common,displayInformation); + [_title, _content, _type] call FUNC(displayInformation); }; -}; \ No newline at end of file +}; diff --git a/addons/common/functions/fnc_sendDisplayMessageTo.sqf b/addons/common/functions/fnc_sendDisplayMessageTo.sqf index e042f69939..6f16ec8006 100644 --- a/addons/common/functions/fnc_sendDisplayMessageTo.sqf +++ b/addons/common/functions/fnc_sendDisplayMessageTo.sqf @@ -1,46 +1,53 @@ -/** - * fn_sendDisplayMessageTo.sqf - * @Descr: Displays a message on locality of receiver - * @Author: Glowbal +/* + * Author: Glowbal + * Displays a message on locality of receiver * - * @Arguments: [receiver OBJECT, title STRING, content STRING, type NUMBER (Optional)] - * @Return: void - * @PublicAPI: true + * Arguments: + * 0: receiver + * 1: title + * 2: content + * 3: type (optional) + * + * Return Value: + * None + * + * Public: Yes */ - #include "script_component.hpp" -private ["_reciever","_title","_content","_type", "_parameters", "_localizationArray"]; -_reciever = [_this, 0, ObjNull,[ObjNull]] call BIS_fnc_Param; -_title = [_this, 1, "",[""]] call BIS_fnc_Param; -_content = [_this, 2, "",[""]] call BIS_fnc_Param; -_type = [_this, 3, 0,[0]] call BIS_fnc_Param; -_parameters = [_this, 4, [], [[]]] call BIS_fnc_Param; +params [["_reciever", objNull], ["_title", ""], ["_content", ""], ["_type", 0], ["_parameters", []]]; if (isPlayer _reciever) then { if (!local _reciever) then { - [_this, QUOTE(FUNC(sendDisplayMessageTo)), _reciever, false] call EFUNC(common,execRemoteFnc); + [_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; - }foreach _parameters; + _localizationArray pushBack _x; + false + } count _parameters; + _title = format _localizationArray; _localizationArray = [_content]; + { - _localizationArray pushback _x; - }foreach _parameters; + _localizationArray pushBack _x; + false + } count _parameters; + _content = format _localizationArray; - [_title,_content,_type] call EFUNC(common,displayMessage); + [_title, _content, _type] call FUNC(displayMessage); }; -}; \ No newline at end of file +}; diff --git a/addons/common/functions/fnc_sendRequest.sqf b/addons/common/functions/fnc_sendRequest.sqf index 68b42ce302..c8d2ef7e2b 100644 --- a/addons/common/functions/fnc_sendRequest.sqf +++ b/addons/common/functions/fnc_sendRequest.sqf @@ -1,20 +1,26 @@ -/** - * fn_sendRequest_f.sqf - * @Descr: Send a request to an unit and execute code based upon results. - * @Author: Glowbal +/* + * Author: Glowbal + * Send a request to an unit and execute code based upon results. * - * @Arguments: [caller OBJECT, target OBJECT, requestID STRING, requestMessage STRING (Will be localized for other target object), callback CODE (Code called upon accept or decline.)] - * @Return: void - * @PublicAPI: true + * Arguments: + * 0: caller + * 1: target + * 2: requestID (STRING) + * 3: requestMessage Will be localized for other target object. (STRING) + * 4: callback Code called upon accept or decline. (CODE) + * + * Return Value: + * None + * + * Public: Yes */ - #include "script_component.hpp" -PARAMS_5(_caller,_target,_requestID,_requestMessage,_callBack); +params ["_caller", "_target", "_requestID", "_requestMessage", "_callBack"]; if (isPlayer _target) then { // Pass request on to target locality for player accept/decline. - [[_caller, _target, _requestID, _requestMessage, _callBack], QUOTE(FUNC(receiveRequest)), _target, false] call EFUNC(common,execRemoteFnc); + [[_caller, _target, _requestID, _requestMessage, _callBack], QFUNC(receiveRequest), _target, false] call FUNC(execRemoteFnc); } else { // accept it, since it's an AI. [_caller, _target, true] call compile _callBack; diff --git a/addons/common/functions/fnc_serverEvent.sqf b/addons/common/functions/fnc_serverEvent.sqf index 9227b1a783..65ab0da2a7 100644 --- a/addons/common/functions/fnc_serverEvent.sqf +++ b/addons/common/functions/fnc_serverEvent.sqf @@ -1,26 +1,27 @@ /* * Author: Nou - * * Execute a event only on the server. * * Argument: - * 0: Event name (string) - * 1: Event args (any) + * 0: Event name + * 1: Event args * - * Return value: - * Nothing + * Return Value: + * None + * + * Public: Yes */ #include "script_component.hpp" -//IGNORE_PRIVATE_WARNING("_handleNetEvent"); -PARAMS_2(_eventName,_eventArgs); +params ["_eventName", "_eventArgs"]; - #ifdef DEBUG_EVENTS - diag_log text format[ARR_2("* Server Event: %1",_eventName)]; - diag_log text format[ARR_2(" args=%1",_eventArgs)]; - #endif +#ifdef DEBUG_EVENTS + ACE_LOGINFO_1("* Server Event: %1",_eventName); + ACE_LOGINFO_1(" args=%1",_eventArgs); +#endif ACEg = [_eventName, _eventArgs]; + if (!isServer) then { publicVariableServer "ACEg"; } else { diff --git a/addons/common/functions/fnc_serverLog.sqf b/addons/common/functions/fnc_serverLog.sqf index 76560e45a3..45ab03891c 100644 --- a/addons/common/functions/fnc_serverLog.sqf +++ b/addons/common/functions/fnc_serverLog.sqf @@ -1,8 +1,19 @@ -// by esteldunedain +/* + * Author: esteldunedain + * ? + * + * Arguments: + * ? + * + * Return Value: + * None + * + * Public: no + */ #include "script_component.hpp" if (isServer) then { diag_log _this; } else { - [_this, QUOTE(FUNC(serverLog)), 1] call FUNC(execRemoteFnc); + [_this, QFUNC(serverLog), 1] call FUNC(execRemoteFnc); }; diff --git a/addons/common/functions/fnc_setAllGear.sqf b/addons/common/functions/fnc_setAllGear.sqf new file mode 100644 index 0000000000..e25045a685 --- /dev/null +++ b/addons/common/functions/fnc_setAllGear.sqf @@ -0,0 +1,172 @@ +/* + * Author: bux578, commy2 + * Applies gear to unit. + * + * Arguments: + * 0: Unit + * 1: All Gear based on return value of ACE_common_fnc_getAllGear + * 2: Remove all attachments from weapons? (default: false) + * 3: Remove all items from prefilled backpacks? (default: false) + * + * Return Value: + * None + * + * Example: + * [player, gear_array, true, true] call ace_common_fnc_setAllGear + * + * Public: Yes + */ +#include "script_component.hpp" + +params ["_unit", "_allGear", ["_clearAttachments", false], ["_clearBackpack", false]]; + +// remove all starting gear of a player +removeAllWeapons _unit; +removeGoggles _unit; +removeHeadgear _unit; +removeVest _unit; +removeUniform _unit; +removeAllAssignedItems _unit; +removeBackpack _unit; + +_allGear params [ + "_headgear", "_goggles", + "_uniform", "_uniformitems", + "_vest", "_vestitems", + "_backpack", "_backpackitems", + "_primaryweapon", "_primaryweaponitems", "_primaryweaponmagazine", + "_secondaryweapon", "_secondaryweaponitems", "_secondaryweaponmagazine", + "_handgunweapon", "_handgunweaponitems", "_handgunweaponmagazine", + "_assigneditems", + "_binocular", + "_binocularmagazine" +]; + +// start restoring the items +if (_headgear != "") then {_unit addHeadgear _headgear}; +if (_goggles != "") then {_unit addGoggles _goggles}; + +// ensure all weapons being loaded +_unit addBackpack "ACE_FakeBackpack"; + +// primaryWeapon +if (_primaryweapon != "") then { + { + _unit addMagazine _x; + false + } count _primaryweaponmagazine; + + _unit addWeapon _primaryweapon; + + if (_clearAttachments) then { + removeAllPrimaryWeaponItems _unit; + }; + + { + if (_x != "") then { + _unit addPrimaryWeaponItem _x; + }; + false + } count _primaryweaponitems; +}; + +// secondaryWeapon +if (_secondaryweapon != "") then { + { + _unit addMagazine _x; + false + } count _secondaryweaponmagazine; + + _unit addWeapon _secondaryweapon; + + if (_clearAttachments) then { + //removeAllSecondaryWeaponItems _unit; + { + _unit removeSecondaryWeaponItem _x; + false + } count secondaryWeaponItems _unit; + }; + + { + if (_x != "") then { + _unit addSecondaryWeaponItem _x; + }; + false + } count _secondaryweaponitems; +}; + +// handgun +if (_handgunweapon != "") then { + { + _unit addMagazine _x; + false + } count _handgunweaponmagazine; + + _unit addWeapon _handgunweapon; + + if (_clearAttachments) then { + removeAllHandgunItems _unit; + }; + + { + if (_x != "") then { + _unit addHandgunItem _x; + }; + false + } count _handgunweaponitems; +}; + +// binocular +_unit addWeapon _binocular; +_unit addMagazine _binocularmagazine; + +// done with dummy backpack. now remove +removeBackpack _unit; + +// uniform +if (_uniform != "") then { + _unit forceAddUniform _uniform; +}; + +{ + _unit addItemToUniform _x; + false +} count _uniformitems; + +// vest +if (_vest != "") then { + _unit addVest _vest; +}; + +{ + _unit addItemToVest _x; + false +} count _vestitems; + +// backpack +if (_backpack != "") then { + _unit addBackpack _backpack; + + if (_clearBackpack) then { + local _backpackObject = unitBackpack _unit; + + clearMagazineCargoGlobal _backpackObject; + clearWeaponCargoGlobal _backpackObject; + clearItemCargoGlobal _backpackObject; + }; + + { + _unit addItemToBackpack _x; + false + } count _backpackitems; +}; + +// assigned items +_assignedItems deleteAt (_assignedItems find _binocular); + +{ + _unit linkItem _x; + false +} count _assignedItems; + +nil diff --git a/addons/common/functions/fnc_setArrestState.sqf b/addons/common/functions/fnc_setArrestState.sqf deleted file mode 100644 index 7b4f3cd995..0000000000 --- a/addons/common/functions/fnc_setArrestState.sqf +++ /dev/null @@ -1,44 +0,0 @@ -/** - * fn_setArrestState.sqf - * @Descr: Set a unit in arrest state - * @Author: Glowbal - * - * @Arguments: [unitToBeArrested OBJECT, setArrested BOOL] - * @Return: void - * @PublicAPI: true - */ - -#include "script_component.hpp" - -private ["_unit","_setArrest"]; -_unit = [_this, 0, objNull, [objNull]] call BIS_fnc_Param; -_setArrest = [_this, 1, false, [false]] call BIS_fnc_Param; - -if (_setArrest) then { - [_unit, QGVAR(StateArrested), true] call FUNC(setDefinedVariable); - - if ([_unit] call FUNC(isAwake)) then { - if (vehicle _unit == _unit) then { - [_unit,"UnaErcPoslechVelitele2",1] call FUNC(doAnimation); - }; - }; - if (IsPlayer _unit) then { - [["arrested", true],QUOTE(FUNC(setDisableUserInputStatus)),_unit,false] call EFUNC(common,execRemoteFnc); - }; - _unit disableAI "Move"; - _unit disableAI "ANIM"; -} else { - [_unit, QGVAR(StateArrested), false] call FUNC(setDefinedVariable); - - if ([_unit] call FUNC(isAwake)) then { - if (vehicle _unit == _unit) then { - [_unit,"",1] call FUNC(doAnimation); - }; - _unit enableAI "Move"; - _unit enableAI "ANIM"; - }; - if (IsPlayer _unit) then { - [["arrested", false],QUOTE(FUNC(setDisableUserInputStatus)),_unit,false] call EFUNC(common,execRemoteFnc); - }; -}; - diff --git a/addons/common/functions/fnc_setCanInteract.sqf b/addons/common/functions/fnc_setCanInteract.sqf deleted file mode 100644 index ae05d3cd5b..0000000000 --- a/addons/common/functions/fnc_setCanInteract.sqf +++ /dev/null @@ -1,30 +0,0 @@ -/** - * fn_setCanInteract.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - -#include "script_component.hpp" - -private ["_unit","_to","_return"]; - -_unit = [_this, 0, objNull, [objNull]] call BIS_fnc_param; -_to = _this select 1; -_return = false; - -if (((typeName _to) == "SCALAR")) then { - if (_to <-1) then { - _to = -1; - } else { - if (_to > 1) then { - _to = 1; - }; - }; - _unit setvariable [QGVAR(canInteract), ([_unit] call FUNC(getCanInteract)) + _to,false]; - _return = true; -}; -_return \ No newline at end of file diff --git a/addons/common/functions/fnc_setCaptivityStatus.sqf b/addons/common/functions/fnc_setCaptivityStatus.sqf index f579b5cfbc..ecb7b3152a 100644 --- a/addons/common/functions/fnc_setCaptivityStatus.sqf +++ b/addons/common/functions/fnc_setCaptivityStatus.sqf @@ -1,21 +1,22 @@ /* * Author: commy2 - * * Set the captivity status of an unit. This allows the handling of more than one reason to set a unit captive. * - * Argument: - * 0: Unit (Object) - * 1: The reason of the captivity (String) - * 2: Is the reason still valid? True for setting this reason, false for removing it (Bool) + * Arguments: + * 0: Unit + * 1: The reason of the captivity + * 2: Is the reason still valid? True for setting this reason, false for removing it * - * Return value: - * None. + * Return Value: + * None + * + * Public: No */ #include "script_component.hpp" -private ["_captivityReasons", "_unitCaptivityReasons", "_captivityReasonsBooleans", "_bitmask"]; +params ["_unit", "_reason", "_status"]; -PARAMS_3(_unit,_reason,_status); +private ["_captivityReasons", "_unitCaptivityReasons", "_captivityReasonsBooleans", "_bitmask"]; _captivityReasons = missionNamespace getVariable ["ACE_captivityReasons", []]; diff --git a/addons/common/functions/fnc_setDefinedVariable.sqf b/addons/common/functions/fnc_setDefinedVariable.sqf index ea8a326f21..480632394c 100644 --- a/addons/common/functions/fnc_setDefinedVariable.sqf +++ b/addons/common/functions/fnc_setDefinedVariable.sqf @@ -1,31 +1,30 @@ -/** - * fn_setVariable.sqf - * @Descr: Setvariable value - * @Author: Glowbal +/* + * Author: Glowbal + * Setvariable value * - * @Arguments: [unit OBJECT, variableName STRING, value ANY] - * @Return: void - * @PublicAPI: true + * Arguments: + * 0: Unit + * 1: variableName + * 2: value + * + * Return Value: + * None + * + * Public: Yes */ - #include "script_component.hpp" -private ["_global","_definedVariable"]; +params ["_unit", "_variable", "_value", "_global"]; -PARAMS_3(_unit,_variable,_value); +if (isNil "_global") then { + private "_definedVariable"; + _definedVariable = [_variable] call FUNC(getDefinedVariableInfo); -_global = false; - -if (count _this > 3) then { - _global = _this select 3; -} else { - _definedVariable = ([_variable] call FUNC(getDefinedVariableInfo)); - if (count _definedVariable > 2) then { - _global = _definedVariable select 2; - }; + _definedVariable params ["", "", ["_global", false]]; }; if (!isNil "_value") exitwith { - _unit setvariable [_variable, _value, _global]; + _unit setVariable [_variable, _value, _global]; }; -_unit setvariable [_variable, nil, _global]; \ No newline at end of file + +_unit setVariable [_variable, nil, _global]; diff --git a/addons/common/functions/fnc_setDisableUserInputStatus.sqf b/addons/common/functions/fnc_setDisableUserInputStatus.sqf index 8836f4cd0d..ec475f744f 100644 --- a/addons/common/functions/fnc_setDisableUserInputStatus.sqf +++ b/addons/common/functions/fnc_setDisableUserInputStatus.sqf @@ -1,26 +1,30 @@ -/** - * fn_setDisableUserInputStatus.sqf - * @Descr: Disables the user input. Works stacked. - * @Author: Glowbal +/* + * Author: Glowbal + * Disables the user input. Works stacked. * - * @Arguments: [id STRING, disable BOOL] - * @Return: void - * @PublicAPI: true + * Arguments: + * 0: id + * 1: disable + * + * Return Value: + * None + * + * Public: Yes */ #include "script_component.hpp" -PARAMS_2(_id,_disable); +params ["_id", "_disable"]; -if (isnil QGVAR(DISABLE_USER_INPUT_COLLECTION)) then { +if (isNil QGVAR(DISABLE_USER_INPUT_COLLECTION)) then { GVAR(DISABLE_USER_INPUT_COLLECTION) = []; }; if (_disable) then { - GVAR(DISABLE_USER_INPUT_COLLECTION) pushback _id; + GVAR(DISABLE_USER_INPUT_COLLECTION) pushBack _id; [true] call FUNC(disableUserInput); } else { GVAR(DISABLE_USER_INPUT_COLLECTION) = GVAR(DISABLE_USER_INPUT_COLLECTION) - [_id]; if (GVAR(DISABLE_USER_INPUT_COLLECTION) isEqualTo []) then { [false] call FUNC(disableUserInput); }; -}; \ No newline at end of file +}; diff --git a/addons/common/functions/fnc_setForceWalkStatus.sqf b/addons/common/functions/fnc_setForceWalkStatus.sqf index 9935f4ad21..aaa594b9a9 100644 --- a/addons/common/functions/fnc_setForceWalkStatus.sqf +++ b/addons/common/functions/fnc_setForceWalkStatus.sqf @@ -1,36 +1,34 @@ /* -Name: FUNC(setForceWalkStatus) - -Author: Pabst Mirror (from captivity by commy2) - -Description: - Sets the forceWalk status of an unit. This allows the handling of more than one reason to set forceWalk. - Unit will force walk until all reasons are removed. - -Parameters: - 0: OBJECT - Unit - 1: STRING - Reason for forcing walking - 2: BOOL - Is the reason still valid. True to force walk, false to remove restriction. - -Returns: - None - -Example: - [ACE_Player, "BrokenLeg", true] call FUNC(setForceWalkStatus) + * Author: Pabst Mirror (from captivity by commy2) + * Sets the forceWalk status of an unit. This allows the handling of more than one reason to set forceWalk. + * Unit will force walk until all reasons are removed. + * + * Arguments: + * 0: Unit + * 1: Reason for forcing walking + * 2: Is the reason still valid. True to force walk, false to remove restriction. + * + * Returns: + * None + * + * Example: + * [ACE_Player, "BrokenLeg", true] call FUNC(setForceWalkStatus) + * + * Public: No */ #include "script_component.hpp" -private ["_forceWalkReasons", "_unitForceWalkReasons", "_forceWalkReasonsBooleans", "_bitmaskNumber"]; +params ["_unit", "_reason", "_status"]; -PARAMS_3(_unit,_reason,_status); +private ["_forceWalkReasons", "_unitForceWalkReasons", "_forceWalkReasonsBooleans", "_bitmaskNumber"]; _forceWalkReasons = missionNamespace getVariable ["ACE_forceWalkReasons", []]; // register new reason (these reasons are shared publicly, since units can change ownership, but keep their forceWalk status) if !(_reason in _forceWalkReasons) then { - _forceWalkReasons pushBack _reason; - ACE_forceWalkReasons = _forceWalkReasons; - publicVariable "ACE_forceWalkReasons"; + _forceWalkReasons pushBack _reason; + ACE_forceWalkReasons = _forceWalkReasons; + publicVariable "ACE_forceWalkReasons"; }; // get reasons why the unit is forceWalking already and update to the new status @@ -38,7 +36,7 @@ _unitForceWalkReasons = [_unit] call FUNC(getForceWalkStatus); _forceWalkReasonsBooleans = []; { - _forceWalkReasonsBooleans set [_forEachIndex, (_forceWalkReasons select _forEachIndex) in _unitForceWalkReasons]; + _forceWalkReasonsBooleans set [_forEachIndex, (_forceWalkReasons select _forEachIndex) in _unitForceWalkReasons]; } forEach _forceWalkReasons; _forceWalkReasonsBooleans set [_forceWalkReasons find _reason, _status]; @@ -48,4 +46,4 @@ _bitmaskNumber = _forceWalkReasonsBooleans call FUNC(toBitmask); _unit setVariable ["ACE_forceWalkStatusNumber", _bitmaskNumber, true]; // actually apply the forceWalk command globaly -[[_unit], QUOTE(FUNC(applyForceWalkStatus)), 2] call FUNC(execRemoteFnc); +[[_unit], QFUNC(applyForceWalkStatus), 2] call FUNC(execRemoteFnc); diff --git a/addons/common/functions/fnc_setHearingCapability.sqf b/addons/common/functions/fnc_setHearingCapability.sqf index 3e2939d29b..d24f8d0d9d 100644 --- a/addons/common/functions/fnc_setHearingCapability.sqf +++ b/addons/common/functions/fnc_setHearingCapability.sqf @@ -1,23 +1,24 @@ -/** - * fn_setHearingCapability.sqf - * @Descr: Handle set volume calls. Will use the lowest available volume setting. - * @Author: Glowbal +/* + * Author: Glowbal + * Handle set volume calls. Will use the lowest available volume setting. * - * @Arguments: [id STRING, settings NUMBER, add BOOL (Optional. True will add, false will remove. Default value is true)] - * @Return: nil - * @PublicAPI: true + * Arguments: + * 0: id + * 1: settings + * 2: add (default: true) + * + * Return Value: + * None + * + * Public: Yes + * + * Note: uses player */ - #include "script_component.hpp" -private ["_add", "_exists", "_map", "_lowestVolume"]; +params ["_id", "_settings", ["_add", true]]; -PARAMS_2(_id,_settings); - -_add = true; -if (count _this > 2) then { - _add = _this select 2; -}; +private ["_map", "_exists", "_lowestVolume"]; _map = missionNamespace getVariable [QGVAR(setHearingCapabilityMap),[]]; @@ -44,7 +45,8 @@ missionNamespace setVariable [QGVAR(setHearingCapabilityMap), _map]; _lowestVolume = 1; { _lowestVolume = (_x select 1) min _lowestVolume; -} forEach _map; + false +} count _map; // in game sounds 0 fadeSound _lowestVolume; diff --git a/addons/common/functions/fnc_setName.sqf b/addons/common/functions/fnc_setName.sqf index 980408fb12..117445b561 100644 --- a/addons/common/functions/fnc_setName.sqf +++ b/addons/common/functions/fnc_setName.sqf @@ -1,25 +1,24 @@ /* * Author: commy2 - * * Sets the name variable of the object. Used to prevent issues with the name command. * - * Argument: - * 0: Object (Object) + * Arguments: + * 0: Object * - * Return value: - * Nothing. + * Return Value: + * None + * + * Public: No */ #include "script_component.hpp" -private ["_name"]; - -PARAMS_1(_unit); +params ["_unit"]; if (isNull _unit || {!alive _unit}) exitWith {}; if (_unit isKindOf "CAManBase") then { _name = [name _unit, true] call FUNC(sanitizeString); - + //if (_name != _unit getVariable ["ACE_Name", ""]) then { _unit setVariable ["ACE_Name", _name, true]; //}; diff --git a/addons/common/functions/fnc_setParameter.sqf b/addons/common/functions/fnc_setParameter.sqf index d7a4573935..dd946f7bc5 100644 --- a/addons/common/functions/fnc_setParameter.sqf +++ b/addons/common/functions/fnc_setParameter.sqf @@ -1,22 +1,25 @@ /* * Author: esteldunedain - * * Sets the value of an ACE_Parameter and makes it public. * * Arguments: - * 0: Parameter name (string) + * 0: Parameter name * 1: Value * * Return Value: * None + * + * Public: Yes + * + * Deprecated */ #include "script_component.hpp" -PARAMS_2(_name,_value); +params ["_name", "_value"]; // Hack to keep backward compatibility for the moment -if ((typeName (missionNamespace getVariable _name)) == "BOOL") then { - if ((typeName _value) == "SCALAR") then { +if (typeName (missionNamespace getVariable _name) == "BOOL") then { + if (typeName _value == "SCALAR") then { _value = _value > 0; }; }; diff --git a/addons/common/functions/fnc_setPitchBankYaw.sqf b/addons/common/functions/fnc_setPitchBankYaw.sqf index f5d13eb6fe..ea7f27a906 100644 --- a/addons/common/functions/fnc_setPitchBankYaw.sqf +++ b/addons/common/functions/fnc_setPitchBankYaw.sqf @@ -1,26 +1,25 @@ /* - * Taken From: - * https://community.bistudio.com/wiki/BIS_fnc_setPitchBank - * Edited By: - * KoffeinFlummi + * Author: Bohemia Interactive edit by KoffeinFlummi + * Sets the value of an ACE_Parameter and makes it public. * * Arguments: - * 0: Unit/Vehicle - * 1: Pitch (degrees) - * 2: Yaw (degrees) - * 3: Bank (degrees) + * 0: Unit/Vehicle + * 1: Pitch + * 2: Yaw + * 3: Bank * * Return Value: * None + * + * Public: Yes */ #include "script_component.hpp" -private ["_object", "_aroundX", "_aroundY", "_aroundZ", "_dirX", "_dirY", "_dirZ", "_upX", "_upY", "_upZ", "_dir", "_up", "_dirXTemp", "_upXTemp"]; +params ["_object", "_aroundX", "_aroundY", "_aroundZ"]; -_object = _this select 0; -_aroundX = _this select 1; -_aroundY = _this select 2; -_aroundZ = (360 - (_this select 3)) - 360; +_aroundZ = - _aroundZ; + +private ["_dirX", "_dirY", "_dirZ", "_upX", "_upY", "_upZ", "_dir", "_up"]; _dirX = 0; _dirY = 1; @@ -28,28 +27,34 @@ _dirZ = 0; _upX = 0; _upY = 0; _upZ = 1; + if (_aroundX != 0) then { - _dirY = cos _aroundX; - _dirZ = sin _aroundX; - _upY = -sin _aroundX; - _upZ = cos _aroundX; -}; -if (_aroundY != 0) then { - _dirX = _dirZ * sin _aroundY; - _dirZ = _dirZ * cos _aroundY; - _upX = _upZ * sin _aroundY; - _upZ = _upZ * cos _aroundY; -}; -if (_aroundZ != 0) then { - _dirXTemp = _dirX; - _dirX = (_dirXTemp* cos _aroundZ) - (_dirY * sin _aroundZ); - _dirY = (_dirY * cos _aroundZ) + (_dirXTemp * sin _aroundZ); - _upXTemp = _upX; - _upX = (_upXTemp * cos _aroundZ) - (_upY * sin _aroundZ); - _upY = (_upY * cos _aroundZ) + (_upXTemp * sin _aroundZ); + _dirY = cos _aroundX; + _dirZ = sin _aroundX; + _upY = -sin _aroundX; + _upZ = cos _aroundX; }; -_dir = [_dirX,_dirY,_dirZ]; -_up = [_upX,_upY,_upZ]; +if (_aroundY != 0) then { + _dirX = _dirZ * sin _aroundY; + _dirZ = _dirZ * cos _aroundY; + _upX = _upZ * sin _aroundY; + _upZ = _upZ * cos _aroundY; +}; + +if (_aroundZ != 0) then { + private ["_dirXTemp", "_upXTemp"]; + + _dirXTemp = _dirX; + _dirX = (_dirXTemp* cos _aroundZ) - (_dirY * sin _aroundZ); + _dirY = (_dirY * cos _aroundZ) + (_dirXTemp * sin _aroundZ); + + _upXTemp = _upX; + _upX = (_upXTemp * cos _aroundZ) - (_upY * sin _aroundZ); + _upY = (_upY * cos _aroundZ) + (_upXTemp * sin _aroundZ); +}; + +_dir = [_dirX, _dirY, _dirZ]; +_up = [_upX, _upY, _upZ]; _object setVectorDirAndUp [_dir,_up]; diff --git a/addons/common/functions/fnc_setProne.sqf b/addons/common/functions/fnc_setProne.sqf index b456c5094a..75be8bac2d 100644 --- a/addons/common/functions/fnc_setProne.sqf +++ b/addons/common/functions/fnc_setProne.sqf @@ -1,28 +1,22 @@ -/** - * fn_setProne.sqf - * @Descr: Force a unit to go prone - * @Author: Glowbal +/* + * Author: Glowbal + * Force a unit to go prone * - * @Arguments: [unit OBJECT] - * @Return: void - * @PublicAPI: true + * Arguments: + * 0: Unit + * + * Return Value: + * None + * + * Public: Yes + * + * Note: Not functional, because FUNC(localAnim) does no longer exist */ - #include "script_component.hpp" -private ["_unit"]; -_unit = [_this,0, ObjNull,[ObjNull]] call BIS_fnc_Param; -switch (currentWeapon _unit) do { - case (primaryWeapon _unit): { - [_unit,"amovppnemstpsraswrfldnon"] call FUNC(localAnim); - }; - case (secondaryWeapon _unit): { - [_unit,"amovppnemstpsraswlnrdnon"] call FUNC(localAnim); - }; - case (handgunWeapon _unit): { - [_unit,"AmovPpneMstpSrasWpstDnon"] call FUNC(localAnim); - }; - default { - [_unit,"amovppnemstpsnonwnondnon"] call FUNC(localAnim); - }; -}; \ No newline at end of file +params ["_unit"]; + +[ + _unit, + ["amovppnemstpsnonwnondnon", "amovppnemstpsraswrfldnon", "amovppnemstpsraswlnrdnon", "amovppnemstpsraswpstdnon"] select (([primaryWeapon _unit, secondaryWeapon _unit, handgunWeapon _unit] find currentWeapon _unit) + 1) +] call FUNC(localAnim); diff --git a/addons/common/functions/fnc_setSetting.sqf b/addons/common/functions/fnc_setSetting.sqf index d50e09fb15..60b64e31d4 100644 --- a/addons/common/functions/fnc_setSetting.sqf +++ b/addons/common/functions/fnc_setSetting.sqf @@ -5,10 +5,10 @@ * If executed on server it can have global effect if the last parameter is set to true. * * Arguments: - * 0: Setting name (String) - * 1: Value (Any) - * 2: Force it? (Bool) (Optional) - * 3: Broadcast the change to all clients (Bool) (Optional) + * 0: Setting name + * 1: Value + * 2: Force it? (default: false) + * 3: Broadcast the change to all clients (default: false) * * Return Value: * None @@ -17,15 +17,9 @@ */ #include "script_component.hpp" -private ["_force", "_settingData","_failed"]; +params ["_name", "_value", ["_force", false], ["_broadcastChanges", false]]; -PARAMS_2(_name,_value); - -private ["_force"]; -_force = false; -if (count _this > 2) then { - _force = _this select 2; -}; +private ["_settingData", "_failed"]; _settingData = [_name] call FUNC(getSettingData); @@ -37,9 +31,9 @@ if (_settingData select 6) exitWith {}; // If the type is not equal, try to cast it _failed = false; -if ((typeName _value) != (_settingData select 1)) then { +if (typeName _value != _settingData select 1) then { _failed = true; - if ((_settingData select 1) == "BOOL" and (typeName _value) == "SCALAR") then { + if (_settingData select 1 == "BOOL" && typeName _value == "SCALAR") then { // If value is not 0 or 1 consider it invalid and don't set anything if (_value isEqualTo 0) then { _value = false; @@ -50,10 +44,11 @@ if ((typeName _value) != (_settingData select 1)) then { _failed = false; }; }; - if ((_settingData select 1) == "COLOR" and (typeName _value) == "ARRAY") then { + if (_settingData select 1 == "COLOR" && typeName _value == "ARRAY") then { _failed = false; }; }; + if (_failed) exitWith {}; // Force it if it was required @@ -66,7 +61,7 @@ if (_value isEqualTo (missionNamespace getVariable _name)) exitWith {}; TRACE_2("Variable Updated",_name,_value); missionNamespace setVariable [_name, _value]; -if (isServer && {count _this > 3} && {_this select 3}) then { +if (isServer && {_broadcastChanges}) then { // Publicize the new value publicVariable _name; diff --git a/addons/common/functions/fnc_setSettingFromConfig.sqf b/addons/common/functions/fnc_setSettingFromConfig.sqf index f45f6736bf..5dc55f51f7 100644 --- a/addons/common/functions/fnc_setSettingFromConfig.sqf +++ b/addons/common/functions/fnc_setSettingFromConfig.sqf @@ -3,7 +3,7 @@ * Load a setting from config if it was not previosuly forced. Force if neccesary. * * Arguments: - * 0: Config entry (config entry) + * 0: Config entry * * Return Value: * None @@ -12,12 +12,12 @@ */ #include "script_component.hpp" -PARAMS_1(_optionEntry); +params ["_optionEntry"]; -private ["_fnc_getValueWithType", "_value","_name", "_typeName", "_settingData", "_valueConfig", "_text"]; +private ["_fnc_getValueWithType", "_value", "_name", "_typeName", "_settingData", "_valueConfig", "_text"]; _fnc_getValueWithType = { - EXPLODE_2_PVT(_this,_optionEntry,_typeName); + params ["_optionEntry", "_typeName"]; _valueConfig = (_optionEntry >> "value"); _value = if (isNumber (_optionEntry >> "value")) then {getNumber (_optionEntry >> "value")} else {0}; @@ -72,12 +72,12 @@ if (isNil _name) then { _name, _typeName, (getNumber (_optionEntry >> "isClientSettable")) > 0, - getText (_optionEntry >> "displayName"), - getText (_optionEntry >> "description"), - getArray (_optionEntry >> "values"), + "", //getText (_optionEntry >> "displayName"), //No need to broadcast, handeled by fnc_loadSettingsLocalizedText + "", //getText (_optionEntry >> "description"), //No need to broadcast, handeled by fnc_loadSettingsLocalizedText + [], //getArray (_optionEntry >> "values"), //No need to broadcast, handeled by fnc_loadSettingsLocalizedText getNumber (_optionEntry >> "force") > 0, _value, - getText (_optionEntry >> "category") + "" //getText (_optionEntry >> "category") //No need to broadcast, handeled by fnc_loadSettingsLocalizedText ]; //Strings in the values array won't be localized from the config, so just do that now: @@ -103,11 +103,8 @@ if (isNil _name) then { // The setting is not forced, so update the value - // Get the type from the existing variable - _typeName = _settingData select 1; - - // Read entry and cast it to the correct type - _value = [_optionEntry, _typeName] call _fnc_getValueWithType; + // Read entry and cast it to the correct type from the existing variable + _value = [_optionEntry, _settingData select 1] call _fnc_getValueWithType; // Update the variable missionNamespace setVariable [_name, _value]; diff --git a/addons/common/functions/fnc_setVariableJIP.sqf b/addons/common/functions/fnc_setVariableJIP.sqf index 8177e97473..d1bd27ea4e 100644 --- a/addons/common/functions/fnc_setVariableJIP.sqf +++ b/addons/common/functions/fnc_setVariableJIP.sqf @@ -1,27 +1,27 @@ /* * Author: commy2 - * * Sets a public object namespace variable that gets reset with the same value after respawn, so JIP clients keep the value. * - * Argument: - * 0: Object (Object) - * 1: Variable name (String) - * 2: Any value (Anything) + * Arguments: + * 0: Object + * 1: Variable name + * 2: Any value * - * Return value: - * Nothing. + * Return Value: + * None + * + * Public: No */ #include "script_component.hpp" -private ["_respawnVariables"]; - -PARAMS_3(_unit,_varName,_value); +params ["_unit", "_varName", "_value"]; +private "_respawnVariables"; _respawnVariables = _unit getVariable ["ACE_respawnVariables", []]; if !(_varName in _respawnVariables) then { - _respawnVariables pushBack _varName; - _unit setVariable ["ACE_respawnVariables", _respawnVariables, true]; + _respawnVariables pushBack _varName; + _unit setVariable ["ACE_respawnVariables", _respawnVariables, true]; }; _unit setVariable [_varName, _value, true]; diff --git a/addons/common/functions/fnc_setVariablePublic.sqf b/addons/common/functions/fnc_setVariablePublic.sqf index f5ab1920db..b6fb58b0f4 100644 --- a/addons/common/functions/fnc_setVariablePublic.sqf +++ b/addons/common/functions/fnc_setVariablePublic.sqf @@ -1,54 +1,59 @@ /* - * Author: commy2 - * + * Author: commy2 and joko // Jonas * Sets a public variable, but wait a certain amount of ACE_time to transfer the value over the network. Changing the value by calling this function again resets the windup timer. * - * Argument: - * 0: Object the variable should be assigned to (Object) - * 1: Name of the variable (String) - * 2: Value of the variable (Any) - * 3: Windup ACE_time (Number, optional. Default: 1) + * Arguments: + * 0: Object the variable should be assigned to + * 1: Name of the variable + * 2: Value of the variable + * 3: Windup ACE_time (default: 1) * - * Return value: - * Nothing. + * Return Value: + * None + * + * Public: No */ #include "script_component.hpp" -PARAMS_4(_object,_varName,_value,_sync); - -if (isNil "_sync") then { - _sync = 1; -}; +params ["_object", "_varName", "_value", ["_sync", 1]]; // set value locally _object setVariable [_varName, _value]; -// "duh" +// Exit if in SP if (!isMultiplayer) exitWith {}; -// generate stacked eventhandler id -private "_idName"; +private ["_idName", "_syncTime"]; + _idName = format ["ACE_setVariablePublic_%1", _varName]; -// exit now if an eh for that variable already exists -private "_allIdNames"; -_allIdNames = [GETMVAR(BIS_stackedEventHandlers_onEachFrame,[]), {_this select 0}] call FUNC(map); +if (_idName in GVAR(setVariableNames)) exitWith {}; -if (_idName in _allIdNames) exitWith {}; - -// when to push the value -private "_syncTime"; _syncTime = ACE_diagTime + _sync; -// add eventhandler -[_idName, "onEachFrame", { - // wait to sync the variable - if (ACE_diagTime > _this select 2) then { - // set value public - (_this select 0) setVariable [_this select 1, (_this select 0) getVariable (_this select 1), true]; +GVAR(setVariableNames) pushBack _idName; - // remove eventhandler - [_this select 3, "onEachFrame"] call BIS_fnc_removeStackedEventHandler +GVAR(setVariablePublicArray) pushBack [_object, _varName, _syncTime, _idName]; + +if (isNil QGVAR(setVariablePublicPFH)) exitWith {}; + +GVAR(setVariablePublicPFH) = [{ + private "_delete"; + _delete = 0; + + { + _x params ["_object", "_varName", "_syncTime", "_idName"]; + if (ACE_diagTime > _syncTime) then { + // set value public + _object setVariable [_varName, _object getVariable _varName, true]; + GVAR(setVariablePublicArray) deleteAt _forEachIndex - _delete; + GVAR(setVariableNames) deleteAt _forEachIndex - _delete; + _delete = _delete + 1; + }; + } forEach GVAR(setVariablePublicArray); + + if (GVAR(setVariablePublicArray) isEqualTo []) then { + [GVAR(setVariablePublicPFH)] call CBA_fnc_removePerFrameHandler; + GVAR(setVariablePublicPFH) = nil; }; -}, [_object, _varName, _syncTime, _idName]] call BIS_fnc_addStackedEventHandler; -nil +}, 0, []] call CBA_fnc_addPerFrameHandler; diff --git a/addons/common/functions/fnc_setVolume.sqf b/addons/common/functions/fnc_setVolume.sqf index 133a09bd24..37e1f04cfa 100644 --- a/addons/common/functions/fnc_setVolume.sqf +++ b/addons/common/functions/fnc_setVolume.sqf @@ -1,21 +1,24 @@ -/** - * fn_setVolume_f.sqf - * @Descr: Sets the volume of the game, including third party radio modifications such as TFAR and ACRE. - * @Author: Glowbal +/* + * Author: Glowbal + * Sets the volume of the game, including third party radio modifications such as TFAR and ACRE. * - * @Arguments: [setVolume BOOL] - * @Return: void - * @PublicAPI: true + * Arguments: + * 0: setVolume (default: false) + * + * Return Value: + * None + * + * Public: Yes + * + * Note: Uses player */ - #include "script_component.hpp" #define MUTED_LEVEL 0.2 #define NORMAL_LEVEL 1 #define NO_SOUND 0 -private ["_setVolume"]; -_setVolume = [_this, 0, false, [false]] call BIS_fnc_Param; +params [["_setVolume", false]]; if (_setVolume) then { // Vanilla Game diff --git a/addons/common/functions/fnc_showUser.sqf b/addons/common/functions/fnc_showUser.sqf index a88d39ce0d..b783fb4ec5 100644 --- a/addons/common/functions/fnc_showUser.sqf +++ b/addons/common/functions/fnc_showUser.sqf @@ -1,8 +1,21 @@ -// by commy2 +/* + * Author: commy2 + * hint the Variable ACE_isUsedBy from the input Object every frame + * + * Argument: + * + * + * Return Value: + * None + * + * Public: No + */ #include "script_component.hpp" -GVAR(Debug_Object) = _this select 0; - -onEachFrame { - hintSilent str (GVAR(Debug_Object) getVariable ["ACE_isUsedBy", objNull]); +if (!isNil QGVAR(showUserPFH)) then { + [GVAR(showUserPFH)] call CBA_fnc_removePerFrameHandler; }; + +GVAR(showUserPFH) = [{ + hintSilent str ((_this select 0) getVariable ["ACE_isUsedBy", objNull]); +}, 0, _this] call CBA_fnc_addPerFrameHandler; diff --git a/addons/common/functions/fnc_sortAlphabeticallyBy.sqf b/addons/common/functions/fnc_sortAlphabeticallyBy.sqf index db142b01b6..287c4566d5 100644 --- a/addons/common/functions/fnc_sortAlphabeticallyBy.sqf +++ b/addons/common/functions/fnc_sortAlphabeticallyBy.sqf @@ -1,18 +1,24 @@ -/** - * fn_sortAlphabeticallyBy.sqf - * @Descr: - * @Author: Glowbal +/* + * Author: Glowbal + * ? * - * @Arguments: [] - * @Return: - * @PublicAPI: true + * Arguments: + * ? + * + * Return Value: + * ? + * + * Public: Yes + * + * Deprecated */ - #include "script_component.hpp" -private ["_elements","_indexes", "_theElement", "_tmp", "_tempIndex", "_j", "_i", "_returnArray"]; +ACE_DEPRECATED("ace_common_fnc_sortAlphabeticallyBy","3.5.0","sort"); -PARAMS_2(_array,_elementN); +params ["_array", "_elementN"]; + +private ["_elements", "_indexes", "_theElement", "_tmp", "_tempIndex", "_returnArray"]; _indexes = []; _elements = []; @@ -37,8 +43,9 @@ for "_i" from 1 to (count _elements) - 1 do { }; _returnArray = []; + { _returnArray pushback (_array select _x); } forEach _indexes; -_returnArray; \ No newline at end of file +_returnArray diff --git a/addons/common/functions/fnc_stringCompare.sqf b/addons/common/functions/fnc_stringCompare.sqf index 2162f71fd0..da65c676f8 100644 --- a/addons/common/functions/fnc_stringCompare.sqf +++ b/addons/common/functions/fnc_stringCompare.sqf @@ -1,35 +1,41 @@ -/** - * fn_stringCompare.sqf - * @Descr: Determines whether one string matches another and how many characters match. Case insensitive. - * @Author: bovine3dom +/* + * Author: bovine3dom + * Determines whether one string matches another and how many characters match. Case insensitive. * - * @Arguments: [stringA STRING, stringB STRING] - * @Return: NUMBER Number of matching characters - * @PublicAPI: true + * Arguments: + * 0: stringA + * 1: stringB + * + * Return Value: + * Number of matching characters >NUMBER> + * + * Public: Yes */ - #include "script_component.hpp" -private ["_searchTerm", "_string", "_arraySearchTerm", "_arrayString", "_sizeSearchTerm", "_sizeString", "_matchingCharacters", "_searchIterator", "_targetIterator"]; -_string = toLower (_this select 0); // removes case sensitivity -_searchTerm = toLower (_this select 1); +params ["_string", "_searchTerm"]; +_string = toLower _string; // removes case sensitivity +_searchTerm = toLower _searchTerm; + +private ["_arraySearchTerm", "_arrayString", "_sizeSearchTerm", "_sizeString", "_matchingCharacters", "_searchIterator", "_targetIterator"]; _arraySearchTerm = toArray _searchTerm; // splits string into array of unicode decimals _arrayString = toArray _string; _sizeSearchTerm = count _arraySearchTerm; // We only measure the array once _sizeString = count _arrayString; - _matchingCharacters = 0; -_targetIterator = 0; _searchIterator = 0; -while {(_searchIterator < _sizeSearchTerm) && (_targetIterator < _sizeString)} do { // Prevents us from going out of bounds - if ((_arraySearchTerm select _searchIterator) == (_arrayString select _targetIterator)) then { // If we have a match, start looking for the next character in the search term +_targetIterator = 0; + +while {_searchIterator < _sizeSearchTerm && _targetIterator < _sizeString} do { // Prevents us from going out of bounds + if (_arraySearchTerm select _searchIterator == _arrayString select _targetIterator) then { // If we have a match, start looking for the next character in the search term _matchingCharacters = _matchingCharacters + 1; _searchIterator = _searchIterator + 1 }; + _targetIterator = _targetIterator + 1; // Look at the next character in the string }; -_matchingCharacters \ No newline at end of file +_matchingCharacters diff --git a/addons/common/functions/fnc_stringRemoveWhiteSpace.sqf b/addons/common/functions/fnc_stringRemoveWhiteSpace.sqf index 19ca13de3b..2121f69ef4 100644 --- a/addons/common/functions/fnc_stringRemoveWhiteSpace.sqf +++ b/addons/common/functions/fnc_stringRemoveWhiteSpace.sqf @@ -1,21 +1,18 @@ -/** - * fn_stringTrim.sqf - * @Descr: Removes white spaces from string - * @Author: Glowbal +/* + * Author: Glowbal + * Removes white spaces from string * - * @Arguments: [string STRING] - * @Return: STRING copy of string - * @PublicAPI: true + * Arguments: + * 0: stringA + * 1: stringB + * + * Return Value: + * copy of string + * + * Public: Yes */ - #include "script_component.hpp" -#define WHITE_SPACE [20] +params ["_string"]; -private ["_string", "_charArray", "_returnString"]; -_string = [_this, 0, "",[""]] call bis_fnc_param; -_charArray = toArray _string; -_charArray = _charArray - [((toArray " ") select 0)]; -_returnString = toString _charArray; - -_returnString; \ No newline at end of file +(_string splitString " ") joinString "" diff --git a/addons/common/functions/fnc_stringToColoredText.sqf b/addons/common/functions/fnc_stringToColoredText.sqf index 4f6b1e7143..e6e19e4869 100644 --- a/addons/common/functions/fnc_stringToColoredText.sqf +++ b/addons/common/functions/fnc_stringToColoredText.sqf @@ -1,28 +1,28 @@ /* * Author: commy2 - * * Create a centered, colored text. * - * Argument: - * 0: Text (Anything) - * 2: Color (Array) + * Arguments: + * 0: Text + * 1: Color * - * Return value: - * Text + * Return Value: + * Text + * + * Public: Yes */ #include "script_component.hpp" -private ["_string", "_color"]; +params ["_string", "_color"]; -_string = format ["%1", _this select 0]; -_color = _this select 1; +_string = format ["%1", _string]; _color = ( - [255 * (_color select 0), 2] call FUNC(toHex) + [255 * (_color select 0), 2] call FUNC(toHex) ) + ( - [255 * (_color select 1), 2] call FUNC(toHex) + [255 * (_color select 1), 2] call FUNC(toHex) ) + ( - [255 * (_color select 2), 2] call FUNC(toHex) + [255 * (_color select 2), 2] call FUNC(toHex) ); -parseText format ["%1", _string, _color]; +parseText format ["%1", _string, _color] diff --git a/addons/common/functions/fnc_switchToGroupSide.sqf b/addons/common/functions/fnc_switchToGroupSide.sqf index 528d32853c..95f17a9c7b 100644 --- a/addons/common/functions/fnc_switchToGroupSide.sqf +++ b/addons/common/functions/fnc_switchToGroupSide.sqf @@ -1,45 +1,53 @@ -/** - * fn_switchToGroupSide_f.sqf - * @Descr: Stack group switches. Will always trace back to original group. - * @Author: Glowbal +/* + * Author: Glowbal + * Stack group switches. Will always trace back to original group. * - * @Arguments: [unit OBJECT, switch BOOL, id STRING, side SIDE] - * @Return: void - * @PublicAPI: true + * Arguments: + * 0: Unit + * 1: switch + * 2: id + * 3: side + * + * Return Value: + * None + * + * Public: Yes */ - #include "script_component.hpp" -private ["_unit","_side","_previousGroup","_newGroup", "_currentGroup", "_switch", "_originalSide", "_previousGroupsList", "_id"]; -_unit = [_this, 0,ObjNull,[ObjNull]] call BIS_fnc_Param; -_switch = [_this, 1, false,[false]] call BIS_fnc_Param; -_id = [_this, 2, "", [""]] call BIS_fnc_Param; -_side = [_this, 3, side _unit,[west]] call BIS_fnc_Param; +params [["_unit", objNull], ["_switch", false], ["_id", ""], ["_side", side _unit]]; + +private "_previousGroupsList"; +_previousGroupsList = _unit getvariable [QGVAR(previousGroupSwitchTo), []]; -_previousGroupsList = _unit getvariable [QGVAR(previousGroupSwitchTo),[]]; if (_switch) then { // go forward + private ["_previousGroup", "_originalSide", "_newGroup"]; + _previousGroup = group _unit; _originalSide = side group _unit; if (count units _previousGroup == 1 && _originalSide == _side) exitwith { - [format["Current group has only 1 member and is of same side as switch. Not switching unit %1", _id]] call FUNC(debug); + [format ["Current group has only 1 member and is of same side as switch. Not switching unit %1", _id]] call FUNC(debug); }; _newGroup = createGroup _side; [_unit] joinSilent _newGroup; - _previousGroupsList pushback [_previousGroup, _originalSide, _id, true]; - _unit setvariable [QGVAR(previousGroupSwitchTo), _previousGroupsList, true]; + _previousGroupsList pushBack [_previousGroup, _originalSide, _id, true]; + _unit setVariable [QGVAR(previousGroupSwitchTo), _previousGroupsList, true]; } else { // go one back + private ["_currentGroup", "_newGroup"]; + { if (_id == (_x select 2)) exitwith { _x set [ 3, false]; - _previousGroupsList set [_foreachIndex, _x]; + _previousGroupsList set [_forEachIndex, _x]; [format["found group with ID: %1", _id]] call FUNC(debug); }; - }foreach _previousGroupsList; + } forEach _previousGroupsList; + reverse _previousGroupsList; { @@ -55,10 +63,12 @@ if (_switch) then { if (count units _currentGroup == 0) then { deleteGroup _currentGroup; }; - _previousGroupsList set [_foreachIndex, ObjNull]; + _previousGroupsList set [_forEachIndex, objNull]; }; - }foreach _previousGroupsList; + } forEach _previousGroupsList; + _previousGroupsList = _previousGroupsList - [objNull]; reverse _previousGroupsList; // we have to reverse again, to ensure the list is in the right order. - _unit setvariable [QGVAR(previousGroupSwitchTo), _previousGroupsList, true]; + + _unit setVariable [QGVAR(previousGroupSwitchTo), _previousGroupsList, true]; }; diff --git a/addons/common/functions/fnc_syncedEvent.sqf b/addons/common/functions/fnc_syncedEvent.sqf index 9100e5a19a..34043fa8ae 100644 --- a/addons/common/functions/fnc_syncedEvent.sqf +++ b/addons/common/functions/fnc_syncedEvent.sqf @@ -1,33 +1,27 @@ /* * Author: jaynus - * * Call and propegate a synced event * - * Argument: - * 0: Name (String) - * 1: Arguments (Array) - * 2: TTL (Number or Code) [Optional] for this specific event call - * - * Return value: - * Boolean of success + * Arguments: + * 0: Name + * 1: Arguments + * 2: TTL [Optional] for this specific event call + * + * Return Value: + * Boolean of success + * + * Public: No */ -//#define DEBUG_MODE_FULL #include "script_component.hpp" -PARAMS_2(_name,_args); +params ["_name", "_args", ["_ttl", 0]]; -private["_ttl", "_eventData"]; - -if( (count _this) > 2) then { - _ttl = _this select 2; -} else { - _ttl = 0; -}; - -if(!HASH_HASKEY(GVAR(syncedEvents),_name)) exitWith { - diag_log text format["[ACE] Error, synced event key not found."]; +if (!HASH_HASKEY(GVAR(syncedEvents),_name)) exitWith { + ACE_LOGERROR("Synced event key not found."); false }; -_eventData = [_name, _args,_ttl]; -["SEH", _eventData] call FUNC(globalEvent); \ No newline at end of file +private "_eventData"; +_eventData = [_name, _args, _ttl]; + +["SEH", _eventData] call FUNC(globalEvent); diff --git a/addons/common/functions/fnc_syncedEventPFH.sqf b/addons/common/functions/fnc_syncedEventPFH.sqf index a5ec809706..923e445839 100644 --- a/addons/common/functions/fnc_syncedEventPFH.sqf +++ b/addons/common/functions/fnc_syncedEventPFH.sqf @@ -1,52 +1,66 @@ -//#define DEBUG_MODE_FULL +/* + * Author: ? + * + * ? + * + * Arguments: + * ? + * + * Return Value: + * ? + * + * Public: ? + */ #include "script_component.hpp" -if(!isServer) exitWith { false }; +if (!isServer) exitWith {false}; // Walk through the local synced events and clean up anything thats already EOL // @TODO: This should be iteration limited to prevent FPS lag -private["_data"]; + { - private["_data", "_eventLog", "_newEventLog", "_name", "_globalEventTTL"]; + private ["_name", "_data", "_newEventLog"]; + _name = _x; _data = HASH_GET(GVAR(syncedEvents),_name); - _eventLog = _data select 1; - _globalEventTTL = _data select 2; + _data params ["_eventTime", "_eventLog", "_globalEventTTL"]; + _newEventLog = []; - + // @TODO: This should be iteration limited to prevent FPS lag { - private["_eventEntry", "_ttlReturn"]; + private ["_eventEntry", "_ttlReturn"]; + _eventEntry = _x; - _ttlReturn = true; - if(typeName _globalEventTTL == "CODE") then { - _ttlReturn = [(_data select 0),_eventEntry] call _globalEventTTL; + + if (typeName _globalEventTTL == "CODE") then { + _ttlReturn = [_eventTime, _eventEntry] call _globalEventTTL; } else { - _ttlReturn = call { _globalEventTTL < 1 || {ACE_diagTime < (_eventEntry select 0) + _globalEventTTL} }; + _ttlReturn = call {_globalEventTTL < 1 || {ACE_diagTime < (_eventEntry select 0) + _globalEventTTL}}; }; - if(_ttlReturn) then { + if (_ttlReturn) then { // Do event based TTL check - private["_eventTTL"]; - _eventTTL = _eventEntry select 2; - - if(typeName _eventTTL == "CODE") then { - _ttlReturn = [(_data select 0),_eventEntry] call _eventTTL; + _eventEntry params ["_time", "", "_eventTTL"]; + + if (typeName _eventTTL == "CODE") then { + _ttlReturn = [_eventTime, _eventEntry] call _eventTTL; } else { - _ttlReturn = call { _eventTTL < 1 || {ACE_diagTime < (_eventEntry select 0) + _eventTTL} }; + _ttlReturn = call {_eventTTL < 1 || {ACE_diagTime < _time + _eventTTL}}; }; }; // Finally drop it if the TTL check fails - if(_ttlReturn) then { + if (_ttlReturn) then { _newEventLog pushBack _x; }; - } forEach _eventLog; - - _data set[1, _newEventLog]; -} forEach (GVAR(syncedEvents) select 0); + false + } count _eventLog; + _data set [1, _newEventLog]; + false +} count (GVAR(syncedEvents) select 0); // @TODO: Next, detect if we had a new request from a JIP player, and we need to continue syncing events diff --git a/addons/common/functions/fnc_targetEvent.sqf b/addons/common/functions/fnc_targetEvent.sqf index 22bd7431f5..b9802f0835 100644 --- a/addons/common/functions/fnc_targetEvent.sqf +++ b/addons/common/functions/fnc_targetEvent.sqf @@ -1,33 +1,33 @@ /* * Author: Nou - * * Execute a event only on specific clients. * - * Argument: - * 0: Event name (string) - * 1: Event targets (object or array of objects) - * 2: Event args (any) + * Arguments: + * 0: Event name (STRING) + * 1: Event targets + * 2: Event args * * Note: If local executor is in list of targets, event will execute with * network delay, and not immediatly. * - * Return value: - * Nothing + * Return Value: + * None + * + * Public: Yes */ #include "script_component.hpp" -//IGNORE_PRIVATE_WARNING("_handleNetEvent"); - -PARAMS_3(_eventName,_eventTargets,_eventArgs); +params ["_eventName", "_eventTargets", "_eventArgs"]; #ifdef DEBUG_EVENTS - diag_log text format[ARR_3("* Target Event: %1 - %2",_eventName,_eventTargets)]; - diag_log text format[ARR_2(" args=%1",_eventArgs)]; + ACE_LOGINFO_2("* Target Event: %1 - %2",_eventName,_eventTargets); + ACE_LOGINFO_1(" args=%1",_eventArgs); #endif ACEc = [_eventName, _eventTargets, _eventArgs]; -if(!isServer) then { + +if (!isServer) then { publicVariableServer "ACEc"; } else { ["ACEc", ACEc] call FUNC(_handleNetEvent); -}; \ No newline at end of file +}; diff --git a/addons/common/functions/fnc_throttledPublicVariable.sqf b/addons/common/functions/fnc_throttledPublicVariable.sqf index d43841146a..cdc72f4450 100644 --- a/addons/common/functions/fnc_throttledPublicVariable.sqf +++ b/addons/common/functions/fnc_throttledPublicVariable.sqf @@ -17,21 +17,20 @@ */ #include "script_component.hpp" -PARAMS_3(_unit,_varName,_maxDelay); +params ["_unit", "_varName", "_maxDelay"]; // Create the publish scheduler PFH the first ACE_time if (isNil QGVAR(publishSchedId)) then { - GVAR(publishVarNames) = []; GVAR(publishNextTime) = 1e7; GVAR(publishSchedId) = [{ - if (ACE_diagTime > GVAR(publishNextTime)) then { { - EXPLODE_2_PVT(_x,_unit,_varName); - _unit setVariable [_varName, (_unit getVariable _varName), true]; - } forEach GVAR(publishVarNames); + _x params [_unit, _varName]; + _unit setVariable [_varName, _unit getVariable _varName, true]; + false + } count GVAR(publishVarNames); GVAR(publishVarNames) = []; GVAR(publishNextTime) = 1e7; @@ -40,10 +39,10 @@ if (isNil QGVAR(publishSchedId)) then { }; // If the variable is not on the list -if (GVAR(publishVarNames) find [_unit,_varName] == -1) exitWith { - GVAR(publishVarNames) pushBack [_unit,_varName]; +if (GVAR(publishVarNames) find [_unit, _varName] == -1) exitWith { + GVAR(publishVarNames) pushBack [_unit, _varName]; GVAR(publishNextTime) = GVAR(publishNextTime) min (ACE_diagTime + _maxDelay); }; // If the variable is on the list -GVAR(publishNextTime) = GVAR(publishNextTime) min (ACE_diagTime + _maxDelay); \ No newline at end of file +GVAR(publishNextTime) = GVAR(publishNextTime) min (ACE_diagTime + _maxDelay); diff --git a/addons/common/functions/fnc_timePFH.sqf b/addons/common/functions/fnc_timePFH.sqf index 40fef519a8..4f099ea68c 100644 --- a/addons/common/functions/fnc_timePFH.sqf +++ b/addons/common/functions/fnc_timePFH.sqf @@ -1,7 +1,18 @@ -//#define DEBUG_MODE_FULL +/* + * Author: ? + * ? + * + * Arguments: + * ? + * + * Return Value: + * ? + * + * Public: ? + */ #include "script_component.hpp" -private["_lastTickTime", "_lastGameTime", "_delta"]; +private ["_lastTickTime", "_lastGameTime", "_delta"]; _lastTickTime = ACE_diagTime; _lastGameTime = ACE_gameTime; @@ -10,7 +21,8 @@ ACE_gameTime = time; ACE_diagTime = diag_tickTime; _delta = ACE_diagTime - _lastTickTime; -if(ACE_gameTime <= _lastGameTime) then { + +if (ACE_gameTime <= _lastGameTime) then { TRACE_1("paused",_delta); ACE_paused = true; // Game is paused or not running diff --git a/addons/common/functions/fnc_toBin.sqf b/addons/common/functions/fnc_toBin.sqf index 7c666f2f73..9f3296597d 100644 --- a/addons/common/functions/fnc_toBin.sqf +++ b/addons/common/functions/fnc_toBin.sqf @@ -1,23 +1,21 @@ /* -Author: commy2 - -Description: -Converts number to binary number - -Arguments: -A number - -Return Value: -A binary number, String -*/ + * Author: commy2 + * Converts number to binary number + * + * Arguments: + * A number + * + * Return Value: + * A binary number as string + * + * Public: Yes + */ #include "script_component.hpp" +params ["_number", ["_minLength", 1]]; + private ["_sign", "_bin", "_rest"]; -PARAMS_2(_number,_minLength); - -if (isNil "_minLength") then {_minLength = 1}; - _sign = ["", "-"] select (_number < 0); _number = round abs _number; @@ -33,4 +31,4 @@ while {count toArray _bin < _minLength} do { _bin = "0" + _bin; }; -_sign + _bin +_sign + _bin // return diff --git a/addons/common/functions/fnc_toBitmask.sqf b/addons/common/functions/fnc_toBitmask.sqf index 14ddb90541..35b1e06f9f 100644 --- a/addons/common/functions/fnc_toBitmask.sqf +++ b/addons/common/functions/fnc_toBitmask.sqf @@ -1,23 +1,22 @@ /* * Author: commy2 - * * Convert an array of booleans into a number. * - * Argument: - * 0: Booleans (Array of Booleans) + * Arguments: + * N: Booleans * - * Return value: - * Bitmask (Number) + * Return Value: + * Bitmask + * + * Public: Yes */ #include "script_component.hpp" -private ["_array", "_result"]; - -_array = _this; - +private "_result"; _result = 0; + { if (_x) then {_result = _result + 2 ^ _forEachIndex}; -} forEach _array; +} forEach _this; _result diff --git a/addons/common/functions/fnc_toHex.sqf b/addons/common/functions/fnc_toHex.sqf index 2d7d7a383e..80d8757b80 100644 --- a/addons/common/functions/fnc_toHex.sqf +++ b/addons/common/functions/fnc_toHex.sqf @@ -1,25 +1,28 @@ /* -Author: commy2, esteldunedain - -Description: -Converts number to hexadecimal number - -Arguments: -A number between 0 and 255 - -Return Value: -A hexadecimal number, String -*/ + * Author: commy2, esteldunedain + * Converts number to hexadecimal number + * + * Arguments: + * A number between 0 and 255 + * + * Return Value: + * A hexadecimal number as string + * + * Public: Yes + */ #include "script_component.hpp" -private ["_number"]; -_number = ((round abs (_this select 0)) max 0) min 255; +params ["_number"]; + +_number = ((round abs _number) max 0) min 255; if (isNil QGVAR(hexArray)) then { - private ["_minLength", "_i", "_num", "_hex", "_rest"]; - GVAR(hexArray) = []; + + private ["_minLength", "_num", "_hex", "_rest"]; + _minLength = 2; + for [{_i = 0;}, {_i < 256}, {_i = _i + 1}] do { _num = _i; _hex = ["", "0"] select (_i == 0); @@ -38,11 +41,13 @@ if (isNil QGVAR(hexArray)) then { _num = floor (_num / 16); _hex = _rest + _hex; }; + while {count toArray _hex < _minLength} do { _hex = "0" + _hex; }; + GVAR(hexArray) pushBack _hex; }; }; -(GVAR(hexArray) select _number) +GVAR(hexArray) select _number // return diff --git a/addons/common/functions/fnc_toNumber.sqf b/addons/common/functions/fnc_toNumber.sqf index 55a9ba2787..6b1aacde1e 100644 --- a/addons/common/functions/fnc_toNumber.sqf +++ b/addons/common/functions/fnc_toNumber.sqf @@ -1,25 +1,22 @@ /* - Name: FUNC(toNumber) - - Author(s): - Garth de Wet (LH) - - Description: - Takes a string/number and returns the number. - - Parameters: - 0: TYPE - Value to attempt to convert to number or if number simply return number. - - Returns: - NUMBER - - Example: - number = ["102"] call FUNC(toNumber); -*/ + * Author: Garth de Wet (LH) + * Takes a string/number and returns the number. + * + * Arguments: + * 0: Value to attempt to convert to number or if number simply return number. + * + * Return Value: + * + * + * Example: + * number = ["102"] call ace_common_fnc_toNumber; + * + * Public: Yes + */ #include "script_component.hpp" -if (typeName (_this select 0) == "SCALAR") exitWith { - (_this select 0) -}; +params ["_value"]; -(parseNumber (_this select 0)) \ No newline at end of file +if (typeName _value == "SCALAR") exitWith {_value}; + +parseNumber _value // return diff --git a/addons/common/functions/fnc_translateToModelSpace.sqf b/addons/common/functions/fnc_translateToModelSpace.sqf index d2dfa38643..b05a19bed6 100644 --- a/addons/common/functions/fnc_translateToModelSpace.sqf +++ b/addons/common/functions/fnc_translateToModelSpace.sqf @@ -1,20 +1,24 @@ +/* + * Author: ? + * ? + * + * Arguments: + * ? + * + * Return Value: + * ? + * + * Public: ? + */ #include "script_component.hpp" -private["_matrix", "_object", "_offset", "_origin", "_out", "_xVec", "_y", "_yVec", "_z", "_zVec"]; +params ["_object", "_matrix", "_offset"]; -_object = _this select 0; +private "_origin"; _origin = getPosASL _object; -_matrix = _this select 1; -_xVec = _matrix select 0; -_yVec = _matrix select 1; -_zVec = _matrix select 2; -_offset = _this select 2; +_matrix params ["_xVec", "_yVec", "_zVec"]; -_x = _offset select 0; -_y = _offset select 1; -_z = _offset select 2; +_offset params ["_x", "_y", "_z"]; -_out = (((_xVec vectorMultiply _x) vectorAdd (_yVec vectorMultiply _y)) vectorAdd (_zVec vectorMultiply _z)) vectorAdd _origin; - -_out; \ No newline at end of file +(_xVec vectorMultiply _x) vectorAdd (_yVec vectorMultiply _y) vectorAdd (_zVec vectorMultiply _z) vectorAdd _origin // return diff --git a/addons/common/functions/fnc_translateToWeaponSpace.sqf b/addons/common/functions/fnc_translateToWeaponSpace.sqf index ca1544b317..db3a5eaf37 100644 --- a/addons/common/functions/fnc_translateToWeaponSpace.sqf +++ b/addons/common/functions/fnc_translateToWeaponSpace.sqf @@ -1,26 +1,30 @@ +/* + * Author: ? + * ? + * + * Arguments: + * ? + * + * Return Value: + * ? + * + * Public: ? + */ #include "script_component.hpp" -private["_matrix", "_object", "_offset", "_origin", "_out", "_xVec", "_y", "_yVec", "_z", "_zVec"]; +params ["_object", "_matrix", "_offset"]; -_object = _this select 0; +private "_origin"; _origin = getPosASL _object; -_matrix = _this select 1; -_xVec = _matrix select 0; -_yVec = _matrix select 1; -_zVec = _matrix select 2; -_offset = _this select 2; +_matrix params ["_xVec", "_yVec", "_zVec"]; _offset = _offset vectorDiff _origin; -_x = _offset select 0; -_y = _offset select 1; -_z = _offset select 2; +_offset params ["_x", "_y", "_z"]; -_out = [ - ((_xVec select 0)*_x) + ((_xVec select 1)*_y) + ((_xVec select 2)*_z), - ((_yVec select 0)*_x) + ((_yVec select 1)*_y) + ((_yVec select 2)*_z), - ((_zVec select 0)*_x) + ((_zVec select 1)*_y) + ((_zVec select 2)*_z) - ]; - -_out; \ No newline at end of file +[ + ((_xVec select 0) * _x) + ((_xVec select 1) * _y) + ((_xVec select 2) * _z), + ((_yVec select 0) * _x) + ((_yVec select 1) * _y) + ((_yVec select 2) * _z), + ((_zVec select 0) * _x) + ((_zVec select 1) * _y) + ((_zVec select 2) * _z) +] // return diff --git a/addons/common/functions/fnc_unhideUnit.sqf b/addons/common/functions/fnc_unhideUnit.sqf index 190be47664..5bcafc3509 100644 --- a/addons/common/functions/fnc_unhideUnit.sqf +++ b/addons/common/functions/fnc_unhideUnit.sqf @@ -7,17 +7,16 @@ * 1: Reason to unhide the unit * * Return Value: - * nil + * None * * Example: * [ACE_Player, "SpectatorMode"] call ace_common_fnc_unhideUnit * - * Public: No + * Public: Yes */ - #include "script_component.hpp" -PARAMS_2(_unit,_reason); +params ["_unit", "_reason"]; if (isNull _unit) exitWith {}; diff --git a/addons/common/functions/fnc_uniqueElements.sqf b/addons/common/functions/fnc_uniqueElements.sqf new file mode 100644 index 0000000000..55d8c4ef5f --- /dev/null +++ b/addons/common/functions/fnc_uniqueElements.sqf @@ -0,0 +1,17 @@ +/* + * Author: Glowbal + * Make a copy of an array with only the unique elements. + * + * Arguments: + * 0: array + * + * Return Value: + * Copy of original array + * + * Public: Yes + */ +#include "script_component.hpp" + +params ["_array"]; + +_array arrayIntersect _array // return diff --git a/addons/common/functions/fnc_uniqueElementsOnly.sqf b/addons/common/functions/fnc_uniqueElementsOnly.sqf index c81efb8308..9bdb6ff647 100644 --- a/addons/common/functions/fnc_uniqueElementsOnly.sqf +++ b/addons/common/functions/fnc_uniqueElementsOnly.sqf @@ -1,24 +1,19 @@ -/** - * fn_uniqueElementsOnly.sqf - * @Descr: Make a copy of an array with only the unique elements. - * @Author: Glowbal +/* + * Author: Glowbal + * Make a copy of an array with only the unique elements. * - * @Arguments: [array ARRAY] - * @Return: ARRAY Copy of original array - * @PublicAPI: true + * Arguments: + * 0: array + * + * Return Value: + * Copy of original array + * + * Public: Yes + * + * Deprecated */ - #include "script_component.hpp" -private ["_result", "_value"]; -PARAMS_1(_array); +ACE_DEPRECATED("ace_common_fnc_uniqueElementsOnly","3.5.0","ace_common_fnc_uniqueElements"); -_result = []; -{ - _value = _x; - if ({_x isEqualTo _value} count _result == 0) then { - _result pushback _x; - }; -} forEach _array; - -_result; \ No newline at end of file +_this call FUNC(uniqueElements) diff --git a/addons/common/functions/fnc_unloadPerson.sqf b/addons/common/functions/fnc_unloadPerson.sqf index cd421fd3e5..0ab65a5983 100644 --- a/addons/common/functions/fnc_unloadPerson.sqf +++ b/addons/common/functions/fnc_unloadPerson.sqf @@ -10,23 +10,26 @@ * * Public: No */ -//#define DEBUG_MODE_FULL #include "script_component.hpp" #define GROUP_SWITCH_ID QUOTE(FUNC(loadPerson)) -private ["_vehicle","_emptyPos"]; -PARAMS_1(_unit); +params ["_unit"]; + +private "_vehicle"; _vehicle = vehicle _unit; -if (_vehicle == _unit) exitwith {false;}; -if !(speed _vehicle <1 && (((getpos _vehicle) select 2) < 2)) exitwith {false;}; +if (_vehicle == _unit) exitWith {false}; -_emptyPos = ((getPos _vehicle) findEmptyPosition [0, 10, typeof _unit]); -if (count _emptyPos == 0) exitwith {false}; +if (speed _vehicle > 1 || getPos _vehicle select 2 > 2) exitWith {false}; + +private "_emptyPos"; +_emptyPos = (getPos _vehicle) findEmptyPosition [0, 10, typeof _unit]; // @todo to small? + +if (count _emptyPos == 0) exitWith {false}; if (!isNull _vehicle) then { - [[_unit], QUOTE(FUNC(unloadPersonLocal)), _unit, false] call EFUNC(common,execRemoteFnc); + [[_unit], QUOTE(FUNC(unloadPersonLocal)), _unit, false] call FUNC(execRemoteFnc); }; -true; +true diff --git a/addons/common/functions/fnc_unloadPersonLocal.sqf b/addons/common/functions/fnc_unloadPersonLocal.sqf index da2d9ea77e..67d104a9e4 100644 --- a/addons/common/functions/fnc_unloadPersonLocal.sqf +++ b/addons/common/functions/fnc_unloadPersonLocal.sqf @@ -10,69 +10,94 @@ * * Public: No */ -//#define DEBUG_MODE_FULL #include "script_component.hpp" #define GROUP_SWITCH_ID QUOTE(FUNC(loadPerson)) -private ["_loaded", "_emptyPos","_validVehiclestate"]; -PARAMS_2(_unit,_vehicle); +params ["_unit", "_vehicle"]; + +private ["_validVehiclestate", "_emptyPos", "_loaded"]; + _validVehiclestate = true; -if (_vehicle isKindOf "Ship" ) then { - if !(speed _vehicle <1 && {(((getPosATL _vehicle) select 2) < 2)}) then {_validVehiclestate = false}; - TRACE_1("SHIP Ground Check", getPosATL _vehicle ); - _emptyPos = ((getPosASL _vehicle) call EFUNC(common,ASLtoPosition) findEmptyPosition [0, 13, typeof _unit]); // TODO: if spot is underwater pick another spot. +if (_vehicle isKindOf "Ship") then { + if (speed _vehicle > 1 || {getPos _vehicle select 2 > 2}) then { + _validVehiclestate = false; + }; + + TRACE_1("SHIP Ground Check",getPos _vehicle); + + _emptyPos = (ASLToAGL getPosASL _vehicle) findEmptyPosition [0, 13, typeof _unit]; // TODO: if spot is underwater pick another spot. } else { - if (_vehicle isKindOf "Air" ) then { - if !(speed _vehicle <1 && {isTouchingGround _vehicle}) then {_validVehiclestate = false}; - TRACE_1("Vehicle Ground Check", isTouchingGround _vehicle); - _emptyPos = (getPosASL _vehicle) call EFUNC(common,ASLtoPosition); - _emptyPos = [(_emptyPos select 0) + random(5), (_emptyPos select 1) + random(5), _emptyPos select 2 ]; + if (_vehicle isKindOf "Air") then { + if (speed _vehicle > 1 || {isTouchingGround _vehicle}) then { + _validVehiclestate = false; + }; + + TRACE_1("Vehicle Ground Check",isTouchingGround _vehicle); + + _emptyPos = ASLToAGL getPosASL _vehicle; + _emptyPos = _emptyPos vectorAdd [random 10 - 5, random 10 - 5, 0]; } else { - if !(speed _vehicle <1 && {(((getPosATL _vehicle) select 2) < 2)}) then {_validVehiclestate = false}; + if (speed _vehicle > 1 || {getPos _vehicle select 2 > 2}) then { + _validVehiclestate = false; + }; + TRACE_1("Vehicle Ground Check", isTouchingGround _vehicle); - _emptyPos = ((getPosASL _vehicle) call EFUNC(common,ASLtoPosition) findEmptyPosition [0, 13, typeof _unit]); + + _emptyPos = (ASLToAGL getPosASL _vehicle) findEmptyPosition [0, 13, typeof _unit]; }; }; TRACE_1("getPosASL Vehicle Check", getPosASL _vehicle); -if (!_validVehiclestate) exitwith { diag_log format["Unable to unload patient because invalid (%1) vehicle state. Either moving or Not close enough on the ground. position: %2 isTouchingGround: %3 Speed: %4", _vehicle, getPos _vehicle, isTouchingGround _vehicle, speed _vehicle]; false }; -diag_log str _emptyPos; - -if (count _emptyPos == 0) exitwith {diag_log format["No safe empty spots to unload patient. %1", _emptyPos]; false}; //consider displaying text saying there are no safe places to exit the vehicle +if !(_validVehiclestate) exitwith { + ACE_LOGWARNING_4("Unable to unload patient because invalid (%1) vehicle state. Either moving or Not close enough on the ground. position: %2 isTouchingGround: %3 Speed: %4",_vehicle,getPos _vehicle,isTouchingGround _vehicle,speed _vehicle); + false +}; +if (count _emptyPos == 0) exitwith { + ACE_LOGWARNING_1("No safe empty spots to unload patient. %1",_emptyPos); + false +}; //consider displaying text saying there are no safe places to exit the vehicle unassignVehicle _unit; [_unit] orderGetIn false; + TRACE_1("Ejecting", alive _unit); + _unit action ["Eject", vehicle _unit]; -[ { - private "_anim"; - PARAMS_2(_unit,_emptyPos); - _unit setPosASL (_emptyPos call EFUNC(common,PositiontoASL)); - if (!([_unit] call FUNC(isAwake))) then { + +[{ + params ["_unit", "_emptyPos"]; + + _unit setPosASL AGLToASL _emptyPos; + + if !([_unit] call FUNC(isAwake)) then { TRACE_1("Check if isAwake", [_unit] call FUNC(isAwake)); + if (driver _unit == _unit) then { - _anim = [_unit] call EFUNC(common,getDeathAnim); - [_unit, _anim, 1, true] call EFUNC(common,doAnimation); + private "_anim"; + _anim = [_unit] call FUNC(getDeathAnim); + + [_unit, _anim, 1, true] call FUNC(doAnimation); + [{ _unit = _this select 0; _anim = _this select 1; if ((_unit getVariable "ACE_isUnconscious") and (animationState _unit != _anim)) then { - [_unit, _anim, 2, true] call EFUNC(common,doAnimation); + [_unit, _anim, 2, true] call FUNC(doAnimation); }; - }, [_unit, _anim], 0.5, 0] call EFUNC(common,waitAndExecute); + }, [_unit, _anim], 0.5, 0] call FUNC(waitAndExecute); }; }; -},[_unit,_emptyPos], 0.5, 0] call EFUNC(common,waitAndExecute); - +}, [_unit, _emptyPos], 0.5, 0] call FUNC(waitAndExecute); [_unit, false, GROUP_SWITCH_ID, side group _unit] call FUNC(switchToGroupSide); _loaded = _vehicle getvariable [QGVAR(loaded_persons),[]]; -_loaded = _loaded - [_unit]; -_vehicle setvariable [QGVAR(loaded_persons),_loaded,true]; +_loaded deleteAt (_loaded find _unit); -true \ No newline at end of file +_vehicle setvariable [QGVAR(loaded_persons), _loaded, true]; + +true diff --git a/addons/common/functions/fnc_unmuteUnit.sqf b/addons/common/functions/fnc_unmuteUnit.sqf index 24b74785de..bf02fe676f 100644 --- a/addons/common/functions/fnc_unmuteUnit.sqf +++ b/addons/common/functions/fnc_unmuteUnit.sqf @@ -1,18 +1,19 @@ /* * Author: commy2 - * * Unmutes the unit. Only unmutes if the last reason was removed. * - * Argument: - * 0: Unit (Object) - * 1: Reason to unmute the unit. (String) + * Arguments: + * 0: Unit + * 1: Reason to unmute the unit. * - * Return value: - * Nothing + * Return Value: + * None + * + * Public: Yes */ #include "script_component.hpp" -PARAMS_2(_unit,_reason); +params ["_unit", "_reason"]; if (isNull _unit) exitWith {}; diff --git a/addons/common/functions/fnc_useItem.sqf b/addons/common/functions/fnc_useItem.sqf index 03589cd56d..acf359813c 100644 --- a/addons/common/functions/fnc_useItem.sqf +++ b/addons/common/functions/fnc_useItem.sqf @@ -1,36 +1,37 @@ -/** - * fn_useItem.sqf - * @Descr: - * @Author: Glowbal +/* + * Author: Glowbal + * Use item * - * @Arguments: [] - * @Return: - * @PublicAPI: true + * Arguments: + * 0: unit + * 1: item + * + * Return Value: + * if item has been used. + * + * Public: Yes */ - #include "script_component.hpp" -PARAMS_2(_unit,_item); - -private ["_return", "_vehicleUsage"]; - -_vehicleUsage = [_this, 2, false, [false]] call BIS_fnc_Param; +params ["_unit", "_item", ["_vehicleUsage", false]]; +private "_return"; _return = false; -if (!_vehicleUsage) then { + +if !(_vehicleUsage) then { if (_item != "") then { - if (_item in (items _unit)) then { + if (_item in items _unit) then { _unit removeItem _item; _return = true; } else { - if (_item in (assignedItems _unit)) then { - _unit unassignItem _item; - _unit removeItem _item; + if (_item in assignedItems _unit) then { + _unit unlinkItem _item; _return = true; }; }; }; +//} else { + // @todo implement shared item functionality for with vehicles. }; -// TODO implement shared item functionality for with vehicles. -_return; \ No newline at end of file +_return diff --git a/addons/common/functions/fnc_useMagazine.sqf b/addons/common/functions/fnc_useMagazine.sqf index f21a04d026..1a77d0b3f3 100644 --- a/addons/common/functions/fnc_useMagazine.sqf +++ b/addons/common/functions/fnc_useMagazine.sqf @@ -1,28 +1,32 @@ -/** - * fn_useMagazine.sqf - * @Descr: Use magazine - * @Author: Glowbal +/* + * Author: Glowbal + * Use magazine * - * @Arguments: [unit OBJECt, magazine STRING] - * @Return: BOOL True if magazine has been used. - * @PublicAPI: true + * Arguments: + * 0: unit + * 1: magazine + * + * Return Value: + * if magazine has been used. + * + * Public: Yes */ - #include "script_component.hpp" -private ["_return", "_vehicleUsage"]; -PARAMS_2(_unit,_magazine); -_vehicleUsage = [_this, 2, false, [false]] call BIS_fnc_Param; +params ["_unit", "_magazine", ["_vehicleUsage", false]]; -if (!_vehicleUsage) then { +private "_return"; +_return = false; + +if !(_vehicleUsage) then { if (_magazine != "") then { _unit removeMagazine _magazine; _return = true; - } else { - _return = false; }; - [format["fnc_useMagazine: %1 | %2",_this,_return]] call FUNC(debug); + + [format ["fnc_useMagazine: %1 | %2", _this, _return]] call FUNC(debug); +//} else { + // @todo implement shared magazine functionality +}; + _return -} else { - // TODO implement shared magazine functionality -}; \ No newline at end of file diff --git a/addons/common/functions/fnc_waitAndExecute.sqf b/addons/common/functions/fnc_waitAndExecute.sqf index 977e4f146d..af59e301f7 100644 --- a/addons/common/functions/fnc_waitAndExecute.sqf +++ b/addons/common/functions/fnc_waitAndExecute.sqf @@ -1,24 +1,23 @@ /* * Author: esteldunedain - * * Executes a code once with a given game ACE_time delay, using a PFH * - * Argument: - * 0: Code to execute (Code) - * 1: Parameters to run the code with (Array) - * 2: Delay in seconds before executing the code (Number) + * Arguments: + * 0: Code to execute + * 1: Parameters to run the code with + * 2: Delay in seconds before executing the code * - * Return value: + * Return Value: * None * * Example: * [{(_this select 0) setVelocity [0,0,200];}, [player], 10] call ace_common_fnc_waitAndExecute * - * Public: No + * Public: Yes */ #include "script_component.hpp" -PARAMS_3(_func,_params,_delay); +params ["_func", "_params", "_delay"]; -GVAR(waitAndExecArray) pushBack [(ACE_time + _delay), _func, _params]; +GVAR(waitAndExecArray) pushBack [ACE_time + _delay, _func, _params]; GVAR(waitAndExecArray) sort true; diff --git a/addons/common/functions/fnc_waitUntilAndExecute.sqf b/addons/common/functions/fnc_waitUntilAndExecute.sqf new file mode 100644 index 0000000000..6a7867d707 --- /dev/null +++ b/addons/common/functions/fnc_waitUntilAndExecute.sqf @@ -0,0 +1,23 @@ +/* + * Author: joko // Jonas + * Executes a code once with after the Condition is True, using a PFH + * + * Argument: + * 0: Condition + * 1: Code to execute + * 2: Parameters to run the code with + * + * Return value: + * None + * + * Example: + * [{(_this select 0) == vehicle (_this select 0)}, {(_this select 0) setDamage 1;}, [ACE_player]] call ace_common_fnc_waitAndExecute + * + * Public: No + */ +#include "script_component.hpp" + +TRACE_1("Adding",_this); + +GVAR(waitUntilAndExecArray) pushBack _this; +nil diff --git a/addons/common/functions/fnc_waveHeightAt.sqf b/addons/common/functions/fnc_waveHeightAt.sqf index e05e4219b7..a3f2447729 100644 --- a/addons/common/functions/fnc_waveHeightAt.sqf +++ b/addons/common/functions/fnc_waveHeightAt.sqf @@ -9,12 +9,17 @@ * Return Value: * Wave height in meters * + * + * Public: No */ #include "script_component.hpp" -if(isNil QGVAR(waveHeightLogic)) then { +params ["_position"]; + +if (isNil QGVAR(waveHeightLogic)) then { GVAR(waveHeightLogic) = "Logic" createVehicleLocal [0,0,0]; }; -GVAR(waveHeightLogic) setPosASL (_this select 0); -(((getPosASLW GVAR(waveHeightLogic)) select 2) - ((getPosASL GVAR(waveHeightLogic)) select 2)) \ No newline at end of file +GVAR(waveHeightLogic) setPosASL _position; + +(getPosASLW GVAR(waveHeightLogic) select 2) - (getPosASL GVAR(waveHeightLogic) select 2) diff --git a/addons/common/functions/fnc_worldToScreenBounds.sqf b/addons/common/functions/fnc_worldToScreenBounds.sqf index b3b5ba3f1e..2de07c7bbd 100644 --- a/addons/common/functions/fnc_worldToScreenBounds.sqf +++ b/addons/common/functions/fnc_worldToScreenBounds.sqf @@ -1,53 +1,76 @@ -// (c) zGuba 2011 -// Function helper for framing objects on screen. -// Input: [_object,_margins3D,_offset3D] (object, 3 * float array, 3 * float array) -// Output: [_minX,_minY,_minY,_maxY] (4 * float) - +/* + * Author: zGuba 2011 + * + * Function helper for framing objects on screen. + * + * Arguments: + * 0: object + * 1: margins 3D + * 0: X + * 1: Y + * 2: Z + * 2: offset 3D + * 0: X + * 1: Y + * 2: Z + * + * Return Value: + * 0: Minimal X + * 1: Minimal Y + * 2: Maximal X + * 3: Maximal Y + * + * Public: No + */ #include "script_component.hpp" -private ["_minX","_minY","_maxX","_maxY", "_bounds", "_boundsCorners", "_boundsMax", "_boundsMaxX", "_boundsMaxY", "_boundsMaxZ", "_boundsMin", "_boundsMinX", "_boundsMinY", "_boundsMinZ"]; +params ["_object", "_margins", "_offsets"]; -PARAMS_3(_object,_margins,_offsets); +private ["_minX", "_minY", "_maxX", "_maxY", "_bounds", "_boundsCorners"]; _minX = 10; _minY = 10; _maxX = -10; _maxY = -10; -if (true) then { - _bounds = boundingBox _object; +_bounds = boundingBox _object; +_margins params ["_marginsX", "_marginsY", "_marginsZ"]; +_offsets params ["_offsetsX", "_offsetsY", "_offsetsZ"]; - _boundsMin = _bounds select 0; - _boundsMinX = (_boundsMin select 0) - (_margins select 0) + (_offsets select 0); - _boundsMinY = (_boundsMin select 1) - (_margins select 1) + (_offsets select 1); - _boundsMinZ = (_boundsMin select 2) - (_margins select 2) + (_offsets select 2); - _boundsMax = _bounds select 1; - _boundsMaxX = (_boundsMax select 0) + (_margins select 0) + (_offsets select 0); - _boundsMaxY = (_boundsMax select 1) + (_margins select 1) + (_offsets select 1); - _boundsMaxZ = (_boundsMax select 2) + (_margins select 2) + (_offsets select 2); +_bounds params ["_boundsMin", "_boundsMax"]; +_boundsMin params ["_boundsMinX", "_boundsMinY", "_boundsMinZ"]; +_boundsMax params ["_boundsMaxX", "_boundsMaxY", "_boundsMaxZ"]; - _boundsCorners = [ - [_boundsMinX,_boundsMinY,_boundsMinZ], - [_boundsMinX,_boundsMinY,_boundsMaxZ], - [_boundsMinX,_boundsMaxY,_boundsMinZ], - [_boundsMinX,_boundsMaxY,_boundsMaxZ], - [_boundsMaxX,_boundsMinY,_boundsMinZ], - [_boundsMaxX,_boundsMinY,_boundsMaxZ], - [_boundsMaxX,_boundsMaxY,_boundsMinZ], - [_boundsMaxX,_boundsMaxY,_boundsMaxZ] - ]; +_boundsMinX = _boundsMinX - _marginsX + _offsetsX; +_boundsMinY = _boundsMinY - _marginsY + _offsetsY; +_boundsMinZ = _boundsMinZ - _marginsZ + _offsetsZ; +_boundsMaxX = _boundsMaxX + _marginsX + _offsetsX; +_boundsMaxY = _boundsMaxY + _marginsY + _offsetsY; +_boundsMaxZ = _boundsMaxZ + _marginsZ + _offsetsZ; - { - _ppos = worldToScreen (_object modelToWorld _x); - if (count _ppos >= 2) then { - EXPLODE_2_PVT(_ppos,_pposX,_pposY); - if (_pposX < _minX) then {_minX = _pposX}; - if (_pposX > _maxX) then {_maxX = _pposX}; - if (_pposY < _minY) then {_minY = _pposY}; - if (_pposY > _maxY) then {_maxY = _pposY}; - }; //else - what to do if it is offscreen? - } forEach _boundsCorners; -}; +_boundsCorners = [ + [_boundsMinX,_boundsMinY,_boundsMinZ], + [_boundsMinX,_boundsMinY,_boundsMaxZ], + [_boundsMinX,_boundsMaxY,_boundsMinZ], + [_boundsMinX,_boundsMaxY,_boundsMaxZ], + [_boundsMaxX,_boundsMinY,_boundsMinZ], + [_boundsMaxX,_boundsMinY,_boundsMaxZ], + [_boundsMaxX,_boundsMaxY,_boundsMinZ], + [_boundsMaxX,_boundsMaxY,_boundsMaxZ] +]; + +{ + private "_ppos"; + _ppos = worldToScreen (_object modelToWorld _x); + if (count _ppos >= 2) then { + _ppos params ["_pposX", "_pposY"]; + if (_pposX < _minX) then {_minX = _pposX}; + if (_pposX > _maxX) then {_maxX = _pposX}; + if (_pposY < _minY) then {_minY = _pposY}; + if (_pposY > _maxY) then {_maxY = _pposY}; + }; //else - what to do if it is offscreen? + false +} count _boundsCorners; [_minX,_minY,_maxX,_maxY] diff --git a/addons/common/functions/script_component.hpp b/addons/common/functions/script_component.hpp index 95b7e86461..c213544655 100644 --- a/addons/common/functions/script_component.hpp +++ b/addons/common/functions/script_component.hpp @@ -10,4 +10,4 @@ if((count _this) > c) then {\ _callFrom = _this select c;\ _lineNo = _this select c+1;\ - }; \ No newline at end of file + }; diff --git a/addons/common/scripts/Version/script_component.hpp b/addons/common/scripts/Version/script_component.hpp deleted file mode 100644 index 23da62b05c..0000000000 --- a/addons/common/scripts/Version/script_component.hpp +++ /dev/null @@ -1 +0,0 @@ -#include "\z\ace\addons\common\script_component.hpp" \ No newline at end of file diff --git a/addons/common/scripts/assignedItemFix.sqf b/addons/common/scripts/assignedItemFix.sqf deleted file mode 100644 index bcf79a3ac1..0000000000 --- a/addons/common/scripts/assignedItemFix.sqf +++ /dev/null @@ -1,64 +0,0 @@ -// by commy2 -#include "script_component.hpp" - -private ["_config"]; - -ACE_isMapEnabled = call {_config = missionConfigFile >> "showMap"; !isNumber _config || {getNumber _config == 1}}; // default value is 1, so do isNumber check first -ACE_isCompassEnabled = call {_config = missionConfigFile >> "showCompass"; !isNumber _config || {getNumber _config == 1}}; -ACE_isWatchEnabled = call {_config = missionConfigFile >> "showWatch"; !isNumber _config || {getNumber _config == 1}}; -ACE_isRadioEnabled = call {_config = missionConfigFile >> "showRadio"; !isNumber _config || {getNumber _config == 1}}; -ACE_isGPSEnabled = call {_config = missionConfigFile >> "showGPS"; !isNumber _config || {getNumber _config == 1}}; - -GVAR(AssignedItems) = []; -GVAR(AssignedItemsInfo) = []; - -["playerInventoryChanged", { - private ["_unit", "_assignedItems", "_shownItems"]; - - _unit = _this select 0; - _assignedItems = _this select 1 select 17; - - _shownItems = [ - ACE_isMapEnabled, - ACE_isCompassEnabled, - ACE_isWatchEnabled, - ACE_isRadioEnabled, - ACE_isGPSEnabled - ]; - - { - if !(_x in GVAR(AssignedItems)) then { - GVAR(AssignedItems) pushBack _x; - GVAR(AssignedItemsInfo) pushBack toLower getText (configFile >> "CfgWeapons" >> _x >> "ACE_hideItemType") - }; - - private "_hideItemType"; - _hideItemType = GVAR(AssignedItemsInfo) select (GVAR(AssignedItems) find _x); - - switch (_hideItemType) do { - case ("map"): { - _shownItems set [0, false]; - }; - case ("compass"): { - _shownItems set [1, false]; - }; - case ("watch"): { - _shownItems set [2, false]; - }; - case ("radio"): { - _shownItems set [3, false]; - }; - case ("gps"): { - _shownItems set [4, false]; - }; - }; - } forEach _assignedItems; - - //systemChat str _shownItems; - - showMap (_shownItems select 0); - showCompass (_shownItems select 1); - showWatch (_shownItems select 2); - showRadio (_shownItems select 3); - showGPS (_shownItems select 4 || {cameraOn == getConnectedUAV _unit}); //If player is activly controling a UAV, showGPS controls showing the map (m key) -}] call FUNC(addEventHandler); diff --git a/addons/common/scripts/Version/checkVersionNumber.sqf b/addons/common/scripts/checkVersionNumber.sqf similarity index 100% rename from addons/common/scripts/Version/checkVersionNumber.sqf rename to addons/common/scripts/checkVersionNumber.sqf diff --git a/addons/common/scripts/initScrollWheel.sqf b/addons/common/scripts/initScrollWheel.sqf deleted file mode 100644 index 78920bb371..0000000000 --- a/addons/common/scripts/initScrollWheel.sqf +++ /dev/null @@ -1,16 +0,0 @@ -// by commy2 -#include "script_component.hpp" - -GVAR(ScrollWheelFrame) = diag_frameno; - -GVAR(onScrollWheel) = { - private ["_scroll"]; - _scroll = _this select 1; - - if (GVAR(ScrollWheelFrame) == diag_frameno) exitWith {}; - GVAR(ScrollWheelFrame) = diag_frameno; - - { - [_scroll] call _x; - } count ((missionNamespace getVariable ["ACE_EventHandler_ScrollWheel", [-1, [], []]]) select 2); -}; diff --git a/addons/common/stringtable.xml b/addons/common/stringtable.xml index d0034d2c04..8973d1d3e6 100644 --- a/addons/common/stringtable.xml +++ b/addons/common/stringtable.xml @@ -477,14 +477,19 @@ Überprüfe PBOs Zkontrolovat PBO Verificar PBOs + Vérifier les PBOs + PBO-k ellenőrzése + Проверка аддонов - - Sprawdzaj spójność addonów z serwerem + Check addon integrity with server and do selected action if an addon is missing. + Sprawdzaj spójność addonów z serwerem i wykonuj stosowną akcję jeżeli zostanie wykryty brak addonu. Este módulo verifica la integridad de los addons con los que iniciamos el simulador Dieses Modul überprüft ob jeder Spieler die richtigen PBO-Dateien hat. Zjistit addon který je v souladu se serverem Este módulo verifica a integridade dos addons quando iniciamos a simulação + Выполняет проверку версий аддонов ACE у подключаемых игроков + Ce module contrôle si les PBOs de chaque joueur sont corrects Action @@ -493,6 +498,9 @@ Aktion Akce Ação + Action + Cselekvés + Действие What to do with people who do not have the right PBOs? @@ -501,6 +509,9 @@ Was soll mit Leuten passieren, die nicht die richtigen PBOs haben? Co udělat s lidmi, co nemají správné addony? O que fazer com pessoas que não tem os PBOs corretos? + Que faire avec les personnes n'ayant pas les bon PBOs + Mi legyen azokkal a személyekkel, akiknek nincsenek meg a helyes PBO-k? + Что делать с игроками с неправильными аддонами? Warn once @@ -509,6 +520,9 @@ Einmal verwarnen Upozornit jednou Avisar uma vez + Avertir une fois + Egyszeri figyelmeztetés + Предупредить один раз Warn (permanent) @@ -517,6 +531,9 @@ Immer verwarnen Upozornit (permanentně) Avisar (permanente) + Avertir (permanent) + Figyelmeztetés (tartós) + Предупреждать (постоянно) Kick @@ -525,6 +542,9 @@ Kicken Vyhodit Chutar + Ejecter + Kirúgás + Кикнуть Check all addons @@ -533,6 +553,9 @@ Alle Addons überprüfen Zkontrolovat všechny addony Verificar todos addons + Vérifier tous les addons + Összes bővítmény ellenőrzése + Проверять все аддоны Check all addons instead of only those of ACE? @@ -541,6 +564,9 @@ Alle Addons anstatt nur ACE überprüfen? Zkontrolovat všechny addony namísto jen těch od ACE? Verificar todos addons invés de só os do ACE? + Vérifie tous les addons, même ceux qui ne sont pas liés à ACE + Az összes bővítmény ellenőrzése, csak az ACE helyett? + Проверять все аддоны, а не только ACE? Whitelist @@ -549,6 +575,9 @@ Whitelist Seznam povolených Lista branca + Liste blanche + Fehérlista + Вайтлист доп. аддонов What addons are allowed regardless? @@ -557,6 +586,9 @@ Welche Addons werden dennoch erlaubt? Jaké addony jsou povoleny? Quais addons são permitidos de qualquer maneira? + Quels addons sont tolérés + Milyen bővítmények vannak feltétlenül engedélyezve? + Какие аддоны дополнительно разрешены? LSD Vehicles @@ -565,6 +597,9 @@ LSD-Fahrzeuge LSD vozidla Veículos LSD + LSD - Véhicules + LSD járművek + Транспорт под LSD Adds LSD effect to synchronized vehicle @@ -573,6 +608,9 @@ Fügt einen LSD-Effekt zum synchronisierten Fahrzeug hinzu Přidá LSD efekt pro synchronizované vozidla Adiciona efeito LSD ao veículo sincronizado + Ajoute l'effet LSD aux véhicules synchronisés + LSD-effekt hozzáadása a szinkronizált járművekhez + Добавляет эффект LSD (мигание всеми цветами радуги) синхронизированным транспортным средствам Toggle Handheld Device @@ -581,6 +619,9 @@ Ativa dispositivo de mão Przełącz urządzenie podręczne Přepnout ruční zařízení + Allumer l'ordinateur de poche + Kézi eszköz kapcsolása + Включить портативное устройство Close Handheld Device @@ -589,6 +630,9 @@ Fecha dispositivo de mão Zamknij urządzenie podręczne Zavřít ruční zařízení + Fermer l'ordinateur de poche + Kézi eszköz bezárása + Закрыть портативное устройство Cycle Handheld Devices @@ -597,6 +641,9 @@ Troca dispositivos de mão Następne urządzenie podręczne Procházet ruční zařízení + Changer (cycle) d'ordinateur de poche + Kézi eszköz váltása + Следующее портативное устройство Disabled @@ -646,6 +693,11 @@ Vehicles only + Tylko pojazdy + Somente veículos + Только в транспорте + Pouze vozidla + Solo vehículos Do Not Force @@ -654,30 +706,53 @@ Nicht erzwingen Nevynucovat Não forçar + Не обязывать ACE3 Equipment ACE3 Wyposażenie + Equipamentos ACE3 + ACE3 Снаряжение + ACE3 Vybavení + ACE3 Equipo ACE3 Common ACE3 Ogólne + Comum ACE3 + ACE3 Общие + ACE3 Común ACE3 Weapons ACE3 Broń + Armamento ACE3 + ACE3 Оружие + ACE3 Zbraně + ACE3 Armas ACE3 Movement ACE3 Ruch + Movimento ACE3 + ACE3 Перемещение + ACE3 Movimiento ACE3 Scope Adjustment ACE3 Regulacja optyki + Ajuste de luneta ACE3 + ACE3 Прицелы + ACE3 Nastavení optiky + ACE3 Ajuste de miras ACE3 Vehicles ACE3 Pojazdy + Veículos ACE3 + ACE3 Транспорт + ACE3 Vozidla + ACE3 Vehículos diff --git a/addons/concertina_wire/CfgVehicles.hpp b/addons/concertina_wire/CfgVehicles.hpp index cf1be40487..81304da853 100644 --- a/addons/concertina_wire/CfgVehicles.hpp +++ b/addons/concertina_wire/CfgVehicles.hpp @@ -3,7 +3,7 @@ class CfgVehicles { class Fence; class thingX; class NonStrategic; - + class ACE_ConcertinaWireNoGeo: Fence { XEH_ENABLED; scope = 1; @@ -48,7 +48,7 @@ class CfgVehicles { class wire_16: wire_2{}; class wire_17: wire_2{}; class wire_18: wire_2{}; - + class wire_2_1: wire_2 { animPeriod = 8; }; @@ -67,13 +67,14 @@ class CfgVehicles { class wire_15_1: wire_2_1 {}; class wire_16_1: wire_2_1 {}; class wire_17_1: wire_2_1 {}; - class wire_18_1: wire_2_1 {}; + class wire_18_1: wire_2_1 {}; }; }; class ACE_ConcertinaWire: ACE_ConcertinaWireNoGeo { scope = 2; displayName = $STR_ACE_CONCERTINA_WIRE; model = PATHTOF(data\ACE_ConcertinaWire.p3d); + EGVAR(logistics_wirecutter,isFence) = 1; class ACE_Actions { class ACE_MainActions { selection = ""; @@ -113,6 +114,8 @@ class CfgVehicles { EGVAR(dragging,canDrag) = 1; EGVAR(dragging,dragPosition[]) = {0,0.5,0.5}; EGVAR(dragging,dragDirection) = 0; + EGVAR(cargo,size) = 1; + EGVAR(cargo,canLoad) = 1; class ACE_Actions { class ACE_MainActions { selection = ""; @@ -133,7 +136,7 @@ class CfgVehicles { }; }; }; - + class Land_Razorwire_F: NonStrategic { XEH_ENABLED; }; diff --git a/addons/concertina_wire/README.md b/addons/concertina_wire/README.md index ab62458de9..e1e6530f5b 100644 --- a/addons/concertina_wire/README.md +++ b/addons/concertina_wire/README.md @@ -3,8 +3,9 @@ ace_concertina_wire Adds concertina wire. + ## Maintainers The people responsible for merging changes to this component or answering potential questions. -- [Ruthberg] (http://github.com/Ulteq) \ No newline at end of file +- [Ruthberg](http://github.com/Ulteq) diff --git a/addons/concertina_wire/stringtable.xml b/addons/concertina_wire/stringtable.xml index 07c2961862..26216b7c0e 100644 --- a/addons/concertina_wire/stringtable.xml +++ b/addons/concertina_wire/stringtable.xml @@ -1,13 +1,13 @@ - + Concertina Wire NATO-Draht - Проволочная спираль + Колючая проволока Koncentrina Alambre de espino - Concertina wire + Fill barbelé Ostnatý drát Concertina wire Concertina wire @@ -16,10 +16,10 @@ Concertina Wire Coil NATO-Draht Rolle - Проволочная спираль (моток) + Колючая проволока (моток) Zwój koncentriny Bobina de alambre de espino - Concertina wire coil + Bobine de fil barbelé Smyčka ostnatého drátu Concertina wire coil Concertina wire coil @@ -28,10 +28,10 @@ Dismount Concertina Wire NATO-Draht abbauen - Демонтировать проволочную спираль + Демонтировать колючую проволоку Zwiń koncentrinę Desmontar alambre de espino - Dismount Concertina wire + Descendre le fil barbelé Svinout ostnatý drát Dismount Concertina wire Dismount Concertina wire @@ -40,14 +40,14 @@ Deploy Concertina Wire NATO-Draht verlegen - Монтировать проволочную спираль + Монтировать колючую проволоку Rozwiń koncentrinę Desplegar alambre de espino - Deploy Concertina wire + Mettre en place le fil barbelé Rozvinout ostnatý drát Deploy Concertina wire Deploy Concertina wire Colocar arame farpado - + \ No newline at end of file diff --git a/addons/dagr/CfgVehicles.hpp b/addons/dagr/CfgVehicles.hpp index a9948ca8aa..7f0a7f6cff 100644 --- a/addons/dagr/CfgVehicles.hpp +++ b/addons/dagr/CfgVehicles.hpp @@ -4,7 +4,7 @@ class CfgVehicles { class ACE_SelfActions { class ACE_Equipment { class GVAR(menu) { - displayName = "Configure DAGR"; + displayName = CSTRING(ConfigureDAGR); condition = QUOTE([ARR_2(_player,'ACE_DAGR')] call EFUNC(common,hasItem)); statement = QUOTE(call FUNC(menuInit)); showDisabled = 0; @@ -12,7 +12,7 @@ class CfgVehicles { icon = QUOTE(PATHTOF(UI\DAGR_Icon.paa)); exceptions[] = {"isNotInside", "isNotSitting"}; class GVAR(toggle) { - displayName = "Toggle DAGR"; + displayName = CSTRING(ToggleDAGR); condition = QUOTE([ARR_2(_player,'ACE_DAGR')] call EFUNC(common,hasItem)); statement = QUOTE(call FUNC(toggleOverlay)); showDisabled = 0; @@ -30,7 +30,7 @@ class CfgVehicles { author[] = {"Rosuto", "Ruthberg"}; scope = 2; scopeCurator = 2; - displayName = "DAGR"; + displayName = CSTRING(Name); vehicleClass = "Items"; class TransportItems { MACRO_ADDITEM(ACE_DAGR,1); diff --git a/addons/dagr/CfgWeapons.hpp b/addons/dagr/CfgWeapons.hpp index 830e9cf115..9fcd903cdd 100644 --- a/addons/dagr/CfgWeapons.hpp +++ b/addons/dagr/CfgWeapons.hpp @@ -6,9 +6,9 @@ class CfgWeapons { class ACE_DAGR: ACE_ItemCore { author[] = {$STR_ACE_Common_ACETeam, "Ruthberg"}; scope = 2; - displayName = "DAGR"; + displayName = CSTRING(Name); model = QUOTE(PATHTOF(data\DAGR.p3d)); - descriptionShort = ""; + descriptionShort = CSTRING(Description); picture = PATHTOF(UI\DAGR_Icon.paa); icon = "iconObject_circle"; mapSize = 0.034; diff --git a/addons/dagr/README.md b/addons/dagr/README.md index 33d095dca4..eb502e7a24 100644 --- a/addons/dagr/README.md +++ b/addons/dagr/README.md @@ -1,10 +1,11 @@ ace_dagr =============== -Defense Advanced GPS Receiver +Adds Defense Advanced GPS Receiver. + ## Maintainers The people responsible for merging changes to this component or answering potential questions. -- [Ruthberg] (http://github.com/Ulteq) \ No newline at end of file +- [Ruthberg](http://github.com/Ulteq) diff --git a/addons/dagr/stringtable.xml b/addons/dagr/stringtable.xml index 7da844d614..1abd146800 100644 --- a/addons/dagr/stringtable.xml +++ b/addons/dagr/stringtable.xml @@ -1,5 +1,29 @@  + + DAGR + DAGR + DAGR + DAGR + + + Configure DAGR + Konfiguruj DAGR + Configurar DAGR + Настроить DAGR + + + Toggle DAGR + Przełącz DAGR + Mostrar DAGR + Вкл./выкл. DAGR + + + Defense Advanced GPS Receiver + Defense Advanced GPS Receiver + Defense Advanced GPS Receiver + Военный многофункциональный GPS-приёмник + - \ No newline at end of file + diff --git a/addons/disarming/XEH_postInit.sqf b/addons/disarming/XEH_postInit.sqf index 7315ef1785..ef17e6e96a 100644 --- a/addons/disarming/XEH_postInit.sqf +++ b/addons/disarming/XEH_postInit.sqf @@ -1,4 +1,4 @@ #include "script_component.hpp" -["DisarmDropItems", {_this call FUNC(eventTargetStart)}] call EFUNC(common,addEventHandler); -["DisarmDebugCallback", {_this call FUNC(eventCallerFinish)}] call EFUNC(common,addEventHandler); +["DisarmDropItems", FUNC(eventTargetStart)] call EFUNC(common,addEventHandler); +["DisarmDebugCallback", FUNC(eventCallerFinish)] call EFUNC(common,addEventHandler); diff --git a/addons/disarming/functions/fnc_canBeDisarmed.sqf b/addons/disarming/functions/fnc_canBeDisarmed.sqf index 25ec884919..9be20db7f4 100644 --- a/addons/disarming/functions/fnc_canBeDisarmed.sqf +++ b/addons/disarming/functions/fnc_canBeDisarmed.sqf @@ -1,5 +1,6 @@ /* * Author: PabstMirror + * * Checks the conditions for being able to disarm a unit * * Arguments: @@ -15,17 +16,17 @@ */ #include "script_component.hpp" -PARAMS_1(_target); - private ["_animationStateCfgMoves", "_putDownAnim"]; +params ["_target"]; + //Check animationState for putDown anim //This ensures the unit doesn't have to actualy do any animation to drop something //This should always be true for the 3 possible status effects that allow disarming _animationStateCfgMoves = getText (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState _target) >> "actions"); -if (_animationStateCfgMoves == "") exitWith {false}; +if (_animationStateCfgMoves == "") exitWith { false }; _putDownAnim = getText (configFile >> "CfgMovesBasic" >> "Actions" >> _animationStateCfgMoves >> "PutDown"); -if (_putDownAnim != "") exitWith {false}; +if (_putDownAnim != "") exitWith { false }; (alive _target) && diff --git a/addons/disarming/functions/fnc_canPlayerDisarmUnit.sqf b/addons/disarming/functions/fnc_canPlayerDisarmUnit.sqf index ec9e975ec2..34f1a10d32 100644 --- a/addons/disarming/functions/fnc_canPlayerDisarmUnit.sqf +++ b/addons/disarming/functions/fnc_canPlayerDisarmUnit.sqf @@ -1,5 +1,6 @@ /* * Author: PabstMirror + * * Checks the conditions for being able to disarm a unit * * Arguments: @@ -16,7 +17,7 @@ */ #include "script_component.hpp" -PARAMS_2(_player,_target); +params ["_player", "_target"]; -([_target] call FUNC(canBeDisarmed)) && +([_target] call FUNC(canBeDisarmed)) && {([_player, _target, []] call EFUNC(common,canInteractWith))} diff --git a/addons/disarming/functions/fnc_disarmDropItems.sqf b/addons/disarming/functions/fnc_disarmDropItems.sqf index 5422fd00a6..91eff1c99d 100644 --- a/addons/disarming/functions/fnc_disarmDropItems.sqf +++ b/addons/disarming/functions/fnc_disarmDropItems.sqf @@ -1,5 +1,6 @@ /* * Author: PabstMirror + * * Makes a unit drop items * * Arguments: @@ -22,13 +23,11 @@ private ["_fncSumArray", "_return", "_holder", "_dropPos", "_targetMagazinesStart", "_holderMagazinesStart", "_xClassname", "_xAmmo", "_targetMagazinesEnd", "_holderMagazinesEnd", "_holderItemsStart", "_targetItemsStart", "_addToCrateClassnames", "_addToCrateCount", "_index", "_holderItemsEnd", "_targetItemsEnd", "_holderIsEmpty"]; - -PARAMS_3(_caller,_target,_listOfItemsToRemove); -DEFAULT_PARAM(3,_doNotDropAmmo,false); //By default units drop all weapon mags when dropping a weapon +params ["_caller", "_target", "_listOfItemsToRemove", ["_doNotDropAmmo", false, [false]]]; //By default units drop all weapon mags when dropping a weapon _fncSumArray = { _return = 0; - {_return = _return + _x;} forEach (_this select 0); + {_return = _return + _x;} count (_this select 0); _return }; @@ -48,7 +47,7 @@ if (!_doNotDropAmmo) then { if ((_x getVariable [QGVAR(disarmUnit), objNull]) == _target) exitWith { _holder = _x; }; - } forEach ((getpos _target) nearObjects [DISARM_CONTAINER, 3]); + } count ((getpos _target) nearObjects [DISARM_CONTAINER, 3]); }; //Create a new weapon holder diff --git a/addons/disarming/functions/fnc_eventCallerFinish.sqf b/addons/disarming/functions/fnc_eventCallerFinish.sqf index d95be98d5f..e1376f4052 100644 --- a/addons/disarming/functions/fnc_eventCallerFinish.sqf +++ b/addons/disarming/functions/fnc_eventCallerFinish.sqf @@ -1,5 +1,6 @@ /* * Author: PabstMirror + * * Recieves a possible error code from FUNC(eventTargetFinish) * * Arguments: @@ -17,9 +18,9 @@ */ #include "script_component.hpp" -PARAMS_3(_caller,_target,_errorMsg); +params ["_caller", "_target", "_errorMsg"]; if (_caller != ACE_player) exitWith {}; systemChat format ["Debug-Caller: Disarm finished from [%1] with code [%2]", _target, _errorMsg]; -diag_log text format ["[ACE_Disarming] %1 - eventCallerFinish: %2", ACE_time, _this]; +ACE_LOGINFO_2("%1 - eventCallerFinish: %2",ACE_time,_this); diff --git a/addons/disarming/functions/fnc_eventTargetFinish.sqf b/addons/disarming/functions/fnc_eventTargetFinish.sqf index d702a554a5..b7364a8f40 100644 --- a/addons/disarming/functions/fnc_eventTargetFinish.sqf +++ b/addons/disarming/functions/fnc_eventTargetFinish.sqf @@ -1,5 +1,6 @@ /* * Author: PabstMirror + * * After FUNC(disarmDropItems) has completed, passing a possible error code. * Passes that error back to orginal caller. * @@ -18,9 +19,9 @@ */ #include "script_component.hpp" -PARAMS_3(_caller,_target,_errorMsg); +params ["_caller", "_target", "_errorMsg"]; if (_errorMsg != "") then { - diag_log text format ["[ACE_Disarming] %1 - eventTargetFinish: %2", ACE_time, _this]; + ACE_LOGINFO_2("%1 - eventTargetFinish: %2",ACE_time,_this); ["DisarmDebugCallback", [_caller], [_caller, _target, _errorMsg]] call EFUNC(common,targetEvent); }; diff --git a/addons/disarming/functions/fnc_eventTargetStart.sqf b/addons/disarming/functions/fnc_eventTargetStart.sqf index 316ec2b656..29c370f2b5 100644 --- a/addons/disarming/functions/fnc_eventTargetStart.sqf +++ b/addons/disarming/functions/fnc_eventTargetStart.sqf @@ -1,5 +1,6 @@ /* * Author: PabstMirror + * * Disarm Event Handler, Starting func, called on the target. * If target has to remove uniform/vest, this will add all uniform/vest items to the drop list. * @@ -18,7 +19,7 @@ */ #include "script_component.hpp" -PARAMS_3(_caller,_target,_listOfObjectsToRemove); +params ["_caller", "_target", "_listOfObjectsToRemove"]; private "_itemsToAdd"; diff --git a/addons/disarming/functions/fnc_getAllGearContainer.sqf b/addons/disarming/functions/fnc_getAllGearContainer.sqf index c5b2c445ab..0394761197 100644 --- a/addons/disarming/functions/fnc_getAllGearContainer.sqf +++ b/addons/disarming/functions/fnc_getAllGearContainer.sqf @@ -1,5 +1,6 @@ /* * Author: PabstMirror + * * Helper function to get all gear of a container * * Arguments: @@ -15,15 +16,16 @@ */ #include "script_component.hpp" -PARAMS_1(_target); +params ["_target"]; -private ["_allGear"]; - -_allGear = [[],[]]; +private ["_items", "_counts"]; +_items = []; +_counts = []; { - (_allGear select 0) append (_x select 0); - (_allGear select 1) append (_x select 1); + _x params ["_item", "_count"]; + _items append _item; + _counts append _count; } forEach [(getWeaponCargo _target), (getItemCargo _target), (getMagazineCargo _target), (getBackpackCargo _target)]; -_allGear +[_items,_counts] // Return diff --git a/addons/disarming/functions/fnc_getAllGearUnit.sqf b/addons/disarming/functions/fnc_getAllGearUnit.sqf index 99d4b2d7f2..bdd1ff0bf9 100644 --- a/addons/disarming/functions/fnc_getAllGearUnit.sqf +++ b/addons/disarming/functions/fnc_getAllGearUnit.sqf @@ -1,5 +1,6 @@ /* * Author: PabstMirror + * * Helper function to get all gear of a unit. * * Arguments: @@ -15,7 +16,7 @@ */ #include "script_component.hpp" -PARAMS_1(_target); +params ["_target"]; private ["_allItems", "_classnamesCount", "_index", "_uniqueClassnames"]; diff --git a/addons/disarming/functions/fnc_openDisarmDialog.sqf b/addons/disarming/functions/fnc_openDisarmDialog.sqf index 88e0e81be8..c2a3a6396e 100644 --- a/addons/disarming/functions/fnc_openDisarmDialog.sqf +++ b/addons/disarming/functions/fnc_openDisarmDialog.sqf @@ -1,5 +1,6 @@ /* * Author: PabstMirror + * * Opens the disarm dialog (allowing a person to remove items) * * Arguments: @@ -15,21 +16,9 @@ * Public: No */ #include "script_component.hpp" - -#define TEXTURES_RANKS [ \ - "", \ - "\A3\Ui_f\data\GUI\Cfg\Ranks\private_gs.paa", \ - "\A3\Ui_f\data\GUI\Cfg\Ranks\corporal_gs.paa", \ - "\A3\Ui_f\data\GUI\Cfg\Ranks\sergeant_gs.paa", \ - "\A3\Ui_f\data\GUI\Cfg\Ranks\lieutenant_gs.paa", \ - "\A3\Ui_f\data\GUI\Cfg\Ranks\captain_gs.paa", \ - "\A3\Ui_f\data\GUI\Cfg\Ranks\major_gs.paa", \ - "\A3\Ui_f\data\GUI\Cfg\Ranks\colonel_gs.paa" \ - ] - -PARAMS_2(_caller,_target); +params ["_caller", "_target"]; private "_display"; - +#define DEFUALTPATH "\A3\Ui_f\data\GUI\Cfg\Ranks\%1_gs.paa" //Sanity Checks if (_caller != ACE_player) exitwith {ERROR("Player isn't caller?");}; if (!([_player, _target] call FUNC(canPlayerDisarmUnit))) exitWith {ERROR("Can't Disarm Unit");}; @@ -47,8 +36,8 @@ GVAR(disarmTarget) = _target; //Setup Drop Event (on right pannel) (_display displayCtrl 632) ctrlAddEventHandler ["LBDrop", { if (isNull GVAR(disarmTarget)) exitWith {}; - PARAMS_5(_ctrl,_xPos,_yPos,_idc,_itemInfo); - EXPLODE_3_PVT((_itemInfo select 0),_displayText,_value,_data); + params ["_ctrl", "_xPos", "_yPos", "_idc", "_itemInfo"]; + (_itemInfo select 0) params ["_displayText", "_value", "_data"]; if (isNull GVAR(disarmTarget)) exitWith {ERROR("disarmTarget is null");}; @@ -60,18 +49,18 @@ GVAR(disarmTarget) = _target; //Setup PFEH [{ - private ["_groundContainer", "_targetContainer", "_playerName", "_rankPicture", "_rankIndex", "_targetUniqueItems", "_holderUniqueItems", "_holder"]; + private ["_groundContainer", "_targetContainer", "_playerName", "_icon", "_rankPicture", "_targetUniqueItems", "_holderUniqueItems", "_holder"]; disableSerialization; - EXPLODE_2_PVT(_this,_args,_pfID); - EXPLODE_3_PVT(_args,_player,_target,_display); + params ["_args", "_idPFH"]; + _args params ["_player", "_target", "_display"]; if ((!([_player, _target] call FUNC(canPlayerDisarmUnit))) || {isNull _display} || {_player != ACE_player}) then { - [_pfID] call CBA_fnc_removePerFrameHandler; + [_idPFH] call CBA_fnc_removePerFrameHandler; GVAR(disarmTarget) = objNull; - if (!isNull _display) then {closeDialog 0;}; //close dialog if still open + if (!isNull _display) then { closeDialog 0; }; //close dialog if still open } else { _groundContainer = _display displayCtrl 632; @@ -80,8 +69,9 @@ GVAR(disarmTarget) = _target; _rankPicture = _display displayCtrl 1203; //Show rank and name (just like BIS's inventory) - _rankIndex = ((["PRIVATE", "CORPORAL", "SERGEANT", "LIEUTENANT", "CAPTAIN", "MAJOR", "COLONEL"] find (rank _target)) + 1); - _rankPicture ctrlSetText (TEXTURES_RANKS select _rankIndex); + _icon = format [DEFUALTPATH, toLower (rank _target)]; + if (_icon isEqualTo DEFUALTPATH) then {_icon = ""}; + _rankPicture ctrlSetText _icon; _playerName ctrlSetText ([GVAR(disarmTarget)] call EFUNC(common,getName)); //Clear both inventory lists: @@ -98,7 +88,7 @@ GVAR(disarmTarget) = _target; if ((_x getVariable [QGVAR(disarmUnit), objNull]) == _target) exitWith { _holder = _x; }; - } forEach ((getpos _target) nearObjects [DISARM_CONTAINER, 3]); + } count ((getpos _target) nearObjects [DISARM_CONTAINER, 3]); //If a holder exists, show it's inventory if (!isNull _holder) then { diff --git a/addons/disarming/functions/fnc_showItemsInListbox.sqf b/addons/disarming/functions/fnc_showItemsInListbox.sqf index b36e53e820..f675012ee3 100644 --- a/addons/disarming/functions/fnc_showItemsInListbox.sqf +++ b/addons/disarming/functions/fnc_showItemsInListbox.sqf @@ -1,5 +1,6 @@ /* * Author: PabstMirror + * * Shows a list of inventory items in a listBox control. * * Arguments: @@ -17,11 +18,12 @@ #include "script_component.hpp" disableSerialization; -PARAMS_2(_listBoxCtrl,_itemsCountArray); - private ["_classname", "_count", "_displayName", "_picture"]; +params ["_listBoxCtrl", "_itemsCountArray"]; + { + private "_configPath"; _displayName = ""; _picture = ""; @@ -31,21 +33,25 @@ private ["_classname", "_count", "_displayName", "_picture"]; if ((_classname != DUMMY_ITEM) && {_classname != "ACE_FakePrimaryWeapon"}) then { //Don't show the dummy potato or fake weapon switch (true) do { - case (isClass (configFile >> "CfgWeapons" >> _classname)): { - _displayName = getText (configFile >> "CfgWeapons" >> _classname >> "displayName"); - _picture = getText (configFile >> "CfgWeapons" >> _classname >> "picture"); + case (isClass (configFile >> "CfgWeapons" >> _classname)): { + _configPath = (configFile >> "CfgWeapons"); + _displayName = getText (_configPath >> _classname >> "displayName"); + _picture = getText (_configPath >> _classname >> "picture"); }; - case (isClass (configFile >> "CfgMagazines" >> _classname)): { - _displayName = getText (configFile >> "CfgMagazines" >> _classname >> "displayName"); - _picture = getText (configFile >> "CfgMagazines" >> _classname >> "picture"); + case (isClass (configFile >> "CfgMagazines" >> _classname)): { + _configPath = (configFile >> "CfgMagazines"); + _displayName = getText (_configPath >> _classname >> "displayName"); + _picture = getText (_configPath >> _classname >> "picture"); }; - case (isClass (configFile >> "CfgVehicles" >> _classname)): { - _displayName = getText (configFile >> "CfgVehicles" >> _classname >> "displayName"); - _picture = getText (configFile >> "CfgVehicles" >> _classname >> "picture"); + case (isClass (configFile >> "CfgVehicles" >> _classname)): { + _configPath = (configFile >> "CfgVehicles"); + _displayName = getText (_configPath >> _classname >> "displayName"); + _picture = getText (_configPath >> _classname >> "picture"); }; - case (isClass (configFile >> "CfgGlasses" >> _classname)): { - _displayName = getText (configFile >> "CfgGlasses" >> _classname >> "displayName"); - _picture = getText (configFile >> "CfgGlasses" >> _classname >> "picture"); + case (isClass (configFile >> "CfgGlasses" >> _classname)): { + _configPath = (configFile >> "CfgGlasses"); + _displayName = getText (_configPath >> _classname >> "displayName"); + _picture = getText (_configPath >> _classname >> "picture"); }; default { ERROR(format ["[%1] - bad classname", _classname]); diff --git a/addons/disarming/functions/fnc_verifyMagazinesMoved.sqf b/addons/disarming/functions/fnc_verifyMagazinesMoved.sqf index e1753f390a..efe5aae72a 100644 --- a/addons/disarming/functions/fnc_verifyMagazinesMoved.sqf +++ b/addons/disarming/functions/fnc_verifyMagazinesMoved.sqf @@ -1,5 +1,6 @@ /* * Author: PabstMirror + * * Verifies magazines moved with exact ammo counts preserved. * Arrays will be in format from magazinesAmmo/magazinesAmmoCargo * e.g.: [["30Rnd_65x39_caseless_mag",15], ["30Rnd_65x39_caseless_mag",30]] diff --git a/addons/disarming/stringtable.xml b/addons/disarming/stringtable.xml index e43624f96d..61eaf9af59 100644 --- a/addons/disarming/stringtable.xml +++ b/addons/disarming/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -14,4 +14,4 @@ Abrir inventário - \ No newline at end of file + diff --git a/addons/disposable/CfgEventHandlers.hpp b/addons/disposable/CfgEventHandlers.hpp index e4e4abffd8..98fec255c2 100644 --- a/addons/disposable/CfgEventHandlers.hpp +++ b/addons/disposable/CfgEventHandlers.hpp @@ -22,7 +22,7 @@ class Extended_FiredBIS_EventHandlers { class Extended_InitPost_EventHandlers { class CAManBase { class ADDON { - init = QUOTE([ARR_2(_this select 0, secondaryWeapon (_this select 0))] call FUNC(takeLoadedATWeapon)); + init = QUOTE([_this select 0] call FUNC(takeLoadedATWeapon)); }; }; }; diff --git a/addons/disposable/CfgMagazines.hpp b/addons/disposable/CfgMagazines.hpp index 484fa36238..d26d5ecea2 100644 --- a/addons/disposable/CfgMagazines.hpp +++ b/addons/disposable/CfgMagazines.hpp @@ -1,6 +1,6 @@ class CfgMagazines { class NLAW_F; - class ACE_PreloadedMissileDummy: NLAW_F { // The dummy magazine + class ACE_PreloadedMissileDummy: NLAW_F { // The dummy magazine author = ECSTRING(common,ACETeam); scope = 1; scopeArsenal = 1; @@ -12,14 +12,4 @@ class CfgMagazines { class ACE_FiredMissileDummy: ACE_PreloadedMissileDummy { count = 0; }; - class ACE_UsedTube_F: NLAW_F { - author = ECSTRING(common,ACETeam); - displayName = CSTRING(UsedTube); - descriptionShort = CSTRING(UsedTubeDescription); - displayNameShort = "-"; - count = 0; - weaponPoolAvailable = 0; - modelSpecial = ""; - mass = 0; - }; }; diff --git a/addons/disposable/CfgVehicles.hpp b/addons/disposable/CfgVehicles.hpp index 13d4cedf4b..0ad3ff51c0 100644 --- a/addons/disposable/CfgVehicles.hpp +++ b/addons/disposable/CfgVehicles.hpp @@ -1,5 +1,5 @@ class CfgVehicles { -#define MACRO_NONLAW \ + #define MACRO_NONLAW \ class TransportMagazines { \ class _xx_NLAW_F { \ count = 0; \ @@ -73,56 +73,56 @@ class CfgVehicles { MACRO_NONLAW }; /*class B_APC_Tracked_01_base_F: APC_Tracked_01_base_F { - MACRO_NONLAW -}; -class B_APC_Tracked_01_rcws_F: B_APC_Tracked_01_base_F { - MACRO_NONLAW -}; -class B_APC_Tracked_01_CRV_F: B_APC_Tracked_01_base_F { - MACRO_NONLAW -}; -class B_APC_Tracked_01_AA_F: B_APC_Tracked_01_base_F { - MACRO_NONLAW -};*/ + MACRO_NONLAW + }; + class B_APC_Tracked_01_rcws_F: B_APC_Tracked_01_base_F { + MACRO_NONLAW + }; + class B_APC_Tracked_01_CRV_F: B_APC_Tracked_01_base_F { + MACRO_NONLAW + }; + class B_APC_Tracked_01_AA_F: B_APC_Tracked_01_base_F { + MACRO_NONLAW + };*/ class Car_F; class MRAP_01_base_F: Car_F { MACRO_NONLAW }; /*class MRAP_01_gmg_base_F: MRAP_01_base_F { - MACRO_NONLAW -}; -class MRAP_01_hmg_base_F: MRAP_01_gmg_base_F { - MACRO_NONLAW -}; -class B_MRAP_01_F: MRAP_01_base_F { - MACRO_NONLAW -}; -class B_MRAP_01_gmg_F: MRAP_01_gmg_base_F { - MACRO_NONLAW -}; -class B_MRAP_01_hmg_F: MRAP_01_hmg_base_F { - MACRO_NONLAW -};*/ + MACRO_NONLAW + }; + class MRAP_01_hmg_base_F: MRAP_01_gmg_base_F { + MACRO_NONLAW + }; + class B_MRAP_01_F: MRAP_01_base_F { + MACRO_NONLAW + }; + class B_MRAP_01_gmg_F: MRAP_01_gmg_base_F { + MACRO_NONLAW + }; + class B_MRAP_01_hmg_F: MRAP_01_hmg_base_F { + MACRO_NONLAW + };*/ class MRAP_03_base_F: Car_F { MACRO_NONLAW }; /*class MRAP_03_hmg_base_F: MRAP_03_base_F { - MACRO_NONLAW -}; -class MRAP_03_gmg_base_F: MRAP_03_hmg_base_F { - MACRO_NONLAW -}; -class I_MRAP_03_F: MRAP_03_base_F { - MACRO_NONLAW -}; -class I_MRAP_03_hmg_F: MRAP_03_hmg_base_F { - MACRO_NONLAW -}; -class I_MRAP_03_gmg_F: MRAP_03_gmg_base_F { - MACRO_NONLAW -};*/ + MACRO_NONLAW + }; + class MRAP_03_gmg_base_F: MRAP_03_hmg_base_F { + MACRO_NONLAW + }; + class I_MRAP_03_F: MRAP_03_base_F { + MACRO_NONLAW + }; + class I_MRAP_03_hmg_F: MRAP_03_hmg_base_F { + MACRO_NONLAW + }; + class I_MRAP_03_gmg_F: MRAP_03_gmg_base_F { + MACRO_NONLAW + };*/ class Wheeled_APC_F: Car_F {}; class APC_Wheeled_03_base_F: Wheeled_APC_F { @@ -132,15 +132,15 @@ class I_MRAP_03_gmg_F: MRAP_03_gmg_base_F { MACRO_NONLAW }; /*class B_APC_Wheeled_01_base_F: APC_Wheeled_01_base_F { - MACRO_NONLAW -}; -class B_APC_Wheeled_01_cannon_F: B_APC_Wheeled_01_base_F { - MACRO_NONLAW -}; -class I_APC_Wheeled_03_base_F: APC_Wheeled_03_base_F { - MACRO_NONLAW -}; -class I_APC_Wheeled_03_cannon_F: I_APC_Wheeled_03_base_F { - MACRO_NONLAW -};*/ + MACRO_NONLAW + }; + class B_APC_Wheeled_01_cannon_F: B_APC_Wheeled_01_base_F { + MACRO_NONLAW + }; + class I_APC_Wheeled_03_base_F: APC_Wheeled_03_base_F { + MACRO_NONLAW + }; + class I_APC_Wheeled_03_cannon_F: I_APC_Wheeled_03_base_F { + MACRO_NONLAW + };*/ }; diff --git a/addons/disposable/README.md b/addons/disposable/README.md index 73418cd49d..82281a3c52 100644 --- a/addons/disposable/README.md +++ b/addons/disposable/README.md @@ -1,7 +1,7 @@ ace_disposable ============== -Makes the NLAW a disposable one-shot weapon. +Makes the NLAW a disposable one-shot weapon and provides disposable launchers framework for use by other mods. ## Maintainers diff --git a/addons/disposable/XEH_postInit.sqf b/addons/disposable/XEH_postInit.sqf index 2f3b936692..800d749d06 100644 --- a/addons/disposable/XEH_postInit.sqf +++ b/addons/disposable/XEH_postInit.sqf @@ -3,9 +3,12 @@ if (!hasInterface) exitWith {}; -["inventoryDisplayLoaded", {[ACE_player, _this select 0] call FUNC(updateInventoryDisplay)}] call EFUNC(common,addEventHandler); +["inventoryDisplayLoaded", { + [ACE_player, _this select 0] call FUNC(updateInventoryDisplay) +}] call EFUNC(common,addEventHandler); + ["playerInventoryChanged", { - params ["_unit", "_items"]; - [_unit, _items select 11] call FUNC(takeLoadedATWeapon); + params ["_unit"]; + [_unit] call FUNC(takeLoadedATWeapon); [_unit] call FUNC(updateInventoryDisplay); }] call EFUNC(common,addEventHandler); diff --git a/addons/disposable/XEH_postInitClient.sqf b/addons/disposable/XEH_postInitClient.sqf deleted file mode 100644 index c20dfa886b..0000000000 --- a/addons/disposable/XEH_postInitClient.sqf +++ /dev/null @@ -1,10 +0,0 @@ -// by commy2 - -// The Arma InventoryOpened EH fires actually before the inventory dialog is opened (findDisplay 602 => displayNull). - -#include "script_component.hpp" - -["inventoryDisplayLoaded",{ - [ACE_player] call FUNC(takeLoadedATWeapon); - [ACE_player, (_this select 0)] call FUNC(updateInventoryDisplay); -}] call EFUNC(common,addEventHandler); \ No newline at end of file diff --git a/addons/disposable/functions/fnc_replaceATWeapon.sqf b/addons/disposable/functions/fnc_replaceATWeapon.sqf index c3b506e0dc..ec56f42ff4 100644 --- a/addons/disposable/functions/fnc_replaceATWeapon.sqf +++ b/addons/disposable/functions/fnc_replaceATWeapon.sqf @@ -21,14 +21,14 @@ */ #include "script_component.hpp" -private ["_replacementTube", "_items"]; params ["_unit", "_weapon", "", "", "", "", "_projectile"]; +TRACE_3("params",_unit,_weapon,_projectile); -if (!local _unit) exitWith {}; +if ((!local _unit) || {_weapon != (secondaryWeapon _unit)}) exitWith {}; +private ["_replacementTube", "_items"]; _replacementTube = getText (configFile >> "CfgWeapons" >> _weapon >> "ACE_UsedTube"); if (_replacementTube == "") exitWith {}; //If no replacement defined just exit -if (_weapon != (secondaryWeapon _unit)) exitWith {}; //just to be sure //Save array of items attached to launcher diff --git a/addons/disposable/functions/fnc_takeLoadedATWeapon.sqf b/addons/disposable/functions/fnc_takeLoadedATWeapon.sqf index d747b77cb1..c371c8d5a5 100644 --- a/addons/disposable/functions/fnc_takeLoadedATWeapon.sqf +++ b/addons/disposable/functions/fnc_takeLoadedATWeapon.sqf @@ -15,17 +15,18 @@ */ #include "script_component.hpp" -private ["_unit", "_launcher", "_config"]; - params ["_unit"]; +TRACE_1("params",_unit); if (!local _unit) exitWith {}; +private ["_launcher", "_config"]; + _launcher = secondaryWeapon _unit; _config = configFile >> "CfgWeapons" >> _launcher; if (isClass _config && {getText (_config >> "ACE_UsedTube") != ""} && {getNumber (_config >> "ACE_isUsedLauncher") != 1} && {count secondaryWeaponMagazine _unit == 0}) then { - private ["_magazine", "_isLauncherSelected"]; + private ["_magazine", "_isLauncherSelected", "_didAdd"]; _magazine = getArray (_config >> "magazines") select 0; @@ -34,15 +35,25 @@ if (isClass _config && {getText (_config >> "ACE_UsedTube") != ""} && {getNumber _unit removeMagazines _magazine; if (backpack _unit == "") then { - _unit addBackpack "Bag_Base"; - + _unit addBackpack "ACE_FakeBackpack"; + _unit removeWeapon _launcher; _unit addMagazine _magazine; + _didAdd = _magazine in (magazines _unit); _unit addWeapon _launcher; - + if (!_didAdd) then { + TRACE_1("Failed To Add Disposable Magazine Normally, doing backup method (no backpack)",_unit); + _unit addSecondaryWeaponItem _magazine; + }; removeBackpack _unit; } else { + _unit removeWeapon _launcher; _unit addMagazine _magazine; + _didAdd = _magazine in (magazines _unit); _unit addWeapon _launcher; + if (!_didAdd) then { + TRACE_2("Failed To Add Disposable Magazine Normally, doing backup method",_unit,(backpack _unit)); + _unit addSecondaryWeaponItem _magazine; + }; }; if (_isLauncherSelected) then { diff --git a/addons/disposable/functions/fnc_updateInventoryDisplay.sqf b/addons/disposable/functions/fnc_updateInventoryDisplay.sqf index 93b57308e8..7f50e45089 100644 --- a/addons/disposable/functions/fnc_updateInventoryDisplay.sqf +++ b/addons/disposable/functions/fnc_updateInventoryDisplay.sqf @@ -17,6 +17,7 @@ disableSerialization; params ["_player", ["_display",(findDisplay 602),[displayNull]]]; +TRACE_2("params",_player,_display); _player removeMagazines "ACE_PreloadedMissileDummy"; _player removeMagazines "ACE_FiredMissileDummy"; diff --git a/addons/disposable/script_component.hpp b/addons/disposable/script_component.hpp index af1f17bd86..12a05ea60d 100644 --- a/addons/disposable/script_component.hpp +++ b/addons/disposable/script_component.hpp @@ -1,6 +1,8 @@ #define COMPONENT disposable #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL + #ifdef DEBUG_ENABLED_ATTACH #define DEBUG_MODE_FULL #endif diff --git a/addons/disposable/stringtable.xml b/addons/disposable/stringtable.xml index 2cbd8b0012..2c6f0b0afd 100644 --- a/addons/disposable/stringtable.xml +++ b/addons/disposable/stringtable.xml @@ -1,4 +1,4 @@ - + diff --git a/addons/dragging/CfgEventHandlers.hpp b/addons/dragging/CfgEventHandlers.hpp index e5c454e969..7276bc4284 100644 --- a/addons/dragging/CfgEventHandlers.hpp +++ b/addons/dragging/CfgEventHandlers.hpp @@ -7,8 +7,7 @@ class Extended_PreInit_EventHandlers { class Extended_PostInit_EventHandlers { class ADDON { - clientInit = QUOTE(call COMPILE_FILE(XEH_clientInit)); - serverInit = QUOTE(call COMPILE_FILE(XEH_serverInit)); + init = QUOTE(call COMPILE_FILE(XEH_postInit)); }; }; @@ -28,6 +27,11 @@ class Extended_Init_EventHandlers { init = QUOTE(_this call DFUNC(initObject)); }; }; + class ACE_RepairItem_Base { + class ADDON { + init = QUOTE(_this call DFUNC(initObject)); + }; + }; }; class Extended_Killed_EventHandlers { diff --git a/addons/dragging/CfgVehicles.hpp b/addons/dragging/CfgVehicles.hpp index 5ac84b7038..d4d791724b 100644 --- a/addons/dragging/CfgVehicles.hpp +++ b/addons/dragging/CfgVehicles.hpp @@ -83,4 +83,18 @@ class CfgVehicles { GVAR(canCarry) = 0; GVAR(canDrag) = 0; }; + + class ACE_RepairItem_Base: ThingX {}; + + class ACE_Track: ACE_RepairItem_Base { + GVAR(canCarry) = 1; + GVAR(carryPosition[]) = {0,1,1}; + GVAR(carryDirection) = 0; + }; + + class ACE_Wheel: ACE_RepairItem_Base { + GVAR(canCarry) = 1; + GVAR(carryPosition[]) = {0,1,1}; + GVAR(carryDirection) = 0; + }; }; diff --git a/addons/protection/README.md b/addons/dragging/README.md similarity index 57% rename from addons/protection/README.md rename to addons/dragging/README.md index a6def1a1bc..b69484eccf 100644 --- a/addons/protection/README.md +++ b/addons/dragging/README.md @@ -1,12 +1,12 @@ -ace_protection +ace_dragging ============== -Fixes and tweaks the protection values of body armour. +Adds ability to drag and carry objects. ## Maintainers The people responsible for merging changes to this component or answering potential questions. -- [KoffeinFlummi](https://github.com/KoffeinFlummi) +- [Garth "L-H" de Wet](https://github.com/CorruptedHeart) - [commy2](https://github.com/commy2) diff --git a/addons/dragging/XEH_clientInit.sqf b/addons/dragging/XEH_clientInit.sqf deleted file mode 100644 index 21d699c688..0000000000 --- a/addons/dragging/XEH_clientInit.sqf +++ /dev/null @@ -1,25 +0,0 @@ -// by PabstMirror, commy2 -#include "script_component.hpp" - -[{_this call DFUNC(handleScrollWheel)}] call EFUNC(common,addScrollWheelEventHandler); - -if (isNil "ACE_maxWeightDrag") then { - ACE_maxWeightDrag = 800; -}; - -if (isNil "ACE_maxWeightCarry") then { - ACE_maxWeightCarry = 600; -}; - -["isNotDragging", {!((_this select 0) getVariable [QGVAR(isDragging), false])}] call EFUNC(common,addCanInteractWithCondition); -["isNotCarrying", {!((_this select 0) getVariable [QGVAR(isCarrying), false])}] call EFUNC(common,addCanInteractWithCondition); - -// release object on player change. This does work when returning to lobby, but not when hard disconnecting. -["playerChanged", {_this call DFUNC(handlePlayerChanged)}] call EFUNC(common,addEventhandler); -["playerVehicleChanged", {[ACE_player, objNull] call DFUNC(handlePlayerChanged)}] call EFUNC(common,addEventhandler); -["playerWeaponChanged", {_this call DFUNC(handlePlayerWeaponChanged)}] call EFUNC(common,addEventhandler); - -// handle waking up dragged unit and falling unconscious while dragging -["medical_onUnconscious", {_this call DFUNC(handleUnconscious)}] call EFUNC(common,addEventhandler); - -//@todo Captivity? diff --git a/addons/dragging/XEH_postInit.sqf b/addons/dragging/XEH_postInit.sqf new file mode 100644 index 0000000000..5a54f8c8a2 --- /dev/null +++ b/addons/dragging/XEH_postInit.sqf @@ -0,0 +1,32 @@ +// by PabstMirror, commy2 +#include "script_component.hpp" + +if (isServer) then { + // release object on hard disconnection. Function is identical to killed + addMissionEventHandler ["HandleDisconnect", {_this call FUNC(handleKilled)}]; +}; + +if (!hasInterface) exitWith {}; + +[{_this call FUNC(handleScrollWheel)}] call EFUNC(common,addScrollWheelEventHandler); + +if (isNil "ACE_maxWeightDrag") then { + ACE_maxWeightDrag = 800; +}; + +if (isNil "ACE_maxWeightCarry") then { + ACE_maxWeightCarry = 600; +}; + +["isNotDragging", {!((_this select 0) getVariable [QGVAR(isDragging), false])}] call EFUNC(common,addCanInteractWithCondition); +["isNotCarrying", {!((_this select 0) getVariable [QGVAR(isCarrying), false])}] call EFUNC(common,addCanInteractWithCondition); + +// release object on player change. This does work when returning to lobby, but not when hard disconnecting. +["playerChanged", {_this call FUNC(handlePlayerChanged)}] call EFUNC(common,addEventhandler); +["playerVehicleChanged", {[ACE_player, objNull] call FUNC(handlePlayerChanged)}] call EFUNC(common,addEventhandler); +["playerWeaponChanged", {_this call FUNC(handlePlayerWeaponChanged)}] call EFUNC(common,addEventhandler); + +// handle waking up dragged unit and falling unconscious while dragging +["medical_onUnconscious", {_this call FUNC(handleUnconscious)}] call EFUNC(common,addEventhandler); + +//@todo Captivity? diff --git a/addons/dragging/XEH_serverInit.sqf b/addons/dragging/XEH_serverInit.sqf deleted file mode 100644 index f6c231d275..0000000000 --- a/addons/dragging/XEH_serverInit.sqf +++ /dev/null @@ -1,5 +0,0 @@ -// by commy2 -#include "script_component.hpp" - -// release object on hard disconnection. Function is identical to killed -addMissionEventHandler ["HandleDisconnect", {_this call DFUNC(handleKilled)}]; diff --git a/addons/dragging/config.cpp b/addons/dragging/config.cpp index cc843d4a68..0c9cfb3c43 100644 --- a/addons/dragging/config.cpp +++ b/addons/dragging/config.cpp @@ -6,7 +6,7 @@ class CfgPatches { weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_interaction"}; - author[] = {"Garth 'L-H' de Wet","commy2"}; + author[] = {"Garth 'L-H' de Wet", "commy2"}; authorUrl = "https://github.com/commy2/"; VERSION_CONFIG; }; diff --git a/addons/dragging/functions/fnc_canCarry.sqf b/addons/dragging/functions/fnc_canCarry.sqf index 6472124aef..6ee28edff3 100644 --- a/addons/dragging/functions/fnc_canCarry.sqf +++ b/addons/dragging/functions/fnc_canCarry.sqf @@ -3,23 +3,22 @@ * * Check if unit can carry the object. Doesn't check weight. * - * Argument: - * 0: Unit that should do the carrying (Object) - * 1: Object to carry (Object) + * Arguments: + * 0: Unit that should do the carrying + * 1: Object to carry * - * Return value: - * Can the unit carry the object? (Bool) + * Return Value: + * Can the unit carry the object? + * + * Public: No */ #include "script_component.hpp" -private ["_unit", "_target"]; - -_unit = _this select 0; -_target = _this select 1; +params ["_unit", "_target"]; if !([_unit, _target, []] call EFUNC(common,canInteractWith)) exitWith {false}; -// a static weapon has to be empty for dragging -if ((typeOf _target) isKindOf "StaticWeapon" && {count crew _target > 0}) exitWith {false}; +// a static weapon has to be empty for dragging (ignore UAV AI) +if (((typeOf _target) isKindOf "StaticWeapon") && {{(getText (configFile >> "CfgVehicles" >> (typeOf _x) >> "simulation")) != "UAVPilot"} count crew _target > 0}) exitWith {false}; alive _target && {vehicle _target == _target} && {_target getVariable [QGVAR(canCarry), false]} && {animationState _target in ["", "unconscious"] || (_target getvariable ["ACE_isUnconscious", false]) || (_target isKindOf "CAManBase" && {(_target getHitPointDamage "HitLegs") > 0.4})} diff --git a/addons/dragging/functions/fnc_canDrag.sqf b/addons/dragging/functions/fnc_canDrag.sqf index 7eedfce179..58c4718407 100644 --- a/addons/dragging/functions/fnc_canDrag.sqf +++ b/addons/dragging/functions/fnc_canDrag.sqf @@ -3,12 +3,14 @@ * * Check if unit can drag the object. Doesn't check weight. * - * Argument: - * 0: Unit that should do the dragging (Object) - * 1: Object to drag (Object) + * Arguments: + * 0: Unit that should do the dragging + * 1: Object to drag * - * Return value: - * Can the unit drag the object? (Bool) + * Return Value: + * Can the unit drag the object? + * + * Public: No */ #include "script_component.hpp" @@ -19,7 +21,7 @@ _target = _this select 1; if !([_unit, _target, []] call EFUNC(common,canInteractWith)) exitWith {false}; -// a static weapon has to be empty for dragging -if ((typeOf _target) isKindOf "StaticWeapon" && {count crew _target > 0}) exitWith {false}; +// a static weapon has to be empty for dragging (ignore UAV AI) +if ((typeOf _target) isKindOf "StaticWeapon" && {{(getText (configFile >> "CfgVehicles" >> (typeOf _x) >> "simulation")) != "UAVPilot"} count crew _target > 0}) exitWith {false}; -alive _target && {vehicle _target == _target} && {_target getVariable [QGVAR(canDrag), false]} && {animationState _target in ["", "unconscious"] || (_target getvariable ["ACE_isUnconscious", false]) || (_target isKindOf "CAManBase" && {(_target getHitPointDamage "HitLegs") > 0.4})}; \ No newline at end of file +alive _target && {vehicle _target == _target} && {_target getVariable [QGVAR(canDrag), false]} && {animationState _target in ["", "unconscious"] || (_target getvariable ["ACE_isUnconscious", false]) || (_target isKindOf "CAManBase" && {(_target getHitPointDamage "HitLegs") > 0.4})}; diff --git a/addons/dragging/functions/fnc_canDrop.sqf b/addons/dragging/functions/fnc_canDrop.sqf index df75b9540f..58c02cab07 100644 --- a/addons/dragging/functions/fnc_canDrop.sqf +++ b/addons/dragging/functions/fnc_canDrop.sqf @@ -3,19 +3,18 @@ * * Check if unit can drop the object. * - * Argument: - * 0: Unit that currently drags a object (Object) - * 1: Object that is dragged (Object) + * Arguments: + * 0: Unit that currently drags a object + * 1: Object that is dragged * - * Return value: - * Can the unit drop the object? (Bool) + * Return Value: + * Can the unit drop the object? + * + * Public: No */ #include "script_component.hpp" -private ["_unit", "_target"]; - -_unit = _this select 0; -_target = _this select 1; +params ["_unit", "_target"]; if !([_unit, _target, ["isNotDragging"]] call EFUNC(common,canInteractWith)) exitWith {false}; diff --git a/addons/dragging/functions/fnc_canDrop_carry.sqf b/addons/dragging/functions/fnc_canDrop_carry.sqf index 9efbbe9b0f..430b12c642 100644 --- a/addons/dragging/functions/fnc_canDrop_carry.sqf +++ b/addons/dragging/functions/fnc_canDrop_carry.sqf @@ -3,19 +3,18 @@ * * Check if unit can drop the carried object. * - * Argument: - * 0: Unit that currently carries a object (Object) - * 1: Object that is carried (Object) + * Arguments: + * 0: Unit that currently carries a object + * 1: Object that is carried * - * Return value: - * Can the unit drop the object? (Bool) + * Return Value: + * Can the unit drop the object? + * + * Public: No */ #include "script_component.hpp" -private ["_unit", "_target"]; - -_unit = _this select 0; -_target = _this select 1; +params ["_unit", "_target"]; if !([_unit, _target, ["isNotCarrying"]] call EFUNC(common,canInteractWith)) exitWith {false}; diff --git a/addons/dragging/functions/fnc_carryObject.sqf b/addons/dragging/functions/fnc_carryObject.sqf index bb413d8240..8bea72b907 100644 --- a/addons/dragging/functions/fnc_carryObject.sqf +++ b/addons/dragging/functions/fnc_carryObject.sqf @@ -3,22 +3,21 @@ * * Carry an object. * - * Argument: - * 0: Unit that should do the carrying (Object) - * 1: Object to carry (Object) + * Arguments: + * 0: Unit that should do the carrying + * 1: Object to carry * - * Return value: - * NONE. + * Return Value: + * None + * + * Public: No */ #include "script_component.hpp" -private ["_unit", "_target"]; - -_unit = _this select 0; -_target = _this select 1; +params ["_unit", "_target"]; // get attachTo offset and direction. -private ["_position", "_direction"]; +private ["_position", "_direction", "_UAVCrew"]; _position = _target getVariable [QGVAR(carryPosition), [0, 0, 0]]; _direction = _target getVariable [QGVAR(carryDirection), 0]; @@ -49,29 +48,26 @@ if (_target isKindOf "CAManBase") then { _unit setVariable [QGVAR(isCarrying), true, true]; _unit setVariable [QGVAR(carriedObject), _target, true]; -// add scrollwheel action to release object -private "_actionID"; -_actionID = _unit getVariable [QGVAR(ReleaseActionID), -1]; +// add drop action +_unit setVariable [QGVAR(ReleaseActionID), [ + _unit, "DefaultAction", + {!isNull ((_this select 0) getVariable [QGVAR(carriedObject), objNull])}, + {[_this select 0, (_this select 0) getVariable [QGVAR(carriedObject), objNull]] call FUNC(dropObject_carry)} +] call EFUNC(common,addActionEventHandler)]; -if (_actionID != -1) then { - _unit removeAction _actionID; -}; - -_actionID = _unit addAction [ - format ["%1", localize LSTRING(Drop)], - QUOTE([ARR_2(_this select 0, (_this select 0) getVariable [ARR_2(QUOTE(QGVAR(carriedObject)),objNull)])] call FUNC(dropObject_carry)), - nil, - 20, - false, - true, - "", - QUOTE(!isNull (_this getVariable [ARR_2(QUOTE(QGVAR(carriedObject)),objNull)])) -]; - -_unit setVariable [QGVAR(ReleaseActionID), _actionID]; +// show mouse hint +[localize LSTRING(Drop), "", localize LSTRING(LowerRaise)] call EFUNC(interaction,showMouseHint); // check everything [FUNC(carryObjectPFH), 0.5, [_unit, _target]] call CBA_fnc_addPerFrameHandler; // reset current dragging height. GVAR(currentHeightChange) = 0; + +// prevent UAVs from firing +_UAVCrew = _target call EFUNC(common,getVehicleUAVCrew); + +if !(_UAVCrew isEqualTo []) then { + {_target deleteVehicleCrew _x} count _UAVCrew; + _target setVariable [QGVAR(isUAV), true, true]; +}; diff --git a/addons/dragging/functions/fnc_carryObjectPFH.sqf b/addons/dragging/functions/fnc_carryObjectPFH.sqf index 3ad1f89f77..b50383707a 100644 --- a/addons/dragging/functions/fnc_carryObjectPFH.sqf +++ b/addons/dragging/functions/fnc_carryObjectPFH.sqf @@ -1,21 +1,31 @@ -// by commy2 +/* + * Author: commy2 + * + * PFH for Carry Object + * + * Arguments: + * ? + * + * Return Value: + * None + * + * Public: No + */ #include "script_component.hpp" #ifdef DEBUG_ENABLED_DRAGGING systemChat format ["%1 carryObjectPFH running", ACE_time]; #endif -private ["_unit", "_target"]; - -_unit = _this select 0 select 0; -_target = _this select 0 select 1; +params ["_args", "_idPFH"]; +_args params ["_unit","_target"]; if !(_unit getVariable [QGVAR(isCarrying), false]) exitWith { - [_this select 1] call CBA_fnc_removePerFrameHandler; + [_idPFH] call CBA_fnc_removePerFrameHandler; }; // drop if the crate is destroyed OR (target moved away from carrier (weapon disasembled)) -if ((!([_target] call EFUNC(common,isAlive))) || {(_unit distance _target) > 10}) then { +if (!alive _target || {_unit distance _target > 10}) then { [_unit, _target] call FUNC(dropObject_carry); - [_this select 1] call CBA_fnc_removePerFrameHandler; + [_idPFH] call CBA_fnc_removePerFrameHandler; }; diff --git a/addons/dragging/functions/fnc_dragObject.sqf b/addons/dragging/functions/fnc_dragObject.sqf index e4b200c4dd..17fbc60c06 100644 --- a/addons/dragging/functions/fnc_dragObject.sqf +++ b/addons/dragging/functions/fnc_dragObject.sqf @@ -3,28 +3,26 @@ * * Drag an object. Called from ace_dragging_fnc_startDrag * - * Argument: - * 0: Unit that should do the dragging (Object) - * 1: Object to drag (Object) + * Arguments: + * 0: Unit that should do the dragging + * 1: Object to drag * - * Return value: - * NONE. + * Return Value: + * None + * + * Public: No */ #include "script_component.hpp" -private ["_unit", "_target"]; +params ["_unit", "_target"]; -_unit = _this select 0; -_target = _this select 1; +private ["_position", "_direction", "_offset", "_UAVCrew"]; // get attachTo offset and direction. -private ["_position", "_direction"]; - _position = _target getVariable [QGVAR(dragPosition), [0, 0, 0]]; _direction = _target getVariable [QGVAR(dragDirection), 0]; // add height offset of model -private "_offset"; _offset = (_target modelToWorldVisual [0, 0, 0] select 2) - (_unit modelToWorldVisual [0, 0, 0] select 2); _position = _position vectorAdd [0, 0, _offset]; @@ -40,29 +38,26 @@ if (_target isKindOf "CAManBase") then { _unit setVariable [QGVAR(isDragging), true, true]; _unit setVariable [QGVAR(draggedObject), _target, true]; -// add scrollwheel action to release object -private "_actionID"; -_actionID = _unit getVariable [QGVAR(ReleaseActionID), -1]; +// add drop action +_unit setVariable [QGVAR(ReleaseActionID), [ + _unit, "DefaultAction", + {!isNull ((_this select 0) getVariable [QGVAR(draggedObject), objNull])}, + {[_this select 0, (_this select 0) getVariable [QGVAR(draggedObject), objNull]] call FUNC(dropObject)} +] call EFUNC(common,addActionEventHandler)]; -if (_actionID != -1) then { - _unit removeAction _actionID; -}; - -_actionID = _unit addAction [ - format ["%1", localize LSTRING(Drop)], - QUOTE([ARR_2(_this select 0, (_this select 0) getVariable [ARR_2(QUOTE(QGVAR(draggedObject)),objNull)])] call FUNC(dropObject)), - nil, - 20, - false, - true, - "", - QUOTE(!isNull (_this getVariable [ARR_2(QUOTE(QGVAR(draggedObject)),objNull)])) -]; - -_unit setVariable [QGVAR(ReleaseActionID), _actionID]; +// show mouse hint +[localize LSTRING(Drop), ""] call EFUNC(interaction,showMouseHint); // check everything [FUNC(dragObjectPFH), 0.5, [_unit, _target]] call CBA_fnc_addPerFrameHandler; // reset current dragging height. GVAR(currentHeightChange) = 0; + +// prevent UAVs from firing +_UAVCrew = _target call EFUNC(common,getVehicleUAVCrew); + +if !(_UAVCrew isEqualTo []) then { + {_target deleteVehicleCrew _x} count _UAVCrew; + _target setVariable [QGVAR(isUAV), true, true]; +}; diff --git a/addons/dragging/functions/fnc_dragObjectPFH.sqf b/addons/dragging/functions/fnc_dragObjectPFH.sqf index 465107af39..f6ff252886 100644 --- a/addons/dragging/functions/fnc_dragObjectPFH.sqf +++ b/addons/dragging/functions/fnc_dragObjectPFH.sqf @@ -1,21 +1,31 @@ -// by commy2 +/* + * Author: commy2 + * + * PFH for Drag Object + * + * Arguments: + * ? + * + * Return Value: + * None + * + * Public: No + */ #include "script_component.hpp" #ifdef DEBUG_ENABLED_DRAGGING systemChat format ["%1 dragObjectPFH running", ACE_time]; #endif -private ["_unit", "_target"]; - -_unit = _this select 0 select 0; -_target = _this select 0 select 1; +params ["_args", "_idPFH"]; +_args params ["_unit", "_target"]; if !(_unit getVariable [QGVAR(isDragging), false]) exitWith { - [_this select 1] call CBA_fnc_removePerFrameHandler; + [_idPFH] call CBA_fnc_removePerFrameHandler; }; // drop if the crate is destroyed OR (target moved away from carrier (weapon disasembled)) -if ((!([_target] call EFUNC(common,isAlive))) || {(_unit distance _target) > 10}) then { +if (!alive _target || {_unit distance _target > 10}) then { [_unit, _target] call FUNC(dropObject); - [_this select 1] call CBA_fnc_removePerFrameHandler; + [_idPFH] call CBA_fnc_removePerFrameHandler; }; diff --git a/addons/dragging/functions/fnc_dropObject.sqf b/addons/dragging/functions/fnc_dropObject.sqf index 9589457dbe..9da1656b8b 100644 --- a/addons/dragging/functions/fnc_dropObject.sqf +++ b/addons/dragging/functions/fnc_dropObject.sqf @@ -3,22 +3,21 @@ * * Drop a dragged object. * - * Argument: - * 0: Unit that drags the other object (Object) - * 1: Dragged object to drop (Object) + * Arguments: + * 0: Unit that drags the other object + * 1: Dragged object to drop * - * Return value: - * NONE. + * Return Value: + * None + * + * Public: No */ #include "script_component.hpp" -private ["_unit", "_target"]; +params ["_unit", "_target"]; -_unit = _this select 0; -_target = _this select 1; - -// remove scroll wheel action -_unit removeAction (_unit getVariable [QGVAR(ReleaseActionID), -1]); +// remove drop action +[_unit, "DefaultAction", _unit getVariable [QGVAR(ReleaseActionID), -1]] call EFUNC(common,removeActionEventHandler); private "_inBuilding"; _inBuilding = [_unit] call FUNC(isObjectOnObject); @@ -50,6 +49,9 @@ if (_inBuilding) then { _target setPosASL (getPosASL _target vectorAdd [0, 0, 0.05]); }; +// hide mouse hint +[] call EFUNC(interaction,hideMouseHint); + _unit setVariable [QGVAR(isDragging), false, true]; _unit setVariable [QGVAR(draggedObject), objNull, true]; @@ -64,3 +66,8 @@ if !(_target isKindOf "CAManBase") then { if (_unit getvariable ["ACE_isUnconscious", false]) then { [_unit, "unconscious", 2, true] call EFUNC(common,doAnimation); }; + +// recreate UAV crew +if (_target getVariable [QGVAR(isUAV), false]) then { + createVehicleCrew _target; +}; diff --git a/addons/dragging/functions/fnc_dropObject_carry.sqf b/addons/dragging/functions/fnc_dropObject_carry.sqf index b6dfe9fc45..300846bc6c 100644 --- a/addons/dragging/functions/fnc_dropObject_carry.sqf +++ b/addons/dragging/functions/fnc_dropObject_carry.sqf @@ -3,22 +3,21 @@ * * Drop a carried object. * - * Argument: - * 0: Unit that carries the other object (Object) - * 1: Carried object to drop (Object) + * Arguments: + * 0: Unit that carries the other object + * 1: Carried object to drop * - * Return value: - * NONE. + * Return Value: + * None + * + * Public: No */ #include "script_component.hpp" -private ["_unit", "_target"]; +params ["_unit", "_target"]; -_unit = _this select 0; -_target = _this select 1; - -// remove scroll wheel action -_unit removeAction (_unit getVariable [QGVAR(ReleaseActionID), -1]); +// remove drop action +[_unit, "DefaultAction", _unit getVariable [QGVAR(ReleaseActionID), -1]] call EFUNC(common,removeActionEventHandler); private "_inBuilding"; _inBuilding = [_unit] call FUNC(isObjectOnObject); @@ -56,6 +55,9 @@ if (_inBuilding) then { _target setPosASL (getPosASL _target vectorAdd [0, 0, 0.05]); }; +// hide mouse hint +[] call EFUNC(interaction,hideMouseHint); + _unit setVariable [QGVAR(isCarrying), false, true]; _unit setVariable [QGVAR(carriedObject), objNull, true]; @@ -66,3 +68,8 @@ if !(_target isKindOf "CAManBase") then { ["fixPosition", _target, _target] call EFUNC(common,targetEvent); ["fixFloating", _target, _target] call EFUNC(common,targetEvent); }; + +// recreate UAV crew +if (_target getVariable [QGVAR(isUAV), false]) then { + createVehicleCrew _target; +}; diff --git a/addons/dragging/functions/fnc_getWeight.sqf b/addons/dragging/functions/fnc_getWeight.sqf index 871c49db89..dcdcbbf3fe 100644 --- a/addons/dragging/functions/fnc_getWeight.sqf +++ b/addons/dragging/functions/fnc_getWeight.sqf @@ -1,54 +1,45 @@ /* - Name: AGM_Drag_fnc_GetWeight - - Author(s): - L-H, edited by commy2 - - Description: - Returns the weight of a crate. - - Parameters: - 0: OBJECT - Crate to get weight of - - Returns: - NUMBER - Weight - - Example: - _weight = Crate1 call AGM_Drag_fnc_GetWeight; + * Author: L-H, edited by commy2, rewritten by joko // Jonas + * + * Returns the weight of a crate. + * + * Arguments: + * 0: Crate to get weight of + * + * Return Value: + * Total Weight + * + * Example: + * _weight = Crate1 call ace_dragging_fnc_getweight; + * + * Public: No */ #include "script_component.hpp" -private "_object"; - -_object = _this select 0; - -private ["_totalWeight", "_fnc","_fnc_Extra"]; +private "_totalWeight"; +params ["_object"]; +// Initialize the total weight. _totalWeight = 0; -_fnc_Extra = { - private ["_weight", "_items"]; - _items = _this select 0; - _weight = 0; - { - _weight = _weight + (getNumber (ConfigFile >> (_this select 1) >> _x >> (_this select 2) >> "mass") * ((_items select 1) select _foreachIndex)); - } foreach (_items select 0); - - _weight -}; -_fnc = { - private ["_weight", "_items"]; - _items = _this select 0; - _weight = 0; - { - _weight = _weight + (getNumber (ConfigFile >> (_this select 1) >> _x >> "mass") * ((_items select 1) select _foreachIndex)); - } foreach (_items select 0); - - _weight -}; -_totalWeight = ([getMagazineCargo _object, "CfgMagazines"] call _fnc); -_totalWeight = _totalWeight + ([getItemCargo _object, "CfgWeapons", "ItemInfo"] call _fnc_Extra); -_totalWeight = _totalWeight + ([getWeaponCargo _object, "CfgWeapons", "WeaponSlotsInfo"] call _fnc_Extra); -_totalWeight = _totalWeight + ([getBackpackCargo _object, "CfgVehicles"] call _fnc); -_totalWeight = _totalWeight * 0.5; // Mass in Arma isn't an exact amount but rather a volume/weight value. This attempts to work around that by making it a usable value. (sort of). +// Cycle through all item types with their assigned config paths. +{ + _x params["_items","_getConfigCode"]; + _items params ["_item", "_count"]; + // Cycle through all items and read their mass out of the config. + { + // Multiply mass with amount of items and add the mass to the total weight. + _totalWeight = _totalWeight + (getNumber ((call _getConfigCode) >> "mass") * (_count select _forEachIndex)); + } forEach _item; + true +} count [ + [getMagazineCargo _object, {configFile >> "CfgMagazines" >> _x}], + [getBackpackCargo _object, {configFile >> "CfgVehicles" >> _x}], + [getItemCargo _object, {configFile >> "CfgWeapons" >> _x >> "ItemInfo"}], + [getWeaponCargo _object, {configFile >> "CfgWeapons" >> _x >> "WeaponSlotsInfo"}] +]; -_totalWeight +// add Weight of create to totalWeight +_totalWeight = _totalWeight + (getNumber (configFile >> "CfgVehicles" >> typeof _object >> "mass")); + +// Mass in Arma isn't an exact amount but rather a volume/weight value. This attempts to work around that by making it a usable value. (sort of). +_totalWeight * 0.5 diff --git a/addons/dragging/functions/fnc_handleAnimChanged.sqf b/addons/dragging/functions/fnc_handleAnimChanged.sqf index 14b2eff611..0694687ca4 100644 --- a/addons/dragging/functions/fnc_handleAnimChanged.sqf +++ b/addons/dragging/functions/fnc_handleAnimChanged.sqf @@ -1,4 +1,20 @@ -// by commy2 +/* + * Author: commy2 + * + * Handle the animaion for a Unit for Dragging Module + * + * Arguments: + * 0: Unit + * 1: animaion + * + * Return Value: + * None + * + * Example: + * [_unit, "amovpercmstpsnonwnondnon"] call ace_dragging_fnc_handleAnimChanged; + * + * Public: No +*/ #include "script_component.hpp" private ["_unit", "_anim"]; diff --git a/addons/dragging/functions/fnc_handleKilled.sqf b/addons/dragging/functions/fnc_handleKilled.sqf index 4dcfc77fcd..2d0923d624 100644 --- a/addons/dragging/functions/fnc_handleKilled.sqf +++ b/addons/dragging/functions/fnc_handleKilled.sqf @@ -1,9 +1,22 @@ -// by commy2 +/* + * Author: commy2 + * + * Handle death of the dragger + * + * Arguments: + * 0: Unit + * + * Return Value: + * None + * + * Example: + * [_unit] call ace_dragging_fnc_handleKilled; + * + * Public: No +*/ #include "script_component.hpp" -private "_unit"; - -_unit = _this select 0; +params ["_unit"]; if (_unit getVariable [QGVAR(isDragging), false]) then { private "_draggedObject"; diff --git a/addons/dragging/functions/fnc_handlePlayerChanged.sqf b/addons/dragging/functions/fnc_handlePlayerChanged.sqf index e2dd41021b..41c9091c72 100644 --- a/addons/dragging/functions/fnc_handlePlayerChanged.sqf +++ b/addons/dragging/functions/fnc_handlePlayerChanged.sqf @@ -1,10 +1,23 @@ -// by commy2 +/* + * Author: commy2 + * + * Handle player changes. + * + * Arguments: + * 0: New Player Unit + * 1: Old Player Unit + * + * Return Value: + * None + * + * Example: + * [_unitNew, _unitOld] call ace_dragging_fnc_handlePlayerChanged; + * + * Public: No +*/ #include "script_component.hpp" -private ["_newPlayer", "_oldPlayer"]; - -_newPlayer = _this select 0; -_oldPlayer = _this select 1; +params ["_newPlayer", "_oldPlayer"]; { if (_x getVariable [QGVAR(isDragging), false]) then { diff --git a/addons/dragging/functions/fnc_handlePlayerWeaponChanged.sqf b/addons/dragging/functions/fnc_handlePlayerWeaponChanged.sqf index a7f9be7681..e0f1b2a8e4 100644 --- a/addons/dragging/functions/fnc_handlePlayerWeaponChanged.sqf +++ b/addons/dragging/functions/fnc_handlePlayerWeaponChanged.sqf @@ -1,10 +1,23 @@ -// by commy2 +/* + * Author: commy2 + * + * Handle the Weapon Changed Event + * + * Arguments: + * 0: Unit + * 1: Weapon + * + * Return Value: + * None + * + * Example: + * [_unit, _currentWeapon] call ace_dragging_fnc_handlePlayerWeaponChanged; + * + * Public: No +*/ #include "script_component.hpp" -private ["_unit", "_weapon"]; - -_unit = _this select 0; -_weapon = _this select 1; +params ["_unit", "_weapon"]; if (_unit getVariable [QGVAR(isDragging), false]) then { diff --git a/addons/dragging/functions/fnc_handleScrollWheel.sqf b/addons/dragging/functions/fnc_handleScrollWheel.sqf index 96f46413bc..73c42c2810 100644 --- a/addons/dragging/functions/fnc_handleScrollWheel.sqf +++ b/addons/dragging/functions/fnc_handleScrollWheel.sqf @@ -3,38 +3,33 @@ * * Handles raising and lowering the dragged weapon to be able to place it on top of objects. * - * Argument: - * 0: Scroll amount (Number) + * Arguments: + * 0: Scroll amount * - * Return value: - * Handled or not. (Bool) + * Return Value: + * Handled or not. + * + * Public: No */ #include "script_component.hpp" -// requires modifier key to be hold down -if (GETMVAR(ACE_Modifier,0) == 0) exitWith {false}; +params ["_scrollAmount"]; + +private ["_unit", "_carriedItem", "_position", "_maxHeight"]; -private "_unit"; _unit = ACE_player; // EH is always assigned. Exit and don't overwrite input if not carrying if !(_unit getVariable [QGVAR(isCarrying), false]) exitWith {false}; -private "_scrollAmount"; - -_scrollAmount = _this select 0; - // move carried item 15 cm per scroll interval _scrollAmount = _scrollAmount * 0.15; -private "_carriedItem"; _carriedItem = _unit getVariable [QGVAR(carriedObject), objNull]; //disabled for persons if (_carriedItem isKindOf "CAManBase") exitWith {false}; -private ["_position", "_maxHeight"]; - _position = getPosATL _carriedItem; _maxHeight = (_unit modelToWorldVisual [0,0,0]) select 2; diff --git a/addons/dragging/functions/fnc_handleUnconscious.sqf b/addons/dragging/functions/fnc_handleUnconscious.sqf index 31c703f37b..b87e36b92d 100644 --- a/addons/dragging/functions/fnc_handleUnconscious.sqf +++ b/addons/dragging/functions/fnc_handleUnconscious.sqf @@ -1,17 +1,29 @@ -// by commy2 +/* + * Author: commy2 + * + * Handle the Unconscious of a Unit while Dragging + * + * Arguments: + * 0: Unit + * + * Return Value: + * None + * + * Example: + * [_unit] call ace_dragging_fnc_handleUnconscious; + * + * Public: No +*/ #include "script_component.hpp" -private ["_unit", "_isUnconscious"]; +private ["_player", "_draggedObject", "_carriedObject"]; -_unit = _this select 0; -_isUnconscious = _this select 1; +params ["_unit"]; -private "_player"; _player = ACE_player; if (_player getVariable [QGVAR(isDragging), false]) then { - private "_draggedObject"; _draggedObject = _player getVariable [QGVAR(draggedObject), objNull]; // handle falling unconscious @@ -28,7 +40,6 @@ if (_player getVariable [QGVAR(isDragging), false]) then { if (_player getVariable [QGVAR(isCarrying), false]) then { - private "_carriedObject"; _carriedObject = _player getVariable [QGVAR(carriedObject), objNull]; // handle falling unconscious diff --git a/addons/dragging/functions/fnc_initObject.sqf b/addons/dragging/functions/fnc_initObject.sqf index 65866bd028..0dd36568bc 100644 --- a/addons/dragging/functions/fnc_initObject.sqf +++ b/addons/dragging/functions/fnc_initObject.sqf @@ -4,23 +4,22 @@ * Initialize variables for drag or carryable objects. Called from init EH. * * Argument: - * 0: Any object (Object) + * 0: Any object * - * Return value: - * NONE. + * Return Value: + * None + * + * Public: No */ #include "script_component.hpp" -private "_object"; +private ["_position", "_direction", "_config"]; -_object = _this select 0; +params ["_object"]; -private "_config"; _config = configFile >> "CfgVehicles" >> typeOf _object; if (getNumber (_config >> QGVAR(canDrag)) == 1) then { - private ["_position", "_direction"]; - _position = getArray (_config >> QGVAR(dragPosition)); _direction = getNumber (_config >> QGVAR(dragDirection)); @@ -28,8 +27,6 @@ if (getNumber (_config >> QGVAR(canDrag)) == 1) then { }; if (getNumber (_config >> QGVAR(canCarry)) == 1) then { - private ["_position", "_direction"]; - _position = getArray (_config >> QGVAR(carryPosition)); _direction = getNumber (_config >> QGVAR(carryDirection)); diff --git a/addons/dragging/functions/fnc_initPerson.sqf b/addons/dragging/functions/fnc_initPerson.sqf index 0dc2af1389..c0a951771c 100644 --- a/addons/dragging/functions/fnc_initPerson.sqf +++ b/addons/dragging/functions/fnc_initPerson.sqf @@ -4,16 +4,16 @@ * Initialize variables for drag or carryable persons. Called from init EH. * * Argument: - * 0: Any Unit (Object) + * 0: Unit * * Return value: - * NONE. + * None + * + * Public: No */ #include "script_component.hpp" -private "_unit"; - -_unit = _this select 0; +params ["_unit"]; [_unit, true, [0,1.1,0.092], 180] call FUNC(setDraggable); [_unit, true, [0.4,-0.1,-1.25], 195] call FUNC(setCarryable); // hard-coded selection: "LeftShoulder" diff --git a/addons/dragging/functions/fnc_isObjectOnObject.sqf b/addons/dragging/functions/fnc_isObjectOnObject.sqf index 0a8624820e..e8ab5f307a 100644 --- a/addons/dragging/functions/fnc_isObjectOnObject.sqf +++ b/addons/dragging/functions/fnc_isObjectOnObject.sqf @@ -1,6 +1,16 @@ -// by commy2 - -private "_object"; -_object = _this select 0; +/* + * Author: commy2 + * + * Check if Object is Overlapping + * + * Argument: + * 0: Object + * + * Return value: + * + * + * Public: No + */ +params ["_object"]; (getPosATL _object select 2) - (getPos _object select 2) > 1E-5 diff --git a/addons/dragging/functions/fnc_setCarryable.sqf b/addons/dragging/functions/fnc_setCarryable.sqf index 52c6e5643a..6bf05e5fde 100644 --- a/addons/dragging/functions/fnc_setCarryable.sqf +++ b/addons/dragging/functions/fnc_setCarryable.sqf @@ -4,25 +4,21 @@ * Enable the object to be carried. * * Argument: - * 0: Any object (Object) - * 1: true to enable carrying, false to disable (Bool) - * 2: Position offset for attachTo command (Array, optinal; default: [0,1,1]) - * 3: Direction in degree to rotate the object after attachTo (Number, optional; default: 0) + * 0: Any object + * 1: true to enable carrying, false to disable + * 2: Position offset for attachTo command (default: [0,1,1]) + * 3: Direction in degree to rotate the object after attachTo (default: 0) * - * Return value: - * NONE. + * Return Value: + * None + * + * Public: Yes */ #include "script_component.hpp" -private ["_carryAction", "_dropAction", "_object", "_enableCarry", "_position", "_direction"]; -//IGNORE_PRIVATE_WARNING("_player", "_target"); +private ["_carryAction", "_dropAction", "_type", "_initializedClasses"]; -_this resize 4; - -_object = _this select 0; -_enableCarry = _this select 1; -_position = _this select 2; -_direction = _this select 3; +params ["_object", "_enableCarry", "_position", "_direction"]; if (isNil "_position") then { _position = _object getVariable [QGVAR(carryPosition), [0,1,1]]; @@ -38,8 +34,6 @@ _object setVariable [QGVAR(carryPosition), _position]; _object setVariable [QGVAR(carryDirection), _direction]; // add action to class if it is not already present -private ["_type", "_initializedClasses"]; - _type = typeOf _object; _initializedClasses = GETGVAR(initializedClasses_carry,[]); diff --git a/addons/dragging/functions/fnc_setDraggable.sqf b/addons/dragging/functions/fnc_setDraggable.sqf index 7745bd2d3e..bbfca9d868 100644 --- a/addons/dragging/functions/fnc_setDraggable.sqf +++ b/addons/dragging/functions/fnc_setDraggable.sqf @@ -10,19 +10,15 @@ * 3: Direction in degree to rotate the object after attachTo (Number, optional; default: 0) * * Return value: - * NONE. + * None + * + * Public: Yes */ #include "script_component.hpp" -private ["_dragAction", "_dropAction", "_object", "_enableDrag", "_position", "_direction"]; +private ["_dragAction", "_dropAction", "_type", "_initializedClasses"]; //IGNORE_PRIVATE_WARNING("_player", "_target"); - -_this resize 4; - -_object = _this select 0; -_enableDrag = _this select 1; -_position = _this select 2; -_direction = _this select 3; +params ["_object", "_enableDrag", "_position", "_direction"]; if (isNil "_position") then { _position = _object getVariable [QGVAR(dragPosition), [0,0,0]]; @@ -38,8 +34,6 @@ _object setVariable [QGVAR(dragPosition), _position]; _object setVariable [QGVAR(dragDirection), _direction]; // add action to class if it is not already present -private ["_type", "_initializedClasses"]; - _type = typeOf _object; _initializedClasses = GETGVAR(initializedClasses,[]); diff --git a/addons/dragging/functions/fnc_startCarry.sqf b/addons/dragging/functions/fnc_startCarry.sqf index 5521bec375..a95a8f9fb4 100644 --- a/addons/dragging/functions/fnc_startCarry.sqf +++ b/addons/dragging/functions/fnc_startCarry.sqf @@ -3,29 +3,28 @@ * * Start the carrying process. * - * Argument: - * 0: Unit that should do the carrying (Object) - * 1: Object to carry (Object) + * Arguments: + * 0: Unit that should do the carrying + * 1: Object to carry * - * Return value: - * NONE. + * Return Value: + * None + * + * Public: No */ #include "script_component.hpp" -private ["_unit", "_target"]; +private ["_weight", "_timer"]; -_unit = _this select 0; -_target = _this select 1; +params ["_unit", "_target"]; // check weight -private "_weight"; _weight = [_target] call FUNC(getWeight); -if (_weight > GETMVAR(ACE_maxWeightCarry,1E11)) exitWith { +if (_weight > missionNamespace getVariable ["ACE_maxWeightCarry", 1E11]) exitWith { [localize LSTRING(UnableToDrag)] call EFUNC(common,displayTextStructured); }; -private "_timer"; _timer = ACE_time + 5; // handle objects vs persons diff --git a/addons/dragging/functions/fnc_startCarryPFH.sqf b/addons/dragging/functions/fnc_startCarryPFH.sqf index 47824a8e76..eafc9b8e01 100644 --- a/addons/dragging/functions/fnc_startCarryPFH.sqf +++ b/addons/dragging/functions/fnc_startCarryPFH.sqf @@ -1,25 +1,34 @@ -// by commy2 +/* + * Author: commy2 + * + * Carry PFH + * + * Arguments: + * ? + * + * Return Value: + * None + * + * Public: No + */ #include "script_component.hpp" #ifdef DEBUG_ENABLED_DRAGGING systemChat format ["%1 startCarryPFH running", ACE_time]; #endif -private ["_unit", "_target", "_timeOut"]; - -_unit = _this select 0 select 0; -_target = _this select 0 select 1; -_timeOut = _this select 0 select 2; +params ["_args", "_idPFH"]; +_args params ["_unit", "_target", "_timeOut"]; // handle aborting carry if !(_unit getVariable [QGVAR(isCarrying), false]) exitWith { - [_this select 1] call CBA_fnc_removePerFrameHandler; + [_idPFH] call CBA_fnc_removePerFrameHandler; }; // same as dragObjectPFH, checks if object is deleted or dead OR (target moved away from carrier (weapon disasembled)) -if ((!([_target] call EFUNC(common,isAlive))) || {(_unit distance _target) > 10}) then { +if (!alive _target || {_unit distance _target > 10}) then { [_unit, _target] call FUNC(dropObject); - [_this select 1] call CBA_fnc_removePerFrameHandler; + [_idPFH] call CBA_fnc_removePerFrameHandler; }; // handle persons vs objects @@ -27,11 +36,11 @@ if (_target isKindOf "CAManBase") then { if (ACE_time > _timeOut) exitWith { [_unit, _target] call FUNC(carryObject); - [_this select 1] call CBA_fnc_removePerFrameHandler; + [_idPFH] call CBA_fnc_removePerFrameHandler; }; } else { if (ACE_time > _timeOut) exitWith { - [_this select 1] call CBA_fnc_removePerFrameHandler; + [_idPFH] call CBA_fnc_removePerFrameHandler; // drop if in timeout private "_draggedObject"; @@ -43,7 +52,7 @@ if (_target isKindOf "CAManBase") then { if (stance _unit == "STAND") exitWith { [_unit, _target] call FUNC(carryObject); - [_this select 1] call CBA_fnc_removePerFrameHandler; + [_idPFH] call CBA_fnc_removePerFrameHandler; }; }; diff --git a/addons/dragging/functions/fnc_startDrag.sqf b/addons/dragging/functions/fnc_startDrag.sqf index 1d4eb9a158..d3e55bdaea 100644 --- a/addons/dragging/functions/fnc_startDrag.sqf +++ b/addons/dragging/functions/fnc_startDrag.sqf @@ -4,24 +4,21 @@ * Start the dragging process. * * Argument: - * 0: Unit that should do the dragging (Object) - * 1: Object to drag (Object) + * 0: Unit that should do the dragging + * 1: Object to drag * * Return value: - * NONE. + * None */ #include "script_component.hpp" -private ["_unit", "_target"]; - -_unit = _this select 0; -_target = _this select 1; +params ["_unit", "_target"]; // check weight private "_weight"; _weight = [_target] call FUNC(getWeight); -if (_weight > GETMVAR(ACE_maxWeightDrag,1E11)) exitWith { +if (_weight > missionNamespace getVariable ["ACE_maxWeightDrag", 1E11]) exitWith { [localize LSTRING(UnableToDrag)] call EFUNC(common,displayTextStructured); }; diff --git a/addons/dragging/functions/fnc_startDragPFH.sqf b/addons/dragging/functions/fnc_startDragPFH.sqf index 65cf0a2431..1edbd92a99 100644 --- a/addons/dragging/functions/fnc_startDragPFH.sqf +++ b/addons/dragging/functions/fnc_startDragPFH.sqf @@ -1,30 +1,39 @@ -// by commy2 +/* + * Author: commy2 + * + * Drag PFH + * + * Arguments: + * ? + * + * Return Value: + * None + * + * Public: No + */ #include "script_component.hpp" #ifdef DEBUG_ENABLED_DRAGGING systemChat format ["%1 startDragPFH running", ACE_time]; #endif -private ["_unit", "_target", "_timeOut"]; - -_unit = _this select 0 select 0; -_target = _this select 0 select 1; -_timeOut = _this select 0 select 2; +params ["_args", "_idPFH"]; +_args params ["_unit", "_target", "_timeOut"]; // handle aborting drag if !(_unit getVariable [QGVAR(isDragging), false]) exitWith { - [_this select 1] call CBA_fnc_removePerFrameHandler; + [_idPFH] call CBA_fnc_removePerFrameHandler; }; // same as dragObjectPFH, checks if object is deleted or dead OR (target moved away from carrier (weapon disasembled)) -if ((!([_target] call EFUNC(common,isAlive))) || {(_unit distance _target) > 10}) then { +if (!alive _target || {_unit distance _target > 10}) then { [_unit, _target] call FUNC(dropObject); - [_this select 1] call CBA_fnc_removePerFrameHandler; + [_idPFH] call CBA_fnc_removePerFrameHandler; }; // timeout. Do nothing. Quit. ACE_time, because anim length is linked to ingame ACE_time. if (ACE_time > _timeOut) exitWith { - [_this select 1] call CBA_fnc_removePerFrameHandler; + [_idPFH] call CBA_fnc_removePerFrameHandler; // drop if in timeout private "_draggedObject"; @@ -36,5 +45,5 @@ if (ACE_time > _timeOut) exitWith { if (animationState _unit in DRAG_ANIMATIONS) exitWith { [_unit, _target] call FUNC(dragObject); - [_this select 1] call CBA_fnc_removePerFrameHandler; + [_idPFH] call CBA_fnc_removePerFrameHandler; }; diff --git a/addons/dragging/stringtable.xml b/addons/dragging/stringtable.xml index d1eb18d6b4..4535a8e62e 100644 --- a/addons/dragging/stringtable.xml +++ b/addons/dragging/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -49,5 +49,10 @@ Trasporta Нести + + Raise/Lower + Heben/Senken + Wyżej/Niżej + - \ No newline at end of file + diff --git a/addons/explosives/ACE_Triggers.hpp b/addons/explosives/ACE_Triggers.hpp index 5df3d005bc..952f360f22 100644 --- a/addons/explosives/ACE_Triggers.hpp +++ b/addons/explosives/ACE_Triggers.hpp @@ -1,5 +1,5 @@ class ACE_Triggers { -/* onPlace parameters: + /* onPlace parameters: 0: OBJECT - unit placing 1: OBJECT - Placed explosive 2: STRING - Magazine classname @@ -7,46 +7,54 @@ class ACE_Triggers { Last Index: ACE_Triggers config of trigger type. onSetup parameters: 0: STRING - Magazine Classname -*/ + */ class Command { + isAttachable = 1; displayName = CSTRING(clacker_displayName); picture = PATHTOF(Data\UI\Clacker.paa); onPlace = QUOTE(_this call FUNC(AddClacker);false); requires[] = {"ACE_Clacker"}; }; class MK16_Transmitter:Command { + isAttachable = 1; displayName = CSTRING(MK16_displayName); picture = PATHTOF(Data\UI\MK16_Reciever_ca.paa); requires[] = {"ACE_M26_Clacker"}; }; class DeadManSwitch:Command { + isAttachable = 1; displayName = CSTRING(DeadManSwitch_displayName); picture = PATHTOF(Data\UI\DeadmanSwitch.paa); requires[] = {"ACE_DeadManSwitch"}; }; class Cellphone:Command { + isAttachable = 1; displayName = CSTRING(cellphone_displayName); picture = PATHTOF(Data\UI\Cellphone_UI.paa); onPlace = QUOTE(_this call FUNC(addCellphoneIED);false); requires[] = {"ACE_Cellphone"}; }; class PressurePlate { + isAttachable = 0; displayName = CSTRING(PressurePlate); picture = PATHTOF(Data\UI\PressurePlate.paa); - onPlace = "_dist=GetNumber(ConfigFile >> 'CfgMagazines' >> (_this select 2) >> 'ACE_Triggers' >> 'PressurePlate' >> 'digDistance');_ex=_this select 1;_ex setPosATL ((getPosATL _ex) vectorDiff ((VectorUp _ex) vectorCrossProduct [0,0,_dist]));false"; + onPlace = QUOTE(false); }; class IRSensor { + isAttachable = 0; displayName = CSTRING(IRSensor); picture = PATHTOF(Data\UI\PressurePlate.paa); onPlace = "false"; }; class Timer { + isAttachable = 1; displayName = CSTRING(timerName); picture = PATHTOF(data\UI\Timer.paa); onPlace = QUOTE([ARR_2(_this select 1,(_this select 3) select 0)] call FUNC(startTimer);false); onSetup = QUOTE(_this call FUNC(openTimerSetUI);true); }; class Tripwire { + isAttachable = 0; displayName = CSTRING(TripWire); picture = PATHTOF(Data\UI\Tripwire.paa); onPlace = "false"; diff --git a/addons/explosives/CfgEventHandlers.hpp b/addons/explosives/CfgEventHandlers.hpp index 89e3017e8a..e7bf74e414 100644 --- a/addons/explosives/CfgEventHandlers.hpp +++ b/addons/explosives/CfgEventHandlers.hpp @@ -11,7 +11,7 @@ class Extended_PostInit_EventHandlers { class Extended_Killed_EventHandlers { class CAManBase { - GVAR(killedHandler) = QUOTE(_this call FUNC(onKilled)); + GVAR(killedHandler) = QUOTE(_this call FUNC(onIncapacitated)); }; }; diff --git a/addons/explosives/CfgMagazines.hpp b/addons/explosives/CfgMagazines.hpp index 39d08917c3..686dd83ee8 100644 --- a/addons/explosives/CfgMagazines.hpp +++ b/addons/explosives/CfgMagazines.hpp @@ -8,7 +8,7 @@ class CfgMagazines { class ACE_Triggers { SupportedTriggers[] = {"PressurePlate"}; class PressurePlate { - digDistance = 0.1; + digDistance = 0.06; }; }; }; @@ -17,7 +17,7 @@ class CfgMagazines { class ACE_Triggers { SupportedTriggers[] = {"PressurePlate"}; class PressurePlate { - digDistance = 0.075; + digDistance = 0.08; }; }; }; @@ -26,7 +26,7 @@ class CfgMagazines { class ACE_Triggers { SupportedTriggers[] = {"PressurePlate"}; class PressurePlate { - digDistance = 0.05; + digDistance = 0.02; }; }; }; @@ -96,7 +96,7 @@ class CfgMagazines { }; }; }; - + class IEDUrbanBig_Remote_Mag: DemoCharge_Remote_Mag { ACE_SetupObject = "ACE_Explosives_Place_IEDUrbanBig"; class ACE_Triggers { @@ -113,9 +113,9 @@ class CfgMagazines { ammo = "IEDUrbanBig_Range_Ammo"; pitch = 0; }; - }; + }; }; - + class IEDLandBig_Remote_Mag: IEDUrbanBig_Remote_Mag { ACE_SetupObject = "ACE_Explosives_Place_IEDLandBig"; class ACE_Triggers: ACE_Triggers { diff --git a/addons/explosives/GUI_VirtualAmmo.hpp b/addons/explosives/GUI_VirtualAmmo.hpp new file mode 100644 index 0000000000..96e5b452ee --- /dev/null +++ b/addons/explosives/GUI_VirtualAmmo.hpp @@ -0,0 +1,30 @@ +class RscTitles { + class GVAR(virtualAmmo) { + idd = -1; + movingEnable = 1; + duration = 9999999; + fadein = 0; + fadeout = 0; + onLoad = "uiNamespace setVariable ['ACE_explosives_virtualAmmoDisplay', (_this select 0)];"; + class controls {}; + class objects { + class TheObject { + idc = 800851; + type = 82; + model = "\a3\weapons_f\Ammo\Handgrenade.p3d"; //dummy value, cannot be "" !!! + scale = 1; + direction[] = {0, 0, 1}; + up[] = {0, 1, 0}; + x = 0.5; + y = 0.5; + z = 1; + xBack = 0.5; + yBack = 0.5; + zBack = 0.5; + inBack = 0; + enableZoom = 0; + zoomDuration = 1; + }; + }; + }; +}; diff --git a/addons/explosives/XEH_postInit.sqf b/addons/explosives/XEH_postInit.sqf index 27a4703906..b6dc5049d9 100644 --- a/addons/explosives/XEH_postInit.sqf +++ b/addons/explosives/XEH_postInit.sqf @@ -15,20 +15,37 @@ */ #include "script_component.hpp" -if !(hasInterface) exitWith {}; +//Event for setting explosive placement angle/pitch: +[QGVAR(place), {_this call FUNC(setPosition)}] call EFUNC(common,addEventHandler); -["interactMenuOpened", {_this call FUNC(interactEH)}] call EFUNC(common,addEventHandler); +//When getting knocked out in medical, trigger deadman explosives: +//Event is global, only run on server (ref: ace_medical_fnc_setUnconscious) +if (isServer) then { + ["medical_onUnconscious", { + params ["_unit", "_isUnconscious"]; + if (!_isUnconscious) exitWith {}; + TRACE_1("Knocked Out, Doing Deadman", _unit); + [_unit] call FUNC(onIncapacitated); + }] call EFUNC(common,addEventHandler); +}; + +if (!hasInterface) exitWith {}; GVAR(PlacedCount) = 0; GVAR(Setup) = objNull; GVAR(pfeh_running) = false; GVAR(CurrentSpeedDial) = 0; -//Cancel placement if interact menu opened + ["interactMenuOpened", { - if (GVAR(pfeh_running) && {!isNull (GVAR(Setup))}) then { - call FUNC(place_Cancel) + //Cancel placement if interact menu opened + if (GVAR(pfeh_running)) then { + GVAR(placeAction) = PLACE_CANCEL; }; + + //Show defuse actions on cfgAmmos (allMines): + _this call FUNC(interactEH); + }] call EFUNC(common,addEventHandler); -[{(_this select 0) call FUNC(handleScrollWheel);}] call EFUNC(Common,addScrollWheelEventHandler); +[{(_this select 0) call FUNC(handleScrollWheel);}] call EFUNC(common,addScrollWheelEventHandler); diff --git a/addons/explosives/XEH_preInit.sqf b/addons/explosives/XEH_preInit.sqf index b3888e1535..470cae661d 100644 --- a/addons/explosives/XEH_preInit.sqf +++ b/addons/explosives/XEH_preInit.sqf @@ -44,15 +44,11 @@ PREP(getSpeedDialExplosive); PREP(module); +PREP(onIncapacitated); PREP(onInventoryChanged); -PREP(onKilled); -PREP(onLanded); PREP(openTimerSetUI); -PREP(place_Approve); -PREP(place_Cancel); - PREP(placeExplosive); PREP(removeFromSpeedDial); diff --git a/addons/explosives/config.cpp b/addons/explosives/config.cpp index 873c4e0dc3..99544213d3 100644 --- a/addons/explosives/config.cpp +++ b/addons/explosives/config.cpp @@ -12,6 +12,8 @@ class CfgPatches { }; }; +#include "ACE_Settings.hpp" + #include "CfgEventHandlers.hpp" #include "CfgAmmo.hpp" @@ -21,6 +23,7 @@ class CfgPatches { #include "ACE_Triggers.hpp" #include "ExplosivesUI.hpp" +#include "GUI_VirtualAmmo.hpp" class CfgActions { class None; @@ -39,5 +42,3 @@ class CfgMineTriggers { mineTriggerRange = 1; }; }; - -#include "ACE_Settings.hpp" diff --git a/addons/explosives/functions/fnc_addCellphoneIED.sqf b/addons/explosives/functions/fnc_addCellphoneIED.sqf index 953476861b..24d254ac04 100644 --- a/addons/explosives/functions/fnc_addCellphoneIED.sqf +++ b/addons/explosives/functions/fnc_addCellphoneIED.sqf @@ -18,7 +18,8 @@ */ #include "script_component.hpp" -EXPLODE_4_PVT(_this,_unit,_explosive,_magazineClass,_extra); +params ["_unit", "_explosive", "_magazineClass", "_extra"]; +TRACE_4("params",_unit,_explosive,_magazineClass,_extra); private["_config", "_detonators", "_hasRequired", "_requiredItems", "_code", "_count", "_codeSet"]; @@ -50,6 +51,9 @@ if (isNil QGVAR(CellphoneIEDs)) then { _count = GVAR(CellphoneIEDs) pushBack [_explosive,_code,GetNumber(ConfigFile >> "CfgMagazines" >> _magazineClass >> "ACE_Triggers" >> "Cellphone" >> "FuseTime")]; _count = _count + 1; publicVariable QGVAR(CellphoneIEDs); -_unit sideChat format ["IED %1 code: %2", _count,_code]; + +//display IED number message: +[format ["IED %1 code: %2", _count,_code]] call EFUNC(common,displayTextStructured); + if !(_hasRequired) exitWith {}; [format ["IED %1", _count],_code] call FUNC(addToSpeedDial); diff --git a/addons/explosives/functions/fnc_addClacker.sqf b/addons/explosives/functions/fnc_addClacker.sqf index d22b15eef4..f8301f73fb 100644 --- a/addons/explosives/functions/fnc_addClacker.sqf +++ b/addons/explosives/functions/fnc_addClacker.sqf @@ -17,8 +17,12 @@ * Public: Yes */ #include "script_component.hpp" + +params ["_unit", "_explosive", "_magazineClass"]; +TRACE_3("params",_unit,_explosive,_magazineClass); + private ["_clacker", "_config", "_requiredItems", "_hasRequired", "_detonators"]; -EXPLODE_3_PVT(_this,_unit,_explosive,_magazineClass); + // Config is the last item in the list of passed in items. _config = (_this select 3) select (count (_this select 3) - 1); @@ -41,4 +45,6 @@ _clacker pushBack [_explosive, getNumber(_config >> "FuseTime"), format [localiz GVAR(PlacedCount)], _magazineClass, configName ((_this select 3) select (count (_this select 3) - 1))]; _unit setVariable [QGVAR(Clackers), _clacker, true]; -_unit sideChat format [localize LSTRING(DetonateCode), GVAR(PlacedCount)]; + +//display clacker code message: +[format [localize LSTRING(DetonateCode), GVAR(PlacedCount)]] call EFUNC(common,displayTextStructured); diff --git a/addons/explosives/functions/fnc_addDetonateActions.sqf b/addons/explosives/functions/fnc_addDetonateActions.sqf index 5c94649608..04e78f0f82 100644 --- a/addons/explosives/functions/fnc_addDetonateActions.sqf +++ b/addons/explosives/functions/fnc_addDetonateActions.sqf @@ -15,10 +15,13 @@ * Public: No */ #include "script_component.hpp" + +params ["_unit", "_detonator"]; +TRACE_2("params",_unit,_detonator); + private ["_result", "_item", "_children", "_range", "_required"]; -EXPLODE_2_PVT(_this,_unit,_detonator); -_range = GetNumber (ConfigFile >> "CfgWeapons" >> _detonator >> "ACE_Range"); +_range = getNumber (ConfigFile >> "CfgWeapons" >> _detonator >> "ACE_Range"); _result = [_unit] call FUNC(getPlacedExplosives); _children = []; @@ -44,6 +47,6 @@ _children = []; ]; }; }; -} foreach _result; +} forEach _result; _children diff --git a/addons/explosives/functions/fnc_addExplosiveActions.sqf b/addons/explosives/functions/fnc_addExplosiveActions.sqf index 214b41602c..fa00fdd207 100644 --- a/addons/explosives/functions/fnc_addExplosiveActions.sqf +++ b/addons/explosives/functions/fnc_addExplosiveActions.sqf @@ -1,6 +1,6 @@ /* * Author: Garth 'L-H' de Wet and CAA-Picard - * + * Adds sub actions for all explosive magazines (from insertChildren) * * Arguments: * 0: Unit @@ -11,9 +11,11 @@ * Public: No */ #include "script_component.hpp" -private ["_mags", "_item", "_index", "_children", "_itemCount", "_list"]; -EXPLODE_1_PVT(_this,_unit); +params ["_unit"]; +TRACE_1("params",_unit); + +private ["_mags", "_item", "_index", "_children", "_itemCount", "_list"]; _mags = magazines _unit; _list = []; @@ -41,16 +43,16 @@ _children = []; [ [ format ["Explosive_%1", _forEachIndex], - format [_name + " (%1)", _itemCount select _foreachIndex], + format [_name + " (%1)", _itemCount select _forEachIndex], getText(_x >> "picture"), - {(_this select 2) call FUNC(setupExplosive);}, + {[{_this call FUNC(setupExplosive)}, _this] call EFUNC(common,execNextFrame)}, {true}, {}, - [_unit, configName _x] + (configName _x) ] call EFUNC(interact_menu,createAction), [], _unit ]; -} foreach _list; +} forEach _list; _children diff --git a/addons/explosives/functions/fnc_addToSpeedDial.sqf b/addons/explosives/functions/fnc_addToSpeedDial.sqf index 4f0772e601..bf409d5462 100644 --- a/addons/explosives/functions/fnc_addToSpeedDial.sqf +++ b/addons/explosives/functions/fnc_addToSpeedDial.sqf @@ -15,13 +15,16 @@ * Public: Yes */ #include "script_component.hpp" + +params ["_name", "_code"]; +TRACE_2("params",_name,_code); + private ["_speedDial", "_found"]; + _speedDial = ace_player getVariable [QGVAR(SpeedDial), []]; _found = false; -EXPLODE_2_PVT(_this,_name,_code); - -if ((_code) == "") ExitWith { +if ((_code) == "") exitWith { [_name] call FUNC(removeFromSpeedDial); }; { @@ -29,7 +32,7 @@ if ((_code) == "") ExitWith { _speedDial set [_foreachindex, _this]; _found = true; }; -} foreach _speedDial; +} forEach _speedDial; if (!_found) then { _speedDial pushBack _this; }; diff --git a/addons/explosives/functions/fnc_addTransmitterActions.sqf b/addons/explosives/functions/fnc_addTransmitterActions.sqf index abaa57decc..40ec8581d4 100644 --- a/addons/explosives/functions/fnc_addTransmitterActions.sqf +++ b/addons/explosives/functions/fnc_addTransmitterActions.sqf @@ -14,8 +14,12 @@ * Public: No */ #include "script_component.hpp" -private ["_unit", "_children", "_config", "_detonators"]; -_unit = _this select 0; + +params ["_unit"]; +TRACE_1("params",_unit); + +private ["_children", "_config", "_detonators"]; + _detonators = [_unit] call FUNC(getDetonators); _children = []; { @@ -34,6 +38,6 @@ _children = []; [], ACE_Player ]; -} foreach _detonators; +} forEach _detonators; _children diff --git a/addons/explosives/functions/fnc_addTriggerActions.sqf b/addons/explosives/functions/fnc_addTriggerActions.sqf index 6f4ece163c..ca444a4e31 100644 --- a/addons/explosives/functions/fnc_addTriggerActions.sqf +++ b/addons/explosives/functions/fnc_addTriggerActions.sqf @@ -15,10 +15,14 @@ * Public: No */ #include "script_component.hpp" -private ["_hasRequiredItems","_triggerTypes", "_children", "_detonators", "_required", "_magTriggers"]; -EXPLODE_2_PVT(_this,_magazine,_explosive); -_detonators = [ACE_player] call FUNC(getDetonators); +params ["_magazine", "_explosive"]; +TRACE_2("params",_magazine,_explosive); + +private ["_hasRequiredItems","_triggerTypes", "_children", "_detonators", "_required", "_magTriggers", "_isAttached"]; + +_isAttached = !isNull (attachedTo _explosive); +_detonators = [ACE_player] call FUNC(getDetonators); _triggerTypes = [_magazine] call FUNC(triggerType); _magTriggers = ConfigFile >> "CfgMagazines" >> _magazine >> "ACE_Triggers"; _children = []; @@ -30,7 +34,7 @@ _children = []; _hasRequiredItems = false; }; } count _required; - if (_hasRequiredItems) then { + if (_hasRequiredItems && {(!_isAttached) || {(getNumber (_x >> "isAttachable")) == 1}}) then { _children pushBack [ [ @@ -50,6 +54,6 @@ _children = []; ACE_Player ]; }; -} foreach _triggerTypes; +} forEach _triggerTypes; _children diff --git a/addons/explosives/functions/fnc_canDefuse.sqf b/addons/explosives/functions/fnc_canDefuse.sqf index ef4bd10a83..e69ac41dac 100644 --- a/addons/explosives/functions/fnc_canDefuse.sqf +++ b/addons/explosives/functions/fnc_canDefuse.sqf @@ -4,6 +4,7 @@ * * Arguments: * 0: Unit + * 0: Target * * Return Value: * Able to defuse @@ -14,8 +15,12 @@ * Public: Yes */ #include "script_component.hpp" + +params ["_unit", "_target"]; +TRACE_2("params",_unit,_target); + private ["_isSpecialist"]; -EXPLODE_2_PVT(_this,_unit,_target); + if (isNull(_target getVariable [QGVAR(Explosive),objNull])) exitWith { deleteVehicle _target; false diff --git a/addons/explosives/functions/fnc_canDetonate.sqf b/addons/explosives/functions/fnc_canDetonate.sqf index 0b96f66f27..73ca3c4e70 100644 --- a/addons/explosives/functions/fnc_canDetonate.sqf +++ b/addons/explosives/functions/fnc_canDetonate.sqf @@ -14,7 +14,7 @@ * Public: Yes */ #include "script_component.hpp" -private "_unit"; -_unit = _this select 0; -[_unit] call FUNC(hasPlacedExplosives) and {count ([_unit] call FUNC(getDetonators)) > 0} +params ["_unit"]; + +([_unit] call FUNC(hasPlacedExplosives)) && {(count ([_unit] call FUNC(getDetonators))) > 0} diff --git a/addons/explosives/functions/fnc_defuseExplosive.sqf b/addons/explosives/functions/fnc_defuseExplosive.sqf index e0c7f7c85d..0af28788b3 100644 --- a/addons/explosives/functions/fnc_defuseExplosive.sqf +++ b/addons/explosives/functions/fnc_defuseExplosive.sqf @@ -15,9 +15,12 @@ * Public: Yes */ #include "script_component.hpp" -EXPLODE_2_PVT(_this,_unit,_explosive); -if (GVAR(ExplodeOnDefuse) && (random 1.0) < getNumber(ConfigFile >> "CfgAmmo" >> typeOf _explosive >> "ACE_explodeOnDefuse")) exitWith { +params ["_unit", "_explosive"]; +TRACE_2("params",_unit,_explosive); + +if (GVAR(ExplodeOnDefuse) && {(random 1.0) < (getNumber (ConfigFile >> "CfgAmmo" >> typeOf _explosive >> "ACE_explodeOnDefuse"))}) exitWith { + TRACE_1("exploding on defuse",_explosive); [_unit, -1, [_explosive, 1], true] call FUNC(detonateExplosive); }; diff --git a/addons/explosives/functions/fnc_detonateExplosive.sqf b/addons/explosives/functions/fnc_detonateExplosive.sqf index bfdf4a4b92..373e72ac21 100644 --- a/addons/explosives/functions/fnc_detonateExplosive.sqf +++ b/addons/explosives/functions/fnc_detonateExplosive.sqf @@ -19,12 +19,16 @@ * Public: Yes */ #include "script_component.hpp" -private ["_result", "_ignoreRange", "_helpers", "_pos"]; -EXPLODE_3_PVT(_this,_unit,_range,_item); + +params ["_unit", "_range", "_item"]; +TRACE_3("params",_unit,_range,_item); + +private ["_result", "_ignoreRange", "_pos"]; + _ignoreRange = (_range == -1); _result = true; -if (!_ignoreRange && {(_unit distance (_item select 0)) > _range}) exitWith {false}; +if (!_ignoreRange && {(_unit distance (_item select 0)) > _range}) exitWith {TRACE_1("out of range",_range); false}; if (getNumber (ConfigFile >> "CfgAmmo" >> typeof (_item select 0) >> "TriggerWhenDestroyed") == 0) then { private ["_exp", "_previousExp"]; @@ -40,11 +44,11 @@ if (getNumber (ConfigFile >> "CfgAmmo" >> typeof (_item select 0) >> "TriggerWhe }; }; [{ - private ["_explosive"]; - _explosive = _this; + params ["_explosive"]; + TRACE_1("exploding",_explosive); if (!isNull _explosive) then { _explosive setDamage 1; }; -}, _item select 0, _item select 1, 0] call EFUNC(common,waitAndExecute); +}, [_item select 0], (_item select 1)] call EFUNC(common,waitAndExecute); _result diff --git a/addons/explosives/functions/fnc_dialPhone.sqf b/addons/explosives/functions/fnc_dialPhone.sqf index aa163b027f..44addcda9f 100644 --- a/addons/explosives/functions/fnc_dialPhone.sqf +++ b/addons/explosives/functions/fnc_dialPhone.sqf @@ -15,8 +15,12 @@ * Public: Yes */ #include "script_component.hpp" + +params ["_unit", "_code"]; +TRACE_2("params",_unit,_code); + private ["_arr", "_ran", "_i"]; -EXPLODE_2_PVT(_this,_unit,_code); + if (_unit getVariable [QGVAR(Dialing),false]) exitWith {}; if !(alive _unit) exitWith {}; _unit setVariable [QGVAR(Dialing), true, true]; @@ -36,7 +40,7 @@ if (_unit == ace_player) then { [{ playSound3D [QUOTE(PATHTO_R(Data\Audio\Cellphone_Ring.wss)),objNull, false, getPosASL (_this select 1),3.16228,1,75]; (_this select 0) setVariable [QGVAR(Dialing), false, true]; - }, [_unit,_explosive select 0], 0.25 * (count _arr - 4), 0] call EFUNC(common,waitAndExecute); + }, [_unit,_explosive select 0], 0.25 * (count _arr - 4)] call EFUNC(common,waitAndExecute); [_explosive select 0,(0.25 * (count _arr - 1)) + (_explosive select 2)] call FUNC(startTimer); }; }; diff --git a/addons/explosives/functions/fnc_dialingPhone.sqf b/addons/explosives/functions/fnc_dialingPhone.sqf index fa992a9cac..cb9d7f5450 100644 --- a/addons/explosives/functions/fnc_dialingPhone.sqf +++ b/addons/explosives/functions/fnc_dialingPhone.sqf @@ -17,7 +17,10 @@ * Public: No */ #include "script_component.hpp" -EXPLODE_4_PVT(_this select 0,_unit,_i,_arr,_code); + +params ["_args", "_pfID"]; +_args params ["_unit", "_i", "_arr", "_code"]; + if ((_i mod 4) == 0) then { playSound3D [QUOTE(PATHTO_R(Data\Audio\DialTone.wss)), objNull, false, (_unit modelToWorldVisual [0,0.2,2]), 15,1,2.5]; }; @@ -27,7 +30,7 @@ private "_explosive"; _explosive = [_code] call FUNC(getSpeedDialExplosive); if (_i >= (count _arr + 2)) then { - [_this select 1] call CALLSTACK(cba_fnc_removePerFrameHandler); + [_pfID] call CALLSTACK(cba_fnc_removePerFrameHandler); if ((count _explosive) > 0) then { [_unit, -1, [_explosive select 0, _explosive select 2]] call FUNC(detonateExplosive); }; @@ -41,4 +44,4 @@ if (_i == (count _arr)) then { playSound3D [QUOTE(PATHTO_R(Data\Audio\Cellphone_Ring.wss)),objNull, false, getPosASL (_explosive select 0),3.16228,1,75]; }; }; -(_this select 0) set [1, _i + 1]; +_args set [1, _i + 1]; diff --git a/addons/explosives/functions/fnc_getDetonators.sqf b/addons/explosives/functions/fnc_getDetonators.sqf index da0bdc93d2..54c942e9de 100644 --- a/addons/explosives/functions/fnc_getDetonators.sqf +++ b/addons/explosives/functions/fnc_getDetonators.sqf @@ -16,8 +16,11 @@ #include "script_component.hpp" // IGNORE_PRIVATE_WARNING(_detonators); -private ["_unit", "_items", "_result", "_config"]; -_unit = _this select 0; +params ["_unit"]; +TRACE_1("params",_unit); + +private ["_items", "_result", "_config"]; + _items = (items _unit); _result = []; diff --git a/addons/explosives/functions/fnc_getPlacedExplosives.sqf b/addons/explosives/functions/fnc_getPlacedExplosives.sqf index 0c2080923a..56334af65b 100644 --- a/addons/explosives/functions/fnc_getPlacedExplosives.sqf +++ b/addons/explosives/functions/fnc_getPlacedExplosives.sqf @@ -18,8 +18,11 @@ #include "script_component.hpp" // IGNORE_PRIVATE_WARNING(_allExplosives,_deadmanExplosives); -private ["_unit", "_clackerList", "_adjustedList", "_list", "_filter"]; -_unit = _this select 0; +params ["_unit"]; +TRACE_1("params",_unit); + +private ["_clackerList", "_adjustedList", "_list", "_filter"]; + _filter = nil; if (count _this > 1) then { _filter = ConfigFile >> "ACE_Triggers" >> (_this select 1); @@ -30,14 +33,14 @@ _clackerList = _unit getVariable [QGVAR(Clackers), []]; _list = []; { if (isNull (_x select 0)) then { - _clackerList set [_foreachIndex, "X"]; + _clackerList set [_forEachIndex, "X"]; _adjustedList = true; } else { if (isNil "_filter" || {(ConfigFile >> "ACE_Triggers" >> (_x select 4)) == _filter}) then { _list pushBack _x; }; }; -} foreach _clackerList; +} forEach _clackerList; if (_adjustedList) then { _clackerList = _clackerList - ["X"]; if (count _clackerList == 0) then { diff --git a/addons/explosives/functions/fnc_getSpeedDialExplosive.sqf b/addons/explosives/functions/fnc_getSpeedDialExplosive.sqf index b57f4f9f16..b6bd9b6e6f 100644 --- a/addons/explosives/functions/fnc_getSpeedDialExplosive.sqf +++ b/addons/explosives/functions/fnc_getSpeedDialExplosive.sqf @@ -14,8 +14,12 @@ * Public: Yes */ #include "script_component.hpp" -EXPLODE_1_PVT(_this,_code); + +params ["_code"]; +TRACE_1("params",_code); + private ["_explosive"]; + if (isNil QGVAR(CellphoneIEDs)) exitWith {[]}; _explosive = []; { @@ -24,4 +28,5 @@ _explosive = []; }; false } count GVAR(CellphoneIEDs); + _explosive diff --git a/addons/explosives/functions/fnc_handleScrollWheel.sqf b/addons/explosives/functions/fnc_handleScrollWheel.sqf index 3bef53e196..0d5fdd2aba 100644 --- a/addons/explosives/functions/fnc_handleScrollWheel.sqf +++ b/addons/explosives/functions/fnc_handleScrollWheel.sqf @@ -14,9 +14,9 @@ * Public: No */ #include "script_component.hpp" -if (isNull(GVAR(Setup)) || {ACE_Modifier == 0} || !GVAR(pfeh_running)) exitWith {false}; -_this = _this * 5; -GVAR(Setup) setDir ((getDir GVAR(Setup)) + _this); -GVAR(TweakedAngle) = GVAR(TweakedAngle) + _this; + +if ((!GVAR(pfeh_running)) || {ACE_Modifier == 0}) exitWith {false}; + +GVAR(TweakedAngle) = ((GVAR(TweakedAngle) + 7.2 * _this) + 360) % 360; true diff --git a/addons/explosives/functions/fnc_hasExplosives.sqf b/addons/explosives/functions/fnc_hasExplosives.sqf index bd790bd12f..4a626e9c63 100644 --- a/addons/explosives/functions/fnc_hasExplosives.sqf +++ b/addons/explosives/functions/fnc_hasExplosives.sqf @@ -9,16 +9,18 @@ * The unit has explosives * * Example: - * _hasExplosives = [player] call ACE_Explosives_fnc_hasExplosives; + * hasExplosives = [player] call ACE_Explosives_fnc_hasExplosives; * * Public: Yes */ #include "script_component.hpp" -// IGNORE_PRIVATE_WARNING(_hasExplosives); -private ["_unit", "_result", "_magazines"]; +params ["_unit"]; +TRACE_1("params",_unit); + +private ["_result", "_magazines"]; + _result = false; -_unit = _this select 0; _magazines = magazines _unit; { if (getNumber (ConfigFile >> "CfgMagazines" >> _x >> "ACE_Placeable") == 1) exitWith { diff --git a/addons/explosives/functions/fnc_interactEH.sqf b/addons/explosives/functions/fnc_interactEH.sqf index 4e916edb82..9be7568530 100644 --- a/addons/explosives/functions/fnc_interactEH.sqf +++ b/addons/explosives/functions/fnc_interactEH.sqf @@ -16,7 +16,8 @@ */ #include "script_component.hpp" -PARAMS_1(_interactionType); +params ["_interactionType"]; +TRACE_1("params",_interactionType); //Ignore self-interaction menu if (_interactionType != 0) exitWith {}; @@ -26,8 +27,8 @@ if ((vehicle ACE_player) != ACE_player) exitWith {}; if (!("ACE_DefusalKit" in (items ACE_player))) exitWith {}; [{ - PARAMS_2(_args,_pfID); - EXPLODE_3_PVT(_args,_setPosition,_addedDefuseHelpers,_minesHelped); + params ["_args", "_pfID"]; + _args params ["_setPosition", "_addedDefuseHelpers", "_minesHelped"]; if (!EGVAR(interact_menu,keyDown)) then { TRACE_1("Cleaning Defuse Helpers",(count _addedDefuseHelpers)); diff --git a/addons/explosives/functions/fnc_module.sqf b/addons/explosives/functions/fnc_module.sqf index 56225d8ca8..6764e9bea4 100644 --- a/addons/explosives/functions/fnc_module.sqf +++ b/addons/explosives/functions/fnc_module.sqf @@ -14,20 +14,13 @@ * Public: No */ #include "script_component.hpp" + if !(isServer) exitWith {}; -private["_activated", "_logic"]; +params ["_logic"]; -_logic = _this select 0; -_activated = _this select 2; +[_logic, QGVAR(RequireSpecialist), "RequireSpecialist"] call EFUNC(Common,readSettingFromModule); +[_logic, QGVAR(PunishNonSpecialists),"PunishNonSpecialists"] call EFUNC(Common,readSettingFromModule); +[_logic, QGVAR(ExplodeOnDefuse),"ExplodeOnDefuse"] call EFUNC(Common,readSettingFromModule); -if !(_activated) exitWith {}; - -[_logic, QGVAR(RequireSpecialist), "RequireSpecialist"] - call EFUNC(Common,readSettingFromModule); -[_logic, QGVAR(PunishNonSpecialists),"PunishNonSpecialists"] - call EFUNC(Common,readSettingFromModule); -[_logic, QGVAR(ExplodeOnDefuse),"ExplodeOnDefuse"] - call EFUNC(Common,readSettingFromModule); - -diag_log text "[ACE]: Explosive Module Initialized."; +ACE_LOGINFO("Explosive Module Initialized."); diff --git a/addons/explosives/functions/fnc_onKilled.sqf b/addons/explosives/functions/fnc_onIncapacitated.sqf similarity index 74% rename from addons/explosives/functions/fnc_onKilled.sqf rename to addons/explosives/functions/fnc_onIncapacitated.sqf index 74775b2e66..963f106979 100644 --- a/addons/explosives/functions/fnc_onKilled.sqf +++ b/addons/explosives/functions/fnc_onIncapacitated.sqf @@ -14,13 +14,14 @@ * Public: No */ #include "script_component.hpp" + +//NOTE: Extended_Killed_EventHandlers runs only where _unit is local +params ["_unit"]; +TRACE_1("params",_unit); + private ["_deadman"]; -_unit = _this select 0; -if (_unit == ACE_player) then { - call FUNC(place_Cancel); -}; -if (!isServer) exitWith{}; + _deadman = [_unit, "DeadManSwitch"] call FUNC(getPlacedExplosives); { [_unit, -1, _x, true] call FUNC(detonateExplosive); -} foreach _deadman; +} forEach _deadman; diff --git a/addons/explosives/functions/fnc_onInventoryChanged.sqf b/addons/explosives/functions/fnc_onInventoryChanged.sqf index 53ebb2464d..3e3e1b96d3 100644 --- a/addons/explosives/functions/fnc_onInventoryChanged.sqf +++ b/addons/explosives/functions/fnc_onInventoryChanged.sqf @@ -17,8 +17,11 @@ * Public: No */ #include "script_component.hpp" + +params ["_receiver", "_giver", "_item"]; +TRACE_3("params",_receiver,_giver,_item); + private ["_config", "_detonators"]; -PARAMS_3(_receiver,_giver,_item); if (_receiver != ace_player) exitWith {}; diff --git a/addons/explosives/functions/fnc_onLanded.sqf b/addons/explosives/functions/fnc_onLanded.sqf deleted file mode 100644 index f2ed729b1a..0000000000 --- a/addons/explosives/functions/fnc_onLanded.sqf +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Author: Garth 'L-H' de Wet - * Handles the "EpeContactStart" event when placing the explosive. - * - * Arguments: - * 0: Explosive Placing Object - * 1: Colliding Object - * - * Return Value: - * None - * - * Example: - * object addEventHandler ["EpeContactStart", ACE_explosive_fnc_onLanded]; - * - * Public: No - */ -#include "script_component.hpp" -EXPLODE_2_PVT(_this,_explosive,_hitTarget); - -TRACE_2("Explosive EpeContactStart",_explosive,_hitTarget); - -if ((_explosive getVariable [QGVAR(Handled), false])) exitWith {}; - -_explosive setVariable [QGVAR(Handled), true]; -if (!isNull _hitTarget && {_hitTarget isKindOf "AllVehicles"}) then { - TRACE_1("Attaching to",_hitTarget); - _explosive attachTo [_hitTarget]; - private "_dir"; - _dir = _explosive getVariable [QGVAR(Direction), 0]; - _dir = _dir - (getDir _hitTarget); - [[_explosive, _dir, 0], QFUNC(setPosition)] call EFUNC(common,execRemoteFnc); -} else { - [{ - EXPLODE_2_PVT(_this,_player,_explosive); - private "_pos"; - _pos = getPosASL _explosive; - if (surfaceIsWater _pos) then { - _pos = getPosASL _explosive; - _explosive setPosASL _pos; - }else{ - _pos = getPosATL _explosive; - _explosive setPosATL _pos; - }; - }, [ACE_player, _explosive], 0.5, 0.1] call EFUNC(common,waitAndExecute); -}; diff --git a/addons/explosives/functions/fnc_openTimerSetUI.sqf b/addons/explosives/functions/fnc_openTimerSetUI.sqf index d08d7444dd..7175f425d4 100644 --- a/addons/explosives/functions/fnc_openTimerSetUI.sqf +++ b/addons/explosives/functions/fnc_openTimerSetUI.sqf @@ -15,7 +15,10 @@ * Public: No */ #include "script_component.hpp" -EXPLODE_2_PVT(_this,_explosive,_mag); + +params ["_explosive", "_mag"]; +TRACE_2("params",_explosive,_mag); + createDialog "RscACE_SelectTimeUI"; sliderSetRange [8845, 5, 900]; // 5seconds - 15minutes sliderSetPosition [8845, 30]; diff --git a/addons/explosives/functions/fnc_placeExplosive.sqf b/addons/explosives/functions/fnc_placeExplosive.sqf index 68580c2ba0..5e4999b1f4 100644 --- a/addons/explosives/functions/fnc_placeExplosive.sqf +++ b/addons/explosives/functions/fnc_placeExplosive.sqf @@ -21,9 +21,11 @@ * Public: Yes */ #include "script_component.hpp" -private ["_ammo", "_explosive", "_attachedTo", "_expPos", "_magazineTrigger"]; -EXPLODE_6_PVT(_this,_unit,_pos,_dir,_magazineClass,_triggerConfig,_triggerSpecificVars); -DEFAULT_PARAM(6,_setupPlaceholderObject,objNull); + +params ["_unit", "_pos", "_dir", "_magazineClass", "_triggerConfig", "_triggerSpecificVars", ["_setupPlaceholderObject", objNull]]; +TRACE_7("params",_unit,_pos,_dir,_magazineClass,_triggerConfig,_triggerSpecificVars,_setupPlaceholderObject); + +private ["_ammo", "_explosive", "_attachedTo", "_magazineTrigger", "_pitch", "_digDistance", "_canDigDown", "_soundEnviron", "_surfaceType"]; _unit playActionNow "PutDown"; @@ -34,7 +36,7 @@ if (!isNull _setupPlaceholderObject) then { }; if (isNil "_triggerConfig") exitWith { - diag_log format ["ACE_Explosives: Error config not passed to PlaceExplosive: %1", _this]; + ACE_LOGERROR_1("Config not passed to PlaceExplosive: %1",_this); objNull }; @@ -42,7 +44,7 @@ _magazineTrigger = ConfigFile >> "CfgMagazines" >> _magazineClass >> "ACE_Trigge _triggerConfig = ConfigFile >> "ACE_Triggers" >> _triggerConfig; if (isNil "_triggerConfig") exitWith { - diag_log format ["ACE_Explosives: Error config not found in PlaceExplosive: %1", _this]; + ACE_LOGERROR_1("Config not found in PlaceExplosive: %1",_this); objNull }; @@ -52,6 +54,28 @@ if (isText(_magazineTrigger >> "ammo")) then { }; _triggerSpecificVars pushBack _triggerConfig; +//Dig the explosive down into the ground (usually on "pressurePlate") +if (isNumber (_magazineTrigger >> "digDistance")) then { + _digDistance = getNumber (_magazineTrigger >> "digDistance"); + + //Get Surface Type: + _canDigDown = true; + _surfaceType = surfaceType _pos; + if ((_surfaceType select [0,1]) == "#") then {_surfaceType = _surfaceType select [1, 99];}; + if ((_surfaceType != "") || {isClass (configfile >> "CfgSurfaces" >> _surfaceType >> "soundEnviron")}) then { + _soundEnviron = getText (configfile >> "CfgSurfaces" >> _surfaceType >> "soundEnviron"); + TRACE_2("Dig Down Surface",_surfaceType,_soundEnviron); + _canDigDown = !(_soundEnviron in ["road", "tarmac", "concrete", "concrete_int", "int_concrete", "concrete_ext"]); + }; + //Don't dig down if pos ATL is high (in a building or A2 road) + if (_canDigDown && {(_pos select 2) < 0.1}) then { + TRACE_2("Can Dig Down",_digDistance,_pos); + _pos = _pos vectorAdd [0,0, (-1 * _digDistance)]; + } else { + TRACE_2("Can NOT Dig Down",_digDistance,_pos); + }; +}; + _explosive = createVehicle [_ammo, _pos, [], 0, "NONE"]; _explosive setPosATL _pos; @@ -60,7 +84,17 @@ if (!isNull _attachedTo) then { _explosive attachTo [_attachedTo]; }; -if (isText(_triggerConfig >> "onPlace") && {[_unit,_explosive,_magazineClass,_triggerSpecificVars] - call compile (getText (_triggerConfig >> "onPlace"))}) exitWith {_explosive}; -[[_explosive, _dir, getNumber (_magazineTrigger >> "pitch")], QFUNC(setPosition)] call EFUNC(common,execRemoteFnc); +//If trigger has "onPlace" and it returns true, just exitWith the explosive +if (isText(_triggerConfig >> "onPlace") && {[_unit,_explosive,_magazineClass,_triggerSpecificVars] call compile (getText (_triggerConfig >> "onPlace"))}) exitWith { + TRACE_1("onPlace returns true",_explosive); + _explosive +}; + +//TODO: placing explosives on hills looks funny + +_pitch = getNumber (_magazineTrigger >> "pitch"); + +//Globaly set the position angle: +[QGVAR(place), [_explosive, _dir, _pitch]] call EFUNC(common,globalEvent); + _explosive diff --git a/addons/explosives/functions/fnc_place_Approve.sqf b/addons/explosives/functions/fnc_place_Approve.sqf deleted file mode 100644 index 0604045f65..0000000000 --- a/addons/explosives/functions/fnc_place_Approve.sqf +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Author: Garth 'L-H' de Wet - * Approves placement of the explosive, releases the placement object for it - * to settle in a location suitable for the explosive to be created. - * - * Arguments: - * None - * - * Return Value: - * None - * - * Example: - * call ACE_Explosives_fnc_place_Approve; - * - * Public: No - */ -#include "script_component.hpp" -if (GVAR(pfeh_running)) then { - [QGVAR(Placement),"OnEachFrame"] call CALLSTACK(BIS_fnc_removeStackedEventHandler); - GVAR(pfeh_running) = false; -}; -private ["_setup", "_player", "_dir"]; -_setup = GVAR(Setup); -GVAR(Setup) = objNull; -[GVAR(placer), "ACE_Explosives", false] call EFUNC(Common,setForceWalkStatus); -[ACE_player, "DefaultAction", ACE_player getVariable [QGVAR(Place), -1]] call EFUNC(Common,removeActionEventHandler); -[ACE_player, "zoomtemp", ACE_player getVariable [QGVAR(Cancel), -1]] call EFUNC(Common,removeActionEventHandler); -GVAR(placer) = objNull; -_player = ACE_player; -call EFUNC(interaction,hideMouseHint); -if ((_setup getVariable [QGVAR(Class), ""]) == "") exitWith { - deleteVehicle _setup; -}; -_dir = (getDir _setup); -if (_dir > 180) then { - _dir = _dir - 180; -} else { - _dir = 180 + _dir; -}; -_setup setVariable [QGVAR(Direction), _dir, true]; -_player setVariable [QGVAR(PlantingExplosive), true]; -[{_this setVariable [QGVAR(PlantingExplosive), false]}, _player, 1.5, 0.5] call EFUNC(common,waitAndExecute); -_setup addEventHandler ["EpeContactStart", FUNC(onLanded)]; -_setup enableSimulationGlobal true; -_player playActionNow "PutDown"; -_player removeMagazine (_setup getVariable [QGVAR(Class), ""]); diff --git a/addons/explosives/functions/fnc_place_Cancel.sqf b/addons/explosives/functions/fnc_place_Cancel.sqf deleted file mode 100644 index 78d718e283..0000000000 --- a/addons/explosives/functions/fnc_place_Cancel.sqf +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Author: Garth 'L-H' de Wet - * Cancels placement of the explosive - * - * Arguments: - * None - * - * Return Value: - * None - * - * Example: - * call ACE_Explosives_fnc_place_Cancel; - * - * Public: Yes - */ -#include "script_component.hpp" -if (GVAR(pfeh_running)) then { - [QGVAR(Placement),"OnEachFrame"] call CALLSTACK(BIS_fnc_removeStackedEventHandler); - GVAR(pfeh_running) = false; -}; -if (!isNull (GVAR(Setup))) then { - deleteVehicle GVAR(Setup); -}; -GVAR(Setup) = objNull; -if (isNil {GVAR(placer)}) then { - GVAR(placer) = objNull; -}; -[GVAR(placer), "ACE_Explosives", false] call EFUNC(Common,setForceWalkStatus); -GVAR(placer) = objNull; -call EFUNC(interaction,hideMouseHint); -[ACE_player, "DefaultAction", ACE_player getVariable [QGVAR(Place), -1]] call EFUNC(Common,removeActionEventHandler); -[ACE_player, "zoomtemp", ACE_player getVariable [QGVAR(Cancel), -1]] call EFUNC(Common,removeActionEventHandler); diff --git a/addons/explosives/functions/fnc_removeFromSpeedDial.sqf b/addons/explosives/functions/fnc_removeFromSpeedDial.sqf index c67313966c..00b1cbba2a 100644 --- a/addons/explosives/functions/fnc_removeFromSpeedDial.sqf +++ b/addons/explosives/functions/fnc_removeFromSpeedDial.sqf @@ -14,13 +14,15 @@ * Public: Yes */ #include "script_component.hpp" + private "_speedDial"; + _speedDial = ace_player getVariable [QGVAR(SpeedDial), []]; if (count _speedDial == 0) exitWith {}; { if ((_x select 0) == (_this select 0)) exitWith { - _speedDial set [_foreachIndex, "x"]; + _speedDial set [_forEachIndex, "x"]; _speedDial = _speedDial - ["x"]; ace_player setVariable [QGVAR(SpeedDial),_speedDial]; }; -} foreach _speedDial; +} forEach _speedDial; diff --git a/addons/explosives/functions/fnc_selectTrigger.sqf b/addons/explosives/functions/fnc_selectTrigger.sqf index 53bc8b66cb..203bfaf606 100644 --- a/addons/explosives/functions/fnc_selectTrigger.sqf +++ b/addons/explosives/functions/fnc_selectTrigger.sqf @@ -16,12 +16,17 @@ * Public: No */ #include "script_component.hpp" + +params ["_explosive", "_magazine", "_trigger"]; +TRACE_3("params",_explosive,_magazine,_trigger); + private ["_config"]; -EXPLODE_3_PVT(_this,_explosive,_magazine,_trigger); _config = ConfigFile >> "ACE_Triggers" >> _trigger; // If the onSetup function returns true, it is handled elsewhere -if (isText(_config >> "onSetup") && {[_explosive,_magazine] call compile getText (_config >> "onSetup")}) exitWith {}; +if (isText(_config >> "onSetup") && {[_explosive,_magazine] call compile getText (_config >> "onSetup")}) exitWith { + TRACE_2("onSetup returned true",_explosive,_trigger); +}; -[ACE_player, getPosATL _explosive, _explosive getVariable [QGVAR(Direction), 0],_magazine, _trigger, [], _explosive] call ACE_Explosives_fnc_placeExplosive; +[ACE_player, getPosATL _explosive, _explosive getVariable [QGVAR(Direction), 0],_magazine, _trigger, [], _explosive] call FUNC(placeExplosive); diff --git a/addons/explosives/functions/fnc_setPosition.sqf b/addons/explosives/functions/fnc_setPosition.sqf index dcf2537776..b19e63ff5a 100644 --- a/addons/explosives/functions/fnc_setPosition.sqf +++ b/addons/explosives/functions/fnc_setPosition.sqf @@ -11,13 +11,21 @@ * None * * Example: - * [_explosive, 150, 90] call ACE_Explosives_fnc_SetPos; + * [_explosive, 150, 90] call ACE_Explosives_fnc_setPosition; * - * Public: Yes + * Public: No */ #include "script_component.hpp" -EXPLODE_3_PVT(_this,_explosive,_direction,_pitch); -_explosive setDir _direction; -if (_pitch != 0) then { - [_explosive, _pitch, 0] call CALLSTACK(BIS_fnc_setPitchBank); + +params ["_explosive", "_direction", "_pitch"]; +TRACE_3("params",_explosive,_direction,_pitch); + +if (isNull (attachedTo _explosive)) then { + _explosive setDir _direction; + if (_pitch != 0) then { + [_explosive, _pitch, 0] call CALLSTACK(BIS_fnc_setPitchBank); + }; +} else { + //Attaching to a vehicle (dirAndUp based on vehicle) + _explosive setVectorDirAndUp [[0,0,1],[(sin _direction),(cos _direction),0]]; }; diff --git a/addons/explosives/functions/fnc_setSpeedDial.sqf b/addons/explosives/functions/fnc_setSpeedDial.sqf index adb2e6af03..9013c812cc 100644 --- a/addons/explosives/functions/fnc_setSpeedDial.sqf +++ b/addons/explosives/functions/fnc_setSpeedDial.sqf @@ -15,7 +15,9 @@ * Public: No */ #include "script_component.hpp" + private ["_speedDial", "_amount"]; + _speedDial = ace_player getVariable [QGVAR(SpeedDial), []]; if (count _speedDial == 0) exitWith {}; _amount = if((_this select 0))then{1}else{-1}; diff --git a/addons/explosives/functions/fnc_setupExplosive.sqf b/addons/explosives/functions/fnc_setupExplosive.sqf index 566ab9c281..b104761fac 100644 --- a/addons/explosives/functions/fnc_setupExplosive.sqf +++ b/addons/explosives/functions/fnc_setupExplosive.sqf @@ -3,8 +3,9 @@ * Starts the setup process for the passed explosive. Player only. * * Arguments: - * 0: Unit - * 1: Classname of explosive to place. (CfgMagazine class) + * 0: Vehicle + * 1: Player Unit + * 2: Classname of explosive to place. (CfgMagazine class) * * Return Value: * None @@ -14,36 +15,203 @@ * * Public: Yes */ +// #define ENABLE_PERFORMANCE_COUNTERS #include "script_component.hpp" -closeDialog 0; -EXPLODE_2_PVT(_this,_unit,_class); -GVAR(placer) = _unit; -// TODO: check MP performance and MP compatible. -GVAR(Setup) = createVehicle [getText(ConfigFile >> "CfgMagazines" >> _class >> "ACE_SetupObject"),[0,0,-10000],[], 0, "NONE"]; -GVAR(Setup) enableSimulationGlobal false; -GVAR(Setup) setVariable [QGVAR(class), _class, true]; +#define PLACE_RANGE_MAX 1 +#define PLACE_RANGE_MIN 0.025 + +params ["_vehicle", "_unit", "_magClassname"]; +TRACE_3("params",_vehicle,_unit,_magClassname); + +private["_isAttachable", "_setupObjectClass", "_supportedTriggers", "_p3dModel"]; + +//Get setup object vehicle and model: +_setupObjectClass = getText(ConfigFile >> "CfgMagazines" >> _magClassname >> "ACE_SetupObject"); +if (!isClass (configFile >> "CfgVehicles" >> _setupObjectClass)) exitWith {ERROR("Bad Vehicle");}; +_p3dModel = getText (configFile >> "CfgVehicles" >> _setupObjectClass >> "model"); +if (_p3dModel == "") exitWith {ERROR("No Model");}; //"" - will crash game! [_unit, "ACE_Explosives", true] call EFUNC(common,setForceWalkStatus); -GVAR(TweakedAngle) = 180; -[QGVAR(Placement),"OnEachFrame", { - private ["_player", "_pos"]; - _player = ACE_player; - if (GVAR(placer) != _player) exitWith { - call FUNC(place_Cancel); - }; - GVAR(pfeh_running) = true; - _pos = (ASLtoATL eyePos _player) vectorAdd (positionCameraToWorld [0,0,1] vectorDiff positionCameraToWorld [0,0,0]); - GVAR(Setup) setPosATL _pos; - if (ACE_Modifier == 0) then { - GVAR(Setup) setDir (GVAR(TweakedAngle) + getDir _player); - }; -}] call CALLSTACK(BIS_fnc_addStackedEventHandler); +//Show mouse buttons: +[localize LSTRING(PlaceAction), localize LSTRING(CancelAction), localize LSTRING(ScrollAction)] call EFUNC(interaction,showMouseHint); +_unit setVariable [QGVAR(placeActionEH), [_unit, "DefaultAction", {true}, {GVAR(placeAction) = PLACE_APPROVE;}] call EFUNC(common,AddActionEventHandler)]; +_unit setVariable [QGVAR(cancelActionEH), [_unit, "zoomtemp", {true}, {GVAR(placeAction) = PLACE_CANCEL;}] call EFUNC(common,AddActionEventHandler)]; -[localize LSTRING(PlaceAction), localize LSTRING(CancelAction), - localize LSTRING(ScrollAction)] call EFUNC(interaction,showMouseHint); -_unit setVariable [QGVAR(Place), [_unit, "DefaultAction", - {GVAR(pfeh_running) AND !isNull (GVAR(Setup))}, {call FUNC(place_Approve);}] call EFUNC(common,AddActionEventHandler)]; -_unit setVariable [QGVAR(Cancel), [_unit, "zoomtemp", - {GVAR(pfeh_running) AND !isNull (GVAR(Setup))}, {call FUNC(place_Cancel);}] call EFUNC(common,AddActionEventHandler)]; +//Display to show virtual object: +(QGVAR(virtualAmmo) call BIS_fnc_rscLayer) cutRsc [QGVAR(virtualAmmo), "PLAIN", 0, false]; +((uiNamespace getVariable [QGVAR(virtualAmmoDisplay), displayNull]) displayCtrl 800851) ctrlSetModel _p3dModel; + +//Make sure it has a trigger that works when attached (eg, no tripwires that only do pressurePlate) +_isAttachable = false; +_supportedTriggers = getArray (configFile >> "CfgMagazines" >> _magClassname >> "ACE_Triggers" >> "SupportedTriggers"); +{ + if ((getNumber (configFile >> "ACE_Triggers" >> _x >> "isAttachable")) == 1) exitWith {_isAttachable = true;}; +} forEach _supportedTriggers; + + +GVAR(pfeh_running) = true; +GVAR(placeAction) = PLACE_WAITING; +GVAR(TweakedAngle) = 0; + + +[{ + BEGIN_COUNTER(pfeh); + + params ["_args", "_pfID"]; + _args params ["_unit", "_magClassname", "_setupObjectClass", "_isAttachable"]; + + private["_angle", "_attachVehicle", "_badPosition", "_basePosASL", "_cameraAngle", "_distanceFromBase", "_expSetupVehicle", "_index", "_intersectsWith", "_lookDirVector", "_max", "_min", "_modelDir", "_modelOffset", "_modelUp", "_placeAngle", "_realDistance", "_return", "_screenPos", "_testBase", "_testPos", "_testPositionIsValid", "_virtualPosASL"]; + + _lookDirVector = ((positionCameraToWorld [0,0,0]) call EFUNC(common,positionToASL)) vectorFromTo ((positionCameraToWorld [0,0,10]) call EFUNC(common,positionToASL)); + _basePosASL = (eyePos _unit); + if (cameraView == "EXTERNAL") then { //If external, show explosive over the right shoulder + _basePosASL = _basePosASL vectorAdd ((positionCameraToWorld [0.3,0,0]) vectorDiff (positionCameraToWorld [0,0,0])); + }; + if ((stance _unit) == "PRONE") then { + //If prone, lower base and increase up angle of look - Makes it much easier to attach to underside of vehicles + _basePosASL set [2, ((_basePosASL select 2) - 0.3)]; + _lookDirVector = ((positionCameraToWorld [0,0,0]) call EFUNC(common,positionToASL)) vectorFromTo ((positionCameraToWorld [0,3,10]) call EFUNC(common,positionToASL)); + }; + _cameraAngle = (_lookDirVector select 0) atan2 (_lookDirVector select 1); + + _testPositionIsValid = { + _testBase = _basePosASL vectorAdd (_lookDirVector vectorMultiply (_this select 0)); + _return = true; + { + _testPos = _testBase vectorAdd [0.1 * (_x select 0) * (cos _cameraAngle), 0.1 * (_x select 0) * (sin _cameraAngle), 0.1 * (_x select 1)]; + #ifdef DEBUG_MODE_FULL + drawLine3d [(eyePos _unit) call EFUNC(common,ASLToPosition), (_testPos) call EFUNC(common,ASLToPosition), [1,0,0,1]]; + #endif + if (lineIntersects [eyePos _unit, _testPos, _unit]) exitWith {_return = false;}; + } forEach [[0,0], [-1,-1], [1,-1], [-1,1], [1,1]]; + _return + }; + + _distanceFromBase = PLACE_RANGE_MAX; + _badPosition = !([_distanceFromBase] call _testPositionIsValid); + _attachVehicle = objNull; + + if (_isAttachable && _badPosition) then { + _attachVehicle = objNull; + _testBase = _basePosASL vectorAdd _lookDirVector; + { + _testPos = _testBase vectorAdd [0.1 * (_x select 0) * (cos _cameraAngle), 0.1 * (_x select 0) * (sin _cameraAngle), 0.1 * (_x select 1)]; + _intersectsWith = lineIntersectsWith [eyePos _unit, _testPos, _unit]; + if (count _intersectsWith == 1) exitWith {_attachVehicle = (_intersectsWith select 0);}; + } forEach [[0,0], [-1,-1], [1,-1], [-1,1], [1,1]]; + if ((!isNull _attachVehicle) && {[PLACE_RANGE_MIN] call _testPositionIsValid} && + {(_attachVehicle isKindOf "Car") || {_attachVehicle isKindOf "Tank"} || {_attachVehicle isKindOf "Air"} || {_attachVehicle isKindOf "Ship"}}) then { + _min = PLACE_RANGE_MIN; + _max = PLACE_RANGE_MAX; + for "_index" from 0 to 6 do { + _distanceFromBase = (_min + _max) / 2; + if ([_distanceFromBase] call _testPositionIsValid) then { + _min = _distanceFromBase; + } else { + _max = _distanceFromBase; + }; + }; + _badPosition = false; + _distanceFromBase = ((_min + _max) / 2 + 0.075) min 1; + } else { + _attachVehicle = objNull; + }; + }; + + _virtualPosASL = _basePosASL vectorAdd (_lookDirVector vectorMultiply _distanceFromBase); + + //Update mouse hint: + if (_badPosition) then { + ((uiNamespace getVariable ["ACE_Helper_Display", objNull]) displayCtrl 1000) ctrlSetText localize LSTRING(BlockedAction); + } else { + if (isNull _attachVehicle) then { + ((uiNamespace getVariable ["ACE_Helper_Display", objNull]) displayCtrl 1000) ctrlSetText localize LSTRING(PlaceAction); + } else { + ((uiNamespace getVariable ["ACE_Helper_Display", objNull]) displayCtrl 1000) ctrlSetText localize LSTRING(AttachAction); + }; + }; + + //Don't allow Placing bellow terrain + if ((getTerrainHeightASL _virtualPosASL) > (_virtualPosASL select 2)) then { + _virtualPosASL set [2, (getTerrainHeightASL _virtualPosASL)]; + }; + + //Don't allow placing in a bad position: + if (_badPosition && {GVAR(placeAction) == PLACE_APPROVE}) then {GVAR(placeAction) = PLACE_WAITING;}; + + if (((inputAction "zoomTemp") > 0) || //Cancel on RMB, For some reason this works (when held) but AddActionEventHandler doesn't + {_unit != ACE_player} || + {!([_unit, objNull, ["isNotSwimming"]] call EFUNC(common,canInteractWith))} || + {!(_magClassname in (magazines _unit))}) then { + GVAR(placeAction) = PLACE_CANCEL; + }; + + if (GVAR(placeAction) != PLACE_WAITING) then { + [_pfID] call CBA_fnc_removePerFrameHandler; + GVAR(pfeh_running) = false; + + [_unit, "ACE_Explosives", false] call EFUNC(common,setForceWalkStatus); + [] call EFUNC(interaction,hideMouseHint); + [_unit, "DefaultAction", (_unit getVariable [QGVAR(placeActionEH), -1])] call EFUNC(common,removeActionEventHandler); + [_unit, "zoomtemp", (_unit getVariable [QGVAR(cancelActionEH), -1])] call EFUNC(common,removeActionEventHandler); + + (QGVAR(virtualAmmo) call BIS_fnc_rscLayer) cutText ["", "PLAIN"]; + + if (GVAR(placeAction) == PLACE_APPROVE) then { + _placeAngle = 0; + _expSetupVehicle = _setupObjectClass createVehicle (_virtualPosASL call EFUNC(common,ASLToPosition)); + + TRACE_1("Planting Mass", (getMass _expSetupVehicle)); + //If the object is too heavy, it can kill a player if it colides + if ((getMass _expSetupVehicle) > 5) then {_expSetupVehicle setMass 5;}; + + if (isNull _attachVehicle) then { + _placeAngle = _cameraAngle - GVAR(TweakedAngle) + 180; + _expSetupVehicle setPosAsl _virtualPosASL; + _expSetupVehicle setDir _placeAngle; + _placeAngle = _placeAngle + 180; //CfgAmmos seem to be 180 for some reason + } else { + _modelOffset = _attachVehicle worldToModel (_virtualPosASL call EFUNC(common,ASLToPosition)); + _placeAngle = _cameraAngle - (getDir _attachVehicle) + 180; + _expSetupVehicle attachTo [_attachVehicle, _modelOffset]; + _expSetupVehicle setVectorDirAndUp [[0,0,-1],[(sin _placeAngle),(cos _placeAngle),0]]; + }; + + TRACE_1("Place angel",_placeAngle); + + _expSetupVehicle setVariable [QGVAR(class), _magClassname, true]; + _expSetupVehicle setVariable [QGVAR(Direction), _placeAngle, true]; + + _unit removeMagazine _magClassname; + _unit playActionNow "PutDown"; + _unit setVariable [QGVAR(PlantingExplosive), true]; + [{_this setVariable [QGVAR(PlantingExplosive), false]}, _unit, 1.5] call EFUNC(common,waitAndExecute); + + }; + } else { + _screenPos = worldToScreen (_virtualPosASL call EFUNC(common,ASLToPosition)); + if (_badPosition || {_screenPos isEqualTo []}) then { + ((uiNamespace getVariable [QGVAR(virtualAmmoDisplay), displayNull]) displayCtrl 800851) ctrlShow false; + } else { + //Show the model on the hud in aprox the same size/location as it will be placed: + ((uiNamespace getVariable [QGVAR(virtualAmmoDisplay), displayNull]) displayCtrl 800851) ctrlShow true; + + _realDistance = ((_virtualPosASL call EFUNC(common,ASLToPosition)) distance (positionCameraToWorld [0,0,0])) / ((call CBA_fnc_getFov) select 1); + _screenPos = [(_screenPos select 0), _realDistance, (_screenPos select 1)]; + ((uiNamespace getVariable [QGVAR(virtualAmmoDisplay), displayNull]) displayCtrl 800851) ctrlSetPosition _screenPos; + + _modelDir = [0,0,-1]; + _modelUp = [0,-1,0]; + if (isNull _attachVehicle) then { + _angle = acos (_lookDirVector select 2); + _modelUp = [0, (cos _angle), (sin _angle)]; + _modelDir = [cos GVAR(TweakedAngle), sin GVAR(TweakedAngle), 0] vectorCrossProduct _modelUp; + }; + ((uiNamespace getVariable [QGVAR(virtualAmmoDisplay), displayNull]) displayCtrl 800851) ctrlSetModelDirAndUp [_modelDir, _modelUp]; + }; + }; + + END_COUNTER(pfeh); +}, 0, [_unit, _magClassname, _setupObjectClass, _isAttachable]] call CBA_fnc_addPerFrameHandler; diff --git a/addons/explosives/functions/fnc_startDefuse.sqf b/addons/explosives/functions/fnc_startDefuse.sqf index 251e1e213d..2c394a997a 100644 --- a/addons/explosives/functions/fnc_startDefuse.sqf +++ b/addons/explosives/functions/fnc_startDefuse.sqf @@ -15,14 +15,17 @@ * Public: Yes */ #include "script_component.hpp" -EXPLODE_2_PVT(_this,_unit,_target); + +params ["_unit", "_target"]; +TRACE_2("params",_unit,_target); private["_actionToPlay", "_defuseTime", "_isEOD"]; _target = attachedTo (_target); _fnc_DefuseTime = { - EXPLODE_2_PVT(_this,_specialist,_target); + params ["_specialist", "_target"]; + TRACE_2("defuseTime",_specialist,_target); private ["_defuseTime"]; _defuseTime = 5; if (isNumber(ConfigFile >> "CfgAmmo" >> typeOf (_target) >> "ACE_DefuseTime")) then { @@ -48,11 +51,12 @@ if (ACE_player != _unit) then { _unit disableAI "TARGET"; _defuseTime = [[_unit] call EFUNC(Common,isEOD), _target] call _fnc_DefuseTime; [{ - PARAMS_2(_unit,_target); + params ["_unit", "_target"]; + TRACE_2("defuse finished",_unit,_target); [_unit, _target] call FUNC(defuseExplosive); _unit enableAI "MOVE"; _unit enableAI "TARGET"; - }, [_unit, _target], _defuseTime, 0] call EFUNC(common,waitAndExecute); + }, [_unit, _target], _defuseTime] call EFUNC(common,waitAndExecute); }; } else { _unit playActionNow _actionToPlay; diff --git a/addons/explosives/functions/fnc_startTimer.sqf b/addons/explosives/functions/fnc_startTimer.sqf index 9d2ca0aee4..ca219ed13c 100644 --- a/addons/explosives/functions/fnc_startTimer.sqf +++ b/addons/explosives/functions/fnc_startTimer.sqf @@ -16,12 +16,13 @@ */ #include "script_component.hpp" -EXPLODE_2_PVT(_this,_explosive,_delay); +params ["_explosive", "_delay"]; +TRACE_2("params",_explosive,_delay); [{ - private ["_explosive"]; - _explosive = _this; + params ["_explosive"]; + TRACE_1("Explosive Going Boom",_explosive); if (!isNull _explosive) then { [_explosive, -1, [_explosive, 0]] call FUNC(detonateExplosive); }; -}, _explosive, _delay, 0] call EFUNC(common,waitAndExecute); +}, [_explosive], _delay] call EFUNC(common,waitAndExecute); diff --git a/addons/explosives/functions/fnc_triggerType.sqf b/addons/explosives/functions/fnc_triggerType.sqf index f9d8790a56..0fc29e34ad 100644 --- a/addons/explosives/functions/fnc_triggerType.sqf +++ b/addons/explosives/functions/fnc_triggerType.sqf @@ -9,17 +9,19 @@ * Supported triggers as ACE_Triggers config entries * * Example: - * _supports = ["SatchelCharge_Remote_Mag"] call ACE_Explosives_fnc_TriggerType + * ["SatchelCharge_Remote_Mag"] call ACE_Explosives_fnc_TriggerType * * Public: Yes */ #include "script_component.hpp" -private["_result", "_config", "_count", "_index", "_supports"]; -// IGNORE_PRIVATE_WARNING(_supports); +params ["_magazineClassname"]; +TRACE_1("params",_magazineClassname); + +private["_result", "_config", "_count", "_index"]; _result = []; -_config = getArray (ConfigFile >> "CfgMagazines" >> (_this select 0) >> "ACE_Triggers" >> "SupportedTriggers"); +_config = getArray (ConfigFile >> "CfgMagazines" >> _magazineClassname >> "ACE_Triggers" >> "SupportedTriggers"); _count = count _config; for "_index" from 0 to (_count - 1) do { diff --git a/addons/explosives/script_component.hpp b/addons/explosives/script_component.hpp index 5ff12b8ba3..17de3516a5 100644 --- a/addons/explosives/script_component.hpp +++ b/addons/explosives/script_component.hpp @@ -12,3 +12,7 @@ #endif #include "\z\ace\addons\main\script_macros.hpp" + +#define PLACE_WAITING -1 +#define PLACE_CANCEL 0 +#define PLACE_APPROVE 1 diff --git a/addons/explosives/stringtable.xml b/addons/explosives/stringtable.xml index a985b428c1..f23cb2fc00 100644 --- a/addons/explosives/stringtable.xml +++ b/addons/explosives/stringtable.xml @@ -5,7 +5,7 @@ Explosives Sprengstoffe Explosivos - Ładunki wybuchowe + Mat. wybuchowe Explosifs Výbušniny Esplosivi @@ -61,6 +61,26 @@ Colocar Установить + + Attach + Befestigen + Acoplar + Przyczep + Attacher + Připnout + Fixar + Attacca + Hozzácsatolás + Прикрепить + + + Blocked + Obstruido + Bloqueado + Заблокировано + Blokováno + Zablokowany + Cancel Abbrechen @@ -74,16 +94,16 @@ Отмена - + Modifier, rotates - + Modifikator, drehen - + Modificador, girar - + Modificateur, tourner - + Modificatore, rotazione - + Modifikátor, otočit - + Változtatás, forgatás - + Modyfikator, obrót - + Modificador, rotaciona - + Bращать + +Ctrl rotate + +Strg drehen + +Ctrl girar + +Ctrl tourner + +Ctrl rotazione + +Ctrl otočit + +Ctrl forgatás + +Ctrl obrót + +Ctrl rotaciona + +Ctrl Bращать Turn On Thor III @@ -476,7 +496,7 @@ Spínač mrtvého muže Czuwak Detonador de hombre muerto - Dead Man's Switch + Halott ember kapcsolója Detonador do homem morto Кнопка мертвеца Detonatore a rilascio @@ -512,6 +532,9 @@ Sprengstoffsystem Systém výbušnin Sistema de explosivos + Module explosifs + Robbanóanyag-rendszer + Взрывные устройства Require specialists? @@ -520,6 +543,9 @@ Benötigt Sprengstoffexperten? Vyžadovat specialistu? Requer especialista? + Requiert un spécialiste? + Specialisták igénylése? + Требуется специалист? Require explosive specialists to disable explosives? Default: No @@ -528,6 +554,9 @@ Benötige Sprengstoffexperte um Sprengladungen zu entschärfen? Standard: Nein Vyžadovat specialistu na zneškodnění výbušniny? Výchozí: Ne Requer especialista em explosivos para desativar explosivos? Padrão: Não + Le désarmoçage d'explosif requiert un spécialiste? Défaut: non + Szükséges-e egy specialista a robbanóanyagok hatástalanításához? Alapértelmezett: Nem + Требуется ли специалист по минному делу для обезвреживания взрывчатки? По-умолчанию: Нет Punish non-specialists? @@ -536,6 +565,9 @@ Bestrafe Nicht-Sprengstoffexperten? Potrestat, pokud není specialista? Punir não especialistas? + Punir les non-spécialistes? + Nem-specialisták büntetése? + Штраф не-специалистам? Increase the time it takes to complete actions for non-specialists? Default: Yes @@ -544,6 +576,9 @@ Entschärfungszeit für Nicht-Sprengstoffexperten erhöhen? Standard: Ja Zvýšit čas potřebný k dokončení akce pokud není specialista? Výchozí: Ano Aumentar o tempo necessário para completar ações por não especialistas? Padrão: Sim + Augmenter le temps nécessaire au désarmoçage pour les non-spécialistes? Défaut: oui + Nem-specialisták esetén több ideig tartson a cselekvés befejezése? Alapértelmezett: Igen + Увеличивать время завершения действий для не-специалистов? По-умолчанию: Нет Explode on defusal? @@ -551,6 +586,9 @@ Eksplozja przy rozbrajaniu? Explodovat při zneškodňování? Explotar al desactivar? + Explosion si désamorçage? + Robbanás hatástalanításkor? + Взрыв при разминир.? Enable certain explosives to explode on defusal? Default: Yes @@ -558,6 +596,9 @@ Spraw, aby niektóre ładunki wybuchowe eksplodowały przy próbie ich rozbrojenia? Domyślnie:Tak Umožnit u některých výbušnin explozi při pokusu je zneškodnit? Výchozí: Ano ¿Habilitar ciertos explosivos para estallar al desactivar? Por defecto: Sí + Permet à certains explosifs d'exploser au désamorçage? Défaut: oui + Meghatározott robbanóanyagok felrobbanjanak-e hatástalanításkor? Alapértelmezett: Igen + Разрешить определенным взрывным устройствам взрываться при разминировании? По-умолчанию: Да This module adjusts the settings related to explosives. @@ -565,6 +606,10 @@ Dieses Modul erlaubt die Einstellungen für Sprengstoffe zu verändern. Tento modul umoňuje přizpůsobit nastavení týkajících se výbušnin. Este módulo permite personalizar as definições relacionadas a explosivos. + Ce module ajuste les options relative aux explosifs + Ez a modul a robbanóanyagokhoz kötött beállításokat szabályozza. + Этот модуль управляет настройками, связанными со взрывными устройствами + Este módulo ajusta las configuraciones relacionadas con explosivos. - \ No newline at end of file + diff --git a/addons/fcs/CfgVehicles.hpp b/addons/fcs/CfgVehicles.hpp index 10cb868ca0..53b279ef88 100644 --- a/addons/fcs/CfgVehicles.hpp +++ b/addons/fcs/CfgVehicles.hpp @@ -505,4 +505,26 @@ class CfgVehicles { class Plane_Fighter_03_base_F: Plane_Base_F { class Turrets; }; + + // static weapons. + class StaticWeapon: LandVehicle { + class Turrets { + class MainTurret; //: NewTurret {}; + }; + }; + + class StaticMGWeapon: StaticWeapon {}; + + class HMG_01_base_F: StaticMGWeapon { + class Turrets: Turrets { + class MainTurret: MainTurret { + GVAR(Enabled) = 1; + GVAR(MinDistance) = 100; + GVAR(MaxDistance) = 1500; + GVAR(DistanceInterval) = 5; + discreteDistance[] = {}; + discreteDistanceInitIndex = 0; + }; + }; + }; }; diff --git a/addons/fcs/README.md b/addons/fcs/README.md index dfe9b8d8e9..c4abbe3253 100644 --- a/addons/fcs/README.md +++ b/addons/fcs/README.md @@ -1,7 +1,7 @@ ace_fcs ======= -Adds a fire control system to armoured vehicles and helicoters, allowing the precise engagement of stationary and moving targets. +Adds a fire control system to armoured vehicles and helicopters, allowing precise engagement of stationary and moving targets. ## Maintainers diff --git a/addons/fcs/stringtable.xml b/addons/fcs/stringtable.xml index 77d683fc98..4970f9b10e 100644 --- a/addons/fcs/stringtable.xml +++ b/addons/fcs/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -74,4 +74,4 @@ СУО обнулен. - \ No newline at end of file + diff --git a/addons/finger/functions/fnc_incomingFinger.sqf b/addons/finger/functions/fnc_incomingFinger.sqf index 83e2916e4f..5a1e23a278 100644 --- a/addons/finger/functions/fnc_incomingFinger.sqf +++ b/addons/finger/functions/fnc_incomingFinger.sqf @@ -16,10 +16,10 @@ */ #include "script_component.hpp" -PARAMS_2(_sourceUnit,_fingerPosPrecise); - private ["_data", "_fingerPos"]; +params ["_sourceUnit", "_fingerPosPrecise"]; + //add some random float to location if it's not our own finger: _fingerPos = if (_sourceUnit == ACE_player) then { _fingerPosPrecise diff --git a/addons/finger/functions/fnc_keyPress.sqf b/addons/finger/functions/fnc_keyPress.sqf index 8462eb7170..1ce83d62dc 100644 --- a/addons/finger/functions/fnc_keyPress.sqf +++ b/addons/finger/functions/fnc_keyPress.sqf @@ -38,7 +38,7 @@ _sendFingerToPlayers = []; _nearbyMen = (ACE_player nearObjects ["CAManBase", (GVAR(maxRange) + 2)]); { _nearbyMen append (crew _x); -} forEach (ACE_player nearObjects ["StaticWeapon", (GVAR(maxRange) + 2)]); +} count (ACE_player nearObjects ["StaticWeapon", (GVAR(maxRange) + 2)]); { if ((((eyePos _x) vectorDistance _playerEyePos) < GVAR(maxRange)) && @@ -50,7 +50,8 @@ _nearbyMen = (ACE_player nearObjects ["CAManBase", (GVAR(maxRange) + 2)]); _sendFingerToPlayers pushBack _x; }; -} forEach _nearbyMen; + true +} count _nearbyMen; TRACE_1("sending finger to",_sendFingerToPlayers); diff --git a/addons/finger/functions/fnc_moduleSettings.sqf b/addons/finger/functions/fnc_moduleSettings.sqf index aa623ed58c..c5189f4562 100644 --- a/addons/finger/functions/fnc_moduleSettings.sqf +++ b/addons/finger/functions/fnc_moduleSettings.sqf @@ -13,8 +13,7 @@ #include "script_component.hpp" -PARAMS_1(_logic); - +params ["_logic"]; if !(isServer) exitWith {}; [_logic, QGVAR(enabled), "enabled"] call EFUNC(common,readSettingFromModule); diff --git a/addons/finger/functions/fnc_perFrameEH.sqf b/addons/finger/functions/fnc_perFrameEH.sqf index a35550db76..7f0150c492 100644 --- a/addons/finger/functions/fnc_perFrameEH.sqf +++ b/addons/finger/functions/fnc_perFrameEH.sqf @@ -30,7 +30,7 @@ _iconSize = BASE_SIZE * _fovCorrection; { _data = HASH_GET(GVAR(fingersHash), _x); - EXPLODE_3_PVT(_data,_lastTime,_pos,_name); + _data params ["_lastTime", "_pos", "_name"]; _timeLeftToShow = _lastTime + FP_TIMEOUT - ACE_diagTime; if (_timeLeftToShow <= 0) then { HASH_REM(GVAR(fingersHash), _x); @@ -41,9 +41,9 @@ _iconSize = BASE_SIZE * _fovCorrection; _drawColor set [3, ((_drawColor select 3) * (_timeLeftToShow / 0.5))]; }; - drawIcon3D [QUOTE(PATHTOF(UI\fp_icon.paa)), _drawColor, _pos, _iconSize, _iconSize, 0, _name, 1, 0.03, "PuristaMedium"]; + drawIcon3D [QUOTE(PATHTOF(UI\fp_icon2.paa)), _drawColor, _pos, _iconSize, _iconSize, 0, _name, 1, 0.03, "PuristaMedium"]; }; -} forEach (GVAR(fingersHash) select 0); +} count (GVAR(fingersHash) select 0); if ((count (GVAR(fingersHash) select 0)) == 0) then { [GVAR(pfeh_id)] call CBA_fnc_removePerFrameHandler; diff --git a/addons/finger/stringtable.xml b/addons/finger/stringtable.xml index f11f36d971..88030cc7d9 100644 --- a/addons/finger/stringtable.xml +++ b/addons/finger/stringtable.xml @@ -1,50 +1,95 @@ - + Show pointing indicator to self - Отображать пальце-индикатор для показывающего игрока + Индикатор пальца для показывающего + Afficher un indicateur de pointage pour soit même Pokaż indykator wskazywania palcem dla siebie + Saját mutatási indikátor megjelenítése + Mostrar indicador para si mesmo + Mostrar el indicador de señalado a uno mismo Render the indicator for the pointing player. This option doesn't affect whether the other players would see the indicator - Отображать индикатор для показывающего игрока. Эта настройка не влияет на то, будутт ли другие игроки видеть индикатор + Отображать индикатор указания пальцем для показывающего игрока. Эта настройка не влияет на то, будут ли другие игроки видеть индикатор + Affiche l'indicateur pour le joueur qui pointe. Cette option n'affecte pas les autres joueurs Wyświetl indykator kiedy wskazujesz coś palcem. Ta opcja nie wpływa na to, czy inni gracze zobaczą ten indykator czy też nie. + Az indikátor megjelenítése a mutató játékosnak. Ez a beállítás nem változtat azon, hogy más játékosok látják-e az indikátort. + Renderizar o indicador para o jogador que está apontando. Esta opção não afeta se os outros jogadores verão ou não o indicador + Muestra el indicador para el jugador que apunta. Esta opción no afecta si los otros jugadores verían el indicador Pointing indicator - Пальце-индикатор + Индикатор указания пальцем + Indicateur de pointage Indykator palca + Ujj-indikátor + Indicador de apontamento + Indicador de señalado Color of the pointing indicator circle - Цвет индикатора пальце-указания + Цвет индикатора указания пальцем + Couleur de l'indicateur Kolor okręgu wyświetlanego przy wskazywaniu palcem + Mutatási indikátor körének színe + Cor do círculo de indicação + Color del círculo indicador que señala Action "point a finger at" Действие "показать пальцем на" + Action 'Pointer le doigt à" Akcja "wskaż palcem" + Cselekvés "ujj rámutatása" + Ação "Apontar um dedo para" + Acción "apuntar con el dedo a" Points, and shows a virtual marker of where you are looking to nearby units. Can be held down. + Montre du doigt et affiche un marqueur virtuel de la direction pointée aux uinités proches. Peut être maintenu Wskazuje a także wyświetla wirtualny marker-okrąg w miejscu, w które patrzysz, dla wszystkich pobliskich jednostek. Może być przytrzymywany. + Mutat, és elhelyez egy virtuális jelölőt a nézett területhez közeli egységekhez. Lenyomva tartható. + Aponta e mostra um marcador virtual para onde você está olhando para unidades próximas. Pode ser utilizado para baixo. + Показывает пальцем и рисует виртуальный маркер в направлении взгляда ближайшим игрокам. Можно удерживать. + Señala y muestra un marcador virtual donde ustás apuntando para las unidades cercanas. Puede ser mantenido. Pointing Settings + Option "Montrer du doigt" Ustawienia wskazywania palcem + Ujj beállításai + Preferências de apontamento + Настройки указания пальцем + Ajustes de señalado Pointing Enabled + Activer "Montrer du doigt" Aktywuj wskazywanie + Mutatás engedélyezése + Apontamento ativado + Указание пальцем включено + Señalado habilitado Pointing Max Range + Distance maximale du pointage Maks. zasięg wskazywania + Ujj maximum hatótávja + Distância máxima do apontamento + Макс. дальность + Distancia máxima de señalado Max range between players to show the pointing indicator [default: 4 meters] + Distance maximale entre joueurs pour afficher l'indicateur (défaut: 4 mètres) Określ dystans na jakim można wskazywać coś palcem innym graczom. [domyślnie: 4m] + A maximális távolság, amelyben a közeli játékosoknak megjelenik az indikátor. [alapértelmezett: 4 méter] + Distância máxima entre jogadores para mostrar o apontamento [padrão: 4 metros] + Максимальная дальность между игроками для отображения индикатора указания пальцем [по-умолчанию: 4 метра] + Distancia máxima entre los jugadores para mostrar el indicador que señala [por defecto: 4 metros] diff --git a/addons/finger/ui/fp_icon2.paa b/addons/finger/ui/fp_icon2.paa new file mode 100644 index 0000000000..4f7fde9f10 Binary files /dev/null and b/addons/finger/ui/fp_icon2.paa differ diff --git a/addons/flashlights/$PBOPREFIX$ b/addons/flashlights/$PBOPREFIX$ new file mode 100644 index 0000000000..674d0d255c --- /dev/null +++ b/addons/flashlights/$PBOPREFIX$ @@ -0,0 +1 @@ +z\ace\addons\flashlights \ No newline at end of file diff --git a/addons/flashlights/CfgEventHandlers.hpp b/addons/flashlights/CfgEventHandlers.hpp new file mode 100644 index 0000000000..d5f49bd5c3 --- /dev/null +++ b/addons/flashlights/CfgEventHandlers.hpp @@ -0,0 +1,5 @@ +class Extended_PostInit_EventHandlers { + class ADDON { + clientInit = QUOTE(call COMPILE_FILE(XEH_postInitClient) ); + }; +}; diff --git a/addons/flashlights/CfgSounds.hpp b/addons/flashlights/CfgSounds.hpp new file mode 100644 index 0000000000..f0fabe3a39 --- /dev/null +++ b/addons/flashlights/CfgSounds.hpp @@ -0,0 +1,7 @@ +class CfgSounds { + class ACE_flashlights_flashlightClick { + name = "ACE_flashlights_flashlightClick"; + sound[] = {"\a3\sounds_f\weapons\Other\dry4.wss", 0.2, 2}; + titles[] = {}; + }; +}; \ No newline at end of file diff --git a/addons/flashlights/CfgVehicles.hpp b/addons/flashlights/CfgVehicles.hpp new file mode 100644 index 0000000000..fa766ad87b --- /dev/null +++ b/addons/flashlights/CfgVehicles.hpp @@ -0,0 +1,89 @@ +class CfgVehicles { + class Man; + class CAManBase: Man { + class ACE_SelfActions { + //todo: add flashlight attach actions + }; + }; + + class Item_Base_F; + + class ACE_Flashlight_MX991Item: Item_Base_F { + scope = 2; + scopeCurator = 2; + displayName = CSTRING(MX991_DisplayName); + author = ECSTRING(common,ACETeam); + vehicleClass = "WeaponAccessories"; + class TransportItems { + class ACE_Flashlight_MX991 { + name = "ACE_Flashlight_MX991"; + count = 1; + }; + }; + }; + + class ACE_Flashlight_KSF1Item: Item_Base_F { + scope = 2; + scopeCurator = 2; + displayName = CSTRING(KSF1_DisplayName); + author = ECSTRING(common,ACETeam); + vehicleClass = "WeaponAccessories"; + class TransportItems { + class ACE_Flashlight_KSF1 { + name = "ACE_Flashlight_KSF1"; + count = 1; + }; + }; + }; + + class ACE_Flashlight_XL50Item: Item_Base_F { + scope = 2; + scopeCurator = 2; + displayName = CSTRING(XL50_DisplayName); + author = ECSTRING(common,ACETeam); + vehicleClass = "WeaponAccessories"; + class TransportItems { + class ACE_Flashlight_XL50 { + name = "ACE_Flashlight_XL50"; + count = 1; + }; + }; + }; + + class NATO_Box_Base; + class EAST_Box_Base; + class IND_Box_Base; + class FIA_Box_Base_F; + + class Box_NATO_Support_F: NATO_Box_Base { + class TransportItems { + MACRO_ADDITEM(ACE_Flashlight_MX991,12); + }; + }; + + class Box_East_Support_F: EAST_Box_Base { + class TransportItems { + MACRO_ADDITEM(ACE_Flashlight_KSF1,12); + }; + }; + + class Box_IND_Support_F: IND_Box_Base { + class TransportItems { + MACRO_ADDITEM(ACE_Flashlight_XL50,12); + }; + }; + + class Box_FIA_Support_F: FIA_Box_Base_F { + class TransportItems { + MACRO_ADDITEM(ACE_Flashlight_MX991,12); + }; + }; + + class ACE_Box_Misc: Box_NATO_Support_F { + class TransportItems { + MACRO_ADDITEM(ACE_Flashlight_MX991,12); + MACRO_ADDITEM(ACE_Flashlight_KSF1,12); + MACRO_ADDITEM(ACE_Flashlight_XL50,12); + }; + }; +}; \ No newline at end of file diff --git a/addons/flashlights/CfgWeapons.hpp b/addons/flashlights/CfgWeapons.hpp new file mode 100644 index 0000000000..09fe70d764 --- /dev/null +++ b/addons/flashlights/CfgWeapons.hpp @@ -0,0 +1,61 @@ +class CfgWeapons { + + class ItemCore; + class ACE_ItemCore; + class InventoryItem_Base_F; + class InventoryFlashlightItem_Base_F; + + class acc_flashlight: ItemCore { + class ItemInfo: InventoryFlashlightItem_Base_F { + class Flashlight { + ACE_Flashlight_Colour = "white"; + ACE_Flashlight_Size = 2.75; + }; + }; + }; + + class ACE_Flashlight_MX991: ACE_ItemCore { + displayName = CSTRING(MX991_DisplayName); + descriptionShort = CSTRING(MX991_Description); + model = QUOTE(PATHTOF(data\MX_991.p3d)); + picture = PATHTOF(UI\mx991_ca.paa); + scope = 2; + class ItemInfo: InventoryItem_Base_F { + mass = 1; + class FlashLight { + ACE_Flashlight_Colour = "red"; + ACE_Flashlight_Size = 1.75; + }; + }; + }; + + class ACE_Flashlight_KSF1: ACE_ItemCore { + displayName = CSTRING(KSF1_DisplayName); + descriptionShort = CSTRING(KSF1_Description); + model = QUOTE(PATHTOF(data\KSF_1.p3d)); + picture = PATHTOF(UI\ksf1_ca.paa); + scope = 2; + class ItemInfo: InventoryItem_Base_F { + mass = 1; + class FlashLight { + ACE_Flashlight_Colour = "red"; + ACE_Flashlight_Size = 1.5; + }; + }; + }; + + class ACE_Flashlight_XL50: ACE_ItemCore { + displayName = CSTRING(XL50_DisplayName); + descriptionShort = CSTRING(XL50_Description); + model = QUOTE(PATHTOF(data\Maglight.p3d)); + picture = PATHTOF(UI\xl50_ca.paa); + scope = 2; + class ItemInfo: InventoryItem_Base_F { + mass = 1; + class FlashLight { + ACE_Flashlight_Colour = "white"; + ACE_Flashlight_Size = 2.15; + }; + }; + }; +}; \ No newline at end of file diff --git a/addons/flashlights/README.md b/addons/flashlights/README.md new file mode 100644 index 0000000000..6a04b78091 --- /dev/null +++ b/addons/flashlights/README.md @@ -0,0 +1,11 @@ +ace_flashlights +======= + +Flashlights for use on map and to attach to player. + + +## Maintainers + +The people responsible for merging changes to this component or answering potential questions. + +- [voiper](https://github.com/voiperr) diff --git a/addons/flashlights/UI/Flashlight_Beam_blue_ca.paa b/addons/flashlights/UI/Flashlight_Beam_blue_ca.paa new file mode 100644 index 0000000000..737780d1c8 Binary files /dev/null and b/addons/flashlights/UI/Flashlight_Beam_blue_ca.paa differ diff --git a/addons/flashlights/UI/Flashlight_Beam_green_ca.paa b/addons/flashlights/UI/Flashlight_Beam_green_ca.paa new file mode 100644 index 0000000000..b075990ba6 Binary files /dev/null and b/addons/flashlights/UI/Flashlight_Beam_green_ca.paa differ diff --git a/addons/flashlights/UI/Flashlight_Beam_red_ca.paa b/addons/flashlights/UI/Flashlight_Beam_red_ca.paa new file mode 100644 index 0000000000..5afd4e66d5 Binary files /dev/null and b/addons/flashlights/UI/Flashlight_Beam_red_ca.paa differ diff --git a/addons/flashlights/UI/Flashlight_Beam_white_ca.paa b/addons/flashlights/UI/Flashlight_Beam_white_ca.paa new file mode 100644 index 0000000000..08460e9a9c Binary files /dev/null and b/addons/flashlights/UI/Flashlight_Beam_white_ca.paa differ diff --git a/addons/flashlights/UI/Flashlight_Beam_yellow_ca.paa b/addons/flashlights/UI/Flashlight_Beam_yellow_ca.paa new file mode 100644 index 0000000000..8593ac8706 Binary files /dev/null and b/addons/flashlights/UI/Flashlight_Beam_yellow_ca.paa differ diff --git a/addons/flashlights/UI/KSF1_ca.paa b/addons/flashlights/UI/KSF1_ca.paa new file mode 100644 index 0000000000..5a89051c05 Binary files /dev/null and b/addons/flashlights/UI/KSF1_ca.paa differ diff --git a/addons/flashlights/UI/mx991_ca.paa b/addons/flashlights/UI/mx991_ca.paa new file mode 100644 index 0000000000..9385ec675a Binary files /dev/null and b/addons/flashlights/UI/mx991_ca.paa differ diff --git a/addons/flashlights/UI/xl50_ca.paa b/addons/flashlights/UI/xl50_ca.paa new file mode 100644 index 0000000000..55aaa0cbcd Binary files /dev/null and b/addons/flashlights/UI/xl50_ca.paa differ diff --git a/addons/flashlights/XEH_postInitClient.sqf b/addons/flashlights/XEH_postInitClient.sqf new file mode 100644 index 0000000000..53e7d041a8 --- /dev/null +++ b/addons/flashlights/XEH_postInitClient.sqf @@ -0,0 +1,8 @@ +#include "script_component.hpp" + +// Exit on Headless as well +if (!hasInterface) exitWith {}; + +LOG(MSG_INIT); + +//todo: make flashlights attachable to players \ No newline at end of file diff --git a/addons/flashlights/config.cpp b/addons/flashlights/config.cpp new file mode 100644 index 0000000000..b34c4b8000 --- /dev/null +++ b/addons/flashlights/config.cpp @@ -0,0 +1,18 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + units[] = {}; + weapons[] = {"ACE_Flashlight_MX991", "ACE_Flashlight_KSF1", "ACE_Flashlight_XL50"}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"ace_interaction"}; + author[] = {"voiper"}; + authorUrl = "https://github.com/voiperr/"; + VERSION_CONFIG; + }; +}; + +#include "CfgEventHandlers.hpp" +#include "CfgVehicles.hpp" +#include "CfgWeapons.hpp" +#include "CfgSounds.hpp" diff --git a/addons/flashlights/data/KSF_1.p3d b/addons/flashlights/data/KSF_1.p3d new file mode 100644 index 0000000000..0ec2fd23c6 Binary files /dev/null and b/addons/flashlights/data/KSF_1.p3d differ diff --git a/addons/flashlights/data/KSF_1.rvmat b/addons/flashlights/data/KSF_1.rvmat new file mode 100644 index 0000000000..113fe0cc14 --- /dev/null +++ b/addons/flashlights/data/KSF_1.rvmat @@ -0,0 +1,79 @@ +ambient[]={1,1,1,1}; +diffuse[]={1,1,1,1}; +forcedDiffuse[]={0,0,0,0}; +emmisive[]={0,0,0,1}; +specular[]={0.6,0.6,0.6,1}; //amount of glossiness - the higher the number, the higher the glossiness +specularPower=700; //area of glossiness - the higher the number, the smaller the area +PixelShaderID="Super"; +VertexShaderID="Super"; + +class Stage1 { + texture="z\ace\addons\flashlights\data\KSF_1_nohq.paa"; + uvSource="tex"; + class uvTransform { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,0}; + pos[]={0,0,0}; + }; +}; +class Stage2 { + texture="#(argb,8,8,3)color(0.5,0.5,0.5,1,dt)"; + uvSource="tex"; + class uvTransform { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,0}; + pos[]={0,0,0}; + }; +}; +class Stage3 { + texture="#(argb,8,8,3)color(0,0,0,0,mc)"; + uvSource="tex"; + class uvTransform { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,0}; + pos[]={0,0,0}; + }; +}; +class Stage4 { + texture="#(argb,8,8,3)color(1,1,1,1,as)"; + uvSource="tex"; + class uvTransform { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,1}; + pos[]={0,0,1}; + }; +}; +class Stage5 { + texture="z\ace\addons\flashlights\data\KSF_1_smdi.paa"; + uvSource="tex"; + class uvTransform { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,0}; + pos[]={0,0,0}; + }; +}; +class Stage6 { + texture="#(ai,64,64,1)fresnel(4.7,1.2)"; + uvSource="tex"; + class uvTransform { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,1}; + pos[]={0,0,0}; + }; +}; +class Stage7 { + texture="a3\data_f\env_land_ca.paa"; + uvSource="tex"; + class uvTransform { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,1}; + pos[]={0,0,0}; + }; +}; diff --git a/addons/flashlights/data/KSF_1_co.paa b/addons/flashlights/data/KSF_1_co.paa new file mode 100644 index 0000000000..bb31888863 Binary files /dev/null and b/addons/flashlights/data/KSF_1_co.paa differ diff --git a/addons/flashlights/data/KSF_1_nohq.paa b/addons/flashlights/data/KSF_1_nohq.paa new file mode 100644 index 0000000000..8c5ada23c8 Binary files /dev/null and b/addons/flashlights/data/KSF_1_nohq.paa differ diff --git a/addons/flashlights/data/KSF_1_smdi.paa b/addons/flashlights/data/KSF_1_smdi.paa new file mode 100644 index 0000000000..b12f26e5f4 Binary files /dev/null and b/addons/flashlights/data/KSF_1_smdi.paa differ diff --git a/addons/flashlights/data/MX_991.p3d b/addons/flashlights/data/MX_991.p3d new file mode 100644 index 0000000000..c79c330ea3 Binary files /dev/null and b/addons/flashlights/data/MX_991.p3d differ diff --git a/addons/flashlights/data/MX_991.rvmat b/addons/flashlights/data/MX_991.rvmat new file mode 100644 index 0000000000..0268d4903c --- /dev/null +++ b/addons/flashlights/data/MX_991.rvmat @@ -0,0 +1,79 @@ +ambient[]={1,1,1,1}; +diffuse[]={1,1,1,1}; +forcedDiffuse[]={0,0,0,0}; +emmisive[]={0,0,0,1}; +specular[]={0.6,0.6,0.6,1}; //amount of glossiness - the higher the number, the higher the glossiness +specularPower=700; //area of glossiness - the higher the number, the smaller the area +PixelShaderID="Super"; +VertexShaderID="Super"; + +class Stage1 { + texture="z\ace\addons\flashlights\data\MX_991_nohq.paa"; + uvSource="tex"; + class uvTransform { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,0}; + pos[]={0,0,0}; + }; +}; +class Stage2 { + texture="#(argb,8,8,3)color(0.5,0.5,0.5,1,dt)"; + uvSource="tex"; + class uvTransform { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,0}; + pos[]={0,0,0}; + }; +}; +class Stage3 { + texture="#(argb,8,8,3)color(0,0,0,0,mc)"; + uvSource="tex"; + class uvTransform { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,0}; + pos[]={0,0,0}; + }; +}; +class Stage4 { + texture="#(argb,8,8,3)color(1,1,1,1,as)"; + uvSource="tex"; + class uvTransform { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,1}; + pos[]={0,0,1}; + }; +}; +class Stage5 { + texture="#(rgb,1,1,1)color(0.2,0.2,1,1)"; + uvSource="tex"; + class uvTransform { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,0}; + pos[]={0,0,0}; + }; +}; +class Stage6 { + texture="#(ai,64,64,1)fresnel(4.7,1.2)"; + uvSource="tex"; + class uvTransform { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,1}; + pos[]={0,0,0}; + }; +}; +class Stage7 { + texture="a3\data_f\env_land_ca.paa"; + uvSource="tex"; + class uvTransform { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,1}; + pos[]={0,0,0}; + }; +}; diff --git a/addons/flashlights/data/MX_991_co.paa b/addons/flashlights/data/MX_991_co.paa new file mode 100644 index 0000000000..598dda174b Binary files /dev/null and b/addons/flashlights/data/MX_991_co.paa differ diff --git a/addons/flashlights/data/MX_991_nohq.paa b/addons/flashlights/data/MX_991_nohq.paa new file mode 100644 index 0000000000..565df542e1 Binary files /dev/null and b/addons/flashlights/data/MX_991_nohq.paa differ diff --git a/addons/flashlights/data/Maglight.p3d b/addons/flashlights/data/Maglight.p3d new file mode 100644 index 0000000000..6ce3b9fcd4 Binary files /dev/null and b/addons/flashlights/data/Maglight.p3d differ diff --git a/addons/flashlights/data/Maglite.rvmat b/addons/flashlights/data/Maglite.rvmat new file mode 100644 index 0000000000..960599813b --- /dev/null +++ b/addons/flashlights/data/Maglite.rvmat @@ -0,0 +1,79 @@ +ambient[]={1,1,1,1}; +diffuse[]={1,1,1,1}; +forcedDiffuse[]={0,0,0,0}; +emmisive[]={0,0,0,1}; +specular[]={0.6,0.6,0.6,1}; //amount of glossiness - the higher the number, the higher the glossiness +specularPower=700; //area of glossiness - the higher the number, the smaller the area +PixelShaderID="Super"; +VertexShaderID="Super"; + +class Stage1 { + texture="z\ace\addons\flashlights\data\Maglite_nohq.paa"; + uvSource="tex"; + class uvTransform { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,0}; + pos[]={0,0,0}; + }; +}; +class Stage2 { + texture="#(argb,8,8,3)color(0.5,0.5,0.5,1,dt)"; + uvSource="tex"; + class uvTransform { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,0}; + pos[]={0,0,0}; + }; +}; +class Stage3 { + texture="#(argb,8,8,3)color(0,0,0,0,mc)"; + uvSource="tex"; + class uvTransform { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,0}; + pos[]={0,0,0}; + }; +}; +class Stage4 { + texture="#(argb,8,8,3)color(1,1,1,1,as)"; + uvSource="tex"; + class uvTransform { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,1}; + pos[]={0,0,1}; + }; +}; +class Stage5 { + texture="z\ace\addons\flashlights\data\Maglite_smdi.paa"; + uvSource="tex"; + class uvTransform { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,0}; + pos[]={0,0,0}; + }; +}; +class Stage6 { + texture="#(ai,64,64,1)fresnel(4.7,1.2)"; + uvSource="tex"; + class uvTransform { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,1}; + pos[]={0,0,0}; + }; +}; +class Stage7 { + texture="a3\data_f\env_land_ca.paa"; + uvSource="tex"; + class uvTransform { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,1}; + pos[]={0,0,0}; + }; +}; diff --git a/addons/flashlights/data/Maglite_co.paa b/addons/flashlights/data/Maglite_co.paa new file mode 100644 index 0000000000..8a399b25cc Binary files /dev/null and b/addons/flashlights/data/Maglite_co.paa differ diff --git a/addons/flashlights/data/Maglite_nohq.paa b/addons/flashlights/data/Maglite_nohq.paa new file mode 100644 index 0000000000..43282a963b Binary files /dev/null and b/addons/flashlights/data/Maglite_nohq.paa differ diff --git a/addons/flashlights/data/Maglite_smdi.paa b/addons/flashlights/data/Maglite_smdi.paa new file mode 100644 index 0000000000..093d83e145 Binary files /dev/null and b/addons/flashlights/data/Maglite_smdi.paa differ diff --git a/addons/flashlights/script_component.hpp b/addons/flashlights/script_component.hpp new file mode 100644 index 0000000000..ba740c22fc --- /dev/null +++ b/addons/flashlights/script_component.hpp @@ -0,0 +1,12 @@ +#define COMPONENT flashlights +#include "\z\ace\addons\main\script_mod.hpp" + +#ifdef DEBUG_ENABLED_FLASHLIGHTS + #define DEBUG_MODE_FULL +#endif + +#ifdef DEBUG_SETTINGS_FLASHLIGHTS + #define DEBUG_SETTINGS DEBUG_SETTINGS_FLASHLIGHTS +#endif + +#include "\z\ace\addons\main\script_macros.hpp" \ No newline at end of file diff --git a/addons/flashlights/stringtable.xml b/addons/flashlights/stringtable.xml new file mode 100644 index 0000000000..bc6908ab97 --- /dev/null +++ b/addons/flashlights/stringtable.xml @@ -0,0 +1,53 @@ + + + + + Fulton MX-991 + Fulton MX-991 + Fulton MX-991 + Fulton MX-991 + Fulton MX-991 + Fulton MX-991 + + + Flashlight with red filter. For use on map. + Latarka z czerwonym filtrem. Używana do podświetlania mapy. + Lanterna com filtro vermelho. Para uso no mapa. + Фонарь с красным светофильтром. Для использования на карте. + Svítilna s červeným filtrem. Pro nahlédnutí do mapy. + Linterna con filtro rojo. Para su uso en el mapa. + + + Maglite XL50 + Maglite XL50 + Maglite XL50 + Maglite XL50 + Maglite XL50 + Maglite XL50 + + + White mini flashlight. For use on map. + Mini latarka. Światło białe. Używana do podświetlania mapy. + Mini lanterna branca. Para uso no mapa. + Небольшой фонарик белого света. Для использования на карте. + Bílá mini svítilna. Pro nahlédnutí do mapy. + Mini linterna blanca. Para su uso en el mapa. + + + KSF-1 + KSF-1 + KSF-1 + KSF-1 + KSF-1 + KSF-1 + + + Flashlight with red filter. For use on map. + Latarka z czerwonym filtrem. Używana do podświetlania mapy. + Lanterna com filtro vermelho. Para uso no mapa. + Фонарь с красным светофильтром. Для использования на карте. + Svítilna s červeným filtrem. Pro nahlédnutí do mapy. + Linterna con filtro rojo. Para su uso en el mapa. + + + diff --git a/addons/fonts/README.md b/addons/fonts/README.md new file mode 100644 index 0000000000..7e6f704d67 --- /dev/null +++ b/addons/fonts/README.md @@ -0,0 +1,11 @@ +ace_fonts +======== + +Custom fonts including fixed-width font. + + +## Maintainers + +The people responsible for merging changes to this component or answering potential questions. + +- [jaynus](https://github.com/jaynus/) diff --git a/addons/frag/functions/fnc_doSpall.sqf b/addons/frag/functions/fnc_doSpall.sqf index a5a5472e1b..57b5d330c7 100644 --- a/addons/frag/functions/fnc_doSpall.sqf +++ b/addons/frag/functions/fnc_doSpall.sqf @@ -1,6 +1,6 @@ //fnc_doSpall.sqf #include "script_component.hpp" -// ACE_player sideChat "WAAAAAAAAAAAAAAAAAAAAA"; +// ACE_player sideChat "WAAAAAAAAAAAAAAAAAAAAA"; private ["_hitData", "_initialData", "_hpData", "_object", "_foundObjects", "_index", "_foundObjecsts", "_roundType", "_round", "_caliber", "_explosive", "_idh", "_alive", "_exit", "_vm", "_velocity", "_oldVelocity", "_curVelocity", "_diff", "_polar", "_unitDir", "_spallPos", "_pos1", "_i", "_pos2", "_blah", "_data", "_spallPolar", "_warn", "_c", "_m", "_k", "_gC", "_fragPower", "_fragTypes", "_spread", "_spallCount", "_elev", "_dir", "_vel", "_spallFragVect", "_fragType", "_fragment", "_pos"]; @@ -86,7 +86,7 @@ if(_alive || {_caliber >= 2.5} || {(_explosive > 0 && {_idh >= 1})}) then { if(_gC == 0) then { _gC = 2440; _warn = true;}; if(_warn) then { - diag_log text format["Ammo class %1 lacks proper explosive properties definitions for frag!", _roundType]; //TODO: turn this off when we get closer to release + ACE_LOGWARNING_1("Ammo class %1 lacks proper explosive properties definitions for frag!",_roundType); //TODO: turn this off when we get closer to release }; _fragPower = (((_m/_c)+_k)^-(1/2))*_gC; diff --git a/addons/frag/functions/fnc_frago.sqf b/addons/frag/functions/fnc_frago.sqf index e8d0f0ffa6..3507a7ab6e 100644 --- a/addons/frag/functions/fnc_frago.sqf +++ b/addons/frag/functions/fnc_frago.sqf @@ -67,7 +67,7 @@ _gC = getNumber(configFile >> "CfgAmmo" >> _shellType >> "ACE_frag_GURNEY_C"); if(_gC == 0) then { _gC = 2440; _warn = true;}; if(_warn) then { - diag_log text format["Ammo class %1 lacks proper explosive properties definitions for frag!", _shellType]; //TODO: turn this off when we get closer to release + ACE_LOGWARNING_1("Ammo class %1 lacks proper explosive properties definitions for frag!",_shellType); //TODO: turn this off when we get closer to release }; _fragPower = (((_m/_c)+_k)^-(1/2))*_gC; @@ -187,9 +187,9 @@ if(_isArmed && (count _objects) > 0) then { _sectorOffset = 360 * (_i - 1) / (_randomCount max 1); _randomDir = random(_sectorSize); _vec = [cos(_sectorOffset + _randomDir), sin(_sectorOffset + _randomDir), sin(30 - (random 45))]; - + _fp = (_fragPower-(random (_fragPowerRandom))); - + _vel = _vec vectorMultiply _fp; _fragType = round (random ((count _fragTypes)-1)); @@ -197,7 +197,7 @@ if(_isArmed && (count _objects) > 0) then { _fragObj setPosASL _lastPos; _fragObj setVectorDir _vec; _fragObj setVelocity _vel; - + if(GVAR(traceFrags)) then { GVAR(TOTALFRAGS) = GVAR(TOTALFRAGS) + 1; [ACE_player, _fragObj, [1,0.5,0,1]] call FUNC(addTrack); @@ -205,7 +205,7 @@ if(_isArmed && (count _objects) > 0) then { _fragCount = _fragCount + 1; }; }; - + }; // #ifdef DEBUG_MODE_FULL // ACE_player sideChat format["total frags: %1", GVAR(TOTALFRAGS)]; diff --git a/addons/frag/stringtable.xml b/addons/frag/stringtable.xml index 5a59b15a4a..bba8f1dae9 100644 --- a/addons/frag/stringtable.xml +++ b/addons/frag/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -8,6 +8,9 @@ Splittersimulation Simulace fragmentace Simulação de fragmentação + Simulation de la fragmentation + Repesz-szimuláció + Симуляция осколков Enable the ACE Fragmentation Simulation @@ -16,6 +19,9 @@ Aktiviere die ACE-Splittersimulation Povolit ACE simulaci fragmentace Ativa a simulação de fragmentação do ACE + Active la simulation ACE de la fragmentation + Az ACE repesz-szimuláció engedélyezése + Включить симуляцию осколков ACE Spalling Simulation @@ -24,6 +30,9 @@ Explosionssimulation Simulace úlomků Simulação de estilhaços + Simulation d'éclat + Pattogzás-szimuláció + Симуляция обломков Enable the ACE Spalling Simulation @@ -32,6 +41,9 @@ Aktiviere ACE-Explosionssimulation Povolit ACE simulaci úlomků Ativa a simulação de estilhaços do ACE + Active la simulation d'éclat ACE + Az ACE pattogzás-szimuláció engedélyezése + Включить симуляцию обломков ACE Maximum Projectiles Tracked @@ -40,6 +52,9 @@ Maximalzahl der verfolgten Projektile Maximální počet sledovaných projektilů Máximo de projéteis rastreados + Nombre maximum de projectile suivis + Maximum követett repeszek + Макс. количество отслеживаемых снарядов This setting controls the maximum amount of projectiles the fragmentation and spalling system will track at any given time. If more projectiles are fired, they will not be tracked. Lower this setting if you do not want FPS drops at high-count projectile scenarios ( >200 rounds in the air at once) @@ -48,6 +63,9 @@ Diese Einstellung steuert die maximale Anzahl an Projektilen, die das Splitter- und Explosionssystem gleichzeitig verfolgen wird. Wenn mehr Projektile abgefeuert werden, werden sie nicht verfolgt werden. Diese Einstellung zu verringern, kann FPS-Einbrüche bei Szenarien mit vielen Projektilen verhindern (>200 Objekte gleichzeitig in der Luft) Toto nastavení kontroluje maximální množství projektilů z fragmentace a úlomků, která jsou sledována v dané době. Pokud je vystřeleno více projektilů, tak nebudou sledovány. Snižte toto nastavení pokud si nepřejete propady FPS v situacích, kde je velké množství projektilů ( >200 nábojů najednou ve vzduchu) Esta definição controla a quantidade máxima de projéteis que o sistema de fragmentação e estilhaçamento irá acompanhar em qualquer momento. Se mais projéteis são disparados, eles não serão rastreados. Diminua essa configuração se você não quiser que o FPS caia em cenários com alta contagem de projéteis (> 200 projéteis no ar ao mesmo tempo) + Cette option controle le nombre maximum de projectile et d'éclat résultant de la fragmentation que le système suivra à un moment T. Si plus de projectiles sont générés, ils ne seront pas pris en compte. Baisser cette option si vous ne voulez pas de baisse de FPS en cas d'un nombre important de projectiles (>200 éclats en même temps) + Ez a beállítás szabályozza a repeszeződés és pattogzás által kilőtt objektumok követett számát. Ha több ez a szám, ezek az objektumok nem lesznek követve. Csökkentsd ezt a beállítást, ha nem akarsz lassulásokat magas-törmelékmennyiségű helyzetekben (200+ repesz a levegőben egyszerre) + Эта настройка контролирует максимальное количество снарядов, которок отслеживает система осколков и обломков в каждый момент времени. Снаряды, выстреленные сверх этого числа, отслеживаться не будут. Уменьшите это значение, если вы не хотите падения FPS при большом количестве снарядов в одной перестрелке (> 200 одновременно летящих снарядов) Maximum Projectiles Per Frame @@ -56,6 +74,9 @@ Maks. liczba pocisków na klatkę Maximální počet projektilů ze jeden snímek Projéteis máximos por quadro + Nombre maximal de projectile par image + Maximum repesz/képkocka + Макс. количество снарядов за кадр The number of spall track calculations to perform in any given frame. This helps spread the FPS impact of tracking spall rounds across multiple frames, limiting its impact even further. @@ -64,6 +85,9 @@ El número de cálculos de esquirlas que se hará en cualquier cuadro. Esto ayuda a dispersar el impacto en FPS del seguimiento de esquirlas de balas a través de múltiples cuadros, lo que limita aún más su impacto. Počet úlomků v daném snímku. Toto pomáhá rozšířit FPS dopad sledovaného úlomku napříč více snímky, omezuje jeho vliv ještě více. O número de cálculos por estilhaço rastreado para executar em qualquer quadro. Isso ajuda a distribuir o impacto no FPS do rastreamento de estilhaço em vários quadros, o que limita o seu impacto ainda mais. + Le nombre d'éclat à calculer dans chaque images. Ceci permet de diffuser l'impact sur les FPS dans de multiples images, le limitant d'autant plus. + A lepattogzási útvonalak számításának darabjai képkockánként. Ez eloszlatja az FPS-megszakadást több képkockára, ezzel csökkentve a súlyosságát. + Число обрабатываемых осколков за кадр. Это позволяет распределить нагрузку по отслеживанию осколков между несколькими кадрами, чтобы предотвратить падение FPS. (SP Only) Frag/Spall Debug Tracing @@ -72,6 +96,9 @@ (Pouze SP) Debug sledování Frag/Úlomků (nur SP) Splitter-/Explosions-Debug-Verfolgung (Somente SP) Depuração de fragmentação e estilhaços traçantes + (SP uniquement) Fragmentation/éclat debug + (Csak SP) Repesz/Pattogzás debug követés + (Только для одиночной игры) Отслеживаение/отладка осколков (SP Only) Requires a mission/editor restart. Enables visual tracing of fragmentation and spalling rounds in SP game mode only. @@ -80,6 +107,9 @@ (nur SP) Splitter-/Explosions-Debugging (Pouze SP) Vyžaduje restart mise/editoru. Aktivuje vizuální stopování fragmentace a úlomů pouze v režimu jednoho hráče. (Somente SP) Requer um reinício de missão / editor. Habilita o rastreamento visual de projéteis de fragmentação e estilhaçamento apenas no modo de jogo SP. + (SP seulement) Requiert un redémarrage de mission ou de l'éditeur. Active les traceurs visuels de fragmentation et d'éclats en mode solo seulement + (Csak SP) Küldetés/Editor újraindítás szükséges. Engedélyezi a repeszek és pattogzó lövedékek vizuális nyomkövetését, csak egyjátékos módok alatt. + (Только для одиночной игры) Требует перезапуска миссии/редактора. Включает визуальные следы от осколков и обломков в режиме одиночной игры. diff --git a/addons/gforces/XEH_postInit.sqf b/addons/gforces/XEH_postInit.sqf index 7a0d4a559c..a97822be8c 100644 --- a/addons/gforces/XEH_postInit.sqf +++ b/addons/gforces/XEH_postInit.sqf @@ -1,6 +1,6 @@ #include "script_component.hpp" -if !(hasInterface) exitWith {}; +if (!hasInterface) exitWith {}; // Setup ppEffect GVAR(GForces_CC) = ppEffectCreate ["ColorCorrections", 4215]; diff --git a/addons/gforces/functions/fnc_pfhUpdateGForces.sqf b/addons/gforces/functions/fnc_pfhUpdateGForces.sqf index a4cb047629..b7173f5742 100644 --- a/addons/gforces/functions/fnc_pfhUpdateGForces.sqf +++ b/addons/gforces/functions/fnc_pfhUpdateGForces.sqf @@ -14,7 +14,7 @@ #include "script_component.hpp" private ["_interval", "_player", "_newVel", "_accel", "_currentGForce", "_average", "_sum", "_classCoef", "_suitCoef", "_gBlackOut", "_gRedOut", "_g", "_gBO", "_coef", "_strength"]; - + EXPLODE_2_PVT(_this,_params,_pfhId); _interval = ACE_time - GVAR(lastUpdateTime); @@ -87,8 +87,6 @@ if (_suitCoef == 0) then {_suitCoef = 0.001}; _gBlackOut = MAXVIRTUALG / _classCoef + MAXVIRTUALG / _suitCoef - MAXVIRTUALG; _gRedOut = MINVIRTUALG / _classCoef; -["GForces", [], {format ["_g _gBO _coef: %1, %2, %3", _average, _gBlackOut, 2 * ((1.0 - ((_average - 0.30 * _gBlackOut) / (0.70 * _gBlackOut)) ^ 2) max 0) ]}] call EFUNC(common,log); - // @todo: Sort the interaction with medical if ((_average > _gBlackOut) and {isClass (configFile >> "CfgPatches" >> "ACE_Medical") and {!(ACE_player getVariable ["ACE_isUnconscious", false])}}) then { [ACE_player, true, (10 + floor(random 5))] call EFUNC(medical,setUnconscious); diff --git a/addons/goggles/ACE_Settings.hpp b/addons/goggles/ACE_Settings.hpp index 6b3faa1823..a78c2866e0 100644 --- a/addons/goggles/ACE_Settings.hpp +++ b/addons/goggles/ACE_Settings.hpp @@ -1,4 +1,11 @@ + class ACE_Settings { + /*class GVAR(enable) { // @todo + value = 0; + typeName = "BOOL"; + isClientSettable = 1; + displayName = CSTRING(enable); + };*/ class GVAR(showInThirdPerson) { value = 0; typeName = "BOOL"; diff --git a/addons/goggles/CfgEventHandlers.hpp b/addons/goggles/CfgEventHandlers.hpp index 8c7edda20f..67f17fda18 100644 --- a/addons/goggles/CfgEventHandlers.hpp +++ b/addons/goggles/CfgEventHandlers.hpp @@ -1,10 +1,36 @@ + 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)); - }; + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_postInit)); + }; +}; + +class Extended_Killed_EventHandlers { + class CAManBase { + class ADDON { + killed = QUOTE(_this call FUNC(handleKilled)); + }; + }; +}; + +class Extended_Fired_EventHandlers { + class CAManBase { + class ADDON { + fired = QUOTE(if (local (_this select 0)) then {_this call FUNC(handleFired)}); + }; + }; +}; + +class Extended_Explosion_EventHandlers { + class CAManBase { + class ADDON { + explosion = QUOTE(if (local (_this select 0)) then {_this call FUNC(handleExplosion)}); + }; + }; }; diff --git a/addons/goggles/XEH_postInit.sqf b/addons/goggles/XEH_postInit.sqf index 088ccc477a..4958c8e02b 100644 --- a/addons/goggles/XEH_postInit.sqf +++ b/addons/goggles/XEH_postInit.sqf @@ -1,24 +1,8 @@ -/* - * Author: Garth 'L-H' de Wet - * Sets up the glasses mod for usage. Initialises variables and event handlers. - * Shouldn't be called by a user/modder ever. Done by the engine. - * - * Arguments: - * None - * - * Return Value: - * None - * - * Example: - * None - * - * Public: No - */ #include "script_component.hpp" + if (!hasInterface) exitWith {}; -["ACE3 Common", QGVAR(wipeGlasses), localize LSTRING(WipeGlasses), -{ +["ACE3 Common", QGVAR(wipeGlasses), localize LSTRING(WipeGlasses), { if (!(GETVAR(ace_player,ACE_isUnconscious,false))) exitWith { call FUNC(clearGlasses); true @@ -26,22 +10,29 @@ if (!hasInterface) exitWith {}; false }, {false}, -[20, [true, true, false]], false] call cba_fnc_addKeybind; +[20, [true, true, false]], false] call CBA_fnc_addKeybind; -if isNil(QGVAR(UsePP)) then { +// make sure to stack effect layers in correct order +GVAR(GogglesEffectsLayer) = QGVAR(GogglesEffectsLayer) call BIS_fnc_RSCLayer; +GVAR(GogglesLayer) = QGVAR(GogglesLayer) call BIS_fnc_RSCLayer; + +if (isNil QGVAR(UsePP)) then { GVAR(UsePP) = true; }; -GVAR(PostProcess) = ppEffectCreate ["ColorCorrections", 1995]; +// init pp effects +GVAR(PostProcess) = ppEffectCreate ["ColorCorrections", 1995]; GVAR(PostProcessEyes) = ppEffectCreate ["ColorCorrections", 1992]; -GVAR(PostProcessEyes) ppEffectAdjust[1, 1, 0, [0,0,0,0], [0,0,0,1],[1,1,1,0]]; +GVAR(PostProcessEyes) ppEffectAdjust [1, 1, 0, [0, 0, 0, 0], [0, 0, 0, 1], [1, 1, 1, 0]]; GVAR(PostProcessEyes) ppEffectCommit 0; GVAR(PostProcessEyes) ppEffectEnable false; + GVAR(EffectsActive) = false; + SETGLASSES(ace_player,GLASSESDEFAULT); -GVAR(Current) = "None"; + GVAR(EyesDamageScript) = -1; -GVAR(FrameEvent) = [false, [false,20]]; +GVAR(FrameEvent) = [false, [false, 20]]; GVAR(PostProcessEyes_Enabled) = false; GVAR(DustHandler) = -1; GVAR(RainDrops) = objNull; @@ -50,82 +41,89 @@ GVAR(RainLastLevel) = 0; GVAR(surfaceCache) = ""; GVAR(surfaceCacheIsDust) = false; -FUNC(CheckGlasses) = { - if (GVAR(Current) != (goggles ace_player)) then { - GVAR(Current) = (goggles ace_player); - ["GlassesChanged",[GVAR(Current)]] call EFUNC(common,localEvent); - }; -}; +// init GlassesChanged eventhandler +GVAR(OldGlasses) = "#NULLSTRING"; -player addEventHandler ["Explosion", { - private "_effects"; - if (alive ace_player) then { - call FUNC(ApplyDirtEffect); - if (GETBROKEN) exitWith {}; - if (((_this select 1) call FUNC(GetExplosionIndex)) < getNumber(ConfigFile >> "CfgGlasses" >> GVAR(Current) >> "ACE_Resistance")) exitWith {}; - if !([ace_player] call FUNC(isGogglesVisible)) exitWith {["GlassesCracked",[ace_player]] call EFUNC(common,localEvent);}; - _effects = GETGLASSES(ace_player); - _effects set [BROKEN, true]; - SETGLASSES(ace_player,_effects); - if (getText(ConfigFile >> "CfgGlasses" >> GVAR(Current) >> "ACE_OverlayCracked") != "" && {cameraOn == ace_player}) then { - if (call FUNC(ExternalCamera)) exitWith {}; - if (isNull(GLASSDISPLAY)) then { - 150 cutRsc["RscACE_Goggles", "PLAIN",1, false]; - }; - (GLASSDISPLAY displayCtrl 10650) ctrlSetText getText(ConfigFile >> "CfgGlasses" >> GVAR(Current) >> "ACE_OverlayCracked"); - }; - ["GlassesCracked",[ace_player]] call EFUNC(common,localEvent); - }; -}]; -player addEventHandler ["Killed",{ - GVAR(PostProcessEyes) ppEffectEnable false; - SETGLASSES(ace_player,GLASSESDEFAULT); - call FUNC(removeGlassesEffect); - GVAR(EffectsActive)=false; - ace_player setVariable ["ACE_EyesDamaged", false]; - if (GVAR(EyesDamageScript) != -1) then { - [GVAR(EyesDamageScript)] call CALLSTACK(cba_fnc_removePreFrameHandler); - }; - if (GVAR(DustHandler) != -1) then { - [GVAR(DustHandler)] call CALLSTACK(cba_fnc_removePerFrameHandler); - GVAR(DustHandler) = -1; - }; -}]; -player addEventHandler ["Fired",{[_this select 0, _this select 1] call FUNC(dustHandler);}]; -player AddEventHandler ["Take",{call FUNC(checkGlasses);}]; -player AddEventHandler ["Put", {call FUNC(checkGlasses);}]; +["playerInventoryChanged", { + (_this select 1) params ["", "_currentGlasses"]; -["GlassesChanged",{ - SETGLASSES(ace_player,GLASSESDEFAULT); + if (GVAR(OldGlasses) != _currentGlasses) then { + ["GlassesChanged", [ACE_player, _currentGlasses]] call EFUNC(common,localEvent); + GVAR(OldGlasses) = _currentGlasses; + }; +}] call EFUNC(common,addEventHandler); + +// add glasses eventhandlers +["GlassesChanged", { + params ["_unit", "_glasses"]; + + SETGLASSES(_unit,GLASSESDEFAULT); if (call FUNC(ExternalCamera)) exitWith {call FUNC(RemoveGlassesEffect)}; - if ([ace_player] call FUNC(isGogglesVisible)) then { - [_this select 0] call FUNC(applyGlassesEffect); + if ([_unit] call FUNC(isGogglesVisible)) then { + _glasses call FUNC(applyGlassesEffect); } else { call FUNC(removeGlassesEffect); }; }] call EFUNC(common,addEventHandler); -["GlassesCracked",{ - if (_this select 0 != ace_player) exitWith {}; - ace_player setVariable ["ACE_EyesDamaged", true]; - if (GVAR(EyesDamageScript) != -1) then { - [GVAR(EyesDamageScript)] call CALLSTACK(cba_fnc_removePreFrameHandler); - }; - GVAR(PostProcessEyes) ppEffectAdjust[1, 1, 0, [0,0,0,0], [0.5,0.5,0.5,0.5],[1,1,1,0]]; + +["GlassesCracked", { + params ["_unit"]; + + _unit setVariable ["ACE_EyesDamaged", true]; + + GVAR(PostProcessEyes) ppEffectAdjust [1, 1, 0, [0, 0, 0, 0], [0.5, 0.5, 0.5, 0.5], [1, 1, 1, 0]]; GVAR(PostProcessEyes) ppEffectCommit 0; GVAR(PostProcessEyes) ppEffectEnable true; - GVAR(EyesDamageScript) = [{ - GVAR(PostProcessEyes) ppEffectAdjust[1, 1, 0, [0,0,0,0], [1,1,1,1],[1,1,1,0]]; + + [{ + GVAR(PostProcessEyes) ppEffectAdjust [1, 1, 0, [0, 0, 0, 0], [1, 1, 1, 1], [1, 1, 1, 0]]; GVAR(PostProcessEyes) ppEffectCommit 5; + GVAR(EyesDamageScript) = [{ + params ["_unit"]; + GVAR(PostProcessEyes) ppEffectEnable false; - ace_player setVariable ["ACE_EyesDamaged", false]; - GVAR(EyesDamageScript) = -1; - }, [], 5, 1] call EFUNC(common,waitAndExecute); - }, [], 25, 5] call EFUNC(common,waitAndExecute); + + _unit setVariable ["ACE_EyesDamaged", false]; + + }, _this, 5] call EFUNC(common,waitAndExecute); + + }, _unit, 25] call EFUNC(common,waitAndExecute); + }] call EFUNC(common,addEventHandler); -call FUNC(checkGlasses); -[FUNC(CheckGoggles), 1, []] call CBA_fnc_addPerFrameHandler; -[FUNC(rainEffect), 0.5, []] call CBA_fnc_addPerFrameHandler; -[FUNC(onEachFrame), 0, []] call CBA_fnc_addPerFrameHandler; + +// check goggles +local _fnc_checkGoggles = { + params ["_unit"]; + + if (GVAR(EffectsActive)) then { + if (call FUNC(externalCamera) || {!([_unit] call FUNC(isGogglesVisible))}) then { + call FUNC(removeGlassesEffect); + }; + } else { + if (!(call FUNC(externalCamera)) && {[_unit] call FUNC(isGogglesVisible)}) then { + [goggles _unit] call FUNC(applyGlassesEffect); + }; + }; +}; + +["cameraViewChanged", _fnc_checkGoggles] call EFUNC(common,addEventHandler); +["activeCameraChanged", _fnc_checkGoggles] call EFUNC(common,addEventHandler); + +// goggles effects main PFH +[{ + // rain + call FUNC(applyRainEffect); + + // auto remove effects under water + if (GVAR(EffectsActive) && {[goggles ACE_player] call FUNC(isDivingGoggles) && {underwater ACE_player}}) then { + call FUNC(removeRainEffect); + call FUNC(removeDirtEffect); + call FUNC(removeDustEffect); + }; + + // rotor wash effect + call FUNC(applyRotorWashEffect) +}, 0.5, _fnc_checkGoggles] call CBA_fnc_addPerFrameHandler; diff --git a/addons/goggles/XEH_preInit.sqf b/addons/goggles/XEH_preInit.sqf index 4eb7df91d1..ba5fa2373e 100644 --- a/addons/goggles/XEH_preInit.sqf +++ b/addons/goggles/XEH_preInit.sqf @@ -1,42 +1,31 @@ -/* - * Author: Garth 'L-H' de Wet - * Initialises Goggles. - * - * Arguments: - * None - * - * Return Value: - * None - * - * Example: - * None - * - * Public: No - */ #include "script_component.hpp" ADDON = false; +// effects PREP(applyDirtEffect); -PREP(applyDust); +PREP(applyDustEffect); PREP(applyGlassesEffect); - -PREP(checkGoggles); -PREP(clearGlasses); -PREP(dustHandler); -PREP(externalCamera); -PREP(getExplosionIndex); - -PREP(isDivingGoggles); -PREP(isGogglesVisible); -PREP(isInRotorWash); - -PREP(onEachFrame); -PREP(rainEffect); - +PREP(applyRainEffect); +PREP(applyRotorWashEffect); PREP(removeDirtEffect); PREP(removeDustEffect); PREP(removeGlassesEffect); PREP(removeRainEffect); +// public +PREP(externalCamera); +PREP(isDivingGoggles); +PREP(isGogglesVisible); +PREP(isInRotorWash); + +// general +PREP(clearGlasses); +PREP(getExplosionIndex); + +// eventhandlers +PREP(handleExplosion); +PREP(handleFired); +PREP(handleKilled); + ADDON = true; diff --git a/addons/goggles/anim/model.cfg b/addons/goggles/anim/model.cfg index 00ce647aa7..da614e05db 100644 --- a/addons/goggles/anim/model.cfg +++ b/addons/goggles/anim/model.cfg @@ -1,128 +1,133 @@ -class CfgSkeletons -{ - class Default - { - isDiscrete = 1; - skeletonInherit = ""; - skeletonBones[] = {}; - }; - class OFP2_ManSkeleton - { - isDiscrete = 0; - skeletonInherit = ""; - skeletonBones[] = - { - "Pelvis","", - "Spine","Pelvis", - "Spine1","Spine", - "Spine2","Spine1", - "Spine3","Spine2", - "Camera","Pelvis", - "weapon","Spine1", - "launcher","Spine1", - //Head skeleton in hierarchy - "neck","Spine3", - "neck1","neck", - "head","neck1", - //New facial features - "Face_Hub","head", - "Face_Jawbone","Face_Hub", - "Face_Jowl","Face_Jawbone", - "Face_chopRight","Face_Jawbone", - "Face_chopLeft","Face_Jawbone", - "Face_LipLowerMiddle","Face_Jawbone", - "Face_LipLowerLeft","Face_Jawbone", - "Face_LipLowerRight","Face_Jawbone", - "Face_Chin","Face_Jawbone", - "Face_Tongue","Face_Jawbone", - "Face_CornerRight","Face_Hub", - "Face_CheekSideRight","Face_CornerRight", - "Face_CornerLeft","Face_Hub", - "Face_CheekSideLeft","Face_CornerLeft", - "Face_CheekFrontRight","Face_Hub", - "Face_CheekFrontLeft","Face_Hub", - "Face_CheekUpperRight","Face_Hub", - "Face_CheekUpperLeft","Face_Hub", - "Face_LipUpperMiddle","Face_Hub", - "Face_LipUpperRight","Face_Hub", - "Face_LipUpperLeft","Face_Hub", - "Face_NostrilRight","Face_Hub", - "Face_NostrilLeft","Face_Hub", - "Face_Forehead","Face_Hub", - "Face_BrowFrontRight","Face_Forehead", - "Face_BrowFrontLeft","Face_Forehead", - "Face_BrowMiddle","Face_Forehead", - "Face_BrowSideRight","Face_Forehead", - "Face_BrowSideLeft","Face_Forehead", - "Face_Eyelids","Face_Hub", - "Face_EyelidUpperRight","Face_Hub", - "Face_EyelidUpperLeft","Face_Hub", - "Face_EyelidLowerRight","Face_Hub", - "Face_EyelidLowerLeft","Face_Hub", - "EyeLeft","Face_Hub", - "EyeRight","Face_Hub", - //Left upper side - "LeftShoulder","Spine3", - "LeftArm","LeftShoulder", - "LeftArmRoll","LeftArm", - "LeftForeArm","LeftArmRoll", - "LeftForeArmRoll","LeftForeArm", - "LeftHand","LeftForeArmRoll", - "LeftHandRing","LeftHand", - "LeftHandRing1","LeftHandRing", - "LeftHandRing2","LeftHandRing1", - "LeftHandRing3","LeftHandRing2", - "LeftHandPinky1","LeftHandRing", - "LeftHandPinky2","LeftHandPinky1", - "LeftHandPinky3","LeftHandPinky2", - "LeftHandMiddle1","LeftHand", - "LeftHandMiddle2","LeftHandMiddle1", - "LeftHandMiddle3","LeftHandMiddle2", - "LeftHandIndex1","LeftHand", - "LeftHandIndex2","LeftHandIndex1", - "LeftHandIndex3","LeftHandIndex2", - "LeftHandThumb1","LeftHand", - "LeftHandThumb2","LeftHandThumb1", - "LeftHandThumb3","LeftHandThumb2", - //Right upper side - "RightShoulder","Spine3", - "RightArm","RightShoulder", - "RightArmRoll","RightArm", - "RightForeArm","RightArmRoll", - "RightForeArmRoll","RightForeArm", - "RightHand","RightForeArmRoll", - "RightHandRing","RightHand", - "RightHandRing1","RightHandRing", - "RightHandRing2","RightHandRing1", - "RightHandRing3","RightHandRing2", - "RightHandPinky1","RightHandRing", - "RightHandPinky2","RightHandPinky1", - "RightHandPinky3","RightHandPinky2", - "RightHandMiddle1","RightHand", - "RightHandMiddle2","RightHandMiddle1", - "RightHandMiddle3","RightHandMiddle2", - "RightHandIndex1","RightHand", - "RightHandIndex2","RightHandIndex1", - "RightHandIndex3","RightHandIndex2", - "RightHandThumb1","RightHand", - "RightHandThumb2","RightHandThumb1", - "RightHandThumb3","RightHandThumb2", - //Left lower side - "LeftUpLeg","Pelvis", - "LeftUpLegRoll","LeftUpLeg", - "LeftLeg","LeftUpLegRoll", - "LeftLegRoll","LeftLeg", - "LeftFoot","LeftLegRoll", - "LeftToeBase","LeftFoot", - //Right lower side - "RightUpLeg","Pelvis", - "RightUpLegRoll","RightUpLeg", - "RightLeg","RightUpLegRoll", - "RightLegRoll","RightLeg", - "RightFoot","RightLegRoll", - "RightToeBase","RightFoot" - }; - // location of pivot points (local axes) for hierarchical animation - pivotsModel="A3\anims_f\data\skeleton\SkeletonPivots.p3d"; - }; -}; \ No newline at end of file + +class CfgSkeletons { + class Default { + isDiscrete = 1; + skeletonInherit = ""; + skeletonBones[] = {}; + }; + + class OFP2_ManSkeleton { + isDiscrete = 0; + skeletonInherit = ""; + skeletonBones[] = { + "Pelvis","", + "Spine","Pelvis", + "Spine1","Spine", + "Spine2","Spine1", + "Spine3","Spine2", + "Camera","Pelvis", + "weapon","Spine1", + "launcher","Spine1", + + //Head skeleton in hierarchy + "neck","Spine3", + "neck1","neck", + "head","neck1", + + //New facial features + "Face_Hub","head", + "Face_Jawbone","Face_Hub", + "Face_Jowl","Face_Jawbone", + "Face_chopRight","Face_Jawbone", + "Face_chopLeft","Face_Jawbone", + "Face_LipLowerMiddle","Face_Jawbone", + "Face_LipLowerLeft","Face_Jawbone", + "Face_LipLowerRight","Face_Jawbone", + "Face_Chin","Face_Jawbone", + "Face_Tongue","Face_Jawbone", + "Face_CornerRight","Face_Hub", + "Face_CheekSideRight","Face_CornerRight", + "Face_CornerLeft","Face_Hub", + "Face_CheekSideLeft","Face_CornerLeft", + "Face_CheekFrontRight","Face_Hub", + "Face_CheekFrontLeft","Face_Hub", + "Face_CheekUpperRight","Face_Hub", + "Face_CheekUpperLeft","Face_Hub", + "Face_LipUpperMiddle","Face_Hub", + "Face_LipUpperRight","Face_Hub", + "Face_LipUpperLeft","Face_Hub", + "Face_NostrilRight","Face_Hub", + "Face_NostrilLeft","Face_Hub", + "Face_Forehead","Face_Hub", + "Face_BrowFrontRight","Face_Forehead", + "Face_BrowFrontLeft","Face_Forehead", + "Face_BrowMiddle","Face_Forehead", + "Face_BrowSideRight","Face_Forehead", + "Face_BrowSideLeft","Face_Forehead", + "Face_Eyelids","Face_Hub", + "Face_EyelidUpperRight","Face_Hub", + "Face_EyelidUpperLeft","Face_Hub", + "Face_EyelidLowerRight","Face_Hub", + "Face_EyelidLowerLeft","Face_Hub", + "EyeLeft","Face_Hub", + "EyeRight","Face_Hub", + + //Left upper side + "LeftShoulder","Spine3", + "LeftArm","LeftShoulder", + "LeftArmRoll","LeftArm", + "LeftForeArm","LeftArmRoll", + "LeftForeArmRoll","LeftForeArm", + "LeftHand","LeftForeArmRoll", + "LeftHandRing","LeftHand", + "LeftHandRing1","LeftHandRing", + "LeftHandRing2","LeftHandRing1", + "LeftHandRing3","LeftHandRing2", + "LeftHandPinky1","LeftHandRing", + "LeftHandPinky2","LeftHandPinky1", + "LeftHandPinky3","LeftHandPinky2", + "LeftHandMiddle1","LeftHand", + "LeftHandMiddle2","LeftHandMiddle1", + "LeftHandMiddle3","LeftHandMiddle2", + "LeftHandIndex1","LeftHand", + "LeftHandIndex2","LeftHandIndex1", + "LeftHandIndex3","LeftHandIndex2", + "LeftHandThumb1","LeftHand", + "LeftHandThumb2","LeftHandThumb1", + "LeftHandThumb3","LeftHandThumb2", + + //Right upper side + "RightShoulder","Spine3", + "RightArm","RightShoulder", + "RightArmRoll","RightArm", + "RightForeArm","RightArmRoll", + "RightForeArmRoll","RightForeArm", + "RightHand","RightForeArmRoll", + "RightHandRing","RightHand", + "RightHandRing1","RightHandRing", + "RightHandRing2","RightHandRing1", + "RightHandRing3","RightHandRing2", + "RightHandPinky1","RightHandRing", + "RightHandPinky2","RightHandPinky1", + "RightHandPinky3","RightHandPinky2", + "RightHandMiddle1","RightHand", + "RightHandMiddle2","RightHandMiddle1", + "RightHandMiddle3","RightHandMiddle2", + "RightHandIndex1","RightHand", + "RightHandIndex2","RightHandIndex1", + "RightHandIndex3","RightHandIndex2", + "RightHandThumb1","RightHand", + "RightHandThumb2","RightHandThumb1", + "RightHandThumb3","RightHandThumb2", + + //Left lower side + "LeftUpLeg","Pelvis", + "LeftUpLegRoll","LeftUpLeg", + "LeftLeg","LeftUpLegRoll", + "LeftLegRoll","LeftLeg", + "LeftFoot","LeftLegRoll", + "LeftToeBase","LeftFoot", + + //Right lower side + "RightUpLeg","Pelvis", + "RightUpLegRoll","RightUpLeg", + "RightLeg","RightUpLegRoll", + "RightLegRoll","RightLeg", + "RightFoot","RightLegRoll", + "RightToeBase","RightFoot" + }; + + // location of pivot points (local axes) for hierarchical animation + pivotsModel="A3\anims_f\data\skeleton\SkeletonPivots.p3d"; + }; +}; diff --git a/addons/goggles/functions/fnc_applyDirtEffect.sqf b/addons/goggles/functions/fnc_applyDirtEffect.sqf index 068f7639d2..b10ebc9668 100644 --- a/addons/goggles/functions/fnc_applyDirtEffect.sqf +++ b/addons/goggles/functions/fnc_applyDirtEffect.sqf @@ -9,23 +9,29 @@ * Succeeded * * Example: - * _applied = call ace_goggles_fnc_ApplyDirtEffect; + * _applied = call ace_goggles_fnc_applyDirtEffect * * Public: Yes */ #include "script_component.hpp" -if (cameraOn != ace_player || {call FUNC(externalCamera)}) exitWith{false}; -private ["_dirtImage", "_applied", "_effects"]; -_effects = GETGLASSES(ace_player); +if (GVAR(showInThirdPerson)) exitWith {false}; +if (call FUNC(externalCamera)) exitWith {false}; + +private ["_unit", "_effects"]; + +_unit = ACE_player; + +_effects = GETGLASSES(_unit); _effects set [DIRT, true]; -SETGLASSES(ace_player,_effects); -if ([ace_player] call FUNC(isGogglesVisible)) then{ - _dirtImage = getText(ConfigFile >> "CfgGlasses" >> (goggles ace_player) >> "ACE_OverlayDirt"); +SETGLASSES(_unit,_effects); + +if ([_unit] call FUNC(isGogglesVisible)) then { + local _dirtImage = getText (configFile >> "CfgGlasses" >> goggles _unit >> "ACE_OverlayDirt"); + if (_dirtImage != "") then { - 100 cutRsc["RscACE_GogglesEffects", "PLAIN",0.1, false]; - + GVAR(GogglesEffectsLayer) cutRsc ["RscACE_GogglesEffects", "PLAIN", 0.1, false]; (GETUVAR(GVAR(DisplayEffects),displayNull) displayCtrl 10660) ctrlSetText _dirtImage; }; }; diff --git a/addons/goggles/functions/fnc_applyDust.sqf b/addons/goggles/functions/fnc_applyDust.sqf deleted file mode 100644 index 35677657a7..0000000000 --- a/addons/goggles/functions/fnc_applyDust.sqf +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Author: Garth 'L-H' de Wet - * Applies dust to screen. - * - * Arguments: - * None - * - * Return Value: - * None - * - * Example: - * call ace_goggles_fnc_ApplyDust; - * - * Public: Yes - */ -#include "script_component.hpp" -if (call FUNC(ExternalCamera)) exitWith {}; -if ([ace_player] call FUNC(isGogglesVisible)) exitWith { - 100 cutRsc["RscACE_GogglesEffects", "PLAIN",2,false]; - (uiNamespace getVariable ["ACE_Goggles_DisplayEffects", displayNull] displayCtrl 10662) ctrlSetText format[getText(ConfigFile >> "CfgGlasses" >> GVAR(Current) >> "ACE_DustPath"), GETDUSTT(DAMOUNT)+1]; - SETDUST(DAMOUNT,CLAMP(GETDUSTT(DAMOUNT)+1,0,1)); - SETDUST(DBULLETS,0); -}; - -if (GETVAR(ace_player,ACE_EyesDamaged,false)) exitWith {SETDUST(DACTIVE,false);SETDUST(DBULLETS,0);SETDUST(DAMOUNT,0);}; -SETDUST(DAMOUNT,CLAMP(GETDUSTT(DAMOUNT)+1,0,2)); - -private "_amount"; -_amount = 1 - (GETDUSTT(DAMOUNT) * 0.125); - -GVAR(PostProcessEyes) ppEffectAdjust[1, 1, 0, [0,0,0,0], [_amount,_amount,_amount,_amount],[1,1,1,0]]; -GVAR(PostProcessEyes) ppEffectCommit 1; -GVAR(PostProcessEyes) ppEffectEnable true; -SETDUST(DBULLETS,0); - -if (GVAR(DustHandler) != -1) then { // should be fixed in dev CBA - [GVAR(DustHandler)] call CALLSTACK(cba_fnc_removePerFrameHandler); - GVAR(DustHandler) = -1; -}; -GVAR(DustHandler) = [{ - if (ACE_diagTime >= GETDUSTT(DTIME) + 3) then { - SETDUST(DAMOUNT,CLAMP(GETDUSTT(DAMOUNT)-1,0,2)); - private "_amount"; - _amount = 1 - (GETDUSTT(DAMOUNT) * 0.125); - if !(ace_player getVariable ["ACE_EyesDamaged", false]) then { - GVAR(PostProcessEyes) ppEffectAdjust[1, 1, 0, [0,0,0,0], [_amount,_amount,_amount,_amount],[1,1,1,0]]; - GVAR(PostProcessEyes) ppEffectCommit 0.5; - }; - if (GETDUSTT(DAMOUNT) <= 0) then { - GVAR(PostProcessEyes) ppEffectAdjust[1, 1, 0, [0,0,0,0], [1,1,1,1],[1,1,1,0]]; - GVAR(PostProcessEyes) ppEffectCommit 2; - [{GVAR(PostProcessEyes) ppEffectEnable false;}, [], 2, 0.5] call EFUNC(common,waitAndExecute); - SETDUST(DACTIVE,false); - SETDUST(DBULLETS,0); - [GVAR(DustHandler)] call CALLSTACK(cba_fnc_removePerFrameHandler); - GVAR(DustHandler) = -1; - }; - }; -},0,[]] call CALLSTACK(CBA_fnc_addPerFrameHandler); diff --git a/addons/goggles/functions/fnc_applyDustEffect.sqf b/addons/goggles/functions/fnc_applyDustEffect.sqf new file mode 100644 index 0000000000..b052f3eae7 --- /dev/null +++ b/addons/goggles/functions/fnc_applyDustEffect.sqf @@ -0,0 +1,81 @@ +/* + * Author: Garth 'L-H' de Wet + * Applies dust to screen. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * call ace_goggles_fnc_applyDustEffect + * + * Public: Yes + */ +#include "script_component.hpp" + +if (GVAR(showInThirdPerson)) exitWith {}; +if (call FUNC(ExternalCamera)) exitWith {}; + +private ["_unit", "_amount"]; + +_unit = ACE_player; + +if ([_unit] call FUNC(isGogglesVisible)) exitWith { + GVAR(GogglesEffectsLayer) cutRsc ["RscACE_GogglesEffects", "PLAIN", 2, false]; + + ((GETUVAR(GVAR(DisplayEffects),displayNull)) displayCtrl 10662) ctrlSetText format [getText (configFile >> "CfgGlasses" >> goggles _unit >> "ACE_DustPath"), GETDUSTT(DAMOUNT) + 1]; + + SETDUST(DAMOUNT,CLAMP(GETDUSTT(DAMOUNT) + 1,0,1)); + SETDUST(DBULLETS,0); +}; + +if (GETVAR(_unit,ACE_EyesDamaged,false)) exitWith { + SETDUST(DACTIVE,false); + SETDUST(DBULLETS,0); + SETDUST(DAMOUNT,0); +}; + +SETDUST(DAMOUNT,CLAMP(GETDUSTT(DAMOUNT) + 1,0,2)); + +_amount = 1 - (GETDUSTT(DAMOUNT) * 0.125); + +GVAR(PostProcessEyes) ppEffectAdjust [1, 1, 0, [0, 0, 0, 0], [_amount, _amount, _amount, _amount], [1, 1, 1, 0]]; +GVAR(PostProcessEyes) ppEffectCommit 1; +GVAR(PostProcessEyes) ppEffectEnable true; + +SETDUST(DBULLETS,0); + +[GVAR(DustHandler)] call CBA_fnc_removePerFrameHandler; +GVAR(DustHandler) = -1; + +GVAR(DustHandler) = [{ + if (ACE_diagTime >= GETDUSTT(DTIME) + 3) then { + SETDUST(DAMOUNT,CLAMP(GETDUSTT(DAMOUNT)-1,0,2)); + + local _amount = 1 - (GETDUSTT(DAMOUNT) * 0.125); + + if !(_unit getVariable ["ACE_EyesDamaged", false]) then { + GVAR(PostProcessEyes) ppEffectAdjust [1, 1, 0, [0, 0, 0, 0], [_amount, _amount, _amount, _amount], [1, 1, 1, 0]]; + GVAR(PostProcessEyes) ppEffectCommit 0.5; + }; + + if (GETDUSTT(DAMOUNT) <= 0) then { + SETDUST(DACTIVE,false); + SETDUST(DBULLETS,0); + + GVAR(PostProcessEyes) ppEffectAdjust [1, 1, 0, [0, 0, 0, 0], [1, 1, 1, 1], [1, 1, 1, 0]]; + GVAR(PostProcessEyes) ppEffectCommit 2; + + [{ + if (GVAR(DustHandler) == -1) then { + GVAR(PostProcessEyes) ppEffectEnable false + }; + }, [], 2] call EFUNC(common,waitAndExecute); + + [GVAR(DustHandler)] call CBA_fnc_removePerFrameHandler; + GVAR(DustHandler) = -1; + }; + }; +}, 0, []] call CBA_fnc_addPerFrameHandler; diff --git a/addons/goggles/functions/fnc_applyGlassesEffect.sqf b/addons/goggles/functions/fnc_applyGlassesEffect.sqf index 8c2edb531e..7be010ef9c 100644 --- a/addons/goggles/functions/fnc_applyGlassesEffect.sqf +++ b/addons/goggles/functions/fnc_applyGlassesEffect.sqf @@ -11,19 +11,23 @@ * None * * Example: - * [goggles ace_player] call ace_goggles_fnc_ApplyGlassesEffect; + * [goggles ace_player] call ace_goggles_fnc_applyGlassesEffect * * Public: No */ #include "script_component.hpp" -private["_postProcessColour", "_postProcessTintAmount", "_glassesClassname", "_glassImagePath"]; -_glassesClassname = _this select 0; -_postProcessColour = getArray(configFile >> "CfgGlasses" >> _glassesClassname >> "ACE_Color"); -_postProcessTintAmount = getNumber(configFile >> "CfgGlasses" >> _glassesClassname >> "ACE_TintAmount"); +params ["_glasses"]; +// remove old effect call FUNC(removeGlassesEffect); -GVAR(EffectsActive) = true; + +private ["_config", "_postProcessColour", "_postProcessTintAmount", "_imagePath"]; + +_config = configFile >> "CfgGlasses" >> _glasses; + +_postProcessColour = getArray (_config >> "ACE_Color"); +_postProcessTintAmount = getNumber (_config >> "ACE_TintAmount"); if (_postProcessTintAmount != 0 && {GVAR(UsePP)}) then { _postProcessColour set [3, _postProcessTintAmount/100]; @@ -35,20 +39,20 @@ if (_postProcessTintAmount != 0 && {GVAR(UsePP)}) then { GVAR(PostProcess) ppEffectCommit 30; }; -_glassImagePath = getText(configFile >> "CfgGlasses" >> _glassesClassname >> "ACE_Overlay"); -if GETBROKEN then { - _glassImagePath = getText(configFile >> "CfgGlasses" >> _glassesClassname >> "ACE_OverlayCracked"); -}; -if (_glassImagePath != "") then { - 150 cutRsc["RscACE_Goggles", "PLAIN",1, false]; - (GLASSDISPLAY displayCtrl 10650) ctrlSetText _glassImagePath; +_imagePath = getText (_config >> ["ACE_Overlay", "ACE_OverlayCracked"] select GETBROKEN); + +if (_imagePath != "") then { + GVAR(GogglesLayer) cutRsc ["RscACE_Goggles", "PLAIN", 1, false]; + (GLASSDISPLAY displayCtrl 10650) ctrlSetText _imagePath; }; -if GETDIRT then { +if (GETDIRT) then { call FUNC(applyDirtEffect); }; -if GETDUSTT(DACTIVE) then { +if (GETDUSTT(DACTIVE)) then { SETDUST(DAMOUNT,CLAMP(GETDUSTT(DAMOUNT)-1,0,2)); - call FUNC(applyDust); + call FUNC(applyDustEffect); }; + +GVAR(EffectsActive) = true; diff --git a/addons/goggles/functions/fnc_applyRainEffect.sqf b/addons/goggles/functions/fnc_applyRainEffect.sqf new file mode 100644 index 0000000000..7e1260a453 --- /dev/null +++ b/addons/goggles/functions/fnc_applyRainEffect.sqf @@ -0,0 +1,68 @@ +/* + * Author: Garth 'L-H' de Wet + * Handles rain effects being created on glasses. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * call ace_goggles_fnc_applyRainEffect; + * + * Public: No + */ +#include "script_component.hpp" + +private ["_unit", "_fnc_underCover"]; + +_unit = ACE_player; + +if (!alive _unit) exitWith {}; + +_fnc_underCover = { + params ["_unit"]; + + if (vehicle _unit != _unit && {!isTurnedOut _unit}) exitWith {true}; + + // looking up and no roof over head + local _position = eyePos _unit; + positionCameraToWorld [0, 0, 1] select 2 < (positionCameraToWorld [0, 0, 0] select 2) - 0.4 || {(lineIntersects [_position, _position vectorAdd [0, 0, 15], _unit])} // return +}; + +if (!isNull findDisplay 312) exitWith { + if (GVAR(RainActive)) then { + call FUNC(removeRainEffect); + }; +}; + +// Ignore if unit is under water +if !(GVAR(EffectsActive) || {underwater _unit}) exitWith { + call FUNC(RemoveRainEffect); +}; + +if (GVAR(RainLastLevel) != rain) then { + call FUNC(RemoveRainEffect); + + GVAR(RainLastLevel) = rain; + + // Rain is happening + if (GVAR(RainLastLevel) > 0.05 && {!([_unit] call _fnc_underCover)}) then { + GVAR(RainActive) = true; + GVAR(RainDrops) = "#particlesource" createVehicleLocal position _unit; + GVAR(RainDrops) setParticleClass "ACERainEffect"; + GVAR(RainDrops) setDropInterval (0.07 * (1.1 - GVAR(RainLastLevel))); + GVAR(RainDrops) attachTo [vehicle _unit, [0,0,0]]; + }; +} else { + if (GVAR(RainLastLevel) > 0.05) then { + if (GVAR(RainActive) && {[_unit] call _fnc_underCover}) exitWith { + call FUNC(RemoveRainEffect); + }; + + if !(GVAR(RainActive)) then { + GVAR(RainLastLevel) = -1; + }; + }; +}; diff --git a/addons/goggles/functions/fnc_applyRotorWashEffect.sqf b/addons/goggles/functions/fnc_applyRotorWashEffect.sqf new file mode 100644 index 0000000000..7dc088bc4e --- /dev/null +++ b/addons/goggles/functions/fnc_applyRotorWashEffect.sqf @@ -0,0 +1,108 @@ +/* + * Author: Garth 'L-H' de Wet, commy2 + * Handles the rotor wash effects. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * call ace_goggles_fnc_applyRotorWashEffect; + * + * Public: No + */ +#include "script_component.hpp" + +private ["_unit", "_fnc_underCover"]; + +_unit = ACE_player; + +if (!alive _unit) exitWith {}; + +// idk. chaching magic? ends with isInRotorWash check. +GVAR(FrameEvent) set [0, !(GVAR(FrameEvent) select 0)]; + +if (GVAR(FrameEvent) select 0) exitWith { + if (vehicle _unit != _unit && {!isTurnedOut _unit}) exitWith { + (GVAR(FrameEvent) select 1) set [0, false]; + }; + + GVAR(FrameEvent) set [1, ([_unit] call FUNC(isInRotorWash))]; +}; + +// check if the unit is affected by rotor wash +private ["_rotorWash", "_safe"]; + +_rotorWash = GVAR(FrameEvent) select 1; +_safe = false; + +// no rotor wash? remove effects. +if !(_rotorWash select 0) exitWith { + if (GVAR(PostProcessEyes_Enabled)) then { + GVAR(PostProcessEyes_Enabled) = false; + + GVAR(PostProcessEyes) ppEffectAdjust [1, 1, 0, [0, 0, 0, 0], [0, 0, 0, 1], [1, 1, 1, 0]]; + GVAR(PostProcessEyes) ppEffectCommit 2; + + [{ + if (GVAR(DustHandler) == -1) then { + GVAR(PostProcessEyes) ppEffectEnable false; + } + }, [], 2] call EFUNC(common,waitAndExecute); + + [GVAR(DustHandler)] call CBA_fnc_removePerFrameHandler; + GVAR(DustHandler) = -1; + }; +}; + +// check protection of helmet +if (headgear _unit != "") then { + _safe = getNumber (configFile >> "CfgWeapons" >> headgear _unit >> "ACE_Protection") == 1; +}; + +// check protection of goggles +if !(_safe) then { + if !([_unit] call FUNC(isGogglesVisible)) exitWith {}; + + if (GETDUSTT(DAMOUNT) < 2) then { + if !(GETDUSTT(DACTIVE)) then { + SETDUST(DACTIVE,true); + + call FUNC(applyDustEffect); + } else { + if (_rotorWash select 1 > 0.5) then { + call FUNC(applyDustEffect); + }; + }; + }; + + _safe = getNumber (ConfigFile >> "CfgGlasses" >> goggles _unit >> "ACE_Protection") == 1; +}; + +// quit if protected by goggles or helmet +if (_safe) exitWith {}; + +// apply rotor wash effect +if (_rotorWash select 1 > 0) then { + local _scale = 0.7; + + if (_rotorWash select 1 > 0) then { + _scale = CLAMP(0.3 * (_rotorWash select 1),0.1,0.3); + } else { + _scale = 0.1; + }; + + _scale = 1 - _scale; + + [GVAR(DustHandler)] call CBA_fnc_removePerFrameHandler; + GVAR(DustHandler) = -1; + + if !(_unit getVariable ["ACE_EyesDamaged", false]) then { + GVAR(PostProcessEyes_Enabled) = true; + GVAR(PostProcessEyes) ppEffectAdjust [1, 1, 0, [0, 0, 0, 0], [_scale, _scale, _scale, _scale], [1, 1, 1, 0]]; + GVAR(PostProcessEyes) ppEffectCommit 0.5; + GVAR(PostProcessEyes) ppEffectEnable true; + }; +}; diff --git a/addons/goggles/functions/fnc_checkGoggles.sqf b/addons/goggles/functions/fnc_checkGoggles.sqf deleted file mode 100644 index f222ea9881..0000000000 --- a/addons/goggles/functions/fnc_checkGoggles.sqf +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Author: Garth 'L-H' de Wet - * Performs rain checks and checks to see whether glasses effects have been applied or not. - * Checks for external camera and removes effects. - * - * Arguments: - * None - * - * Return Value: - * None - * - * Example: - * None - * - * Public: No - */ -#include "script_component.hpp" -if (!alive ace_player) exitWith {}; -if (true) then { - // Detect if curator interface is open and disable effects - if (!isNull(findDisplay 312)) exitWith { - if (GVAR(EffectsActive)) then { - call FUNC(removeGlassesEffect); - }; - }; - call FUNC(checkGlasses); - if !([ace_player] call FUNC(isGogglesVisible)) exitWith { - if (GVAR(EffectsActive)) then { - call FUNC(removeGlassesEffect); - }; - }; - if (call FUNC(externalCamera)) exitWith { - if (GVAR(EffectsActive)) then { - call FUNC(removeGlassesEffect); - }; - }; - if !(GVAR(EffectsActive)) then { - [goggles ace_player] call FUNC(applyGlassesEffect); - } else { - if ([goggles ace_player] call FUNC(isDivingGoggles) && {underwater ace_player}) then { - call FUNC(removeRainEffect); - call FUNC(removeDirtEffect); - call FUNC(removeDustEffect); - }; - }; -}; diff --git a/addons/goggles/functions/fnc_clearGlasses.sqf b/addons/goggles/functions/fnc_clearGlasses.sqf index 7fcb05a511..d0b14e4f90 100644 --- a/addons/goggles/functions/fnc_clearGlasses.sqf +++ b/addons/goggles/functions/fnc_clearGlasses.sqf @@ -10,27 +10,31 @@ * None * * Example: - * call ace_goggles_fnc_ClearGlasses; + * call ace_goggles_fnc_clearGlasses * * Public: Yes */ #include "script_component.hpp" -private ["_broken", "_effects"]; +private ["_unit", "_broken", "_effects"]; + +_unit = ACE_player; _broken = GETBROKEN; _effects = GLASSESDEFAULT; _effects set [BROKEN, _broken]; -SETGLASSES(ace_player,_effects); -if ((stance ace_player) != "PRONE") then { - ace_player playActionNow "gestureWipeFace"; +SETGLASSES(_unit,_effects); + +if (stance _unit != "PRONE") then { + _unit playActionNow "gestureWipeFace"; }; + [{ if (cameraView == "INTERNAL") then { addCamShake [5, 1.75, 2]; }; -}, [], 0.3, 0] call EFUNC(common,waitAndExecute); +}, [], 0.3] call EFUNC(common,waitAndExecute); call FUNC(removeDirtEffect); call FUNC(removeRainEffect); diff --git a/addons/goggles/functions/fnc_dustHandler.sqf b/addons/goggles/functions/fnc_dustHandler.sqf deleted file mode 100644 index 44475d1acc..0000000000 --- a/addons/goggles/functions/fnc_dustHandler.sqf +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Author: Garth 'L-H' de Wet - * Determines whether to place dust on the goggles, based on calibre of weapon fired and other requirements. - * - * Arguments: - * 0: Unit - * 1: Weapon - * - * Return Value: - * None - * - * Example: - *ace_player addEventHandler ["Fired", {[_this select 0, _this select 1] call ace_goggles_fnc_dustHandler;}]; - * - * Public: No - */ -#include "script_component.hpp" -private ["_bullets", "_position", "_surface", "_weapon", "_cloudType", "_unit"]; -EXPLODE_2_PVT(_this,_unit,_weapon); -if (_unit != ace_player) exitWith {true}; -_cloudType = ""; - -if (rain > 0.1) exitWith {true}; -if ((stance _unit) != "PRONE") exitWith {true}; - -if (isClass(configFile >> "CfgWeapons" >> _weapon >> "GunParticles" >> "FirstEffect")) then { - _cloudType = getText(configFile >> "CfgWeapons" >> _weapon >> "GunParticles" >> "FirstEffect" >> "effectName"); -} else { - if (isClass(configFile >> "CfgWeapons" >> _weapon >> "GunParticles" >> "effect1")) then { - _cloudType = getText(configFile >> "CfgWeapons" >> _weapon >> "GunParticles" >> "effect1" >> "effectName"); - }; -}; - -if (_cloudType == "") exitWith {true}; - -_position = getPosATL _unit; - -if (surfaceIsWater _position) exitWith {}; -if ((_position select 2) > 0.2) exitWith {}; - -_surface = surfaceType _position; - -if (_surface != GVAR(surfaceCache)) then { - GVAR(surfaceCache) = _surface; - _surface = ([_surface, "#"] call CBA_fnc_split) select 1; - GVAR(surfaceCacheIsDust) = getNumber (ConfigFile >> "CfgSurfaces" >> _surface >> "dust") >= 0.1; -}; - -if (!GVAR(surfaceCacheIsDust)) exitWith {}; - -_bullets = GETDUSTT(DBULLETS); - -if ((ACE_diagTime - GETDUSTT(DTIME)) > 1) then { - _bullets = 0; -}; - -_bullets = _bullets + 1; -SETDUST(DBULLETS,_bullets); -SETDUST(DTIME,ACE_diagTime); - -if (GETDUSTT(DAMOUNT) < 2) then { - private "_bulletsRequired"; - _bulletsRequired = 100; - if (isNumber (ConfigFile >> _cloudType >> "ACE_Goggles_BulletCount")) then { - _bulletsRequired = getNumber (ConfigFile >> _cloudType >> "ACE_Goggles_BulletCount"); - }; - - if (_bulletsRequired <= _bullets) then { - SETDUST(DACTIVE,true); - call FUNC(applyDust); - }; -}; -true diff --git a/addons/goggles/functions/fnc_externalCamera.sqf b/addons/goggles/functions/fnc_externalCamera.sqf index ddc05e6b87..1af09827ab 100644 --- a/addons/goggles/functions/fnc_externalCamera.sqf +++ b/addons/goggles/functions/fnc_externalCamera.sqf @@ -6,15 +6,13 @@ * None * * Return Value: - * Whether the camera is in external view or not. If the "showInThirdPerson" option is checked, this will always return false. + * Whether the camera is in external view or not. * * Example: - * call ace_goggles_fnc_removeRainEffect; + * call ace_goggles_fnc_externalCamera; * * Public: Yes */ #include "script_component.hpp" -if (GVAR(showInThirdPerson)) exitWith { false }; - -(cameraView in ["EXTERNAL", "GROUP"] || {call EFUNC(common,isFeatureCameraActive)}) +cameraView in ["EXTERNAL", "GROUP"] || EFUNC(common,isFeatureCameraActive) // return diff --git a/addons/goggles/functions/fnc_getExplosionIndex.sqf b/addons/goggles/functions/fnc_getExplosionIndex.sqf index 6e16085b2c..9d7c4004c7 100644 --- a/addons/goggles/functions/fnc_getExplosionIndex.sqf +++ b/addons/goggles/functions/fnc_getExplosionIndex.sqf @@ -1,5 +1,5 @@ /* - * Author: Garth 'L-H' de Wet + * Author: Garth 'L-H' de Wet, commy2 * Turns 0-1 damage of explosion Event into a rating system of 0-3 * * Arguments: @@ -13,13 +13,12 @@ * * Public: No */ -private ["_effectIndex"]; +#include "script_component.hpp" -_effectIndex = switch true do { - case (_this <= 0.04): {0}; - case (_this <= 0.06): {1}; - case (_this <= 0.09): {2}; - default {3}; -}; +params ["_damage"]; -_effectIndex +if (_damage <= 0.04) exitWith {0}; +if (_damage <= 0.06) exitWith {1}; +if (_damage <= 0.09) exitWith {2}; + +3 diff --git a/addons/goggles/functions/fnc_handleExplosion.sqf b/addons/goggles/functions/fnc_handleExplosion.sqf new file mode 100644 index 0000000000..795cdd78b1 --- /dev/null +++ b/addons/goggles/functions/fnc_handleExplosion.sqf @@ -0,0 +1,51 @@ +/* + * Author: Garth 'L-H' de Wet, commy2 + * Handles explosions. + * + * Arguments: + * 0: Unit + * + * Return Value: + * Function is handled? + * + * Public: No + */ +#include "script_component.hpp" + +params ["_unit"]; + +if (_unit != ACE_player) exitWith {true}; + +call FUNC(applyDirtEffect); + +if (GETBROKEN) exitWith {true}; + +private ["_config", "_effects"]; + +_config = configFile >> "CfgGlasses" >> goggles _unit; + +if ((_this select 1) call FUNC(GetExplosionIndex) < getNumber (_config >> "ACE_Resistance")) exitWith {true}; + +if !([_unit] call FUNC(isGogglesVisible)) exitWith { + ["GlassesCracked", [_unit]] call EFUNC(common,localEvent); + true +}; + +_effects = GETGLASSES(_unit); +_effects set [BROKEN, true]; + +SETGLASSES(_unit,_effects); + +if (getText (_config >> "ACE_OverlayCracked") != "") then { + if (GVAR(showInThirdPerson)) exitWith {}; + if (call FUNC(ExternalCamera)) exitWith {}; + + if (isNull (GLASSDISPLAY)) then { + GVAR(GogglesLayer) cutRsc ["RscACE_Goggles", "PLAIN", 1, false]; + }; + + (GLASSDISPLAY displayCtrl 10650) ctrlSetText getText (_config >> "ACE_OverlayCracked"); +}; + +["GlassesCracked", [_unit]] call EFUNC(common,localEvent); +true diff --git a/addons/goggles/functions/fnc_handleFired.sqf b/addons/goggles/functions/fnc_handleFired.sqf new file mode 100644 index 0000000000..90260d07b3 --- /dev/null +++ b/addons/goggles/functions/fnc_handleFired.sqf @@ -0,0 +1,88 @@ +/* + * Author: Garth 'L-H' de Wet, commy2 + * Determines whether to place dust on the goggles, based on calibre of weapon fired and other requirements. + * + * Arguments: + * 0: Unit + * 1: Weapon + * + * Return Value: + * Function is handled? + * + * Public: No + */ +#include "script_component.hpp" + +params ["_unit", "_weapon"]; + +if (_unit != ACE_player) exitWith {true}; + +// no dust in rain +if (rain > 0.1) exitWith {true}; + +// effect only aplies when lying on the ground +if (stance _unit != "PRONE") exitWith {true}; + +private ["_position", "_particleConfig", "_cloudType", "_surface", "_bullets"]; + +// check if the unit really is on the ground and not in a building +_position = getPosATL _unit; + +if (_position select 2 > 0.2) exitWith {true}; + +// get weapon dust effect +_particleConfig = configFile >> "CfgWeapons" >> _weapon >> "GunParticles"; + +_cloudType = ""; + +if (isClass (_particleConfig >> "FirstEffect")) then { // @todo read this with custom / non-standard config classnames + _cloudType = getText (_particleConfig >> "FirstEffect" >> "effectName"); +} else { + if (isClass (_particleConfig >> "effect1")) then { + _cloudType = getText (_particleConfig >> "effect1" >> "effectName"); + }; +}; + +// quit if the weapon causes no dust effect +if (_cloudType == "") exitWith {true}; + +// get if the surface is dusty +if (surfaceIsWater _position) exitWith {true}; + +_surface = surfaceType _position select [1]; // cuts of the leading # + +if (_surface != GVAR(surfaceCache)) then { + GVAR(surfaceCache) = _surface; + GVAR(surfaceCacheIsDust) = getNumber (configFile >> "CfgSurfaces" >> _surface >> "dust") >= 0.1; +}; + +// quit if surface isn't dusty +if (!GVAR(surfaceCacheIsDust)) exitWith {true}; + +// increment dust value with type bullet +_bullets = GETDUSTT(DBULLETS); + +if (ACE_diagTime - GETDUSTT(DTIME) > 1) then { + _bullets = 0; +}; + +_bullets = _bullets + 1; + +SETDUST(DBULLETS,_bullets); +SETDUST(DTIME,ACE_diagTime); + +// apply dust effect if the amount of fired bullets is over the threshold +if (GETDUSTT(DAMOUNT) < 2) then { + local _bulletsRequired = 100; + + if (isNumber (configFile >> _cloudType >> QGVAR(BulletCount))) then { + _bulletsRequired = getNumber (configFile >> _cloudType >> QGVAR(BulletCount)); + }; + + if (_bullets > _bulletsRequired) then { + SETDUST(DACTIVE,true); + call FUNC(applyDustEffect); + }; +}; + +true diff --git a/addons/goggles/functions/fnc_handleKilled.sqf b/addons/goggles/functions/fnc_handleKilled.sqf new file mode 100644 index 0000000000..d156fb684c --- /dev/null +++ b/addons/goggles/functions/fnc_handleKilled.sqf @@ -0,0 +1,32 @@ +/* + * Author: Garth 'L-H' de Wet, commy2 + * Handles the player dying. + * + * Arguments: + * 0: Unit + * + * Return Value: + * Function is handled? + * + * Public: No + */ +#include "script_component.hpp" + +params ["_unit"]; + +if (_unit != ACE_player) exitWith {true}; + +GVAR(PostProcessEyes) ppEffectEnable false; + +SETGLASSES(_unit,GLASSESDEFAULT); + +call FUNC(removeGlassesEffect); + +GVAR(EffectsActive) = false; + +_unit setVariable ["ACE_EyesDamaged", false]; + +[GVAR(DustHandler)] call CBA_fnc_removePerFrameHandler; +GVAR(DustHandler) = -1; + +true diff --git a/addons/goggles/functions/fnc_isDivingGoggles.sqf b/addons/goggles/functions/fnc_isDivingGoggles.sqf index bcc6b0db5e..ab5bb74269 100644 --- a/addons/goggles/functions/fnc_isDivingGoggles.sqf +++ b/addons/goggles/functions/fnc_isDivingGoggles.sqf @@ -1,22 +1,24 @@ /* - * Author: Garth 'L-H' de Wet + * Author: commy2 * Determines whether passed goggles is diving goggles or a variant of them. * * Arguments: * 0: Glasses classname * * Return Value: - * Whether diving goggles are worn + * Check if these goggles are diving goggles * * Example: - * [(goggles ace_player)] call ace_goggles_fnc_isDivingGoggles; + * [goggles ace_player] call ace_goggles_fnc_isDivingGoggles; * * Public: Yes */ #include "script_component.hpp" -private ["_result", "_glasses"]; -_glasses = _this select 0; -_result = _glasses == "G_Diving"; -if (_result) exitWith {true}; -_result = [configFile >> "CfgGlasses" >> _glasses, configFile >> "CfgGlasses" >> "G_Diving"] call CBA_fnc_inheritsFrom; -_result + +params ["_glasses"]; + +local _config = configFile >> "CfgGlasses" >> _glasses; + +if (!isClass _config) exitWith {false}; + +getNumber (_config >> "mode") == 1 // return diff --git a/addons/goggles/functions/fnc_isGogglesVisible.sqf b/addons/goggles/functions/fnc_isGogglesVisible.sqf index 253a82f0a3..dfa2b97087 100644 --- a/addons/goggles/functions/fnc_isGogglesVisible.sqf +++ b/addons/goggles/functions/fnc_isGogglesVisible.sqf @@ -1,6 +1,6 @@ /* * Author: Garth 'L-H' de Wet - * Determines if goggles are visible on passed unit (Also checks if unit is in vehicle and cameraView is set to GUNNER) + * Determines if goggles are visible on passed unit. * * Arguments: * 0: Unit @@ -15,24 +15,18 @@ */ #include "script_component.hpp" -PARAMS_1(_unit); +params ["_unit"]; -private ["_currentGlasses", "_result", "_position", "_visible"]; +private ["_currentGlasses", "_position"]; _currentGlasses = goggles _unit; -_result = false; -if ((vehicle _unit) != _unit) exitWith {(cameraView != "GUNNER")}; +if (_currentGlasses == "") exitWith {false}; -if (_currentGlasses != "") then { - _position =(getPosASLW _unit); - if (surfaceIsWater _position && {((_position select 2) < 0.25)}) exitWith { - _result = ([_currentGlasses] call FUNC(isDivingGoggles)); - }; - if (getNumber (ConfigFile >> "CfgGlasses" >> _currentGlasses >> "ACE_Resistance") == 0) exitWith { - _result = false; - }; - _result = !([_currentGlasses] call FUNC(isDivingGoggles)); -}; +// requires ACE_Resistance config entry. Returns false for balaclavas and bandanas. +if (getNumber (configFile >> "CfgGlasses" >> _currentGlasses >> "ACE_Resistance") == 0) exitWith {false}; -_result +// check if in water and has diving goggles or on land and not diving goggles +_position = getPosASLW _unit; + +(surfaceIsWater _position && {_position select 2 < 0.25}) isEqualTo (_currentGlasses call FUNC(isDivingGoggles)) // return diff --git a/addons/goggles/functions/fnc_isInRotorWash.sqf b/addons/goggles/functions/fnc_isInRotorWash.sqf index ef6391fdc6..5ddc59192a 100644 --- a/addons/goggles/functions/fnc_isInRotorWash.sqf +++ b/addons/goggles/functions/fnc_isInRotorWash.sqf @@ -1,10 +1,10 @@ /* - * Author: Garth 'L-H' de Wet + * Author: Garth 'L-H' de Wet, commy2 * Checks for nearby running helicopters (within 15m) * * Arguments: * 0: Unit - * 1: Radius to check for helicopter Default: 15 (optional) + * 1: Radius to check for helicopter (default: 15) * * Return Value: * : @@ -12,35 +12,31 @@ * 1: Amount of rotor wash. * * Example: - * if (([ace_player, 10] call ace_goggles_fnc_isInRotorWash) select 0) then { hint "Rotor wash"; }; - * if (([ace_player] call ace_goggles_fnc_isInRotorWash) select 0) then { hint "Rotor wash"; }; + * if ([ace_player, 10] call ace_goggles_fnc_isInRotorWash select 0) then { hint "Rotor wash"; }; + * if ([ace_player] call ace_goggles_fnc_isInRotorWash select 0) then { hint "Rotor wash"; }; * * Public: Yes */ #include "script_component.hpp" -private ["_heli", "_unit", "_result", "_radius"]; -_unit = _this select 0; -_radius = 15; -if (count _this > 1) then { - _radius = _this select 1; -}; -_result = [false, _radius + 2]; -_heli = (getPosATL _unit) nearEntities [["Helicopter"], _radius]; +params ["_unit", ["_radius", 15]]; + +local _rotorWash = [false, 0]; + { - if !(_x isKindOf "ParachuteBase") then { - if (isEngineOn _x) then { - private "_distance"; - _distance = (_radius - (_unit distance _x)); - if (_distance != 0) then { - _distance = _distance / _radius; - }; - if (_distance < (_result select 1)) then { - _result = [true, _distance]; - }; + if (isEngineOn _x) then { + local _distance = _unit distance _x; + + // convert distance to 0...1 range, where 0 is the maximum radius + _distance = 1 - _distance / _radius; + + // use highest amount of rotor wash as return value in case of multiple helicopters + if (_distance > _rotorWash select 1) then { + _rotorWash set [0, true]; + _rotorWash set [1, _distance]; }; }; false -} count _heli; +} count (position _unit nearEntities [["Helicopter"], _radius]); -_result +_rotorWash diff --git a/addons/goggles/functions/fnc_onEachFrame.sqf b/addons/goggles/functions/fnc_onEachFrame.sqf deleted file mode 100644 index 863046da7f..0000000000 --- a/addons/goggles/functions/fnc_onEachFrame.sqf +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Author: Garth 'L-H' de Wet - * Checks whether the player is in the downwash of a helicopter and handles applying effects of that. - * - * Arguments: - * None - * - * Return Value: - * None - * - * Example: - * ["ACE_Goggles_RotorWash", "OnEachFrame", "call ace_goggles_fnc_OnEachFrame;"] call BIS_fnc_addStackedEventHandler; - * - * Public: No - */ -#include "script_component.hpp" -if (isNull(ace_player)) exitWith {}; -GVAR(FrameEvent) set [0, !(GVAR(FrameEvent) select 0)]; -if (GVAR(FrameEvent) select 0) exitWith { - if (vehicle ace_player != ace_player && {!([ace_player] call EFUNC(common,isTurnedOut))}) exitWith {(GVAR(FrameEvent) select 1) set [0, false]; }; - GVAR(FrameEvent) set [1, ([ace_player] call FUNC(isInRotorWash))]; -}; -private ["_rotorWash","_safe"]; -_rotorWash = GVAR(FrameEvent) select 1; -_safe = false; -if !(_rotorWash select 0) exitWith { - if (GVAR(PostProcessEyes_Enabled)) then { - GVAR(PostProcessEyes_Enabled) = false; - if (GVAR(DustHandler) != -1) then { // should be fixed in dev CBA - [GVAR(DustHandler)] call CALLSTACK(cba_fnc_removePerFrameHandler); - GVAR(DustHandler) = -1; - }; - GVAR(PostProcessEyes) ppEffectAdjust [1, 1, 0, [0,0,0,0], [0,0,0,1],[1,1,1,0]]; - GVAR(PostProcessEyes) ppEffectCommit 2; - GVAR(DustHandler) = [{ - GVAR(PostProcessEyes) ppEffectEnable false; - GVAR(DustHandler) = -1; - }, [], 2, 0.5] call EFUNC(common,waitAndExecute); - }; -}; -if ((headgear ace_player) != "") then { - _safe = (getNumber (ConfigFile >> "CfgWeapons" >> (headgear ace_player) >> "ACE_Protection") == 1); -}; -if !(_safe) then { - if !([ace_player] call FUNC(isGogglesVisible)) exitWith{}; - if (GETDUSTT(DAMOUNT) < 2) then { - if (!GETDUSTT(DACTIVE)) then { - SETDUST(DACTIVE,true); - call FUNC(ApplyDust); - } else { - if ((_rotorWash select 1) > 0.5) then { - call FUNC(ApplyDust); - }; - }; - }; - _safe = (getNumber (ConfigFile >> "CfgGlasses" >> GVAR(Current) >> "ACE_Protection") == 1); -}; -if (_safe) exitWith {}; -if ((_rotorWash select 1) <= 15) then { - private "_scale"; - _scale = 0.7; - if ((_rotorWash select 1) != 0) then { - _scale = CLAMP(0.3*(_rotorWash select 1),0.1,0.3); - } else { - _scale = 0.1; - }; - _scale = 1 - _scale; - if (GVAR(DustHandler) != -1) then { // should be fixed in dev CBA - [GVAR(DustHandler)] call CALLSTACK(cba_fnc_removePerFrameHandler); - GVAR(DustHandler) = -1; - }; - if !(ace_player getVariable ["ACE_EyesDamaged", false]) then { - GVAR(PostProcessEyes_Enabled) = true; - GVAR(PostProcessEyes) ppEffectAdjust [1, 1, 0, [0,0,0,0], [_scale,_scale,_scale,_scale],[1,1,1,0]]; - GVAR(PostProcessEyes) ppEffectCommit 0.5; - GVAR(PostProcessEyes) ppEffectEnable true; - }; -}; diff --git a/addons/goggles/functions/fnc_rainEffect.sqf b/addons/goggles/functions/fnc_rainEffect.sqf deleted file mode 100644 index b5badef6f2..0000000000 --- a/addons/goggles/functions/fnc_rainEffect.sqf +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Author: Garth 'L-H' de Wet - * Handles rain effects being created on glasses. - * - * Arguments: - * None - * - * Return Value: - * None - * - * Example: - * call ace_goggles_fnc_rainEffect; - * - * Public: No - */ -#include "script_component.hpp" -private ["_fnc_underCover"]; -if (isNull(ace_player) || {!(alive ace_player)}) exitWith {}; -_fnc_underCover = { - private ["_pos", "_unit"]; - _unit = (_this select 0); - if (vehicle _unit != _unit && {!([_unit] call EFUNC(common,isTurnedOut))}) exitWith {true}; - _pos = eyePos _unit; - ((positionCameraToWorld [0,0,1] select 2) < ((positionCameraToWorld [0,0,0] select 2) - 0.4)) || {(lineIntersects [_pos, _pos vectorAdd [0,0,15], _unit])} -}; -if (!isNull(findDisplay 312)) exitWith { - if (GVAR(RainActive)) then { - call FUNC(RemoveRainEffect); - }; -}; -// Ignore if ace_player is under water -if (!GVAR(EffectsActive) || {underwater ace_player}) exitWith{call FUNC(RemoveRainEffect);}; -if (GVAR(RainLastLevel) != rain) then { - call FUNC(RemoveRainEffect); - GVAR(RainLastLevel) = rain; - // Rain is happening - if (GVAR(RainLastLevel) > 0.05 && {!([ace_player] call _fnc_underCover)}) then { - GVAR(RainActive) = true; - GVAR(RainDrops) = "#particlesource" createVehicleLocal GetPos ace_player; - GVAR(RainDrops) setParticleClass "ACERainEffect"; - GVAR(RainDrops) setDropInterval (0.07 * (1.1 - GVAR(RainLastLevel))); - GVAR(RainDrops) attachTo [vehicle ace_player,[0,0,0]]; - }; -}else{ - if (GVAR(RainLastLevel) > 0.05) then { - if (GVAR(RainActive) && {[ace_player] call _fnc_underCover}) exitWith { - call FUNC(RemoveRainEffect); - }; - if (!GVAR(RainActive)) then { - GVAR(RainLastLevel) = -1; - }; - }; -}; diff --git a/addons/goggles/functions/fnc_removeDirtEffect.sqf b/addons/goggles/functions/fnc_removeDirtEffect.sqf index f7efd39af3..a6d5a232cc 100644 --- a/addons/goggles/functions/fnc_removeDirtEffect.sqf +++ b/addons/goggles/functions/fnc_removeDirtEffect.sqf @@ -9,11 +9,12 @@ * None * * Example: - * call ace_goggles_fnc_removeDirtEffect; + * call ace_goggles_fnc_removeDirtEffect * * Public: Yes */ #include "script_component.hpp" -if (!isNull(GETUVAR(GVAR(DisplayEffects),displayNull))) then { + +if (!isNull (GETUVAR(GVAR(DisplayEffects),displayNull))) then { (GETUVAR(GVAR(DisplayEffects),displayNull) displayCtrl 10660) ctrlSetText ""; }; diff --git a/addons/goggles/functions/fnc_removeDustEffect.sqf b/addons/goggles/functions/fnc_removeDustEffect.sqf index 1e179ed6b4..a04121e8ba 100644 --- a/addons/goggles/functions/fnc_removeDustEffect.sqf +++ b/addons/goggles/functions/fnc_removeDustEffect.sqf @@ -9,11 +9,12 @@ * None * * Example: - * call ace_goggles_fnc_removeDustEffect; + * call ace_goggles_fnc_removeDustEffect * * Public: Yes */ #include "script_component.hpp" -if (!isNull(GETUVAR(GVAR(DisplayEffects),displayNull))) then { + +if (!isNull (GETUVAR(GVAR(DisplayEffects),displayNull))) then { (GETUVAR(GVAR(DisplayEffects),displayNull) displayCtrl 10662) ctrlSetText ""; }; diff --git a/addons/goggles/functions/fnc_removeGlassesEffect.sqf b/addons/goggles/functions/fnc_removeGlassesEffect.sqf index c7965fefbc..658daf1d32 100644 --- a/addons/goggles/functions/fnc_removeGlassesEffect.sqf +++ b/addons/goggles/functions/fnc_removeGlassesEffect.sqf @@ -1,7 +1,6 @@ /* * Author: Garth 'L-H' de Wet - * Removes the glasses effect from the screen, removes dirt effect, removes rain effect, - * removes dust effect. Does not reset array (glasses will still be broken, dirty, ect.) + * Removes the glasses effect from the screen, removes dirt effect, removes rain effect, removes dust effect. Does not reset array (glasses will still be broken, dirty, ect.) * * Arguments: * None @@ -10,15 +9,16 @@ * None * * Example: - * call ace_goggles_fnc_removeGlassesEffect; + * call ace_goggles_fnc_removeGlassesEffect * * Public: Yes */ #include "script_component.hpp" + GVAR(EffectsActive) = false; GVAR(PostProcess) ppEffectEnable false; -if (!isNull(GLASSDISPLAY)) then { +if (!isNull (GLASSDISPLAY)) then { GLASSDISPLAY closeDisplay 0; }; diff --git a/addons/goggles/functions/fnc_removeRainEffect.sqf b/addons/goggles/functions/fnc_removeRainEffect.sqf index 0d322e12da..fb7f3e5e2e 100644 --- a/addons/goggles/functions/fnc_removeRainEffect.sqf +++ b/addons/goggles/functions/fnc_removeRainEffect.sqf @@ -9,13 +9,15 @@ * None * * Example: - * call ace_goggles_fnc_removeRainEffect; + * call ace_goggles_fnc_removeRainEffect * * Public: Yes */ #include "script_component.hpp" -if (!isNull (GVAR(RainDrops))) then { - deleteVehicle (GVAR(RainDrops)); + +if (!isNull GVAR(RainDrops)) then { + deleteVehicle GVAR(RainDrops); }; + GVAR(RainActive) = false; GVAR(RainLastLevel) = 0; diff --git a/addons/grenades/CfgAmmo.hpp b/addons/grenades/CfgAmmo.hpp index 61f20eb935..5aa33284c8 100644 --- a/addons/grenades/CfgAmmo.hpp +++ b/addons/grenades/CfgAmmo.hpp @@ -1,3 +1,4 @@ + class CfgAmmo { class FlareCore; class FlareBase: FlareCore { @@ -5,87 +6,95 @@ class CfgAmmo { flareSize = 12; timeToLive = 60; }; + class F_40mm_White: FlareBase { intensity = 40000; flareSize = 12; }; + class F_20mm_White: FlareBase { intensity = 20000; flareSize = 6; }; + class F_Signal_Green: FlareBase { intensity = 20000; flareSize = 12; }; + class Flare_82mm_AMOS_White: FlareCore { intensity = 80000; flareSize = 12; timeToLive = 60; }; - class F_20mm_Red: F_20mm_White {}; - class F_20mm_Green: F_20mm_White {}; - class F_20mm_Yellow: F_20mm_White {}; - class ACE_F_Hand_White: F_20mm_White { - grenadeBurningSound[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5}; - grenadeFireSound[] = {"SmokeShellSoundHit1",0.25,"SmokeShellSoundHit2",0.25,"SmokeShellSoundHit3",0.5}; - soundTrigger[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5}; - SmokeShellSoundHit1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_1",1.25893,1,100}; - SmokeShellSoundHit2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_2",1.25893,1,100}; - SmokeShellSoundHit3[] = {"A3\Sounds_F\weapons\smokeshell\smoke_3",1.25893,1,100}; - SmokeShellSoundLoop1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop1",0.125893,1,70}; - SmokeShellSoundLoop2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop2",0.125893,1,70}; - timeToLive = 60; - }; - class ACE_F_Hand_Red: F_20mm_Red { - grenadeBurningSound[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5}; - grenadeFireSound[] = {"SmokeShellSoundHit1",0.25,"SmokeShellSoundHit2",0.25,"SmokeShellSoundHit3",0.5}; - soundTrigger[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5}; - SmokeShellSoundHit1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_1",1.25893,1,100}; - SmokeShellSoundHit2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_2",1.25893,1,100}; - SmokeShellSoundHit3[] = {"A3\Sounds_F\weapons\smokeshell\smoke_3",1.25893,1,100}; - SmokeShellSoundLoop1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop1",0.125893,1,70}; - SmokeShellSoundLoop2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop2",0.125893,1,70}; - timeToLive = 60; - }; - class ACE_F_Hand_Green: F_20mm_Green { - grenadeBurningSound[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5}; - grenadeFireSound[] = {"SmokeShellSoundHit1",0.25,"SmokeShellSoundHit2",0.25,"SmokeShellSoundHit3",0.5}; - soundTrigger[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5}; - SmokeShellSoundHit1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_1",1.25893,1,100}; - SmokeShellSoundHit2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_2",1.25893,1,100}; - SmokeShellSoundHit3[] = {"A3\Sounds_F\weapons\smokeshell\smoke_3",1.25893,1,100}; - SmokeShellSoundLoop1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop1",0.125893,1,70}; - SmokeShellSoundLoop2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop2",0.125893,1,70}; - timeToLive = 60; - }; - class ACE_F_Hand_Yellow: F_20mm_Yellow { - grenadeBurningSound[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5}; - grenadeFireSound[] = {"SmokeShellSoundHit1",0.25,"SmokeShellSoundHit2",0.25,"SmokeShellSoundHit3",0.5}; - soundTrigger[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5}; - SmokeShellSoundHit1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_1",1.25893,1,100}; - SmokeShellSoundHit2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_2",1.25893,1,100}; - SmokeShellSoundHit3[] = {"A3\Sounds_F\weapons\smokeshell\smoke_3",1.25893,1,100}; - SmokeShellSoundLoop1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop1",0.125893,1,70}; - SmokeShellSoundLoop2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop2",0.125893,1,70}; timeToLive = 60; }; - class ACE_G_M84: F_20mm_Yellow { - useFlare = 0; - flareSize = 0; - intensity = 0; - grenadeBurningSound[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5}; - grenadeFireSound[] = {"SmokeShellSoundHit1",0.25,"SmokeShellSoundHit2",0.25,"SmokeShellSoundHit3",0.5}; - soundTrigger[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5}; - SmokeShellSoundHit1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_1",1.25893,1,100}; - SmokeShellSoundHit2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_2",1.25893,1,100}; - SmokeShellSoundHit3[] = {"A3\Sounds_F\weapons\smokeshell\smoke_3",1.25893,1,100}; - SmokeShellSoundLoop1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop1",0.125893,1,70}; - SmokeShellSoundLoop2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop2",0.125893,1,70}; - timeToLive = 6; - fuseDistance = 2.3; + class F_20mm_Red; + class ACE_F_Hand_Red: F_20mm_Red { + timeToLive = 60; + }; + + class F_20mm_Green; + class ACE_F_Hand_Green: F_20mm_Green { + timeToLive = 60; + }; + + class F_20mm_Yellow; + class ACE_F_Hand_Yellow: F_20mm_Yellow { + timeToLive = 60; + }; + + class SmokeShell; + class ACE_G_Handflare_White: SmokeShell { + GVAR(flare) = 1; + GVAR(color)[] = {0.5,0.5,0.5,0.5}; + model = "\A3\weapons_f\ammo\flare_white"; + dangerRadiusHit = -1; + suppressionRadiusHit = -1; + typicalSpeed = 22; + cost = 100; + deflecting = 30; + explosionTime = 3; + timeToLive = 60; + grenadeFireSound[] = {}; + grenadeBurningSound[] = {}; + aiAmmoUsageFlags = "4 + 2"; + smokeColor[] = {0,0,0,0}; + effectsSmoke = "ACE_HandFlareEffect"; + whistleDist = 0; + }; + class ACE_G_Handflare_Red: ACE_G_Handflare_White { + GVAR(color)[] = {0.5,0.25,0.25,0.5}; + model = "\A3\weapons_f\ammo\flare_red"; + }; + class ACE_G_Handflare_Green: ACE_G_Handflare_White { + GVAR(color)[] = {0.25,0.5,0.25,0.5}; + model = "\A3\weapons_f\ammo\flare_green"; + }; + class ACE_G_Handflare_Yellow: ACE_G_Handflare_White { + GVAR(color)[] = {0.5,0.5,0.25,0.5}; + model = "\A3\weapons_f\ammo\flare_yellow"; + }; + + class ACE_G_M84: SmokeShell { + GVAR(flashbang) = 1; model = PATHTOF(models\ACE_m84_thrown.p3d); + dangerRadiusHit = -1; + suppressionRadiusHit = 20; + typicalSpeed = 22; + cost = 40; + explosive = 1E-7; + deflecting = 15; + explosionTime = 2.3; + timeToLive = 6; + grenadeFireSound[] = {}; + grenadeBurningSound[] = {}; + aiAmmoUsageFlags = "0"; + smokeColor[] = {0,0,0,0}; + effectsSmoke = "ACE_M84FlashbangEffect"; + whistleDist = 0; }; }; diff --git a/addons/grenades/CfgEventHandlers.hpp b/addons/grenades/CfgEventHandlers.hpp index 2587bdf86f..d93f8469bc 100644 --- a/addons/grenades/CfgEventHandlers.hpp +++ b/addons/grenades/CfgEventHandlers.hpp @@ -1,19 +1,20 @@ + class Extended_PreInit_EventHandlers { class ADDON { - init = QUOTE( call COMPILE_FILE(XEH_preInit) ); + init = QUOTE(call COMPILE_FILE(XEH_preInit)); }; }; class Extended_PostInit_EventHandlers { class ADDON { - init = QUOTE( call COMPILE_FILE(XEH_postInit) ); + init = QUOTE(call COMPILE_FILE(XEH_postInit)); }; }; class Extended_FiredBIS_EventHandlers { class CAManBase { class ADDON { - clientFiredBIS = QUOTE( _this call FUNC(throwGrenade) ); + firedBIS = QUOTE(_this call FUNC(throwGrenade)); }; }; }; diff --git a/addons/grenades/CfgMagazines.hpp b/addons/grenades/CfgMagazines.hpp index 31e80dc545..16dd9929ff 100644 --- a/addons/grenades/CfgMagazines.hpp +++ b/addons/grenades/CfgMagazines.hpp @@ -1,3 +1,4 @@ + class CfgMagazines { class HandGrenade; class ACE_HandFlare_Base: HandGrenade { @@ -8,55 +9,60 @@ class CfgMagazines { mass = 4; initSpeed = 22; }; + class ACE_HandFlare_White: ACE_HandFlare_Base { author = ECSTRING(common,ACETeam); scope = 2; - ammo = "ACE_F_Hand_White"; displayname = CSTRING(M127A1_White_Name); descriptionshort = CSTRING(M127A1_White_Description); displayNameShort = CSTRING(M127A1_White_NameShort); model = "\A3\weapons_f\ammo\flare_white"; picture = "\A3\Weapons_F\Data\UI\gear_flare_white_ca.paa"; + ammo = "ACE_G_Handflare_White"; }; + class ACE_HandFlare_Red: ACE_HandFlare_Base { author = ECSTRING(common,ACETeam); scope = 2; - ammo = "ACE_F_Hand_Red"; displayname = CSTRING(M127A1_Red_Name); descriptionshort = CSTRING(M127A1_Red_Description); displayNameShort = CSTRING(M127A1_Red_NameShort); model = "\A3\weapons_f\ammo\flare_red"; picture = "\A3\Weapons_F\Data\UI\gear_flare_red_ca.paa"; + ammo = "ACE_G_Handflare_Red"; }; + class ACE_HandFlare_Green: ACE_HandFlare_Base { author = ECSTRING(common,ACETeam); scope = 2; - ammo = "ACE_F_Hand_Green"; displayname = CSTRING(M127A1_Green_Name); descriptionshort = CSTRING(M127A1_Green_Description); displayNameShort = CSTRING(M127A1_Green_NameShort); model = "\A3\weapons_f\ammo\flare_green"; picture = "\A3\Weapons_F\Data\UI\gear_flare_green_ca.paa"; + ammo = "ACE_G_Handflare_Green"; }; + class ACE_HandFlare_Yellow: ACE_HandFlare_Base { author = ECSTRING(common,ACETeam); scope = 2; - ammo = "ACE_F_Hand_Yellow"; displayname = CSTRING(M127A1_Yellow_Name); descriptionshort = CSTRING(M127A1_Yellow_Description); displayNameShort = CSTRING(M127A1_Yellow_NameShort); model = "\A3\weapons_f\ammo\flare_yellow"; picture = "\A3\Weapons_F\Data\UI\gear_flare_yellow_ca.paa"; + ammo = "ACE_G_Handflare_Yellow"; }; + class ACE_M84: HandGrenade { author = ECSTRING(common,ACETeam); - ammo = "ACE_G_M84"; displayname = CSTRING(M84_Name); descriptionshort = CSTRING(M84_Description); displayNameShort = "M84"; - mass = 4; model = PATHTOF(models\ACE_m84.p3d); picture = PATHTOF(UI\ACE_m84_x_ca.paa); + ammo = "ACE_G_M84"; + mass = 4; }; class 3Rnd_UGL_FlareGreen_F; @@ -65,6 +71,7 @@ class CfgMagazines { ammo = "F_40mm_Green"; initSpeed = 120; }; + class 6Rnd_RedSignal_F: 6Rnd_GreenSignal_F { author = ECSTRING(common,ACETeam); ammo = "F_40mm_Red"; diff --git a/addons/grenades/CfgVehicles.hpp b/addons/grenades/CfgVehicles.hpp index 7cf2085193..94c60e10d7 100644 --- a/addons/grenades/CfgVehicles.hpp +++ b/addons/grenades/CfgVehicles.hpp @@ -1,9 +1,6 @@ + class CfgVehicles { class NATO_Box_Base; - class EAST_Box_Base; - class IND_Box_Base; - class Box_NATO_Support_F; - class Box_NATO_Grenades_F: NATO_Box_Base { class TransportItems { MACRO_ADDITEM(ACE_HandFlare_White,12); @@ -12,6 +9,7 @@ class CfgVehicles { }; }; + class EAST_Box_Base; class Box_East_Grenades_F: EAST_Box_Base { class TransportItems { MACRO_ADDITEM(ACE_HandFlare_Yellow,12); @@ -20,6 +18,7 @@ class CfgVehicles { }; }; + class IND_Box_Base; class Box_IND_Grenades_F: IND_Box_Base { class TransportItems { MACRO_ADDITEM(ACE_HandFlare_Yellow,12); @@ -28,6 +27,7 @@ class CfgVehicles { }; }; + class Box_NATO_Support_F; class ACE_Box_Misc: Box_NATO_Support_F { class TransportItems { MACRO_ADDITEM(ACE_HandFlare_White,12); diff --git a/addons/grenades/CfgWeapons.hpp b/addons/grenades/CfgWeapons.hpp index 4edc6e6d12..f84c00713a 100644 --- a/addons/grenades/CfgWeapons.hpp +++ b/addons/grenades/CfgWeapons.hpp @@ -1,21 +1,26 @@ + class CfgWeapons { class GrenadeLauncher; - class Throw: GrenadeLauncher { - muzzles[] += {"ACE_HandFlare_WhiteMuzzle", "ACE_HandFlare_RedMuzzle", "ACE_HandFlare_GreenMuzzle", "ACE_HandFlare_YellowMuzzle", "ACE_M84Muzzle"}; + muzzles[] += {"ACE_HandFlare_WhiteMuzzle","ACE_HandFlare_RedMuzzle","ACE_HandFlare_GreenMuzzle","ACE_HandFlare_YellowMuzzle","ACE_M84Muzzle"}; + class ThrowMuzzle; class ACE_HandFlare_WhiteMuzzle: ThrowMuzzle { magazines[] = {"ACE_HandFlare_White"}; }; + class ACE_HandFlare_RedMuzzle: ThrowMuzzle { magazines[] = {"ACE_HandFlare_Red"}; }; + class ACE_HandFlare_GreenMuzzle: ThrowMuzzle { magazines[] = {"ACE_HandFlare_Green"}; }; + class ACE_HandFlare_YellowMuzzle: ThrowMuzzle { magazines[] = {"ACE_HandFlare_Yellow"}; }; + class ACE_M84Muzzle: ThrowMuzzle { magazines[] = {"ACE_M84"}; }; diff --git a/addons/grenades/Effects.hpp b/addons/grenades/Effects.hpp new file mode 100644 index 0000000000..3cbcef9a38 --- /dev/null +++ b/addons/grenades/Effects.hpp @@ -0,0 +1,8 @@ + +class ACE_M84FlashbangEffect { + // empty +}; + +class ACE_HandFlareEffect { + // empty +}; diff --git a/addons/grenades/XEH_postInit.sqf b/addons/grenades/XEH_postInit.sqf index b1559c6cfe..54c2b06e8b 100644 --- a/addons/grenades/XEH_postInit.sqf +++ b/addons/grenades/XEH_postInit.sqf @@ -4,7 +4,7 @@ ["flashbangExplosion", {_this call FUNC(flashbangExplosionEH)}] call EFUNC(common,addEventHandler); -if !(hasInterface) exitWith {}; +if (!hasInterface) exitWith {}; GVAR(flashbangPPEffectCC) = ppEffectCreate ["ColorCorrections", 4265]; GVAR(flashbangPPEffectCC) ppEffectForceInNVG true; @@ -21,4 +21,4 @@ GVAR(flashbangPPEffectCC) ppEffectForceInNVG true; [] call FUNC(nextMode); }, {false}, -[9, [false, false, false]], false] call cba_fnc_addKeybind; //8 Key +[9, [false, false, false]], false] call CBA_fnc_addKeybind; //8 Key diff --git a/addons/grenades/XEH_preInit.sqf b/addons/grenades/XEH_preInit.sqf index 0df2e235fd..631cecca85 100644 --- a/addons/grenades/XEH_preInit.sqf +++ b/addons/grenades/XEH_preInit.sqf @@ -2,6 +2,7 @@ ADDON = false; +PREP(flare); PREP(flashbangExplosionEH); PREP(flashbangThrownFuze); PREP(nextMode); diff --git a/addons/grenades/config.cpp b/addons/grenades/config.cpp index c2a899d66c..2f9e631fe1 100644 --- a/addons/grenades/config.cpp +++ b/addons/grenades/config.cpp @@ -17,3 +17,5 @@ class CfgPatches { #include "CfgWeapons.hpp" #include "CfgMagazines.hpp" #include "CfgVehicles.hpp" + +#include "Effects.hpp" diff --git a/addons/grenades/functions/fnc_flare.sqf b/addons/grenades/functions/fnc_flare.sqf new file mode 100644 index 0000000000..bf1d571640 --- /dev/null +++ b/addons/grenades/functions/fnc_flare.sqf @@ -0,0 +1,40 @@ +/* + * Author: commy2 + * Makes flare shine. + * + * Arguments: + * 0: The flare + * 1: Color of flare + * 2: Intensity of flare + * 3: Flare lifetime + * + * Return Value: + * None + * + * Example: + * [_nade, [0.5,0.5,0.5], 0.5, 60] call ace_grenades_fnc_flare + * + * Public: No + */ +#include "script_component.hpp" + +params ["_projectile", "_color", "_intensity", "_timeToLive"]; + +private "_light"; +_light = "#lightpoint" createVehicleLocal position _projectile; + +_light setLightColor _color; +_light setLightAmbient _color; +_light setLightIntensity _intensity; +_light setLightBrightness 0.8; + +_light setLightUseFlare true; +_light setLightFlareSize 3.0; +_light setLightFlareMaxDistance 1000; + +_light setLightDayLight true; + +_light lightAttachObject [_projectile, [0,0,0]]; +//_light attachTo [_projectile, [0,0,0]]; + +[{deleteVehicle _this}, _light, _timeToLive, 1] call EFUNC(common,waitAndExecute); diff --git a/addons/grenades/functions/fnc_flashbangExplosionEH.sqf b/addons/grenades/functions/fnc_flashbangExplosionEH.sqf index a98fbc2350..b45dc099fc 100644 --- a/addons/grenades/functions/fnc_flashbangExplosionEH.sqf +++ b/addons/grenades/functions/fnc_flashbangExplosionEH.sqf @@ -6,7 +6,7 @@ * 0: The grenade * * Return Value: - * Nothing + * None * * Example: * [theGrenade] call ace_grenades_fnc_flashbangExplosionEH @@ -15,14 +15,14 @@ */ #include "script_component.hpp" -private ["_affected", "_strength", "_posGrenade", "_posUnit", "_angleGrenade", "_angleView", "_angleDiff", "_light", "_losCount", "_dirToUnitVector", "_eyeDir", "_eyePos"]; +params ["_grenade"]; -PARAMS_1(_grenade); +private ["_affected", "_strength", "_posGrenade", "_eyePos", "_losCount", "_eyeDir", "_dirToUnitVector", "_angleDiff", "_light"]; _affected = _grenade nearEntities ["CAManBase", 20]; { - if ((local _x) && {alive _x}) then { + if (local _x && {alive _x}) then { _strength = 1 - ((_x distance _grenade) min 15) / 15; @@ -31,16 +31,19 @@ _affected = _grenade nearEntities ["CAManBase", 20]; if (_x != ACE_player) then { //must be AI [_x, true] call EFUNC(common,disableAI); - _x setSkill ((skill _x) / 50); + + _x setSkill (skill _x / 50); [{ - PARAMS_1(_unit); + params ["_unit"]; + //Make sure we don't enable AI for unconscious units - if (!(_unit getVariable ["ace_isunconscious", false])) then { + if !(_unit getVariable ["ace_isUnconscious", false]) then { [_unit, false] call EFUNC(common,disableAI); }; + _unit setSkill (skill _unit * 50); - }, [_x], (7 * _strength)] call EFUNC(common,waitAndExecute); + }, [_x], 7 * _strength] call EFUNC(common,waitAndExecute); } else { //Do effects for player // is there line of sight to the grenade? @@ -48,21 +51,19 @@ _affected = _grenade nearEntities ["CAManBase", 20]; _eyePos = eyePos ACE_player; //PositionASL _posGrenade set [2, (_posGrenade select 2) + 0.2]; // compensate for grenade glitching into ground - _losCount = 0; //Check for line of sight (check 4 points in case grenade is stuck in an object or underground) - { - if (!lineIntersects [(_posGrenade vectorAdd _x), _eyePos, _grenade, ACE_player]) then { - _losCount = _losCount + 1; - }; - } forEach [[0,0,0], [0,0,0.2], [0.1, 0.1, 0.1], [-0.1, -0.1, 0.1]]; + _losCount = { + !lineIntersects [_posGrenade vectorAdd _x, _eyePos, _grenade, ACE_player] + } count [[0,0,0], [0,0,0.2], [0.1, 0.1, 0.1], [-0.1, -0.1, 0.1]]; + TRACE_1("Line of sight count (out of 4)",_losCount); if (_losCount <= 1) then { _strength = _strength / 10; }; - //Add ace_hearing ear ringing sound effect - if ((isClass (configFile >> "CfgPatches" >> "ACE_Hearing")) && {_strength > 0}) then { - [_x, (20 * _strength)] call EFUNC(hearing,earRinging); + // add ace_hearing ear ringing sound effect + if (isClass (configFile >> "CfgPatches" >> "ACE_Hearing") && {_strength > 0}) then { + [_x, 20 * _strength] call EFUNC(hearing,earRinging); }; // account for people looking away by slightly @@ -71,17 +72,16 @@ _affected = _grenade nearEntities ["CAManBase", 20]; _dirToUnitVector = _eyePos vectorFromTo _posGrenade; _angleDiff = acos (_eyeDir vectorDotProduct _dirToUnitVector); - //From 0-45deg, full effect + // from 0-45deg, full effect if (_angleDiff > 45) then { _strength = _strength - _strength * ((_angleDiff - 45) / 120); }; TRACE_1("Final strength for player",_strength); - - //Add ace_medical pain effect: - if ((isClass (configFile >> "CfgPatches" >> "ACE_Medical")) && {_strength > 0.1}) then { - [ACE_player, (_strength / 2)] call EFUNC(medical,adjustPainLevel); + // add ace_medical pain effect: + if (isClass (configFile >> "CfgPatches" >> "ACE_Medical") && {_strength > 0.1}) then { + [ACE_player, _strength / 2] call EFUNC(medical,adjustPainLevel); }; // create flash to illuminate environment @@ -91,30 +91,32 @@ _affected = _grenade nearEntities ["CAManBase", 20]; _light setLightColor [1,1,1]; _light setLightDayLight true; - //Delete the light after 0.1 seconds + // delete the light after 0.1 seconds [{ - PARAMS_1(_light); + params ["_light"]; deleteVehicle _light; }, [_light], 0.1] call EFUNC(common,waitAndExecute); // blind player - if (_strength > 0.1) then { + if (hasInterface && {_strength > 0.1}) then { GVAR(flashbangPPEffectCC) ppEffectEnable true; GVAR(flashbangPPEffectCC) ppEffectAdjust [1,1,(0.8 + _strength) min 1,[1,1,1,0],[0,0,0,1],[0,0,0,0]]; GVAR(flashbangPPEffectCC) ppEffectCommit 0.01; //PARTIALRECOVERY - start decreasing effect over ACE_time [{ - PARAMS_1(_strength); + params ["_strength"]; + GVAR(flashbangPPEffectCC) ppEffectAdjust [1,1,0,[1,1,1,0],[0,0,0,1],[0,0,0,0]]; GVAR(flashbangPPEffectCC) ppEffectCommit (10 * _strength); - }, [_strength], (7 * _strength), 0] call EFUNC(common,waitAndExecute); + }, [_strength], 7 * _strength] call EFUNC(common,waitAndExecute); //FULLRECOVERY - end effect [{ GVAR(flashbangPPEffectCC) ppEffectEnable false; - }, [], (17 * _strength)] call EFUNC(common,waitAndExecute); + }, [], 17 * _strength] call EFUNC(common,waitAndExecute); }; }; }; -} forEach _affected; + true +} count _affected; diff --git a/addons/grenades/functions/fnc_flashbangThrownFuze.sqf b/addons/grenades/functions/fnc_flashbangThrownFuze.sqf index 377793ca7b..21d132464a 100644 --- a/addons/grenades/functions/fnc_flashbangThrownFuze.sqf +++ b/addons/grenades/functions/fnc_flashbangThrownFuze.sqf @@ -6,7 +6,7 @@ * 0: projectile - Flashbang Grenade * * Return Value: - * Nothing + * None * * Example: * [theFlashbang] call ace_grenades_fnc_flashbangThrownFuze @@ -15,12 +15,13 @@ */ #include "script_component.hpp" -PARAMS_1(_projectile); +params ["_projectile"]; if (alive _projectile) then { playSound3D ["A3\Sounds_F\weapons\Explosion\explosion_mine_1.wss", _projectile, false, getPosASL _projectile, 5, 1.2, 400]; - + private "_affected"; _affected = _projectile nearEntities ["CAManBase", 50]; + ["flashbangExplosion", _affected, [_projectile]] call EFUNC(common,targetEvent); }; diff --git a/addons/grenades/functions/fnc_nextMode.sqf b/addons/grenades/functions/fnc_nextMode.sqf index 913906b8f8..7789e12ac4 100644 --- a/addons/grenades/functions/fnc_nextMode.sqf +++ b/addons/grenades/functions/fnc_nextMode.sqf @@ -3,7 +3,7 @@ * Select the next throwing mode and display message. * * Arguments: - * Nothing + * None * * Return Value: * Handeled diff --git a/addons/grenades/functions/fnc_throwGrenade.sqf b/addons/grenades/functions/fnc_throwGrenade.sqf index c7bc09a261..9439aef4bd 100644 --- a/addons/grenades/functions/fnc_throwGrenade.sqf +++ b/addons/grenades/functions/fnc_throwGrenade.sqf @@ -12,7 +12,7 @@ * 6: projectile - Object of the projectile that was shot * * Return Value: - * Nothing + * None * * Example: * [clientFiredBIS-XEH] call ace_grenades_fnc_throwGrenade @@ -21,25 +21,50 @@ */ #include "script_component.hpp" -private ["_unit", "_weapon", "_projectile", "_mode", "_fuzeTime"]; +params ["_unit", "_weapon", "", "", "_ammo", "", "_projectile"]; -_unit = _this select 0; -_weapon = _this select 1; -_projectile = _this select 6; - -if (_unit != ACE_player) exitWith {}; if (_weapon != "Throw") exitWith {}; +// http://feedback.arma3.com/view.php?id=12340 +if (isNull _projectile) then { + _projectile = nearestObject [_unit, _ammo]; +}; + +// handle special grenades +if (local _unit) then { + if (getNumber (configFile >> "CfgAmmo" >> _ammo >> QGVAR(flashbang)) == 1) then { + private "_fuzeTime"; + _fuzeTime = getNumber (configFile >> "CfgAmmo" >> _ammo >> "explosionTime"); + + [FUNC(flashbangThrownFuze), [_projectile], _fuzeTime, 0] call EFUNC(common,waitAndExecute); + }; +}; + +if (getNumber (configFile >> "CfgAmmo" >> _ammo >> QGVAR(flare)) == 1) then { + private ["_fuzeTime", "_timeToLive", "_color", "_intensity"]; + + _fuzeTime = getNumber (configFile >> "CfgAmmo" >> _ammo >> "explosionTime"); + _timeToLive = getNumber (configFile >> "CfgAmmo" >> _ammo >> "timeToLive"); + _color = getArray (configFile >> "CfgAmmo" >> _ammo >> QGVAR(color)); + _intensity = _color select 3; + _color resize 3; + + [FUNC(flare), [_projectile, _color, _intensity, _timeToLive], _fuzeTime, 0] call EFUNC(common,waitAndExecute); +}; + +// handle throw modes +if (_unit != ACE_player) exitWith {}; + +private "_mode"; _mode = missionNamespace getVariable [QGVAR(currentThrowMode), 0]; if (_mode != 0) then { private "_velocity"; - _velocity = velocity _projectile; switch (_mode) do { //high throw - case 1 : { + case 1 : { _velocity = [ 0.5 * (_velocity select 0), 0.5 * (_velocity select 1), @@ -47,24 +72,18 @@ if (_mode != 0) then { ]; }; //precise throw - case 2 : { + case 2 : { _velocity = (_unit weaponDirection _weapon) vectorMultiply (vectorMagnitude _velocity); }; //roll grande - case 3 : { + case 3 : { //@todo }; //drop grenade - case 4 : { + case 4 : { _velocity = [0, 0, 0]; }; }; _projectile setVelocity _velocity; }; - -if (typeOf _projectile == "ACE_G_M84") then { - _fuzeTime = getNumber (configFile >> "CfgAmmo" >> typeOf _projectile >> "fuseDistance"); - // _fuzeTime = getNumber (configFile >> "CfgAmmo" >> typeOf _projectile >> "explosionTime"); //@toDo pretty sure this should be explosionTime not fuseDistance - [FUNC(flashbangThrownFuze), [_projectile], _fuzeTime, 0] call EFUNC(common,waitAndExecute); -}; diff --git a/addons/grenades/stringtable.xml b/addons/grenades/stringtable.xml index 522c370777..31282500e8 100644 --- a/addons/grenades/stringtable.xml +++ b/addons/grenades/stringtable.xml @@ -1,4 +1,4 @@ - + diff --git a/addons/grenades/textures/ace_m84.rvmat b/addons/grenades/textures/ace_m84.rvmat index e668125e70..1bfb6ffc0f 100644 --- a/addons/grenades/textures/ace_m84.rvmat +++ b/addons/grenades/textures/ace_m84.rvmat @@ -8,85 +8,85 @@ PixelShaderID = "Super"; VertexShaderID = "Super"; class Stage1 { - texture = "z\ace\addons\grenades\textures\ace_m84_nohq.paa"; - uvSource = "tex"; - class uvTransform - { - aside[] = {1,0,0}; - up[] = {0,1,0}; - dir[] = {0,0,0}; - pos[] = {0,0,0}; - }; + texture = "z\ace\addons\grenades\textures\ace_m84_nohq.paa"; + uvSource = "tex"; + class uvTransform + { + aside[] = {1,0,0}; + up[] = {0,1,0}; + dir[] = {0,0,0}; + pos[] = {0,0,0}; + }; }; class Stage2 { - texture = "#(argb,8,8,3)color(0.5,0.5,0.5,1,DT)"; - uvSource = "tex"; - class uvTransform - { - aside[] = {0,9,0}; - up[] = {4.5,0,0}; - dir[] = {0,0,0}; - pos[] = {0,0,0}; - }; + texture = "#(argb,8,8,3)color(0.5,0.5,0.5,1,DT)"; + uvSource = "tex"; + class uvTransform + { + aside[] = {0,9,0}; + up[] = {4.5,0,0}; + dir[] = {0,0,0}; + pos[] = {0,0,0}; + }; }; class Stage3 { - texture = "#(argb,8,8,3)color(0.5,0.5,0.5,0,MC)"; - uvSource = "tex"; - class uvTransform - { - aside[] = {1,0,0}; - up[] = {0,1,0}; - dir[] = {0,0,0}; - pos[] = {0,0,0}; - }; + texture = "#(argb,8,8,3)color(0.5,0.5,0.5,0,MC)"; + uvSource = "tex"; + class uvTransform + { + aside[] = {1,0,0}; + up[] = {0,1,0}; + dir[] = {0,0,0}; + pos[] = {0,0,0}; + }; }; class Stage4 { - texture = "#(argb,8,8,3)color(1,1,1,1,AS)"; - uvSource = "tex"; - class uvTransform - { - aside[] = {1,0,0}; - up[] = {0,1,0}; - dir[] = {0,0,0}; - pos[] = {0,0,0}; - }; + texture = "#(argb,8,8,3)color(1,1,1,1,AS)"; + uvSource = "tex"; + class uvTransform + { + aside[] = {1,0,0}; + up[] = {0,1,0}; + dir[] = {0,0,0}; + pos[] = {0,0,0}; + }; }; class Stage5 { - texture = "z\ace\addons\grenades\textures\ace_m84_smdi.paa"; - uvSource = "tex"; - class uvTransform - { - aside[] = {1,0,0}; - up[] = {0,1,0}; - dir[] = {0,0,0}; - pos[] = {0,0,0}; - }; + texture = "z\ace\addons\grenades\textures\ace_m84_smdi.paa"; + uvSource = "tex"; + class uvTransform + { + aside[] = {1,0,0}; + up[] = {0,1,0}; + dir[] = {0,0,0}; + pos[] = {0,0,0}; + }; }; class Stage6 { - texture = "#(ai,16,2,2)fresnel(10.4,8.3)"; - uvSource = "tex"; - class uvTransform - { - aside[] = {1,0,0}; - up[] = {0,1,0}; - dir[] = {0,0,1}; - pos[] = {0,0,0}; - }; + texture = "#(ai,16,2,2)fresnel(10.4,8.3)"; + uvSource = "tex"; + class uvTransform + { + aside[] = {1,0,0}; + up[] = {0,1,0}; + dir[] = {0,0,1}; + pos[] = {0,0,0}; + }; }; class Stage7 { - texture = "a3\data_f\env_land_co.paa"; - uvSource = "tex"; - class uvTransform - { - aside[] = {1,0,0}; - up[] = {0,1,0}; - dir[] = {0,0,0}; - pos[] = {0,0,0}; - }; -}; \ No newline at end of file + texture = "a3\data_f\env_land_co.paa"; + uvSource = "tex"; + class uvTransform + { + aside[] = {1,0,0}; + up[] = {0,1,0}; + dir[] = {0,0,0}; + pos[] = {0,0,0}; + }; +}; diff --git a/addons/hearing/ACE_Settings.hpp b/addons/hearing/ACE_Settings.hpp index 867914b857..262c3edc34 100644 --- a/addons/hearing/ACE_Settings.hpp +++ b/addons/hearing/ACE_Settings.hpp @@ -19,4 +19,10 @@ class ACE_Settings { isClientSettable = 1; displayName = CSTRING(DisableEarRinging); }; + class GVAR(enabledForZeusUnits) { + value = 1; + typeName = "BOOL"; + displayName = CSTRING(enabledForZeusUnits_DisplayName); + description = CSTRING(enabledForZeusUnits_Description); + }; }; diff --git a/addons/hearing/CfgEventHandlers.hpp b/addons/hearing/CfgEventHandlers.hpp index ce968ed2ca..f09f259266 100644 --- a/addons/hearing/CfgEventHandlers.hpp +++ b/addons/hearing/CfgEventHandlers.hpp @@ -29,7 +29,7 @@ class Extended_FiredNear_EventHandlers { class Extended_Explosion_EventHandlers { class CAManBase { class GVAR(ExplosionNear) { - clientExplosion = QUOTE( if (GVAR(enableCombatDeafness) && {_this select 0 == ACE_player}) then {_this call FUNC(explosionNear)}; ); + clientExplosion = QUOTE(_this call FUNC(explosionNear);); }; }; }; diff --git a/addons/hearing/CfgVehicles.hpp b/addons/hearing/CfgVehicles.hpp index 44ea8f734f..2273653c3a 100644 --- a/addons/hearing/CfgVehicles.hpp +++ b/addons/hearing/CfgVehicles.hpp @@ -130,6 +130,12 @@ class CfgVehicles { }; }; }; + class enabledForZeusUnits { + displayName = CSTRING(enabledForZeusUnits_DisplayName); + description = CSTRING(enabledForZeusUnits_Description); + typeName = "BOOL"; + defaultValue = 1; + }; }; class ModuleDescription { description = CSTRING(Module_Description); diff --git a/addons/hearing/CfgWeapons.hpp b/addons/hearing/CfgWeapons.hpp index 2806ef9970..7c21baaed2 100644 --- a/addons/hearing/CfgWeapons.hpp +++ b/addons/hearing/CfgWeapons.hpp @@ -47,5 +47,16 @@ class CfgWeapons { GVAR(lowerVolume) = 0.60; }; class H_Cap_marshal: H_Cap_headphones {}; -}; + class H_HelmetB_light: H_HelmetB { + GVAR(protection) = 0.8; + GVAR(lowerVolume) = 0.20; + }; + + class H_HelmetB_plain_mcamo; + class H_HelmetSpecB: H_HelmetB_plain_mcamo { + GVAR(protection) = 0.8; + GVAR(lowerVolume) = 0.20; + }; + +}; diff --git a/addons/hearing/XEH_postInit.sqf b/addons/hearing/XEH_postInit.sqf index ad73ed55d5..66406ad917 100644 --- a/addons/hearing/XEH_postInit.sqf +++ b/addons/hearing/XEH_postInit.sqf @@ -15,7 +15,7 @@ GVAR(time4) = 0; ["SettingsInitialized", { // Spawn volume updating process - [FUNC(updateVolume), 1, [false] ] call CBA_fnc_addPerFrameHandler; + [FUNC(updateVolume), 1, [false]] call CBA_fnc_addPerFrameHandler; }] call EFUNC(common,addEventHandler); //Update veh attunation when player veh changes diff --git a/addons/hearing/functions/fnc_addEarPlugs.sqf b/addons/hearing/functions/fnc_addEarPlugs.sqf index 62ed4518e2..b2e43bc718 100644 --- a/addons/hearing/functions/fnc_addEarPlugs.sqf +++ b/addons/hearing/functions/fnc_addEarPlugs.sqf @@ -14,8 +14,7 @@ * Public: No */ #include "script_component.hpp" - -PARAMS_1(_unit); +params ["_unit"]; // Exit if hearing is disabled or soldier has earplugs already in (persistence scenarios) if (!GVAR(enableCombatDeafness) || {[_unit] call FUNC(hasEarPlugsIn)}) exitWith {}; diff --git a/addons/hearing/functions/fnc_earRinging.sqf b/addons/hearing/functions/fnc_earRinging.sqf index 6a896c1820..f4db19e6ea 100644 --- a/addons/hearing/functions/fnc_earRinging.sqf +++ b/addons/hearing/functions/fnc_earRinging.sqf @@ -15,12 +15,12 @@ * Public: No */ #include "script_component.hpp" - -PARAMS_2(_unit,_strength); +params ["_unit", "_strength"]; if (_unit != ACE_player) exitWith {}; if (_strength < 0.05) exitWith {}; if (!isNull curatorCamera) exitWith {}; +if ((!GVAR(enabledForZeusUnits)) && {player != ACE_player}) exitWith {}; if (_unit getVariable ["ACE_hasEarPlugsin", false]) then { _strength = _strength / 4; diff --git a/addons/hearing/functions/fnc_explosionNear.sqf b/addons/hearing/functions/fnc_explosionNear.sqf index dde9bc50cc..7e4d0b9bfc 100644 --- a/addons/hearing/functions/fnc_explosionNear.sqf +++ b/addons/hearing/functions/fnc_explosionNear.sqf @@ -19,10 +19,14 @@ //Only run if deafness or ear ringing is enabled: if ((!GVAR(enableCombatDeafness)) && GVAR(DisableEarRinging)) exitWith {}; -PARAMS_2(_unit,_damage); +params ["_unit", "_damage"]; + +if (_unit != ACE_player) exitWith {}; + +TRACE_2("explosion near player",_unit,_damage); private ["_strength"]; -_strength = 0 max _damage; +_strength = (0 max _damage) * 30; if (_strength < 0.01) exitWith {}; -[{_this call FUNC(earRinging)}, [_unit, _strength], 0.2, 0] call EFUNC(common,waitAndExecute); +[{_this call FUNC(earRinging)}, [_unit, _strength], 0.2] call EFUNC(common,waitAndExecute); diff --git a/addons/hearing/functions/fnc_firedNear.sqf b/addons/hearing/functions/fnc_firedNear.sqf index 6fc48b27fa..1ee84a2dc8 100644 --- a/addons/hearing/functions/fnc_firedNear.sqf +++ b/addons/hearing/functions/fnc_firedNear.sqf @@ -7,8 +7,8 @@ * 1: Firer: Object - Object which fires a weapon near the unit * 2: Distance - Distance in meters between the unit and firer * 3: weapon - Fired weapon - * 4: muzzle - Muzzle that was used - * 5: mod - Current mode of the fired weapon + * 4: muzzle - Muzzle that was used (not used) + * 5: mode - Current mode of the fired weapon (not used) * 6: ammo - Ammo used * * Return Value: @@ -16,6 +16,7 @@ * * Example: * [clientFiredNearEvent] call ace_hearing_fnc_firedNear + * [player, player, 10, "arifle_MX_ACO_pointer_F", "arifle_MX_ACO_pointer_F", "single", "B_65x39_Caseless"] call ace_hearing_fnc_firedNear * * Public: No */ @@ -24,14 +25,14 @@ //Only run if deafness or ear ringing is enabled: if ((!GVAR(enableCombatDeafness)) && GVAR(DisableEarRinging)) exitWith {}; -PARAMS_7(_object,_firer,_distance,_weapon,_muzzle,_mode,_ammo); +params ["_object", "_firer", "_distance", "_weapon", "", "", "_ammo"]; //Only run if firedNear object is player or player's vehicle: if ((ACE_player != _object) && {(vehicle ACE_player) != _object}) exitWith {}; if (_weapon in ["Throw", "Put"]) exitWith {}; if (_distance > 50) exitWith {}; -private ["_silencer", "_audibleFireCoef", "_loudness", "_strength", "_vehAttenuation", "_magazine", "_muzzles", "_weaponMagazines", "_muzzleMagazines", "_ammoType", "_initSpeed", "_ammoConfig", "_caliber", "_parentClasses"]; +private ["_silencer", "_audibleFireCoef", "_loudness", "_strength", "_vehAttenuation", "_magazine", "_muzzles", "_weaponMagazines", "_muzzleMagazines", "_ammoType", "_initSpeed", "_ammoConfig", "_caliber"]; _vehAttenuation = if ((ACE_player == (vehicle ACE_player)) || {isTurnedOut ACE_player}) then {1} else {GVAR(playerVehAttenuation)}; @@ -58,7 +59,7 @@ if (count _weaponMagazines == 0) then { _muzzleMagazines = getArray (configFile >> "CfgWeapons" >> _weapon >> _x >> "magazines"); _weaponMagazines append _muzzleMagazines; }; - } forEach _muzzles; + } count _muzzles; { _ammoType = getText(configFile >> "CfgMagazines" >> _x >> "ammo"); _weaponMagazines set [_forEachIndex, [_x, _ammoType]]; @@ -68,33 +69,30 @@ if (count _weaponMagazines == 0) then { _magazine = ""; { - EXPLODE_2_PVT(_x,_magazineType,_ammoType); + _x params ["_magazineType", "_ammoType"]; if (_ammoType == _ammo) exitWith { _magazine = _magazineType; }; -} forEach _weaponMagazines; +} count _weaponMagazines; if (_magazine == "") exitWith {}; _initSpeed = getNumber(configFile >> "CfgMagazines" >> _magazine >> "initSpeed"); _ammoConfig = (configFile >> "CfgAmmo" >> _ammo); -_parentClasses = [_ammoConfig, true] call BIS_fnc_returnParents; _caliber = getNumber(_ammoConfig >> "ACE_caliber"); -_caliber = switch (true) do { - case ("ShellBase" in _parentClasses): { 80 }; - case ("RocketBase" in _parentClasses): { 200 }; - case ("MissileBase" in _parentClasses): { 600 }; - case ("SubmunitionBase" in _parentClasses): { 80 }; - default { - if (_caliber <= 0) then { 6.5 } else { _caliber }; - }; +_caliber = call { + if (_ammo isKindOf ["ShellBase", (configFile >> "CfgAmmo")]) exitWith { 80 }; + if (_ammo isKindOf ["RocketBase", (configFile >> "CfgAmmo")]) exitWith { 200 }; + if (_ammo isKindOf ["MissileBase", (configFile >> "CfgAmmo")]) exitWith { 600 }; + if (_ammo isKindOf ["SubmunitionBase", (configFile >> "CfgAmmo")]) exitWith { 80 }; + if (_caliber <= 0) then { 6.5 } else { _caliber }; }; _loudness = (_caliber ^ 1.25 / 10) * (_initspeed / 1000) * _audibleFireCoef / 5; _strength = _vehAttenuation * (_loudness - (_loudness / 50 * _distance)); // linear drop off -//systemChat format["%1 : %2 : %3", _strength, _initSpeed, _parentClasses]; +//systemChat format["%1 : %2", _strength, _initSpeed]; //systemChat format["%1 : %2 : %3", _weapon, _magazine, _initSpeed]; if (_strength < 0.01) exitWith {}; -[{_this call FUNC(earRinging)}, [ACE_player, _strength], 0.2, 0] call EFUNC(common,waitAndExecute); +[{_this call FUNC(earRinging)}, [ACE_player, _strength], 0.2] call EFUNC(common,waitAndExecute); diff --git a/addons/hearing/functions/fnc_hasEarPlugsIn.sqf b/addons/hearing/functions/fnc_hasEarPlugsIn.sqf index 58dc302888..67a76685f4 100644 --- a/addons/hearing/functions/fnc_hasEarPlugsIn.sqf +++ b/addons/hearing/functions/fnc_hasEarPlugsIn.sqf @@ -14,7 +14,6 @@ * Public: No */ #include "script_component.hpp" - -PARAMS_1(_unit); +params ["_unit"]; _unit getVariable ["ACE_hasEarPlugsin", false] diff --git a/addons/hearing/functions/fnc_moduleHearing.sqf b/addons/hearing/functions/fnc_moduleHearing.sqf index 6ec0af0231..0aa8843485 100644 --- a/addons/hearing/functions/fnc_moduleHearing.sqf +++ b/addons/hearing/functions/fnc_moduleHearing.sqf @@ -10,9 +10,7 @@ */ #include "script_component.hpp" -PARAMS_3(_logic,_units,_activated); - -if !(_activated) exitWith {}; +params ["_logic"]; [_logic, QGVAR(enableCombatDeafness), "EnableCombatDeafness"] call EFUNC(common,readSettingFromModule); @@ -21,4 +19,5 @@ if ((_logic getVariable "DisableEarRinging") != -1) then { [_logic, QGVAR(DisableEarRinging), "DisableEarRinging"] call EFUNC(common,readSettingFromModule); }; -diag_log text "[ACE]: Hearing Module Initialized."; +[_logic, QGVAR(enabledForZeusUnits), "enabledForZeusUnits"] call EFUNC(common,readSettingFromModule); +ACE_LOGINFO("Hearing Module Initialized."); diff --git a/addons/hearing/functions/fnc_putInEarplugs.sqf b/addons/hearing/functions/fnc_putInEarplugs.sqf index 8b11e6ba25..8d5479c17b 100644 --- a/addons/hearing/functions/fnc_putInEarplugs.sqf +++ b/addons/hearing/functions/fnc_putInEarplugs.sqf @@ -15,7 +15,7 @@ */ #include "script_component.hpp" -PARAMS_1(_player); +params ["_player"]; // Plugs in inventory, putting them in _player removeItem "ACE_EarPlugs"; diff --git a/addons/hearing/functions/fnc_removeEarplugs.sqf b/addons/hearing/functions/fnc_removeEarplugs.sqf index 19a34831cd..f5b5ca2442 100644 --- a/addons/hearing/functions/fnc_removeEarplugs.sqf +++ b/addons/hearing/functions/fnc_removeEarplugs.sqf @@ -15,7 +15,7 @@ */ #include "script_component.hpp" -PARAMS_1(_player); +params ["_player"]; if !(_player canAdd "ACE_EarPlugs") exitWith { // inventory full [localize LSTRING(Inventory_Full)] call EFUNC(common,displayTextStructured); diff --git a/addons/hearing/functions/fnc_updateVolume.sqf b/addons/hearing/functions/fnc_updateVolume.sqf index 3a72e8eb3b..f1cb063971 100644 --- a/addons/hearing/functions/fnc_updateVolume.sqf +++ b/addons/hearing/functions/fnc_updateVolume.sqf @@ -19,9 +19,9 @@ //Only run if deafness or ear ringing is enabled: if ((!GVAR(enableCombatDeafness)) && GVAR(DisableEarRinging)) exitWith {}; -EXPLODE_1_PVT((_this select 0),_justUpdateVolume); - private["_volume", "_soundTransitionTime"]; +(_this select 0) params ["_justUpdateVolume"]; + GVAR(deafnessDV) = (GVAR(deafnessDV) min 20) max 0; GVAR(volume) = (1 - (GVAR(deafnessDV) / 20)) max 0; diff --git a/addons/hearing/stringtable.xml b/addons/hearing/stringtable.xml index a3af102580..05dde3a1bf 100644 --- a/addons/hearing/stringtable.xml +++ b/addons/hearing/stringtable.xml @@ -101,7 +101,7 @@ Disable ear ringing Désactiver le bourdonnement Desactivar zumbido de oídos - Отключить эффект баротравмы + Отключить звон в ушах Knalltrauma deaktivieren Vypnout pískání v uších Wyłącz dzwonienie w uszach @@ -116,14 +116,20 @@ Gehör Sluch Audição + Audition + Hallás + Слух - Enable combat deafness? + Combat Deafness Wł. głuchotę bojową ¿Habilitar sordera de combate? Aktiviere Taubheit im Gefecht? Povolit ztrátu sluchu? Ativar surdez em combate? + Activer la surdité au combat? + Harci süketség engedélyezése? + Оглушение Reduces the hearing ability as the player takes hearing damage @@ -132,13 +138,32 @@ Aktiviere Taubheit im Gefecht? Povolit ztrátu sluchu? Ativar surdez em combate? + Уменьшает возможность игрока слышать звуки при повреждении органов слуха Controls combat deafness and ear ringing. When activated, players can be deafened when a gun is fired in their vicinity or an explosion takes place without hearing protection + Harci süketség engedélyezése? + Уменьшает способность игроков слышать при повреждении слуха Głuchota bojowa pojawia się w momentach, kiedy stoimy w pobliżu broni wielkokalibrowej bez ochrony słuchu, lub np. podczas ostrzału artyleryjskiego. Moduł ten pozwala na włączenie lub wyłączenie tego efektu. Dieses Modul aktiviert/deaktiviert die Taubheit im Gefecht. Wenn aktiviert, können Spieler ohne Gehörschutz taub werden, wenn eine Waffe in ihrer Nähe abgefeuert wird oder eine Explosion stattfindet. Ztráta sluchu je možná ve chvíly, kdy se v bezprostřední blízkosti střílí z velkorážní zbraně nebo při bombardování a osoba je bez ochrany sluchu (např. špunty). Tento modul umožňuje tuto věc povolit nebo zakázat. Este módulo ativa / desativa surdez em combate. Quando ativado, os jogadores podem ficar surdos quando uma arma é disparada ao seu redor ou uma explosão ocorre sem proteção auditiva. + Ce module active / désactivé la surdité au combat. Si active, des joueurs peuvent devenir sourds sans protection d'oreille, si une arme est utilisée ou une explosion a lieu à proximité + Controles de sordera de combate y zumbido en los oídos. Al activarlo, los jugadores pueden ser ensordecidos cuando un arma se dispara cerca o una explosión tiene lugar sin protección auditiva + + + Effect Zeus RC + Wpływ na Zeus RC + Влияет на юнита Зевса + Afeta Zeus CR + Efecto Zeus RC + + + Allow zeus remote controlled units to be able to take hearing damage. + Aktywuj efekty utraty słuchu dla jednostek kontrolowanych zdalnie przez Zeusa. + Контролирует оглушение в бою и звон в ушах. При активации играки могут быть оглушены близкими выстрелами и взрывами при отсутствии защиты для ушей. + Permite que unidades remotamente controladas pelo Zeus sejam atingidas por danos auditivos. + Permitir a las unidades por control remoto de zeus que puedan tener daños auditivos. \ No newline at end of file diff --git a/addons/hitreactions/ACE_Settings.hpp b/addons/hitreactions/ACE_Settings.hpp index adbbdacaf2..4fa45e8ebc 100644 --- a/addons/hitreactions/ACE_Settings.hpp +++ b/addons/hitreactions/ACE_Settings.hpp @@ -1,3 +1,4 @@ + class ACE_Settings { class GVAR(minDamageToTrigger) { //Minimum mamage needed to trigger falling down while moving. Set to -1 to disable completely. diff --git a/addons/hitreactions/README.md b/addons/hitreactions/README.md new file mode 100644 index 0000000000..f770470e44 --- /dev/null +++ b/addons/hitreactions/README.md @@ -0,0 +1,11 @@ +ace_hitreactions +=========== + +Adds reactions when getting shot. + + +## Maintainers + +The people responsible for merging changes to this component or answering potential questions. + +- [commy2](https://github.com/commy2) diff --git a/addons/hitreactions/functions/fnc_fallDown.sqf b/addons/hitreactions/functions/fnc_fallDown.sqf index b979d09a4f..d93b99bd6b 100644 --- a/addons/hitreactions/functions/fnc_fallDown.sqf +++ b/addons/hitreactions/functions/fnc_fallDown.sqf @@ -1,43 +1,52 @@ -// by commy2 +/* + * Author: commy2 + * Adds reactions to a unit that was hit. EH only runs where to unit is local. Adds screams, falling down, falling from ladders, ejecting from static weapons and camshake for players + * + * Arguments: + * 0: unit + * 1: firer + * 2: damage taken + * + * Return Value: + * None + * + * Public: No + */ #include "script_component.hpp" -private ["_unit", "_firer", "_damage"]; +params ["_unit", "_firer", "_damage"]; -_unit = _this select 0; -_firer = _this select 1; -_damage = _this select 2; +// exit if system is disabled +if (GVAR(minDamageToTrigger) == -1) exitWith {}; + +// don't fall after minor damage +if (_damage < GVAR(minDamageToTrigger)) exitWith {}; // don't fall on collision damage if (_unit == _firer) exitWith {}; -//Exit if system disabled: -if (GVAR(minDamageToTrigger) == -1) exitWith {}; - -// cam shake for player +// camshake for player if (_unit == ACE_player) then { addCamShake [3, 5, _damage + random 10]; }; +// play scream sound +if (!isNil QUOTE(EFUNC(medical,playInjuredSound))) then { + [_unit] call EFUNC(medical,playInjuredSound); +}; + private "_vehicle"; _vehicle = vehicle _unit; // handle static weapons -if (_vehicle isKindOf "StaticWeapon") exitwith { +if (_vehicle isKindOf "StaticWeapon") exitWith { if (!alive _unit) then { _unit action ["Eject", _vehicle]; unassignVehicle _unit; }; }; -// don't fall after minor damage -if (_damage < GVAR(minDamageToTrigger)) exitWith {}; - -// play sound -if (!isNil QUOTE(EFUNC(medical,playInjuredSound))) then { - [_unit] call EFUNC(medical,playInjuredSound); -}; - -//Don't do animations if in a vehicle (looks weird and animations never reset): +// don't do animations if in a vehicle (looks weird and animations never reset): if (_vehicle != _unit) exitWith {}; // this checks most things, so it doesn't mess with being inside vehicles or while dragging etc. @@ -58,40 +67,52 @@ _velocity = vectorMagnitude velocity _unit; if (_velocity < 2) exitWith {}; // get correct animation by weapon -private ["_isPlayer", "_isRunning", "_anim"]; +private "_anim"; -_isPlayer = [_unit] call EFUNC(common,isPlayer); -_isRunning = _velocity > 4; +call { + private "_weapon"; + _weapon = currentWeapon _unit; -_anim = switch (currentWeapon _unit) do { - case (""): {"AmovPercMsprSnonWnonDf_AmovPpneMstpSnonWnonDnon"}; - case (primaryWeapon _unit): { - if !(_isPlayer) exitWith {"AmovPercMsprSlowWrfldf_AmovPpneMstpSrasWrflDnon"}; - - [ - ["AmovPercMsprSlowWrfldf_AmovPpneMstpSrasWrflDnon_2", "AmovPercMsprSlowWrfldf_AmovPpneMstpSrasWrflDnon"] select _isRunning, - ["AmovPercMsprSlowWrfldf_AmovPpneMstpSrasWrflDnon_2", "AmovPercMsprSlowWrfldf_AmovPpneMstpSrasWrflDnon"] select _isRunning, - "AmovPercMstpSrasWrflDnon_AadjPpneMstpSrasWrflDleft", - "AmovPercMstpSrasWrflDnon_AadjPpneMstpSrasWrflDright" - ] select floor random 4; + if (_weapon == "") exitWith { + _anim = "AmovPercMsprSnonWnonDf_AmovPpneMstpSnonWnonDnon" }; - case (handgunWeapon _unit): { - if !(_isPlayer) exitWith {"AmovPercMsprSlowWpstDf_AmovPpneMstpSrasWpstDnon"}; - [ - "AmovPercMsprSlowWpstDf_AmovPpneMstpSrasWpstDnon", - "AmovPercMsprSlowWpstDf_AmovPpneMstpSrasWpstDnon", - "AmovPercMstpSrasWpstDnon_AadjPpneMstpSrasWpstDleft", - "AmovPercMstpSrasWpstDnon_AadjPpneMstpSrasWpstDright" - ] select floor random 4; + if (_weapon == primaryWeapon _unit) exitWith { + if ([_unit] call EFUNC(common,isPlayer)) then { + private "_isRunning"; + _isRunning = _velocity > 4; + + _anim = [ + ["AmovPercMsprSlowWrfldf_AmovPpneMstpSrasWrflDnon_2", "AmovPercMsprSlowWrfldf_AmovPpneMstpSrasWrflDnon"] select _isRunning, + ["AmovPercMsprSlowWrfldf_AmovPpneMstpSrasWrflDnon_2", "AmovPercMsprSlowWrfldf_AmovPpneMstpSrasWrflDnon"] select _isRunning, + "AmovPercMstpSrasWrflDnon_AadjPpneMstpSrasWrflDleft", + "AmovPercMstpSrasWrflDnon_AadjPpneMstpSrasWrflDright" + ] select floor random 4; + } else { + _anim = "AmovPercMsprSlowWrfldf_AmovPpneMstpSrasWrflDnon"; + }; }; - default {""}; + + if (_weapon == handgunWeapon _unit) exitWith { + if ([_unit] call EFUNC(common,isPlayer)) then { + _anim = [ + "AmovPercMsprSlowWpstDf_AmovPpneMstpSrasWpstDnon", + "AmovPercMsprSlowWpstDf_AmovPpneMstpSrasWpstDnon", + "AmovPercMstpSrasWpstDnon_AadjPpneMstpSrasWpstDleft", + "AmovPercMstpSrasWpstDnon_AadjPpneMstpSrasWpstDright" + ] select floor random 4; + } else { + _anim = "AmovPercMsprSlowWpstDf_AmovPpneMstpSrasWpstDnon"; + }; + }; + + _anim = ""; }; -// exit if no animation for this weapon exists, i.E. binocular or rocket launcher +// exit if no animation for this weapon exists, i.e. binocular or rocket launcher if (_anim == "") exitWith {}; // don't mess with transitions. don't fall then. -if ([_unit] call EFUNC(common,inTransitionAnim)) exitWith {}; - -[_unit, _anim, 2] call EFUNC(common,doAnimation); +if !([_unit] call EFUNC(common,inTransitionAnim)) then { + [_unit, _anim, 2] call EFUNC(common,doAnimation); +}; diff --git a/addons/huntir/README.md b/addons/huntir/README.md new file mode 100644 index 0000000000..b6c8128cbc --- /dev/null +++ b/addons/huntir/README.md @@ -0,0 +1,11 @@ +ace_huntir +=========== + +Adds High-altitude Unit Navigated Tactical Imaging Round and its Monitor. + + +## Maintainers + +The people responsible for merging changes to this component or answering potential questions. + +- [Ruthberg](http://github.com/Ulteq) diff --git a/addons/huntir/functions/fnc_cam.sqf b/addons/huntir/functions/fnc_cam.sqf index bcc553fff0..9426de13fd 100644 --- a/addons/huntir/functions/fnc_cam.sqf +++ b/addons/huntir/functions/fnc_cam.sqf @@ -7,13 +7,14 @@ * 0: HuntIR * * Return Value: - * Nothing + * None * * Public: No */ #include "script_component.hpp" -PARAMS_1(_huntIR); +if (!hasInterface) exitWith {}; +params ["_huntIR"]; GVAR(huntIR) = _huntIR; GVAR(pos) = getPosVisual GVAR(huntIR); @@ -73,7 +74,8 @@ GVAR(no_cams) sort true; if (((getPosVisual _x) select 2) > 20 && {!(_x in GVAR(no_cams))} && {_x getHitPointDamage "HitCamera" < 0.25}) then { GVAR(no_cams) pushBack _x; }; - } forEach GVAR(nearHuntIRs); + true + } count GVAR(nearHuntIRs); { if (((getPosVisual _x) select 2) <= 20 || {!(_x in GVAR(nearHuntIRs))} || {_x getHitPointDamage "HitCamera" >= 0.25}) then { GVAR(no_cams) deleteAt _forEachIndex; @@ -82,19 +84,19 @@ GVAR(no_cams) sort true; }; }; } forEach GVAR(no_cams); - + GVAR(cur_cam) = 0 max GVAR(cur_cam) min ((count GVAR(no_cams)) - 1); if (count GVAR(no_cams) > 0) then { GVAR(huntIR) = GVAR(no_cams) select GVAR(cur_cam); }; - + GVAR(pos) = getPosVisual GVAR(huntIR); - + if ((!dialog) || (count GVAR(no_cams) == 0) || ((GVAR(pos) select 2) <= 20)) exitWith { [_this select 1] call cba_fnc_removePerFrameHandler; - + GVAR(stop) = true; - + GVAR(pphandle) ppEffectEnable true; ppEffectDestroy GVAR(pphandle); @@ -108,7 +110,7 @@ GVAR(no_cams) sort true; deleteVehicle GVAR(logic); if (player != ACE_player) then { player remoteControl ACE_player; - }; + }; }; switch (GVAR(ZOOM)) do { @@ -131,7 +133,7 @@ GVAR(no_cams) sort true; }; private ["_cam_coord_y", "_cam_coord_x", "_cam_time", "_cam_pos"]; - + GVAR(logic) setPosATL (GVAR(pos) vectorAdd [0, 0, -5]); GVAR(logic) setDir GVAR(ROTATE); GVAR(logic) setVectorUp [0.0001, 0.0001, 1]; diff --git a/addons/huntir/functions/fnc_handleFired.sqf b/addons/huntir/functions/fnc_handleFired.sqf index 121cd9fd12..1919b4547c 100644 --- a/addons/huntir/functions/fnc_handleFired.sqf +++ b/addons/huntir/functions/fnc_handleFired.sqf @@ -13,19 +13,19 @@ * 6: projectile - Object of the projectile that was shot * * Return Value: - * Nothing + * None * * Public: No */ #include "script_component.hpp" -PARAMS_7(_unit,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); +params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile"]; if (_ammo != "F_HuntIR") exitWith {}; [{ - PARAMS_1(_projectile); - + params ["_projectile"]; + //If null (deleted or hit water) exit: if (isNull _projectile) exitWith {}; //If it's not spinning (hit ground), bail: @@ -33,15 +33,16 @@ if (_ammo != "F_HuntIR") exitWith {}; "ACE_HuntIR_Propell" createVehicle (getPosATL _projectile); [{ - PARAMS_1(_position); private ["_huntir"]; + params ["_position"]; _huntir = createVehicle ["ACE_HuntIR", _position, [], 0, "FLY"]; _huntir setPosATL _position; _huntir setVariable [QGVAR(startTime), ACE_time, true]; [{ - EXPLODE_1_PVT(_this select 0,_huntir); + params ["_args", "_idPFH"]; + _args params ["_huntir"]; if (isNull _huntir) exitWith { - [_this select 1] call CBA_fnc_removePerFrameHandler; + [_idPFH] call CBA_fnc_removePerFrameHandler; }; private ["_parachuteDamage", "_velocity"]; _parachuteDamage = _huntir getHitPointDamage "HitParachute"; diff --git a/addons/huntir/functions/fnc_huntir.sqf b/addons/huntir/functions/fnc_huntir.sqf index 27fd5e280b..b1c269533d 100644 --- a/addons/huntir/functions/fnc_huntir.sqf +++ b/addons/huntir/functions/fnc_huntir.sqf @@ -4,10 +4,10 @@ * HuntIR monitor system * * Arguments: - * Nothing + * None * * Return Value: - * Nothing + * None * * Public: No */ @@ -35,21 +35,21 @@ createDialog "ace_huntir_cam_dialog_off"; GVAR(connectionDelay) = 5; GVAR(state) = "searching"; GVAR(message) = []; - GVAR(messageSearching) = toArray "Searching....."; + GVAR(messageSearching) = toArray "Searching....."; GVAR(messageConnecting) = toArray "Connecting....."; [{ //Close monitor if we no longer have item: if ((!([ACE_player, "ACE_HuntIR_monitor"] call EFUNC(common,hasItem))) && {!isNull (uiNameSpace getVariable ["ace_huntir_monitor", displayNull])}) then { closeDialog 0; }; - + private ["_elapsedTime", "_nearestHuntIRs"]; _elapsedTime = ACE_time - GVAR(startTime); _nearestHuntIRs = ACE_player nearEntities ["ACE_HuntIR", HUNTIR_MAX_TRANSMISSION_RANGE]; - + if ((!dialog) || GVAR(done)) exitWith { [_this select 1] call cba_fnc_removePerFrameHandler; - + if (dialog && GVAR(state) == "connected") then { [_nearestHuntIRs select 0] call FUNC(cam); } else { diff --git a/addons/huntir/functions/fnc_huntirCompass.sqf b/addons/huntir/functions/fnc_huntirCompass.sqf index 30fcf45900..ff06b47df3 100644 --- a/addons/huntir/functions/fnc_huntirCompass.sqf +++ b/addons/huntir/functions/fnc_huntirCompass.sqf @@ -4,10 +4,10 @@ * HuntIR monitor compass * * Arguments: - * Nothing + * None * * Return Value: - * Nothing + * None * * Public: No */ @@ -32,7 +32,7 @@ disableSerialization; private ["_fnc_correctIt"]; _fnc_correctIt = { - PARAMS_2(_pos,_dir); + params ["_pos", "_dir"]; if (_dir >= 270 || {_dir <= 90}) then { _pos set [1, (_pos select 1) + __OFFSET_Y] }; @@ -51,16 +51,17 @@ _fnc_correctIt = { HUNTIR_CAM_ROSE_LAYER_ID cutRsc ["ace_huntir_cam_rose", "PLAIN"]; [{ - EXPLODE_1_PVT(_this select 0,_fnc_correctIt); - + params ["_args", "_idPFH"]; + _args params ["_fnc_correctIt"]; + if (GVAR(stop)) exitWith { HUNTIR_CAM_ROSE_LAYER_ID cutText ["", "PLAIN"]; - [_this select 1] call CBA_fnc_removePerFrameHandler; + [_idPFH] call CBA_fnc_removePerFrameHandler; }; - + private ["_dir", "_x1", "_y1", "_pos"]; _dir = getDir GVAR(cam); // direction player; - + _x1 = __CENTER_X - (__RADIUS * sin(_dir)); _y1 = __CENTER_Y - (__RADIUS * cos(_dir)); _pos = [[_x1, _y1], _dir] call _fnc_correctIt; @@ -84,5 +85,5 @@ HUNTIR_CAM_ROSE_LAYER_ID cutRsc ["ace_huntir_cam_rose", "PLAIN"]; _pos = [[_x1, _y1], _dir] call _fnc_correctIt; __CHAR_E ctrlSetPosition [_pos select 0, _pos select 1, __WIDTH, __HEIGHT]; __CHAR_E ctrlCommit 0; - + }, 0.01, [_fnc_correctIt]] call CBA_fnc_addPerFrameHandler; diff --git a/addons/huntir/stringtable.xml b/addons/huntir/stringtable.xml index 7e7767f349..3af7f8157b 100644 --- a/addons/huntir/stringtable.xml +++ b/addons/huntir/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -194,4 +194,4 @@ Esc - Sai do Ajuda - \ No newline at end of file + diff --git a/addons/interact_menu/ACE_Settings.hpp b/addons/interact_menu/ACE_Settings.hpp index 48f32ed13b..381405987c 100644 --- a/addons/interact_menu/ACE_Settings.hpp +++ b/addons/interact_menu/ACE_Settings.hpp @@ -3,14 +3,14 @@ class ACE_Settings { value = 0; typeName = "BOOL"; isClientSettable = 1; - category = LSTRING(Category_InteractionMenu); + category = CSTRING(Category_InteractionMenu); displayName = CSTRING(AlwaysUseCursorSelfInteraction); }; class GVAR(cursorKeepCentered) { value = 0; typeName = "BOOL"; isClientSettable = 1; - category = LSTRING(Category_InteractionMenu); + category = CSTRING(Category_InteractionMenu); displayName = CSTRING(cursorKeepCentered); description = CSTRING(cursorKeepCenteredDescription); }; @@ -18,49 +18,49 @@ class ACE_Settings { value = 0; typeName = "BOOL"; isClientSettable = 1; - category = LSTRING(Category_InteractionMenu); + category = CSTRING(Category_InteractionMenu); displayName = CSTRING(AlwaysUseCursorInteraction); }; class GVAR(UseListMenu) { value = 0; typeName = "BOOL"; isClientSettable = 1; - category = LSTRING(Category_InteractionMenu); + category = CSTRING(Category_InteractionMenu); displayName = CSTRING(UseListMenu); }; class GVAR(colorTextMax) { value[] = {1, 1, 1, 1}; typeName = "COLOR"; isClientSettable = 1; - category = LSTRING(Category_InteractionMenu); + category = CSTRING(Category_InteractionMenu); displayName = CSTRING(ColorTextMax); }; class GVAR(colorTextMin) { value[] = {1, 1, 1, 0.25}; typeName = "COLOR"; isClientSettable = 1; - category = LSTRING(Category_InteractionMenu); + category = CSTRING(Category_InteractionMenu); displayName = CSTRING(ColorTextMin); }; class GVAR(colorShadowMax) { value[] = {0, 0, 0, 1}; typeName = "COLOR"; isClientSettable = 1; - category = LSTRING(Category_InteractionMenu); + category = CSTRING(Category_InteractionMenu); displayName = CSTRING(ColorShadowMax); }; class GVAR(colorShadowMin) { value[] = {0, 0, 0, 0.25}; typeName = "COLOR"; isClientSettable = 1; - category = LSTRING(Category_InteractionMenu); + category = CSTRING(Category_InteractionMenu); displayName = CSTRING(ColorShadowMin); }; class GVAR(textSize) { value = 2; typeName = "SCALAR"; isClientSettable = 1; - category = LSTRING(Category_InteractionMenu); + category = CSTRING(Category_InteractionMenu); displayName = CSTRING(textSize); values[] = {"$str_very_small", "$str_small", "$str_medium", "$str_large", "$str_very_large"}; }; @@ -68,7 +68,7 @@ class ACE_Settings { value = 2; typeName = "SCALAR"; isClientSettable = 1; - category = LSTRING(Category_InteractionMenu); + category = CSTRING(Category_InteractionMenu); displayName = CSTRING(shadowSetting); description = CSTRING(shadowSettingDescription); values[] = {"$STR_A3_OPTIONS_DISABLED", "$STR_A3_OPTIONS_ENABLED", CSTRING(shadowOutline)}; @@ -77,14 +77,14 @@ class ACE_Settings { value = 1; typeName = "BOOL"; isClientSettable = 1; - category = LSTRING(Category_InteractionMenu); + category = CSTRING(Category_InteractionMenu); displayName = CSTRING(ActionOnKeyRelease); }; class GVAR(menuBackground) { value = 0; typeName = "SCALAR"; isClientSettable = 1; - category = LSTRING(Category_InteractionMenu); + category = CSTRING(Category_InteractionMenu); displayName = CSTRING(background); values[] = {"$STR_A3_OPTIONS_DISABLED", CSTRING(backgroundBlur), CSTRING(backgroundBlack)}; }; @@ -92,7 +92,7 @@ class ACE_Settings { value = 0; typeName = "BOOL"; isClientSettable = 1; - category = LSTRING(Category_InteractionMenu); + category = CSTRING(Category_InteractionMenu); displayName = CSTRING(addBuildingActions); description = CSTRING(addBuildingActionsDescription); }; diff --git a/addons/interact_menu/README.md b/addons/interact_menu/README.md new file mode 100644 index 0000000000..77ac2d814a --- /dev/null +++ b/addons/interact_menu/README.md @@ -0,0 +1,12 @@ +ace_interact_menu +=========== + +Base framework for interaction menu. + + +## Maintainers + +The people responsible for merging changes to this component or answering potential questions. + +- [NouberNou](https://github.com/NouberNou) +- [esteldunedain](https://github.com/esteldunedain) diff --git a/addons/interact_menu/XEH_clientInit.sqf b/addons/interact_menu/XEH_clientInit.sqf index cbc28e66b4..59fb01a353 100644 --- a/addons/interact_menu/XEH_clientInit.sqf +++ b/addons/interact_menu/XEH_clientInit.sqf @@ -8,17 +8,19 @@ GVAR(cachedBuildingActionPairs) = []; GVAR(ParsedTextCached) = []; -//Setup text/shadow/size/color settings matrix -[] call FUNC(setupTextColors); ["SettingChanged", { - PARAMS_1(_name); - if (_name in [QGVAR(colorTextMax), QGVAR(colorTextMin), QGVAR(colorShadowMax), QGVAR(colorShadowMin), QGVAR(textSize), QGVAR(shadowSetting)]) then { + params ["_name"]; + if (({_x == _name} count [QGVAR(colorTextMax), QGVAR(colorTextMin), QGVAR(colorShadowMax), QGVAR(colorShadowMin), QGVAR(textSize), QGVAR(shadowSetting)]) == 1) then { [] call FUNC(setupTextColors); }; }] call EFUNC(common,addEventhandler); -// Install the render EH on the main display -addMissionEventHandler ["Draw3D", DFUNC(render)]; +["SettingsInitialized", { + //Setup text/shadow/size/color settings matrix + [] call FUNC(setupTextColors); + // Install the render EH on the main display + addMissionEventHandler ["Draw3D", DFUNC(render)]; +}] call EFUNC(common,addEventHandler); //Add Actions to Houses: ["interactMenuOpened", {_this call FUNC(userActions_addHouseActions)}] call EFUNC(common,addEventHandler); @@ -54,7 +56,7 @@ addMissionEventHandler ["Draw3D", DFUNC(render)]; // If no menu is open just quit if (GVAR(openedMenuType) < 0) exitWith {}; - EXPLODE_2_PVT(_this,_unit,_isUnconscious); + params ["_unit", "_isUnconscious"]; if (_unit != ACE_player || !_isUnconscious) exitWith {}; @@ -75,10 +77,59 @@ addMissionEventHandler ["Draw3D", DFUNC(render)]; if (GVAR(menuBackground)==2) then {(uiNamespace getVariable [QGVAR(menuBackground), displayNull]) closeDisplay 0;}; }] call EFUNC(common,addEventHandler); -// Let key work with zeus open (not perfect, enables all added hotkeys in zeus interface rather than only menu) +// Let key work with zeus open (not perfect, contains workaround to prevent other CBA keybindings) ["zeusDisplayChanged",{ if (_this select 1) then { - (finddisplay 312) displayAddEventHandler ["KeyUp", {[_this,'keyup'] call CBA_events_fnc_keyHandler}]; - (finddisplay 312) displayAddEventHandler ["KeyDown", {[_this,'keydown'] call CBA_events_fnc_keyHandler}]; + (finddisplay 312) displayAddEventHandler ["KeyUp", { + _key = ["ACE3 Common","ace_interact_menu_InteractKey"] call CBA_fnc_getKeybind; + _key = _key select 5; + _dik = _key select 0; + _mods = _key select 1; + + if ((_this select 1) == _dik) then { + if ((_this select [2,3]) isEqualTo _mods) then { + [_this,'keyup'] call CBA_events_fnc_keyHandler + }; + }; + }]; + (finddisplay 312) displayAddEventHandler ["KeyDown", { + _key = ["ACE3 Common","ace_interact_menu_InteractKey"] call CBA_fnc_getKeybind; + _key = _key select 5; + _dik = _key select 0; + _mods = _key select 1; + + if ((_this select 1) == _dik) then { + if ((_this select [2,3]) isEqualTo _mods) then { + [_this,'keydown'] call CBA_events_fnc_keyHandler + }; + }; + }]; }; }] call EFUNC(common,addEventHandler); + + +//Debug to help end users identify mods that break CBA's XEH +[{ + private ["_badClassnames"]; + _badClassnames = []; + { + //Only check Land objects (WeaponHolderSimulated show up in `vehicles` for some reason) + if ((_x isKindOf "Land") && {(isNil (format [QGVAR(Act_%1), typeOf _x])) || {isNil (format [QGVAR(SelfAct_%1), typeOf _x])}}) then { + if (!((typeOf _x) in _badClassnames)) then { + _badClassnames pushBack (typeOf _x); + ACE_LOGERROR_3("Compile checks bad for (classname: %1)(addon: %2) %3", (typeOf _x), (unitAddons (typeOf _x)), _x); + }; + }; + } forEach (allUnits + allDeadMen + vehicles); + if ((count _badClassnames) == 0) then { + ACE_LOGINFO("All compile checks passed"); + } else { + ACE_LOGERROR_1("%1 Classnames failed compile check!!! (bad XEH / missing cba_enable_auto_xeh.pbo)", (count _badClassnames)); + + //Only show visual error if they are actually missing the pbo: + #define SUPMON configFile>>"CfgSettings">>"CBA">>"XEH">>"supportMonitor" + if ((!isNumber(SUPMON)) || {getNumber(SUPMON) != 1}) then { + ["ACE Interaction failed to compile for some units (try adding cba_enable_auto_xeh.pbo)"] call BIS_fnc_error; + }; + }; +}, [], 5] call EFUNC(common,waitAndExecute); //ensure CBASupMon has time to run first diff --git a/addons/interact_menu/XEH_preInit.sqf b/addons/interact_menu/XEH_preInit.sqf index c656ab9056..73b543250e 100644 --- a/addons/interact_menu/XEH_preInit.sqf +++ b/addons/interact_menu/XEH_preInit.sqf @@ -4,6 +4,7 @@ ADDON = false; PREP(addActionToClass); PREP(addActionToObject); +PREP(addMainAction); PREP(compileMenu); PREP(compileMenuSelfAction); PREP(compileMenuZeus); diff --git a/addons/interact_menu/functions/fnc_addActionToClass.sqf b/addons/interact_menu/functions/fnc_addActionToClass.sqf index ef4dc94d9e..f720903a6d 100644 --- a/addons/interact_menu/functions/fnc_addActionToClass.sqf +++ b/addons/interact_menu/functions/fnc_addActionToClass.sqf @@ -19,7 +19,9 @@ */ #include "script_component.hpp" -params ["_objectType", "_typeNum", "_parentPath", "_action"]; +if (!params [["_objectType", "", [""]], ["_typeNum", 0, [0]], ["_parentPath", [], [[]]], ["_action", [], [[]], 11]]) exitWith { + ERROR("Bad Params"); +}; // Ensure the config menu was compiled first if (_typeNum == 0) then { @@ -35,8 +37,15 @@ if((count _actionTrees) == 0) then { missionNamespace setVariable [_varName, _actionTrees]; }; +if (_parentPath isEqualTo ["ACE_MainActions"]) then { + [_objectType, _typeNum] call FUNC(addMainAction); +}; + _parentNode = [_actionTrees, _parentPath] call FUNC(findActionNode); -if (isNil {_parentNode}) exitWith {}; +if (isNil {_parentNode}) exitWith { + ERROR("Failed to add action"); + ACE_LOGERROR_4("action (%1) to parent %2 on object %3 [%4]",(_action select 0),_parentPath,_objectType,_typeNum); +}; // Add action node as children of the correct node of action tree (_parentNode select 1) pushBack [_action,[]]; diff --git a/addons/interact_menu/functions/fnc_addActionToObject.sqf b/addons/interact_menu/functions/fnc_addActionToObject.sqf index fd64c61dad..8cd2270d48 100644 --- a/addons/interact_menu/functions/fnc_addActionToObject.sqf +++ b/addons/interact_menu/functions/fnc_addActionToObject.sqf @@ -19,7 +19,9 @@ */ #include "script_component.hpp" -params ["_object", "_typeNum", "_parentPath", "_action"]; +if (!params [["_object", objNull, [objNull]], ["_typeNum", 0, [0]], ["_parentPath", [], [[]]], ["_action", [], [[]], 11]]) exitWith { + ERROR("Bad Params"); +}; private ["_varName","_actionList"]; _varName = [QGVAR(actions),QGVAR(selfActions)] select _typeNum; @@ -28,6 +30,10 @@ if((count _actionList) == 0) then { _object setVariable [_varName, _actionList]; }; +if (_parentPath isEqualTo ["ACE_MainActions"]) then { + [(typeOf _object), _typeNum] call FUNC(addMainAction); +}; + // Add action and parent path to the list of object actions _actionList pushBack [_action, +_parentPath]; diff --git a/addons/interact_menu/functions/fnc_addMainAction.sqf b/addons/interact_menu/functions/fnc_addMainAction.sqf new file mode 100644 index 0000000000..cf2a3f51d4 --- /dev/null +++ b/addons/interact_menu/functions/fnc_addMainAction.sqf @@ -0,0 +1,31 @@ +/* + * Author: Jonpas, PabstMirror + * Makes sure there is a ACE_MainActions on the object type + * + * Argument: + * 0: Object classname + * 1: Type of action, 0 for actions, 1 for self-actions + * + * Return value: + * None + * + * Example: + * ["Table", 0] call ace_interact_menu_fnc_addMainAction; + * + * Public: No + */ +#include "script_component.hpp" + +params ["_objectType", "_typeNum"]; + +private["_actionTrees", "_mainAction", "_parentNode", "_varName"]; + +_varName = format [[QGVAR(Act_%1), QGVAR(SelfAct_%1)] select _typeNum, _objectType]; +_actionTrees = missionNamespace getVariable [_varName, []]; +_parentNode = [_actionTrees, ["ACE_MainActions"]] call FUNC(findActionNode); + +if (isNil {_parentNode}) then { + TRACE_2("No Main Action on object", _objectType, _typeNum); + _mainAction = ["ACE_MainActions", localize ELSTRING(interaction,MainAction), "", {}, {true}] call FUNC(createAction); + [_objectType, _typeNum, [], _mainAction] call EFUNC(interact_menu,addActionToClass); +}; diff --git a/addons/interact_menu/functions/fnc_compileMenuSelfAction.sqf b/addons/interact_menu/functions/fnc_compileMenuSelfAction.sqf index 910b8893c6..2c8cdc279c 100644 --- a/addons/interact_menu/functions/fnc_compileMenuSelfAction.sqf +++ b/addons/interact_menu/functions/fnc_compileMenuSelfAction.sqf @@ -71,7 +71,7 @@ _recurseFnc = { _statement, _condition, _insertChildren, - {}, + [], [0,0,0], 10, //distace [_showDisabled,_enableInside,_canCollapse,_runOnHover, true], @@ -122,7 +122,7 @@ _actions = if (_isMan) then { // Dummy statement so it's not collapsed when there's no available actions true }, - {[ACE_player, _target, ["isNotInside","isNotDragging", "isNotCarrying", "isNotSwimming", "notOnMap", "isNotEscorting", "isNotSurrendering", "isNotSitting"]] call EFUNC(common,canInteractWith)}, + {[ACE_player, _target, ["isNotInside","isNotDragging", "isNotCarrying", "isNotSwimming", "notOnMap", "isNotEscorting", "isNotSurrendering", "isNotSitting", "isNotOnLadder"]] call EFUNC(common,canInteractWith)}, {}, {}, "Spine3", diff --git a/addons/interact_menu/functions/fnc_findActionNode.sqf b/addons/interact_menu/functions/fnc_findActionNode.sqf index 66738f6cf9..41ab658a62 100644 --- a/addons/interact_menu/functions/fnc_findActionNode.sqf +++ b/addons/interact_menu/functions/fnc_findActionNode.sqf @@ -8,7 +8,7 @@ * 1: Path * * Return value: - * Action node . + * Action node or if not found * * Example: * [_actionTree, ["ACE_TapShoulderRight","VulcanPinchAction"]] call ace_interact_menu_fnc_findActionNode; diff --git a/addons/interact_menu/functions/fnc_keyDown.sqf b/addons/interact_menu/functions/fnc_keyDown.sqf index ca06e25eb6..8c8ecf0c20 100644 --- a/addons/interact_menu/functions/fnc_keyDown.sqf +++ b/addons/interact_menu/functions/fnc_keyDown.sqf @@ -18,7 +18,7 @@ if (GVAR(openedMenuType) == _menuType) exitWith {true}; // Conditions: canInteract (these don't apply to zeus) if ((isNull curatorCamera) && { - !([ACE_player, objNull, ["isNotInside","isNotDragging", "isNotCarrying", "isNotSwimming", "notOnMap", "isNotEscorting", "isNotSurrendering", "isNotSitting"]] call EFUNC(common,canInteractWith)) + !([ACE_player, objNull, ["isNotInside","isNotDragging", "isNotCarrying", "isNotSwimming", "notOnMap", "isNotEscorting", "isNotSurrendering", "isNotSitting", "isNotOnLadder"]] call EFUNC(common,canInteractWith)) }) exitWith {false}; while {dialog} do { diff --git a/addons/interact_menu/functions/fnc_render.sqf b/addons/interact_menu/functions/fnc_render.sqf index 55ca280c43..54f197a2a3 100644 --- a/addons/interact_menu/functions/fnc_render.sqf +++ b/addons/interact_menu/functions/fnc_render.sqf @@ -14,13 +14,14 @@ BEGIN_COUNTER(fnc_render); -private ["_cursorPos1", "_cursorPos2", "_p1", "_p2", "_forEachIndex", "_x", "_cursorScreenPos", "_closestDistance", "_closestSelection", "_sPos", "_disSq", "_closest", "_cTime", "_delta", "_foundTarget", "_misMatch", "_hoverPath", "_i", "_actionData", "_player", "_target"]; -_foundTarget = false; -_cursorPos1 = positionCameraToWorld [0, 0, 0]; -_cursorPos2 = positionCameraToWorld [0, 0, 2]; +private ["_cursorPos2", "_p1", "_p2", "_forEachIndex", "_x", "_cursorScreenPos", "_closestDistance", "_closestSelection", "_sPos", "_disSq", "_closest", "_cTime", "_delta", "_foundTarget", "_misMatch", "_hoverPath", "_i", "_actionData", "_player", "_target"]; +_foundTarget = false; if (GVAR(openedMenuType) >= 0) then { + // _cursorPos1 = positionCameraToWorld [0, 0, 2]; + _cursorPos2 = positionCameraToWorld [0, 0, 2]; + // Render all available nearby interactions call FUNC(renderActionPoints); diff --git a/addons/interact_menu/stringtable.xml b/addons/interact_menu/stringtable.xml index 5bd8aefe21..42966c43c1 100644 --- a/addons/interact_menu/stringtable.xml +++ b/addons/interact_menu/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -90,6 +90,10 @@ Akcje Zeusa Akce Zeuse Acciones Zeus + Actions Zeus + Zeus cselekvések + Ações do Zeus + Действия Зевса Interaction - Text Max @@ -230,14 +234,20 @@ Pozadí menu interakce Interaktionsmenü-Hintergrund Fundo do menu de interação + Arrière plan du menu d'interaction + Cselekvő menü háttere + Фон меню взаимодействия Blur the background while the interaction menu is open. Rozmywa lub przyciemnia tło na czas otwarcia menu interakcji Desenfocar el fondo mientras el menú de interacción está abierto. - Rozmazat obraz pokud je interakční menu otevřené. + Rozmazat obraz při otevřeném interakčním menu. Den Hintergrund verschwimmen lassen, während das Interaktionsmenü geöffnet ist. Desfocar o fundo enquanto o menu de interação está aberto. + Flouter l'arrière plan durant l'ouverture du menu d'interaction + A háttér elmosása a cselekvő menü használata alatt. + Размыть фон, пока открыто меню взаимодействия. Blur screen @@ -246,30 +256,48 @@ Rozmazaný obraz Verschwommenes Bild Desfoque de tela + Flouter l'écran + Kép elmosása + Размытый Black Przyciemnienie ekranu Negro - Černý obraz + Tmavý Preto Schwarz + Noir + Fekete + Черный Show actions for buildings Pokazuj akcje dla budynków Zobrazit akci pro budovy Mostrar acciones para edificios + Affiche les actions pour les batiments + Cselekvések mutatása épületeknél + Mostrar ações para edifícios + Показывать действия для зданий Adds interaction actions for opening doors and mounting ladders on buildings. (Note: There is a performance cost when opening interaction menu, especially in towns) Dodaje opcje interakcji dla otwierania drzwi oraz wchodzenia po drabinach do budynków. Uwaga: Użycie tej opcji może spowodować spadek wydajności menu interakcji, szczególnie w dużych miastach. Přidá možnost interakce pro otevření dvěří a umistňovat žebříky na budovy. (Poznámka: Použití této možnosti snižuje výkon při otevírání pomocí interakčního menu, zejména ve velkých městech.) Añade las acciones de interacción para la apertura de puertas y montaje de escaleras en los edificios. (Nota: Hay un coste de rendimiento al abrir el menú de interacción, especialmente en las ciudades) + Ajoute des interactions pour ouvrir les portes et les échelles des batiments. (Note: l'ouverture du menu en ville dégrade les performances) + Cselekvéseket engedélyez ajtók kinyitására és létrák mászására. (Figyelem: ez teljesítményvesztéssel járhat a menü megnyitásakor, főleg városokban) + Adiciona ações de interações para abrir portas e montar escadas em edifícios. (Nota: Existe um custo de performance quando aberto o menu de interação, especialmente em cidades) + Добавляет действия открывания дверей и залезания на лестницы для зданий. (Примечание: возможно падение производительности при открытии меню взаимодействия, особенно в городах) Interaction Menu Menu interakcji + Menu de interação + Меню взаимодействия + Menu interakce + Menú de interacción - \ No newline at end of file + diff --git a/addons/interaction/ACE_Settings.hpp b/addons/interaction/ACE_Settings.hpp index 6c97109a37..075c1f056d 100644 --- a/addons/interaction/ACE_Settings.hpp +++ b/addons/interaction/ACE_Settings.hpp @@ -1,3 +1,4 @@ + class ACE_Settings { class GVAR(EnableTeamManagement) { value = 1; diff --git a/addons/interaction/ACE_ZeusActions.hpp b/addons/interaction/ACE_ZeusActions.hpp index 50f203a092..5a7ea9d631 100644 --- a/addons/interaction/ACE_ZeusActions.hpp +++ b/addons/interaction/ACE_ZeusActions.hpp @@ -1,6 +1,5 @@ + class ACE_ZeusActions { - // _target = curatorLogic - // curatorSelected = [objects,groups,waypoints,markers] class ZeusUnits { displayName = "$STR_A3_RscDisplayCurator_ModeUnits_tooltip"; icon = "\A3\UI_F_Curator\Data\Displays\RscDisplayCurator\modeUnits_ca.paa"; @@ -29,12 +28,14 @@ class ACE_ZeusActions { statement = "{_x setUnitPos 'AUTO';} forEach (curatorSelected select 0);"; }; }; + class remoteControl { displayName = "$STR_A3_CfgVehicles_ModuleRemoteControl_F"; icon = "\A3\Modules_F_Curator\Data\portraitRemoteControl_ca.paa"; statement = "_unit = objNull; { if ((side _x in [east,west,resistance,civilian]) && !(isPlayer _x)) exitWith { _unit = _x; }; } forEach (curatorSelected select 0); bis_fnc_curatorObjectPlaced_mouseOver = ['OBJECT',_unit]; (group _target) createUnit ['ModuleRemoteControl_F',[0,0,0],[],0,''];"; }; }; + class ZeusGroups { displayName = "$STR_A3_RscDisplayCurator_ModeGroups_tooltip"; icon = "\A3\UI_F_Curator\Data\Displays\RscDisplayCurator\modeGroups_ca.paa"; @@ -67,6 +68,7 @@ class ACE_ZeusActions { statement = "{ _x setBehaviour 'STEALTH'; } forEach (curatorSelected select 1);"; }; }; + class speed { displayName = "$STR_HC_Menu_Speed"; @@ -86,6 +88,7 @@ class ACE_ZeusActions { statement = "{_x setSpeedMode 'FULL';} forEach (curatorSelected select 1);"; }; }; + class formation { displayName = "$STR_Formation"; @@ -136,6 +139,7 @@ class ACE_ZeusActions { }; }; }; + class ZeusWaypoints { displayName = "Waypoints"; icon = "\A3\UI_F_Curator\Data\Displays\RscDisplayCurator\modeRecent_ca.paa"; @@ -168,6 +172,7 @@ class ACE_ZeusActions { statement = "{ _x setWaypointBehaviour 'STEALTH'; } forEach (curatorSelected select 2);"; }; }; + class speed { displayName = "$STR_HC_Menu_Speed"; @@ -187,6 +192,7 @@ class ACE_ZeusActions { statement = "{ _x setWaypointSpeed 'FULL'; } forEach (curatorSelected select 2);"; }; }; + class formation { displayName = "$STR_Formation"; @@ -237,6 +243,7 @@ class ACE_ZeusActions { }; }; }; + class ZeusMarkers { displayName = "$STR_A3_RscDisplayCurator_ModeMarkers_tooltip"; icon = "\A3\UI_F_Curator\Data\Displays\RscDisplayCurator\modeMarkers_ca.paa"; diff --git a/addons/interaction/CfgEventHandlers.hpp b/addons/interaction/CfgEventHandlers.hpp index 7b003bbe8c..60a8fdfcf6 100644 --- a/addons/interaction/CfgEventHandlers.hpp +++ b/addons/interaction/CfgEventHandlers.hpp @@ -1,6 +1,7 @@ + class Extended_PreInit_EventHandlers { class ADDON { - init = QUOTE( call COMPILE_FILE(XEH_preInit) ); + init = QUOTE(call COMPILE_FILE(XEH_preInit)); }; }; @@ -9,3 +10,11 @@ class Extended_PostInit_EventHandlers { init = QUOTE(call COMPILE_FILE(XEH_postInit)); }; }; + +class Extended_Respawn_EventHandlers { + class CAManBase { + class ADDON { + respawn = QUOTE((_this select 0) setVariable [ARR_3(QUOTE(QGVAR(assignedFireTeam)),(_this select 0) getVariable [ARR_2(QUOTE(QGVAR(assignedFireTeam)),'MAIN')],true)]); + }; + }; +}; diff --git a/addons/interaction/CfgVehicles.hpp b/addons/interaction/CfgVehicles.hpp index 6a492b14ad..56fb06a85b 100644 --- a/addons/interaction/CfgVehicles.hpp +++ b/addons/interaction/CfgVehicles.hpp @@ -1,25 +1,28 @@ + class CfgVehicles { - class ACE_Module; - class ACE_ModuleInteraction: ACE_Module { - author = ECSTRING(common,ACETeam); - category = "ACE"; - displayName = CSTRING(Module_DisplayName); - function = "ACE_Interaction_fnc_moduleInteraction"; - scope = 2; - isGlobal = 1; - icon = PATHTOF(UI\Icon_Module_Interaction_ca.paa); - class Arguments { - class EnableTeamManagement { - displayName = CSTRING(EnableTeamManagement_DisplayName); - description = CSTRING(EnableTeamManagement_Description); - typeName = "BOOL"; - defaultValue = 1; - }; + class ACE_Module; + class ACE_ModuleInteraction: ACE_Module { + author = ECSTRING(common,ACETeam); + category = "ACE"; + displayName = CSTRING(Module_DisplayName); + function = "ACE_Interaction_fnc_moduleInteraction"; + scope = 2; + isGlobal = 1; + icon = PATHTOF(UI\Icon_Module_Interaction_ca.paa); + + class Arguments { + class EnableTeamManagement { + displayName = CSTRING(EnableTeamManagement_DisplayName); + description = CSTRING(EnableTeamManagement_Description); + typeName = "BOOL"; + defaultValue = 1; + }; + }; + + class ModuleDescription { + description = CSTRING(Module_Description); + }; }; - class ModuleDescription { - description = CSTRING(Module_Description); - }; - }; class Man; class CAManBase: Man { @@ -77,7 +80,6 @@ class CfgVehicles { priority = 2.1; hotkey = "Y"; }; - class ACE_UnassignTeam { displayName = CSTRING(LeaveTeam); condition = QUOTE([ARR_2(_player,_target)] call DFUNC(canJoinTeam) && {assignedTeam _target != 'MAIN'}); @@ -98,29 +100,29 @@ class CfgVehicles { icon = PATHTOF(UI\team\team_management_ca.paa); hotkey = "J"; }; - class ACE_GetDown { displayName = CSTRING(GetDown); - condition = QUOTE([_target] call DFUNC(canInteractWithCivilian)); - statement = QUOTE([_target] call DFUNC(getDown)); + condition = QUOTE([ARR_2(_player,_target)] call DFUNC(canInteractWithCivilian)); + statement = QUOTE([ARR_2(_player,_target)] call DFUNC(getDown)); showDisabled = 0; priority = 2.2; }; class ACE_SendAway { displayName = CSTRING(SendAway); - condition = QUOTE([_target] call DFUNC(canInteractWithCivilian)); - statement = QUOTE([_target] call DFUNC(sendAway)); + condition = QUOTE([ARR_2(_player,_target)] call DFUNC(canInteractWithCivilian)); + statement = QUOTE([ARR_2(_player,_target)] call DFUNC(sendAway)); showDisabled = 0; priority = 2.0; }; class ACE_Pardon { displayName = CSTRING(Pardon); - condition = QUOTE(rating _target < -2000 && {alive _target} && {side group _player == side group _target}); - statement = QUOTE([ARR_3(_target,'{_this addRating -rating _this}',_target)] call DEFUNC(common,execRemoteFnc)); + condition = QUOTE([ARR_2(_player,_target)] call DFUNC(canPardon)); + statement = QUOTE([ARR_2(_player,_target)] call DFUNC(pardon)); showDisabled = 0; priority = 2.5; }; }; + class ACE_Torso { displayName = CSTRING(Torso); selection = "spine3"; @@ -165,12 +167,11 @@ class CfgVehicles { }; class ACE_Weapon { displayName = CSTRING(Weapon); - position = QUOTE(call FUNC(getWeaponPos)); + position = QUOTE(call DFUNC(getWeaponPos)); distance = 1.50; condition = ""; statement = ""; }; - class ACE_TapShoulderRight { displayName = CSTRING(TapShoulder); selection = "rightshoulder"; @@ -191,7 +192,7 @@ class CfgVehicles { class ACE_TeamManagement { displayName = CSTRING(TeamManagement); condition = QUOTE(GVAR(EnableTeamManagement)); - exceptions[] = {"isNotInside", "isNotSitting"}; + exceptions[] = {"isNotInside", "isNotSitting", "isNotOnLadder"}; statement = ""; showDisabled = 1; priority = 3.2; @@ -201,7 +202,7 @@ class CfgVehicles { class ACE_JoinTeamRed { displayName = CSTRING(JoinTeamRed); condition = QUOTE(true); - exceptions[] = {"isNotInside", "isNotSitting"}; + exceptions[] = {"isNotInside", "isNotSitting", "isNotOnLadder"}; statement = QUOTE([ARR_2(_player,'RED')] call DFUNC(joinTeam)); showDisabled = 1; priority = 2.4; @@ -211,7 +212,7 @@ class CfgVehicles { class ACE_JoinTeamGreen { displayName = CSTRING(JoinTeamGreen); condition = QUOTE(true); - exceptions[] = {"isNotInside", "isNotSitting"}; + exceptions[] = {"isNotInside", "isNotSitting", "isNotOnLadder"}; statement = QUOTE([ARR_2(_player,'GREEN')] call DFUNC(joinTeam)); showDisabled = 1; priority = 2.3; @@ -221,7 +222,7 @@ class CfgVehicles { class ACE_JoinTeamBlue { displayName = CSTRING(JoinTeamBlue); condition = QUOTE(true); - exceptions[] = {"isNotInside", "isNotSitting"}; + exceptions[] = {"isNotInside", "isNotSitting", "isNotOnLadder"}; statement = QUOTE([ARR_2(_player,'BLUE')] call DFUNC(joinTeam)); showDisabled = 1; priority = 2.2; @@ -231,18 +232,17 @@ class CfgVehicles { class ACE_JoinTeamYellow { displayName = CSTRING(JoinTeamYellow); condition = QUOTE(true); - exceptions[] = {"isNotInside", "isNotSitting"}; + exceptions[] = {"isNotInside", "isNotSitting", "isNotOnLadder"}; statement = QUOTE([ARR_2(_player,'YELLOW')] call DFUNC(joinTeam)); showDisabled = 1; priority = 2.1; icon = PATHTOF(UI\team\team_yellow_ca.paa); hotkey = "Y"; }; - class ACE_LeaveTeam { displayName = CSTRING(LeaveTeam); condition = QUOTE(assignedTeam _player != 'MAIN'); - exceptions[] = {"isNotInside", "isNotSitting"}; + exceptions[] = {"isNotInside", "isNotSitting", "isNotOnLadder"}; statement = QUOTE([ARR_2(_player,'MAIN')] call DFUNC(joinTeam)); showDisabled = 1; priority = 2.5; @@ -252,7 +252,7 @@ class CfgVehicles { class ACE_BecomeLeader { displayName = CSTRING(BecomeLeader); condition = QUOTE(_this call DFUNC(canBecomeLeader)); - exceptions[] = {"isNotInside", "isNotSitting"}; + exceptions[] = {"isNotInside", "isNotSitting", "isNotOnLadder"}; statement = QUOTE(_this call DFUNC(doBecomeLeader)); showDisabled = 1; priority = 1.0; @@ -262,7 +262,7 @@ class CfgVehicles { class ACE_LeaveGroup { displayName = CSTRING(LeaveGroup); condition = QUOTE(count (units group _player) > 1); - exceptions[] = {"isNotInside", "isNotSitting"}; + exceptions[] = {"isNotInside", "isNotSitting", "isNotOnLadder"}; statement = QUOTE(_oldGroup = units group _player; _newGroup = createGroup side _player; [_player] joinSilent _newGroup; {_player reveal _x} forEach _oldGroup;); showDisabled = 1; priority = 1.2; @@ -379,7 +379,7 @@ class CfgVehicles { class ACE_Equipment { displayName = CSTRING(Equipment); condition = QUOTE(true); - exceptions[] = {"isNotInside","notOnMap", "isNotSitting"}; + exceptions[] = {"isNotInside", "notOnMap", "isNotSitting"}; statement = ""; showDisabled = 1; priority = 4.5; @@ -405,6 +405,7 @@ class CfgVehicles { }; }; }; + class ACE_SelfActions { class ACE_Passengers { displayName = CSTRING(Passengers); @@ -414,6 +415,7 @@ class CfgVehicles { }; }; }; + class Tank: LandVehicle { class ACE_Actions { class ACE_MainActions { @@ -429,6 +431,7 @@ class CfgVehicles { }; }; }; + class ACE_SelfActions { class ACE_Passengers { displayName = CSTRING(Passengers); @@ -455,6 +458,7 @@ class CfgVehicles { }; }; }; + class ACE_SelfActions { class ACE_Passengers { displayName = CSTRING(Passengers); @@ -464,6 +468,7 @@ class CfgVehicles { }; }; }; + class Plane: Air { class ACE_Actions { class ACE_MainActions { @@ -479,6 +484,7 @@ class CfgVehicles { }; }; }; + class ACE_SelfActions { class ACE_Passengers { displayName = CSTRING(Passengers); @@ -501,8 +507,8 @@ class CfgVehicles { class ACE_Push { displayName = CSTRING(Push); distance = 6; - condition = QUOTE(getMass _target < 1000 && {alive _target}); - statement = QUOTE([ARR_2(_target, [ARR_3(2 * (vectorDir _player select 0), 2 * (vectorDir _player select 1), 0.5)])] call DFUNC(push);); + condition = QUOTE(getMass _target <= 2600 && {alive _target} && {vectorMagnitude velocity _target < 3}); + statement = QUOTE(_this call FUNC(push)); showDisabled = 0; priority = -1; }; @@ -514,6 +520,7 @@ class CfgVehicles { }; }; }; + class ACE_SelfActions { class ACE_Passengers { displayName = CSTRING(Passengers); @@ -539,6 +546,7 @@ class CfgVehicles { }; }; }; + class ACE_SelfActions { class ACE_Passengers { displayName = CSTRING(Passengers); @@ -548,29 +556,32 @@ class CfgVehicles { }; }; }; - + class StaticMGWeapon: StaticWeapon {}; class HMG_01_base_F: StaticMGWeapon {}; + class HMG_01_high_base_F: HMG_01_base_F { - class ACE_Actions: ACE_Actions { - class ACE_MainActions: ACE_MainActions { - position = "[-0.172852,0.164063,-0.476091]"; - }; - }; - }; + class ACE_Actions: ACE_Actions { + class ACE_MainActions: ACE_MainActions { + position = "[-0.172852,0.164063,-0.476091]"; + }; + }; + }; + class AA_01_base_F: StaticMGWeapon { - class ACE_Actions: ACE_Actions { - class ACE_MainActions: ACE_MainActions { - position = "[0,0.515869,-0.200671]"; - }; - }; - }; + class ACE_Actions: ACE_Actions { + class ACE_MainActions: ACE_MainActions { + position = "[0,0.515869,-0.200671]"; + }; + }; + }; + class AT_01_base_F: StaticMGWeapon { - class ACE_Actions: ACE_Actions { - class ACE_MainActions: ACE_MainActions { - position = "[0,0.515869,-0.200671]"; - }; - }; + class ACE_Actions: ACE_Actions { + class ACE_MainActions: ACE_MainActions { + position = "[0,0.515869,-0.200671]"; + }; + }; }; class thingX; @@ -581,6 +592,7 @@ class CfgVehicles { selection = ""; distance = 2; condition = "true"; + class ACE_OpenBox { displayName = CSTRING(OpenBox); condition = QUOTE(alive _target); @@ -590,6 +602,20 @@ class CfgVehicles { }; }; }; + + class ACE_SelfActions {}; + }; + + class ACE_RepairItem_Base: thingX { + class ACE_Actions { + class ACE_MainActions { + displayName = CSTRING(MainAction); + selection = ""; + distance = 2; + condition = "true"; + }; + }; + class ACE_SelfActions {}; }; }; diff --git a/addons/interaction/README.md b/addons/interaction/README.md index 8e841e9a58..92401b2547 100644 --- a/addons/interaction/README.md +++ b/addons/interaction/README.md @@ -3,6 +3,7 @@ ace_interaction Provides interaction options between units. + ## Maintainers The people responsible for merging changes to this component or answering potential questions. diff --git a/addons/interaction/Menu_Config.hpp b/addons/interaction/RscTitles.hpp similarity index 98% rename from addons/interaction/Menu_Config.hpp rename to addons/interaction/RscTitles.hpp index 8359ee560a..f75da59cce 100644 --- a/addons/interaction/Menu_Config.hpp +++ b/addons/interaction/RscTitles.hpp @@ -1,3 +1,4 @@ + #define HSPACE 0.5-2.0/16/2 #define VSPACE 0.5-0.3/9/2 @@ -44,13 +45,15 @@ class ACE_Interaction_Button_Base { class RscListbox; class IGUIBack; class RscText; + #define X_OFFSET 0.2 class RscACE_SelectAnItem { idd = 8854; movingEnable = 0; + class controls { - class back:IGUIBack { + class back: IGUIBack { x = X_OFFSET; y = 0; w = 0.6; @@ -66,7 +69,7 @@ class RscACE_SelectAnItem { style = 0x02; text = ""; }; - class itemList:RscListBox { + class itemList: RscListBox { onMouseButtonDblClick = "_this call ACE_Interaction_fnc_onSelectMenuDblClick"; idc = 8866; x = X_OFFSET + 0.005; @@ -139,18 +142,21 @@ class RscInteractionIcon: RscPicture { w = 2*GUI_GRID_H; h = 2*GUI_GRID_H; }; + class RscInteractionHelperIcon: RscInteractionIcon { x = 20 * GUI_GRID_W; y = 16 * GUI_GRID_H; w = GUI_GRID_H; h = GUI_GRID_H; }; + class RscInteractionText: RscText{ x = 21 * GUI_GRID_W; y = 16 * GUI_GRID_H; - w = 8 * GUI_GRID_W; + w = 24 * GUI_GRID_W; h = 1.5 * GUI_GRID_H; }; + class RscTitles { class GVAR(InteractionHelper) { idd = 9930; diff --git a/addons/interaction/XEH_postInit.sqf b/addons/interaction/XEH_postInit.sqf index 7fe151dac1..ae3ebff5c3 100644 --- a/addons/interaction/XEH_postInit.sqf +++ b/addons/interaction/XEH_postInit.sqf @@ -1,50 +1,70 @@ // by commy2 and esteldunedain - #include "script_component.hpp" ACE_Modifier = 0; -//SelectLeader Event Handler for BecomeLeader action: -[QGVAR(selectLeader), { - PARAMS_2(_group,_leader); - _group selectLeader _leader; +["pardon", {(_this select 0) addRating -rating (_this select 0)}] call EFUNC(common,addEventHandler); + +["getDown", { + params ["_target"]; + + _target setUnitPos "DOWN"; +}] call EFUNC(common,addEventHandler); + +["sendAway", { + params ["_unit", "_position"]; + + _unit setUnitPos "AUTO"; + _unit doMove _position; }] call EFUNC(common,addEventHandler); if (!hasInterface) exitWith {}; GVAR(isOpeningDoor) = false; +[{_this call FUNC(handleScrollWheel)}] call EFUNC(common,addScrollWheelEventHandler); + +["tapShoulder", { + params ["_unit", "_shoulderNum"]; + + if (_unit == ACE_player) then { + addCamShake [4, 0.5, 5]; + }; + + private "_message"; + _message = parseText format ([["%1 >", localize LSTRING(YouWereTappedRight)], ["< %1", localize LSTRING(YouWereTappedLeft)]] select (_shoulderNum == 0)); + + ["displayTextStructured", _message] call EFUNC(common,targetEvent); +}] call EFUNC(common,addEventHandler); + // restore global fire teams for JIP -private ["_team"]; +private "_team"; { _team = _x getVariable [QGVAR(assignedFireTeam), ""]; if (_team != "") then {_x assignTeam _team}; -} forEach allUnits; + false +} count allUnits; - -// Add keybinds -["ACE3 Common", QGVAR(openDoor), localize LSTRING(OpenDoor), -{ +// add keybinds +["ACE3 Common", QGVAR(openDoor), localize LSTRING(OpenDoor), { // Conditions: canInteract if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false}; // Conditions: specific - if (GVAR(isOpeningDoor) || {[2] call FUNC(getDoor) select 1 == ''}) exitWith {false}; + if (GVAR(isOpeningDoor) || {[MACRO_DOOR_REACH_DISTANCE] call FUNC(getDoor) select 1 == ''}) exitWith {false}; // Statement call EFUNC(interaction,openDoor); true -}, -{ +}, { //Probably don't want any condidtions here, so variable never gets locked down // Statement GVAR(isOpeningDoor) = false; true }, -[57, [false, true, false]], false] call cba_fnc_addKeybind; //Key CTRL+Space +[57, [false, true, false]], false] call CBA_fnc_addKeybind; //Key CTRL+Space -["ACE3 Common", QGVAR(tapShoulder), localize LSTRING(TapShoulder), -{ +["ACE3 Common", QGVAR(tapShoulder), localize LSTRING(TapShoulder), { // Conditions: canInteract if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false}; // Conditions: specific @@ -55,23 +75,7 @@ private ["_team"]; true }, {false}, -[20, [true, false, false]], false] call cba_fnc_addKeybind; - -["ACE3 Common", QGVAR(modifierKey), localize LSTRING(ModifierKey), -{ - // Conditions: canInteract - //if !([ACE_player, objNull, ["isNotDragging"]] call EFUNC(common,canInteractWith)) exitWith {false}; // not needed - - // Statement - ACE_Modifier = 1; - // Return false so it doesn't block other actions - false -}, -{ - //Probably don't want any condidtions here, so variable never gets locked down - ACE_Modifier = 0; - false; -}, -[29, [false, false, false]], false] call cba_fnc_addKeybind; +[20, [true, false, false]], false] call CBA_fnc_addKeybind; ["isNotSwimming", {!underwater (_this select 0)}] call EFUNC(common,addCanInteractWithCondition); +["isNotOnLadder", {getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> animationState (_this select 0) >> "ACE_isLadder") != 1}] call EFUNC(common,addCanInteractWithCondition); diff --git a/addons/interaction/XEH_preInit.sqf b/addons/interaction/XEH_preInit.sqf index c2534b44b9..95be20f141 100644 --- a/addons/interaction/XEH_preInit.sqf +++ b/addons/interaction/XEH_preInit.sqf @@ -2,37 +2,38 @@ ADDON = false; +// interaction menu PREP(addPassengerActions); PREP(addPassengersActions); -PREP(addSelectableItem); -PREP(applyButtons); -PREP(canBecomeLeader); +PREP(getWeaponPos); +PREP(moduleInteraction); +PREP(removeTag); + +// scroll wheel hint +PREP(showMouseHint); +PREP(hideMouseHint); + +// interaction with units PREP(canInteractWithCivilian); +PREP(getDown); +PREP(sendAway); PREP(canJoinGroup); PREP(canJoinTeam); -PREP(canTapShoulder); +PREP(joinTeam); +PREP(canBecomeLeader); PREP(doBecomeLeader); +PREP(canTapShoulder); +PREP(tapShoulder); +PREP(canPardon); +PREP(pardon); + +// interaction with doors PREP(getDoor); PREP(getDoorAnimations); -PREP(getDown); -PREP(getSelectedButton); -PREP(getWeaponPos); -PREP(hideMenu); -PREP(hideMouseHint); -PREP(isInRange); -PREP(joinTeam); -PREP(moduleInteraction); -PREP(moveDown); -PREP(onSelectMenuDblClick); +PREP(handleScrollWheel); PREP(openDoor); -PREP(openMenuSelectUI); -PREP(openSelectMenu); -PREP(prepareSelectMenu); + +// interaction with boats PREP(push); -PREP(removeTag); -PREP(sendAway); -PREP(showMouseHint); -PREP(sortOptionsByPriority); -PREP(tapShoulder); ADDON = true; diff --git a/addons/interaction/config.cpp b/addons/interaction/config.cpp index 0afb2fc0fe..9659565c3c 100644 --- a/addons/interaction/config.cpp +++ b/addons/interaction/config.cpp @@ -14,6 +14,6 @@ class CfgPatches { #include "CfgEventHandlers.hpp" #include "CfgVehicles.hpp" -#include "Menu_Config.hpp" +#include "RscTitles.hpp" #include "ACE_Settings.hpp" #include "ACE_ZeusActions.hpp" diff --git a/addons/interaction/functions/fnc_addPassengerActions.sqf b/addons/interaction/functions/fnc_addPassengerActions.sqf index d7e21d4a7b..20de00e315 100644 --- a/addons/interaction/functions/fnc_addPassengerActions.sqf +++ b/addons/interaction/functions/fnc_addPassengerActions.sqf @@ -1,13 +1,13 @@ /* * Author: esteldunedain - * Mount unit actions inside passenger submenu + * Mount unit actions inside passenger submenu. * * Arguments: * 0: Vehicle * 1: Player * 3: Parameters * - * Return value: + * Return Value: * Children actions * * Example: @@ -17,8 +17,8 @@ */ #include "script_component.hpp" -EXPLODE_3_PVT(_this,_vehicle,_player,_parameters); -EXPLODE_1_PVT(_parameters,_unit); +params ["", "", "_parameters"]; +_parameters params ["_unit"]; private ["_varName", "_actionTrees", "_actions"]; @@ -26,11 +26,13 @@ _varName = format [QEGVAR(interact_menu,Act_%1), typeOf _unit]; _actionTrees = missionNamespace getVariable [_varName, []]; _actions = []; -// Mount unit MainActions menu +// Mount unit MainActions menu { - EXPLODE_2_PVT(_x,_actionData,_children); - _actions pushBack [_actionData, _children, _unit]; -} forEach ((_actionTrees select 0) select 1); + _x params ["_actionData", "_children"]; + + _actions pushBack [_actionData, _children, _unit]; + false +} count (_actionTrees select 0 select 1); _actions diff --git a/addons/interaction/functions/fnc_addPassengersActions.sqf b/addons/interaction/functions/fnc_addPassengersActions.sqf index fe557e7ada..7296b34fa2 100644 --- a/addons/interaction/functions/fnc_addPassengersActions.sqf +++ b/addons/interaction/functions/fnc_addPassengersActions.sqf @@ -1,13 +1,13 @@ /* * Author: esteldunedain - * Create one action per passenger + * Create one action per passenger. * * Arguments: * 0: Vehicle * 1: Player * 3: Parameters * - * Return value: + * Return Value: * Children actions * * Example: @@ -17,39 +17,43 @@ */ #include "script_component.hpp" -EXPLODE_3_PVT(_this,_vehicle,_player,_parameters); +params ["_vehicle", "_player"]; -private ["_actions"]; +private "_actions"; _actions = []; { private ["_unit", "_icon"]; + _unit = _x; - if ((_unit != _player) && {(getText (configFile >> "CfgVehicles" >> (typeOf _x) >> "simulation")) != "UAVPilot"}) then { - _icon = switch _unit do { - case (driver _vehicle): { QUOTE(A3\ui_f\data\IGUI\RscIngameUI\RscUnitInfo\role_driver_ca.paa) }; - case (gunner _vehicle): { QUOTE(A3\ui_f\data\IGUI\RscIngameUI\RscUnitInfo\role_gunner_ca.paa) }; - case (commander _vehicle): { QUOTE(A3\ui_f\data\IGUI\RscIngameUI\RscUnitInfo\role_commander_ca.paa) }; - default { "" }; - }; + + if (_unit != _player && {getText (configFile >> "CfgVehicles" >> typeOf _unit >> "simulation") != "UAVPilot"}) then { + _icon = [ + "", + "A3\ui_f\data\IGUI\RscIngameUI\RscUnitInfo\role_driver_ca.paa", + "A3\ui_f\data\IGUI\RscIngameUI\RscUnitInfo\role_gunner_ca.paa", + "A3\ui_f\data\IGUI\RscIngameUI\RscUnitInfo\role_commander_ca.paa" + ] select (([driver _vehicle, gunner _vehicle, commander _vehicle] find _unit) + 1); + if (_unit getVariable [QEGVAR(captives,isHandcuffed), false]) then { _icon = QUOTE(PATHTOEF(captives,UI\handcuff_ca.paa)); }; - _actions pushBack + + _actions pushBack [ [ - [ - str(_unit), - [_unit, true] call EFUNC(common,getName), - _icon, - {}, - {true}, - {_this call FUNC(addPassengerActions);}, - [_unit] - ] call EFUNC(interact_menu,createAction), - [], - _unit - ]; + format ["%1", _unit], + [_unit, true] call EFUNC(common,getName), + _icon, + {}, + {true}, + {_this call FUNC(addPassengerActions)}, + [_unit] + ] call EFUNC(interact_menu,createAction), + [], + _unit + ]; }; -} forEach crew _vehicle; + false +} count crew _vehicle; _actions diff --git a/addons/interaction/functions/fnc_addSelectableItem.sqf b/addons/interaction/functions/fnc_addSelectableItem.sqf deleted file mode 100644 index 74a0e9caea..0000000000 --- a/addons/interaction/functions/fnc_addSelectableItem.sqf +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Author: Garth de Wet (LH) - * Adds an item to the select menu - * - * Arguments: - * 0: List container - * 1: Display name - * 2: Picture - * 3: Data - * - * Return value: - * Container - * - * Example: - * [actions, "Banana", "UI\dot_ca.paa", "bananaContents"] call ace_interaction_fnc_addSelectableItem - * - * Public: No - */ -#include "script_component.hpp" - -PARAMS_4(_container,_displayName,_picture,_data); - -if (_picture == "" || _picture == "PictureThing") then { - _picture = QUOTE(PATHTOF(UI\dot_ca.paa)); -}; - -private ["_index"]; -_index = lbAdd [_container, _displayName]; -lbSetData [_container, _index, str _data]; -lbSetPicture [_container, _index, _picture]; - -_container diff --git a/addons/interaction/functions/fnc_applyButtons.sqf b/addons/interaction/functions/fnc_applyButtons.sqf deleted file mode 100644 index 8aa57d5923..0000000000 --- a/addons/interaction/functions/fnc_applyButtons.sqf +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Author: commy2 - * Applies buttons - * - * Arguments: - * None - * - * Return value: - * None - * - * Example: - * call ace_interaction_fnc_applyButtons - * - * Public: No - */ -#include "script_component.hpp" - -private ["_object", "_actions", "_dlgInteractionDialog", "_ctrlInteractionDialog", "_index", "_ctrlInteractionDialogIcon", "_a", "_action", "_count"]; - -_object = GVAR(Target); -_actions = GVAR(Buttons); - - -disableSerialization; -_dlgInteractionDialog = uiNamespace getVariable QGVAR(Dialog); - -/* -for "_a" from 0 to (_count - 1) do { - _action = GVAR(Buttons) select _a; - - _ctrlInteractionDialog = _dlgInteractionDialog displayCtrl (10 + _a); - _ctrlInteractionDialog ctrlShow true; - _ctrlInteractionDialog ctrlSetText (_action select 0); - _ctrlInteractionDialog ctrlEnable (call (_action select 2)); -}; -*/ - -_ctrlInteractionDialog = _dlgInteractionDialog displayCtrl 3; - -GVAR(MainButton) = "(findDisplay 1713999) closeDisplay 1;"; - -if (_object isKindOf "Man") then { - _ctrlInteractionDialog ctrlSetText (if (alive _object) then {name _object} else {_object getVariable ["ACE_Name", "Unknown"]}); -} else { - _ctrlInteractionDialog ctrlSetText (getText (configFile >> "CfgVehicles" >> typeOf _object >> "displayName")); -}; - -for "_index" from 0 to 9 do { - _ctrlInteractionDialog = _dlgInteractionDialog displayCtrl (10 + _index); - _ctrlInteractionDialog ctrlShow true; - - _ctrlInteractionDialogIcon = _dlgInteractionDialog displayCtrl (20 + _index); - - if (_index < _count) then { - _action = GVAR(Buttons) select _index; - _ctrlInteractionDialog ctrlSetText (_action select 0); - _ctrlInteractionDialog ctrlEnable (call (_action select 2)); - - _ctrlInteractionDialogIcon ctrlSetText (_action select 5); - } else { - _ctrlInteractionDialog ctrlSetText ""; - _ctrlInteractionDialog ctrlEnable false; - - _ctrlInteractionDialogIcon ctrlSetText ""; - }; -}; diff --git a/addons/interaction/functions/fnc_canBecomeLeader.sqf b/addons/interaction/functions/fnc_canBecomeLeader.sqf index 1821e41506..3978306fec 100644 --- a/addons/interaction/functions/fnc_canBecomeLeader.sqf +++ b/addons/interaction/functions/fnc_canBecomeLeader.sqf @@ -1,21 +1,20 @@ /* * Author: PabstMirror - * Test if can Become Leader of group + * Test if can Become Leader of group. * * Arguments: - * 0: Target - * 1: Player + * 1: Unit * * Return Value: * Able to become leader of group * * Example: - * [player, player] call ace_interaction_fnc_canBecomeLeader + * [player] call ace_interaction_fnc_canBecomeLeader * * Public: No */ #include "script_component.hpp" -PARAMS_2(_target,_player); +params ["_unit"]; -(count (units group _player) > 1) && {leader group _player != _player} +count units group _unit > 1 && {leader group _unit != _unit} diff --git a/addons/interaction/functions/fnc_canInteractWithCivilian.sqf b/addons/interaction/functions/fnc_canInteractWithCivilian.sqf index c20ac61f94..eb8374191b 100644 --- a/addons/interaction/functions/fnc_canInteractWithCivilian.sqf +++ b/addons/interaction/functions/fnc_canInteractWithCivilian.sqf @@ -1,11 +1,13 @@ /* * Author: commy2 - * Checks if the player can interact with civilian + * Checks if the unit can interact with civilian * * Arguments: - * 0: Target + * 0: Unit + * 1: Target + * 2: Target has to be on the civilian side (default: true) * - * Return value: + * Return Value: * Able to interact with civilian * * Example: @@ -15,10 +17,6 @@ */ #include "script_component.hpp" -EXPLODE_2_PVT(_this,_unit,_isCivilian); +params ["_unit", "_target", ["_isCivilian", true]]; -if (isNil "_isCivilian") then {_isCivilian = true}; - -alive _unit -&& [side _unit != side ACE_player, side group _unit == civilian] select _isCivilian -//&& {count (weapons _unit) == 0} +alive _target && [side _target != side _unit, side group _target == civilian] select _isCivilian // return diff --git a/addons/interaction/functions/fnc_canJoinGroup.sqf b/addons/interaction/functions/fnc_canJoinGroup.sqf index 315da658db..6a3220181d 100644 --- a/addons/interaction/functions/fnc_canJoinGroup.sqf +++ b/addons/interaction/functions/fnc_canJoinGroup.sqf @@ -1,12 +1,12 @@ /* * Author: commy2 - * Checks if the player can join a group + * Checks if the unit can join a group * * Arguments: - * 0: Player + * 0: Unit * 1: Target * - * Return value: + * Return Value: * Able to join a group * * Example: @@ -16,9 +16,9 @@ */ #include "script_component.hpp" -PARAMS_2(_unit,_target); +params ["_unit", "_target"]; alive _target && {!(_target getVariable ["ACE_isUnconscious", false])} && {side group _unit == side group _target} -&& {group _unit != group _target} +&& {group _unit != group _target} // return diff --git a/addons/interaction/functions/fnc_canPardon.sqf b/addons/interaction/functions/fnc_canPardon.sqf new file mode 100644 index 0000000000..a377533018 --- /dev/null +++ b/addons/interaction/functions/fnc_canPardon.sqf @@ -0,0 +1,20 @@ +/* + * Author: commy2 + * Checks if the unit can pardon the target. + * + * Arguments: + * 0: Unit + * 1: Target + * + * Return Value: + * Unit can pardon target + * + * Public: No + */ +#include "script_component.hpp" + +params ["_unit", "_target"]; + +alive _target +&& {rating _target < -2000} +&& {side group _unit == side group _target} diff --git a/addons/interaction/functions/fnc_canTapShoulder.sqf b/addons/interaction/functions/fnc_canTapShoulder.sqf index bbeee51b4a..514ac0301b 100644 --- a/addons/interaction/functions/fnc_canTapShoulder.sqf +++ b/addons/interaction/functions/fnc_canTapShoulder.sqf @@ -1,12 +1,12 @@ /* * Author: commy2 - * Checks if the player can tap a shoulder + * Checks if the player can tap a shoulder. * * Arguments: * 0: Player * 1: Target * - * Return value: + * Return Value: * Able to tap a shoulder * * Example: @@ -16,9 +16,9 @@ */ #include "script_component.hpp" -PARAMS_2(_unit,_target); +params ["_unit", "_target"]; _target isKindOf "CAManBase" && {alive _target} && {_unit distance _target < 4} && -{!(_target getVariable ["ACE_isUnconscious", false])} +{!(_target getVariable ["ACE_isUnconscious", false])} // return diff --git a/addons/interaction/functions/fnc_doBecomeLeader.sqf b/addons/interaction/functions/fnc_doBecomeLeader.sqf index 0fd81cbc96..b2a423e0c0 100644 --- a/addons/interaction/functions/fnc_doBecomeLeader.sqf +++ b/addons/interaction/functions/fnc_doBecomeLeader.sqf @@ -1,21 +1,20 @@ /* * Author: PabstMirror - * Become Leader of group + * Become Leader of group. * * Arguments: - * 0: Target - * 1: Player + * 0: Unit * * Return Value: * None * * Example: - * [player, player] call ace_interaction_fnc_doBecomeLeader + * [player] call ace_interaction_fnc_doBecomeLeader * * Public: No */ #include "script_component.hpp" -PARAMS_2(_target,_player); +params ["_unit"]; -[QGVAR(selectLeader), (units group _player), [(group _player), _player]] call EFUNC(common,targetEvent); +["selectLeader", units group _unit, [group _unit, _unit]] call EFUNC(common,targetEvent); diff --git a/addons/interaction/functions/fnc_getDoor.sqf b/addons/interaction/functions/fnc_getDoor.sqf index a085c9a3b8..8261aa44f0 100644 --- a/addons/interaction/functions/fnc_getDoor.sqf +++ b/addons/interaction/functions/fnc_getDoor.sqf @@ -1,11 +1,11 @@ /* * Author: commy2 - * Get door + * Find door. * * Arguments: * 0: Distance * - * Return value: + * Return Value: * House objects and door * 0: House * 1: Door Name @@ -17,19 +17,18 @@ */ #include "script_component.hpp" -PARAMS_1(_distance); +params ["_distance"]; -private ["_position0", "_position1", "_intersections", "_count", "_house", "_door"]; +private ["_position0", "_position1", "_intersections", "_house", "_door"]; _position0 = positionCameraToWorld [0, 0, 0]; _position1 = positionCameraToWorld [0, 0, _distance]; -_intersections = lineIntersectsWith [ATLToASL _position0, ATLToASL _position1, objNull, objNull, true]; +_intersections = lineIntersectsSurfaces [AGLToASL _position0, AGLToASL _position1, cameraOn, objNull, true, 1, "GEOM"]; -_count = count _intersections; -if (_count == 0) exitWith {[objNull, ""]}; +if (_intersections isEqualTo []) exitWith {[objNull, ""]}; -_house = _intersections select (_count - 1); +_house = _intersections select 0 select 2; // shithouse is bugged if (typeOf _house == "") exitWith {[objNull, ""]}; @@ -37,6 +36,7 @@ if (typeOf _house == "") exitWith {[objNull, ""]}; _intersections = [_house, "GEOM"] intersect [_position0, _position1]; _door = _intersections select 0 select 0; + if (isNil "_door") exitWith {[_house, ""]}; [_house, _door] diff --git a/addons/interaction/functions/fnc_getDoorAnimations.sqf b/addons/interaction/functions/fnc_getDoorAnimations.sqf index 0de74e61ed..fac29c74a8 100644 --- a/addons/interaction/functions/fnc_getDoorAnimations.sqf +++ b/addons/interaction/functions/fnc_getDoorAnimations.sqf @@ -1,12 +1,12 @@ /* * Author: commy2 - * Get door animations + * Get door animations. @todo rewrite for better custom building support * * Arguments: * 0: House * 1: Door * - * Return value: + * Return Value: * Animation and Locked variable * 0: Animation * 1: Locked variable @@ -18,7 +18,7 @@ */ #include "script_component.hpp" -PARAMS_2(_house,_door); +params ["_house", "_door"]; private ["_index", "_animations", "_lockedVariable"]; diff --git a/addons/interaction/functions/fnc_getDown.sqf b/addons/interaction/functions/fnc_getDown.sqf index 09d651eadf..2dc9711e2c 100644 --- a/addons/interaction/functions/fnc_getDown.sqf +++ b/addons/interaction/functions/fnc_getDown.sqf @@ -1,38 +1,33 @@ /* - * Author: KoffeinFlummi - * Forces a civilian to the ground (with a chance of failure) + * Author: KoffeinFlummi, commy2 + * Forces a civilian to the ground with a chance of failure. * * Arguments: * 0: Unit + * 1: Target * - * Return value: + * Return Value: * None * * Example: - * [target] call ace_interaction_fnc_getDown + * [civillian] call ace_interaction_fnc_getDown * * Public: No */ #include "script_component.hpp" -#define RADIUS 10 +#define SEND_RADIUS 10 -PARAMS_1(_unit); +params ["_unit", "_target"]; -private ["_chance", "_x"]; +_unit playActionNow "GestureGo"; -ACE_player playActionNow "GestureGo"; // put something else here. - -if (count (weapons ACE_player) > 0) then { - _chance = 0.8; -} else { - _chance = 0.5; -}; +private "_chance"; +_chance = [0.5, 0.8] select (count weapons _unit > 0); { - if (count (weapons _unit) == 0 and random 1 < _chance) then { - [-2, { - _this setUnitPos "DOWN"; - }, _x] call CBA_fnc_globalExecute; - }; -} forEach (_unit nearEntities ["Civilian", RADIUS]); + if (count weapons _x == 0 && {random 1 < _chance}) then { + ["getDown", [_x], [_x]] call EFUNC(common,targetEvent); + }; + false +} count (_target nearEntities ["Civilian", SEND_RADIUS]); diff --git a/addons/interaction/functions/fnc_getSelectedButton.sqf b/addons/interaction/functions/fnc_getSelectedButton.sqf deleted file mode 100644 index 92768b67f7..0000000000 --- a/addons/interaction/functions/fnc_getSelectedButton.sqf +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Author: commy2 - * Get selected button - * - * Arguments: - * None - * - * Return value: - * Angle - * - * Example: - * call ace_interaction_fnc_getSelectedButton - * - * Public: No - */ -#include "script_component.hpp" - -#define MIN_DISTANCE 0.0065 - -private ["_position", "_distance", "_angle"]; - -_position = uiNamespace getVariable [QGVAR(CursorPosition), [0.5, 0.5, 0]]; - -_position = [((_position select 1) - 0.5) / safezoneH, ((_position select 2) - 0.5) / safezoneW, 0]; - -_distance = [0, 0, 0] vectorDistanceSqr _position; - -// is in center -if (_distance < MIN_DISTANCE) exitWith {-1}; - -_angle = (_position select 0) atan2 (_position select 1); - -// rotate circle -_angle = 180 - _angle + 360 / 10 / 2; -if (_angle < 0) then {_angle = _angle + 360}; - -_angle = floor (_angle / 360 * 10); -if (_angle == 10) then {0} else {_angle} diff --git a/addons/interaction/functions/fnc_handleScrollWheel.sqf b/addons/interaction/functions/fnc_handleScrollWheel.sqf new file mode 100644 index 0000000000..793e78c1b3 --- /dev/null +++ b/addons/interaction/functions/fnc_handleScrollWheel.sqf @@ -0,0 +1,23 @@ +/* + * Author: commy2 + * Handles incremental door opening + * + * Arguments: + * 0: scroll amount + * + * Return Value: + * handled + * + * Public: No + */ +#include "script_component.hpp" + +params ["_scroll"]; + +if !(GVAR(isOpeningDoor)) exitWith {false}; + +GVAR(doorTargetPhase) = ((GVAR(doorTargetPhase) + (_scroll / (1.2 * 12))) max 0) min 1; + +GVAR(usedScrollWheel) = true; + +true diff --git a/addons/interaction/functions/fnc_hideMenu.sqf b/addons/interaction/functions/fnc_hideMenu.sqf deleted file mode 100644 index 89dc49be40..0000000000 --- a/addons/interaction/functions/fnc_hideMenu.sqf +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Author: Garth de Wet (LH) - * Closes the Interaction menu - * - * Arguments: - * None - * - * Return value: - * None - * - * Example: - * call ace_interaction_fnc_hideMenu - * - * Public: No - */ -#include "script_component.hpp" - -closeDialog 0; -(findDisplay 1713999) closeDisplay 1; -(uiNameSpace getVariable QGVAR(Flow_Display)) closeDisplay 0; -GVAR(MainButton) = nil; -call FUNC(hideMouseHint); diff --git a/addons/interaction/functions/fnc_hideMouseHint.sqf b/addons/interaction/functions/fnc_hideMouseHint.sqf index 69acba25a2..39f43e7fa3 100644 --- a/addons/interaction/functions/fnc_hideMouseHint.sqf +++ b/addons/interaction/functions/fnc_hideMouseHint.sqf @@ -15,7 +15,8 @@ */ #include "script_component.hpp" -if (isNull (uiNamespace getVariable ["ACE_Helper_Display", objNull])) exitWith{}; +if (isNull (uiNamespace getVariable ["ACE_Helper_Display", objNull])) exitWith {}; (QGVAR(InteractionHelper) call BIS_fnc_rscLayer) cutText ["", "PLAIN"]; + showHUD true; diff --git a/addons/interaction/functions/fnc_isInRange.sqf b/addons/interaction/functions/fnc_isInRange.sqf deleted file mode 100644 index 49ac391871..0000000000 --- a/addons/interaction/functions/fnc_isInRange.sqf +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Author: commy2 - * Check if the vehicle is in range of the player. - * - * Arguments: - * 0: Vehicle - * 1: Distance in meters - * - * Return value: - * Vehicle in range of player - * - * Example: - * [target, 5] call ace_interaction_fnc_isInRange - * - * Public: No - */ -#include "script_component.hpp" - -PARAMS_2(_vehicle,_distance); - -private ["_player", "_position0", "_position1"]; - -_player = ACE_player; - -if (_vehicle isKindOf "Man") exitWith {_player distance _vehicle < _distance}; - -private ["_position0", "_position1"];//, "_direction"]; - -_position0 = getPosASL _player; -_position1 = getPosASL _vehicle; - -/* -_direction = _position1 vectorDiff _position0; -_direction = _direction vectorMultiply (_distance / (vectorMagnitude _direction)); - -_position0 = eyePos _player; -_position1 = _position0 vectorAdd _direction; - -_vehicle in lineIntersectsWith [_position0, _position1] || {_player distance _vehicle < _distance} -*/ - -_position0 = ATLToASL positionCameraToWorld [0, 0, 0]; -_position0 set [2, (_position0 select 2) - (getTerrainHeightASL _position0 min 0)]; - -_position1 = ATLToASL positionCameraToWorld [0, 0, _distance]; -_position1 set [2, (_position1 select 2) - (getTerrainHeightASL _position1 min 0)]; - -if (_vehicle in lineIntersectsWith [_position0, _position1] || {_player distance _vehicle < _distance}) then { - true -} else { - ["Not in Range"] call FUNC(addToTooltip); - false -} diff --git a/addons/interaction/functions/fnc_joinTeam.sqf b/addons/interaction/functions/fnc_joinTeam.sqf index c2a542d4af..9283e7b474 100644 --- a/addons/interaction/functions/fnc_joinTeam.sqf +++ b/addons/interaction/functions/fnc_joinTeam.sqf @@ -1,35 +1,39 @@ /* * Author: commy2 - * Assigns a unit to the team + * Unit joins a fire team. * * Arguments: * 0: Unit * 1: Team * - * Return value: + * Return Value: * None * * Example: - * [target, "YELLOW"] call ace_interaction_fnc_joinTeam + * [player, "YELLOW"] call ace_interaction_fnc_joinTeam * * Public: No */ #include "script_component.hpp" -PARAMS_2(_unit,_team); - -private ["_message"]; +params ["_unit", "_team"]; +// make sure correct team is set on JIP _unit setVariable [QGVAR(assignedFireTeam), _team, true]; -[_unit, format ["{_this assignTeam '%1'}", _team]] call EFUNC(common,execRemoteFnc); +// join fire team on every machine in that group +["assignTeam", units group _unit, [_unit, _team]] call EFUNC(common,targetEvent); + +// display message if (_unit == ACE_player) then { - _message = if (_team == "MAIN") then { - localize LSTRING(LeftTeam); + private "_message"; + + if (_team == "MAIN") then { + _message = localize LSTRING(LeftTeam); } else { _team = localize format [LSTRING(Team%1), _team]; - format [localize LSTRING(JoinedTeam), _team]; + _message = format [localize LSTRING(JoinedTeam), _team]; }; - [_message] call EFUNC(common,displayTextStructured); + ["displayTextStructured", _message] call EFUNC(common,localEvent); }; diff --git a/addons/interaction/functions/fnc_moduleInteraction.sqf b/addons/interaction/functions/fnc_moduleInteraction.sqf index bd02093aa0..425ee9d6e4 100644 --- a/addons/interaction/functions/fnc_moduleInteraction.sqf +++ b/addons/interaction/functions/fnc_moduleInteraction.sqf @@ -1,13 +1,13 @@ /* * Author: bux578 - * Initializes the Interaction module + * Initializes the Interaction module. * * Arguments: * 0: Logic - * 1: ??? + * 1: Units * 2: Activation State * - * Return value: + * Return Value: * None * * Example: @@ -17,13 +17,10 @@ */ #include "script_component.hpp" -private ["_logic", "_activated"]; - -_logic = _this select 0; -_activated = _this select 2; +params ["_logic", "", "_activated"]; if !(_activated) exitWith {}; [_logic, QGVAR(EnableTeamManagement), "EnableTeamManagement"] call EFUNC(common,readSettingFromModule); -diag_log text "[ACE]: Interaction Module Initialized."; +ACE_LOGINFO("Interaction Module Initialized."); diff --git a/addons/interaction/functions/fnc_moveDown.sqf b/addons/interaction/functions/fnc_moveDown.sqf deleted file mode 100644 index 235f12fb1f..0000000000 --- a/addons/interaction/functions/fnc_moveDown.sqf +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Author: Garth de Wet (LH) - * Scrolls through the list down or up - * - * Arguments: - * 0: Amount - * - * Return value: - * None - * - * Example: - * [2] call ace_interaction_fnc_moveDown - * - * Public: No - */ -#include "script_component.hpp" - -private ["_count", "_player", "_vehicle", "_dlgInteractionDialog", "_top", "_i", "", "_ctrl", "_index", "_action", "_color", "_current", "_infoText", "_target"]; - -#define CLAMP(x,low,high) (if(x > high)then{high}else{if(x < low)then{low}else{x}}) -if (isNil QGVAR(MainButton)) exitWith{}; -if (isNil QGVAR(Buttons)) exitWith{}; -_count = (count GVAR(Buttons))- 1; -GVAR(SelectedButton) = CLAMP(GVAR(SelectedButton) + _this, 0, _count); - -_target = GVAR(Target); -_player = ACE_player; -_vehicle = vehicle _player; - -disableSerialization; -_dlgInteractionDialog = uiNamespace getVariable QGVAR(Flow_Display); -_top = GVAR(SelectedButton) - 2; -_i = 0; -while {_i <= 4} do { - _index =_i + _top; - _ctrl = _dlgInteractionDialog displayCtrl (1200 + _i); - if (_index >= 0 && {_index <= _count}) then { - _action = GVAR(Buttons) select _index; - _ctrl ctrlShow true; - _ctrl ctrlSetText (_action select 5); - _color = [1,1,1,1]; - if !([_target, _player] call (_action select 2)) then { - _color = [0.3,0.3,0.3,0.8]; - }; - if (_i == 0 || _i == 4) then { - _color set [3, 0.5]; - }; - if (_i == 1 || _i == 3) then { - _color set [3, 0.75]; - }; - _ctrl ctrlSetTextColor _color; - }else{ - _ctrl ctrlShow false; - }; - _i = _i + 1; -}; - -_ctrl = _dlgInteractionDialog displayCtrl 1000; -_ctrl ctrlSetText ((GVAR(Buttons) select GVAR(SelectedButton)) select 0); -_ctrl = _dlgInteractionDialog displayCtrl 1100; -_current = (GVAR(Buttons) select GVAR(SelectedButton)); -_infoText = ""; -if !([_target, _player] call (_current select 2)) then { - _infoText = "Unavailable"; -}; -_ctrl ctrlSetText _infoText; -_ctrl ctrlShow (_infoText != ""); diff --git a/addons/interaction/functions/fnc_onButtonUp.sqf b/addons/interaction/functions/fnc_onButtonUp.sqf deleted file mode 100644 index da1b55b613..0000000000 --- a/addons/interaction/functions/fnc_onButtonUp.sqf +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Author: commy2 - * On button up - * - * Arguments: - * None - * - * Return value: - * None - * - * Example: - * call ace_interaction_fnc_onButtonUp - * - * Public: No - */ -#include "script_component.hpp" - -private ["_player", "_vehicle", "_target", "_count", "_index", "_action", "_statement", "_condition", "_conditionShow", "_distance"]; - -_player = ACE_player; -_vehicle = vehicle _player; -_target = [GVAR(Target), _player] select (GVAR(MenuType) % 2 == 1); - -_count = count GVAR(Buttons); -_index = call FUNC(getSelectedButton); - -_action = if (_index != -1 && {_index < _count}) then { - GVAR(Buttons) select _index -} else { - ["", {}, {false}, 0, [], "", "", {false}, [], 0] -}; - -(findDisplay 1713999) closeDisplay 1; -closeDialog 0; - - -_statement = _action select 1; -_condition = _action select 2; -_conditionShow = _action select 7; -_distance = _action select 9; - -if ((_distance == 0 || {[GVAR(Target), _distance] call FUNC(isInRange)}) && {[_target, _player] call _condition} && {[_target, _player] call _conditionShow}) then { - [_target, _player] call _statement; -}; diff --git a/addons/interaction/functions/fnc_onClick.sqf b/addons/interaction/functions/fnc_onClick.sqf deleted file mode 100644 index a240823710..0000000000 --- a/addons/interaction/functions/fnc_onClick.sqf +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Author: commy2 - * On click - * - * Arguments: - * Index - * - * Return value: - * None - * - * Example: - * 5 call ace_interaction_fnc_onClick - * - * Public: No - */ -#include "script_component.hpp" -private ["_player", "_vehicle", "_target", "_count", "_index", "_action", "_subMenu", "_statement", "_condition", "_conditionShow", "_distance"]; - -_player = ACE_player; -_vehicle = vehicle _player; -_target = [GVAR(Target), _player] select (GVAR(MenuType) % 2 == 1); - -_count = count GVAR(Buttons); -_index = _this; - -_action = if (_index != -1 && {_index < _count}) then { - GVAR(Buttons) select _index -} else { - ["", {}, {false}, 0, [], "", "", {false}, [], 0] -}; - -_subMenu = _action select 4; - -// back -if (_index == -1) exitWith { - call GVAR(MainButton); -}; - -if (count _subMenu < 2) then { - (findDisplay 1713999) closeDisplay 1; - closeDialog 0; - - _statement = _action select 1; - _condition = _action select 2; - _conditionShow = _action select 7; - _distance = _action select 9; - - if ((_distance == 0 || {[GVAR(Target), _distance] call FUNC(isInRange)}) && {[_target, _player] call _condition} && {[_target, _player] call _conditionShow}) then { - [_target, _player] call _statement; - }; -} else { - if (_subMenu select 1 < 1) then { - [_subMenu select 0] call FUNC(openSubMenu); - } else { - [_subMenu select 0] call FUNC(openSubMenuSelf); - }; -}; diff --git a/addons/interaction/functions/fnc_onSelectMenuDblClick.sqf b/addons/interaction/functions/fnc_onSelectMenuDblClick.sqf deleted file mode 100644 index 18b69ba40d..0000000000 --- a/addons/interaction/functions/fnc_onSelectMenuDblClick.sqf +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Author: CorruptedHeart, commy2 - * On select menu double click - * - * Arguments: - * None - * - * Return value: - * None - * - * Example: - * call ace_interaction_fnc_onSelectMenuDblClick - * - * Public: No - */ -#include "script_component.hpp" - -call compile (lbData [8866, lbCurSel 8866]) call GVAR(SelectAccept); diff --git a/addons/interaction/functions/fnc_openDoor.sqf b/addons/interaction/functions/fnc_openDoor.sqf index db808e2eba..b2249d1589 100644 --- a/addons/interaction/functions/fnc_openDoor.sqf +++ b/addons/interaction/functions/fnc_openDoor.sqf @@ -1,12 +1,12 @@ /* * Author: commy2 - * Opens door + * Open door. * * Arguments: * 0: House * 1: Door * - * Return value: + * Return Value: * None * * Example: @@ -16,56 +16,56 @@ */ #include "script_component.hpp" -private ["_info", "_phase", "_position", "_time", "_usedMouseWheel", "_getDoorAnimations"]; +private "_info"; +_info = [MACRO_DOOR_REACH_DISTANCE] call FUNC(getDoor); -_info = [2] call FUNC(getDoor); - -EXPLODE_2_PVT(_info,_house,_door); +_info params ["_house", "_door"]; if (isNull _house) exitWith {}; +private "_getDoorAnimations"; _getDoorAnimations = [_house, _door] call FUNC(getDoorAnimations); -EXPLODE_2_PVT(_getDoorAnimations,_animations,_lockedVariable); +_getDoorAnimations params ["_animations", "_lockedVariable"]; -if (count _animations == 0) exitWith {}; +if (_animations isEqualTo []) exitWith {}; if (_house animationPhase (_animations select 0) <= 0 && {_house getVariable [_lockedVariable select 0, 0] == 1}) exitWith { _lockedVariable set [0, _house]; - _lockedVariable spawn compile preprocessFileLineNumbers "\A3\Structures_F\scripts\LockedDoor_open.sqf"; + _lockedVariable call BIS_fnc_LockedDoorOpen; }; +playSound "ACE_Sound_Click"; // @todo replace with smth. more fitting + +GVAR(doorTargetPhase) = _house animationPhase (_animations select 0); GVAR(isOpeningDoor) = true; -playSound "ACE_Sound_Click"; +GVAR(usedScrollWheel) = false; -[_house, _animations] spawn { - private ["_house", "_animations", "_phase", "_position", "_time", "_usedMouseWheel"]; - _house = _this select 0; - _animations = _this select 1; +[{ + (_this select 0) params ["_house", "_animations", "_position", "_time", "_frame"]; - _phase = _house animationPhase (_animations select 0); - _position = getPosASL ACE_player; + if !(GVAR(isOpeningDoor)) exitWith { + [_this select 1] call CBA_fnc_removePerFrameHandler; - _time = ACE_time + 0.2; - _usedMouseWheel = false; - waitUntil { - if (inputAction "PrevAction" > 0 || {inputAction "NextAction" > 0}) then { - _usedMouseWheel = true; + // didn't use incremental opening. Just do animation normally. + if !(GVAR(usedScrollWheel)) then { + private "_phase"; + _phase = [0, 1] select (_house animationPhase (_animations select 0) < 0.5); + + {_house animate [_x, _phase]; false} count _animations; }; - - _phase = _phase + (inputAction "PrevAction" / 12) min 1; - _phase = _phase - (inputAction "NextAction" / 12) max 0; - - {_house animate [_x, _phase]} forEach _animations; - - !GVAR(isOpeningDoor) || {getPosASL ACE_player distance _position > 1} }; - if (!_usedMouseWheel && {ACE_time < _time} && {[ACE_player, objNull, []] call EFUNC(common,canInteractWith)}) then { - _phase = [0, 1] select (_house animationPhase (_animations select 0) < 0.5); - - {_house animate [_x, _phase]} forEach _animations; + // check if player moved too far away + if (getPosASL ACE_player distance _position > 1) exitWith { + GVAR(isOpeningDoor) = false; }; - GVAR(isOpeningDoor) = false; -}; + // this allows for holding the door in it's current state. + if (ACE_time > _time && {diag_frameno > _frame}) then { + GVAR(usedScrollWheel) = true; + }; + + // do incremental door opening + {_house animate [_x, GVAR(doorTargetPhase)]; false} count _animations; +}, 0.1, [_house, _animations, getPosASL ACE_player, ACE_time + 0.2, diag_frameno + 2]] call CBA_fnc_addPerFrameHandler; diff --git a/addons/interaction/functions/fnc_openMenuSelectUI.sqf b/addons/interaction/functions/fnc_openMenuSelectUI.sqf deleted file mode 100644 index 6141e839b8..0000000000 --- a/addons/interaction/functions/fnc_openMenuSelectUI.sqf +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Author: commy2 - * Opens menu select UI - * - * Arguments: - * 0: Unit - * 1: Vehicle - * - * Return value: - * None - * - * Example: - * [unit, vehicle] call ace_interaction_fnc_openMenuSelectUI - * - * Public: No - */ -#include "script_component.hpp" - -PARAMS_2(_unit,_vehicle); - -private ["_cargo", "_actions"]; - -// Allow interaction with all cargo slots and all FFV slots -_cargo = [_vehicle, ["cargo", "ffv"], true] call EFUNC(common,getVehicleCrew); - -// You can only interact if you are in cargo or FFV yourself. exit otherwise -if !(_unit in _cargo) exitWith {}; - -GVAR(InteractionMenu_Crew) = _cargo; - -// Prepare: add header and "OK" button to select menu -_actions = [localize LSTRING(InteractionMenu), localize LSTRING(Interact)] call FUNC(prepareSelectMenu); - -// Prepare: add all cargo units as options to select menu -{ - if (_x != _unit) then { - _actions = [ - _actions, - [_x] call EFUNC(common,getName), - QUOTE(PATHTOF(UI\dot_ca.paa)), - _forEachIndex - ] call FUNC(addSelectableItem); - }; -} forEach _cargo; - -// Open select menu -[ - _actions, - { - call FUNC(hideMenu); - [0, GVAR(InteractionMenu_Crew) select _this, ""] spawn FUNC(showMenu); - GVAR(InteractionMenu_Crew) = nil; - }, - { - call FUNC(hideMenu); - } -] call FUNC(openSelectMenu); diff --git a/addons/interaction/functions/fnc_openSelectMenu.sqf b/addons/interaction/functions/fnc_openSelectMenu.sqf deleted file mode 100644 index 6e42d3af47..0000000000 --- a/addons/interaction/functions/fnc_openSelectMenu.sqf +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Author: Garth de Wet (LH) - * Opens the select menu UI and sets up the UI - * - * Arguments: - * 0: Items - * 0: Text - * 1: Statement to execute - * 2: Condition before execute - * 3: showDisabled - * 4: Priority - * 5: Icon - * 6: Extra variables passed to the code - * 1: Select Action - * 2: Cancel Action - * - * Return value: - * None - * - * Example: - * [["text", {statement}, {condition}, showDisabled, priority, "icon", [variables]], {selectAction}, {cancelAction}] call ace_interaction_fnc_openSelectMenu - * - * Public: No - */ -#include "script_component.hpp" - -private["_action", "_count", "_customActions", "_i"]; - -if (!(profileNamespace getVariable [QGVAR(FlowMenu), false])) then { - GVAR(SelectAccept) = _this select 1; - GVAR(SelectCancel) = _this select 2; - buttonSetAction [8855, QUOTE( call GVAR(SelectCancel); )]; // Cancel - buttonSetAction [8860, QUOTE( (call compile (lbData [ARR_2(8866, lbCurSel 8866)])) call GVAR(SelectAccept); )]; // Accept - lbSetCurSel [8866, 0]; -}else{ - PARAMS_1(_customActions); - - private ["_count", "_action"]; - - _count = count _customActions; - if (_count == 0) exitWith {}; - _customActions call FUNC(sortOptionsByPriority); - for "_i" from 0 to _count -1 do { - _action = _customActions select _i; - _action set [1, (_this select 1)]; - }; - GVAR(Buttons) = _customActions; - [(_this select 2), true, true, false, ACE_player] call FUNC(initialiseInteraction); -}; diff --git a/addons/interaction/functions/fnc_pardon.sqf b/addons/interaction/functions/fnc_pardon.sqf new file mode 100644 index 0000000000..00fe2f6d17 --- /dev/null +++ b/addons/interaction/functions/fnc_pardon.sqf @@ -0,0 +1,18 @@ +/* + * Author: commy2 + * Unit pardons target unit. + * + * Arguments: + * 0: Unit + * 1: Target + * + * Return Value: + * None + * + * Public: No + */ +#include "script_component.hpp" + +params ["", "_target"]; + +["pardon", [_target], [_target]] call EFUNC(common,targetEvent); diff --git a/addons/interaction/functions/fnc_prepareSelectMenu.sqf b/addons/interaction/functions/fnc_prepareSelectMenu.sqf deleted file mode 100644 index f42d95b75b..0000000000 --- a/addons/interaction/functions/fnc_prepareSelectMenu.sqf +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Author: Garth de Wet (LH) - * Prepares the select menu for use - * - * Arguments: - * 0: Header Text - * 1: Approve Button Text - * - * Return value: - * Container object - * - * Example: - * array = ["Select Explosive", "Place"] call ace_interaction_fnc_prepareSelectMenu - * - * Public: No - */ -#include "script_component.hpp" - -PARAMS_2(_header,_buttonText); - -closeDialog 0; - -if (isNil "_buttonText" or {_buttonText == ""}) then { - _buttonText = localize LSTRING(MakeSelection); -}; - -createDialog "RscACE_SelectAnItem"; -ctrlSetText [8860, _buttonText]; -ctrlSetText [8870, _header]; - -lbClear 8866; - -8866 diff --git a/addons/interaction/functions/fnc_push.sqf b/addons/interaction/functions/fnc_push.sqf index 946a5118be..9a6c86a18e 100644 --- a/addons/interaction/functions/fnc_push.sqf +++ b/addons/interaction/functions/fnc_push.sqf @@ -4,23 +4,23 @@ * * Arguments: * 0: Boat - * 1: Velocity + * 1: Unit * * Return Value: * None * * Example: - * [target, [vector]] call ace_interaction_fnc_push + * [Boats, Jose] call ace_interaction_fnc_push * * Public: No */ - #include "script_component.hpp" -PARAMS_2(_boat,_velocity); +params ["_boat", "_unit"]; -if !(local _boat) exitWith { - [_this, QUOTE(FUNC(push)), _boat] call EFUNC(common,execRemoteFnc); -}; +private "_newVelocity"; +_newVelocity = vectorDir _unit; +_newVelocity set [2, 0.25]; +_newVelocity = _newVelocity vectorMultiply 2; -_boat setVelocity _velocity; +["setVelocity", [_boat], [_boat, _newVelocity]] call EFUNC(common,targetEvent); diff --git a/addons/interaction/functions/fnc_sendAway.sqf b/addons/interaction/functions/fnc_sendAway.sqf index 0dd106de08..546ab9ba3f 100644 --- a/addons/interaction/functions/fnc_sendAway.sqf +++ b/addons/interaction/functions/fnc_sendAway.sqf @@ -1,40 +1,37 @@ /* - * Author: KoffeinFlummi - * Sends a civilian crowd away with a chance of failure + * Author: KoffeinFlummi, commy2 + * Sends a near civilian crowd away with a chance of failure. * * Arguments: * 0: Unit * - * Return value: + * Return Value: * None * * Example: - * [target] call ace_interaction_fnc_sendAway + * [civillian] call ace_interaction_fnc_sendAway * * Public: No */ #include "script_component.hpp" -#define DISTANCE 50 -#define RADIUS 10 +#define SEND_DISTANCE 50 +#define SEND_RADIUS 10 -PARAMS_1(_unit); +params ["_unit"]; -private ["_chance", "_x"]; +_unit playActionNow "GestureGo"; -ACE_player playActionNow "GestureGo"; - -if (count weapons ACE_player > 0) then { - _chance = 0.8; -} else { - _chance = 0.5; -}; +private "_chance"; +_chance = [0.5, 0.8] select (count weapons _unit > 0); { - if (count (weapons _unit) == 0 and random 1 < _chance) then { - [-2, { - (_this select 0) setUnitPos "AUTO"; - (_this select 0) doMove [(getPos (_this select 0) select 0) + DISTANCE * (eyeDirection (_this select 1) select 0), (getPos (_this select 0) select 1) + DISTANCE * (eyeDirection (_this select 1) select 1), 0]; - }, [_x, ACE_player]] call CBA_fnc_globalExecute; + if (count weapons _x == 0 && {random 1 < _chance}) then { + private "_position"; + _position = getPosASL _unit vectorAdd (eyeDirection _unit vectorMultiply SEND_DISTANCE); + _position set [2, 0]; + + ["sendAway", [_x], [_x, _position]] call EFUNC(common,targetEvent); }; -} forEach (_unit nearEntities ["Civilian", RADIUS]); + false +} count (_unit nearEntities ["Civilian", SEND_RADIUS]); diff --git a/addons/interaction/functions/fnc_showMouseHint.sqf b/addons/interaction/functions/fnc_showMouseHint.sqf index e3a9b45f94..e8f279cc0c 100644 --- a/addons/interaction/functions/fnc_showMouseHint.sqf +++ b/addons/interaction/functions/fnc_showMouseHint.sqf @@ -20,18 +20,16 @@ #define GUI_GRID_W (0.025) #define GUI_GRID_H (0.04) -private ["_scroll", "_display"]; +params ["_leftClick", "_rightClick", ["_scroll", ""]]; -PARAMS_2(_leftClick,_rightClick); -_scroll = ""; -if (count _this > 2) then { - _scroll = _this select 2; -}; +(QGVAR(InteractionHelper) call BIS_fnc_rscLayer) cutRsc [QGVAR(InteractionHelper), "PLAIN", 0.5, false]; -(QGVAR(InteractionHelper) call BIS_fnc_rscLayer) cutRsc [QGVAR(InteractionHelper), "PLAIN",0.5, false]; disableSerialization; + +private "_display"; _display = uiNamespace getVariable ["ACE_Helper_Display", objNull]; -if (isNull _display) exitWith{}; + +if (isNull _display) exitWith {}; (_display displayCtrl 1000) ctrlSetText _leftClick; (_display displayCtrl 1001) ctrlSetText _rightClick; @@ -44,10 +42,12 @@ if (isNull _display) exitWith{}; if (_scroll == "") exitWith { (_display displayCtrl 1002) ctrlShow false; (_display displayCtrl 1202) ctrlShow false; - (_display displayCtrl 1001) ctrlSetPosition [21 * GUI_GRID_W, 18 * GUI_GRID_H, 8 * GUI_GRID_W, 1.5 * GUI_GRID_H]; - (_display displayCtrl 1201) ctrlSetPosition [20 * GUI_GRID_W, 18.5 * GUI_GRID_H, 1 * GUI_GRID_W, 1 * GUI_GRID_H]; + (_display displayCtrl 1001) ctrlSetPosition [21 * GUI_GRID_W, 18 * GUI_GRID_H, 24 * GUI_GRID_W, 1.5 * GUI_GRID_H]; + (_display displayCtrl 1201) ctrlSetPosition [20 * GUI_GRID_W, 18.5 * GUI_GRID_H, 1.5 * GUI_GRID_W, 1 * GUI_GRID_H]; (_display displayCtrl 1001) ctrlCommit 0; (_display displayCtrl 1201) ctrlCommit 0; }; + (_display displayCtrl 1002) ctrlSetText _scroll; + showHUD false; diff --git a/addons/interaction/functions/fnc_sortOptionsByPriority.sqf b/addons/interaction/functions/fnc_sortOptionsByPriority.sqf deleted file mode 100644 index 05a4f3bad4..0000000000 --- a/addons/interaction/functions/fnc_sortOptionsByPriority.sqf +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Author: commy2 - * Sort options by priority - * - * Arguments: - * Actions - * - * Return value: - * None - * - * Example: - * customActions call ace_interaction_fnc_sortOptionsByPriority - * - * Public: No - */ -#include "script_component.hpp" - -private ["_actions", "_count", "_index", "_actionN", "_actionM"]; - -_actions = _this; -_count = count _actions; -_index = 0; - -while {_index < _count - 1} do { - _actionN = + _actions select _index; - _actionM = + _actions select (_index + 1); - - if (_actionN select 3 < _actionM select 3) then { - _actions set [_index, _actionM]; - _actions set [_index + 1, _actionN]; - _index = 0; - } else { - _index = _index + 1; - }; -}; diff --git a/addons/interaction/functions/fnc_tapShoulder.sqf b/addons/interaction/functions/fnc_tapShoulder.sqf index b8bb591c6d..2061f1806f 100644 --- a/addons/interaction/functions/fnc_tapShoulder.sqf +++ b/addons/interaction/functions/fnc_tapShoulder.sqf @@ -3,38 +3,26 @@ * Taps a shoulder * * Arguments: - * 0: Player + * 0: Unit * 1: Target - * 2: Shoulder which was tapped + * 2: Shoulder which was tapped [0: left, 1: right] * - * Return value: + * Return Value: * None * * Example: - * [player, target] call ace_interaction_fnc_tapShoulder + * [player, target, 0] call ace_interaction_fnc_tapShoulder * * Public: No */ #include "script_component.hpp" -PARAMS_3(_tapper,_target,_shoulderNum); +params ["_unit", "_target", "_shoulderNum"]; -if (_target != ACE_player) exitWith { +if (_unit == ACE_player) then { addCamShake [4, 0.5, 5]; - ACE_player playActionNow "PutDown"; - if !(local _target) then { - [[_tapper, _target, _shoulderNum], QUOTE(DFUNC(tapShoulder)), _target] call EFUNC(common,execRemoteFnc); - }; }; -addCamShake [4, 0.5, 5]; +_unit playActionNow "PutDown"; -private ["_message"]; -//localize is converting the escaped <> symbols, so just add them here instead of in the stringtable -if (_shoulderNum == 0) then { - _message = format ["%1 >", (localize LSTRING(YouWereTappedRight))]; -} else { - _message = format ["< %1", (localize LSTRING(YouWereTappedLeft))]; -}; - -[parseText _message] call EFUNC(common,displayTextStructured); +["tapShoulder", [_target], [_target, _shoulderNum]] call EFUNC(common,targetEvent); diff --git a/addons/interaction/functions/fnc_updateTooltipPosition.sqf b/addons/interaction/functions/fnc_updateTooltipPosition.sqf deleted file mode 100644 index 93acd6d203..0000000000 --- a/addons/interaction/functions/fnc_updateTooltipPosition.sqf +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Author: commy2 - * Updates tooltip's position - * - * Arguments: - * 0: Tooltip Display - * 1: X Coordinate - * 2: Y Coordinate - * - * Return value: - * None - * - * Example: - * [player, 0.5, 0.5] call ace_interaction_fnc_updateTooltipPosition - * - * Public: No - */ -#include "script_component.hpp" - -PARAMS_3(_tooltip,_coordinateX,_coordinateY); - -private["_ctrl"]; - -disableSerialization; -_ctrl = ctrlParent _tooltip displayCtrl 40; - -_ctrl ctrlSetPosition [ - _coordinateX + 0.01 * safezoneW, - _coordinateY + 0.01 * safezoneH, - 2.0 / 16 * safezoneW, - 0.3 / 9 * safezoneH -]; -_ctrl ctrlCommit 0; diff --git a/addons/interaction/script_component.hpp b/addons/interaction/script_component.hpp index 68f22e96d7..d668387bb9 100644 --- a/addons/interaction/script_component.hpp +++ b/addons/interaction/script_component.hpp @@ -9,4 +9,6 @@ #define DEBUG_SETTINGS DEBUG_SETTINGS_INTERACTION #endif -#include "\z\ace\addons\main\script_macros.hpp" \ No newline at end of file +#include "\z\ace\addons\main\script_macros.hpp" + +#define MACRO_DOOR_REACH_DISTANCE (AGLToASL positionCameraToWorld [0,0,0] vectorDistance AGLToASL (ACE_player modelToWorld (ACE_player selectionPosition "Head"))) + 2 diff --git a/addons/interaction/stringtable.xml b/addons/interaction/stringtable.xml index 4f1df733b7..13383f8088 100644 --- a/addons/interaction/stringtable.xml +++ b/addons/interaction/stringtable.xml @@ -486,7 +486,7 @@ Gruppenverwaltung Gestión de equipo Gestion d'équipe - Zarządzanie oddziałem + Drużyna Správa týmu Управление группой Gerenciamento de Equipe @@ -774,6 +774,10 @@ Otwórz Otevřít Abrir + Ouvrir + Nyitás + Abrir + Открыть Interaction System @@ -781,7 +785,10 @@ Sistema de interacción Interaktionssystem Systém interakce - Sistema de interação + Взаимодействие + Système d'interaction + Interakciós rendszer + Sistema de interação Enable Team Management @@ -789,7 +796,10 @@ Habilitar gestión de equipos Aktiviere Gruppenverwaltung Povolit správu týmu - Habilitar gestão de equipes + Управление группами + Active la gestion d'équipe + Csapatkezelés engedélyezése + Habilitar gestão de equipes Should players be allowed to use the Team Management Menu? Default: Yes @@ -797,15 +807,21 @@ ¿Deben tener permitido los jugadores el uso del menu de gestión de equipos? Por defecto: Si Sollen Spieler das Gruppenverwaltungsmenü verwenden dürfen? Standard: Ja Mohou hráči použít menu správy týmu? Výchozí: Ano - Devem os jogadores ter permissão de usar o menu de gestão de equipes? Padrão: Sim + Разрешить ли игрокам использовать меню управления группами? По-умолчани: Да + Permettre aux joueurs d'utiliser la gestion de groupe? Défaut: oui + A játékosoknak engedélyezve legyen a csapatkezelő menü? Alapértelmezett: Igen + Devem os jogadores ter permissão de usar o menu de gestão de equipes? Padrão: Sim Team management allows color allocation for team members, taking team command and joining/leaving teams. Na zarządzanie drużyną składa się: przydział kolorów dla członków drużyny, przejmowanie dowodzenia, dołączanie/opuszczanie drużyn. Die Gruppenverwaltung erlaubt die Zuweisung von Farben für Einheiten, die Kommandierung und das Beitreten/Verlassen einer Gruppe. Správa týmu se skládá z: přidělení barev pro členy týmu, převzetí velení, připojení/odpojení. - O módulo de gestão de equipe é composto por: a atribuição de cores para os membros da equipe, comando das equipes, juntando-se / deixando equipes. La gestión del equipo permite la asignación de colores para los miembros del equipo, tomando el mando del equipo y uniendo/dejando equipos. + La gestion d'équipe permet l'allocation de couleur aux membres d'équipe, de prendre le commandement, de rejoindre ou quitter une équipe. + A csapatkezelés engedélyezi a tagok színének meghatározását, a vezetés átvételét, és csapatoknál be-és kilépést. + O módulo de gestão de equipe é composto por: a atribuição de cores para os membros da equipe, comando das equipes, juntando-se / deixando equipes. + Управление группами позволяет назначать цвета членам групп, брать командование, вступать в группы или покидать их. - \ No newline at end of file + diff --git a/addons/inventory/README.md b/addons/inventory/README.md index 1e41aa4a8b..7d644143cf 100644 --- a/addons/inventory/README.md +++ b/addons/inventory/README.md @@ -1,7 +1,7 @@ ace_inventory ============= -Increases the size of the inventory dialog. +Adds options to increase the size of the inventory dialog. ## Maintainers diff --git a/addons/inventory/stringtable.xml b/addons/inventory/stringtable.xml index 8272594df5..04cac46b87 100644 --- a/addons/inventory/stringtable.xml +++ b/addons/inventory/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -26,4 +26,4 @@ Normalmente o tamanho da tela do inventário é ditada pelo tamanho da UI. Isso permite aumentar o tamanho da tela de inventário, mas não aumenta o tamanho da fonte, permitindo que mais linhas sejam visualizadas. - \ No newline at end of file + diff --git a/addons/javelin/stringtable.xml b/addons/javelin/stringtable.xml index e826263100..385abf586e 100644 --- a/addons/javelin/stringtable.xml +++ b/addons/javelin/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -26,4 +26,4 @@ Alterar Modo de Disparo - \ No newline at end of file + diff --git a/addons/kestrel4500/README.md b/addons/kestrel4500/README.md index 36a324beb9..c0b50a3555 100644 --- a/addons/kestrel4500/README.md +++ b/addons/kestrel4500/README.md @@ -1,10 +1,11 @@ ace_kestrel4500 =============== -Kestrel 4500 Pocket Weather Tracker +Adds Kestrel 4500 Pocket Weather Tracker. + ## Maintainers The people responsible for merging changes to this component or answering potential questions. -- [Ruthberg] (http://github.com/Ulteq) \ No newline at end of file +- [Ruthberg](http://github.com/Ulteq) diff --git a/addons/laser/functions/fnc_drawVisibleLaserTargets.sqf b/addons/laser/functions/fnc_drawVisibleLaserTargets.sqf index 10d5f1e1b6..8cdb497267 100644 --- a/addons/laser/functions/fnc_drawVisibleLaserTargets.sqf +++ b/addons/laser/functions/fnc_drawVisibleLaserTargets.sqf @@ -1,9 +1,9 @@ // This is a debug function for displaying visible lasers for ourselves #include "script_component.hpp" -diag_log text format["[ACE]: Laser Emitter Dump"]; +ACE_LOGINFO("Laser Emitter Dump"); -{ - diag_log text format[" %1", _x]; - diag_log text format[" %2", HASH_GET(GVAR(laserEmitters), _x)]; -} forEach GVAR(laserEmitters) select 0; \ No newline at end of file +{ + ACE_LOGINFO_1(" %1", _x); + ACE_LOGINFO_1(" %1",HASH_GET(GVAR(laserEmitters),_x)); +} forEach GVAR(laserEmitters) select 0; diff --git a/addons/laser/initKeybinds.sqf b/addons/laser/initKeybinds.sqf index 5e3d017103..25fdd2ddcc 100644 --- a/addons/laser/initKeybinds.sqf +++ b/addons/laser/initKeybinds.sqf @@ -1,9 +1,9 @@ ["ACE3 Equipment", QGVAR(LaserCodeUp), localize LSTRING(laserCodeUp), { - if( EGVAR(laser_selfdesignate,active) - || + if( EGVAR(laser_selfdesignate,active) + || { (currentWeapon ACE_player) == "Laserdesignator" && (call CBA_fnc_getFoV) select 1 > 5 } // If laserdesignator & FOV, we are in scope. - || + || { [ACE_player] call FUNC(unitTurretCanLockLaser) } ) then { [] call FUNC(keyLaserCodeUp); @@ -14,14 +14,14 @@ ["ACE3 Equipment", QGVAR(LaserCodeDown), localize LSTRING(laserCodeDown), { - if( EGVAR(laser_selfdesignate,active) - || + if( EGVAR(laser_selfdesignate,active) + || { (currentWeapon ACE_player) == "Laserdesignator" && (call CBA_fnc_getFoV) select 1 > 5 } // If laserdesignator & FOV, we are in scope. - || + || { [ACE_player] call FUNC(unitTurretCanLockLaser) } ) then { [] call FUNC(keyLaserCodeDown); }; }, {false}, -[18, [true, true, true]], false, 0] call CBA_fnc_addKeybind; // (ALT+CTRL+E) +[18, [false, true, true]], false, 0] call CBA_fnc_addKeybind; // (ALT+CTRL+E) diff --git a/addons/laserpointer/CfgJointRails.hpp b/addons/laserpointer/CfgJointRails.hpp new file mode 100644 index 0000000000..7583bd03b5 --- /dev/null +++ b/addons/laserpointer/CfgJointRails.hpp @@ -0,0 +1,8 @@ +class asdg_SlotInfo; +class asdg_FrontSideRail: asdg_SlotInfo { + class compatibleItems { + ACE_acc_pointer_red = 1; + ACE_acc_pointer_green = 1; + ACE_acc_pointer_green_IR = 1; + }; +}; diff --git a/addons/laserpointer/XEH_postInit.sqf b/addons/laserpointer/XEH_postInit.sqf index 133931578a..c478fe33fd 100644 --- a/addons/laserpointer/XEH_postInit.sqf +++ b/addons/laserpointer/XEH_postInit.sqf @@ -4,13 +4,7 @@ // fixes laser when being captured. Needed, because the selectionPosition of the right hand is used ["SetHandcuffed", {if (_this select 1) then {(_this select 0) action ["GunLightOff", _this select 0]};}] call EFUNC(common,addEventHandler); -//If user has ASDG JR without the compat patch, then ace's' laser pointers won't be compatible with anything -if ((isClass (configFile >> "CfgPatches" >> "asdg_jointrails")) && {!(isClass (configFile >> "CfgPatches" >> "ace_asdg_comp"))}) then { - diag_log text format ["[ACE_laserpointer] - ASDG Joint Rails but no ace_asdg_comp"]; -}; - - -if !(hasInterface) exitWith {}; +if (!hasInterface) exitWith {}; GVAR(nearUnits) = []; @@ -32,7 +26,7 @@ GVAR(nearUnits) = []; } forEach nearestObjects [positionCameraToWorld [0,0,0], ["AllVehicles"], 50]; // when moving this, search also for units inside vehicles. currently breaks the laser in FFV GVAR(nearUnits) = _nearUnits; - + } , 5, []] call CBA_fnc_addPerFrameHandler; addMissionEventHandler ["Draw3D", { diff --git a/addons/laserpointer/config.cpp b/addons/laserpointer/config.cpp index d368512257..cbb3105696 100644 --- a/addons/laserpointer/config.cpp +++ b/addons/laserpointer/config.cpp @@ -16,3 +16,4 @@ class CfgPatches { #include "CfgEventHandlers.hpp" #include "CfgVehicles.hpp" #include "CfgWeapons.hpp" +#include "CfgJointRails.hpp" diff --git a/addons/laserpointer/functions/fnc_drawLaserpoint.sqf b/addons/laserpointer/functions/fnc_drawLaserpoint.sqf index e69fc5e271..34ca98808b 100644 --- a/addons/laserpointer/functions/fnc_drawLaserpoint.sqf +++ b/addons/laserpointer/functions/fnc_drawLaserpoint.sqf @@ -1,30 +1,11 @@ // by commy2 and esteldunedain #include "script_component.hpp" -private ["_p0", "_p1", "_p0Pos", "_offV1", "_offV2", "_offV3", "_camPos", "_intermediatePos", "_iteration", "_light", "_line", "_pL", "_pL2", "_pX", "_size", "_units", "_fnc_getDistanceToTerrain", "_fnc_doesIntersectWithMan"]; +params ["_unit", "_range", "_isGreen", "_brightness"]; -// init object -/*if (isNil QGVAR(laserdot)) then { - _light = "#lightpoint" createVehicleLocal [0,0,0]; - _light setLightBrightness 10; - _light setLightColor [1,0,0]; - _light setLightAmbient [1,0,0]; - _light setLightDayLight true; - //_light lightAttachObject [GVAR(laserdot), [0,0,0]]; - _light setLightAttenuation [0.04,4,4,0,0.04,0.08]; +private ["_p0", "_v1", "_v2", "_v3", "_p1", "_pL", "_distance", "_pL2", "_camPos", "_size"]; - GVAR(laserdot) = _light; -};*/ - -EXPLODE_4_PVT(_this,_unit,_range,_isGreen,_brightness); - -_p0Pos = _unit modelToWorldVisual (_unit selectionPosition "righthand"); - -// Convert _p0Pos to ASL -_p0 = + _p0Pos; -if (!surfaceIsWater _p0) then { - _p0 = ATLtoASL _p0; -}; +_p0 = AGLToASL (_unit modelToWorldVisual (_unit selectionPosition "righthand")); // Find a system of orthogonal reference vectors // _v1 points in the direction of the weapon @@ -36,68 +17,22 @@ _v3 = _v2 vectorCrossProduct _v1; // Offset over the 3 reference axis // This offset could eventually be configured by weapon in the config -_offV1 = 0.31; -_offV2 = 0; -_offV3 = 0.08; +#define OFFV1 0.31 +#define OFFV2 0 +#define OFFV3 0.08 // Offset _p0, the start of the laser -_p0 = _p0 vectorAdd (_v1 vectorMultiply _offV1) vectorAdd (_v3 vectorMultiply _offV3) vectorAdd (_v2 vectorMultiply _offV2); -_p0Pos = _p0Pos vectorAdd (_v1 vectorMultiply _offV1) vectorAdd (_v3 vectorMultiply _offV3) vectorAdd (_v2 vectorMultiply _offV2); +_p0 = _p0 vectorAdd (_v1 vectorMultiply OFFV1) vectorAdd (_v3 vectorMultiply OFFV3) vectorAdd (_v2 vectorMultiply OFFV2); + // Calculate _p1, the potential end of the laser _p1 = _p0 vectorAdd (_v1 vectorMultiply _range); -//Debugaaa = lineIntersectsObjs [_p0, _p1, objNull, _unit, false, 2]; +_pL = lineIntersectsSurfaces [_p0, _p1, ACE_player, vehicle ACE_player, true, 1, "GEOM", "FIRE"] select 0 select 0; -_fnc_getDistanceToTerrain = { - private ["_distance"]; +// no intersection found, quit +if (isNil "_pL") exitWith {}; - _pX = + _p0; - _line = [_p0, _pX]; - - _distance = _this; - _iteration = _distance; - - while {_iteration > 0.05 / 2} do { - _iteration = _iteration / 2; - - _pX = _p0 vectorAdd (_v1 vectorMultiply _distance); - - _line set [1, _pX]; - - _distance = _distance + (([1, -1] select (lineIntersects (_line + [_unit]) || {terrainIntersectASL _line})) * _iteration); - - if (_distance > _this) exitWith {_distance = _this}; - }; - - _distance -}; - -// Get distance to nearest object or terrain (excluding men) -_distance = _range call _fnc_getDistanceToTerrain; - -// Find all men potentially intercepted by the ray -_intermediatePos = _p0 vectorAdd (_v1 vectorMultiply _distance/2); -if (!surfaceIsWater _intermediatePos) then { - _intermediatePos = ASLtoATL _intermediatePos; -}; -_units = nearestObjects [_intermediatePos, ["Man"], _distance/2]; - -_units deleteAt (_units find _unit); - -_fnc_doesIntersectWithMan = { - _pX = _p0 vectorAdd (_v1 vectorMultiply (_this select 1)); - if (!surfaceIsWater _pX) then { - _pX = ASLtoATL _pX; - }; - count ([_this select 0, "FIRE"] intersect [_p0Pos, _pX]) > 0 -}; - -// Test intersection with nearby men -{ - if ([_x, _distance] call _fnc_doesIntersectWithMan) then { - _distance = _distance min ((_unit distance _x) - _offV1); - }; -} forEach _units; +_distance = _p0 vectorDistance _pL; //systemChat str _distance; if (_distance < 0.5) exitWith {}; @@ -105,31 +40,29 @@ if (_distance < 0.5) exitWith {}; _pL = _p0 vectorAdd (_v1 vectorMultiply _distance); _pL2 = _p0 vectorAdd (_v1 vectorMultiply (_distance - 0.5)); -// Convert _pL to pos -if (!surfaceIsWater _pL) then { - _pL = ASLtoATL _pL; -}; +_pL = ASLtoAGL _pL; /* drawLine3D [ - _p0Pos, + _p0, _pL, [[1,0,0,1], [0,1,0,1]] select _isGreen ]; */ -_size = 2 * (_range - (positionCameraToWorld [0,0,0] vectorDistance _pL)) / _range; +//systemChat str [_unit, "FIRE"] intersect [_camPos, _pL]; _camPos = positionCameraToWorld [0,0,0.2]; if (count ([_unit, "FIRE"] intersect [_camPos, _pL]) > 0) exitWith {}; if (count ([ACE_player, "FIRE"] intersect [_camPos, _pL]) > 0) exitWith {}; // Convert _camPos to ASL -if (!surfaceIsWater _camPos) then { _camPos = ATLtoASL _camPos; }; +_camPos = AGLToASL _camPos; + if ( terrainIntersectASL [_camPos, _pL2]) exitWith {}; if ( lineIntersects [_camPos, _pL2]) exitWith {}; -//GVAR(laserdot) setPos _pL; +_size = 2 * (_range - (positionCameraToWorld [0,0,0] vectorDistance _pL)) / _range; drawIcon3D [ format ["\a3\weapons_f\acc\data\collimdot_%1_ca.paa", ["red", "green"] select _isGreen], diff --git a/addons/laserpointer/functions/fnc_onDraw.sqf b/addons/laserpointer/functions/fnc_onDraw.sqf index 09663f9ecf..9e61e70156 100644 --- a/addons/laserpointer/functions/fnc_onDraw.sqf +++ b/addons/laserpointer/functions/fnc_onDraw.sqf @@ -35,7 +35,7 @@ _brightness = 2 - call EFUNC(common,ambientBrightness); }; if (_laserID > 0 && {_x isFlashlightOn _weapon}) then { - [_x, 50, (_laserID == 2 || _isIR), _brightness] call FUNC(drawLaserpoint); + [_x, 100, (_laserID == 2 || _isIR), _brightness] call FUNC(drawLaserpoint); }; }; diff --git a/addons/laserpointer/functions/fnc_switchLaserLightMode.sqf b/addons/laserpointer/functions/fnc_switchLaserLightMode.sqf index 99549ec18f..3332631c49 100644 --- a/addons/laserpointer/functions/fnc_switchLaserLightMode.sqf +++ b/addons/laserpointer/functions/fnc_switchLaserLightMode.sqf @@ -84,6 +84,6 @@ switch (_currentWeaponType) do { if (!_error) then { [_description, _picture] call EFUNC(common,displayTextPicture); } else { - diag_log text format ["Failed to add %1 to %2 - reverting to %3", _nextPointer, _weapon, _pointer]; + ACE_LOGERROR_3("Failed to add %1 to %2 - reverting to %3",_nextPointer,_weapon,_pointer); }; playSound "ACE_Sound_Click"; diff --git a/addons/logistics_uavbattery/README.md b/addons/logistics_uavbattery/README.md index 8c89913459..d32175cb44 100644 --- a/addons/logistics_uavbattery/README.md +++ b/addons/logistics_uavbattery/README.md @@ -1,7 +1,10 @@ ace_logistics_uavbattery =========== -Adds an item `ACE_UAVBattery` that allows refueling/recharging of the "Dartar" quadcopter UAVs. +Adds an item that allows refueling/recharging of the Darter quadcopter UAVs. + +#### Items Added: +`ACE_UAVBattery` ## Maintainers diff --git a/addons/logistics_uavbattery/functions/fnc_canRefuelUAV.sqf b/addons/logistics_uavbattery/functions/fnc_canRefuelUAV.sqf index aaaac3077d..451753a9e2 100644 --- a/addons/logistics_uavbattery/functions/fnc_canRefuelUAV.sqf +++ b/addons/logistics_uavbattery/functions/fnc_canRefuelUAV.sqf @@ -16,6 +16,6 @@ */ #include "script_component.hpp" -PARAMS_2(_caller,_target); +params ["_caller", "_target"]; ("ACE_UAVBattery" in (items _caller)) && {(fuel _target) < 1} && {(speed _target) < 1} && {!(isEngineOn _target)} && {(_target distance _caller) <= 4} diff --git a/addons/logistics_uavbattery/functions/fnc_refuelUAV.sqf b/addons/logistics_uavbattery/functions/fnc_refuelUAV.sqf index e51f17777e..25f452882c 100644 --- a/addons/logistics_uavbattery/functions/fnc_refuelUAV.sqf +++ b/addons/logistics_uavbattery/functions/fnc_refuelUAV.sqf @@ -15,23 +15,21 @@ * Public: No */ #include "script_component.hpp" - -PARAMS_2(_caller,_target); - private ["_onFinish", "_onFailure"]; +params ["_caller", "_target"]; if (!(_this call FUNC(canRefuelUAV))) exitWith {}; _onFinish = { - EXPLODE_2_PVT((_this select 0),_caller,_target); - _caller removeItem "ACE_UAVBattery"; - playSound3D [QUOTE(PATHTO_R(sounds\exchange_battery.ogg)), objNull, false, getPosASL _caller, 1, 1, 10]; - ["setFuel", [_target], [_target, 1]] call EFUNC(common,targetEvent); //setFuel is local + (_this select 0) params ["_caller", "_target"]; + _caller removeItem "ACE_UAVBattery"; + playSound3D [QUOTE(PATHTO_R(sounds\exchange_battery.ogg)), objNull, false, getPosASL _caller, 1, 1, 10]; + ["setFuel", [_target], [_target, 1]] call EFUNC(common,targetEvent); //setFuel is local }; _onFailure = { - EXPLODE_2_PVT((_this select 0),_caller,_target); - [_caller, "AmovPknlMstpSrasWrflDnon", 1] call EFUNC(common,doAnimation); + (_this select 0) params ["_caller", "_target"]; + [_caller, "AmovPknlMstpSrasWrflDnon", 1] call EFUNC(common,doAnimation); }; [_caller, "AinvPknlMstpSnonWnonDr_medic5", 0] call EFUNC(common,doAnimation); diff --git a/addons/logistics_wirecutter/CfgVehicles.hpp b/addons/logistics_wirecutter/CfgVehicles.hpp index a31d9c0d99..0b584409d3 100644 --- a/addons/logistics_wirecutter/CfgVehicles.hpp +++ b/addons/logistics_wirecutter/CfgVehicles.hpp @@ -5,4 +5,22 @@ class CfgVehicles { MACRO_ADDITEM(ACE_wirecutter,4); }; }; + + class Wall_F; + class NonStrategic; + + class Land_Net_Fence_4m_F: Wall_F { GVAR(isFence) = 1; }; + class Land_Net_Fence_8m_F: Wall_F { GVAR(isFence) = 1; }; + class Land_Net_FenceD_8m_F: Wall_F { GVAR(isFence) = 1; }; + class Land_New_WiredFence_5m_F: Wall_F { GVAR(isFence) = 1; }; + class Land_New_WiredFence_10m_Dam_F: Wall_F { GVAR(isFence) = 1; }; + class Land_New_WiredFence_10m_F: Wall_F { GVAR(isFence) = 1; }; + class Land_Pipe_fence_4m_F: Wall_F { GVAR(isFence) = 1; }; + class Land_Pipe_fence_4mNoLC_F: Wall_F { GVAR(isFence) = 1; }; + class Land_SportGround_fence_F: Wall_F { GVAR(isFence) = 1; }; + class Land_Wired_Fence_4m_F: Wall_F { GVAR(isFence) = 1; }; + class Land_Wired_Fence_4mD_F: Wall_F { GVAR(isFence) = 1; }; + class Land_Wired_Fence_8m_F: Wall_F { GVAR(isFence) = 1; }; + class Land_Wired_Fence_8mD_F: Wall_F { GVAR(isFence) = 1; }; + class Land_Razorwire_F: NonStrategic { GVAR(isFence) = 1; }; }; diff --git a/addons/logistics_wirecutter/CfgWeapons.hpp b/addons/logistics_wirecutter/CfgWeapons.hpp index 4297cb3b83..2b365cc8e6 100644 --- a/addons/logistics_wirecutter/CfgWeapons.hpp +++ b/addons/logistics_wirecutter/CfgWeapons.hpp @@ -10,7 +10,7 @@ class CfgWeapons { picture = QUOTE(PATHTOF(ui\item_wirecutter_ca.paa)); scope = 2; class ItemInfo: InventoryItem_Base_F { - mass = 100; + mass = 65; }; }; }; diff --git a/addons/logistics_wirecutter/README.md b/addons/logistics_wirecutter/README.md index e0bef0bed6..89d42c419f 100644 --- a/addons/logistics_wirecutter/README.md +++ b/addons/logistics_wirecutter/README.md @@ -1,7 +1,10 @@ ace_logistics_wirecutter =========== -Adds an item `ACE_wirecutter` that allows cutting of fences in A3 and AiA maps. +Adds an item that allows cutting of fences in Aarma 3 and AiA/CUP maps. + +#### Items Added: +`ACE_wirecutter` ## Maintainers diff --git a/addons/logistics_wirecutter/XEH_preInit.sqf b/addons/logistics_wirecutter/XEH_preInit.sqf index 44eb941c16..39620bf35c 100644 --- a/addons/logistics_wirecutter/XEH_preInit.sqf +++ b/addons/logistics_wirecutter/XEH_preInit.sqf @@ -3,9 +3,6 @@ ADDON = false; PREP(cutDownFence); -PREP(cutDownFenceAbort); -PREP(cutDownFenceCallback); -PREP(getNearestFence); PREP(interactEH); PREP(isFence); diff --git a/addons/logistics_wirecutter/functions/fnc_cutDownFence.sqf b/addons/logistics_wirecutter/functions/fnc_cutDownFence.sqf index f45f0c1511..2bf807975f 100644 --- a/addons/logistics_wirecutter/functions/fnc_cutDownFence.sqf +++ b/addons/logistics_wirecutter/functions/fnc_cutDownFence.sqf @@ -16,21 +16,35 @@ */ #include "script_component.hpp" -#define SOUND_CLIP_TIME_SPACEING 1.5 -private ["_timeToCut", "_progressCheck"]; +params ["_unit", "_fenceObject"]; +TRACE_2("params",_unit,_fenceObject); + +private ["_timeToCut", "_progressCheck", "_onCompletion", "_onFail"]; -PARAMS_2(_unit,_fenceObject); if (_unit != ACE_player) exitWith {}; _timeToCut = if ([ACE_player] call EFUNC(common,isEngineer)) then {7.5} else {11}; [ACE_player, "AinvPknlMstpSnonWnonDr_medic5", 0] call EFUNC(common,doAnimation); +_onCompletion = { + TRACE_1("_onCompletion",_this); + (_this select 0) params ["_fenceObject", "", "_unit"]; + _fenceObject setdamage 1; + [_unit, "AmovPknlMstpSrasWrflDnon", 1] call EFUNC(common,doAnimation); +}; + +_onFail = { + TRACE_1("_onFail", _this); + (_this select 0) params ["", "", "_unit"]; + [_unit, "AmovPknlMstpSrasWrflDnon", 1] call EFUNC(common,doAnimation); +}; + _progressCheck = { - PARAMS_2(_args,_passedTime); - EXPLODE_2_PVT(_args,_fenceObject,_lastSoundEffectTime); + params ["_args", "_passedTime"]; + _args params ["_fenceObject", "_lastSoundEffectTime"]; + if (_passedTime > (_lastSoundEffectTime + SOUND_CLIP_TIME_SPACEING)) then { - // playSound "ACE_wirecutter_sound"; playSound3D [QUOTE(PATHTO_R(sound\wirecut.ogg)), objNull, false, (getPosASL ACE_player), 3, 1, 10]; _args set [1, _passedTime]; }; @@ -38,4 +52,4 @@ _progressCheck = { ((!isNull _fenceObject) && {(damage _fenceObject) < 1} && {("ACE_wirecutter" in (items ACE_player))}) }; -[_timeToCut, [_fenceObject,0], {(_this select 0) call FUNC(cutDownFenceCallback)}, {(_this select 0) call FUNC(cutDownFenceAbort)}, localize LSTRING(CuttingFence), _progressCheck] call EFUNC(common,progressBar); +[_timeToCut, [_fenceObject,0,_unit], _onCompletion, _onFail, localize LSTRING(CuttingFence), _progressCheck] call EFUNC(common,progressBar); diff --git a/addons/logistics_wirecutter/functions/fnc_cutDownFenceAbort.sqf b/addons/logistics_wirecutter/functions/fnc_cutDownFenceAbort.sqf deleted file mode 100644 index 20cb092131..0000000000 --- a/addons/logistics_wirecutter/functions/fnc_cutDownFenceAbort.sqf +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Author: commy2 - * Stops cutting down fence (reset animation) - * - * Arguments: - * Nothing - * - * Return Value: - * Nothing - * - * Example: - * [] call ace_logistics_wirecutter_fnc_cutDownFenceAbort - * - * Public: No - */ -#include "script_component.hpp" - -[ACE_player, "AmovPknlMstpSrasWrflDnon", 1] call EFUNC(common,doAnimation); diff --git a/addons/logistics_wirecutter/functions/fnc_cutDownFenceCallback.sqf b/addons/logistics_wirecutter/functions/fnc_cutDownFenceCallback.sqf deleted file mode 100644 index 57495a2a03..0000000000 --- a/addons/logistics_wirecutter/functions/fnc_cutDownFenceCallback.sqf +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Author: PabstMirror - * Once progressbar is done: Fence is cutdown - * - * Arguments: - * 0: Fence Object - * - * Return Value: - * Nothing - * - * Example: - * [aFence] call ace_logistics_wirecutter_fnc_cutDownFenceCallback - * - * Public: No - */ -#include "script_component.hpp" - -PARAMS_1(_fenceObject); - -_fenceObject setdamage 1; -// [localize LSTRING(FenceCut)] call EFUNC(common,displayTextStructured); -[ACE_player, "AmovPknlMstpSrasWrflDnon", 1] call EFUNC(common,doAnimation); diff --git a/addons/logistics_wirecutter/functions/fnc_getNearestFence.sqf b/addons/logistics_wirecutter/functions/fnc_getNearestFence.sqf deleted file mode 100644 index 15bfbdb8ef..0000000000 --- a/addons/logistics_wirecutter/functions/fnc_getNearestFence.sqf +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Author: PabstMirror - * Gets nearest fence object (not actully used, left for utility) - * - * Arguments: - * 0: Unit - * - * Return Value: - * The return value - * - * Example: - * [player] call ace_logistics_wirecutter_fnc_getNearestFence - * - * Public: Yes - */ -#include "script_component.hpp" - -private "_nearestFence"; -PARAMS_1(_unit); - -_nearestFence = objNull; -{ - if ((isNull _nearestFence) && {[_x] call FUNC(isFence)}) then { - _nearestFence = _x; - }; -} forEach nearestObjects [_unit, [], 15]; - -_nearestFence diff --git a/addons/logistics_wirecutter/functions/fnc_interactEH.sqf b/addons/logistics_wirecutter/functions/fnc_interactEH.sqf index 05c47c4454..e93296e44a 100644 --- a/addons/logistics_wirecutter/functions/fnc_interactEH.sqf +++ b/addons/logistics_wirecutter/functions/fnc_interactEH.sqf @@ -15,22 +15,24 @@ */ #include "script_component.hpp" -PARAMS_1(_interactionType); +params ["_interactionType"]; -//Ignore self-interaction menu -if (_interactionType != 0) exitWith {}; +//Ignore self-interaction menu or mounted vehicle interaction +if ((_interactionType != 0) || {(vehicle ACE_player) != ACE_player}) exitWith {}; //for performance only do stuff it they have a wirecutter item //(if they somehow get one durring keydown they'll just have to reopen) if (!("ACE_wirecutter" in (items ace_player))) exitWith {}; +TRACE_1("Starting wire-cut action PFEH",_interactionType); + [{ private ["_fncStatement", "_attachedFence", "_fncCondition", "_helper", "_action"]; - PARAMS_2(_args,_pfID); - EXPLODE_3_PVT(_args,_setPosition,_addedHelpers,_fencesHelped); + params ["_args", "_pfID"]; + _args params ["_setPosition", "_addedHelpers", "_fencesHelped"]; if (!EGVAR(interact_menu,keyDown)) then { - {deleteVehicle _x;} forEach _addedHelpers; + {deleteVehicle _x; nil} count _addedHelpers; [_pfID] call CBA_fnc_removePerFrameHandler; } else { // Prevent Rare Error when ending mission with interact key down: @@ -40,11 +42,12 @@ if (!("ACE_wirecutter" in (items ace_player))) exitWith {}; if (((getPosASL ace_player) distance _setPosition) > 5) then { _fncStatement = { - PARAMS_3(_dummyTarget,_player,_attachedFence); + params ["", "_player", "_attachedFence"]; [_player, _attachedFence] call FUNC(cutDownFence); }; _fncCondition = { - PARAMS_3(_dummyTarget,_player,_attachedFence); + params ["", "_player", "_attachedFence"]; + if (!([_player, _attachedFence, []] call EFUNC(common,canInteractWith))) exitWith {false}; ((!isNull _attachedFence) && {(damage _attachedFence) < 1} && {("ACE_wirecutter" in (items _player))}) }; @@ -52,15 +55,15 @@ if (!("ACE_wirecutter" in (items ace_player))) exitWith {}; if (!(_x in _fencesHelped)) then { if ([_x] call FUNC(isFence)) then { _fencesHelped pushBack _x; - _helper = "Sign_Sphere25cm_F" createVehicleLocal (getpos _x); + _helper = "ACE_LogicDummy" createVehicleLocal (getpos _x); _action = [QGVAR(helperCutFence), (localize LSTRING(CutFence)), QUOTE(PATHTOF(ui\wirecutter_ca.paa)), _fncStatement, _fncCondition, {}, _x, [0,0,0], 5] call EFUNC(interact_menu,createAction); [_helper, 0, [],_action] call EFUNC(interact_menu,addActionToObject); _helper setPosASL ((getPosASL _x) vectorAdd [0,0,1.25]); - _helper hideObject true; _addedHelpers pushBack _helper; }; }; - } forEach nearestObjects [ace_player, [], 15]; + nil + } count nearestObjects [ace_player, [], 15]; _args set [0, (getPosASL ace_player)]; }; diff --git a/addons/logistics_wirecutter/functions/fnc_isFence.sqf b/addons/logistics_wirecutter/functions/fnc_isFence.sqf index 4c247b268a..c1e30a7e6f 100644 --- a/addons/logistics_wirecutter/functions/fnc_isFence.sqf +++ b/addons/logistics_wirecutter/functions/fnc_isFence.sqf @@ -16,27 +16,26 @@ */ #include "script_component.hpp" -//find is case sensitive, so keep everything lowercase -#define FENCE_TYPENAMES ["land_net_fence_4m_f", "land_net_fence_8m_f", "land_net_fenced_8m_f", "land_new_wiredfence_5m_f", "land_new_wiredfence_10m_dam_f", "land_new_wiredfence_10m_f", "land_pipe_fence_4m_f", "land_pipe_fence_4mnolc_f", "land_sportground_fence_f", "land_wired_fence_4m_f", "land_wired_fence_4md_f", "land_wired_fence_8m_f", "land_wired_fence_8md_f", "land_razorwire_f", "ace_concertinawire"] - -#define FENCE_P3DS ["mil_wiredfence_f.p3d","wall_indfnc_3.p3d", "wall_indfnc_9.p3d", "wall_indfnc_corner.p3d", "pletivo_wired.p3d", "wall_fen1_5.p3d"] +params ["_object"]; +TRACE_1("params",_object); private ["_typeOf", "_returnValue"]; -PARAMS_1(_object); -_typeOf = toLower (typeOf _object); +_typeOf = typeOf _object; _returnValue = false; if (_typeOf != "") then { //If the fence has configEntry we can check it directly - _returnValue = _typeOf in FENCE_TYPENAMES; + _returnValue = (1 == (getNumber (configFile >> "CfgVehicles" >> _typeOf >> QGVAR(isFence)))); } else { + //TODO: 1.50 use getModelInfo _typeOf = toLower (str _object); //something like "123201: wall_indfnc_9.p3d" { if ((_typeOf find _x) != -1) exitWith { _returnValue = true; }; - } forEach FENCE_P3DS; + nil + } count FENCE_P3DS; }; _returnValue diff --git a/addons/logistics_wirecutter/script_component.hpp b/addons/logistics_wirecutter/script_component.hpp index 6dae60dfd2..a86ace1592 100644 --- a/addons/logistics_wirecutter/script_component.hpp +++ b/addons/logistics_wirecutter/script_component.hpp @@ -1,6 +1,8 @@ #define COMPONENT logistics_wirecutter #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL + #ifdef DEBUG_ENABLED_LOGISTICS_WIRECUTTER #define DEBUG_MODE_FULL #endif @@ -10,3 +12,9 @@ #endif #include "\z\ace\addons\main\script_macros.hpp" + + +//find is case sensitive, so keep everything lowercase +#define FENCE_P3DS ["mil_wiredfence_f.p3d","wall_indfnc_3.p3d", "wall_indfnc_9.p3d", "wall_indfnc_corner.p3d", "pletivo_wired.p3d", "wall_fen1_5.p3d"] + +#define SOUND_CLIP_TIME_SPACEING 1.5 diff --git a/addons/magazinerepack/README.md b/addons/magazinerepack/README.md index 28b7c3115a..e86adcd976 100644 --- a/addons/magazinerepack/README.md +++ b/addons/magazinerepack/README.md @@ -1,7 +1,8 @@ ace_magazinerepack ================== -Adds the ability to consolidate multiple half-empty magazines. +Adds the ability to consolidate multiple unfull magazines. + ## Maintainers diff --git a/addons/magazinerepack/functions/fnc_getMagazineChildren.sqf b/addons/magazinerepack/functions/fnc_getMagazineChildren.sqf index fbd07cf31a..34e369199f 100644 --- a/addons/magazinerepack/functions/fnc_getMagazineChildren.sqf +++ b/addons/magazinerepack/functions/fnc_getMagazineChildren.sqf @@ -7,7 +7,7 @@ * 1: Player * * Return value: - * ChildActiosn + * ChildActions * * Example: * [player, player] call ace_magazinerepack_fnc_getMagazineChildren @@ -16,15 +16,17 @@ */ #include "script_component.hpp" -private ["_unitMagazines", "_unitMagCounts", "_xFullMagazineCount", "_index", "_actions", "_displayName", "_picture", "_action"]; +private ["_unitMagazines", "_unitMagCounts", "_index", "_actions", "_displayName", "_picture", "_action"]; -PARAMS_2(_target,_player); +params ["_target", "_player"]; // get all mags and ammo count _unitMagazines = []; _unitMagCounts = []; { - EXPLODE_4_PVT(_x,_xClassname,_xCount,_xLoaded,_xType); + private "_xFullMagazineCount"; + _x params ["_xClassname", "_xCount", "_xLoaded", "_xType"]; + _xFullMagazineCount = getNumber (configfile >> "CfgMagazines" >> _xClassname >> "count"); //for every partial magazine, that is either in inventory or can be moved there diff --git a/addons/magazinerepack/functions/fnc_magazineRepackFinish.sqf b/addons/magazinerepack/functions/fnc_magazineRepackFinish.sqf index 1f5be8f72a..ab380cb1ed 100644 --- a/addons/magazinerepack/functions/fnc_magazineRepackFinish.sqf +++ b/addons/magazinerepack/functions/fnc_magazineRepackFinish.sqf @@ -10,7 +10,7 @@ * 3: Error Code * * Return Value: - * Nothing + * None * * Example: * (args from progressBar) call ace_magazinerepack_fnc_magazineRepackFinish @@ -21,8 +21,9 @@ private ["_structuredOutputText", "_picture", "_fullMags", "_partialMags", "_fullMagazineCount"]; -PARAMS_4(_args,_elapsedTime,_totalTime,_errorCode); -EXPLODE_2_PVT(_args,_magazineClassname,_lastAmmoCount); +params ["_args", "_elapsedTime", "_totalTime", "_errorCode"]; +_args params ["_magazineClassname", "_lastAmmoCount"]; + _fullMagazineCount = getNumber (configfile >> "CfgMagazines" >> _magazineClassname >> "count"); //Don't show anything if player can't interact: diff --git a/addons/magazinerepack/functions/fnc_magazineRepackProgress.sqf b/addons/magazinerepack/functions/fnc_magazineRepackProgress.sqf index 64ce05d12d..c1bf5ebdab 100644 --- a/addons/magazinerepack/functions/fnc_magazineRepackProgress.sqf +++ b/addons/magazinerepack/functions/fnc_magazineRepackProgress.sqf @@ -20,17 +20,19 @@ private ["_currentAmmoCount", "_addedMagazines", "_missingAmmo", "_index", "_updateMagazinesOnPlayerFnc"]; -PARAMS_3(_args,_elapsedTime,_totalTime); -EXPLODE_3_PVT(_args,_magazineClassname,_lastAmmoCount,_simEvents); -if ((count _simEvents) == 0) exitWith {ERROR("No Event"); false}; -EXPLODE_3_PVT((_simEvents select 0),_nextEventTime,_nextEventIsBullet,_nextEventMags); +params ["_ars", "_elapsedTime", "_totalTime"]; +_args params ["_magazineClassname", "_lastAmmoCount", "_simEvents"]; -if (_nextEventTime > _elapsedTime) exitWith {true};//waiting on next event +if !((_simEvents select 0) params ["_nextEventTime", "_nextEventIsBullet", "_nextEventMags"]) exitWith { ERROR("No Event"); false }; + + + +if (_nextEventTime > _elapsedTime) exitWith { true };//waiting on next event //Verify we aren't missing any ammo _currentAmmoCount = []; { - EXPLODE_2_PVT(_x,_xClassname,_xCount); + _x params ["_xClassname", "_xCount"]; if (_xClassname == _magazineClassname) then { _currentAmmoCount pushBack _xCount; }; @@ -50,7 +52,7 @@ _missingAmmo = false; }; } forEach _lastAmmoCount; -if (_missingAmmo) exitWith {false}; //something removed ammo that was being repacked (could be other players or scripts) +if (_missingAmmo) exitWith { false }; //something removed ammo that was being repacked (could be other players or scripts) _updateMagazinesOnPlayerFnc = { ACE_player removeMagazines _magazineClassname; //remove inventory magazines @@ -75,4 +77,4 @@ if (_nextEventIsBullet) then { _simEvents deleteAt 0; //pop off the event -true; +true diff --git a/addons/magazinerepack/functions/fnc_simulateRepackEvents.sqf b/addons/magazinerepack/functions/fnc_simulateRepackEvents.sqf index e57e569dc1..646bd880af 100644 --- a/addons/magazinerepack/functions/fnc_simulateRepackEvents.sqf +++ b/addons/magazinerepack/functions/fnc_simulateRepackEvents.sqf @@ -19,20 +19,20 @@ */ #include "script_component.hpp" -private ["_newMagFnc", "_time", "_events", "_swapAmmoFnc", "_ammoSwaped", "_lowIndex", "_highIndex", "_ammoToTransfer", "_ammoAvailable", "_ammoNeeded", "_swapProgress"]; +private ["_fnc_newMag", "_time", "_events", "_fnc_swapAmmo", "_ammoSwaped", "_lowIndex", "_highIndex", "_ammoToTransfer", "_ammoAvailable", "_ammoNeeded", "_swapProgress"]; -PARAMS_3(_fullMagazineCount,_arrayOfAmmoCounts,_isBelt); +params ["_fullMagazineCount", "_arrayOfAmmoCounts", "_isBelt"]; // Sort Ascending - Don't modify original _arrayOfAmmoCounts = +_arrayOfAmmoCounts; _arrayOfAmmoCounts sort true; -_newMagFnc = { +_fnc_newMag = { _time = _time + GVAR(TimePerMagazine); _events pushBack [_time, false, +_arrayOfAmmoCounts]; }; -_swapAmmoFnc = if (_isBelt) then { +_fnc_swapAmmo = if (_isBelt) then { { _time = _time + GVAR(TimePerBeltLink); _arrayOfAmmoCounts set [_lowIndex, ((_arrayOfAmmoCounts select _lowIndex) - _ammoSwaped)]; @@ -64,14 +64,14 @@ while {_lowIndex < _highIndex} do { if (_ammoAvailable == 0) then { _lowIndex = _lowIndex + 1; - call _newMagFnc; + call _fnc_newMag; } else { if (_ammoNeeded == 0) then { _highIndex = _highIndex - 1; - call _newMagFnc; + call _fnc_newMag; } else { _ammoSwaped = _ammoAvailable min _ammoNeeded; - call _swapAmmoFnc; + call _fnc_swapAmmo; }; }; }; diff --git a/addons/magazinerepack/functions/fnc_startRepackingMagazine.sqf b/addons/magazinerepack/functions/fnc_startRepackingMagazine.sqf index e0621a41be..b11fc3697d 100644 --- a/addons/magazinerepack/functions/fnc_startRepackingMagazine.sqf +++ b/addons/magazinerepack/functions/fnc_startRepackingMagazine.sqf @@ -21,7 +21,7 @@ private ["_magazineCfg", "_fullMagazineCount", "_isBelt", "_startingAmmoCounts", "_simEvents", "_totalTime"]; -PARAMS_3(_target,_player,_magazineClassname); +params ["_target", "_player", "_magazineClassname"]; if (isNil "_magazineClassname" || {_magazineClassname == ""}) exitWith {ERROR("Bad Mag Classname");}; _magazineCfg = configfile >> "CfgMagazines" >> _magazineClassname; @@ -63,11 +63,11 @@ _simEvents = [_fullMagazineCount, _startingAmmoCounts, _isBelt] call FUNC(simula _totalTime = (_simEvents select ((count _simEvents) - 1) select 0); [ -_totalTime, -[_magazineClassname, _startingAmmoCounts, _simEvents], -{_this call FUNC(magazineRepackFinish)}, -{_this call FUNC(magazineRepackFinish)}, -(localize LSTRING(RepackingMagazine)), -{_this call FUNC(magazineRepackProgress)}, -["isNotInside", "isNotSitting"] + _totalTime, + [_magazineClassname, _startingAmmoCounts, _simEvents], + {_this call FUNC(magazineRepackFinish)}, + {_this call FUNC(magazineRepackFinish)}, + (localize LSTRING(RepackingMagazine)), + {_this call FUNC(magazineRepackProgress)}, + ["isNotInside", "isNotSitting"] ] call EFUNC(common,progressBar); diff --git a/addons/main/CfgModuleCategories.hpp b/addons/main/CfgModuleCategories.hpp index 5297ec1e99..a3dd65c544 100644 --- a/addons/main/CfgModuleCategories.hpp +++ b/addons/main/CfgModuleCategories.hpp @@ -5,4 +5,7 @@ class CfgFactionClasses { priority = 2; side = 7; }; + class ACE_Logistics: ACE { + displayName = CSTRING(Category_Logistics); + }; }; diff --git a/addons/main/CfgVehicleClasses.hpp b/addons/main/CfgVehicleClasses.hpp new file mode 100644 index 0000000000..9aa807f3f5 --- /dev/null +++ b/addons/main/CfgVehicleClasses.hpp @@ -0,0 +1,5 @@ +class CfgVehicleClasses { + class ACE_Logistics_Items { + displayName = CSTRING(Category_Logistics); + }; +}; diff --git a/addons/main/config.cpp b/addons/main/config.cpp index eb136f84cf..a013d8e971 100644 --- a/addons/main/config.cpp +++ b/addons/main/config.cpp @@ -1,4 +1,4 @@ -#include "script_component.hpp" +#include "script_component.hpp" class CfgPatches { class ADDON { @@ -541,49 +541,26 @@ class CfgPatches { "a3_weapons_f_vests", "a3data", "map_vr", - "extended_eventhandlers", "CBA_UI", "CBA_XEH", "CBA_XEH_A3" + "extended_eventhandlers", "cba_ui", "cba_xeh", "cba_xeh_a3", "cba_jr" }; - author[] = {"ACE Team"}; - authorUrl = ""; - versionDesc = "A.C.E."; - versionAct = QUOTE(['MAIN',_this] execVM '\z\ace\addons\main\about.sqf';); + author[] = {ECSTRING(common,ACETeam)}; + authorUrl = "http://ace3mod.com/"; VERSION_CONFIG; }; }; class CfgMods { class PREFIX { - dir = "@ACE"; - name = "Core - Advanced Combat Environment"; + dir = "@ace"; + name = "Advanced Combat Environment 3"; picture = "A3\Ui_f\data\Logos\arma3_expansion_alpha_ca"; hidePicture = "true"; hideName = "true"; actionName = "Website"; - action = "http://ace.dev-heaven.net"; - description = "Bugtracker: "; - }; -}; - -class CfgSettings { - class CBA { - class Versioning { - class PREFIX { - level = DEFAULT_VERSIONING_LEVEL; - handler = "ace_common_fnc_mismatch"; - class Dependencies { - CBA[]={"cba_main", {1,0,0}, "true"}; - XEH[]={"cba_xeh", {1,0,0}, "true"}; - }; - }; - }; - /* - class Registry { - class PREFIX { - removed[] = {}; - }; - }; - */ + action = "http://ace3mod.com/"; + description = "Issue Tracker: https://github.com/acemod/ACE3/issues"; }; }; #include "CfgModuleCategories.hpp" +#include "CfgVehicleClasses.hpp" diff --git a/addons/main/script_component.hpp b/addons/main/script_component.hpp index 9a18b78a7a..3ac1d0b7aa 100644 --- a/addons/main/script_component.hpp +++ b/addons/main/script_component.hpp @@ -3,12 +3,12 @@ // #define DEBUG_MODE_FULL -#ifdef DEBUG_ENABLED_CORE +#ifdef DEBUG_ENABLED_MAIN #define DEBUG_MODE_FULL #endif -#ifdef DEBUG_SETTINGS_CORE - #define DEBUG_SETTINGS DEBUG_SETTINGS_CORE +#ifdef DEBUG_SETTINGS_MAIN + #define DEBUG_SETTINGS DEBUG_SETTINGS_MAIN #endif #include "\z\ace\addons\main\script_macros.hpp" diff --git a/addons/main/script_macros.hpp b/addons/main/script_macros.hpp index e67c45e675..c2ecab058b 100644 --- a/addons/main/script_macros.hpp +++ b/addons/main/script_macros.hpp @@ -97,5 +97,96 @@ // Time functions for accuracy per frame #define ACE_tickTime (ACE_time + (diag_tickTime - ACE_diagTime)) +#define ACE_isHC (!hasInterface && !isDedicated) -#include "script_debug.hpp" \ No newline at end of file +//By default CBA's TRACE/LOG/WARNING spawn a buffer, which can cause messages to be logged out of order: +#ifdef CBA_DEBUG_SYNCHRONOUS + #define CBA_fnc_log { params ["_file","_lineNum","_message"]; diag_log [diag_frameNo, diag_tickTime, time, _file + ":"+str(_lineNum + 1), _message]; } +#endif + +#define ACE_LOG(module,level,message) diag_log text ACE_LOGFORMAT(module,level,message) +#define ACE_LOGFORMAT(module,level,message) FORMAT_2(QUOTE([ACE] (module) %1: %2),level,message) + +#define ACE_LOGERROR(message) ACE_LOG(COMPONENT,"ERROR",message) +#define ACE_LOGERROR_1(message,arg1) ACE_LOGERROR(FORMAT_1(message,arg1)) +#define ACE_LOGERROR_2(message,arg1,arg2) ACE_LOGERROR(FORMAT_2(message,arg1,arg2)) +#define ACE_LOGERROR_3(message,arg1,arg2,arg3) ACE_LOGERROR(FORMAT_3(message,arg1,arg2,arg3)) +#define ACE_LOGERROR_4(message,arg1,arg2,arg3,arg4) ACE_LOGERROR(FORMAT_4(message,arg1,arg2,arg3,arg4)) +#define ACE_LOGERROR_5(message,arg1,arg2,arg3,arg4,arg5) ACE_LOGERROR(FORMAT_5(message,arg1,arg2,arg3,arg4,arg5)) +#define ACE_LOGERROR_6(message,arg1,arg2,arg3,arg4,arg5,arg6) ACE_LOGERROR(FORMAT_6(message,arg1,arg2,arg3,arg4,arg5,arg6)) +#define ACE_LOGERROR_7(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7) ACE_LOGERROR(FORMAT_7(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7)) +#define ACE_LOGERROR_8(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) ACE_LOGERROR(FORMAT_8(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8)) + +#define ACE_ERRORFORMAT(message) ACE_LOGFORMAT(COMPONENT,"ERROR",message) +#define ACE_ERRORFORMAT_1(message,arg1) ACE_ERRORFORMAT(FORMAT_1(message,arg1)) +#define ACE_ERRORFORMAT_2(message,arg1,arg2) ACE_ERRORFORMAT(FORMAT_2(message,arg1,arg2)) +#define ACE_ERRORFORMAT_3(message,arg1,arg2,arg3) ACE_ERRORFORMAT(FORMAT_3(message,arg1,arg2,arg3)) +#define ACE_ERRORFORMAT_4(message,arg1,arg2,arg3,arg4) ACE_ERRORFORMAT(FORMAT_4(message,arg1,arg2,arg3,arg4)) +#define ACE_ERRORFORMAT_5(message,arg1,arg2,arg3,arg4,arg5) ACE_ERRORFORMAT(FORMAT_5(message,arg1,arg2,arg3,arg4,arg5)) +#define ACE_ERRORFORMAT_6(message,arg1,arg2,arg3,arg4,arg5,arg6) ACE_ERRORFORMAT(FORMAT_6(message,arg1,arg2,arg3,arg4,arg5,arg6)) +#define ACE_ERRORFORMAT_7(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7) ACE_ERRORFORMAT(FORMAT_7(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7)) +#define ACE_ERRORFORMAT_8(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) ACE_ERRORFORMAT(FORMAT_8(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8)) + +#define ACE_LOGWARNING(message) ACE_LOG(COMPONENT,"WARNING",message) +#define ACE_LOGWARNING_1(message,arg1) ACE_LOGWARNING(FORMAT_1(message,arg1)) +#define ACE_LOGWARNING_2(message,arg1,arg2) ACE_LOGWARNING(FORMAT_2(message,arg1,arg2)) +#define ACE_LOGWARNING_3(message,arg1,arg2,arg3) ACE_LOGWARNING(FORMAT_3(message,arg1,arg2,arg3)) +#define ACE_LOGWARNING_4(message,arg1,arg2,arg3,arg4) ACE_LOGWARNING(FORMAT_4(message,arg1,arg2,arg3,arg4)) +#define ACE_LOGWARNING_5(message,arg1,arg2,arg3,arg4,arg5) ACE_LOGWARNING(FORMAT_5(message,arg1,arg2,arg3,arg4,arg5)) +#define ACE_LOGWARNING_6(message,arg1,arg2,arg3,arg4,arg5,arg6) ACE_LOGWARNING(FORMAT_6(message,arg1,arg2,arg3,arg4,arg5,arg6)) +#define ACE_LOGWARNING_7(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7) ACE_LOGWARNING(FORMAT_7(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7)) +#define ACE_LOGWARNING_8(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) ACE_LOGWARNING(FORMAT_8(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8)) + +#define ACE_WARNINGFORMAT(message) ACE_LOGFORMAT(COMPONENT,"WARNING",message) +#define ACE_WARNINGFORMAT_1(message,arg1) ACE_WARNINGFORMAT(FORMAT_1(message,arg1)) +#define ACE_WARNINGFORMAT_2(message,arg1,arg2) ACE_WARNINGFORMAT(FORMAT_2(message,arg1,arg2)) +#define ACE_WARNINGFORMAT_3(message,arg1,arg2,arg3) ACE_WARNINGFORMAT(FORMAT_3(message,arg1,arg2,arg3)) +#define ACE_WARNINGFORMAT_4(message,arg1,arg2,arg3,arg4) ACE_WARNINGFORMAT(FORMAT_4(message,arg1,arg2,arg3,arg4)) +#define ACE_WARNINGFORMAT_5(message,arg1,arg2,arg3,arg4,arg5) ACE_WARNINGFORMAT(FORMAT_5(message,arg1,arg2,arg3,arg4,arg5)) +#define ACE_WARNINGFORMAT_6(message,arg1,arg2,arg3,arg4,arg5,arg6) ACE_WARNINGFORMAT(FORMAT_6(message,arg1,arg2,arg3,arg4,arg5,arg6)) +#define ACE_WARNINGFORMAT_7(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7) ACE_WARNINGFORMAT(FORMAT_7(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7)) +#define ACE_WARNINGFORMAT_8(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) ACE_WARNINGFORMAT(FORMAT_8(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8)) + +#define ACE_LOGINFO(message) ACE_LOG(COMPONENT,"INFO",message) +#define ACE_LOGINFO_1(message,arg1) ACE_LOGINFO(FORMAT_1(message,arg1)) +#define ACE_LOGINFO_2(message,arg1,arg2) ACE_LOGINFO(FORMAT_2(message,arg1,arg2)) +#define ACE_LOGINFO_3(message,arg1,arg2,arg3) ACE_LOGINFO(FORMAT_3(message,arg1,arg2,arg3)) +#define ACE_LOGINFO_4(message,arg1,arg2,arg3,arg4) ACE_LOGINFO(FORMAT_4(message,arg1,arg2,arg3,arg4)) +#define ACE_LOGINFO_5(message,arg1,arg2,arg3,arg4,arg5) ACE_LOGINFO(FORMAT_5(message,arg1,arg2,arg3,arg4,arg5)) +#define ACE_LOGINFO_6(message,arg1,arg2,arg3,arg4,arg5,arg6) ACE_LOGINFO(FORMAT_6(message,arg1,arg2,arg3,arg4,arg5,arg6)) +#define ACE_LOGINFO_7(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7) ACE_LOGINFO(FORMAT_7(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7)) +#define ACE_LOGINFO_8(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) ACE_LOGINFO(FORMAT_8(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8)) + +#define ACE_INFOFORMAT(message) ACE_LOGFORMAT(COMPONENT,"INFO",message) +#define ACE_INFOFORMAT_1(message,arg1) ACE_INFOFORMAT(FORMAT_1(message,arg1)) +#define ACE_INFOFORMAT_2(message,arg1,arg2) ACE_INFOFORMAT(FORMAT_2(message,arg1,arg2)) +#define ACE_INFOFORMAT_3(message,arg1,arg2,arg3) ACE_INFOFORMAT(FORMAT_3(message,arg1,arg2,arg3)) +#define ACE_INFOFORMAT_4(message,arg1,arg2,arg3,arg4) ACE_INFOFORMAT(FORMAT_4(message,arg1,arg2,arg3,arg4)) +#define ACE_INFOFORMAT_5(message,arg1,arg2,arg3,arg4,arg5) ACE_INFOFORMAT(FORMAT_5(message,arg1,arg2,arg3,arg4,arg5)) +#define ACE_INFOFORMAT_6(message,arg1,arg2,arg3,arg4,arg5,arg6) ACE_INFOFORMAT(FORMAT_6(message,arg1,arg2,arg3,arg4,arg5,arg6)) +#define ACE_INFOFORMAT_7(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7) ACE_INFOFORMAT(FORMAT_7(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7)) +#define ACE_INFOFORMAT_8(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) ACE_INFOFORMAT(FORMAT_8(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8)) + +#define ACE_LOGDEBUG(message) ACE_LOG(COMPONENT,"DEBUG",message) +#define ACE_LOGDEBUG_1(message,arg1) ACE_LOGDEBUG(FORMAT_1(message,arg1)) +#define ACE_LOGDEBUG_2(message,arg1,arg2) ACE_LOGDEBUG(FORMAT_2(message,arg1,arg2)) +#define ACE_LOGDEBUG_3(message,arg1,arg2,arg3) ACE_LOGDEBUG(FORMAT_3(message,arg1,arg2,arg3)) +#define ACE_LOGDEBUG_4(message,arg1,arg2,arg3,arg4) ACE_LOGDEBUG(FORMAT_4(message,arg1,arg2,arg3,arg4)) +#define ACE_LOGDEBUG_5(message,arg1,arg2,arg3,arg4,arg5) ACE_LOGDEBUG(FORMAT_5(message,arg1,arg2,arg3,arg4,arg5)) +#define ACE_LOGDEBUG_6(message,arg1,arg2,arg3,arg4,arg5,arg6) ACE_LOGDEBUG(FORMAT_6(message,arg1,arg2,arg3,arg4,arg5,arg6)) +#define ACE_LOGDEBUG_7(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7) ACE_LOGDEBUG(FORMAT_7(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7)) +#define ACE_LOGDEBUG_8(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) ACE_LOGDEBUG(FORMAT_8(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8)) + +#define ACE_DEBUGFORMAT(message) ACE_LOGFORMAT(COMPONENT,"DEBUG",message) +#define ACE_DEBUGFORMAT_1(message,arg1) ACE_DEBUGFORMAT(FORMAT_1(message,arg1)) +#define ACE_DEBUGFORMAT_2(message,arg1,arg2) ACE_DEBUGFORMAT(FORMAT_2(message,arg1,arg2)) +#define ACE_DEBUGFORMAT_3(message,arg1,arg2,arg3) ACE_DEBUGFORMAT(FORMAT_3(message,arg1,arg2,arg3)) +#define ACE_DEBUGFORMAT_4(message,arg1,arg2,arg3,arg4) ACE_DEBUGFORMAT(FORMAT_4(message,arg1,arg2,arg3,arg4)) +#define ACE_DEBUGFORMAT_5(message,arg1,arg2,arg3,arg4,arg5) ACE_DEBUGFORMAT(FORMAT_5(message,arg1,arg2,arg3,arg4,arg5)) +#define ACE_DEBUGFORMAT_6(message,arg1,arg2,arg3,arg4,arg5,arg6) ACE_DEBUGFORMAT(FORMAT_6(message,arg1,arg2,arg3,arg4,arg5,arg6)) +#define ACE_DEBUGFORMAT_7(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7) ACE_DEBUGFORMAT(FORMAT_7(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7)) +#define ACE_DEBUGFORMAT_8(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) ACE_DEBUGFORMAT(FORMAT_8(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8)) + +#define ACE_DEPRECATED(arg1,arg2,arg3) ACE_LOGWARNING_3("%1 is deprecated. Support will be dropped in version %2. Replaced by: %3",arg1,arg2,arg3) + +#include "script_debug.hpp" diff --git a/addons/main/script_mod.hpp b/addons/main/script_mod.hpp index e38e71ac4b..c87a23aba2 100644 --- a/addons/main/script_mod.hpp +++ b/addons/main/script_mod.hpp @@ -4,7 +4,7 @@ #define PREFIX ace #define MAJOR 3 -#define MINOR 2 +#define MINOR 3 #define PATCHLVL 2 #define BUILD 0 diff --git a/addons/main/stringtable.xml b/addons/main/stringtable.xml new file mode 100644 index 0000000000..511da9875a --- /dev/null +++ b/addons/main/stringtable.xml @@ -0,0 +1,13 @@ + + + + + ACE Logistics + ACE Logistyka + Logísticas ACE + ACE: логистика + ACE Logistika + ACE Logística + + + diff --git a/addons/map/ACE_Settings.hpp b/addons/map/ACE_Settings.hpp index 15e2a174e4..4e2a5d5706 100644 --- a/addons/map/ACE_Settings.hpp +++ b/addons/map/ACE_Settings.hpp @@ -15,6 +15,10 @@ class ACE_Settings { value = 1; typeName = "BOOL"; }; + class GVAR(mapGlow) { + value = 1; + typeName = "BOOL"; + }; class GVAR(mapShake) { value = 1; typeName = "BOOL"; diff --git a/addons/map/CfgAmmo.hpp b/addons/map/CfgAmmo.hpp new file mode 100644 index 0000000000..805e7b3627 --- /dev/null +++ b/addons/map/CfgAmmo.hpp @@ -0,0 +1,48 @@ +class CfgAmmo { + + class FlareCore; + + class FlareBase: FlareCore {}; + class F_20mm_White: FlareBase {}; + + class ACE_FlashlightProxy_White: F_20mm_White { + model = ""; + effectFlare = "FlareShell"; + + triggerTime = 0; + intensity = 0.5; + flareSize = 1; + timeToLive = 10e10; + + lightColor[] = {1,1,1,1}; + + grenadeBurningSound[] = {}; + grenadeFireSound[] = {}; + soundTrigger[] = {}; + SmokeShellSoundHit1[] = {}; + SmokeShellSoundHit2[] = {}; + SmokeShellSoundHit3[] = {}; + SmokeShellSoundLoop1[] = {}; + SmokeShellSoundLoop2[] = {}; + }; + + class ACE_FlashlightProxy_Red: ACE_FlashlightProxy_White { + intensity = 1; + lightColor[] = {1,0,0,1}; + }; + + class ACE_FlashlightProxy_Green: ACE_FlashlightProxy_White { + intensity = 1; + lightColor[] = {0,1,0,1}; + }; + + class ACE_FlashlightProxy_Blue: ACE_FlashlightProxy_White { + intensity = 1.5; + lightColor[] = {0.25,0.25,1,1}; + }; + + class ACE_FlashlightProxy_Yellow: ACE_FlashlightProxy_White { + intensity = 1; + lightColor[] = {1,1,0.5,1}; + }; +}; \ No newline at end of file diff --git a/addons/map/CfgSounds.hpp b/addons/map/CfgSounds.hpp new file mode 100644 index 0000000000..ede59914a7 --- /dev/null +++ b/addons/map/CfgSounds.hpp @@ -0,0 +1,7 @@ +class CfgSounds { + class ACE_map_flashlightClick { + name = "ACE_map_flashlightClick"; + sound[] = {"\a3\sounds_f\weapons\Other\dry4.wss", 0.2, 2}; + titles[] = {}; + }; +}; \ No newline at end of file diff --git a/addons/map/CfgVehicles.hpp b/addons/map/CfgVehicles.hpp index 30cae96ef6..560453b416 100644 --- a/addons/map/CfgVehicles.hpp +++ b/addons/map/CfgVehicles.hpp @@ -1,4 +1,20 @@ class CfgVehicles { + class Man; + class CAManBase: Man { + class ACE_SelfActions { + class ACE_MapFlashlight { + displayName = CSTRING(Action_Flashlights); + icon = QUOTE(\a3\ui_f\data\IGUI\Cfg\VehicleToggles\lightsiconon_ca.paa); + condition = QUOTE(GVAR(mapIllumination) && visibleMap && (count ([ACE_player] call FUNC(getUnitFlashlights)) > 0)); + statement = "true"; + exceptions[] = {"isNotDragging", "notOnMap", "isNotInside", "isNotSitting"}; + insertChildren = QUOTE(_this call DFUNC(compileFlashlightMenu)); + showDisabled = 0; + priority = 99; + }; + }; + }; + class ACE_Module; class ACE_ModuleMap: ACE_Module { author = ECSTRING(common,ACETeam); @@ -15,6 +31,12 @@ class CfgVehicles { typeName = "BOOL"; defaultValue = 1; }; + class MapGlow { + displayName = CSTRING(MapGlow_DisplayName); + description = CSTRING(MapGlow_Description); + typeName = "BOOL"; + defaultValue = 1; + }; class MapShake { displayName = CSTRING(MapShake_DisplayName); description = CSTRING(MapShake_Description); @@ -71,4 +93,4 @@ class CfgVehicles { description = CSTRING(BFT_Module_Description); }; }; -}; +}; \ No newline at end of file diff --git a/addons/map/README.md b/addons/map/README.md index 6544d0f236..7567986ba5 100644 --- a/addons/map/README.md +++ b/addons/map/README.md @@ -1,12 +1,12 @@ ace_map ======= -Various tweaks to the in-game map. Including: +Various tweaks to the in-game map, including: - Better map styling (countours, legend, hiding bushes and trees, etc). - Max zoom level (optional) - Map shaking while walking (optional) - Map illumination (optional) -- Blufor tracker (optional) +- Blue Force Tracker (optional) ## Maintainers diff --git a/addons/map/XEH_postInitClient.sqf b/addons/map/XEH_postInitClient.sqf index 95f42db431..02800c2540 100644 --- a/addons/map/XEH_postInitClient.sqf +++ b/addons/map/XEH_postInitClient.sqf @@ -1,23 +1,24 @@ #include "script_component.hpp" // Exit on Headless as well -if !(hasInterface) exitWith {}; +if (!hasInterface) exitWith {}; LOG(MSG_INIT); // Calculate the maximum zoom allowed for this map call FUNC(determineZoom); -// This spawn is probably worth keeping, as pfh don't work natively on the briefing screen and IDK how reliable the hack we implemented for them is. -// The thread dies as soon as the mission start, so it's not really compiting for scheduler space. -[] spawn { - // Wait until the map display is detected - waitUntil {(!isNull findDisplay 12)}; +[{ + if (isNull findDisplay 12) exitWith {}; GVAR(lastStillPosition) = ((findDisplay 12) displayCtrl 51) ctrlMapScreenToWorld [0.5, 0.5]; GVAR(lastStillTime) = ACE_time; GVAR(isShaking) = false; + //map sizes are multiples of 1280 + GVAR(worldSize) = worldSize / 1280; + GVAR(mousePos) = [0.5,0.5]; + //Allow panning the lastStillPosition while mapShake is active GVAR(rightMouseButtonLastPos) = []; ((findDisplay 12) displayCtrl 51) ctrlAddEventHandler ["Draw", {[] call FUNC(updateMapEffects);}]; @@ -42,13 +43,69 @@ call FUNC(determineZoom); GVAR(rightMouseButtonLastPos) = []; }; }]; -}; + + //get mouse position on map + ((findDisplay 12) displayCtrl 51) ctrlAddEventHandler ["MouseMoving", { + GVAR(mousePos) = (_this select 0) ctrlMapScreenToWorld [_this select 1, _this select 2]; + }]; + ((findDisplay 12) displayCtrl 51) ctrlAddEventHandler ["MouseHolding", { + GVAR(mousePos) = (_this select 0) ctrlMapScreenToWorld [_this select 1, _this select 2]; + }]; + + [_this select 1] call CBA_fnc_removePerFrameHandler; +}, 0] call CBA_fnc_addPerFrameHandler; ["SettingsInitialized", { // Start Blue Force Tracking if Enabled if (GVAR(BFT_Enabled)) then { - diag_log text "[ACE] Blue Force Tracking Enabled (client)"; GVAR(BFT_markers) = []; [FUNC(blueForceTrackingUpdate), GVAR(BFT_Interval), []] call CBA_fnc_addPerFrameHandler; }; + + //illumination settings + if (GVAR(mapIllumination)) then { + GVAR(flashlightInUse) = ""; + GVAR(glow) = objNull; + + ["playerInventoryChanged", { + _flashlights = [ACE_player] call FUNC(getUnitFlashlights); + if ((GVAR(flashlightInUse) != "") && !(GVAR(flashlightInUse) in _flashlights)) then { + GVAR(flashlightInUse) = ""; + }; + }] call EFUNC(common,addEventHandler); + + if (GVAR(mapGlow)) then { + ["visibleMapChanged", { + params ["_player", "_mapOn"]; + if (_mapOn) then { + if (!alive _player && !isNull GVAR(glow)) then { + GVAR(flashlightInUse) = ""; + }; + if (GVAR(flashlightInUse) != "") then { + if (isNull GVAR(glow)) then { + [GVAR(flashlightInUse)] call FUNC(flashlightGlow); + }; + } else { + if (!isNull GVAR(glow)) then { + [""] call FUNC(flashlightGlow); + }; + }; + } else { + if (!isNull GVAR(glow)) then { + [""] call FUNC(flashlightGlow); + }; + }; + }] call EFUNC(common,addEventHandler); + }; + }; +}] call EFUNC(common,addEventHandler); + +// hide clock on map if player has no watch +GVAR(hasWatch) = true; + +["playerInventoryChanged", { + if (isNull (_this select 0)) exitWith { + GVAR(hasWatch) = true; + }; + GVAR(hasWatch) = "ItemWatch" in (_this select 1 select 17); }] call EFUNC(common,addEventHandler); diff --git a/addons/map/XEH_preInit.sqf b/addons/map/XEH_preInit.sqf index c5645a52e7..9e123a3877 100644 --- a/addons/map/XEH_preInit.sqf +++ b/addons/map/XEH_preInit.sqf @@ -5,10 +5,15 @@ LOG(MSG_INIT); PREP(blueForceTrackingModule); PREP(blueForceTrackingUpdate); +PREP(compileFlashlightMenu); PREP(determineMapLight); PREP(determineZoom); +PREP(flashlightGlow); +PREP(getUnitFlashlights); PREP(moduleMap); PREP(onDrawMap); +PREP(simulateMapLight); +PREP(switchFlashlight); PREP(updateMapEffects); ADDON = true; diff --git a/addons/map/config.cpp b/addons/map/config.cpp index 078c06b41d..6d6b4030ec 100644 --- a/addons/map/config.cpp +++ b/addons/map/config.cpp @@ -27,6 +27,8 @@ class RscEdit; #include "CfgEventHandlers.hpp" #include "CfgMarkers.hpp" #include "CfgVehicles.hpp" +#include "CfgAmmo.hpp" +#include "CfgSounds.hpp" class RscMapControl { maxSatelliteAlpha = 0.5; @@ -125,13 +127,6 @@ class RscDisplayDiary { }; }; }; - // scale up the compass - class objects { - class Compass: RscObject { - scale = 0.7; - zoomDuration = 0; - }; - }; }; // BRIEFING SCREEN @@ -149,13 +144,6 @@ class RscDisplayGetReady: RscDisplayMainMap { #include "MapControls.hpp" }; }; - // scale up the compass - class objects { - class Compass: RscObject { - scale = 0.7; - zoomDuration = 0; - }; - }; }; class RscDisplayClientGetReady: RscDisplayGetReady { // get rid of the "center to player position" - button (as it works even on elite) @@ -164,13 +152,6 @@ class RscDisplayClientGetReady: RscDisplayGetReady { #include "MapControls.hpp" }; }; - // scale up the compass - class objects { - class Compass: RscObject { - scale = 0.7; - zoomDuration = 0; - }; - }; }; class RscDisplayServerGetReady: RscDisplayGetReady { // get rid of the "center to player position" - button (as it works even on elite) @@ -179,11 +160,4 @@ class RscDisplayServerGetReady: RscDisplayGetReady { #include "MapControls.hpp" }; }; - // scale up the compass - class objects { - class Compass: RscObject { - scale = 0.7; - zoomDuration = 0; - }; - }; }; diff --git a/addons/map/functions/fnc_blueForceTrackingModule.sqf b/addons/map/functions/fnc_blueForceTrackingModule.sqf index 33049c38ca..77275ffd4c 100644 --- a/addons/map/functions/fnc_blueForceTrackingModule.sqf +++ b/addons/map/functions/fnc_blueForceTrackingModule.sqf @@ -1,6 +1,5 @@ /* * Author: KoffeinFlummi -* * Initializes the blue force tracking module. * * Arguments: @@ -14,10 +13,10 @@ if (!isServer) exitWith {}; -PARAMS_1(_logic); +params ["_logic"]; [_logic, QGVAR(BFT_Enabled), "Enabled"] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(BFT_Interval), "Interval"] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(BFT_HideAiGroups), "HideAiGroups"] call EFUNC(common,readSettingFromModule); -diag_log text "[ACE]: Blue Force Tracking Module initialized. (server)"; +ACE_LOGINFO_3("Blue Force Tracking Module Initialized:", GVAR(BFT_Enabled), GVAR(BFT_Interval), GVAR(BFT_HideAiGroups)); diff --git a/addons/map/functions/fnc_compileFlashlightMenu.sqf b/addons/map/functions/fnc_compileFlashlightMenu.sqf new file mode 100644 index 0000000000..0d081bb57c --- /dev/null +++ b/addons/map/functions/fnc_compileFlashlightMenu.sqf @@ -0,0 +1,65 @@ +/* + * Author: voiper + * Compile list of flashlight classnames and add to the "Flashlight" parent menu. + * + * Arguments: + * 0: Vehicle + * 1: Player + * 3: Parameters + * + * Return value: + * None + * + * Example: + * [_player, _player, []] call ace_map_fnc_compileFlashlightMenu; + * + * Public: No + */ + +#include "script_component.hpp" + +params ["_vehicle", "_player", "_parameters"]; + +_actions = []; +_flashlights = [_player] call FUNC(getUnitFlashlights); + +//add all carried flashlight menus and on/off submenu actions +{ + _displayName = getText (configFile >> "CfgWeapons" >> _x >> "displayName"); + _icon = getText (configFile >> "CfgWeapons" >> _x >> "picture"); + + _children = { + params ["_vehicle", "_player", "_flashlight"]; + _actions = []; + + _onAction = [ + (_flashlight + "_On"), + "On", + "", + {[_this select 2] call FUNC(switchFlashlight)}, + {GVAR(flashlightInUse) != (_this select 2)}, + {}, + _flashlight + ] call EFUNC(interact_menu,createAction); + + _offAction = [ + (_flashlight + "_Off"), + "Off", + "", + {[""] call FUNC(switchFlashlight)}, + {GVAR(flashlightInUse) == (_this select 2)}, + {}, + _flashlight + ] call EFUNC(interact_menu,createAction); + + _actions pushBack [_onAction, [], _player]; + _actions pushBack [_offAction, [], _player]; + + _actions + }; + + _parentAction = [_x, _displayName, _icon, {true}, {true}, _children, _x] call EFUNC(interact_menu,createAction); + _actions pushBack [_parentAction, [], _player]; +} forEach _flashlights; + +_actions \ No newline at end of file diff --git a/addons/map/functions/fnc_determineMapLight.sqf b/addons/map/functions/fnc_determineMapLight.sqf index 9c205299e6..8204b4b7f8 100644 --- a/addons/map/functions/fnc_determineMapLight.sqf +++ b/addons/map/functions/fnc_determineMapLight.sqf @@ -55,11 +55,13 @@ _fnc_calcColor = { _lightLevel = 0.04 + (0.96 * call EFUNC(common,ambientBrightness)); +/* // check if player has NVG enabled if (currentVisionMode _unit == 1) exitWith { // stick to nvg color [true, [154/255,253/255,177/255,0.5]] }; +*/ // Do not obscure the map if the ambient light level is above 0.95 if (_lightLevel > 0.95) exitWith { @@ -122,4 +124,4 @@ if (_lightLevel > 0.95) exitWith { }; // Calculate resulting map color -[true, [_lightTint, _lightLevel] call _fnc_calcColor] +[true, [_lightTint, _lightLevel] call _fnc_calcColor] \ No newline at end of file diff --git a/addons/map/functions/fnc_flashlightGlow.sqf b/addons/map/functions/fnc_flashlightGlow.sqf new file mode 100644 index 0000000000..5e72a6c183 --- /dev/null +++ b/addons/map/functions/fnc_flashlightGlow.sqf @@ -0,0 +1,35 @@ +/* + * Author: voiper + * Add or remove global flashlight glow for when player is looking at map. + * + * Arguments: + * 0: Flashlight classname ("" for off) + * + * Return value: + * None + * + * Example: + * ["ACE_Flashlight_MX991"] call ace_map_fnc_flashlightGlow; + * + * Public: No + */ + +#include "script_component.hpp" + +params ["_flashlight"]; + +_light = GVAR(glow); +if (!isNull _light) then {deleteVehicle _light}; + +if (_flashlight != "") then { + _colour = getText (configFile >> "CfgWeapons" >> _flashlight >> "ItemInfo" >> "FlashLight" >> "ACE_Flashlight_Colour"); + if !(_colour in ["white", "red", "green", "blue", "yellow"]) then {_colour = "white"}; + _class = format["ACE_FlashlightProxy_%1", _colour]; + + _light = _class createVehicle [0,0,0]; + _light attachTo [ACE_player, [0,0.5,-0.1], "head"]; +} else { + _light = objNull; +}; + +GVAR(glow) = _light; \ No newline at end of file diff --git a/addons/map/functions/fnc_getUnitFlashlights.sqf b/addons/map/functions/fnc_getUnitFlashlights.sqf new file mode 100644 index 0000000000..8fb8066374 --- /dev/null +++ b/addons/map/functions/fnc_getUnitFlashlights.sqf @@ -0,0 +1,29 @@ +/* + * Author: voiper + * Check a unit for any flashlights that can be used on map. + * + * Arguments: + * 0: Unit to check + * + * Return value: + * Flashlight classnames (empty for none) + * + * Example: + * [unit] call ace_map_fnc_getUnitFlashlights; + * + * Public: No + */ + +#include "script_component.hpp" + +params ["_unit"]; + +_flashlights = []; + +{ + if ((isText (configFile >> "CfgWeapons" >> _x >> "ItemInfo" >> "FlashLight" >> "ACE_Flashlight_Colour")) && !(_x in _flashlights)) then { + _flashlights pushBack _x; + }; +} forEach (items _unit); + +_flashlights \ No newline at end of file diff --git a/addons/map/functions/fnc_moduleMap.sqf b/addons/map/functions/fnc_moduleMap.sqf index 514d2af034..b7db6996d6 100644 --- a/addons/map/functions/fnc_moduleMap.sqf +++ b/addons/map/functions/fnc_moduleMap.sqf @@ -8,17 +8,19 @@ * Return Value: * None */ + #include "script_component.hpp" if !(isServer) exitWith {}; -PARAMS_3(_logic,_units,_activated); +params ["_logic", "_units", "_activated"]; if !(_activated) exitWith {}; [_logic, QGVAR(mapIllumination), "MapIllumination" ] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(mapGlow), "MapGlow" ] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(mapShake), "MapShake" ] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(mapLimitZoom), "MapLimitZoom" ] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(mapShowCursorCoordinates), "MapShowCursorCoordinates"] call EFUNC(common,readSettingFromModule); -diag_log text "[ACE]: Map Module Initialized."; +ACE_LOGINFO("Map Module Initialized."); diff --git a/addons/map/functions/fnc_onDrawMap.sqf b/addons/map/functions/fnc_onDrawMap.sqf index bc147884e4..37ec5a7000 100644 --- a/addons/map/functions/fnc_onDrawMap.sqf +++ b/addons/map/functions/fnc_onDrawMap.sqf @@ -2,3 +2,6 @@ #include "script_component.hpp" ((_this select 0) displayCtrl 1016) ctrlShow GVAR(mapShowCursorCoordinates); + +// hide clock when no watch in inventory, or whatever never ever +((_this select 0) displayCtrl 101) ctrlShow GVAR(hasWatch); diff --git a/addons/map/functions/fnc_simulateMapLight.sqf b/addons/map/functions/fnc_simulateMapLight.sqf new file mode 100644 index 0000000000..9554409e15 --- /dev/null +++ b/addons/map/functions/fnc_simulateMapLight.sqf @@ -0,0 +1,89 @@ +/* +* Author: voiper +* Draw nearby lighting and sexy flashlight beams on main map. +* +* Arguments: +* 0: Map control +* 1: Map zoom level +* 2: Current map centre +* 3: Light level from ace_map_fnc_determineMapLight +* +* Return Value: +* None +* +* Public: No +*/ + +#include "script_component.hpp" + +params ["_mapCtrl", "_mapScale", "_mapCentre", "_lightLevel"]; + +_hmd = hmd ACE_player; +_flashlight = GVAR(flashlightInUse); + +//map width (on screen) in pixels +_screenSize = 640 * safeZoneW; + +//resolution params (every frame in case resolution change) +getResolution params ["_resX", "_resY", "_viewPortX", "_viewPortY", "", "_uiScale"]; + +//engine rounds the viewport ratios, when they should be fractions; this can cause problems +_realViewPortY = _resY * _uiScale; +_realViewPortX = _realViewPortY * 4/3; + +//textures +_fillTex = "#(rgb,8,8,3)color(0,0,0,1)"; + +//colour/alpha +_lightLevel params ["_r", "_g", "_b", "_a"]; +_colourAlpha = (_r + _g + _b) min _a; +_shadeAlpha = _a; + +_colourList = [_r, _g, _b]; +_colourList sort false; +_maxColour = _colourList select 0; + +//ambient colour fill +_mapCtrl drawIcon [format["#(rgb,8,8,3)color(%1,%2,%3,1)", _r / _maxColour, _g / _maxColour, _b / _maxColour], [1,1,1,_colourAlpha], _mapCentre, _screenSize, _screenSize, 0, "", 0]; + +if (_flashlight == "") then { + //ambient shade fill + _mapCtrl drawIcon [_fillTex, [1,1,1,_shadeAlpha], _mapCentre, _screenSize, _screenSize, 0, "", 0]; +} else { + //mouse pos + _mousePos = GVAR(mousePos); + + //flashlight settings + _colour = getText (configFile >> "CfgWeapons" >> _flashlight >> "ItemInfo" >> "FlashLight" >> "ACE_Flashlight_Colour"); + 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; + + //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))}; + + //assign corrective ratio to fix sub-pixel gaps/overlaps (symptom of viewport * X/Y resolution rounding) + _viewPortRatioFixY = if (_realViewPortY != _viewPortY) then { + _realViewPortX / (_realViewPortY / _viewPortY * _viewPortX) + } else { + if (_realViewPortX != _viewPortX) then { + _realViewPortX / _viewPortX + } else { + 1 + }; + }; + + //offset the elements + _offsetX = _mapScale * GVAR(worldSize) * (_screenSize * 2 + _beamSize); + _offsetYDown = _mapScale * GVAR(worldSize) * (_screenSize + _beamSize) * _viewPortRatioFixY; + //up is bigger because of a potential exploit + _offsetYUp = _mapScale * GVAR(worldSize) * (_screenSize * 4 + _beamSize) * _viewPortRatioFixY; + + //draw the matrix /whoa + _mapCtrl drawIcon [_flashTex, [1,1,1,_shadeAlpha], _mousePos, _beamSize, _beamSize, 0, "", 0]; //centre beam + _mapCtrl drawIcon [_fillTex, [1,1,1,_shadeAlpha], [(_mousePos select 0) - _offsetX, (_mousePos select 1)], _screenSize * 2, _beamSize, 0, "", 0]; //left + _mapCtrl drawIcon [_fillTex, [1,1,1,_shadeAlpha], [(_mousePos select 0) + _offsetX, (_mousePos select 1)], _screenSize * 2, _beamSize, 0, "", 0]; //right + _mapCtrl drawIcon [_fillTex, [1,1,1,_shadeAlpha], [(_mousePos select 0), (_mousePos select 1) - _offsetYDown], _screenSize * 4, _screenSize, 0, "", 0]; //down + _mapCtrl drawIcon [_fillTex, [1,1,1,_shadeAlpha], [(_mousePos select 0), (_mousePos select 1) + _offsetYUp], _screenSize * 4, _screenSize * 4, 0, "", 0]; //up +}; \ No newline at end of file diff --git a/addons/map/functions/fnc_switchFlashlight.sqf b/addons/map/functions/fnc_switchFlashlight.sqf new file mode 100644 index 0000000000..e177f886fa --- /dev/null +++ b/addons/map/functions/fnc_switchFlashlight.sqf @@ -0,0 +1,25 @@ +/* + * Author: voioper + * Switch flashlight. + * + * Arguments: + * 0: Flashlight classname ("" for off) + * + * Return value: + * None + * + * Example: + * ["ACE_Flashlight_MX991"] call ace_map_fnc_switchFlashlight; + * + * Public: No + */ + +#include "script_component.hpp" + +params ["_flashlight"]; + +GVAR(flashlightInUse) = _flashlight; +if (GVAR(mapGlow)) then { + [GVAR(flashlightInUse)] call FUNC(flashlightGlow); +}; +playSound "ACE_map_flashlightClick"; \ No newline at end of file diff --git a/addons/map/functions/fnc_updateMapEffects.sqf b/addons/map/functions/fnc_updateMapEffects.sqf index 3550df517c..72f5d0cec1 100644 --- a/addons/map/functions/fnc_updateMapEffects.sqf +++ b/addons/map/functions/fnc_updateMapEffects.sqf @@ -10,23 +10,21 @@ * * Public: No */ + #include "script_component.hpp" -private ["_mapCtrl","_mapScale"]; - -_mapCtrl = ((findDisplay 12) displayCtrl 51); +_mapCtrl = findDisplay 12 displayCtrl 51; _mapScale = ctrlMapScale _mapCtrl; +_mapCentre = _mapCtrl ctrlMapScreenToWorld [0.5, 0.5]; if (GVAR(mapIllumination)) then { - private ["_data","_darkenFill"]; + //get nearby lighting + _light = [[ACE_player], FUNC(determineMapLight), missionNamespace, QGVAR(mapLight), 0.1] call EFUNC(common,cachedCall); - // Calculate map illumination - _data = [[ACE_player], FUNC(determineMapLight), missionNamespace, QGVAR(mapLight), 0.1] call EFUNC(common,cachedCall); + _light params ["_applyLighting", "_lightLevel"]; - EXPLODE_2_PVT(_data,_darkenMap,_darkenColor); - if (_darkenMap) then { - _darkenFill = format["#(rgb,1,1,1)color(%1,%2,%3,%4)",_darkenColor select 0, _darkenColor select 1, _darkenColor select 2, _darkenColor select 3]; - _mapCtrl drawRectangle [(getArray(configFile >> 'CfgWorlds' >> worldName >> 'centerPosition')),80000,80000,0,_darkenColor,_darkenFill]; + if (_applyLighting) then { + [_mapCtrl, _mapScale, _mapCentre, _lightLevel] call FUNC(simulateMapLight); }; }; @@ -63,7 +61,7 @@ if (GVAR(mapShake)) then { GVAR(isShaking) = false; } else { // The map is still, store state - GVAR(lastStillPosition) = _mapCtrl ctrlMapScreenToWorld [0.5, 0.5]; + GVAR(lastStillPosition) = _mapCentre; GVAR(lastStillTime) = ACE_time; }; }; @@ -72,7 +70,7 @@ if (GVAR(mapShake)) then { if (GVAR(mapLimitZoom)) then { if (GVAR(minMapSize) >= _mapScale) then { ctrlMapAnimClear _mapCtrl; - _mapCtrl ctrlMapAnimAdd [0, GVAR(minMapSize) + 0.001, (_mapCtrl ctrlMapScreenToWorld [0.5, 0.5])]; + _mapCtrl ctrlMapAnimAdd [0, GVAR(minMapSize) + 0.001, _mapCentre]; ctrlMapAnimCommit _mapCtrl; }; -}; +}; \ No newline at end of file diff --git a/addons/map/stringtable.xml b/addons/map/stringtable.xml index 3f2d312fae..8f693ef37a 100644 --- a/addons/map/stringtable.xml +++ b/addons/map/stringtable.xml @@ -8,6 +8,9 @@ Karte Mapa Mapa + Carte + Térkép + Карта Map illumination? @@ -16,14 +19,31 @@ Kartenausleuchtung Osvětlení mapy Iluminação do mapa? + Luminosité + Térkép megvilágítása? + Освещение карты? - Calculate dynamic map illumination based on light conditions? - Oblicza dynamiczne oświetlenie mapy bazujące na warunkach oświetleniowych - Calcula la iluminación dinámica del mapa basandose en las condiciones de luz - Berechne die Kartenauslichtung anhand des Umgebungslichts? - Vypočítat dynamické osvětlení mapy na základně světelných podmínek? - Calcular a iluminação dinâmica do mapa de acordo com as condições de luz? + Simulate map lighting based on ambient lighting and player's items? + Symuluj oświetlenie mapy bazujące na oświetleniu otoczenia oraz przedmiotach gracza? + Calcul la luminosité de la carte en fonction des conditions de lumière + Симулировать освещение карты на основе окружающего света и приборов игрока? + Simular a luz do mapa baseado em luz ambiente e itens do jogador? + Simular iluminación de mapa basada en la iluminación ambiente y los elementos de los jugadores? + + + Map flashlight glow? + Poświata latarki + Свет фонаря на карте? + Brilho de lanterna no mapa? + Resplandor de linterna en el mapa? + + + Add external glow to players who use flashlight on map? + Pokaż poświatę światła latarki na graczu, który używa latarki na widoku mapy? + Добавить свет при использовании фонаря на карте? + Adicionar brilho externo para jogadores que usam lanterna no mapa? + Añadir resplandor externo a los jugadores que utilizan la linterna en el mapa? Map shake? @@ -32,6 +52,9 @@ Kamerawackeln Třesení mapy? Tremor de mapa? + Tremblement de la carte? + Térkép-rázkódás? + Тряска карты? Make map shake when walking? @@ -40,6 +63,9 @@ Kamerawackeln beim Gehen? Umožnit třesení mapy za pochodu? Tremer o mapa enquanto caminha? + La carte tremble lors d'un déplacement? + Rázkódjon-e a térkép mozgáskor? + Заставлять карту трястись при ходьбе? Limit map zoom? @@ -48,6 +74,9 @@ Kartenzoom einschränken Omezit přiblížení mapy? Limitar zoom do mapa? + Limiter le zoom de la carte? + Térkép-nagyítás korlátozása? + Ограничить приближение карты? Limit the amount of zoom available for the map? @@ -56,6 +85,9 @@ Zoomstufe der Karte einschränken? Omezit stupeň přiblížení pro mapu? Limitar a quantidade de zoom disponível para o mapa? + Limite le zoom maximum pour la carte? + Korlátozva legyen-e a nagyítás mennyisége a térképnél? + Ограничить максимальное приближение, доступное на карте? Show cursor coordinates? @@ -64,6 +96,9 @@ Zeige Cursor-Koordinaten? Zobrazit souřadnice u kurzoru? Mostrar coordenadas no cursor? + Afficher les coordonnées sur le curseur? + Kurzor-koordináták mutatása? + Показывать координаты курсора? Show the grid coordinates on the mouse pointer? @@ -72,6 +107,9 @@ Gitter-Koordinaten auf dem Mauszeiger anzeigen? Zobrazit souřadnice u kurzoru v mapě? Mostrar as coordenadas de grade no ponteiro do mouse? + Affiche les coordonnées à coté du curseur? + Mutatva legyen-e a kurzornál található rész rácskoordinátája? + Показывать координаты около курсора мыши? This module allows you to customize the map screen. @@ -79,14 +117,21 @@ Dieses Modul erweitert die Kartenfunktionen. Tento modul umožňuje přizpůsobit mapu s obrazem. Este módulo permite que você personalize a tela de mapa. + Ce module permet de personnaliser l'écran de la carte + Ez a modul lehetővé teszi a térképnézet testreszabását. + Этот модуль позволяет настроить отображение карты. + Este módulo permite personalizar la pantalla del mapa. Blue Force Tracking Blue Force Tracking - Blue Force Tracking + Seguimiento de fuerzas amigas Blue Force Tracking Blue Force Tracking Rastreio de forças azuis + Blue Force Tracking + Blue Force követés + Система слежения Blue Force Tracking BFT Enable @@ -94,6 +139,9 @@ Aktywuj BFT Povolit BFT Activar BFT + Activer le Suivi des Forces Alliées + BFT engedélyezése + Включить BFT Enable Blue Force Tracking. Default: No @@ -101,6 +149,9 @@ Aktywuj Blue Force Tracking. Domyślnie: Nie Povolit Blue Force Tracking. Výchozí: Ne Activar Blue Force Tracking. Por defecto: No + Activer le SFA. Défaut: non + Blue Force követés engedélyezése. Alapértelmezett: Nem + Включает систему служения BFT. По-умолчанию: Нет Interval @@ -109,6 +160,9 @@ Intervall Interval Intervalo + Intervalle + Intervallum + Интервал How often the markers should be refreshed (in seconds) @@ -117,6 +171,9 @@ Wie oft sollen die Markierungen aktualisiert werden (in Sekunden) Jak často budou značky aktualizovány (v sekundách) Frequência em que os marcadores devem ser atualizados (em segundos) + Tout les combien de temps les marqueurs doivent être rafraichit? + Milyen gyakran frissüljenek a jelölők (másodpercben) + Как часто должны обновляться маркеры (в секундах) Hide AI groups? @@ -125,6 +182,9 @@ KI-Gruppen verstecken? Skrýt AI skupiny? Esconder grupos de IA? + Cacher les groupes IA? + AI csoportok elrejtése? + Скрыть группы ботов? Hide markers for 'AI only' groups? @@ -133,6 +193,9 @@ Verstecke Marker für "nur KI"-Gruppen? Skrýt značky pouze pro AI skupiny? Esconder marcadores que pertencem ao grupo de IA? + Cacher les marqueurs pour les groupes d'IA seulement? + Jelölők elrejtése "csak AI" csoportoknál? + Скрыть маркеры групп, которые состоят полностью из ботов? This module allows the tracking of allied units with BFT map markers. @@ -140,6 +203,58 @@ Dieses Modul ermöglicht es verbündete Einheiten mit dem BFT auf der Karte zu verfolgen. Umožňuje sledovat přátelské jednokty na mapě v rámci BFT. Permite que você acompanhe as posições no mapa das unidades aliadas com marcadores RFA. + Ce module permet de suivre les unités alliées avec des marqueurs sur la carte. + Ez a modul lehetővé teszi a szövetséges egységek követését BFT térképjelzőjkkel. + Этот модуль позволяет отслеживать перемещение союзных войск по карте при помощи маркеров BFT. + Este módulo permite el seguimiento de las unidades aliadas con marcadores de mapa BFT. + + + Flashlights + Latarki + Lanternas + Фонари + Svítilny + Linternas + + + NVG + Noktowizja + Óculos de Visão Noturna + ПНВ + NVG + NVG + + + On + Włącz + Ligado + Вкл. + Zapnout + Encendido + + + Off + Wyłącz + Desligado + Выкл. + Vypnout + Apagado + + + Increase Brightness + Zwiększ czułość + Aumentar brilho + Увеличить яркость + Zvýšit jas + Aumentar brillo + + + Decrease Brightness + Zmniejsz czułość + Diminuir brilho + Уменьшить яркость + Snížit jas + Reducir brillo \ No newline at end of file diff --git a/addons/maptools/CfgVehicles.hpp b/addons/maptools/CfgVehicles.hpp index 5c3266d2d6..063f88f38b 100644 --- a/addons/maptools/CfgVehicles.hpp +++ b/addons/maptools/CfgVehicles.hpp @@ -14,7 +14,7 @@ class CfgVehicles { class ACE_MapToolsHide { displayName = CSTRING(MapToolsHide); condition = QUOTE((call FUNC(canUseMapTools) && {GVAR(mapTool_Shown) != 0})); - statement = QUOTE(GVAR(mapTool_Shown) = 0; [] call FUNC(updateMapToolMarkers)); + statement = QUOTE(GVAR(mapTool_Shown) = 0;); exceptions[] = {"isNotDragging", "notOnMap", "isNotInside", "isNotSitting"}; showDisabled = 1; priority = 5; @@ -22,7 +22,7 @@ class CfgVehicles { class ACE_MapToolsShowNormal { displayName = CSTRING(MapToolsShowNormal); condition = QUOTE((call FUNC(canUseMapTools) && {GVAR(mapTool_Shown) != 1})); - statement = QUOTE(GVAR(mapTool_Shown) = 1; [] call FUNC(updateMapToolMarkers)); + statement = QUOTE(GVAR(mapTool_Shown) = 1;); exceptions[] = {"isNotDragging", "notOnMap", "isNotInside", "isNotSitting"}; showDisabled = 1; priority = 4; @@ -30,7 +30,7 @@ class CfgVehicles { class ACE_MapToolsShowSmall { displayName = CSTRING(MapToolsShowSmall); condition = QUOTE((call FUNC(canUseMapTools) && {GVAR(mapTool_Shown) != 2})); - statement = QUOTE(GVAR(mapTool_Shown) = 2; [] call FUNC(updateMapToolMarkers)); + statement = QUOTE(GVAR(mapTool_Shown) = 2;); exceptions[] = {"isNotDragging", "notOnMap", "isNotInside", "isNotSitting"}; showDisabled = 1; priority = 3; @@ -38,7 +38,7 @@ class CfgVehicles { class ACE_MapToolsAlignNorth { displayName = CSTRING(MapToolsAlignNorth); condition = QUOTE((call FUNC(canUseMapTools) && {GVAR(mapTool_Shown) != 0})); - statement = QUOTE(GVAR(mapTool_angle) = 0; [] call FUNC(updateMapToolMarkers)); + statement = QUOTE(GVAR(mapTool_angle) = 0;); exceptions[] = {"isNotDragging", "notOnMap", "isNotInside", "isNotSitting"}; showDisabled = 1; priority = 2; @@ -46,7 +46,7 @@ class CfgVehicles { class ACE_MapToolsAlignCompass { displayName = CSTRING(MapToolsAlignCompass); condition = QUOTE((call FUNC(canUseMapTools) && {GVAR(mapTool_Shown) != 0} && {('ItemCompass' in assigneditems ACE_player) || {'ItemCompass' in assigneditems ACE_player}})); - statement = QUOTE(GVAR(mapTool_angle) = getDir ACE_player; [] call FUNC(updateMapToolMarkers)); + statement = QUOTE(GVAR(mapTool_angle) = getDir ACE_player;); exceptions[] = {"isNotDragging", "notOnMap", "isNotInside", "isNotSitting"}; showDisabled = 1; priority = 1; diff --git a/addons/maptools/README.md b/addons/maptools/README.md index 9248948efa..f03474b5c0 100644 --- a/addons/maptools/README.md +++ b/addons/maptools/README.md @@ -1,11 +1,12 @@ ace_maptools ============ -Map tools: +Adds the following map tools: - Roamer - Map drawing - Showing GPS on map + ## Maintainers The people responsible for merging changes to this component or answering potential questions. diff --git a/addons/maptools/XEH_postInitClient.sqf b/addons/maptools/XEH_postInitClient.sqf index 8129a75b15..06cb8eda3d 100644 --- a/addons/maptools/XEH_postInitClient.sqf +++ b/addons/maptools/XEH_postInitClient.sqf @@ -26,11 +26,11 @@ GVAR(drawing_controls) = [36732, 36733, 36734, 36735, 36736, 36737]; _fnc_installMapEvents = { private "_d"; _d = _this; - ((finddisplay _d) displayctrl 51) ctrlAddEventHandler ["MouseMoving", {_this call FUNC(handleMouseMove);}]; - ((finddisplay _d) displayctrl 51) ctrlAddEventHandler ["MouseButtonDown", {[1, _this] call FUNC(handleMouseButton);}]; - ((finddisplay _d) displayctrl 51) ctrlAddEventHandler ["MouseButtonUp", {[0, _this] call FUNC(handleMouseButton)}]; - ((finddisplay _d) displayctrl 51) ctrlAddEventHandler ["Draw", {_this call FUNC(updateMapToolMarkers);}]; - (finddisplay _d) displayAddEventHandler ["KeyDown", {_this call FUNC(handleKeyDown);}]; + ((findDisplay _d) displayCtrl 51) ctrlAddEventHandler ["MouseMoving", {_this call FUNC(handleMouseMove);}]; + ((findDisplay _d) displayCtrl 51) ctrlAddEventHandler ["MouseButtonDown", {[1, _this] call FUNC(handleMouseButton);}]; + ((findDisplay _d) displayCtrl 51) ctrlAddEventHandler ["MouseButtonUp", {[0, _this] call FUNC(handleMouseButton)}]; + ((findDisplay _d) displayCtrl 51) ctrlAddEventHandler ["Draw", {_this call FUNC(updateMapToolMarkers);}]; + (findDisplay _d) displayAddEventHandler ["KeyDown", {_this call FUNC(handleKeyDown);}]; }; // Wait until the briefing map is detected @@ -64,9 +64,17 @@ GVAR(drawing_controls) = [36732, 36733, 36734, 36735, 36736, 36737]; // Install event handlers on the map control and display (control = 51) GVAR(drawing_syncMarkers) = false; 12 call _fnc_installMapEvents; - - // Update the size and rotation of map tools - [] call FUNC(updateMapToolMarkers); - - [FUNC(mapStateUpdater), 0, []] call CBA_fnc_addPerFrameHandler; }; + +["visibleMapChanged", { + params ["", "_mapOn"]; + if (_mapOn) then { + // Show GPS if required + [GVAR(mapGpsShow)] call FUNC(openMapGps); + } else { + // Hide GPS + [false] call FUNC(openMapGps); + // Cancel drawing + call FUNC(cancelDrawing); + }; +}] call EFUNC(common,addEventHandler); diff --git a/addons/maptools/XEH_preInit.sqf b/addons/maptools/XEH_preInit.sqf index 2da38996c3..2bcd68385a 100644 --- a/addons/maptools/XEH_preInit.sqf +++ b/addons/maptools/XEH_preInit.sqf @@ -16,7 +16,6 @@ PREP(handleMouseButton); PREP(handleMouseMove); PREP(handleMouseZChanged); PREP(isInsideMapTool); -PREP(mapStateUpdater); PREP(openMapGps); PREP(openMapGpsUpdate); PREP(removeLineMarker); diff --git a/addons/maptools/functions/fnc_addLineMarker.sqf b/addons/maptools/functions/fnc_addLineMarker.sqf index 157891a262..017dc5b494 100644 --- a/addons/maptools/functions/fnc_addLineMarker.sqf +++ b/addons/maptools/functions/fnc_addLineMarker.sqf @@ -15,7 +15,7 @@ */ #include "script_component.hpp" -PARAMS_4(_name,_startPos,_endPos,_color); +params ["_name", "_startPos", "_endPos", "_color"]; private ["_marker", "_difPos", "_mag"]; diff --git a/addons/maptools/functions/fnc_calculateMapScale.sqf b/addons/maptools/functions/fnc_calculateMapScale.sqf index 4723a4f5e1..78bfae43af 100644 --- a/addons/maptools/functions/fnc_calculateMapScale.sqf +++ b/addons/maptools/functions/fnc_calculateMapScale.sqf @@ -14,7 +14,7 @@ private ["_screenOffset", "_pos"]; -_pos = ((finddisplay 12) displayctrl 51) ctrlMapScreenToWorld [0.5, 0.5]; -_screenOffset = ((finddisplay 12) displayctrl 51) posWorldToScreen [(_pos select 0) + 100, (_pos select 1)]; +_pos = ((findDisplay 12) displayCtrl 51) ctrlMapScreenToWorld [0.5, 0.5]; +_screenOffset = ((findDisplay 12) displayCtrl 51) posWorldToScreen [(_pos select 0) + 100, (_pos select 1)]; (_screenOffset select 0) - 0.5 diff --git a/addons/maptools/functions/fnc_copyMapReceiveMarkers.sqf b/addons/maptools/functions/fnc_copyMapReceiveMarkers.sqf index 44f6ed6203..6c3c706208 100644 --- a/addons/maptools/functions/fnc_copyMapReceiveMarkers.sqf +++ b/addons/maptools/functions/fnc_copyMapReceiveMarkers.sqf @@ -12,7 +12,7 @@ */ #include "script_component.hpp" -PARAMS_1(_lineMarkers); +params ["_lineMarkers"]; { private "_marker"; diff --git a/addons/maptools/functions/fnc_copyMapRemoteSend.sqf b/addons/maptools/functions/fnc_copyMapRemoteSend.sqf index f4aebf6093..551019f900 100644 --- a/addons/maptools/functions/fnc_copyMapRemoteSend.sqf +++ b/addons/maptools/functions/fnc_copyMapRemoteSend.sqf @@ -12,6 +12,6 @@ #include "script_component.hpp" -PARAMS_1(_requester); +params ["_requester"]; ["drawing_sendbackMarkers", _requester, [GVAR(drawing_lineMarkers)]] call EFUNC(common,targetEvent); diff --git a/addons/maptools/functions/fnc_copyMapStart.sqf b/addons/maptools/functions/fnc_copyMapStart.sqf index a39c74d225..7295f6f499 100644 --- a/addons/maptools/functions/fnc_copyMapStart.sqf +++ b/addons/maptools/functions/fnc_copyMapStart.sqf @@ -17,6 +17,6 @@ #include "script_component.hpp" -PARAMS_1(_player,_target); +params ["_player", "_target"]; ["drawing_requestMarkers", _target, [_player]] call EFUNC(common,targetEvent); diff --git a/addons/maptools/functions/fnc_handleKeyDown.sqf b/addons/maptools/functions/fnc_handleKeyDown.sqf index d1f9e199c9..a83522ac91 100644 --- a/addons/maptools/functions/fnc_handleKeyDown.sqf +++ b/addons/maptools/functions/fnc_handleKeyDown.sqf @@ -15,11 +15,12 @@ #include "script_component.hpp" -PARAMS_5(_display,_code,_shiftKey,_ctrlKey,_altKey); +params ["", "_code"]; +TRACE_1("params",_code); private ["_handled", "_relPos", "_diffVector", "_magDiffVector", "_lambdaLong", "_lambdaTrasAbs"]; -_handled = false; +_handled = false; #define DIK_ESCAPE 0x01 #define DIK_DELETE 0xD3 @@ -30,6 +31,7 @@ if (_code == DIK_ESCAPE) exitWith { call FUNC(cancelDrawing); _handled = true; }; + _handled }; if (_code == DIK_DELETE) exitWith { @@ -65,6 +67,7 @@ if (_code == DIK_DELETE) exitWith { }; } forEach GVAR(drawing_lineMarkers); }; + _handled }; _handled diff --git a/addons/maptools/functions/fnc_handleMouseButton.sqf b/addons/maptools/functions/fnc_handleMouseButton.sqf index 16cabe9719..19869ee3ce 100644 --- a/addons/maptools/functions/fnc_handleMouseButton.sqf +++ b/addons/maptools/functions/fnc_handleMouseButton.sqf @@ -1,6 +1,5 @@ /* * Author: esteldunedain - * * Handle mouse buttons. * * Argument: @@ -13,46 +12,39 @@ #include "script_component.hpp" -private ["_control", "_button", "_screenPos", "_shiftKey", "_ctrlKey", "_handled", "_pos", "_altKey", "_gui", "_marker"]; +params ["_dir", "_params"]; +_params params ["_control", "_button", "_screenPosX", "_screenPosY", "_shiftKey", "_ctrlKey", "_altKey"]; +TRACE_2("params",_dir,_params); -PARAMS_2(_dir,_params); -_control = _params select 0; -_button = _params select 1; -_screenPos = [_params select 2, _params select 3]; -_shiftKey = _params select 4; -_ctrlKey = _params select 5; -_altKey = _params select 6; -_handled = false; +private["_gui", "_handled", "_marker", "_pos"]; +_handled = false; // If it's not a left button event, exit -if (_button != 0) exitWith {}; +if (_button != 0) exitWith {_handled}; // If releasing -if (_dir != 1 && (GVAR(mapTool_isDragging) or GVAR(mapTool_isRotating))) exitWith { - GVAR(mapTool_isDragging) = false; - GVAR(mapTool_isRotating) = false; - _handled = true; - _handled -}; - -// If clicking -if (_dir == 1) exitWith { - +if (_dir != 1) then { + if (GVAR(mapTool_isDragging) || GVAR(mapTool_isRotating)) then { + GVAR(mapTool_isDragging) = false; + GVAR(mapTool_isRotating) = false; + _handled = true; + }; +} else { + // If clicking if !(call FUNC(canDraw)) exitWith {_handled = false;}; // Transform mouse screen position to coordinates - _pos = _control ctrlMapScreenToWorld _screenPos; + _pos = _control ctrlMapScreenToWorld [_screenPosX, _screenPosY]; _pos set [count _pos, 0]; if (GVAR(drawing_isDrawing)) exitWith { // Already drawing -> Add tempLineMarker to permanent list if (GVAR(drawing_syncMarkers)) then { deleteMarkerLocal (GVAR(drawing_tempLineMarker) select 0); - // [GVAR(drawing_tempLineMarker), "FUNC(addLineMarker)", 2] call EFUNC(common,execRemoteFnc); ["drawing_addLineMarker", GVAR(drawing_tempLineMarker)] call EFUNC(common,globalEvent); // Log who drew on the briefing screen - (text format ["[ACE] Server: Player %1 drew on the briefing screen", name player]) call EFUNC(common,serverLog); + (text format ["[ACE] Server: Player %1 drew on the briefing screen", profileName]) call EFUNC(common,serverLog); } else { GVAR(drawing_tempLineMarker) call FUNC(updateLineMarker); GVAR(drawing_lineMarkers) pushBack (+GVAR(drawing_tempLineMarker)); @@ -96,6 +88,7 @@ if (_dir == 1) exitWith { }; _handled = true; }; + _handled }; _handled diff --git a/addons/maptools/functions/fnc_handleMouseMove.sqf b/addons/maptools/functions/fnc_handleMouseMove.sqf index 2148c5a162..b27087290b 100644 --- a/addons/maptools/functions/fnc_handleMouseMove.sqf +++ b/addons/maptools/functions/fnc_handleMouseMove.sqf @@ -1,6 +1,5 @@ /* * Author: esteldunedain - * * Handle mouse movement over the map tool. * * Argument: @@ -13,11 +12,12 @@ #include "script_component.hpp" +params ["_control", "_mousePosX", "_mousePosY"]; +TRACE_3("params",_control,_mousePosX,_mousePosY); + private ["_control", "_pos"]; -_control = _this select 0; -_pos = [_this select 1, _this select 2]; -GVAR(mousePosition) = _control ctrlMapScreenToWorld _pos; +GVAR(mousePosition) = _control ctrlMapScreenToWorld [_mousePosX, _mousePosY]; GVAR(mousePosition) set [2, 0]; //convert 2d pos to 3d // If cannot draw then exit @@ -32,6 +32,7 @@ if !(call FUNC(canDraw)) exitWith { // Handle drawing if (GVAR(drawing_isDrawing)) exitWith { GVAR(drawing_tempLineMarker) set [2, GVAR(mousePosition)]; + TRACE_1("updating line pos",GVAR(mousePosition)); GVAR(drawing_tempLineMarker) call FUNC(updateLineMarker); false }; @@ -44,8 +45,6 @@ if (GVAR(mapTool_isDragging)) exitWith { GVAR(mapTool_pos) set [0, (GVAR(mapTool_startPos) select 0) + (GVAR(mousePosition) select 0) - (GVAR(mapTool_startDragPos) select 0)]; GVAR(mapTool_pos) set [1, (GVAR(mapTool_startPos) select 1) + (GVAR(mousePosition) select 1) - (GVAR(mapTool_startDragPos) select 1)]; - // Update the size and rotation of the maptool - [] call FUNC(updateMapToolMarkers); true }; @@ -56,8 +55,6 @@ if (GVAR(mapTool_isRotating)) exitWith { _angle = (180 + ((GVAR(mousePosition) select 0) - (GVAR(mapTool_startPos) select 0)) atan2 ((GVAR(mousePosition) select 1) - (GVAR(mapTool_startPos) select 1)) mod 360); GVAR(mapTool_angle) = GVAR(mapTool_startAngle) + _angle - GVAR(mapTool_startDragAngle); - // Update the size and rotation of the maptool - [] call FUNC(updateMapToolMarkers); true }; diff --git a/addons/maptools/functions/fnc_handleMouseZChanged.sqf b/addons/maptools/functions/fnc_handleMouseZChanged.sqf index 35626238e5..0af86a81c5 100644 --- a/addons/maptools/functions/fnc_handleMouseZChanged.sqf +++ b/addons/maptools/functions/fnc_handleMouseZChanged.sqf @@ -17,8 +17,6 @@ private ["_dir", "_params", "_control", "_button", "_screenPos", "_shiftKey", "_ _control = _this select 0; _dir = _this select 1; -diag_log "Scroll"; -diag_log _this; _handled = false; _handled = true; diff --git a/addons/maptools/functions/fnc_mapStateUpdater.sqf b/addons/maptools/functions/fnc_mapStateUpdater.sqf deleted file mode 100644 index 2b4e634567..0000000000 --- a/addons/maptools/functions/fnc_mapStateUpdater.sqf +++ /dev/null @@ -1,33 +0,0 @@ - -#include "script_component.hpp" - -if (visibleMap) then { - // Show/Hide draw buttons - if ("ACE_MapTools" in items ACE_player) then { - { ((finddisplay 12) displayctrl _x) ctrlShow true; } forEach GVAR(drawing_controls); - } else { - { ((finddisplay 12) displayctrl _x) ctrlShow false; } forEach GVAR(drawing_controls); - if (GVAR(drawing_isDrawing)) then { - call FUNC(cancelDrawing); - }; - }; -}; - -//When Map is Closed: -if (GVAR(mapVisableLastFrame) && (!visibleMap)) then { - GVAR(mapVisableLastFrame) = false; - // Hide GPS - [false] call FUNC(openMapGps); - // Cancel drawing - call FUNC(cancelDrawing); -}; - -//When Map is Opened: -if ((!GVAR(mapVisableLastFrame)) && (visibleMap)) then { - //todo: "mapOpened" Event???? - GVAR(mapVisableLastFrame) = true; - // Show and update map tools if required - [] call FUNC(updateMapToolMarkers); - // Show GPS if required - [GVAR(mapGpsShow)] call FUNC(openMapGps); -}; diff --git a/addons/maptools/functions/fnc_openMapGps.sqf b/addons/maptools/functions/fnc_openMapGps.sqf index 7d29d9e169..dc2df07b57 100644 --- a/addons/maptools/functions/fnc_openMapGps.sqf +++ b/addons/maptools/functions/fnc_openMapGps.sqf @@ -12,7 +12,7 @@ */ #include "script_component.hpp" -PARAMS_1(_shouldOpenGps); +params ["_shouldOpenGps"]; private ["_isOpen"]; diff --git a/addons/maptools/functions/fnc_removeLineMarker.sqf b/addons/maptools/functions/fnc_removeLineMarker.sqf index be82970524..bd0a16adb1 100644 --- a/addons/maptools/functions/fnc_removeLineMarker.sqf +++ b/addons/maptools/functions/fnc_removeLineMarker.sqf @@ -11,7 +11,7 @@ #include "script_component.hpp" -PARAMS_1(_name); +params ["_name"]; deleteMarkerLocal _name; { diff --git a/addons/maptools/functions/fnc_updateLineMarker.sqf b/addons/maptools/functions/fnc_updateLineMarker.sqf index a745bfa123..12aee5b1df 100644 --- a/addons/maptools/functions/fnc_updateLineMarker.sqf +++ b/addons/maptools/functions/fnc_updateLineMarker.sqf @@ -13,7 +13,8 @@ */ #include "script_component.hpp" -PARAMS_4(_name,_startPos,_endPos,_color); +params ["_name", "_startPos", "_endPos", "_color"]; +TRACE_4("params",_name,_startPos,_endPos,_color); private ["_difPos", "_mag"]; diff --git a/addons/maptools/functions/fnc_updateMapToolMarkers.sqf b/addons/maptools/functions/fnc_updateMapToolMarkers.sqf index fa6db8872a..5d11c6a6e9 100644 --- a/addons/maptools/functions/fnc_updateMapToolMarkers.sqf +++ b/addons/maptools/functions/fnc_updateMapToolMarkers.sqf @@ -16,9 +16,19 @@ #define CENTER_OFFSET_Y_PERC 0.1606 #define CONSTANT_SCALE 0.2 -PARAMS_1(_theMap); +params ["_theMap"]; -private ["_rotatingTexture", "_textureWidth", "_scale", "_xPos", "_yPos"]; +private ["_rotatingTexture", "_textureWidth", "_scaleX", "_scaleY", "_xPos", "_yPos"]; + +// Show/Hide draw buttons +if ([] call FUNC(canDraw)) then { + { ((findDisplay 12) displayCtrl _x) ctrlShow true; } forEach GVAR(drawing_controls); +} else { + { ((findDisplay 12) displayCtrl _x) ctrlShow false; } forEach GVAR(drawing_controls); + if (GVAR(drawing_isDrawing)) then { + call FUNC(cancelDrawing); + }; +}; if (!("ACE_MapTools" in items ACE_player)|| {GVAR(mapTool_Shown) == 0}) exitWith {}; @@ -33,16 +43,18 @@ if (GVAR(mapTool_Shown) == 1) then { }; // Update scale of both parts -_scale = _textureWidth * CONSTANT_SCALE * (call FUNC(calculateMapScale)); +getResolution params ["_resWidth", "_resHeight", "", "", "_aspectRatio"]; +_scaleX = 32 * _textureWidth * CONSTANT_SCALE * (call FUNC(calculateMapScale)); +_scaleY = _scaleX * ((_resWidth / _resHeight) / _aspectRatio); //handle bad aspect ratios // Position of the fixed part _xPos = GVAR(mapTool_pos) select 0; _yPos = (GVAR(mapTool_pos) select 1) + _textureWidth * CENTER_OFFSET_Y_PERC; -_theMap drawIcon [QUOTE(PATHTOF(data\mapToolFixed.paa)), [1,1,1,1], [_xPos,_yPos], (32 * _scale), (32 * _scale), 0, "", 0]; +_theMap drawIcon [QUOTE(PATHTOF(data\mapToolFixed.paa)), [1,1,1,1], [_xPos,_yPos], _scaleX, _scaleY, 0, "", 0]; // Position and rotation of the rotating part _xPos = (GVAR(mapTool_pos) select 0) + sin(GVAR(mapTool_angle)) * _textureWidth * CENTER_OFFSET_Y_PERC; _yPos = (GVAR(mapTool_pos) select 1) + cos(GVAR(mapTool_angle)) * _textureWidth * CENTER_OFFSET_Y_PERC; -_theMap drawIcon [_rotatingTexture, [1,1,1,1], [_xPos,_yPos], (32 * _scale), (32 * _scale), GVAR(mapTool_angle), "", 0]; +_theMap drawIcon [_rotatingTexture, [1,1,1,1], [_xPos,_yPos], _scaleX, _scaleY, GVAR(mapTool_angle), "", 0]; diff --git a/addons/markers/XEH_preInit.sqf b/addons/markers/XEH_preInit.sqf index b2b9ed5c00..e47514f4fa 100644 --- a/addons/markers/XEH_preInit.sqf +++ b/addons/markers/XEH_preInit.sqf @@ -46,7 +46,8 @@ if (isNil QGVAR(MarkerColorsCache)) then { _rgba set [_forEachIndex, call compile _x]; }; } forEach _rgba; - _icon = format ["#(argb,8,8,3)color(%1,%2,%3,%4)", _rgba select 0, _rgba select 1, _rgba select 2, _rgba select 3]; + _rgba params ["_red", "_green", "_blue", "_alpha"]; + _icon = format ["#(argb,8,8,3)color(%1,%2,%3,%4)", _red, _green, _blue, _alpha]; GVAR(MarkerColorsCache) pushBack [_name, _a, _icon]; }; diff --git a/addons/markers/functions/fnc_initInsertMarker.sqf b/addons/markers/functions/fnc_initInsertMarker.sqf index c55e07c360..07e2bc46c4 100644 --- a/addons/markers/functions/fnc_initInsertMarker.sqf +++ b/addons/markers/functions/fnc_initInsertMarker.sqf @@ -7,7 +7,7 @@ * 0: RscDisplayInsertMarker * * Return Value: - * Nothing + * None * * Example: * [onLoad] call ace_markers_fnc_initInsertMarker; @@ -19,11 +19,12 @@ #define BORDER 0.005 [{ - private ["_display", "_text", "_picture", "_channel", "_buttonOK", "_buttonCancel", "_description", "_title", "_descriptionChannel", "_sizeX", "_sizeY", "_aceShapeLB", "_aceColorLB", "_aceAngleSlider", "_aceAngleSliderText", "_mapIDD", "_pos", "_posX", "_posY", "_posW", "_posH", "_offsetButtons", "_buttonOk", "_curSelShape", "_curSelColor", "_curSelAngle"]; + private ["_text", "_picture", "_channel", "_buttonOK", "_buttonCancel", "_description", "_title", "_descriptionChannel", "_sizeX", "_sizeY", "_aceShapeLB", "_aceColorLB", "_aceAngleSlider", "_aceAngleSliderText", "_mapIDD", "_pos", "_offsetButtons", "_buttonOk", "_curSelShape", "_curSelColor", "_curSelAngle"]; disableserialization; - PARAMS_1(_display); - + params ["_display"]; + TRACE_1("params",_display); + //Can't place markers when can't interact if (!([ACE_player, objNull, ["notOnMap", "isNotInside", "isNotSitting"]] call EFUNC(common,canInteractWith))) exitWith { _display closeDisplay 2; //emulate "Cancel" button @@ -76,10 +77,8 @@ //--- Background _pos = ctrlposition _text; - _posX = (_pos select 0) + 0.01; - _posY = _pos select 1; - _posW = _pos select 2; - _posH = _pos select 3; + _pos params ["_posX", "_posY", "_posW", "_posH"]; + _posX = _posX + 0.01; _posY = _posY min ((safeZoneH + safeZoneY) - (8 * _posH + 8 * BORDER)); //prevent buttons being placed below bottom edge of screen _pos set [0,_posX]; _pos set [1,_posY]; @@ -173,9 +172,10 @@ // init marker shape lb lbClear _aceShapeLB; { - _aceShapeLB lbAdd (_x select 0); - _aceShapeLB lbSetValue [_forEachIndex, _x select 1]; - _aceShapeLB lbSetPicture [_forEachIndex, _x select 2]; + _x params ["_add", "_set", "_pic"]; + _aceShapeLB lbAdd _add; + _aceShapeLB lbSetValue [_forEachIndex, _set]; + _aceShapeLB lbSetPicture [_forEachIndex, _pic]; } forEach GVAR(MarkersCache); _curSelShape = GETGVAR(curSelMarkerShape,0); _aceShapeLB lbSetCurSel _curSelShape; @@ -188,9 +188,10 @@ // init marker color lb lbClear _aceColorLB; { - _aceColorLB lbAdd (_x select 0); - _aceColorLB lbSetValue [_forEachIndex, _x select 1]; - _aceColorLB lbSetPicture [_forEachIndex, _x select 2]; + _x params ["_add", "_set", "_pic"]; + _aceColorLB lbAdd _add; + _aceColorLB lbSetValue [_forEachIndex, _set]; + _aceColorLB lbSetPicture [_forEachIndex, _pic]; } forEach GVAR(MarkerColorsCache); _curSelColor = GETGVAR(curSelMarkerColor,0); _aceColorLB lbSetCurSel _curSelColor; diff --git a/addons/markers/functions/fnc_mapDrawEH.sqf b/addons/markers/functions/fnc_mapDrawEH.sqf index 2e23dacec8..babdfbbb44 100644 --- a/addons/markers/functions/fnc_mapDrawEH.sqf +++ b/addons/markers/functions/fnc_mapDrawEH.sqf @@ -6,7 +6,7 @@ * 0: TheMap * * Return Value: - * Nothing + * None * * Example: * [theMapControl] call ace_markers_fnc_mapDrawEH; @@ -15,9 +15,10 @@ */ #include "script_component.hpp" -private ["_theMap", "_sizeX", "_sizeY", "_textureConfig", "_texture", "_markerSize", "_markerShadow", "_colorConfig", "_drawColor"]; +private ["_sizeX", "_sizeY", "_textureConfig", "_texture", "_markerSize", "_markerShadow", "_colorConfig", "_drawColor"]; -PARAMS_1(_theMap); +params ["_theMap"]; +// TRACE_1("params",_theMap); //Only show if marker place is open: if (isNull (findDisplay 54)) exitWith {}; diff --git a/addons/markers/functions/fnc_onLBSelChangedColor.sqf b/addons/markers/functions/fnc_onLBSelChangedColor.sqf index e089569761..0b9c5af209 100644 --- a/addons/markers/functions/fnc_onLBSelChangedColor.sqf +++ b/addons/markers/functions/fnc_onLBSelChangedColor.sqf @@ -7,7 +7,7 @@ * 1: Selected Index * * Return Value: - * Nothing + * None * * Example: * [ColorLB, 5] call ace_markers_fnc_onLBSelChangedColor; @@ -18,7 +18,9 @@ private ["_data", "_config"]; -PARAMS_2(_ctrl,_index); +params ["_ctrl", "_index"]; +TRACE_2("params",_ctrl,_index); + _data = _ctrl lbValue _index; GVAR(curSelMarkerColor) = _index; diff --git a/addons/markers/functions/fnc_onLBSelChangedShape.sqf b/addons/markers/functions/fnc_onLBSelChangedShape.sqf index ff067a467b..c8587e6205 100644 --- a/addons/markers/functions/fnc_onLBSelChangedShape.sqf +++ b/addons/markers/functions/fnc_onLBSelChangedShape.sqf @@ -7,7 +7,7 @@ * 1: Selected Index * * Return Value: - * Nothing + * None * * Example: * [ColorLB, 5] call ace_markers_fnc_onLBSelChangedShape; @@ -18,7 +18,9 @@ private ["_data", "_config"]; -PARAMS_2(_ctrl,_index); +params ["_ctrl", "_index"]; +TRACE_2("params",_ctrl,_index); + _data = _ctrl lbValue _index; GVAR(curSelMarkerShape) = _index; diff --git a/addons/markers/functions/fnc_onSliderPosChangedAngle.sqf b/addons/markers/functions/fnc_onSliderPosChangedAngle.sqf index 1210b8ce71..16c6acfad9 100644 --- a/addons/markers/functions/fnc_onSliderPosChangedAngle.sqf +++ b/addons/markers/functions/fnc_onSliderPosChangedAngle.sqf @@ -7,7 +7,7 @@ * 1: Slider Data (angle: -180..180) * * Return Value: - * Nothing + * None * * Example: * [Slider, 2] call ace_markers_fnc_onSliderPosChangedAngle; @@ -18,7 +18,8 @@ private ["_direction"]; -PARAMS_2(_ctrl,_data); +params ["_ctrl", "_data"]; +TRACE_2("params",_ctrl,_data); _direction = round _data; if (_direction < 0) then { diff --git a/addons/markers/functions/fnc_placeMarker.sqf b/addons/markers/functions/fnc_placeMarker.sqf index fd584c1c99..36b61151ee 100644 --- a/addons/markers/functions/fnc_placeMarker.sqf +++ b/addons/markers/functions/fnc_placeMarker.sqf @@ -7,7 +7,7 @@ * 1: CloseNumber (1 = ButtonOk) * * Return Value: - * Nothing + * None * * Example: * [onUnloadEvent] call ace_markers_fnc_placeMarker; @@ -17,7 +17,8 @@ #include "script_component.hpp" disableserialization; -PARAMS_2(_display,_closeNum); +params ["_display", "_closeNum"]; +TRACE_2("params",_display,_closeNum); if (_closeNum == 1) then { diff --git a/addons/markers/functions/fnc_sendMarkersJIP.sqf b/addons/markers/functions/fnc_sendMarkersJIP.sqf index 99eea2f2d9..73a00519e3 100644 --- a/addons/markers/functions/fnc_sendMarkersJIP.sqf +++ b/addons/markers/functions/fnc_sendMarkersJIP.sqf @@ -6,7 +6,7 @@ * 0: Logic * * Return Value: - * Nothing + * None * * Example: * [onUnloadEvent] call ace_markers_fnc_sendMarkerJIP; @@ -15,11 +15,11 @@ */ #include "script_component.hpp" -PARAMS_1(_logic); +params ["_logic"]; +TRACE_1("params",_logic); -[QGVAR(setMarkerJIP), [_logic], [ -GETGVAR(allMapMarkers,[]), -GETGVAR(allMapMarkersProperties,[]), -_logic -] +[ + QGVAR(setMarkerJIP), + [_logic], + [GETGVAR(allMapMarkers,[]), GETGVAR(allMapMarkersProperties,[]), _logic] ] call EFUNC(common,targetEvent); diff --git a/addons/markers/functions/fnc_setMarkerJIP.sqf b/addons/markers/functions/fnc_setMarkerJIP.sqf index 0760cc6fe5..4e6b47b46b 100644 --- a/addons/markers/functions/fnc_setMarkerJIP.sqf +++ b/addons/markers/functions/fnc_setMarkerJIP.sqf @@ -8,7 +8,7 @@ * 2: Logic * * Return Value: - * Nothing + * None * * Example: * [[],[],dummyLogic] call ace_markers_fnc_setMarkerJIP; @@ -17,32 +17,34 @@ */ #include "script_component.hpp" -private ["_index", "_data", "_config"]; - -PARAMS_3(_allMapMarkers,_allMapMarkersProperties,_logic); +params ["_allMapMarkers", "_allMapMarkersProperties", "_logic"]; +TRACE_3("params",_allMapMarkers,_allMapMarkersProperties,_logic); { + private ["_index", "_data", "_config"]; + _index = _allMapMarkers find _x; if (_index != -1) then { _data = _allMapMarkersProperties select _index; + _data params ["_name", "_color", "_pos", "_dir"]; - _config = (configfile >> "CfgMarkers") >> (_data select 0); + _config = (configfile >> "CfgMarkers") >> _name; if (!isClass _config) then { WARNING("CfgMarker not found, changed to milDot"); _config == (configFile >> "CfgMarkers" >> "MilDot"); }; _x setMarkerTypeLocal (configName _config); - _config = (configfile >> "CfgMarkerColors") >> (_data select 1); + _config = (configfile >> "CfgMarkerColors") >> _color; if (!isClass _config) then { WARNING("CfgMarkerColors not found, changed to Default"); _config == (configFile >> "CfgMarkerColors" >> "Default"); }; _x setMarkerColorLocal (configName _config); - _x setMarkerPosLocal (_data select 2); - _x setMarkerDirLocal (_data select 3); + _x setMarkerPosLocal _pos; + _x setMarkerDirLocal _dir; }; } forEach allMapMarkers; diff --git a/addons/markers/functions/fnc_setMarkerNetwork.sqf b/addons/markers/functions/fnc_setMarkerNetwork.sqf index 457d5dac37..c56a1fb93c 100644 --- a/addons/markers/functions/fnc_setMarkerNetwork.sqf +++ b/addons/markers/functions/fnc_setMarkerNetwork.sqf @@ -8,7 +8,7 @@ * 1: Marker Data * * Return Value: - * Nothing + * None * * Example: * [[],[],dummyLogic] call ace_markers_fnc_setMarkerJIP; @@ -19,8 +19,10 @@ private ["_config"]; -PARAMS_2(_marker,_data); -EXPLODE_4_PVT(_data,_markerClassname,_colorClassname,_markerPos,_markerDir); +params ["_marker", "_data"]; +_data params ["_markerClassname", "_colorClassname", "_markerPos", "_markerDir"]; +TRACE_2("params",_marker,_data); + _config = (configfile >> "CfgMarkers") >> _markerClassname; if (!isClass _config) then { diff --git a/addons/medical/ACE_Medical_Actions.hpp b/addons/medical/ACE_Medical_Actions.hpp index ecb9afdfe4..2912c87011 100644 --- a/addons/medical/ACE_Medical_Actions.hpp +++ b/addons/medical/ACE_Medical_Actions.hpp @@ -122,6 +122,17 @@ class ACE_Torso { enableInside = 1; icon = PATHTOF(UI\icons\triageCard.paa); }; + class Diagnose { + displayName = CSTRING(Actions_Diagnose); + distance = 5.0; + condition = QUOTE([ARR_4(_player, _target, 'body', 'Diagnose')] call DFUNC(canTreatCached)); + statement = QUOTE([ARR_4(_player, _target, 'body', 'Diagnose')] call DFUNC(treatment)); + EXCEPTIONS + showDisabled = 0; + priority = 2; + hotkey = ""; + icon = ""; + }; // Advanced medical class FieldDressing { diff --git a/addons/medical/ACE_Medical_Treatments.hpp b/addons/medical/ACE_Medical_Treatments.hpp index d94ba333d2..ea9e03974a 100644 --- a/addons/medical/ACE_Medical_Treatments.hpp +++ b/addons/medical/ACE_Medical_Treatments.hpp @@ -7,6 +7,7 @@ class ACE_Medical_Actions { category = "bandage"; treatmentLocations[] = {"All"}; allowedSelections[] = {"All"}; + allowSelfTreatment = 1; requiredMedic = 0; treatmentTime = 5; treatmentTimeSelfCoef = 1; @@ -32,6 +33,7 @@ class ACE_Medical_Actions { displayName = CSTRING(Inject_Morphine); displayNameProgress = CSTRING(Injecting_Morphine); allowedSelections[] = {"hand_l", "hand_r", "leg_l", "leg_r"}; + allowSelfTreatment = 1; category = "medication"; treatmentTime = 2; items[] = {"ACE_morphine"}; @@ -43,6 +45,7 @@ class ACE_Medical_Actions { displayName = CSTRING(Inject_Epinephrine); displayNameProgress = CSTRING(Injecting_Epinephrine); allowedSelections[] = {"hand_l", "hand_r", "leg_l", "leg_r"}; + allowSelfTreatment = 1; category = "medication"; requiredMedic = 1; treatmentTime = 3; @@ -55,6 +58,7 @@ class ACE_Medical_Actions { displayName = CSTRING(Transfuse_Blood); displayNameProgress = CSTRING(Transfusing_Blood); allowedSelections[] = {"hand_l", "hand_r", "leg_l", "leg_r"}; + allowSelfTreatment = 0; category = "advanced"; requiredMedic = 1; treatmentTime = 20; @@ -93,7 +97,7 @@ class ACE_Medical_Actions { displayNameProgress = CSTRING(Actions_Diagnosing); category = "examine"; treatmentLocations[] = {"All"}; - allowedSelections[] = {"head"}; + allowedSelections[] = {"head", "body"}; requiredMedic = 0; treatmentTime = 1; items[] = {}; @@ -105,6 +109,29 @@ class ACE_Medical_Actions { itemConsumed = 0; litter[] = {}; }; + class CPR: Bandage { + displayName = CSTRING(Actions_CPR); + displayNameProgress = CSTRING(Actions_PerformingCPR); + category = "advanced"; + treatmentLocations[] = {"All"}; + allowedSelections[] = {"body"}; + allowSelfTreatment = 0; + requiredMedic = 0; + treatmentTime = 15; + items[] = {}; + condition = QUOTE(!([(_this select 1)] call ace_common_fnc_isAwake) && GVAR(enableRevive)>0); + callbackSuccess = QUOTE(DFUNC(treatmentAdvanced_CPR)); + callbackFailure = ""; + callbackProgress = "!([((_this select 0) select 1)] call ace_common_fnc_isAwake)"; + animationPatient = ""; + animationPatientUnconscious = "AinjPpneMstpSnonWrflDnon_rolltoback"; + animationCaller = "AinvPknlMstpSlayWnonDnon_medic"; + animationCallerProne = "AinvPpneMstpSlayW[wpn]Dnon_medic"; + animationCallerSelf = ""; + animationCallerSelfProne = ""; + itemConsumed = 0; + litter[] = {}; + }; }; class Advanced { @@ -115,10 +142,11 @@ class ACE_Medical_Actions { // Which locations can this treatment action be used? Available: Field, MedicalFacility, MedicalVehicle, All. treatmentLocations[] = {"All"}; allowedSelections[] = {"All"}; + allowSelfTreatment = 1; // What is the level of medical skill required for this treatment action? 0 = all soldiers, 1 = medic, 2 = doctor requiredMedic = 0; // The time it takes for a treatment action to complete. Time is in seconds. - treatmentTime = 5; + treatmentTime = 8; // Item required for the action. Leave empty for no item required. items[] = {"ACE_fieldDressing"}; condition = ""; @@ -154,9 +182,9 @@ class ACE_Medical_Actions { class Tourniquet: fieldDressing { displayName = CSTRING(Apply_Tourniquet); displayNameProgress = CSTRING(Applying_Tourniquet); - allowedSelections[] = {"hand_l", "hand_r", "leg_l", "leg_r", "body"}; + allowedSelections[] = {"hand_l", "hand_r", "leg_l", "leg_r"}; items[] = {"ACE_tourniquet"}; - treatmentTime = 6; + treatmentTime = 4; callbackSuccess = QUOTE(DFUNC(treatmentTourniquet)); condition = QUOTE(!([ARR_2(_this select 1, _this select 2)] call FUNC(hasTourniquetAppliedTo))); litter[] = {}; @@ -188,6 +216,7 @@ class ACE_Medical_Actions { displayName = CSTRING(Actions_Blood4_1000); displayNameProgress = CSTRING(Transfusing_Blood); allowedSelections[] = {"hand_l", "hand_r", "leg_l", "leg_r"}; + allowSelfTreatment = 0; category = "advanced"; items[] = {"ACE_bloodIV"}; requiredMedic = 1; @@ -234,10 +263,11 @@ class ACE_Medical_Actions { }; class SurgicalKit: fieldDressing { displayName = CSTRING(Use_SurgicalKit); - displayNameProgress = CSTRING(TreatmentAction); + displayNameProgress = CSTRING(Stitching); category = "advanced"; items[] = {"ACE_surgicalKit"}; treatmentLocations[] = {QGVAR(useLocation_SurgicalKit)}; + allowSelfTreatment = 0; requiredMedic = QGVAR(medicSetting_SurgicalKit); patientStateCondition = QGVAR(useCondition_SurgicalKit); treatmentTime = "(count ((_this select 1) getVariable ['ACE_Medical_bandagedWounds', []]) * 5)"; @@ -253,6 +283,7 @@ class ACE_Medical_Actions { category = "advanced"; items[] = {"ACE_personalAidKit"}; treatmentLocations[] = {QGVAR(useLocation_PAK)}; + allowSelfTreatment = 0; requiredMedic = QGVAR(medicSetting_PAK); patientStateCondition = QGVAR(useCondition_PAK); treatmentTime = QUOTE((_this select 1) call FUNC(treatmentAdvanced_fullHealTreatmentTime)); @@ -297,6 +328,7 @@ class ACE_Medical_Actions { displayName = CSTRING(Check_Response); callbackSuccess = QUOTE(DFUNC(actionCheckResponse)); displayNameProgress = CSTRING(Check_Response_Content); + allowSelfTreatment = 0; }; class RemoveTourniquet: Tourniquet { displayName = CSTRING(Actions_RemoveTourniquet); @@ -313,6 +345,7 @@ class ACE_Medical_Actions { category = "advanced"; treatmentLocations[] = {"All"}; allowedSelections[] = {"body"}; + allowSelfTreatment = 0; requiredMedic = 0; treatmentTime = 15; items[] = {}; @@ -334,8 +367,9 @@ class ACE_Medical_Actions { displayNameProgress = CSTRING(PlacingInBodyBag); category = "advanced"; treatmentLocations[] = {"All"}; + allowSelfTreatment = 0; requiredMedic = 0; - treatmentTime = 2; + treatmentTime = 15; items[] = {"ACE_bodyBag"}; condition = "!alive (_this select 1);"; callbackSuccess = QUOTE(DFUNC(actionPlaceInBodyBag)); @@ -605,6 +639,7 @@ class ACE_Medical_Advanced { class vehiclecrash { thresholds[] = {{0.25, 5}}; selectionSpecific = 0; + lethalDamage = 0.2; }; class backblast { thresholds[] = {{0, 2},{0.55, 5}, {1, 6}}; @@ -622,6 +657,7 @@ class ACE_Medical_Advanced { class falling { thresholds[] = {{0.1, 1}}; selectionSpecific = 1; + lethalDamage = 0.4; }; class ropeburn { thresholds[] = {{0.1, 1}}; diff --git a/addons/medical/ACE_Settings.hpp b/addons/medical/ACE_Settings.hpp index 23b7cf8a4f..b17610b0e3 100644 --- a/addons/medical/ACE_Settings.hpp +++ b/addons/medical/ACE_Settings.hpp @@ -1,116 +1,116 @@ class ACE_Settings { class GVAR(level) { - category = LSTRING(Category_Medical); + category = CSTRING(Category_Medical); value = 1; typeName = "SCALAR"; values[] = {"Disabled", "Basic", "Advanced"}; }; class GVAR(medicSetting) { - category = LSTRING(Category_Medical); + category = CSTRING(Category_Medical); value = 1; typeName = "SCALAR"; values[] = {"Disabled", "Normal", "Advanced"}; }; class GVAR(enableFor) { - category = LSTRING(Category_Medical); + category = CSTRING(Category_Medical); value = 0; typeName = "SCALAR"; values[] = {"Players only", "Players and AI"}; }; class GVAR(enableOverdosing) { - category = LSTRING(Category_Medical); + category = CSTRING(Category_Medical); typeName = "BOOL"; value = 1; }; class GVAR(bleedingCoefficient) { - category = LSTRING(Category_Medical); + category = CSTRING(Category_Medical); typeName = "SCALAR"; value = 1; }; class GVAR(painCoefficient) { - category = LSTRING(Category_Medical); + category = CSTRING(Category_Medical); typeName = "SCALAR"; value = 1; }; class GVAR(enableAirway) { - category = LSTRING(Category_Medical); + category = CSTRING(Category_Medical); typeName = "BOOL"; value = false; }; class GVAR(enableFractures) { - category = LSTRING(Category_Medical); + category = CSTRING(Category_Medical); typeName = "BOOL"; value = false; }; class GVAR(enableAdvancedWounds) { - category = LSTRING(Category_Medical); + category = CSTRING(Category_Medical); typeName = "BOOL"; value = false; }; class GVAR(enableVehicleCrashes) { - category = LSTRING(Category_Medical); + category = CSTRING(Category_Medical); typeName = "BOOL"; value = 1; }; class GVAR(enableScreams) { - category = LSTRING(Category_Medical); + category = CSTRING(Category_Medical); typeName = "BOOL"; value = 1; }; class GVAR(playerDamageThreshold) { - category = LSTRING(Category_Medical); + category = CSTRING(Category_Medical); typeName = "SCALAR"; value = 1; }; class GVAR(AIDamageThreshold) { - category = LSTRING(Category_Medical); + category = CSTRING(Category_Medical); typeName = "SCALAR"; value = 1; }; class GVAR(enableUnconsciousnessAI) { - category = LSTRING(Category_Medical); + category = CSTRING(Category_Medical); value = 1; typeName = "SCALAR"; values[] = {"Disabled", "50/50", "Enabled"}; }; class GVAR(remoteControlledAI) { - category = LSTRING(Category_Medical); + category = CSTRING(Category_Medical); typeName = "BOOL"; value = 1; }; class GVAR(preventInstaDeath) { - category = LSTRING(Category_Medical); + category = CSTRING(Category_Medical); typeName = "BOOL"; value = 0; }; class GVAR(enableRevive) { - category = LSTRING(Category_Medical); + category = CSTRING(Category_Medical); typeName = "SCALAR"; value = 0; values[] = {"Disabled", "Players only", "Players and AI"}; }; class GVAR(maxReviveTime) { - category = LSTRING(Category_Medical); + category = CSTRING(Category_Medical); typeName = "SCALAR"; value = 120; }; class GVAR(amountOfReviveLives) { - category = LSTRING(Category_Medical); + category = CSTRING(Category_Medical); typeName = "SCALAR"; value = -1; }; class GVAR(allowDeadBodyMovement) { - category = LSTRING(Category_Medical); + category = CSTRING(Category_Medical); typeName = "BOOL"; value = 0; }; class GVAR(allowLitterCreation) { - category = LSTRING(Category_Medical); + category = CSTRING(Category_Medical); typeName = "BOOL"; value = 1; }; class GVAR(litterSimulationDetail) { - category = LSTRING(Category_Medical); + category = CSTRING(Category_Medical); displayName = CSTRING(litterSimulationDetail); description = CSTRING(litterSimulationDetail_Desc); typeName = "SCALAR"; @@ -122,48 +122,48 @@ class ACE_Settings { isClientSettable = 1; }; class GVAR(litterCleanUpDelay) { - category = LSTRING(Category_Medical); + category = CSTRING(Category_Medical); typeName = "SCALAR"; value = 0; }; class GVAR(medicSetting_PAK) { - category = LSTRING(Category_Medical); + category = CSTRING(Category_Medical); typeName = "SCALAR"; value = 1; values[] = {"Anyone", "Medics only", "Doctors only"}; }; class GVAR(medicSetting_SurgicalKit) { - category = LSTRING(Category_Medical); + category = CSTRING(Category_Medical); typeName = "SCALAR"; value = 1; values[] = {"Anyone", "Medics only", "Doctors only"}; }; class GVAR(consumeItem_PAK) { - category = LSTRING(Category_Medical); + category = CSTRING(Category_Medical); typeName = "SCALAR"; value = 0; values[] = {"No", "Yes"}; }; class GVAR(consumeItem_SurgicalKit) { - category = LSTRING(Category_Medical); + category = CSTRING(Category_Medical); typeName = "SCALAR"; value = 0; values[] = {"No", "Yes"}; }; class GVAR(useLocation_PAK) { - category = LSTRING(Category_Medical); + category = CSTRING(Category_Medical); typeName = "SCALAR"; value = 3; values[] = {"Anywhere", "Medical vehicles", "Medical facility", "vehicle & facility", "Disabled"}; }; class GVAR(useLocation_SurgicalKit) { - category = LSTRING(Category_Medical); + category = CSTRING(Category_Medical); typeName = "SCALAR"; value = 2; values[] = {"Anywhere", "Medical vehicles", "Medical facility", "vehicle & facility", "Disabled"}; }; class GVAR(useCondition_PAK) { - category = LSTRING(Category_Medical); + category = CSTRING(Category_Medical); displayName = CSTRING(AdvancedMedicalSettings_useCondition_PAK_DisplayName); description = CSTRING(AdvancedMedicalSettings_useCondition_PAK_Description); typeName = "SCALAR"; @@ -171,7 +171,7 @@ class ACE_Settings { values[] = {"Anytime", "Stable"}; }; class GVAR(useCondition_SurgicalKit) { - category = LSTRING(Category_Medical); + category = CSTRING(Category_Medical); displayName = CSTRING(AdvancedMedicalSettings_useCondition_SurgicalKit_DisplayName); description = CSTRING(AdvancedMedicalSettings_useCondition_SurgicalKit_Description); typeName = "SCALAR"; @@ -179,24 +179,24 @@ class ACE_Settings { values[] = {"Anytime", "Stable"}; }; class GVAR(keepLocalSettingsSynced) { - category = LSTRING(Category_Medical); + category = CSTRING(Category_Medical); typeName = "BOOL"; value = 1; }; class GVAR(healHitPointAfterAdvBandage) { - category = LSTRING(Category_Medical); + category = CSTRING(Category_Medical); displayName = CSTRING(healHitPointAfterAdvBandage); typeName = "BOOL"; value = 0; }; class GVAR(painIsOnlySuppressed) { - category = LSTRING(Category_Medical); + category = CSTRING(Category_Medical); displayName = CSTRING(painIsOnlySuppressed); typeName = "BOOL"; value = 1; }; class GVAR(painEffectType) { - category = LSTRING(Category_Medical); + category = CSTRING(Category_Medical); displayName = CSTRING(painEffectType); typeName = "SCALAR"; value = 0; @@ -204,23 +204,23 @@ class ACE_Settings { isClientSettable = 1; }; class GVAR(allowUnconsciousAnimationOnTreatment) { - category = LSTRING(Category_Medical); + category = CSTRING(Category_Medical); typeName = "BOOL"; value = 0; }; class GVAR(moveUnitsFromGroupOnUnconscious) { - category = LSTRING(Category_Medical); + category = CSTRING(Category_Medical); typeName = "BOOL"; value = 0; }; class GVAR(menuTypeStyle) { - category = LSTRING(Category_Medical); + category = CSTRING(Category_Medical); displayName = CSTRING(menuTypeDisplay); description = CSTRING(menuTypeDescription); typeName = "SCALAR"; value = 0; - values[] = {CSTRING(useSelection)/*, CSTRING(useRadial)*/}; - // isClientSettable = 1; + values[] = {CSTRING(useSelection), CSTRING(useRadial), "Disabled"}; + isClientSettable = 1; }; }; diff --git a/addons/medical/CfgVehicles.hpp b/addons/medical/CfgVehicles.hpp index aef45b115d..3a675e9258 100644 --- a/addons/medical/CfgVehicles.hpp +++ b/addons/medical/CfgVehicles.hpp @@ -2,12 +2,12 @@ #define MEDICAL_ACTION_DISTANCE 1.75 class CfgVehicles { - class Logic; class Module_F: Logic { class ArgumentsBaseUnits { }; }; + class ACE_Module; class ACE_moduleMedicalSettings: ACE_Module { scope = 2; @@ -19,6 +19,7 @@ class CfgVehicles { isGlobal = 1; isTriggerActivated = 0; author = ECSTRING(common,ACETeam); + class Arguments { class level { displayName = CSTRING(MedicalSettings_level_DisplayName); @@ -137,6 +138,7 @@ class CfgVehicles { defaultValue = 1; }; }; + class ModuleDescription { description = CSTRING(MedicalSettings_Module_Description); sync[] = {}; @@ -154,6 +156,7 @@ class CfgVehicles { isTriggerActivated = 0; isDisposable = 0; author = ECSTRING(common,ACETeam); + class Arguments { class enableFor { displayName = CSTRING(AdvancedMedicalSettings_enableFor_DisplayName); @@ -256,13 +259,13 @@ class CfgVehicles { defaultValue = 1; }; }; + class ModuleDescription { description = CSTRING(AdvancedMedicalSettings_Module_Description); sync[] = {}; }; }; - class ACE_moduleReviveSettings: ACE_Module { scope = 2; displayName = CSTRING(ReviveSettings_Module_DisplayName); @@ -273,6 +276,7 @@ class CfgVehicles { isGlobal = 1; isTriggerActivated = 0; author = ECSTRING(common,ACETeam); + class Arguments { class enableRevive { displayName = CSTRING(ReviveSettings_enableRevive_DisplayName); @@ -298,11 +302,13 @@ class CfgVehicles { defaultValue = -1; }; }; + class ModuleDescription { description = CSTRING(ReviveSettings_Module_Description); sync[] = {}; }; }; + class ACE_moduleAssignMedicRoles: Module_F { scope = 2; displayName = CSTRING(AssignMedicRoles_Module_DisplayName); @@ -314,6 +320,7 @@ class CfgVehicles { isTriggerActivated = 0; isDisposable = 0; author = ECSTRING(common,ACETeam); + class Arguments { class EnableList { displayName = CSTRING(AssignMedicRoles_EnableList_DisplayName); @@ -342,6 +349,7 @@ class CfgVehicles { }; }; }; + class ModuleDescription { description = CSTRING(AssignMedicRoles_Module_Description); sync[] = {}; @@ -359,6 +367,7 @@ class CfgVehicles { isTriggerActivated = 0; isDisposable = 0; author = ECSTRING(common,ACETeam); + class Arguments { class EnableList { displayName = CSTRING(AssignMedicVehicle_EnableList_DisplayName); @@ -384,11 +393,13 @@ class CfgVehicles { }; }; }; + class ModuleDescription { description = CSTRING(AssignMedicVehicle_Module_Description); sync[] = {}; }; }; + class ACE_moduleAssignMedicalFacility: Module_F { scope = 2; displayName = CSTRING(AssignMedicalFacility_Module_DisplayName); @@ -400,6 +411,7 @@ class CfgVehicles { isTriggerActivated = 0; isDisposable = 0; author = ECSTRING(common,ACETeam); + class Arguments { class enabled { displayName = CSTRING(AssignMedicalFacility_enabled_DisplayName); @@ -407,70 +419,52 @@ class CfgVehicles { typeName = "BOOL"; }; }; + class ModuleDescription { description = CSTRING(AssignMedicalFacility_Module_Description); sync[] = {}; }; }; - #define ARM_LEG_ARMOR_DEFAULT 2 - #define ARM_LEG_ARMOR_BETTER 3 + #define ARM_LEG_ARMOR_DEFAULT 3 + #define ARM_LEG_ARMOR_BETTER 5 #define ARM_LEG_ARMOR_CSAT 4 - class Man; - class CAManBase: Man { - class HitPoints { - class HitHead; - class HitBody; - // "DEACTIVE" DEFAULT HITPOINTS - class HitHands { - armor = 999; //armor = 2; - explosionShielding = 0; //explosionShielding = 1; - material = -1; - minimalHit = 0; - name = ""; - passThrough = 1; - radius = 0; //radius = 0.06; - visual = "injury_hands"; - }; - class HitLegs { - armor = 999; //armor = 2; - explosionShielding = 0; //explosionShielding = 1; - material = -1; - minimalHit = 0; - name = ""; - passThrough = 1; - radius = 0; //radius = 0.08; - visual = "injury_legs"; - }; + class Land; + class Man: Land { + class HitPoints; + }; + class CAManBase: Man { + class HitPoints: HitPoints { // custom hitpoints. addons might want to adjust these accordingly class HitLeftArm { - armor = ARM_LEG_ARMOR_DEFAULT; //2; - explosionShielding = 1; + armor = ARM_LEG_ARMOR_DEFAULT; material = -1; - minimalHit = 0; - name = "hand_l"; - passThrough = 1; - radius = 0.06; - visual = "injury_hands"; - }; - class HitRightArm: HitLeftArm { - name = "hand_r"; - }; - class HitLeftLeg { - armor = ARM_LEG_ARMOR_DEFAULT; //2; - explosionShielding = 1; - material = -1; - minimalHit = 0; - name = "leg_l"; + name = "hand_l"; // @todo hopefully these still include the whole arm + hands passThrough = 1; radius = 0.08; + explosionShielding = 1; + visual = "injury_hands"; + minimalHit = 0.01; + }; + class HitRightArm: HitLeftArm { + name = "hand_r"; // @todo hopefully these still include the whole arm + hands + }; + class HitLeftLeg { + armor = ARM_LEG_ARMOR_DEFAULT; + material = -1; + name = "leg_l"; + passThrough = 1; + radius = 0.1; + explosionShielding = 1; visual = "injury_legs"; + minimalHit = 0.01; }; class HitRightLeg: HitLeftLeg { name = "leg_r"; }; }; + class ACE_SelfActions { #include "ACE_Medical_SelfActions.hpp" }; @@ -529,23 +523,19 @@ class CfgVehicles { class B_Soldier_04_f: B_Soldier_base_F { class HitPoints: HitPoints { - class HitHead: HitHead {}; - class HitBody: HitBody {}; - class HitHands: HitHands {}; - class HitLegs: HitLegs {}; - + class HitHead; + class HitBody; + class HitHands; + class HitLegs; class HitLeftArm: HitLeftArm { armor = ARM_LEG_ARMOR_BETTER; }; - class HitRightArm: HitRightArm { armor = ARM_LEG_ARMOR_BETTER; }; - class HitLeftLeg: HitLeftLeg { armor = ARM_LEG_ARMOR_BETTER; }; - class HitRightLeg: HitRightLeg { armor = ARM_LEG_ARMOR_BETTER; }; @@ -554,23 +544,19 @@ class CfgVehicles { class B_Soldier_05_f: B_Soldier_base_F { class HitPoints: HitPoints { - class HitHead: HitHead {}; - class HitBody: HitBody {}; - class HitHands: HitHands {}; - class HitLegs: HitLegs {}; - + class HitHead; + class HitBody; + class HitHands; + class HitLegs; class HitLeftArm: HitLeftArm { armor = ARM_LEG_ARMOR_BETTER; }; - class HitRightArm: HitRightArm { armor = ARM_LEG_ARMOR_BETTER; }; - class HitLeftLeg: HitLeftLeg { armor = ARM_LEG_ARMOR_BETTER; }; - class HitRightLeg: HitRightLeg { armor = ARM_LEG_ARMOR_BETTER; }; @@ -581,23 +567,19 @@ class CfgVehicles { class I_Soldier_03_F: I_Soldier_base_F { class HitPoints: HitPoints { - class HitHead: HitHead {}; - class HitBody: HitBody {}; - class HitHands: HitHands {}; - class HitLegs: HitLegs {}; - + class HitHead; + class HitBody; + class HitHands; + class HitLegs; class HitLeftArm: HitLeftArm { armor = ARM_LEG_ARMOR_BETTER; }; - class HitRightArm: HitRightArm { armor = ARM_LEG_ARMOR_BETTER; }; - class HitLeftLeg: HitLeftLeg { armor = ARM_LEG_ARMOR_BETTER; }; - class HitRightLeg: HitRightLeg { armor = ARM_LEG_ARMOR_BETTER; }; @@ -606,23 +588,19 @@ class CfgVehicles { class I_Soldier_04_F: I_Soldier_base_F { class HitPoints: HitPoints { - class HitHead: HitHead {}; - class HitBody: HitBody {}; - class HitHands: HitHands {}; - class HitLegs: HitLegs {}; - + class HitHead; + class HitBody; + class HitHands; + class HitLegs; class HitLeftArm: HitLeftArm { armor = ARM_LEG_ARMOR_BETTER; }; - class HitRightArm: HitRightArm { armor = ARM_LEG_ARMOR_BETTER; }; - class HitLeftLeg: HitLeftLeg { armor = ARM_LEG_ARMOR_BETTER; }; - class HitRightLeg: HitRightLeg { armor = ARM_LEG_ARMOR_BETTER; }; @@ -631,65 +609,93 @@ class CfgVehicles { class O_Soldier_base_F: SoldierEB { class HitPoints: HitPoints { - class HitHead: HitHead {}; - class HitBody: HitBody {}; - class HitHands: HitHands {}; - class HitLegs: HitLegs {}; - + class HitHead; + class HitBody; + class HitHands; + class HitLegs; class HitLeftArm: HitLeftArm { armor = ARM_LEG_ARMOR_CSAT; - passThrough = 0.85; }; - class HitRightArm: HitRightArm { armor = ARM_LEG_ARMOR_CSAT; - passThrough = 0.85; }; - class HitLeftLeg: HitLeftLeg { armor = ARM_LEG_ARMOR_CSAT; - passThrough = 0.85; }; - class HitRightLeg: HitRightLeg { armor = ARM_LEG_ARMOR_CSAT; - passThrough = 0.85; }; }; }; class O_Soldier_02_F: O_Soldier_base_F { class HitPoints: HitPoints { - class HitHead: HitHead {}; - class HitBody: HitBody {}; - class HitHands: HitHands {}; - class HitLegs: HitLegs {}; - + class HitHead; + class HitBody; + class HitHands; + class HitLegs; class HitLeftArm: HitLeftArm { armor = ARM_LEG_ARMOR_CSAT; - passThrough = 0.85; }; - class HitRightArm: HitRightArm { armor = ARM_LEG_ARMOR_CSAT; - passThrough = 0.85; }; - class HitLeftLeg: HitLeftLeg { armor = ARM_LEG_ARMOR_CSAT; - passThrough = 0.85; }; - class HitRightLeg: HitRightLeg { armor = ARM_LEG_ARMOR_CSAT; - passThrough = 0.85; }; }; }; + + class O_officer_F: O_Soldier_base_F { + class HitPoints: HitPoints { + class HitHead; + class HitBody; + class HitHands; + class HitLegs; + class HitLeftArm: HitLeftArm { + armor = ARM_LEG_ARMOR_CSAT; // @todo is that suppossed to be the case? + }; + class HitRightArm: HitRightArm { + armor = ARM_LEG_ARMOR_CSAT; + }; + class HitLeftLeg: HitLeftLeg { + armor = ARM_LEG_ARMOR_CSAT; + }; + class HitRightLeg: HitRightLeg { + armor = ARM_LEG_ARMOR_CSAT; + }; + }; + }; + + class O_Protagonist_VR_F: O_Soldier_base_F { + class HitPoints: HitPoints { + class HitHead; + class HitBody; + class HitHands; + class HitLegs; + class HitLeftArm: HitLeftArm { + armor = 2; + }; + class HitRightArm: HitRightArm { + armor = 2; + }; + class HitLeftLeg: HitLeftLeg { + armor = 2; + }; + class HitRightLeg: HitRightLeg { + armor = 2; + }; + }; + }; + class MapBoard_altis_F; class ACE_bodyBagObject: MapBoard_altis_F { XEH_ENABLED; scope = 1; + scopeCurator = 2; side = -1; model = QUOTE(PATHTOEF(apl,bodybag.p3d)); icon = ""; @@ -697,6 +703,8 @@ class CfgVehicles { EGVAR(dragging,canDrag) = 1; EGVAR(dragging,dragPosition[]) = {0,1.2,0}; EGVAR(dragging,dragDirection) = 0; + EGVAR(cargo,size) = 1; + EGVAR(cargo,canLoad) = 1; class ACE_Actions { class ACE_MainActions { displayName = ECSTRING(interaction,MainAction); @@ -713,6 +721,7 @@ class CfgVehicles { class Thing; class ACE_MedicalLitterBase: Thing { scope = 1; + scopeCurator = 0; displayName = " "; destrType = "DestructNo"; model = QUOTE(PATHTOF(data\littergeneric.p3d)); @@ -893,6 +902,7 @@ class CfgVehicles { class NATO_Box_Base; class ACE_medicalSupplyCrate: NATO_Box_Base { scope = 2; + scopeCurator = 2; accuracy = 1000; displayName = CSTRING(medicalSupplyCrate); model = PATHTOF(data\ace_medcrate.p3d); diff --git a/addons/medical/README.md b/addons/medical/README.md index b7a5fd2a3b..ecf8f5793e 100644 --- a/addons/medical/README.md +++ b/addons/medical/README.md @@ -3,6 +3,7 @@ ace_medical Provides a basic and advanced medical system. + ## Maintainers The people responsible for merging changes to this component or answering potential questions. diff --git a/addons/medical/XEH_init.sqf b/addons/medical/XEH_init.sqf index 0ded7d471f..acdd50ce82 100644 --- a/addons/medical/XEH_init.sqf +++ b/addons/medical/XEH_init.sqf @@ -1,10 +1,12 @@ #include "script_component.hpp" -private ["_unit"]; -_unit = _this select 0; +params ["_unit"]; _unit addEventHandler ["HandleDamage", {_this call FUNC(handleDamage)}]; if (local _unit) then { - [_unit] call FUNC(init); + if (!EGVAR(common,settingsInitFinished)) exitWith { + EGVAR(common,runAtSettingsInitialized) pushBack [FUNC(init), [_unit]]; + }; + [_unit] call FUNC(init); }; diff --git a/addons/medical/XEH_postInit.sqf b/addons/medical/XEH_postInit.sqf index f9f821eeb3..064f78682f 100644 --- a/addons/medical/XEH_postInit.sqf +++ b/addons/medical/XEH_postInit.sqf @@ -11,10 +11,9 @@ GVAR(heartBeatSounds_Slow) = ["ACE_heartbeat_slow_1", "ACE_heartbeat_slow_2"]; ["interactMenuClosed", {[objNull, false] call FUNC(displayPatientInformation); }] call EFUNC(common,addEventHandler); ["medical_onUnconscious", { - if (local (_this select 0)) then { - private ["_unit"]; - _unit = _this select 0; - if (_this select 1) then { + params ["_unit", "_status"]; + if (local _unit) then { + if (_status) then { _unit setVariable ["tf_globalVolume", 0.4]; _unit setVariable ["tf_voiceVolume", 0, true]; _unit setVariable ["tf_unable_to_use_radio", true, true]; @@ -34,11 +33,11 @@ GVAR(heartBeatSounds_Slow) = ["ACE_heartbeat_slow_1", "ACE_heartbeat_slow_2"]; // Initialize all effects +if (hasInterface) then { + _fnc_createEffect = { - private ["_type", "_layer", "_default", "_effect"]; - _type = _this select 0; - _layer = _this select 1; - _default = _this select 2; + private "_effect"; + params ["_type", "_layer", "_default"]; _effect = ppEffectCreate [_type, _layer]; _effect ppEffectForceInNVG true; @@ -162,7 +161,7 @@ GVAR(lastHeartBeatSound) = ACE_time; _heartRate = 60 + 40 * _pain; }; if (_heartRate <= 0) exitwith {}; - _interval = 60 / (_heartRate min 50); + _interval = 60 / (_heartRate min 40); if ((ACE_player getVariable ["ACE_isUnconscious", false])) then { if (GVAR(painEffectType) == 1) then { @@ -176,7 +175,7 @@ GVAR(lastHeartBeatSound) = ACE_time; // Pain effect, no pain effect in zeus camera if (isNull curatorCamera) then { - _strength = (_pain - (ACE_player getvariable [QGVAR(painSuppress), 0])) max 0; + _strength = ((_pain - (ACE_player getvariable [QGVAR(painSuppress), 0])) max 0) min 1; _strength = _strength * (ACE_player getVariable [QGVAR(painCoefficient), GVAR(painCoefficient)]); if (GVAR(painEffectType) == 1) then { GVAR(effectPainCC) ppEffectEnable false; @@ -244,31 +243,29 @@ GVAR(lastHeartBeatSound) = ACE_time; }; }, 0, []] call CBA_fnc_addPerFrameHandler; - -if (USE_WOUND_EVENT_SYNC) then { - // broadcast injuries to JIP clients in a MP session - if (isMultiplayer && hasInterface) then { - ["playerChanged", { - EXPLODE_2_PVT(_this,_newPlayer,_oldPlayer); - if (alive _newPlayer) then { - // We are only pulling the wounds for the units in the player group. Anything else will come when the unit interacts with them. - { - [_x, _newPlayer] call FUNC(requestWoundSync); - }foreach units group _newPlayer; - }; - }] call EFUNC(common,addEventhandler); - }; }; -[ - {(((_this select 0) getvariable [QGVAR(bloodVolume), 100]) < 65)}, - {(((_this select 0) getvariable [QGVAR(pain), 0]) - ((_this select 0) getvariable [QGVAR(painSuppress), 0])) > 0.9}, - {(([_this select 0] call FUNC(getBloodLoss)) > 0.25)}, - {((_this select 0) getvariable [QGVAR(inReviveState), false])}, - {((_this select 0) getvariable [QGVAR(inCardiacArrest), false])}, - {((_this select 0) getvariable ["ACE_isDead", false])}, - {(((_this select 0) getvariable [QGVAR(airwayStatus), 100]) < 80)} -] call FUNC(addUnconsciousCondition); +["SettingsInitialized", { + if (GVAR(level) == 2) exitwith { + [ + {(((_this select 0) getvariable [QGVAR(bloodVolume), 100]) < 65)}, + {(((_this select 0) getvariable [QGVAR(pain), 0]) - ((_this select 0) getvariable [QGVAR(painSuppress), 0])) > 0.9}, + {(([_this select 0] call FUNC(getBloodLoss)) > 0.25)}, + {((_this select 0) getvariable [QGVAR(inReviveState), false])}, + {((_this select 0) getvariable [QGVAR(inCardiacArrest), false])}, + {((_this select 0) getvariable ["ACE_isDead", false])}, + {(((_this select 0) getvariable [QGVAR(airwayStatus), 100]) < 80)} + ] call FUNC(addUnconsciousCondition); + }; + + [ + {(((_this select 0) getvariable [QGVAR(bloodVolume), 100]) < 40)}, + {(((_this select 0) getvariable [QGVAR(pain), 0]) - ((_this select 0) getvariable [QGVAR(painSuppress), 0])) > 0.6}, + {(([_this select 0] call FUNC(getBloodLoss)) > 0.1)}, + {((_this select 0) getvariable [QGVAR(inReviveState), false])}, + {((_this select 0) getvariable ["ACE_isDead", false])} + ] call FUNC(addUnconsciousCondition); +}] call EFUNC(common,addEventHandler); // Prevent all types of interaction while unconscious // @todo: probably remove this when CBA keybind hold key works properly @@ -284,7 +281,7 @@ if (USE_WOUND_EVENT_SYNC) then { if (hasInterface) then { ["PlayerJip", { - diag_log format["[ACE] JIP Medical init for player"]; + ACE_LOGINFO("JIP Medical init for player."); [player] call FUNC(init); }] call EFUNC(common,addEventHandler); }; diff --git a/addons/medical/XEH_preInit.sqf b/addons/medical/XEH_preInit.sqf index b479383468..2625bf4b8a 100644 --- a/addons/medical/XEH_preInit.sqf +++ b/addons/medical/XEH_preInit.sqf @@ -68,6 +68,7 @@ PREP(selectionNameToNumber); PREP(setCardiacArrest); PREP(setDead); PREP(setHitPointDamage); +PREP(setStructuralDamage); PREP(setUnconscious); PREP(treatment); PREP(treatment_failure); @@ -83,6 +84,7 @@ PREP(treatmentAdvanced_medication); PREP(treatmentAdvanced_medicationLocal); PREP(treatmentAdvanced_surgicalKit_onProgress); PREP(treatmentBasic_bandage); +PREP(treatmentBasic_bandageLocal); PREP(treatmentBasic_bloodbag); PREP(treatmentBasic_bloodbagLocal); PREP(treatmentBasic_epipen); diff --git a/addons/medical/XEH_respawn.sqf b/addons/medical/XEH_respawn.sqf index 44060fa15c..b5b07bf141 100644 --- a/addons/medical/XEH_respawn.sqf +++ b/addons/medical/XEH_respawn.sqf @@ -1,11 +1,8 @@ #include "script_component.hpp" -private ["_unit"]; - -_unit = _this select 0; - -if !(local _unit) exitWith {}; +params ["_unit"]; +// reset all variables. @todo GROUP respawn? [_unit] call FUNC(init); // Reset captive status for respawning unit diff --git a/addons/medical/data/QuikClot.p3d b/addons/medical/data/QuikClot.p3d index 85ec2e9923..9fe747cb54 100644 Binary files a/addons/medical/data/QuikClot.p3d and b/addons/medical/data/QuikClot.p3d differ diff --git a/addons/medical/data/atropine.p3d b/addons/medical/data/atropine.p3d index 2b3ea52e61..fa9fb72c84 100644 Binary files a/addons/medical/data/atropine.p3d and b/addons/medical/data/atropine.p3d differ diff --git a/addons/medical/data/bandage.p3d b/addons/medical/data/bandage.p3d index 873d0feb8b..23540f10d9 100644 Binary files a/addons/medical/data/bandage.p3d and b/addons/medical/data/bandage.p3d differ diff --git a/addons/medical/data/bodybagItem.p3d b/addons/medical/data/bodybagItem.p3d index 72c8fec886..73b3bfe404 100644 Binary files a/addons/medical/data/bodybagItem.p3d and b/addons/medical/data/bodybagItem.p3d differ diff --git a/addons/medical/data/epinephrine.p3d b/addons/medical/data/epinephrine.p3d index 47149c4eca..45f0aee1f7 100644 Binary files a/addons/medical/data/epinephrine.p3d and b/addons/medical/data/epinephrine.p3d differ diff --git a/addons/medical/data/littergeneric.p3d b/addons/medical/data/littergeneric.p3d index 4170dd5a41..801a6f5a4f 100644 Binary files a/addons/medical/data/littergeneric.p3d and b/addons/medical/data/littergeneric.p3d differ diff --git a/addons/medical/data/littergeneric_Quikclot.p3d b/addons/medical/data/littergeneric_Quikclot.p3d index e309736148..e54e331721 100644 Binary files a/addons/medical/data/littergeneric_Quikclot.p3d and b/addons/medical/data/littergeneric_Quikclot.p3d differ diff --git a/addons/medical/data/littergeneric_atropine.p3d b/addons/medical/data/littergeneric_atropine.p3d index 141f7bd67f..4490a11c0e 100644 Binary files a/addons/medical/data/littergeneric_atropine.p3d and b/addons/medical/data/littergeneric_atropine.p3d differ diff --git a/addons/medical/data/littergeneric_clean.p3d b/addons/medical/data/littergeneric_clean.p3d index 7fa6fb3e91..0ebddf30ca 100644 Binary files a/addons/medical/data/littergeneric_clean.p3d and b/addons/medical/data/littergeneric_clean.p3d differ diff --git a/addons/medical/data/littergeneric_epinephrine.p3d b/addons/medical/data/littergeneric_epinephrine.p3d index 33f2b19285..8246ef607e 100644 Binary files a/addons/medical/data/littergeneric_epinephrine.p3d and b/addons/medical/data/littergeneric_epinephrine.p3d differ diff --git a/addons/medical/data/littergeneric_gloves.p3d b/addons/medical/data/littergeneric_gloves.p3d index abc55ebcc9..ca92017688 100644 Binary files a/addons/medical/data/littergeneric_gloves.p3d and b/addons/medical/data/littergeneric_gloves.p3d differ diff --git a/addons/medical/data/littergeneric_morphine.p3d b/addons/medical/data/littergeneric_morphine.p3d index 754bce29a4..906280227c 100644 Binary files a/addons/medical/data/littergeneric_morphine.p3d and b/addons/medical/data/littergeneric_morphine.p3d differ diff --git a/addons/medical/data/littergeneric_packingbandage.p3d b/addons/medical/data/littergeneric_packingbandage.p3d index 73e86d92b4..185b8a73ff 100644 Binary files a/addons/medical/data/littergeneric_packingbandage.p3d and b/addons/medical/data/littergeneric_packingbandage.p3d differ diff --git a/addons/medical/data/morphine.p3d b/addons/medical/data/morphine.p3d index 8657b87c8a..3328630ac9 100644 Binary files a/addons/medical/data/morphine.p3d and b/addons/medical/data/morphine.p3d differ diff --git a/addons/medical/data/packingbandage.p3d b/addons/medical/data/packingbandage.p3d index 002c68ed13..0e083c4766 100644 Binary files a/addons/medical/data/packingbandage.p3d and b/addons/medical/data/packingbandage.p3d differ diff --git a/addons/medical/functions/fnc_actionCheckBloodPressure.sqf b/addons/medical/functions/fnc_actionCheckBloodPressure.sqf index e8e03bb4c0..889cc90de9 100644 --- a/addons/medical/functions/fnc_actionCheckBloodPressure.sqf +++ b/addons/medical/functions/fnc_actionCheckBloodPressure.sqf @@ -7,14 +7,12 @@ * 1: The patient * * Return Value: -* NONE +* None * * Public: No */ #include "script_component.hpp" -private ["_caller","_target"]; -_caller = _this select 0; -_target = _this select 1; -[[_caller, _target], QUOTE(DFUNC(actionCheckBloodPressureLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ +params ["_caller", "_target", "_selectionName"]; +[[_caller, _target, _selectionName], QUOTE(DFUNC(actionCheckBloodPressureLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ diff --git a/addons/medical/functions/fnc_actionCheckBloodPressureLocal.sqf b/addons/medical/functions/fnc_actionCheckBloodPressureLocal.sqf index 82edd1749f..24b5bf4c6e 100644 --- a/addons/medical/functions/fnc_actionCheckBloodPressureLocal.sqf +++ b/addons/medical/functions/fnc_actionCheckBloodPressureLocal.sqf @@ -7,24 +7,22 @@ * 1: The patient * * Return Value: - * NONE + * None * * Public: No */ #include "script_component.hpp" -private ["_caller","_target","_bloodPressure","_bloodPressureHigh","_bloodPressureLow", "_logOutPut", "_output"]; -_caller = _this select 0; -_target = _this select 1; +private ["_bloodPressure", "_logOutPut", "_output"]; +params ["_caller", "_target", "_selectionName"]; -_bloodPressure = [_target] call FUNC(getBloodPressure); -if (!alive _target) then { - _bloodPressure = [0,0]; +_bloodPressure = if (!alive _target) then { + [0,0] +} else { + [_target] call FUNC(getBloodPressure) }; - -_bloodPressureHigh = _bloodPressure select 1; -_bloodPressureLow = _bloodPressure select 0; +_bloodPressure params [ "_bloodPressureLow", "_bloodPressureHigh"]; _output = ""; _logOutPut = ""; if ([_caller] call FUNC(isMedic)) then { @@ -54,6 +52,11 @@ if ([_caller] call FUNC(isMedic)) then { }; }; +if (_selectionName in ["hand_l","hand_r"] && {[_unit, _selectionName] call FUNC(hasTourniquetAppliedTo)}) then { + _output = LSTRING(Check_Bloodpressure_Output_6); + _logOutPut = ""; +}; + ["displayTextStructured", [_caller], [[_output, [_target] call EFUNC(common,getName), round(_bloodPressureHigh),round(_bloodPressureLow)], 1.75, _caller]] call EFUNC(common,targetEvent); if (_logOutPut != "") then { diff --git a/addons/medical/functions/fnc_actionCheckPulse.sqf b/addons/medical/functions/fnc_actionCheckPulse.sqf index fd96321e8f..8c2c6cf109 100644 --- a/addons/medical/functions/fnc_actionCheckPulse.sqf +++ b/addons/medical/functions/fnc_actionCheckPulse.sqf @@ -7,14 +7,13 @@ * 1: The patient * * Return Value: -* NONE +* None * * Public: No */ #include "script_component.hpp" -private ["_caller","_target"]; -_caller = _this select 0; -_target = _this select 1; -[[_caller, _target], QUOTE(DFUNC(actionCheckPulseLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ +params ["_caller","_target", "_selectionName"]; +[[_caller, _target, _selectionName], QUOTE(DFUNC(actionCheckPulseLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ + diff --git a/addons/medical/functions/fnc_actionCheckPulseLocal.sqf b/addons/medical/functions/fnc_actionCheckPulseLocal.sqf index d759bf1bc8..94f3e6ad34 100644 --- a/addons/medical/functions/fnc_actionCheckPulseLocal.sqf +++ b/addons/medical/functions/fnc_actionCheckPulseLocal.sqf @@ -7,17 +7,15 @@ * 1: The patient * * Return Value: - * NONE + * None * * Public: No */ #include "script_component.hpp" -private ["_caller", "_unit", "_heartRateOutput", "_heartRate", "_logOutPut"]; -_caller = _this select 0; -_unit = _this select 1; - +private ["_heartRateOutput", "_heartRate", "_logOutPut"]; +params ["_caller", "_unit", "_selectionName"]; _heartRate = _unit getvariable [QGVAR(heartRate), 80]; if (!alive _unit) then { @@ -46,6 +44,11 @@ if (_heartRate > 1.0) then { }; }; +if (_selectionName in ["hand_l","hand_r"] && {[_unit, _selectionName] call FUNC(hasTourniquetAppliedTo)}) then { + _heartRateOutput = LSTRING(Check_Pulse_Output_5); + _logOutPut = LSTRING(Check_Pulse_None); +}; + ["displayTextStructured", [_caller], [[_heartRateOutput, [_unit] call EFUNC(common,getName), round(_heartRate)], 1.5, _caller]] call EFUNC(common,targetEvent); if (_logOutPut != "") then { diff --git a/addons/medical/functions/fnc_actionCheckResponse.sqf b/addons/medical/functions/fnc_actionCheckResponse.sqf index b5df63047e..6910545a9d 100644 --- a/addons/medical/functions/fnc_actionCheckResponse.sqf +++ b/addons/medical/functions/fnc_actionCheckResponse.sqf @@ -7,23 +7,17 @@ * 1: The patient * * Return Value: - * NONE + * None * * Public: No */ #include "script_component.hpp" -private ["_caller","_target", "_output"]; -_caller = _this select 0; -_target = _this select 1; +private ["_output"]; +params ["_caller", "_target"]; -_output = ""; -if ([_target] call EFUNC(common,isAwake)) then { - _output = LSTRING(Check_Response_Responsive); -} else { - _output = LSTRING(Check_Response_Unresponsive); -}; +_output = [LSTRING(Check_Response_Unresponsive), LSTRING(Check_Response_Responsive)] select ([_target] call EFUNC(common,isAwake)); ["displayTextStructured", [_caller], [[_output, [_target] call EFUNC(common,getName)], 2, _caller]] call EFUNC(common,targetEvent); diff --git a/addons/medical/functions/fnc_actionDiagnose.sqf b/addons/medical/functions/fnc_actionDiagnose.sqf index 243edbdef8..072b9b1a7e 100644 --- a/addons/medical/functions/fnc_actionDiagnose.sqf +++ b/addons/medical/functions/fnc_actionDiagnose.sqf @@ -7,16 +7,15 @@ * 1: The patient * * Return Value: -* NONE +* None * * Public: No */ #include "script_component.hpp" -private ["_caller", "_target", "_genericMessages"]; -_caller = _this select 0; -_target = _this select 1; +private "_genericMessages"; +params ["_caller", "_target"]; _genericMessages = [LSTRING(diagnoseMessage)]; @@ -36,10 +35,12 @@ if (_target getvariable[QGVAR(hasLostBlood), 0] > 0) then { _genericMessages pushback LSTRING(noBloodloss); }; -if (_target getvariable[QGVAR(hasPain), false]) then { - _genericMessages pushback LSTRING(inPain); -} else { - _genericMessages pushback LSTRING(noPain); +if (alive _target) then { + if (_target getvariable[QGVAR(hasPain), false]) then { + _genericMessages pushback LSTRING(inPain); + } else { + _genericMessages pushback LSTRING(noPain); + }; }; ["displayTextStructured", [_caller], [_genericMessages, 3.0, _caller]] call EFUNC(common,targetEvent); diff --git a/addons/medical/functions/fnc_actionLoadUnit.sqf b/addons/medical/functions/fnc_actionLoadUnit.sqf index 03d9a3ef54..42a94997d8 100644 --- a/addons/medical/functions/fnc_actionLoadUnit.sqf +++ b/addons/medical/functions/fnc_actionLoadUnit.sqf @@ -7,20 +7,18 @@ * 1: The patient * * Return Value: - * NONE + * None * * Public: No */ #include "script_component.hpp" -private ["_caller", "_target","_vehicle"]; -_caller = _this select 0; -_target = _this select 1; +private "_vehicle"; +params ["_caller", "_target"]; if ([_target] call EFUNC(common,isAwake)) exitwith { - // TODO localization - ["displayTextStructured", [_caller], [["This person (%1) is awake and cannot be loaded", [_target] call EFUNC(common,getName)], 1.5, _caller]] call EFUNC(common,targetEvent); + ["displayTextStructured", [_caller], [[LSTRING(CanNotLoaded), [_target] call EFUNC(common,getName)], 1.5, _caller]] call EFUNC(common,targetEvent); }; if ([_target] call FUNC(isBeingCarried)) then { [_caller, _target] call EFUNC(dragging,dropObject_carry); diff --git a/addons/medical/functions/fnc_actionPlaceInBodyBag.sqf b/addons/medical/functions/fnc_actionPlaceInBodyBag.sqf index 73f9eeca4d..f416535701 100644 --- a/addons/medical/functions/fnc_actionPlaceInBodyBag.sqf +++ b/addons/medical/functions/fnc_actionPlaceInBodyBag.sqf @@ -14,9 +14,8 @@ #include "script_component.hpp" -PARAMS_2(_caller,_target); - private ["_position", "_headPos", "_spinePos", "_dirVect", "_direction", "_bodyBag"]; +params ["_caller", "_target"]; if (alive _target) then { [_target, true] call FUNC(setDead); diff --git a/addons/medical/functions/fnc_actionRemoveTourniquet.sqf b/addons/medical/functions/fnc_actionRemoveTourniquet.sqf index a14dbc3bcd..b920f276f0 100644 --- a/addons/medical/functions/fnc_actionRemoveTourniquet.sqf +++ b/addons/medical/functions/fnc_actionRemoveTourniquet.sqf @@ -8,17 +8,15 @@ * 2: SelectionName * * Return Value: - * NONE + * None * * Public: Yes */ #include "script_component.hpp" -private ["_caller", "_target", "_part", "_selectionName", "_tourniquets", "_output"]; -_caller = _this select 0; -_target = _this select 1; -_selectionName = _this select 2; +private ["_part", "_tourniquets", "_output"]; +params ["_caller", "_target", "_selectionName"]; // grab the required data _part = [_selectionName] call FUNC(selectionNameToNumber); @@ -26,7 +24,7 @@ _tourniquets = _target getvariable [QGVAR(tourniquets), [0,0,0,0,0,0]]; // Check if there is a tourniquet on this bodypart if ((_tourniquets select _part) == 0) exitwith { - _output = "There is no tourniquet on this body part!"; + _output = LSTRING(noTourniquetOnBodyPart); ["displayTextStructured", [_caller], [_output, 1.5, _caller]] call EFUNC(common,targetEvent); }; diff --git a/addons/medical/functions/fnc_actionUnloadUnit.sqf b/addons/medical/functions/fnc_actionUnloadUnit.sqf index a73f32265a..6bb4f5beed 100644 --- a/addons/medical/functions/fnc_actionUnloadUnit.sqf +++ b/addons/medical/functions/fnc_actionUnloadUnit.sqf @@ -5,23 +5,20 @@ * Arguments: * 0: The medic * 1: The patient - * 2: Drag after unload + * 2: Drag after unload (default: false) * * Return Value: - * NONE + * None * * Public: No */ #include "script_component.hpp" -private ["_caller", "_target", "_drag"]; -_caller = _this select 0; -_target = _this select 1; -_drag = if (count _this > 2) then {_this select 2} else {false}; +params ["_caller", "_target", ["_drag", false]]; // cannot unload a unit not in a vehicle. if (vehicle _target == _target) exitwith {}; if (([_target] call EFUNC(common,isAwake))) exitwith {}; -["unloadPersonEvent", _target, [_target, vehicle _target]] call EFUNC(common,targetEvent) \ No newline at end of file +["unloadPersonEvent", _target, [_target, vehicle _target]] call EFUNC(common,targetEvent) diff --git a/addons/medical/functions/fnc_addHeartRateAdjustment.sqf b/addons/medical/functions/fnc_addHeartRateAdjustment.sqf index f4516a100c..7171eee275 100644 --- a/addons/medical/functions/fnc_addHeartRateAdjustment.sqf +++ b/addons/medical/functions/fnc_addHeartRateAdjustment.sqf @@ -9,18 +9,15 @@ * 3: callback * * Return Value: - * nil + * None * * Public: Yes */ #include "script_component.hpp" -private ["_unit", "_value", "_time", "_adjustment", "_callBack"]; -_unit = [_this, 0, objNull, [objNull]] call BIS_fnc_Param; -_value = [_this, 1, 0, [0]] call BIS_fnc_Param; -_time = [_this, 2, 1, [0]] call BIS_fnc_Param; -_callBack = [_this, 3, {}, [{}]] call BIS_fnc_Param; + +params [["_unit", objNull, [objNull]], ["_value", 0, [0]], ["_time", 1, [0]], ["_callBack", {}, [{}]]]; _adjustment = _unit getvariable [QGVAR(heartRateAdjustments), []]; _adjustment pushback [_value, _time, _callBack]; diff --git a/addons/medical/functions/fnc_addToInjuredCollection.sqf b/addons/medical/functions/fnc_addToInjuredCollection.sqf index 083f949d9d..0ed9b9747f 100644 --- a/addons/medical/functions/fnc_addToInjuredCollection.sqf +++ b/addons/medical/functions/fnc_addToInjuredCollection.sqf @@ -6,16 +6,14 @@ * 0: The Unit * * ReturnValue: - * + * None * * Public: Yes */ #include "script_component.hpp" -private ["_unit", "_force"]; -_unit = _this select 0; -_force = if (count _this > 1) then {_this select 1} else {false}; +params ["_unit", ["_force", false]]; if ([_unit] call FUNC(hasMedicalEnabled) || _force) then { @@ -27,13 +25,13 @@ if ([_unit] call FUNC(hasMedicalEnabled) || _force) then { _unit setvariable [QGVAR(addedToUnitLoop), true, true]; [{ - private ["_unit", "_interval"]; - _unit = (_this select 0) select 0; - _interval = ACE_time - ((_this select 0) select 1); + params ["_args", "_idPFH"]; + _args params ["_unit", "_interval"]; + _interval = ACE_time - _interval; (_this select 0) set [1, ACE_time]; - + if (!alive _unit || !local _unit) then { - [_this select 1] call CBA_fnc_removePerFrameHandler; + [_idPFH] call CBA_fnc_removePerFrameHandler; if (!local _unit) then { if (GVAR(level) >= 2) then { _unit setvariable [QGVAR(heartRate), _unit getvariable [QGVAR(heartRate), 80], true]; @@ -47,9 +45,12 @@ if ([_unit] call FUNC(hasMedicalEnabled) || _force) then { private "_pain"; _pain = _unit getvariable [QGVAR(pain), 0]; if (_pain > (_unit getvariable [QGVAR(painSuppress), 0])) then { - if (_pain > 0.7 && {random(1) > 0.6}) then { + // This introduces wierd unconscious behaviour for basic medical and possibly also advanced. + // TODO This is disabled as it's considered non critical code. + // We will need to decide if we want unconscious triggered on high pain levels or if we can get rid of this entirely. + /*if (_pain > 0.7 && {random(1) > 0.6}) then { [_unit] call FUNC(setUnconscious); - }; + };*/ [_unit, _pain] call FUNC(playInjuredSound); }; diff --git a/addons/medical/functions/fnc_addToLog.sqf b/addons/medical/functions/fnc_addToLog.sqf index af7d9f3170..0e341792c9 100644 --- a/addons/medical/functions/fnc_addToLog.sqf +++ b/addons/medical/functions/fnc_addToLog.sqf @@ -9,28 +9,24 @@ * 3: The arguments for localization * * Return Value: - * nil + * None * * Public: Yes */ #include "script_component.hpp" -private ["_unit", "_type", "_message", "_arguments", "_lastNumber", "_moment", "_logVarName", "_log","_newLog", "_logs"]; -_unit = _this select 0; -_type = _this select 1; -_message = _this select 2; -_arguments = _this select 3; +private ["_moment", "_logVarName", "_log","_newLog", "_logs"]; +params ["_unit", "_type", "_message", "_arguments"]; if (!local _unit) exitwith { - [_this, QUOTE(DFUNC(addToLog)), _unit] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ + [_this, QFUNC(addToLog), _unit] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ }; -_lastNumber = date select 4; -_moment = format["%1:%2",date select 3, _lastNumber]; -if (_lastNumber < 10) then { - _moment = format["%1:0%2",date select 3, _lastNumber]; -}; +date params ["", "", "", "_hour", "_minute"]; + +_moment = format [ (["%1:%2", "%1:0%2"] select (_minute < 10)), _hour, _minute]; + _logVarName = format[QGVAR(logFile_%1), _type]; _log = _unit getvariable [_logVarName, []]; @@ -41,10 +37,10 @@ if (count _log >= 8) then { if (_foreachIndex > 0) then { _newLog pushback _x; }; - }foreach _log; + } foreach _log; _log = _newLog; }; -_log pushback [_message,_moment,_type, _arguments]; +_log pushback [_message, _moment, _type, _arguments]; _unit setvariable [_logVarName, _log, true]; ["medical_onLogEntryAdded", [_unit, _type, _message, _arguments]] call EFUNC(common,localEvent); diff --git a/addons/medical/functions/fnc_addToTriageCard.sqf b/addons/medical/functions/fnc_addToTriageCard.sqf index 7495c04a8a..b1df46f751 100644 --- a/addons/medical/functions/fnc_addToTriageCard.sqf +++ b/addons/medical/functions/fnc_addToTriageCard.sqf @@ -7,19 +7,18 @@ * 1: The new item classname * * Return Value: - * nil + * None * * Public: Yes */ #include "script_component.hpp" -private ["_unit", "_newItem", "_log", "_inList", "_amount"]; -_unit = _this select 0; -_newItem = _this select 1; +private ["_log", "_inList", "_amount"]; +params ["_unit", "_newItem"]; if (!local _unit) exitwith { - [_this, QUOTE(DFUNC(addToTriageList)), _unit] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ + [_this, QUOTE(DFUNC(addToTriageCard)), _unit] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ }; _log = _unit getvariable [QGVAR(triageCard), []]; @@ -30,16 +29,16 @@ _amount = 1; private "_info"; _info = _log select _foreachIndex; _info set [1,(_info select 1) + 1]; - _info set [2, ACE_time]; + _info set [2, ACE_gameTime]; _log set [_foreachIndex, _info]; _amount = (_info select 1); _inList = true; }; -}foreach _log; +} foreach _log; if (!_inList) then { - _log pushback [_newItem, 1, ACE_time]; + _log pushback [_newItem, 1, ACE_gameTime]; }; _unit setvariable [QGVAR(triageCard), _log, true]; ["Medical_onItemAddedToTriageCard", [_unit, _newItem, _amount]] call EFUNC(common,localEvent); diff --git a/addons/medical/functions/fnc_addUnconsciousCondition.sqf b/addons/medical/functions/fnc_addUnconsciousCondition.sqf index 579a55ca1f..6a867088da 100644 --- a/addons/medical/functions/fnc_addUnconsciousCondition.sqf +++ b/addons/medical/functions/fnc_addUnconsciousCondition.sqf @@ -3,14 +3,13 @@ * Adds new condition for the unconscious state. Conditions are not actively checked for units unless unit is in unconscious state. * * Arguments: - * 0: Code, should return a boolean + * 0-N: Code, should return a boolean * * ReturnValue: - * + * None * * Public: Yes */ - #include "script_component.hpp" if (isnil QGVAR(unconsciousConditions)) then { @@ -21,5 +20,5 @@ if (typeName _this == typeName []) then { if (typeName _x == typeName {}) then { GVAR(unconsciousConditions) pushback _x; }; - }foreach _this; + } foreach _this; }; diff --git a/addons/medical/functions/fnc_addUnloadPatientActions.sqf b/addons/medical/functions/fnc_addUnloadPatientActions.sqf index 13a4177859..f29b3923f1 100644 --- a/addons/medical/functions/fnc_addUnloadPatientActions.sqf +++ b/addons/medical/functions/fnc_addUnloadPatientActions.sqf @@ -13,8 +13,7 @@ * Public: No */ #include "script_component.hpp" - -EXPLODE_3_PVT(_this,_vehicle,_player,_parameters); +params ["_vehicle", "_player", "_parameters"]; private ["_actions", "_unit"]; _actions = []; diff --git a/addons/medical/functions/fnc_adjustPainLevel.sqf b/addons/medical/functions/fnc_adjustPainLevel.sqf index 7e6ce2d5f1..df82e06823 100644 --- a/addons/medical/functions/fnc_adjustPainLevel.sqf +++ b/addons/medical/functions/fnc_adjustPainLevel.sqf @@ -18,10 +18,10 @@ private ["_pain"]; -PARAMS_2(_unit,_addedPain); - +params ["_unit", "_addedPain"]; //Only run on local units: if (!local _unit) exitWith {ERROR("unit is not local");}; +TRACE_3("ACE_DEBUG: adjustPainLevel Called",_unit, _pain, _addedPain); //Ignore if medical system disabled: if (GVAR(level) == 0) exitWith {}; diff --git a/addons/medical/functions/fnc_canAccessMedicalEquipment.sqf b/addons/medical/functions/fnc_canAccessMedicalEquipment.sqf index 4b1940b7e3..2aecfb9a12 100644 --- a/addons/medical/functions/fnc_canAccessMedicalEquipment.sqf +++ b/addons/medical/functions/fnc_canAccessMedicalEquipment.sqf @@ -14,9 +14,8 @@ #include "script_component.hpp" -private ["_target", "_caller", "_accessLevel", "_return"]; -_caller = _this select 0; -_target = _this select 1; +private ["_accessLevel", "_return"]; +params ["_caller", "_target"]; _accessLevel = _target getvariable [QGVAR(allowSharedEquipmentAccess), -1]; @@ -28,4 +27,4 @@ if (_accessLevel >= 0) then { if (_accessLevel == 2) exitwith { _return = (group _target == group _caller); }; }; -_return; \ No newline at end of file +_return; diff --git a/addons/medical/functions/fnc_canTreat.sqf b/addons/medical/functions/fnc_canTreat.sqf index e0cab95420..ba6ced0486 100644 --- a/addons/medical/functions/fnc_canTreat.sqf +++ b/addons/medical/functions/fnc_canTreat.sqf @@ -16,36 +16,35 @@ #include "script_component.hpp" -private ["_caller", "_target", "_selectionName", "_className", "_config", "_medicRequired", "_items", "_locations", "_return", "_condition", "_patientStateCondition", "_allowedSelections"]; -_caller = _this select 0; -_target = _this select 1; -_selectionName = _this select 2; -_className = _this select 3; +private ["_config", "_medicRequired", "_items", "_locations", "_return", "_condition", "_patientStateCondition", "_allowedSelections"]; +params ["_caller", "_target", "_selectionName", "_className"]; -if !(_target isKindOf "CAManBase") exitWith {false}; +if !(_target isKindOf "CAManBase") exitWith { false }; + + +_config = (ConfigFile >> "ACE_Medical_Actions" >> (["Basic", "Advanced"] select (GVAR(level)>=2)) >> _className); -_config = (ConfigFile >> "ACE_Medical_Actions" >> "Basic" >> _className); -if (GVAR(level)>=2) then { - _config = (ConfigFile >> "ACE_Medical_Actions" >> "Advanced" >> _className); -}; if !(isClass _config) exitwith {false}; +// Allow self treatment check +if (_caller == _target && {getNumber (_config >> "allowSelfTreatment") == 0}) exitwith {false}; + _medicRequired = if (isNumber (_config >> "requiredMedic")) then { getNumber (_config >> "requiredMedic"); } else { // Check for required class if (isText (_config >> "requiredMedic")) exitwith { - missionNamespace getvariable [(getText (_config >> "requiredMedic")), 0]; + missionNamespace getvariable [(getText (_config >> "requiredMedic")), 0] }; 0; }; -if !([_caller, _medicRequired] call FUNC(isMedic)) exitwith {false}; +if !([_caller, _medicRequired] call FUNC(isMedic)) exitwith { false }; _items = getArray (_config >> "items"); -if (count _items > 0 && {!([_caller, _target, _items] call FUNC(hasItems))}) exitwith {false}; +if (count _items > 0 && {!([_caller, _target, _items] call FUNC(hasItems))}) exitwith { false }; _allowedSelections = getArray (_config >> "allowedSelections"); -if !("All" in _allowedSelections || {(_selectionName in _allowedSelections)}) exitwith {false}; +if !("All" in _allowedSelections || {(_selectionName in _allowedSelections)}) exitwith { false }; _return = true; if (getText (_config >> "condition") != "") then { @@ -61,7 +60,7 @@ if (getText (_config >> "condition") != "") then { _return = [_caller, _target, _selectionName, _className] call _condition; }; }; -if (!_return) exitwith {false}; +if (!_return) exitwith { false }; _patientStateCondition = if (isText(_config >> "patientStateCondition")) then { missionNamespace getvariable [getText(_config >> "patientStateCondition"), 0] @@ -71,7 +70,7 @@ _patientStateCondition = if (isText(_config >> "patientStateCondition")) then { if (_patientStateCondition == 1 && {!([_target] call FUNC(isInStableCondition))}) exitwith {false}; _locations = getArray (_config >> "treatmentLocations"); -if ("All" in _locations) exitwith {true}; +if ("All" in _locations) exitwith { true }; private [ "_medFacility", "_medVeh"]; _medFacility = {([_caller] call FUNC(isInMedicalFacility)) || ([_target] call FUNC(isInMedicalFacility))}; @@ -93,6 +92,6 @@ _medVeh = {([_caller] call FUNC(isInMedicalVehicle)) || ([_target] call FUNC(isI }; }; }; -}foreach _locations; +} foreach _locations; _return; diff --git a/addons/medical/functions/fnc_canTreatCached.sqf b/addons/medical/functions/fnc_canTreatCached.sqf index b1dfaf7d12..273da7dc4b 100644 --- a/addons/medical/functions/fnc_canTreatCached.sqf +++ b/addons/medical/functions/fnc_canTreatCached.sqf @@ -17,6 +17,7 @@ #include "script_component.hpp" #define MAX_DURATION_CACHE 2 +params ["", "_target", "_selection", "_classname"]; // parameters, function, namespace, uid -[_this, DFUNC(canTreat), _this select 1, format[QGVAR(canTreat_%1_%2), _this select 2, _this select 3], MAX_DURATION_CACHE, "clearConditionCaches"] call EFUNC(common,cachedCall); +[_this, DFUNC(canTreat), _target, format [QGVAR(canTreat_%1_%2), _selection, _classname], MAX_DURATION_CACHE, "clearConditionCaches"] call EFUNC(common,cachedCall); diff --git a/addons/medical/functions/fnc_copyDeadBody.sqf b/addons/medical/functions/fnc_copyDeadBody.sqf index 36bcd91487..9cd43dada6 100644 --- a/addons/medical/functions/fnc_copyDeadBody.sqf +++ b/addons/medical/functions/fnc_copyDeadBody.sqf @@ -7,16 +7,15 @@ * 1: The caller * * Return Value: - * OBJECT Returns the copy of the unit. If no copy could be made, returns the oldBody + * Returns the copy of the unit. If no copy could be made, returns the oldBody * * Public: No */ #include "script_component.hpp" -private ["_oldBody","_newUnit","_class","_group","_position","_side", "_caller", "_name"]; -_oldBody = _this select 0; -_caller = _this select 1; +private ["_newUnit", "_class", "_group", "_position", "_side", "_name"]; +params ["_oldBody", "_caller"]; if (alive _oldBody) exitwith {_oldBody}; // we only want to do this for dead bodies @@ -79,5 +78,5 @@ _newUnit setvariable ["ACE_isUnconscious", true, true]; _newUnit setvariable [QGVAR(disableInteraction), true, true]; _oldBody setvariable [QGVAR(disableInteraction), true, true]; -_newUnit setDamage 0.89; +[_newUnit, 0.89] call FUNC(setStructuralDamage); _newUnit; diff --git a/addons/medical/functions/fnc_createLitter.sqf b/addons/medical/functions/fnc_createLitter.sqf index a3b71b7f9c..c234574abc 100644 --- a/addons/medical/functions/fnc_createLitter.sqf +++ b/addons/medical/functions/fnc_createLitter.sqf @@ -3,11 +3,16 @@ * Spawns litter for the treatment action on the ground around the target * * Arguments: - * 0: The target - * 1: The treatment classname + * 0: The Caller + * 1: The target + * 2: The treatment Selection Name + * 3: The treatment classname + * 4: ? + * 5: Users of Items + * 6: Previous Damage * * Return Value: - * + * None * * Public: No */ @@ -16,13 +21,8 @@ #define MIN_ENTRIES_LITTER_CONFIG 3 -private ["_target", "_className", "_config", "_litter", "_createLitter", "_position", "_createdLitter", "_caller", "_selectionName", "_usersOfItems", "_previousDamage"]; -_caller = _this select 0; -_target = _this select 1; -_selectionName = _this select 2; -_className = _this select 3; -_usersOfItems = _this select 5; -_previousDamage = _this select 6; +private ["_config", "_litter", "_createLitter", "_position", "_createdLitter"]; +params ["_caller", "_target", "_selectionName", "_className", "", "_usersOfItems", "_previousDamage"]; if !(GVAR(allowLitterCreation)) exitwith {}; if (vehicle _caller != _caller || vehicle _target != _target) exitwith {}; @@ -38,25 +38,24 @@ if !(isArray (_config >> "litter")) exitwith {}; _litter = getArray (_config >> "litter"); _createLitter = { - private["_position", "_litterClass", "_direction"]; - + private["_position", "_direction"]; + params ["_unit", "_litterClass"]; // @TODO: handle carriers over water // For now, don't spawn litter if we are over water to avoid floating litter - if(surfaceIsWater (getPos (_this select 0))) exitWith { false }; - - _position = getPosATL (_this select 0); - _position = [_position select 0, _position select 1, 0]; - _litterClass = _this select 1; - if (random(1) >= 0.5) then { - _position = [(_position select 0) + random 1, (_position select 1) + random 1, _position select 2]; + if(surfaceIsWater (getPos _unit)) exitWith { false }; + + _position = getPosATL _unit; + _position params ["_posX", "_posY"]; + _position = if (random(1) >= 0.5) then { + [_posX + random 1, _posY + random 1, 0] } else { - _position = [(_position select 0) - random 1, (_position select 1) - random 1, _position select 2]; + [_posX - random 1, _posY - random 1, 0]; }; _direction = (random 360); // Create the litter, and timeout the event based on the cleanup delay // The cleanup delay for events in MP is handled by the server side - [QGVAR(createLitter), [_litterClass,_position,_direction], 0] call EFUNC(common,syncedEvent); + [QGVAR(createLitter), [_litterClass, _position, _direction], 0] call EFUNC(common,syncedEvent); true }; @@ -65,11 +64,10 @@ _createdLitter = []; { if (typeName _x == "ARRAY") then { if (count _x < MIN_ENTRIES_LITTER_CONFIG) exitwith {}; - private ["_selection", "_litterCondition", "_litterOptions"]; - _selection = _x select 0; + + _x params ["_selection", "_litterCondition", "_litterOptions"]; + if (toLower _selection in [toLower _selectionName, "all"]) then { // in is case sensitve. We can be forgiving here, so lets use toLower. - _litterCondition = _x select 1; - _litterOptions = _x select 2; if (isnil _litterCondition) then { _litterCondition = if (_litterCondition != "") then {compile _litterCondition} else {{true}}; @@ -88,8 +86,8 @@ _createdLitter = []; if (typeName _x == "STRING") then { [_target, _x] call _createLitter; }; - }foreach _litterOptions; + } foreach _litterOptions; }; }; }; -}foreach _litter; \ No newline at end of file +} foreach _litter; diff --git a/addons/medical/functions/fnc_determineIfFatal.sqf b/addons/medical/functions/fnc_determineIfFatal.sqf index bad15dbcad..7fc4823202 100644 --- a/addons/medical/functions/fnc_determineIfFatal.sqf +++ b/addons/medical/functions/fnc_determineIfFatal.sqf @@ -1,19 +1,29 @@ -/** - * fn_determineIfFatal.sqf - * @Descr: N/A - * @Author: Glowbal +/* + * Author: Glowbal + * Determine If Fatal * - * @Arguments: [] - * @Return: - * @PublicAPI: false + * Arguments: + * 0: Unit + * 1: Part + * 2: with Damage (default: 0) + * + * Return Value: + * None + * + * Public: No */ - #include "script_component.hpp" -private ["_unit","_part","_damageThreshold", "_withDamage", "_damageBodyPart"]; -_unit = _this select 0; -_part = _this select 1; -_withDamage = if (count _this > 2) then { _this select 2} else {0}; +#define INCREASE_CHANCE_HEAD 0.05 +#define INCREASE_CHANCE_TORSO 0.03 +#define INCREASE_CHANGE_LIMB 0.01 + +#define CHANGE_FATAL_HEAD 0.7 +#define CHANGE_FATAL_TORSO 0.6 +#define CHANGE_FATAL_LIMB 0.1 + +private ["_damageThreshold", "_damageBodyPart", "_chanceFatal"]; +params ["_unit", "_part", ["_withDamage", 0]]; if (!alive _unit) exitwith {true}; if (_part < 0 || _part > 5) exitwith {false}; @@ -26,17 +36,22 @@ if ([_unit] call EFUNC(common,IsPlayer)) then { } else { _damageThreshold =_unit getvariable[QGVAR(unitDamageThreshold), [GVAR(AIDamageThreshold), GVAR(AIDamageThreshold), GVAR(AIDamageThreshold) * 1.7]]; }; +_damageThreshold params ["_thresholdHead", "_thresholdTorso", "_thresholdLimbs"]; _damageBodyPart = ((_unit getvariable [QGVAR(bodyPartStatus),[0, 0, 0, 0, 0, 0]]) select _part) + _withDamage; // Check if damage to body part is higher as damage head if (_part == 0) exitwith { - (_damageBodyPart >= (_damageThreshold select 0) && {(random(1) > 0.2)}); + _chanceFatal = CHANGE_FATAL_HEAD + ((INCREASE_CHANCE_HEAD * (_damageBodyPart - _thresholdHead)) * 10); + (_damageBodyPart >= _thresholdHead && {(_chanceFatal >= random(1))}); }; // Check if damage to body part is higher as damage torso if (_part == 1) exitwith { - (_damageBodyPart >= (_damageThreshold select 1) && {(random(1) > 0.2)}); + _chanceFatal = CHANGE_FATAL_TORSO + ((INCREASE_CHANCE_TORSO * (_damageBodyPart - _thresholdTorso)) * 10); + (_damageBodyPart >= _thresholdTorso && {(_chanceFatal >= random(1))}); }; // Check if damage to body part is higher as damage limbs -(_damageBodyPart >= (_damageThreshold select 2) && {(random(1) > 0.95)}); +// We use a slightly lower decrease for limbs, as we want any injuries done to those to be less likely to be fatal compared to head shots or torso. +_chanceFatal = CHANGE_FATAL_LIMB + ((INCREASE_CHANGE_LIMB * (_damageBodyPart - _thresholdLimbs)) * 10); +(_damageBodyPart >= _thresholdLimbs && {(_chanceFatal >= random(1))}); diff --git a/addons/medical/functions/fnc_displayPatientInformation.sqf b/addons/medical/functions/fnc_displayPatientInformation.sqf index cd61550152..f73376cb29 100644 --- a/addons/medical/functions/fnc_displayPatientInformation.sqf +++ b/addons/medical/functions/fnc_displayPatientInformation.sqf @@ -4,25 +4,25 @@ * * Arguments: * 0: The Unit - * 1: Show + * 1: Show (default: true) + * 2: Selection (default: 0) * * ReturnValue: - * nil + * None * * Public: No */ #include "script_component.hpp" +#define MAX_DISTANCE 10 // Exit for basic medical if (GVAR(level) < 2) exitWith {}; -private ["_target", "_show", "_selectionN", "_amountOfGeneric", "_bandagedwounds", "_logCtrl", "_part", "_partText", "_pointDamage", "_severity", "_total", "_totalIvVolume", "_triageStatus", "_type"]; -_target = _this select 0; -_show = if (count _this > 1) then {_this select 1} else {true}; -_selectionN = if (count _this > 2) then {_this select 2} else {0}; +private ["_amountOfGeneric", "_bandagedwounds", "_logCtrl", "_part", "_partText", "_pointDamage", "_severity", "_total", "_totalIvVolume", "_triageStatus", "_type"]; +params ["_target", ["_show", true], ["_selectionN", 0]]; -GVAR(currentSelectedSelectionN) = if (typeName _selectionN == "SCALAR") then {_selectionN} else {0}; -GVAR(displayPatientInformationTarget) = if (_show) then {_target} else {ObjNull}; +GVAR(currentSelectedSelectionN) = [0, _selectionN] select (IS_SCALAR(_selectionN)); +GVAR(displayPatientInformationTarget) = [ObjNull, _target] select _show; if (USE_WOUND_EVENT_SYNC) then { [_target, ACE_player] call FUNC(requestWoundSync); @@ -33,17 +33,22 @@ if (_show) then { [{ private ["_target", "_display", "_alphaLevel", "_damaged", "_availableSelections", "_openWounds", "_selectionBloodLoss", "_red", "_green", "_blue", "_alphaLevel", "_allInjuryTexts", "_lbCtrl", "_genericMessages"]; - _target = (_this select 0) select 0; - _selectionN = (_this select 0) select 1; + params ["_args", "_idPFH"]; + _args params ["_target", "_selectionN"]; if (GVAR(displayPatientInformationTarget) != _target || GVAR(currentSelectedSelectionN) != _selectionN) exitwith { - [_this select 1] call CBA_fnc_removePerFrameHandler; + [_idPFH] call CBA_fnc_removePerFrameHandler; + }; + if (ACE_player distance _target > MAX_DISTANCE) exitwith { + ("ACE_MedicalRscDisplayInformation" call BIS_fnc_rscLayer) cutText ["","PLAIN"]; + [_idPFH] call CBA_fnc_removePerFrameHandler; + ["displayTextStructured", [ACE_player], [[LSTRING(DistanceToFar), [_target] call EFUNC(common,getName)], 1.75, ACE_player]] call EFUNC(common,targetEvent); }; disableSerialization; _display = uiNamespace getvariable QGVAR(DisplayInformation); if (isnil "_display") exitwith { - [_this select 1] call CBA_fnc_removePerFrameHandler; + [_idPFH] call CBA_fnc_removePerFrameHandler; }; _allInjuryTexts = []; @@ -75,7 +80,7 @@ if (_show) then { if !(isnil "_value") then { _totalIvVolume = _totalIvVolume + (_target getvariable [_x, 0]); }; - }foreach GVAR(IVBags); + } foreach GVAR(IVBags); if (_totalIvVolume >= 1) then { _genericMessages pushback [format[localize LSTRING(receivingIvVolume), floor _totalIvVolume], [1, 1, 1, 1]]; }; @@ -86,33 +91,33 @@ if (_show) then { _openWounds = _target getvariable [QGVAR(openWounds), []]; private "_amountOf"; { - _amountOf = _x select 3; + _x params ["", "_x1", "_selectionX", "_amountOf", "_x4"]; // Find how much this bodypart is bleeding if (_amountOf > 0) then { - _damaged set[_x select 2, true]; - _selectionBloodLoss set [(_x select 2), (_selectionBloodLoss select (_x select 2)) + (20 * ((_x select 4) * _amountOf))]; + _damaged set[_selectionX, true]; + _selectionBloodLoss set [_selectionX, (_selectionBloodLoss select _selectionX) + (20 * (_x4 * _amountOf))]; - if (_selectionN == (_x select 2)) then { + if (_selectionN == _selectionX) then { // Collect the text to be displayed for this injury [ Select injury class type definition - select the classname DisplayName (6th), amount of injuries for this] if (_amountOf >= 1) then { // TODO localization - _allInjuryTexts pushback [format["%2x %1", (GVAR(AllWoundInjuryTypes) select (_x select 1)) select 6, _amountOf], [1,1,1,1]]; + _allInjuryTexts pushback [format["%2x %1", (GVAR(AllWoundInjuryTypes) select _x1) select 6, _amountOf], [1,1,1,1]]; } else { // TODO localization - _allInjuryTexts pushback [format["Partial %1", (GVAR(AllWoundInjuryTypes) select (_x select 1)) select 6], [1,1,1,1]]; + _allInjuryTexts pushback [format["Partial %1", (GVAR(AllWoundInjuryTypes) select _x1) select 6], [1,1,1,1]]; }; }; }; - }foreach _openWounds; + } foreach _openWounds; _bandagedwounds = _target getvariable [QGVAR(bandagedWounds), []]; { - _amountOf = _x select 3; + _x params ["", "", "_selectionX", "_amountOf", "_x4"]; // Find how much this bodypart is bleeding - if !(_damaged select (_x select 2)) then { - _selectionBloodLoss set [(_x select 2), (_selectionBloodLoss select (_x select 2)) + (20 * ((_x select 4) * _amountOf))]; + if !(_damaged select _selectionX) then { + _selectionBloodLoss set [_selectionX, (_selectionBloodLoss select _selectionX) + (20 * (_x4 * _amountOf))]; }; - if (_selectionN == (_x select 2)) then { + if (_selectionN == _selectionX) then { // Collect the text to be displayed for this injury [ Select injury class type definition - select the classname DisplayName (6th), amount of injuries for this] if (_amountOf > 0) then { if (_amountOf >= 1) then { @@ -124,7 +129,7 @@ if (_show) then { }; }; }; - }foreach _bandagedwounds; + } foreach _bandagedwounds; } else { _damaged = [true, true, true, true, true, true]; { @@ -154,7 +159,7 @@ if (_show) then { _availableSelections = [50,51,52,53,54,55]; { - private ["_red", "_green", "_blue"]; + private ["_red", "_green", "_blue", "_total"]; _total = _x; _red = 1; @@ -171,20 +176,22 @@ if (_show) then { }; }; (_display displayCtrl (_availableSelections select _foreachIndex)) ctrlSetTextColor [_red, _green, _blue, 1.0]; - }foreach _selectionBloodLoss; + } foreach _selectionBloodLoss; _lbCtrl = (_display displayCtrl 200); lbClear _lbCtrl; { - _lbCtrl lbAdd (_x select 0); - _lbCtrl lbSetColor [_foreachIndex, _x select 1]; - }foreach _genericMessages; + _x params ["_add", "_color"]; + _lbCtrl lbAdd _add; + _lbCtrl lbSetColor [_foreachIndex, _color]; + } foreach _genericMessages; _amountOfGeneric = count _genericMessages; { - _lbCtrl lbAdd (_x select 0); - _lbCtrl lbSetColor [_foreachIndex + _amountOfGeneric, _x select 1]; - }foreach _allInjuryTexts; + _x params ["_add", "_color"]; + _lbCtrl lbAdd _add; + _lbCtrl lbSetColor [_foreachIndex + _amountOfGeneric, _color]; + } foreach _allInjuryTexts; if (count _allInjuryTexts == 0) then { _lbCtrl lbAdd (localize LSTRING(NoInjuriesBodypart)); }; @@ -196,9 +203,7 @@ if (_show) then { _logs = _target getvariable [QGVAR(logFile_Activity), []]; { // [_message,_moment,_type, _arguments] - _message = _x select 0; - _moment = _x select 1; - _arguments = _x select 3; + _x params ["_message", "_moment", "_type", "_arguments"]; if (isLocalized _message) then { _message = localize _message; }; @@ -207,10 +212,10 @@ if (_show) then { if (typeName _x == "STRING" && {isLocalized _x}) then { _arguments set [_foreachIndex, localize _x]; }; - }foreach _arguments; + } foreach _arguments; _message = format([_message] + _arguments); _logCtrl lbAdd format["%1 %2", _moment, _message]; - }foreach _logs; + } foreach _logs; _triageStatus = [_target] call FUNC(getTriageStatus); (_display displayCtrl 303) ctrlSetText (_triageStatus select 0); diff --git a/addons/medical/functions/fnc_displayTriageCard.sqf b/addons/medical/functions/fnc_displayTriageCard.sqf index c4ed4ad829..9849242de1 100644 --- a/addons/medical/functions/fnc_displayTriageCard.sqf +++ b/addons/medical/functions/fnc_displayTriageCard.sqf @@ -4,18 +4,18 @@ * * Arguments: * 0: The unit + * 1: Show (default: true) * * Return Value: - * nil + * None * * Public: Yes */ #include "script_component.hpp" -private ["_target", "_show", "_amount", "_item", "_log", "_message", "_triageCardTexts", "_triageStatus"]; -_target = _this select 0; -_show = if (count _this > 1) then {_this select 1} else {true}; +private ["_amount", "_item", "_log", "_message", "_triageCardTexts", "_triageStatus"]; +params ["_target", ["_show", true]]; GVAR(TriageCardTarget) = if (_show) then {_target} else {ObjNull}; @@ -25,15 +25,16 @@ if (_show) then { [{ private ["_target", "_display", "_alphaLevel", "_alphaLevel", "_lbCtrl"]; - _target = (_this select 0) select 0; + params ["_args", "_idPFH"]; + _args params ["_target"]; if (GVAR(TriageCardTarget) != _target) exitwith { - [_this select 1] call CBA_fnc_removePerFrameHandler; + [_idPFH] call CBA_fnc_removePerFrameHandler; }; disableSerialization; _display = uiNamespace getvariable QGVAR(triageCard); if (isnil "_display") exitwith { - [_this select 1] call CBA_fnc_removePerFrameHandler; + [_idPFH] call CBA_fnc_removePerFrameHandler; }; _triageCardTexts = []; @@ -44,8 +45,7 @@ if (_show) then { _log = _target getvariable [QGVAR(triageCard), []]; { - _item = _x select 0; - _amount = _x select 1; + _x params ["_item", "_amount"]; _message = _item; if (isClass(configFile >> "CfgWeapons" >> _item)) then { _message = getText(configFile >> "CfgWeapons" >> _item >> "DisplayName"); @@ -55,18 +55,21 @@ if (_show) then { }; }; _triageCardTexts pushback format["%1x - %2", _amount, _message]; - }foreach _log; + } foreach _log; if (count _triageCardTexts == 0) then { _lbCtrl lbAdd (localize LSTRING(TriageCard_NoEntry)); }; { _lbCtrl lbAdd _x; - }foreach _triageCardTexts; + } foreach _triageCardTexts; _triageStatus = [_target] call FUNC(getTriageStatus); - (_display displayCtrl 2000) ctrlSetText (_triageStatus select 0); - (_display displayCtrl 2000) ctrlSetBackgroundColor (_triageStatus select 2); + + _triageStatus params ["_text", "", "_color"]; + + (_display displayCtrl 2000) ctrlSetText _text; + (_display displayCtrl 2000) ctrlSetBackgroundColor _color; }, 0, [_target]] call CBA_fnc_addPerFrameHandler; diff --git a/addons/medical/functions/fnc_dropDownTriageCard.sqf b/addons/medical/functions/fnc_dropDownTriageCard.sqf index 6f30152c5f..d207c7f9a4 100644 --- a/addons/medical/functions/fnc_dropDownTriageCard.sqf +++ b/addons/medical/functions/fnc_dropDownTriageCard.sqf @@ -3,18 +3,18 @@ * Display triage card for a unit * * Arguments: - * 0: The unit + * 0: Show * * Return Value: - * nil + * None * * Public: Yes */ #include "script_component.hpp" -private ["_show", "_ctrl", "_display", "_idc", "_pos"]; -_show = _this select 0; +private ["_ctrl", "_display", "_idc", "_pos"]; +params ["_show"]; disableSerialization; _display = uiNamespace getvariable QGVAR(triageCard); diff --git a/addons/medical/functions/fnc_getBloodLoss.sqf b/addons/medical/functions/fnc_getBloodLoss.sqf index 1881643d97..a3fdbd5b94 100644 --- a/addons/medical/functions/fnc_getBloodLoss.sqf +++ b/addons/medical/functions/fnc_getBloodLoss.sqf @@ -15,10 +15,9 @@ #define BLOODLOSSRATE_BASIC 0.2 -private ["_unit", "_totalBloodLoss","_tourniquets","_openWounds", "_cardiacOutput", "_internalWounds"]; +private ["_totalBloodLoss","_tourniquets","_openWounds", "_cardiacOutput", "_internalWounds"]; // TODO Only use this calculation if medium or higher, otherwise use vanilla calculations (for basic medical). - -_unit = _this select 0; +params ["_unit"]; _totalBloodLoss = 0; // Advanced medical bloodloss handling @@ -34,16 +33,17 @@ if (GVAR(level) >= 2) then { // (((BLOODLOSS_SMALL_WOUNDS * (_x select 0))) + ((BLOODLOSS_MEDIUM_WOUNDS * (_x select 1))) + ((BLOODLOSS_LARGE_WOUNDS * (_x select 2))) * (_cardiacOutput / DEFAULT_CARDIAC_OUTPUT)); }; - }foreach _openWounds; + } foreach _openWounds; _internalWounds = _unit getvariable [QGVAR(internalWounds), []]; { _totalBloodLoss = _totalBloodLoss + ((_x select 4) * (_x select 3)); - }foreach _internalWounds; + } foreach _internalWounds; // cap the blood loss to be no greater as the current cardiac output //(_totalBloodLoss min _cardiacOutput); } else { - _totalBloodLoss = BLOODLOSSRATE_BASIC * (damage _unit); + { _totalBloodLoss = _totalBloodLoss + _x } forEach (_unit getvariable [QGVAR(bodyPartStatus), []]); + _totalBloodLoss = (_totalBloodLoss / 6) * BLOODLOSSRATE_BASIC; }; _totalBloodLoss * ((_unit getVariable [QGVAR(bleedingCoefficient), GVAR(bleedingCoefficient)]) max 0); diff --git a/addons/medical/functions/fnc_getBloodPressure.sqf b/addons/medical/functions/fnc_getBloodPressure.sqf index f5012c8735..659949d716 100644 --- a/addons/medical/functions/fnc_getBloodPressure.sqf +++ b/addons/medical/functions/fnc_getBloodPressure.sqf @@ -6,29 +6,28 @@ * 0: The Unit * * ReturnValue: - * Blood Pressuret ,> + * 0: BloodPressure Low + * 1: BloodPressure High * * Public: No */ #include "script_component.hpp" -/* - Value is taken because with cardic output and resistance at default values, it will put blood pressure High at 120. -*/ +// Value is taken because with cardic output and resistance at default values, it will put blood pressure High at 120. #define MODIFIER_BP_HIGH 0.229 -/* - Value is taken because with cardic output and resistance at default values, it will put blood pressure Low at 80. -*/ +// Value is taken because with cardic output and resistance at default values, it will put blood pressure Low at 80. #define MODIFIER_BP_LOW 0.1524 -private ["_unit", "_bloodPressureLow", "_bloodPressureHigh", "_cardiacOutput", "_resistance"]; -_unit = _this select 0; +private ["_bloodPressureLow", "_bloodPressureHigh", "_cardiacOutput", "_resistance"]; + +params ["_unit"]; + _cardiacOutput = [_unit] call FUNC(getCardiacOutput); _resistance = _unit getvariable [QGVAR(peripheralResistance), 100]; _bloodPressureHigh = (_cardiacOutput * MODIFIER_BP_HIGH) * _resistance; _bloodPressureLow = (_cardiacOutput * MODIFIER_BP_LOW) * _resistance; -[_bloodPressureLow, _bloodPressureHigh]; +[_bloodPressureLow max 0, _bloodPressureHigh max 0] diff --git a/addons/medical/functions/fnc_getBloodVolumeChange.sqf b/addons/medical/functions/fnc_getBloodVolumeChange.sqf index 23eba4a0c7..3524e15cb5 100644 --- a/addons/medical/functions/fnc_getBloodVolumeChange.sqf +++ b/addons/medical/functions/fnc_getBloodVolumeChange.sqf @@ -28,10 +28,8 @@ */ #define BLOOD_CHANGE_PER_SECOND 0.0595 - - -private ["_unit","_bloodVolume","_bloodVolumeChange", "_ivVolume"]; -_unit = _this select 0; +private ["_bloodVolume", "_bloodVolumeChange", "_ivVolume"]; +params ["_unit"]; _bloodVolume = _unit getvariable [QGVAR(bloodVolume), 100]; _bloodVolumeChange = -([_unit] call FUNC(getBloodLoss)); @@ -43,13 +41,13 @@ if (_bloodVolume < 100.0) then { _ivVolume = (_unit getvariable [_x, 0]) + IV_CHANGE_PER_SECOND; _unit setvariable [_x,_ivVolume]; }; - }foreach GVAR(IVBags); + } foreach GVAR(IVBags); } else { { if ((_unit getvariable [_x, 0]) > 0) then { _unit setvariable [_x, 0]; // lets get rid of exessive IV volume }; - }foreach GVAR(IVBags); + } foreach GVAR(IVBags); }; _bloodVolumeChange; diff --git a/addons/medical/functions/fnc_getCardiacOutput.sqf b/addons/medical/functions/fnc_getCardiacOutput.sqf index 34d7be33af..f24aa438ca 100644 --- a/addons/medical/functions/fnc_getCardiacOutput.sqf +++ b/addons/medical/functions/fnc_getCardiacOutput.sqf @@ -22,7 +22,6 @@ // to limit the amount of complex calculations necessary, we take a set modifier to calculate Stroke Volume. #define MODIFIER_CARDIAC_OUTPUT 19.04761 -private "_unit"; -_unit = _this select 0; +params ["_unit"]; ((_unit getvariable [QGVAR(bloodVolume), 100])/MODIFIER_CARDIAC_OUTPUT) + ((_unit getvariable [QGVAR(heartRate), 80])/80-1); diff --git a/addons/medical/functions/fnc_getHeartRateChange.sqf b/addons/medical/functions/fnc_getHeartRateChange.sqf index 92a2053737..d46733452a 100644 --- a/addons/medical/functions/fnc_getHeartRateChange.sqf +++ b/addons/medical/functions/fnc_getHeartRateChange.sqf @@ -15,8 +15,9 @@ #define HEART_RATE_MODIFIER 0.02 -private ["_unit", "_heartRate", "_hrIncrease", "_bloodLoss", "_time", "_values", "_adjustment", "_change", "_callBack", "_bloodVolume"]; -_unit = _this select 0; +private ["_heartRate", "_hrIncrease", "_bloodLoss", "_time", "_values", "_adjustment", "_change", "_callBack", "_bloodVolume"]; +params ["_unit"]; + _hrIncrease = 0; if (!(_unit getvariable [QGVAR(inCardiacArrest),false])) then { _heartRate = _unit getvariable [QGVAR(heartRate), 80]; @@ -24,10 +25,8 @@ if (!(_unit getvariable [QGVAR(inCardiacArrest),false])) then { _adjustment = _unit getvariable [QGVAR(heartRateAdjustments), []]; { - _values = (_x select 0); + _x params ["_values", "_time", "_callBack"]; if (abs _values > 0) then { - _time = (_x select 1); - _callBack = _x select 2; if (_time <= 0) then { _time = 1; }; @@ -47,7 +46,7 @@ if (!(_unit getvariable [QGVAR(inCardiacArrest),false])) then { [_unit] call _callBack; }; - }foreach _adjustment; + } foreach _adjustment; _adjustment = _adjustment - [ObjNull]; _unit setvariable [QGVAR(heartRateAdjustments), _adjustment]; diff --git a/addons/medical/functions/fnc_getTriageStatus.sqf b/addons/medical/functions/fnc_getTriageStatus.sqf index 812c20ed2a..4dcef530a3 100644 --- a/addons/medical/functions/fnc_getTriageStatus.sqf +++ b/addons/medical/functions/fnc_getTriageStatus.sqf @@ -6,7 +6,9 @@ * 0: The unit * * Return Value: - * Triage status from the unit. Name, statusID, color > + * 0: Name + * 1: Status ID + * 2: Color > * * Public: Yes */ @@ -14,7 +16,7 @@ #include "script_component.hpp" private ["_unit","_return","_status"]; -_unit = _this select 0; +params ["_unit"]; _status = _unit getvariable [QGVAR(triageLevel), -1]; _return = switch (_status) do { case 1: {[localize LSTRING(Triage_Status_Minor), 1, [0, 0.5, 0, 0.9]]}; @@ -23,4 +25,4 @@ _return = switch (_status) do { case 4: {[localize LSTRING(Triage_Status_Deceased), 4, [0, 0, 0, 0.9]]}; default {[localize LSTRING(Triage_Status_None), 0, [0, 0, 0, 0.9]]}; }; -_return; +_return diff --git a/addons/medical/functions/fnc_getTypeOfDamage.sqf b/addons/medical/functions/fnc_getTypeOfDamage.sqf index d51131ce0c..7a351e0b77 100644 --- a/addons/medical/functions/fnc_getTypeOfDamage.sqf +++ b/addons/medical/functions/fnc_getTypeOfDamage.sqf @@ -13,23 +13,19 @@ #include "script_component.hpp" -PARAMS_1(_typeOfProjectile); +params ["_typeOfProjectile"]; -private ["_typeOfDamage"]; -_typeOfDamage = switch (true) do { - case (_typeOfProjectile isKindOf "BulletBase"): {"bullet"}; - case (_typeOfProjectile isKindOf "GrenadeCore"): {"grenade"}; - case (_typeOfProjectile isKindOf "TimeBombCore"): {"explosive"}; - case (_typeOfProjectile isKindOf "MineCore"): {"explosive"}; - case (_typeOfProjectile isKindOf "FuelExplosion"): {"explosive"}; - case (_typeOfProjectile isKindOf "ShellBase"): {"shell"}; - case (_typeOfProjectile isKindOf "RocketBase"): {"explosive"}; - case (_typeOfProjectile isKindOf "MissileBase"): {"explosive"}; - case (_typeOfProjectile isKindOf "LaserBombCore"): {"explosive"}; - case (_typeOfProjectile isKindOf "BombCore"): {"explosive"}; - case (_typeOfProjectile isKindOf "Grenade"): {"grenade"}; - default {toLower _typeOfProjectile}; -}; - -_typeOfDamage +if (_typeOfProjectile isKindOf "BulletBase") exitWith {"bullet"}; +if (_typeOfProjectile isKindOf "ShotgunBase") exitwith {"bullet"}; +if (_typeOfProjectile isKindOf "GrenadeCore") exitWith {"grenade"}; +if (_typeOfProjectile isKindOf "TimeBombCore") exitWith {"explosive"}; +if (_typeOfProjectile isKindOf "MineCore") exitWith {"explosive"}; +if (_typeOfProjectile isKindOf "FuelExplosion") exitWith {"explosive"}; +if (_typeOfProjectile isKindOf "ShellBase") exitWith {"shell"}; +if (_typeOfProjectile isKindOf "RocketBase") exitWith {"explosive"}; +if (_typeOfProjectile isKindOf "MissileBase") exitWith {"explosive"}; +if (_typeOfProjectile isKindOf "LaserBombCore") exitWith {"explosive"}; +if (_typeOfProjectile isKindOf "BombCore") exitWith {"explosive"}; +if (_typeOfProjectile isKindOf "Grenade") exitWith {"grenade"}; +toLower _typeOfProjectile diff --git a/addons/medical/functions/fnc_getUnconsciousCondition.sqf b/addons/medical/functions/fnc_getUnconsciousCondition.sqf index 19d3bdec1d..c354dd6ebd 100644 --- a/addons/medical/functions/fnc_getUnconsciousCondition.sqf +++ b/addons/medical/functions/fnc_getUnconsciousCondition.sqf @@ -14,7 +14,7 @@ #include "script_component.hpp" private ["_unit","_return"]; -_unit = _this select 0; +params ["_unit"]; if (isnil QGVAR(unconsciousConditions)) then { GVAR(unconsciousConditions) = []; @@ -25,6 +25,6 @@ _return = false; if (typeName _x == typeName {} && {([_unit] call _x)}) exitwith { _return = true; }; -}foreach GVAR(unconsciousConditions); +} foreach GVAR(unconsciousConditions); -_return; +_return diff --git a/addons/medical/functions/fnc_handleBandageOpening.sqf b/addons/medical/functions/fnc_handleBandageOpening.sqf index a86077cb3b..4a32adb9e5 100644 --- a/addons/medical/functions/fnc_handleBandageOpening.sqf +++ b/addons/medical/functions/fnc_handleBandageOpening.sqf @@ -18,13 +18,8 @@ #include "script_component.hpp" -private ["_target", "_impact", "_part", "_injuryIndex", "_injury", "_bandage", "_classID", "_className", "_reopeningChance", "_reopeningMinDelay", "_reopeningMaxDelay", "_config", "_woundTreatmentConfig", "_bandagedWounds", "_exist", "_injuryId", "_existingInjury", "_delay", "_openWounds", "_selectedInjury", "_bandagedInjury"]; -_target = _this select 0; -_impact = _this select 1; -_part = _this select 2; -_injuryIndex = _this select 3; -_injury = _this select 4; -_bandage = _this select 5; +private ["_className", "_reopeningChance", "_reopeningMinDelay", "_reopeningMaxDelay", "_config", "_woundTreatmentConfig", "_bandagedWounds", "_exist", "_injuryId", "_existingInjury", "_delay", "_openWounds", "_selectedInjury", "_bandagedInjury"]; +params ["_target", "_impact", "_part", "_injuryIndex", "_injury", "_bandage"]; _classID = _injury select 1; _className = GVAR(woundClassNames) select _classID; @@ -57,8 +52,8 @@ if (isClass (_config >> _className)) then { }; _bandagedWounds = _target getvariable [QGVAR(bandagedWounds), []]; -_exist = false; _injuryType = _injury select 1; +_exist = false; _bandagedInjury = []; { if ((_x select 1) == _injuryType && (_x select 2) == (_injury select 2)) exitwith { @@ -69,7 +64,7 @@ _bandagedInjury = []; _bandagedInjury = _existingInjury; }; -}foreach _bandagedWounds; +} foreach _bandagedWounds; if !(_exist) then { // [ID, classID, bodypart, percentage treated, bloodloss rate] @@ -83,12 +78,8 @@ _target setvariable [QGVAR(bandagedWounds), _bandagedWounds, true]; if (random(1) <= _reopeningChance) then { _delay = _reopeningMinDelay + random(_reopeningMaxDelay - _reopeningMinDelay); [{ - private ["_target", "_impact", "_part", "_injuryIndex", "_bandage", "_injury", "_openWounds", "_selectedInjury","_bandagedWounds","_exist"]; - _target = _this select 0; - _impact = _this select 1; - _part = _this select 2; - _injuryIndex = _this select 3; - _injury = _this select 4; + private ["_bandage", "_openWounds", "_selectedInjury","_bandagedWounds","_exist"]; + params ["_target", "_impact", "_part", "_injuryIndex", "_injury"]; //if (alive _target) then { _openWounds = _target getvariable [QGVAR(openWounds), []]; @@ -108,7 +99,7 @@ if (random(1) <= _reopeningChance) then { _existingInjury set [3, ((_existingInjury select 3) - _impact) max 0]; _bandagedWounds set [_foreachIndex, _existingInjury]; }; - }foreach _bandagedWounds; + } foreach _bandagedWounds; if (_exist) then { _target setvariable [QGVAR(bandagedWounds), _bandagedWounds, true]; diff --git a/addons/medical/functions/fnc_handleCreateLitter.sqf b/addons/medical/functions/fnc_handleCreateLitter.sqf index d7595ec439..31e65218c2 100644 --- a/addons/medical/functions/fnc_handleCreateLitter.sqf +++ b/addons/medical/functions/fnc_handleCreateLitter.sqf @@ -1,9 +1,22 @@ -//#define DEBUG_MODE_FULL +/* + * Author: Glowbal + * handle Litter Create + * + * Arguments: + * 0: Litter Class + * 1: Position + * 2: Unit + * + * Return Value: + * None + * + * Public: No + */ #include "script_component.hpp" if(!hasInterface) exitWith { false }; -PARAMS_3(_litterClass,_position,_direction); +params ["_litterClass", "_position", "_unit"]; private["_litterObject", "_maxLitterCount"]; //IGNORE_PRIVATE_WARNING(_values); @@ -16,9 +29,9 @@ _litterObject = _litterClass createVehicleLocal _position; _litterObject setDir _direction; _litterObject setPosATL _position; // Move the litter next frame to get rid of HORRIBLE spacing, fixes #1112 -[{ (_this select 0) setPosATL (_this select 1); }, [_litterObject, _position]] call EFUNC(common,execNextFrame); - -_maxLitterCount = getArray (configFile >> "ACE_Settings" >> QGVAR(litterSimulationDetail) >> "_values") select GVAR(litterSimulationDetail); +[{ params ["_object", "_pos"]; _object setPosATL _pos; }, [_litterObject, _position]] call EFUNC(common,execNextFrame); + +_maxLitterCount = getArray (configFile >> "ACE_Settings" >> QGVAR(litterSimulationDetail) >> "_values") select GVAR(litterSimulationDetail); if((count GVAR(allCreatedLitter)) > _maxLitterCount ) then { // gank the first litter object, and spawn ours. private["_oldLitter"]; @@ -34,10 +47,11 @@ if(!GVAR(litterPFHRunning) && {GVAR(litterCleanUpDelay) > 0}) then { GVAR(litterPFHRunning) = true; [{ { - if (ACE_time - (_x select 0) >= GVAR(litterCleanUpDelay)) then { + _x params ["_time", "_objects"]; + if (ACE_time - _time >= GVAR(litterCleanUpDelay)) then { { deleteVehicle _x; - } forEach (_x select 1); + } forEach _objects; GVAR(allCreatedLitter) set[_foreachIndex, objNull]; }; } forEach GVAR(allCreatedLitter); @@ -46,8 +60,6 @@ if(!GVAR(litterPFHRunning) && {GVAR(litterCleanUpDelay) > 0}) then { if ( (count GVAR(allCreatedLitter)) == 0) exitwith { [(_this select 1)] call CBA_fnc_removePerFrameHandler; GVAR(litterPFHRunning) = false; - }; + }; }, 30, []] call CBA_fnc_addPerFrameHandler; }; - -true \ No newline at end of file diff --git a/addons/medical/functions/fnc_handleDamage.sqf b/addons/medical/functions/fnc_handleDamage.sqf index a4e5525276..afcf6e12e5 100644 --- a/addons/medical/functions/fnc_handleDamage.sqf +++ b/addons/medical/functions/fnc_handleDamage.sqf @@ -1,5 +1,5 @@ -/* - * Author: KoffeinFlummi, Glowbal + /* + * Author: KoffeinFlummi, Glowbal, commy2 * Main HandleDamage EH function. * * Arguments: @@ -14,74 +14,79 @@ * * Public: No */ - #include "script_component.hpp" -private ["_unit", "_selection", "_damage", "_shooter", "_projectile", "_damageReturn", "_typeOfDamage", "_minLethalDamage", "_newDamage", "_typeIndex", "_preventDeath"]; -_unit = _this select 0; -_selection = _this select 1; -_damage = _this select 2; -_shooter = _this select 3; -_projectile = _this select 4; +params ["_unit", "_selection", "_damage", "_shooter", "_projectile"]; +TRACE_5("ACE_DEBUG: HandleDamage Called",_unit, _selection, _damage, _shooter, _projectile); -if !(local _unit) exitWith {nil}; +// bug, apparently can fire for remote units in special cases +if !(local _unit) exitWith { + TRACE_2("ACE_DEBUG: HandleDamage on remote unit!",_unit, isServer); + nil +}; +private ["_damageReturn", "_typeOfDamage", "_minLethalDamage", "_newDamage", "_typeIndex", "_preventDeath"]; + +// bug, assumed fixed, @todo excessive testing, if nothing happens remove if (typeName _projectile == "OBJECT") then { _projectile = typeOf _projectile; _this set [4, _projectile]; }; -// If the damage is being weird, we just tell it to fuck off. -if !(_selection in (GVAR(SELECTIONS) + [""])) exitWith {0}; +TRACE_3("ACE_DEBUG: HandleDamage",_selection,_damage,_unit); + +// If damage is in dummy hitpoints, "hands" and "legs", don't change anything +if (_selection == "hands") exitWith {_unit getHit "hands"}; +if (_selection == "legs") exitWith {_unit getHit "legs"}; + +// If the damage is being weird, we just tell it to fuck off. Ignore: "hands", "legs", "?" +if (_selection != "" && {!(_selection in GVAR(SELECTIONS))}) exitWith {0}; //@todo "neck", "pelvis", "spine1", "spine2", "spine3" // Exit if we disable damage temporarily -_damageOld = damage _unit; -if (_selection in GVAR(SELECTIONS)) then { - _damageOld = _unit getHit _selection; +if !(_unit getVariable [QGVAR(allowDamage), true]) exitWith { + TRACE_3("ACE_DEBUG: HandleDamage damage disabled.",_selection,damage _unit,_unit); + if (_selection == "") then { + damage _unit + } else { + _unit getHit _selection + }; }; -if !(_unit getVariable [QGVAR(allowDamage), true]) exitWith {_damageOld}; // Get return damage _damageReturn = _damage; -if (GVAR(level) < 2) then { - _damageReturn = _this call FUNC(handleDamage_basic); + +_newDamage = _this call FUNC(handleDamage_caching); +// handleDamage_caching may have modified the projectile string +_typeOfDamage = [_projectile] call FUNC(getTypeOfDamage); + +TRACE_3("ACE_DEBUG: HandleDamage caching new damage",_selection,_newDamage,_unit); + +_typeIndex = (GVAR(allAvailableDamageTypes) find _typeOfDamage); +_minLethalDamage = if (_typeIndex >= 0) then { + GVAR(minLethalDamages) select _typeIndex } else { - if !([_unit] call FUNC(hasMedicalEnabled)) exitwith { - // Because of the config changes, we cannot properly disable the medical system for a unit. - // lets use basic for the ACE_time being.. - _damageReturn = _this call FUNC(handleDamage_basic); - }; - _newDamage = _this call FUNC(handleDamage_caching); - // handleDamage_caching may have modified the projectile string - _projectile = _this select 4; - _typeOfDamage = [_projectile] call FUNC(getTypeOfDamage); + 0.01 +}; - _typeIndex = (GVAR(allAvailableDamageTypes) find _typeOfDamage); - _minLethalDamage = 0.01; - if (_typeIndex >= 0) then { - _minLethalDamage = GVAR(minLethalDamages) select _typeIndex; +if (vehicle _unit != _unit && {!(vehicle _unit isKindOf "StaticWeapon")} && {isNull _shooter} && {_projectile == ""} && {_selection == ""}) then { + if (GVAR(enableVehicleCrashes)) then { + _selection = GVAR(SELECTIONS) select (floor(random(count GVAR(SELECTIONS)))); }; +}; - if (vehicle _unit != _unit && {!(vehicle _unit isKindOf "StaticWeapon")} && {isNull _shooter} && {_projectile == ""} && {_selection == ""}) then { - if (GVAR(enableVehicleCrashes)) then { - _selection = GVAR(SELECTIONS) select (floor(random(count GVAR(SELECTIONS)))); - }; +if ((_minLethalDamage <= _newDamage) && {[_unit, [_selection] call FUNC(selectionNameToNumber), _newDamage] call FUNC(determineIfFatal)}) then { + if ((_unit getVariable [QGVAR(preventInstaDeath), GVAR(preventInstaDeath)])) exitwith { + _damageReturn = 0.9; }; - - if ((_minLethalDamage <= _newDamage) && {[_unit, [_selection] call FUNC(selectionNameToNumber), _newDamage] call FUNC(determineIfFatal)}) then { - if ((_unit getVariable [QGVAR(preventInstaDeath), GVAR(preventInstaDeath)])) exitwith { - _damageReturn = 0.9; - }; - if ([_unit] call FUNC(setDead)) then { - _damageReturn = 1; - } else { - _damageReturn = _damageReturn min 0.89; - }; + if ([_unit] call FUNC(setDead)) then { + _damageReturn = 1; } else { _damageReturn = _damageReturn min 0.89; }; - +} else { + _damageReturn = _damageReturn min 0.89; }; + [_unit] call FUNC(addToInjuredCollection); if (_unit getVariable [QGVAR(preventInstaDeath), GVAR(preventInstaDeath)]) exitWith { @@ -104,7 +109,7 @@ if (_unit getVariable [QGVAR(preventInstaDeath), GVAR(preventInstaDeath)]) exitW if (_delayedUnconsicous) then { [{ [_this select 0, true] call FUNC(setUnconscious); - }, [_unit], 0.7, 0] call EFUNC(common,waitAndExec); + }, [_unit], 0.7, 0] call EFUNC(common,waitAndExecute); } else { [{ [_this select 0, true] call FUNC(setUnconscious); @@ -123,4 +128,6 @@ if (((_unit getVariable [QGVAR(enableRevive), GVAR(enableRevive)]) > 0) && {_dam 0.89; }; -_damageReturn; +TRACE_3("ACE_DEBUG: HandleDamage damage return",_selection,_damageReturn,_unit); + +_damageReturn diff --git a/addons/medical/functions/fnc_handleDamage_advanced.sqf b/addons/medical/functions/fnc_handleDamage_advanced.sqf index e617738a90..5035fbe282 100644 --- a/addons/medical/functions/fnc_handleDamage_advanced.sqf +++ b/addons/medical/functions/fnc_handleDamage_advanced.sqf @@ -12,23 +12,16 @@ * 6: Type of Damage * * Return Value: - * Nothing + * None * * Public: No */ #include "script_component.hpp" -private ["_unit","_selectionName","_amountOfDamage","_sourceOfDamage","_typeOfProjectile","_typeOfDamage", "_part", "_damageBodyParts", "_newDamage", "_hitPoints"]; -_unit = _this select 0; -_selectionName = _this select 1; -_amountOfDamage = _this select 2; -_sourceOfDamage = _this select 3; -_typeOfProjectile = _this select 4; -_newDamage = _this select 5; +private ["_typeOfProjectile", "_part", "_damageBodyParts", "_hitPoints"]; +params ["_unit", "_selectionName", "_amountOfDamage", "_sourceOfDamage", "_typeOfProjectile", "_hitPointNumber", "_newDamage"]; -// Most likely taking exessive fire damage. Lets exit. -if (isNull _sourceOfDamage && {_typeOfProjectile == ""} && {vehicle _unit == _unit} && {(_selectionName == "head" || isBurning _unit)}) exitwith {}; _part = [_selectionName] call FUNC(selectionNameToNumber); if (_part < 0) exitwith {}; @@ -40,6 +33,7 @@ _damageBodyParts set [_part, (_damageBodyParts select _part) + _newDamage]; _unit setvariable [QGVAR(bodyPartStatus), _damageBodyParts, true]; _typeOfDamage = [_typeOfProjectile] call FUNC(getTypeOfDamage); + [_unit, _selectionName, _newDamage, _typeOfProjectile, _typeOfDamage] call FUNC(handleDamage_assignWounds); // TODO Disabled until implemented fully diff --git a/addons/medical/functions/fnc_handleDamage_advancedSetDamage.sqf b/addons/medical/functions/fnc_handleDamage_advancedSetDamage.sqf index 3df8a5ce0c..bac5a32976 100644 --- a/addons/medical/functions/fnc_handleDamage_advancedSetDamage.sqf +++ b/addons/medical/functions/fnc_handleDamage_advancedSetDamage.sqf @@ -6,23 +6,23 @@ * 0: Unit for which the hitpoint damage will be sorted out * * Return Value: - * nil + * None * * Public: No */ #include "script_component.hpp" -PARAMS_1(_unit); +params ["_unit"]; if (!local _unit) exitwith {}; -private ["_bodyStatus", "_headDamage", "_torsoDamage", "_handsDamage", "_legsDamage"]; +private "_bodyStatus"; // ["head", "body", "hand_l", "hand_r", "leg_l", "leg_r"] _bodyStatus = _unit getVariable [QGVAR(bodyPartStatus), [0,0,0,0,0,0]]; -EXPLODE_6_PVT(_bodyStatus,_headDamage,_torsoDamage,_handsDamageR,_handsDamageL,_legsDamageR,_legsDamageL); +_bodyStatus params ["_headDamage", "_torsoDamage", "_handsDamageR", "_handsDamageL", "_legsDamageR", "_legsDamageL"]; _unit setHitPointDamage ["hitHead", _headDamage min 0.95]; _unit setHitPointDamage ["hitBody", _torsoDamage min 0.95]; diff --git a/addons/medical/functions/fnc_handleDamage_airway.sqf b/addons/medical/functions/fnc_handleDamage_airway.sqf index bc220eaad9..8b627faae1 100644 --- a/addons/medical/functions/fnc_handleDamage_airway.sqf +++ b/addons/medical/functions/fnc_handleDamage_airway.sqf @@ -10,19 +10,15 @@ * 4: Type of the damage done * * Return Value: - * None + * None * * Public: No */ #include "script_component.hpp" -private ["_unit", "_selectionName", "_amountOfDamage", "_sourceOfDamage", "_typeOfDamage", "_bodyPartn"]; -_unit = _this select 0; -_selectionName = _this select 1; -_amountOfDamage = _this select 2; -_sourceOfDamage = _this select 3; -_typeOfDamage = _this select 4; +private "_bodyPartn"; +params ["_unit", "_selectionName", "_amountOfDamage", "_sourceOfDamage", "_typeOfDamage"]; _bodyPartn = [_selectionName] call FUNC(selectionNameToNumber); if (_bodyPartn > 1) exitwith {}; diff --git a/addons/medical/functions/fnc_handleDamage_basic.sqf b/addons/medical/functions/fnc_handleDamage_basic.sqf index 04049cfa7c..92fc97c717 100644 --- a/addons/medical/functions/fnc_handleDamage_basic.sqf +++ b/addons/medical/functions/fnc_handleDamage_basic.sqf @@ -1,192 +1,60 @@ /* - * Author: KoffeinFlummi - * Basic HandleDamage EH function. + * Author: KoffeinFlummi, Glowbal + * Handle damage basic medical * * Arguments: - * 0: Unit That Was Hit - * 1: Name Of Hit Selection - * 2: Amount Of Damage - * 3: Shooter - * 4: Projectile - * 5: Current damage to be returned * * Return Value: - * Damage To Be Inflicted + * * * Public: No */ #include "script_component.hpp" -#define LEGDAMAGETRESHOLD1 1 -#define LEGDAMAGETRESHOLD2 1.7 -#define ARMDAMAGETRESHOLD1 1 -#define ARMDAMAGETRESHOLD2 1.7 -#define UNCONSCIOUSNESSTRESHOLD 0.7 +private ["_damageBodyParts", "_cache_params", "_cache_damages"]; +params ["_target"]; +TRACE_1("ACE_DEBUG: HandleDamage_BASIC Called",_target); -private ["_unit", "_selectionName", "_damage", "_shooter", "_projectile", "_damage", "_armdamage", "_hitPoint", "_index", "_legdamage", "_newDamage", "_otherDamage", "_pain", "_restore"]; +_damageBodyParts = _target getvariable [QGVAR(bodyPartStatus), [0,0,0,0,0,0]]; +_cache_params = _target getVariable [QGVAR(cachedHandleDamageParams), []]; +_cache_damages = _target getVariable QGVAR(cachedDamages); -_unit = _this select 0; -_selectionName = _this select 1; -_damage = _this select 2; -_shooter = _this select 3; -_projectile = _this select 4; +TRACE_4("ACE_DEBUG: HandleDamage BASIC",_unit, _damageBodyParts,_cache_params,_cache_damages); -// Apply damage treshold / coefficient -_threshold = [ - _unit getVariable [QGVAR(damageThreshold), GVAR(AIDamageThreshold)], - _unit getVariable [QGVAR(damageThreshold), GVAR(playerDamageThreshold)] -] select ([_unit] call EFUNC(common,isPlayer)); -_damage = _damage * (1 / _threshold); +{ + _x params ["_unit","_selectionName","_amountOfDamage","_sourceOfDamage","_typeOfProjectile","_typeOfDamage"]; + if !(isNull _sourceOfDamage && {_typeOfProjectile == ""} && {vehicle _unit == _unit} && {(_selectionName == "head" || isBurning _unit)}) then { + _part = [_selectionName] call FUNC(selectionNameToNumber); + if (_part < 0) exitwith {}; -// This is a new hit, reset variables. -// Note: sometimes handleDamage spans over 2 or even 3 frames. -if (diag_frameno > (_unit getVariable [QGVAR(basic_frameNo), -3]) + 2) then { - _unit setVariable [QGVAR(basic_frameNo), diag_frameno]; - _unit setVariable [QGVAR(isFalling), false]; - _unit setVariable [QGVAR(projectiles), []]; - _unit setVariable [QGVAR(hitPoints), []]; - _unit setVariable [QGVAR(damages), []]; - _unit setVariable [QGVAR(structDamage), 0]; + private ["_newDamage", "_pain"]; + _newDamage = (_cache_damages select _foreachIndex); + _damageBodyParts set [_part, (_damageBodyParts select _part) + _newDamage]; + _unit setvariable [QGVAR(bodyPartStatus), _damageBodyParts]; - if (isnil {_unit getvariable QGVAR(structDamagePFH)}) then { - // Assign orphan structural damage to torso - [{ - private ["_unit", "_damagesum"]; - _unit = (_this select 0) select 0; - if (ACE_diagTime - (_unit getvariable [QGVAR(structDamagePFH),-2]) >= 2) then { - _unit setVariable [QGVAR(structDamagePFH), nil]; - _damagesum = (_unit getHitPointDamage "HitHead") + - (_unit getHitPointDamage "HitBody") + - (_unit getHitPointDamage "HitLeftArm") + - (_unit getHitPointDamage "HitRightArm") + - (_unit getHitPointDamage "HitLeftLeg") + - (_unit getHitPointDamage "HitRightLeg"); - if (_damagesum < 0.06 and damage _unit > 0.06 and alive _unit) then { - _unit setHitPointDamage ["HitBody", damage _unit]; - }; - [(_this select 1)] call cba_fnc_removePerFrameHandler; + if (alive _unit && {!(_unit getvariable ["ACE_isUnconscious", false])}) then { + // If it reaches this, we can assume that the hit did not kill this unit, as this function is called 3 frames after the damage has been passed. + if ([_unit, _part, if (_part > 1) then {_newDamage * 1.3} else {_newDamage * 2}] call FUNC(determineIfFatal)) then { + [_unit, true, 0.5+random(10)] call FUNC(setUnconscious); }; - }, 0, [_unit]] call CBA_fnc_addPerFrameHandler; - }; - _unit setVariable [QGVAR(structDamagePFH), ACE_diagTime]; // Assign starting ACE_time or reset it -}; - -_newDamage = _damage - (damage _unit); -if (_selectionName in GVAR(SELECTIONS)) then { - _newDamage = _damage - (_unit getHitPointDamage (GVAR(HITPOINTS) select (GVAR(SELECTIONS) find _selectionName))); -}; - -_damage = _damage - _newDamage; - - -// Exclude falling damage to everything other than legs and reduce it overall. -if (((velocity _unit) select 2 < -5) and (vehicle _unit == _unit)) then { - _unit setVariable [QGVAR(isFalling), true]; -}; -if (_unit getVariable [QGVAR(isFalling), false] and !(_selectionName in ["", "leg_l", "leg_r"])) exitWith { - (_unit getHitPointDamage (GVAR(HITPOINTS) select (GVAR(SELECTIONS) find _selectionName))) max 0.01; -}; -if (_unit getVariable [QGVAR(isFalling), false]) then { - _newDamage = _newDamage * 0.7; -}; - - -// Make sure there's only one damaged selection per projectile per frame. -if (_selectionName != "" and !(_unit getVariable QGVAR(isFalling))) then { - _cache_projectiles = _unit getVariable QGVAR(projectiles); - _cache_hitpoints = _unit getVariable QGVAR(hitPoints); - _cache_damages = _unit getVariable QGVAR(damages); - if (_projectile in _cache_projectiles) then { - _index = _cache_projectiles find _projectile; - _otherDamage = (_cache_damages select _index); - if (_otherDamage > _newDamage) then { - _newDamage = 0; - } else { - _hitPoint = _cache_hitpoints select _index; - _restore = ((_unit getHitPointDamage _hitPoint) - _otherDamage) max 0; - _unit setHitPointDamage [_hitPoint, _restore]; - // Make entry unfindable - _cache_projectiles set [_index, objNull]; - _cache_projectiles pushBack _projectile; - _cache_hitpoints pushBack (GVAR(HITPOINTS) select (GVAR(SELECTIONS) find _selectionName)); - _cache_damages pushBack _newDamage; }; - } else { - _cache_projectiles pushBack _projectile; - _cache_hitpoints pushBack (GVAR(HITPOINTS) select (GVAR(SELECTIONS) find _selectionName)); - _cache_damages pushBack _newDamage; + _pain = _unit getVariable [QGVAR(pain), 0]; + _pain = _pain + (_newDamage / 4) * (1 - (_unit getVariable [QGVAR(morphine), 0])); + _unit setVariable [QGVAR(pain), _pain min 1, true]; }; - _unit setVariable [QGVAR(projectiles), _cache_projectiles]; - _unit setVariable [QGVAR(hitPoints), _cache_hitpoints]; - _unit setVariable [QGVAR(damages), _cache_damages]; -}; +}foreach _cache_params; -// Get rid of double structural damage (seriously arma, what the fuck?) -if (_selectionName == "") then { - _cache_structDamage = _unit getVariable QGVAR(structDamage); - if (_newDamage > _cache_structDamage) then { - _unit setVariable [QGVAR(structDamage), _newDamage]; - _newDamage = _newDamage - _cache_structDamage; - } else { - _newDamage = 0; - }; -}; +// We broadcast the value across the net here, in order to avoid broadcasting it multiple times earlier in the above code block +_target setvariable [QGVAR(bodyPartStatus), _damageBodyParts, true]; +TRACE_2("ACE_DEBUG: HandleDamage BASIC Broadcast value here",_unit, _target getvariable QGVAR(bodyPartStatus)); -if (_selectionName == "") then { - _damage = _damage + (_unit getVariable QGVAR(structDamage)); -} else { - _damage = _damage + _newDamage; -}; +EXPLODE_6_PVT(_damageBodyParts,_headDamage,_torsoDamage,_handsDamageR,_handsDamageL,_legsDamageR,_legsDamageL); +_target setHitPointDamage ["hitHead", _headDamage min 0.95]; +_target setHitPointDamage ["hitBody", _torsoDamage min 0.95]; +_target setHitPointDamage ["hitHands", (_handsDamageR + _handsDamageL) min 0.95]; +_target setHitPointDamage ["hitLegs", (_legsDamageR + _legsDamageL) min 0.95]; -// Leg Damage -_legdamage = (_unit getHitPointDamage "HitLeftLeg") + (_unit getHitPointDamage "HitRightLeg"); -if (_selectionName == "leg_l") then { - _legdamage = _damage + (_unit getHitPointDamage "HitRightLeg"); -}; -if (_selectionName == "leg_r") then { - _legdamage = (_unit getHitPointDamage "HitLeftLeg") + _damage; -}; - -if (_legdamage >= LEGDAMAGETRESHOLD1) then { - _unit setHitPointDamage ["HitLegs", 1]; -} else { - _unit setHitPointDamage ["HitLegs", 0]; -}; -// @todo: force prone for completely fucked up legs. - - -// Arm Damage -_armdamage = (_unit getHitPointDamage "HitLeftArm") + (_unit getHitPointDamage "HitRightArm"); -if (_selectionName == "hand_l") then { - _armdamage = _damage + (_unit getHitPointDamage "HitRightArm"); -}; -if (_selectionName == "hand_r") then { - _armdamage = (_unit getHitPointDamage "HitLeftArm") + _damage; -}; - -if (_armdamage >= ARMDAMAGETRESHOLD1) then { - _unit setHitPointDamage ["HitHands", 1]; -} else { - _unit setHitPointDamage ["HitHands", 0]; -}; -// @todo: Drop weapon for full damage. - - -// Set Pain -if (_selectionName == "") then { - _pain = _unit getVariable [QGVAR(pain), 0]; - _pain = _pain + _newDamage * (1 - (_unit getVariable [QGVAR(morphine), 0])); - _unit setVariable [QGVAR(pain), _pain min 1, true]; -}; - -// Unconsciousness -if (_selectionName == "" and - _damage >= UNCONSCIOUSNESSTRESHOLD and - _damage < 1 and - !(_unit getVariable ["ACE_isUnconscious", False] -)) then { - [_unit, true] call FUNC(setUnconscious); -}; - -_damage +{ + _target setHitPointDamage [_x, (_damageBodyParts select _foreachIndex) min 0.95]; +}foreach GVAR(HITPOINTS); diff --git a/addons/medical/functions/fnc_handleDamage_caching.sqf b/addons/medical/functions/fnc_handleDamage_caching.sqf index 99816ee274..910221a850 100644 --- a/addons/medical/functions/fnc_handleDamage_caching.sqf +++ b/addons/medical/functions/fnc_handleDamage_caching.sqf @@ -18,13 +18,9 @@ #include "script_component.hpp" -private ["_unit", "_selectionName", "_damage", "_source", "_projectile", "_hitSelections", "_hitPoints", "_impactVelocity", "_newDamage", "_cache_hitpoints", "_cache_projectiles", "_cache_params", "_cache_damages"]; -_unit = _this select 0; -_selectionName = _this select 1; -_damage = _this select 2; -_source = _this select 3; -_projectile = _this select 4; - +private ["_hitSelections", "_hitPoints", "_impactVelocity", "_newDamage", "_cache_hitpoints", "_cache_projectiles", "_cache_params", "_cache_damages"]; +params ["_unit", "_selectionName", "_damage", "_source", "_projectile"]; +TRACE_8("ACE_DEBUG: HandleDamage_Caching Called",_unit, _selectionName, _damage, _source, _projectile,GVAR(SELECTIONS),GVAR(HITPOINTS),damage _unit); _hitSelections = GVAR(SELECTIONS); _hitPoints = GVAR(HITPOINTS); @@ -78,21 +74,23 @@ if (diag_frameno > (_unit getVariable [QGVAR(frameNo_damageCaching), -3]) + 2) t // handle the cached damages 3 frames later [{ private ["_args", "_params"]; - _args = _this select 0; + params ["_args", "_idPFH"]; + _args params ["_unit", "_frameno"]; + if (diag_frameno >= _frameno + 2) then { + _unit setDamage 0; - if (diag_frameno > (_args select 1) + 2) then { - (_args select 0) setDamage 0; - - _cache_params = (_args select 0) getVariable [QGVAR(cachedHandleDamageParams), []]; - _cache_damages = (_args select 0) getVariable QGVAR(cachedDamages); - { - _params = _x + [_cache_damages select _foreachIndex]; - _params call FUNC(handleDamage_advanced); - }foreach _cache_params; - - [(_args select 0)] call FUNC(handleDamage_advancedSetDamage); - - [(_this select 1)] call cba_fnc_removePerFrameHandler; + if (GVAR(level) < 2 || {!([_unit] call FUNC(hasMedicalEnabled))}) then { + [_unit] call FUNC(handleDamage_basic); + } else { + _cache_params = _unit getVariable [QGVAR(cachedHandleDamageParams), []]; + _cache_damages = _unit getVariable QGVAR(cachedDamages); + { + _params = _x + [_cache_damages select _foreachIndex]; + _params call FUNC(handleDamage_advanced); + } foreach _cache_params; + [_unit] call FUNC(handleDamage_advancedSetDamage); + }; + [_idPFH] call CBA_fnc_removePerFrameHandler; }; }, 0, [_unit, diag_frameno] ] call CBA_fnc_addPerFrameHandler; @@ -152,4 +150,6 @@ if (_selectionName != "") then { _unit setVariable [QGVAR(cachedHandleDamageParams), _cache_params]; }; -_newDamage; +TRACE_8("ACE_DEBUG: HandleDamage_Caching",_unit, _newDamage, _cache_params, _cache_damages, _unit getVariable QGVAR(cachedProjectiles), _unit getVariable QGVAR(cachedHitPoints), _unit getVariable QGVAR(cachedDamages), _unit getVariable QGVAR(cachedHandleDamageParams)); + +_newDamage diff --git a/addons/medical/functions/fnc_handleDamage_fractures.sqf b/addons/medical/functions/fnc_handleDamage_fractures.sqf index 31fa1c8873..46000dbbdf 100644 --- a/addons/medical/functions/fnc_handleDamage_fractures.sqf +++ b/addons/medical/functions/fnc_handleDamage_fractures.sqf @@ -17,12 +17,8 @@ #include "script_component.hpp" -private ["_unit", "_selectionName", "_amountOfDamage", "_sourceOfDamage", "_typeOfDamage", "_bodyPartn", "_fractures", "_fractureType"]; -_unit = _this select 0; -_selectionName = _this select 1; -_amountOfDamage = _this select 2; -_sourceOfDamage = _this select 3; -_typeOfDamage = _this select 4; +private ["_bodyPartn", "_fractures", "_fractureType"]; +params ["_unit", "_selectionName", "_amountOfDamage", "_sourceOfDamage", "_typeOfDamage"]; _bodyPartn = [_selectionName] call FUNC(selectionNameToNumber); _fractureType = 1; diff --git a/addons/medical/functions/fnc_handleDamage_internalInjuries.sqf b/addons/medical/functions/fnc_handleDamage_internalInjuries.sqf index 6ee256a977..d8d9be1506 100644 --- a/addons/medical/functions/fnc_handleDamage_internalInjuries.sqf +++ b/addons/medical/functions/fnc_handleDamage_internalInjuries.sqf @@ -10,19 +10,15 @@ * 4: Type of the damage done * * Return Value: - * None + * None * * Public: No */ #include "script_component.hpp" -private ["_unit", "_selectionName", "_amountOfDamage", "_sourceOfDamage", "_typeOfDamage", "_bodyPartn"]; -_unit = _this select 0; -_selectionName = _this select 1; -_amountOfDamage = _this select 2; -_sourceOfDamage = _this select 3; -_typeOfDamage = _this select 4; +private "_bodyPartn"; +params ["_unit", "_selectionName", "_amountOfDamage", "_sourceOfDamage", "_typeOfDamage"]; _bodyPartn = [_selectionName] call FUNC(selectionNameToNumber); // TODO implement internal injuries diff --git a/addons/medical/functions/fnc_handleDamage_wounds.sqf b/addons/medical/functions/fnc_handleDamage_wounds.sqf index 70eeb74f9d..ae032e6d64 100644 --- a/addons/medical/functions/fnc_handleDamage_wounds.sqf +++ b/addons/medical/functions/fnc_handleDamage_wounds.sqf @@ -10,19 +10,16 @@ * 4: Type of the damage done * * Return Value: - * None + * None * * Public: No */ #include "script_component.hpp" -private ["_unit", "_selectionName", "_damage", "_typeOfProjectile", "_typeOfDamage", "_bodyPartn", "_injuryTypeInfo", "_allInjuriesForDamageType", "_allPossibleInjuries", "_highestPossibleDamage", "_highestPossibleSpot", "_minDamage", "_openWounds", "_woundID", "_toAddInjury", "_painToAdd", "_bloodLoss", "_bodyPartNToAdd", "_classType", "_damageLevels", "_foundIndex", "_i", "_injury", "_maxDamage", "_pain", "_painLevel", "_selections", "_toAddClassID", "_woundsCreated"]; -_unit = _this select 0; -_selectionName = _this select 1; -_damage = _this select 2; -_typeOfProjectile = _this select 3; -_typeOfDamage = _this select 4; +private ["_bodyPartn", "_injuryTypeInfo", "_allInjuriesForDamageType", "_allPossibleInjuries", "_highestPossibleDamage", "_highestPossibleSpot", "_minDamage", "_openWounds", "_woundID", "_toAddInjury", "_painToAdd", "_bloodLoss", "_bodyPartNToAdd", "_classType", "_damageLevels", "_foundIndex", "_i", "_injury", "_maxDamage", "_pain", "_painLevel", "_selections", "_toAddClassID", "_woundsCreated"]; +params ["_unit", "_selectionName", "_damage", "_typeOfProjectile", "_typeOfDamage"]; +TRACE_6("ACE_DEBUG: HandleDamage Called",_unit, _selectionName, _damage, _shooter, _typeOfProjectile,_typeOfDamage); // Administration for open wounds and ids _openWounds = _unit getvariable[QGVAR(openWounds), []]; @@ -43,7 +40,7 @@ _foundIndex = -1; if (_x select 1 == _toAddClassID && {_x select 2 == _bodyPartNToAdd}) exitwith { _foundIndex = _foreachIndex; }; - }foreach _openWounds; + } foreach _openWounds; if (_foundIndex < 0) then { // Since it is a new injury, we will have to add it to the open wounds array to store it @@ -53,7 +50,7 @@ _foundIndex = -1; _injury = _openWounds select _foundIndex; _injury set [3, (_injury select 3) + 1]; }; -}foreach _woundsCreated; +} foreach _woundsCreated; _unit setvariable [QGVAR(openWounds), _openWounds, true]; @@ -64,3 +61,4 @@ if (count _woundsCreated > 0) then { _painLevel = _unit getvariable [QGVAR(pain), 0]; _unit setvariable [QGVAR(pain), _painLevel + _painToAdd]; +TRACE_6("ACE_DEBUG: HandleDamage_WoundsOLD",_unit, _painLevel, _painToAdd, _unit getvariable QGVAR(pain), _unit getvariable QGVAR(openWounds),_woundsCreated); diff --git a/addons/medical/functions/fnc_handleDamage_woundsOld.sqf b/addons/medical/functions/fnc_handleDamage_woundsOld.sqf index 1034ba9cae..dc21012dd6 100644 --- a/addons/medical/functions/fnc_handleDamage_woundsOld.sqf +++ b/addons/medical/functions/fnc_handleDamage_woundsOld.sqf @@ -17,12 +17,9 @@ #include "script_component.hpp" -private ["_unit", "_selectionName", "_damage", "_typeOfProjectile", "_typeOfDamage", "_bodyPartn", "_injuryTypeInfo", "_allInjuriesForDamageType", "_allPossibleInjuries", "_highestPossibleDamage", "_highestPossibleSpot", "_minDamage", "_openWounds", "_woundID", "_toAddInjury", "_painToAdd", "_bloodLoss", "_bodyPartNToAdd", "_classType", "_damageLevels", "_foundIndex", "_i", "_injury", "_maxDamage", "_pain", "_painLevel", "_selections", "_toAddClassID", "_woundsCreated"]; -_unit = _this select 0; -_selectionName = _this select 1; -_damage = _this select 2; -_typeOfProjectile = _this select 3; -_typeOfDamage = _this select 4; +private ["_bodyPartn", "_injuryTypeInfo", "_allInjuriesForDamageType", "_allPossibleInjuries", "_highestPossibleDamage", "_highestPossibleSpot", "_minDamage", "_openWounds", "_woundID", "_toAddInjury", "_painToAdd", "_bloodLoss", "_bodyPartNToAdd", "_classType", "_damageLevels", "_foundIndex", "_i", "_injury", "_maxDamage", "_pain", "_painLevel", "_selections", "_toAddClassID", "_woundsCreated"]; +params ["_unit", "_selectionName", "_damage", "_typeOfProjectile", "_typeOfDamage"]; +TRACE_6("ACE_DEBUG: HandleDamage_WoundsOLD Called",_unit, _selectionName, _damage, _shooter, _typeOfProjectile,_typeOfDamage); // Convert the selectionName to a number and ensure it is a valid selection. _bodyPartn = [_selectionName] call FUNC(selectionNameToNumber); @@ -70,7 +67,7 @@ _allPossibleInjuries = []; _allPossibleInjuries pushback _x; }; }; -}foreach _allInjuriesForDamageType; +} foreach _allInjuriesForDamageType; // No possible wounds available for this damage type or damage amount. if (_highestPossibleSpot < 0) exitwith {}; @@ -98,7 +95,7 @@ _woundsCreated = []; if (_x select 1 == _toAddClassID && {_x select 2 == _bodyPartNToAdd}) exitwith { _foundIndex = _foreachIndex; }; - }foreach _openWounds; + } foreach _openWounds; }; _injury = []; @@ -123,21 +120,15 @@ _woundsCreated = []; _painToAdd = _painToAdd + (_toAddInjury select 3); }; }; -}foreach (_injuryTypeInfo select 0); // foreach damage thresholds +} foreach (_injuryTypeInfo select 0); // foreach damage thresholds -_unit setvariable [QGVAR(openWounds), _openWounds, !USE_WOUND_EVENT_SYNC]; +_unit setvariable [QGVAR(openWounds), _openWounds, true]; // Only update if new wounds have been created if (count _woundsCreated > 0) then { -// _unit setvariable [QGVAR(lastUniqueWoundID), _woundID, true]; -}; - -if (USE_WOUND_EVENT_SYNC) then { - // Broadcast the new injuries across the net in parts. One broadcast per injury. Prevents having to broadcast one massive array of injuries. - { - // ["medical_propagateWound", [_unit, _x]] call EFUNC(common,globalEvent); - }foreach _woundsCreated; + _unit setvariable [QGVAR(lastUniqueWoundID), _woundID, true]; }; _painLevel = _unit getvariable [QGVAR(pain), 0]; _unit setvariable [QGVAR(pain), _painLevel + _painToAdd]; +TRACE_6("ACE_DEBUG: HandleDamage_WoundsOLD",_unit, _painLevel, _painToAdd, _unit getvariable QGVAR(pain), _unit getvariable QGVAR(openWounds),_woundsCreated); diff --git a/addons/medical/functions/fnc_handleKilled.sqf b/addons/medical/functions/fnc_handleKilled.sqf index 5003ec189c..d6a4440d76 100644 --- a/addons/medical/functions/fnc_handleKilled.sqf +++ b/addons/medical/functions/fnc_handleKilled.sqf @@ -13,8 +13,8 @@ #include "script_component.hpp" -private["_unit", "_openWounds"]; -_unit = _this select 0; +private "_openWounds"; +params ["_unit"]; if (!local _unit) exitwith {}; _unit setvariable [QGVAR(pain), 0]; @@ -22,11 +22,4 @@ if (GVAR(level) >= 2) then { _unit setvariable [QGVAR(heartRate), 0]; _unit setvariable [QGVAR(bloodPressure), [0, 0]]; _unit setvariable [QGVAR(airwayStatus), 0]; - - if (USE_WOUND_EVENT_SYNC) then { - _openWounds = _unit getvariable [QGVAR(openWounds), []]; - { - ["medical_propagateWound", [_unit, _x]] call EFUNC(common,globalEvent); - }foreach _openWounds; - }; }; diff --git a/addons/medical/functions/fnc_handleLocal.sqf b/addons/medical/functions/fnc_handleLocal.sqf index c0f9c15292..50a30e90e8 100644 --- a/addons/medical/functions/fnc_handleLocal.sqf +++ b/addons/medical/functions/fnc_handleLocal.sqf @@ -15,9 +15,7 @@ #include "script_component.hpp" -private["_unit", "_local"]; -_unit = _this select 0; -_local = _this select 1; +params ["_unit", "_local"]; if (_local) then { if (_unit getvariable[QGVAR(addedToUnitLoop),false]) then { [_unit, true] call FUNC(addToInjuredCollection); diff --git a/addons/medical/functions/fnc_handleUnitVitals.sqf b/addons/medical/functions/fnc_handleUnitVitals.sqf index 0c7113f69a..fddf5489da 100644 --- a/addons/medical/functions/fnc_handleUnitVitals.sqf +++ b/addons/medical/functions/fnc_handleUnitVitals.sqf @@ -13,10 +13,9 @@ #include "script_component.hpp" -private ["_unit", "_heartRate","_bloodPressure","_bloodVolume","_painStatus", "_lastTimeValuesSynced", "_syncValues", "_airwayStatus", "_blood", "_bloodPressureH", "_bloodPressureL", "_interval"]; -_unit = _this select 0; -_interval = _this select 1; - +private ["_heartRate","_bloodPressure","_bloodVolume","_painStatus", "_lastTimeValuesSynced", "_syncValues", "_airwayStatus", "_blood"]; +params ["_unit", "_interval"]; +TRACE_3("ACE_DEBUG",_unit,_interval,_unit); if (_interval == 0) exitWith {}; _lastTimeValuesSynced = _unit getvariable [QGVAR(lastMomentValuesSynced), 0]; @@ -30,23 +29,28 @@ _bloodVolume = _bloodVolume max 0; _unit setvariable [QGVAR(bloodVolume), _bloodVolume, _syncValues]; +TRACE_3("ACE_DEBUG",_bloodVolume,_syncValues,_unit); // Set variables for synchronizing information across the net if (_bloodVolume < 100) then { if ((_bloodVolume < 90 && (GVAR(level) == 2)) || _bloodVolume <= 45) then { + TRACE_4("ACE_DEBUG_ADVANCED",_bloodVolume,_unit getVariable QGVAR(hasLostBlood),_syncValues,_unit); if (_unit getvariable [QGVAR(hasLostBlood), 0] != 2) then { _unit setvariable [QGVAR(hasLostBlood), 2, true]; }; } else { + TRACE_4("ACE_DEBUG", _bloodVolume,_unit getVariable QGVAR(hasLostBlood),_syncValues,_unit); if (_unit getvariable [QGVAR(hasLostBlood), 0] != 1) then { _unit setvariable [QGVAR(hasLostBlood), 1, true]; }; } } else { + TRACE_4("ACE_DEBUG",_bloodVolume,_unit getVariable QGVAR(hasLostBlood),_syncValues,_unit); if (_unit getvariable [QGVAR(hasLostBlood), 0] != 0) then { _unit setvariable [QGVAR(hasLostBlood), 0, true]; }; }; +TRACE_3("ACE_DEBUG",[_unit] call FUNC(getBloodLoss),_unit getVariable QGVAR(isBleeding),_unit); if (([_unit] call FUNC(getBloodLoss)) > 0) then { if !(_unit getvariable [QGVAR(isBleeding), false]) then { _unit setvariable [QGVAR(isBleeding), true, true]; @@ -58,6 +62,7 @@ if (([_unit] call FUNC(getBloodLoss)) > 0) then { }; _painStatus = _unit getvariable [QGVAR(pain), 0]; +TRACE_4("ACE_DEBUG",_painStatus,_unit getVariable QGVAR(hasPain),_unit getVariable QGVAR(painSuppress),_unit); if (_painStatus > (_unit getvariable [QGVAR(painSuppress), 0])) then { if !(_unit getvariable [QGVAR(hasPain), false]) then { _unit setvariable [QGVAR(hasPain), true, true]; @@ -69,6 +74,7 @@ if (_painStatus > (_unit getvariable [QGVAR(painSuppress), 0])) then { }; if (GVAR(level) == 1) then { + TRACE_5("ACE_DEBUG_BASIC_VITALS",_painStatus,_unit getVariable QGVAR(hasPain),_unit getVariable QGVAR(morphine),_syncValues,_unit); // reduce pain if (_painStatus > 0) then { _unit setVariable [QGVAR(pain), (_painStatus - 0.001 * _interval) max 0, _syncValues]; @@ -91,6 +97,7 @@ if (GVAR(level) == 1) then { // handle advanced medical, with vitals if (GVAR(level) >= 2) then { + TRACE_6("ACE_DEBUG_ADVANCED_VITALS",_painStatus,_bloodVolume, _unit getVariable QGVAR(hasPain),_unit getVariable QGVAR(morphine),_syncValues,_unit); if (_bloodVolume < 30) exitwith { [_unit] call FUNC(setDead); }; @@ -105,7 +112,7 @@ if (GVAR(level) >= 2) then { // Set the vitals _heartRate = (_unit getvariable [QGVAR(heartRate), 80]) + (([_unit] call FUNC(getHeartRateChange)) * _interval); - _unit setvariable [QGVAR(heartRate), _heartRate, _syncValues]; + _unit setvariable [QGVAR(heartRate), _heartRate max 0, _syncValues]; _bloodPressure = [_unit] call FUNC(getBloodPressure); _unit setvariable [QGVAR(bloodPressure), _bloodPressure, _syncValues]; @@ -114,7 +121,7 @@ if (GVAR(level) >= 2) then { _painReduce = if (_painStatus > 5) then {0.002} else {0.001}; _unit setVariable [QGVAR(pain), (_painStatus - _painReduce * _interval) max 0, _syncValues]; }; - + TRACE_8("ACE_DEBUG_ADVANCED_VITALS",_painStatus,_painReduce,_heartRate,_bloodVolume,_bloodPressure,_interval,_syncValues,_unit); // TODO Disabled until implemented fully // Handle airway /*if (GVAR(setting_allowAirwayInjuries)) then { @@ -140,8 +147,7 @@ if (GVAR(level) >= 2) then { // Check vitals for medical status // TODO check for in revive state instead of variable - _bloodPressureL = _bloodPressure select 0; - _bloodPressureH = _bloodPressure select 1; + _bloodPressure params ["_bloodPressureL", "_bloodPressureH"]; if (!(_unit getvariable [QGVAR(inCardiacArrest),false])) then { if (_heartRate < 10 || _bloodPressureH < 30 || _bloodVolume < 20) then { @@ -174,12 +180,13 @@ if (GVAR(level) >= 2) then { // syncing any remaining values if (_syncValues) then { + TRACE_3("ACE_DEBUG_IVBAGS_SYNC",GVAR(IVBags),_syncValues,_unit); { private "_value"; _value = _unit getvariable _x; if !(isnil "_value") then { _unit setvariable [_x,(_unit getvariable [_x, 0]), true]; }; - }foreach GVAR(IVBags); + } foreach GVAR(IVBags); }; }; diff --git a/addons/medical/functions/fnc_hasItem.sqf b/addons/medical/functions/fnc_hasItem.sqf index cfec633b55..df1a3828f5 100644 --- a/addons/medical/functions/fnc_hasItem.sqf +++ b/addons/medical/functions/fnc_hasItem.sqf @@ -16,19 +16,17 @@ #include "script_component.hpp" private ["_medic", "_patient", "_item", "_return", "_crew"]; -_medic = _this select 0; -_patient = _this select 1; -_item = _this select 2; +params ["_medic", "_patient", "_item"]; if (isnil QGVAR(setting_allowSharedEquipment)) then { GVAR(setting_allowSharedEquipment) = true; }; if (GVAR(setting_allowSharedEquipment) && {[_patient, _item] call EFUNC(common,hasItem)}) exitwith { - true; + true }; if ([_medic, _item] call EFUNC(common,hasItem)) exitwith { - true; + true }; _return = false; @@ -38,7 +36,7 @@ if ((vehicle _medic != _medic) && {[vehicle _medic] call FUNC(isMedicalVehicle)} if ([_medic, _x] call FUNC(canAccessMedicalEquipment) && {([_x, _item] call EFUNC(common,hasItem))}) exitwith { _return = true; }; - }foreach _crew; + } foreach _crew; }; -_return; +_return diff --git a/addons/medical/functions/fnc_hasItems.sqf b/addons/medical/functions/fnc_hasItems.sqf index ea16edebc4..dd53cb3337 100644 --- a/addons/medical/functions/fnc_hasItems.sqf +++ b/addons/medical/functions/fnc_hasItems.sqf @@ -16,9 +16,7 @@ #include "script_component.hpp" private ["_medic", "_patient", "_items", "_return"]; -_medic = _this select 0; -_patient = _this select 1; -_items = _this select 2; +params ["_medic", "_patient", "_items"]; _return = true; { @@ -31,4 +29,4 @@ _return = true; }; }foreach _items; -_return; +_return diff --git a/addons/medical/functions/fnc_hasMedicalEnabled.sqf b/addons/medical/functions/fnc_hasMedicalEnabled.sqf index 63fddd16b4..cbf40078fd 100644 --- a/addons/medical/functions/fnc_hasMedicalEnabled.sqf +++ b/addons/medical/functions/fnc_hasMedicalEnabled.sqf @@ -1,21 +1,27 @@ -/** - * fn_hasMedicalEnabled.sqf - * @Descr: Check if unit has CMS enabled. - * @Author: Glowbal - * - * @Arguments: [unit OBJECT] - * @Return: BOOL - * @PublicAPI: true - */ +/* + * Author: Glowbal + * Check if unit has CMS enabled + * + * Arguments: + * 0: unit + * + * Return Value: + * enabled + * + * Example: + * [Unit] call ace_medical_fnc_hasMedicalEnabled + * + * Public: No + */ #include "script_component.hpp" -private ["_unit", "_medicalEnabled"]; -_unit = _this select 0; +private "_medicalEnabled"; +params ["_unit"]; _medicalEnabled = _unit getvariable QGVAR(enableMedical); if (isnil "_medicalEnabled") exitwith { - (((GVAR(enableFor) == 0 && (isPlayer _unit || (_unit getvariable [QEGVAR(common,isDeadPlayer), false])))) || (GVAR(enableFor) == 1) || GVAR(level) == 1); + (((GVAR(enableFor) == 0 && (isPlayer _unit || (_unit getvariable [QEGVAR(common,isDeadPlayer), false])))) || (GVAR(enableFor) == 1) || GVAR(level) == 1) }; -_medicalEnabled; +_medicalEnabled diff --git a/addons/medical/functions/fnc_hasTourniquetAppliedTo.sqf b/addons/medical/functions/fnc_hasTourniquetAppliedTo.sqf index 6183854e45..955665233a 100644 --- a/addons/medical/functions/fnc_hasTourniquetAppliedTo.sqf +++ b/addons/medical/functions/fnc_hasTourniquetAppliedTo.sqf @@ -14,8 +14,6 @@ #include "script_component.hpp" -private ["_target", "_selectionName"]; -_target = _this select 0; -_selectionName = _this select 1; +params ["_target", "_selectionName"]; (((_target getvariable [QGVAR(tourniquets), [0,0,0,0,0,0]]) select ([_selectionName] call FUNC(selectionNameToNumber))) > 0); diff --git a/addons/medical/functions/fnc_init.sqf b/addons/medical/functions/fnc_init.sqf index 27d80163a5..bd97203f33 100644 --- a/addons/medical/functions/fnc_init.sqf +++ b/addons/medical/functions/fnc_init.sqf @@ -1,5 +1,5 @@ /* - * Author: KoffeinFlummi + * Author: KoffeinFlummi, commy2 * Initializes unit variables. * * Arguments: @@ -10,17 +10,17 @@ * * Public: No */ - #include "script_component.hpp" -private ["_unit", "_allUsedMedication", "_logs"]; - -_unit = _this select 0; +params ["_unit"]; +// basic _unit setVariable [QGVAR(pain), 0, true]; _unit setVariable [QGVAR(morphine), 0, true]; _unit setVariable [QGVAR(bloodVolume), 100, true]; +_unit setVariable ["ACE_isUnconscious", false, true]; +// advanced // tourniquets _unit setvariable [QGVAR(tourniquets), [0,0,0,0,0,0], true]; @@ -59,13 +59,14 @@ _unit setvariable [QGVAR(airwayCollapsed), false]; // generic medical admin _unit setvariable [QGVAR(addedToUnitLoop), false, true]; _unit setvariable [QGVAR(inCardiacArrest), false, true]; -_unit setVariable ["ACE_isUnconscious", false, true]; _unit setvariable [QGVAR(hasLostBlood), 0, true]; _unit setvariable [QGVAR(isBleeding), false, true]; _unit setvariable [QGVAR(hasPain), false, true]; _unit setvariable [QGVAR(amountOfReviveLives), GVAR(amountOfReviveLives), true]; _unit setvariable [QGVAR(painSuppress), 0, true]; +private ["_allUsedMedication", "_logs"]; + // medication _allUsedMedication = _unit getVariable [QGVAR(allUsedMedication), []]; { diff --git a/addons/medical/functions/fnc_isBeingCarried.sqf b/addons/medical/functions/fnc_isBeingCarried.sqf index 6505f8b51a..b47c5e475f 100644 --- a/addons/medical/functions/fnc_isBeingCarried.sqf +++ b/addons/medical/functions/fnc_isBeingCarried.sqf @@ -15,7 +15,7 @@ */ #include "script_component.hpp" -PARAMS_1(_target); +params ["_target"]; private "_owner"; diff --git a/addons/medical/functions/fnc_isBeingDragged.sqf b/addons/medical/functions/fnc_isBeingDragged.sqf index 4d09ed9e29..929b48ccb7 100644 --- a/addons/medical/functions/fnc_isBeingDragged.sqf +++ b/addons/medical/functions/fnc_isBeingDragged.sqf @@ -15,7 +15,7 @@ */ #include "script_component.hpp" -PARAMS_1(_target); +params ["_target"]; private "_owner"; diff --git a/addons/medical/functions/fnc_isInMedicalFacility.sqf b/addons/medical/functions/fnc_isInMedicalFacility.sqf index bed660a46a..34f1cf4244 100644 --- a/addons/medical/functions/fnc_isInMedicalFacility.sqf +++ b/addons/medical/functions/fnc_isInMedicalFacility.sqf @@ -13,8 +13,8 @@ #include "script_component.hpp" -private ["_unit","_eyePos","_objects","_isInBuilding","_medicalFacility"]; -_unit = _this select 0; +private ["_eyePos", "_objects", "_isInBuilding", "_medicalFacility"]; +params ["_unit"]; _eyePos = eyePos _unit; _isInBuilding = false; @@ -42,13 +42,13 @@ _objects = (lineIntersectsWith [_unit modelToWorldVisual [0, 0, (_eyePos select if (((typeOf _x) in _medicalFacility) || (_x getVariable [QGVAR(isMedicalFacility),false])) exitwith { _isInBuilding = true; }; -}foreach _objects; +} foreach _objects; if (!_isInBuilding) then { _objects = position _unit nearObjects 7.5; { if (((typeOf _x) in _medicalFacility) || (_x getVariable [QGVAR(isMedicalFacility),false])) exitwith { _isInBuilding = true; }; - }foreach _objects; + } foreach _objects; }; _isInBuilding; diff --git a/addons/medical/functions/fnc_isInMedicalVehicle.sqf b/addons/medical/functions/fnc_isInMedicalVehicle.sqf index d376ce3824..1f1ff193fd 100644 --- a/addons/medical/functions/fnc_isInMedicalVehicle.sqf +++ b/addons/medical/functions/fnc_isInMedicalVehicle.sqf @@ -13,9 +13,8 @@ #include "script_component.hpp" -private ["_unit", "_vehicle"]; - -_unit = _this select 0; +private ["_vehicle"]; +params ["_unit"]; _vehicle = vehicle _unit; if (_unit == _vehicle) exitWith {false}; diff --git a/addons/medical/functions/fnc_isInStableCondition.sqf b/addons/medical/functions/fnc_isInStableCondition.sqf index f7c22ed085..763185640c 100644 --- a/addons/medical/functions/fnc_isInStableCondition.sqf +++ b/addons/medical/functions/fnc_isInStableCondition.sqf @@ -13,8 +13,8 @@ #include "script_component.hpp" -private ["_unit"]; -_unit = _this select 0; +private ["_openWounds", "_openWounds"]; +params ["_unit"]; if (GVAR(level) <= 1) exitwith { ([_unit] call FUNC(getBloodloss)) == 0; @@ -25,6 +25,6 @@ _openWounds = _unit getvariable [QGVAR(openWounds), []]; { // total bleeding ratio * percentage of injury left _totalBloodLoss = _totalBloodLoss + ((_x select 4) * (_x select 3)); -}foreach _openWounds; +} foreach _openWounds; (_totalBloodLoss == 0); diff --git a/addons/medical/functions/fnc_isMedic.sqf b/addons/medical/functions/fnc_isMedic.sqf index 122d261238..ca974fb751 100644 --- a/addons/medical/functions/fnc_isMedic.sqf +++ b/addons/medical/functions/fnc_isMedic.sqf @@ -4,7 +4,7 @@ * * Arguments: * 0: The Unit - * 1: Class + * 1: Class (default: 1) * * ReturnValue: * Is in of medic class @@ -15,8 +15,7 @@ #include "script_component.hpp" private ["_unit", "_class", "_medicN"]; -_unit = _this select 0; -_medicN = if (count _this > 1) then {_this select 1} else {1}; +params ["_unit", ["_medicN", 1]]; _class = _unit getVariable [QGVAR(medicClass), getNumber (configFile >> "CfgVehicles" >> typeOf _unit >> "attendant")]; diff --git a/addons/medical/functions/fnc_isMedicalVehicle.sqf b/addons/medical/functions/fnc_isMedicalVehicle.sqf index 5e9283852f..14499cb241 100644 --- a/addons/medical/functions/fnc_isMedicalVehicle.sqf +++ b/addons/medical/functions/fnc_isMedicalVehicle.sqf @@ -12,7 +12,6 @@ */ #include "script_component.hpp" -private ["_vehicle"]; -_vehicle = _this select 0; +params ["_vehicle"]; (_vehicle getVariable [QGVAR(medicClass), getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> "attendant")]) > 0 diff --git a/addons/medical/functions/fnc_itemCheck.sqf b/addons/medical/functions/fnc_itemCheck.sqf index c903417dfc..d49e04e774 100644 --- a/addons/medical/functions/fnc_itemCheck.sqf +++ b/addons/medical/functions/fnc_itemCheck.sqf @@ -6,15 +6,14 @@ * 0: The unit * * ReturnValue: - * nil + * None * * Public: Yes */ #include "script_component.hpp" -private ["_unit"]; -_unit = _this select 0; +params ["_unit"]; while {({_x == "FirstAidKit"} count items _unit) > 0} do { _unit removeItem "FirstAidKit"; diff --git a/addons/medical/functions/fnc_modifyMedicalAction.sqf b/addons/medical/functions/fnc_modifyMedicalAction.sqf index 268ba8e253..8feaa7bfca 100644 --- a/addons/medical/functions/fnc_modifyMedicalAction.sqf +++ b/addons/medical/functions/fnc_modifyMedicalAction.sqf @@ -10,17 +10,18 @@ * 3: The action to modify * * ReturnValue: - * nil + * None * * Public: No */ #include "script_component.hpp" -EXPLODE_4_PVT(_this,_target,_player,_selectionN,_actionData); +params ["_target", "_player", "_selectionN", "_actionData"]; + if (GVAR(level) < 2) exitwith { private ["_pointDamage"]; - _pointDamage = _target getHitPointDamage (["HitHead", "HitBody", "HitLeftArm", "HitRightArm", "HitLeftLeg", "HitRightLeg"] select _selectionN); + _pointDamage = (_target getvariable [QGVAR(bodyPartStatus), [0,0,0,0,0,0]]) select _selectionN; if (_pointDamage >= 0.8) exitWith { _actionData set [2, QUOTE(PATHTOF(UI\icons\medical_crossRed.paa))]; @@ -33,8 +34,8 @@ if (GVAR(level) < 2) exitwith { private ["_openWounds", "_amountOf"]; _openWounds = _target getvariable [QGVAR(openWounds), []]; { - _amountOf = _x select 3; - if (_amountOf > 0 && {(_selectionN == (_x select 2))} && {(_x select 4) > 0}) exitwith { + _x params ["", "", "_selectionX", "_amountOf", "_x4"]; + if (_amountOf > 0 && {(_selectionN == _selectionX)} && {_x4 > 0}) exitwith { _actionData set [2, QUOTE(PATHTOF(UI\icons\medical_crossRed.paa))]; }; } foreach _openWounds; diff --git a/addons/medical/functions/fnc_moduleAdvancedMedicalSettings.sqf b/addons/medical/functions/fnc_moduleAdvancedMedicalSettings.sqf index 2960c65b9d..b54196d75f 100644 --- a/addons/medical/functions/fnc_moduleAdvancedMedicalSettings.sqf +++ b/addons/medical/functions/fnc_moduleAdvancedMedicalSettings.sqf @@ -8,17 +8,14 @@ * 2: activated * * Return Value: - * None + * None * * Public: No */ #include "script_component.hpp" -private ["_logic", "_units", "_activated"]; -_logic = _this select 0; -_units = _this select 1; -_activated = _this select 2; +params ["_logic", "_units", "_activated"]; if !(_activated) exitWith {}; diff --git a/addons/medical/functions/fnc_moduleAssignMedicRoles.sqf b/addons/medical/functions/fnc_moduleAssignMedicRoles.sqf index 1c26eb53d4..e295c55a2e 100644 --- a/addons/medical/functions/fnc_moduleAssignMedicRoles.sqf +++ b/addons/medical/functions/fnc_moduleAssignMedicRoles.sqf @@ -8,15 +8,15 @@ * 2: activated * * Return Value: - * None + * None * * Public: No */ #include "script_component.hpp" -private ["_logic","_setting","_objects", "_list", "_splittedList", "_nilCheckPassedList", "_parsedList"]; -_logic = [_this,0,objNull,[objNull]] call BIS_fnc_param; +private ["_setting", "_objects", "_list", "_splittedList", "_nilCheckPassedList", "_parsedList"]; +params [["_logic", objNull, [objNull]]]; if (!isNull _logic) then { _list = _logic getvariable ["EnableList",""]; @@ -32,7 +32,7 @@ if (!isNull _logic) then { _nilCheckPassedList = _nilCheckPassedList + ","+ _x; }; }; - }foreach _splittedList; + } foreach _splittedList; _list = "[" + _nilCheckPassedList + "]"; _parsedList = [] call compile _list; @@ -47,7 +47,7 @@ if (!isNull _logic) then { }; }; }; - }foreach _objects; + } foreach _objects; }; { if (!isnil "_x") then { @@ -57,7 +57,5 @@ if (!isNull _logic) then { }; }; }; - }foreach _parsedList; + } foreach _parsedList; }; - -true \ No newline at end of file diff --git a/addons/medical/functions/fnc_moduleAssignMedicalFacility.sqf b/addons/medical/functions/fnc_moduleAssignMedicalFacility.sqf index c08d737f4b..7a219f2559 100644 --- a/addons/medical/functions/fnc_moduleAssignMedicalFacility.sqf +++ b/addons/medical/functions/fnc_moduleAssignMedicalFacility.sqf @@ -8,15 +8,15 @@ * 2: activated * * Return Value: - * None + * None * * Public: No */ #include "script_component.hpp" -private ["_logic","_setting","_objects"]; -_logic = [_this,0,objNull,[objNull]] call BIS_fnc_param; +private ["_setting", "_objects"]; +params [["_logic", objNull, [objNull]]]; if (!isNull _logic) then { _setting = _logic getvariable ["class",0]; _objects = synchronizedObjects _logic; @@ -24,7 +24,7 @@ if (!isNull _logic) then { if (local _x) then { _x setvariable[QGVAR(isMedicalFacility), true, true]; }; - }foreach _objects; + } foreach _objects; }; true; diff --git a/addons/medical/functions/fnc_moduleAssignMedicalVehicle.sqf b/addons/medical/functions/fnc_moduleAssignMedicalVehicle.sqf index af6de73ce1..8481aaf293 100644 --- a/addons/medical/functions/fnc_moduleAssignMedicalVehicle.sqf +++ b/addons/medical/functions/fnc_moduleAssignMedicalVehicle.sqf @@ -8,16 +8,14 @@ * 2: activated * * Return Value: - * None + * None * * Public: No */ - - #include "script_component.hpp" -private ["_logic","_setting","_objects", "_list", "_splittedList", "_nilCheckPassedList", "_parsedList"]; -_logic = [_this,0,objNull,[objNull]] call BIS_fnc_param; +private ["_setting", "_objects", "_list", "_splittedList", "_nilCheckPassedList", "_parsedList", "_xVehicle"]; +params [["_logic", objNull, [objNull]]]; if (!isNull _logic) then { _list = _logic getvariable ["EnableList",""]; @@ -33,7 +31,7 @@ if (!isNull _logic) then { _nilCheckPassedList = _nilCheckPassedList + ","+ _x; }; }; - }foreach _splittedList; + } foreach _splittedList; _list = "[" + _nilCheckPassedList + "]"; _parsedList = [] call compile _list; @@ -42,23 +40,24 @@ if (!isNull _logic) then { if (!(_objects isEqualTo []) && _parsedList isEqualTo []) then { { if (!isnil "_x") then { - if (typeName _x == typeName objNull) then { + if (typeName _x == typeName objNull) then { if (local _x) then { - _x setvariable [QGVAR(medicClass), _setting, true]; + _xVehicle = vehicle _x; + TRACE_3("setting medical vehicle", _x, _xVehicle, (typeOf _xVehicle)); + _xVehicle setvariable [QGVAR(medicClass), _setting, true]; }; }; }; - }foreach _objects; + } foreach _objects; }; { if (!isnil "_x") then { - if (typeName _x == typeName objNull) 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; - }; - -true; + } foreach _parsedList; +}; diff --git a/addons/medical/functions/fnc_moduleMedicalSettings.sqf b/addons/medical/functions/fnc_moduleMedicalSettings.sqf index 00b7a15fcf..4e1af0e86c 100644 --- a/addons/medical/functions/fnc_moduleMedicalSettings.sqf +++ b/addons/medical/functions/fnc_moduleMedicalSettings.sqf @@ -8,17 +8,14 @@ * 2: activated * * Return Value: - * None + * None * * Public: No */ #include "script_component.hpp" -private ["_logic", "_units", "_activated"]; -_logic = _this select 0; -_units = _this select 1; -_activated = _this select 2; +params ["_logic", "_units", "_activated"]; if !(_activated) exitWith {}; diff --git a/addons/medical/functions/fnc_moduleReviveSettings.sqf b/addons/medical/functions/fnc_moduleReviveSettings.sqf index c96b1eb67c..19aa9579dd 100644 --- a/addons/medical/functions/fnc_moduleReviveSettings.sqf +++ b/addons/medical/functions/fnc_moduleReviveSettings.sqf @@ -8,17 +8,14 @@ * 2: activated * * Return Value: - * None + * None * * Public: No */ #include "script_component.hpp" -private ["_logic", "_units", "_activated"]; -_logic = _this select 0; -_units = _this select 1; -_activated = _this select 2; +params ["_logic", "_units", "_activated"]; if !(_activated) exitWith {}; diff --git a/addons/medical/functions/fnc_onMedicationUsage.sqf b/addons/medical/functions/fnc_onMedicationUsage.sqf index 904ad3ef88..db4ba737ea 100644 --- a/addons/medical/functions/fnc_onMedicationUsage.sqf +++ b/addons/medical/functions/fnc_onMedicationUsage.sqf @@ -11,28 +11,21 @@ * 5: Incompatable medication > * * Return Value: - * NONE + * None * * Public: No */ #include "script_component.hpp" -private ["_target", "_className", "_variable", "_maxDosage", "_timeInSystem", "_incompatabileMeds", "_foundEntry", "_allUsedMedication","_allMedsFromClassname", "_usedMeds", "_hasOverDosed", "_med", "_limit", "_classNamesUsed", "_decreaseAmount", "_viscosityChange", "_viscosityAdjustment", "_medicationConfig", "_onOverDose", "_painReduce"]; -_target = _this select 0; -_className = _this select 1; -_variable = _this select 2; -_maxDosage = _this select 3; -_timeInSystem = _this select 4; -_incompatabileMeds = _this select 5; -_viscosityChange = _this select 6; -_painReduce = _this select 7; +private ["_foundEntry", "_allUsedMedication","_allMedsFromClassname", "_usedMeds", "_hasOverDosed", "_med", "_limit", "_decreaseAmount", "_viscosityAdjustment", "_medicationConfig", "_onOverDose"]; +params ["_target", "_className", "_variable", "_maxDosage", "_timeInSystem", "_incompatabileMeds", "_viscosityChange", "_painReduce"]; _foundEntry = false; _allUsedMedication = _target getvariable [QGVAR(allUsedMedication), []]; { - if (_x select 0 == _variable) exitwith { - _allMedsFromClassname = _x select 1; + _x params ["_variableX", "_allMedsFromClassname"]; + if (_variableX== _variable) exitwith { if !(_className in _allMedsFromClassname) then { _allMedsFromClassname pushback _className; _x set [1, _allMedsFromClassname]; @@ -56,15 +49,14 @@ if (_usedMeds >= floor (_maxDosage + round(random(2))) && _maxDosage >= 1 && GVA _hasOverDosed = 0; { - _med = _x select 0; - _limit = _x select 1; + _x params ["_med", "_limit"]; { - _classNamesUsed = _x select 1; + _x params ["", "_classNamesUsed"]; if ({_x == _med} count _classNamesUsed > _limit) then { _hasOverDosed = _hasOverDosed + 1; }; - }foreach _allUsedMedication; -}foreach _incompatabileMeds; + } foreach _allUsedMedication; +} foreach _incompatabileMeds; if (_hasOverDosed > 0 && GVAR(enableOverdosing)) then { _medicationConfig = (configFile >> "ACE_Medical_Advanced" >> "Treatment" >> "Medication"); @@ -85,16 +77,9 @@ _decreaseAmount = 1 / _timeInSystem; _viscosityAdjustment = _viscosityChange / _timeInSystem; [{ - private ["_args", "_target", "_timeInSystem", "_variable", "_amountDecreased","_decreaseAmount", "_usedMeds", "_viscosityAdjustment", "_painReduce"]; - _args = _this select 0; - _target = _args select 0; - _timeInSystem = _args select 1; - _variable = _args select 2; - _amountDecreased = _args select 3; - _decreaseAmount = _args select 4; - _viscosityAdjustment = _args select 5; - _painReduce = _args select 6; - + params ["_args", "_idPFH"]; + _args params ["_target", "_timeInSystem", "_variable", "_amountDecreased","_decreaseAmount", "_viscosityAdjustment", "_painReduce"]; + private "_usedMeds"; _usedMeds = _target getvariable [_variable, 0]; _usedMeds = _usedMeds - _decreaseAmount; _target setvariable [_variable, _usedMeds]; @@ -106,7 +91,7 @@ _viscosityAdjustment = _viscosityChange / _timeInSystem; _target setvariable [QGVAR(painSuppress), ((_target getvariable [QGVAR(painSuppress), 0]) - _painReduce) max 0]; if (_amountDecreased >= 1 || (_usedMeds <= 0) || !alive _target) then { - [(_this select 1)] call cba_fnc_removePerFrameHandler; + [_idPFH] call CBA_fnc_removePerFrameHandler; }; _args set [3, _amountDecreased]; }, 1, [_target, _timeInSystem, _variable, 0, _decreaseAmount, _viscosityAdjustment, _painReduce / _timeInSystem] ] call CBA_fnc_addPerFrameHandler; diff --git a/addons/medical/functions/fnc_onPropagateWound.sqf b/addons/medical/functions/fnc_onPropagateWound.sqf index 934899eac4..f8b361ad17 100644 --- a/addons/medical/functions/fnc_onPropagateWound.sqf +++ b/addons/medical/functions/fnc_onPropagateWound.sqf @@ -7,7 +7,7 @@ * 1: injury * * Return Value: - * None + * None * * Public: No */ @@ -15,8 +15,7 @@ #include "script_component.hpp" private ["_unit", "_injury", "_openWounds", "_injuryID", "_exists"]; -_unit = _this select 0; -_injury = _this select 1; +params ["_unit", "_injury"]; if (!local _unit) then { _openWounds = _unit getvariable[QGVAR(openWounds), []]; @@ -28,7 +27,7 @@ if (!local _unit) then { _exists = true; _openWounds set [_foreachIndex, _injury]; }; - }foreach _openWounds; + } foreach _openWounds; if (!_exists) then { _openWounds pushback _injury; diff --git a/addons/medical/functions/fnc_onWoundUpdateRequest.sqf b/addons/medical/functions/fnc_onWoundUpdateRequest.sqf index 3c99496d7b..091bea7ef8 100644 --- a/addons/medical/functions/fnc_onWoundUpdateRequest.sqf +++ b/addons/medical/functions/fnc_onWoundUpdateRequest.sqf @@ -7,19 +7,18 @@ * 1: Origin object * * ReturnValue: - * + * None * * Public: Yes */ #include "script_component.hpp" private ["_unit", "_openWounds", "_originOfrequest"]; -_unit = _this select 0; -_originOfrequest = _this select 1; +params ["_unit", "_originOfrequest"]; if (local _unit && !(local _originOfrequest)) then { _openWounds = _unit getvariable [QGVAR(openWounds), []]; { ["medical_propagateWound", [_originOfrequest], [_unit, _x]] call EFUNC(common,targetEvent); - }foreach _openWounds; + } foreach _openWounds; }; diff --git a/addons/medical/functions/fnc_parseConfigForInjuries.sqf b/addons/medical/functions/fnc_parseConfigForInjuries.sqf index 1b2db7c278..764d0bf591 100644 --- a/addons/medical/functions/fnc_parseConfigForInjuries.sqf +++ b/addons/medical/functions/fnc_parseConfigForInjuries.sqf @@ -3,13 +3,12 @@ * Parse the ACE_Medical_Advanced config for all injury types. * * Arguments: - * + * None * ReturnValue: - * + * None * * Public: No */ - #include "script_component.hpp" private ["_injuriesRootConfig", "_woundsConfig", "_allWoundClasses", "_amountOf", "_entry","_classType", "_selections", "_bloodLoss", "_pain","_minDamage","_causes", "_damageTypesConfig", "_thresholds", "_typeThresholds", "_selectionSpecific", "_selectionSpecificType", "_classDisplayName", "_subClassDisplayName", "_maxDamage", "_subClassmaxDamage", "_defaultMinLethalDamage", "_minLethalDamage", "_allFoundDamageTypes", "_classID", "_configDamageTypes", "_i", "_parseForSubClassWounds", "_subClass", "_subClassConfig", "_subClassbloodLoss", "_subClasscauses", "_subClassminDamage", "_subClasspain", "_subClassselections", "_subClasstype", "_type", "_varName", "_woundTypes"]; @@ -110,7 +109,7 @@ _selectionSpecific = getNumber(_damageTypesConfig >> "selectionSpecific"); if (_type in (_x select 5)) then { _woundTypes pushback _x; }; - }foreach _allWoundClasses; + } foreach _allWoundClasses; _typeThresholds = _thresholds; _selectionSpecificType = _selectionSpecific; if (isClass(_damageTypesConfig >> _x)) then { @@ -130,11 +129,11 @@ _selectionSpecific = getNumber(_damageTypesConfig >> "selectionSpecific"); _minDamageThresholds = _minDamageThresholds + ":"; _amountThresholds = _amountThresholds + ":"; }; - }foreach _typeThresholds; + } foreach _typeThresholds; "ace_medical" callExtension format ["addDamageType,%1,%2,%3,%4,%5", _type, GVAR(minLethalDamages) select _foreachIndex, _minDamageThresholds, _amountThresholds, _selectionSpecificType]; -}foreach _allFoundDamageTypes; +} foreach _allFoundDamageTypes; // Extension loading @@ -142,34 +141,30 @@ _selectionSpecific = getNumber(_damageTypesConfig >> "selectionSpecific"); { private ["_classID", "_className", "_allowedSelections", "_bloodLoss", "_pain", "_minDamage", "_maxDamage", "_causes", "_classDisplayName", "_extensionInput", "_selections", "_causesArray"]; // add shit to addInjuryType - _classID = _x select 0; + _x params ["_classID", "_selections", "_bloodLoss", "_pain", "_damage", "_causesArray", "_classDisplayName"]; + _damage params ["_minDamage", "_maxDamage"]; _className = GVAR(woundClassNames) select _forEachIndex; _allowedSelections = ""; - _selections = _x select 1; { _allowedSelections = _allowedSelections + _x; if (_forEachIndex < (count _selections) - 1) then { _allowedSelections = _allowedSelections + ":"; }; - }foreach _selections; + } foreach _selections; - _bloodLoss = _x select 2; - _pain = _x select 3; - _minDamage = (_x select 4) select 0; - _maxDamage = (_x select 4) select 1; _causes = ""; - _causesArray = (_x select 5); + { _causes = _causes + _x; if (_forEachIndex < (count _causesArray) - 1) then { _causes = _causes + ":"; }; - }foreach _causesArray; + } foreach _causesArray; _classDisplayName = _x select 6; "ace_medical" callExtension format["addInjuryType,%1,%2,%3,%4,%5,%6,%7,%8,%9", _classID, _className, _allowedSelections, _bloodLoss, _pain, _minDamage, _maxDamage, _causes, _classDisplayName]; -}foreach _allWoundClasses; +} foreach _allWoundClasses; "ace_medical" callExtension "ConfigComplete"; diff --git a/addons/medical/functions/fnc_playInjuredSound.sqf b/addons/medical/functions/fnc_playInjuredSound.sqf index 3d41ec70db..ddf107c840 100644 --- a/addons/medical/functions/fnc_playInjuredSound.sqf +++ b/addons/medical/functions/fnc_playInjuredSound.sqf @@ -6,9 +6,10 @@ * * Arguments: * 0: The Unit + * 1: Amount of Pain * * ReturnValue: - * + * None * * Public: No */ @@ -16,8 +17,7 @@ #include "script_component.hpp" private ["_unit","_availableSounds_A","_availableSounds_B","_availableSounds_C","_sound", "_pain"]; -_unit = _this select 0; -_pain = _this select 1; +params ["_unit", "_pain"]; if (!local _unit || !GVAR(enableScreams)) exitwith{}; // Lock if the unit is already playing a sound. diff --git a/addons/medical/functions/fnc_requestWoundSync.sqf b/addons/medical/functions/fnc_requestWoundSync.sqf index 74fd3e230d..31cf726214 100644 --- a/addons/medical/functions/fnc_requestWoundSync.sqf +++ b/addons/medical/functions/fnc_requestWoundSync.sqf @@ -7,16 +7,14 @@ * 1: object belonging to the caller * * ReturnValue: - * + * None * * Public: Yes */ #include "script_component.hpp" -private [ "_target", "_caller"]; -_target = _this select 0; -_caller = _this select 1; +params [ "_target", "_caller"]; if (local _target || GVAR(level) < 2) exitwith {}; // if the target is local, we already got the most update to date information if (_target getvariable [QGVAR(isWoundSynced), false]) exitwith {}; diff --git a/addons/medical/functions/fnc_setCardiacArrest.sqf b/addons/medical/functions/fnc_setCardiacArrest.sqf index c33d83bb40..017befcaad 100644 --- a/addons/medical/functions/fnc_setCardiacArrest.sqf +++ b/addons/medical/functions/fnc_setCardiacArrest.sqf @@ -7,15 +7,15 @@ * 0: The unit that will be put in cardiac arrest state * * ReturnValue: - * + * None * * Public: yes */ #include "script_component.hpp" -private ["_unit", "_timeInCardiacArrest"]; -_unit = _this select 0; +private "_timeInCardiacArrest"; +params ["_unit"]; if (_unit getvariable [QGVAR(inCardiacArrest),false]) exitwith {}; _unit setvariable [QGVAR(inCardiacArrest), true,true]; @@ -28,20 +28,17 @@ _timeInCardiacArrest = 120 + round(random(600)); [{ private ["_args","_unit","_startTime","_timeInCardiacArrest","_heartRate"]; - _args = _this select 0; - _unit = _args select 0; - _startTime = _args select 1; - _timeInCardiacArrest = _args select 2; + params ["_args", "_idPFH"]; + _args params ["_unit", "_startTime", "_timeInCardiacArrest"]; _heartRate = _unit getvariable [QGVAR(heartRate), 80]; if (_heartRate > 0 || !alive _unit) exitwith { - [(_this select 1)] call cba_fnc_removePerFrameHandler; + [_idPFH] call CBA_fnc_removePerFrameHandler; _unit setvariable [QGVAR(inCardiacArrest), nil,true]; }; if (ACE_time - _startTime >= _timeInCardiacArrest) exitwith { - [(_this select 1)] call cba_fnc_removePerFrameHandler; + [_idPFH] call CBA_fnc_removePerFrameHandler; _unit setvariable [QGVAR(inCardiacArrest), nil,true]; [_unit] call FUNC(setDead); }; }, 1, [_unit, ACE_time, _timeInCardiacArrest] ] call CBA_fnc_addPerFrameHandler; - diff --git a/addons/medical/functions/fnc_setDead.sqf b/addons/medical/functions/fnc_setDead.sqf index c29edcd5e3..c8c81a699e 100644 --- a/addons/medical/functions/fnc_setDead.sqf +++ b/addons/medical/functions/fnc_setDead.sqf @@ -6,7 +6,7 @@ * 0: The unit that will be killed * * ReturnValue: - * + * None * * Public: yes */ @@ -14,11 +14,7 @@ #include "script_component.hpp" private ["_unit", "_force", "_reviveVal", "_lifesLeft"]; -_unit = _this select 0; -_force = false; -if (count _this >= 2) then { - _force = _this select 1; -}; +params ["_unit", ["_force", false]]; if (!alive _unit) exitwith{true}; if (!local _unit) exitwith { @@ -44,13 +40,13 @@ if (((_reviveVal == 1 && {[_unit] call EFUNC(common,isPlayer)} || _reviveVal == [_unit, true] call FUNC(setUnconscious); [{ - private ["_args","_unit","_startTime"]; - _args = _this select 0; - _unit = _args select 0; + private "_startTime"; + params ["_args", "_idPFH"]; + _args params ["_unit"]; _startTime = _unit getvariable [QGVAR(reviveStartTime), 0]; if (GVAR(maxReviveTime) > 0 && {ACE_time - _startTime > GVAR(maxReviveTime)}) exitwith { - [(_this select 1)] call cba_fnc_removePerFrameHandler; + [_idPFH] call CBA_fnc_removePerFrameHandler; _unit setvariable [QGVAR(inReviveState), nil, true]; _unit setvariable [QGVAR(reviveStartTime), nil]; [_unit, true] call FUNC(setDead); @@ -64,7 +60,7 @@ if (((_reviveVal == 1 && {[_unit] call EFUNC(common,isPlayer)} || _reviveVal == }; _unit setvariable [QGVAR(reviveStartTime), nil]; - [(_this select 1)] call cba_fnc_removePerFrameHandler; + [_idPFH] call CBA_fnc_removePerFrameHandler; }; if (GVAR(level) >= 2) then { if (_unit getvariable [QGVAR(heartRate), 60] > 0) then { @@ -82,5 +78,5 @@ if (isPLayer _unit) then { ["medical_onSetDead", [_unit]] call EFUNC(common,localEvent); -_unit setdamage 1; +[_unit, 1] call FUNC(setStructuralDamage); true; diff --git a/addons/medical/functions/fnc_setHitPointDamage.sqf b/addons/medical/functions/fnc_setHitPointDamage.sqf index 18d4fc616e..f8698a7fe0 100644 --- a/addons/medical/functions/fnc_setHitPointDamage.sqf +++ b/addons/medical/functions/fnc_setHitPointDamage.sqf @@ -7,10 +7,10 @@ * 0: Unit * 1: HitPoint * 2: Damage - * 3: Disable overall damage adjustment (optional) + * 3: Disable overall damage adjustment (default: false) * * Return Value: - * nil + * None * * Public: Yes */ @@ -22,10 +22,7 @@ #define ARMDAMAGETRESHOLD2 1.7 private ["_unit", "_selection", "_damage", "_selections", "_damages", "_damageOld", "_damageSumOld", "_damageNew", "_damageSumNew", "_damageFinal", "_armdamage", "_legdamage"]; - -_unit = _this select 0; -_selection = _this select 1; -_damage = _this select 2; +params ["_unit", "_selection", "_damage", ["_disabled", false]]; // Unit isn't local, give function to machine where it is. if !(local _unit) exitWith { @@ -33,7 +30,7 @@ if !(local _unit) exitWith { }; // Check if overall damage adjustment is disabled -if (count _this > 3 && {_this select 3}) exitWith { +if (_disabled) exitWith { _unit setHitPointDamage [_selection, _damage]; }; diff --git a/addons/medical/functions/fnc_setStructuralDamage.sqf b/addons/medical/functions/fnc_setStructuralDamage.sqf new file mode 100644 index 0000000000..b4dc74eac1 --- /dev/null +++ b/addons/medical/functions/fnc_setStructuralDamage.sqf @@ -0,0 +1,25 @@ +/* + * Author: commy2 + * Set the structural damage of a soldier without changing the individual hitpoints. Unit has to be local. Not safe to use with vehicles! + * + * Arguments: + * 0: The unit + * + * ReturnValue: + * + * + * Public: no? + */ + +params ["_unit", "_damage"]; + +if (!local _unit) exitWith {}; + +private "_allHitPoints"; +_allHitPoints = getAllHitPointsDamage _unit select 2; + +_unit setDamage _damage; + +{ + _unit setHitIndex [_forEachIndex, _x]; +} forEach _allHitPoints; diff --git a/addons/medical/functions/fnc_setUnconscious.sqf b/addons/medical/functions/fnc_setUnconscious.sqf index 7e5cd8c1b7..cb9fff0693 100644 --- a/addons/medical/functions/fnc_setUnconscious.sqf +++ b/addons/medical/functions/fnc_setUnconscious.sqf @@ -4,9 +4,9 @@ * * Arguments: * 0: The unit that will be put in an unconscious state - * 1: Set unconsciouns - * 2: Minimum unconscious ACE_time - * 3: Force AI Unconscious (skip random death chance) + * 1: Set unconsciouns (default: true) + * 2: Minimum unconscious ACE_time (default: (round(random(10)+5))) + * 3: Force AI Unconscious (skip random death chance) (default: false) * * ReturnValue: * nil @@ -19,13 +19,15 @@ #include "script_component.hpp" -#define DEFAULT_DELAY (round(random(10)+5)) +#define DEFAULT_DELAY (round(random(10)+5)) -private ["_unit", "_set", "_animState", "_originalPos", "_startingTime","_minWaitingTime", "_force", "_isDead"]; -_unit = _this select 0; -_set = if (count _this > 1) then {_this select 1} else {true}; -_minWaitingTime = if (count _this > 2) then {_this select 2} else {DEFAULT_DELAY}; -_force = if (count _this > 3) then {_this select 3} else {false}; +// only run this after the settings are initialized +if !(EGVAR(common,settingsInitFinished)) exitWith { + EGVAR(common,runAtSettingsInitialized) pushBack [FUNC(setUnconscious), _this]; +}; + +private ["_animState", "_originalPos", "_startingTime", "_isDead"]; +params ["_unit", ["_set", true], ["_minWaitingTime", DEFAULT_DELAY], ["_force", false]]; // No change, fuck off. (why is there no xor?) if (_set isEqualTo (_unit getVariable ["ACE_isUnconscious", false])) exitWith {}; @@ -97,8 +99,7 @@ if (GVAR(moveUnitsFromGroupOnUnconscious)) then { _anim = [_unit] call EFUNC(common,getDeathAnim); [_unit, _anim, 1, true] call EFUNC(common,doAnimation); [{ - _unit = _this select 0; - _anim = _this select 1; + params ["_unit", "_anim"]; if ((_unit getVariable "ACE_isUnconscious") and (animationState _unit != _anim)) then { [_unit, _anim, 2, true] call EFUNC(common,doAnimation); }; diff --git a/addons/medical/functions/fnc_treatment.sqf b/addons/medical/functions/fnc_treatment.sqf index 9c218de540..5e97e31501 100644 --- a/addons/medical/functions/fnc_treatment.sqf +++ b/addons/medical/functions/fnc_treatment.sqf @@ -16,11 +16,8 @@ #include "script_component.hpp" -private ["_caller", "_target", "_selectionName", "_className", "_config", "_medicRequired", "_items", "_locations", "_return", "_callbackProgress", "_treatmentTime", "_callerAnim", "_patientAnim", "_iconDisplayed", "_return", "_usersOfItems", "_consumeItems", "_condition", "_displayText", "_wpn", "_treatmentTimeConfig", "_patientStateCondition", "_allowedSelections"]; -_caller = _this select 0; -_target = _this select 1; -_selectionName = _this select 2; -_className = _this select 3; +private ["_config", "_medicRequired", "_items", "_locations", "_return", "_callbackProgress", "_treatmentTime", "_callerAnim", "_patientAnim", "_iconDisplayed", "_return", "_usersOfItems", "_consumeItems", "_condition", "_displayText", "_wpn", "_treatmentTimeConfig", "_patientStateCondition", "_allowedSelections"]; +params ["_caller", "_target", "_selectionName", "_className"]; // If the cursorMenu is open, the loading bar will fail. If we execute the function one frame later, it will work fine if (uiNamespace getVariable [QEGVAR(interact_menu,cursorMenuOpened),false]) exitwith { @@ -37,6 +34,9 @@ if (GVAR(level) >= 2) then { }; if !(isClass _config) exitwith {false}; +// Allow self treatment check +if (_caller == _target && {getNumber (_config >> "allowSelfTreatment") == 0}) exitwith {false}; + _medicRequired = if (isNumber (_config >> "requiredMedic")) then { getNumber (_config >> "requiredMedic"); } else { @@ -107,7 +107,7 @@ if ("All" in _locations) then { }; }; }; - }foreach _locations; + } foreach _locations; }; if !(_return) exitwith {false}; @@ -176,8 +176,17 @@ if (vehicle _caller == _caller && {_callerAnim != ""}) then { _caller selectWeapon (primaryWeapon _caller); // unit always has a primary weapon here }; - if (stance _caller == "STAND") then { - _caller setvariable [QGVAR(treatmentPrevAnimCaller), "amovpknlmstpsraswrfldnon"]; + if (isWeaponDeployed _caller) then { + TRACE_1("Weapon Deployed, breaking out first",(stance _caller)); + [_caller, "", 0] call EFUNC(common,doAnimation); + }; + + if ((stance _caller) == "STAND") then { + switch (_wpn) do {//If standing, end in a crouched animation based on their current weapon + case ("rfl"): {_caller setvariable [QGVAR(treatmentPrevAnimCaller), "AmovPknlMstpSrasWrflDnon"];}; + case ("pst"): {_caller setvariable [QGVAR(treatmentPrevAnimCaller), "AmovPknlMstpSrasWpstDnon"];}; + case ("non"): {_caller setvariable [QGVAR(treatmentPrevAnimCaller), "AmovPknlMstpSnonWnonDnon"];}; + }; } else { _caller setvariable [QGVAR(treatmentPrevAnimCaller), animationState _caller]; }; diff --git a/addons/medical/functions/fnc_treatmentAdvanced_CPR.sqf b/addons/medical/functions/fnc_treatmentAdvanced_CPR.sqf index ade74a6ccb..f09de600ae 100644 --- a/addons/medical/functions/fnc_treatmentAdvanced_CPR.sqf +++ b/addons/medical/functions/fnc_treatmentAdvanced_CPR.sqf @@ -16,12 +16,7 @@ #include "script_component.hpp" -private ["_caller", "_target", "_selectionName", "_className", "_items"]; -_caller = _this select 0; -_target = _this select 1; -_selectionName = _this select 2; -_className = _this select 3; -_items = _this select 4; +params ["_caller", "_target", "_selectionName", "_className", "_items"]; if (alive _target && {(_target getvariable [QGVAR(inCardiacArrest), false] || _target getvariable [QGVAR(inReviveState), false])}) then { [[_caller, _target], QUOTE(DFUNC(treatmentAdvanced_CPRLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ diff --git a/addons/medical/functions/fnc_treatmentAdvanced_CPRLocal.sqf b/addons/medical/functions/fnc_treatmentAdvanced_CPRLocal.sqf index c3151f2c90..9024489a3b 100644 --- a/addons/medical/functions/fnc_treatmentAdvanced_CPRLocal.sqf +++ b/addons/medical/functions/fnc_treatmentAdvanced_CPRLocal.sqf @@ -14,24 +14,23 @@ #include "script_component.hpp" -private ["_caller","_target", "_reviveStartTime"]; -_caller = _this select 0; -_target = _this select 1; +private "_reviveStartTime"; +params ["_caller","_target"]; -if (_target getvariable [QGVAR(inReviveState), false]) exitwith { +if (_target getvariable [QGVAR(inReviveState), false]) then { _reviveStartTime = _target getvariable [QGVAR(reviveStartTime),0]; if (_reviveStartTime > 0) then { _target setvariable [QGVAR(reviveStartTime), (_reviveStartTime + random(20)) min ACE_time]; }; }; -if (random(1)>= 0.6) exitwith { +if (GVAR(level) > 1 && {(random 1) >= 0.6}) then { _target setvariable [QGVAR(inCardiacArrest), nil,true]; _target setvariable [QGVAR(heartRate), 40]; _target setvariable [QGVAR(bloodPressure), [50,70]]; }; -[_target, "activity", LSTRING(Activity_fullHeal), [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog); -[_target, "activity_view", LSTRING(Activity_fullHeal), [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog); // TODO expand message +[_target, "activity", LSTRING(Activity_CPR), [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog); +[_target, "activity_view", LSTRING(Activity_CPR), [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog); // TODO expand message true; diff --git a/addons/medical/functions/fnc_treatmentAdvanced_bandage.sqf b/addons/medical/functions/fnc_treatmentAdvanced_bandage.sqf index 1278994a11..aa3669c227 100644 --- a/addons/medical/functions/fnc_treatmentAdvanced_bandage.sqf +++ b/addons/medical/functions/fnc_treatmentAdvanced_bandage.sqf @@ -7,7 +7,8 @@ * 1: The patient * 2: SelectionName * 3: Treatment classname - * + * 4: Item + * 5: specific Spot (default: -1) * * Return Value: * Succesful treatment started @@ -16,15 +17,7 @@ */ #include "script_component.hpp" - -private ["_caller", "_target", "_selectionName", "_className", "_items", "_specificSpot"]; -_caller = _this select 0; -_target = _this select 1; -_selectionName = _this select 2; -_className = _this select 3; -_items = _this select 4; - -_specificSpot = if (count _this > 6) then {_this select 6} else {-1}; +params ["_caller", "_target", "_selectionName", "_className", "_items", "", ["_specificSpot", -1]]; if !([_target] call FUNC(hasMedicalEnabled)) exitwith { _this call FUNC(treatmentBasic_bandage); diff --git a/addons/medical/functions/fnc_treatmentAdvanced_bandageLocal.sqf b/addons/medical/functions/fnc_treatmentAdvanced_bandageLocal.sqf index d6c490d3c6..2ef1174e63 100644 --- a/addons/medical/functions/fnc_treatmentAdvanced_bandageLocal.sqf +++ b/addons/medical/functions/fnc_treatmentAdvanced_bandageLocal.sqf @@ -15,19 +15,16 @@ #include "script_component.hpp" -private ["_target", "_bandage", "_part", "_selectionName", "_openWounds", "_config", "_effectiveness","_mostEffectiveInjury", "_mostEffectiveSpot", "_woundEffectivenss", "_mostEffectiveInjury", "_impact", "_exit", "_specificClass", "_classID", "_effectivenessFound", "_className", "_hitPoints", "_hitSelections", "_point", "_woundTreatmentConfig"]; -_target = _this select 0; -_bandage = _this select 1; -_selectionName = _this select 2; -_specificClass = if (count _this > 3) then {_this select 3} else { -1 }; +private ["_openWounds", "_config", "_effectiveness","_mostEffectiveInjury", "_mostEffectiveSpot", "_woundEffectivenss", "_mostEffectiveInjury", "_impact", "_exit", "_classID", "_effectivenessFound", "_className", "_hitPoints", "_hitSelections", "_point", "_woundTreatmentConfig"]; +params ["_target", "_bandage", "_selectionName", ["_specificClass", -1]]; // Ensure it is a valid bodypart _part = [_selectionName] call FUNC(selectionNameToNumber); -if (_part < 0) exitwith {}; +if (_part < 0) exitwith {false}; // Get the open wounds for this unit _openWounds = _target getvariable [QGVAR(openWounds), []]; -if (count _openWounds == 0) exitwith {}; // nothing to do here! +if (count _openWounds == 0) exitwith {false}; // nothing to do here! // Get the default effectiveness for the used bandage _config = (ConfigFile >> "ACE_Medical_Advanced" >> "Treatment" >> "Bandaging"); @@ -43,10 +40,11 @@ _effectivenessFound = -1; _mostEffectiveInjury = _openWounds select 0; _exit = false; { + _x params ["", "_classID", "_partX"]; + TRACE_2("OPENWOUND: ", _target, _x); // Only parse injuries that are for the selected bodypart. - if (_x select 2 == _part) then { + if (_partX == _part) then { _woundEffectivenss = _effectiveness; - _classID = (_x select 1); // Select the classname from the wound classname storage _className = GVAR(woundClassNames) select _classID; @@ -59,6 +57,7 @@ _exit = false; }; }; + TRACE_2("Wound classes: ", _specificClass, _classID); if (_specificClass == _classID) exitwith { _effectivenessFound = _woundEffectivenss; _mostEffectiveSpot = _foreachIndex; @@ -74,7 +73,7 @@ _exit = false; }; }; if (_exit) exitwith {}; -}foreach _openWounds; +} foreach _openWounds; if (_effectivenessFound == -1) exitwith {}; // Seems everything is patched up on this body part already.. @@ -95,13 +94,79 @@ if (_impact > 0 && {GVAR(enableAdvancedWounds)}) then { [_target, _impact, _part, _mostEffectiveSpot, _mostEffectiveInjury, _bandage] call FUNC(handleBandageOpening); }; -// If all wounds have been bandaged, we will reset all damage to 0, so the unit is not showing any blood on the model anymore. -if (GVAR(healHitPointAfterAdvBandage) && {{(_x select 2) == _part && {_x select 3 > 0}}count _openWounds == 0}) then { - _hitSelections = ["head", "body", "hand_l", "hand_r", "leg_l", "leg_r"]; - _hitPoints = ["HitHead", "HitBody", "HitLeftArm", "HitRightArm", "HitLeftLeg", "HitRightLeg"]; - _point = _hitPoints select (_hitSelections find _selectionName); - [_target, _point, 0] call FUNC(setHitPointDamage); - // _target setvariable [QGVAR(bodyPartStatus), [0,0,0,0,0,0], true]; +// If all wounds to a body part have been bandaged, reset damage to that body part to zero +// so that the body part functions normally and blood is removed from the uniform. +// Arma combines left and right arms into a single body part (HitHands), same with left and right legs (HitLegs). +// Arms are actually hands. +if (GVAR(healHitPointAfterAdvBandage)) then { + private["_currentWounds", "_headWounds", "_bodyWounds", "_legsWounds", "_armWounds"]; + + // Get the list of the wounds the target is currently suffering from. + _currentWounds = _target getVariable [QGVAR(openWounds), []]; + + // Tally of unbandaged wounds to each body part. + _headWounds = 0; + _bodyWounds = 0; + _legsWounds = 0; + _armWounds = 0; + + // Loop through all current wounds and add up the number of unbandaged wounds on each body part. + { + _x params ["", "", "_bodyPart", "_numOpenWounds", "_bloodLoss"]; + + // Use switch/case for early termination if wounded limb is found before all six are checked. + // Number of wounds multiplied by blood loss will return zero for a fully + // bandaged body part, not incrementing the wound counter; or it will return + // some other number which will increment the wound counter. + switch (_bodyPart) do { + // Head + case 0: { + _headWounds = _headWounds + (_numOpenWounds * _bloodLoss); + }; + + // Body + case 1: { + _bodyWounds = _bodyWounds + (_numOpenWounds * _bloodLoss); + }; + + // Left Arm + case 2: { + _armWounds = _armWounds + (_numOpenWounds * _bloodLoss); + }; + + // Right Arm + case 3: { + _armWounds = _armWounds + (_numOpenWounds * _bloodLoss); + }; + + // Left Leg + case 4: { + _legsWounds = _legsWounds + (_numOpenWounds * _bloodLoss); + }; + + // Right Leg + case 5: { + _legsWounds = _legsWounds + (_numOpenWounds * _bloodLoss); + }; + }; + } forEach _currentWounds; + + // Any body part that has no wounds is healed to full health + if (_headWounds == 0) then { + _target setHitPointDamage ["hitHead", 0.0]; + }; + + if (_bodyWounds == 0) then { + _target setHitPointDamage ["hitBody", 0.0]; + }; + + if (_armWounds == 0) then { + _target setHitPointDamage ["hitHands", 0.0]; + }; + + if (_legsWounds == 0) then { + _target setHitPointDamage ["hitLegs", 0.0]; + }; }; true; diff --git a/addons/medical/functions/fnc_treatmentAdvanced_fullHeal.sqf b/addons/medical/functions/fnc_treatmentAdvanced_fullHeal.sqf index 37627a8c5d..a26876568d 100644 --- a/addons/medical/functions/fnc_treatmentAdvanced_fullHeal.sqf +++ b/addons/medical/functions/fnc_treatmentAdvanced_fullHeal.sqf @@ -10,12 +10,7 @@ #include "script_component.hpp" -private ["_target", "_caller", "_selectionName", "_className", "_items"]; -_caller = _this select 0; -_target = _this select 1; -_selectionName = _this select 2; -_className = _this select 3; -_items = _this select 4; +params ["_caller", "_target", "_selectionName", "_className", "_items"]; // TODO replace by event system [[_caller, _target], QUOTE(DFUNC(treatmentAdvanced_fullHealLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ diff --git a/addons/medical/functions/fnc_treatmentAdvanced_fullHealLocal.sqf b/addons/medical/functions/fnc_treatmentAdvanced_fullHealLocal.sqf index df7594921d..ed5eb0858d 100644 --- a/addons/medical/functions/fnc_treatmentAdvanced_fullHealLocal.sqf +++ b/addons/medical/functions/fnc_treatmentAdvanced_fullHealLocal.sqf @@ -10,9 +10,8 @@ #include "script_component.hpp" -private ["_target", "_caller", "_allUsedMedication"]; -_caller = _this select 0; -_target = _this select 1; +private "_allUsedMedication"; +params ["_caller", "_target"]; if (alive _target) exitwith { @@ -64,7 +63,7 @@ if (alive _target) exitwith { _allUsedMedication = _target getVariable [QGVAR(allUsedMedication), []]; { _target setvariable [_x select 0, nil]; - }foreach _allUsedMedication; + } foreach _allUsedMedication; // Resetting damage _target setDamage 0; diff --git a/addons/medical/functions/fnc_treatmentAdvanced_fullHealTreatmentTime.sqf b/addons/medical/functions/fnc_treatmentAdvanced_fullHealTreatmentTime.sqf index 108bdd4a5d..a0539948ea 100644 --- a/addons/medical/functions/fnc_treatmentAdvanced_fullHealTreatmentTime.sqf +++ b/addons/medical/functions/fnc_treatmentAdvanced_fullHealTreatmentTime.sqf @@ -15,12 +15,12 @@ */ #include "script_component.hpp" -private ["_target", "_totalDamage"]; -_target = _this; +private "_totalDamage"; + _totalDamage = 0; { _totalDamage = _totalDamage + _x; -} forEach (_target getVariable [QGVAR(bodyPartStatus), []]); +} forEach (_this getVariable [QGVAR(bodyPartStatus), []]); (10 max (_totalDamage * 10) min 120) diff --git a/addons/medical/functions/fnc_treatmentAdvanced_medication.sqf b/addons/medical/functions/fnc_treatmentAdvanced_medication.sqf index 0b401a73cc..b5b0af1401 100644 --- a/addons/medical/functions/fnc_treatmentAdvanced_medication.sqf +++ b/addons/medical/functions/fnc_treatmentAdvanced_medication.sqf @@ -17,12 +17,7 @@ #include "script_component.hpp" -private ["_caller", "_target", "_selectionName", "_className", "_items"]; -_caller = _this select 0; -_target = _this select 1; -_selectionName = _this select 2; -_className = _this select 3; -_items = _this select 4; +params ["_caller", "_target", "_selectionName", "_className", "_items"]; [[_target, _className], QUOTE(DFUNC(treatmentAdvanced_medicationLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ @@ -32,7 +27,7 @@ _items = _this select 4; [_target, "activity", LSTRING(Activity_usedItem), [[_caller] call EFUNC(common,getName), getText (configFile >> "CfgWeapons" >> _x >> "displayName")]] call FUNC(addToLog); [_target, "activity_view", LSTRING(Activity_usedItem), [[_caller] call EFUNC(common,getName), getText (configFile >> "CfgWeapons" >> _x >> "displayName")]] call FUNC(addToLog); }; -}foreach _items; +} foreach _items; true; diff --git a/addons/medical/functions/fnc_treatmentAdvanced_medicationLocal.sqf b/addons/medical/functions/fnc_treatmentAdvanced_medicationLocal.sqf index c4ba840398..00a4fae8d9 100644 --- a/addons/medical/functions/fnc_treatmentAdvanced_medicationLocal.sqf +++ b/addons/medical/functions/fnc_treatmentAdvanced_medicationLocal.sqf @@ -15,9 +15,8 @@ #include "script_component.hpp" -private ["_target", "_className", "_currentInSystem", "_medicationConfig", "_painReduce", "_hrIncreaseLow", "_hrIncreaseNorm", "_hrIncreaseHigh", "_maxDose", "_inCompatableMedication", "_timeInSystem", "_heartRate", "_pain", "_resistance", "_hrCallback", "_varName", "_viscosityChange"]; -_target = _this select 0; -_className = _this select 1; +private ["_currentInSystem", "_medicationConfig", "_painReduce", "_hrIncreaseLow", "_hrIncreaseNorm", "_hrIncreaseHigh", "_maxDose", "_inCompatableMedication", "_timeInSystem", "_heartRate", "_pain", "_resistance", "_hrCallback", "_varName", "_viscosityChange"]; +params ["_target", "_className"]; // We have added a new dose of this medication to our system, so let's increase it _varName = format[QGVAR(%1_inSystem), _className]; diff --git a/addons/medical/functions/fnc_treatmentAdvanced_surgicalKit_onProgress.sqf b/addons/medical/functions/fnc_treatmentAdvanced_surgicalKit_onProgress.sqf index c0e1037027..aadcb40d45 100644 --- a/addons/medical/functions/fnc_treatmentAdvanced_surgicalKit_onProgress.sqf +++ b/addons/medical/functions/fnc_treatmentAdvanced_surgicalKit_onProgress.sqf @@ -1,23 +1,30 @@ /* * Author: BaerMitUmlaut - * Handles treatment via surgical kit per frame. + * Handles treatment via surgical kit per frame + * + * Arguments: + * 0: Arguments + * 0: Caller + * 1: Target + * 1: Elapsed Time + * 2: Total Time + * + * Return Value: + * Succesful treatment started * * Public: No */ - #include "script_component.hpp" -private ["_args", "_target", "_caller", "_elapsedTime", "_totalTime", "_bandagedWounds"]; -_args = _this select 0; -_caller = _args select 0; -_target = _args select 1; -_elapsedTime = _this select 1; -_totalTime = _this select 2; + +private "_bandagedWounds"; +params ["_args", "_elapsedTime", "_totalTime"]; +_args params ["_caller", "_target"]; _bandagedWounds = _target getVariable [QGVAR(bandagedWounds), []]; //In case two people stitch up one patient and the last wound has already been closed we can stop already -if (count _bandagedWounds == 0) exitWith {false}; +if (count _bandagedWounds == 0) exitWith { false }; //Has enough time elapsed that we can close another wound? if ((_totalTime - _elapsedTime) <= (((count _bandagedWounds) - 1) * 5)) then { @@ -25,4 +32,4 @@ if ((_totalTime - _elapsedTime) <= (((count _bandagedWounds) - 1) * 5)) then { _target setVariable [QGVAR(bandagedWounds), _bandagedWounds, true]; }; -true \ No newline at end of file +true diff --git a/addons/medical/functions/fnc_treatmentBasic_bandage.sqf b/addons/medical/functions/fnc_treatmentBasic_bandage.sqf index 75b0b6bfdd..04cace08af 100644 --- a/addons/medical/functions/fnc_treatmentBasic_bandage.sqf +++ b/addons/medical/functions/fnc_treatmentBasic_bandage.sqf @@ -9,7 +9,7 @@ * 3: Treatment classname * * Return Value: - * nil + * None * * Public: No */ @@ -17,19 +17,7 @@ #include "script_component.hpp" #define BANDAGEHEAL 0.8 -private ["_caller", "_target","_selection","_className","_target","_hitSelections","_hitPoints","_point", "_damage"]; -_caller = _this select 0; -_target = _this select 1; -_selection = _this select 2; -_className = _this select 3; +private ["_hitSelections", "_hitPoints", "_point", "_damage"]; +params ["_caller", "_target", "_selection", "_className"]; -if (_selection == "all") then { - _target setDamage ((damage _target - BANDAGEHEAL) max 0); -} else { - _hitSelections = ["head", "body", "hand_l", "hand_r", "leg_l", "leg_r"]; - _hitPoints = ["HitHead", "HitBody", "HitLeftArm", "HitRightArm", "HitLeftLeg", "HitRightLeg"]; - _point = _hitPoints select (_hitSelections find _selection); - - _damage = ((_target getHitPointDamage _point) - BANDAGEHEAL) max 0; - [_target, _point, _damage] call FUNC(setHitPointDamage); -}; +[[_target, _selection], QUOTE(DFUNC(treatmentBasic_bandageLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ diff --git a/addons/medical/functions/fnc_treatmentBasic_bandageLocal.sqf b/addons/medical/functions/fnc_treatmentBasic_bandageLocal.sqf new file mode 100644 index 0000000000..ee04decfbd --- /dev/null +++ b/addons/medical/functions/fnc_treatmentBasic_bandageLocal.sqf @@ -0,0 +1,50 @@ +/* + * Author: Glowbal + * Handles the bandage of a patient. + * + * Arguments: + * 0: The patient + * 1: Treatment classname + * + * + * Return Value: + * Succesful treatment started + * + * Public: No + */ + +#include "script_component.hpp" +#define BANDAGEHEAL 0.8 + +params ["_target", "_selectionName"]; + +_damageBodyParts = _target getvariable [QGVAR(bodyPartStatus), [0,0,0,0,0,0]]; + +// Ensure it is a valid bodypart +_part = [_selectionName] call FUNC(selectionNameToNumber); +if (_part < 0) exitwith {false}; + +if ((_damageBodyParts select _part) > 0) then { + _damageOnPart = (_damageBodyParts select _part); + // Temp quick fix to change in behaviour of basic medical bandaging + if (_damageOnPart - BANDAGEHEAL > 0) then { + _damageOnPart = _damageOnPart - (_damageOnPart * BANDAGEHEAL); + } else { + _damageOnPart = _damageOnPart - BANDAGEHEAL; + }; + _damageBodyParts set [_part, _damageOnPart max 0]; + _target setvariable [QGVAR(bodyPartStatus), _damageBodyParts, true]; + TRACE_2("ACE_DEBUG: Treatment BASIC Bandage Broadcast value here",_unit, _target getvariable QGVAR(bodyPartStatus)); +}; + +EXPLODE_6_PVT(_damageBodyParts,_headDamage,_torsoDamage,_handsDamageR,_handsDamageL,_legsDamageR,_legsDamageL); +_target setHitPointDamage ["hitHead", _headDamage min 0.95]; +_target setHitPointDamage ["hitBody", _torsoDamage min 0.95]; +_target setHitPointDamage ["hitHands", (_handsDamageR + _handsDamageL) min 0.95]; +_target setHitPointDamage ["hitLegs", (_legsDamageR + _legsDamageL) min 0.95]; + +{ + _target setHitPointDamage [_x, (_damageBodyParts select _foreachIndex) min 0.95]; +}foreach GVAR(HITPOINTS); + +true; diff --git a/addons/medical/functions/fnc_treatmentBasic_bloodbag.sqf b/addons/medical/functions/fnc_treatmentBasic_bloodbag.sqf index 7cfb65a909..5700d351cb 100644 --- a/addons/medical/functions/fnc_treatmentBasic_bloodbag.sqf +++ b/addons/medical/functions/fnc_treatmentBasic_bloodbag.sqf @@ -9,16 +9,13 @@ * 3: Treatment classname * * Return Value: - * nil + * None * * Public: No */ #include "script_component.hpp" -private ["_caller", "_target", "_treatmentClassname"]; -_caller = _this select 0; -_target = _this select 1; -_treatmentClassname = _this select 3; +params ["_caller", "_target", "_treatmentClassname"]; [[_target, _treatmentClassname], QUOTE(DFUNC(treatmentBasic_bloodbagLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ diff --git a/addons/medical/functions/fnc_treatmentBasic_bloodbagLocal.sqf b/addons/medical/functions/fnc_treatmentBasic_bloodbagLocal.sqf index 08057c9492..64ba6e031b 100644 --- a/addons/medical/functions/fnc_treatmentBasic_bloodbagLocal.sqf +++ b/addons/medical/functions/fnc_treatmentBasic_bloodbagLocal.sqf @@ -15,7 +15,7 @@ #include "script_component.hpp" #define BLOODBAGHEAL 70 -PARAMS_2(_target,_treatmentClassname); +params ["_target", "_treatmentClassname"]; private ["_blood", "_bloodAdded"]; diff --git a/addons/medical/functions/fnc_treatmentBasic_epipen.sqf b/addons/medical/functions/fnc_treatmentBasic_epipen.sqf index bdfb95fb2a..d387e91f89 100644 --- a/addons/medical/functions/fnc_treatmentBasic_epipen.sqf +++ b/addons/medical/functions/fnc_treatmentBasic_epipen.sqf @@ -9,17 +9,13 @@ * 3: Treatment classname * * Return Value: - * nil + * None * * Public: No */ - #include "script_component.hpp" -private ["_caller", "_target","_className"]; -_caller = _this select 0; -_target = _this select 1; -_className = _this select 3; +params ["_caller", "_target","_className"]; [_target, false] call FUNC(setUnconscious); diff --git a/addons/medical/functions/fnc_treatmentBasic_morphine.sqf b/addons/medical/functions/fnc_treatmentBasic_morphine.sqf index 048b314781..87559d0dd2 100644 --- a/addons/medical/functions/fnc_treatmentBasic_morphine.sqf +++ b/addons/medical/functions/fnc_treatmentBasic_morphine.sqf @@ -9,7 +9,7 @@ * 3: Treatment classname * * Return Value: - * nil + * None * * Public: No */ @@ -17,8 +17,6 @@ #include "script_component.hpp" #define MORPHINEHEAL 0.4 -private ["_caller", "_target"]; -_caller = _this select 0; -_target = _this select 1; +params ["_caller", "_target"]; [[_target], QUOTE(DFUNC(treatmentBasic_morphineLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ diff --git a/addons/medical/functions/fnc_treatmentBasic_morphineLocal.sqf b/addons/medical/functions/fnc_treatmentBasic_morphineLocal.sqf index 9dddf743e2..780196819b 100644 --- a/addons/medical/functions/fnc_treatmentBasic_morphineLocal.sqf +++ b/addons/medical/functions/fnc_treatmentBasic_morphineLocal.sqf @@ -7,7 +7,7 @@ * 1: The patient * * Return Value: - * nil + * None * * Public: No */ @@ -15,8 +15,8 @@ #include "script_component.hpp" #define MORPHINEHEAL 0.4 -private ["_target", "_morphine", "_pain"]; -_target = _this select 0; +private ["_morphine", "_pain"]; +params ["_target"]; // reduce pain, pain sensitivity _morphine = ((_target getVariable [QGVAR(morphine), 0]) + MORPHINEHEAL) min 1; diff --git a/addons/medical/functions/fnc_treatmentIV.sqf b/addons/medical/functions/fnc_treatmentIV.sqf index e0c4d20ed6..2a7bbc6adf 100644 --- a/addons/medical/functions/fnc_treatmentIV.sqf +++ b/addons/medical/functions/fnc_treatmentIV.sqf @@ -8,26 +8,23 @@ * 2: SelectionName * 3: Treatment classname * - * * Return Value: - * + * Succesful treatment started * * Public: Yes */ #include "script_component.hpp" -private ["_caller", "_target", "_selectionName", "_className", "_items", "_removeItem"]; -_caller = _this select 0; -_target = _this select 1; -_selectionName = _this select 2; -_className = _this select 3; -_items = _this select 4; +private "_removeItem"; +params ["_caller", "_target", "_selectionName", "_className", "_items"]; -if (count _items == 0) exitwith {}; +if (count _items == 0) exitwith {false}; _removeItem = _items select 0; [[_target, _className], QUOTE(DFUNC(treatmentIVLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ [_target, _removeItem] call FUNC(addToTriageCard); [_target, "activity", LSTRING(Activity_gaveIV), [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog); [_target, "activity_view", LSTRING(Activity_gaveIV), [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog); // TODO expand message + +true diff --git a/addons/medical/functions/fnc_treatmentIVLocal.sqf b/addons/medical/functions/fnc_treatmentIVLocal.sqf index 9abb5fda2f..37cba2ad1b 100644 --- a/addons/medical/functions/fnc_treatmentIVLocal.sqf +++ b/addons/medical/functions/fnc_treatmentIVLocal.sqf @@ -8,16 +8,15 @@ * * * Return Value: - * nil + * None * * Public: Yes */ #include "script_component.hpp" -private ["_target", "_treatmentClassname", "_config", "_volumeAdded", "_typeOf", "_varName", "_bloodVolume"]; -_target = _this select 0; -_treatmentClassname = _this select 1; +private ["_config", "_volumeAdded", "_typeOf", "_varName", "_bloodVolume"]; +params ["_target", "_treatmentClassname"]; _bloodVolume = _target getvariable [QGVAR(bloodVolume), 100]; if (_bloodVolume >= 100) exitwith {}; diff --git a/addons/medical/functions/fnc_treatmentTourniquet.sqf b/addons/medical/functions/fnc_treatmentTourniquet.sqf index 148ed06252..5d3ba6e1d4 100644 --- a/addons/medical/functions/fnc_treatmentTourniquet.sqf +++ b/addons/medical/functions/fnc_treatmentTourniquet.sqf @@ -10,7 +10,7 @@ * * * Return Value: - * + * Succesful treatment started * * Public: No */ @@ -24,11 +24,11 @@ _selectionName = _this select 2; _className = _this select 3; _items = _this select 4; -if (count _items == 0) exitwith {}; +if (count _items == 0) exitwith {false}; _part = [_selectionName] call FUNC(selectionNameToNumber); if (_part == 0 || _part == 1) exitwith { - // [_caller,"You cannot apply a CAT on this body part!"] call EFUNC(common,sendHintTo); + // ["displayTextStructured", [_caller], ["You cannot apply a CAT on this body part!"]] call EFUNC(common,targetEvent); false; }; @@ -47,4 +47,4 @@ _removeItem = _items select 0; [_target, "activity_view", LSTRING(Activity_appliedTourniquet), [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog); // TODO expand message -true; +true diff --git a/addons/medical/functions/fnc_treatmentTourniquetLocal.sqf b/addons/medical/functions/fnc_treatmentTourniquetLocal.sqf index 5108bf8433..d1ffd34e4b 100644 --- a/addons/medical/functions/fnc_treatmentTourniquetLocal.sqf +++ b/addons/medical/functions/fnc_treatmentTourniquetLocal.sqf @@ -7,16 +7,14 @@ * 1: Item used classname * * Return Value: - * nil + * None * * Public: No */ #include "script_component.hpp" -private ["_target", "_tourniquetItem", "_part", "_tourniquets", "_applyingTo", "_selectionName"]; -_target = _this select 0; -_tourniquetItem = _this select 1; -_selectionName = _this select 2; +private ["_tourniquets", "_part", "_applyingTo"]; +params ["_target", "_tourniquetItem", "_selectionName"]; [_target] call FUNC(addToInjuredCollection); @@ -29,24 +27,21 @@ _tourniquets set[_part, _applyingTo]; _target setvariable [QGVAR(tourniquets), _tourniquets, true]; [{ - private ["_args","_target","_applyingTo","_part", "_tourniquets", "_time"]; - _args = _this select 0; - _target = _args select 0; - _applyingTo = _args select 1; - _part = _args select 2; - _time = _args select 3; + params ["_args", "_idPFH"]; + _args params ["_target", "_applyingTo", "_part", "_time"]; + if (!alive _target) exitwith { - [(_this select 1)] call cba_fnc_removePerFrameHandler; + [_idPFH] call CBA_fnc_removePerFrameHandler; }; _tourniquets = _target getvariable [QGVAR(tourniquets), [0,0,0,0,0,0]]; if !((_tourniquets select _part) == _applyingTo) exitwith { // Tourniquet has been removed - [(_this select 1)] call cba_fnc_removePerFrameHandler; + [_idPFH] call CBA_fnc_removePerFrameHandler; }; if (ACE_time - _time > 120) then { _target setvariable [QGVAR(pain), (_target getvariable [QGVAR(pain), 0]) + 0.005]; }; }, 5, [_target, _applyingTo, _part, ACE_time] ] call CBA_fnc_addPerFrameHandler; -true; +true diff --git a/addons/medical/functions/fnc_treatment_failure.sqf b/addons/medical/functions/fnc_treatment_failure.sqf index 8a5d784301..4aac0eda6a 100644 --- a/addons/medical/functions/fnc_treatment_failure.sqf +++ b/addons/medical/functions/fnc_treatment_failure.sqf @@ -10,21 +10,16 @@ * 4: Items available > * * Return Value: - * nil + * None * * Public: No */ #include "script_component.hpp" -private ["_args", "_caller", "_target","_selectionName","_className","_config","_callback", "_usersOfItems", "_weaponSelect", "_lastAnim"]; - -_args = _this select 0; -_caller = _args select 0; -_target = _args select 1; -_selectionName = _args select 2; -_className = _args select 3; -_usersOfItems = _args select 5; +private ["_config", "_callback", "_weaponSelect", "_lastAnim"]; +params ["_args"]; +_args params ["_caller", "_target", "_selectionName", "_className", "_items", "_usersOfItems"]; if (primaryWeapon _caller == "ACE_FakePrimaryWeapon") then { _caller removeWeapon "ACE_FakePrimaryWeapon"; @@ -33,14 +28,15 @@ if (vehicle _caller == _caller) then { _lastAnim = _caller getvariable [QGVAR(treatmentPrevAnimCaller), ""]; //Don't play another medic animation (when player is rapidily treating) TRACE_2("Reseting to old animation", animationState player, _lastAnim); - switch (true) do { - case (_lastAnim == "AinvPknlMstpSlayWrflDnon_medic"): {_lastAnim = "AmovPknlMstpSrasWrflDnon"}; - case (_lastAnim == "AinvPpneMstpSlayWrflDnon_medic"): {_lastAnim = "AmovPpneMstpSrasWrflDnon"}; - case (_lastAnim == "AinvPknlMstpSlayWnonDnon_medic"): {_lastAnim = "AmovPknlMstpSnonWnonDnon"}; - case (_lastAnim == "AinvPpneMstpSlayWpstDnon_medic"): {_lastAnim = "AinvPpneMstpSlayWpstDnon"}; - case (_lastAnim == "AinvPknlMstpSlayWpstDnon_medic"): {_lastAnim = "AmovPknlMstpSrasWpstDnon"}; + switch (toLower _lastAnim) do { + case "ainvpknlmstpslaywrfldnon_medic": {_lastAnim = "AmovPknlMstpSrasWrflDnon"}; + case "ainvppnemstpslaywrfldnon_medic": {_lastAnim = "AmovPpneMstpSrasWrflDnon"}; + case "ainvpknlmstpslaywnondnon_medic": {_lastAnim = "AmovPknlMstpSnonWnonDnon"}; + case "ainvppnemstpslaywpstdnon_medic": {_lastAnim = "AinvPpneMstpSlayWpstDnon"}; + case "ainvpknlmstpslaywpstdnon_medic": {_lastAnim = "AmovPknlMstpSrasWpstDnon"}; }; - [_caller, _lastAnim, 1] call EFUNC(common,doAnimation); + + [_caller, _lastAnim, 2] call EFUNC(common,doAnimation); }; _caller setvariable [QGVAR(treatmentPrevAnimCaller), nil]; @@ -57,8 +53,9 @@ if ((_weaponSelect params [["_previousWeapon", ""]]) && {(_previousWeapon != "") }; { - (_x select 0) addItem (_x select 1); -}foreach _usersOfItems; + _x params ["_unit", "_item"]; + _unit addItem _item; +} foreach _usersOfItems; // Record specific callback _config = (configFile >> "ACE_Medical_Actions" >> "Basic" >> _className); @@ -67,10 +64,10 @@ if (GVAR(level) >= 2) then { }; _callback = getText (_config >> "callbackFailure"); -if (isNil _callback) then { - _callback = compile _callback; +_callback = if (isNil _callback) then { + compile _callback } else { - _callback = missionNamespace getvariable _callback; + missionNamespace getvariable _callback }; _args call _callback; diff --git a/addons/medical/functions/fnc_treatment_success.sqf b/addons/medical/functions/fnc_treatment_success.sqf index f5cb9baf71..c2347c59ee 100644 --- a/addons/medical/functions/fnc_treatment_success.sqf +++ b/addons/medical/functions/fnc_treatment_success.sqf @@ -10,19 +10,16 @@ * 4: Items available > * * Return Value: - * nil + * None * * Public: No */ #include "script_component.hpp" -private ["_args", "_caller", "_target","_selectionName","_className","_config","_callback", "_weaponSelect", "_lastAnim"]; -_args = _this select 0; -_caller = _args select 0; -_target = _args select 1; -_selectionName = _args select 2; -_className = _args select 3; +private ["_config", "_callback", "_weaponSelect", "_lastAnim"]; +params ["_args"]; +_args params ["_caller", "_target", "_selectionName", "_className", "_items", "_usersOfItems"]; if (primaryWeapon _caller == "ACE_FakePrimaryWeapon") then { _caller removeWeapon "ACE_FakePrimaryWeapon"; @@ -31,14 +28,15 @@ if (vehicle _caller == _caller) then { _lastAnim = _caller getvariable [QGVAR(treatmentPrevAnimCaller), ""]; //Don't play another medic animation (when player is rapidily treating) TRACE_2("Reseting to old animation", animationState player, _lastAnim); - switch (true) do { - case (_lastAnim == "AinvPknlMstpSlayWrflDnon_medic"): {_lastAnim = "AmovPknlMstpSrasWrflDnon"}; - case (_lastAnim == "AinvPpneMstpSlayWrflDnon_medic"): {_lastAnim = "AmovPpneMstpSrasWrflDnon"}; - case (_lastAnim == "AinvPknlMstpSlayWnonDnon_medic"): {_lastAnim = "AmovPknlMstpSnonWnonDnon"}; - case (_lastAnim == "AinvPpneMstpSlayWpstDnon_medic"): {_lastAnim = "AinvPpneMstpSlayWpstDnon"}; - case (_lastAnim == "AinvPknlMstpSlayWpstDnon_medic"): {_lastAnim = "AmovPknlMstpSrasWpstDnon"}; + switch (toLower _lastAnim) do { + case "ainvpknlmstpslaywrfldnon_medic": {_lastAnim = "AmovPknlMstpSrasWrflDnon"}; + case "ainvppnemstpslaywrfldnon_medic": {_lastAnim = "AmovPpneMstpSrasWrflDnon"}; + case "ainvpknlmstpslaywnondnon_medic": {_lastAnim = "AmovPknlMstpSnonWnonDnon"}; + case "ainvppnemstpslaywpstdnon_medic": {_lastAnim = "AinvPpneMstpSlayWpstDnon"}; + case "ainvpknlmstpslaywpstdnon_medic": {_lastAnim = "AmovPknlMstpSrasWpstDnon"}; }; - [_caller, _lastAnim, 1] call EFUNC(common,doAnimation); + + [_caller, _lastAnim, 2] call EFUNC(common,doAnimation); }; _caller setvariable [QGVAR(treatmentPrevAnimCaller), nil]; diff --git a/addons/medical/functions/fnc_unconsciousPFH.sqf b/addons/medical/functions/fnc_unconsciousPFH.sqf index 5b1ca04d2d..0e8c424ca3 100644 --- a/addons/medical/functions/fnc_unconsciousPFH.sqf +++ b/addons/medical/functions/fnc_unconsciousPFH.sqf @@ -13,21 +13,17 @@ * 1: PFEH ID * * ReturnValue: - * nil + * None * * Public: yes */ - #include "script_component.hpp" private ["_unit", "_minWaitingTime", "_slotInfo", "_hasMovedOut", "_parachuteCheck", "_args", "_originalPos", "_startingTime", "_awakeInVehicleAnimation", "_oldVehicleAnimation", "_vehicle"]; -_args = _this select 0; -_unit = _args select 0; -_originalPos = _args select 1; -_startingTime = _args select 2; -_minWaitingTime = _args select 3; -_hasMovedOut = _args select 4; -_parachuteCheck = _args select 5; +params ["_args", "_idPFH"]; +_args params ["_unit", "_originalPos", "_startingTime", "_minWaitingTime", "_hasMovedOut", "_parachuteCheck"]; + +TRACE_6("ACE_DEBUG_Unconscious_PFH",_unit, _originalPos, _startingTime, _minWaitingTime, _hasMovedOut, _parachuteCheck); if (!alive _unit) exitwith { if ("ACE_FakePrimaryWeapon" in (weapons _unit)) then { @@ -45,11 +41,14 @@ if (!alive _unit) exitwith { [_unit, "isUnconscious"] call EFUNC(common,unmuteUnit); ["medical_onUnconscious", [_unit, false]] call EFUNC(common,globalEvent); - [(_this select 1)] call cba_fnc_removePerFrameHandler; + TRACE_3("ACE_DEBUG_Unconscious_Exit",_unit, (!alive _unit) , QGVAR(unconscious)); + + [_idPFH] call CBA_fnc_removePerFrameHandler; }; // In case the unit is no longer in an unconscious state, we are going to check if we can already reset the animation if !(_unit getvariable ["ACE_isUnconscious",false]) exitwith { + TRACE_7("ACE_DEBUG_Unconscious_PFH",_unit, _args, [_unit] call FUNC(isBeingCarried), [_unit] call FUNC(isBeingDragged), _idPFH, _unit getvariable QGVAR(unconsciousArguments),animationState _unit); // TODO, handle this with carry instead, so we can remove the PFH here. // Wait until the unit isn't being carried anymore, so we won't end up with wierd animations if !(([_unit] call FUNC(isBeingCarried)) || ([_unit] call FUNC(isBeingDragged))) then { @@ -57,7 +56,7 @@ if !(_unit getvariable ["ACE_isUnconscious",false]) exitwith { TRACE_1("Removing fake weapon [on wakeup]",_unit); _unit removeWeapon "ACE_FakePrimaryWeapon"; }; - + if (vehicle _unit == _unit) then { if (animationState _unit == "AinjPpneMstpSnonWrflDnon") then { [_unit,"AinjPpneMstpSnonWrflDnon_rolltofront", 2] call EFUNC(common,doAnimation); @@ -99,7 +98,7 @@ if !(_unit getvariable ["ACE_isUnconscious",false]) exitwith { ["medical_onUnconscious", [_unit, false]] call EFUNC(common,globalEvent); // EXIT PFH - [(_this select 1)] call cba_fnc_removePerFrameHandler; + [_idPFH] call CBA_fnc_removePerFrameHandler; }; if (!_hasMovedOut) then { // Reset the unit back to the previous captive state. @@ -130,13 +129,15 @@ if (_parachuteCheck) then { }; if (!local _unit) exitwith { + TRACE_6("ACE_DEBUG_Unconscious_PFH",_unit, _args, _startingTime, _minWaitingTime, _idPFH, _unit getvariable QGVAR(unconsciousArguments)); _args set [3, _minWaitingTime - (ACE_time - _startingTime)]; _unit setvariable [QGVAR(unconsciousArguments), _args, true]; - [(_this select 1)] call cba_fnc_removePerFrameHandler; + [_idPFH] call CBA_fnc_removePerFrameHandler; }; // Ensure we are waiting at least a minimum period before checking if we can wake up the unit again, allows for temp knock outs if ((ACE_time - _startingTime) >= _minWaitingTime) exitwith { + TRACE_2("ACE_DEBUG_Unconscious_Temp knock outs",_unit, [_unit] call FUNC(getUnconsciousCondition)); if (!([_unit] call FUNC(getUnconsciousCondition))) then { _unit setvariable ["ACE_isUnconscious", false, true]; }; diff --git a/addons/medical/functions/fnc_useItem.sqf b/addons/medical/functions/fnc_useItem.sqf index 750ea0452f..770d8b6ea7 100644 --- a/addons/medical/functions/fnc_useItem.sqf +++ b/addons/medical/functions/fnc_useItem.sqf @@ -8,17 +8,16 @@ * 2: Item * * ReturnValue: - * + * 0: success + * 1: Unit * * Public: Yes */ #include "script_component.hpp" -private ["_medic", "_patient", "_item", "_return","_crew"]; -_medic = _this select 0; -_patient = _this select 1; -_item = _this select 2; +private ["_return","_crew"]; +params ["_medic", "_patient", "_item"]; if (isnil QGVAR(setting_allowSharedEquipment)) then { GVAR(setting_allowSharedEquipment) = true; @@ -42,7 +41,7 @@ if ([vehicle _medic] call FUNC(isMedicalVehicle) && {vehicle _medic != _medic}) _return = [true, _x]; [[_x, _item], QUOTE(EFUNC(common,useItem)), _x] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ }; - }foreach _crew; + } foreach _crew; }; -_return; +_return diff --git a/addons/medical/functions/fnc_useItems.sqf b/addons/medical/functions/fnc_useItems.sqf index fbaa324022..0d937c0938 100644 --- a/addons/medical/functions/fnc_useItems.sqf +++ b/addons/medical/functions/fnc_useItems.sqf @@ -8,7 +8,7 @@ * 2: Items > * * ReturnValue: - * + * None * * Public: Yes */ @@ -16,9 +16,7 @@ #include "script_component.hpp" private ["_medic", "_patient", "_items", "_itemUsedInfo", "_itemsUsedBy"]; -_medic = _this select 0; -_patient = _this select 1; -_items = _this select 2; +params ["_medic", "_patient", "_items"]; _itemsUsedBy = []; { @@ -27,7 +25,7 @@ _itemsUsedBy = []; { _itemUsedInfo = [_medic, _patient, _x] call FUNC(useItem); if (_itemUsedInfo select 0) exitwith { _itemsUsedBy pushback [(_itemUsedInfo select 1), _x]}; - }foreach _x; + } foreach _x; }; // handle required item @@ -35,6 +33,6 @@ _itemsUsedBy = []; _itemUsedInfo = [_medic, _patient, _x] call FUNC(useItem); if (_itemUsedInfo select 0) exitwith { _itemsUsedBy pushback [(_itemUsedInfo select 1), _x]}; }; -}foreach _items; +} foreach _items; [count _items == count _itemsUsedBy, _itemsUsedBy]; diff --git a/addons/medical/stringtable.xml b/addons/medical/stringtable.xml index b852c27f96..13e2e32e38 100644 --- a/addons/medical/stringtable.xml +++ b/addons/medical/stringtable.xml @@ -762,7 +762,7 @@ Erhalte IV [%1ml] Reciviendo IV [%1ml] Принимается переливание [%1 мл] - Otrzymywanie IV [%1ml] + Otrzymywanie IV [pozostało %1ml] Transfusion en IV [%1ml] Přijímání transfúze [%1ml] Infúzióra kötve [%1ml] @@ -786,7 +786,7 @@ Для перевязки ран Utilizado para cubrir una herida Utilisé pour couvrir une blessure - Używany w celu przykrycia i ochrony miejsca zranienia + Używany w celu przykrycia i ochrony miejsca zranienia. Najczęściej stosowany bandaż na otarcia i draśnięcia. Verwendet um Wunden abzudecken Sebesülések befedésére alkalmas Usato per coprire una ferita @@ -823,7 +823,7 @@ Для тампонирования ран среднего и большого размера и остановки кровотечения. Se utiliza para vendar heridas medianas o grandes y detener el sangrado Utilisé pour couvrir des blessures de taille moyenne à grande. Arrête l'hémorragies - Używany w celu opatrywania średnich i dużych ran oraz tamowania krwawienia. + Używany w celu opatrywania średnich i dużych ran oraz tamowania krwawienia. Dobrze radzi sobie z tamowaniem ran płatowych oraz postrzałowych. Közepestől nagyig terjedő sebek betakarására és vérzés elállítására használt kötszer Usato su ferite medie o larghe per fermare emorragie. Usado para o preenchimento de cavidades geradas por ferimentos médios e grandes e estancar o sangramento. @@ -859,7 +859,7 @@ Давящая повязка Kit de vendaje (Elástico) Bandage compressif élastique - Zestaw bandaży elastycznych. + Bandaż elastyczny służy do opatrywania ran ciętych oraz kłutych. Dobrze radzi sobie również ze zgniecieniami tkanek miękkich oraz rozerwaniami powierzchni skóry. Rugalmas kötszercsomag, "rögzítő" Kit di bendaggio, elastico Kit de Bandagem, Elástica @@ -894,7 +894,7 @@ Замедляет кровопотерю при кровотечении Reduce la velocidad de pérdida de sangre Ralentit le saignement - Zmniejsza ubytek krwi z kończyn w przypadku krwawienia. + Zmniejsza ubytek krwi z kończyn w przypadku krwawienia. Nie może być noszony zbyt długo ze względu na narastający ból z kończyny. Verringert den Blutverlust während einer Blutung Lelassítja a vérvesztést vérzés esetén Rallenta la perdita di sangue in caso di sanguinamento @@ -931,7 +931,7 @@ Для снятия средних и сильных болевых ощущений Usado para combatir los estados dolorosos de moderados a severos Utilisé pour réduire les douleurs modérées à sévères. - Morfina. Ma silne działanie przeciwbólowe. + Morfina. Ma silne działanie przeciwbólowe. Powoduje spowolnienie tętna oraz rozrzedzenie krwi, zwiększając tym samym ciśnienie tętnicze krwi. Działa przez ok. 15 minut. Mérsékelttől erős fájdalomig, ellene alkalmazandó termék Usato per combattere il dolore. Usado para combater dores moderadas e severas @@ -950,7 +950,7 @@ Analgetikum slouží k tlumení středně těžkých a těžkých bolestí - Atropin autoinjector + Atropine autoinjector Атропин в пневмошприце Atropina auto-inyectable Auto-injecteur d'Atropine @@ -1002,7 +1002,7 @@ Стимулирует работу сердца и купирует аллергические реакции Aumenta la frecuencia cardiaca y contraresta los efectos de las reacciones alérgicas Augmente la fréquence cadiaque et annule les effets d'une réaction anaphylactique - Adrenalina. Zwiększa puls i przeciwdziała efektom wywołanym przez reakcje alergiczne + Adrenalina. Przyśpiesza tętno oraz zwiększa ciśnienie krwi a także przeciwdziała efektom wywołanym przez reakcje alergiczne. Steigert die Herzfrequenz und bekämpft Symptome von allergischen Reaktionen. Növeli a szívverést és ellenzi az allergiás reakciók hatásait Aumenta il battito cardiaco e combatte gli effetti di reazioni allergiche. @@ -1098,7 +1098,7 @@ Пакет крови для возмещения объёма потерянной крови (хранить в холодильнике) Sangre intravenosa, para restarurar el volumen sanguíneo (mantener frío) Cullot sanguin O- ,utiliser seulement lors de perte sanguine majeur afin de remplacer le volume sanguin perdu. Habituelment utiliser lors du transport ou dans un etablisement de soin. - Krew IV, używana do uzupełnienia krwi u pacjenta, trzymać w warunkach chłodniczych + Krew IV, używana do uzupełnienia krwi u pacjenta, trzymać w warunkach chłodniczych. Vér-infúzió, intravénás bejuttatásra egy páciensnek (hidegen tárolandó) Sangue usato per ripristinare pazienti in cui si è verificata una perdita di sangue (conservare al fresco) Blut IV, Bluthaushalt des Patienten wiederherstellen. (Kühl halten) @@ -1158,7 +1158,7 @@ Пакет физраствора для возмещения объёма потерянной крови Solución salina intravenosa, para restaurar el volumen sanguíneo Solution saline 0.9% IV, pour rétablir temporairement la tension artérielle - Sól fizjologiczna, podawana dożylnie (IV), używana w celu uzupełnienia krwi u pacjenta + Używany w medycynie w formie płynu infuzyjnego jako środek nawadniający i uzupełniający niedobór elektrolitów, podawany dożylnie (IV). 0,9%-os sósvíz-infúzió, a páciens vérmennyiségének helyreállítására Soluzione salina, usata per ripristinare sangue nei pazienti. Kochsalzlösung, ein medizinisches Volumenersatzmittel @@ -1206,7 +1206,7 @@ Первичный перевязочный пакет (QuikClot) Vendaje básico (QuickClot) Bandage basique (Hémostatique) - Podstawowy pakiet opatrunkowy (QuikClot) + Opatrunek QuikClot ACS Verbandpäckchen(Gerinnungsmittel) Általános zárókötszer (QuikClot) Bendaggio emostatico (QuikClot) @@ -1218,7 +1218,7 @@ Гемостатический пакет QuikClot Vendaje QuikClot Bandage hémostatique - Hemostatyczny pakiet QuikClot. Podstawowy opatrunek stosowany na rany. + Proszkowy opatrunek adsorbcyjny przeznaczony do tamowania zagrażających życiu krwawień średniej i dużej intensywności. Bandage mit Gerinnungsmittel QuikClot kötszer Bendaggio emostatico (QuikClot) @@ -1243,7 +1243,7 @@ Trousse de premiers soins Equipo de primeros auxilios Apteczka osobista - Persönliches Verbandpäckchen + Persönliches Erste-Hilfe-Set Elsősegélycsomag Pronto soccorso personale Kit De Primeiros Socorros Pessoal @@ -1254,7 +1254,7 @@ Содержит различные материалы и инструменты для зашивания ран и оказания специальной медпомощи. Incluye material médico para tratamientos avanzados Inclue du matériel medical pour les traitements avancés, tel les points de suture. - Zestaw środków medycznych do opatrywania ran i dodatkowego leczenia po-urazowego + Zestaw środków medycznych do opatrywania ran i dodatkowego leczenia po-urazowego. Beinhaltet medizinisches Material für fortgeschrittene Behandlung und zum Nähen. Változatos segédfelszereléseket tartalmaz sebvarráshoz és haladó elsősegélynyújtáshoz Include vario materiale medico per trattamenti avanzati. @@ -1265,7 +1265,7 @@ Personal Aid Kit for in field stitching or advanced treatment W znacznym stopniu poprawia stan pacjenta Полевая аптчека для продвинутого лечения и зашивания ран - Persönliches Verbandspäckchen zum ambulanten Nähen und fortgeschrittener Behandlung. + Persönliches Erste-Hilfe-Set zum ambulanten Nähen und fortgeschrittener Behandlung. Trousse de premiers soins pour coudre sur le terrain et traitements avancés. Equipo de primeros auxilios para sutura de campaña o tratamientos avanzados Elsősegélycsomag, terepen való sebvarráshoz és haladó ellátáshoz @@ -1275,7 +1275,7 @@ Use Personal Aid Kit - Verbandpäckchen benutzen + Erste-Hilfe-Set benutzen Использовать аптечку Utiliser la Trousse de premier soins Użyj apteczki osobistej @@ -1593,6 +1593,8 @@ Keine Žádný Nada + Aucun + Nincs Weak @@ -2043,7 +2045,7 @@ Colocando cuerpo en bolsa para cadáveres Упаковка тела ... Verstaue Körper in Leichensack - Pakowanie ciała do worka na zwłoki + Pakowanie ciała do worka na zwłoki ... Placement du corps dans la housse Test hullazsákba helyezése ... Stai mettendo il corpo nella sacca @@ -2055,7 +2057,7 @@ %1 has vendado al paciente %1 перевязал пациента %1 hat den Patienten verbunden - %1 zabandażował pacjenta + %1 założył bandaż %1 a pansé le patient %1 bekötözte a pácienst %1 ha bendato il paziente @@ -2098,6 +2100,16 @@ %1 aplicou um torniquete %1 použil škrtidlo + + %1 performed CPR + %1 wykonał cykl RKO + %1 провел сердечно-легочную реанимацию + %1 realicó RCP + + + %1 used Personal Aid Kit + %1 użył apteczki + Heavily wounded Schwer verwundet: @@ -2207,12 +2219,10 @@ Perna Direita - Bandaging removes bloodstains - Bandagieren entfernt Blutflecken - Bandażowanie usuwa ślady krwi - Obvázání odstraňuje skvrny od krve - El vendaje elimina las manchas de sangre - Bandagem remove manchas de sangue + Heal fully bandaged hitpoints + Lecz w pełni zabandażowane hitpointy + Curar miembros totalmente vendados + Исцелять полностью перебинтованные части тела Pain is only temporarily suppressed @@ -2221,6 +2231,9 @@ Bolest je potlačena pouze dočasně El dolor se suprime solo temporalmente Dor é suprimida somente temporáriamente + La douleur est seulement supprimée temporairement + A fájdalom csak ideiglenesen csökken + Боль приглушается только временно Pain Effect Type @@ -2706,7 +2719,7 @@ Treating ... Behandeln ... Ellátás ... - Leczenie ... + Opatrywanie ran ... Traitement ... Лечение ... Tratando ... @@ -2734,15 +2747,19 @@ ACE-Medicsystem ACE Zdravotnické ACE Médico + ACE Médical + ACE Orvosi Rendszer Medical Settings [ACE] Настройки медицины [ACE] - Ustawienia medyczne [ACE] + Ustawienia medyczne Ajustes médicos [ACE] Medizinische Einstellungen [ACE] Lékařské nastavení [ACE] Ajustes médicos [ACE] + Option médicale [ACE] + Orvosi beállítások [ACE] Medical Level @@ -2752,6 +2769,8 @@ Medizinisches Level Úroveň medického Nível médico + Niveau de simulation médicale + Orvosi szint What is the medical simulation level? @@ -2761,6 +2780,8 @@ Wie hoch soll das medizinische Simulationslevel sein? Jaká je úroveň lékařské simulace? Qual o nível de simulação médica? + Quel niveau de simulation médicale choisissez vous? + Milyen komplex legyen az orvosi szimuláció? Basic @@ -2770,6 +2791,8 @@ Standard Základní Básica + Basique + Alap Advanced @@ -2779,6 +2802,8 @@ Erweitert Pokročilé Avançada + Avancée + Fejlett Medics setting @@ -2788,6 +2813,8 @@ Medizinische Einstellungen Úroveň zdravotníků Configuração médica + Paramètre des infirmiers + Orvosok beállítása What is the level of detail prefered for medics? @@ -2796,6 +2823,8 @@ ¿Cuál es el nivel de detalle preferido para los médicos? Jaká úroveň detailů je preferována pro zdravotníky? Qual o nível de detalhe preferido para os médicos? + Quel niveau de détail voullez vous pour les infirmier? + Mi a javasolt részletesség orvosok számára? Disable medics @@ -2805,6 +2834,8 @@ Sanitäter deaktivieren Zakázat zdravotníky Desativar médicos + Désactiver les infirmiers + Orvosok letiltása Enable Litter @@ -2814,6 +2845,8 @@ Abfälle aktivieren Povolit odpadky Ativar lixo médico + Activer les détritus + Szemét engedélyezése Enable litter being created upon treatment @@ -2823,6 +2856,8 @@ Aktiviere Abfälle, wenn eine Behandlung durchgeführt wurde Vytváří odpad zdravotnického materiálu pří léčení Ativar lixo ser criado após tratamento + Activer la création de détrimus au début des traitements + Engedélyezi a szemét keletkezését ellátáskor Life time of litter objects @@ -2832,6 +2867,8 @@ Dauer des angezeigten Abfalls Životnost pro odpadky Tempo de vida dos objetos do lixo + Durée d'affichage des détritus + Szemétobjektumok élettartama How long should litter objects stay? In seconds. -1 is forever. @@ -2841,6 +2878,8 @@ Wie lange sollen Abfälle am Boden liegen (in Sekunden)? -1 ist für immer. Za jak dlouho začnou odpadky mizet? V sekundách. -1 navždy. Quanto tempo os objetos do lixo devem ficar? Em segundos. -1 é para sempre. + Combien de temps doivent rester affiché les détritus? En secondes. -1 pour tout le temps + Milyen sokáig legyenek jelen a szemétobjektumok (másodpercben)? A -1 végtelen időt jelent. Enable Screams @@ -2850,6 +2889,8 @@ Schreie aktivieren Povolit křik Ativar gritos + Activer les hurlements + Kiáltások engedélyezése Enable screaming by injuried units @@ -2859,6 +2900,8 @@ Aktiviere Schreie bei verletzten Einheiten Povolit křičení zraněných jednotek Ativa gritos para unidades feridas + Active les hurlements d'unités blessées + Engedélyezi a sérült egységek kiáltásait Player Damage @@ -2868,6 +2911,8 @@ Spielerschaden Poškození hráče Dano do jogador + Dégats des joueurs + Játékos sérülés What is the damage a player can take before being killed? @@ -2877,6 +2922,8 @@ Wie viel Schaden kann ein Spieler erleiden, bevor er getötet wird? Jaké poškození může hráč dostat než bude zabit? Qal é o dano que um jogador pode sofrer antes de morrer? + Quels dégats peut subir un joueur avant d'être tué + Mennyi sérülést szenvedhet el egy játékos, mielőtt meghal? AI Damage @@ -2886,6 +2933,8 @@ KI-Schaden Poškození AI Dano da IA + Dégats des IA + AI sérülés What is the damage an AI can take before being killed? @@ -2895,6 +2944,8 @@ Wie viel Schaden kann eine KI erleiden, bis sie getötet wird? Jaké poškození může AI dostat než bude zabito? Qual é o dano que uma IA pode sofrer antes de morrer? + Quels dégats peut subir une IA avant d'être tuée + Mennyi sérülést szenvedhet el egy AI, mielőtt meghal? AI Unconsciousness @@ -2904,6 +2955,8 @@ KI-Bewusstlosigkeit Bezvědomí AI Inconsciência da IA + Inconscience des IA + AI eszméletlenség Allow AI to go unconscious @@ -2913,6 +2966,8 @@ KI kann bewusstlos werden Umožňuje AI upadnout do bezvědomí Permite IA ficar inconsciente + Autoriser les IA à tomber inconsciente + Engedélyezi az AI eszméletének elvesztését Remote Controlled AI @@ -2920,6 +2975,9 @@ IA controlada remotamente Zdalnie sterowane AI Vzdáleně ovládané AI + Contrôle à distance des IA + Távvezérelt AI + Зевса считать ботом Treat remote controlled units as AI not players? @@ -2927,15 +2985,20 @@ Tratar unidades remotamente controladas como IA? Traktuj jednostki zdalnie sterowane (przez Zeusa) jako AI, nie jako graczy? Ošetřit vzdáleně ovládané jednotky jako AI, ne jako hráče? + Soigner les unitées controlées à distance comme des IA et non comme des joueurs? + Távvezérelt egységek AI-ként, nem játékosként való kezelése? + Обрабатывать дистанционно управляемых юнитов как ботов, а не как игроков? Prevent instant death - Отключить мгновенную смерть + Откл. мгновенную смерть Wył. natychmiast. śmierć Prevenir muerte instantánea Verhindere direkten Tod Zabránit okamžité smrti Previnir morte instantânea + Empêcher la morte instantanée + Azonnali halál kiiktatása Have a unit move to unconscious instead of death @@ -2945,24 +3008,30 @@ Lässt eine Einheit bewusstlos werden anstatt zu sterben Jednotka upadne do bezvědomí namísto smrti Fazer a unidade ficar inconsciente invés de morrer + Forcer l'inconscience au lieu de la mort instantanée + Egy egység kerüljön eszméletlen állapotba a halott helyett Bleeding coefficient - Коэффициент потери крови + Коэффициент кровопотери Mnożnik krwawienia Coeficiente de sangrado Verblutungsmultiplikator Koeficient krvácení Coeficiente de sangramento + Coefficient de saignement + Vérzési koefficiens Coefficient to modify the bleeding speed - Коэффициент, изменяющий скорость кровопотери + Коэффициент, изменяющий скорость потери крови Mnożnik modyfikujący prędkość wykrwawiania się Coeficiente para modificar la velocidad de sangrado Multiplikator um die Verblutungsgeschwindigkeit zu verändern Koeficient rychlosti krvácení Coeficiente para modificar a velocidade do sangramento + Coefficient modifiant la vitesse de saignement + Egy szorzó a vérzés sebességének szabályozására Pain coefficient @@ -2972,6 +3041,8 @@ Schmerzmultiplikator Koeficient bolesti Coeficiente de dor + Coefficient de douleur + Fájdalmi koefficiens Coefficient to modify the pain intensity @@ -2981,6 +3052,8 @@ Multiplikator um den Schmerzintensität zu verändern Koeficient intenzity bolesti Coeficiente para modificar a instensidade de dor + Coefficient modifiant l'intensité de la douleur + Egy szorzó a fájdalom erősségének szabályozására Sync status @@ -2990,6 +3063,8 @@ Status synchronisieren Synchronizovat status Sincronizar estado + Status de la synchronisation + Szinkronizációs állapot Keep unit status synced. Recommended on. @@ -2999,6 +3074,8 @@ Status der Einheit synchron halten. Sollte aktiviert bleiben. Udržuje status jednotky synchronizovaný. Doporučeno zapnout. Mater o estado da unidade sincronizado. Recomendado ativado. + Garder l'unité synchronisée, Recommandé sur oui. + Egységállapotok szinkronizálása. Javasolt a bekapcsolása. Provides a medical system for both players and AI. @@ -3008,15 +3085,19 @@ Aktiviert ein medizinisches System für Spieler und KI. Poskytuje zdravotní systém pro hráče a AI. Proporciona o sistema médico para os jogadores e a IA. + Fourni un système médical pour les joueurs tout comme pour les IA. + Egy orvosi rendszert ad játékosok és AI-k számára. Advanced Medical Settings [ACE] Настройки усложненной медицины [ACE] - Zaawansowane ustawienia medyczne [ACE] + Zaawansowane ustawienia medyczne Ajustes médicos avanzados [ACE] Erweiterte medizinische Einstellungen [ACE] Pokročilé zdravotnické nastavení [ACE] Ajustes médicos avançados [ACE] + Paramètres des soins avancés + Fejlett orvosi beállítások [ACE] Enabled for @@ -3026,6 +3107,8 @@ Aktiviert für Povoleno pro Habilitado para + Activer pour + Engedélyezve... Select what units the advanced medical system will be enabled for @@ -3035,6 +3118,8 @@ Wähle aus welche Einheiten das erweiterte medizinische System haben Vyberte, pro jaké jednotky bude pokročilý zdravotní systém povolen Selecione quais unidades o sistema médico avançado será habilitado + Sélectionne pour quelle unité le système de soin avancé est activé + Kiválasztható, mely egységek számára legyen engedélyezve a fejlett orvosi rendszer Players only @@ -3044,6 +3129,8 @@ Nur Spieler Pouze hráči Somente jogadores + Joueur uniquement + Csak játékosok Players and AI @@ -3053,15 +3140,19 @@ Spieler und KI Hráči a AI Jogadores e IA + Joueur et IA + Játékosok és AI Enable Advanced wounds - Включить усложненные ранения + Усложненные раны Akt. zaawansowane rany Activa heridas avanzadas Aktiviere erweiterte Wunden Povolit pokročilé zranění Ativar ferimentos avançados + Activer les blessures avancées + Komplex sebek engedélyezése Allow reopening of bandaged wounds? @@ -3071,6 +3162,8 @@ Erlaube das Öffnen von bandagierten Wunden? Umožnit znovuotevření zavázané rány? Permitr reabertura de ferimentos enfaixados? + Permettre la réouverture des bandages + Visszanyílhatnak a bekötözött sebek? Vehicle Crashes @@ -3080,6 +3173,8 @@ Fahrzeugunfälle Poškození z kolize Batidas de veículos + Accident en véhicule + Járműbalesetek Do units take damage from a vehicle crash? @@ -3089,24 +3184,30 @@ Bekommen Einheiten von Fahrzeugunfällen Schaden? Dostane jednotka poškození při autonehodě? As unidades recebem dano de uma batida de veículo? + Les unités subissent des dégats lors d'accident + Sérülnek-e az egységek autós ütközés során? Allow PAK Использование аптечки Ust. apteczek osobistych Permitir EPA - Erlaube Erstehilfekasten + Erlaube Erste-Hilfe-Set Povolit osobní lékárničky Permitir Kit de Primeiros Socorros + Permettre le kit de premier secours + Elsősegélycsomag engedélyezése Who can use the PAK for full heal? Кому разрешено выполнять полное лечение с помощью аптечки? Kto może skorzystać z apteczki osobistej w celu pełnego uleczenia? ¿Quién puede utilizar el EPA para una cura completa? - Wer kann den Erstehilfekasten für eine Endheilung verwenden? + Wer kann das Erste-Hilfe-Set für eine Endheilung verwenden? Kdo může použít osobní lékárničku pro plné vyléčení? Quem pode usar o KPS para cura completa? + Qui peut utilier les kit de premier secours pour soigner + Ki használhatja az elsősegélycsomagot teljes gyógyításra? Anyone @@ -3116,6 +3217,8 @@ Jeder Kdokoliv Qualquer um + Tout le monde + Akárki Medics only @@ -3125,6 +3228,8 @@ Nur Sanitäter Pouze zdravotník Somente médicos + Infirmier uniquement + Csak orvosok Doctors only @@ -3134,54 +3239,72 @@ Nur Ärzte Pouze doktor Somente doutores + Médecin uniquement + Csak doktorok Remove PAK on use Удалять аптечки после использования Usuń apteczkę po użyciu Eliminar EPA después del uso - Entferne Erstehilfekasten bei Verwendung + Entferne Erste-Hilfe-Set bei Verwendung Odebrat osobní lékárničku po použití Remover o KPS depois do uso + Enlever le KPS à l'utilisation + Elsősegélycsomag eltávolítása használatkor Should PAK be removed on usage? Нужно ли удалять аптечки после использования? Czy apteczka osobista powinna zniknąć z ekwipunku po jej użyciu? El EPA será eliminado después de usarlo - Sollen Erstehilfekästen bei Verwendung entfernt werden? + Sollen Erste-Hilfe-Sets bei Verwendung entfernt werden? Má se osobní lékárnička odstranit po použití? Deve o KPS ser removido depois do uso? + Le Kit de Premier Secours doit il être enlevé à l'utilisation? + Eltávolítódjon az elsősegélycsomag használatkor? Locations PAK Место использования аптечки Ogr. apteczek osobistych Ubicacions del EPA - Orte für Erstehilfekasten + Orte für Erste-Hilfe-Set Lokace osobní lékárničky Localizações do KPS + Lieu d'utilisation du KPS + Elsősegélycsomag helyek Where can the Personal Aid Kit be used? Где может использоваться аптечка? Gdzie można korzystać z apteczek osobistych? ¿Dónde se puede utilizar el equipo de primeros auxilios? - Wo kann der Erstehilfekasten verwendet werden? + Wo kann das Erste-Hilfe-Set verwendet werden? Kde může být použita osobní lékárnička? Onde o kit de primeiros socorros pode ser utilizado? + Où le Kit de Premier Secour peut être utilisé + Hol lehet az elsősegélycsomagot használni? Condition PAK Podmínka osobní lékárničky Condición EPA + Condition d'utilisation du KPS Warunek apteczek + Elsősegélycsomag állapot + Condição do KPS + Условие использования аптечки When can the Personal Aid Kit 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 Po spełnieniu jakich warunków apteczka osobista może zostać zastosowana na pacjencie? + Mikor lehet az elsősegélycsomagot használni? + Onde o kit de primeiros socorros pode ser utilizado? + Когда может использоваться аптечка? Anywhere @@ -3191,6 +3314,8 @@ Überall Kdekoliv Qualquer lugar + PArtout + Akárhol Medical vehicles @@ -3200,6 +3325,8 @@ Medizinische Fahrzeuge Zdravotnická vozidla Veículos médcos + Dans les véhicules médicals + Orvosi járművek Medical facility @@ -3209,6 +3336,8 @@ Medizinische Einrichtungen Zdravotnické zařízení Instalação médica + Dans les installations médicales + Orvosi létesítmény Vehicles & facility @@ -3218,15 +3347,19 @@ Fahrzeuge & Einrichtungen Vozidla a zařízení Veículos e instalações + Dans les véhicules et les installations médicals + Járművek & létesítmény Allow Surgical kit (Adv) - Разрешить хирургический набор (усл.) + Хирургический набор может использоваться (усл.) Ust. zestawu chirurg. Permitir equipo quirúrgico (Avanzado) Erlaube Operationskasten Povolit chirurgickou soupravu (Pokr.) Permite kit cirúrgico (avançado) + Permettre les kit de chirurgie (Avancé) + Sebészkészlet (Fejlett) engedélyezése Who can use the surgical kit? @@ -3236,6 +3369,8 @@ Wer kann den Operationskasten verwenden? Kdo může použít chirurgickou soupravu? Quem pode usar o kit cirúrgico? + Qui peut utiliser les kit de chirurgie + Ki használhatja a sebészkészletet? Remove Surgical kit (Adv) @@ -3245,6 +3380,8 @@ Enrtferne Operationskasten (erweitert) Odebrat chirurgickou soupravu (Pokr.) Remover kit cirúrgico (avançado) + Supprimer les kit de chirurgie (Avancé) + Sebészkészlet (Fejlett) eltávolítása Should Surgical kit be removed on usage? @@ -3254,6 +3391,8 @@ Entferne Operationskästen bei Verwendung? Odebrat chirurgickou soupravu po použití? Deve o kit cirúrgico ser removido após o uso? + Le kit de chirurgie doit il être supprimé à l'utilisation + Eltávolítódjon a sebészkészlet használatkor? Locations Surgical kit (Adv) @@ -3263,6 +3402,8 @@ Orte für Operationskästen (erweitert) Lokace chirurgické soupravy (Pokr.) Localizações do kit cirúrgico (avançado) + Lieu d'utilisation du kit de chirurgie + Sebészkészlet (Fejlett) helyei Where can the Surgical kit be used? @@ -3272,34 +3413,40 @@ Wo kann der Operationskasten verwendet werden? Kde může být použita chirurgická souprava? Onde o kit cirúrgico pode ser utilizado? + Où peut être utilisé les kit de chirurgie + Hol lehet a sebészkészletet használni? Condition Surgical kit (Adv) Podmínka chirurgické soupravy (Pokr.) Condición de equipo quirúrgico (Av) + Conditions d'utilisation du kit de chirurgie Warunek zestawu chir. + Sebészkészlet állapot + Condição do Kit Cirúrgico (Avançado) + Условие использования хирургического набора (усл.) 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 Po spełnieniu jakich warunków zestaw chirurgiczny może zostać zastosowany na pacjencie? + Mikor lehet a sebészkészletet használni? + Onde o kit cirúrgico pode ser utilizado? + Когда может использоваться хирургический набор? - Bloodstains - Blutflecken - Plamy krwi - Skvrny od krve - Manchas de sangre - Manchas de sangue + Heal hitpoints + Lecz hitpointy + Curar puntos de vida + Исцелять части тела - Bandaging removes bloodstains - Bandagieren entfernt Blutflecken - Bandażowanie usuwa ślady krwi - Obvázání odstraňuje skvrny od krve - El vendaje elimina las manchas de sangre - Bandagem remove manchas de sangue + Heal fully bandaged hitpoints + Po bandażowaniu ulecz hitpointy, usuwając z nich ślady krwi i przywracając im pełną sprawność. + Curar miembros totalmente vendados + Исцелять полностью перебинтованные части тела Pain suppression @@ -3308,6 +3455,9 @@ Potlačení bolesti Supresión del dolor Supressão de dor + Suppression de la douleur + Fájdalomcsillapítás + Приглушение боли Pain is only temporarily suppressed, not removed @@ -3316,6 +3466,9 @@ Bolest je potlačena, ale jen dočastně El dolor se suprime solo temporalmente, no se elimina. Dor é somente temporáriamente suprimida, não removida + La douleur est temporairement supprimée, pas enlevée + A fájdalom csak ideiglenesen csökken, nem távolítódik el + Боль приглушается только временно Configure the treatment settings from ACE Medical @@ -3325,15 +3478,19 @@ Behandlungseinstellungen vom ACE-Medical konfigurieren Konfigurace nastavení léčby ze zdravotnické systému ACE Configure as opções de tratamento do ACE Médico + Configure les paramètres de traitement du système de soin ACE + Kezelési lehetőségek konfigurálása az ACE Orvosi rendszerből Revive Settings [ACE] Настройки реанимации [ACE] - Ustawienia wskrzeszania [ACE] + Ustawienia wskrzeszania Sistema de resucitado [ACE] Wiederbelebungseinstellungen [ACE] Nastavení oživení [ACE] Sistema de reavivamento [ACE] + Paramètre du revive [ACE] + Újraélesztés beállításai [ACE] Enable Revive @@ -3343,6 +3500,8 @@ Erlaube Wiederbelebung Povolit oživení Habilitar reavivamento + Activer le revive + Újraélesztés engedélyezése Enable a basic revive system @@ -3352,6 +3511,8 @@ Aktiviere Standard-Wiederbelebungssystem Povolit základní systém oživení Habilitar um sistema básico de reavivamento + Active un sytème de revive basique + Egy alap újraélesztési rendszer engedélyezése Max Revive time @@ -3361,6 +3522,8 @@ Maximale Wiederbelebungszeit Maximální čas pro oživení Tempo máximo de reavivamento + Temps maximum pour le revive + Maximum újraélesztési idő Max amount of seconds a unit can spend in revive state @@ -3370,6 +3533,8 @@ Maximale Zeitspanne in Sekunden die eine Einheit im Wiederbelebungszustand verbringen kann Maximální doba v agónii v sekundách Quantidade máxima de segundos que uma unidade pode gastar em um estado de reavivamento + Nombre de seconde maximum qu'une unité peut être en attente d'un revive + Maximum másodperc, amit egy egység újraélesztési állapotban tölthet Max Revive lives @@ -3379,6 +3544,8 @@ Maximale Leben bei Wiederbelebung Maximální počet oživení Vidas máximas do reavivado + Nombre maximum de revive + Maximum újraélesztési lehetőségek Max amount of lives a unit. 0 or -1 is disabled. @@ -3388,6 +3555,8 @@ Maximale Anzahl von Leben einer Einheit. 0 or -1 bedeutet deaktiviert. Maximální počet životu pro jednotku. 0 nebo -1 je zakázáno. Quantidade máxima de vidas por unidade. 0 ou -1 é desativado. + Nombre de vie maximale d'une unité. 0 ou -1 désactive + Egy egység maximum "életei". 0 vagy -1 letiltja. Provides a medical system for both players and AI. @@ -3397,15 +3566,19 @@ Aktiviert das Medicsystem für Spieler und KI. Poskytuje zdravotní systém pro hráče a AI. Proporciona um sistema médico para jogadores e IA. + Fourni un sytème médical pour les joueurs et les IAs + Egy orvosi rendszert ad játékosok és AI-k számára. Set Medic Class [ACE] Сделать медиком [ACE] - Ustaw klasę medyka [ACE] + Ustaw klasę medyka Establecer case médica [ACE] Setze Sanitäterklassen [ACE] Určit třídu medika [ACE] Definir classe médica [ACE] + Définir comme unité médicale [ACE] + Orvos beállítása [ACE] List @@ -3415,6 +3588,8 @@ Liste Seznam Lista + Liste + Lista List of unit names that will be classified as medic, separated by commas. @@ -3424,6 +3599,8 @@ Liste von Namen, die als Sanitäter verwendet werden. Wird durch Kommas getrennt. Seznam osob které budou klasifikovány jako zdravotník, oddělené čárkami. Lista dos nomes das unidades que se classificam como médicos, separados por vírgulas. + Liste d'unité qui seront listées comme infirmier, séparation par virgule + Azon egységek nevei, melyek orvosként vannak meghatározva, vesszővel elválasztva. Is Medic @@ -3433,6 +3610,8 @@ Ist Sanitäter Je zdravotník É médico + Est infirmier + Orvos-e This module allows you to assign the medic class to selected units. @@ -3440,6 +3619,10 @@ Dieses Modul legt fest welche Einheit ein Sanitäter ist. Tento modul určuje, která jednotka je zdravotník. Este módulo determina qual unidade é um paramédico. + Ce module permet d'assigner la classe médicale à une unité sélectionnée + Ez a modul engedélyezi az orvosi jelző hozzárendelését kiválasztott egységekhez. + Этот модуль позволяет назначить класс медика выбранным юнитам. + Este módulo permite asignar la clase médico a las unidades seleccionadas. None @@ -3449,6 +3632,8 @@ Keine Žádný Nada + Aucun + Nincs Regular medic @@ -3458,6 +3643,8 @@ Normaler Sanitäter Řadový zdravotník Médico regular + Infirmier standard + Hagyományos orvos Doctor (Only Advanced Medics) @@ -3467,6 +3654,8 @@ Arzt (nur erweiterte Sanitäter) Doktor (Pouze pokročilý zdravotníci) Doutor (Somente médicos avançados) + Médecin (traitements avancés uniquement) + Doktor (csak fejlett orvosok) Assigns the ACE medic class to a unit @@ -3476,15 +3665,19 @@ Weise die ACE-Sanitäterklasse einer Einheit zu Přiřadí ACE třídu zdravotníka do jednotky Atribui a classe médica do ACE a uma unidade + Assigner la classe médicale à une unité + Az ACE orvosi jelző hozzárendelése egy egységhez Set Medical Vehicle [ACE] Сделать мед. транспортом [ACE] - Ustaw pojazd medyczny [ACE] + Ustaw pojazd medyczny Establecer vehículos médicos [ACE] Setze medizinisches Fahrzeug [ACE] Určit zdravotnické vozidlo [ACE] Definir veículo médico [ACE] + Définir comme véhicule médical [ACE] + Orvosi jármű beállítása [ACE] List @@ -3494,6 +3687,8 @@ Liste Seznam Lista + Liste + Lista List of vehicles that will be classified as medical vehicle, separated by commas. @@ -3503,24 +3698,30 @@ Liste von Fahrzeugen, die als medizinische Fahrzeuge verwendet werden. Wird durch Kommas getrennt. Seznam vozidel které budou klasifikovány jako zdravotnická vozidla, oddělené čárkami. Lista de veículos que serão classificados como veículos médicos, separados por vírgulas. + Liste de véhicule classé comme véhicule médical, séparation par virgule. + Orvosi járműveknek tekintett járművek listája, vesszővel elválasztva. Is Medical Vehicle - Является мед. транспортом + Является медицинским транспортом Jest pojazdem med. Es vehículo médico Ist medizinisches Fahrzeug Je zdravotnické vozidlo É um veículo médico + Véhicule médical + Orvosi jármű-e Whatever or not the objects in the list will be a medical vehicle. Будут ли объекты в списке считаться медицинским транспортом. - Czy pojazdy z tej listy są pojazdami medycznymi. + Czy pojazdy z tej listy są pojazdami medycznymi? Cualquiera de la lista o fuera de ella será un vehículo médico. Leg fest ob das Objekt in der Liste ein medizinisches Fahrzeug ist. Ať už jsou nebo nejsou objekty v seznamu budou zdravotnická vozidla. Se serão ou não os objetos dessa lista veículos médicos. + Quoi qu'il arrive les objets de la liste seront des véhicules médical + A listában lévő objektumok orvosi járművek-e, vagy sem. Assigns the ACE medic class to a unit @@ -3530,15 +3731,19 @@ Weist die ACE-Sanitäterklasse einer Einheit zu Přiřadí ACE třídu zdravotníka do jednotky Atribui a classe médica ACE a uma unidade + Assigne la classe médicale à une unité + Hozzárendeli az ACE orvosi jelzőt egy egységhez Set Medical Facility [ACE] Сделать госпиталем [ACE] - Ustaw budynek medyczny [ACE] + Ustaw budynek medyczny Establece el centro médico [ACE] Setze medizinische Einrichtung [ACE] Určit zdravotnické zařízení [ACE] Definir instalação médica [ACE] + Définir comme équipement médical [ACE] + Orvosi létesítmény beállítása [ACE] Is Medical Facility @@ -3548,6 +3753,8 @@ Ist eine medizinische Einrichtung Je zdravotnické zařízení É uma instalação médica + Est un équipement médical + Orvosi létesítmény-e Registers an object as a medical facility @@ -3557,6 +3764,8 @@ Definiert ein Objekt als medizinische Einrichtung Registruje objekt jako zdravotnické zařízení Registra um objeto como instalacão médica + Enregistrer un objet comme un équipement médical + Egy objektum orvosi létesítményként való regisztrálása Defines an object as a medical facility. This allows for more advanced treatments. Can be used on buildings and vehicles. @@ -3566,6 +3775,8 @@ Definiert ein Objekt als medizinische Einrichtung. Das ermöglicht weitere Behandlungen. Kann bei Gebäuden und Fahrzeugen verwendet werden. Definuje objekt jako zdravotnické zařízení. To umožňuje více pokročilé léčení. Může být použito na budovy nebo na vozidla. Define um objeto como instalação médica. Isso permite tratamentos mais avançados. Pode ser utilizado em edifícios e veículos. + Définir un objet comme équipement médical. Cela permet les traitements avancés. Peut être utilisé sur les batiments et les véhicules + Egy objektumot orvosi létesítményként határoz meg. Ez fejlett ellátási lehetőségeket engedélyez. Használható járműveken és épületeken. [ACE] Medical Supply Crate (Basic) @@ -3575,6 +3786,8 @@ [ACE] Medizinische Kiste (standard) [ACE] Zdravotnické zásoby (základní) [ACE] Caixa com suprimentos médicos + [ACE] Caisse médicale (basique) + [ACE] Orvosi láda (Alap) [ACE] Medical Supply Crate (Advanced) @@ -3584,18 +3797,28 @@ [ACE] Medizinische Kiste (erweitert) [ACE] Zdravotnické zásoby (pokročilé) [ACE] Caixa com suprimentos médicos (Avançados) + [ACE] Caisse médicale (avancée) + [ACE] Orvosi láda (Fejlett) Anytime Kdykoli Siempre + Tout le temps Zawsze + Akármikor + Sempre + В любое время Stable Stabilní Estable + Stable Po stabilizacji + Stabil + Estável + После стабилизации Medical @@ -3609,5 +3832,24 @@ Médico Orvosi + + Distance to %1 has become to far for treatment + %1 odszedł zbyt daleko, nie można kontynuować leczenia + Расстояние до %1 стало слишком большим для лечения + A distância de %1 está muito longe para tratamento + La distancia hasta %1 se ha agrandado demasiado para el tratamiento + + + This person (%1) is awake and cannot be loaded + Ta osoba (%1) jest przytomna i nie może zostać załadowana + Esta persona (%1) está despierto y no puede ser cargado + Боец (%1) в сознании и не может быть погружен + + + There is no tourniquet on this body part! + Na tej części ciała nie ma stazy! + No hay torniquete en esta parte del cuerpo! + Нет жгута на этой части тела! + diff --git a/addons/medical_menu/ACE_Settings.hpp b/addons/medical_menu/ACE_Settings.hpp index 1f2b9cc3ea..42bd80044f 100644 --- a/addons/medical_menu/ACE_Settings.hpp +++ b/addons/medical_menu/ACE_Settings.hpp @@ -1,4 +1,3 @@ - class ACE_Settings { class GVAR(allow) { displayName = CSTRING(allow); @@ -6,6 +5,7 @@ class ACE_Settings { value = 1; typeName = "SCALAR"; values[] = {ECSTRING(common,Disabled), ECSTRING(common,Enabled), ECSTRING(common,VehiclesOnly)}; + category = ECSTRING(medical,Category_Medical); }; class GVAR(useMenu) { displayName = CSTRING(useMenu); @@ -14,6 +14,7 @@ class ACE_Settings { typeName = "SCALAR"; values[] = {ECSTRING(common,Disabled), ECSTRING(common,Enabled), ECSTRING(common,VehiclesOnly)}; isClientSettable = 1; + category = ECSTRING(medical,Category_Medical); }; class GVAR(openAfterTreatment) { displayName = CSTRING(openAfterTreatment); @@ -21,5 +22,6 @@ class ACE_Settings { typeName = "BOOL"; value = 1; isClientSettable = 1; + category = ECSTRING(medical,Category_Medical); }; }; diff --git a/addons/medical_menu/README.md b/addons/medical_menu/README.md index 0755083712..86ae2039ea 100644 --- a/addons/medical_menu/README.md +++ b/addons/medical_menu/README.md @@ -3,6 +3,7 @@ ace_medical_menu Provides the CSE medical menu for the advanced medical system. + ## Maintainers The people responsible for merging changes to this component or answering potential questions. diff --git a/addons/medical_menu/XEH_postInit.sqf b/addons/medical_menu/XEH_postInit.sqf index a72c1a8887..eaf356f608 100644 --- a/addons/medical_menu/XEH_postInit.sqf +++ b/addons/medical_menu/XEH_postInit.sqf @@ -26,9 +26,10 @@ if (!hasInterface) exitwith {}; false }, { - if (ACE_time - GVAR(lastOpenedOn) > 0.5) then { + if (ACE_time - GVAR(lastOpenedOn) > 0.5) exitWith { [ObjNull] call FUNC(openMenu); }; + false }, [35, [false, false, false]], false, 0] call CBA_fnc_addKeybind; diff --git a/addons/medical_menu/XEH_preInit.sqf b/addons/medical_menu/XEH_preInit.sqf index c231c7df6e..65ac88e245 100644 --- a/addons/medical_menu/XEH_preInit.sqf +++ b/addons/medical_menu/XEH_preInit.sqf @@ -3,6 +3,7 @@ ADDON = false; PREP(onMenuOpen); +PREP(onMenuClose); PREP(openMenu); PREP(canOpenMenu); diff --git a/addons/medical_menu/functions/fnc_canOpenMenu.sqf b/addons/medical_menu/functions/fnc_canOpenMenu.sqf index 2cfe7072ef..9b7c3bcbff 100644 --- a/addons/medical_menu/functions/fnc_canOpenMenu.sqf +++ b/addons/medical_menu/functions/fnc_canOpenMenu.sqf @@ -21,4 +21,4 @@ params ["_caller", "_target"]; if !(GVAR(allow) == 1 || (GVAR(allow) == 2 && {vehicle _caller != _caller || vehicle _target != _target} && {alive ACE_player})) exitwith {false}; if !(GVAR(useMenu) == 1 || (GVAR(useMenu) == 2 && {vehicle _caller != _caller || vehicle _target != _target} && {alive ACE_player})) exitwith {false}; -true; +true diff --git a/addons/medical_menu/functions/fnc_collectActions.sqf b/addons/medical_menu/functions/fnc_collectActions.sqf index 211de76202..ad189139ea 100644 --- a/addons/medical_menu/functions/fnc_collectActions.sqf +++ b/addons/medical_menu/functions/fnc_collectActions.sqf @@ -33,7 +33,7 @@ _fnc_compileActionsLevel = { _actions pushBack [_displayName, _category, compile _condition, compile _statement]; }; nil - }count ("true" configClasses _config); + } count ("true" configClasses _config); _actions // return }; diff --git a/addons/medical_menu/functions/fnc_handleUI_DisplayOptions.sqf b/addons/medical_menu/functions/fnc_handleUI_DisplayOptions.sqf index d795b0128c..dafd72d54d 100644 --- a/addons/medical_menu/functions/fnc_handleUI_DisplayOptions.sqf +++ b/addons/medical_menu/functions/fnc_handleUI_DisplayOptions.sqf @@ -38,11 +38,11 @@ if (_name isEqualTo "toggle") exitwith { }; GVAR(INTERACTION_TARGET_PREVIOUS) = GVAR(INTERACTION_TARGET); - [_newTarget] spawn { - closeDialog 0; - sleep 0.1; + + closeDialog 0; + [{ [_this select 0] call FUNC(openMenu); - }; + }, [_newTarget], 0.1] call EFUNC(common,waitAndExecute); }; // Clean the dropdown options list from all actions @@ -75,9 +75,9 @@ if (_name isEqualTo "triage") exitwith { _message = localize _message; }; }; - _triageCardTexts pushback format["%1x - %2 (%3m)", _amount, _message, round((ACE_time - _time) / 60)]; + _triageCardTexts pushback format["%1x - %2 (%3m)", _amount, _message, round((ACE_gameTime - _time) / 60)]; nil; - }count _log; + } count _log; if (count _triageCardTexts == 0) exitwith { lbAdd [212,(localize ELSTRING(medical,TriageCard_NoEntry))]; diff --git a/addons/medical_menu/functions/fnc_onMenuClose.sqf b/addons/medical_menu/functions/fnc_onMenuClose.sqf new file mode 100644 index 0000000000..4300089a4a --- /dev/null +++ b/addons/medical_menu/functions/fnc_onMenuClose.sqf @@ -0,0 +1,21 @@ +/* + * Author: joko // Jonas + * Handle medical menu closed + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * call ace_medical_menu_onMenuClosed + * + * Public: No + */ +#include "script_component.hpp" + +if (EGVAR(interact_menu,menuBackground)==1) then {[QGVAR(id), false] call EFUNC(common,blurScreen);}; +if (EGVAR(interact_menu,menuBackground)==2) then {(uiNamespace getVariable [QEGVAR(interact_menu,menuBackground), displayNull]) closeDisplay 0;}; + +[GVAR(MenuPFHID)] call CBA_fnc_removePerFrameHandler; diff --git a/addons/medical_menu/functions/fnc_onMenuOpen.sqf b/addons/medical_menu/functions/fnc_onMenuOpen.sqf index 52a957ae93..fb64865b89 100644 --- a/addons/medical_menu/functions/fnc_onMenuOpen.sqf +++ b/addons/medical_menu/functions/fnc_onMenuOpen.sqf @@ -14,6 +14,7 @@ * Public: No */ #include "script_component.hpp" +#define MAX_DISTANCE 10 private "_target"; @@ -21,6 +22,9 @@ params ["_display"]; if (isNil "_display") exitwith {}; +if (EGVAR(interact_menu,menuBackground)==1) then {[QGVAR(id), true] call EFUNC(common,blurScreen);}; +if (EGVAR(interact_menu,menuBackground)==2) then {0 cutRsc[QEGVAR(interact_menu,menuBackground), "PLAIN", 1, false];}; + if (isNil QGVAR(LatestDisplayOptionMenu)) then { GVAR(LatestDisplayOptionMenu) = "triage"; } else { @@ -60,8 +64,9 @@ disableSerialization; (_display displayCtrl 1) ctrlSetText format ["%1", [_target] call EFUNC(common,getName)]; setMousePosition [0.4, 0.4]; -[QGVAR(onMenuOpen), "onEachFrame", { - params ["_display"]; +GVAR(MenuPFHID) = [{ + + (_this select 0) params ["_display"]; if (isNull GVAR(INTERACTION_TARGET)) then { GVAR(INTERACTION_TARGET) = ACE_player; }; @@ -69,9 +74,15 @@ setMousePosition [0.4, 0.4]; [GVAR(INTERACTION_TARGET)] call FUNC(updateIcons); [GVAR(LatestDisplayOptionMenu)] call FUNC(handleUI_DisplayOptions); - _status = [GVAR(INTERACTION_TARGET)] call FUNC(getTriageStatus); + _status = [GVAR(INTERACTION_TARGET)] call EFUNC(medical,getTriageStatus); (_display displayCtrl 2000) ctrlSetText (_status select 0); (_display displayCtrl 2000) ctrlSetBackgroundColor (_status select 2); - }, [_display]] call BIS_fnc_addStackedEventHandler; + + if (ACE_player distance _target > MAX_DISTANCE) exitwith { + closeDialog 314412; + ["displayTextStructured", [ACE_player], [[ELSTRING(medical,DistanceToFar), [_target] call EFUNC(common,getName)], 1.75, ACE_player]] call EFUNC(common,targetEvent); + }; + +}, 0, [_display]] call CBA_fnc_addPerFrameHandler; ["Medical_onMenuOpen", [ACE_player, _interactionTarget]] call EFUNC(common,localEvent); diff --git a/addons/medical_menu/functions/fnc_openMenu.sqf b/addons/medical_menu/functions/fnc_openMenu.sqf index 3bc67f0028..067e7bda13 100644 --- a/addons/medical_menu/functions/fnc_openMenu.sqf +++ b/addons/medical_menu/functions/fnc_openMenu.sqf @@ -6,7 +6,7 @@ * 0: Target * * Return Value: - * None + * If action was taken * * Example: * [some_player] call ace_medical_menu_openMenu @@ -18,16 +18,22 @@ params ["_interactionTarget"]; if (dialog || isNull _interactionTarget) exitwith { - disableSerialization; + disableSerialization; - private "_display"; - _display = uiNamespace getVariable QGVAR(medicalMenu); - if (!isNil "_display") then { - closeDialog 314412; - }; + private ["_display", "_handled"]; + _handled = false; + _display = uiNamespace getVariable QGVAR(medicalMenu); + if (!isNil "_display") then { + closeDialog 314412; + _handled = true; + }; + + _handled }; GVAR(INTERACTION_TARGET) = _interactionTarget; createDialog QGVAR(medicalMenu); GVAR(lastOpenedOn) = ACE_time; + +true diff --git a/addons/medical_menu/functions/fnc_updateInformationLists.sqf b/addons/medical_menu/functions/fnc_updateInformationLists.sqf index db7220065c..ecd700e43a 100644 --- a/addons/medical_menu/functions/fnc_updateInformationLists.sqf +++ b/addons/medical_menu/functions/fnc_updateInformationLists.sqf @@ -21,16 +21,18 @@ params ["_display", "_genericMessages", "_allInjuryTexts"]; _lbCtrl = _display displayCtrl 213; lbClear _lbCtrl; { - _lbCtrl lbAdd (_x select 0); - _lbCtrl lbSetColor [_forEachIndex, _x select 1]; + _x params ["_add", "_color"]; + _lbCtrl lbAdd _add; + _lbCtrl lbSetColor [_forEachIndex, _color]; } forEach _genericMessages; _amountOfGeneric = count _genericMessages; { - _lbCtrl lbAdd (_x select 0); - _lbCtrl lbSetColor [_forEachIndex + _amountOfGeneric, _x select 1]; + _x params ["_add", "_Color"]; + _lbCtrl lbAdd _add; + _lbCtrl lbSetColor [_forEachIndex + _amountOfGeneric, _color]; } forEach _allInjuryTexts; -if (count _allInjuryTexts == 0) then { +if (_allInjuryTexts isEqualTo []) then { _lbCtrl lbAdd localize ELSTRING(medical,NoInjuriesBodypart); }; diff --git a/addons/medical_menu/functions/fnc_updateUIInfo.sqf b/addons/medical_menu/functions/fnc_updateUIInfo.sqf index 7dee2d5123..b493b5026e 100644 --- a/addons/medical_menu/functions/fnc_updateUIInfo.sqf +++ b/addons/medical_menu/functions/fnc_updateUIInfo.sqf @@ -105,11 +105,12 @@ if (EGVAR(medical,level) >= 2) then { } forEach _bandagedwounds; } else { _damaged = [true, true, true, true, true, true]; - { - _selectionBloodLoss set [_forEachIndex, _target getHitPointDamage _x]; - if (_target getHitPointDamage _x > 0 && _forEachIndex == _selectionN) then { - _pointDamage = _target getHitPointDamage _x; + { + _selectionBloodLoss set [_forEachIndex, _x]; + + if (_x > 0 && _forEachIndex == _selectionN) then { + _pointDamage = _x; _severity = switch (true) do { case (_pointDamage > 0.5): {localize ELSTRING(medical,HeavilyWounded)}; case (_pointDamage > 0.1): {localize ELSTRING(medical,LightlyWounded)}; @@ -125,7 +126,7 @@ if (EGVAR(medical,level) >= 2) then { ] select _forEachIndex); _allInjuryTexts pushBack [format ["%1 %2", _severity, toLower _part], [1,1,1,1]]; }; - } forEach ["HitHead", "HitBody", "HitLeftArm", "HitRightArm", "HitLeftLeg", "HitRightLeg"]; + } forEach (_target getvariable [QEGVAR(medical,bodyPartStatus), [0,0,0,0,0,0]]); }; [_selectionBloodLoss, _display] call FUNC(updateBodyImage); diff --git a/addons/medical_menu/stringtable.xml b/addons/medical_menu/stringtable.xml index 05f29d8b19..9e3bbc4c2b 100644 --- a/addons/medical_menu/stringtable.xml +++ b/addons/medical_menu/stringtable.xml @@ -1,386 +1,459 @@ - + - - - Medical Menu - - - Allow Medical Menu - - - Allow clients to use the medical menu - - - Use Medical menu - - - If allowed by server, enable the option to use the Medical Menu through keybinding and interaction menu - - - Re-open Medical menu - - - Re-open the medical menu after succesful treatment - - - Open Medical Menu - - - Medical Menu Settings - - - Configure the usage of the Medical Menu - - - EXAMINE & TREATMENT - ОСМОТР И ЛЕЧЕНИЕ - EXAMINAR & TRATAMIENTO - EXAMINER & TRAITEMENTS - BADANIE & LECZENIE - - - STATUS - СОСТОЯНИЕ - ESTADO - ÉTATS - STATUS - - - OVERVIEW - ОБЩАЯ ИНФОРМАЦИЯ - DESCRIPCIÓN - DESCRIPTION - OPIS - - - ACTIVITY LOG - ПРОВЕДЕННЫЕ МАНИПУЛЯЦИИ - REGISTRO DE ACTIVIDAD - REGISTRE DES SOINS - LOGI AKTYWNOŚCI - - - QUICK VIEW - БЫСТРЫЙ ОСМОТР - VISTA RÁPIDA - VUE RAPIDE - SZYBKI PODGLĄD - - - None - Не ранен - Ninguno - Aucun - Brak - - - Minor - Несрочная помощь - Menor - Mineur - Normalny - - - Delayed - Срочная помощь - Diferido - Urgent - Opóźniony - - - Immediate - Неотложная помощь - Inmediato - Immédiat - Natychmiastowy - - - Deceased - Морг - Fallecido - Décédé - Nie żyje - - - View triage Card - Смотреть первичную карточку - Ver Triage - Voir Carte de Triage - Pokaż kartę segregacyjną - - - Examine Patient - Осмотреть пациента - Examinar Paciente - Examiner Patient - Zbadaj pacjenta - - - Bandage / Fractures - Раны / переломы - Vendajes/Fracturas - Bandages / Fractures - Bandaże / Złamania - - - Medication - Медикаменты - Medicación - Médications - Leki - - - Airway Management - Дыхательные пути - Vías Aéreas - Gestion Des Voie REspiratoire - Drogi oddechowe - - - Advanced Treatments - Специальная медпомощь - Tratamientos Avanzados - Traitement Avancé - Zaawansowane zabiegi - - - Drag/Carry - Тащить/нести - Arrastrar/Cargar - Glisser/Porter - Ciągnij/Nieś - - - Toggle (Self) - Лечить себя/другого раненого - Activer (sois) - Przełącz (na siebie) - Alternar - - - Select triage status - Сортировка - Seleccionar estado de Triage - Selectioner l'état de Triage - Wybierz priorytet - - - Select Head - Выбрать голову - Seleccionar Cabeza - Selectioner Tête - Wybierz głowę - - - Select Torso - Выбрать торс - Seleccionar Torso - Selectioner Torse - Wybierz tors - - - Select Left Arm - Выбрать левую руку - Seleccionar Brazo Izquierdo - Selectioner Bras Gauche - Wybierz lewą rękę - - - Select Right Arm - Выбрать правую руку - Seleccionar Brazo Derecho - Selectioner Bras Droit - Wybierz prawą rękę - - - Select Left Leg - Выбрать левую ногу - Seleccionar Pierna Izquierda - Selectioner Jambe Gauche - Wybierz lewą nogę - - - Select Right Leg - Выбрать правую ногу - Seleccionar Pierna Derecha - Selectioner Jambe Droite - Wybierz prawą nogę - - - Head - Голова - Cabeza - Tête - Głowa - - - Torso - Торс - Torse - Tors - - - Left Arm - Левая рука - Brazo Izquierdo - Bras Gauche - Lewa ręka - - - Right Arm - Правая рука - Brazo Derecho - Bras Droit - Prawa ręka - - - Left Leg - Левая нога - Pierna Izquierda - Jambe Gauche - Lewa noga - - - Right Leg - Правая нога - Pierna Derecha - Jambe Droite - Prawa noga - - - Body Part: %1 - Часть тела: %1 - Parte del cuerpo: %1 - Partie du corps: %1 - Część ciała: %1 - - - Small - малого размера - Pequeña - Petite - małym - - - Medium - среднего размера - Mediana - moyenne - średnim - - - Large - большого размера - Grande - Grande - dużym - - - There are %2 %1 Open Wounds - %2 открытые раны %1 - Hay %2 Heridas Abiertas %1 - Il y a %2 %1 Blessure Ouverte - Widzisz otwarte rany w ilości %2 o %1 rozmiarze - - - There is 1 %1 Open Wound - Открытая рана %1 - Hay 1 Herida Abierta %1 - Il y a 1 blessure ouverte %1 - Widzisz 1 otwartą ranę o %1 rozmiarze - - - There is a partial %1 Open wound - Частично открытая рана %1 - Hay una herida parcial abierta %1 - Il y a une Blessure Patiellement Ouverte %1 - Widzisz częściowo otwartą ranę o %1 rozmiarze - - - There are %2 %1 Bandaged Wounds - %2 перевязанные раны %1 - Hay %2 Heridas %1 Vendadas - Il y a %2 %1 Blessure Bandée - Widzisz %2 zabandażowanych ran o %1 rozmiarze - - - There is 1 %1 Bandaged Wound - 1 перевязанная рана %1 - Hay 1 Herida Vendada %1 - Il y a 1 %1 Blessure Bandée - Widzisz 1 zabandażowaną ranę o %1 rozmiarze - - - There is a partial %1 Bandaged wound - Частично перевязанная рана %1 - Hay una Herida parcial %1 Vendada - Il y a %1 Blessure Partielment Bandée - Widzisz 1 częściowo zabandażowaną ranę o %1 rozmiarze - - - Normal breathing - Дыхание в норме - Respiración normal - Respiration Normale - Normalny oddech - - - No breathing - Дыхания нет - No respira - Apnée - Brak oddechu - - - Difficult breathing - Дыхание затруднено - Dificultad para respirar - Difficultée Respiratoire - Trudności z oddychaniem - - - Almost no breathing - Дыхания почти нет - Casi sin respirar - Respiration Faible - Prawie brak oddechu - - - Bleeding - Кровотечение - Sangrando - Seignement - Krwawienie zewnętrzne - - - in Pain - Испытывает боль - Con Dolor - A De La Douleur - W bólu - - - Lost a lot of Blood - Большая кровопотеря - Mucha Sangre perdida - A Perdu Bcp de Sang - Stracił dużo krwi - - - Tourniquet [CAT] - Жгут - Torniquete [CAT] - Garot [CAT] - Opaska uciskowa [CAT] - - - Nasopharyngeal Tube [NPA] - Назотрахеальная трубка - Torniquete [CAT] - Canule Naseaupharyngée [NPA] - Rurka nosowo-gardłowa [NPA] - - + + Medical Menu + Menu medyczne + Menu médico + Медицинское меню + Menú médico + + + Allow Medical Menu + Akt. menu medyczne + Permitir menu médico + Разрешить мед. меню + Permitir menú médico + + + Allow clients to use the medical menu + Zezwalaj graczom korzystać z menu medycznego + Permite que clientes utilizem o menu médico + Разрешает клиентам использовать медицинское меню + Permitir a los clientes utilizar el menú médico + + + Use Medical menu + Użyj menu medycznego + Usar o menu médico + Использовать медицинское меню + Utiliza el menú médico + + + If allowed by server, enable the option to use the Medical Menu through keybinding and interaction menu + Jeżeli zezwolone przez serwer, aktywuj menu medyczne poprzez skrót klawiszowy i menu interakcji. + Se permitido pelo servidor, ativa a opção de usar o menu médico por atalhos de teclas e menu de interação + Если разрешено сервером, включает опцию использования медицинского меню с помощью горячих главиш или меню взаимодействия + Si está permitido por el servidor, active la opción de utilizar el menú médico a través del menú de las teclas + + + Re-open Medical menu + Otwieraj ponownie menu medyczne + Reabrir menu médico + Переоткрывать мед. меню + Reabrir menú médico + + + Re-open the medical menu after succesful treatment + Otwórz ponownie menu medyczne po udanym zakończeniu leczenia + Reabre o menu médico depois de um tratamento bem sucedido + Переоткрывать медицинское меню после удачного лечения + Reabre el menú médico despues de un tratamiento con éxito + + + Open Medical Menu + Otwórz menu medyczne + Abrir menu médico + Открыть медицинское меню + Abrir menú médico + + + Medical Menu Settings + Ustawienia menu medycznego + Preferências do menu médico + Настройки медицинского меню + Ajustes del mení médico + + + Configure the usage of the Medical Menu + Skonfiguruj opcje menu medycznego + Configura o uso do menu médico + Настройки использования медицинского меню + Configurar el uso del menú médico + + + EXAMINE & TREATMENT + ОСМОТР И ЛЕЧЕНИЕ + EXAMINAR & TRATAMIENTO + EXAMINER & TRAITEMENTS + BADANIE & LECZENIE + EXAMINAR & TRATAMENTO + VYŠETŘENÍ & LÉČBA + + + STATUS + СОСТОЯНИЕ + ESTADO + ÉTATS + STATUS + ESTADO + STAV + + + OVERVIEW + ОБЩАЯ ИНФОРМАЦИЯ + DESCRIPCIÓN + DESCRIPTION + OPIS + VISÃO GERAL + PŘEHLED + + + ACTIVITY LOG + ПРОВЕДЕННЫЕ МАНИПУЛЯЦИИ + REGISTRO DE ACTIVIDAD + REGISTRE DES SOINS + LOGI AKTYWNOŚCI + REGISTRO DE ATIVIDADE + PROTOKOL + + + QUICK VIEW + БЫСТРЫЙ ОСМОТР + VISTA RÁPIDA + VUE RAPIDE + SZYBKI PODGLĄD + VISÃO RÁPIDA + RYCHLÝ NÁHLED + + + View triage Card + Смотреть первичную карточку + Ver Triage + Voir Carte de Triage + Pokaż kartę segregacyjną + Ver cartão de triagem + + + Examine Patient + Осмотреть пациента + Examinar Paciente + Examiner Patient + Zbadaj pacjenta + Examinar paciente + + + Bandage / Fractures + Раны / переломы + Vendajes/Fracturas + Bandages / Fractures + Bandaże / Złamania + Bandagens / Fraturas + + + Medication + Медикаменты + Medicación + Médications + Leki + Medicação + + + Airway Management + Дыхательные пути + Vías Aéreas + Gestion Des Voie REspiratoire + Drogi oddechowe + Vias aéreas + + + Advanced Treatments + Специальная медпомощь + Tratamientos Avanzados + Traitement Avancé + Zaawansowane zabiegi + Tratamentos avançados + + + Drag/Carry + Тащить/нести + Arrastrar/Cargar + Glisser/Porter + Ciągnij/Nieś + Arrastar/Carregar + Táhnout/Nést + + + Toggle (Self) + Лечить себя/другого раненого + Activer (sois) + Przełącz (na siebie) + Alternar + Alternar (Si mesmo) + + + Select triage status + Сортировка + Seleccionar estado de Triage + Selectioner l'état de Triage + Wybierz priorytet + Selecionar estado de triagem + + + Select Head + Выбрать голову + Seleccionar Cabeza + Selectioner Tête + Wybierz głowę + Selecionar Cabeça + Vybrat Hlavu + + + Select Torso + Выбрать торс + Seleccionar Torso + Selectioner Torse + Wybierz tors + Selecionar Torso + Vybrat Trup + + + Select Left Arm + Выбрать левую руку + Seleccionar Brazo Izquierdo + Selectioner Bras Gauche + Wybierz lewą rękę + Selecionar Braço Esquerdo + Vybrat Levou Ruku + + + Select Right Arm + Выбрать правую руку + Seleccionar Brazo Derecho + Selectioner Bras Droit + Wybierz prawą rękę + Selecionar Braço Direito + Vybrat Pravou Ruku + + + Select Left Leg + Выбрать левую ногу + Seleccionar Pierna Izquierda + Selectioner Jambe Gauche + Wybierz lewą nogę + Selecionar Perna Esquerda + Vybrat Levou Nohu + + + Select Right Leg + Выбрать правую ногу + Seleccionar Pierna Derecha + Selectioner Jambe Droite + Wybierz prawą nogę + Selecionar Perna Direita + Vybrat Pravou Nohu + + + Head + Голова + Cabeza + Tête + Głowa + Caebça + Hlava + + + Torso + Торс + Torse + Tors + Torso + Trup + Torso + + + Left Arm + Левая рука + Brazo Izquierdo + Bras Gauche + Lewa ręka + Braço Esquerdo + Levá Ruka + + + Right Arm + Правая рука + Brazo Derecho + Bras Droit + Prawa ręka + Braço Direito + Pravá Ruka + + + Left Leg + Левая нога + Pierna Izquierda + Jambe Gauche + Lewa noga + Perna Esquerda + Levá Noha + + + Right Leg + Правая нога + Pierna Derecha + Jambe Droite + Prawa noga + Perna Direita + Pravá Noha + + + Body Part: %1 + Часть тела: %1 + Parte del cuerpo: %1 + Partie du corps: %1 + Część ciała: %1 + Parte do corpo: %1 + + + Small + малого размера + Pequeña + Petite + małym + Pequeno + + + Medium + среднего размера + Mediana + moyenne + średnim + Médio + + + Large + большого размера + Grande + Grande + dużym + Grande + + + There are %2 %1 Open Wounds + %2 открытые раны %1 + Hay %2 Heridas Abiertas %1 + Il y a %2 %1 Blessure Ouverte + Widzisz otwarte rany w ilości %2 o %1 rozmiarze + Existem %2 ferimentos abertos %1 + + + There is 1 %1 Open Wound + Открытая рана %1 + Hay 1 Herida Abierta %1 + Il y a 1 blessure ouverte %1 + Widzisz 1 otwartą ranę o %1 rozmiarze + Existe 1 %1 ferimento aberto + + + There is a partial %1 Open wound + Частично открытая рана %1 + Hay una herida parcial abierta %1 + Il y a une Blessure Patiellement Ouverte %1 + Widzisz częściowo otwartą ranę o %1 rozmiarze + Existe um ferimento parcial aberto %1 + + + There are %2 %1 Bandaged Wounds + %2 перевязанные раны %1 + Hay %2 Heridas %1 Vendadas + Il y a %2 %1 Blessure Bandée + Widzisz %2 zabandażowanych ran o %1 rozmiarze + Existem %2 ferimentos %1 tratados + + + There is 1 %1 Bandaged Wound + 1 перевязанная рана %1 + Hay 1 Herida Vendada %1 + Il y a 1 %1 Blessure Bandée + Widzisz 1 zabandażowaną ranę o %1 rozmiarze + Existe 1 ferimento %1 tratado + + + There is a partial %1 Bandaged wound + Частично перевязанная рана %1 + Hay una Herida parcial %1 Vendada + Il y a %1 Blessure Partielment Bandée + Widzisz 1 częściowo zabandażowaną ranę o %1 rozmiarze + Existe um ferimento parcial tratado %1 + + + Normal breathing + Дыхание в норме + Respiración normal + Respiration Normale + Normalny oddech + Respiração normal + + + No breathing + Дыхания нет + No respira + Apnée + Brak oddechu + Sem respiração + Nedýchá + + + Difficult breathing + Дыхание затруднено + Dificultad para respirar + Difficultée Respiratoire + Trudności z oddychaniem + Dificuldade para respirar + Potíže s dýcháním + + + Almost no breathing + Дыхания почти нет + Casi sin respirar + Respiration Faible + Prawie brak oddechu + Quase sem respiração + Téměř nedýchá + + + Bleeding + Кровотечение + Sangrando + Seignement + Krwawienie zewnętrzne + Sangrando + Krvácí + + + in Pain + Испытывает боль + Con Dolor + A De La Douleur + W bólu + Com dor + v Bolestech + + + Lost a lot of Blood + Большая кровопотеря + Mucha Sangre perdida + A Perdu Bcp de Sang + Stracił dużo krwi + Perdeu muito sangue + Ztratil hodně Krve + + + Tourniquet [CAT] + Жгут + Torniquete [CAT] + Garot [CAT] + Opaska uciskowa [CAT] + Torniquete [CAT] + + + Nasopharyngeal Tube [NPA] + Назотрахеальная трубка + Torniquete [CAT] + Canule Naseaupharyngée [NPA] + Rurka nosowo-gardłowa [NPA] + Tubo nasofaríngeo [NPA] + diff --git a/addons/medical_menu/ui/menu.hpp b/addons/medical_menu/ui/menu.hpp index c0c32cac8b..342f0230a2 100644 --- a/addons/medical_menu/ui/menu.hpp +++ b/addons/medical_menu/ui/menu.hpp @@ -3,10 +3,10 @@ class GVAR(medicalMenu) { idd = 314412; movingEnable = true; - onLoad = QUOTE(uiNamespace setVariable [ARR_2(QUOTE(QGVAR(medicalMenu)), _this select 0)]; [ARR_2(QUOTE(QGVAR(id)), true)] call EFUNC(common,blurScreen); [_this select 0] call FUNC(onMenuOpen);); - onUnload = QUOTE([ARR_2(QUOTE(QGVAR(id)), false)] call EFUNC(common,blurScreen); [ARR_2(QUOTE(QGVAR(onMenuOpen)), 'onEachFrame')] call BIS_fnc_removeStackedEventHandler;); + onLoad = QUOTE(uiNamespace setVariable [ARR_2(QUOTE(QGVAR(medicalMenu)), _this select 0)]; [_this select 0] call FUNC(onMenuOpen);); + onUnload = QUOTE([] call FUNC(onMenuClose)); class controlsBackground { - class HeaderBackground: ACE_gui_backgroundBase{ + class HeaderBackground: ACE_gui_backgroundBase { idc = -1; SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; x = "1 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; @@ -63,15 +63,15 @@ class GVAR(medicalMenu) { colorText[] = {1, 1, 1.0, 0.9}; colorBackground[] = {0,0,0,0}; SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1.2)"; - text = $STR_ACE_Medical_Menu_EXAMINE_TREATMENT; + text = CSTRING(EXAMINE_TREATMENT); }; class CatagoryCenter: CatagoryLeft { x = "13.33 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; - text = $STR_ACE_Medical_Menu_STATUS; + text = CSTRING(STATUS); }; class CatagoryRight: CatagoryCenter{ x = "25.66 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; - text = $STR_ACE_Medical_Menu_OVERVIEW; + text = CSTRING(OVERVIEW); }; class Line: ACE_gui_backgroundBase { idc = -1; @@ -404,11 +404,11 @@ class GVAR(medicalMenu) { colorText[] = {0.6, 0.7, 1.0, 1}; colorBackground[] = {0,0,0,0}; SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; - text = $STR_ACE_Medical_Menu_ACTIVITY_LOG; + text = CSTRING(ACTIVITY_LOG); }; class QuickViewHeader: ActivityLogHeader { x = "19.5 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; - text = $STR_ACE_Medical_Menu_QUICK_VIEW; + text = CSTRING(QUICK_VIEW); }; class LineBottomHeaders: Line { y = "19.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; @@ -481,7 +481,7 @@ class GVAR(medicalMenu) { y = 0; w = 0; h = 0; - text = $STR_ACE_Medical_Menu_TRIAGE_NONE; + text = ECSTRING(Medical,Triage_Status_None); style = ST_CENTER; size = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; @@ -500,7 +500,7 @@ class GVAR(medicalMenu) { y = 0; w = 0; h = 0; - text = $STR_ACE_Medical_Menu_TRIAGE_MINOR; + text = ECSTRING(Medical,Triage_Status_Minor); style = ST_CENTER; size = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; @@ -518,7 +518,7 @@ class GVAR(medicalMenu) { y = 0; w = 0; h = 0; - text = $STR_ACE_Medical_Menu_TRIAGE_DELAYED; + text = ECSTRING(Medical,Triage_Status_Delayed); style = ST_CENTER; size = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; @@ -536,7 +536,7 @@ class GVAR(medicalMenu) { y = 0; w = 0; h = 0; - text = $STR_ACE_Medical_Menu_TRIAGE_IMMEDIATE; + text = ECSTRING(Medical,Triage_Status_Immediate); style = ST_CENTER; size = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; @@ -554,7 +554,7 @@ class GVAR(medicalMenu) { y = 0; w = 0; h = 0; - text = $STR_ACE_Medical_Menu_TRIAGE_DECEASED; + text = ECSTRING(Medical,Triage_Status_Deceased); style = ST_CENTER; size = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; @@ -567,4 +567,4 @@ class GVAR(medicalMenu) { action = QUOTE([] call FUNC(handleUI_dropDownTriageCard); [ARR_2(GVAR(INTERACTION_TARGET),4)] call FUNC(setTriageStatus);); }; }; -}; \ No newline at end of file +}; diff --git a/addons/microdagr/CfgVehicles.hpp b/addons/microdagr/CfgVehicles.hpp index 49f7a0e65c..ee16870fe0 100644 --- a/addons/microdagr/CfgVehicles.hpp +++ b/addons/microdagr/CfgVehicles.hpp @@ -37,7 +37,7 @@ class CfgVehicles { displayName = CSTRING(Module_DisplayName); function = QFUNC(moduleMapFill); scope = 2; - isGlobal = 1; + isGlobal = 0; icon = QUOTE(PATHTOF(UI\Icon_Module_microDAGR_ca.paa)); functionPriority = 0; class Arguments { @@ -46,9 +46,9 @@ class CfgVehicles { description = CSTRING(MapDataAvailable_Description); typeName = "NUMBER"; class values { - class None {name = CSTRING(None); value = MAP_DETAIL_SAT; default = 1;}; - class Side {name = CSTRING(Side); value = MAP_DETAIL_TOPOROADS;}; - class Unique {name = CSTRING(Unique); value = MAP_DETAIL_NONE;}; + class Full {name = CSTRING(MapFill_Full); value = MAP_DETAIL_SAT; default = 1;}; + class Roads {name = CSTRING(MapFill_OnlyRoads); value = MAP_DETAIL_TOPOROADS;}; + class Disabled {name = CSTRING(MapFill_None); value = MAP_DETAIL_NONE;}; }; }; }; diff --git a/addons/microdagr/CfgWeapons.hpp b/addons/microdagr/CfgWeapons.hpp index 9776f1c615..6fa84b6e7b 100644 --- a/addons/microdagr/CfgWeapons.hpp +++ b/addons/microdagr/CfgWeapons.hpp @@ -7,6 +7,7 @@ class CfgWeapons { scope = 2; displayName = CSTRING(itemName); descriptionShort = CSTRING(itemDescription); + model = QUOTE(PATHTOF(data\MicroDAGR.p3d)); picture = QUOTE(PATHTOF(images\microDAGR_item.paa)); class ItemInfo: InventoryItem_Base_F { mass = 2; diff --git a/addons/microdagr/XEH_clientInit.sqf b/addons/microdagr/XEH_clientInit.sqf index c918bcf454..518a648601 100644 --- a/addons/microdagr/XEH_clientInit.sqf +++ b/addons/microdagr/XEH_clientInit.sqf @@ -3,6 +3,9 @@ if (!hasInterface) exitWith {}; +//Functions that are called for each draw of the map: +GVAR(miniMapDrawHandlers) = []; + //Add deviceKey entry: private ["_conditonCode", "_toggleCode", "_closeCode"]; _conditonCode = { diff --git a/addons/microdagr/data/MicroDAGR.p3d b/addons/microdagr/data/MicroDAGR.p3d new file mode 100644 index 0000000000..bd4ea59090 Binary files /dev/null and b/addons/microdagr/data/MicroDAGR.p3d differ diff --git a/addons/microdagr/data/MicroDAGR.rvmat b/addons/microdagr/data/MicroDAGR.rvmat new file mode 100644 index 0000000000..6f3522304c --- /dev/null +++ b/addons/microdagr/data/MicroDAGR.rvmat @@ -0,0 +1,92 @@ +ambient[] = {0.6,0.6,0.6,0.6}; +diffuse[] = {0.6,0.6,0.6,0.6}; +forcedDiffuse[] = {0.0,0.0,0.0,0.0}; +emmisive[] = {0.0,0.0,0.0,0.6}; +specular[] = {0.1,0.1,0.1,0.2}; +specularPower = 90.0; +PixelShaderID = "Super"; +VertexShaderID = "Super"; +class Stage1 +{ + texture="z\ace\addons\microdagr\data\MicroDAGR_nohq.paa"; + uvSource="tex"; + class uvTransform + { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,0}; + pos[]={0,0,0}; + }; +}; +class Stage2 +{ + texture="#(argb,8,8,3)color(0.5,0.5,0.5,1,DT)"; + uvSource="tex"; + class uvTransform + { + aside[]={0,9,0}; + up[]={4.5,0,0}; + dir[]={0,0,0}; + pos[]={0,0,0}; + }; +}; +class Stage3 +{ + texture="#(argb,8,8,3)color(0.5,0.5,0.5,0,MC)"; + uvSource="tex"; + class uvTransform + { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,0}; + pos[]={0,0,0}; + }; +}; +class Stage4 +{ + texture="#(argb,8,8,3)color(1,1,1,1,AS)"; + uvSource="tex"; + class uvTransform + { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,0}; + pos[]={0,0,0}; + }; +}; +class Stage5 +{ + texture="z\ace\addons\microdagr\data\MicroDAGR_smdi.paa"; + uvSource="tex"; + class uvTransform + { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,0}; + pos[]={0,0,0}; + }; +}; +class Stage6 +{ + texture="#(ai,16,2,2)fresnel(10.4,8.3)"; + uvSource="tex"; + class uvTransform + { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,1}; + pos[]={0,0,0}; + }; +}; +class Stage7 +{ + texture="a3\data_f\env_land_co.paa"; + uvSource="tex"; + class uvTransform + { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,0}; + pos[]={0,0,0}; + }; +}; diff --git a/addons/microdagr/data/MicroDAGR_co.paa b/addons/microdagr/data/MicroDAGR_co.paa new file mode 100644 index 0000000000..6efd68bff5 Binary files /dev/null and b/addons/microdagr/data/MicroDAGR_co.paa differ diff --git a/addons/microdagr/data/MicroDAGR_nohq.paa b/addons/microdagr/data/MicroDAGR_nohq.paa new file mode 100644 index 0000000000..1b9c8a337c Binary files /dev/null and b/addons/microdagr/data/MicroDAGR_nohq.paa differ diff --git a/addons/microdagr/data/MicroDAGR_smdi.paa b/addons/microdagr/data/MicroDAGR_smdi.paa new file mode 100644 index 0000000000..66c69a63b3 Binary files /dev/null and b/addons/microdagr/data/MicroDAGR_smdi.paa differ diff --git a/addons/microdagr/functions/fnc_appMarkKeypadEntry.sqf b/addons/microdagr/functions/fnc_appMarkKeypadEntry.sqf index 0822bdf310..86ace87b3e 100644 --- a/addons/microdagr/functions/fnc_appMarkKeypadEntry.sqf +++ b/addons/microdagr/functions/fnc_appMarkKeypadEntry.sqf @@ -6,7 +6,7 @@ * 0: String version of Keypad entry ["ok","del","1",...] * * Return Value: - * Nothing + * None * * Example: * ["ok"] call ace_microdagr_fnc_appMarkKeypadEntry @@ -16,15 +16,12 @@ #include "script_component.hpp" private ["_display", "_editText", "_actualPos"]; -PARAMS_1(_keypadButton); + +params ["_keypadButton"]; disableSerialization; -_display = displayNull; -if (GVAR(currentShowMode) == DISPLAY_MODE_DIALOG) then { - _display = (uiNamespace getVariable [QGVAR(DialogDisplay), displayNull]); -} else { - _display = (uiNamespace getVariable [QGVAR(RscTitleDisplay), displayNull]); -}; +_display = uiNamespace getVariable [[QGVAR(RscTitleDisplay), QGVAR(DialogDisplay)] select (GVAR(currentShowMode) == DISPLAY_MODE_DIALOG), displayNull]; + if (isNull _display) exitWith {ERROR("No Display");}; if (GVAR(currentApplicationPage) != APP_MODE_MARK) exitWith {}; diff --git a/addons/microdagr/functions/fnc_appMenuButtonConnectRangefinder.sqf b/addons/microdagr/functions/fnc_appMenuButtonConnectRangefinder.sqf index 1cf81963f5..589ec096fb 100644 --- a/addons/microdagr/functions/fnc_appMenuButtonConnectRangefinder.sqf +++ b/addons/microdagr/functions/fnc_appMenuButtonConnectRangefinder.sqf @@ -3,18 +3,18 @@ * Handles the "Connect To" button from the menu application * * Arguments: - * Nothing + * None * * Return Value: - * Nothing + * None * * Example: - * [] call ace_microdagr_fnc_appMenuButtonConnectRangefinder + * call ace_microdagr_fnc_appMenuButtonConnectRangefinder * * Public: No */ #include "script_component.hpp" -GVAR(currentWaypoint) = if (GVAR(currentWaypoint) == -2) then {-1} else {-2}; +GVAR(currentWaypoint) = [-2, -1] select (GVAR(currentWaypoint) == -2); GVAR(rangeFinderPositionASL) = []; [APP_MODE_INFODISPLAY] call FUNC(saveCurrentAndSetNewMode); diff --git a/addons/microdagr/functions/fnc_appSettingsLBClick.sqf b/addons/microdagr/functions/fnc_appSettingsLBClick.sqf index bc6779c10a..9e808559b2 100644 --- a/addons/microdagr/functions/fnc_appSettingsLBClick.sqf +++ b/addons/microdagr/functions/fnc_appSettingsLBClick.sqf @@ -7,7 +7,7 @@ * 1: Index * * Return Value: - * Nothing + * None * * Example: * [settingList, 1] call ace_microdagr_fnc_appSettingsLBClick @@ -17,7 +17,7 @@ #include "script_component.hpp" disableSerialization; -PARAMS_2(_control,_itemClicked); +params ["", "_itemClicked"]; switch (_itemClicked) do { case (0): { GVAR(settingUseMils) = ! GVAR(settingUseMils)}; diff --git a/addons/microdagr/functions/fnc_appWaypointsButtonDeleteWP.sqf b/addons/microdagr/functions/fnc_appWaypointsButtonDeleteWP.sqf index 1acd936370..d1fe1e8bdd 100644 --- a/addons/microdagr/functions/fnc_appWaypointsButtonDeleteWP.sqf +++ b/addons/microdagr/functions/fnc_appWaypointsButtonDeleteWP.sqf @@ -3,13 +3,13 @@ * Handles clicking the delete button from the waypoint application * * Arguments: - * Nothing + * None * * Return Value: - * Nothing + * None * * Example: - * [] call ace_microdagr_fnc_appWaypointsButtonDeleteWP + * call ace_microdagr_fnc_appWaypointsButtonDeleteWP * * Public: No */ @@ -18,12 +18,8 @@ private ["_display", "_wpIndex"]; disableSerialization; -_display = displayNull; -if (GVAR(currentShowMode) == DISPLAY_MODE_DIALOG) then { - _display = (uiNamespace getVariable [QGVAR(DialogDisplay), displayNull]); -} else { - _display = (uiNamespace getVariable [QGVAR(RscTitleDisplay), displayNull]); -}; +_display = uiNamespace getVariable [[QGVAR(RscTitleDisplay), QGVAR(DialogDisplay)] select (GVAR(currentShowMode) == DISPLAY_MODE_DIALOG), displayNull]; + if (isNull _display) exitWith {ERROR("No Display");}; _wpIndex = lbCurSel (_display displayCtrl IDC_MODEWAYPOINTS_LISTOFWAYPOINTS); diff --git a/addons/microdagr/functions/fnc_appWaypointsButtonSetWP.sqf b/addons/microdagr/functions/fnc_appWaypointsButtonSetWP.sqf index 881c0b3b5d..d2b3b0e20c 100644 --- a/addons/microdagr/functions/fnc_appWaypointsButtonSetWP.sqf +++ b/addons/microdagr/functions/fnc_appWaypointsButtonSetWP.sqf @@ -6,10 +6,10 @@ * The "SetWP" button * * Return Value: - * Nothing + * None * * Example: - * [] call ace_microdagr_fnc_appWaypointsButtonSetWP + * [1234] call ace_microdagr_fnc_appWaypointsButtonSetWP * * Public: No */ @@ -18,7 +18,7 @@ private ["_wpListBox", "_newWpIndex", "_waypoints"]; disableSerialization; -PARAMS_1(_wpButton); +params ["_wpButton"]; _wpListBox = (ctrlParent _wpButton) displayCtrl 144501; _newWpIndex = lbCurSel _wpListBox; diff --git a/addons/microdagr/functions/fnc_canShow.sqf b/addons/microdagr/functions/fnc_canShow.sqf index 9e54f927e0..70e8989031 100644 --- a/addons/microdagr/functions/fnc_canShow.sqf +++ b/addons/microdagr/functions/fnc_canShow.sqf @@ -6,32 +6,31 @@ * The display mode to test showing * * Return Value: - * Nothing + * None * * Example: - * [mode] call ace_microdagr_fnc_canShow + * [1] call ace_microdagr_fnc_canShow * * Public: No */ #include "script_component.hpp" - -PARAMS_1(_showType); +params ["_showType"]; private ["_returnValue"]; _returnValue = false; -switch (_showType) do { -case (DISPLAY_MODE_CLOSED): {_returnValue = true}; //Can always close -case (DISPLAY_MODE_HIDDEN): {_returnValue = true}; //Can always hide - -case (DISPLAY_MODE_DIALOG): { - _returnValue = ("ACE_microDAGR" in (items ACE_player)) && {[ACE_player, objNull, ["notOnMap", "isNotInside", "isNotSitting"]] call EFUNC(common,canInteractWith)}; +_returnValue = switch (_showType) do { + case (DISPLAY_MODE_CLOSED): { true }; //Can always close + case (DISPLAY_MODE_HIDDEN): { true }; //Can always hide + case (DISPLAY_MODE_DIALOG): { + ("ACE_microDAGR" in (items ACE_player)) && {[ACE_player, objNull, ["notOnMap", "isNotInside", "isNotSitting"]] call EFUNC(common,canInteractWith)} }; -case (DISPLAY_MODE_DISPLAY): { + case (DISPLAY_MODE_DISPLAY): { //Can't have minimap up while zoomed in - _returnValue = (cameraview != "GUNNER") && {"ACE_microDAGR" in (items ACE_player)} && {[ACE_player, objNull, ["notOnMap", "isNotInside", "isNotSitting"]] call EFUNC(common,canInteractWith)}; + (cameraview != "GUNNER") && {"ACE_microDAGR" in (items ACE_player)} && {[ACE_player, objNull, ["notOnMap", "isNotInside", "isNotSitting"]] call EFUNC(common,canInteractWith)} }; + default { false }; }; _returnValue diff --git a/addons/microdagr/functions/fnc_deviceAddWaypoint.sqf b/addons/microdagr/functions/fnc_deviceAddWaypoint.sqf index c383d0a95e..f99ec78354 100644 --- a/addons/microdagr/functions/fnc_deviceAddWaypoint.sqf +++ b/addons/microdagr/functions/fnc_deviceAddWaypoint.sqf @@ -8,7 +8,7 @@ * 1: Waypoint Position ASL * * Return Value: - * Nothing + * None * * Example: * ["Hill 55", [41,324, 12]] call ace_microdagr_fnc_deviceAddWaypoint @@ -17,10 +17,11 @@ */ #include "script_component.hpp" -PARAMS_2(_waypointName,_waypointPosASL); - private "_waypoints"; +params ["_waypointName","_waypointPosASL"]; -_waypoints = ace_player getVariable [QGVAR(waypoints), []]; + + +_waypoints = ACE_player getVariable [QGVAR(waypoints), []]; _waypoints pushBack [_waypointName, _waypointPosASL]; -ace_player setVariable [QGVAR(waypoints), _waypoints]; +ACE_player setVariable [QGVAR(waypoints), _waypoints]; diff --git a/addons/microdagr/functions/fnc_deviceDeleteWaypoint.sqf b/addons/microdagr/functions/fnc_deviceDeleteWaypoint.sqf index 62ca5a222a..d3681466b4 100644 --- a/addons/microdagr/functions/fnc_deviceDeleteWaypoint.sqf +++ b/addons/microdagr/functions/fnc_deviceDeleteWaypoint.sqf @@ -7,7 +7,7 @@ * 0: Waypoint Index * * Return Value: - * Nothing + * None * * Example: * ["Hill 55", [41,324, 12]] call ace_microdagr_fnc_deviceDeleteWaypoint @@ -16,13 +16,12 @@ */ #include "script_component.hpp" -PARAMS_1(_wpIndex); - private "_waypoints"; +params ["_wpIndex"]; -_waypoints = ace_player getVariable [QGVAR(waypoints), []]; +_waypoints = ACE_player getVariable [QGVAR(waypoints), []]; if ((_wpIndex < 0) || (_wpIndex > ((count _waypoints) - 1))) exitWith {ERROR("out of bounds wp");}; _waypoints deleteAt _wpIndex; -ace_player setVariable [QGVAR(waypoints), _waypoints]; +ACE_player setVariable [QGVAR(waypoints), _waypoints]; diff --git a/addons/microdagr/functions/fnc_deviceGetWaypoints.sqf b/addons/microdagr/functions/fnc_deviceGetWaypoints.sqf index f90ecb06be..da3484ceb0 100644 --- a/addons/microdagr/functions/fnc_deviceGetWaypoints.sqf +++ b/addons/microdagr/functions/fnc_deviceGetWaypoints.sqf @@ -4,7 +4,7 @@ * Device saving not implemented yet, just save to player object * * Arguments: - * Nothing + * None * * Return Value: * Waypoints @@ -16,4 +16,4 @@ */ #include "script_component.hpp" -(ace_player getVariable [QGVAR(waypoints), []]) +(ACE_player getVariable [QGVAR(waypoints), []]) diff --git a/addons/microdagr/functions/fnc_dialogClosedEH.sqf b/addons/microdagr/functions/fnc_dialogClosedEH.sqf index 0a7e5e5115..5180734644 100644 --- a/addons/microdagr/functions/fnc_dialogClosedEH.sqf +++ b/addons/microdagr/functions/fnc_dialogClosedEH.sqf @@ -3,13 +3,13 @@ * Handles the dialog closeing, switches back to display mode * * Arguments: - * Nothing + * None * * Return Value: - * Nothing + * None * * Example: - * [] call ace_microdagr_fnc_dialogClosedEH + * call ace_microdagr_fnc_dialogClosedEH * * Public: No */ diff --git a/addons/microdagr/functions/fnc_mapButtonDownEH.sqf b/addons/microdagr/functions/fnc_mapButtonDownEH.sqf index e7d2618160..566f08dc66 100644 --- a/addons/microdagr/functions/fnc_mapButtonDownEH.sqf +++ b/addons/microdagr/functions/fnc_mapButtonDownEH.sqf @@ -10,7 +10,7 @@ * 3: MousePosY * * Return Value: - * Nothing + * None * * Example: * [minimap,0,0.5,0.5] call ace_microdagr_fnc_mapButtonDownEH @@ -19,7 +19,7 @@ */ #include "script_component.hpp" -PARAMS_4(_theMap,_mouseButton,_xPos,_yPos); +params ["", "_mouseButton"]; //Only handle RMB if (_mouseButton != 1) exitWith {}; diff --git a/addons/microdagr/functions/fnc_mapDoubleTapEH.sqf b/addons/microdagr/functions/fnc_mapDoubleTapEH.sqf index 21a164ff2e..2226011215 100644 --- a/addons/microdagr/functions/fnc_mapDoubleTapEH.sqf +++ b/addons/microdagr/functions/fnc_mapDoubleTapEH.sqf @@ -9,7 +9,7 @@ * 3: MousePosY * * Return Value: - * Nothing + * None * * Example: * [minimap,0,0.5,0.5] call ace_microdagr_fnc_mapDoubleTapEH @@ -18,7 +18,7 @@ */ #include "script_component.hpp" -PARAMS_4(_theMap,_mouseButton,_xPos,_yPos); +params ["_theMap", "_mouseButton", "_xPos", "_yPos"]; private ["_worldPos"]; @@ -26,7 +26,7 @@ private ["_worldPos"]; if (_mouseButton != 0) exitWith {}; _worldPos = _theMap ctrlMapScreenToWorld [_xPos, _yPos]; -_worldPos set [2, (getTerrainHeightASL _worldPos)]; +_worldPos pushBack (getTerrainHeightASL _worldPos); GVAR(newWaypointPosition) = _worldPos; [APP_MODE_MARK] call FUNC(saveCurrentAndSetNewMode); diff --git a/addons/microdagr/functions/fnc_mapOnDrawEH.sqf b/addons/microdagr/functions/fnc_mapOnDrawEH.sqf index 644064d069..25f5bc92fd 100644 --- a/addons/microdagr/functions/fnc_mapOnDrawEH.sqf +++ b/addons/microdagr/functions/fnc_mapOnDrawEH.sqf @@ -6,7 +6,7 @@ * 0: The Map * * Return Value: - * Nothing + * None * * Example: * [compassMap] call ace_microdagr_fnc_mapOnDrawEH @@ -15,10 +15,10 @@ */ #include "script_component.hpp" -PARAMS_1(_theMap); - private ["_mapSize", "_waypoints", "_size", "_targetPos", "_relBearing", "_wpName", "_wpPos", "_alpha"]; +params ["_theMap"]; + _mapSize = (ctrlPosition _theMap) select 3; _waypoints = [] call FUNC(deviceGetWaypoints); @@ -27,7 +27,7 @@ if (GVAR(currentApplicationPage) == 1) then { _theMap ctrlMapAnimAdd [0, DUMMY_ZOOM, DUMMY_POS]; ctrlMapAnimCommit _theMap; _size = 412 * _mapSize; - _theMap drawIcon [QUOTE(PATHTO_R(images\compass_starInverted.paa)), [1,1,1,1], DUMMY_POS, _size, _size, (-1 * (getDir ace_player)), '', 0 ]; + _theMap drawIcon [QUOTE(PATHTO_R(images\compass_starInverted.paa)), [1,1,1,1], DUMMY_POS, _size, _size, (-1 * (getDir ACE_player)), '', 0 ]; _theMap drawIcon [QUOTE(PATHTO_R(images\compass_needle.paa)), [0.533,0.769,0.76,1], DUMMY_POS, _size, _size, 0, '', 0 ]; if (GVAR(currentWaypoint) != -1) then { @@ -42,23 +42,26 @@ if (GVAR(currentApplicationPage) == 1) then { }; }; if ((count _targetPos) == 3) then { - _relBearing = [ace_player, _targetPos] call BIS_fnc_relativeDirTo; + _relBearing = [ACE_player, _targetPos] call BIS_fnc_relativeDirTo; _theMap drawIcon [QUOTE(PATHTO_R(images\compass_needle.paa)), [1,0.564,0.564,1], DUMMY_POS, _size, _size, _relBearing, '', 0 ]; }; }; } else { //Map Mode: + //Call all added minimap draw event handlers: + {_this call _x;} forEach GVAR(miniMapDrawHandlers); + if (GVAR(mapAutoTrackPosition)) then { - _theMap ctrlMapAnimAdd [0, (GVAR(mapZoom)/_mapSize), (getPosASL ace_player)]; + _theMap ctrlMapAnimAdd [0, (GVAR(mapZoom)/_mapSize), (getPosASL ACE_player)]; ctrlMapAnimCommit _theMap; }; _size = 48 * _mapSize; - _theMap drawIcon [QUOTE(PATHTO_R(images\icon_self.paa)), [0.533,0.769,0.76,0.75], (getPosASL ace_player), _size, _size, (getDir ace_player), '', 0 ]; + _theMap drawIcon [QUOTE(PATHTO_R(images\icon_self.paa)), [0.533,0.769,0.76,0.75], (getPosASL ACE_player), _size, _size, (getDir ACE_player), '', 0 ]; if (GVAR(settingShowAllWaypointsOnMap)) then { _size = 32 * _mapSize; { - EXPLODE_2_PVT(_x,_wpName,_wpPos); + _x params ["_wpName", "_wpPos"]; _alpha = if (_forEachIndex == GVAR(currentWaypoint)) then {1} else {0.5}; _theMap drawIcon [QUOTE(PATHTO_R(images\icon_mapWaypoints.paa)), [1,1,1,_alpha], _wpPos, _size, _size, 0, '', 0 ]; } forEach _waypoints; diff --git a/addons/microdagr/functions/fnc_modeMapButtons.sqf b/addons/microdagr/functions/fnc_modeMapButtons.sqf index 5de4bf9ca7..a0d74bec49 100644 --- a/addons/microdagr/functions/fnc_modeMapButtons.sqf +++ b/addons/microdagr/functions/fnc_modeMapButtons.sqf @@ -6,7 +6,7 @@ * 0: String of the map button pressed * * Return Value: - * Nothing + * None * * Example: * ["autotrack"] call ace_microdagr_fnc_modeMapButtons @@ -15,7 +15,7 @@ */ #include "script_component.hpp" -PARAMS_1(_mode); +params ["_mode"]; [-1] call FUNC(saveCurrentAndSetNewMode); //backup current draw pos/zoom diff --git a/addons/microdagr/functions/fnc_moduleMapFill.sqf b/addons/microdagr/functions/fnc_moduleMapFill.sqf index d07b0bc518..03089a4ff4 100644 --- a/addons/microdagr/functions/fnc_moduleMapFill.sqf +++ b/addons/microdagr/functions/fnc_moduleMapFill.sqf @@ -4,23 +4,18 @@ * * Arguments: * 0: logic - * 1: synced units-not used - * 2: Module Activated * * Return Value: - * Nothing + * None * * Example: - * [module, [], true] call ace_microdagr_fnc_moduleMapFill + * [module] call ace_microdagr_fnc_moduleMapFill * * Public: No */ #include "script_component.hpp" -PARAMS_3(_logic,_syncedUnits,_activated); +if !(isServer) exitWith {}; +params ["_logic"]; -if (!_activated) exitWith {WARNING("Module Placed but not active");}; - -if (isServer) then { - [_logic, QGVAR(MapDataAvailable), "MapDataAvailable"] call EFUNC(common,readSettingFromModule); -}; +[_logic, QGVAR(MapDataAvailable), "MapDataAvailable"] call EFUNC(common,readSettingFromModule); diff --git a/addons/microdagr/functions/fnc_openDisplay.sqf b/addons/microdagr/functions/fnc_openDisplay.sqf index b4cec0fe46..aa2db94827 100644 --- a/addons/microdagr/functions/fnc_openDisplay.sqf +++ b/addons/microdagr/functions/fnc_openDisplay.sqf @@ -6,7 +6,7 @@ * 0: Display Mode to show the microDAGR in * * Return Value: - * Nothing + * None * * Example: * [1] call ace_microdagr_fnc_openDisplay @@ -15,9 +15,9 @@ */ #include "script_component.hpp" -private ["_oldShowMode", "_args", "_pfID", "_player"]; +private ["_oldShowMode", "_args", "_player"]; -DEFAULT_PARAM(0,_newDisplayShowMode,-1); +params [["_newDisplayShowMode", -1, [-1]]]; _oldShowMode = GVAR(currentShowMode); if (_newDisplayShowMode == -1) then { @@ -30,11 +30,10 @@ if ((_newDisplayShowMode == DISPLAY_MODE_DISPLAY) && {!([DISPLAY_MODE_DISPLAY] c if ((_newDisplayShowMode == DISPLAY_MODE_DIALOG) && {!([DISPLAY_MODE_DIALOG] call FUNC(canShow))}) then {_newDisplayShowMode = DISPLAY_MODE_HIDDEN}; - //On first-startup if (GVAR(currentApplicationPage) == APP_MODE_NULL) then { GVAR(currentApplicationPage) = APP_MODE_INFODISPLAY; - GVAR(mapPosition) = getPos ace_player; + GVAR(mapPosition) = getPos ACE_player; }; if (_newDisplayShowMode in [DISPLAY_MODE_CLOSED, DISPLAY_MODE_HIDDEN]) then { @@ -74,14 +73,14 @@ if ((_oldShowMode == DISPLAY_MODE_CLOSED) && {GVAR(currentShowMode) != DISPLAY_M //Start a pfeh to update display and handle hiding display [{ - PARAMS_2(_args,_pfID); - EXPLODE_1_PVT(_args,_player); - if ((isNull ace_player) || {!alive ace_player} || {ace_player != _player} || {!("ACE_microDAGR" in (items ace_player))} || {GVAR(currentShowMode) == DISPLAY_MODE_CLOSED}) then { + params ["_args", "_idPFH"]; + _args params ["_player"]; + if ((isNull ACE_player) || {!alive ACE_player} || {ACE_player != _player} || {!("ACE_microDAGR" in (items ACE_player))} || {GVAR(currentShowMode) == DISPLAY_MODE_CLOSED}) then { //Close Display if still open: if (GVAR(currentShowMode) != DISPLAY_MODE_CLOSED) then { [DISPLAY_MODE_CLOSED] call FUNC(openDisplay); }; - [_pfID] call CBA_fnc_removePerFrameHandler; + [_idPFH] call CBA_fnc_removePerFrameHandler; } else { if (GVAR(currentShowMode) == DISPLAY_MODE_HIDDEN) then { //If display is hidden, and we can show, then swithc modes: @@ -96,5 +95,5 @@ if ((_oldShowMode == DISPLAY_MODE_CLOSED) && {GVAR(currentShowMode) != DISPLAY_M }; }; }; - }, 0.1, [ace_player]] call CBA_fnc_addPerFrameHandler; + }, 0.1, [ACE_player]] call CBA_fnc_addPerFrameHandler; }; diff --git a/addons/microdagr/functions/fnc_recieveRangefinderData.sqf b/addons/microdagr/functions/fnc_recieveRangefinderData.sqf index 154dfff94a..8b2c6672a8 100644 --- a/addons/microdagr/functions/fnc_recieveRangefinderData.sqf +++ b/addons/microdagr/functions/fnc_recieveRangefinderData.sqf @@ -8,7 +8,7 @@ * 2: Inclination (Degrees) * * Return Value: - * Nothing + * None * * Example: * [1000, 45, 1] call ace_microdagr_fnc_recieveRangefinderData @@ -19,7 +19,7 @@ private ["_horizontalDistance", "_verticleDistance", "_targetOffset", "_targetPosASL"]; -PARAMS_3(_slopeDistance,_azimuth,_inclination); +params ["_slopeDistance", "_azimuth", "_inclination"]; if (GVAR(currentWaypoint) != -2) exitWith {}; //Only take waypoint when "connected" if (_slopeDistance < 0) exitWith {}; //Bad Data @@ -29,6 +29,6 @@ _verticleDistance = (sin _inclination) * _slopeDistance; _targetOffset = [((sin _azimuth) * _horizontalDistance), ((cos _azimuth) * _horizontalDistance), _verticleDistance]; //This assumes the "rangefinder view" pos is very close to player, at worst the turret should only be a few meters different -_targetPosASL = (getPosASL ace_player) vectorAdd _targetOffset; +_targetPosASL = (getPosASL ACE_player) vectorAdd _targetOffset; GVAR(rangeFinderPositionASL) = _targetPosASL; diff --git a/addons/microdagr/functions/fnc_saveCurrentAndSetNewMode.sqf b/addons/microdagr/functions/fnc_saveCurrentAndSetNewMode.sqf index 64a5cab991..7cbec9f242 100644 --- a/addons/microdagr/functions/fnc_saveCurrentAndSetNewMode.sqf +++ b/addons/microdagr/functions/fnc_saveCurrentAndSetNewMode.sqf @@ -7,7 +7,7 @@ * 0: New Mode * * Return Value: - * Nothing + * None * * Example: * [2] call ace_microdagr_fnc_saveCurrentAndSetNewMode @@ -16,24 +16,21 @@ */ #include "script_component.hpp" -private ["_display", "_theMap", "_mapSize", "_centerPos", "_mapCtrlPos"]; +private ["_display", "_theMap", "_centerPos", "_mapCtrlPos"]; -PARAMS_1(_newMode); +params ["_newMode"]; disableSerialization; -_display = displayNull; -if (GVAR(currentShowMode) == DISPLAY_MODE_DIALOG) then { - _display = (uiNamespace getVariable [QGVAR(DialogDisplay), displayNull]); -} else { - _display = (uiNamespace getVariable [QGVAR(RscTitleDisplay), displayNull]); -}; +_display = uiNamespace getVariable [[QGVAR(RscTitleDisplay), QGVAR(DialogDisplay)] select (GVAR(currentShowMode) == DISPLAY_MODE_DIALOG), displayNull]; + if (isNull _display) exitWith {ERROR("No Display");}; if (GVAR(currentApplicationPage) == 2) then { - _theMap = if (!GVAR(mapShowTexture)) then {_display displayCtrl IDC_MAPPLAIN} else {_display displayCtrl IDC_MAPDETAILS}; + _theMap = [_display displayCtrl IDC_MAPDETAILS, _display displayCtrl IDC_MAPPLAIN] select (!GVAR(mapShowTexture)); _mapCtrlPos = ctrlPosition _theMap; - _mapSize = _mapCtrlPos select 3; - _centerPos = [((_mapCtrlPos select 0) + (_mapCtrlPos select 2) / 2), ((_mapCtrlPos select 1) + (_mapCtrlPos select 3) / 2)]; + + _mapCtrlPos params ["_mapCtrlPosX", "_mapCtrlPosY", "_mapCtrlPosZ", "_mapSize"]; + _centerPos = [(_mapCtrlPosX + _mapCtrlPosZ / 2), (_mapCtrlPosY + _mapSize / 2)]; GVAR(mapPosition) = _theMap ctrlMapScreenToWorld _centerPos; GVAR(mapZoom) = (ctrlMapScale _theMap) * _mapSize; diff --git a/addons/microdagr/functions/fnc_showApplicationPage.sqf b/addons/microdagr/functions/fnc_showApplicationPage.sqf index 3c042fdff3..dba6b54f18 100644 --- a/addons/microdagr/functions/fnc_showApplicationPage.sqf +++ b/addons/microdagr/functions/fnc_showApplicationPage.sqf @@ -3,10 +3,10 @@ * Changes the "application page" shown on the microDAGR * * Arguments: - * Nothing + * None * * Return Value: - * Nothing + * None * * Example: * [] call ace_microdagr_fnc_showApplicationPage @@ -19,12 +19,8 @@ private ["_display", "_theMap", "_mapSize"]; disableSerialization; -_display = displayNull; -if (GVAR(currentShowMode) == DISPLAY_MODE_DIALOG) then { - _display = (uiNamespace getVariable [QGVAR(DialogDisplay), displayNull]); -} else { - _display = (uiNamespace getVariable [QGVAR(RscTitleDisplay), displayNull]); -}; +_display = uiNamespace getVariable [[QGVAR(RscTitleDisplay), QGVAR(DialogDisplay)] select (GVAR(currentShowMode) == DISPLAY_MODE_DIALOG), displayNull]; + if (isNull _display) exitWith {ERROR("No Display");}; //TopBar diff --git a/addons/microdagr/functions/fnc_updateDisplay.sqf b/addons/microdagr/functions/fnc_updateDisplay.sqf index 910f422c75..826ea55e6c 100644 --- a/addons/microdagr/functions/fnc_updateDisplay.sqf +++ b/addons/microdagr/functions/fnc_updateDisplay.sqf @@ -3,10 +3,10 @@ * Updates the display (several times a second) called from the pfeh * * Arguments: - * Nothing + * None * * Return Value: - * Nothing + * None * * Example: * [] call ace_microdagr_fnc_updateDisplay @@ -15,15 +15,11 @@ */ #include "script_component.hpp" -private ["_display", "_waypoints", "_posString", "_eastingText", "_northingText", "_numASL", "_aboveSeaLevelText", "_compassAngleText", "_targetPos", "_targetPosName", "_targetPosLocationASL", "_bearingText", "_rangeText", "_targetName", "_bearing", "_2dDistanceKm", "_SpeedText", "_playerPos2d", "_wpListBox", "_currentIndex", "_wpName", "_wpPos", "_settingListBox", "_yearString", "_monthSring", "_dayString"]; +private ["_display", "_waypoints", "_posString", "_eastingText", "_northingText", "_numASL", "_aboveSeaLevelText", "_compassAngleText", "_targetPos", "_targetPosName", "_targetPosLocationASL", "_bearingText", "_rangeText", "_targetName", "_bearing", "_2dDistanceKm", "_SpeedText", "_wpListBox", "_currentIndex", "_wpName", "_wpPos", "_settingListBox", "_yearString", "_monthSring", "_dayString", "_daylight"]; disableSerialization; -_display = displayNull; -if (GVAR(currentShowMode) == DISPLAY_MODE_DIALOG) then { - _display = (uiNamespace getVariable [QGVAR(DialogDisplay), displayNull]); -} else { - _display = (uiNamespace getVariable [QGVAR(RscTitleDisplay), displayNull]); -}; +_display = uiNamespace getVariable [[QGVAR(RscTitleDisplay), QGVAR(DialogDisplay)] select (GVAR(currentShowMode) == DISPLAY_MODE_DIALOG), displayNull]; + if (isNull _display) exitWith {ERROR("No Display");}; //Fade "shell" at night @@ -44,21 +40,21 @@ case (APP_MODE_INFODISPLAY): { (_display displayCtrl IDC_MODEDISPLAY_NORTHING) ctrlSetText _northingText; //Elevation: - _numASL = ((getPosASL ace_player) select 2) + EGVAR(common,mapAltitude); + _numASL = ((getPosASL ACE_player) select 2) + EGVAR(common,mapAltitude); _aboveSeaLevelText = [_numASL, 5, 0] call CBA_fnc_formatNumber; _aboveSeaLevelText = if (_numASL > 0) then {"+" + _aboveSeaLevelText + " MSL"} else {_aboveSeaLevelText + " MSL"}; (_display displayCtrl IDC_MODEDISPLAY_ELEVATIONNUM) ctrlSetText _aboveSeaLevelText; //Heading: _compassAngleText = if (GVAR(settingUseMils)) then { - [(floor ((6400 / 360) * (getDir ace_player))), 4, 0] call CBA_fnc_formatNumber; + [(floor ((6400 / 360) * (getDir ACE_player))), 4, 0] call CBA_fnc_formatNumber; } else { - ([(floor (getDir ace_player)), 3, 1] call CBA_fnc_formatNumber) + "°" //degree symbol is in UTF-8 + ([(floor (getDir ACE_player)), 3, 1] call CBA_fnc_formatNumber) + "°" //degree symbol is in UTF-8 }; (_display displayCtrl IDC_MODEDISPLAY_HEADINGNUM) ctrlSetText _compassAngleText; //Speed: - (_display displayCtrl IDC_MODEDISPLAY_SPEEDNUM) ctrlSetText format ["%1kph", (round (speed (vehicle ace_player)))];; + (_display displayCtrl IDC_MODEDISPLAY_SPEEDNUM) ctrlSetText format ["%1kph", (round (speed (vehicle ACE_player)))];; if (GVAR(currentWaypoint) == -1) then { @@ -89,13 +85,13 @@ case (APP_MODE_INFODISPLAY): { }; if (!(_targetPosLocationASL isEqualTo [])) then { - _bearing = [(getPosASL ace_player), _targetPosLocationASL] call BIS_fnc_dirTo; + _bearing = [(getPosASL ACE_player), _targetPosLocationASL] call BIS_fnc_dirTo; _bearingText = if (GVAR(settingUseMils)) then { [(floor ((6400 / 360) * (_bearing))), 4, 0] call CBA_fnc_formatNumber; } else { ([(floor (_bearing)), 3, 1] call CBA_fnc_formatNumber) + "°" //degree symbol is in UTF-8 }; - _2dDistanceKm = (((getPosASL ace_player) select [0,2]) distance (_targetPosLocationASL select [0,2])) / 1000; + _2dDistanceKm = ((getPosASL ACE_player) distance2D _targetPosLocationASL) / 1000; _rangeText = format ["%1km", ([_2dDistanceKm, 1, 1] call CBA_fnc_formatNumber)]; _numASL = (_targetPosLocationASL select 2) + EGVAR(common,mapAltitude); _aboveSeaLevelText = [_numASL, 5, 0] call CBA_fnc_formatNumber; @@ -111,14 +107,14 @@ case (APP_MODE_INFODISPLAY): { case (APP_MODE_COMPASS): { //Heading: _compassAngleText = if (GVAR(settingUseMils)) then { - [(floor ((6400 / 360) * (getDir ace_player))), 4, 0] call CBA_fnc_formatNumber; + [(floor ((6400 / 360) * (getDir ACE_player))), 4, 0] call CBA_fnc_formatNumber; } else { - ([(floor (getDir ace_player)), 3, 1] call CBA_fnc_formatNumber) + "°" //degree symbol is in UTF-8 + ([(floor (getDir ACE_player)), 3, 1] call CBA_fnc_formatNumber) + "°" //degree symbol is in UTF-8 }; (_display displayCtrl IDC_MODECOMPASS_HEADING) ctrlSetText _compassAngleText; //Speed: - _SpeedText = format ["%1kph", (round (speed (vehicle ace_player)))];; + _SpeedText = format ["%1kph", (round (speed (vehicle ACE_player)))];; (_display displayCtrl IDC_MODECOMPASS_SPEED) ctrlSetText _SpeedText; if (GVAR(currentWaypoint) == -1) then { @@ -126,8 +122,6 @@ case (APP_MODE_COMPASS): { (_display displayCtrl IDC_MODECOMPASS_RANGE) ctrlSetText ""; (_display displayCtrl IDC_MODECOMPASS_TARGET) ctrlSetText ""; } else { - _playerPos2d = (getPosASL ace_player) select [0,2]; - _targetPosName = ""; _targetPosLocationASL = []; @@ -147,13 +141,13 @@ case (APP_MODE_COMPASS): { _rangeText = "---"; if (!(_targetPosLocationASL isEqualTo [])) then { - _bearing = [(getPosASL ace_player), _targetPosLocationASL] call BIS_fnc_dirTo; + _bearing = [(getPosASL ACE_player), _targetPosLocationASL] call BIS_fnc_dirTo; _bearingText = if (GVAR(settingUseMils)) then { [(floor ((6400 / 360) * (_bearing))), 4, 0] call CBA_fnc_formatNumber; } else { ([(floor (_bearing)), 3, 1] call CBA_fnc_formatNumber) + "°" //degree symbol is in UTF-8 }; - _2dDistanceKm = (((getPosASL ace_player) select [0,2]) distance (_targetPosLocationASL select [0,2])) / 1000; + _2dDistanceKm = ((getPosASL ACE_player) distance2D _targetPosLocationASL) / 1000; _rangeText = format ["%1km", ([_2dDistanceKm, 1, 1] call CBA_fnc_formatNumber)]; }; @@ -169,9 +163,9 @@ case (APP_MODE_WAYPOINTS): { lbClear _wpListBox; { - EXPLODE_2_PVT(_x,_wpName,_wpPos); + _x params ["_wpName", "_wpPos"]; _wpListBox lbAdd _wpName; - _2dDistanceKm = (((getPosASL ace_player) select [0,2]) distance (_wpPos select [0,2])) / 1000; + _2dDistanceKm = ((getPosASL ACE_player) distance2D _wpPos) / 1000; _wpListBox lbSetTextRight [_forEachIndex, (format ["%1km", ([_2dDistanceKm, 1, 1] call CBA_fnc_formatNumber)])]; } forEach _waypoints; diff --git a/addons/microdagr/gui_controls.hpp b/addons/microdagr/gui_controls.hpp index 50e9083ed6..270a3325bd 100644 --- a/addons/microdagr/gui_controls.hpp +++ b/addons/microdagr/gui_controls.hpp @@ -77,14 +77,8 @@ class controlsBackground { sizeExLevel = 0; sizeEx = H_PART(1); - ptsPerSquareSea = 5; - ptsPerSquareTxt = 20; - ptsPerSquareRoad = 0.01; + ptsPerSquareRoad = 0.75; ptsPerSquareObj = 2000; //don't show buildings - ptsPerSquareCLn = 100; - ptsPerSquareCost = 200; - ptsPerSquareFor = 9; - ptsPerSquareForEdge = 9; showCountourInterval = 0; @@ -116,14 +110,7 @@ class controlsBackground { onMouseButtonDblClick = QUOTE(_this call FUNC(mapDoubleTapEH)); onMouseButtonDown = QUOTE(_this call FUNC(mapButtonDownEH)); - // ptsPerSquareSea = 5; - // ptsPerSquareTxt = 20; - // ptsPerSquareRoad = 0.01; ptsPerSquareObj = 9; - // ptsPerSquareCLn = 100; - // ptsPerSquareCost = 200; - // ptsPerSquareFor = 9; - // ptsPerSquareForEdge = 9; maxSatelliteAlpha = 0.5; @@ -711,14 +698,18 @@ class controls { y = Y_PART(2); w = W_PART(24.6); h = H_PART(19); - onLBDblClick = QUOTE(_this call FUNC(appSettingsLBClick)); + // onLBDblClick = QUOTE(_this call FUNC(appSettingsLBClick)); + onLBSelChanged = QUOTE(_this call FUNC(appSettingsLBClick)); sizeEx = H_PART(1.5); sizeEx2 = H_PART(1.5); rowHeight = H_PART(1.75); itemSpacing = 0.001; colorText[] = {0.75,0.75,0.75,1}; + colorTextRight[] = {0.75,0.75,0.75,1}; colorSelect[] = {0.75,0.75,0.75,1}; colorSelect2[] = {0.75,0.75,0.75,1}; + colorSelectRight[] = {0.75,0.75,0.75,1}; + colorSelect2Right[] = {0.75,0.75,0.75,1}; colorBackground[] = {0.05,0.05,0.05,1}; colorSelectBackground[] = {0.05,0.05,0.05,1}; colorSelectBackground2[] = {0.05,0.05,0.05,1}; diff --git a/addons/microdagr/readme.md b/addons/microdagr/readme.md index f2dc25a656..d7bcf01b40 100644 --- a/addons/microdagr/readme.md +++ b/addons/microdagr/readme.md @@ -1,7 +1,7 @@ ace_microdagr =============== -Adds a microDAGR infentry GPS device. +Adds a MicroDAGR infantry GPS device. Press home to open. Then home again to toggle an interactive version. Press CTRL+Home to close. Info/Compass/Minimap modes are selectable by the bottom buttons. Tap the top bar to open the menu and access Mark/Waypoints/Connect To/Settings modes. Tap the minimap button again to toggle map modes (if available). @@ -9,13 +9,14 @@ Enter waypoints from the menu or double tapping on the minimap. Can interface with the `ace_vector`. Hold Azimuth+Range and release (see page 14 of vector's manual) #### Items Added: - `ACE_microDAGR` + ## For Mission Makers: #### Modules: -* MicroDAGR Map Fill - Controls the amount of map data avaialbe for the minimap. Can limit to just roads/topographical or disable entirely. +- MicroDAGR Map Fill - Controls the amount of map data available for the minimap. Can limit to just roads/topographical or disable entirely. + ## Maintainers diff --git a/addons/microdagr/stringtable.xml b/addons/microdagr/stringtable.xml index a636ffa4de..7e2261107f 100644 --- a/addons/microdagr/stringtable.xml +++ b/addons/microdagr/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -283,7 +283,7 @@ Configurar MicroDAGR Настроить MicroDAGR Konfigurovat MicroDAGR - Konfiguruj MicroDAGR + Otwórz MicroDAGR Configurer MicroDAGR MicroDAGR konfigurálása ConfiguraMicroDAGR @@ -308,6 +308,9 @@ MicroDAGR - Vyplnění mapy MicroDAGR-Kartenfüllung Preenchimento de mapa do MicroDAGR + MicroDAGR - Remplissage de la carte + MicroDAGR térképkitöltés + Заполнение карты MicroDAGR MicroDAGR Map Fill @@ -316,6 +319,9 @@ MicroDAGR - Vyplnění mapy MicroDAGR-Kartenfüllung Preenchimento de mapa do MicroDAGR + MicroDAGR - Remplissage de la carte + MicroDAGR térképkitöltés + Заполнение карты MicroDAGR How much map data is filled on MicroDAGR's @@ -324,30 +330,42 @@ Wie viel Daten auf einem MicroDAGR zu sehen sind Kolik informací je načteno do MicroDAGR? Quanta informação é preenchida no mapa do MicroDAGR + Combien d'information apparaisse sur la carte du MicroDAGR + Mennyi térképadatot tartalmaz a MicroDAGR + Сколько данных должно отображаться на карте MicroDAGR - + Full Satellite + Buildings Pełna satelitarna + budynki Satelite completo + Edificios Satellitenbild + Gebäude Satelit + Budovy Satélite completo + Edifícios + Satellite + Batiments + Teljes műholdas + épületek + Спутник + Здания - + Topographical + Roads Topograficzna + drogi Topografico + Carreteras Topografisch + Straßen Topografické + Cesty Topográfico + Estradas + Topographie + Routes + Topográfia + utak + Топография + Дороги - + None (Cannot use map view) Żadna (wyłącza ekran mapy) Nada (No se puede el mapa) Keine (kann keine Kartenansicht verwenden) Žádný (Nelze použít zobrazení mapy) Nada (Não pode usar a tela de mapa) + Rien (La vue carte n'est pas possible) + Semmi (nem használható a térképnézet) + Не показывать (запрещает использовать режим карты) Controls how much data is filled on the microDAGR items. Less data restricts the map view to show less on the minimap.<br />Source: microDAGR.pbo @@ -356,6 +374,9 @@ Steuert wie viel Daten auf dem microDAGR zu sehen ist. Weniger Daten schränken die Kartenansicht ein, um mehr auf der Minimap zu sehen.<br />Quelle: microDAGR.pbo Tento modul umožňuje kontrolovat, kolik informací je obsaženo v MicroDAGR. Menší množství dat omezené zobrazením mapy ukazují méně věcí na minimapě.<br />Zdroj: microDAGR.pbo Controla quantos dados são preenchidos nos itens microDAGR. Menos dados restringe a visualização de mapa para mostrar menos informações no minimapa<br/>Fonte: MicroDAGR.pbo + Contrôle le nombre d'information disponible sur la carte du MicroDAGR. <br/>Source: microDAGR.pbo + Meghatárroza a MicroDAGR objektumok térképének tartalmát. A kevesebb adat korlátozza a térképnézeti módot az eszközön. <br />Forrás: microDAGR.pbo + Контролирует, сколько данных должно отображаться на карте устройств MicroDAGR. Ограничивает объем отображаемых данных на миникарте.<br />Источник: microDAGR.pbo diff --git a/addons/missileguidance/stringtable.xml b/addons/missileguidance/stringtable.xml index 2845767f15..3a416007f4 100644 --- a/addons/missileguidance/stringtable.xml +++ b/addons/missileguidance/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -104,6 +104,9 @@ Aus Vypnout Desligado + Eteint + Ki + Выкл. Player Only @@ -112,6 +115,9 @@ Nur Spieler Pouze hráči Somente jogador + Seulement les joueurs + Csak játékosok + Только игрок Player and AI @@ -120,6 +126,9 @@ Spieler und KI Hráči a AI Jogador e IA + Joueurs et IA + Játékosok és AI + Игрок и боты - \ No newline at end of file + diff --git a/addons/missionmodules/README.md b/addons/missionmodules/README.md new file mode 100644 index 0000000000..0b8950d3fe --- /dev/null +++ b/addons/missionmodules/README.md @@ -0,0 +1,11 @@ +ace_missionmodules +=========== + +Adds mission modules. + + +## Maintainers + +The people responsible for merging changes to this component or answering potential questions. + +- [Glowbal](https://github.com/Glowbal) diff --git a/addons/missionmodules/stringtable.xml b/addons/missionmodules/stringtable.xml index b99285850d..fe06252a61 100644 --- a/addons/missionmodules/stringtable.xml +++ b/addons/missionmodules/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -8,6 +8,9 @@ ACE-Missionsmodule ACE Moduly mise Módulo de missões ACE + ACE module de mission + ACE küldetési modulok + Модули миссий ACE Ambiance Sounds [ACE] @@ -16,6 +19,9 @@ Umgebungsgeräusche [ACE] Zvuky prostředí [ACE] [ACE] Sons ambientes + Sons d'ambiance [ACE] + Ambiens hangok [ACE] + Звук окружения [ACE] Sounds @@ -24,6 +30,9 @@ Sounds Zvuky Sons + Sons + Hangok + Звуки Class names of the ambiance sounds to be played. Seperated by ',' @@ -32,6 +41,8 @@ Klassennamen der Umgebungsgeräusche, die abgespielt werden sollen. Getrennt durch "," Class names zvuků prostředí, které budou přehrány. Oddělené ',' Nomes de classe dos sons de ambiente para serem reproduzidos. Separados por "," + Имена классов звуков окружения, которые должны проигрываться. Разделенные ',' + ClassNames des sons d'ambiances. Séparation par "," Minimal Distance @@ -40,6 +51,9 @@ Mindestabstand Minimální vzdálenost Distância mínima + Distance minimale + Minimális távolság + Минимальная дистанция Used for calculating a random position and sets the minimal distance between the players and the played sound file(s) @@ -48,6 +62,9 @@ Wird verwendet, um eine zufällige Position zu bestimmen und setzt den Mindestabstand zwischen Spielern und der/den abzuspielenden Sounddatei(en) fest Používá se pro výpočet náhodné pozice a určuje minimální vzdálenost mezi hráči a přehrávaným zvukem. Usada para calcular uma posição aleatória e definir a distância mínima entre os jogadores e os arquivos de sons que estão sendo reproduzidos. + Utilisé pour calculer une position aléatoire et pour définir la distance minimale entre le joueur les sons lus. + Egy véletlenszerű pozíció számításához használt érték, amihez megadja a minimum távolságot a játékosok és a lejátszott hangfájl(ok) között + Используется для расчета случайной позиции и указывает минимальное расстояние между игроками и источниками звука Maximum Distance @@ -56,6 +73,9 @@ Maximalabstand Maximální vzdálenost Distância máxima + Distance maximale + Maximális távolság + Максимальная дистанция Used for calculating a random position and sets the maximum distance between the players and the played sound file(s) @@ -64,6 +84,9 @@ Wird verwendet, um eine zufällige Position zu bestimmen und setzt den Maximalabstand zwischen Spielern und der/den abzuspielenden Sounddatei(en) fest Používá se pro výpočet náhodné pozice a určuje maximální vzdálenost mezi hráči a přehrávaným zvukem. Usado para calcular uma posição aleatória e definir uma distância máxima entre os jogadores e os arquivos de sons que estão sendo reproduzidos. + Utilisé pour calculer une position aléatoire et pour définir la distance maximale entre le joueur les sons lus. + Egy véletlenszerű pozíció számításához használt érték, amihez megadja a maximum távolságot a játékosok és a lejátszott hangfájl(ok) között + Используется для расчета случайной позиции и указывает максимальное расстояние между игроками и источниками звука Minimal Delay @@ -72,6 +95,9 @@ Minimale Verzögerung Minimální prodleva Atraso mínimo + Délais minimal + Minimum késleltetés + Минимальная задержка Minimal delay between sounds played @@ -80,6 +106,9 @@ Minimale Verzögerung zwischen abzuspielenden Sounds Minimální prodleva mezi přehrávanými zvuky Atraso mínimo entre os sons reproduzidos + Délais minimal entre les sons lus. + Minimum késleltetés a lejátszott hangok között + Минимальная задержка между воспроизведением звуков Maximum Delay @@ -88,6 +117,9 @@ Maximale Verzögerung Maximální prodleva Atraso máximo + Délais maximal + Maximum késleltetés + Максимальная задержка Maximum delay between sounds played @@ -96,6 +128,9 @@ Maximale Verzögerung zwischen abzuspielenden Sounds Maximální prodleva mezi přehrávanými zvuky Atraso máximo entre os sons reproduzidos + Délais maximal entre les sons lus. + Maximum késleltetés a lejátszott hangok között + Максимальная задержка между воспроизведением звуков Follow Players @@ -104,6 +139,9 @@ Spielern folgen Následovat hráče Seguir jogadores + Suivre les joueurs + Játékosok követése + Следовать за игроками Follow players. If set to false, loop will play sounds only nearby logic position. @@ -112,6 +150,9 @@ Spielern folgen. Wenn auf falsch gesetzt, werden Sounds nur in der Nähe des Logikmoduls abgespielt. Následuj hráče. Pokud je FALSE, smyčka zvuku bude přehrávána na nejbližší pozici logiki. Segue os jogadores. Se esta desabilitado (falso), o loop reproduzirá os sons somente perto de sua posição lógica. + Suivre le joueur. Si défini sur false, les sons seront joués en boucle autour la position logique + Játékosok követése. Ha le van tiltva, az ismétlés csak a legközelebbi logikai ponton játszik le hangokat. + Следовать за игроками. Если установить в Ложь, звуки будут циклически проигрываться только около позиции Логики. Volume @@ -120,6 +161,9 @@ Lautstärke Hlasitost Volume + Volume + Hangerő + Громкость The volume of the sounds played @@ -128,6 +172,9 @@ Lautstärke der abzuspielenden Sounds Hlasitost přehrávaného zvuku O volume em que os sons serão reproduzidos + Volume des sons lus + A lejátszott hangok hangereje + Громкость воспроизводимых звуков Ambiance sounds loop (synced across MP) @@ -136,6 +183,9 @@ Umgebungsgeräusch-Schleife (im MP synchronisiert) Smyčka okkolního zvuku (synchronizováno v MP) Loop de sons ambientes (sincronizados através do MP) + Sons d'ambiance lus en boucle (Synchronisation MP) + Ambiens hangok folyamatossága (MP alatt szinkronizálva) + Циклически воспроизводимые звуки окружения (синх. между игроками) - \ No newline at end of file + diff --git a/addons/mk6mortar/README.md b/addons/mk6mortar/README.md index 84c7a6e984..3e5109f38f 100644 --- a/addons/mk6mortar/README.md +++ b/addons/mk6mortar/README.md @@ -1,7 +1,8 @@ ace_mk6mortar ========== -Tweaks the mk6 mortar from Arma3 +Tweaks the Nk6 Mortar system. + ## Maintainers diff --git a/addons/mk6mortar/functions/fnc_dev_buildTable.sqf b/addons/mk6mortar/functions/fnc_dev_buildTable.sqf index 7a60e91e68..84184fcb51 100644 --- a/addons/mk6mortar/functions/fnc_dev_buildTable.sqf +++ b/addons/mk6mortar/functions/fnc_dev_buildTable.sqf @@ -36,13 +36,13 @@ while {_stillInRange} do { _stillInRange = false; } else { if (_airFriction == 0) then { - _result set [4, 0]; _result set [5, 0]; _result set [6, 0]; _result set [7, 0]; _result set [8, 0]; _result set [9, 0]; _result set [10, 0]; + _result set [11, 0]; }; if ((_result select 1) < 88) then { _outputArray pushBack [ diff --git a/addons/mk6mortar/functions/fnc_dev_simulateFindSolution.sqf b/addons/mk6mortar/functions/fnc_dev_simulateFindSolution.sqf index cfba7c0e05..32a5a314a7 100644 --- a/addons/mk6mortar/functions/fnc_dev_simulateFindSolution.sqf +++ b/addons/mk6mortar/functions/fnc_dev_simulateFindSolution.sqf @@ -13,7 +13,7 @@ * ARRAY - [NUMBER - Elevation In Degrees, NUMBER - Shot Durration] * * Example: - * [_rangeToHit, _heightToHit, _muzzleVelocity, _airFriction, TIME_STEP] call FUNC(simulateFindSolution); + * [_rangeToHit, _heightToHit, _muzzleVelocity, _airFriction, TIME_STEP] call ace_mk6mortar_fnc_dev_simulateFindSolution; * * Public: No */ diff --git a/addons/mk6mortar/functions/fnc_rangeTablePreCalculatedValues.sqf b/addons/mk6mortar/functions/fnc_rangeTablePreCalculatedValues.sqf index 6904403b55..db87cb6000 100644 --- a/addons/mk6mortar/functions/fnc_rangeTablePreCalculatedValues.sqf +++ b/addons/mk6mortar/functions/fnc_rangeTablePreCalculatedValues.sqf @@ -133,135 +133,135 @@ case ((abs(_muzzleVelocity - 200) < 0.00001) && {(abs(_airFriction - -0.0001) < }; case ((abs(_muzzleVelocity - 70) < 0.00001) && {(abs(_airFriction - 0) < 0.00001)}): { [ - ["100","1497","9","1.3","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["150","1445","14","1.3","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["200","1390","19","1.4","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["250","1333","26","1.4","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["300","1272","34","1.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["350","1204","45","1.6","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["400","1127","61","1.8","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["450","1028","91","2.1","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"] + ["100","1497","9","1.3","14.2","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["150","1445","14","1.3","14.1","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["200","1390","19","1.4","14.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["250","1333","26","1.4","13.8","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["300","1272","34","1.5","13.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["350","1204","45","1.6","13.2","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["400","1127","61","1.8","12.8","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["450","1028","91","2.1","12.1","0.0","0.0","0.0","0.0","0.0","0.0","0.0"] ] }; case ((abs(_muzzleVelocity - 140) < 0.00001) && {(abs(_airFriction - 0) < 0.00001)}): { [ - ["150","1562","1","0.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["200","1549","1","0.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["250","1536","2","0.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["300","1523","2","0.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["350","1510","2","0.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["400","1497","3","0.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["450","1484","3","0.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["500","1471","3","0.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["550","1458","4","0.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["600","1445","4","0.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["650","1431","4","0.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["700","1418","5","0.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["750","1404","5","0.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["800","1390","6","0.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["850","1376","6","0.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["900","1362","6","0.8","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["950","1348","7","0.8","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["1000","1333","7","0.8","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["1050","1318","8","0.8","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["1100","1303","9","0.8","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["1150","1288","9","0.8","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["1200","1272","10","0.8","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["1250","1256","11","0.8","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["1300","1239","12","0.8","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["1350","1222","13","0.9","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["1400","1205","13","0.9","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["1450","1187","15","0.9","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["1500","1168","16","0.9","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["1550","1148","18","1.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["1600","1127","19","1.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["1650","1105","21","1.1","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["1700","1082","24","1.1","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["1750","1057","27","1.2","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["1800","1029","31","1.3","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["1850","997","37","1.4","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["1900","960","46","1.6","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["1950","912","63","1.9","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"] + ["150","1562","1","0.7","28.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["200","1549","1","0.7","28.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["250","1536","2","0.7","28.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["300","1523","2","0.7","28.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["350","1510","2","0.7","28.4","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["400","1497","3","0.7","28.4","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["450","1484","3","0.7","28.4","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["500","1471","3","0.7","28.3","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["550","1458","4","0.7","28.3","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["600","1445","4","0.7","28.2","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["650","1431","4","0.7","28.2","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["700","1418","5","0.7","28.1","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["750","1404","5","0.7","28.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["800","1390","6","0.7","27.9","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["850","1376","6","0.7","27.9","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["900","1362","6","0.8","27.8","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["950","1348","7","0.8","27.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["1000","1333","7","0.8","27.6","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["1050","1318","8","0.8","27.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["1100","1303","9","0.8","27.3","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["1150","1288","9","0.8","27.2","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["1200","1272","10","0.8","27.1","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["1250","1256","11","0.8","26.9","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["1300","1239","12","0.8","26.8","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["1350","1222","13","0.9","26.6","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["1400","1205","13","0.9","26.4","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["1450","1187","15","0.9","26.2","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["1500","1168","16","0.9","26.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["1550","1148","18","1.0","25.8","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["1600","1127","19","1.0","25.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["1650","1105","21","1.1","25.2","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["1700","1082","24","1.1","24.9","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["1750","1057","27","1.2","24.6","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["1800","1029","31","1.3","24.2","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["1850","997","37","1.4","23.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["1900","960","46","1.6","23.1","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["1950","912","63","1.9","22.3","0.0","0.0","0.0","0.0","0.0","0.0","0.0"] ] }; case ((abs(_muzzleVelocity - 200) < 0.00001) && {(abs(_airFriction - 0) < 0.00001)}): { [ - ["300","1563","0","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["350","1556","1","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["400","1550","1","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["450","1544","1","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["500","1537","1","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["550","1531","1","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["600","1525","1","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["650","1519","1","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["700","1512","1","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["750","1506","1","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["800","1499","1","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["850","1493","1","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["900","1487","1","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["950","1480","1","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["1000","1474","2","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["1050","1467","2","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["1100","1461","2","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["1150","1454","2","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["1200","1448","2","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["1250","1441","2","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["1300","1435","2","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["1350","1428","2","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["1400","1422","2","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["1450","1415","2","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["1500","1408","2","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["1550","1402","3","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["1600","1395","3","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["1650","1388","3","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["1700","1381","3","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["1750","1374","3","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["1800","1367","3","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["1850","1360","3","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["1900","1353","3","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["1950","1346","4","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["2000","1339","4","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["2050","1332","4","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["2100","1325","4","0.6","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["2150","1317","4","0.6","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["2200","1310","4","0.6","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["2250","1302","4","0.6","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["2300","1295","5","0.6","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["2350","1287","5","0.6","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["2400","1280","5","0.6","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["2450","1272","5","0.6","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["2500","1264","5","0.6","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["2550","1256","5","0.6","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["2600","1248","6","0.6","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["2650","1240","6","0.6","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["2700","1232","6","0.6","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["2750","1223","6","0.6","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["2800","1215","7","0.6","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["2850","1206","7","0.6","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["2900","1197","7","0.6","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["2950","1188","7","0.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["3000","1179","8","0.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["3050","1170","8","0.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["3100","1160","8","0.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["3150","1151","9","0.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["3200","1141","9","0.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["3250","1131","10","0.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["3300","1120","10","0.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["3350","1109","11","0.8","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["3400","1098","11","0.8","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["3450","1087","12","0.8","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["3500","1075","13","0.8","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["3550","1062","14","0.8","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["3600","1049","15","0.9","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["3650","1036","16","0.9","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["3700","1021","17","0.9","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["3750","1006","19","1.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["3800","990","21","1.1","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["3850","971","24","1.1","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["3900","952","27","1.2","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["3950","929","32","1.4","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["4000","900","40","1.6","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], - ["4050","861","56","2.1","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"] + ["300","1563","0","0.5","40.8","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["350","1556","1","0.5","40.8","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["400","1550","1","0.5","40.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["450","1544","1","0.5","40.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["500","1537","1","0.5","40.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["550","1531","1","0.5","40.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["600","1525","1","0.5","40.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["650","1519","1","0.5","40.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["700","1512","1","0.5","40.6","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["750","1506","1","0.5","40.6","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["800","1499","1","0.5","40.6","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["850","1493","1","0.5","40.6","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["900","1487","1","0.5","40.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["950","1480","1","0.5","40.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["1000","1474","2","0.5","40.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["1050","1467","2","0.5","40.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["1100","1461","2","0.5","40.4","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["1150","1454","2","0.5","40.4","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["1200","1448","2","0.5","40.3","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["1250","1441","2","0.5","40.3","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["1300","1435","2","0.5","40.3","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["1350","1428","2","0.5","40.2","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["1400","1422","2","0.5","40.2","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["1450","1415","2","0.5","40.1","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["1500","1408","2","0.5","40.1","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["1550","1402","3","0.5","40.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["1600","1395","3","0.5","40.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["1650","1388","3","0.5","39.9","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["1700","1381","3","0.5","39.9","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["1750","1374","3","0.5","39.8","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["1800","1367","3","0.5","39.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["1850","1360","3","0.5","39.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["1900","1353","3","0.5","39.6","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["1950","1346","4","0.5","39.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["2000","1339","4","0.5","39.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["2050","1332","4","0.5","39.4","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["2100","1325","4","0.6","39.3","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["2150","1317","4","0.6","39.2","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["2200","1310","4","0.6","39.2","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["2250","1302","4","0.6","39.1","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["2300","1295","5","0.6","39.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["2350","1287","5","0.6","38.9","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["2400","1280","5","0.6","38.8","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["2450","1272","5","0.6","38.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["2500","1264","5","0.6","38.6","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["2550","1256","5","0.6","38.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["2600","1248","6","0.6","38.4","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["2650","1240","6","0.6","38.3","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["2700","1232","6","0.6","38.2","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["2750","1223","6","0.6","38.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["2800","1215","7","0.6","37.9","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["2850","1206","7","0.6","37.8","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["2900","1197","7","0.6","37.6","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["2950","1188","7","0.7","37.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["3000","1179","8","0.7","37.4","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["3050","1170","8","0.7","37.2","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["3100","1160","8","0.7","37.1","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["3150","1151","9","0.7","36.9","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["3200","1141","9","0.7","36.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["3250","1131","10","0.7","36.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["3300","1120","10","0.7","36.3","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["3350","1109","11","0.8","36.2","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["3400","1098","11","0.8","35.9","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["3450","1087","12","0.8","35.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["3500","1075","13","0.8","35.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["3550","1062","14","0.8","35.2","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["3600","1049","15","0.9","35.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["3650","1036","16","0.9","34.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["3700","1021","17","0.9","34.4","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["3750","1006","19","1.0","34.1","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["3800","990","21","1.1","33.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["3850","971","24","1.1","33.3","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["3900","952","27","1.2","32.8","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["3950","929","32","1.4","32.2","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["4000","900","40","1.6","31.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0"], + ["4050","861","56","2.1","30.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0"] ] }; default { diff --git a/addons/mk6mortar/stringtable.xml b/addons/mk6mortar/stringtable.xml index 26ab485db2..f1bbef9228 100644 --- a/addons/mk6mortar/stringtable.xml +++ b/addons/mk6mortar/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -56,6 +56,9 @@ MK6-Einstellungen MK6 - Nastavení Ajustes do MK6 + Option du MK6 + MK6 beállítások + Настройки MK6 Air Resistance @@ -64,6 +67,9 @@ Luftwiderstand Odpor vzduchu Resistência do Ar + Résistance de l'air + Légellenállás + Сопротивление воздуха For Player Shots, Model Air Resistance and Wind Effects @@ -72,6 +78,9 @@ Für Spielerschüsse, Luftwiderstand und Windeffekte Pro hráčovu střelbu, Model odporu vzduchu a povětrných podmínek Para disparos do jogador, modelo de resistência de ar e efeitos de vento + Pour les tirs de joueurs, modèle de résistance à l'air et d'effet du vent + Játékos általi lövésekhez, legyen-e számított légellenállás és szélhatás + Для выстрелов игрока. Моделирует сопротивление воздуха и эффект ветра Allow MK6 Computer @@ -80,6 +89,9 @@ Erlaube MK6-Computer MK6 - Povolit počítač Permitir computador do MK6 + Autoriser l'ordinateur de tir pour MK6 + MK6 számítógép engedélyezése + Разрешить компьютер MK6 Show the Computer and Rangefinder (these NEED to be removed if you enable air resistance) @@ -88,6 +100,9 @@ Zeige den Computer und den Entfernungsmesser an (diese MÜSSEN entfernt werden, wenn der Luftwiderstand aktiviert ist) Zobrazit počítač a dálkoměr (toto MUSÍ být odstraněno pokud je zapnut odpor vzduchu) Mostra o computador e o medidor de distância (estes DEVEM ser removidos se você habilitar resistência do ar) + Affiche l'ordinateur de tir (cette option doit être DESACTIVEE si la résisance à l'air est activée) + A távmérő és számítógép megjelenítése (ezeket el KELL távolítani ha a légellenállás engedélyezve van) + Показывает компьютер и дальномер (это НУЖНО отключить, если вы включаете сопротивление воздуха) Allow MK6 Compass @@ -96,6 +111,9 @@ Erlaube MK6-Kompass MK6 - Povolit kompas Permitir bússula do MK6 + Autoriser la boussole pour MK6 + MK6 iránytű engedélyezése + Разрешить компас MK6 Show the MK6 Digital Compass @@ -104,13 +122,18 @@ Zeige MK6-Digitaler-Kompass MK6 - Zobrazit digitální kompas Mostra a bússula digital do MK6 + Affiche la boussole digitale pour le MK6 + Az MK6 digitális iránytű megjelenítése + Показывает цифровой компас MK6 - + This module allows you to setup MK6 mortar settings. Moduł ten pozwala dostosować ustawienia moździerza MK6. Dieses Modul erlaubt das Einstellen des MK6-Mörsers. Tento modul umožňuje nastavení minometu MK6. Este módulo permite que você ajuste o morteiro MK6. + Модуль настройки миномета MK6. + Ce module permet de régler les options du mortier MK6 - \ No newline at end of file + diff --git a/addons/modules/README.md b/addons/modules/README.md new file mode 100644 index 0000000000..b13743b981 --- /dev/null +++ b/addons/modules/README.md @@ -0,0 +1,11 @@ +ace_modules +=========== + +Provides framework for module handling. + + +## Maintainers + +The people responsible for merging changes to this component or answering potential questions. + +- [Glowbal](https://github.com/Glowbal) diff --git a/addons/mx2a/README.md b/addons/mx2a/README.md index cbaf9add1b..f03edf1849 100644 --- a/addons/mx2a/README.md +++ b/addons/mx2a/README.md @@ -3,8 +3,9 @@ ace_mx2a Adds the MX-2A thermal imaging device. + ## Maintainers The people responsible for merging changes to this component or answering potential questions. -- [Ruthberg] (http://github.com/Ulteq) +- [Ruthberg](http://github.com/Ulteq) diff --git a/addons/mx2a/stringtable.xml b/addons/mx2a/stringtable.xml index e8df673866..f45e10bcaa 100644 --- a/addons/mx2a/stringtable.xml +++ b/addons/mx2a/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -8,6 +8,9 @@ MX-2A MX-2A MX-2A + MX-2A + MX-2A + MX-2A Thermal imaging device @@ -16,6 +19,9 @@ Dispositivo de imagen térmica Termální dalekohled Dispositivo de imagem térmica + Appareil d'imagerie thermique + Hőleképező készülék + Тепловизионный прибор diff --git a/addons/nametags/ACE_Settings.hpp b/addons/nametags/ACE_Settings.hpp index 2270c93f0a..354d5748bf 100644 --- a/addons/nametags/ACE_Settings.hpp +++ b/addons/nametags/ACE_Settings.hpp @@ -4,6 +4,7 @@ class ACE_Settings { typeName = "COLOR"; isClientSettable = 1; displayName = CSTRING(DefaultNametagColor); + category = CSTRING(Module_DisplayName); }; class GVAR(showPlayerNames) { value = 1; @@ -12,29 +13,34 @@ class ACE_Settings { displayName = CSTRING(ShowPlayerNames); description = CSTRING(ShowPlayerNames_Desc); values[] = {ECSTRING(common,Disabled), ECSTRING(common,Enabled), CSTRING(OnlyCursor), CSTRING(OnlyKeypress), CSTRING(OnlyCursorAndKeypress)}; + category = CSTRING(Module_DisplayName); }; class GVAR(showPlayerRanks) { value = 1; typeName = "BOOL"; isClientSettable = 1; displayName = CSTRING(ShowPlayerRanks); + category = CSTRING(Module_DisplayName); }; class GVAR(showVehicleCrewInfo) { value = 1; typeName = "BOOL"; isClientSettable = 1; displayName = CSTRING(ShowVehicleCrewInfo); + category = CSTRING(Module_DisplayName); }; class GVAR(showNamesForAI) { value = 0; typeName = "BOOL"; isClientSettable = 1; displayName = CSTRING(ShowNamesForAI); + category = CSTRING(Module_DisplayName); }; class GVAR(showCursorTagForVehicles) { value = 0; typeName = "BOOL"; isClientSettable = 0; + category = CSTRING(Module_DisplayName); }; class GVAR(showSoundWaves) { value = 1; @@ -43,16 +49,19 @@ class ACE_Settings { displayName = CSTRING(ShowSoundWaves); description = CSTRING(ShowSoundWaves_Desc); values[] = {ECSTRING(common,Disabled), CSTRING(NameTagSettings), CSTRING(AlwaysShowAll)}; + category = CSTRING(Module_DisplayName); }; class GVAR(playerNamesViewDistance) { value = 5; typeName = "SCALAR"; isClientSettable = 0; + category = CSTRING(Module_DisplayName); }; class GVAR(playerNamesMaxAlpha) { value = 0.8; typeName = "SCALAR"; isClientSettable = 0; + category = CSTRING(Module_DisplayName); }; class GVAR(tagSize) { value = 2; @@ -61,5 +70,6 @@ class ACE_Settings { displayName = CSTRING(TagSize_Name); description = CSTRING(TagSize_Description); values[] = {"$str_very_small", "$str_small", "$str_medium", "$str_large", "$str_very_large"}; + category = CSTRING(Module_DisplayName); }; }; diff --git a/addons/nametags/XEH_postInit.sqf b/addons/nametags/XEH_postInit.sqf index efc634be6c..b828d70005 100644 --- a/addons/nametags/XEH_postInit.sqf +++ b/addons/nametags/XEH_postInit.sqf @@ -66,8 +66,8 @@ GVAR(showNamesTime) = -10; // Change settings accordingly when they are changed ["SettingChanged", { - PARAMS_1(_name); - if (_name == QGVAR(showPlayerNames)) then { + params ["_name"]; + if (_name == QGVAR(showPlayerNames)) then { call FUNC(updateSettings); }; }] call EFUNC(common,addEventHandler); diff --git a/addons/nametags/functions/fnc_canShow.sqf b/addons/nametags/functions/fnc_canShow.sqf index b53f50c93e..5bccc8f91d 100644 --- a/addons/nametags/functions/fnc_canShow.sqf +++ b/addons/nametags/functions/fnc_canShow.sqf @@ -10,16 +10,12 @@ * Can show Crew Info * * Example: - * call ace_nametags_fnc_doShow + * call ace_nametags_fnc_canShow * * Public: No */ #include "script_component.hpp" -private ["_player"]; - -_player = ACE_player; - -vehicle _player != _player && +((vehicle ACE_player) != ACE_player) && {GVAR(ShowCrewInfo)} && -{!(vehicle _player isKindOf "ParachuteBase")}; +{!(vehicle ACE_player isKindOf "ParachuteBase")}; diff --git a/addons/nametags/functions/fnc_drawNameTagIcon.sqf b/addons/nametags/functions/fnc_drawNameTagIcon.sqf index 021a4e2a0b..7c98be16ed 100644 --- a/addons/nametags/functions/fnc_drawNameTagIcon.sqf +++ b/addons/nametags/functions/fnc_drawNameTagIcon.sqf @@ -13,26 +13,26 @@ * None * * Example: - * [ACE_player, _target, _alpha, _distance * 0.026, _icon] call ace_nametags_fnc_drawNameTagIcon + * [ACE_player, bob, 0.5, height, ICON_NAME_SPEAK] call ace_nametags_fnc_drawNameTagIcon * * Public: No */ #include "script_component.hpp" -PARAMS_5(_player,_target,_alpha,_heightOffset,_iconType); - -private ["_position", "_color", "_name", "_rank", "_size", "_icon", "_scale"]; +params ["_player", "_target", "_alpha", "_heightOffset", "_iconType"]; if (_iconType == ICON_NONE) exitWith {}; //Don't waste time if not visable +private ["_position", "_color", "_name", "_size", "_icon", "_scale"]; + //Set Icon: _icon = ""; _size = 0; -if ((_iconType == ICON_NAME_SPEAK) || (_iconType == ICON_SPEAK)) then { +if (_iconType in [ICON_NAME_SPEAK, ICON_SPEAK]) then { _icon = QUOTE(PATHTOF(UI\soundwave)) + str (floor (random 10)) + ".paa"; _size = 1; - _alpha = _alpha max 0.6;//Boost alpha when speaking + _alpha = (_alpha max 0.2) + 0.2;//Boost alpha when speaking } else { if (_iconType == ICON_NAME_RANK) then { _icon = format["\A3\Ui_f\data\GUI\Cfg\Ranks\%1_gs.paa",(toLower(rank _target))]; @@ -50,7 +50,7 @@ _name = if (_iconType in [ICON_NAME, ICON_NAME_RANK, ICON_NAME_SPEAK]) then { }; //Set Color: -if !(group _target == group _player) then { +if ((group _target) != (group _player)) then { _color = +GVAR(defaultNametagColor); //Make a copy, then multiply both alpha values (allows client to decrease alpha in settings) _color set [3, (_color select 3) * _alpha]; } else { @@ -58,7 +58,7 @@ if !(group _target == group _player) then { }; // Convert position to ASLW (expected by drawIcon3D) and add height offsets -_position = _target modelToWorldVisual ((_target selectionPosition "pilot") vectorAdd [0,0,(_heightOffset + .35)]); +_position = _target modelToWorldVisual ((_target selectionPosition "pilot") vectorAdd [0,0,(_heightOffset + .3)]); _scale = [0.333, 0.5, 0.666, 0.83333, 1] select GVAR(tagSize); diff --git a/addons/nametags/functions/fnc_getVehicleData.sqf b/addons/nametags/functions/fnc_getVehicleData.sqf index 6d83b0f573..b0e0b1ff34 100644 --- a/addons/nametags/functions/fnc_getVehicleData.sqf +++ b/addons/nametags/functions/fnc_getVehicleData.sqf @@ -22,7 +22,7 @@ private ["_type", "_varName", "_data", "_isAir", "_config", "_fnc_addTurret", "_fnc_addTurretUnit"]; -PARAMS_1(_type); +params ["_type"]; _varName = format ["ACE_CrewInfo_Cache_%1", _type]; _data = + (uiNamespace getVariable _varName); diff --git a/addons/nametags/functions/fnc_initIsSpeaking.sqf b/addons/nametags/functions/fnc_initIsSpeaking.sqf index 897d223930..4d4d576c52 100644 --- a/addons/nametags/functions/fnc_initIsSpeaking.sqf +++ b/addons/nametags/functions/fnc_initIsSpeaking.sqf @@ -19,7 +19,7 @@ if (isServer) then { //If someone disconnects while speaking, reset their variable addMissionEventHandler ["HandleDisconnect", { - PARAMS_1(_disconnectedPlayer); + params ["_disconnectedPlayer"]; if (_disconnectedPlayer getVariable [QGVAR(isSpeakingInGame), false]) then { _disconnectedPlayer setVariable [QGVAR(isSpeakingInGame), false, true]; }; @@ -30,7 +30,7 @@ if (!hasInterface) exitWith {}; ["playerChanged", { //When player changes, make sure to reset old unit's variable - PARAMS_2(_newUnit,_oldUnit); + params ["", "_oldUnit"]; if ((!isNull _oldUnit) && {_oldUnit getVariable [QGVAR(isSpeakingInGame), false]}) then { _oldUnit setVariable [QGVAR(isSpeakingInGame), false, true]; }; @@ -38,16 +38,16 @@ if (!hasInterface) exitWith {}; if (isClass (configFile >> "cfgPatches" >> "acre_api")) then { - diag_log text format ["[ACE_nametags] - ACRE Detected"]; + ACE_LOGINFO("ACRE Detected."); DFUNC(isSpeaking) = { - PARAMS_1(_unit); - (([_unit] call acre_api_fnc_isSpeaking) || ([ACE_player] call acre_api_fnc_isBroadcasting)) && {!(_unit getVariable ["ACE_isUnconscious", false])} + params ["_unit"]; + (([_unit] call acre_api_fnc_isSpeaking) || {[ACE_player] call acre_api_fnc_isBroadcasting}) && {!(_unit getVariable ["ACE_isUnconscious", false])} }; } else { if (isClass (configFile >> "cfgPatches" >> "task_force_radio")) then { - diag_log text format ["[ACE_nametags] - TFR Detected"]; + ACE_LOGINFO("TFR Detected."); DFUNC(isSpeaking) = { - PARAMS_1(_unit); + params ["_unit"]; (_unit getVariable ["tf_isSpeaking", false]) && {!(_unit getVariable ["ACE_isUnconscious", false])} }; } else { @@ -64,7 +64,7 @@ if (isClass (configFile >> "cfgPatches" >> "acre_api")) then { } , 0.1, []] call CBA_fnc_addPerFrameHandler; DFUNC(isSpeaking) = { - PARAMS_1(_unit); + params ["_unit"]; (_unit getVariable [QGVAR(isSpeakingInGame), false]) && {!(_unit getVariable ["ACE_isUnconscious", false])} }; }; diff --git a/addons/nametags/functions/fnc_moduleNameTags.sqf b/addons/nametags/functions/fnc_moduleNameTags.sqf index 7a6d2fa3c8..079e4aa704 100644 --- a/addons/nametags/functions/fnc_moduleNameTags.sqf +++ b/addons/nametags/functions/fnc_moduleNameTags.sqf @@ -1,6 +1,5 @@ /* * Author: esteldunedain - * * Initializes the name tags module. * * Arguments: @@ -14,7 +13,7 @@ if !(isServer) exitWith {}; -PARAMS_3(_logic,_units,_activated); +params ["_logic", "", "_activated"]; if !(_activated) exitWith {}; @@ -34,4 +33,4 @@ if ((_logic getVariable "showVehicleCrewInfo") != -1) then { [_logic, QGVAR(showVehicleCrewInfo), "showVehicleCrewInfo" ] call EFUNC(common,readSettingFromModule); }; -diag_log text "[ACE]: NameTags Module Initialized."; +ACE_LOGINFO("Nametags Module Initialized."); diff --git a/addons/nametags/functions/fnc_onDraw3d.sqf b/addons/nametags/functions/fnc_onDraw3d.sqf index 43996e17b2..bbf608b75a 100644 --- a/addons/nametags/functions/fnc_onDraw3d.sqf +++ b/addons/nametags/functions/fnc_onDraw3d.sqf @@ -17,8 +17,8 @@ private ["_onKeyPressAlphaMax", "_defaultIcon", "_distance", "_alpha", "_icon", "_targets", "_pos2", "_vecy", "_relPos", "_projDist", "_pos", "_target", "_targetEyePosASL", "_ambientBrightness", "_maxDistance"]; -//don't show nametags in spectator -if ((isNull ACE_player) || {!alive ACE_player}) exitWith {}; +//don't show nametags in spectator or if RscDisplayMPInterrupt is open +if ((isNull ACE_player) || {!alive ACE_player} || {!isNull (findDisplay 49)}) exitWith {}; _ambientBrightness = ((([] call EFUNC(common,ambientBrightness)) + ([0, 0.4] select ((currentVisionMode ace_player) != 0))) min 1) max 0; _maxDistance = _ambientBrightness * GVAR(PlayerNamesViewDistance); @@ -63,6 +63,7 @@ if ((GVAR(showPlayerNames) in [2,4]) && {_onKeyPressAlphaMax > 0}) then { {GVAR(showNamesForAI) || {[_target] call EFUNC(common,isPlayer)}} && {!(_target getVariable ["ACE_hideName", false])}) then { _distance = ACE_player distance _target; + if (_distance > (_maxDistance + 5)) exitWith {}; _alpha = (((1 - 0.2 * (_distance - _maxDistance)) min 1) * GVAR(playerNamesMaxAlpha)) min _onKeyPressAlphaMax; _icon = ICON_NONE; if (GVAR(showSoundWaves) == 2) then { //icon will be drawn below, so only show name here @@ -116,5 +117,6 @@ if (((GVAR(showPlayerNames) in [1,3]) && {_onKeyPressAlphaMax > 0}) || {GVAR(sho [ACE_player, _target, _alpha, _distance * 0.026, _icon] call FUNC(drawNameTagIcon); }; - } forEach _targets; + nil + } count _targets; }; diff --git a/addons/nametags/functions/fnc_setText.sqf b/addons/nametags/functions/fnc_setText.sqf index 33112c31d0..842c765de1 100644 --- a/addons/nametags/functions/fnc_setText.sqf +++ b/addons/nametags/functions/fnc_setText.sqf @@ -17,7 +17,7 @@ #define TextIDC 11123 -PARAMS_1(_text); +params ["_text"]; private["_ctrl"]; diff --git a/addons/nametags/stringtable.xml b/addons/nametags/stringtable.xml index a0048c4076..d3616d18f4 100644 --- a/addons/nametags/stringtable.xml +++ b/addons/nametags/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -116,6 +116,9 @@ Namensanzeigen Jmenovky Etiquetas de nome + NameTags + Névcímkék + Имена игроков Player Names View Dist. @@ -124,6 +127,9 @@ Spielernamen-Distanz Vzdálenost zobrazení jména hráčů Distância de visão dos nomes dos jogadores + Distance de vue des noms de joueurs + Játékosok nevének látótávja + Дистанция отображения имен Distance in meters at which player names are shown. Default: 5 @@ -132,6 +138,9 @@ Distanz in Metern bei der Spielernamen angezeigt werden. Standard: 5 Vzdálenost v metrech pro zobrazení jména. Výchozí: 5 Distância em metros que os nomes dos jogadores são mostrados. Padrão: 5 + Distance en mètres au delà de laquelle les noms de joueurs ne sont plus affichés. Défaut: 5 + Méterben megadott érték a játékosok nevének mutatására. Alapértelmezett: 5 + Дистанция в метрах, на которой отображаются имена игроков. По-умолчанию: 5 Show name tags for AI? @@ -140,6 +149,9 @@ Zeige Namensanzeigen für KI? Zobrazit jmenovky pro AI? Mostrar nomes para IA? + Afficher les noms pour les IA? + Névcímkék megjelenítése AI-nál? + Показывать имена ботов? Show the name and rank tags for friendly AI units? Default: Do not force @@ -148,6 +160,9 @@ Zeige den Namen und Rang für freundliche KI-Einheiten? Standard: nicht erwzingen Zobrazit jména a hodnosti pro spřátelené AI jednotky? Výchozí: Nevynucovat Mostra o nome e patente para unidades IA aliadas? Padrão: Não forçar + Affiche le nom et le rang pour les IA alliées? Défaut : ne pas forcer + Mutassa-e a szövetséges AI egységek nevét és rangját? Alapértelmezett: Nincs felülbírálás + Показывать имена и звания дружественных ботов? По-умолчанию: Не обязывать Force Hide @@ -156,6 +171,9 @@ Verstecken erzwingen Vynuceno skrýt Ocultar forçado + Forcer la désactivation + Erőltetett rejtett + Обязательно: Скрывать Force Show @@ -164,6 +182,9 @@ Anzeigen erzwingen Vynuceno zobrazit Mostrar forçado + Forcer l'affichage + Erőltetett látható + Обязательно: Показывать Show crew info? @@ -172,6 +193,9 @@ Zeige Besatzungsinfo? Zobrazit informace o posádce? Mostrar informação de tripulação? + Afficher les informations de l'équipage? + Legénységi adatok megjelenítése? + Показывать экипаж? Show vehicle crew info, or by default allows players to choose it on their own. Default: Do Not Force @@ -180,6 +204,9 @@ Zeige Fahrzeugbesatzungsinfo oder erlaube Spielern es auszuwählen. Standard: nicht erzwingen. Zobrazit informace o posádce, nebo nechat aby si hráč vybral sám. Výchozí: Nevynucovat Mostrar informações de tripulação ou por padrão permitir a escolha dos jogadores. Padrão: Não forçar. + Afficher les informations sur l'équipage d'un véhicule. Défaut: ne pas forcer + A legénységi adatok mutatása, alapértelmezett esetben a játékos által kiválasztható. Alapértelmezett: Nincs felülbírálás + Показывать информацию об экипаже техники, или по-умолчанию, позволяет игрокам выбрать свою настройку. По-умолчанию: Не обязывать Show for Vehicles @@ -188,14 +215,19 @@ Zeige bei Fahrzeugen Zobrazit pro vozidla Mostrar para veículos + Montrer pour les véhicules + Mutatás járműveknél + Показывать для техники - Show cursor NameTag for vehicle commander (only if client has name tags enabled)Default: No + Show cursor NameTag for vehicle commander (only if client has name tags enabled) Default: No Pokazuj imię dowódcy pojazdu nad pojazdem (tylko jeżeli klient ma włączone imiona graczy). Domyślnie: Nie Muestra etiquetas de nombre en el cursor para el comandante del vehiculo (solo si el cliente tiene las etiquetas de nombre activadas) Por defecto: No Zeige Maus-Namensanzeigen für Fahrzeugkommandanten (nur wenn der Client Namensanzeigen aktiviert hat). Standard: Nein Zobrazit jmenovky pro velitele vozidla (pouze pokud má klient jmenovky povolené). Výchozí: Ne Mostrar o nome no cursor para o comandante do veículo (somente se o cliente tiver etiquetas de nomes ativada). Padrão: Não + Показывать имя командира техники (только, если клиент включил отображение имен). По-умолчанию: Нет + Afficher les étiquettes de nom pour les commandants de véhicule (uniquement si l'affichage est activé pour le client). Défaut: non This module allows you to customize settings and range of Name Tags. @@ -204,6 +236,9 @@ Este módulo permite personalizar la configuración y la distancia de las Etiquetas de nombre. Tento modul umožňuje si přizpůsobit nastavení a vzdálenost jmenovky. Este módulo permite que você personalize as configurações e distâncias de etiquetas de nome. + Ce module permet le paramétrage de l'affichage des étiquettes des noms + Ez a modul lehetővé teszi a névcímkék beállításainak testreszabását. + Этот модуль позволяет настроить опции и дистанцию отображения имен игроков. Only on Cursor @@ -212,6 +247,9 @@ Nur bei Maus Pouze na kurzor Somente no cursor + Seulement sous le curseur + Csak kurzorra + Только под курсором Only on Keypress @@ -220,6 +258,9 @@ Nur bei Tastendruck Pouze na klávesu Somente em tecla ativada + Seulement par appui de touche + Csak gombnyomásra + Только по нажатию клавиши Only on Cursor and Keypress @@ -228,6 +269,9 @@ Nur Maus und Tastendruck Pouze na kurzor a klávesu Somente em cursor ou tecla ativada + Seulement sous le curseur et par appui de touche + Csak kurzorra és gombnyomásra + Под курсором или по нажатию клавиши Force Show Only on Cursor @@ -236,6 +280,9 @@ Vynuceno zobrazit pouze na kurzor Erzwinge nur mit Mauszeiger anzuzeigen Forçar mostrar somente no cursor + Forcer l'affichage sous le curseur uniquement + Erőltetett látható, csak kurzorra + Обязательно: Только под курсором Force Show Only on Keypress @@ -244,6 +291,9 @@ Vynuceno zobrazit pouze na klávesu Erzwinge nur mit Tastendruck anzuzeigen Forçar somente mostrar em tecla ativada + Forcer l'affichage par appui de touche uniquement + Erőltetett látható, csak gombnyomásra + Обязательно: Только по нажатию клавиши Force Show Only on Cursor and Keypress @@ -252,6 +302,9 @@ Vynuceno zobrazit pouze na kurzor a klávesu Erzwinge nur mit Mauszeiger und Tastendruck anzuzeigen Forçar mostrar somente em cursor e tecla ativada + Forcer l'affichage sous le curseur et par appui de touche uniquement + Erőltetett látható, csak kurzorra és gombnyomásra + Обязательно: Под курсором или по нажатию клавиши Use Nametag settings @@ -260,6 +313,9 @@ Verwende Namenanzeigen Použít nastavení jmenovky Usar ajustes de etiquetas de nome + Utiliser les paramètre des NamesTags + Névcímkék beállításának használata + Так же, как имена Always Show All @@ -268,6 +324,9 @@ Immer alle zeigen Vždy zobrazit vše Sempre mostrar tudo + Toujours montrer tout + Mindig minden mutatása + Всегда показывать Show player names and set their activation. Default: Enabled @@ -276,6 +335,9 @@ Zobrazit jména hráčů a nastavit jejich aktivaci. Výchozí: Povoleno Erlaubt das Anzeigen von Spielernamen und stellt ein, ob sie standardmäßig aktiviert oder deaktiviert sind. Standard: aktiviert Mostrar os nomes dos jogadores e definir sua ativação. Padrão: Ativado + Afficher les noms des joueurs et paramètre son activation. Défaut: activé + Mutassa a játékosok nevét és kezelje az aktivációjukat. Alapértelmezett: Engedélyezve + Показывать имена игроков и установить их активацию. По-умолчанию: Включено Effect of sound waves above the heads of speaking players after holding the PTT key. This option works with TFAR and ACRE2. @@ -284,6 +346,9 @@ Efekt zvukových vln nad hlavami hráčů když mluví skrz PTT klávesu. Tato volba funguje s TFAR a ACRE2. Es wird ein Schallwellensymbol über den Köpfen von sprechenden Spielern angezeigt, die ihre Push-to-Talk-Taste drücken. Diese Option funktioniert mit TFAR und ACRE2. Efeito de ondas sonoras acima das cabeças dos jogadores que falam depois mantendo pressionada a tecla PTT. Esta opção funciona com TFAR e ACRE2. + Icone au dessus de la tête du joueur qui parle après avoir utilisé la touche de PTT. Option compatible avec ACRE2 et TFAR + Hanghullám-effekt a beszélő játékosok feje felett a PTT-gomb lenyomásakor. Ez a beállítás TFAR és ACRE2 alatt működik. + Эффект звуковой волны над головами говорящих игроков при удерживании кнопки push-to-talk. Эта опация работает также с рациями TFAR и ACRE2. Nametags Size @@ -292,6 +357,9 @@ Velikost jmenovky Namensschildgröße Tamanho das etiquetas de nome + Taille des noms + Névcímkék mérete + Размер имен игроков Text and Icon Size Scaling @@ -300,6 +368,9 @@ Velikost textu a ikon Text- und Symbolgrößen Escala de tamanho dos ícones e textos + Taille du texte et des icones + Szöveg és ikon méretének skálázása + Масштабирование размера текста и иконок diff --git a/addons/nightvision/functions/fnc_blending.sqf b/addons/nightvision/functions/fnc_blending.sqf index 96e7f404a5..42d586248d 100644 --- a/addons/nightvision/functions/fnc_blending.sqf +++ b/addons/nightvision/functions/fnc_blending.sqf @@ -21,25 +21,24 @@ */ #include "script_component.hpp" -private ["_vehicle", "_weapon", "_ammo", "_magazine", "_player"]; +if (!hasInterface) exitWith {}; -_vehicle = _this select 0; -_weapon = _this select 1; -_ammo = _this select 4; -_magazine = _this select 5; +params ["_vehicle", "_weapon", "", "", "_ammo", "_magazine"]; +private "_player"; _player = ACE_player; + //If our vehicle didn't shoot, or we're not in NVG mode, exit if ((_vehicle != (vehicle _player)) || {(currentVisionMode _player) != 1}) exitWith {}; //If we are mounted, and it wasn't our weapon system that fired, exit if (_player != _vehicle && {!(_weapon in (_vehicle weaponsTurret ([_player] call EFUNC(common,getTurretIndex))))}) exitWith {}; -private ["_silencer", "_visibleFireCoef", "_visibleFireTimeCoef", "_visibleFire", "_visibleFireTime", "_nvgBrightnessCoef", "_fnc_isTracer", "_darkness"]; +private["_darkness", "_nvgBrightnessCoef", "_silencer", "_visibleFire", "_visibleFireCoef", "_visibleFireTime", "_visibleFireTimeCoef"]; _silencer = switch (_weapon) do { -case (primaryWeapon _player) : {primaryWeaponItems _player select 0}; -case (secondaryWeapon _player) : {secondaryWeaponItems _player select 0}; -case (handgunWeapon _player) : {handgunItems _player select 0}; + case (primaryWeapon _player): {(primaryWeaponItems _player) select 0}; + case (secondaryWeapon _player): {(secondaryWeaponItems _player) select 0}; + case (handgunWeapon _player): {(handgunItems _player) select 0}; default {""}; }; @@ -81,7 +80,7 @@ _darkness = 1 - (call EFUNC(common,ambientBrightness)); _visibleFire = _darkness * _visibleFireCoef * _visibleFire * _nvgBrightnessCoef / 10 min 1; _visibleFireTime = _darkness * _visibleFireTimeCoef * _visibleFireTime * _nvgBrightnessCoef / 10 min 0.5; -// ["NightVision", [_visibleFire, _visibleFireTime], {format ["visibleFire: %1 - visibleFireTime: %2", _this select 0, _this select 1]}] call AGM_Debug_fnc_log; //todo +TRACE_2("Player Shot, Adjusting NVG Effect", _visibleFire, _visibleFireTime); GVAR(ppEffectMuzzleFlash) ppEffectAdjust [1, 1, _visibleFire, [0, 0, 0, 0], [0, 0, 0, 1], [0, 0, 0, 1]]; GVAR(ppEffectMuzzleFlash) ppEffectCommit 0; diff --git a/addons/nightvision/functions/fnc_changeNVGBrightness.sqf b/addons/nightvision/functions/fnc_changeNVGBrightness.sqf index 22f96ce9b1..116ab9b5a5 100644 --- a/addons/nightvision/functions/fnc_changeNVGBrightness.sqf +++ b/addons/nightvision/functions/fnc_changeNVGBrightness.sqf @@ -16,9 +16,12 @@ */ #include "script_component.hpp" +params ["_player", "_changeInBrightness"]; +TRACE_2("params",_player,_changeInBrightness); + private ["_brightness"]; -PARAMS_2(_player,_changeInBrightness); +if (!hasInterface) exitWith {}; _brightness = _player getVariable [QGVAR(NVGBrightness), 0]; diff --git a/addons/nightvision/functions/fnc_updatePPEffects.sqf b/addons/nightvision/functions/fnc_updatePPEffects.sqf index 9906a440fc..72cd6cbd0d 100644 --- a/addons/nightvision/functions/fnc_updatePPEffects.sqf +++ b/addons/nightvision/functions/fnc_updatePPEffects.sqf @@ -15,6 +15,8 @@ */ #include "script_component.hpp" +if (!hasInterface) exitWith {}; + private ["_currentVehicle", "_grainSetting", "_blurSetting", "_radBlurSetting", "_config", "_hmd", "_cameraView", "_turret"]; _currentVehicle = vehicle ACE_player; diff --git a/addons/nightvision/script_component.hpp b/addons/nightvision/script_component.hpp index d322ea0799..9afeeb5d8d 100644 --- a/addons/nightvision/script_component.hpp +++ b/addons/nightvision/script_component.hpp @@ -1,6 +1,8 @@ #define COMPONENT nightvision #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL + #ifdef DEBUG_ENABLED_NIGHTVISION #define DEBUG_MODE_FULL #endif diff --git a/addons/noidle/README.md b/addons/noidle/README.md new file mode 100644 index 0000000000..4ea313bd57 --- /dev/null +++ b/addons/noidle/README.md @@ -0,0 +1,11 @@ +ace_noidle +=========== + +Removes idle animations. + + +## Maintainers + +The people responsible for merging changes to this component or answering potential questions. + +- [commy2](https://github.com/commy2) diff --git a/addons/noradio/CfgEventhandlers.hpp b/addons/noradio/CfgEventhandlers.hpp index d960e896df..386d98d241 100644 --- a/addons/noradio/CfgEventhandlers.hpp +++ b/addons/noradio/CfgEventhandlers.hpp @@ -1,6 +1,6 @@ + class Extended_PostInit_EventHandlers { - class ADDON { - clientInit = QUOTE(call COMPILE_FILE(XEH_post_initClient)); - serverInit = QUOTE(call COMPILE_FILE(XEH_post_initServer)); - }; -}; \ No newline at end of file + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_postInit)); + }; +}; diff --git a/addons/noradio/XEH_postInit.sqf b/addons/noradio/XEH_postInit.sqf new file mode 100644 index 0000000000..4aeccffd62 --- /dev/null +++ b/addons/noradio/XEH_postInit.sqf @@ -0,0 +1,24 @@ +// by commy2 +#include "script_component.hpp" + +// unmute unit if that player disconnects +if (isServer) then { + addMissionEventHandler ["HandleDisconnect", { + [_this select 0, "isPlayer"] call EFUNC(common,unmuteUnit); + }]; +}; + +if (!hasInterface) exitWith {}; + +// mutes/unmutes units when the player changes +["playerChanged", { + params ["_newPlayer", "_oldPlayer"]; + + // mute the new player + [_newPlayer, "isPlayer"] call EFUNC(common,muteUnit); + + // unmute the old player + if (alive _oldPlayer) then { + [_oldPlayer, "isPlayer"] call EFUNC(common,unmuteUnit); + }; +}] call EFUNC(common,addEventhandler); diff --git a/addons/noradio/XEH_post_initClient.sqf b/addons/noradio/XEH_post_initClient.sqf deleted file mode 100644 index ecd80a6436..0000000000 --- a/addons/noradio/XEH_post_initClient.sqf +++ /dev/null @@ -1,27 +0,0 @@ -// by commy2 -#include "script_component.hpp" - -/* -[{ - if (!isNull ACE_player) then { - [(_this select 1)] call cba_fnc_removePerFrameHandler; - - [ACE_player, "isPlayer"] call EFUNC(common,muteUnit); - }; -}, 0, []] call CBA_fnc_addPerFrameHandler; -*/ - -if (!hasInterface) exitWith {}; - -// Mutes/unmutes units when the player changes -["playerChanged", { - EXPLODE_2_PVT(_this,_newPlayer,_oldPlayer); - - // On player change mute the new player - [_newPlayer, "isPlayer"] call EFUNC(common,muteUnit); - - // Unmute the old player - if (alive _oldPlayer) then { - [_oldPlayer, "isPlayer"] call EFUNC(common,unmuteUnit); - }; -}] call EFUNC(common,addEventhandler); diff --git a/addons/noradio/XEH_post_initServer.sqf b/addons/noradio/XEH_post_initServer.sqf deleted file mode 100644 index ae2dc16ec1..0000000000 --- a/addons/noradio/XEH_post_initServer.sqf +++ /dev/null @@ -1,6 +0,0 @@ -// by commy2 -#include "script_component.hpp" - -addMissionEventHandler ["HandleDisconnect", { - [_this select 0, "isPlayer"] call EFUNC(common,unmuteUnit); -}]; diff --git a/addons/norearm/README.md b/addons/norearm/README.md new file mode 100644 index 0000000000..f0035e5749 --- /dev/null +++ b/addons/norearm/README.md @@ -0,0 +1,11 @@ +ace_norearm +=========== + +Removes rearm action. + + +## Maintainers + +The people responsible for merging changes to this component or answering potential questions. + +- [commy2](https://github.com/commy2) diff --git a/addons/optics/CfgEventHandlers.hpp b/addons/optics/CfgEventHandlers.hpp index 6c6e824b16..68962af2c4 100644 --- a/addons/optics/CfgEventHandlers.hpp +++ b/addons/optics/CfgEventHandlers.hpp @@ -1,4 +1,3 @@ - class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); diff --git a/addons/optics/CfgJointRails.hpp b/addons/optics/CfgJointRails.hpp new file mode 100644 index 0000000000..86c962afe5 --- /dev/null +++ b/addons/optics/CfgJointRails.hpp @@ -0,0 +1,15 @@ +class asdg_OpticRail; +class asdg_OpticRail1913: asdg_OpticRail { + class compatibleItems { + ACE_optic_Hamr_2D = 1; + ACE_optic_Hamr_PIP = 1; + ACE_optic_Arco_2D = 1; + ACE_optic_Arco_PIP = 1; + ACE_optic_MRCO_2D = 1; + ACE_optic_MRCO_PIP = 1; + ACE_optic_SOS_2D = 1; + ACE_optic_SOS_PIP = 1; + ACE_optic_LRPS_2D = 1; + ACE_optic_LRPS_PIP = 1; + }; +}; diff --git a/addons/optics/CfgOpticsEffect.hpp b/addons/optics/CfgOpticsEffect.hpp index a1bf62d6e3..8638277732 100644 --- a/addons/optics/CfgOpticsEffect.hpp +++ b/addons/optics/CfgOpticsEffect.hpp @@ -1,4 +1,3 @@ - class CfgOpticsEffect { class ACE_OpticsRadBlur1 { type = "radialblur"; diff --git a/addons/optics/CfgPreloadTextures.hpp b/addons/optics/CfgPreloadTextures.hpp index 57fa2cabf8..1354f91e18 100644 --- a/addons/optics/CfgPreloadTextures.hpp +++ b/addons/optics/CfgPreloadTextures.hpp @@ -1,4 +1,3 @@ - #define MACRO_PRELOAD \ GVAR(BodyDay) = "*"; \ GVAR(BodyNight) = "*"; \ diff --git a/addons/optics/CfgRscTitles.hpp b/addons/optics/CfgRscTitles.hpp index b7d2005d77..3bbd6b62bc 100644 --- a/addons/optics/CfgRscTitles.hpp +++ b/addons/optics/CfgRscTitles.hpp @@ -1,4 +1,3 @@ - class RscOpticsValue; class RscMapControl; class RscText; @@ -111,7 +110,7 @@ class RscInGameUI { idc = 1713011; x = "safeZoneXAbs + safeZoneWAbs - (safezoneX - safeZoneXABS) * ((getResolution select 4)/(16/3))"; colorBackground[] = {0,0,0,1}; - }; + }; }; class ACE_RscWeapon_Hamr: ACE_RscWeapon_base { diff --git a/addons/optics/CfgVehicles.hpp b/addons/optics/CfgVehicles.hpp index 92abeac04f..eda9a3d930 100644 --- a/addons/optics/CfgVehicles.hpp +++ b/addons/optics/CfgVehicles.hpp @@ -1,4 +1,3 @@ - class CfgVehicles { class Box_NATO_Support_F; class ACE_Box_Misc: Box_NATO_Support_F { diff --git a/addons/optics/CfgWeapons.hpp b/addons/optics/CfgWeapons.hpp index 11fdb1f427..1be66d3aa2 100644 --- a/addons/optics/CfgWeapons.hpp +++ b/addons/optics/CfgWeapons.hpp @@ -1,18 +1,17 @@ - class CfgWeapons { class ItemCore; class InventoryOpticsItem_Base_F; class Default; - + class Binocular: Default { forceOptics = 0; // Allow using compass with Binocular opticsZoomMin = 0.056889; // 5.25x power opticsZoomMax = 0.056889; // 9 px/mil - modelOptics = "\z\ace\addons\optics\models\NWD_M22_5x"; // 7 horizontal field of view + modelOptics = "\z\ace\addons\optics\models\NWD_M22_5x"; // 7 degrees horizontal field of view visionMode[] = {"Normal"}; // Can't use nvgs with binoculars any more than you can with scopes // Fix AI using Binocs on short range - #18737 // minRange = 300; // 300 = uses Rangefinder often (runs a few meters, stops, uses RF, repeats) - minRange = 500; //500 = seem almost never use it..? + minRange = 500; //500 = seem almost never use it..? minRangeProbab = 0.001; midRange = 1000; midRangeProbab = 0.01; diff --git a/addons/optics/README.md b/addons/optics/README.md index 2d7281cee7..a5224267b7 100644 --- a/addons/optics/README.md +++ b/addons/optics/README.md @@ -1,7 +1,7 @@ ace_optics =============== -Adds animated 2D optics. Some of them use picture in picture. +Adds animated 2D and PiP (picture-in-picture) optics. ## Maintainers diff --git a/addons/optics/XEH_postInit.sqf b/addons/optics/XEH_postInit.sqf index df6d0ae486..6214178ac9 100644 --- a/addons/optics/XEH_postInit.sqf +++ b/addons/optics/XEH_postInit.sqf @@ -3,16 +3,22 @@ if (!hasInterface) exitWith {}; +GVAR(camera) = objNull; + 0 = 0 spawn { waituntil {!isNull ACE_player}; + waituntil {sleep 1; {_x != GVAR(camera)} count allMissionObjects "camera" == 0 && {isNull curatorCamera}}; + + GVAR(camera) cameraEffect ["TERMINATE", "BACK"]; + camDestroy GVAR(camera); // PiP technique by BadBenson - GVAR(camera) = "camera" camCreate positioncameratoworld [0,0,0]; + GVAR(camera) = "camera" camCreate positionCameraToWorld [0,0,0]; GVAR(camera) camSetFov 0.7; GVAR(camera) camSetTarget ACE_player; GVAR(camera) camCommit 1; - "ace_optics_rendertarget0" setPiPEffect [2, 1.0, 1.0, 1.0, 0.0, [0.0, 1.0, 0.0, 0.25], [1.0, 0.0, 1.0, 1.0], [0.199, 0.587, 0.114, 0.0]]; + "ace_optics_rendertarget0" setPiPEffect [0]; GVAR(camera) cameraEffect ["INTERNAL", "BACK", "ace_optics_rendertarget0"]; }; @@ -23,18 +29,19 @@ if (!hasInterface) exitWith {}; }; }] call EFUNC(common,addEventHandler); -// camera has to be re-created every ACE_time another camera is created. Otherwise r2t is either black or transparent. @todo Add popular custom cameras to the event in ACE_common. +// camera has to be re-created every time another camera is created. Otherwise r2t is either black or transparent. @todo Add popular custom cameras to the event in ACE_common. ["activeCameraChanged", { if !(_this select 1) then { - deleteVehicle GVAR(camera); + GVAR(camera) cameraEffect ["TERMINATE", "BACK"]; + camDestroy GVAR(camera); // PiP technique by BadBenson - GVAR(camera) = "camera" camCreate positioncameratoworld [0,0,0]; + GVAR(camera) = "camera" camCreate positionCameraToWorld [0,0,0]; GVAR(camera) camSetFov 0.7; GVAR(camera) camSetTarget ACE_player; GVAR(camera) camCommit 1; - "ace_optics_rendertarget0" setPiPEffect [2, 1.0, 1.0, 1.0, 0.0, [0.0, 1.0, 0.0, 0.25], [1.0, 0.0, 1.0, 1.0], [0.199, 0.587, 0.114, 0.0]]; + "ace_optics_rendertarget0" setPiPEffect [0]; GVAR(camera) cameraEffect ["INTERNAL", "BACK", "ace_optics_rendertarget0"]; }; }] call EFUNC(common,addEventHandler); diff --git a/addons/optics/config.cpp b/addons/optics/config.cpp index 224410cdec..79f71842ee 100644 --- a/addons/optics/config.cpp +++ b/addons/optics/config.cpp @@ -30,5 +30,6 @@ class CfgPatches { #include "CfgRscTitles.hpp" #include "CfgVehicles.hpp" #include "CfgWeapons.hpp" +#include "CfgJointRails.hpp" #include "CfgPreloadTextures.hpp" diff --git a/addons/optics/functions/fnc_onDrawScope2D.sqf b/addons/optics/functions/fnc_onDrawScope2D.sqf index 7abee8f122..9ea038f877 100644 --- a/addons/optics/functions/fnc_onDrawScope2D.sqf +++ b/addons/optics/functions/fnc_onDrawScope2D.sqf @@ -22,8 +22,8 @@ _optic = (primaryWeaponItems ACE_player) select 2; _isPIP = (getText (configFile >> "CfgWeapons" >> _optic >> "ItemInfo" >> "modelOptics")) == QUOTE(PATHTOF(models\ace_optics_pip.p3d)); if (_isPIP) then { - GVAR(camera) setposATL positioncameratoworld [0,0,0.4]; - GVAR(camera) camPrepareTarget positioncameratoworld [0,0,50]; + GVAR(camera) setPosATL positionCameraToWorld [0,0,0.4]; + GVAR(camera) camPrepareTarget positionCameraToWorld [0,0,50]; GVAR(camera) camCommitPrepared 0; // @todo, check if that needs to be done at all diff --git a/addons/optionsmenu/config.cpp b/addons/optionsmenu/config.cpp index 17e4887db6..4acfef321f 100644 --- a/addons/optionsmenu/config.cpp +++ b/addons/optionsmenu/config.cpp @@ -32,3 +32,10 @@ class CfgAddons { class ACE_Extensions { extensions[] += {"ace_clipboard"}; }; + + +class CfgCommands { + allowedHTMLLoadURIs[] += { + "http://ace3mod.com/version.html" + }; +}; diff --git a/addons/optionsmenu/functions/fnc_exportSettings.sqf b/addons/optionsmenu/functions/fnc_exportSettings.sqf index 9d6437495d..172a95808e 100644 --- a/addons/optionsmenu/functions/fnc_exportSettings.sqf +++ b/addons/optionsmenu/functions/fnc_exportSettings.sqf @@ -16,7 +16,7 @@ #include "script_component.hpp" -private ["_compiledConfig", "_name", "_typeName", "_isClientSetable", "_localizedName", "_localizedDescription", "_possibleValues", "_defaultValue", "_value", "_compiledConfigEntry"]; +private ["_compiledConfig", "_name", "_typeName", "_isClientSetable", "_localizedName", "_localizedDescription", "_possibleValues", "_defaultValue", "_value", "_compiledConfigEntry", "_formatedValue"]; { /*_settingData = [ @@ -40,25 +40,39 @@ private ["_compiledConfig", "_name", "_typeName", "_isClientSetable", "_localize if (GVAR(ClientSettingsExportIncluded) || !_isClientSetable) then { _value = missionNamespace getvariable [_name, _defaultValue]; - if (_typeName == "STRING") then { - _value = format['"%1"', _value]; - }; - if (_typeName == "BOOL") then { - _value = if (typeName _value == "BOOL" && {_value}) then {1} else {0}; + _formatedValue = switch (toLower _typeName) do { + case ("scalar"): { + format['value = %1;', _value]; + }; + case ("string"): { + format['value = "%1";', _value]; + }; + case ("bool"): { + if (typeName _value != "BOOL") then {ERROR("weird bool typename??");}; + _value = if (((typeName _value) == "BOOL") && {_value}) then {1} else {0}; + format ['value = %1;', _value]; + }; + case ("color"): { + _value params [["_r",1], ["_b",0], ["_g",1], ["_a",1]]; + format ["value[] = {%1, %2, %3, %4};", _r, _b, _g, _a]; + }; + default { + ERROR("unknown typeName"); + "" + }; + }; _compiledConfigEntry = format [" class %1 { - value = %2; + %2 typeName = %3; force = 1; -};", _name, _value, format['"%1"', _typeName]]; +};", _name, _formatedValue, format['"%1"', _typeName]]; "ace_clipboard" callExtension _compiledConfigEntry; }; } forEach EGVAR(common,settings); - "ace_clipboard" callExtension "--COMPLETE--"; +"ace_clipboard" callExtension "--COMPLETE--"; [LSTRING(settingsExported)] call EFUNC(common,displayTextStructured); - - diff --git a/addons/optionsmenu/functions/fnc_onCategorySelectChanged.sqf b/addons/optionsmenu/functions/fnc_onCategorySelectChanged.sqf index 3b97892cdb..3129e32bef 100644 --- a/addons/optionsmenu/functions/fnc_onCategorySelectChanged.sqf +++ b/addons/optionsmenu/functions/fnc_onCategorySelectChanged.sqf @@ -16,7 +16,7 @@ #include "script_component.hpp" -private ["_settingsMenu"]; +private ["_settingsMenu", "_ctrlComboBox"]; disableSerialization; _settingsMenu = uiNamespace getVariable 'ACE_settingsMenu'; @@ -24,4 +24,4 @@ _settingsMenu = uiNamespace getVariable 'ACE_settingsMenu'; _ctrlComboBox = (_settingsMenu displayCtrl 14); GVAR(currentCategorySelection) = lbCurSel _ctrlComboBox; -[false] call FUNC(settingsMenuUpdateList); +[true] call FUNC(settingsMenuUpdateList); diff --git a/addons/optionsmenu/functions/fnc_onListBoxSettingsChanged.sqf b/addons/optionsmenu/functions/fnc_onListBoxSettingsChanged.sqf index 1543a2c8d5..b122d0da0e 100644 --- a/addons/optionsmenu/functions/fnc_onListBoxSettingsChanged.sqf +++ b/addons/optionsmenu/functions/fnc_onListBoxSettingsChanged.sqf @@ -18,24 +18,28 @@ private ["_settingIndex", "_rightDropDownIndex"]; -_settingIndex = lbCurSel 200; //Index of left list _rightDropDownIndex = lbCurSel 400; //Index of right drop down - if (_rightDropDownIndex < 0) then {_rightDropDownIndex = 0;}; +_settingIndex = -1; +if (((lnbCurSelRow 200) >= 0) && {(lnbCurSelRow 200) < ((lnbSize 200) select 0)}) then { + _settingIndex = lnbValue [200, [(lnbCurSelRow 200), 0]]; +}; +if (_settingIndex == -1) exitWith {}; + switch (GVAR(optionMenu_openTab)) do { case (MENU_TAB_OPTIONS): { if ((_settingIndex >= 0) && (_settingIndex < (count GVAR(clientSideOptions)))) then { - _settingIndex = (GVAR(clientSideOptions) select _settingIndex) select 0; - [MENU_TAB_OPTIONS, _settingIndex, _rightDropDownIndex] call FUNC(updateSetting); + _settingIndex = (GVAR(clientSideOptions) select _settingIndex) select 0; + [MENU_TAB_OPTIONS, _settingIndex, _rightDropDownIndex] call FUNC(updateSetting); }; [false] call FUNC(settingsMenuUpdateList); - }; + }; case (MENU_TAB_SERVER_OPTIONS): { if ((_settingIndex >= 0) && (_settingIndex < (count GVAR(serverSideOptions)))) then { - _settingIndex = (GVAR(serverSideOptions) select _settingIndex) select 0; - [MENU_TAB_SERVER_OPTIONS, _settingIndex, _rightDropDownIndex] call FUNC(updateSetting); + _settingIndex = (GVAR(serverSideOptions) select _settingIndex) select 0; + [MENU_TAB_SERVER_OPTIONS, _settingIndex, _rightDropDownIndex] call FUNC(updateSetting); }; [false] call FUNC(serverSettingsMenuUpdateList); - }; + }; }; diff --git a/addons/optionsmenu/functions/fnc_onServerCategorySelectChanged.sqf b/addons/optionsmenu/functions/fnc_onServerCategorySelectChanged.sqf index f294e27a5e..d134cda993 100644 --- a/addons/optionsmenu/functions/fnc_onServerCategorySelectChanged.sqf +++ b/addons/optionsmenu/functions/fnc_onServerCategorySelectChanged.sqf @@ -23,4 +23,4 @@ _settingsMenu = uiNamespace getVariable 'ACE_serverSettingsMenu'; _ctrlComboBox = (_settingsMenu displayCtrl 14); GVAR(currentCategorySelection) = lbCurSel _ctrlComboBox; -[false] call FUNC(serverSettingsMenuUpdateList); +[true] call FUNC(serverSettingsMenuUpdateList); diff --git a/addons/optionsmenu/functions/fnc_onServerSaveInputField.sqf b/addons/optionsmenu/functions/fnc_onServerSaveInputField.sqf index 11aadc76e4..fde370426f 100644 --- a/addons/optionsmenu/functions/fnc_onServerSaveInputField.sqf +++ b/addons/optionsmenu/functions/fnc_onServerSaveInputField.sqf @@ -18,9 +18,13 @@ private ["_settingIndex", "_inputText", "_setting", "_settingName", "_convertedValue"]; -_settingIndex = lbCurSel 200; //Index of left list _inputText = ctrlText 414; //Index of right drop down +_settingIndex = -1; +if (((lnbCurSelRow 200) >= 0) && {(lnbCurSelRow 200) < ((lnbSize 200) select 0)}) then { + _settingIndex = lnbValue [200, [(lnbCurSelRow 200), 0]]; +}; + switch (GVAR(optionMenu_openTab)) do { case (MENU_TAB_SERVER_VALUES): { if ((_settingIndex >= 0) && (_settingIndex < (count GVAR(serverSideValues)))) then { diff --git a/addons/optionsmenu/functions/fnc_onServerSettingsMenuOpen.sqf b/addons/optionsmenu/functions/fnc_onServerSettingsMenuOpen.sqf index 621493967e..6c0cb56519 100644 --- a/addons/optionsmenu/functions/fnc_onServerSettingsMenuOpen.sqf +++ b/addons/optionsmenu/functions/fnc_onServerSettingsMenuOpen.sqf @@ -72,7 +72,6 @@ lbClear (_menu displayCtrl 14); if (_x == "") then { _x = localize (LSTRING(category_all)); }; - if (isLocalized _x) then {_x = localize _x}; (_menu displayCtrl 14) lbAdd _x; } forEach GVAR(categories); diff --git a/addons/optionsmenu/functions/fnc_onSettingsMenuOpen.sqf b/addons/optionsmenu/functions/fnc_onSettingsMenuOpen.sqf index af3e2232f3..c71a26a6e7 100644 --- a/addons/optionsmenu/functions/fnc_onSettingsMenuOpen.sqf +++ b/addons/optionsmenu/functions/fnc_onSettingsMenuOpen.sqf @@ -56,9 +56,8 @@ if (GVAR(serverConfigGeneration) == 0) then { lbClear (_menu displayCtrl 14); { if (_x == "") then { - _x = localize "STR_ACE_OptionsMenu_category_all"; + _x = localize LSTRING(category_all); }; - if (isLocalized _x) then {_x = localize _x}; (_menu displayCtrl 14) lbAdd _x; } forEach GVAR(categories); diff --git a/addons/optionsmenu/functions/fnc_onSliderPosChanged.sqf b/addons/optionsmenu/functions/fnc_onSliderPosChanged.sqf index b69d8bd734..7df198cc5f 100644 --- a/addons/optionsmenu/functions/fnc_onSliderPosChanged.sqf +++ b/addons/optionsmenu/functions/fnc_onSliderPosChanged.sqf @@ -18,7 +18,11 @@ private ["_newColor", "_settingIndex"]; -_settingIndex = lbCurSel 200; +_settingIndex = -1; +if (((lnbCurSelRow 200) >= 0) && {(lnbCurSelRow 200) < ((lnbSize 200) select 0)}) then { + _settingIndex = lnbValue [200, [(lnbCurSelRow 200), 0]]; +}; +if (_settingIndex == -1) exitWith {}; switch (GVAR(optionMenu_openTab)) do { case (MENU_TAB_COLORS): { diff --git a/addons/optionsmenu/functions/fnc_resetSettings.sqf b/addons/optionsmenu/functions/fnc_resetSettings.sqf index 07fc43cdfc..8d6c3958c6 100644 --- a/addons/optionsmenu/functions/fnc_resetSettings.sqf +++ b/addons/optionsmenu/functions/fnc_resetSettings.sqf @@ -30,8 +30,8 @@ private ["_name", "_default", "_lastSelected"]; [MENU_TAB_COLORS, _name, _default] call FUNC(updateSetting); } forEach GVAR(clientSideColors); -_lastSelected = lbCurSel 200; +_lastSelected = lnbCurSelRow 200; [GVAR(optionMenu_openTab)] call FUNC(onListBoxShowSelectionChanged); if (_lastSelected != -1) then { - lbSetCurSel [200, _lastSelected]; + lnbSetCurSelRow [200, _lastSelected]; }; diff --git a/addons/optionsmenu/functions/fnc_serverResetSettings.sqf b/addons/optionsmenu/functions/fnc_serverResetSettings.sqf index 434e622818..d9f6a4ad96 100644 --- a/addons/optionsmenu/functions/fnc_serverResetSettings.sqf +++ b/addons/optionsmenu/functions/fnc_serverResetSettings.sqf @@ -36,7 +36,7 @@ private ["_name", "_default", "_lastSelected"]; [MENU_TAB_SERVER_VALUES, _name, _default] call FUNC(updateSetting); } forEach GVAR(serverSideVakyes); -_lastSelected = lbCurSel 200; +_lastSelected = lnbCurSelRow 200; [GVAR(optionMenu_openTab)] call FUNC(onserverListBoxShowSelectionChanged); if (_lastSelected != -1) then { lbSetCurSel [200, _lastSelected]; diff --git a/addons/optionsmenu/functions/fnc_serverSettingsMenuUpdateKeyView.sqf b/addons/optionsmenu/functions/fnc_serverSettingsMenuUpdateKeyView.sqf index ac25d719e1..87532aaf86 100644 --- a/addons/optionsmenu/functions/fnc_serverSettingsMenuUpdateKeyView.sqf +++ b/addons/optionsmenu/functions/fnc_serverSettingsMenuUpdateKeyView.sqf @@ -16,11 +16,10 @@ #include "script_component.hpp" -private ["_settingsMenu", "_ctrlList", "_collection", "_settingIndex", "_setting", "_entryName", "_localizedName", "_localizedDescription", "_possibleValues", "_settingsValue", "_currentColor", "_expectedType", "_filteredCollection", "_selectedCategory"]; +private ["_settingsMenu", "_collection", "_settingIndex", "_setting", "_entryName", "_localizedName", "_localizedDescription", "_possibleValues", "_settingsValue", "_currentColor", "_expectedType"]; disableSerialization; _settingsMenu = uiNamespace getVariable 'ACE_serverSettingsMenu'; -_ctrlList = _settingsMenu displayCtrl 200; _collection = switch (GVAR(optionMenu_openTab)) do { case MENU_TAB_SERVER_OPTIONS: {GVAR(serverSideOptions)}; @@ -29,24 +28,13 @@ _collection = switch (GVAR(optionMenu_openTab)) do { default {[]}; }; -_selectedCategory = GVAR(categories) select GVAR(currentCategorySelection); -_filteredCollection = []; -{ - if (_selectedCategory == "" || {_selectedCategory == (_x select 8)}) then { - _filteredCollection pushBack _x; - }; -} forEach _collection; +_settingIndex = -1; +if (((lnbCurSelRow 200) >= 0) && {(lnbCurSelRow 200) < ((lnbSize 200) select 0)}) then { + _settingIndex = lnbValue [200, [(lnbCurSelRow 200), 0]]; +}; -if (count _filteredCollection > 0) then { - _settingIndex = (lbCurSel _ctrlList); - if (_settingIndex > (count _filteredCollection)) then { - _settingIndex = count _filteredCollection - 1; - }; - - if (_settingIndex < 0) then { - _settingIndex = 0; - }; - _setting = _filteredCollection select _settingIndex; +if ((_settingIndex >= 0) && {_settingIndex <= (count _collection)}) then { + _setting = _collection select _settingIndex; _entryName = _setting select 0; _localizedName = _setting select 3; diff --git a/addons/optionsmenu/functions/fnc_serverSettingsMenuUpdateList.sqf b/addons/optionsmenu/functions/fnc_serverSettingsMenuUpdateList.sqf index 4a6648878a..fc745c37be 100644 --- a/addons/optionsmenu/functions/fnc_serverSettingsMenuUpdateList.sqf +++ b/addons/optionsmenu/functions/fnc_serverSettingsMenuUpdateList.sqf @@ -16,26 +16,26 @@ #include "script_component.hpp" -private ["_settingsMenu", "_ctrlList", "_settingsText", "_color", "_settingsColor", "_updateKeyView", "_settingsValue", "_selectedCategory"]; +private ["_settingName", "_added", "_settingsMenu", "_ctrlList", "_settingsText", "_color", "_settingsColor", "_updateKeyView", "_settingsValue", "_selectedCategory"]; DEFAULT_PARAM(0,_updateKeyView,true); disableSerialization; _settingsMenu = uiNamespace getVariable 'ACE_serverSettingsMenu'; _ctrlList = _settingsMenu displayCtrl 200; -lbclear _ctrlList; +lnbClear _ctrlList; _selectedCategory = GVAR(categories) select GVAR(currentCategorySelection); - +_added = 0; switch (GVAR(optionMenu_openTab)) do { case (MENU_TAB_SERVER_OPTIONS): { { - if (_selectedCategory == "" || _selectedCategory == (_X select 8)) then { - if ((_x select 3) != "") then { - _ctrlList lbadd (_x select 3); + if (_selectedCategory == "" || {_selectedCategory == (_x select 8)}) then { + _settingName = if ((_x select 3) != "") then { + (_x select 3); } else { - _ctrlList lbadd (_x select 0); + (_x select 0); }; _settingsValue = _x select 9; @@ -47,41 +47,45 @@ switch (GVAR(optionMenu_openTab)) do { (_x select 5) select _settingsValue; }; - _ctrlList lbadd (_settingsText); + _added = _ctrlList lnbAddRow [_settingName, _settingsText]; + _ctrlList lnbSetValue [[_added, 0], _forEachIndex]; }; }foreach GVAR(serverSideOptions); }; case (MENU_TAB_SERVER_COLORS): { { - if (_selectedCategory == "" || _selectedCategory == (_X select 8)) then { + if (_selectedCategory == "" || {_selectedCategory == (_x select 8)}) then { _color = +(_x select 9); { _color set [_forEachIndex, ((round (_x * 100))/100)]; } forEach _color; _settingsColor = str _color; - if ((_x select 3) != "") then { - _ctrlList lbadd (_x select 3); + _settingName = if ((_x select 3) != "") then { + (_x select 3); } else { - _ctrlList lbadd (_x select 0); + (_x select 0); }; - _ctrlList lbadd (_settingsColor); - _ctrlList lnbSetColor [[_forEachIndex, 1], (_x select 9)]; + + _added = _ctrlList lnbAddRow [_settingName, _settingsColor]; + _ctrlList lnbSetColor [[_added, 1], (_x select 9)]; + _ctrlList lnbSetValue [[_added, 0], _forEachIndex]; }; }foreach GVAR(serverSideColors); }; case (MENU_TAB_SERVER_VALUES): { { - if (_selectedCategory == "" || _selectedCategory == (_X select 8)) then { - if ((_x select 3) != "") then { - _ctrlList lbadd (_x select 3); + if (_selectedCategory == "" || {_selectedCategory == (_x select 8)}) then { + _settingName = if ((_x select 3) != "") then { + (_x select 3); } else { - _ctrlList lbadd (_x select 0); + (_x select 0); }; _settingsValue = _x select 9; - if (typeName _settingsValue != "STRINg") then { + if (typeName _settingsValue != "STRING") then { _settingsValue = format["%1", _settingsValue]; }; - _ctrlList lbadd (_settingsValue); + _added = _ctrlList lnbAddRow [_settingName, _settingsValue]; + _ctrlList lnbSetValue [[_added, 0], _forEachIndex]; }; }foreach GVAR(serverSideValues); }; diff --git a/addons/optionsmenu/functions/fnc_settingsMenuUpdateKeyView.sqf b/addons/optionsmenu/functions/fnc_settingsMenuUpdateKeyView.sqf index 442a1ceb50..64f45121e5 100644 --- a/addons/optionsmenu/functions/fnc_settingsMenuUpdateKeyView.sqf +++ b/addons/optionsmenu/functions/fnc_settingsMenuUpdateKeyView.sqf @@ -28,24 +28,13 @@ _collection = switch (GVAR(optionMenu_openTab)) do { default {[]}; }; -_selectedCategory = GVAR(categories) select GVAR(currentCategorySelection); -_filteredCollection = []; -{ - if (_selectedCategory == "" || {_selectedCategory == (_x select 8)}) then { - _filteredCollection pushBack _x; - }; -} forEach _collection; +_settingIndex = -1; +if (((lnbCurSelRow 200) >= 0) && {(lnbCurSelRow 200) < ((lnbSize 200) select 0)}) then { + _settingIndex = lnbValue [200, [(lnbCurSelRow 200), 0]]; +}; -if (count _filteredCollection > 0) then { - _settingIndex = (lbCurSel _ctrlList); - if (_settingIndex > (count _filteredCollection)) then { - _settingIndex = count _filteredCollection - 1; - }; - - if (_settingIndex < 0) then { - _settingIndex = 0; - }; - _setting = _filteredCollection select _settingIndex; +if ((_settingIndex >= 0) && {_settingIndex <= (count _collection)}) then { + _setting = _collection select _settingIndex; _entryName = _setting select 0; _localizedName = _setting select 3; diff --git a/addons/optionsmenu/functions/fnc_settingsMenuUpdateList.sqf b/addons/optionsmenu/functions/fnc_settingsMenuUpdateList.sqf index 18075a1844..96a45a1b83 100644 --- a/addons/optionsmenu/functions/fnc_settingsMenuUpdateList.sqf +++ b/addons/optionsmenu/functions/fnc_settingsMenuUpdateList.sqf @@ -16,22 +16,22 @@ #include "script_component.hpp" -private ["_settingsMenu", "_ctrlList", "_settingsText", "_color", "_settingsColor", "_updateKeyView", "_settingsValue", "_selectedCategory"]; +private ["_settingName", "_added", "_settingsMenu", "_ctrlList", "_settingsText", "_color", "_settingsColor", "_updateKeyView", "_settingsValue", "_selectedCategory"]; DEFAULT_PARAM(0,_updateKeyView,true); disableSerialization; _settingsMenu = uiNamespace getVariable 'ACE_settingsMenu'; _ctrlList = _settingsMenu displayCtrl 200; -lbclear _ctrlList; +lnbClear _ctrlList; _selectedCategory = GVAR(categories) select GVAR(currentCategorySelection); switch (GVAR(optionMenu_openTab)) do { case (MENU_TAB_OPTIONS): { { - if (_selectedCategory == "" || _selectedCategory == (_X select 8)) then { - _ctrlList lbadd (_x select 3); + if (_selectedCategory == "" || {_selectedCategory == (_x select 8)}) then { + _settingName = (_x select 3); _settingsValue = _x select 9; // Created disable/enable options for bools @@ -40,21 +40,24 @@ switch (GVAR(optionMenu_openTab)) do { } else { (_x select 5) select _settingsValue; }; - _ctrlList lbadd (_settingsText); + _added = _ctrlList lnbAddRow [_settingName, _settingsText]; + _ctrlList lnbSetValue [[_added, 0], _forEachIndex]; }; - }foreach GVAR(clientSideOptions); + } foreach GVAR(clientSideOptions); }; case (MENU_TAB_COLORS): { { - if (_selectedCategory == "" || _selectedCategory == (_X select 8)) then { + if (_selectedCategory == "" || {_selectedCategory == (_x select 8)}) then { _color = +(_x select 9); { _color set [_forEachIndex, ((round (_x * 100))/100)]; } forEach _color; _settingsColor = str _color; - _ctrlList lbadd (_x select 3); - _ctrlList lbadd (_settingsColor); - _ctrlList lnbSetColor [[_forEachIndex, 1], (_x select 9)]; + _settingName = (_x select 3); + + _added = _ctrlList lnbAddRow [_settingName, _settingsColor]; + _ctrlList lnbSetColor [[_added, 1], (_x select 9)]; + _ctrlList lnbSetValue [[_added, 0], _forEachIndex]; }; }foreach GVAR(clientSideColors); }; diff --git a/addons/optionsmenu/functions/fnc_stringEscape.sqf b/addons/optionsmenu/functions/fnc_stringEscape.sqf index fe3930f68c..1493f76445 100644 --- a/addons/optionsmenu/functions/fnc_stringEscape.sqf +++ b/addons/optionsmenu/functions/fnc_stringEscape.sqf @@ -14,7 +14,7 @@ * Public: No */ -private ["_str", "_array", "_maxIndex"]; +private ["_str", "_array", "_maxIndex", "_isEven"]; _str = _this; _isEven = { diff --git a/addons/optionsmenu/gui/settingsMenu.hpp b/addons/optionsmenu/gui/settingsMenu.hpp index 2c79bdab1d..cd65eb966d 100644 --- a/addons/optionsmenu/gui/settingsMenu.hpp +++ b/addons/optionsmenu/gui/settingsMenu.hpp @@ -256,7 +256,7 @@ class ACE_settingsMenu { idc = 1102; text = CSTRING(OpenExport); x = X_PART(18); - action = QUOTE(if (GVAR(serverConfigGeneration) > 0) then {createDialog 'ACE_serverSettingsMenu'; }); + action = QUOTE(if (GVAR(serverConfigGeneration) > 0) then {closeDialog 0; createDialog 'ACE_serverSettingsMenu';}); }; class action_debug: actionClose { idc = 1102; diff --git a/addons/optionsmenu/stringtable.xml b/addons/optionsmenu/stringtable.xml index bde7803e5a..6b4cad396b 100644 --- a/addons/optionsmenu/stringtable.xml +++ b/addons/optionsmenu/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -103,7 +103,7 @@ Abrir menú de exportación Открыть меню экспорта Otevřít exportovací menu - Otwórz menu eksportowania + Eksport ustawień Ouvrir le menu d'exportation Exportálási menü megnyitása Apri menù esportazione @@ -175,7 +175,7 @@ Incluir configuración de cliente Включить настройки клиента Zahrnout nastavení klienta - Zawrzyj ustawienia klienta + Zaw. ustaw. klienta Inclure paramètres client Kliens-beállítások melléklése Includi i parametri del client @@ -219,11 +219,14 @@ Allow Config Export [ACE] - Pozwól na eksport ustawień [ACE] + Pozwól na eksport ustawień [ACE] Permitir exportar configuración Erlaube Config-Export [ACE] Povolit export natavení [ACE] [ACE] Permitir exportação de configurações + Autoriser l'exportation de la configuration [ACE] + Konfiguráció-exportálás engedélyezése [ACE] + Разрешить экспорт настроек [ACE] Allow @@ -232,6 +235,9 @@ Erlaube Povolit Permitir + Autoriser + Engedélyezés + Разрешить Allow export of all settings to a server config formatted. @@ -240,6 +246,9 @@ Erlaube alle Einstellungen in einer Server-Config zu exportieren. Povolit exportovat všechna nastavení do formátu server configu. Permitir exportação de todas as configurações para uma configuração formatada de servidor. + Autorise l'exportation des toutes les options vers un fichier de configuration + Az összes beállítás szerver-konfigurációba való exportálásának engedélyezése. + Разрешить экспорт всех настроек в формате серверного конфига. When allowed, you have access to the settings modification and export in SP. Clicking export will place the formated config on your clipboard. @@ -248,6 +257,9 @@ Wenn erlaubt, können die Einstellungsmodifikationen angezeigt und im SP exportiert werden. Wenn auf "Exportieren" geklickt wird, wird eine formatierte Config-Datei in der Zwischenablage abgespeichert. Pokud je povoleno, budete mít přístup k modifikaci nastavení a exportování v SP. Kliknutím na export umístníte formátovaný config do vaší schránky. Quando permitido, você tem acesso à modificação de definições e exportação em SP. Clicando em exportação colocará a configuração formatada em sua área de transferência. + Quand autoriser, vous pouvez accéder au modification et à l'exporation en solo. Cliquer sur exporter placera la configuration dans le presse papier + Engedélyezéskor hozzáférést kapsz a beállítások módosításához és exportálásához egyjátékos módban. Exportáláskor a formázott konfiguráció a vágólapra kerül. + Когда разршен, у вас появляется доступ к модификации настроек и экспорту их в одинночном режиме. Нажатие на кнопку Экспорт поместит форматированные настройки в буфер обмена. Hide @@ -256,6 +268,9 @@ Verstecken Skrýt Ocultar + Cacher + Elrejtés + Скрыть Top right, downwards @@ -264,6 +279,9 @@ Open rechts, nach unten Vpravo nahoře, dolů Superior direito, para baixo + Haut droit, vers le bas + Jobb felül, lefele + Справа — сверху вниз Top right, to the left @@ -272,6 +290,9 @@ Von rechts nach links Vpravo nahoře, do leva Superior direito, à esquerda + Haut droit, vers la gauche + Jobb felül, balra + Сверху — справа налево Top left, downwards @@ -280,6 +301,9 @@ Von links, nach unten Vlevo nahoře, dolů Superior esquerdo, para baixo + Haut gauche, vers le bas + Bal felül, lefele + Слева - сверху вниз Top left, to the right @@ -288,6 +312,9 @@ Oben links nach rechts Vlevo nahoře, do prava Superior esquerdo, para a direita + Haut gauche, vers la droite + Bal felül, jobbra + Сверху — слева направо Top @@ -296,6 +323,9 @@ Oben Nahoře Acima + Haut + Fent + Сверху Bottom @@ -304,14 +334,20 @@ Unten Dole Abaixo + Bas + Alul + Снизу Debug To Clipboard - Debuguj do schowka + Debug do schowka Depurar al portapapeles Debug do schránky Debug in die Zwischenablage Depuração para área de transferência + Debug vers le presse papier + Debug a vágólapra + Отладка в буфер обмена Sends debug information to RPT and clipboard. @@ -323,9 +359,23 @@ Headbug Fix + Fix Headbug + HeadBug + "Fejhiba" fix + Corrigir Headbug + Fix Headbug + Fix Headbug + Corregir error de cabeza (headbug) Resets your animation state. + Resetuje aktualną animację. + Réinitialise l'état de l'animation + Visszaállítja az animációs állapotodat. + Redefine seu estado de animação. + Исправляет баг с зациклившейся анимацией. + Resetovat aktuální animaci. + Restablece tu estado de animación. ACE News @@ -333,7 +383,10 @@ ACE-Neuigkeiten Notícias do ACE Wiadomości ACE - ACE Novinky + ACE Zprávy + Nouveautés ACE + ACE hírek + Новости ACE Show News on Main Menu @@ -341,11 +394,25 @@ Zeige Neuigkeiten im Hauptmenü Mostrar notícias no menu principal Pokazuj wiadomości ACE w menu głównym - Zobrazit novinky v hlavním menu + Affiche les nouveautés sur l'écran principal + Hírek mutatása a főmenüben + Показывать новости в Главном Меню All Categories Wszystkie kategorie + Todas categorias + Все категории + Všechny Kategorie + Todas las categorías + + + Logistics + Logistyka + Logística + Логистика + Logistika + Logística diff --git a/addons/overheating/CfgWeapons.hpp b/addons/overheating/CfgWeapons.hpp index 025fa5e280..5c9717dbcf 100644 --- a/addons/overheating/CfgWeapons.hpp +++ b/addons/overheating/CfgWeapons.hpp @@ -9,7 +9,7 @@ class CfgWeapons { picture = QUOTE(PATHTOF(UI\spare_barrel_ca.paa)); scope = 2; class ItemInfo: InventoryItem_Base_F { - mass = 50; + mass = 30; }; }; diff --git a/addons/overheating/XEH_postInit.sqf b/addons/overheating/XEH_postInit.sqf index 0dad0dd32c..1b64d7f0b0 100644 --- a/addons/overheating/XEH_postInit.sqf +++ b/addons/overheating/XEH_postInit.sqf @@ -1,13 +1,13 @@ // by esteldunedain #include "script_component.hpp" -if !(hasInterface) exitWith {}; +if (!hasInterface) exitWith {}; // Add keybinds ["ACE3 Weapons", QGVAR(unjamWeapon), localize LSTRING(UnjamWeapon), { // Conditions: canInteract - if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false}; + if !([ACE_player, objNull, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false}; // Conditions: specific if !([ACE_player] call EFUNC(common,canUseWeapon) && {currentWeapon ACE_player in (ACE_player getVariable [QGVAR(jammedWeapons), []])} diff --git a/addons/overheating/functions/fnc_cooldown.sqf b/addons/overheating/functions/fnc_cooldown.sqf index 8fb0e0127b..9e54d35b56 100644 --- a/addons/overheating/functions/fnc_cooldown.sqf +++ b/addons/overheating/functions/fnc_cooldown.sqf @@ -39,7 +39,7 @@ while {true} do { if (_temperature < 1) exitWith {0}; if (isNil "_temperature") exitWith { - diag_log text format ["[ACE] ERROR: _totalTime = %1; _time = %2; _deltaTime = %3;", _totalTime, _time, _deltaTime]; + ACE_LOGERROR_3("_totalTime = %1; _time = %2; _deltaTime = %3;",_totalTime,_time,_deltaTime); 0 }; diff --git a/addons/overheating/functions/fnc_displayTemperature.sqf b/addons/overheating/functions/fnc_displayTemperature.sqf index 521b998fa7..73c790119d 100644 --- a/addons/overheating/functions/fnc_displayTemperature.sqf +++ b/addons/overheating/functions/fnc_displayTemperature.sqf @@ -28,8 +28,6 @@ _barrelMass = 0.50 * (getNumber (configFile >> "CfgWeapons" >> _weapon >> "Weapo // Calculate cooling _temperature = [_temperature, _barrelMass, ACE_time - _time] call FUNC(cooldown); -//["Overheating", _temperature, {format ["Temperature: %1 °C", _this]}] call EFUNC(common,log); - // Store new temperature _time = ACE_time; _player setVariable [_string, [_temperature, _time], false]; diff --git a/addons/overheating/functions/fnc_overheat.sqf b/addons/overheating/functions/fnc_overheat.sqf index ee1c8f9ff5..d7f40c4d91 100644 --- a/addons/overheating/functions/fnc_overheat.sqf +++ b/addons/overheating/functions/fnc_overheat.sqf @@ -165,8 +165,6 @@ if ("Jam" in (missionNamespace getvariable ["ACE_Debug", []])) then { _jamChance = 0.5; }; -["Overheating", [_temperature, _jamChance], {format ["Temperature: %1 - JamChance: %2", _this select 0, _this select 1]}] call EFUNC(common,log); - if (random 1 < _jamChance) then { [_unit, _weapon] call FUNC(jamWeapon); }; diff --git a/addons/overpressure/CfgEventHandlers.hpp b/addons/overpressure/CfgEventHandlers.hpp index 439270861b..6f8dba89bd 100644 --- a/addons/overpressure/CfgEventHandlers.hpp +++ b/addons/overpressure/CfgEventHandlers.hpp @@ -14,38 +14,38 @@ class Extended_PostInit_EventHandlers { class Extended_FiredBIS_EventHandlers { class CAManBase { class ADDON { - firedBIS = QUOTE(if (local (_this select 0) && {getNumber (configfile >> 'CfgWeapons' >> _this select 1 >> QUOTE(QGVAR(Damage))) > 0}) then {_this call DFUNC(fireLauncherBackblast)}); + firedBIS = QUOTE(if (local (_this select 0)) then {_this call FUNC(firedEHBB);};); }; }; class Tank { class ADDON { - firedBIS = QUOTE(if (local (_this select 0) && {getNumber (configfile >> 'CfgWeapons' >> _this select 1 >> QUOTE(QGVAR(Damage))) > 0}) then {_this call DFUNC(fireOverpressureZone)}); + firedBIS = QUOTE(if (local (_this select 0)) then {_this call FUNC(firedEHOP);};); }; }; class Car { class ADDON { - firedBIS = QUOTE(if (local (_this select 0) && {getNumber (configfile >> 'CfgWeapons' >> _this select 1 >> QUOTE(QGVAR(Damage))) > 0}) then {_this call DFUNC(fireOverpressureZone)}); + firedBIS = QUOTE(if (local (_this select 0)) then {_this call FUNC(firedEHOP);};); }; }; class Helicopter { class ADDON { - firedBIS = QUOTE(if (local (_this select 0) && {getNumber (configfile >> 'CfgWeapons' >> _this select 1 >> QUOTE(QGVAR(Damage))) > 0}) then {_this call DFUNC(fireOverpressureZone)}); + firedBIS = QUOTE(if (local (_this select 0)) then {_this call FUNC(firedEHOP);};); }; }; class Plane { class ADDON { - firedBIS = QUOTE(if (local (_this select 0) && {getNumber (configfile >> 'CfgWeapons' >> _this select 1 >> QUOTE(QGVAR(Damage))) > 0}) then {_this call DFUNC(fireOverpressureZone)}); + firedBIS = QUOTE(if (local (_this select 0)) then {_this call FUNC(firedEHOP);};); }; }; class Ship_F { class ADDON { - firedBIS = QUOTE(if (local (_this select 0) && {getNumber (configfile >> 'CfgWeapons' >> _this select 1 >> QUOTE(QGVAR(Damage))) > 0}) then {_this call DFUNC(fireOverpressureZone)}); + firedBIS = QUOTE(if (local (_this select 0)) then {_this call FUNC(firedEHOP);};); }; }; class StaticWeapon { class ADDON { - firedBIS = QUOTE(if (local (_this select 0) && {getNumber (configfile >> 'CfgWeapons' >> _this select 1 >> QUOTE(QGVAR(Damage))) > 0}) then {_this call DFUNC(fireOverpressureZone)}); + firedBIS = QUOTE(if (local (_this select 0)) then {_this call FUNC(firedEHOP);};); }; }; }; diff --git a/addons/overpressure/CfgWeapons.hpp b/addons/overpressure/CfgWeapons.hpp index e9170a4b2e..a88fa90894 100644 --- a/addons/overpressure/CfgWeapons.hpp +++ b/addons/overpressure/CfgWeapons.hpp @@ -3,6 +3,7 @@ class CfgWeapons { class LauncherCore; class Launcher: LauncherCore { + GVAR(priority) = 1; GVAR(angle) = 60; GVAR(range) = 10; GVAR(damage) = 0.7; @@ -11,6 +12,7 @@ class CfgWeapons { class Launcher_Base_F: Launcher {}; class launch_Titan_base: Launcher_Base_F { + GVAR(priority) = 1; GVAR(angle) = 40; GVAR(range) = 8; GVAR(damage) = 0.5; @@ -18,6 +20,7 @@ class CfgWeapons { class launch_Titan_short_base: launch_Titan_base { // Titan is a soft-launch launcher + GVAR(priority) = 1; GVAR(angle) = 30; GVAR(range) = 2; GVAR(damage) = 0.5; @@ -25,12 +28,14 @@ class CfgWeapons { class launch_NLAW_F: Launcher_Base_F { // NLAW is a soft-launch launcher + GVAR(priority) = 1; GVAR(angle) = 30; GVAR(range) = 2; GVAR(damage) = 0.6; }; class launch_RPG32_F: Launcher_Base_F { + GVAR(priority) = 1; GVAR(angle) = 60; GVAR(range) = 15; GVAR(damage) = 0.7; @@ -38,12 +43,14 @@ class CfgWeapons { class CannonCore; class cannon_120mm: CannonCore { + GVAR(priority) = 1; GVAR(angle) = 90; GVAR(range) = 50; GVAR(damage) = 0.85; }; class mortar_155mm_AMOS: CannonCore { + GVAR(priority) = 1; GVAR(angle) = 90; GVAR(range) = 60; GVAR(damage) = 1; diff --git a/addons/overpressure/README.md b/addons/overpressure/README.md index 3d3f242e40..fce4db7d3f 100644 --- a/addons/overpressure/README.md +++ b/addons/overpressure/README.md @@ -1,7 +1,7 @@ ace_overpressure ============= -Adds backblast to AT launchers and overpressure zones to tank cannons. +Adds backblast area to AT launchers and overpressure zones to tank cannons. ## Maintainers diff --git a/addons/overpressure/XEH_preInit.sqf b/addons/overpressure/XEH_preInit.sqf index 5eefc5eae4..d0ce7cbcf1 100644 --- a/addons/overpressure/XEH_preInit.sqf +++ b/addons/overpressure/XEH_preInit.sqf @@ -6,5 +6,7 @@ PREP(fireLauncherBackblast); PREP(fireOverpressureZone); PREP(getDistance); PREP(overpressureDamage); - +PREP(cacheOverPressureValues); +PREP(firedEHOP); +PREP(firedEHBB); ADDON = true; diff --git a/addons/overpressure/functions/fnc_cacheOverPressureValues.sqf b/addons/overpressure/functions/fnc_cacheOverPressureValues.sqf new file mode 100644 index 0000000000..0717065c43 --- /dev/null +++ b/addons/overpressure/functions/fnc_cacheOverPressureValues.sqf @@ -0,0 +1,76 @@ +/* + * Author: joko // Jonas + * + * Handle fire of local launchers + * + * Argument: + * 0: Weapon + * 1: Magazine + * 2: Ammo + * + * Return value: + * Array: + * 0: Angle + * 1: Range + * 2: Damage + * + */ + #include "script_component.hpp" + +params ["_weapon", "_ammo", "_magazine"]; +TRACE_3("Parameter",_weapon,_magazine,_ammo); + +private ["_array", "_type", "_return", "_config" /*, "_priority"*/]; + +// get Priority Array from Config +_array = [ + getNumber (configFile >> "CfgWeapons" >> QGVAR(priority)), + getNumber (configFile >> "CfgMagazines" >> QGVAR(priority)), + getNumber (configFile >> "CfgAmmo" >> QGVAR(priority)) +]; + +TRACE_1("Proiroity Array",_array); + +/* for CBA Upadte 2.1 +_priority = _array call CBA_fnc_findMax; +_type = if (isNil "_priority") then { + 0 +} else { + _priority select 1 +}; +*/ + +// obsolete as CBA Update 2.1 start +_array params ["_max"]; + +// set Default type +_type = 0; +// get Highest Entry out the the Priority Array +{ + if (_max < _x) then { + _max = _x; + _type = _forEachIndex; + }; +} forEach _array; +// obsolete end + +TRACE_2("Highest Value",_max,_type); +// create the Config entry Point +_config = [ + (configFile >> "CfgWeapons" >> _weapon), + (configFile >> "CfgMagazines" >> _magazine), + (configFile >> "CfgAmmo" >> _ammo) +] select _type; +TRACE_1("ConfigPath",_config); + +// get the Variables out of the Configes and create a array with then +_return = [ + (getNumber (_config >> QGVAR(angle))), + (getNumber (_config >> QGVAR(range))), + (getNumber (_config >> QGVAR(damage))) +]; +TRACE_1("Return",_return); +_varName = format [QGVAR(values%1%2%3), _weapon, _ammo, _magazine]; +missionNameSpace setVariable [format [QGVAR(values%1%2%3), _weapon, _ammo, _magazine], _return]; + +_return diff --git a/addons/overpressure/functions/fnc_fireLauncherBackblast.sqf b/addons/overpressure/functions/fnc_fireLauncherBackblast.sqf index d5c28cca44..1653fce9e1 100644 --- a/addons/overpressure/functions/fnc_fireLauncherBackblast.sqf +++ b/addons/overpressure/functions/fnc_fireLauncherBackblast.sqf @@ -3,22 +3,22 @@ * * Handle fire of local launchers * - * Argument: - * 0: Unit that fired (Object) - * 1: Weapon fired (String) - * 2: Muzzle (String) - * 3: Mode (String) - * 4: Ammo (String) - * 5: Magazine (String) - * 6: Projectile (Object) + * Arguments: + * 0: Unit that fired + * 1: Weapon fired + * 2: Muzzle + * 3: Mode + * 4: Ammo + * 5: Magazine + * 6: Projectile * * Return value: * None */ -//#define DEBUG_MODE_FULL + #include "script_component.hpp" -EXPLODE_7_PVT(_this,_firer,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); +params ["_firer", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile"]; // Prevent AI from causing backblast damage if !([_firer] call EFUNC(common,isPlayer)) exitWith {}; @@ -28,11 +28,16 @@ private ["_position", "_direction"]; _position = getPosASL _projectile; _direction = [0, 0, 0] vectorDiff (vectorDir _projectile); -private ["_backblastAngle", "_backblastRange", "_backblastDamage"]; +private ["_var","_varName","_backblastAngle", "_backblastRange", "_backblastDamage"]; +// Bake variable name and check if the variable exists, call the caching function otherwise +_varName = format [QGVAR(values%1%2%3), _weapon, _ammo, _magazine]; +_var = if (isNil _varName) then { + [_weapon, _ammo, _magazine] call FUNC(cacheOverPressureValues); +} else { + missionNameSpace getVariable _varName; +}; +_var params["_backblastAngle","_backblastRange","_backblastDamage"]; -_backblastAngle = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(angle)) / 2; -_backblastRange = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(range)); -_backblastDamage = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(damage)); // Damage to others private "_affected"; @@ -57,7 +62,7 @@ if (_distance < _backblastRange) then { [_damage * 100] call BIS_fnc_bloodEffect; if (isClass (configFile >> "CfgPatches" >> "ACE_Medical") && {([_firer] call EFUNC(medical,hasMedicalEnabled))}) then { - [_firer, "HitBody", [_firer, "body", ((_firer getHitPointDamage "HitBody") + _damage), _firer, "backblast"] call EFUNC(medical,handleDamage)] call EFUNC(medical,setHitPointDamage); + [_firer, "body", ((_firer getvariable [QEGVAR(medical,bodyPartStatus), [0,0,0,0,0,0]]) select 1) + _damage, _firer, "backblast", 0] call EFUNC(medical,handleDamage); } else { _firer setDamage (damage _firer + _damage); }; diff --git a/addons/overpressure/functions/fnc_fireOverpressureZone.sqf b/addons/overpressure/functions/fnc_fireOverpressureZone.sqf index 4438e4a859..3068928ba4 100644 --- a/addons/overpressure/functions/fnc_fireOverpressureZone.sqf +++ b/addons/overpressure/functions/fnc_fireOverpressureZone.sqf @@ -3,14 +3,14 @@ * * Handle fire of local vehicle weapons creating overpressure zones * - * Argument: - * 0: Unit that fired (Object) - * 1: Weapon fired (String) - * 2: Muzzle (String) - * 3: Mode (String) - * 4: Ammo (String) - * 5: Magazine (String) - * 6: Projectile (Object) + * Arguments: + * 0: Unit that fired + * 1: Weapon fired + * 2: Muzzle + * 3: Mode + * 4: Ammo + * 5: Magazine + * 6: Projectile * * Return value: * None @@ -18,8 +18,7 @@ //#define DEBUG_MODE_FULL #include "script_component.hpp" -EXPLODE_7_PVT(_this,_firer,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); - +params ["_firer", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile"]; // Prevent AI from causing overpressure damage if !([gunner _firer] call EFUNC(common,isPlayer)) exitWith {}; //@todo non-maingun turrets? @@ -28,18 +27,23 @@ private ["_position", "_direction"]; _position = getPosASL _projectile; _direction = vectorDir _projectile; -private ["_dangerZoneAngle", "_dangerZoneRange", "_dangerZoneDamage"]; +private ["_var", "_varName", "_dangerZoneAngle", "_dangerZoneRange", "_dangerZoneDamage"]; -_dangerZoneAngle = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(angle)) / 2; -_dangerZoneRange = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(range)); -_dangerZoneDamage = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(damage)); +// Bake variable name and check if the variable exists, call the caching function otherwise +_varName = format [QGVAR(values%1%2%3), _weapon, _ammo, _magazine]; +_var = if (isNil _varName) then { + [_weapon, _ammo, _magazine] call FUNC(cacheOverPressureValues); +} else { + missionNameSpace getVariable _varName; +}; +_var params["_dangerZoneAngle","_dangerZoneRange","_dangerZoneDamage"]; // Damage to others private "_affected"; _affected = getPos _projectile nearEntities ["CAManBase", _dangerZoneRange]; // Let each client handle their own affected units -["overpressure", _affected, [_firer, _position, _direction, _weapon]] call EFUNC(common,targetEvent); +["overpressure", _affected, [_firer, _position, _direction, _weapon, _magazine, _ammo]] call EFUNC(common,targetEvent); // Draw debug lines #ifdef DEBUG_MODE_FULL diff --git a/addons/overpressure/functions/fnc_firedEHBB.sqf b/addons/overpressure/functions/fnc_firedEHBB.sqf new file mode 100644 index 0000000000..cf2ac31561 --- /dev/null +++ b/addons/overpressure/functions/fnc_firedEHBB.sqf @@ -0,0 +1,32 @@ +/* + * Author: joko // Jonas + * + * Handle fire of local launchers + * + * Arguments: + * 0: Unit that fired + * 1: Weapon fired + * 2: Muzzle + * 3: Mode + * 4: Ammo + * 5: Magazine + * 6: Projectile + * + * Return value: + * None + */ +#include "script_component.hpp" +private ["_damage","_varName"]; +params ["", "_weapon", "", "", "_ammo", "_magazine", ""]; + +// Bake variable name and check if the variable exists, call the caching function otherwise +_varName = format [QGVAR(values%1%2%3), _weapon, _ammo, _magazine]; +_damage = if (isNil _varName) then { + ([_weapon, _ammo, _magazine] call FUNC(cacheOverPressureValues)) select 2; +} else { + (missionNameSpace getVariable _varName) select 2; +}; + +if (_damage > 0) then { + _this call DFUNC(fireLauncherBackblast) +}; diff --git a/addons/overpressure/functions/fnc_firedEHOP.sqf b/addons/overpressure/functions/fnc_firedEHOP.sqf new file mode 100644 index 0000000000..6cec770deb --- /dev/null +++ b/addons/overpressure/functions/fnc_firedEHOP.sqf @@ -0,0 +1,32 @@ +/* + * Author: joko // Jonas + * + * Handle fire of Other Weapons + * + * Arguments: + * 0: Unit that fired + * 1: Weapon fired + * 2: Muzzle + * 3: Mode + * 4: Ammo + * 5: Magazine + * 6: Projectile + * + * Return value: + * None + */ +#include "script_component.hpp" +private ["_damage","_varName"]; +params ["", "_weapon", "", "", "_ammo", "_magazine", ""]; + +// Bake variable name and check if the variable exists, call the caching function otherwise +_varName = format [QGVAR(values%1%2%3), _weapon, _ammo, _magazine]; +_damage = if (isNil _varName) then { + ([_weapon, _ammo, _magazine] call FUNC(cacheOverPressureValues)) select 2; +} else { + (missionNameSpace getVariable _varName) select 2; +}; + +if (_damage > 0) then { + _this call DFUNC(fireOverpressureZone) +}; diff --git a/addons/overpressure/functions/fnc_getDistance.sqf b/addons/overpressure/functions/fnc_getDistance.sqf index 905ecbd180..3b3103d951 100644 --- a/addons/overpressure/functions/fnc_getDistance.sqf +++ b/addons/overpressure/functions/fnc_getDistance.sqf @@ -3,13 +3,13 @@ * * Calculate the distance to the first intersection of a line * - * Argument: - * 0: Pos ASL of origin (Array) - * 1: Direction (Array) - * 2: Max distance to search (Number) + * Arguments: + * 0: Pos ASL of origin (ARRAY> + * 1: Direction + * 2: Max distance to search * * Return value: - * Distance to intersection (+- 0.1 m) + * Distance to intersection (+- 0.1 m) */ #include "script_component.hpp" diff --git a/addons/overpressure/functions/fnc_overpressureDamage.sqf b/addons/overpressure/functions/fnc_overpressureDamage.sqf index d1280b682f..a39aec3c14 100644 --- a/addons/overpressure/functions/fnc_overpressureDamage.sqf +++ b/addons/overpressure/functions/fnc_overpressureDamage.sqf @@ -4,23 +4,29 @@ * Calculate and apply backblast damage to potentially affected local units * * Argument: - * 0: Unit that fired (Object) - * 1: Pos ASL of the projectile (Array) - * 2: Direction of the projectile (Array) - * 3: Weapon fired (String) + * 0: Unit that fired + * 1: Pos ASL of the projectile + * 2: Direction of the projectile + * 3: Weapon fired + * 4: Magazine + * 5: Ammo * * Return value: * None */ #include "script_component.hpp" -EXPLODE_4_PVT(_this,_firer,_posASL,_direction,_weapon); +private ["_var","_overpressureAngle", "_overpressureRange", "_overpressureDamage"]; +params ["_firer", "_posASL", "_direction", "_weapon", "_magazine", "_ammo"]; -private ["_overpressureAngle", "_overpressureRange", "_overpressureDamage"]; - -_overpressureAngle = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(angle)) / 2; -_overpressureRange = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(range)); -_overpressureDamage = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(damage)); +// Bake variable name and check if the variable exists, call the caching function otherwise +_varName = format [QGVAR(values%1%2%3), _weapon, _ammo, _magazine]; +_var = if (isNil _varName) then { + [_weapon, _ammo, _magazine] call FUNC(cacheOverPressureValues); +} else { + missionNameSpace getVariable _varName; +}; +_var params["_overpressureAngle","_overpressureRange","_overpressureDamage"]; TRACE_4("Parameters:",_overpressureAngle,_overpressureRange,_overpressureDamage,_weapon); @@ -56,7 +62,7 @@ if (!surfaceIsWater _pos) then { if (_x == ACE_player) then {[_damage * 100] call BIS_fnc_bloodEffect}; if (isClass (configFile >> "CfgPatches" >> "ACE_Medical") && {([_x] call EFUNC(medical,hasMedicalEnabled))}) then { - [_x, "HitBody", [_x, "body", (_x getHitPointDamage "HitBody") + _damage, _firer, "backblast"] call EFUNC(medical,handleDamage)] call EFUNC(medical,setHitPointDamage); + [_x, "body", ((_x getvariable [QEGVAR(medical,bodyPartStatus), [0,0,0,0,0,0]]) select 1) + _damage, _firer, "backblast", 0] call EFUNC(medical,handleDamage); } else { _x setDamage (damage _x + _damage); }; diff --git a/addons/overpressure/script_component.hpp b/addons/overpressure/script_component.hpp index 3a44df1f9b..fbe7cd1238 100644 --- a/addons/overpressure/script_component.hpp +++ b/addons/overpressure/script_component.hpp @@ -9,4 +9,4 @@ #define DEBUG_SETTINGS DEBUG_ENABLED_OVERPRESSURE #endif -#include "\z\ace\addons\main\script_macros.hpp" \ No newline at end of file +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/addons/parachute/README.md b/addons/parachute/README.md index fcf1a36333..3dd2608152 100644 --- a/addons/parachute/README.md +++ b/addons/parachute/README.md @@ -3,6 +3,7 @@ ace_parachute Improves parachutes and adds an altimeter. + ## Maintainers The people responsible for merging changes to this component or answering potential questions. diff --git a/addons/parachute/stringtable.xml b/addons/parachute/stringtable.xml index 8a4b2d766c..ebedda7405 100644 --- a/addons/parachute/stringtable.xml +++ b/addons/parachute/stringtable.xml @@ -17,7 +17,7 @@ Altimeter Watch Montre altimètre Höhenmesser - Hodinky s výškoměrem + Hodinky s Výškoměrem Zegarek z wysokościomierzem Reloj altímetro Magasságmérős karóra @@ -43,7 +43,7 @@ Paracaídas no dirigible Parachute non manœuvrable Niesterowalny spadochron - Neříditelný padák + Neříditelný Padák Irányíthatatlan ejtőernyő Неуправляемый парашют Paracadute non manovrabile @@ -52,12 +52,24 @@ Cut Parachute Fallschirm abschneiden + Couper le parachute Odetnij spadochron + Ejtőernyő elvágása + Cortar para-quedas + Обрезать стропы + Odžíznout Padák + Cortar paracaídas Reserve Parachute Reserve Fallschirm + Mettre de coté le parachute (????) Spadochron awaryjny + Tartalék ejtőernyő + Para-quedas de reserva + Запасной парашют + Záložní Padák + Paracaídas de reserva - \ No newline at end of file + diff --git a/addons/protection/$PBOPREFIX$ b/addons/protection/$PBOPREFIX$ deleted file mode 100644 index 7ba9736ebe..0000000000 --- a/addons/protection/$PBOPREFIX$ +++ /dev/null @@ -1 +0,0 @@ -z\ace\addons\protection \ No newline at end of file diff --git a/addons/protection/CfgVehicles.hpp b/addons/protection/CfgVehicles.hpp deleted file mode 100644 index bce583e2ec..0000000000 --- a/addons/protection/CfgVehicles.hpp +++ /dev/null @@ -1,5 +0,0 @@ - -class CfgVehicles { - #include - #include -}; diff --git a/addons/protection/CfgWeapons.hpp b/addons/protection/CfgWeapons.hpp deleted file mode 100644 index 3f706fed41..0000000000 --- a/addons/protection/CfgWeapons.hpp +++ /dev/null @@ -1,4 +0,0 @@ - -class CfgWeapons { - #include -}; diff --git a/addons/protection/FixHelmets.hpp b/addons/protection/FixHelmets.hpp deleted file mode 100644 index eb2c515e50..0000000000 --- a/addons/protection/FixHelmets.hpp +++ /dev/null @@ -1,230 +0,0 @@ - -// INTEGER -#define HELMET_ARMOR_NO_PROTECTION 0 - -// FLOAT, 0-1 -#define HELMET_PASSTHROUGH_NO_PROTECTION 1 - -/*class InventoryItem_Base_F; -class HeadgearItem: InventoryItem_Base_F { - armor = 0; - passThrough = 1; -}; - -class H_HelmetB: ItemCore { - class ItemInfo: HeadgearItem { - //mass = 40; - armor = 4; - passThrough = 0.5; - }; -}; - -class H_HelmetB_camo: H_HelmetB { - class ItemInfo: HeadgearItem { - //mass = 40; - armor = 4; - passThrough = 0.5; - }; -}; - -class H_HelmetB_light: H_HelmetB { - class ItemInfo: ItemInfo { - //mass = 30; - armor = 3; - passThrough = 0.5; - }; -}; - -class H_Booniehat_khk: H_HelmetB { - class ItemInfo: ItemInfo { - //mass = 10; - armor = 0; - passThrough = 1; - }; -}; - -class H_HelmetB_plain_mcamo: H_HelmetB {}; - -class H_HelmetSpecB: H_HelmetB_plain_mcamo { - class ItemInfo: ItemInfo { - //mass = 50; - armor = 5; - passThrough = 0.5; - }; -}; - -class H_HelmetIA: H_HelmetB { - class ItemInfo: ItemInfo { - //mass = 40; - armor = 4; - passThrough = 0.5; - }; -}; - -class H_Cap_red: H_HelmetB { - class ItemInfo: ItemInfo { - //mass = 4; - armor = 0; - passThrough = 1; - }; -}; - -class H_Cap_headphones: H_HelmetB { - class ItemInfo: ItemInfo { - //mass = 8; - armor = 0; - passThrough = 1; - }; -}; - -class H_HelmetCrew_B: H_HelmetB { - class ItemInfo: ItemInfo { - //mass = 40; - armor = 4; - passThrough = 0.5; - }; -}; - -class H_PilotHelmetFighter_B: H_HelmetB { - class ItemInfo: ItemInfo { - //mass = 50; - armor = 5; - passThrough = 0.5; - }; -}; - -class H_PilotHelmetHeli_B: H_HelmetB { - class ItemInfo: ItemInfo { - //mass = 30; - armor = 3; - passThrough = 0.5; - }; -}; - -class H_CrewHelmetHeli_B: H_HelmetB { - class ItemInfo: ItemInfo { - //mass = 30; - armor = 3; - passThrough = 0.5; - }; -}; - -class H_HelmetO_ocamo: H_HelmetB { - class ItemInfo: ItemInfo { - //mass = 50; - armor = 5; - passThrough = 0.5; - }; -}; - -class H_HelmetLeaderO_ocamo: H_HelmetO_ocamo { - class ItemInfo: ItemInfo { - //mass = 60; - armor = 6; - passThrough = 0.5; - }; -}; - -class H_MilCap_ocamo: H_HelmetB { - class ItemInfo: ItemInfo { - //mass = 6; - armor = 0; - passThrough = 1; - }; -}; - -class H_BandMask_blk: H_HelmetB { - class ItemInfo: ItemInfo { - //mass = 8; - armor = 0; - passThrough = 1; - }; -}; - -class H_HelmetSpecO_ocamo: H_HelmetO_ocamo { - class ItemInfo: ItemInfo { - //mass = 40; - armor = 4; - passThrough = 0.5; - }; -}; - -class H_Bandanna_surfer: H_HelmetB { - class ItemInfo: ItemInfo { - //mass = 8; - armor = 0; - passThrough = 1; - }; -}; - -class H_Shemag_khk: H_HelmetB { - class ItemInfo: ItemInfo { - //mass = 6; - armor = 0; - passThrough = 1; - }; -}; - -class H_ShemagOpen_khk: H_HelmetB { - class ItemInfo: ItemInfo { - //mass = 6; - armor = 0; - passThrough = 1; - }; -}; - -class H_Beret_blk: H_HelmetB { - class ItemInfo: ItemInfo { - //mass = 6; - armor = 0; - passThrough = 1; - }; -}; - -class H_Beret_02: H_Beret_blk { - class ItemInfo: ItemInfo { - //mass = 6; - armor = 0; - passThrough = 1; - }; -}; - -class H_Watchcap_blk: H_HelmetB { - class ItemInfo: ItemInfo { - //mass = 6; - armor = 0; - passThrough = 1; - }; -}; - -class H_TurbanO_blk: H_HelmetB { - class ItemInfo: ItemInfo { - //mass = 8; - armor = 0; - passThrough = 1; - }; -}; - -class H_StrawHat: H_HelmetB { - class ItemInfo: ItemInfo { - //mass = 6; - armor = 0; - passThrough = 1; - }; -}; - -class H_Hat_blue: H_HelmetB { - class ItemInfo: ItemInfo { - //mass = 6; - armor = 0; - passThrough = 1; - }; -}; - -class H_RacingHelmet_1_F: H_HelmetB_camo { - class ItemInfo: ItemInfo { - //mass = 50; - armor = 5; - passThrough = 0.5; - }; -};*/ diff --git a/addons/protection/FixUniforms.hpp b/addons/protection/FixUniforms.hpp deleted file mode 100644 index 24c02b79aa..0000000000 --- a/addons/protection/FixUniforms.hpp +++ /dev/null @@ -1,569 +0,0 @@ - -class Man; -class CAManBase: Man { - class HitPoints { - class HitHead { - /*armor = 1; - passThrough = 1; - radius = 0.1; - explosionShielding = 0.5; - minimalHit = 0;*/ - }; - - class HitBody { - /*armor = 1; - passThrough = 1; - radius = 0.15; - explosionShielding = 10; - minimalHit = 0;*/ - }; - - class HitHands { - /*armor = 1; - passThrough = 1; - radius = 0.08; - explosionShielding = 1; - minimalHit = 0;*/ - }; - - class HitLegs { - /*armor = 1; - passThrough = 1; - radius = 0.1; - explosionShielding = 1; - minimalHit = 0;*/ - }; - }; - - /*armor = 2; - armorStructural = 5;*/ -}; - -class Civilian: CAManBase { - /*class HitPoints: HitPoints { - class HitHead: HitHead { - armor = 1; - }; - - class HitBody: HitBody { - armor = 2; - }; - - class HitHands: HitHands { - armor = 2; - }; - - class HitLegs: HitLegs { - armor = 2; - }; - };*/ -}; - -/*class Civilian_F: Civilian {}; -class C_man_1: Civilian_F {};*/ - -class SoldierWB: CAManBase {}; -class SoldierEB: CAManBase {}; -class SoldierGB: CAManBase {}; - -class B_Soldier_base_F: SoldierWB { - /*class HitPoints: HitPoints { - class HitHead: HitHead { - armor = 1; - }; - - class HitBody: HitBody { - armor = 2; - }; - - class HitHands: HitHands { - armor = 2; - }; - - class HitLegs: HitLegs { - armor = 2; - }; - }; - - armor = 2; - armorStructural = 5;*/ -}; - -class B_Soldier_02_f: B_Soldier_base_F { // t-shirt - /*class HitPoints: HitPoints { - class HitHead: HitHead { - armor = 1; - }; - - class HitBody: HitBody { - armor = 1; - }; - - class HitHands: HitHands { - armor = 1; - }; - - class HitLegs: HitLegs { - armor = 2; - }; - };*/ - - armorStructural = 5; //7; -}; - -class B_Soldier_03_f: B_Soldier_base_F { // sleeves - /*class HitPoints: HitPoints { - class HitHead: HitHead { - armor = 1; - }; - - class HitBody: HitBody { - armor = 2; - }; - - class HitHands: HitHands { - armor = 1; - }; - - class HitLegs: HitLegs { - armor = 2; - }; - };*/ - - armorStructural = 5; //7; -}; - -class B_Soldier_04_f: B_Soldier_base_F { // heli pilot - class HitPoints: HitPoints { - class HitHead: HitHead { - /*armor = 1; - passThrough = 1; - explosionShielding = 0.5;*/ - }; - - class HitBody: HitBody { - /*armor = 2;*/ - passThrough = 1; //0.5; - /*explosionShielding = 2.4;*/ - }; - - class HitHands: HitHands { - armor = 2; //8; - passThrough = 1; //0.5; - /*explosionShielding = 1.2;*/ - }; - - class HitLegs: HitLegs { - armor = 2; //8; - passThrough = 1; //0.5; - /*explosionShielding = 1.2;*/ - }; - }; -}; - -class B_Soldier_05_f: B_Soldier_base_F { // cas pilot - armorStructural = 5; //3; - - class HitPoints: HitPoints { - class HitHead: HitHead { - /*armor = 1; - passThrough = 1; - explosionShielding = 0.5;*/ - }; - - class HitBody: HitBody { - armor = 3; //2; - passThrough = 1; //0.5; - /*explosionShielding = 2.4;*/ - }; - - class HitHands: HitHands { - armor = 3; //8; - /*passThrough = 1; - explosionShielding = 1.2;*/ - }; - - class HitLegs: HitLegs { - armor = 3; //8; - /*passThrough = 1; - explosionShielding = 1.2;*/ - }; - }; -}; - -class B_Soldier_diver_base_F: B_Soldier_base_F { - /*class HitPoints: HitPoints { - class HitHead: HitHead { - armor = 2; - }; - - class HitBody: HitBody { - armor = 2; - }; - - class HitHands: HitHands { - armor = 2; - }; - - class HitLegs: HitLegs { - armor = 2; - }; - };*/ -}; - -// these appear to be broken, remnants from A2? -/*class C_man_p_fugitive_F: C_man_1 { - class HitPoints: HitPoints { - class HitBody: HitBody { - armor = "0.3*10"; - }; - - class HitLegs: HitLegs { - armor = "0.3*5"; - }; - }; -}; - -class C_man_w_worker_F: C_man_1 { - class HitPoints: HitPoints { - class HitBody: HitBody { - armor = "0.6*10"; - }; - - class HitHands: HitHands { - armor = "0.5*5"; - }; - - class HitLegs: HitLegs { - armor = "0.5*5"; - }; - }; -}; - -class C_man_hunter_1_F: C_man_1 { - class HitPoints: HitPoints { - class HitBody: HitBody { - armor = "0.6*10"; - }; - - class HitHands: HitHands { - armor = "0.5*5"; - }; - - class HitLegs: HitLegs { - armor = "0.5*5"; - }; - }; -}; - -class C_man_p_shorts_1_F: C_man_1 { - class HitPoints: HitPoints { - class HitLegs: HitLegs { - armor = "0.3*5"; - }; - }; -}; - -class C_man_pilot_F: C_man_1 { - class HitPoints: HitPoints { - class HitBody: HitBody { - armor = "0.6*10"; - }; - - class HitHands: HitHands { - armor = "0.5*5"; - }; - - class HitLegs: HitLegs { - armor = "0.5*5"; - }; - }; -};*/ - -class I_Soldier_base_F: SoldierGB { - /*class HitPoints: HitPoints { - class HitHead: HitHead { - armor = 1; - }; - - class HitBody: HitBody { - armor = 2; - }; - - class HitHands: HitHands { - armor = 2; - }; - - class HitLegs: HitLegs { - armor = 2; - }; - };*/ - - /*armor = 2;*/ - armorStructural = 5; //7; -}; - -class I_Soldier_02_F: I_Soldier_base_F { // sleeves - /*class HitPoints: HitPoints { - class HitHead: HitHead { - armor = 1; - }; - - class HitBody: HitBody { - armor = 2; - }; - - class HitHands: HitHands { - armor = 1; - }; - - class HitLegs: HitLegs { - armor = 2; - }; - };*/ -}; - -class I_Soldier_03_F: I_Soldier_base_F { // heli pilot - /*armorStructural = 5;*/ - - class HitPoints: HitPoints { - class HitHead: HitHead { - /*armor = 1; - passThrough = 1; - explosionShielding = 0.5;*/ - }; - - class HitBody: HitBody { - /*armor = 2;*/ - passThrough = 1; //0.5; - /*explosionShielding = 2.4;*/ - }; - - class HitHands: HitHands { - armor = 2; //8; - passThrough = 1; //0.5; - /*explosionShielding = 1.2;*/ - }; - - class HitLegs: HitLegs { - armor = 2; //8; - passThrough = 1; //0.5; - /*explosionShielding = 1.2;*/ - }; - }; -}; - -class I_Soldier_04_F: I_Soldier_base_F { // cas pilot - armorStructural = 5; //3; - - class HitPoints: HitPoints { - class HitHead: HitHead { - /*armor = 1; - passThrough = 1; - explosionShielding = 0.5;*/ - }; - - class HitBody: HitBody { - armor = 3; //2; - passThrough = 1; //0.5; - /*explosionShielding = 2.4;*/ - }; - - class HitHands: HitHands { - armor = 3; //8; - /*passThrough = 1; - explosionShielding = 1.2;*/ - }; - - class HitLegs: HitLegs { - armor = 3; //8; - /*passThrough = 1; - explosionShielding = 1.2;*/ - }; - }; -}; - -class I_Soldier_diver_base_F: I_Soldier_base_F { - /*class HitPoints: HitPoints { - class HitHead: HitHead { - armor = 2; - }; - - class HitBody: HitBody { - armor = 2; - }; - - class HitHands: HitHands { - armor = 2; - }; - - class HitLegs: HitLegs { - armor = 2; - }; - };*/ -}; - -class O_Soldier_base_F: SoldierEB { - class HitPoints: HitPoints { - class HitHead: HitHead { - /*armor = 1; - passThrough = 1; - explosionShielding = 0.5;*/ - }; - - class HitBody: HitBody { - armor = 4; //6; - passThrough = 0.85; //0.5; - /*explosionShielding = 1.5;*/ - }; - - class HitHands: HitHands { - armor = 4; //8; - passThrough = 0.85; //0.5; - /*explosionShielding = 0.8;*/ - }; - - class HitLegs: HitLegs { - armor = 4; //8; - passThrough = 0.85; //0.5; - /*explosionShielding = 0.8;*/ - }; - }; - - /*armor = 2; - armorStructural = 5;*/ -}; - -class O_officer_F: O_Soldier_base_F { - class HitPoints: HitPoints { - class HitHead: HitHead { - /*armor = 1; - passThrough = 1; - explosionShielding = 0.5;*/ - }; - - class HitBody: HitBody { - /*armor = 2; - passThrough = 1; - explosionShielding = 10;*/ - }; - - class HitHands: HitHands { - /*armor = 2; - passThrough = 1; - explosionShielding = 1;*/ - }; - - class HitLegs: HitLegs { - armor = 2; //8; - passThrough = 1; //0.5; - /*explosionShielding = 1;*/ - }; - }; -}; - -class O_Soldier_02_F: O_Soldier_base_F { // crew ? - armorStructural = 5; //3; - - class HitPoints: HitPoints { - class HitHead: HitHead { - /*armor = 1; - passThrough = 1; - explosionShielding = 0.5;*/ - }; - - class HitBody: HitBody { - armor = 4; //6; - passThrough = 0.85; //0.5; - /*explosionShielding = 1.5;*/ - }; - - class HitHands: HitHands { - armor = 4; //8; - passThrough = 0.85; //1; - /*explosionShielding = 0.8;*/ - }; - - class HitLegs: HitLegs { - armor = 4; //8; - passThrough = 0.85; //1; - /*explosionShielding = 0.8;*/ - }; - }; -}; - -class O_Soldier_diver_base_F: O_Soldier_base_F { - /*class HitPoints: HitPoints { - class HitHead: HitHead { - armor = 2; - }; - - class HitBody: HitBody { - armor = 2; - }; - - class HitHands: HitHands { - armor = 2; - }; - - class HitLegs: HitLegs { - armor = 2; - }; - };*/ -}; - -class O_Soldier_VR_F: O_Soldier_base_F { - /*class HitPoints: HitPoints { - class HitHead: HitHead { - armor = 1; - passThrough = 1; - explosionShielding = 0.5; - }; - - class HitBody: HitBody { - armor = 2; - passThrough = 1; - explosionShielding = 10; - }; - - class HitHands: HitHands { - armor = 2; - passThrough = 1; - explosionShielding = 1; - }; - - class HitLegs: HitLegs { - armor = 2; - passThrough = 1; - explosionShielding = 1; - }; - };*/ -}; - -class O_Protagonist_VR_F: O_Soldier_base_F { - /*class HitPoints: HitPoints { - class HitHead: HitHead { - armor = 1; - passThrough = 1; - explosionShielding = 0.5; - }; - - class HitBody: HitBody { - armor = 2; - passThrough = 1; - explosionShielding = 10; - }; - - class HitHands: HitHands { - armor = 2; - passThrough = 1; - explosionShielding = 1; - }; - - class HitLegs: HitLegs { - armor = 2; - passThrough = 1; - explosionShielding = 1; - }; - };*/ -}; diff --git a/addons/protection/FixVests.hpp b/addons/protection/FixVests.hpp deleted file mode 100644 index f3d1ad2b3d..0000000000 --- a/addons/protection/FixVests.hpp +++ /dev/null @@ -1,303 +0,0 @@ - -class ItemCore; -class VestItem; - -class Vest_Camo_Base: ItemCore { - class ItemInfo: VestItem { - /*containerClass = "Supply0"; - mass = 0; - armor = 0; - passThrough = 1;*/ - }; -}; -class Vest_NoCamo_Base: ItemCore { - class ItemInfo: VestItem { - /*containerClass = "Supply0"; - mass = 0; - armor = 0; - passThrough = 1;*/ - }; -}; - -// belts -class V_Rangemaster_belt: Vest_NoCamo_Base { - class ItemInfo: ItemInfo { - /*containerClass = "Supply40"; - mass = 10; - armor = 0; - passThrough = 1;*/ - }; -}; - -// bandolliers -class V_BandollierB_khk: Vest_Camo_Base { - class ItemInfo: ItemInfo { - /*containerClass = "Supply80"; - mass = 15; - armor = 0;*/ - passThrough = 0.85; //1; - }; -}; -/*class V_BandollierB_cbr: V_BandollierB_khk { - class ItemInfo: ItemInfo {}; -}; -class V_BandollierB_rgr: V_BandollierB_khk { - class ItemInfo: ItemInfo {}; -}; -class V_BandollierB_blk: V_BandollierB_khk { - class ItemInfo: ItemInfo {}; -}; -class V_BandollierB_oli: V_BandollierB_khk { - class ItemInfo: ItemInfo {}; -};*/ - -// plate carriers -class V_PlateCarrier1_rgr: Vest_NoCamo_Base { // lite - class ItemInfo: ItemInfo { - /*containerClass = "Supply140"; - mass = 80;*/ - armor = 8; //20; - passThrough = 0.75; //0.5; - }; -}; -class V_PlateCarrier2_rgr: V_PlateCarrier1_rgr { // heavy - class ItemInfo: ItemInfo { - /*containerClass = "Supply140"; - mass = 100;*/ - armor = 12; //30; - passThrough = 0.75; //0.5; - }; -}; -class V_PlateCarrier3_rgr: Vest_NoCamo_Base { // heavy (us) - class ItemInfo: ItemInfo { - /*containerClass = "Supply140"; - mass = 100;*/ - armor = 12; //30; - passThrough = 0.75; //0.5; - }; -}; -class V_PlateCarrierGL_rgr: Vest_NoCamo_Base { // lite (gl) - class ItemInfo: ItemInfo { - containerClass = "Supply160"; //"Supply140"; - /*mass = 100;*/ - armor = 8; //100; - passThrough = 0.75; //0.7; - }; -}; -class V_PlateCarrier1_blk: Vest_Camo_Base { // heavy (black) - class ItemInfo: ItemInfo { - /*containerClass = "Supply140";*/ - mass = 100; //80; - armor = 12; //20; - passThrough = 0.75; //0.5; - }; -}; -class V_PlateCarrierSpec_rgr: Vest_NoCamo_Base { // lite (special) - class ItemInfo: ItemInfo { - /*containerClass = "Supply100"; - mass = 120;*/ - armor = 16; //40; - passThrough = 0.75; //0.1; - }; -}; - -// chestrigs -/*class V_Chestrig_khk: Vest_Camo_Base { - class ItemInfo: ItemInfo { - containerClass = "Supply140"; - mass = 20; - armor = 0; - passThrough = 1; - }; -}; -class V_Chestrig_rgr: V_Chestrig_khk {}; -class V_Chestrig_blk: V_Chestrig_khk {}; -class V_Chestrig_oli: Vest_Camo_Base { - class ItemInfo: ItemInfo { - containerClass = "Supply140"; - mass = 20; - armor = 0; - passThrough = 1; - }; -};*/ - -// tactical vests -class V_TacVest_khk: Vest_Camo_Base { - class ItemInfo: ItemInfo { - /*containerClass = "Supply100"; - mass = 40;*/ - armor = 8; //20; - /*passThrough = 1;*/ - }; -}; -class V_TacVest_brn: V_TacVest_khk {}; -class V_TacVest_oli: V_TacVest_khk {}; -class V_TacVest_blk: V_TacVest_khk {}; -class V_TacVest_camo: Vest_Camo_Base { - class ItemInfo: ItemInfo { - /*containerClass = "Supply100"; - mass = 40;*/ - armor = 8; //20; - /*passThrough = 1;*/ - }; -}; -class V_TacVest_blk_POLICE: Vest_Camo_Base { - class ItemInfo: ItemInfo { - /*containerClass = "Supply100";*/ - mass = 40; //60; - armor = 8; //100; - passThrough = 1; //0.7; - }; -}; -class V_TacVestIR_blk: Vest_NoCamo_Base { // raven vest - class ItemInfo: VestItem { - /*containerClass = "Supply100"; - mass = 50;*/ - armor = 8; //20; - passThrough = 0.85; //0.5; - }; -}; -class V_TacVestCamo_khk: Vest_Camo_Base { - class ItemInfo: VestItem { - /*containerClass = "Supply100"; - mass = 40;*/ - armor = 8; //20; - /*passThrough = 1;*/ - }; -}; - -// harnesses -class V_HarnessO_brn: Vest_NoCamo_Base { - class ItemInfo: ItemInfo { - /*containerClass = "Supply160"; - mass = 30; - armor = 0;*/ - passThrough = 0.85; //0.5; - }; -}; -class V_HarnessOGL_brn: Vest_NoCamo_Base { // gl - class ItemInfo: ItemInfo { - /*containerClass = "Supply120"; - mass = 20; - armor = 0;*/ - passThrough = 0.85; //0.5; - }; -}; -class V_HarnessO_gry: V_HarnessO_brn { - class ItemInfo: ItemInfo { - /*containerClass = "Supply160"; - mass = 30; - armor = 0;*/ - passThrough = 0.85; //0.5; - }; -}; -class V_HarnessOGL_gry: V_HarnessO_gry { // gl - class ItemInfo: ItemInfo { - /*containerClass = "Supply120"; - mass = 20; - armor = 0;*/ - passThrough = 0.85; //0.5; - }; -}; -class V_HarnessOSpec_brn: V_HarnessO_brn { - class ItemInfo: VestItem { - /*containerClass = "Supply160"; - mass = 30; - armor = 0;*/ - passThrough = 0.85; //0.5; - }; -}; -class V_HarnessOSpec_gry: V_HarnessO_gry { - class ItemInfo: ItemInfo { - /*containerClass = "Supply160"; - mass = 30; - armor = 0;*/ - passThrough = 0.85; //0.5; - }; -}; - -// indep plate carriers -class V_PlateCarrierIA1_dgtl: Vest_NoCamo_Base { // lite - class ItemInfo: VestItem { - /*containerClass = "Supply120"; - mass = 60;*/ - armor = 8; //20; - passThrough = 0.75; //0.5; - }; -}; -class V_PlateCarrierIA2_dgtl: V_PlateCarrierIA1_dgtl { // heavy - class ItemInfo: VestItem { - /*containerClass = "Supply120"; - mass = 80;*/ - armor = 12; //30; - passThrough = 0.75; //0.5; - }; -}; -class V_PlateCarrierIAGL_dgtl: V_PlateCarrierIA2_dgtl { // heavy (gl) - class ItemInfo: VestItem { - containerClass = "Supply140"; //"Supply120"; - mass = 100; //80; - armor = 12; //100; - passThrough = 0.75; //0.7; - }; -}; - -// rebreather -/*class V_RebreatherB: Vest_Camo_Base { - class ItemInfo: ItemInfo { - containerClass = "Supply0"; - mass = 80; - armor = 20; - passThrough = 1; - }; -}; -class V_RebreatherIR: V_RebreatherB {}; -class V_RebreatherIA: V_RebreatherB {};*/ - -// more plate carriers -class V_PlateCarrier_Kerry: V_PlateCarrier1_rgr { // lighter - class ItemInfo: ItemInfo { - /*containerClass = "Supply140"; - mass = 80;*/ - armor = 8; //30; - passThrough = 0.75; //0.5; - }; -}; -class V_PlateCarrierL_CTRG: V_PlateCarrier1_rgr { // lite - class ItemInfo: ItemInfo { - /*containerClass = "Supply140"; - mass = 80;*/ - armor = 8; //20; - passThrough = 0.75; //0.5; - }; -}; -class V_PlateCarrierH_CTRG: V_PlateCarrier2_rgr { // heavy - class ItemInfo: ItemInfo { - /*containerClass = "Supply140"; - mass = 100;*/ - armor = 12; //30; - passThrough = 0.75; //0.5; - }; -}; - -// another tactical vest -class V_I_G_resistanceLeader_F: V_TacVest_camo { - class ItemInfo: ItemInfo {}; -}; - -// press vest -class V_Press_F: Vest_Camo_Base { - class ItemInfo: ItemInfo { - /*containerClass = "Supply40"; - mass = 20;*/ - armor = 8; //0; ? - /*passThrough = 1;*/ - }; -}; - -// marksman dlc -/*class V_PlateCarrierGL_blk: V_PlateCarrierGL_rgr {}; -class V_PlateCarrierGL_mtp: V_PlateCarrierGL_rgr {}; -class V_PlateCarrierSpec_blk: V_PlateCarrierSpec_rgr {}; -class V_PlateCarrierSpec_mtp: V_PlateCarrierSpec_rgr {}; -class V_PlateCarrierIAGL_oli: V_PlateCarrierIAGL_dgtl {};*/ diff --git a/addons/protection/script_component.hpp b/addons/protection/script_component.hpp deleted file mode 100644 index 1b2774a8ef..0000000000 --- a/addons/protection/script_component.hpp +++ /dev/null @@ -1,12 +0,0 @@ -#define COMPONENT protection -#include "\z\ace\addons\main\script_mod.hpp" - -#ifdef DEBUG_ENABLED_PROTECTION - #define DEBUG_MODE_FULL -#endif - -#ifdef DEBUG_ENABLED_PROTECTION - #define DEBUG_SETTINGS DEBUG_ENABLED_PROTECTION -#endif - -#include "\z\ace\addons\main\script_macros.hpp" \ No newline at end of file diff --git a/addons/ragdolls/README.md b/addons/ragdolls/README.md index b90ba9e5c9..86739775c3 100644 --- a/addons/ragdolls/README.md +++ b/addons/ragdolls/README.md @@ -1,7 +1,7 @@ ace_ragdolls ============ -Tweaks the ragdoll behaviour to be more resposive to bullet impacts and explosions. +Tweaks the ragdoll behaviour to be more responsive to bullet impacts and explosions. ## Maintainers diff --git a/addons/rangecard/README.md b/addons/rangecard/README.md index c96e151869..94169a3075 100644 --- a/addons/rangecard/README.md +++ b/addons/rangecard/README.md @@ -1,10 +1,11 @@ ace_rangecards =============== -Adds range cards +Adds range cards. + ## Maintainers The people responsible for merging changes to this component or answering potential questions. -- [Ruthberg] (http://github.com/Ulteq) \ No newline at end of file +- [Ruthberg](http://github.com/Ulteq) diff --git a/addons/rangecard/stringtable.xml b/addons/rangecard/stringtable.xml index bda93bcab3..309241a565 100644 --- a/addons/rangecard/stringtable.xml +++ b/addons/rangecard/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -8,6 +8,9 @@ Vzdálenostní tabulka Entfernungsspinne Tabela de distâncias + Table de tir + Távolsági kártya + Таблица поправок 50 METER increments -- MRAD/MRAD (reticle/turrets) @@ -16,6 +19,9 @@ Přidat 50 METRŮ -- MRAD/MRAD (síťka/věže) 50-Meter-Schritte MRAD/MRAD (Fadenkreuz/Geschützturm) Incrementos de 50 METROS - MRAD/MRAD (retícula/torres) + Incrément de 50m -- MRAD/MRAD (réticule/tourelle) + 50 MÉTERES lépések - MRAD/MRAD (célzó/lövegek) + Шаг 50 МЕТРОВ - MRAD/MRAD (сетка/маховички) Open Range Card @@ -24,6 +30,9 @@ Otevřít vzdálenostní tabulku Öffne Entfernungsspinne Abrir tabela de distâncias + Ouvrir la table de tir + Távolsági kártya kinyitása + Открыть таблицу поправок Open Range Card Copy @@ -32,6 +41,9 @@ Otevřít kopii vzdálenostní tabulky Öffne Kopie der Entfernungsspinne Abrir cópia da tabela de distâncias + Ouvrir une copie de la table de tir + Távolsági kártya-másolat kinyitása + Открыть копию таблицы поправок Open Range Card @@ -40,6 +52,9 @@ Otevřít vzdálenostní tabulku Öffne Entfernungsspinne Abrir tabela de distäncias + Ouvrir la table de tir + Távolsági kártya kinyitása + Открыть таблицу поправок Open Range Card Copy @@ -48,6 +63,9 @@ Otevřít kopii vzdálenostní tabulky Öffne Kopie der Entfernungsspinne Abrir cópia da tabela de distâncias + Ouvrir une copie de la table de tir + Távolsági kártya-másolat kinyitása + Открыть копию таблицы поправок Copy Range Card @@ -56,6 +74,9 @@ Kopírovat vzdálenostní tabulku Kopiere Entfernungsspinne Copiar tabela de distäncias + Recopier la table de tir + Távolsági kártya másolása + Скопировать таблицу поправок diff --git a/addons/realisticnames/CfgVehicles.hpp b/addons/realisticnames/CfgVehicles.hpp index aef52578e2..c3288815dd 100644 --- a/addons/realisticnames/CfgVehicles.hpp +++ b/addons/realisticnames/CfgVehicles.hpp @@ -633,4 +633,12 @@ class CfgVehicles { class Weapon_MMG_02_sand_F: Weapon_Base_F { displayName = CSTRING(MMG_02_sand); };*/ + + //attachments + + class Item_Base_F; + + class Item_acc_flashlight: Item_Base_F { + displayName="UTG Defender 126"; + }; }; diff --git a/addons/realisticnames/CfgWeapons.hpp b/addons/realisticnames/CfgWeapons.hpp index 0a83239047..83534a1083 100644 --- a/addons/realisticnames/CfgWeapons.hpp +++ b/addons/realisticnames/CfgWeapons.hpp @@ -1,4 +1,4 @@ - +class Mode_SemiAuto; class Mode_FullAuto; class CfgWeapons { @@ -510,14 +510,14 @@ class CfgWeapons { class player: player {}; }; - class cannon_105mm: cannon_120mm { + class cannon_105mm: CannonCore { displayName = "M68"; - class player: player { + class player: Mode_SemiAuto { displayName = "M68"; }; }; - class cannon_125mm: cannon_120mm { + class cannon_125mm: CannonCore { displayName = "2A46"; }; @@ -568,4 +568,12 @@ class CfgWeapons { displayName = "L21A1 RARDEN"; }; }; + + //attachments + + class Itemcore; + + class acc_flashlight: ItemCore { + displayName = "UTG Defender 126"; + }; }; diff --git a/addons/realisticnames/README.md b/addons/realisticnames/README.md index 145ec16a61..6cd05351f6 100644 --- a/addons/realisticnames/README.md +++ b/addons/realisticnames/README.md @@ -1,7 +1,7 @@ ace_realisticnames ================== -Changes the names of various weapons and vehicles to those of their RL counterparts. +Changes the names of various weapons and vehicles to those of their real life counterparts. ## Maintainers diff --git a/addons/realisticnames/stringtable.xml b/addons/realisticnames/stringtable.xml index 483242835f..5f84a4f16d 100644 --- a/addons/realisticnames/stringtable.xml +++ b/addons/realisticnames/stringtable.xml @@ -428,7 +428,7 @@ KamAZ transportowy KamAZ Valník KamAZ Transport - КамАЗ Траспортный + КамАЗ Транспортный KamAZ Transporte KamAZ szállítójármű KamAZ da trasporto @@ -440,7 +440,7 @@ KamAZ Transportowy (zakryty) KamAZ Valník (krytý) KamAZ Transport (bâché) - КамАЗ Траспортный (крытый) + КамАЗ Транспортный (крытый) KamAZ Transporte (coberto) KamAZ szállítójármű (ponyvás) KamAZ da trasporto (coperto) diff --git a/addons/recoil/README.md b/addons/recoil/README.md new file mode 100644 index 0000000000..0c81cde34a --- /dev/null +++ b/addons/recoil/README.md @@ -0,0 +1,11 @@ +ace_recoil +=========== + +Tweaks weapon recoils and adds camera shake. + + +## Maintainers + +The people responsible for merging changes to this component or answering potential questions. + +- [commy2](https://github.com/commy2) diff --git a/addons/reload/XEH_postInit.sqf b/addons/reload/XEH_postInit.sqf index 9d5110d330..e1dc9e8d51 100644 --- a/addons/reload/XEH_postInit.sqf +++ b/addons/reload/XEH_postInit.sqf @@ -1,7 +1,7 @@ // by esteldunedain #include "script_component.hpp" -if !(hasInterface) exitWith {}; +if (!hasInterface) exitWith {}; // Add keybinds ["ACE3 Weapons", QGVAR(checkAmmo), localize LSTRING(checkAmmo), @@ -27,8 +27,6 @@ if !(hasInterface) exitWith {}; // Listen for attempts to link ammo ["linkedAmmo", { EXPLODE_3_PVT(_this,_receiver,_giver,_magazine); - diag_log "linkedAmmo"; - diag_log _this; private ["_magazineCfg","_magazineType"]; _magazineType = currentMagazine _receiver; @@ -62,8 +60,6 @@ if !(hasInterface) exitWith {}; // Listen for returned magazines ["returnedAmmo", { EXPLODE_3_PVT(_this,_receiver,_giver,_magazine); - diag_log "returnedAmmo"; - diag_log _this; _receiver addMagazine _magazine; }] call EFUNC(common,addEventhandler); diff --git a/addons/reload/functions/fnc_canCheckAmmo.sqf b/addons/reload/functions/fnc_canCheckAmmo.sqf index 95ac2582a2..8fbb37c726 100644 --- a/addons/reload/functions/fnc_canCheckAmmo.sqf +++ b/addons/reload/functions/fnc_canCheckAmmo.sqf @@ -3,7 +3,7 @@ * Check if the player can check the ammo of the target. * * Argument: - * 0: Player + * 0: Unit * 1: Target * * Return value: @@ -16,22 +16,24 @@ */ #include "script_component.hpp" -EXPLODE_2_PVT(_this,_player,_target); - -private ["_magazineType", "_magazineCfg"]; +params ["", "_target"]; // Return true for static weapons if they have been fired once, @todo 1.40 this work-around doesn't work anymore if (_target isKindOf "StaticWeapon") exitWith { if (currentMagazine _target != "") exitWith {true}; - private ["_magazines","_found"]; - _magazines = magazinesAmmoFull _target; - _found = false; + // no check ammo action on destroyed static weapons + if (!alive _target) exitWith {false}; + + local _found = false; + { if (_x select 2) exitWith { _found = true; }; - } forEach _magazines; + false + } count magazinesAmmoFull _target; + _found }; @@ -42,9 +44,7 @@ if !(_target isKindOf "CAManBase") exitWith {false}; if (currentWeapon _target == "") exitWith {false}; // Check if their current magazine is a belt -_magazineType = currentMagazine _target; -_magazineCfg = configFile >> "CfgMagazines" >> _magazineType; -if (getNumber (_magazineCfg >> "ACE_isBelt") == 1) exitWith {true}; +if (getNumber (configFile >> "CfgMagazines" >> currentMagazine _target >> "ACE_isBelt") == 1) exitWith {true}; // Check for rocket launchers if (currentWeapon _target == secondaryWeapon _target) exitWith {true}; diff --git a/addons/reloadlaunchers/README.md b/addons/reloadlaunchers/README.md new file mode 100644 index 0000000000..2b6357200b --- /dev/null +++ b/addons/reloadlaunchers/README.md @@ -0,0 +1,11 @@ +ace_reloadlaunchers +=========== + +Add the ability to reload someone else's launcher. + + +## Maintainers + +The people responsible for merging changes to this component or answering potential questions. + +- [commy2](https://github.com/commy2) diff --git a/addons/reloadlaunchers/config.cpp b/addons/reloadlaunchers/config.cpp index 3a66b39719..6a04f6339a 100644 --- a/addons/reloadlaunchers/config.cpp +++ b/addons/reloadlaunchers/config.cpp @@ -6,8 +6,8 @@ class CfgPatches { weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_interaction"}; - author[] = {""}; - authorUrl = ""; + author[] = {"commy2"}; + authorUrl = "https://github.com/commy2"; VERSION_CONFIG; }; }; diff --git a/addons/repair/$PBOPREFIX$ b/addons/repair/$PBOPREFIX$ new file mode 100644 index 0000000000..d8fbd51195 --- /dev/null +++ b/addons/repair/$PBOPREFIX$ @@ -0,0 +1 @@ +z\ace\addons\repair \ No newline at end of file diff --git a/addons/repair/ACE_Repair.hpp b/addons/repair/ACE_Repair.hpp new file mode 100644 index 0000000000..a8aac18690 --- /dev/null +++ b/addons/repair/ACE_Repair.hpp @@ -0,0 +1,71 @@ +class ACE_Repair { + class Actions { + class ReplaceWheel { + displayName = CSTRING(ReplaceWheel); + displayNameProgress = CSTRING(ReplacingWheel); + + locations[] = {"All"}; + requiredEngineer = QGVAR(engineerSetting_Wheel); + repairingTime = 10; + repairingTimeSelfCoef = 1; + items = QGVAR(wheelRepairRequiredItems); + condition = QUOTE(call FUNC(canReplaceWheel)); + itemConsumed = 0; + + callbackSuccess = QUOTE(call FUNC(doReplaceWheel)); + callbackFailure = ""; + callbackProgress = ""; + + animationCaller = "Acts_carFixingWheel"; + animationCallerProne = "Acts_carFixingWheel"; + animationCallerSelf = "Acts_carFixingWheel"; + animationCallerSelfProne = "Acts_carFixingWheel"; + litter[] = {}; + }; + class RemoveWheel: ReplaceWheel { + displayName = CSTRING(RemoveWheel); + displayNameProgress = CSTRING(RemovingWheel); + condition = QUOTE(call FUNC(canRemove)); + callbackSuccess = QUOTE(call FUNC(doRemoveWheel)); + }; + class MiscRepair: ReplaceWheel { + displayName = CSTRING(Repairing); // let's make empty string an auto generated string + displayNameProgress = CSTRING(RepairingHitPoint); + condition = QUOTE(call FUNC(canMiscRepair)); + requiredEngineer = 0; + repairingTime = 15; + callbackSuccess = QUOTE(call FUNC(doRepair)); + items[] = {"ToolKit"}; + }; + class RepairTrack: MiscRepair { + displayName = CSTRING(Repairing); + displayNameProgress = CSTRING(RepairingHitPoint); + condition = QUOTE(call FUNC(canRepairTrack)); + callbackSuccess = QUOTE(call FUNC(doRepairTrack)); + requiredEngineer = QGVAR(engineerSetting_Wheel); + }; + class RemoveTrack: MiscRepair { + displayName = CSTRING(RemoveTrack); + displayNameProgress = CSTRING(RemovingTrack); + condition = QUOTE(call FUNC(canRemove)); + callbackSuccess = QUOTE(call FUNC(doRemoveTrack)); + requiredEngineer = QGVAR(engineerSetting_Wheel); + }; + class ReplaceTrack: RemoveTrack { + displayName = CSTRING(ReplaceTrack); + displayNameProgress = CSTRING(ReplacingTrack); + condition = QUOTE(call FUNC(canReplaceTrack)); + callbackSuccess = QUOTE(call FUNC(doReplaceTrack)); + requiredEngineer = QGVAR(engineerSetting_Wheel); + }; + class FullRepair: MiscRepair { + displayName = CSTRING(fullRepair); + displayNameProgress = CSTRING(fullyRepairing); + requiredEngineer = QGVAR(engineerSetting_fullRepair); + repairLocations[] = {QGVAR(fullRepairLocation)}; + repairingTime = 30; + condition = "damage _target > 0"; + callbackSuccess = QUOTE(call FUNC(doFullRepair)); + }; + }; +}; diff --git a/addons/repair/ACE_Settings.hpp b/addons/repair/ACE_Settings.hpp new file mode 100644 index 0000000000..22e68ce3e9 --- /dev/null +++ b/addons/repair/ACE_Settings.hpp @@ -0,0 +1,80 @@ +class ACE_Settings { + class GVAR(DisplayTextOnRepair) { + displayName = CSTRING(SettingDisplayTextName); + description = CSTRING(SettingDisplayTextDesc); + typeName = "BOOL"; + isClientSettable = 1; + value = 1; + category = ECSTRING(OptionsMenu,CategoryLogistics); + }; + class GVAR(engineerSetting_Repair) { + displayName = CSTRING(enginerSetting_Repair_name); + description = CSTRING(enginerSetting_Repair_description); + typeName = "SCALAR"; + value = 1; + values[] = {CSTRING(engineerSetting_anyone), CSTRING(engineerSetting_EngineerOnly), CSTRING(engineerSetting_RepairSpecialistOnly)}; + category = ECSTRING(OptionsMenu,CategoryLogistics); + }; + class GVAR(engineerSetting_Wheel) { + displayName = CSTRING(enginerSetting_Wheel_name); + description = CSTRING(enginerSetting_Wheel_description); + typeName = "SCALAR"; + value = 0; + values[] = {CSTRING(engineerSetting_anyone), CSTRING(engineerSetting_EngineerOnly), CSTRING(engineerSetting_RepairSpecialistOnly)}; + category = ECSTRING(OptionsMenu,CategoryLogistics); + }; + class GVAR(repairDamageThreshold) { + displayName = CSTRING(repairDamageThreshold_name); + description = CSTRING(repairDamageThreshold_description); + typeName = "SCALAR"; + value = 0.6; + category = ECSTRING(OptionsMenu,CategoryLogistics); + }; + class GVAR(repairDamageThreshold_Engineer) { + displayName = CSTRING(repairDamageThreshold_Engineer_name); + description = CSTRING(repairDamageThreshold_Engineer_description); + typeName = "SCALAR"; + value = 0.4; + category = ECSTRING(OptionsMenu,CategoryLogistics); + }; + class GVAR(consumeItem_ToolKit) { + displayName = CSTRING(consumeItem_ToolKit_name); + description = CSTRING(consumeItem_ToolKit_description); + typeName = "SCALAR"; + value = 1; + values[] = {ECSTRING(common,No), ECSTRING(common,Yes)}; + category = ECSTRING(OptionsMenu,CategoryLogistics); + }; + class GVAR(fullRepairLocation) { + displayName = CSTRING(fullRepairLocation); + description = CSTRING(fullRepairLocation_description); + typeName = "SCALAR"; + value = 2; + values[] = {CSTRING(useAnywhere), CSTRING(repairVehicleOnly), CSTRING(repairFacilityOnly), CSTRING(vehicleAndFacility), ECSTRING(common,Disabled)}; + category = ECSTRING(OptionsMenu,CategoryLogistics); + }; + class GVAR(engineerSetting_fullRepair) { + displayName = CSTRING(engineerSetting_fullRepair_name); + description = CSTRING(engineerSetting_fullRepair_description); + typeName = "SCALAR"; + value = 2; + values[] = {CSTRING(engineerSetting_anyone), CSTRING(engineerSetting_EngineerOnly), CSTRING(engineerSetting_RepairSpecialistOnly)}; + category = ECSTRING(OptionsMenu,CategoryLogistics); + }; + class GVAR(addSpareParts) { + displayName = CSTRING(addSpareParts_name); + description = CSTRING(addSpareParts_description); + typeName = "BOOL"; + value = 1; + category = ECSTRING(OptionsMenu,CategoryLogistics); + }; + class GVAR(wheelRepairRequiredItems) { + displayName = CSTRING(wheelRepairRequiredItems_name); + description = CSTRING(wheelRepairRequiredItems_description); + category = ECSTRING(OptionsMenu,CategoryLogistics); + typeName = "SCALAR"; + value = 0; + values[] = {"None", "ToolKit"}; + _values[] = {{}, {"ToolKit"}}; + }; +}; diff --git a/addons/repair/CfgActions.hpp b/addons/repair/CfgActions.hpp new file mode 100644 index 0000000000..5dbd0ca7a6 --- /dev/null +++ b/addons/repair/CfgActions.hpp @@ -0,0 +1,9 @@ +class CfgActions { + class None; + class Repair: None { + show = 0; + }; + class RepairVehicle: None { + show = 0; + }; +}; diff --git a/addons/repair/CfgEventHandlers.hpp b/addons/repair/CfgEventHandlers.hpp new file mode 100644 index 0000000000..798a10316a --- /dev/null +++ b/addons/repair/CfgEventHandlers.hpp @@ -0,0 +1,45 @@ +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)); + }; +}; + +//Need initPost or we have problems with setVariable with addSpareParts +class Extended_InitPost_EventHandlers { + class Car { + class ADDON { + init = QUOTE(_this call DFUNC(addRepairActions)); + serverInit = QUOTE(_this call DFUNC(addSpareParts)); + }; + }; + class Tank { + class ADDON { + init = QUOTE(_this call DFUNC(addRepairActions)); + serverInit = QUOTE(_this call DFUNC(addSpareParts)); + }; + }; + class Helicopter { + class ADDON { + init = QUOTE(_this call DFUNC(addRepairActions)); + serverInit = QUOTE(_this call DFUNC(addSpareParts)); + }; + }; + class Plane { + class ADDON { + init = QUOTE(_this call DFUNC(addRepairActions)); + serverInit = QUOTE(_this call DFUNC(addSpareParts)); + }; + }; + class Ship_F { + class ADDON { + init = QUOTE(_this call DFUNC(addRepairActions)); + serverInit = QUOTE(_this call DFUNC(addSpareParts)); + }; + }; +}; diff --git a/addons/repair/CfgVehicles.hpp b/addons/repair/CfgVehicles.hpp new file mode 100644 index 0000000000..ee31e2c873 --- /dev/null +++ b/addons/repair/CfgVehicles.hpp @@ -0,0 +1,406 @@ +#define MACRO_REPAIRVEHICLE \ + class ACE_Actions { \ + class ACE_MainActions { \ + class GVAR(Repair) { \ + displayName = CSTRING(Repair); \ + condition = "true"; \ + statement = ""; \ + runOnHover = 1; \ + showDisabled = 0; \ + priority = 2; \ + icon = "\A3\ui_f\data\igui\cfg\actions\repair_ca.paa"; \ + distance = 4; \ + exceptions[] = {"isNotOnLadder"}; \ + }; \ + }; \ + }; + +class CfgVehicles { + class ACE_Module; + class ACE_moduleRepairSettings: ACE_Module { + scope = 2; + displayName = CSTRING(moduleName); + icon = QUOTE(PATHTOF(ui\Icon_Module_Repair_ca.paa)); + category = "ACE_Logistics"; + function = QFUNC(moduleRepairSettings); + functionPriority = 1; + isGlobal = 1; + isTriggerActivated = 0; + author = ECSTRING(Common,ACETeam); + class Arguments { + class engineerSetting_Repair { + displayName = CSTRING(enginerSetting_Repair_name); + description = CSTRING(enginerSetting_Repair_description); + typeName = "NUMBER"; + class values { + class anyone { name = CSTRING(engineerSetting_anyone); value = 0; }; + class Engineer { name = CSTRING(engineerSetting_EngineerOnly); value = 1; default = 1; }; + class Special { name = CSTRING(engineerSetting_RepairSpecialistOnly); value = 2; }; + }; + }; + class engineerSetting_Wheel { + displayName = CSTRING(enginerSetting_Wheel_name); + description = CSTRING(enginerSetting_Wheel_description); + typeName = "NUMBER"; + class values { + class anyone { name = CSTRING(engineerSetting_anyone); value = 0; default = 1; }; + class Engineer { name = CSTRING(engineerSetting_EngineerOnly); value = 1; }; + class Special { name = CSTRING(engineerSetting_RepairSpecialistOnly); value = 2; }; + }; + }; + class repairDamageThreshold { + displayName = CSTRING(repairDamageThreshold_name); + description = CSTRING(repairDamageThreshold_description); + typeName = "NUMBER"; + defaultValue = 0.6; + }; + class repairDamageThreshold_Engineer { + displayName = CSTRING(repairDamageThreshold_Engineer_name); + description = CSTRING(repairDamageThreshold_Engineer_description); + typeName = "NUMBER"; + defaultValue = 0.4; + }; + class consumeItem_ToolKit { + displayName = CSTRING(consumeItem_ToolKit_name); + description = CSTRING(consumeItem_ToolKit_description); + typeName = "NUMBER"; + class values { + class keep { name = ECSTRING(common,No); value = 0; default = 1; }; + class remove { name = ECSTRING(common,Yes); value = 1; }; + }; + }; + class fullRepairLocation { + displayName = CSTRING(fullRepairLocation); + description = CSTRING(fullRepairLocation_description); + typeName = "NUMBER"; + class values { + class anywhere { name = CSTRING(useAnywhere); value = 0; }; + class vehicle { name = CSTRING(repairVehicleOnly); value = 1; }; + class facility { name = CSTRING(repairFacilityOnly); value = 2; default = 1; }; + class vehicleAndFacility { name = CSTRING(vehicleAndFacility); value = 3; }; + class disabled { name = ECSTRING(common,Disabled); value = 4;}; + }; + }; + class engineerSetting_fullRepair { + displayName = CSTRING(engineerSetting_fullRepair_name); + description = CSTRING(engineerSetting_fullRepair_description); + typeName = "NUMBER"; + class values { + class anyone { name = CSTRING(engineerSetting_anyone); value = 0; }; + class Engineer { name = CSTRING(engineerSetting_EngineerOnly); value = 1; }; + class Special { name = CSTRING(engineerSetting_RepairSpecialistOnly); value = 2; default = 1;}; + }; + }; + class addSpareParts { + displayName = CSTRING(addSpareParts_name); + description = CSTRING(addSpareParts_description); + typeName = "BOOL"; + defaultValue = 1; + }; + class wheelRepairRequiredItems { + displayName = CSTRING(wheelRepairRequiredItems_name); + description = CSTRING(wheelRepairRequiredItems_description); + typeName = "NUMBER"; + class values { + class None { name = "None"; value = 0; default = 1;}; + class ToolKit { name = "ToolKit"; value = 1; }; + }; + }; + }; + class ModuleDescription { + description = CSTRING(moduleDescription); + sync[] = {}; + }; + }; + + class Module_F; + class ACE_moduleAssignEngineerRoles: Module_F { + scope = 2; + displayName = CSTRING(AssignEngineerRole_Module_DisplayName); + icon = QUOTE(PATHTOF(ui\Icon_Module_Repair_ca.paa)); + category = "ACE_Logistics"; + function = QFUNC(moduleAssignEngineer); + functionPriority = 10; + isGlobal = 2; + isTriggerActivated = 0; + isDisposable = 0; + author = ECSTRING(common,ACETeam); + class Arguments { + class EnableList { + displayName = CSTRING(EnableList_DisplayName); + description = CSTRING(AssignEngineerRole_EnableList_Description); + defaultValue = ""; + typeName = "STRING"; + }; + class role { + displayName = CSTRING(AssignEngineerRole_role_DisplayName); + description = CSTRING(AssignEngineerRole_role_Description); + typeName = "NUMBER"; + class values { + class none { + name = CSTRING(AssignEngineerRole_role_none); + value = 0; + }; + class medic { + name = CSTRING(AssignEngineerRole_role_engineer); + value = 1; + default = 1; + }; + class doctor { + name = CSTRING(AssignEngineerRole_role_specialist); + value = 2; + }; + }; + }; + }; + class ModuleDescription { + description = CSTRING(AssignEngineerRole_Module_Description); + sync[] = {}; + }; + }; + class ACE_moduleAssignRepairVehicle: Module_F { + scope = 2; + displayName = CSTRING(AssignRepairVehicle_Module_DisplayName); + icon = QUOTE(PATHTOF(ui\Icon_Module_Repair_ca.paa)); + category = "ACE_Logistics"; + function = QFUNC(moduleAssignRepairVehicle); + functionPriority = 10; + isGlobal = 2; + isTriggerActivated = 0; + isDisposable = 0; + author = ECSTRING(common,ACETeam); + class Arguments { + class EnableList { + displayName = CSTRING(EnableList_DisplayName); + description = CSTRING(AssignRepairVehicle_EnableList_Description); + defaultValue = ""; + typeName = "STRING"; + }; + class role { + displayName = CSTRING(AssignRepairVehicle_role_DisplayName); + description = CSTRING(AssignRepairVehicle_role_Description); + typeName = "NUMBER"; + class values { + class none { + name = ECSTRING(common,No); + value = 0; + }; + class isVehicle { + name = ECSTRING(common,Yes); + value = 1; + default = 1; + }; + }; + }; + }; + class ModuleDescription { + description = CSTRING(AssignRepairVehicle_Module_Description); + sync[] = {}; + }; + }; + class ACE_moduleAssignRepairFacility: ACE_moduleAssignRepairVehicle { + displayName = CSTRING(AssignRepairFacility_Module_DisplayName); + function = QFUNC(moduleAssignRepairFacility); + class Arguments { + class EnableList { + displayName = CSTRING(EnableList_DisplayName); + description = CSTRING(AssignRepairFacility_EnableList_Description); + defaultValue = ""; + typeName = "STRING"; + }; + class role { + displayName = CSTRING(AssignRepairFacility_role_DisplayName); + description = CSTRING(AssignRepairFacility_role_Description); + typeName = "NUMBER"; + class values { + class none { + name = ECSTRING(common,No); + value = 0; + }; + class isFacility { + name = ECSTRING(common,Yes); + value = 1; + default = 1; + }; + }; + }; + }; + class ModuleDescription { + description = CSTRING(AssignRepairFacility_Module_Description); + sync[] = {}; + }; + }; + class ACE_moduleAddSpareParts: Module_F { + scope = 2; + displayName = CSTRING(AddSpareParts_Module_DisplayName); + icon = QUOTE(PATHTOF(ui\Icon_Module_Repair_ca.paa)); + category = "ACE_Logistics"; + function = QFUNC(moduleAddSpareParts); + functionPriority = 10; + isGlobal = 0; + isTriggerActivated = 0; + isDisposable = 0; + author = ECSTRING(common,ACETeam); + class Arguments { + class List { + displayName = CSTRING(EnableList_DisplayName); + description = CSTRING(AddSpareParts_List_Description); + defaultValue = ""; + typeName = "STRING"; + }; + class Part { + displayName = CSTRING(AddSpareParts_Part_DisplayName); + description = CSTRING(AddSpareParts_Part_Description); + typeName = "STRING"; + class values { + class Wheel { + name = CSTRING(SpareWheel); + value = "ACE_Wheel"; + default = 1; + }; + class Track { + name = CSTRING(SpareTrack); + value = "ACE_Track"; + }; + }; + }; + class Amount { + displayName = CSTRING(AddSpareParts_Amount_DisplayName); + description = CSTRING(AddSpareParts_Amount_Description); + typeName = "NUMBER"; + defaultValue = 1; + }; + }; + class ModuleDescription { + description = CSTRING(AddSpareParts_Module_Description); + sync[] = {}; + }; + }; + + + class LandVehicle; + class Car: LandVehicle { + MACRO_REPAIRVEHICLE + }; + + class Tank: LandVehicle { + MACRO_REPAIRVEHICLE + }; + + class Air; + class Helicopter: Air { + MACRO_REPAIRVEHICLE + }; + + class Plane: Air { + MACRO_REPAIRVEHICLE + }; + + class Ship; + class Ship_F: Ship { + MACRO_REPAIRVEHICLE + }; + + class thingX; + class ACE_RepairItem_Base: thingX { + XEH_ENABLED; + icon = "iconObject_circle"; + mapSize = 0.7; + accuracy = 0.2; + vehicleClass = "ACE_Logistics_Items"; + destrType = "DesturctNo"; + }; + + class ACE_Track: ACE_RepairItem_Base { + EGVAR(cargo,size) = 2; + EGVAR(cargo,canLoad) = 1; + author = "Hawkins"; + scope = 2; + model = QUOTE(PATHTOF(data\ace_track.p3d)); + displayName = CSTRING(SpareTrack); + }; + + class ACE_Wheel: ACE_RepairItem_Base { + EGVAR(cargo,size) = 1; + EGVAR(cargo,canLoad) = 1; + author = "Hawkins"; + scope = 2; + model = QUOTE(PATHTOF(data\ace_wheel.p3d)); + displayName = CSTRING(SpareWheel); + picture = QUOTE(PATHTOF(ui\tire_ca.paa)); + }; + + // disable vanilla repair + // "getNumber (_x >> ""transportRepair"") > 0" configClasses (configFile >> "CfgVehicles") + + class Slingload_01_Base_F; + class B_Slingload_01_Repair_F: Slingload_01_Base_F { + GVAR(canRepair) = 1; + transportRepair = 0; + }; + + class Helicopter_Base_H; + class Heli_Transport_04_base_F: Helicopter_Base_H { + GVAR(hitpointGroups[]) = { {"HitEngine", {"HitEngine1", "HitEngine2"}}, {"Glass_1_hitpoint", {"Glass_2_hitpoint", "Glass_3_hitpoint", "Glass_4_hitpoint", "Glass_5_hitpoint", "Glass_6_hitpoint", "Glass_7_hitpoint", "Glass_8_hitpoint", "Glass_9_hitpoint", "Glass_10_hitpoint", "Glass_11_hitpoint", "Glass_12_hitpoint", "Glass_13_hitpoint", "Glass_14_hitpoint", "Glass_15_hitpoint", "Glass_16_hitpoint", "Glass_17_hitpoint", "Glass_18_hitpoint", "Glass_19_hitpoint", "Glass_20_hitpoint"}} }; + }; + class O_Heli_Transport_04_repair_F: Heli_Transport_04_base_F { + GVAR(canRepair) = 1; + transportRepair = 0; + }; + + class Pod_Heli_Transport_04_base_F; + class Land_Pod_Heli_Transport_04_repair_F: Pod_Heli_Transport_04_base_F { + GVAR(canRepair) = 1; + transportRepair = 0; + }; + + class B_APC_Tracked_01_base_F; + class B_APC_Tracked_01_CRV_F: B_APC_Tracked_01_base_F { + GVAR(canRepair) = 1; + transportRepair = 0; + }; + + class Car_F; + class Offroad_01_base_F: Car_F { + GVAR(hitpointGroups[]) = { {"HitGlass1", {"HitGlass2"}} }; + }; + class Offroad_01_repair_base_F: Offroad_01_base_F { + GVAR(canRepair) = 1; + transportRepair = 0; + }; + + class MRAP_01_base_F: Car_F { + GVAR(hitpointGroups[]) = { {"HitGlass1", {"HitGlass2", "HitGlass3", "HitGlass4", "HitGlass5", "HitGlass6"}} }; + }; + + class B_Truck_01_mover_F; + class B_Truck_01_Repair_F: B_Truck_01_mover_F { + GVAR(canRepair) = 1; + transportRepair = 0; + }; + + class B_Truck_01_fuel_F: B_Truck_01_mover_F { // the fuel hemet apparently can repair. GJ BI + transportRepair = 0; + }; + + class Truck_02_base_F; + class Truck_02_box_base_F: Truck_02_base_F { + GVAR(canRepair) = 1; + transportRepair = 0; + }; + + class Truck_02_engineeral_base_F: Truck_02_box_base_F { + GVAR(canRepair) = 0; + }; + + class Truck_03_base_F; + class O_Truck_03_repair_F: Truck_03_base_F { + GVAR(canRepair) = 1; + transportRepair = 0; + }; + + class Quadbike_01_base_F; + class B_Quadbike_01_F: Quadbike_01_base_F { + GVAR(hitpointPositions[]) = { {"HitEngine", {0, 0.5, -0.7}}, {"HitFuel", {0, 0, -0.5}} }; + }; +}; diff --git a/addons/repair/README.md b/addons/repair/README.md new file mode 100644 index 0000000000..5cf5e8f89a --- /dev/null +++ b/addons/repair/README.md @@ -0,0 +1,13 @@ +ace_repair +=========== + +Adds repair system. + + +## Maintainers + +The people responsible for merging changes to this component or answering potential questions. + +- [commy2](https://github.com/commy2) +- [Glowbal](https://github.com/Glowbal) +- [Jonpas](https://github.com/jonpas) diff --git a/addons/repair/XEH_postInit.sqf b/addons/repair/XEH_postInit.sqf new file mode 100644 index 0000000000..44ca157b0c --- /dev/null +++ b/addons/repair/XEH_postInit.sqf @@ -0,0 +1,7 @@ +#include "script_component.hpp" + +["setVehicleDamage", {_this call FUNC(setDamage)}] call EFUNC(common,addEventHandler); +["setVehicleHitPointDamage", {_this call FUNC(setHitPointDamage)}] call EFUNC(common,addEventHandler); + +// wheels +["setWheelHitPointDamage", {(_this select 0) setHitPointDamage [_this select 1, _this select 2]}] call EFUNC(common,addEventHandler); diff --git a/addons/repair/XEH_preInit.sqf b/addons/repair/XEH_preInit.sqf new file mode 100644 index 0000000000..f94c230f29 --- /dev/null +++ b/addons/repair/XEH_preInit.sqf @@ -0,0 +1,43 @@ +#include "script_component.hpp" + +ADDON = false; + +PREP(addRepairActions); +PREP(addSpareParts); +PREP(canMiscRepair); +PREP(canRemove); +PREP(canRepair); +PREP(canRepairTrack); +PREP(canReplaceTrack); +PREP(canReplaceWheel); +PREP(doFullRepair); +PREP(doRemoveTrack); +PREP(doRemoveWheel); +PREP(doRepair); +PREP(doRepairTrack); +PREP(doReplaceTrack); +PREP(doReplaceWheel); +PREP(getHitPointString); +PREP(getPostRepairDamage); +PREP(getWheelHitPointsWithSelections); +PREP(hasItems); +PREP(isEngineer); +PREP(isInRepairFacility); +PREP(isNearRepairVehicle); +PREP(isRepairVehicle); +PREP(moduleAddSpareParts); +PREP(moduleAssignEngineer); +PREP(moduleAssignRepairVehicle); +PREP(moduleAssignRepairFacility); +PREP(moduleRepairSettings); +PREP(normalizeHitPoints); +PREP(repair); +PREP(repair_failure); +PREP(repair_success); +PREP(setDamage); +PREP(setHitPointDamage); +PREP(spawnObject); +PREP(useItem); +PREP(useItems); + +ADDON = true; diff --git a/addons/repair/config.cpp b/addons/repair/config.cpp new file mode 100644 index 0000000000..2e991b54a6 --- /dev/null +++ b/addons/repair/config.cpp @@ -0,0 +1,19 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + units[] = {"ACE_Wheel", "ACE_Track"}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"ace_interaction"}; + author[] = {"commy2", "Glowbal", "Jonpas"}; + authorUrl = "https://ace3mod.com"; + VERSION_CONFIG; + }; +}; + +#include "ACE_Repair.hpp" +#include "ACE_Settings.hpp" +#include "CfgEventHandlers.hpp" +#include "CfgActions.hpp" +#include "CfgVehicles.hpp" diff --git a/addons/repair/data/ace_track.p3d b/addons/repair/data/ace_track.p3d new file mode 100644 index 0000000000..988499c32b Binary files /dev/null and b/addons/repair/data/ace_track.p3d differ diff --git a/addons/repair/data/ace_wheel.p3d b/addons/repair/data/ace_wheel.p3d new file mode 100644 index 0000000000..c24f804b4f Binary files /dev/null and b/addons/repair/data/ace_wheel.p3d differ diff --git a/addons/repair/data/trailObjects.rvmat b/addons/repair/data/trailObjects.rvmat new file mode 100644 index 0000000000..8692493699 --- /dev/null +++ b/addons/repair/data/trailObjects.rvmat @@ -0,0 +1,100 @@ +#define _ARMA_ + +class StageTI +{ + texture = "a3\data_f\default_ti_ca.paa"; +}; +ambient[] = {1,1,1,1}; +diffuse[] = {1,1,1,1}; +forcedDiffuse[] = {0,0,0,0}; +emmisive[] = {0,0,0,0}; +specular[] = {0.0099999998,0.0099999998,0.0099999998,0.0099999998}; +specularPower = 500; +surfaceInfo="a3\data_f\penetration\metal.bisurf"; +PixelShaderID = "Super"; +VertexShaderID = "Super"; +class Stage1 +{ + texture = "z\ace\addons\repair\data\trailObjects_nohq.paa"; + uvSource = "tex"; + class uvTransform + { + aside[] = {1,0,0}; + up[] = {0,1,0}; + dir[] = {0,0,1}; + pos[] = {0,0,0}; + }; +}; +class Stage2 +{ + texture = "#(argb,8,8,3)color(0.5,0.5,0.5,1,DT)"; + uvSource = "tex"; + class uvTransform + { + aside[] = {1,0,0}; + up[] = {0,1,0}; + dir[] = {0,0,1}; + pos[] = {0,0,0}; + }; +}; +class Stage3 +{ + texture = "#(argb,8,8,3)color(0,0,0,0,MC)"; + uvSource = "tex"; + class uvTransform + { + aside[] = {1,0,0}; + up[] = {0,1,0}; + dir[] = {0,0,1}; + pos[] = {0,0,0}; + }; +}; +class Stage4 +{ + texture = "#(argb,8,8,3)color(1,1,1,1,AS)"; + uvSource = "tex"; + class uvTransform + { + aside[] = {1,0,0}; + up[] = {0,1,0}; + dir[] = {0,0,1}; + pos[] = {0,0,0}; + }; +}; +class Stage5 +{ + texture = "#(argb,8,8,3)color(0,0.6,1,1,SMDI)"; + uvSource = "tex"; + class uvTransform + { + aside[] = {1,0,0}; + up[] = {0,1,0}; + dir[] = {0,0,1}; + pos[] = {0,0,0}; + }; +}; +class Stage6 +{ + texture = "#(ai,64,64,1)fresnelGlass(2)"; + uvSource = "tex"; + class uvTransform + { + aside[] = {1,0,0}; + up[] = {0,1,0}; + dir[] = {0,0,1}; + pos[] = {0,0,0}; + }; +}; +class Stage7 +{ + useWorldEnvMap = "true"; + texture = "a3\data_f\env_land_ca.paa"; + uvSource = "tex"; + class uvTransform + { + aside[] = {1,0,0}; + up[] = {0,1,0}; + dir[] = {0,0,1}; + pos[] = {0,0,0}; + }; +}; diff --git a/addons/repair/data/trailObjects_co.paa b/addons/repair/data/trailObjects_co.paa new file mode 100644 index 0000000000..25f2c4c1c0 Binary files /dev/null and b/addons/repair/data/trailObjects_co.paa differ diff --git a/addons/repair/data/trailObjects_nohq.paa b/addons/repair/data/trailObjects_nohq.paa new file mode 100644 index 0000000000..fc10e94aea Binary files /dev/null and b/addons/repair/data/trailObjects_nohq.paa differ diff --git a/addons/repair/functions/fnc_addRepairActions.sqf b/addons/repair/functions/fnc_addRepairActions.sqf new file mode 100644 index 0000000000..7ebf978088 --- /dev/null +++ b/addons/repair/functions/fnc_addRepairActions.sqf @@ -0,0 +1,171 @@ +/* + * Author: commy2 + * Checks if the vehicles class already has the actions initialized, otherwise add all available repair options. Calleed from init EH. + * + * Arguments: + * 0: Vehicle + * + * Return Value: + * None + * + * Example: + * [vehicle] call ace_repair_fnc_addRepairActions + * + * Public: No + */ +#include "script_component.hpp" + +params ["_vehicle"]; +TRACE_1("params", _vehicle); + +private ["_type", "_initializedClasses", "_condition", "_statement", "_action"]; + +_type = typeOf _vehicle; + +_initializedClasses = GETMVAR(GVAR(initializedClasses),[]); + +// do nothing if the class is already initialized +if (_type in _initializedClasses) exitWith {}; + +// get all hitpoints and selections +([_vehicle] call EFUNC(common,getHitPointsWithSelections)) params ["_hitPoints", "_hitPointsSelections"]; + +// get hitpoints of wheels with their selections +([_vehicle] call FUNC(getWheelHitPointsWithSelections)) params ["_wheelHitPoints", "_wheelHitPointSelections"]; + + +private ["_hitPointsAddedNames", "_hitPointsAddedStrings", "_hitPointsAddedAmount"]; +_hitPointsAddedNames = []; +_hitPointsAddedStrings = []; +_hitPointsAddedAmount = []; + +// add repair events to this vehicle class +{ + if (_x in _wheelHitPoints) then { + // add wheel repair action + + private ["_icon", "_selection", "_name", "_text"]; + + _icon = QUOTE(PATHTOF(ui\tire_ca.paa)); + _icon = "A3\ui_f\data\igui\cfg\actions\repair_ca.paa"; + // textDefault = ""; + _selection = _wheelHitPointSelections select (_wheelHitPoints find _x); + + // remove wheel action + _name = format ["Remove_%1", _x]; + _text = localize LSTRING(RemoveWheel); + + _condition = {[_this select 1, _this select 0, _this select 2 select 0, "RemoveWheel"] call DFUNC(canRepair)}; + _statement = {[_this select 1, _this select 0, _this select 2 select 0, "RemoveWheel"] call DFUNC(repair)}; + + _action = [_name, _text, _icon, _statement, _condition, {}, [_x], _selection, 2] call EFUNC(interact_menu,createAction); + [_type, 0, [], _action] call EFUNC(interact_menu,addActionToClass); + + // replace wheel action + _name = format ["Replace_%1", _x]; + _text = localize LSTRING(ReplaceWheel); + + _condition = {[_this select 1, _this select 0, _this select 2 select 0, "ReplaceWheel"] call DFUNC(canRepair)}; + _statement = {[_this select 1, _this select 0, _this select 2 select 0, "ReplaceWheel"] call DFUNC(repair)}; + + _action = [_name, _text, _icon, _statement, _condition, {}, [_x], _selection, 2] call EFUNC(interact_menu,createAction); + [_type, 0, [], _action] call EFUNC(interact_menu,addActionToClass); + + } else { + // exit if the hitpoint is in the blacklist, e.g. glasses + if (_x in IGNORED_HITPOINTS) exitWith {}; + + private ["_hitpointGroupConfig", "_inHitpointSubGroup", "_currentHitpoint"]; + + // Get hitpoint groups if available + _hitpointGroupConfig = configFile >> "CfgVehicles" >> _type >> QGVAR(hitpointGroups); + _inHitpointSubGroup = false; + if (isArray _hitpointGroupConfig) then { + // Set variable if current hitpoint is in a sub-group (to be excluded from adding action) + _currentHitpoint = _x; + { + { + if (_x == _currentHitpoint) exitWith { + _inHitpointSubGroup = true; + }; + } forEach (_x select 1); + } forEach (getArray _hitpointGroupConfig); + }; + + // Exit if current hitpoint is in sub-group (only main hitpoints get actions) + if (_inHitpointSubGroup) exitWith {}; + + // exit if the hitpoint is virtual + if (isText (configFile >> "CfgVehicles" >> _type >> "HitPoints" >> _x >> "depends")) exitWith {}; + + // add misc repair action + private ["_name", "_icon", "_selection", "_customSelectionsConfig"]; + + _name = format ["Repair_%1", _x]; + + // Find localized string and track those added for numerization + ([_x, "%1", _x, [_hitPointsAddedNames, _hitPointsAddedStrings, _hitPointsAddedAmount]] call FUNC(getHitPointString)) params ["_text", "_trackArray"]; + _hitPointsAddedNames = _trackArray select 0; + _hitPointsAddedStrings = _trackArray select 1; + _hitPointsAddedAmount = _trackArray select 2; + + _icon = "A3\ui_f\data\igui\cfg\actions\repair_ca.paa"; + + _selection = ""; + + // Get custom position if available + _customSelectionsConfig = configFile >> "CfgVehicles" >> _type >> QGVAR(hitpointPositions); + if (isArray _customSelectionsConfig) then { + // Loop through custom hitpoint positions array + _currentHitpoint = _x; + { + _x params ["_hitpoint", "_position"]; + // Exit with supplied custom position when same hitpoint name found or print RPT error if it's invalid + if (_hitpoint == _currentHitpoint) exitWith { + if (typeName _position == "ARRAY") exitWith { + _selection = _position; // Position in model space + }; + if (typeName _position == "STRING") exitWith { + _selection = _vehicle selectionPosition _position; // Selection name + }; + ACE_LOGERROR_3("Invalid custom position %1 of hitpoint %2 in vehicle %3.",_position,_hitpoint,_vehicle); + }; + } forEach (getArray _customSelectionsConfig); + }; + + // If position still empty (not a position array or selection name) try extracting from model + if (typeName _selection == "STRING" && {_selection == ""}) then { + _selection = _vehicle selectionPosition (_hitPointsSelections select (_hitPoints find _x)); + }; + + _condition = {[_this select 1, _this select 0, _this select 2 select 0, _this select 2 select 1] call DFUNC(canRepair)}; + _statement = {[_this select 1, _this select 0, _this select 2 select 0, _this select 2 select 1] call DFUNC(repair)}; + + if (_x in TRACK_HITPOINTS) then { + if (_x == "HitLTrack") then { + _selection = [-1.75, 0, -1.75]; + } else { + _selection = [1.75, 0, -1.75]; + }; + _action = [_name, _text, _icon, _statement, _condition, {}, [_x, "RepairTrack"], _selection, 4] call EFUNC(interact_menu,createAction); + [_type, 0, [], _action] call EFUNC(interact_menu,addActionToClass); + } else { + _action = [_name, _text, _icon, _statement, _condition, {}, [_x, "MiscRepair"], _selection, 4] call EFUNC(interact_menu,createAction); + // Put inside main actions if no other position was found above + if (_selection isEqualTo [0, 0, 0]) then { + [_type, 0, ["ACE_MainActions", QGVAR(Repair)], _action] call EFUNC(interact_menu,addActionToClass); + } else { + [_type, 0, [], _action] call EFUNC(interact_menu,addActionToClass); + }; + }; + }; +} forEach _hitPoints; + +_condition = {[_this select 1, _this select 0, _this select 2 select 0, _this select 2 select 1] call DFUNC(canRepair)}; +_statement = {[_this select 1, _this select 0, _this select 2 select 0, _this select 2 select 1] call DFUNC(repair)}; +_action = [QGVAR(fullRepair), localize LSTRING(fullRepair), "A3\ui_f\data\igui\cfg\actions\repair_ca.paa", _statement, _condition, {}, ["", "fullRepair"], "", 4] call EFUNC(interact_menu,createAction); +[_type, 0, ["ACE_MainActions", QGVAR(Repair)], _action] call EFUNC(interact_menu,addActionToClass); +// set class as initialized +_initializedClasses pushBack _type; + +SETMVAR(GVAR(initializedClasses),_initializedClasses); diff --git a/addons/repair/functions/fnc_addSpareParts.sqf b/addons/repair/functions/fnc_addSpareParts.sqf new file mode 100644 index 0000000000..4d3197c8e8 --- /dev/null +++ b/addons/repair/functions/fnc_addSpareParts.sqf @@ -0,0 +1,45 @@ +/* + * Author: Jonpas + * Adds spare parts to the vehicle. Before SettingsInitialized only collect for later execution. + * + * Arguments: + * 0: Vehicle + * 1: Amount (default: 1) + * 2: Spare Part Classname (default: "") + * 3: Force (add even if setting is disabled) (default: false) + * + * Return Value: + * None + * + * Example: + * [vehicle] call ace_repair_fnc_addSpareParts + * + * Public: No + */ +#include "script_component.hpp" + +private ["_part"]; +params ["_vehicle", ["_amount", 1], ["_part", ""], ["_force", false]]; +TRACE_2("params",_vehicle,_amount); + +// Exit if ace_cargo is not loaded +if !(["ace_cargo"] call EFUNC(common,isModLoaded)) exitWith {}; + +// Collect until SettingsInitialized +if (!EGVAR(common,settingsInitFinished)) exitWith { + EGVAR(common,runAtSettingsInitialized) pushBack [FUNC(addSpareParts), _this]; +}; + +// Exit if not forced and add spare parts is disabled (after settings initted to make sure it really is) +if (!_force && !GVAR(addSpareParts)) exitWith {}; + +// Select appropriate part +if (_part == "") then { + if (_vehicle isKindOf "Car") then { _part = "ACE_Wheel" }; + if (_vehicle isKindOf "Tank") then { _part = "ACE_Track" }; +}; +// Exit if no appropriate part +if (_part == "") exitWith {}; + +// Load +["AddCargoByClass", [_part, _vehicle, _amount]] call EFUNC(common,localEvent); diff --git a/addons/repair/functions/fnc_canMiscRepair.sqf b/addons/repair/functions/fnc_canMiscRepair.sqf new file mode 100644 index 0000000000..0533f9f4fc --- /dev/null +++ b/addons/repair/functions/fnc_canMiscRepair.sqf @@ -0,0 +1,52 @@ +/* + * Author: Jonpas + * Check if misc repair action can be done, called from callbackSuccess. + * + * Arguments: + * 0: Unit that does the repairing + * 1: Vehicle to repair + * 2: Selected hitpoint + * + * Return Value: + * Can Misc Repair + * + * Example: + * [unit, vehicle, "hitpoint", "classname"] call ace_repair_fnc_canMiscRepair + * + * Public: No + */ +#include "script_component.hpp" + +private ["_hitpointGroupConfig", "_hitpointGroup", "_postRepairDamage", "_return"]; +params ["_caller", "_target", "_hitPoint"]; + +if !([_unit, _target, ["isNotDragging", "isNotCarrying", "isNotOnLadder"]] call EFUNC(common,canInteractWith)) exitWith {false}; + +// Get hitpoint groups if available +_hitpointGroupConfig = configFile >> "CfgVehicles" >> typeOf _target >> QGVAR(hitpointGroups); +_hitpointGroup = []; +if (isArray _hitpointGroupConfig) then { + // Retrieve hitpoint subgroup if current hitpoint is main hitpoint of a group + { + // Exit using found hitpoint group if this hitpoint is leader of any + if (_x select 0 == _hitPoint) exitWith { + _hitpointGroup = _x select 1; + }; + } forEach (getArray _hitpointGroupConfig); +}; + +// Add current hitpoint to the group +_hitpointGroup pushBack _hitPoint; + +// Get post repair damage +_postRepairDamage = [_caller] call FUNC(getPostRepairDamage); + +// Return true if damage can be repaired on any hitpoint in the group, else false +_return = false; +{ + if ((_target getHitPointDamage _x) > _postRepairDamage) exitWith { + _return = true; + }; +} forEach _hitpointGroup; + +_return diff --git a/addons/repair/functions/fnc_canRemove.sqf b/addons/repair/functions/fnc_canRemove.sqf new file mode 100644 index 0000000000..9f06e8d148 --- /dev/null +++ b/addons/repair/functions/fnc_canRemove.sqf @@ -0,0 +1,25 @@ +/* + * Author: commy2 + * Check if the unit can remove given wheel/track of the vehicle. + * + * Arguments: + * 0: Unit that does the repairing + * 1: Vehicle to repair + * 2: Selected hitpoint + * + * Return Value: + * Can Remove + * + * Example: + * [unit, vehicle, "hitpoint"] call ace_repair_fnc_canRemove + * + * Public: No + */ +#include "script_component.hpp" + +params ["_unit", "_target", "_hitPoint"]; +TRACE_3("params",_unit,_target,_hitPoint); + +if !([_unit, _target, ["isNotDragging", "isNotCarrying", "isNotOnLadder"]] call EFUNC(common,canInteractWith)) exitWith {false}; + +alive _target && {_target getHitPointDamage _hitPoint < 1} diff --git a/addons/repair/functions/fnc_canRepair.sqf b/addons/repair/functions/fnc_canRepair.sqf new file mode 100644 index 0000000000..8fb2a4938e --- /dev/null +++ b/addons/repair/functions/fnc_canRepair.sqf @@ -0,0 +1,104 @@ +/* + * Author: Glowbal + * Check if the repair action can be performed. + * + * Arguments: + * 0: Unit that does the repairing + * 1: Vehicle to repair + * 2: Selected hitpoint + * 3: Repair Action Classname + * + * Return Value: + * Can Repair + * + * Example: + * ["something", player] call ace_repair_fnc_canRepair + * + * Public: Yes + */ +#include "script_component.hpp" + +params ["_caller", "_target", "_hitPoint", "_className"]; +TRACE_4("params",_caller,_target,_hitPoint,_className); + +private ["_config", "_engineerRequired", "_items", "_locations", "_return", "_condition", "_vehicleStateCondition", "_settingName", "_settingItemsArray"]; + +_config = (ConfigFile >> "ACE_Repair" >> "Actions" >> _className); +if !(isClass _config) exitwith {false}; // or go for a default? +if(isEngineOn _target) exitwith {false}; + +_engineerRequired = if (isNumber (_config >> "requiredEngineer")) then { + getNumber (_config >> "requiredEngineer"); +} else { + // Check for required class + if (isText (_config >> "requiredEngineer")) exitwith { + missionNamespace getVariable [(getText (_config >> "requiredEngineer")), 0]; + }; + 0; +}; +if !([_caller, _engineerRequired] call FUNC(isEngineer)) exitwith {false}; + +//Items can be an array of required items or a string to a ACE_Setting array +_items = if (isArray (_config >> "items")) then { + getArray (_config >> "items"); +} else { + _settingName = getText (_config >> "items"); + _settingItemsArray = getArray (configFile >> "ACE_Settings" >> _settingName >> "_values"); + if ((isNil _settingName) || {(missionNamespace getVariable _settingName) >= (count _settingItemsArray)}) exitWith { + ERROR("bad setting"); ["BAD"] + }; + _settingItemsArray select (missionNamespace getVariable _settingName); +}; +if (count _items > 0 && {!([_caller, _items] call FUNC(hasItems))}) exitwith {false}; + +_return = true; +if (getText (_config >> "condition") != "") then { + _condition = getText (_config >> "condition"); + if (isnil _condition) then { + _condition = compile _condition; + } else { + _condition = missionNamespace getVariable _condition; + }; + if (typeName _condition == "BOOL") then { + _return = _condition; + } else { + _return = [_caller, _target, _hitPoint, _className] call _condition; + }; +}; + +if (!_return) exitwith {false}; + +_vehicleStateCondition = if (isText(_config >> "vehicleStateCondition")) then { + missionNamespace getVariable [getText(_config >> "vehicleStateCondition"), 0] +} else { + getNumber(_config >> "vehicleStateCondition") +}; +// if (_vehicleStateCondition == 1 && {!([_target] call FUNC(isInStableCondition))}) exitwith {false}; + +_locations = getArray (_config >> "repairLocations"); +if ("All" in _locations) exitwith {true}; + +private ["_repairFacility", "_repairVeh"]; +_repairFacility = {([_caller] call FUNC(isInRepairFacility)) || ([_target] call FUNC(isInRepairFacility))}; +_repairVeh = {([_caller] call FUNC(isNearRepairVehicle)) || ([_target] call FUNC(isNearRepairVehicle))}; + +{ + if (_x == "field") exitwith {_return = true;}; + if (_x == "RepairFacility" && _repairFacility) exitwith {_return = true;}; + if (_x == "RepairVehicle" && _repairVeh) exitwith {_return = true;}; + if !(isnil _x) exitwith { + private "_val"; + _val = missionNamespace getVariable _x; + if (typeName _val == "SCALAR") then { + _return = switch (_val) do { + case 0: {true}; //useAnywhere + case 1: {call _repairVeh}; //repairVehicleOnly + case 2: {call _repairFacility}; //repairFacilityOnly + case 3: {(call _repairFacility) || {call _repairVeh}}; //vehicleAndFacility + default {false}; //Disabled + }; + }; + }; +} forEach _locations; + +_return && alive _target; diff --git a/addons/repair/functions/fnc_canRepairTrack.sqf b/addons/repair/functions/fnc_canRepairTrack.sqf new file mode 100644 index 0000000000..0ba01afb87 --- /dev/null +++ b/addons/repair/functions/fnc_canRepairTrack.sqf @@ -0,0 +1,43 @@ +/* + * Author: commy2 + * Check if the unit can replace given wheel of the vehicle. + * + * Arguments: + * 0: Unit that does the repairing + * 1: Vehicle to repair + * 2: Selected hitpoint + * + * Return Value: + * None + * + * Example: + * [unit, vehicle, "hitpoint"] call ace_repair_fnc_canRepairTrack + * + * Public: No + */ +#include "script_component.hpp" + +params ["_unit", "_target", "_hitPoint", ["_wheel",false]]; +TRACE_4("params",_unit,_target,_hitPoint,_wheel); +// TODO [_unit, _wheel] call EFUNC(common,claim); on start of action + +if !([_unit, _target, ["isNotDragging", "isNotCarrying", "isNotOnLadder"]] call EFUNC(common,canInteractWith)) exitWith {false}; + +if (typeName _wheel == "OBJECT") then { + // not near interpret as objNull + if !(_wheel in nearestObjects [_unit, ["ACE_Track"], 5]) then { + _wheel = objNull; + }; +} else { + _wheel = objNull; + + { + if ([_unit, _x, ["isNotDragging", "isNotCarrying", "isNotOnLadder"]] call EFUNC(common,canInteractWith)) exitWith { + _wheel = _x; + }; + } forEach nearestObjects [_unit, ["ACE_Track"], 5]; +}; + +if (isNull _wheel || damage _wheel >= 1) exitWith {false}; + +alive _target && {_target getHitPointDamage _hitPoint > 0} diff --git a/addons/repair/functions/fnc_canReplaceTrack.sqf b/addons/repair/functions/fnc_canReplaceTrack.sqf new file mode 100644 index 0000000000..aec3a9f062 --- /dev/null +++ b/addons/repair/functions/fnc_canReplaceTrack.sqf @@ -0,0 +1,44 @@ +/* + * Author: commy2 + * Check if the unit can replace given wheel of the vehicle. + * + * Arguments: + * 0: Unit that does the repairing + * 1: Vehicle to repair + * 2: Selected hitpoint + * 3: Track / (default: false) + * + * Return Value: + * None + * + * Example: + * [unit, vehicle, "hitpoint"] call ace_repair_fnc_canReplaceTrack + * + * Public: No + */ +#include "script_component.hpp" + +params ["_unit", "_target", "_hitPoint", ["_track", false]]; +TRACE_4("params",_unit,_target,_hitPoint,_track); +// TODO [_unit, _track] call EFUNC(common,claim); on start of action + +if !([_unit, _target, ["isNotDragging", "isNotCarrying", "isNotOnLadder"]] call EFUNC(common,canInteractWith)) exitWith {false}; + +if (typeName _track == "OBJECT") then { + // not near interpret as objNull + if !(_track in nearestObjects [_unit, ["ACE_Track"], 5]) then { + _track = objNull; + }; +} else { + _track = objNull; + + { + if ([_unit, _x, ["isNotDragging", "isNotCarrying", "isNotOnLadder"]] call EFUNC(common,canInteractWith)) exitWith { + _track = _x; + }; + } forEach nearestObjects [_unit, ["ACE_Track"], 5]; +}; + +if (isNull _track) exitWith {false}; + +alive _target && {_target getHitPointDamage _hitPoint >= 1} diff --git a/addons/repair/functions/fnc_canReplaceWheel.sqf b/addons/repair/functions/fnc_canReplaceWheel.sqf new file mode 100644 index 0000000000..cf7a047f19 --- /dev/null +++ b/addons/repair/functions/fnc_canReplaceWheel.sqf @@ -0,0 +1,48 @@ +/* + * Author: commy2 + * Check if the unit can replace given wheel of the vehicle. + * + * Arguments: + * 0: Unit that does the repairing + * 1: Vehicle to repair + * 2: Selected hitpoint + * 3: Wheel / (default: false) + * + * Return Value: + * None + * + * Example: + * [unit, vehicle, "hitpoint"] call ace_repair_fnc_canReplaceWheel + * + * Public: No + */ +#include "script_component.hpp" + +params ["_unit", "_target", "_hitPoint", ["_wheel", false]]; +TRACE_4("params",_unit,_target,_hitPoint,_wheel); +// TODO [_unit, _wheel] call EFUNC(common,claim); on start of action +//if !([_unit, _target, _hitpoint, "ReplaceWheel"] call FUNC(canRepair)) exitwith {false}; + +if !([_unit, _target, ["isNotDragging", "isNotCarrying", "isNotOnLadder"]] call EFUNC(common,canInteractWith)) exitWith {false}; + +//if !([_unit, GVAR(engineerSetting_Wheel)] call FUNC(isEngineer)) exitWith {false}; + +// check for a near wheel +if (typeName _wheel == "OBJECT") then { + // not near interpret as objNull + if !(_wheel in nearestObjects [_unit, ["ACE_Wheel"], 5]) then { + _wheel = objNull; + }; +} else { + _wheel = objNull; + + { + if ([_unit, _x, ["isNotDragging", "isNotCarrying", "isNotOnLadder"]] call EFUNC(common,canInteractWith)) exitWith { + _wheel = _x; + }; + } forEach nearestObjects [_unit, ["ACE_Wheel"], 5]; +}; + +if (isNull _wheel) exitWith {false}; + +alive _target && {_target getHitPointDamage _hitPoint >= 1} diff --git a/addons/repair/functions/fnc_doFullRepair.sqf b/addons/repair/functions/fnc_doFullRepair.sqf new file mode 100644 index 0000000000..6beec4c4c7 --- /dev/null +++ b/addons/repair/functions/fnc_doFullRepair.sqf @@ -0,0 +1,23 @@ +/* + * Author: Glowbal + * Called by repair action / progress bar. Raise events to set the new hitpoint damage. + * + * Arguments: + * 0: Unit that does the repairing + * 1: Vehicle to repair + * 2: Selected hitpoint + * + * Return Value: + * None + * + * Example: + * [unit, vehicle, "hitpoint"] call ace_repair_fnc_doFullRepair + * + * Public: No + */ +#include "script_component.hpp" + +params ["_unit", "_vehicle", "_hitPoint"]; +TRACE_3("params",_unit,_vehicle,_hitPoint); + +_vehicle setDamage 0; diff --git a/addons/repair/functions/fnc_doRemoveTrack.sqf b/addons/repair/functions/fnc_doRemoveTrack.sqf new file mode 100644 index 0000000000..68755658ca --- /dev/null +++ b/addons/repair/functions/fnc_doRemoveTrack.sqf @@ -0,0 +1,44 @@ +/* + * Author: commy2 + * Called by repair action / progress bar. Raise events to set the new hitpoint damage. + * + * Arguments: + * 0: Unit that does the repairing + * 1: Vehicle to repair + * 2: Selected hitpoint + * + * Return Value: + * None + * + * Example: + * [unit, vehicle, "hitpoint"] call ace_repair_fnc_doRemoveTrack + * + * Public: No + */ +#include "script_component.hpp" + +params ["_unit", "_vehicle", "_hitPoint"]; +TRACE_3("params",_unit,_vehicle,_hitPoint); +// TODO [_unit, _wheel] call EFUNC(common,claim); on start of action +// get current hitpoint damage +private "_hitPointDamage"; +_hitPointDamage = _vehicle getHitPointDamage _hitPoint; + +// can't remove destroyed or already removed wheel +if (_hitPointDamage >= 1) exitWith {}; + +// don't die by spawning / moving the wheel +["fixCollision", _unit] call EFUNC(common,localEvent); + +// spawn wheel +private "_wheel"; +_wheel = ["ACE_Track", getPosASL _unit] call FUNC(spawnObject); +_wheel setdamage _hitPointDamage; + +// raise event to set the new hitpoint damage +["setWheelHitPointDamage", _vehicle, [_vehicle, _hitPoint, 1]] call EFUNC(common,targetEvent); + +// display text message if enabled +if (GVAR(DisplayTextOnRepair)) then { + [localize LSTRING(RemovedTrack)] call EFUNC(common,displayTextStructured); +}; diff --git a/addons/repair/functions/fnc_doRemoveWheel.sqf b/addons/repair/functions/fnc_doRemoveWheel.sqf new file mode 100644 index 0000000000..0ffeb7ad23 --- /dev/null +++ b/addons/repair/functions/fnc_doRemoveWheel.sqf @@ -0,0 +1,44 @@ +/* + * Author: commy2 + * Called by repair action / progress bar. Raise events to set the new hitpoint damage. + * + * Arguments: + * 0: Unit that does the repairing + * 1: Vehicle to repair + * 2: Selected hitpoint + * + * Return Value: + * None + * + * Example: + * [unit, vehicle, "hitpoint"] call ace_repair_fnc_doRemoveWheel + * + * Public: No + */ +#include "script_component.hpp" + +params ["_unit", "_vehicle", "_hitPoint"]; +TRACE_3("params",_unit,_vehicle,_hitPoint); +// TODO [_unit, _wheel] call EFUNC(common,claim); on start of action +// get current hitpoint damage +private "_hitPointDamage"; +_hitPointDamage = _vehicle getHitPointDamage _hitPoint; + +// can't remove destroyed or already removed wheel +if (_hitPointDamage >= 1) exitWith {}; + +// don't die by spawning / moving the wheel +["fixCollision", _unit] call EFUNC(common,localEvent); + +// spawn wheel +private "_wheel"; +_wheel = ["ACE_Wheel", getPosASL _unit] call FUNC(spawnObject); +_wheel setdamage _hitPointDamage; + +// raise event to set the new hitpoint damage +["setWheelHitPointDamage", _vehicle, [_vehicle, _hitPoint, 1]] call EFUNC(common,targetEvent); + +// display text message if enabled +if (GVAR(DisplayTextOnRepair)) then { + [localize LSTRING(RemovedWheel)] call EFUNC(common,displayTextStructured); +}; diff --git a/addons/repair/functions/fnc_doRepair.sqf b/addons/repair/functions/fnc_doRepair.sqf new file mode 100644 index 0000000000..1cf3f77bca --- /dev/null +++ b/addons/repair/functions/fnc_doRepair.sqf @@ -0,0 +1,66 @@ +/* + * Author: commy2 + * Called by repair action / progress bar. Raise events to set the new hitpoint damage. + * + * Arguments: + * 0: Unit that does the repairing + * 1: Vehicle to repair + * 2: Selected hitpoint + * + * Return Value: + * None + * + * Example: + * [unit, vehicle, "hitpoint"] call ace_repair_fnc_doRepair + * + * Public: No + */ +#include "script_component.hpp" + +private ["_hitPointDamage", "_text", "_hitpointGroup"]; +params ["_unit", "_vehicle", "_hitPoint"]; +TRACE_3("params",_unit,_vehicle,_hitPoint); + +// get current hitpoint damage +_hitPointDamage = _vehicle getHitPointDamage _hitPoint; + +_hitPointDamage = _hitPointDamage - 0.5; +// don't use negative values for damage +_hitPointDamage = _hitPointDamage max ([_unit] call FUNC(getPostRepairDamage)); + +// raise event to set the new hitpoint damage +["setVehicleHitPointDamage", _vehicle, [_vehicle, _hitPoint, _hitPointDamage]] call EFUNC(common,targetEvent); + +// Get hitpoint groups if available +_hitpointGroupConfig = configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(hitpointGroups); +_hitpointGroup = []; +if (isArray _hitpointGroupConfig) then { + // Retrieve group if current hitpoint is leader of any + { + if (_x select 0 == _hitPoint) exitWith { + ([_vehicle] call EFUNC(common,getHitPointsWithSelections)) params ["_hitpoints"]; + // Set all sub-group hitpoints' damage to 0, if a hitpoint is invalid print RPT error + { + if (_x in _hitpoints) then { + ["setVehicleHitPointDamage", _vehicle, [_vehicle, _x, 0]] call EFUNC(common,targetEvent); + } else { + diag_log text format ["[ACE] ERROR: Invalid hitpoint %1 in hitpointGroups of %2", _x, _vehicle]; + }; + + } forEach (_x select 1); + }; + } forEach (getArray _hitpointGroupConfig); +}; + +// display text message if enabled +if (GVAR(DisplayTextOnRepair)) then { + private ["_textLocalized", "_textDefault"]; + + // Find localized string + _textLocalized = localize ([LSTRING(RepairedHitPointFully), LSTRING(RepairedHitPointPartially)] select (_hitPointDamage > 0)); + _textDefault = localize ([LSTRING(RepairedFully), LSTRING(RepairedPartially)] select (_hitPointDamage > 0)); + ([_hitPoint, _textLocalized, _textDefault] call FUNC(getHitPointString)) params ["_text"]; + + // Display text + [_text] call EFUNC(common,displayTextStructured); +}; diff --git a/addons/repair/functions/fnc_doRepairTrack.sqf b/addons/repair/functions/fnc_doRepairTrack.sqf new file mode 100644 index 0000000000..de04e71920 --- /dev/null +++ b/addons/repair/functions/fnc_doRepairTrack.sqf @@ -0,0 +1,53 @@ +/* + * Author: commy2 + * Called by repair action / progress bar. Raise events to set the new hitpoint damage. + * + * Arguments: + * 0: Unit that does the repairing + * 1: Vehicle to repair + * 2: Selected hitpoint + * 3: Repair Action Classname + * + * Return Value: + * None + * + * Example: + * [unit, vehicle, "hitpoint", "classname"] call ace_repair_fnc_doRepairTrack + * + * Public: No + */ +#include "script_component.hpp" + +params ["_unit", "_vehicle", "_hitPoint", "_classname"]; +TRACE_4("params",_unit,_vehicle,_hitPoint,_classname); +// TODO [_unit, _wheel] call EFUNC(common,claim); on start of action + +private ["_hitPointDamage", "_newDamage", "_wheel"]; + +_wheel = objNull; + +{ + if ([_unit, _x, ["isNotDragging", "isNotCarrying", "isNotOnLadder"]] call EFUNC(common,canInteractWith)) exitWith { + _wheel = _x; + }; +} forEach nearestObjects [_unit, ["ACE_Track"], 5]; +if (isNull _wheel) exitwith {}; + +// get current hitpoint damage + +_hitPointDamage = _vehicle getHitPointDamage _hitPoint; +_newDamage = (1 - (damage _wheel)) / 4; // require 4 tracks to fully replace one side + +// can't replace a destroyed wheel +if ((damage _wheel) >= 1) exitWith {}; +// don't die by spawning / moving the wheel +_hitPointDamage = (_hitPointDamage - _newDamage) min 0; +deleteVehicle _wheel; + +// raise event to set the new hitpoint damage +["setWheelHitPointDamage", _vehicle, [_vehicle, _hitPoint, _hitPointDamage]] call EFUNC(common,targetEvent); + +// display text message if enabled +if (GVAR(DisplayTextOnRepair)) then { + [LSTRING(ReplacedTrack)] call EFUNC(common,displayTextStructured); +}; diff --git a/addons/repair/functions/fnc_doReplaceTrack.sqf b/addons/repair/functions/fnc_doReplaceTrack.sqf new file mode 100644 index 0000000000..a95a669159 --- /dev/null +++ b/addons/repair/functions/fnc_doReplaceTrack.sqf @@ -0,0 +1,56 @@ +/* + * Author: commy2 + * Called by repair action / progress bar. Raise events to set the new hitpoint damage. + * + * Arguments: + * 0: Unit that does the repairing + * 1: Vehicle to repair + * 2: Selected hitpoint + * 3: Repair Action Classname + * + * Return Value: + * None + * + * Example: + * [unit, vehicle, "hitpoint", "classname"] call ace_repair_fnc_doReplaceTrack + * + * Public: No + */ +#include "script_component.hpp" + +params ["_unit", "_vehicle", "_hitPoint", "_classname"]; +TRACE_4("params",_unit,_vehicle,_hitPoint,_classname); +// TODO [_unit, _wheel] call EFUNC(common,claim); on start of action + +private["_hitPointDamage", "_wheel"]; + +_wheel = objNull; + +{ + if ([_unit, _x, ["isNotDragging", "isNotCarrying", "isNotOnLadder"]] call EFUNC(common,canInteractWith)) exitWith { + _wheel = _x; + }; +} forEach nearestObjects [_unit, ["ACE_Track"], 5]; +if (isNull _wheel) exitwith {}; + +// get current hitpoint damage +_hitPointDamage = _vehicle getHitPointDamage _hitPoint; + +// can't replace not destroyed wheel +if (_hitPointDamage < 1) exitWith {}; + +// don't die by spawning / moving the wheel +_hitPointDamage = damage _wheel; + +// can't replace a destroyed wheel +if (_hitPointDamage >= 1) exitWith {}; + +deleteVehicle _wheel; + +// raise event to set the new hitpoint damage +["setWheelHitPointDamage", _vehicle, [_vehicle, _hitPoint, _hitPointDamage]] call EFUNC(common,targetEvent); + +// display text message if enabled +if (GVAR(DisplayTextOnRepair)) then { + [LSTRING(ReplacedTrack)] call EFUNC(common,displayTextStructured); +}; diff --git a/addons/repair/functions/fnc_doReplaceWheel.sqf b/addons/repair/functions/fnc_doReplaceWheel.sqf new file mode 100644 index 0000000000..f10712d65d --- /dev/null +++ b/addons/repair/functions/fnc_doReplaceWheel.sqf @@ -0,0 +1,56 @@ +/* + * Author: commy2 + * Called by repair action / progress bar. Raise events to set the new hitpoint damage. + * + * Arguments: + * 0: Unit that does the repairing + * 1: Vehicle to repair + * 2: Selected hitpoint + * 3: Repair Action Classname + * + * Return Value: + * None + * + * Example: + * [unit, vehicle, "hitpoint", "classname"] call ace_repair_fnc_doReplaceWheel + * + * Public: No + */ +#include "script_component.hpp" + +params ["_unit", "_vehicle", "_hitPoint", "_classname"]; +TRACE_4("params",_unit,_vehicle,_hitPoint,_classname); +// TODO [_unit, _wheel] call EFUNC(common,claim); on start of action + +private ["_hitPointDamage", "_wheel"]; + +_wheel = objNull; + +{ + if ([_unit, _x, ["isNotDragging", "isNotCarrying", "isNotOnLadder"]] call EFUNC(common,canInteractWith)) exitWith { + _wheel = _x; + }; +} forEach nearestObjects [_unit, ["ACE_Wheel"], 5]; +if (isNull _wheel) exitwith {}; + +// get current hitpoint damage +_hitPointDamage = _vehicle getHitPointDamage _hitPoint; + +// can't replace not destroyed wheel +if (_hitPointDamage < 1) exitWith {}; + +// don't die by spawning / moving the wheel +_hitPointDamage = damage _wheel; + +// can't replace a destroyed wheel +if (_hitPointDamage >= 1) exitWith {}; + +deleteVehicle _wheel; + +// raise event to set the new hitpoint damage +["setWheelHitPointDamage", _vehicle, [_vehicle, _hitPoint, _hitPointDamage]] call EFUNC(common,targetEvent); + +// display text message if enabled +if (GVAR(DisplayTextOnRepair)) then { + [LSTRING(ReplacedWheel)] call EFUNC(common,displayTextStructured); +}; diff --git a/addons/repair/functions/fnc_getHitPointString.sqf b/addons/repair/functions/fnc_getHitPointString.sqf new file mode 100644 index 0000000000..1358e99595 --- /dev/null +++ b/addons/repair/functions/fnc_getHitPointString.sqf @@ -0,0 +1,89 @@ +/* + * Author: Jonpas + * Finds the localized string of the given hitpoint name or uses default text if none found. + * + * Arguments: + * 0: Hitpoint + * 1: Localized Text + * 2: Default Text + * 3: Track Added Hitpoints (default: false) + * + * Return Value: + * 0: Text + * 1: Added Hitpoint (default: []) + * + * Example: + * [unit, vehicle, "hitpoint"] call ace_repair_fnc_getHitPointString + * + * Public: No + */ +#include "script_component.hpp" + +private ["_track", "_trackNames", "_trackStrings", "_trackAmount", "_text", "_toFind", "_trackIndex", "_combinedString"]; +params ["_hitPoint", "_textLocalized", "_textDefault", ["_trackArray", []]]; + +_track = if (count _trackArray > 0) then {true} else {false}; +_trackNames = []; +_trackStrings = []; +_trackAmount = []; + +if (_track) then { + _trackNames = _trackArray select 0; + _trackStrings = _trackArray select 1; + _trackAmount = _trackArray select 2; +}; + +// Prepare first part of the string from stringtable +_text = LSTRING(Hit); + +// Remove "Hit" from hitpoint name if one exists +_toFind = if (_hitPoint find "Hit" == 0) then { + [_hitPoint, 3] call CBA_fnc_substr +} else { + _hitPoint +}; + +// Loop through always shorter part of the hitpoint name to find the string from stringtable +for "_i" from 0 to (count _hitPoint) do { + if (_track) then { + // Loop through already added hitpoints and save index + _trackIndex = -1; + { + if (_x == _toFind) exitWith { + _trackIndex = _forEachIndex; + }; + } forEach _trackNames; + + // Use already added hitpoint if one found above and numerize + if (_trackIndex != -1) exitWith { + _text = localize (_trackStrings select _trackIndex) + " " + str(_trackAmount select _trackIndex); + _trackAmount set [_trackIndex, (_trackAmount select _trackIndex) + 1]; // Set amount + TRACE_2("Same hitpoint found",_toFind,_trackNames); + }; + }; + + + // Localize if localization found + _combinedString = _text + _toFind; + if (isLocalized _combinedString) exitWith { + _text = format [_textLocalized, localize _combinedString]; + TRACE_1("Hitpoint localized",_toFind); + + if (_track) then { + // Add hitpoint to the list + _trackNames pushBack _toFind; + _trackStrings pushBack _combinedString; + _trackAmount pushBack 2; + }; + }; + + // Cut off one character + _toFind = [_toFind, 0, count _toFind - 1] call CBA_fnc_substr; +}; + +// Don't display part name if no string is found in stringtable +if (_text == LSTRING(Hit)) then { + _text = _textDefault; +}; + +[_text, [_trackNames, _trackStrings, _trackAmount]] diff --git a/addons/repair/functions/fnc_getPostRepairDamage.sqf b/addons/repair/functions/fnc_getPostRepairDamage.sqf new file mode 100644 index 0000000000..797f7a4f22 --- /dev/null +++ b/addons/repair/functions/fnc_getPostRepairDamage.sqf @@ -0,0 +1,26 @@ +/* + * Author: commy2 + * Returns the damage threshold based on settings and unit type. + * + * Arguments: + * 0: Unit that does the repairing + * + * Return Value: + * 0: Rpair Damage Threshold + * + * Example: + * [unit] call ace_repair_fnc_getPostRepairDamage + * + * Public: No + */ +#include "script_component.hpp" + +params ["_unit"]; +TRACE_1("params",_unit); +// TODO when near repair station, full repair? + +if (([_unit] call FUNC(isInRepairFacility) || {[_unit] call FUNC(isNearRepairVehicle)})) exitwith {0}; + +if ([_unit, GVAR(engineerSetting_Repair) + 1] call FUNC(isEngineer)) exitWith {GVAR(repairDamageThreshold_Engineer)}; +if ([_unit, GVAR(engineerSetting_Repair)] call FUNC(isEngineer)) exitWith {GVAR(repairDamageThreshold)}; +0.3; diff --git a/addons/repair/functions/fnc_getWheelHitPointsWithSelections.sqf b/addons/repair/functions/fnc_getWheelHitPointsWithSelections.sqf new file mode 100644 index 0000000000..182c6f54f0 --- /dev/null +++ b/addons/repair/functions/fnc_getWheelHitPointsWithSelections.sqf @@ -0,0 +1,82 @@ +/* + * Author: commy2 + * Returns the wheel hitpoints and their selections. + * + * Arguments: + * 0: Vehicle + * + * Return Value: + * 0: Wheel hitpoints + * 1: Wheel hitpoint selections in model coordinates + * + * Example: + * [unit, vehicle, "hitpoint"] call ace_repair_fnc_getWheelHitPointsWithSelections + * + * Public: No + */ +#include "script_component.hpp" + +params ["_vehicle"]; +TRACE_1("params",_vehicle); + +// get the vehicles wheel config +private "_wheels"; +_wheels = configfile >> "CfgVehicles" >> typeOf _vehicle >> "Wheels"; + +// exit with nothing if the vehicle has no wheels class +if !(isClass _wheels) exitWith {[[],[]]}; + +// get all wheels and read selections from config +private ["_selections", "_bones"]; + +_wheels = "true" configClasses _wheels; + +_selections = []; +_bones = []; +{ + _selections pushBack getText (_x >> "center"); + + private "_bone"; + _bone = getText (_x >> "boneName"); + + _bone = toArray _bone; + _bone resize count "wheel_X_Y"; // this is a requirement for physx. Should work for all addon vehicles. + _bone = toString _bone; + + _bones pushBack _bone; +} forEach _wheels; + +// get hitpoints with their fire geometry selections +private ["_hitPointsWithSelections", "_hitPoints", "_hitPointSelections"]; + +_hitPointsWithSelections = [_vehicle] call EFUNC(common,getHitPointsWithSelections); + +_hitPoints = _hitPointsWithSelections select 0; +_hitPointSelections = _hitPointsWithSelections select 1; + +// assign hitpoints to correct wheel selection by comparing bone name and fire geometry selection +private ["_wheelHitPoints", "_wheelHitPointSelections"]; + +_wheelHitPoints = []; +_wheelHitPointSelections = []; +{ + private "_bone"; + _bone = _x; + + private "_index"; + + _index = -1; + { + if (_bone != "" && {_x find _bone == 0}) exitWith { // same as above. Requirement for physx. + _index = _forEachIndex; + }; + } forEach _hitPointSelections; + + if (_index != -1) then { + _wheelHitPoints pushBack (_hitPoints select _index); + _wheelHitPointSelections pushBack (_selections select _forEachIndex); + }; + +} forEach _bones; + +[_wheelHitPoints, _wheelHitPointSelections] diff --git a/addons/repair/functions/fnc_hasItems.sqf b/addons/repair/functions/fnc_hasItems.sqf new file mode 100644 index 0000000000..2f070c8bb6 --- /dev/null +++ b/addons/repair/functions/fnc_hasItems.sqf @@ -0,0 +1,34 @@ +/* + * Author: Glowbal + * Check if the engineer has all items. + * + * Arguments: + * 0: Unit that does the repairing + * 1: Items required + * + * Return Value: + * Has Items + * + * Example: + * [engineer, [items]] call ace_repair_fnc_hasItems + * + * Public: Yes + */ +#include "script_component.hpp" + +params ["_unit", "_items"]; +TRACE_2("params",_unit,_items); + +private ["_return"]; + +_return = true; +{ + if (typeName _x == "ARRAY" && {({[_unit, _x] call EFUNC(common,hasItem)} count _x == 0)}) exitwith { + _return = false; + }; + if (typeName _x == "STRING" && {!([_unit, _x] call EFUNC(common,hasItem))}) exitwith { + _return = false; + }; +} forEach _items; + +_return; diff --git a/addons/repair/functions/fnc_isEngineer.sqf b/addons/repair/functions/fnc_isEngineer.sqf new file mode 100644 index 0000000000..9d6af3a1ff --- /dev/null +++ b/addons/repair/functions/fnc_isEngineer.sqf @@ -0,0 +1,29 @@ +/* + * Author: Glowbal, KoffeinFlummi, commy2 + * Check if a unit is any engineer class. + * + * Arguments: + * 0: Unit + * 1: Class (default: 1) + * + * Return Value: + * Is Engineer Class + * + * Example: + * [unit, 1] call ace_repair_fnc_isEngineer + * + * Public: Yes + */ +#include "script_component.hpp" + +params ["_unit", ["_engineerN", 1]]; +TRACE_2("params",_unit,_engineerN); + +private ["_class"]; +_class = _unit getVariable ["ACE_IsEngineer", getNumber (configFile >> "CfgVehicles" >> typeOf _unit >> "engineer")]; + +// This if statement is here for copmatability with the common variant of isEngineer, which requires a bool. +// We cannot move this function to common because we require the GVAR(engineerSetting_Repair), which only makes sense to include in the repair module. +if (typeName _class == "BOOL") then {_class = 1}; + +_class >= (_engineerN min GVAR(engineerSetting_Repair)); diff --git a/addons/repair/functions/fnc_isInRepairFacility.sqf b/addons/repair/functions/fnc_isInRepairFacility.sqf new file mode 100644 index 0000000000..0c062ff0b3 --- /dev/null +++ b/addons/repair/functions/fnc_isInRepairFacility.sqf @@ -0,0 +1,42 @@ +/* + * Author: Glowbal + * Checks if a unit is in a repair facility. + * + * Arguments: + * 0: Unit + * + * Return Value: + * Is inside a repair facility + * + * Example: + * [unit] call ace_repair_fnc_isInRepairFacility + * + * Public: Yes + */ +#include "script_component.hpp" + +params ["_object"]; +TRACE_1("params",_object); + +private ["_position","_objects","_isInBuilding","_repairFacility"]; + +_position = getPosASL _object; +_isInBuilding = false; +_repairFacility = []; + +_objects = (lineIntersectsWith [_object modelToWorldVisual [0, 0, (_position select 2)], _object modelToWorldVisual [0, 0, (_position select 2) +10], _object]); +{ + if (((typeOf _x) in _repairFacility) || (_x getVariable ["ACE_isRepairFacility",0]) > 0) exitwith { + _isInBuilding = true; + }; +} forEach _objects; + +if (!_isInBuilding) then { + _objects = position _object nearObjects 7.5; + { + if (((typeOf _x) in _repairFacility) || (_x getVariable ["ACE_isRepairFacility",0]) > 0) exitwith { + _isInBuilding = true; + }; + } forEach _objects; +}; +_isInBuilding; diff --git a/addons/repair/functions/fnc_isNearRepairVehicle.sqf b/addons/repair/functions/fnc_isNearRepairVehicle.sqf new file mode 100644 index 0000000000..677f489a88 --- /dev/null +++ b/addons/repair/functions/fnc_isNearRepairVehicle.sqf @@ -0,0 +1,30 @@ +/* + * Author: KoffeinFlummi + * Checks if a unit is near an engineering vehicle. + * + * Arguments: + * 0: Unit + * + * Return Value: + * Is near engineering vehicle + * + * Example: + * [unit] call ace_repair_fnc_isNearRepairVehicle + * + * Public: Yes + */ +#include "script_component.hpp" + +params ["_unit"]; +TRACE_1("params",_unit); + +private ["_nearObjects", "_return"]; + +_nearObjects = nearestObjects [_unit, ["Air","LandVehicle"], 20]; + +_return = false; +{ + if ([_x] call FUNC(isRepairVehicle)) exitwith {_return = true;}; +} forEach _nearObjects; + +_return; diff --git a/addons/repair/functions/fnc_isRepairVehicle.sqf b/addons/repair/functions/fnc_isRepairVehicle.sqf new file mode 100644 index 0000000000..121bda0fe3 --- /dev/null +++ b/addons/repair/functions/fnc_isRepairVehicle.sqf @@ -0,0 +1,23 @@ +/* + * Author: Glowbal + * Check if vehicle is a engineering vehicle. + * + * Arguments: + * 0: Vehicle + * + * ReturnValue: + * Is engineering vehicle + * + * Example: + * [vehicle] call ace_repair_fnc_isRepairVehicle + * + * Public: Yes + */ +#include "script_component.hpp" + +params ["_vehicle"]; +TRACE_1("params",_vehicle); + +if (_vehicle isKindOf "CAManBase") exitwith {false}; + +((_vehicle getVariable ["ACE_isRepairVehicle", getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(canRepair))]) > 0); diff --git a/addons/repair/functions/fnc_moduleAddSpareParts.sqf b/addons/repair/functions/fnc_moduleAddSpareParts.sqf new file mode 100644 index 0000000000..46689951a7 --- /dev/null +++ b/addons/repair/functions/fnc_moduleAddSpareParts.sqf @@ -0,0 +1,61 @@ +/* + * Author: Jonpas + * Adds spare parts to a vehicle. + * + * Arguments: + * 0: The module logic + * 1: Synchronized units + * 2: Activated + * + * Return Value: + * None + * + * Example: + * function = "ace_repair_fnc_moduleAssignRepairVehicle" + * + * Public: No + */ +#define DEBUG_MODE_FULL +#include "script_component.hpp" + +params ["_logic"]; + +if (!isNull _logic) then { + private ["_list", "_part", "_amount", "_nilCheckPassedList"]; + // Module settings + _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; + + // Add synchronized objects to list + { + _list pushBack _x; + } forEach (synchronizedObjects _logic); + + if (_list isEqualTo []) exitWith {}; + + 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; +}; + +true diff --git a/addons/repair/functions/fnc_moduleAssignEngineer.sqf b/addons/repair/functions/fnc_moduleAssignEngineer.sqf new file mode 100644 index 0000000000..9fb9ed8431 --- /dev/null +++ b/addons/repair/functions/fnc_moduleAssignEngineer.sqf @@ -0,0 +1,31 @@ +/* + * Author: Glowbal + * Assign an engineer role to a unit. + * + * Arguments: + * 0: The module logic + * 1: Synchronized units + * 2: Activated + * + * Return Value: + * None + * + * Example: + * function = "ace_repair_fnc_moduleAssignEngineer" + * + * Public: No + */ +#include "script_component.hpp" + +params ["_logic"]; + +if (!isNull _logic) then { + private ["_list", "_setting"]; + _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 new file mode 100644 index 0000000000..00cb847866 --- /dev/null +++ b/addons/repair/functions/fnc_moduleAssignRepairFacility.sqf @@ -0,0 +1,31 @@ +/* + * Author: Glowbal + * Assign a repair facility. + * + * Arguments: + * 0: The module logic + * 1: Synchronized units + * 2: Activated + * + * Return Value: + * None + * + * Example: + * function = "ace_repair_fnc_moduleAssignRepairFacility" + * + * Public: No + */ +#include "script_component.hpp" + +params ["_logic"]; + +if (!isNull _logic) then { + private ["_list", "_setting"]; + _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 new file mode 100644 index 0000000000..69d2a2c52f --- /dev/null +++ b/addons/repair/functions/fnc_moduleAssignRepairVehicle.sqf @@ -0,0 +1,31 @@ +/* + * Author: Glowbal + * Assign a repair vehicle. + * + * Arguments: + * 0: The module logic + * 1: Synchronized units + * 2: Activated + * + * Return Value: + * None + * + * Example: + * function = "ace_repair_fnc_moduleAssignRepairVehicle" + * + * Public: No + */ +#include "script_component.hpp" + +params ["_logic"]; + +if (!isNull _logic) then { + private ["_list", "_setting"]; + _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/repair/functions/fnc_moduleRepairSettings.sqf b/addons/repair/functions/fnc_moduleRepairSettings.sqf new file mode 100644 index 0000000000..98ff354662 --- /dev/null +++ b/addons/repair/functions/fnc_moduleRepairSettings.sqf @@ -0,0 +1,38 @@ +/* + * Author: commy2 + * Adjusts repair damage settings. + * + * Arguments: + * 0: The module logic + * 1: Synchronized units + * 2: Activated + * + * Return Value: + * None + * + * Example: + * function = "ace_repair_fnc_moduleRepairSettings" + * + * Public: No + */ +#include "script_component.hpp" + +params ["_logic"]; + +if (!isServer) exitWith {}; + +[_logic, QGVAR(engineerSetting_Repair), "engineerSetting_Repair"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(engineerSetting_Wheel), "engineerSetting_Wheel"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(consumeItem_ToolKit), "consumeItem_ToolKit"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(repairDamageThreshold), "repairDamageThreshold"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(repairDamageThreshold_Engineer), "repairDamageThreshold_Engineer"] call EFUNC(common,readSettingFromModule); + + +[_logic, QGVAR(fullRepairLocation), "fullRepairLocation"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(engineerSetting_fullRepair), "engineerSetting_fullRepair"] call EFUNC(common,readSettingFromModule); + +[_logic, QGVAR(addSpareParts), "addSpareParts"] call EFUNC(common,readSettingFromModule); + +[_logic, QGVAR(wheelRepairRequiredItems), "wheelRepairRequiredItems"] call EFUNC(common,readSettingFromModule); + +ACE_LOGINFO("Repair Module Initialized."); diff --git a/addons/repair/functions/fnc_normalizeHitPoints.sqf b/addons/repair/functions/fnc_normalizeHitPoints.sqf new file mode 100644 index 0000000000..88c72f4de8 --- /dev/null +++ b/addons/repair/functions/fnc_normalizeHitPoints.sqf @@ -0,0 +1,48 @@ +/* + * Author: commy2 + * Used to normalize dependant hitpoints. May overwrite some global variables that are named like hitpoints or "Total" though... + * + * Arguments: + * 0: Local Vehicle + * + * Return Value: + * None + * + * Example: + * [vehicle] call ace_repair_fnc_normalizeHitPoints + * + * Public: No + */ +#include "script_component.hpp" + +params ["_vehicle"]; +TRACE_1("params",_vehicle); + +// Can't execute all commands if the vehicle isn't local, exit if that's so +if !(local _vehicle) exitWith {}; + +private ["_hitPoints", "_config", "_dependentHitPoints", "_dependentHitPointScripts", "_damage"]; + +_hitPoints = [_vehicle] call EFUNC(common,getHitPoints); +_config = configFile >> "CfgVehicles" >> typeOf _vehicle >> "HitPoints"; + +// define global variables. Needed to parse the depends config entries. Also find dependent hitpoints. + +_dependentHitPoints = []; +_dependentHitPointScripts = []; + +Total = damage _vehicle; + +{ + missionNamespace setVariable [_x, _vehicle getHitPointDamage _x]; + if (isText (_config >> _x >> "depends")) then { + _dependentHitPoints pushBack _x; + _dependentHitPointScripts pushBack compile getText (_config >> _x >> "depends"); + }; +} forEach _hitPoints; + +// apply normalized damage to all dependand hitpoints +{ + _damage = call (_dependentHitPointScripts select _forEachIndex); + _vehicle setHitPointDamage [_x, _damage]; +} forEach _dependentHitPoints; diff --git a/addons/repair/functions/fnc_repair.sqf b/addons/repair/functions/fnc_repair.sqf new file mode 100644 index 0000000000..fd3b4f032b --- /dev/null +++ b/addons/repair/functions/fnc_repair.sqf @@ -0,0 +1,212 @@ +/* + * Author: Glowbal, KoffeinFlummi + * Starts the repair process. + * + * Arguments: + * 0: Unit that does the repairing + * 1: Vehicle to repair + * 3: Repair Action Classname + * + * Return Value: + * Succesful Repair Started + * + * Example: + * [unit, vehicle, "hitpoint", "classname"] call ace_repair_fnc_repair + * + * Public: Yes + */ +#include "script_component.hpp" + +params ["_caller", "_target", "_hitPoint", "_className"]; +TRACE_4("params",_calller,_target,_hitPoint,_className); + +private["_callbackProgress", "_callerAnim", "_calller", "_condition", "_config", "_consumeItems", "_displayText", "_engineerRequired", "_iconDisplayed", "_items", "_locations", "_repairTime", "_repairTimeConfig", "_return", "_usersOfItems", "_vehicleStateCondition", "_wpn", "_settingName", "_settingItemsArray"]; + +_config = (ConfigFile >> "ACE_Repair" >> "Actions" >> _className); +if !(isClass _config) exitwith {false}; // or go for a default? + +_engineerRequired = if (isNumber (_config >> "requiredEngineer")) then { + getNumber (_config >> "requiredEngineer"); +} else { + // Check for required class + if (isText (_config >> "requiredEngineer")) exitwith { + missionNamespace getVariable [(getText (_config >> "requiredEngineer")), 0]; + }; + 0; +}; +if !([_caller, _engineerRequired] call FUNC(isEngineer)) exitwith {false}; +if (isEngineOn _target) exitwith {false}; + +//Items can be an array of required items or a string to a ACE_Setting array +_items = if (isArray (_config >> "items")) then { + getArray (_config >> "items"); +} else { + _settingName = getText (_config >> "items"); + _settingItemsArray = getArray (configFile >> "ACE_Settings" >> _settingName >> "_values"); + if ((isNil _settingName) || {(missionNamespace getVariable _settingName) >= (count _settingItemsArray)}) exitWith { + ERROR("bad setting"); ["BAD"] + }; + _settingItemsArray select (missionNamespace getVariable _settingName); +}; +if (count _items > 0 && {!([_caller, _items] call FUNC(hasItems))}) exitwith {false}; + +_return = true; +if (getText (_config >> "condition") != "") then { + _condition = getText (_config >> "condition"); + if (isnil _condition) then { + _condition = compile _condition; + } else { + _condition = missionNamespace getVariable _condition; + }; + if (typeName _condition == "BOOL") then { + _return = _condition; + } else { + _return = [_caller, _target, _hitPoint, _className] call _condition; + }; +}; +if (!_return) exitwith {false}; + +_vehicleStateCondition = if (isText(_config >> "vehicleStateCondition")) then { + missionNamespace getVariable [getText(_config >> "vehicleStateCondition"), 0] +} else { + getNumber(_config >> "vehicleStateCondition") +}; +// if (_vehicleStateCondition == 1 && {!([_target] call FUNC(isInStableCondition))}) exitwith {false}; + +_locations = getArray (_config >> "repairLocations"); +if ("All" in _locations) exitwith {true}; + +private ["_repairFacility", "_repairVeh"]; +_repairFacility = {([_caller] call FUNC(isInRepairFacility)) || ([_target] call FUNC(isInRepairFacility))}; +_repairVeh = {([_caller] call FUNC(isNearRepairVehicle)) || ([_target] call FUNC(isNearRepairVehicle))}; + +{ + if (_x == "field") exitwith {_return = true;}; + if (_x == "RepairFacility" && _repairFacility) exitwith {_return = true;}; + if (_x == "RepairVehicle" && _repairVeh) exitwith {_return = true;}; + if !(isnil _x) exitwith { + private "_val"; + _val = missionNamespace getVariable _x; + if (typeName _val == "SCALAR") then { + _return = switch (_val) do { + case 0: {true}; //useAnywhere + case 1: {call _repairVeh}; //repairVehicleOnly + case 2: {call _repairFacility}; //repairFacilityOnly + case 3: {(call _repairFacility) || {call _repairVeh}}; //vehicleAndFacility + default {false}; //Disabled + }; + }; + }; +} forEach _locations; + +if !(_return && alive _target) exitwith {false}; + +_consumeItems = if (isNumber (_config >> "itemConsumed")) then { + getNumber (_config >> "itemConsumed"); +} else { + // Check for required class + if (isText (_config >> "itemConsumed")) exitwith { + missionNamespace getVariable [(getText (_config >> "itemConsumed")), 0]; + }; + 0; +}; + +_usersOfItems = []; +if (_consumeItems > 0) then { + _usersOfItems = ([_caller, _target, _items] call FUNC(useItems)) select 1; +}; + +// Parse the config for the progress callback +_callbackProgress = getText (_config >> "callbackProgress"); +if (_callbackProgress == "") then { + _callbackProgress = "true"; +}; +if (isNil _callbackProgress) then { + _callbackProgress = compile _callbackProgress; +} else { + _callbackProgress = missionNamespace getVariable _callbackProgress; +}; + + +// Player Animation +_callerAnim = [getText (_config >> "animationCaller"), getText (_config >> "animationCallerProne")] select (stance _caller == "PRONE"); +_caller setvariable [QGVAR(selectedWeaponOnrepair), currentWeapon _caller]; + +// Cannot use secondairy weapon for animation +if (currentWeapon _caller == secondaryWeapon _caller) then { + _caller selectWeapon (primaryWeapon _caller); +}; + +_wpn = ["non", "rfl", "pst"] select (1 + ([primaryWeapon _caller, handgunWeapon _caller] find (currentWeapon _caller))); +_callerAnim = [_callerAnim, "[wpn]", _wpn] call CBA_fnc_replace; +if (vehicle _caller == _caller && {_callerAnim != ""}) then { + if (primaryWeapon _caller == "") then { + _caller addWeapon "ACE_FakePrimaryWeapon"; + }; + if (currentWeapon _caller == "") then { + _caller selectWeapon (primaryWeapon _caller); // unit always has a primary weapon here + }; + + if (stance _caller == "STAND") then { + _caller setvariable [QGVAR(repairPrevAnimCaller), "amovpknlmstpsraswrfldnon"]; + } else { + _caller setvariable [QGVAR(repairPrevAnimCaller), animationState _caller]; + }; + [_caller, _callerAnim] call EFUNC(common,doAnimation); +}; + +//Get repair time +_repairTime = if (isNumber (_config >> "repairingTime")) then { + getNumber (_config >> "repairingTime"); +} else { + if (isText (_config >> "repairingTime")) exitwith { + _repairTimeConfig = getText(_config >> "repairingTime"); + if (isnil _repairTimeConfig) then { + _repairTimeConfig = compile _repairTimeConfig; + } else { + _repairTimeConfig = missionNamespace getVariable _repairTimeConfig; + }; + if (typeName _repairTimeConfig == "SCALAR") exitwith { + _repairTimeConfig; + }; + [_caller, _target, _hitPoint, _className] call _repairTimeConfig; + }; + 0; +}; + +private ["_processText"]; +// Find localized string +_processText = getText (_config >> "displayNameProgress"); +([_hitPoint, _processText, _processText] call FUNC(getHitPointString)) params ["_text"]; + +// Start repair +[ + _repairTime, + [_caller, _target, _hitPoint, _className, _items, _usersOfItems], + DFUNC(repair_success), + DFUNC(repair_failure), + _text, + _callbackProgress, + ["isNotOnLadder"] +] call EFUNC(common,progressBar); + +// Display Icon +_iconDisplayed = getText (_config >> "actionIconPath"); +if (_iconDisplayed != "") then { + [QGVAR(repairActionIcon), true, _iconDisplayed, [1,1,1,1], getNumber(_config >> "actionIconDisplayTime")] call EFUNC(common,displayIcon); +}; + +// handle display of text/hints +_displayText = ""; +if (_target != _caller) then { + _displayText = getText(_config >> "displayTextOther"); +} else { + _displayText = getText(_config >> "displayTextSelf"); +}; + +if (_displayText != "") then { + ["displayTextStructured", [_caller], [[_displayText, [_caller] call EFUNC(common,getName), [_target] call EFUNC(common,getName)], 1.5, _caller]] call EFUNC(common,targetEvent); +}; + +true; diff --git a/addons/repair/functions/fnc_repair_failure.sqf b/addons/repair/functions/fnc_repair_failure.sqf new file mode 100644 index 0000000000..6e27ab07a7 --- /dev/null +++ b/addons/repair/functions/fnc_repair_failure.sqf @@ -0,0 +1,61 @@ +/* + * Author: KoffeinFlummi, Glowbal + * Callback when repair fails. + * + * Arguments: + * 0: Arguments + * 0: Unit that does the repairing + * 1: Vehicle to repair + * 3: Repair Action Classname + * 4: None + * 5: Items available + * + * Return Value: + * None + * + * Example: + * [[unit, vehicle, "hitpoint", "classname", nil, [items]]] call ace_repair_fnc_repair_failure + * + * Public: No + */ +#include "script_component.hpp" + +params ["_args"]; +_args params ["_caller", "_target","_selectionName","_className","","_usersOfItems"]; +TRACE_5("params",_caller,_target,_selectionName,_className,_usersOfItems); + +private ["_config","_callback", "_usersOfItems", "_weaponSelect"]; + +if (primaryWeapon _caller == "ACE_FakePrimaryWeapon") then { + _caller removeWeapon "ACE_FakePrimaryWeapon"; +}; +if (vehicle _caller == _caller) then { + [_caller, _caller getVariable [QGVAR(repairPrevAnimCaller), ""], 2] call EFUNC(common,doAnimation); +}; +_caller setvariable [QGVAR(repairPrevAnimCaller), nil]; + +_weaponSelect = (_caller getVariable [QGVAR(selectedWeaponOnrepair), ""]); +if (_weaponSelect != "") then { + _caller selectWeapon _weaponSelect; +} else { + _caller action ["SwitchWeapon", _caller, _caller, 99]; +}; + +{ + (_x select 0) addItem (_x select 1); +} forEach _usersOfItems; + +// Record specific callback +_config = (ConfigFile >> "ACE_Repair" >> "Actions" >> _className); + +_callback = getText (_config >> "callbackFailure"); +if (isNil _callback) then { + _callback = compile _callback; +} else { + _callback = missionNamespace getVariable _callback; +}; + +_args call _callback; + +// _args call FUNC(createLitter); diff --git a/addons/repair/functions/fnc_repair_success.sqf b/addons/repair/functions/fnc_repair_success.sqf new file mode 100644 index 0000000000..ccad93663f --- /dev/null +++ b/addons/repair/functions/fnc_repair_success.sqf @@ -0,0 +1,54 @@ +/* + * Author: KoffeinFlummi, Glowbal + * Callback when repair completes. + * + * Arguments: + * 0: Arguments + * 0: Unit that does the repairing + * 1: Vehicle to repair + * 3: Repair Action Classname + * + * Return Value: + * None + * + * Example: + * [[unit, vehicle, "hitpoint", "classname"]] call ace_repair_fnc_repair_success + * + * Public: No + */ +#include "script_component.hpp" + +params ["_args"]; +_args params ["_caller", "_target","_selectionName","_className"]; +TRACE_4("params",_caller,_target,_selectionName,_className); + +private ["_config","_callback", "_weaponSelect"]; + +if (primaryWeapon _caller == "ACE_FakePrimaryWeapon") then { + _caller removeWeapon "ACE_FakePrimaryWeapon"; +}; +if (vehicle _caller == _caller) then { + [_caller, _caller getVariable [QGVAR(repairPrevAnimCaller), ""], 2] call EFUNC(common,doAnimation); +}; +_caller setvariable [QGVAR(repairPrevAnimCaller), nil]; + +_weaponSelect = (_caller getVariable [QGVAR(selectedWeaponOnrepair), ""]); +if (_weaponSelect != "") then { + _caller selectWeapon _weaponSelect; +} else { + _caller action ["SwitchWeapon", _caller, _caller, 99]; +}; + +// Record specific callback +_config = (ConfigFile >> "ACE_Repair" >> "Actions" >> _className); + +_callback = getText (_config >> "callbackSuccess"); +if (isNil _callback) then { + _callback = compile _callback; +} else { + _callback = missionNamespace getVariable _callback; +}; +_args call _callback; + +// _args call FUNC(createLitter); diff --git a/addons/repair/functions/fnc_setDamage.sqf b/addons/repair/functions/fnc_setDamage.sqf new file mode 100644 index 0000000000..410a9b0396 --- /dev/null +++ b/addons/repair/functions/fnc_setDamage.sqf @@ -0,0 +1,45 @@ +/* + * Author: commy2 + * Sets the structural damage of a vehicle without altering the hitPoints, requires local vehicle. + * + * Arguments: + * 0: Local Vehicle to Damage + * 1: Total Damage + * + * Return Value: + * None + * + * Example: + * [vehicle, 0.5] call ace_repair_fnc_setDamage + * + * Public: No + */ +#include "script_component.hpp" + +params ["_vehicle", "_damage"]; +TRACE_2("params",_vehicle,_damage); + +// can't execute all commands if the vehicle isn't local. exit here. +if !(local _vehicle) exitWith {}; + +// save array with damage values of all hitpoints +private ["_hitPoints", "_hitPointDamages"]; + +_hitPoints = [_vehicle] call EFUNC(common,getHitpoints); + +_hitPointDamages = []; + +{ + _hitPointDamages set [_forEachIndex, _vehicle getHitPointDamage _x]; +} forEach _hitPoints; + +// set damage of the vehicle +_vehicle setDamage _damage; + +// restore original hitpoint damage values +{ + _vehicle setHitPointDamage [_x, _hitPointDamages select _forEachIndex]; +} forEach _hitPoints; + +// normalize hitpoints +[_vehicle] call FUNC(normalizeHitPoints); diff --git a/addons/repair/functions/fnc_setHitPointDamage.sqf b/addons/repair/functions/fnc_setHitPointDamage.sqf new file mode 100644 index 0000000000..a8b4cd347b --- /dev/null +++ b/addons/repair/functions/fnc_setHitPointDamage.sqf @@ -0,0 +1,86 @@ +/* + * Author: commy2 + * Set the hitpoint damage and change the structural damage acordingly, requires local vehicle. + * + * Arguments: + * 0: Local Vehicle to Damage + * 1: Selected hitpoint + * 2: Total Damage + * + * Return Value: + * None + * + * Example: + * [vehicle, "hitpoint", 0.5] call ace_repair_fnc_setHitPointDamage + * + * Public: No + */ +#include "script_component.hpp" + +params ["_vehicle", "_hitPoint", "_hitPointDamage"]; +TRACE_3("params",_vehicle,_hitPoint,_hitPointDamage); + +// can't execute all commands if the vehicle isn't local. exit here. +if !(local _vehicle) exitWith {}; + +// get all valid hitpoints +private ["_hitPoints", "_hitPointsWithSelections"]; + +_hitPoints = [_vehicle] call EFUNC(common,getHitpoints); +_hitPointsWithSelections = [_vehicle] call EFUNC(common,getHitpointsWithSelections) select 0; + +// exit if the hitpoint is not valid +if !(_hitPoint in _hitPoints) exitWith {systemChat format["NOT A VALID HITPOINT: %1",_hitpoint]}; + +// save array with damage values of all hitpoints +private "_hitPointDamages"; +_hitPointDamages = []; + +{ + _hitPointDamages set [_forEachIndex, (_vehicle getHitPointDamage _x)]; +} forEach _hitPoints; + +// save structural damage and sum of hitpoint damages +private ["_damageOld", "_hitPointDamageSumOld"]; + +_damageOld = damage _vehicle; + +_hitPointDamageSumOld = 0; +{ + if (!(_x in IGNORED_HITPOINTS) && {!isText (configFile >> "CfgVehicles" >> typeOf _vehicle >> "HitPoints" >> _x >> "depends")}) then { + _hitPointDamageSumOld = _hitPointDamageSumOld + (_hitPointDamages select (_hitPoints find _x)); + }; +} forEach _hitPointsWithSelections; + +// set new damage in array +_hitPointDamages set [_hitPoints find _hitPoint, _hitPointDamage]; + +// save sum of new hitpoint damages +private "_hitPointDamageSumNew"; + +_hitPointDamageSumNew = 0; +{ + if (!(_x in IGNORED_HITPOINTS) && {!isText (configFile >> "CfgVehicles" >> typeOf _vehicle >> "HitPoints" >> _x >> "depends")}) then { + _hitPointDamageSumNew = _hitPointDamageSumNew + (_hitPointDamages select (_hitPoints find _x)); + }; +} forEach _hitPointsWithSelections; + +// calculate new strctural damage +private "_damageNew"; +_damageNew = _hitPointDamageSumNew / count _hitPoints; + +if (_hitPointDamageSumOld > 0) then { + _damageNew = _damageOld * (_hitPointDamageSumNew / _hitPointDamageSumOld); +}; + +// set new structural damage value +_vehicle setDamage _damageNew; + +// set the new damage for that hit point + +{ + _vehicle setHitPointDamage [_x, _hitPointDamages select _forEachIndex]; +} forEach _hitPoints; + +// normalize hitpoints +// [_vehicle] call FUNC(normalizeHitPoints); diff --git a/addons/repair/functions/fnc_spawnObject.sqf b/addons/repair/functions/fnc_spawnObject.sqf new file mode 100644 index 0000000000..1ea4b7363a --- /dev/null +++ b/addons/repair/functions/fnc_spawnObject.sqf @@ -0,0 +1,32 @@ +/* + * Author: commy2 + * Spawns an object of specified string, at specified position with specified damage taken. + * + * Arguments: + * 0: Item classname + * 1: Position + * 2: Damage + * + * Return Value: + * None + * + * Example: + * ["classname", [0, 0, 0], 1] call ace_repair_fnc_spawnObject + * + * Public: No + */ +#include "script_component.hpp" + +params ["_item", "_position", ["_damage", 0]]; +TRACE_3("params",_item,_position,_damage); + +// randomized end position +_position = _position vectorAdd [1 - random 2, 1 - random 2, 0]; + +_item = createVehicle [_item, _position, [], 0, "NONE"]; +_item setPosASL _position; + +["fixCollision", _item] call EFUNC(common,localEvent); +["fixPosition", _item] call EFUNC(common,localEvent); + +_item setDamage _damage; diff --git a/addons/repair/functions/fnc_useItem.sqf b/addons/repair/functions/fnc_useItem.sqf new file mode 100644 index 0000000000..218a7a1ee4 --- /dev/null +++ b/addons/repair/functions/fnc_useItem.sqf @@ -0,0 +1,26 @@ +/* + * Author: Glowbal + * Use Equipment if any is available. + * + * Arguments: + * 0: Unit + * 2: Item classname + * + * ReturnValue: + * None + * + * Example: + * [unit, "classname"] call ace_repair_fnc_useItem + * + * Public: Yes + */ +#include "script_component.hpp" + +params ["_unit", "_item"]; +TRACE_2("params",_unit,_item); + +if ([_unit, _item] call EFUNC(common,hasItem)) exitwith { + [[_unit, _item], QUOTE(EFUNC(common,useItem)), _unit] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ + [true, _unit]; +}; +[false, objNull]; diff --git a/addons/repair/functions/fnc_useItems.sqf b/addons/repair/functions/fnc_useItems.sqf new file mode 100644 index 0000000000..f8aa176018 --- /dev/null +++ b/addons/repair/functions/fnc_useItems.sqf @@ -0,0 +1,41 @@ +/* + * Author: Glowbal + * Use Equipment items if any is available. + * + * Arguments: + * 0: Unit + * 1: Item classnames + * + * ReturnValue: + * None + * + * Example: + * [unit, ["classname1", "classname2"]] call ace_repair_fnc_useItems + * + * Public: Yes + */ +#include "script_component.hpp" + +params ["_unit", "_items"]; +TRACE_2("params",_unit,_items); + +private ["_itemUsedInfo", "_itemsUsedBy"]; + +_itemsUsedBy = []; +{ + // handle a one of type use item + if (typeName _x == "ARRAY") then { + { + _itemUsedInfo = [_unit, _x] call FUNC(useItem); + if (_itemUsedInfo select 0) exitwith { _itemsUsedBy pushback [(_itemUsedInfo select 1), _x]}; + } forEach _x; + }; + + // handle required item + if (typeName _x == "STRING") then { + _itemUsedInfo = [_unit, _x] call FUNC(useItem); + if (_itemUsedInfo select 0) exitwith { _itemsUsedBy pushback [(_itemUsedInfo select 1), _x]}; + }; +} forEach _items; + +[count _items == count _itemsUsedBy, _itemsUsedBy]; diff --git a/addons/repair/functions/script_component.hpp b/addons/repair/functions/script_component.hpp new file mode 100644 index 0000000000..80a7b2eb74 --- /dev/null +++ b/addons/repair/functions/script_component.hpp @@ -0,0 +1 @@ +#include "\z\ace\addons\repair\script_component.hpp" diff --git a/addons/repair/script_component.hpp b/addons/repair/script_component.hpp new file mode 100644 index 0000000000..a6aa1db61f --- /dev/null +++ b/addons/repair/script_component.hpp @@ -0,0 +1,18 @@ +#define COMPONENT repair +#include "\z\ace\addons\main\script_mod.hpp" + +// #define DEBUG_MODE_FULL + +#ifdef DEBUG_ENABLED_REPAIR + #define DEBUG_MODE_FULL +#endif + +#ifdef DEBUG_SETTINGS_REPAIR + #define DEBUG_SETTINGS DEBUG_SETTINGS_REPAIR +#endif + +#include "\z\ace\addons\main\script_macros.hpp" + + +#define IGNORED_HITPOINTS ["HitGlass1", "HitGlass2", "HitGlass3", "HitGlass4", "HitGlass5", "HitGlass6", "HitGlass7", "HitGlass8", "HitGlass9", "HitGlass10", "HitGlass11", "HitGlass12", "HitGlass13", "HitGlass14", "HitGlass15", "HitRGlass", "HitLGlass", "Glass_1_hitpoint", "Glass_2_hitpoint", "Glass_3_hitpoint", "Glass_4_hitpoint", "Glass_5_hitpoint", "Glass_6_hitpoint", "Glass_7_hitpoint", "Glass_8_hitpoint", "Glass_9_hitpoint", "Glass_10_hitpoint", "Glass_11_hitpoint", "Glass_12_hitpoint", "Glass_13_hitpoint", "Glass_14_hitpoint", "Glass_15_hitpoint", "Glass_16_hitpoint", "Glass_17_hitpoint", "Glass_18_hitpoint", "Glass_19_hitpoint", "Glass_20_hitpoint"] +#define TRACK_HITPOINTS ["HitLTrack", "HitRTrack"] diff --git a/addons/repair/stringtable.xml b/addons/repair/stringtable.xml new file mode 100644 index 0000000000..d4b9527f09 --- /dev/null +++ b/addons/repair/stringtable.xml @@ -0,0 +1,1011 @@ + + + + + Spare Track + Ersatzkette + Oruga de repuesto + Chenille de réserve + Zapasowa gąsienica + Esteira reserva + Náhradní Pásy + Cingolo di scorta + Pót lánctalp + Запасная гусеница + + + Spare Wheel + Ersatzreifen + Rueda de repuesto + Roue de secours + Zapasowe koło + Náhradní Kolo + Estepe + Ruota di scorta + Pótkerék + Запасное колесо + + + Change Wheel + Reifen wechseln + Cambiar rueda + Changer Roue + Wymień koło + Trocar roda + Sostituisci la ruota + Kerék cseréje + Поменять колесо + + + Replacing Wheel ... + Ersetze Reifen ... + Wymienianie koła ... + Trocando roda... + Замена колеса ... + Měním Kolo ... + Cambiando rueda ... + + + Wheel replaced + Reifen ersetzt + Koło zostało wymienione + Roda trocada + Колесо заменено + Kolo vyměněno + Rueda cambiada + + + Remove Wheel + Reifen entfernen + Quitar rueda + Démonter Roue + Zdejmij koło + Odstranit Kolo + Remover roda + Rimuovi la ruota + Kerék leszerelése + Снять колесо + + + Removing Wheel ... + Entferne Reifen ... + Zdejmowanie koła ... + Removendo roda... + Снятие колеса ... + Odstraňuji Kolo ... + Quitando rueda ... + + + Wheel removed + Reifen entfernt + Koło zostało zdjęte + Roda removida + Колесо снято + Kolo odstraněno + Rueda quitada + + + Change Track + Wymień gąsienicę + Trocar esteira + Заменить гусеницу + Vyměnit Pás + Cambiar oruga + + + Replacing Track ... + Wymienianie gąsienicy ... + Trocando esteira... + Замена гусеницы ... + Měním Pás ... + Cambiando oruga ... + + + Track replaced + Gąsienica została wymieniona + Esteira trocada + Гусеница заменена + Pás vyměněn + Oruga cambiada + + + Remove Track + Zdejmij gąsienicę + Remover esteira + Снять гусеницу + Odstranit Pás + Quitar oruga + + + Removing Track ... + Zdejmowanie gąsienicy ... + Removendo esteira... + Снятие гусеницы ... + Odstraňuji Pás ... + Quitando oruga ... + + + Track removed + Gąsienica została zdjęta + Esteira trocada + Гусеница снята + Pás odstraněn + Oruga quitada + + + Full Repair + Pełna naprawa + Reparo completo + Полный ремонт + Kompletní Oprava + Reparación completa + + + Repairing Vehicle ... + Naprawianie pojazdu ... + Reparando veículo... + Ремонт транспорта ... + Opravuji Vozidlo ... + Reparando vehículo ... + + + Full Repair Locations + Lokaliz. pełnej naprawy + Localizações de reparo completo + Места полного ремонта + Lokace pro Kompletní Opravu + Lugares de reparación completa + + + At what locations can a vehicle be fully repaired? + W jakich miejscach pojazd może zostać w pełni naprawiony? + Em quais locais um veículo pode ser reparado por completo? + В каких местах транспорт может быть полностью отремеонтирован? + ¿En qué lugares puede un vehículo ser reparado totalmente? + + + Allow Full Repair + Zezwól na pełną naprawę + Permitir reparo completo + Полный ремонт выполняют + Povolit Kompletní Opravu + Permitir reparación completa + + + Who can perform a full repair on a vehicle? + Kto może przeprowadzić pełną naprawę pojazdu? + Кто может выполнять полный ремонт? + Quem pode reparar o veículo por completo? + ¿Quién puede realizar una reparación completa de un vehículo? + + + Add Spare Parts + Dodaj części zam. + Adicionar partes sobressalentes + Añadir repuestos + Добавлять запчасти + + + Add spare parts to vehicles (requires Cargo component)? + Czy dodać do pojazdów części zamienne? Wymaga włączonego cargo. + Adicionar partes sobressalentes aos veículos (requer o componente de carga)? + ¿Añadir repuestos para vehículos (requiere componente de carga)? + Добавлять запасные части в технику (требуется модуль Грузоперевозок)? + + + Repair >> + Reparieren >> + Reparación >> + Réparer >> + Napraw >> + Opravit >> + Reparar >> + Ripara >> + Szerelés >> + Ремонт >> + + + Display text on repair + Wyświetl tekst przy naprawie + Mostrar texto quando reparar + Отображать текст при ремонте + Zobrazit text při opravě + Mostrar texto en la reparación + + + Display a notification whenever you repair a vehicle + Pokaż informację, kiedy wykonujesz czynności związane z naprawą pojazdu. + Mostra uma notificação quando você repara um veículo + Отображать оповещение каждый раз, когда вы ремонтируете транспорт + Mostrar una notificación cada vez que se reparare un vehículo + + + Repairing ... + Reparieren ... + Reparando ... + Réparation ... + Naprawianie... + Opravuji ... + Reparando... + Sto riparando ... + javítása ... + Ремонтируем ... + + + Repairing %1 ... + Reparieren %1 ... + Reparando %1 ... + Réparation %1 ... + Naprawianie %1... + Opravuji %1 ... + Reparando %1... + Sto riparando %1 ... + %1 javítása ... + Ремонтируем %1 ... + + + Repaired %1 + %1 repariert + Reparado %1 + %1 réparé(e) + Naprawiono %1 + Opraveno - %1 + Reparado %1 + %1 Riparata/o + %1 megjavítva + %1 отремонтирован + + + Fully repaired part + Bauteil vollständig repariert + W pełni naprawiono część + Parte totalmente reparada + Полностью отремонтированная часть + Kompletně opravená část + Parte totalmente reparado + + + Partially repaired %1 + Bauteil teilweise repariert + Częściowo naprawiono: %1 + %1 parcialmente reparado + Частично отремонтировано: %1 + Parcialmente reparada %1 + + + Fully repaired %1 + %1 vollständig repariert + W pełni naprawiono: %1 + %1 totalmente reparado + Полностью отремонтировано: %1 + Kompletně opraveno %1 + Totalmente reparada %1 + + + Partially repaired %1 + %1 teilweise repariert + Częściowo naprawiono: %1 + %1 parcialmente reparado + Частично отремонтировано: %1 + Parcialmente reparada %1 + + + Body + Karosserie + Carrocería + Blindage + Karoseria + Karoserie + Carroceria + Carrozzeria + Test + Кузов + + + Hull + Wanne + Casco + Caisse + Kadłub + Trup + Chassi + Scafo + Test + Корпус + + + Engine + Motor + Motor + Moteur + Silnik + Motor + Motor + Motore + Motor + Двигатель + + + Left Horizontal Stabilizer + Lewy statecznik poziomy + Левый горизонтальный стабилизатор + Estabilizador Horizontal Esquerdo + Estabilizador horizontal izquierdo + + + Right Horizontal Stabilizer + Prawy statecznik poziomy + Правый горизонтальный стабилизатор + Estabilizador Horizontal Direito + Estabilizador horizontal derecho + + + Vertical Stabilizer + Vertikální Stabilizátor + Statecznik pionowy + Вертикальный стабилизатор + Estabilizador Vertical + Estabilizador vertical + + + Fuel Tank + Tank + Depósito + Réservoir + Zbiornik paliwa + Palivová nádrž + Tanque de Combustível + Serbatoio + Üzemanyagtank + Топливный бак + + + Transmission + Převodovka + Skrzynia biegów + Трансмиссия + Transmissão + Transmisión + + + Gear + Podwozie + Коробка передач + Engrenagem + Rueda + + + Starter + Zapłon + Startér + Стартер + Arranque + Motor de arranque + + + Tail + Ogon + Ocas + Хвост + Tail + + + Pitot Tube + Rurka Pitota + Pilotova Trubice + Кокпит + Tubo de Pitot + Tubo del pitot + + + Static Port + Port statyczny + Статический иллюминатор + Porta Estática + Puerto estático + + + Ammo + Munice + Amunicja + Боеприпасы + Munição + Munición + + + Turret + Turm + Torreta + Tourelle + Wieżyczka + Věž + Torre + Torretta + Lövegtorony + Башню + + + Gun + Kanone + Cañón + Canon + Działo + Kanón + Canhão + Cannone + Ágyú + Пушку + + + Missiles + Mísseis + Ракеты + Rakety + Rakiety + Misiles + + + Left Track + Linke Kette + Oruga izquierda + Chenille gauche + Lewa gąsienica + Levý Pás + Esteira Esquerda + Cingolo sinistro + Bal lánctalp + Левую гусеницу + + + Right Track + Rechte Kette + Oruga derecha + Chenille droite + Prawa gąsienica + Pravý Pás + Esteira Direita + Cingolo destro + Jobb lánctalp + Правую гусеницу + + + Left Front Wheel + Linkes Vorderrad + Rueda frontal izquierda + Roue avant-gauche + Przednie lewe koło + Levé přední Kolo + Roda Dianteira Esquerda + Ruota frontale sinistra + Bal első kerék + Левое переднее колесо + + + Right Front Wheel + Rechtes Vorderrad + Rueda frontal derecha + Roue avant-droite + Przednie prawe koło + Pravé přední Kolo + Roda Dianteira Direita + Ruota frontale destra + Jobb első kerék + Правое переднее колесо + + + Second Left Front Wheel + Zweites linkes Vorderrad + Segunda rueda frontal izquierda + Deuxième roue avant-gauche + Drugie przednie lewe koło + Druhé Levé přední Kolo + Segunda Roda Dianteira Esquerda + Seconda ruota frontale sinistra + Második bal első kerék + Второе переднее левое колесо + + + Second Right Front Wheel + Zweites rechtes Vorderrad + Segunda rueda frontal derecha + Deuxième roue avant-droite + Drugie przednie prawe koło + Druhé Pravé přední Kolo + Segunda Roda Dianteira Direita + Seconda ruota frontale destra + Második jobb hátsó kerék + Второе правое переднее колесо + + + Left Middle Wheel + Linkes mittleres Rad + Rueda central izquierda + Roue centre-gauche + Środkowe lewe koło + Levé prostřední Kolo + Roda Intermediária Esquerda + Ruota centrale sinistra + Bal középső kerék + Левое среднее колесо + + + Right Middle Wheel + Rechtes mittleres Rad + Rueda central derecha + Roue centre-droite + Środkowe prawe koło + Pravé prostřední Kolo + Roda Intermediária Direita + Ruota centrale destra + Jobb középső kerék + Правое среднее колесо + + + Left Rear Wheel + Linkes Hinterrad + Rueda trasera izquierda + Roue arrière-gauche + Tylnie lewe koło + Levé zadní Kolo + Roda Traseira Esquerda + Ruota posteriore sinistra + Bal hátsó kerék + Левое заднее колесо + + + Right Rear Wheel + Rechtes Hinterrad + Rueda trasera derecha + Roue arrière-droite + Tylnie prawe koło + Pravé zadní Kolo + Roda Traseira Direita + Ruota posteriore destra + Jobb hátsó kerék + Правое заднее колесо + + + Avionics + Avionik + Aviónica + Avionique + Awionika + Elektronika + Aviônica + Avionica + Avionika + Авионику + + + Main Rotor + Hauptrotor + Rotor principal + Rotor principal + Główny rotor + Hlavní Rotor + Rotor Principal + Rotore principale + Főrotor + Несущий винт + + + Tail Rotor + Heckrotor + Rotor de cola + Rotor anticouple + Tylni rotor + Ocasní Rotor + Rotor de Cauda + Rotore di coda + Farokrotor + Рулевой винт + + + Winch + Seilwinde + Wyciągarka + Guincho + Лебедка + Cabrestante + + + Glass (right) + Scheibe (rechts) + Ventana (derecha) + Vitre (droite) + Szyba (prawa) + Sklo (pravé) + Vidro (à direita) + Vetro destro + Jobb szélvédő + Стекло (справа) + + + Glass (left) + Scheibe (links) + Ventana (izquierda) + Vitre (gauche) + Szyba (lewa) + Sklo (pravé) + Vidro (à esquerda) + Vetro sinistro + Bal szélvédő + Стекло (слава) + + + Glass + Scheibe + Ventana + Vitre + Szyba + Sklo + Vidro + Vetro + Üveg + Стекло + + + Repair Settings + Ustawienia naprawy + Preferências de reparo + Ремонт + Ajustes de reparación + + + Provides a repair system for all types of vehicles. + Dostarcza rozbudowany system naprawy dla wszystkich typów pojazdów. + Provém um sistema de reparo para todos os veículos + Предоставляет систему ремонта для всех типов транспортных средств. + Proporciona un sistema de reparación para todo tipo de vehículos. + + + Anyone + Ktokolwiek + Qualquer um + Кто угодно + Kdokoliv + Cualquiera + + + Engineer only + Tylko mechanicy + Somente engenheiro + Только инженеры + Pouze inženýr + Solo ingeniero + + + Repair Specialist only + Tylko inżynierowie + Somente especialista em reparos + Только ремонтные специалисты + Pouze specialista na opravování + Solo especialista en reparación + + + Allow Wheel + Wymiana kół + Permite rodas + Разрешить замену колес + Možnost Výměny Kol + Permitir rueda + + + Who can remove and replace wheels? + Kto może zdejmować i zmieniać koła? + Quem pode remover e trocar rodas? + Кто может снимать и заменять колеса? + Kdo může odstranit a vyměnit kola? + ¿Quién puede quitar y cambiar las ruedas? + + + Allow Repair + Możliwość naprawy + Permite reparo + Разрешить ремонт + Možnost Opravování + Permitir reparación + + + Who can perform repair actions? + Kto może wykonywać czynności związane z naprawą pojazdów? + Quem pode executar ações de reparo? + Кто может выполнять ремонт? + Kdo může provádět opravy? + ¿Quién puede realizar reparaciones? + + + Repair Threshold + Próg naprawy + Limite de reparo + Лимит ремкомплекта + Umbral de reparación + + + What is the maximum damage that can be repaired with a toolkit? + Jaki jest maksymalny poziom uszkodzeń jaki może zostać naprawiony przy pomocy narzędzi? + Qual é o dano máximo que pode ser reparado com um kit de ferramentas? + Какой максимальный урон можно починить с помощью ремкомплекта? + ¿Cuál es el daño máximo que puede ser reparado con una caja de herramientas? + + + Repair Threshold (Engineer) + Próg naprawy (mechanik) + Limite de reparo (Engenheiro) + Лимит инженера + Umbral de Reparación (Ingeniero) + + + What is the maximum damage that can be repaired by an engineer? + Jaki jest maksymalny poziom uszkodzeń jaki może zostać naprawiony przez mechanika? + Qual é o dano máximo que pode ser reparado com um engenheiro? + Какой максимальный урон может починить инженер? + ¿Cuál es el daño máximo que puede ser reparado por un ingeniero? + + + Remove toolkit on use + Usuń narzędzia po użyciu + Remover kit de ferramentas + Удалять ремкомплект после использования + Eliminar conjunto de herramientas al usarlo + + + Should the toolkit be removed on usage? + Czy zestaw naprawczy powinien zostać usunięty po jego użyciu? + O kit de ferramentas deve ser removido após uso? + Следует ли удалять ремкомплект после использования? + ¿Deben retirarse las herramientas al usarlas? + + + Anywhere + Wszędzie + Qualquer lugar + Где угодно + Kdekoliv + En cualquier sitio + + + Repair Vehicle only + Przy pojazdach naprawczych + Somente veículos de reparo + Только у ремонтного транспорта + Reparar solo en vehículo + + + Repair Facility only + Przy budynkach naprawczych + Somente instalação de reparo + Только у ремонтных сооружений + Reparar solo en instalación + + + Repair Facility or Vehicle + Przy budynkach i pojazdach naprawczych + Instalação e veículo de reparo + Только у ремонтного транспорта или ремонтных сооружений + Reparar en instalación o vehículo + + + Assign Engineer + Przydziel inżyniera + Definir engenheiro + Назначить инженером + Přiřadit Inženýra + Asignar ingeniero + + + List + Lista + Lista + Список + Seznam + Lista + + + List of unit names that will be classified as engineer, separated by commas. + Lista nazw jednostek, które są sklasyfikowane jako inżynierowie, oddzielone przecinkami. + Lista de nomes de unidades que serão classificadas como engenheiros, separadas por vírgulas. + Список имен юнитов, которые будут классифицированы как инженеры, разделенный запятыми. + Lista de los nombres de las unidades que serán clasificados como ingeniero, separados por comas. + + + Is Engineer + Poziom wyszkolenia + É engenheiro + Это инженер + Es un ingeniero + + + Select the engineering skill level of the unit + Wybierz biegłość w dziedzinie naprawy danej jednostki + Selecione o nível de habilidade da unidade em engenhraria + Укажите уровень инженерного мастерства для юнита + Selecciona el nivel de conocimientos de ingeniería de la unidad + + + None + Żadny + Nenhum + Нет + Nikdo + Ningún + + + Engineer + Mechanik + Engenheiro + Инженер + Inženýr + Ingeniero + + + Specialist + Inżynier + Especialista + Специалист + Specialista + Especialista + + + Assign one or multiple units as an engineer + Przydziel klasę inżyniera do jednej lub kilku jednostek + Defina um ou mais unidades como engenheiro + Назначить одного или нескольких юнитов инженерами + Asignar una o varias unidades como ingeniero + + + Assign Repair Vehicle + Przydziel pojazd naprawczy + Defina veículo de reparo + Назначить ремонтный транспорт + Asignar vehículo de reparación + + + List + Lista + Lista + Список + Seznam + Lista + + + List of vehicles that will be classified as repair vehicle, separated by commas. + Lista nazw pojazdów, które są sklasyfikowane jako pojazdy naprawcze, oddzielone przecinkami. + Lista de veículos que serão classificadas como veículo de reparo. Separado por vígulas. + Список транспортных средств, которые будут классифицированы как ремонтные, разделенный запятыми. + Lista de los vehículos que se clasifican como vehículo de reparación, separados por comas. + + + Is Repair Vehicle + Jest poj. naprawczym + É veículo de reparo + Это ремонтный транспорт + Es un vehículo de reparación + + + Is the vehicle classified as a repair vehicle? + Czy pojazd jest zklasyfikowany jako pojazd naprawczy? + O veículo é classificado como reparo? + Классифицируется ли этот транспорт как ремонтный? + ¿Está el vehículo clasificado como un vehículo de reparación? + + + Assign one or multiple vehicles as a repair vehicle + Przydziel klasę pojazdu naprawczego do jednego lub kilku pojazdów. + Definir um ou mais veículos como reparo + Назначить одно или несколько транспортных средств ремонтными + Asignar uno o varios vehículos como vehículo de reparación + + + Assign Repair Facility + Przydziel budynek naprawczy + Definir instalação de reparo + Назначить ремонтное сооружение + Asignar instalación de reparación + + + List + Lista + Lista + Список + Seznam + Lista + + + List of objects that will be classified as repair Facility, separated by commas. + Lista nazw budynków, które są sklasyfikowane jako budynki naprawcze, oddzielone przecinkami. + Lista de objetos que serão classificados como instalações de reparo. separado por vírgulas. + Список объектов, которые будут классифицированы как ремонтные, разделенный запятыми. + Lista de los objetos que se clasifican como instalaciones para la reparación, separados por comas. + + + Is Repair Facility + Jest bud. naprawczym + É uma instalação de reparo + Это ремонтное сооружение + Es una instalación de reparación + + + Is the object classified as a repair Facility? + Czy budynek jest zklasyfikowany jako budynek naprawczy? + O objeto é classificado como instalação de reparo? + Классифицируется ли этот объект как ремонтное сооружение? + ¿Está el objeto clasificado como una instalación de reparación? + + + Assign one or multiple objects as a repair Facility + Przydziel klasę budynku naprawczego do jednego lub kilku budynków. + Назначить один или несколько объектов ремонтными сооружениями + Definir um ou mais objetos como instalação de reparos + Asignar uno o varios objetos como una instalación de reparación + + + Add Spare Parts + Dodaj części zam. + Adicionar partes sobressalentes + Añadir repuestos + Добавить запчасти + + + Add spare parts to one or multiple objects + Dodaj części zamienne do jednego lub wielu obiektów. + Adicionar partes sobressalentes para um ou mais objetos + Añadir repuestos a uno o varios objetos + Добавить запасные части в одно или несколько транспортных средств + + + List + Lista + Lista + Lista + Список + + + List of objects that will get spare parts added, separated by commas. + Lista obiektów, które otrzymają części zamienne, oddzielone przecinkiem. + Lista de objetos que ganharão partes sobressalentes, dividos por vírgulas. + Lista de los objetos que tendrán repuestos añadidos, separados por comas. + Список транспортных средств, в которые будут добавляться запчасти, разделенный запятыми. + + + Part + Część + Parte + Pieza + Запчасть + + + Spare part. + Część zamienna. + Parte sobressalente + Pieza de recambio. + Запасная часть. + + + Amount + Ilość + Quantidade + Cantidad + Количество + + + Number of selected spare parts. + Ilość wybranych części zamiennych. + Número de partes sobressalentes. + Número de piezas de repuesto seleccionados. + Число выбранных запасных частей. + + + Wheel repair requirements + Wym. naprawy kół + Requisitos de reparación de ruedas + Для ремонта колес требуется + + + Items required to remove/replace wheels + Przedmioty potrzebne do wymiany kół + Elementos necesarios para quitar/cambiar ruedas + Предметы, которые требуются для снятия/замены колес + + + diff --git a/addons/repair/ui/Icon_Module_Repair_ca.paa b/addons/repair/ui/Icon_Module_Repair_ca.paa new file mode 100644 index 0000000000..11b0f896d6 Binary files /dev/null and b/addons/repair/ui/Icon_Module_Repair_ca.paa differ diff --git a/addons/repair/ui/tire_ca.paa b/addons/repair/ui/tire_ca.paa new file mode 100644 index 0000000000..93ceb6bb6c Binary files /dev/null and b/addons/repair/ui/tire_ca.paa differ diff --git a/addons/respawn/ACE_Settings.hpp b/addons/respawn/ACE_Settings.hpp index 5c947b8670..f704d25412 100644 --- a/addons/respawn/ACE_Settings.hpp +++ b/addons/respawn/ACE_Settings.hpp @@ -1,3 +1,4 @@ + class ACE_Settings { class GVAR(SavePreDeathGear) { value = 0; diff --git a/addons/respawn/CfgAddons.hpp b/addons/respawn/CfgAddons.hpp index 111613615e..50ea187915 100644 --- a/addons/respawn/CfgAddons.hpp +++ b/addons/respawn/CfgAddons.hpp @@ -1,3 +1,4 @@ + class CfgAddons { class GVAR(Rallypoints) { list[] = {"ACE_Rallypoint_West", "ACE_Rallypoint_East", "ACE_Rallypoint_Independent", "ACE_Rallypoint_West_Base", "ACE_Rallypoint_East_Base", "ACE_Rallypoint_Independent_Base"}; diff --git a/addons/respawn/CfgVehicleClasses.hpp b/addons/respawn/CfgVehicleClasses.hpp index ab9c9b6c7e..817ee8150f 100644 --- a/addons/respawn/CfgVehicleClasses.hpp +++ b/addons/respawn/CfgVehicleClasses.hpp @@ -1,3 +1,4 @@ + class CfgVehicleClasses { class GVAR(Rallypoints) { displayName = CSTRING(EditorCategory); diff --git a/addons/respawn/CfgVehicles.hpp b/addons/respawn/CfgVehicles.hpp index aa99b4e942..8fdfb5f0fc 100644 --- a/addons/respawn/CfgVehicles.hpp +++ b/addons/respawn/CfgVehicles.hpp @@ -1,3 +1,4 @@ + class CfgVehicles { class ACE_Module; class ACE_ModuleRespawn: ACE_Module { @@ -6,7 +7,7 @@ class CfgVehicles { displayName = CSTRING(Module_DisplayName); function = QFUNC(module); scope = 2; - isGlobal = 1; + isGlobal = 0; icon = QUOTE(PATHTOF(UI\Icon_Module_Respawn_ca.paa)); class Arguments { @@ -24,6 +25,7 @@ class CfgVehicles { defaultValue = 1; }; }; + class ModuleDescription { description = CSTRING(Module_Description); }; diff --git a/addons/respawn/XEH_postInit.sqf b/addons/respawn/XEH_postInit.sqf index ada5765e86..22be7b86ac 100644 --- a/addons/respawn/XEH_postInit.sqf +++ b/addons/respawn/XEH_postInit.sqf @@ -2,4 +2,4 @@ #include "script_component.hpp" ["rallypointMoved", {_this call FUNC(updateRallypoint)}] call EFUNC(common,addEventhandler); -["playerChanged", {_this call FUNC(handlePlayerChanged)}] call EFUNC(common,addEventhandler); // hide enemy rallypoint markers +["playerChanged", {_this call FUNC(handlePlayerChanged)}] call EFUNC(common,addEventhandler); // hide enemy rallypoint markers diff --git a/addons/respawn/XEH_preInit.sqf b/addons/respawn/XEH_preInit.sqf index dd116f108c..eda5293876 100644 --- a/addons/respawn/XEH_preInit.sqf +++ b/addons/respawn/XEH_preInit.sqf @@ -13,7 +13,6 @@ PREP(moduleFriendlyFire); PREP(moduleRallypoint); PREP(moveRallypoint); PREP(removeBody); -PREP(removeDisconnectedPlayer); PREP(restoreGear); PREP(showFriendlyFireMessage); PREP(teleportToRallypoint); diff --git a/addons/respawn/functions/fnc_canMoveRallypoint.sqf b/addons/respawn/functions/fnc_canMoveRallypoint.sqf index d5f325c067..174d76c69d 100644 --- a/addons/respawn/functions/fnc_canMoveRallypoint.sqf +++ b/addons/respawn/functions/fnc_canMoveRallypoint.sqf @@ -1,33 +1,30 @@ /* - Name: ACE_Respawn_fnc_canMoveRallypoint - - Author(s): - commy2 - - Description: - checks if a unit can move a rally point - - Parameters: - 0: OBJECT - unit - 1: OBJECT - side - - Returns: - BOOLEAN -*/ - + * Author: commy2 + * Checks if a unit can move a rally point. + * + * Arguments: + * 0: Unit + * 1: Side + * + * Return Value: + * Can move + * + * Example: + * [ACE_Player, side ACE_Player] call ace_respawn_fnc_canMoveRallypoint + * + * Public: No + */ #include "script_component.hpp" -private ["_unit", "_side"]; +params ["_unit", "_side"]; -_unit = _this select 0; -_side = _this select 1; +// player has to be a rallypoint mover. group leader by default +if !(_unit getVariable ["ACE_canMoveRallypoint", false]) exitWith {false}; -// rallypoint names are defined in CfgVehicles.hpp - -_unit getVariable ["ACE_canMoveRallypoint", false] -&& {!isNull ([ +// rallypoint of that side has to exist +!isNull ([ objNull, missionNamespace getVariable ["ACE_Rallypoint_West", objNull], missionNamespace getVariable ["ACE_Rallypoint_East", objNull], missionNamespace getVariable ["ACE_Rallypoint_Independent", objNull] -] select ([west, east, independent] find _side) + 1)} +] select ([west, east, independent] find _side) + 1) // return diff --git a/addons/respawn/functions/fnc_handleInitPostServer.sqf b/addons/respawn/functions/fnc_handleInitPostServer.sqf index 914334cc25..a1e46c1caf 100644 --- a/addons/respawn/functions/fnc_handleInitPostServer.sqf +++ b/addons/respawn/functions/fnc_handleInitPostServer.sqf @@ -1,26 +1,39 @@ -// by commy2 -// execute on server only! +/* + * Author: commy2 + * Handle XEH Init Post on Server. + * Execution on server only. + * + * Arguments: + * 0: Unit + * + * Return Value: + * None + * + * Example: + * [ACE_Player] call ace_respawn_fnc_handleInitPostServer + * + * Public: No + */ #include "script_component.hpp" -PARAMS_1(_unit); +params ["_unit"]; -private ["_group0", "_rallypoint"]; +private ["_groupUnit", "_rallypoint", "_leaderVarName"]; -_group0 = group _unit; // _group-is a reserved veriable and shouldn't be used +_groupUnit = group _unit; // _group is a reserved veriable and shouldn't be used _rallypoint = [ objNull, missionNamespace getVariable ["ACE_Rallypoint_West", objNull], missionNamespace getVariable ["ACE_Rallypoint_East", objNull], missionNamespace getVariable ["ACE_Rallypoint_Independent", objNull] -] select ([west, east, independent] find side _group0) + 1; +] select ([west, east, independent] find side _groupUnit) + 1; // exit if no moveable rallypoint is placed for that side if (isNull _rallypoint) exitWith {}; // find leader -private "_leaderVarName"; -_leaderVarName = _group0 getVariable [QGVAR(leaderVarName), ""]; +_leaderVarName = _groupUnit getVariable [QGVAR(leaderVarName), ""]; // exit if group already has a playable slot assigned as rallypoint leader if (_leaderVarName != "") exitWith { @@ -31,7 +44,7 @@ if (_leaderVarName != "") exitWith { }; // treat group leader -_unit = leader _group0; +_unit = leader _groupUnit; _leaderVarName = vehicleVarName _unit; @@ -47,6 +60,6 @@ if (_leaderVarName == "") then { }; // prevent group from getting multiple leaders; use this to assign rallypoint moving ability on JIP -_group0 setVariable [QGVAR(leaderVarName), _leaderVarName]; +_groupUnit setVariable [QGVAR(leaderVarName), _leaderVarName]; _unit setVariable ["ACE_canMoveRallypoint", true, true]; diff --git a/addons/respawn/functions/fnc_handleKilled.sqf b/addons/respawn/functions/fnc_handleKilled.sqf index 1fea488421..cd1ad33491 100644 --- a/addons/respawn/functions/fnc_handleKilled.sqf +++ b/addons/respawn/functions/fnc_handleKilled.sqf @@ -1,30 +1,30 @@ /* - Name: ACE_Respawn_fnc_handleKilled - - Author(s): - bux578 - - Description: - Handles the XEH Killed event - - Parameters: - 0: OBJECT - Killed unit - 1: OBJECT - Attacker - - Returns: - VOID -*/ - + * Author: bux578 + * Handles the XEH killed event. + * + * Arguments: + * 0: Unit + * 1: Killer + * + * Return Value: + * None + * + * Example: + * [ACE_player, bad_dude] call ace_respawn_fnc_handleKilled + * + * Public: No + */ #include "script_component.hpp" -PARAMS_1(_killedUnit); +params ["_unit"]; // Saves the gear when the player! (and only him) is killed -if (ACE_player == _killedUnit) then { +if (ACE_player == _unit) then { GVAR(unitGear) = []; if (GVAR(SavePreDeathGear)) then { - GVAR(unitGear) = [_killedUnit] call EFUNC(common,getAllGear); + GVAR(unitGear) = [_unit] call EFUNC(common,getAllGear); + GVAR(unitGear) append [currentWeapon _unit, currentMuzzle _unit, currentWeaponMode _unit]; }; }; diff --git a/addons/respawn/functions/fnc_handlePlayerChanged.sqf b/addons/respawn/functions/fnc_handlePlayerChanged.sqf index db699066bc..7d595e6a44 100644 --- a/addons/respawn/functions/fnc_handlePlayerChanged.sqf +++ b/addons/respawn/functions/fnc_handlePlayerChanged.sqf @@ -1,44 +1,28 @@ -// by commy2 +/* + * Author: commy2 + * Handle player changed event. Updates visibility of Rallypoint markers. + * + * Arguments: + * 0: New Unit + * + * Return Value: + * None + * + * Example: + * [ACE_player] call ace_respawn_fnc_handlePlayerChanged + * + * Public: No + */ #include "script_component.hpp" -private "_newUnit"; +params ["_newUnit"]; -_newUnit = _this select 0; +private "_side"; +_side = side group _newUnit; -switch (side group _newUnit) do { - case (west): { - ((missionNamespace getVariable ["ACE_Rallypoint_West", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 1; - ((missionNamespace getVariable ["ACE_Rallypoint_East", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0; - ((missionNamespace getVariable ["ACE_Rallypoint_Independent", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0; - ((missionNamespace getVariable ["ACE_Rallypoint_West_Base", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 1; - ((missionNamespace getVariable ["ACE_Rallypoint_East_Base", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0; - ((missionNamespace getVariable ["ACE_Rallypoint_Independent_Base", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0; - }; - - case (east): { - ((missionNamespace getVariable ["ACE_Rallypoint_West", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0; - ((missionNamespace getVariable ["ACE_Rallypoint_East", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 1; - ((missionNamespace getVariable ["ACE_Rallypoint_Independent", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0; - ((missionNamespace getVariable ["ACE_Rallypoint_West_Base", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0; - ((missionNamespace getVariable ["ACE_Rallypoint_East_Base", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 1; - ((missionNamespace getVariable ["ACE_Rallypoint_Independent_Base", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0; - }; - - case (independent): { - ((missionNamespace getVariable ["ACE_Rallypoint_West", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0; - ((missionNamespace getVariable ["ACE_Rallypoint_East", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0; - ((missionNamespace getVariable ["ACE_Rallypoint_Independent", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 1; - ((missionNamespace getVariable ["ACE_Rallypoint_West_Base", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0; - ((missionNamespace getVariable ["ACE_Rallypoint_East_Base", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0; - ((missionNamespace getVariable ["ACE_Rallypoint_Independent_Base", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 1; - }; - - default { - ((missionNamespace getVariable ["ACE_Rallypoint_West", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0; - ((missionNamespace getVariable ["ACE_Rallypoint_East", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0; - ((missionNamespace getVariable ["ACE_Rallypoint_Independent", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0; - ((missionNamespace getVariable ["ACE_Rallypoint_West_Base", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0; - ((missionNamespace getVariable ["ACE_Rallypoint_East_Base", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0; - ((missionNamespace getVariable ["ACE_Rallypoint_Independent_Base", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0; - }; -}; +((GETMVAR(ACE_Rallypoint_West, objNull)) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal ([0, 1] select (_side == west)); +((GETMVAR(ACE_Rallypoint_West_Base, objNull)) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal ([0, 1] select (_side == west)); +((GETMVAR(ACE_Rallypoint_East, objNull)) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal ([0, 1] select (_side == east)); +((GETMVAR(ACE_Rallypoint_East_Base, objNull)) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal ([0, 1] select (_side == east)); +((GETMVAR(ACE_Rallypoint_Independent, objNull)) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal ([0, 1] select (_side == independent)); +((GETMVAR(ACE_Rallypoint_Independent_Base, objNull)) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal ([0, 1] select (_side == independent)); diff --git a/addons/respawn/functions/fnc_handleRespawn.sqf b/addons/respawn/functions/fnc_handleRespawn.sqf index 33a0ec09e5..ab5ecedbda 100644 --- a/addons/respawn/functions/fnc_handleRespawn.sqf +++ b/addons/respawn/functions/fnc_handleRespawn.sqf @@ -1,32 +1,29 @@ /* - Name: ACE_Respawn_fnc_handleRespawn - - Author(s): - bux578 - - Description: - Handles the XEH Respawn event - - Parameters: - 0: OBJECT - Respawned Unit - 1: ? - - Returns: - VOID -*/ - + * Author: bux578 + * Handles the XEH Respawn event. + * + * Arguments: + * 0: Unit + * 1: Corpse + * + * Return Value: + * None + * + * Example: + * [ACE_Player, old_body_lying_on_floor] call ace_respawn_fnc_handleRespawn + * + * Public: No + */ #include "script_component.hpp" -private ["_respawnedUnit"]; - -_respawnedUnit = _this select 0; +params ["_unit"]; // Restores the gear when the player respawns if (GVAR(SavePreDeathGear)) then { - [_respawnedUnit, GVAR(unitGear)] call FUNC(restoreGear); + [_unit, GVAR(unitGear)] call FUNC(restoreGear); }; // fix for setVariable public being lost on respawn for machines that JIP after the command was broadcasted -if (_respawnedUnit getVariable ["ACE_canMoveRallypoint", false]) then { - _respawnedUnit setVariable ["ACE_canMoveRallypoint", true, true]; +if (_unit getVariable ["ACE_canMoveRallypoint", false]) then { + _unit setVariable ["ACE_canMoveRallypoint", true, true]; }; diff --git a/addons/respawn/functions/fnc_initRallypoint.sqf b/addons/respawn/functions/fnc_initRallypoint.sqf index 2ef158a419..dba1ae5d0a 100644 --- a/addons/respawn/functions/fnc_initRallypoint.sqf +++ b/addons/respawn/functions/fnc_initRallypoint.sqf @@ -1,52 +1,51 @@ /* - Name: ACE_Respawn_fnc_initRallypoint - - Author(s): - commy2 - - Description: - init code for rally points - - Parameters: - 0: OBJECT - rally - - Returns: - VOID -*/ - + * Author: commy2 + * Init code for rallypoints. + * + * Arguments: + * 0: Rallypoint Object + * 1: Respawn Marker + * 2: Side + * + * Return Value: + * None + * + * Example: + * [respawn_object, "", west] call ace_respawn_fnc_initRallypoint + * + * Public: No + */ #include "script_component.hpp" -PARAMS_3(_rallypoint,_respawnMarker,_side); +params ["_rallypoint", "_respawnMarker", "_side"]; private "_name"; _name = typeOf _rallypoint; // init visible marker if (hasInterface) then { - // fix init having wrong position, vars etc. - [_rallypoint, _respawnMarker, _side, _name] spawn { - PARAMS_4(_rallypoint,_respawnMarker,_side,_name); - - private ["_marker", "_type"]; - + [{ + params ["_rallypoint", "_respawnMarker", "_side", "_name"]; + + private ["_marker", "_type", "_date"]; + _marker = format ["ACE_Marker_%1", _name]; - // exit if it already exist + // exit if marker already exist if (_marker in allMapMarkers) exitWith {}; _marker = createMarkerLocal [_marker, getPosASL _rallypoint]; _type = ["selector_selectedFriendly", "selector_selectedEnemy"] select (_respawnMarker == ""); _marker setMarkerTypeLocal _type; - _marker setMarkerAlphaLocal ([0,1] select (_side == playerSide)); // playerSide to guarantee init + _marker setMarkerAlphaLocal ([0,1] select (_side == playerSide)); // playerSide to guarantee init - private "_markerDate"; - _markerDate = _rallypoint getVariable [QGVAR(markerDate), ""]; + _date = _rallypoint getVariable [QGVAR(markerDate), ""]; - _marker setMarkerTextLocal _markerDate; + _marker setMarkerTextLocal _date; _rallypoint setVariable [QGVAR(marker), _marker]; - }; + }, [_rallypoint, _respawnMarker, _side, _name], 0.1] call EFUNC(common,waitAndExecute); }; if (!isServer) exitWith {}; @@ -62,8 +61,7 @@ if (isNil _name) then { }; ["rallypointMoved", [_rallypoint, _side]] call EFUNC(common,globalEvent); - } else { deleteVehicle _rallypoint; - diag_log text "[ACE] Respawn: ERROR Multiple Rallypoints of same type."; + ACE_LOGERROR("Multiple Rallypoints of same type."); }; diff --git a/addons/respawn/functions/fnc_module.sqf b/addons/respawn/functions/fnc_module.sqf index 3f1ef89a1f..ea6ba555d5 100644 --- a/addons/respawn/functions/fnc_module.sqf +++ b/addons/respawn/functions/fnc_module.sqf @@ -1,26 +1,23 @@ - /* - Name: ACE_Respawn_fnc_module - - Author(s): - KoffeinFlummi, bux578, esteldunedain, commy2 - - Description: - initializes the respawn module - - Parameters: - 0: OBJECT - logic - 1: ARRAY - synced units - 2: BOOLEAN - activated - - Returns: - VOID -*/ - +/* + * Author: KoffeinFlummi, bux578, esteldunedain, commy2 + * Initializes the respawn module. + * + * Arguments: + * 0: Logic + * 1: Synced units + * 2: Activated + * + * Return Value: + * None + * + * Example: + * [logic, [ACE_Player], true] call ace_respawn_fnc_module + * + * Public: No + */ #include "script_component.hpp" -PARAMS_3(_logic,_units,_activated); - -if !(isServer) exitWith {}; +params ["_logic", "_units", "_activated"]; if !(_activated) exitWith {}; @@ -29,20 +26,18 @@ GVAR(Module) = true; [_logic, QGVAR(SavePreDeathGear), "SavePreDeathGear"] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(RemoveDeadBodiesDisconnected), "RemoveDeadBodiesDisconnected"] call EFUNC(common,readSettingFromModule); -if (isServer) then { - if (GVAR(RemoveDeadBodiesDisconnected)) then { - addMissionEventHandler ["HandleDisconnect", { - [{ - PARAMS_1(_unit); +if (isServer && {GVAR(RemoveDeadBodiesDisconnected)}) then { + addMissionEventHandler ["HandleDisconnect", { + [{ + params ["_unit"]; - if (!alive _unit) then { - deleteVehicle _unit; - }; - }, - _this, 4, 1] call EFUNC(common,waitAndExecute); - false - }]; - }; + if (!alive _unit) then { + deleteVehicle _unit; + }; + }, + _this, 4] call EFUNC(common,waitAndExecute); + false + }]; }; -diag_log text "[ACE]: Respawn Module Initialized."; +ACE_LOGINFO("Respawn Module Initialized."); diff --git a/addons/respawn/functions/fnc_moduleFriendlyFire.sqf b/addons/respawn/functions/fnc_moduleFriendlyFire.sqf index 7641db806d..f5b982f0ea 100644 --- a/addons/respawn/functions/fnc_moduleFriendlyFire.sqf +++ b/addons/respawn/functions/fnc_moduleFriendlyFire.sqf @@ -1,32 +1,33 @@ /* - Name: ACE_Respawn_fnc_moduleFriendlyFire - - Author(s): - commy2 - - Description: - initializes the Friendly Fire Messages module - - Parameters: - 0: OBJECT - logic - 1: ARRAY - synced units - 2: BOOLEAN - activated - - Returns: - VOID -*/ - + * Author: commy2 + * Initializes the friendly fire module. + * + * Arguments: + * 0: Logic + * 1: Synced units + * 2: Activated + * + * Return Value: + * None + * + * Example: + * [logic, [ACE_Player], true] call ace_respawn_fnc_moduleFriendlyFire + * + * Public: No + */ #include "script_component.hpp" -_this spawn { - PARAMS_3(_logic,_units,_activated); +params ["_logic", "_units", "_activated"]; - if !(_activated) exitWith {}; +if !(_activated) exitWith {}; - if (isServer) then { +// this is done for JIP compatibility +if (isServer) then { + [{ missionNamespace setVariable [QGVAR(showFriendlyFireMessage), true]; publicVariable QGVAR(showFriendlyFireMessage); - }; - - diag_log text "[ACE]: Friendly Fire Messages Module Initialized."; + }, + [], 0.1] call EFUNC(common,waitAndExecute); }; + +ACE_LOGINFO("Friendly Fire Messages Module Initialized."); diff --git a/addons/respawn/functions/fnc_moduleRallypoint.sqf b/addons/respawn/functions/fnc_moduleRallypoint.sqf index 15c415027d..89baed660f 100644 --- a/addons/respawn/functions/fnc_moduleRallypoint.sqf +++ b/addons/respawn/functions/fnc_moduleRallypoint.sqf @@ -1,29 +1,29 @@ /* - Name: ACE_Respawn_fnc_moduleRallypoint - - Author(s): - commy2 - - Description: - initializes the Rallypoint module - - Parameters: - 0: OBJECT - logic - 1: ARRAY - synced units - 2: BOOLEAN - activated - - Returns: - VOID -*/ - + * Author: commy2 + * Initializes the Rallypoint module. + * + * Arguments: + * 0: Logic + * 1: Synced units + * 2: Activated + * + * Return Value: + * None + * + * Example: + * [logic, [ACE_Player], true] call ace_respawn_fnc_moduleRallypoint + * + * Public: No + */ #include "script_component.hpp" -PARAMS_3(_logic,_units,_activated); +params ["_logic", "_units", "_activated"]; if !(_activated) exitWith {}; { _x setVariable ["ACE_canMoveRallypoint", true]; -} forEach _units; + false +} count _units; -diag_log text "[ACE]: Rallypoint Module Initialized."; +ACE_LOGINFO("Rallypoint Module Initialized."); diff --git a/addons/respawn/functions/fnc_moveRallypoint.sqf b/addons/respawn/functions/fnc_moveRallypoint.sqf index d512c23886..fa8aae40a5 100644 --- a/addons/respawn/functions/fnc_moveRallypoint.sqf +++ b/addons/respawn/functions/fnc_moveRallypoint.sqf @@ -1,60 +1,54 @@ /* - Name: ACE_Respawn_fnc_moveRallypoint - - Author(s): - commy2 - - Description: - Moves a rallypoint to the player's location - - Parameters: - 0: OBJECT - unit - 1: OBJECT - side - - Returns: - VOID -*/ - + * Author: commy2 + * Moves a rallypoint to the players location. + * + * Arguments: + * 0: Unit + * 1: Side + * + * Return Value: + * None + * + * Example: + * [ACE_Player, side ACE_Player] call ace_respawn_fnc_moveRallypoint + * + * Public: No + */ #include "script_component.hpp" -PARAMS_2(_unit,_side); +params ["_unit", "_side"]; private ["_rallypoint", "_position"]; -// rallypoint names are defined in CfgVehicles.hpp - _rallypoint = [ - objNull, - missionNamespace getVariable ["ACE_Rallypoint_West", objNull], - missionNamespace getVariable ["ACE_Rallypoint_East", objNull], - missionNamespace getVariable ["ACE_Rallypoint_Independent", objNull] + objNull, + missionNamespace getVariable ["ACE_Rallypoint_West", objNull], + missionNamespace getVariable ["ACE_Rallypoint_East", objNull], + missionNamespace getVariable ["ACE_Rallypoint_Independent", objNull] ] select ([west, east, independent] find _side) + 1; -TRACE_3("moving rally",_unit, _rallypoint, (typeOf _rallypoint)); +TRACE_3("moving rally",_unit,_rallypoint,typeOf _rallypoint); if (isNull _rallypoint) exitWith {}; _position = getPosATL _unit; _position = _position findEmptyPosition [0, 2, typeOf _rallypoint]; -if (count _position == 0) then {_position = getPosATL _unit}; + +if (_position isEqualTo []) then {_position = getPosATL _unit}; _position set [2, 0]; [localize LSTRING(Deploy)] call EFUNC(common,displayTextStructured); [{ - _rallypoint = _this select 0; - _unit = _this select 1; - _position = _this select 2; - _rallypoint = _this select 3; + params ["_rallypoint", "_unit", "_position"]; _rallypoint setPosATL _position; _unit reveal _rallypoint; - _rallypoint setVariable [QGVAR(markerDate), format ["%1:%2", date select 3, date select 4], true]; + _rallypoint setVariable [QGVAR(markerDate), [dayTime, "HH:MM"] call BIS_fnc_timeToString, true]; ["rallypointMoved", [_rallypoint, _side, _position]] call EFUNC(common,globalEvent); [localize LSTRING(Deployed)] call EFUNC(common,displayTextStructured); -}, -[_rallypoint, _unit, _position, _rallypoint], 5, 1] call EFUNC(common,waitAndExecute); +}, [_rallypoint, _unit, _position], 5] call EFUNC(common,waitAndExecute); diff --git a/addons/respawn/functions/fnc_removeBody.sqf b/addons/respawn/functions/fnc_removeBody.sqf index e00f633e6c..e9676696a1 100644 --- a/addons/respawn/functions/fnc_removeBody.sqf +++ b/addons/respawn/functions/fnc_removeBody.sqf @@ -1,36 +1,27 @@ /* - Name: ACE_Respawn_fnc_removeBody - - Author(s): - bux578 - - Description: - removes a given body - - Parameters: - 0: OBJECT - body - 1: BOOLEAN - forceRemove // not used atm - - Returns: - VOID -*/ - + * Author: bux578, commy2 + * Removes a given body. + * + * Arguments: + * 0: Body + * + * Return Value: + * None + * + * Example: + * [corpse] call ace_respawn_fnc_removeBody + * + * Public: No + */ #include "script_component.hpp" -private ["_body", "_forceRemove", "_bodyRemoveTimer"]; +params ["_body", "_forceRemove"]; -_body = _this select 0; -_forceRemove = _this select 1; - -_bodyRemoveTimer = GVAR(BodyRemoveTimer) max 0; - -// could be used for SpecOps missions. -if (_forceRemove) then { - _bodyRemoveTimer = 2; -}; +private "_bodyRemoveTimer"; +_bodyRemoveTimer = [GVAR(BodyRemoveTimer) max 0, 2] select _forceRemove; // could be used for SpecOps missions. [{ // hideBody takes ~20s till body is fully underground // a better hideBody would make this more aesthetic deleteVehicle _this; -}, _body, _bodyRemoveTimer, 1] call EFUNC(common,waitAndExecute); +}, _body, _bodyRemoveTimer] call EFUNC(common,waitAndExecute); diff --git a/addons/respawn/functions/fnc_removeDisconnectedPlayer.sqf b/addons/respawn/functions/fnc_removeDisconnectedPlayer.sqf deleted file mode 100644 index 7bd0a6707f..0000000000 --- a/addons/respawn/functions/fnc_removeDisconnectedPlayer.sqf +++ /dev/null @@ -1,31 +0,0 @@ -/* - Name: ACE_Respawn_fnc_removeDisconnectedPlayer - - Author(s): - commy2 - - Description: - handles the disconnected event - - Parameters: - 0: BOOLEAN - forceRemove // not used atm - - Returns: - VOID -*/ - -#include "script_component.hpp" - -private ["_forceRemove", "_body", "_uid"]; - -_forceRemove = _this select 0; - -{ - if (getPlayerUID _x == _uid) exitWith { - _body = _x; - }; -} forEach playableUnits; - -if (!isNil "_body" && {!alive _body}) then { - [_body, _forceRemove] call FUNC(removeBody); -}; diff --git a/addons/respawn/functions/fnc_restoreGear.sqf b/addons/respawn/functions/fnc_restoreGear.sqf index 285c560a6c..d01e45dd50 100644 --- a/addons/respawn/functions/fnc_restoreGear.sqf +++ b/addons/respawn/functions/fnc_restoreGear.sqf @@ -1,164 +1,48 @@ /* - Name: ACE_Respawn_fnc_removeBody - - Author(s): - bux578 - - Description: - Restores previously saved gear - - Parameters: - 0: OBJECT - unit - 1: ARRAY - Array containing all gear - - Returns: - VOID -*/ - + * Author: bux578, commy2 + * Restores previously saved gear. + * + * Arguments: + * 0: Unit + * 1: All Gear based on return value of ACE_common_fnc_getAllGear + * + * Return Value: + * None + * + * Example: + * [ACE_Player, stored_allGear, active_weapon_muzzle_and_mode] call ace_respawn_fnc_restoreGear + * + * Public: No + */ #include "script_component.hpp" -PARAMS_2(_unit,_allGear); +params ["_unit", "_allGear", "_activeWeaponAndMuzzle"]; -private ["_unit", "_allGear", "_headgear", "_goggles", "_uniform", "_uniformitems", "_vest", "_vestitems", "_backpack", "_backpackitems", "_primaryweapon", "_primaryweaponitems", "_primaryweaponmagazine", "_handgunweapon", "_handgunweaponitems", "_handgunweaponmagazine", "_assigneditems", "_binocular", "_backpa", "_secondaryweapon", "_secondaryweaponitems", "_secondaryweaponmagazine"]; +// restore all gear +[_unit, _allGear, true, true] call EFUNC(common,setAllGear); +// restore the last active weapon, muzzle and weaponMode +_activeWeaponAndMuzzle params ["_activeWeapon", "_activeMuzzle", "_activeWeaponMode"]; -// remove all starting gear of a player -removeAllWeapons _unit; -removeGoggles _unit; -removeHeadgear _unit; -removeVest _unit; -removeUniform _unit; -removeAllAssignedItems _unit; -clearAllItemsFromBackpack _unit; -removeBackpack _unit; - -_headgear = _allGear select 0; -_goggles = _allGear select 1; -_uniform = _allGear select 2; -_uniformitems = _allGear select 3; -_vest = _allGear select 4; -_vestitems = _allGear select 5; -_backpack = _allGear select 6; -_backpackitems = _allGear select 7; -_primaryweapon = _allGear select 8; -_primaryweaponitems = _allGear select 9; -_primaryweaponmagazine = _allGear select 10; -_secondaryweapon = _allGear select 11; -_secondaryweaponitems = _allGear select 12; -_secondaryweaponmagazine = _allGear select 13; -_handgunweapon = _allGear select 14; -_handgunweaponitems = _allGear select 15; -_handgunweaponmagazine = _allGear select 16; -_assigneditems = _allGear select 17; -_binocular = _allGear select 18; - - -// start restoring the items -if (_headgear != "") then { - _unit addHeadgear _headgear; -}; -if (_uniform != "") then { - _unit forceAddUniform _uniform; -}; -if (_vest != "") then { - _unit addVest _vest; -}; -if (_goggles != "") then { - _unit addGoggles _goggles; -}; - -{ - _unit addItemToUniform _x; -}forEach _uniformitems; - -{ - _unit addItemToVest _x; -}forEach _vestitems; - -private "_flagRemoveDummyBag"; -_flagRemoveDummyBag = false; - -if(format["%1", _backpack] != "") then { - _unit addBackpack _backpack; - - _backpa = unitBackpack _unit; - clearMagazineCargoGlobal _backpa; - clearWeaponCargoGlobal _backpa; - clearItemCargoGlobal _backpa; - { - _unit addItemToBackpack _x; - } forEach _backpackitems; - +if ( + (_activeMuzzle != "") && + {_activeMuzzle != _activeWeapon} && + {_activeMuzzle in getArray (configfile >> "CfgWeapons" >> _activeWeapon >> "muzzles")} +) then { + _unit selectWeapon _activeMuzzle; } else { - // dummy backpack to ensure mags being loaded - _unit addBackpack "B_Kitbag_Base"; - - _flagRemoveDummyBag = true; + if (_activeWeapon != "") then { + _unit selectWeapon _activeWeapon; + }; }; +if (currentWeapon _unit != "") then { + local _index = 0; -// primaryWeapon -if ((_primaryweapon != "") && {_primaryweapon != "ACE_FakePrimaryWeapon"}) then { - { - _unit addMagazine _x; - } forEach _primaryweaponmagazine; - - _unit addWeapon _primaryweapon; - - { - if (_x != "") then { - _unit addPrimaryWeaponItem _x; - }; - } forEach _primaryweaponitems; -}; - - -// secondaryWeapon -if (_secondaryweapon != "") then { - { - _unit addMagazine _x; - } forEach _secondaryweaponmagazine; - - _unit addWeapon _secondaryweapon; - - { - if (_x != "") then { - _unit addSecondaryWeaponItem _x; - }; - } forEach _secondaryweaponitems; -}; - - -// handgun -if (_handgunweapon != "") then { - { - _unit addMagazine _x; - } forEach _handgunweaponmagazine; - - _unit addWeapon _handgunweapon; - - { - if (_x != "") then { - _unit addHandgunItem _x; - }; - } forEach _handgunweaponitems; -}; - - -// remove dummy bagpack -if (_flagRemoveDummyBag) then { - removeBackpack _unit; -}; - - -_assignedItems = _assignedItems - [_binocular]; - -// items -{_unit linkItem _x} forEach _assignedItems; - -_unit addWeapon _binocular; - -if ("Laserdesignator" in assignedItems _unit) then { - _unit selectWeapon "Laserdesignator"; - if (currentMagazine _unit == "") then {_unit addMagazine "Laserbatteries";}; + while { + _index < 100 && {currentWeaponMode _unit != _activeWeaponMode} + } do { + _unit action ["SwitchWeapon", _unit, _unit, _index]; + _index = _index + 1; + }; }; diff --git a/addons/respawn/functions/fnc_showFriendlyFireMessage.sqf b/addons/respawn/functions/fnc_showFriendlyFireMessage.sqf index 1fdd10da4e..1c5a7b7cc2 100644 --- a/addons/respawn/functions/fnc_showFriendlyFireMessage.sqf +++ b/addons/respawn/functions/fnc_showFriendlyFireMessage.sqf @@ -1,28 +1,24 @@ /* - Name: ACE_Respawn_fnc_showFriendlyFireMessages - - Author(s): - commy2 - - Description: - shows a message in system chat of who killed who - - Parameters: - 0: OBJECT - unit - 1: OBJECT - killer - - Returns: - VOID -*/ - + * Author: commy2 + * Shows a message in system chat of who killed whom. + * + * Arguments: + * 0: Unitn + * 1: Killer + * + * Return Value: + * None + * + * Example: + * [ACE_Player, killer] call ace_module_fnc_functionName + * + * Public: No + */ #include "script_component.hpp" -private ["_unit", "_killer"]; +params ["_unit", "_killer"]; -_unit = _this select 0; -_killer = _this select 1; - -if (_unit != _killer && side group _unit in [side group ACE_player, civilian] && {side group _killer == side group ACE_player}) then { +if (_unit != _killer && {side group _unit in [side group ACE_player, civilian]} && {side group _killer == side group ACE_player}) then { systemChat format ["%1 was killed by %2", [_unit] call EFUNC(common,getName), [_killer] call EFUNC(common,getName)]; // Raise ACE globalEvent diff --git a/addons/respawn/functions/fnc_teleportToRallypoint.sqf b/addons/respawn/functions/fnc_teleportToRallypoint.sqf index 59a9766114..88bd0d6d52 100644 --- a/addons/respawn/functions/fnc_teleportToRallypoint.sqf +++ b/addons/respawn/functions/fnc_teleportToRallypoint.sqf @@ -1,29 +1,25 @@ /* * Author: commy2 - * teleports a unit to a rallypoint + * Teleports a unit to a rallypoint * * Arguments: - * 0: unit - * 1: side? - * 2: teleport to base + * 0: Unit + * 1: Side + * 2: Rallypoint name * * Return Value: - * Nothing + * None * * Example: - * [,,] call ACE_Respawn_fnc_teleportToRallypoint; + * [ACE_player, side ACE_Player, rallypoint_name] call ace_respawn_fnc_teleportToRallypoint; * * Public: No */ #include "script_component.hpp" -PARAMS_3(_unit,_side,_rallypoint); +params ["_unit", "_side", "_rallypoint"]; -private ["_toBase"]; - -// rallypoint names are defined in CfgVehicles.hpp - -//IGNORE_PRIVATE_WARNING("_Base") +private "_toBase"; _toBase = _rallypoint find "_Base" != -1; _rallypoint = missionNamespace getVariable [_rallypoint, objNull], @@ -31,4 +27,5 @@ _rallypoint = missionNamespace getVariable [_rallypoint, objNull], if (isNull _rallypoint) exitWith {}; _unit setPosASL getPosASL _rallypoint; + [[localize LSTRING(TeleportedToRallypoint), localize LSTRING(TeleportedToBase)] select _toBase] call EFUNC(common,displayTextStructured); diff --git a/addons/respawn/functions/fnc_updateRallypoint.sqf b/addons/respawn/functions/fnc_updateRallypoint.sqf index 248955155a..8b34f87019 100644 --- a/addons/respawn/functions/fnc_updateRallypoint.sqf +++ b/addons/respawn/functions/fnc_updateRallypoint.sqf @@ -1,11 +1,23 @@ -// by commy2 +/* + * Author: commy2 + * Updates marker position and texts. + * + * Arguments: + * 0: Marker + * 1: Side + * 2: Position + * + * Return Value: + * None + * + * Example: + * [marker_name, side ACE_Player, getPos ACE_Player] call ace_respawn_fnc_updateRallypoint + * + * Public: No + */ #include "script_component.hpp" -private ["_rallypoint", "_side", "_position"]; - -_rallypoint = _this select 0; -_side = _this select 1; -_position = _this select 2; +params ["_rallypoint", "_side", "_position"]; if (!hasInterface) exitWith {}; diff --git a/addons/respawn/stringtable.xml b/addons/respawn/stringtable.xml index 4b649173f0..e44150ff10 100644 --- a/addons/respawn/stringtable.xml +++ b/addons/respawn/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -152,6 +152,9 @@ Respawn-System Systém znovuzrození Sistema de Renascimento + Système de Respawn + Respawn-rendszer + Возрождение Save Gear? @@ -160,6 +163,9 @@ Ausrüstung speichern? Uložit výbavu? Salvar equipamento? + Sauver l'équipement? + Felszerelés elmentése? + Сохранять снаряжение? Respawn with the gear a soldier had just before his death? @@ -168,6 +174,9 @@ Mit der Ausrüstung, die ein Soldat vor seinem Tod hatte, respawnen? Znovuubjevit s výbavou kterou měl voják před smrtí? Renascer com o equipamento que um soldado tinha antes de sua morte? + Conserve l'équipement au Respawn + Az egység halála előtti felszerelésével való respawnolása? + Возрождать солдата с тем же снаряжением, которое было на нем при смерти? Remove bodies? @@ -176,6 +185,9 @@ Körper entfernen? Odstranit těla? Remover corpos? + Enlever les coprs? + Holttestek eltávolítása? + Удалять трупы? Remove player bodies after disconnect? @@ -184,13 +196,18 @@ Entferne Spielerkörper nach dem Trennen einer Verbindung? Odstranit hráčova těla po odpojení? Remover corpos dos jogadores depois de desconectar? + Enlève les corps de joueurs après déconnection + Játékosi testek eltávolítása távozás után? + Удалять трупы игроков после дисконнекта? - + This module enables you to configure ACE functionality specific to respawns. Moduł ten pozwala dostosować ustawienia odrodzenia (respawnu). Dieses Modul erlaubt es die Respawn-Einstellungen anzupassen. Tento modul umožňuje nastavení znovuzrození (spawn). Este módulo permite que você personalize as configurações do renascimento (Spawn). + Этот модуль позволяет настроить систему возрождения. + Ce module permet de régler les options de Respawn Friendly Fire Messages @@ -199,12 +216,17 @@ Freundbeschuss-Nachrichten Upozornění na přátelskou střelbu Mensagens de fogo amigo + Message de tirs fraticides + Baráti tűz üzenetek + Сообщения об огне по своим - + Using this module in your mission will make it so any friendly fire kills will be displayed in form of a message in chat. Użycie tego modułu na misji spowoduje wyświetlenie wiadomości na czacie w przypadku, kiedy zostanie popełniony friendly fire - wyświetlona zostanie wtedy wiadomość kto kogo zabił. Zobrazí zprávu v chatu v případě, když budete střílet na vlastní jednotky. Ve zprávě se zobrazí kdo na koho střílel, popř. kdo koho zabil. Usando este módulo em uma missão para exibir mensagens chat, no caso de quando você faz um fogo amigo - então a mensagem será exibida mostrando quem matou quem. + Отображает сообщение в чате, в случае, когда убивают союзных игроков. В докладе указывается, кто стрелял, в кого. Кто кого убил. + Ce module permet l'affiche de message dans le chat lors d'un tir fraticide et indique qui a tué qui. Rallypoint System @@ -213,12 +235,16 @@ Rallypoint-System Systém shromáždění Sistema de ponto de encontro + Système de point de ralliement + Gyülekezőpont-rendszer + Система точек сбора - + This module allows you to use rally points in missions, to which you can quickly teleport from base flag. Requires placing special objects on map - base and flag. Both available in category Empty -> ACE Respawn. Moduł ten pozwala zastosować na misji "punkt zbiórki", do którego można szybko przeteleportować się z "bazy". Wymaga postawienia odpowiednich obiektów na mapie - bazy oraz flagi. Obydwa dostępne są w kategorii Puste -> ACE Odrodzenie. Tento modul umožňuje určit místo shromaždiště, kam se mohou jednokty rychle teleportovat ze "základny". Toto vyžaduje vhodné objekty v mapě - základna a vlajka. Oba dva můžete najít v kategorii Prázdné -> ACE Oživení. Este módulo permite que você aplique em uma missão "pontos de encontro", que pode rapidamente se teletransportar para a "base". Ele requer colocar objetos apropriados no mapa - base e bandeiras. Ambos estão disponíveis na categoria em branco -> ACE Revival. + Этот модуль позволяет вам указать место сбора, куда вы можете быстро телепортироваться с "базы". Требуется наличие соответствующих объектов на карте - базы и флага. Они могут быть найдены в категории Пусто -> ACE Возрождения. Move Rallypoint @@ -227,6 +253,9 @@ Bewege Rallypoint Přesun na shromaždiště Mover para ponto de encontro + Bouger le point de ralliement + Gyülekezőpont mozgatása + Двигать точку сбора ACE Respawn @@ -235,6 +264,9 @@ ACE-Respawn ACE Znovuzrození ACE Respawn + ACE Respawn + ACE Respawn + ACE Возрождение - \ No newline at end of file + diff --git a/addons/safemode/CfgEventHandlers.hpp b/addons/safemode/CfgEventHandlers.hpp index eefe61652b..0cd959a047 100644 --- a/addons/safemode/CfgEventHandlers.hpp +++ b/addons/safemode/CfgEventHandlers.hpp @@ -1,12 +1,12 @@ class Extended_PreInit_EventHandlers { class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_preInit) ); + init = QUOTE(call COMPILE_FILE(XEH_preInit)); }; }; class Extended_PostInit_EventHandlers { class ADDON { - clientInit = QUOTE( call COMPILE_FILE(XEH_postInit) ); + init = QUOTE(call COMPILE_FILE(XEH_postInit)); }; }; diff --git a/addons/safemode/XEH_postInit.sqf b/addons/safemode/XEH_postInit.sqf index c7132dd76c..f3ab06d20e 100644 --- a/addons/safemode/XEH_postInit.sqf +++ b/addons/safemode/XEH_postInit.sqf @@ -7,8 +7,7 @@ if (!hasInterface) exitWith {}; //["Soldier", {_player = ACE_player; if (currentWeapon _player in (_player getVariable [QGVAR(safedWeapons), []])) then {[false] call FUNC(setSafeModeVisual)}] call EFUNC(common,addInfoDisplayEventHandler); //@todo addEventHandler infoDisplayChanged with select 1 == "Soldier" - -// Add keybinds +// add keybinds ["ACE3 Weapons", QGVAR(safeMode), localize LSTRING(SafeMode), { // Conditions: canInteract @@ -21,4 +20,4 @@ if (!hasInterface) exitWith {}; true }, {false}, -[41, [false, true, false]], false] call cba_fnc_addKeybind; +[41, [false, true, false]], false] call CBA_fnc_addKeybind; diff --git a/addons/safemode/XEH_preInit.sqf b/addons/safemode/XEH_preInit.sqf index 6bedb35134..e6eb91b8bd 100644 --- a/addons/safemode/XEH_preInit.sqf +++ b/addons/safemode/XEH_preInit.sqf @@ -2,7 +2,6 @@ ADDON = false; -PREP(firstMode); PREP(lockSafety); PREP(playChangeFiremodeSound); PREP(setSafeModeVisual); diff --git a/addons/safemode/functions/fnc_firstMode.sqf b/addons/safemode/functions/fnc_firstMode.sqf deleted file mode 100644 index d10da3f896..0000000000 --- a/addons/safemode/functions/fnc_firstMode.sqf +++ /dev/null @@ -1,9 +0,0 @@ -// by commy2 -#include "script_component.hpp" - -PARAMS_1(_weapon); - -private ["_mode"]; -_mode = getArray (configFile >> "CfgWeapons" >> _weapon >> "modes") select 0; - -[_mode, _weapon] select (_mode == "this") diff --git a/addons/safemode/functions/fnc_lockSafety.sqf b/addons/safemode/functions/fnc_lockSafety.sqf index 42a8ef89fb..9fe429a49b 100644 --- a/addons/safemode/functions/fnc_lockSafety.sqf +++ b/addons/safemode/functions/fnc_lockSafety.sqf @@ -1,12 +1,29 @@ -// by commy2 +/* + * Author: commy2 + * Put weapon on safety, or take it off safety if safety is already put on. + * + * Arguments: + * 0: Unit + * 1: Weapon + * 2: Muzzle + * + * Return Value: + * None + * + * Example: + * [ACE_player, currentWeapon ACE_player, currentMuzzle ACE_player] call ace_safemode_fnc_lockSafety + * + * Public: No + */ #include "script_component.hpp" -PARAMS_3(_unit,_weapon,_muzzle); - // don't immediately switch back if (inputAction "nextWeapon" > 0) exitWith {}; -private ["_safedWeapons"]; +params ["_unit", "_weapon", "_muzzle"]; + +private ["_safedWeapons", "_picture"]; + _safedWeapons = _unit getVariable [QGVAR(safedWeapons), []]; if (_weapon in _safedWeapons) exitWith { @@ -18,48 +35,39 @@ _safedWeapons pushBack _weapon; _unit setVariable [QGVAR(safedWeapons), _safedWeapons]; if (_unit getVariable [QGVAR(actionID), -1] == -1) then { - private ["_condition", "_statement", "_id"]; - - _condition = { - if ( - [_this select 1] call EFUNC(common,canUseWeapon) - && { - if (currentMuzzle (_this select 1) in ((_this select 1) getVariable [QGVAR(safedWeapons), []])) then { - if (inputAction "nextWeapon" > 0) exitWith { - [_this select 1, currentWeapon (_this select 1), currentMuzzle (_this select 1)] call FUNC(unlockSafety); - false - }; - true - } else {false} - } - ) then { - // player hud - [false] call FUNC(setSafeModeVisual); - true - } else { - // player hud - [true] call FUNC(setSafeModeVisual); - false - } - }; - - _statement = { - [_this select 1, currentWeapon (_this select 1), currentMuzzle (_this select 1)] call FUNC(unlockSafety); - }; - - //_id = [_unit, format ["%1", localize LSTRING(TakeOffSafety)], "DefaultAction", _condition, {}, {true}, _statement, 10] call EFUNC(common,addActionMenuEventHandler); - _id = [_unit, "DefaultAction", _condition, {}] call EFUNC(common,addActionEventHandler); - - _unit setVariable [QGVAR(actionID), _id]; + _unit setVariable [QGVAR(actionID), [ + _unit, "DefaultAction", { + if ( + [_this select 1] call EFUNC(common,canUseWeapon) + && { + if (currentMuzzle (_this select 1) in ((_this select 1) getVariable [QGVAR(safedWeapons), []])) then { + if (inputAction "nextWeapon" > 0) exitWith { + [_this select 1, currentWeapon (_this select 1), currentMuzzle (_this select 1)] call FUNC(unlockSafety); + false + }; + true + } else {false} + } + ) then { + // player hud + [false] call FUNC(setSafeModeVisual); + true + } else { + // player hud + [true] call FUNC(setSafeModeVisual); + false + }; + }, {} + ] call EFUNC(common,addActionEventHandler)]; }; -if ((typeName _muzzle) == (typeName "")) then { - _unit selectWeapon _muzzle;//_weapon +if (typeName _muzzle == "STRING") then { + _unit selectWeapon _muzzle; }; // play fire mode selector sound [_unit, _weapon, _muzzle] call FUNC(playChangeFiremodeSound); -private "_picture"; +// show info box _picture = getText (configFile >> "CfgWeapons" >> _weapon >> "picture"); [localize LSTRING(PutOnSafety), _picture] call EFUNC(common,displayTextPicture); diff --git a/addons/safemode/functions/fnc_playChangeFiremodeSound.sqf b/addons/safemode/functions/fnc_playChangeFiremodeSound.sqf index 754a02005c..5da4aeb672 100644 --- a/addons/safemode/functions/fnc_playChangeFiremodeSound.sqf +++ b/addons/safemode/functions/fnc_playChangeFiremodeSound.sqf @@ -1,27 +1,43 @@ -// by commy2 +/* + * Author: commy2 + * Play weapon firemode change sound. + * + * Arguments: + * 0: Unit + * 1: Weapon + * + * Return Value: + * None + * + * Example: + * [ACE_player, currentWeapon ACE_player] call ace_safemode_fnc_playChangeFiremodeSound + * + * Public: No + */ #include "script_component.hpp" -PARAMS_2(_unit,_weapon); +params ["_unit", "_weapon"]; + +private ["_sound", "_position"]; -private ["_sound"]; _sound = getArray (configFile >> "CfgWeapons" >> _weapon >> "changeFiremodeSound"); -if (count _sound == 0) exitWith { +if (_sound isEqualTo []) exitWith { playSound "ACE_Sound_Click"; }; -// add file extension -if ({(toLower (_sound select 0) find _x == (count toArray (_sound select 0) - count toArray _x) - 1)} count [".wav", ".ogg", ".wss"] == 0) then { - _sound set [0, (_sound select 0) + ".wss"]; +// get position where to play the sound (position of the weapon) +_position = AGLToASL (_unit modelToWorldVisual (_unit selectionPosition "RightHand")); + +_sound params ["_filename", ["_volume", 1], ["_soundPitch", 1], ["_distance", 0]]; + +if (_filename == "") exitWith { + playSound "ACE_Sound_Click"; }; -// add default volume, pitch and distance -if (count _sound < 2) then {_sound pushBack 1}; -if (count _sound < 3) then {_sound pushBack 1}; -if (count _sound < 4) then {_sound pushBack 0}; +// add file extension .wss as default +if !(toLower (_filename select [count _filename - 4]) in [".wav", ".ogg", ".wss"]) then { + _filename = format ["%1.wss", _filename]; +}; -private "_position"; -_position = _unit modelToWorldVisual (_unit selectionPosition "RightHand"); -_position set [2, (_position select 2) + ((getPosASLW _unit select 2) - (getPosATL _unit select 2) max 0)]; - -playSound3D [_sound select 0, objNull, false, _position, _sound select 1, _sound select 2, _sound select 3]; +playSound3D [_filename, objNull, false, _position, _volume, _soundPitch, _distance]; diff --git a/addons/safemode/functions/fnc_setSafeModeVisual.sqf b/addons/safemode/functions/fnc_setSafeModeVisual.sqf index cb8c679855..492d5c6996 100644 --- a/addons/safemode/functions/fnc_setSafeModeVisual.sqf +++ b/addons/safemode/functions/fnc_setSafeModeVisual.sqf @@ -1,17 +1,31 @@ -// by commy2 +/* + * Author: commy2 + * Show firemode indicator, representing safety lock + * + * Arguments: + * 0: Show firemode + * + * Return Value: + * None + * + * Example: + * [true] call ace_safemode_fnc_setSafeModeVisual + * + * Public: No + */ #include "script_component.hpp" -PARAMS_1(_show); +params ["_show"]; disableSerialization; -private ["_control"]; +private "_control"; _control = (uiNamespace getVariable ["ACE_dlgSoldier", displayNull]) displayCtrl 187; if (isNull _control) exitWith {}; if (_show) then { - private "_config"; + private "_config"; _config = configFile >> "RscInGameUI" >> "RscUnitInfoSoldier" >> "WeaponInfoControlsGroupLeft" >> "controls" >> "CA_ModeTexture"; _control ctrlSetPosition [getNumber (_config >> "x"), getNumber (_config >> "y"), getNumber (_config >> "w"), getNumber (_config >> "h")]; diff --git a/addons/safemode/functions/fnc_unlockSafety.sqf b/addons/safemode/functions/fnc_unlockSafety.sqf index 2b4f00a4a9..ef01766872 100644 --- a/addons/safemode/functions/fnc_unlockSafety.sqf +++ b/addons/safemode/functions/fnc_unlockSafety.sqf @@ -1,24 +1,35 @@ -// by commy2 +/* + * Author: commy2 + * Take weapon of safety lock. + * + * Arguments: + * 0: Unit + * 1: Weapon + * 2: Muzzle + * + * Return Value: + * None + * + * Example: + * [ACE_player, currentWeapon ACE_player, currentMuzzle ACE_player] call ace_safemode_fnc_unlockSafety + * + * Public: No + */ #include "script_component.hpp" -PARAMS_3(_unit,_weapon,_muzzle); +params ["_unit", "_weapon", "_muzzle"]; + +private ["_safedWeapons", "_picture"]; -private ["_safedWeapons"]; _safedWeapons = _unit getVariable [QGVAR(safedWeapons), []]; +_safedWeapons deleteAt (_safedWeapons find _weapon); -if (_weapon in _safedWeapons) then { - _safedWeapons = _safedWeapons - [_weapon]; +_unit setVariable [QGVAR(safedWeapons), _safedWeapons]; - _unit setVariable [QGVAR(safedWeapons), _safedWeapons]; - - if (count _safedWeapons == 0) then { - private "_id"; - _id = _unit getVariable [QGVAR(actionID), -1]; - - //[_unit, "DefaultAction", _id] call EFUNC(common,removeActionMenuEventHandler); - [_unit, "DefaultAction", _id] call EFUNC(common,removeActionEventHandler); - _unit setVariable [QGVAR(actionID), -1]; - }; +// remove action if all weapons have put their safety on +if (_safedWeapons isEqualTo []) then { + [_unit, "DefaultAction", _unit getVariable [QGVAR(actionID), -1]] call EFUNC(common,removeActionEventHandler); + _unit setVariable [QGVAR(actionID), -1]; }; _unit selectWeapon _muzzle; @@ -36,7 +47,8 @@ if (inputAction "nextWeapon" > 0) then { if (_x == "this") then { _modes pushBack _weapon; }; - } forEach getArray (configfile >> "CfgWeapons" >> _weapon >> "modes"); + nil + } count getArray (configfile >> "CfgWeapons" >> _weapon >> "modes"); // select last mode _mode = _modes select (count _modes - 1); @@ -57,6 +69,6 @@ if (inputAction "nextWeapon" > 0) then { // player hud [true] call FUNC(setSafeModeVisual); -private "_picture"; +// show info box _picture = getText (configFile >> "CfgWeapons" >> _weapon >> "picture"); [localize LSTRING(TookOffSafety), _picture] call EFUNC(common,displayTextPicture); diff --git a/addons/sandbag/CfgEventHandlers.hpp b/addons/sandbag/CfgEventHandlers.hpp index 17911f6b1f..da53514f3b 100644 --- a/addons/sandbag/CfgEventHandlers.hpp +++ b/addons/sandbag/CfgEventHandlers.hpp @@ -1,19 +1,28 @@ + class Extended_PreInit_EventHandlers { class ADDON { - init = QUOTE( call COMPILE_FILE(XEH_preInit) ); + init = QUOTE(call COMPILE_FILE(XEH_preInit)); }; }; class Extended_PostInit_EventHandlers { class ADDON { - init = QUOTE( call COMPILE_FILE(XEH_postInit) ); + init = QUOTE(call COMPILE_FILE(XEH_postInit)); }; }; class Extended_Init_EventHandlers { class ACE_SandbagObject { class ADDON { - init = QUOTE(_this call DEFUNC(dragging,initObject)); + init = QUOTE(_this call EFUNC(dragging,initObject)); }; }; -}; \ No newline at end of file +}; + +class Extended_Killed_EventHandlers { + class CAManBase { + class ADDON { + killed = QUOTE(_this call FUNC(handleKilled)); + }; + }; +}; diff --git a/addons/sandbag/CfgVehicles.hpp b/addons/sandbag/CfgVehicles.hpp index 5a9b530062..a2b255318e 100644 --- a/addons/sandbag/CfgVehicles.hpp +++ b/addons/sandbag/CfgVehicles.hpp @@ -1,14 +1,15 @@ + class CfgVehicles { class Man; class CAManBase: Man { class ACE_SelfActions { - class ACE_Sandbags { + class GVAR(place) { displayName = CSTRING(DeploySandbag); - condition = QUOTE(call FUNC(canDeploy)); - //wait a frame to handle "Do When releasing action menu key" option: - statement = QUOTE([ARR_2({_this call FUNC(deploy)}, [])] call EFUNC(common,execNextFrame)); + condition = QUOTE(_this call FUNC(canDeploy)); + //wait a frame to handle "Do When releasing action menu key" option + statement = QUOTE([ARR_2({_this call FUNC(deploy)},_this)] call EFUNC(common,execNextFrame)); exceptions[] = {"isNotSwimming"}; - showDisabled = 1; + showDisabled = 0; priority = 4; icon = PATHTOF(UI\icon_sandbag_ca.paa); }; @@ -26,8 +27,8 @@ class CfgVehicles { MACRO_ADDITEM(ACE_Sandbag_empty,1); }; }; - /* - class ACE_Item_Sandbag: Item_Base_F { + + /*class ACE_Item_Sandbag: Item_Base_F { author = ECSTRING(common,ACETeam); scope = 2; scopeCurator = 2; @@ -39,8 +40,8 @@ class CfgVehicles { count = 1; }; }; - }; - */ + };*/ + class thingX; class ACE_SandbagObject: thingX { author = ECSTRING(common,ACETeam); @@ -55,10 +56,10 @@ class CfgVehicles { nameSound = "Bunker"; icon = PATHTOF(UI\icon_sandbag_ca.paa); accuracy = 1000; - destrType = "DestructDefault"; class DestructionEffects {}; + class Damage { tex[] = {}; mat[] = { @@ -67,28 +68,19 @@ class CfgVehicles { "z\ace\addons\sandbag\data\bag_destruct.rvmat" }; }; + class ACE_Actions { class ACE_MainActions { selection = ""; distance = 5; condition = "true"; + class ACE_PickUp { selection = ""; displayName = CSTRING(PICKUPSB); distance = 4; - condition = QUOTE(!(_player getVariable [ARR_2('ace_sandbag_usingSandbag',false)])); - statement = QUOTE([ARR_2(_target,_player)] call FUNC(pickup)); - showDisabled = 0; - exceptions[] = {}; - priority = 5; - icon = PATHTOF(UI\icon_sandbag_ca.paa); - }; - class ACE_Carry { - selection = ""; - displayName = CSTRING(CARRYSB); - distance = 4; - condition = QUOTE(!(_player getVariable [ARR_2('ace_sandbag_usingSandbag',false)])); - statement = QUOTE([ARR_2(_target,_player)] call FUNC(carry)); + condition = QUOTE(!(_player getVariable [ARR_2(QUOTE(QGVAR(isUsingSandbag)),false)])); + statement = QUOTE([ARR_2(_player,_target)] call FUNC(pickup)); showDisabled = 0; exceptions[] = {}; priority = 5; @@ -97,6 +89,7 @@ class CfgVehicles { }; }; }; + class ACE_SandbagObject_NoGeo: ACE_SandbagObject { scope = 1; model = PATHTOF(data\ace_sandbag_nogeo.p3d); diff --git a/addons/sandbag/README.md b/addons/sandbag/README.md index 8c67ed9a6d..e1bd40eee5 100644 --- a/addons/sandbag/README.md +++ b/addons/sandbag/README.md @@ -1,10 +1,11 @@ ace_sandbag =============== -Stackable sandbags. +Adds stackable sandbags. + ## Maintainers The people responsible for merging changes to this component or answering potential questions. -- [Ruthberg] (http://github.com/Ulteq) \ No newline at end of file +- [Ruthberg](http://github.com/Ulteq) diff --git a/addons/sandbag/XEH_postInit.sqf b/addons/sandbag/XEH_postInit.sqf index d1c0ad0766..c3f99c2a9b 100644 --- a/addons/sandbag/XEH_postInit.sqf +++ b/addons/sandbag/XEH_postInit.sqf @@ -1,15 +1,27 @@ #include "script_component.hpp" -GVAR(placer) = objNull; +if (isServer) then { + // Cancel deploy on hard disconnection. Function is identical to killed + addMissionEventHandler ["HandleDisconnect", {_this call FUNC(handleKilled)}]; +}; + +if (!hasInterface) exitWith {}; + GVAR(sandBag) = objNull; GVAR(deployPFH) = -1; GVAR(deployDirection) = 0; -// Cancel deploy sandbag if interact menu opened -["interactMenuOpened", { - if (GVAR(deployPFH) != -1 && {!isNull (GVAR(sandBag))}) then { - call FUNC(deployCancel); - }; -}] call EFUNC(common,addEventHandler); +[{_this call FUNC(handleScrollWheel)}] call EFUNC(common,addScrollWheelEventHandler); -[{_this call DFUNC(handleScrollWheel)}] call EFUNC(common,addScrollWheelEventHandler); +// Cancel deploy sandbag if interact menu opened +["interactMenuOpened", {[ACE_player] call FUNC(handleInteractMenuOpened)}] call EFUNC(common,addEventHandler); + +// Cancel deploy on player change. This does work when returning to lobby, but not when hard disconnecting. +["playerChanged", {_this call FUNC(handlePlayerChanged)}] call EFUNC(common,addEventhandler); +["playerInventoryChanged", {_this call FUNC(handlePlayerInventoryChanged)}] call EFUNC(common,addEventhandler); +["playerVehicleChanged", {[ACE_player, objNull] call FUNC(handlePlayerChanged)}] call EFUNC(common,addEventhandler); + +// handle waking up dragged unit and falling unconscious while dragging +["medical_onUnconscious", {_this call FUNC(handleUnconscious)}] call EFUNC(common,addEventhandler); + +//@todo Captivity? diff --git a/addons/sandbag/XEH_preInit.sqf b/addons/sandbag/XEH_preInit.sqf index 1978913723..444dca7ae0 100644 --- a/addons/sandbag/XEH_preInit.sqf +++ b/addons/sandbag/XEH_preInit.sqf @@ -3,12 +3,15 @@ ADDON = false; PREP(canDeploy); -PREP(carry); PREP(deploy); PREP(deployCancel); PREP(deployConfirm); -PREP(drop); +PREP(handleInteractMenuOpened); +PREP(handleKilled); +PREP(handlePlayerChanged); +PREP(handlePlayerInventoryChanged); PREP(handleScrollWheel); +PREP(handleUnconscious); PREP(pickup); ADDON = true; diff --git a/addons/sandbag/functions/fnc_canDeploy.sqf b/addons/sandbag/functions/fnc_canDeploy.sqf index 0c5fda5b4c..d26569f4ab 100644 --- a/addons/sandbag/functions/fnc_canDeploy.sqf +++ b/addons/sandbag/functions/fnc_canDeploy.sqf @@ -1,5 +1,5 @@ /* - * Author: Ruthberg + * Author: Ruthberg, commy2 * Checks if the player can deploy a sandbag * * Arguments: @@ -9,7 +9,7 @@ * Can deploy * * Example: - * [] call ace_sandbag_fnc_canDeploy + * [ACE_player] call ace_sandbag_fnc_canDeploy * * Public: No */ @@ -17,13 +17,13 @@ #define SURFACE_BLACKLIST ["water", "concrete", "tarmac", "wood", "metal", "roof_tin", "roof_tiles", "wood_int", "concrete_int", "tiles_int", "metal_int", "stony", "rock", "int_concrete", "int_tiles", "int_wood", "tiling", "wavymetal", "int_metal"] -if !([ACE_player, "ACE_Sandbag_empty"] call EFUNC(common,hasItem)) exitWith { false }; -if (ACE_player getVariable [QGVAR(usingSandbag), false]) exitWith { false }; -if ((getPosATL ACE_player select 2) - (getPos ACE_player select 2) > 1E-5) exitWith { false }; +params ["_unit"]; + +if !("ACE_Sandbag_empty" in items _unit) exitWith {false}; private ["_surfaceClass", "_surfaceType"]; -_surfaceClass = ([surfaceType (position ACE_player), "#"] call CBA_fnc_split) select 1; +_surfaceClass = (surfaceType getPosASL _unit) select [1]; _surfaceType = getText (configfile >> "CfgSurfaces" >> _surfaceClass >> "soundEnviron"); !(_surfaceType in SURFACE_BLACKLIST) diff --git a/addons/sandbag/functions/fnc_carry.sqf b/addons/sandbag/functions/fnc_carry.sqf deleted file mode 100644 index 84ab8c1883..0000000000 --- a/addons/sandbag/functions/fnc_carry.sqf +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Author: Ruthberg - * Carry sandbag - * - * Arguments: - * 0: sandbag - * 1: unit - * - * Return Value: - * None - * - * Example: - * [_sandbag, _unit] call ace_sandbag_fnc_carry - * - * Public: No - */ -#include "script_component.hpp" - -params ["_sandbag", "_unit"]; - -_unit playActionNow "PutDown"; - -_unit setVariable [QGVAR(usingSandbag), true]; -[{ - params ["_sandbag", "_unit"]; - - GVAR(carrier) = ACE_player; - - [GVAR(carrier), "ACE_Sandbag", true] call EFUNC(common,setForceWalkStatus); - - deleteVehicle _sandbag; - - GVAR(sandBag) = createVehicle ["ACE_SandbagObject_NoGeo", [0, 0, 0], [], 0, "NONE"]; - GVAR(sandBag) enableSimulationGlobal false; - - // Force physx update - { - _x setPosASL (getPosASL _x); - } count (GVAR(carrier) nearObjects ["ACE_SandbagObject", 5]); - - GVAR(carryPFH) = [{ - if (GVAR(carrier) != ACE_player) exitWith { - call FUNC(drop); - }; - GVAR(sandBag) setPosASL ((eyePos ACE_player) vectorAdd (positionCameraToWorld [0, 0, 1] vectorDiff positionCameraToWorld [0, 0, 0])); - GVAR(sandBag) setDir (GVAR(deployDirection) + getDir ACE_player); - }, 0, []] call CBA_fnc_addPerFrameHandler; - - [localize LSTRING(DropSandbag), "", ""] call EFUNC(interaction,showMouseHint); - - GVAR(carrier) setVariable [QGVAR(drop), - [GVAR(carrier), "DefaultAction", - {GVAR(carryPFH) != -1 && !isNull (GVAR(sandBag))}, - {call FUNC(drop);} - ] call EFUNC(common,AddActionEventHandler)]; -}, [_sandbag, _unit], 1, 0.5] call EFUNC(common,waitAndExecute); diff --git a/addons/sandbag/functions/fnc_deploy.sqf b/addons/sandbag/functions/fnc_deploy.sqf index 5bb162e029..de5bd9458e 100644 --- a/addons/sandbag/functions/fnc_deploy.sqf +++ b/addons/sandbag/functions/fnc_deploy.sqf @@ -1,47 +1,61 @@ /* - * Author: Garth 'L-H' de Wet, Ruthberg + * Author: Garth 'L-H' de Wet, Ruthberg, edited by commy2 for better MP and eventual AI support * Starts the deploy process for sandbags. * * Arguments: - * None + * 0: unit * * Return Value: * None * * Example: - * [] call ace_sandbag_fnc_deploy + * [ACE_player] call ace_sandbag_fnc_deploy * * Public: No */ #include "script_component.hpp" -closeDialog 0; +params ["_unit"]; -GVAR(placer) = ACE_player; +// prevent the placing unit from running +[_unit, "ACE_Sandbag", true] call EFUNC(common,setForceWalkStatus); -[GVAR(placer), "ACE_Sandbag", true] call EFUNC(common,setForceWalkStatus); +// create the sandbag +private "_sandBag"; +_sandBag = createVehicle ["ACE_SandbagObject_NoGeo", [0, 0, 0], [], 0, "NONE"]; -GVAR(sandBag) = createVehicle ["ACE_SandbagObject_NoGeo", [0, 0, 0], [], 0, "NONE"]; -GVAR(sandBag) enableSimulationGlobal false; +GVAR(sandBag) = _sandBag; +// prevent collisions with sandbag +["enableSimulationGlobal", [_sandBag, false]] call EFUNC(common,serverEvent); + +GVAR(deployDirection) = 0; + +// pfh that runs while the deployment is in progress GVAR(deployPFH) = [{ - if (GVAR(placer) != ACE_player) exitWith { - call FUNC(deployCancel); - }; - GVAR(sandBag) setPosASL ((eyePos ACE_player) vectorAdd (positionCameraToWorld [0, 0, 1] vectorDiff positionCameraToWorld [0, 0, 0])); - GVAR(sandBag) setDir (GVAR(deployDirection) + getDir ACE_player); -}, 0, []] call CBA_fnc_addPerFrameHandler; + (_this select 0) params ["_unit", "_sandBag"]; + if (isNull _sandBag) exitWith { + [_unit] call FUNC(deployCancel); + }; + + _sandBag setPosASL (eyePos _unit vectorAdd (positionCameraToWorld [0, 0, 1] vectorDiff positionCameraToWorld [0, 0, 0])); + _sandBag setDir (GVAR(deployDirection) + getDir _unit); +}, 0, [_unit, _sandBag]] call CBA_fnc_addPerFrameHandler; + +// add mouse button action and hint [localize LSTRING(ConfirmDeployment), localize LSTRING(CancelDeployment), localize LSTRING(ScrollAction)] call EFUNC(interaction,showMouseHint); -GVAR(placer) setVariable [QGVAR(Deploy), - [GVAR(placer), "DefaultAction", - {GVAR(deployPFH) != -1 && !isNull (GVAR(sandBag))}, - {call FUNC(deployConfirm);} -] call EFUNC(common,AddActionEventHandler)]; +_unit setVariable [QGVAR(Deploy), [ + _unit, "DefaultAction", + {GVAR(deployPFH) != -1}, + {[_this select 0] call FUNC(deployConfirm)} +] call EFUNC(common,addActionEventHandler)]; -GVAR(placer) setVariable [QGVAR(Cancel), - [GVAR(placer), "zoomtemp", - {GVAR(deployPFH) != -1 && !isNull (GVAR(sandBag))}, - {call FUNC(deployCancel);} -] call EFUNC(common,AddActionEventHandler)]; +_unit setVariable [QGVAR(Cancel), [ + _unit, "zoomtemp", + {GVAR(deployPFH) != -1}, + {[_this select 0] call FUNC(deployCancel)} +] call EFUNC(common,addActionEventHandler)]; + +_unit setVariable [QGVAR(isDeploying), true, true]; diff --git a/addons/sandbag/functions/fnc_deployCancel.sqf b/addons/sandbag/functions/fnc_deployCancel.sqf index bb7480a59e..9186ddbf57 100644 --- a/addons/sandbag/functions/fnc_deployCancel.sqf +++ b/addons/sandbag/functions/fnc_deployCancel.sqf @@ -1,35 +1,36 @@ /* - * Author: Garth 'L-H' de Wet, Ruthberg + * Author: Garth 'L-H' de Wet, Ruthberg, edited by commy2 for better MP and eventual AI support * Cancels sandbag deployment * * Arguments: - * None + * 0: unit * * Return Value: * None * * Example: - * [] call ace_sandbag_fnc_deployCancel + * [ACE_player] call ace_sandbag_fnc_deployCancel * * Public: No */ #include "script_component.hpp" -if (isNull GVAR(placer)) exitWith {}; +params ["_unit"]; -[GVAR(deployPFH)] call cba_fnc_removePerFrameHandler; +// enable running again +[_unit, "ACE_Sandbag", false] call EFUNC(common,setForceWalkStatus); -if (!isNull (GVAR(sandBag))) then { - deleteVehicle GVAR(sandBag); -}; +// delete placement dummy +deleteVehicle GVAR(sandBag); -[GVAR(placer), "ACE_Sandbag", false] call EFUNC(Common,setForceWalkStatus); +// remove deployment pfh +[GVAR(deployPFH)] call CBA_fnc_removePerFrameHandler; +GVAR(deployPFH) = -1; +// remove mouse button actions call EFUNC(interaction,hideMouseHint); -[GVAR(placer), "DefaultAction", GVAR(placer) getVariable [QGVAR(Deploy), -1]] call EFUNC(Common,removeActionEventHandler); -[GVAR(placer), "zoomtemp", GVAR(placer) getVariable [QGVAR(Cancel), -1]] call EFUNC(Common,removeActionEventHandler); -GVAR(placer) addItem "ACE_Sandbag_empty"; +[_unit, "DefaultAction", _unit getVariable [QGVAR(Deploy), -1]] call EFUNC(common,removeActionEventHandler); +[_unit, "zoomtemp", _unit getVariable [QGVAR(Cancel), -1]] call EFUNC(common,removeActionEventHandler); -GVAR(sandBag) = objNull; -GVAR(placer) = objNull; +_unit setVariable [QGVAR(isDeploying), false, true]; diff --git a/addons/sandbag/functions/fnc_deployConfirm.sqf b/addons/sandbag/functions/fnc_deployConfirm.sqf index 61264c15fe..62848dd0cd 100644 --- a/addons/sandbag/functions/fnc_deployConfirm.sqf +++ b/addons/sandbag/functions/fnc_deployConfirm.sqf @@ -1,51 +1,59 @@ /* - * Author: Garth 'L-H' de Wet, Ruthberg + * Author: Garth 'L-H' de Wet, Ruthberg, edited by commy2 for better MP and eventual AI support * Confirms sandbag deployment * * Arguments: - * None + * 0: unit * * Return Value: * None * * Example: - * [] call ace_sandbag_fnc_deployConfirm + * [ACE_player] call ace_sandbag_fnc_deployConfirm * * Public: No */ #include "script_component.hpp" -if (isNull GVAR(sandBag) || isNull GVAR(placer)) exitWith {}; +params ["_unit"]; -[GVAR(deployPFH)] call cba_fnc_removePerFrameHandler; +// enable running again +[_unit, "ACE_Sandbag", false] call EFUNC(common,setForceWalkStatus); -[GVAR(placer), "ACE_Sandbag", false] call EFUNC(Common,setForceWalkStatus); -[GVAR(placer), "DefaultAction", GVAR(placer) getVariable [QGVAR(Deploy), -1]] call EFUNC(Common,removeActionEventHandler); -[GVAR(placer), "zoomtemp", GVAR(placer) getVariable [QGVAR(Cancel), -1]] call EFUNC(Common,removeActionEventHandler); +// remove sandbag from inventory +_unit removeItem "ACE_Sandbag_empty"; -call EFUNC(interaction,hideMouseHint); - -GVAR(placer) playActionNow "PutDown"; - -GVAR(placer) setVariable [QGVAR(usingSandbag), true]; +// delete placement dummy and create real sandbag [{ - _this setVariable [QGVAR(usingSandbag), false]; -}, GVAR(placer), 1.5, 0.5] call EFUNC(common,waitAndExecute); + if (isNull GVAR(sandBag)) exitWith {}; + + params ["_unit"]; + + private ["_position", "_direction", "_sandBag"]; -[{ - private ["_sandBag", "_position", "_direction"]; _position = getPosASL GVAR(sandBag); _direction = getDir GVAR(sandBag); deleteVehicle GVAR(sandBag); _sandBag = createVehicle ["ACE_SandbagObject", [0, 0, 0], [], 0, "NONE"]; - _sandBag enableSimulationGlobal true; _sandBag setPosASL _position; _sandBag setDir _direction; - GVAR(placer) removeItem "ACE_Sandbag_empty"; - GVAR(sandBag) = objNull; - GVAR(placer) = objNull; -}, [], 1.0, 0.5] call EFUNC(common,waitAndExecute); +}, [_unit], 1] call EFUNC(common,waitAndExecute); + +// remove deployment pfh +[GVAR(deployPFH)] call CBA_fnc_removePerFrameHandler; +GVAR(deployPFH) = -1; + +// remove mouse button actions +call EFUNC(interaction,hideMouseHint); + +[_unit, "DefaultAction", _unit getVariable [QGVAR(Deploy), -1]] call EFUNC(common,removeActionEventHandler); +[_unit, "zoomtemp", _unit getVariable [QGVAR(Cancel), -1]] call EFUNC(common,removeActionEventHandler); + +// play animation +_unit playActionNow "PutDown"; + +_unit setVariable [QGVAR(isDeploying), false, true]; diff --git a/addons/sandbag/functions/fnc_drop.sqf b/addons/sandbag/functions/fnc_drop.sqf deleted file mode 100644 index 3ba825d423..0000000000 --- a/addons/sandbag/functions/fnc_drop.sqf +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Author: Garth 'L-H' de Wet, Ruthberg - * Drop sandbag - * - * Arguments: - * None - * - * Return Value: - * None - * - * Example: - * [] call ace_sandbag_fnc_deployCancel - * - * Public: No - */ -#include "script_component.hpp" - -if (isNull GVAR(sandBag) || isNull GVAR(carrier)) exitWith {}; - -[GVAR(carryPFH)] call cba_fnc_removePerFrameHandler; - -[GVAR(carrier), "ACE_Sandbag", false] call EFUNC(Common,setForceWalkStatus); -[GVAR(carrier), "DefaultAction", GVAR(carrier) getVariable [QGVAR(drop), -1]] call EFUNC(Common,removeActionEventHandler); - -call EFUNC(interaction,hideMouseHint); - -GVAR(carrier) playActionNow "PutDown"; - -[{ - _this setVariable [QGVAR(usingSandbag), false]; -}, GVAR(carrier), 1.5, 0.5] call EFUNC(common,waitAndExecute); - -[{ - private ["_sandBag", "_position", "_direction"]; - _position = getPosASL GVAR(sandBag); - _direction = getDir GVAR(sandBag); - - deleteVehicle GVAR(sandBag); - - _sandBag = createVehicle ["ACE_SandbagObject", [0, 0, 0], [], 0, "NONE"]; - _sandBag enableSimulationGlobal true; - _sandBag setPosASL _position; - _sandBag setDir _direction; - - GVAR(sandBag) = objNull; - GVAR(carrier) = objNull; -}, [], 1.0, 0.5] call EFUNC(common,waitAndExecute); diff --git a/addons/sandbag/functions/fnc_handleInteractMenuOpened.sqf b/addons/sandbag/functions/fnc_handleInteractMenuOpened.sqf new file mode 100644 index 0000000000..f4ea5891c7 --- /dev/null +++ b/addons/sandbag/functions/fnc_handleInteractMenuOpened.sqf @@ -0,0 +1,19 @@ +/* + * Author: commy2 + * Handle opening of interaction menu. + * + * Arguments: + * 0: Unit + * + * Return Value: + * None + * + * Public: No +*/ +#include "script_component.hpp" + +params ["_unit"]; + +if (_unit getVariable [QGVAR(isDeploying), false]) then { + [_unit] call FUNC(deployCancel); +}; diff --git a/addons/sandbag/functions/fnc_handleKilled.sqf b/addons/sandbag/functions/fnc_handleKilled.sqf new file mode 100644 index 0000000000..63babd3f52 --- /dev/null +++ b/addons/sandbag/functions/fnc_handleKilled.sqf @@ -0,0 +1,19 @@ +/* + * Author: commy2 + * Handle death. + * + * Arguments: + * 0: Unit + * + * Return Value: + * None + * + * Public: No +*/ +#include "script_component.hpp" + +params ["_unit"]; + +if (_unit getVariable [QGVAR(isDeploying), false]) then { + [_unit] call FUNC(deployCancel); +}; diff --git a/addons/sandbag/functions/fnc_handlePlayerChanged.sqf b/addons/sandbag/functions/fnc_handlePlayerChanged.sqf new file mode 100644 index 0000000000..f27a295903 --- /dev/null +++ b/addons/sandbag/functions/fnc_handlePlayerChanged.sqf @@ -0,0 +1,24 @@ +/* + * Author: commy2 + * Handle player changes. + * + * Arguments: + * 0: New Player Unit + * 1: Old Player Unit + * + * Return Value: + * None + * + * Public: No +*/ +#include "script_component.hpp" + +params ["_newPlayer", "_oldPlayer"]; + +if (_newPlayer getVariable [QGVAR(isDeploying), false]) then { + [_newPlayer] call FUNC(deployCancel); +}; + +if (_oldPlayer getVariable [QGVAR(isDeploying), false]) then { + [_oldPlayer] call FUNC(deployCancel); +}; diff --git a/addons/sandbag/functions/fnc_handlePlayerInventoryChanged.sqf b/addons/sandbag/functions/fnc_handlePlayerInventoryChanged.sqf new file mode 100644 index 0000000000..9f5920edd1 --- /dev/null +++ b/addons/sandbag/functions/fnc_handlePlayerInventoryChanged.sqf @@ -0,0 +1,22 @@ +/* + * Author: commy2 + * Handle the InventoryChanged event. + * + * Arguments: + * 0: Unit + * 1: Weapon + * + * Return Value: + * None + * + * Public: No +*/ +#include "script_component.hpp" + +params ["_unit"]; + +if (_unit getVariable [QGVAR(isDeploying), false]) then { + if !("ACE_Sandbag_empty" in items _unit) then { + [_unit] call FUNC(deployCancel); + }; +}; diff --git a/addons/sandbag/functions/fnc_handleUnconscious.sqf b/addons/sandbag/functions/fnc_handleUnconscious.sqf new file mode 100644 index 0000000000..7e0e257158 --- /dev/null +++ b/addons/sandbag/functions/fnc_handleUnconscious.sqf @@ -0,0 +1,19 @@ +/* + * Author: commy2 + * Handle unconsciousness. + * + * Arguments: + * 0: Unit + * + * Return Value: + * None + * + * Public: No +*/ +#include "script_component.hpp" + +params ["_unit"]; + +if (_unit getVariable [QGVAR(isDeploying), false]) then { + [_unit] call FUNC(deployCancel); +}; diff --git a/addons/sandbag/functions/fnc_pickup.sqf b/addons/sandbag/functions/fnc_pickup.sqf index dd0b93fd59..7e04d047fd 100644 --- a/addons/sandbag/functions/fnc_pickup.sqf +++ b/addons/sandbag/functions/fnc_pickup.sqf @@ -3,27 +3,32 @@ * Pick up sandbag * * Arguments: - * 0: sandbag - * 1: unit + * 0: unit + * 1: sandbag * * Return Value: * None * * Example: - * [_sandbag, _unit] call ace_sandbag_fnc_pickup + * [_unit, _sandbag] call ace_sandbag_fnc_pickup * * Public: No */ #include "script_component.hpp" -params ["_sandbag", "_unit"]; +params ["_unit", "_sandbag"]; _unit playActionNow "PutDown"; -_unit setVariable [QGVAR(usingSandbag), true]; +_unit setVariable [QGVAR(isUsingSandbag), true]; + [{ - params ["_sandbag", "_unit"]; - _unit setVariable [QGVAR(usingSandbag), false]; + params ["_unit", "_sandbag"]; + + _unit setVariable [QGVAR(isUsingSandbag), false]; + + if (isNull _sandbag) exitWith {}; + deletevehicle _sandbag; // Force physx update @@ -32,4 +37,4 @@ _unit setVariable [QGVAR(usingSandbag), true]; } count (_unit nearObjects ["ACE_SandbagObject", 5]); [_unit, "ACE_Sandbag_empty"] call EFUNC(common,addToInventory); -}, [_sandbag, _unit], 1.5, 0.5] call EFUNC(common,waitAndExecute); +}, [_unit, _sandbag], 1.5] call EFUNC(common,waitAndExecute); diff --git a/addons/sandbag/stringtable.xml b/addons/sandbag/stringtable.xml index 5576add969..c67173466c 100644 --- a/addons/sandbag/stringtable.xml +++ b/addons/sandbag/stringtable.xml @@ -146,16 +146,16 @@ Aqui não tem areia - + Modifier, rotates - + Modifikator, drehen - + Modificador, girar - + Modificateur, tourner - + Modificatore, rotazione - + Modifikátor, otočit - + Változtatás, forgatás - + Modyfikator, obrót - + Modificador, rotaciona - + Bращать + +Ctrl rotate + +Strg drehen + +Ctrl girar + +Ctrl tourner + +Ctrl rotazione + +Ctrl otočit + +Ctrl forgatás + +Ctrl obrót + +Ctrl rotaciona + +Ctrl Bращать \ No newline at end of file diff --git a/addons/scopes/XEH_postInit.sqf b/addons/scopes/XEH_postInit.sqf index e96ac43960..bd81a0935b 100644 --- a/addons/scopes/XEH_postInit.sqf +++ b/addons/scopes/XEH_postInit.sqf @@ -7,7 +7,7 @@ */ #include "script_component.hpp" -if !(hasInterface) exitWith {}; +if (!hasInterface) exitWith {}; // Check inventory when it changes ["playerInventoryChanged", { @@ -136,30 +136,3 @@ if !(hasInterface) exitWith {}; }, {false}, [201, [true, true, false]], true] call cba_fnc_addKeybind; - -// init shortdot -GVAR(showShortdot) = false; - -["playerInventoryChanged", { - if (_this select 1 isEqualTo []) exitWith {}; //@todo fix eh - - private "_showShortdot"; - _showShortdot = _this select 1 select 9 select 2 == "ACE_optic_DMS"; - - if (GVAR(showShortdot)) then { - if (!_showShortdot) then { - // hide control and turn onDraw handler off - (uiNamespace getVariable ["ACE_ctrlShortdotReticle", controlNull]) ctrlShow false; - GVAR(showShortdot) = false; - }; - } else { - if (_showShortdot) then { - // create control and turn onDraw handler on - ([QGVAR(reticle)] call BIS_fnc_rscLayer) cutRsc ["ACE_Shortdot_Reticle", "PLAIN", 0, false]; - (uiNamespace getVariable "ACE_ctrlShortdotReticle") ctrlSetText QUOTE(PATHTOF(data\reticles\ace_shortdot_reticle_1.paa)); - GVAR(showShortdot) = true; - }; - }; -}] call EFUNC(common,addEventHandler); - -addMissionEventHandler ["Draw3D", {if (GVAR(showShortdot)) then {call FUNC(onDrawShortdot)};}]; diff --git a/addons/scopes/functions/fnc_firedEH.sqf b/addons/scopes/functions/fnc_firedEH.sqf index 5ede2d2cf8..bb9c37a1af 100644 --- a/addons/scopes/functions/fnc_firedEH.sqf +++ b/addons/scopes/functions/fnc_firedEH.sqf @@ -38,4 +38,4 @@ if (_zeroing isEqualTo [0, 0, 0]) exitWith {}; _zeroing = _zeroing vectorMultiply 0.05625; _zeroing params ["_elevation", "_windage", "_zero"]; -[_projectile, _elevation, _elevation + _zero, 0] call EFUNC(common,changeProjectileDirection); +[_projectile, _windage, _elevation + _zero, 0] call EFUNC(common,changeProjectileDirection); diff --git a/addons/sitting/CfgMoves.hpp b/addons/sitting/CfgMoves.hpp index fc902032e2..f203203ed0 100644 --- a/addons/sitting/CfgMoves.hpp +++ b/addons/sitting/CfgMoves.hpp @@ -1,6 +1,9 @@ -// Enable visual head movement while free-looking +// Force free-look, prevent body rotating and leaning #define MACRO_ANIMATION \ - head = "headDefault"; + head = "headDefault"; \ + aimingBody = "aimingNo"; \ + forceAim = 1; \ + static = 1; class CfgMovesBasic; class CfgMovesMaleSdr: CfgMovesBasic { diff --git a/addons/sitting/README.md b/addons/sitting/README.md index 41db2ce8ee..5237c7145e 100644 --- a/addons/sitting/README.md +++ b/addons/sitting/README.md @@ -1,10 +1,11 @@ ace_sitting =============== -The Sitting module introduces ability to sit on different chairs and toilets. +The Sitting module introduces ability to sit on chairs. + ## Maintainers The people responsible for merging changes to this component or answering potential questions. -- [Jonpas] (https://github.com/jonpas) +- [Jonpas](https://github.com/jonpas) diff --git a/addons/sitting/XEH_clientInit.sqf b/addons/sitting/XEH_clientInit.sqf index 1e477cd952..9cf8278877 100644 --- a/addons/sitting/XEH_clientInit.sqf +++ b/addons/sitting/XEH_clientInit.sqf @@ -1,7 +1,7 @@ #include "script_component.hpp" // Exit on Headless -if !(hasInterface) exitWith {}; +if (!hasInterface) exitWith {}; // Add interaction menu exception ["isNotSitting", {!((_this select 0) getVariable [QGVAR(isSitting), false])}] call EFUNC(common,addCanInteractWithCondition); diff --git a/addons/sitting/XEH_preInit.sqf b/addons/sitting/XEH_preInit.sqf index 1649aaba2b..86912ada6b 100644 --- a/addons/sitting/XEH_preInit.sqf +++ b/addons/sitting/XEH_preInit.sqf @@ -6,7 +6,6 @@ PREP(canSit); PREP(canStand); PREP(getRandomAnimation); PREP(handleInterrupt); -PREP(hasChairMoved); PREP(moduleInit); PREP(sit); PREP(stand); diff --git a/addons/sitting/functions/fnc_hasChairMoved.sqf b/addons/sitting/functions/fnc_hasChairMoved.sqf deleted file mode 100644 index de3a38e0ce..0000000000 --- a/addons/sitting/functions/fnc_hasChairMoved.sqf +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Author: Jonpas - * Checks if chair moved from original position. - * - * Arguments: - * 0: Seat - * 1: Seat Position - * - * Return Value: - * None - * - * Example: - * [seat, seatPos] call ace_sitting_fnc_hasChairMoved - * - * Public: No - */ -#include "script_component.hpp" - -params ["_seat", "_seatPosOrig"]; - -TRACE_2("Chair position",_seatPosOrig,getPosASL _seat); - -(getPosASL _seat) params ["_seatX", "_seatY", "_seatZ"]; -_seatPosOrig params ["_seatOrigX", "_seatOrigY", "_seatOrigZ"]; - -// Check each coordinate due to possibility of tiny movements in simulation -if (abs (_seatX - _seatOrigX) > 0.01) exitWith {true}; -if (abs (_seatY - _seatOrigY) > 0.01) exitWith {true}; -if (abs (_seatZ - _seatOrigZ) > 0.01) exitWith {true}; -false diff --git a/addons/sitting/functions/fnc_moduleInit.sqf b/addons/sitting/functions/fnc_moduleInit.sqf index ae476317db..c21d92afbb 100644 --- a/addons/sitting/functions/fnc_moduleInit.sqf +++ b/addons/sitting/functions/fnc_moduleInit.sqf @@ -22,4 +22,4 @@ if (!_activated) exitWith {}; [_logic, QGVAR(enable), "enable"] call EFUNC(common,readSettingFromModule); -diag_log text "[ACE]: Sitting Module Initialized."; +ACE_LOGINFO("Sitting Module Initialized."); diff --git a/addons/sitting/functions/fnc_sit.sqf b/addons/sitting/functions/fnc_sit.sqf index 0c6825ed58..5e9c36947e 100644 --- a/addons/sitting/functions/fnc_sit.sqf +++ b/addons/sitting/functions/fnc_sit.sqf @@ -16,7 +16,7 @@ */ #include "script_component.hpp" -private ["_configFile", "_sitDirection", "_sitPosition", "_sitRotation", "_sitDirectionVisual"]; +private ["_actionID", "_configFile", "_sitDirection", "_sitPosition", "_sitRotation", "_seatPosOrig"]; params ["_seat", "_player"]; @@ -26,6 +26,26 @@ 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)), + nil, + 20, + false, + true, + "GetOut", + QUOTE(_this call FUNC(canStand)) +]; + +_player setVariable [QGVAR(StandUpActionID), _actionID]; + // Read config _configFile = configFile >> "CfgVehicles" >> typeOf _seat; _sitDirection = (getDir _seat) + getNumber (_configFile >> QGVAR(sitDirection)); @@ -45,30 +65,22 @@ _player setPos (_seat modelToWorld _sitPosition); _player setVariable [QGVAR(isSitting), true]; _seat setVariable [QGVAR(seatOccupied), true, true]; // To prevent multiple people sitting on one seat -// Add rotation control PFH -_sitDirectionVisual = getDirVisual _player; // Needed for precision and issues with using above directly + +// Add automatical stand PFH in case of interruptions _seatPosOrig = getPosASL _seat; [{ params ["_args", "_pfhId"]; - _args params ["_player", "_sitDirectionVisual", "_sitRotation", "_seat", "_seatPosOrig"]; + _args params ["_player", "_seat", "_seatPosOrig"]; // Remove PFH if not sitting any more if !(_player getVariable [QGVAR(isSitting), false]) exitWith { - [_pfhId] call cba_fnc_removePerFrameHandler; + [_pfhId] call CBA_fnc_removePerFrameHandler; TRACE_1("Remove PFH",_player getVariable [ARR_2(QGVAR(isSitting), false)]); }; - // Stand up if chair moves - if ([_seat, _seatPosOrig] call FUNC(hasChairMoved)) exitWith { + // Stand up if chair gets deleted or moved + if (isNull _seat || !((getPosASL _seat) isEqualTo _seatPosOrig)) exitWith { _player call FUNC(stand); TRACE_2("Chair moved",getPosASL _seat,_seatPosOrig); }; - - // Set direction to boundary when passing it - if (getDir _player > _sitDirectionVisual + _sitRotation) exitWith { - _player setDir (_sitDirectionVisual + _sitRotation); - }; - if (getDir _player < _sitDirectionVisual - _sitRotation) exitWith { - _player setDir (_sitDirectionVisual - _sitRotation); - }; -}, 0, [_player, _sitDirectionVisual, _sitRotation, _seat, _seatPosOrig]] call CBA_fnc_addPerFrameHandler; +}, 0, [_player, _seat, _seatPosOrig]] call CBA_fnc_addPerFrameHandler; diff --git a/addons/sitting/functions/fnc_stand.sqf b/addons/sitting/functions/fnc_stand.sqf index 978bcaf279..ef19d5f586 100644 --- a/addons/sitting/functions/fnc_stand.sqf +++ b/addons/sitting/functions/fnc_stand.sqf @@ -17,8 +17,19 @@ params ["_player"]; +// remove scroll wheel action +_player removeAction (_player getVariable [QGVAR(StandUpActionID), -1]); + // Restore animation -[_player, "", 2] call EFUNC(common,doAnimation); +private "_animation"; +_animation = switch (currentWeapon _player) do { + case "": {"amovpercmstpsnonwnondnon"}; + case (primaryWeapon _player): {"amovpercmstpslowwrfldnon"}; + case (handgunWeapon _player): {"amovpercmstpslowwpstdnon"}; + default {"amovpercmstpsnonwnondnon"}; +}; + +[_player, _animation, 2] call EFUNC(common,doAnimation); // Set variables to nil _player setVariable [QGVAR(isSitting), nil]; diff --git a/addons/sitting/stringtable.xml b/addons/sitting/stringtable.xml index 443c34c360..b8716f49e5 100644 --- a/addons/sitting/stringtable.xml +++ b/addons/sitting/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -7,6 +7,9 @@ Sentar Sednout si Sentarse + S'assoir + Leülés + Сесть Stand Up @@ -14,6 +17,9 @@ Levantar Vstát Levantarse + Se lever + Felállás + Встать Enable Sitting @@ -21,13 +27,19 @@ Aktywuj siadanie Povolit sezení Acivar asiento + Permettre de s'assoir + Ülés engedélyezése + Разрешить сидение Sitting Sentado Siadanie - Sedící + Sezení Sentarse + S'assoir + Ülés + Сидение This module allows you to disable the ability to sit on chairs and toilets. @@ -35,6 +47,9 @@ Moduł ten pozwala na włączenie lub wyłączenie możliwości siadania na krzesłach i toaletach. Tento modul dovoluje zakázat možnost sedět na židlých a toaletách. Este módulo te permite desactivar la capacidad de sentarte en sillas y aseos. + Ce module controle la capacité de s'assoir sur des chaises ou sur des toilettes + Ez a modul lehetővé teszi a székekre és toalettekre való leülés letiltását. + Этот модуль позволяет вам запретить возможность садиться на стулья и туалеты. - \ No newline at end of file + diff --git a/addons/slideshow/README.md b/addons/slideshow/README.md index 58b22c1e17..627e1fe660 100644 --- a/addons/slideshow/README.md +++ b/addons/slideshow/README.md @@ -3,8 +3,9 @@ ace_slideshow Adds ability to have slide-shows on them and control them with a controller (another object). + ## Maintainers The people responsible for merging changes to this component or answering potential questions. -- [Jonpas] (https://github.com/jonpas) +- [Jonpas](https://github.com/jonpas) diff --git a/addons/slideshow/functions/fnc_addSlideActions.sqf b/addons/slideshow/functions/fnc_addSlideActions.sqf index 1ebba306b4..a18249a4f8 100644 --- a/addons/slideshow/functions/fnc_addSlideActions.sqf +++ b/addons/slideshow/functions/fnc_addSlideActions.sqf @@ -20,7 +20,6 @@ #include "script_component.hpp" private "_actions"; - params ["_objects", "_images", "_names", "_controller", "_currentSlideshow"]; _actions = []; diff --git a/addons/slideshow/functions/fnc_autoTransition.sqf b/addons/slideshow/functions/fnc_autoTransition.sqf index c8b03a707a..4c31c4ff6a 100644 --- a/addons/slideshow/functions/fnc_autoTransition.sqf +++ b/addons/slideshow/functions/fnc_autoTransition.sqf @@ -19,7 +19,6 @@ #include "script_component.hpp" private "_currentSlide"; - params ["_objects", "_images", "_varString", "_duration"]; // Get current slide number of this slideshow diff --git a/addons/slideshow/functions/fnc_createSlideshow.sqf b/addons/slideshow/functions/fnc_createSlideshow.sqf index c3b45528da..792905db0f 100644 --- a/addons/slideshow/functions/fnc_createSlideshow.sqf +++ b/addons/slideshow/functions/fnc_createSlideshow.sqf @@ -10,7 +10,7 @@ * 4: Slide Duration (0 disables automatic transitions) * * Return Value: - * Parsed List + * None * * Example: * [[object1, object2, object3], [controller1], ["images\image1.paa", "images\image2.paa"], ["Action1", "Action2"], 5] call ace_slideshow_fnc_createSlideshow @@ -19,23 +19,25 @@ */ #include "script_component.hpp" -private ["_currentSlideshow", "_actionsObject", "_actionsClass", "_mainAction", "_slidesAction", "_varString"]; - -params ["_objects", "_controllers", "_images", "_names", "_duration"]; +private ["_currentSlideshow", "_slidesAction", "_varString"]; +params [ + ["_objects", [], [[]] ], + ["_controllers", [], [[]] ], + ["_images", [], [[]] ], + ["_names", [], [[]] ], + ["_duration", 0, [0]] +]; // Verify data -if (count _images != count _names || {count _images == 0} || {count _names == 0}) exitWith { - diag_log "[ACE] ERROR: Slideshow Images or Names fields can NOT be empty and must have equal number of items!" +if (_objects isEqualTo []) exitWith { + ACE_LOGERROR("Slideshow Objects field must NOT be empty!"); +}; +if (count _images != count _names || {_images isEqualTo []} || {_names isEqualTo []}) exitWith { + ACE_LOGERROR("Slideshow Images or Names fields must NOT be empty and must have equal number of items!"); }; -// Objects synced to the module -{ - _objects pushBack _x; - nil -} count (synchronizedObjects _logic); - // If no controllers use objects as controllers -if (count _controllers == 0) then { +if (_controllers isEqualTo []) then { _controllers = _objects; }; @@ -55,24 +57,15 @@ _currentSlideshow = GVAR(slideshows); // Local variable in case GVAR gets change // If interaction menu module is not present, set default duration value if !(["ace_interact_menu"] call EFUNC(common,isModLoaded)) then { - _duration = 5; - diag_log text format ["[ACE]: Slideshow: Interaction Menu module not present, defaulting duration value to %1", _duration]; + _duration = NOINTERACTMENU_DURATION; + ACE_LOGINFO_1("Interaction Menu module not present, defaulting duration value to %1",_duration); }; // Add interactions if automatic transitions are disabled, else setup automatic transitions if (_duration == 0) then { { - // Add MainAction if one does not already exist - _actionsObject = _x getVariable [QEGVAR(interact_menu,actions), []]; - _actionsClass = missionNamespace getVariable [format [QEGVAR(interact_menu,Act_%1), typeOf _x], []]; - if (count _actionsObject == 0 && {count _actionsClass == 0}) then { - _mainAction = ["ACE_MainActions", localize ELSTRING(interaction,MainAction), "", {}, {true}] call EFUNC(interact_menu,createAction); - [_x, 0, [], _mainAction] call EFUNC(interact_menu,addActionToObject); - TRACE_2("Adding ACE_MainActions",_actionsObject,_actionsClass); - }; - // Add Slides sub-action and populate with images - _slidesAction = [QGVAR(Slides), localize LSTRING(Interaction), "", {}, {true}, {(_this select 2) call FUNC(addSlideActions)}, [_objects,_images,_names,_x,_currentSlideshow], [0,0,0], 2] call EFUNC(interact_menu,createAction); + _slidesAction = [QGVAR(Slides), localize LSTRING(Interaction), "", {}, {true}, {(_this select 2) call FUNC(addSlideActions)}, [_objects, _images, _names, _x, _currentSlideshow], [0, 0, 0], 2] call EFUNC(interact_menu,createAction); [_x, 0, ["ACE_MainActions"], _slidesAction] call EFUNC(interact_menu,addActionToObject); nil } count _controllers; diff --git a/addons/slideshow/functions/fnc_makeList.sqf b/addons/slideshow/functions/fnc_makeList.sqf index 8de87a2d96..e550e462a7 100644 --- a/addons/slideshow/functions/fnc_makeList.sqf +++ b/addons/slideshow/functions/fnc_makeList.sqf @@ -4,7 +4,7 @@ * * Arguments: * 0: Text - * 1: Remove Whitespace + * 1: Trim Whitespace * 2: Check Nil * * Return Value: @@ -15,24 +15,22 @@ * * Public: No */ -//#define DEBUG_MODE_FULL #include "script_component.hpp" -params ["_list", "_removeWhitespace", "_checkNil"]; - -private ["_splittedList", "_listNoWhitespace", "_nilCheckPassedList"]; +private ["_splittedList", "_listTrimmedWhitespace", "_nilCheckPassedList"]; +params ["_list", "_trimWhitespace", "_checkNil"]; // Split using comma delimiter _splittedList = [_list, ","] call BIS_fnc_splitString; // Remove whitespace -_listNoWhitespace = []; -if (_removeWhitespace) then { +_listTrimmedWhitespace = []; +if (_trimWhitespace) then { { - _listNoWhitespace pushBack ([_x] call EFUNC(common,stringRemoveWhiteSpace)); + _listTrimmedWhitespace pushBack ([_x] call CBA_fnc_trim); nil } count _splittedList; - _list = _listNoWhitespace; + _list = _listTrimmedWhitespace; }; // Check for object existence @@ -53,6 +51,6 @@ if (_checkNil) then { _list = [] call compile _list; }; -TRACE_4("Lists",_splittedList,_listNoWhitespace,_nilCheckPassedList,_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 da1724dfcc..f09dab678d 100644 --- a/addons/slideshow/functions/fnc_moduleInit.sqf +++ b/addons/slideshow/functions/fnc_moduleInit.sqf @@ -18,7 +18,6 @@ if (!hasInterface && !isDedicated) exitWith {}; private ["_objects", "_controllers", "_images", "_names", "_duration"]; - params [["_logic", objNull, [objNull]], "_units", "_activated"]; if !(_activated) exitWith {}; @@ -31,7 +30,13 @@ _images = [_logic getVariable ["Images", ""], true, false] call FUNC(makeList); _names = [_logic getVariable ["Names", ""], true, false] call FUNC(makeList); _duration = _logic getVariable ["Duration", 0]; +// Objects synced to the module +{ + _objects pushBack _x; + nil +} count (synchronizedObjects _logic); + // Prepare with actions [_objects, _controllers, _images, _names, _duration] call FUNC(createSlideshow); -diag_log text format ["[ACE]: Slideshow Module Initialized for: %1 with Duration: %2", _objects, _duration]; +ACE_LOGINFO_1("Slideshow Module Initialized on %1 Objects", count _objects); diff --git a/addons/slideshow/script_component.hpp b/addons/slideshow/script_component.hpp index 12f60ee1ab..3acd23c0ee 100644 --- a/addons/slideshow/script_component.hpp +++ b/addons/slideshow/script_component.hpp @@ -10,3 +10,6 @@ #endif #include "\z\ace\addons\main\script_macros.hpp" + + +#define NOINTERACTMENU_DURATION 5 diff --git a/addons/slideshow/stringtable.xml b/addons/slideshow/stringtable.xml index fa10700ffb..2cf707f024 100644 --- a/addons/slideshow/stringtable.xml +++ b/addons/slideshow/stringtable.xml @@ -3,55 +3,124 @@ Slideshow + Diaporama Pokaz slajdów + Vetítés + Apresentação de Slides + Слайд-шоу + Prezentace + Presentación de diapositivas This module allows you to set up slide-shows on different objects. One module per image list. Only objects with hiddenSelection 0 are supported. + Ce module permet d'afficher des diaporamas sur différents objets. Un module par liste d'image. Seul les objets avec le paramètre "HiddenSelection 0" sont supportés Ten moduł pozwala skonfigurować pokaz slajdów na różnych obiektach. Jeden moduł na jedną liste slajdów. Tylko obiekty z hiddenSelection 0 są wspierane. + Ez a modul lehetővé teszi a különböző objektumokon való vetítést. Egy modul/képlista. Csak "hiddenSelection 0"-t tartalmazó objektumok felelnek meg. + Este módulo permite que você monte apresentações de slides em diferentes objetos. Um módulo por lista de imagem. Somente objetos com hiddenSelection 0 são suportados. + Этот модуль позволяет вам устроить слайд-шоу на различных объектах. Один модуль на один список изображений. Поддерживаются только объекты с hiddenSelection 0. + Este módulo permite configurar una presentación de diapositivas en diferentes objetos. Un módulo por lista de imágenes. Sólo son soportados objetos con hiddenSelection 0. Objects + Objets Obiekty + Objektumok + Objetos + Объекты + Objekty + Objetos Object names (can also be synchronized objects) slide-show will be displayed on, separated by commas if multiple. Reference INFO for object support. + Nom d'objets (peuvent aussi être des objets synchronisés) sur lesquels les diaporamas vont être affichées, séparation par virgule si plusieurs. Nazwy obiektów (mogą to też być zsynchronizowane obiekty) na których pokaz slajdów zostanie pokazany, oddzielony przecinkiem jeżeli jest ich więcej niż 1. Sprawdź opis modułu aby dowiedzieć się jakie obiekty są wspierane przez moduł. + Objektum nevek (szinkronizált is lehet) amik a vetítésen megjelennek, több darab esetén vesszővel elválasztva. Objektumtámogatásért az INFO-t tekintsd meg. + Nomes dos objetos (também podem ser objetos sincronizados) em que a apresentação de slides será mostrada, separado por vírgulas se for mais de um. Referência INFO para suporte do objeto. + Имена объектов (так же могут использоваться синхронизированные объекты), на которых будет отображаться слайд-шоу, разделенные запятыми. Посмотрите описание, чтобы понять, какие объекты поддерживаются. + Los nombres de objetos (también pueden ser objetos sincronizados) de diapositivas se mostrarán en, separados por comas. Referencia INFO para el soporte del objeto. Controllers + Controleurs Kontroler + Vezérlők + Controles + Контроллеры + Controladores Controller object names, separated by commas if multiple. + Noms de controleur d'objets, séparation par virgule si plusieurs Nazwa obiektu - kontrolera, oddzielona przecinkami jeżeli jest ich więcej niż 1. + Vezérlő objektum nevek, vesszővel elválasztva több darab esetén. + Nome dos objetos de controle, separado por vírgula se mais de um. + Имена объектов-контроллеров, разделенные запятыми. + Nombres de objeto de controlador, separados por comas. Images + Images Obrazy + Képek + Imagens + Изображения + Obrázky + Imágenes List of images that will be used for the slide-show, separated by commas, with full path correctly formatted (eg. images\image.paa). + Liste d'images qui seront utilisées dans des diaporama, séparation par virgule, avec le chemin d'accès complet et formaté correctement (ie. images\image.paa) Lista obrazów, które zostaną użyte do pokazu slajdów, oddzielone przecinkiem, z poprawnym pełnym formatem ścieżki do obrazka (np. slajdy\obrazek.paa). + A képek listája amit a vetítés használni fog, vesszővel elválasztva, megfelelően formázott teljes útvonallal (pl. képek\kép.paa) + Lista das imagens que serão utilizadas na apresentação de slides, separadas por vírgula, com o caminho completo corretamente formatado (ex: imagens\imagem.paa). + Список изображений, которые будут использованы для слайд-шоу, разделенные запятыми, с полными путями в правильном формате (например, images\image.paa). + Lista de imágenes que se utilizarán para la presentación de diapositivas, separadas por comas, con la ruta completa en formato correcto (ej. imágenes\image.paa). Interaction Names + Noms d'interaction Nazwy interakcji + Interakciós nevek + Nomes de Interação + Интерактивные имена + Názvy Interakcí + Nombres de interacción List of names that will be used for interaction entries, separated by commas, in order of images. + Liste de nom qui seront utilisés pour des interactions, séparation par virgule, dans l'ordre des images Lista nazw, które zostaną użyte do nazwania wpisów interakcji, oddzielone przecinkiem, w kolejności obrazów. + Olyan nevek listája, melyek interakciós célra kellenek, vesszővel elválasztva, kép szerinti sorrendben. + Lista dos nomes que serão usados para entradas de interação, separados por vírgulas, na ordem das imagens. + Список имен, которые будут использованы при взаимодействии, разделенные запятыми, в порядке следования изображений. + Lista de nombres que se utilizarán para las entradas de interacción, separados por comas, en el orden de las imágenes. Slide Duration + Durée d'une diapositive Czas trwania slajdów + Dia időtartam + Duração do Slide + Длительность слайда + Duración de diapositiva Duration of each slide. Default: 0 (Automatic Transitions Disabled) + Durée de chaque diapositive. Dafaut: 0 (transition automatique désactivée) Czas trwania poszczególnych slajdów. Domyślnie: 0 (Automatyczne przejścia wyłączone) + A diák időtartama. Alapértelmezett: 0 (Automatikus váltás letiltva) + Duração de cada slide. Padrão: 0 (Transição automática desabilitada) + Длительность каждого слайда. По-умолчанию: 0 (автоматический переход отключен) + Duración de cada diapositiva. Por defecto: 0 (Transiciones automáticas desactivadas) Slides + Diapositives Slajdy + Diák + Slides + Слайды + Diapositivas - \ No newline at end of file + diff --git a/addons/spectator/$PBOPREFIX$ b/addons/spectator/$PBOPREFIX$ new file mode 100644 index 0000000000..42fe4034e9 --- /dev/null +++ b/addons/spectator/$PBOPREFIX$ @@ -0,0 +1 @@ +z\ace\addons\spectator \ No newline at end of file diff --git a/addons/spectator/ACE_Settings.hpp b/addons/spectator/ACE_Settings.hpp new file mode 100644 index 0000000000..78402cff23 --- /dev/null +++ b/addons/spectator/ACE_Settings.hpp @@ -0,0 +1,22 @@ +class ACE_Settings { + class GVAR(filterUnits) { + typeName = "SCALAR"; + value = 2; + values[] = {CSTRING(units_none), CSTRING(units_players), CSTRING(units_playable), CSTRING(units_all)}; + }; + class GVAR(filterSides) { + typeName = "SCALAR"; + value = 0; + values[] = {CSTRING(sides_player), CSTRING(sides_friendly), CSTRING(sides_hostile), CSTRING(sides_all)}; + }; + class GVAR(restrictModes) { + typeName = "SCALAR"; + value = 0; + values[] = {CSTRING(modes_all), CSTRING(modes_unit), CSTRING(modes_free), CSTRING(modes_internal), CSTRING(modes_external)}; + }; + class GVAR(restrictVisions) { + typeName = "SCALAR"; + value = 0; + values[] = {CSTRING(modes_all), CSTRING(visions_nv), CSTRING(visions_ti), "$STR_Special_None"}; + }; +}; diff --git a/addons/spectator/CfgEventHandlers.hpp b/addons/spectator/CfgEventHandlers.hpp new file mode 100644 index 0000000000..e75956f440 --- /dev/null +++ b/addons/spectator/CfgEventHandlers.hpp @@ -0,0 +1,11 @@ +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)); + }; +}; diff --git a/addons/spectator/CfgVehicles.hpp b/addons/spectator/CfgVehicles.hpp new file mode 100644 index 0000000000..f6869462ac --- /dev/null +++ b/addons/spectator/CfgVehicles.hpp @@ -0,0 +1,117 @@ +class CfgVehicles { + class ACE_Module; + class GVAR(moduleSettings): ACE_Module { + scope = 2; + displayName = CSTRING(Settings_DisplayName); + icon = PATHTOF(UI\Icon_Module_Spectator_ca.paa); + category = "ACE"; + function = QFUNC(moduleSpectatorSettings); + isGlobal = 1; + author = ECSTRING(common,ACETeam); + class Arguments { + class unitsFilter { + displayName = CSTRING(units_DisplayName); + description = CSTRING(units_Description); + typeName = "NUMBER"; + class values { + class none { + name = CSTRING(units_none); + value = 0; + }; + class players { + name = CSTRING(units_players); + value = 1; + }; + class playable { + name = CSTRING(units_playable); + value = 2; + default = 1; + }; + class all { + name = CSTRING(units_all); + value = 3; + }; + }; + }; + class sidesFilter { + displayName = CSTRING(sides_DisplayName); + description = CSTRING(sides_Description); + typeName = "NUMBER"; + class values { + class player { + name = CSTRING(sides_player); + value = 0; + default = 1; + }; + class friendly { + name = CSTRING(sides_friendly); + value = 1; + }; + class hostile { + name = CSTRING(sides_hostile); + value = 2; + }; + class all { + name = CSTRING(sides_all); + value = 3; + }; + }; + }; + class cameraModes { + displayName = CSTRING(modes_DisplayName); + description = CSTRING(modes_Description); + typeName = "NUMBER"; + class values { + class all { + name = CSTRING(modes_all); + value = 0; + default = 1; + }; + class unit { + name = CSTRING(modes_unit); + value = 1; + }; + class free { + name = CSTRING(modes_free); + value = 2; + }; + class internal { + name = CSTRING(modes_internal); + value = 3; + }; + class external { + name = CSTRING(modes_external); + value = 4; + }; + }; + }; + class visionModes { + displayName = CSTRING(visions_DisplayName); + description = CSTRING(visions_Description); + typeName = "NUMBER"; + class values { + class all { + name = CSTRING(modes_all); + value = 0; + default = 1; + }; + class nv { + name = CSTRING(visions_nv); + value = 1; + }; + class ti { + name = CSTRING(visions_ti); + value = 2; + }; + class none { + name = "$STR_Special_None"; + value = 3; + }; + }; + }; + }; + class ModuleDescription { + description = CSTRING(Settings_Description); + }; + }; +}; diff --git a/addons/spectator/README.md b/addons/spectator/README.md new file mode 100644 index 0000000000..b827bdcc49 --- /dev/null +++ b/addons/spectator/README.md @@ -0,0 +1,14 @@ +ace_spectator +======= + +A flexible spectator framework for mission makers to use. + +Includes a public API for integration into custom respawn frameworks and a template for use with the vanilla respawn framework. + +For more information, see: http://ace3mod.com/wiki/feature/spectator.html + +## Maintainers + +The people responsible for merging changes to this component or answering potential questions. + +- [SilentSpike](https://github.com/SilentSpike) diff --git a/addons/spectator/UI/Icon_Module_Spectator_ca.paa b/addons/spectator/UI/Icon_Module_Spectator_ca.paa new file mode 100644 index 0000000000..97258bb0d0 Binary files /dev/null and b/addons/spectator/UI/Icon_Module_Spectator_ca.paa differ diff --git a/addons/spectator/UI/interface.hpp b/addons/spectator/UI/interface.hpp new file mode 100644 index 0000000000..e8bc6c210f --- /dev/null +++ b/addons/spectator/UI/interface.hpp @@ -0,0 +1,255 @@ +// Temporary fix until BI take care of it +class RscFrame { + x = 0; + y = 0; + w = 0; + h = 0; +}; + + +class RscButtonMenu; +class RscControlsGroupNoScrollbars; +//class RscFrame; +class RscListBox; +class RscMapControl; +class RscPicture; +class RscText; +class RscTree; + +class GVAR(interface) { + idd = 12249; + enableSimulation = 1; + movingEnable = 0; + onLoad = QUOTE([ARR_2('onLoad',_this)] call FUNC(handleInterface)); + onUnload = QUOTE([ARR_2('onUnload',_this)] call FUNC(handleInterface)); + onKeyDown = QUOTE([ARR_2('onKeyDown',_this)] call FUNC(handleInterface)); + onKeyUp = QUOTE([ARR_2('onKeyUp',_this)] call FUNC(handleInterface)); + class controlsBackground { + class mouseHandler: RscControlsGroupNoScrollbars { + x = safeZoneXAbs; + y = safeZoneY; + w = safeZoneWAbs; + h = safeZoneH; + onMouseButtonDown = QUOTE([ARR_2('onMouseButtonDown',_this)] call FUNC(handleInterface)); + onMouseButtonUp = QUOTE([ARR_2('onMouseButtonUp',_this)] call FUNC(handleInterface)); + onMouseZChanged = QUOTE([ARR_2('onMouseZChanged',_this)] call FUNC(handleInterface)); + onMouseMoving = QUOTE([ARR_2('onMouseMoving',_this)] call FUNC(handleInterface)); + onMouseHolding = QUOTE([ARR_2('onMouseMoving',_this)] call FUNC(handleInterface)); + }; + }; + class controls { + class compass: RscControlsGroupNoScrollbars { + idc = IDC_COMP; + x = COMPASS_X; + y = safeZoneY; + w = COMPASS_W; + h = TOOL_H; + class controls { + class compassBack: RscText { + x = 0; + y = 0; + w = COMPASS_W; + h = TOOL_H; + colorBackground[] = {COL_BACK}; + }; + class compass0_90: RscPicture { + idc = IDC_COMP_0; + x = COMPASS_W * 0.5; + y = 0; + w = COMPASS_W * 0.5; + h = TOOL_H; + text = "A3\UI_F_Curator\Data\CfgIngameUI\compass\texture180_ca.paa"; + }; + class compass90_180: compass0_90 { + idc = IDC_COMP_90; + x = COMPASS_W; + text = "A3\UI_F_Curator\Data\CfgIngameUI\compass\texture270_ca.paa"; + }; + class compass180_270: compass0_90 { + idc = IDC_COMP_180; + x = 0; + text = "A3\UI_F_Curator\Data\CfgIngameUI\compass\texture0_ca.paa"; + }; + class compass270_0: compass0_90 { + idc = IDC_COMP_270; + x = COMPASS_W * -0.5; + text = "A3\UI_F_Curator\Data\CfgIngameUI\compass\texture90_ca.paa"; + }; + class compassCaret: RscFrame { + x = COMPASS_W * 0.5; + y = 0; + w = 0; + h = TOOL_H; + colorText[] = {COL_FORE}; + }; + class compassFrame: compassBack { + style = 64; + shadow=2; + colorText[] = {COL_FORE}; + }; + }; + }; + class toolbar: RscControlsGroupNoScrollbars { + idc = IDC_TOOL; + x = safeZoneX; + y = safeZoneY + safeZoneH - TOOL_H; + w = safeZoneW; + h = TOOL_H; + class controls { + class nameTool: RscText { + idc = IDC_TOOL_NAME; + style = 2; + x = 0; + y = 0; + w = TOOL_W * 2; + h = TOOL_H; + shadow = 2; + colorText[]={COL_FORE}; + colorBackground[] = {COL_BACK}; + sizeEx = H_PART(1); + }; + class nameFrame: nameTool { + idc = -1; + style = 64; + }; + class viewTool: nameTool { + idc = IDC_TOOL_VIEW; + x = TOOL_W * 2 + MARGIN; + w = TOOL_W; + }; + class viewFrame: viewTool { + idc = -1; + style = 64; + }; + class visionTool: viewTool { + idc = IDC_TOOL_VISION; + x = TOOL_W * 3 + MARGIN * 2; + }; + class visionFrame: visionTool { + idc = -1; + style = 64; + }; + class clockTool: viewTool { + idc = IDC_TOOL_CLOCK; + x = safeZoneW - TOOL_W * 3 - MARGIN * 2; + }; + class clockFrame: clockTool { + idc = -1; + style = 64; + }; + class zoomTool: viewTool { + idc = IDC_TOOL_FOV; + x = safeZoneW - TOOL_W * 2 - MARGIN; + }; + class zoomFrame: zoomTool { + idc = -1; + style = 64; + }; + class speedTool: viewTool { + idc = IDC_TOOL_SPEED; + x = safeZoneW - TOOL_W; + }; + class speedFrame: speedTool { + idc = -1; + style = 64; + }; + }; + }; + class unitWindow: RscControlsGroupNoScrollbars { + idc = IDC_UNIT; + x = safeZoneX; + y = safeZoneY + TOOL_H * 6; + w = TOOL_W * 2; + h = safeZoneH - TOOL_H * 13; + class controls { + class unitTitle: RscText { + x = 0; + y = 0; + w = TOOL_W * 2; + h = H_PART(1); + style = 2; + colorText[] = {COL_FORE}; + colorBackground[] = {COL_FORE_D}; + sizeEx = H_PART(1); + text = CSTRING(UnitTitle); + }; + class unitTree: RscTree { + idc = IDC_UNIT_TREE; + x = 0; + y = H_PART(1); + w = TOOL_W * 2; + h = safeZoneH - TOOL_H * 14; + sizeEx = H_PART(0.8); + colorText[] = {COL_FORE}; + colorBorder[] = {0,0,0,0}; + colorBackground[] = {COL_BACK}; + colorSelect[] = { + "profilenamespace getvariable ['GUI_BCG_RGB_R',0.77]", + "profilenamespace getvariable ['GUI_BCG_RGB_G',0.51]", + "profilenamespace getvariable ['GUI_BCG_RGB_B',0.08]", + 1 + }; + multiselectEnabled = 0; + onTreeDblClick = QUOTE([ARR_2('onTreeDblClick',_this)] call FUNC(handleInterface)); + onTreeSelChanged = QUOTE([ARR_2('onTreeSelChanged',_this)] call FUNC(handleInterface)); + }; + class unitFrame: RscFrame { + x = 0; + y = 0; + w = TOOL_W * 2; + h = safeZoneH - TOOL_H * 13; + shadow = 2; + colorText[] = {COL_FORE}; + }; + }; + }; + class helpWindow: RscControlsGroupNoScrollbars { + idc = IDC_HELP; + x = safeZoneX + safeZoneW - TOOL_W * 2; + y = safeZoneY + TOOL_H * 6; + w = TOOL_W * 2; + h = safeZoneH - TOOL_H * 13; + class controls { + class helpTitle: RscText { + x = 0; + y = 0; + w = TOOL_W * 2; + h = H_PART(1); + style = 2; + colorText[] = {COL_FORE}; + colorBackground[] = {COL_FORE_D}; + sizeEx = H_PART(1); + text = CSTRING(HelpTitle); + }; + class helpContent: RscListBox { + idc = IDC_HELP_LIST; + x = 0; + y = H_PART(1); + w = TOOL_W * 2; + h = safeZoneH - TOOL_H * 14; + colorBackground[] = {COL_BACK}; + sizeEx = H_PART(0.8); + default = 1; + }; + class helpFrame: RscFrame { + x = 0; + y = 0; + w = TOOL_W * 2; + h = safeZoneH - TOOL_H * 13; + shadow = 2; + colorText[] = {COL_FORE}; + }; + }; + }; + class mapOverlay: RscMapControl { + idc = IDC_MAP; + type = 100; + x = safeZoneX; + y = safeZoneY; + w = safeZoneW; + h = safeZoneH; + onMouseButtonDown = QUOTE([ARR_2('onMapClick',_this)] call FUNC(handleInterface)); + onDraw = QUOTE(_this call FUNC(handleMap)); + }; + }; +}; diff --git a/addons/spectator/XEH_postInit.sqf b/addons/spectator/XEH_postInit.sqf new file mode 100644 index 0000000000..35b463837f --- /dev/null +++ b/addons/spectator/XEH_postInit.sqf @@ -0,0 +1,10 @@ +#include "script_component.hpp" +//#include "initKeybinds.sqf"; + +// Add interaction menu exception +["isNotSpectating", {!(GETVAR((_this select 0),GVAR(isStaged),false))}] call EFUNC(common,addCanInteractWithCondition); + +["SettingsInitialized", { + GVAR(availableModes) = [[0,1,2], [1,2], [0], [1], [2]] select GVAR(restrictModes); + GVAR(availableVisions) = [[-2,-1,0,1], [-2,-1], [-2,0,1], [-2]] select GVAR(restrictVisions); +}] call EFUNC(common,addEventHandler); diff --git a/addons/spectator/XEH_preInit.sqf b/addons/spectator/XEH_preInit.sqf new file mode 100644 index 0000000000..e26dc27d07 --- /dev/null +++ b/addons/spectator/XEH_preInit.sqf @@ -0,0 +1,60 @@ +#include "script_component.hpp" + +ADDON = false; + +PREP(cacheUnitInfo); +PREP(cycleCamera); +PREP(handleCamera); +PREP(handleCompass); +PREP(handleIcons); +PREP(handleInterface); +PREP(handleMap); +PREP(handleMouse); +PREP(handleToolbar); +PREP(handleUnits); +PREP(interrupt); +PREP(moduleSpectatorSettings); +PREP(respawnTemplate); +PREP(setCameraAttributes); +PREP(setSpectator); +PREP(stageSpectator); +PREP(transitionCamera); +PREP(toggleInterface); +PREP(updateCameraModes); +PREP(updateSpectatableSides); +PREP(updateUnits); +PREP(updateVisionModes); + +// Permanent variables +GVAR(availableModes) = [0,1,2]; +GVAR(availableSides) = [west,east,resistance,civilian]; +GVAR(availableVisions) = [-2,-1,0,1]; + +GVAR(camAgent) = objNull; +GVAR(camDistance) = 10; +GVAR(camMode) = 0; +GVAR(camPan) = 0; +GVAR(camPos) = ATLtoASL [worldSize * 0.5, worldSize * 0.5, 20]; +GVAR(camSpeed) = 2.5; +GVAR(camTilt) = -10; +GVAR(camUnit) = objNull; +GVAR(camVision) = -2; +GVAR(camZoom) = 1.25; + +GVAR(interrupts) = []; +GVAR(isSet) = false; + +GVAR(showComp) = true; +GVAR(showHelp) = true; +GVAR(showIcons) = true; +GVAR(showInterface) = true; +GVAR(showMap) = false; +GVAR(showTool) = true; +GVAR(showUnit) = true; + +GVAR(unitList) = []; +GVAR(unitBlacklist) = []; +GVAR(unitWhitelist) = []; +GVAR(groupList) = []; + +ADDON = true; diff --git a/addons/spectator/config.cpp b/addons/spectator/config.cpp new file mode 100644 index 0000000000..6e32ed0413 --- /dev/null +++ b/addons/spectator/config.cpp @@ -0,0 +1,25 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"ace_common"}; + author[] = {"F3 Project","Head","SilentSpike","voiper"}; + authorUrl = "https://github.com/acemod"; + VERSION_CONFIG; + }; +}; + +#include "ACE_Settings.hpp" +#include "CfgEventHandlers.hpp" +#include "CfgVehicles.hpp" +#include "ui\interface.hpp" + +class CfgRespawnTemplates { + class ADDON { + onPlayerKilled = QFUNC(respawnTemplate); + onPlayerRespawn = QFUNC(respawnTemplate); + }; +}; diff --git a/addons/spectator/functions/fnc_cacheUnitInfo.sqf b/addons/spectator/functions/fnc_cacheUnitInfo.sqf new file mode 100644 index 0000000000..9f40651748 --- /dev/null +++ b/addons/spectator/functions/fnc_cacheUnitInfo.sqf @@ -0,0 +1,38 @@ +/* + * Author: SilentSpike + * Caches the units information for quick retrevial in spectator interface PFHs + * + * Arguments: + * 0: Unit to have info cached for + * + * Return Value: + * None + * + * Example: + * [vehicle player] call ace_spectator_fnc_cacheUnitInfo + * + * Public: No + */ + +#include "script_component.hpp" + +params ["_unit"]; +private ["_color","_icon","_name"]; + +// Group info only needs to be cached once (groups can't change) +if (isNil { GETVAR((group _unit),GVAR(gColor),nil) }) then { + _color = [side group _unit] call BIS_fnc_sideColor; + SETVAR((group _unit),GVAR(gColor),_color); +}; + +// Unit info should be updated each time +_icon = getText (configFile >> "CfgVehicles" >> typeOf _unit >> "Icon"); +_name = [_unit,false] call EFUNC(common,getName); + +// Handle CfgVehicleIcons +if (isText (configFile >> "CfgVehicleIcons" >> _icon)) then { + _icon = getText (configFile >> "CfgVehicleIcons" >> _icon); +}; + +SETVAR(_unit,GVAR(uIcon),_icon); +SETVAR(_unit,GVAR(uName),_name); diff --git a/addons/spectator/functions/fnc_cycleCamera.sqf b/addons/spectator/functions/fnc_cycleCamera.sqf new file mode 100644 index 0000000000..474d25cd0c --- /dev/null +++ b/addons/spectator/functions/fnc_cycleCamera.sqf @@ -0,0 +1,58 @@ +/* + * Author: SilentSpike + * Cycle through the spectator camera vision/view/units in steps + * + * Arguments: + * 0: Camera mode steps + * 1: Camera unit steps + * 2: Vision mode steps + * + * Return Value: + * None + * + * Example: + * [0, -1] call ace_spectator_fnc_cycleCamera + * + * Public: No + */ + +#include "script_component.hpp" + +params [["_stepMode",0], ["_stepUnit",0], ["_stepVision",0]]; +private ["_modes","_visions","_iMode","_iVision","_countModes","_countVisions","_newMode","_newVision","_newUnit"]; + +_modes = GVAR(availableModes); +_units = GVAR(unitList); +_visions = GVAR(availableVisions); + +// Get current index +_iMode = (_modes find GVAR(camMode)) max 0; +_iUnit = (_units find GVAR(camUnit)) max 0; +_iVision = (_visions find GVAR(camVision)) max 0; + +_countModes = count _modes; +_countUnits = count _units; +_countVisions = count _visions; + +// Step index by step number (loop at ends) +if (_countModes != 0) then { + _iMode = (_iMode + _stepMode) % _countModes; + if (_iMode < 0) then { _iMode = _countModes + _iMode; }; +}; + +if (_countUnits != 0) then { + _iUnit = (_iUnit + _stepUnit) % _countUnits; + if (_iUnit < 0) then { _iUnit = _countUnits + _iUnit; }; +}; + +if (_countVisions != 0) then { + _iVision = (_iVision + _stepVision) % _countVisions; + if (_iVision < 0) then { _iVision = _countVisions + _iVision; }; +}; + +// Get value at new index +_newMode = _modes select _iMode; +_newUnit = _units select _iUnit; +_newVision = _visions select _iVision; + +[_newMode, _newUnit, _newVision] call FUNC(transitionCamera); diff --git a/addons/spectator/functions/fnc_handleCamera.sqf b/addons/spectator/functions/fnc_handleCamera.sqf new file mode 100644 index 0000000000..f07ac6da47 --- /dev/null +++ b/addons/spectator/functions/fnc_handleCamera.sqf @@ -0,0 +1,75 @@ +/* + * Author: F3 Project, Head, SilentSpike + * Handles free camera manipulation according to input + * + * Arguments: + * 0: Parameters + * 1: PFH handle + * + * Return Value: + * None + * + * Example: + * [ace_spectator_fnc_handleCamera, 0] call CBA_fnc_addPerFrameHandler; + * + * Public: No + */ + +#include "script_component.hpp" + +// Kill PFH when not in free cam (or display is closed) +if (isNil QGVAR(camHandler)) exitWith { [_this select 1] call CBA_fnc_removePerFrameHandler; }; + +private ["_camera","_pan","_tilt"]; + +_pan = (GVAR(camPan) + 360) % 360; +_tilt = GVAR(camTilt); + +if (GVAR(camMode) == 0) then { + private ["_oldPos","_altMod","_zoomMod","_mX","_mY","_mZ","_x","_y","_z"]; + _camera = GVAR(freeCamera); + _oldPos = GVAR(camPos); + + // Dolly/Boom amount should be influnced by zoom level (it should really be exponential) + // Dollying should also slow as the camera gets close to the ground + _zoomMod = (GVAR(camZoom) * 0.8) max 1; + _altMod = ((((getPos _camera) select 2) * 0.05) max 0.1) min 1; + + _mX = (GVAR(camDolly) select 0) * _altMod / _zoomMod; + _mY = (GVAR(camDolly) select 1) * _altMod / _zoomMod; + _mZ = GVAR(camBoom) / _zoomMod; + + _x = (_oldPos select 0) + (_mX * cos(_pan)) + (_mY * sin(_pan)); + _y = (_oldPos select 1) - (_mX * sin(_pan)) + (_mY * cos(_pan)); + _z = (_oldPos select 2) + _mZ; + + // Prevent camera going under terrain + GVAR(camPos) = [_x,_y,_z max (getTerrainHeightASL [_x,_y])]; + + // Update camera position and rotation + _camera setPosASL GVAR(camPos); + _camera setDir _pan; + [_camera, _tilt, 0] call BIS_fnc_setPitchBank; +} else { + private ["_unit","_target","_distance","_vector"]; + _camera = GVAR(unitCamera); + + _unit = GVAR(camUnit); + _target = GVAR(targetCamera); + _distance = GVAR(camDistance); + + // Generate a position vector relative to the unit + _vector = [0,-_distance*cos(_tilt),0]; + _vector = [_vector,[-_pan] call CBA_fnc_simplifyAngle180] call BIS_fnc_rotateVector2D; + _vector = _vector vectorAdd [0,0,_distance*sin(-_tilt)]; + + // Update the position of the target camera (used for smooth unit tracking) + _target camSetPos ((_unit modelToWorldVisual [0,0,0]) vectorAdd [0,0,1.5]); + _target camCommit 0; + + // Update the relative position of the unit camera + _camera camSetRelPos _vector; + _camera camCommit 0; + + GVAR(camPos) = getPosASL _camera; +}; diff --git a/addons/spectator/functions/fnc_handleCompass.sqf b/addons/spectator/functions/fnc_handleCompass.sqf new file mode 100644 index 0000000000..a65cc9ddce --- /dev/null +++ b/addons/spectator/functions/fnc_handleCompass.sqf @@ -0,0 +1,67 @@ +/* + * Author: SilentSpike, voiper + * Handles the spectator UI compass + * + * Arguments: + * 0: Parameters + * 1: PFH handle + * + * Return Value: + * None + * + * Example: + * [ace_spectator_fnc_handleCompass, 0, _display] call CBA_fnc_addPerFrameHandler; + * + * Public: No + */ + +#include "script_component.hpp" + +params ["_display"]; + +// Kill PFH when compass hidden (or display is closed) +if (isNil QGVAR(compHandler)) exitWith { [_this select 1] call CBA_fnc_removePerFrameHandler; }; + +private ["_compass","_NE","_ES","_SW","_WN","_compassW","_degree","_heading","_offset","_positions","_sequence"]; + +_compass = _display displayCtrl IDC_COMP; + +_NE = _compass controlsGroupCtrl IDC_COMP_0; +_ES = _compass controlsGroupCtrl IDC_COMP_90; +_SW = _compass controlsGroupCtrl IDC_COMP_180; +_WN = _compass controlsGroupCtrl IDC_COMP_270; + +_compassW = (ctrlPosition _compass) select 2; +_degree = _compassW / 180; + +// Get direction of screen rather than object (accounts for unit freelook) +_heading = (positionCameraToWorld [0,0,1]) vectorDiff (positionCameraToWorld [0,0,0]); +_heading = (((_heading select 0) atan2 (_heading select 1)) + 360) % 360; +_offset = -(_heading % 90) * _degree; + +_positions = [ + [_compassW * -0.5 + _offset, 0], + [_offset, 0], + [_compassW * 0.5 + _offset, 0], + [_compassW + _offset, 0] +]; + +_sequence = if (_heading < 90) then { + [_SW, _WN, _NE, _ES] +} else { + if (_heading < 180) then { + [_WN, _NE, _ES, _SW] + } else { + if (_heading < 270) then { + [_NE, _ES, _SW, _WN] + } else { + [_ES, _SW, _WN, _NE] + }; + }; +}; + + +{ + _x ctrlSetPosition (_positions select _forEachIndex); + _x ctrlCommit 0; +} forEach _sequence; diff --git a/addons/spectator/functions/fnc_handleIcons.sqf b/addons/spectator/functions/fnc_handleIcons.sqf new file mode 100644 index 0000000000..d1f83690ff --- /dev/null +++ b/addons/spectator/functions/fnc_handleIcons.sqf @@ -0,0 +1,46 @@ +/* + * Author: Head, SilentSpike + * Handles rendering the spectator 3D unit icons + * + * Arguments: + * 0: Parameters + * 1: PFH handle + * + * Return Value: + * None + * + * Example: + * [ace_spectator_fnc_handleIcons, 0] call CBA_fnc_addPerFrameHandler; + * + * Public: No + */ + +#include "script_component.hpp" + +if !(GVAR(showIcons)) exitWith {}; +private ["_refPoint","_drawVehicles","_leader","_color","_txt","_unit"]; + +// Draw groups unless leader is within distance +_refPoint = [GVAR(freeCamera),GVAR(camUnit)] select (GVAR(camMode) > 0); +_drawVehicles = []; +{ + _leader = leader _x; + if ((_leader distanceSqr _refPoint) > 40000) then { + _color = GETVAR(_x,GVAR(gColor),[ARR_4(0,0,0,0)]); + _txt = groupID _x; + + drawIcon3D ["\A3\ui_f\data\map\markers\nato\b_inf.paa", _color, _leader modelToWorldVisual [0,0,30], 1, 1, 0, _txt, 2, 0.02]; + } else { + _drawVehicles append (units _x); + }; + false +} count GVAR(groupList); + +// Draw units for groups within distance +{ + _color = GETVAR((group _x),GVAR(gColor),[ARR_4(0,0,0,0)]); + _txt = ["", GETVAR(_x,GVAR(uName),"")] select (isPlayer _x); + + drawIcon3D ["\A3\ui_f\data\map\markers\military\dot_CA.paa", _color, _x modelToWorldVisual [0,0,3], 0.7, 0.7, 0, _txt, 1, 0.02]; + false +} count (_drawVehicles arrayIntersect GVAR(unitList)); diff --git a/addons/spectator/functions/fnc_handleInterface.sqf b/addons/spectator/functions/fnc_handleInterface.sqf new file mode 100644 index 0000000000..7c961071c3 --- /dev/null +++ b/addons/spectator/functions/fnc_handleInterface.sqf @@ -0,0 +1,498 @@ +/* + * Author: SilentSpike + * Handles spectator interface events + * + * Arguments: + * 0: Event name + * 1: Event arguments + * + * Return Value: + * None + * + * Example: + * ["onLoad",_this] call ace_spectator_fnc_handleInterface + * + * Public: No + */ + +#include "script_component.hpp" + +params ["_mode",["_args",[]]]; + +switch (toLower _mode) do { + case "onload": { + _args params ["_display"]; + + // Always show interface and hide map upon opening + [_display,nil,nil,!GVAR(showInterface),GVAR(showMap)] call FUNC(toggleInterface); + + // Keep unit list and tree up to date + [FUNC(handleUnits), 21, _display] call CBA_fnc_addPerFrameHandler; + + // Handle 3D unit icons + GVAR(iconHandler) = addMissionEventHandler ["Draw3D",FUNC(handleIcons)]; + + // Populate the help window + private "_help"; + _help = (_display displayCtrl IDC_HELP) controlsGroupCtrl IDC_HELP_LIST; + { + _i = _help lbAdd (_x select 0); + if ((_x select 1) == "") then { + _help lbSetPicture [_i,"\A3\ui_f\data\map\markers\military\dot_CA.paa"]; + _help lbSetPictureColor [_i,[COL_FORE]]; + } else { + _help lbSetTooltip [_i,_x select 1]; + }; + } forEach [ + [localize LSTRING(uiControls),""], + [localize LSTRING(uiToggleUnits),"1"], + [localize LSTRING(uiToggleHelp),"2"], + [localize LSTRING(uiToggleTools),"3"], + [localize LSTRING(uiToggleCompass),"4"], + [localize LSTRING(uiToggleIcons),"5"], + [localize LSTRING(uiToggleMap),"M"], + [localize LSTRING(uiToggleInterface),"Backspace"], + [localize LSTRING(freeCamControls),""], + [localize LSTRING(freeCamForward),"W"], + [localize LSTRING(freeCamBackward),"S"], + [localize LSTRING(freeCamLeft),"A"], + [localize LSTRING(freeCamRight),"D"], + [localize LSTRING(freeCamUp),"Q"], + [localize LSTRING(freeCamDown),"Z"], + [localize LSTRING(freeCamPan),"RMB (Hold)"], + [localize LSTRING(freeCamDolly),"LMB (Hold)"], + [localize LSTRING(freeCamBoost),"Shift (Hold)"], + [localize LSTRING(freeCamFocus),"F"], + [localize LSTRING(attributeControls),""], + [localize LSTRING(nextCam),"Up Arrow"], + [localize LSTRING(prevCam),"Down Arrow"], + [localize LSTRING(nextUnit),"Right Arrow"], + [localize LSTRING(prevUnit),"Left Arrow"], + [localize LSTRING(nextVis),"N"], + [localize LSTRING(prevVis),"Ctrl + N"], + [localize LSTRING(adjZoom),"Scrollwheel"], + [localize LSTRING(adjSpeed),"Ctrl + Scrollwheel"], + [localize LSTRING(incZoom),"Num-/Num+"], + [localize LSTRING(incSpeed),"Ctrl + Num-/Num+"], + [localize LSTRING(reZoom),"Alt + Num-"], + [localize LSTRING(reSpeed),"Alt + Num+"] + ]; + + // Handle support for BI's respawn counter + [{ + if !(isNull (GETUVAR(RscRespawnCounter,displayNull))) then { + disableSerialization; + private ["_counter","_title","_back","_timer","_frame","_x","_y"]; + _counter = GETUVAR(RscRespawnCounter,displayNull); + _title = _counter displayCtrl 1001; + _back = _counter displayCtrl 1002; + _timer = _counter displayCtrl 1003; + _frame = _counter ctrlCreate ["RscFrame",1008]; + + _x = safeZoneX + safeZoneW - TOOL_W * 4 - MARGIN * 3; + _y = safeZoneY + safeZoneH - TOOL_H; + + // Timer + _title ctrlSetPosition [_x,_y,TOOL_W,TOOL_H]; + _back ctrlSetPosition [_x,_y,TOOL_W,TOOL_H]; + _timer ctrlSetPosition [_x,_y,TOOL_W,TOOL_H]; + _frame ctrlSetPosition [_x,_y,TOOL_W,TOOL_H]; + + _title ctrlSetBackgroundColor [0,0,0,0]; + _back ctrlSetBackgroundColor [COL_BACK]; + _timer ctrlSetFontHeight TOOL_H; + _frame ctrlSetTextColor [COL_FORE]; + + _title ctrlCommit 0; + _back ctrlCommit 0; + _timer ctrlCommit 0; + _frame ctrlCommit 0; + }; + },[],0.5] call EFUNC(common,waitAndExecute); + }; + case "onunload": { + // Kill GUI PFHs + removeMissionEventHandler ["Draw3D",GVAR(iconHandler)]; + GVAR(camHandler) = nil; + GVAR(compHandler) = nil; + GVAR(iconHandler) = nil; + GVAR(toolHandler) = nil; + + // Reset variables + GVAR(camBoom) = 0; + GVAR(camDolly) = [0,0]; + GVAR(ctrlKey) = false; + GVAR(heldKeys) = []; + GVAR(heldKeys) resize 255; + GVAR(mouse) = [false,false]; + GVAR(mousePos) = [0.5,0.5]; + GVAR(treeSel) = objNull; + }; + // Mouse events + case "onmousebuttondown": { + _args params ["_ctrl","_button"]; + GVAR(mouse) set [_button,true]; + + // Detect right click + if ((_button == 1) && (GVAR(camMode) == 1)) then { + // In first person toggle sights mode + GVAR(camGun) = !GVAR(camGun); + [] call FUNC(transitionCamera); + }; + }; + case "onmousebuttonup": { + _args params ["_ctrl","_button"]; + + GVAR(mouse) set [_button,false]; + if (_button == 0) then { GVAR(camDolly) = [0,0]; }; + }; + case "onmousezchanged": { + _args params ["_ctrl","_zChange"]; + + // Scroll to modify distance value in third person + if (GVAR(camMode) == 0) then { + // Scroll to change speed, modifier for zoom + if (GVAR(ctrlKey)) then { + [nil,nil,nil,nil,nil,nil,nil, GVAR(camSpeed) + _zChange * 0.2] call FUNC(setCameraAttributes); + } else { + [nil,nil,nil,nil,nil,nil, GVAR(camZoom) + _zChange * 0.1] call FUNC(setCameraAttributes); + }; + } else { + GVAR(camDistance) = ((GVAR(camDistance) - _zChange * 2) max 5) min 50; + }; + }; + case "onmousemoving": { + _args params ["_ctrl","_x","_y"]; + + [_x,_y] call FUNC(handleMouse); + }; + // Keyboard events + case "onkeydown": { + _args params ["_display","_dik","_shift","_ctrl","_alt"]; + + if ((alive player) && {_dik in (actionKeys "curatorInterface")} && {!isNull (getAssignedCuratorLogic player)}) exitWith { + [QGVAR(zeus)] call FUNC(interrupt); + ["zeus"] call FUNC(handleInterface); + }; + if ((isServer || {serverCommandAvailable "#kick"}) && {_dik in (actionKeys "Chat" + actionKeys "PrevChannel" + actionKeys "NextChannel")}) exitWith { + false + }; + + // Handle held keys (prevent repeat calling) + if (GVAR(heldKeys) param [_dik,false]) exitwith {}; + // Exclude movement/adjustment keys so that speed can be adjusted on fly + if !(_dik in [16,17,30,31,32,44,74,78]) then { + GVAR(heldKeys) set [_dik,true]; + }; + + switch (_dik) do { + case 1: { // Esc + [QGVAR(escape)] call FUNC(interrupt); + ["escape"] call FUNC(handleInterface); + }; + case 2: { // 1 + [_display,nil,nil,nil,nil,nil,true] call FUNC(toggleInterface); + }; + case 3: { // 2 + [_display,nil,true] call FUNC(toggleInterface); + }; + case 4: { // 3 + [_display,nil,nil,nil,nil,true] call FUNC(toggleInterface); + }; + case 5: { // 4 + [_display,true] call FUNC(toggleInterface); + }; + case 6: { // 5 + GVAR(showIcons) = !GVAR(showIcons); + }; + case 14: { // Backspace + [_display,nil,nil,true] call FUNC(toggleInterface); + }; + case 16: { // Q + GVAR(camBoom) = 0.5 * GVAR(camSpeed) * ([1, 2] select _shift); + }; + case 17: { // W + GVAR(camDolly) set [1, GVAR(camSpeed) * ([1, 2] select _shift)]; + }; + case 29: { // Ctrl + GVAR(ctrlKey) = true; + }; + case 30: { // A + GVAR(camDolly) set [0, -GVAR(camSpeed) * ([1, 2] select _shift)]; + }; + case 31: { // S + GVAR(camDolly) set [1, -GVAR(camSpeed) * ([1, 2] select _shift)]; + }; + case 32: { // D + GVAR(camDolly) set [0, GVAR(camSpeed) * ([1, 2] select _shift)]; + }; + case 33: { // F + private ["_sel","_vector"]; + _sel = GVAR(treeSel); + if ((GVAR(camMode) == 0) && {!isNull _sel} && {_sel in GVAR(unitList)}) then { + _vector = (positionCameraToWorld [0,0,0]) vectorDiff (positionCameraToWorld [0,0,25]); + [nil,nil,nil,(getPosATL _sel) vectorAdd _vector] call FUNC(setCameraAttributes); + }; + }; + case 44: { // Z + GVAR(camBoom) = -0.5 * GVAR(camSpeed) * ([1, 2] select _shift); + }; + case 49: { // N + if (GVAR(camMode) == 0) then { + if (_ctrl) then { + [nil,nil,-1] call FUNC(cycleCamera); + } else { + [nil,nil,1] call FUNC(cycleCamera); + }; + }; + }; + case 50: { // M + [_display,nil,nil,nil,true] call FUNC(toggleInterface); + }; + case 57: { // Spacebar + // Freecam attachment here, if in external then set cam pos and attach + }; + case 74: { // Num - + if (_alt) exitWith { [nil,nil,nil,nil,nil,nil, 1.25] call FUNC(setCameraAttributes); }; + if (_ctrl) then { + [nil,nil,nil,nil,nil,nil,nil, GVAR(camSpeed) - 0.05] call FUNC(setCameraAttributes); + } else { + [nil,nil,nil,nil,nil,nil, GVAR(camZoom) - 0.01] call FUNC(setCameraAttributes); + }; + }; + case 78: { // Num + + if (_alt) exitWith { [nil,nil,nil,nil,nil,nil,nil, 2.5] call FUNC(setCameraAttributes); }; + if (_ctrl) then { + [nil,nil,nil,nil,nil,nil,nil, GVAR(camSpeed) + 0.05] call FUNC(setCameraAttributes); + } else { + [nil,nil,nil,nil,nil,nil, GVAR(camZoom) + 0.01] call FUNC(setCameraAttributes); + }; + }; + case 200: { // Up arrow + [-1] call FUNC(cycleCamera); + }; + case 203: { // Left arrow + [nil,1] call FUNC(cycleCamera); + }; + case 205: { // Right arrow + [nil,-1] call FUNC(cycleCamera); + }; + case 208: { // Down arrow + [1] call FUNC(cycleCamera); + }; + }; + + true + }; + case "onkeyup": { + _args params ["_display","_dik","_shift","_ctrl","_alt"]; + + // No longer being held + GVAR(heldKeys) set [_dik,nil]; + + switch (_dik) do { + case 16: { // Q + GVAR(camBoom) = 0; + }; + case 17: { // W + GVAR(camDolly) set [1, 0]; + }; + case 29: { // Ctrl + GVAR(ctrlKey) = false; + }; + case 30: { // A + GVAR(camDolly) set [0, 0]; + }; + case 31: { // S + GVAR(camDolly) set [1, 0]; + }; + case 32: { // D + GVAR(camDolly) set [0, 0]; + }; + case 44: { // Z + GVAR(camBoom) = 0; + }; + }; + + true + }; + // Tree events + case "ontreedblclick": { + // Update camera view when listbox unit is double clicked on + _args params ["_tree","_sel"]; + + // Ensure a unit was selected + if (count _sel == 3) then { + private ["_netID","_newUnit","_newMode"]; + _netID = (_args select 0) tvData _sel; + _newUnit = objectFromNetId _netID; + + // When unit is reselected, toggle camera mode + if (_newUnit == GVAR(camUnit) || GVAR(camMode) == 0) then { + _newMode = [2,2,1] select GVAR(camMode); + }; + + [_newMode,_newUnit] call FUNC(transitionCamera); + }; + }; + case "ontreeselchanged": { + _args params ["_tree","_sel"]; + + if (count _sel == 3) then { + GVAR(treeSel) = objectFromNetId (_tree tvData _sel); + } else { + GVAR(treeSel) = objNull; + }; + }; + case "onunitsupdate": { + _args params ["_tree"]; + private ["_cachedUnits","_cachedGrps","_cachedSides","_s","_g","_grp","_u","_unit","_side"]; + + // Cache existing group and side nodes and cull removed data + _cachedUnits = []; + _cachedGrps = []; + _cachedSides = []; + for "_s" from 0 to ((_tree tvCount []) - 1) do { + for "_g" from 0 to ((_tree tvCount [_s]) - 1) do { + _grp = groupFromNetID (_tree tvData [_s,_g]); + + if (_grp in GVAR(groupList)) then { + _cachedGrps pushBack _grp; + _cachedGrps pushBack _g; + + for "_u" from 0 to ((_tree tvCount [_s,_g])) do { + _unit = objectFromNetId (_tree tvData [_s,_g,_u]); + + if (_unit in GVAR(unitList)) then { + _cachedUnits pushBack _unit; + } else { + _tree tvDelete [_s,_g,_u]; + }; + }; + } else { + _tree tvDelete [_s,_g]; + }; + }; + + if ((_tree tvCount [_s]) > 0) then { + _cachedSides pushBack (_tree tvText [_s]); + _cachedSides pushBack _s; + } else { + _tree tvDelete [_s]; + }; + }; + + // Update the tree from the unit list + { + _grp = group _x; + _side = [side _grp] call BIS_fnc_sideName; + + // Use correct side node + if !(_side in _cachedSides) then { + // Add side node + _s = _tree tvAdd [[], _side]; + _tree tvExpand [_s]; + + _cachedSides pushBack _side; + _cachedSides pushBack _s; + } else { + // If side already processed, use existing node + _s = _cachedSides select ((_cachedSides find _side) + 1); + }; + + // Use correct group node + if !(_grp in _cachedGrps) then { + // Add group node + _g = _tree tvAdd [[_s], groupID _grp]; + _tree tvSetData [[_s,_g], netID _grp]; + + _cachedGrps pushBack _grp; + _cachedGrps pushBack _g; + } else { + // If group already processed, use existing node + _g = _cachedGrps select ((_cachedGrps find _grp) + 1); + }; + + _u = _tree tvAdd [[_s,_g], GETVAR(_x,GVAR(uName),"")]; + _tree tvSetData [[_s,_g,_u], netID _x]; + _tree tvSetPicture [[_s,_g,_u], GETVAR(_x,GVAR(uIcon),"")]; + _tree tvSetPictureColor [[_s,_g,_u], GETVAR(_grp,GVAR(gColor),[ARR_4(1,1,1,1)])]; + + _tree tvSort [[_s,_g],false]; + } forEach (GVAR(unitList) - _cachedUnits); + + _tree tvSort [[],false]; + + if ((_tree tvCount []) <= 0) then { + _tree tvAdd [[], localize LSTRING(units_none)]; + }; + }; + // Map events + case "onmapclick": { + _args params ["_map","_button","_x","_y","_shift","_ctrl","_alt"]; + private ["_newPos","_oldZ"]; + + if ((GVAR(camMode) == 0) && (_button == 0)) then { + _newPos = _map ctrlMapScreenToWorld [_x,_y]; + _oldZ = (ASLtoATL GVAR(camPos)) select 2; + _newPos set [2, _oldZ]; + [nil,nil,nil, _newPos] call FUNC(setCameraAttributes); + }; + }; + // Interrupt events + case "escape": { + private "_dlg"; + + createDialog (["RscDisplayInterrupt", "RscDisplayMPInterrupt"] select isMultiplayer); + + disableSerialization; + _dlg = finddisplay 49; + _dlg displayAddEventHandler ["KeyDown", { + _key = _this select 1; + !(_key == 1) + }]; + + // Disable save, respawn, options & manual buttons + (_dlg displayCtrl 103) ctrlEnable false; + if !(alive player) then { + (_dlg displayCtrl 1010) ctrlEnable false; + }; + (_dlg displayCtrl 101) ctrlEnable false; + (_dlg displayCtrl 122) ctrlEnable false; + + // Initalize abort button (the "spawn" is a necessary evil) + (_dlg displayCtrl 104) ctrlAddEventHandler ["ButtonClick",{_this spawn { + disableSerialization; + _display = ctrlparent (_this select 0); + _abort = [localize "str_msg_confirm_return_lobby",nil,localize "str_disp_xbox_hint_yes",localize "str_disp_xbox_hint_no",_display,nil,true] call BIS_fnc_guiMessage; + if (_abort) then {_display closeDisplay 2; failMission "loser"}; + }}]; + + // PFH to re-open display when menu closes + [{ + if !(isNull (findDisplay 49)) exitWith {}; + + // If still a spectator then re-enter the interface + [QGVAR(escape),false] call FUNC(interrupt); + + [_this select 1] call CBA_fnc_removePerFrameHandler; + },0] call CBA_fnc_addPerFrameHandler; + }; + case "zeus": { + openCuratorInterface; + + [{ + // PFH to re-open display when menu closes + [{ + if !((isNull curatorCamera) && {isNull (GETMVAR(bis_fnc_moduleRemoteControl_unit,objNull))}) exitWith {}; + + // If still a spectator then re-enter the interface + [QGVAR(zeus),false] call FUNC(interrupt); + + [_this select 1] call CBA_fnc_removePerFrameHandler; + },0] call CBA_fnc_addPerFrameHandler; + },[],5] call EFUNC(common,waitAndExecute); + + true + }; +}; diff --git a/addons/spectator/functions/fnc_handleMap.sqf b/addons/spectator/functions/fnc_handleMap.sqf new file mode 100644 index 0000000000..fd084f9967 --- /dev/null +++ b/addons/spectator/functions/fnc_handleMap.sqf @@ -0,0 +1,47 @@ +/* + * Author: Head, SilentSpike + * Handles rendering the spectator map icons + * + * Arguments: + * 0: Parameters + * 1: PFH handle + * + * Return Value: + * None + * + * Example: + * [ace_spectator_fnc_handleIcons, 0] call CBA_fnc_addPerFrameHandler; + * + * Public: No + */ + +#include "script_component.hpp" + +params ["_map"]; +private ["_cachedVehicles","_unit","_color","_icon","_txt"]; + +if (GVAR(camMode) == 0) then { + _map drawIcon ["\A3\UI_F\Data\GUI\Rsc\RscDisplayMissionEditor\iconcamera_ca.paa",[0,0,0,1],GVAR(freeCamera),20,20,GVAR(camPan)]; +}; + +_cachedVehicles = []; +{ + _unit = vehicle _x; + + if !(_unit in _cachedVehicles) then { + _cachedVehicles pushBack _unit; + + // Use previously cached info where possible + if (GETVAR(_unit,GVAR(uIcon),"") == "") then { + [_unit] call FUNC(cacheUnitInfo); + }; + + // Function has caching built in + _color = [side effectiveCommander _unit] call BIS_fnc_sideColor; + _icon = GETVAR(_unit,GVAR(uIcon),""); + _txt = ["", GETVAR(_x,GVAR(uName),"")] select (isPlayer _x); + + _map drawIcon [_icon, _color, _unit, 19, 19, getDir _unit, _txt, 1, 0.03]; + }; + false +} count GVAR(unitList); diff --git a/addons/spectator/functions/fnc_handleMouse.sqf b/addons/spectator/functions/fnc_handleMouse.sqf new file mode 100644 index 0000000000..1c2b62798c --- /dev/null +++ b/addons/spectator/functions/fnc_handleMouse.sqf @@ -0,0 +1,46 @@ +/* + * Author: F3 Project, Head, SilentSpike + * Processes the change in mouse position for the spectator camera + * + * Arguments: + * 0: Mouse x coord + * 1: Mouse y coord + * + * Return Value: + * None + * + * Example: + * [0.5, 0.5] call ace_spectator_fnc_handleMouse; + * + * Public: No + */ + +#include "script_component.hpp" + +params ["_x","_y"]; +private ["_leftButton","_rightButton","_oldX","_oldY","_deltaX","_deltaY","_zoomMod"]; + +_leftButton = GVAR(mouse) select 0; +_rightButton = GVAR(mouse) select 1; + +_oldX = GVAR(mousePos) select 0; +_oldY = GVAR(mousePos) select 1; + +// Get change in pos +_deltaX = _oldX - _x; +_deltaY = _oldY - _y; + +if (_leftButton) then { + GVAR(camDolly) set [0, _deltaX * -100 * GVAR(camSpeed)]; + GVAR(camDolly) set [1, _deltaY * 100 * GVAR(camSpeed)]; +} else { + if (_rightButton) then { + // Pan/Tilt amount should be influnced by zoom level (it should really be exponential) + _zoomMod = (GVAR(camZoom) * 0.8) max 1; + + GVAR(camPan) = GVAR(camPan) - ((_deltaX * 360) / _zoomMod); + GVAR(camTilt) = ((GVAR(camTilt) + ((_deltaY * 180) / _zoomMod)) min 89) max -89; + }; +}; + +GVAR(mousePos) = [_x,_y]; diff --git a/addons/spectator/functions/fnc_handleToolbar.sqf b/addons/spectator/functions/fnc_handleToolbar.sqf new file mode 100644 index 0000000000..878f3e46de --- /dev/null +++ b/addons/spectator/functions/fnc_handleToolbar.sqf @@ -0,0 +1,54 @@ +/* + * Author: Karel Moricky, SilentSpike + * Handles the spectator UI toolbar values + * + * Arguments: + * 0: Parameters + * 1: PFH handle + * + * Return Value: + * None + * + * Example: + * [ace_spectator_fnc_handleToolbar, 0, _display] call CBA_fnc_addPerFrameHandler; + * + * Public: No + */ + +#include "script_component.hpp" + +params ["_display"]; + +// Kill PFH when toolbar hidden (or display is closed) +if (isNil QGVAR(toolHandler)) exitWith { [_this select 1] call CBA_fnc_removePerFrameHandler; }; + +private ["_name","_vision","_fov","_speed","_mode","_time","_toolbar"]; +_toolbar = _display displayCtrl IDC_TOOL; + +// Find all tool values +if (GVAR(camMode) == 0) then { + _vision = if (GVAR(camVision) >= 0) then {localize LSTRING(VisionThermal)} else { [localize LSTRING(VisionNight), localize LSTRING(VisionNormal)] select (GVAR(camVision) < -1) }; + _fov = format ["%1x", floor(GVAR(camZoom) * 100) * 0.01]; + _speed = format ["%1 m/s", floor(GVAR(camSpeed) * 100) * 0.01]; +} else { + _vision = [side group GVAR(camUnit)] call BIS_fnc_sideName; + _fov = format ["%1 m", floor(getPosASL GVAR(camUnit) select 2)]; + _speed = format ["%1 km/h", floor(speed GVAR(camUnit)) max 0]; +}; + +if (alive GVAR(camUnit)) then { + _name = GETVAR(GVAR(camUnit),GVAR(uName),""); +} else { + _name = localize "STR_Special_None"; +}; + +_mode = [localize LSTRING(ViewFree),localize LSTRING(ViewInternal),localize LSTRING(ViewExternal)] select GVAR(camMode); +_time = [daytime,"HH:MM"] call BIS_fnc_timeToString; + +// Update the UI tools +(_toolbar controlsGroupCtrl IDC_TOOL_CLOCK) ctrlSetText _time; +(_toolbar controlsGroupCtrl IDC_TOOL_VISION) ctrlSetText _vision; +(_toolbar controlsGroupCtrl IDC_TOOL_FOV) ctrlSetText _fov; +(_toolbar controlsGroupCtrl IDC_TOOL_NAME) ctrlSetText _name; +(_toolbar controlsGroupCtrl IDC_TOOL_SPEED) ctrlSetText _speed; +(_toolbar controlsGroupCtrl IDC_TOOL_VIEW) ctrlSetText _mode; diff --git a/addons/spectator/functions/fnc_handleUnits.sqf b/addons/spectator/functions/fnc_handleUnits.sqf new file mode 100644 index 0000000000..c32961024c --- /dev/null +++ b/addons/spectator/functions/fnc_handleUnits.sqf @@ -0,0 +1,40 @@ +/* + * Author: SilentSpike + * Maintains the spectatable unit list and updates the unit tree accordingly + * Also updates current camera unit when status changes + * + * Arguments: + * 0: Parameters + * 1: PFH handle + * + * Return Value: + * None + * + * Example: + * [ace_spectator_fnc_handleUnits, 10, _display] call CBA_fnc_addPerFrameHandler; + * + * Public: No + */ + +#include "script_component.hpp" + +params ["_display"]; + +// Kill PFH when display is closed +if (isNull _display) exitWith { [_this select 1] call CBA_fnc_removePerFrameHandler; }; + +// Remove all dead and null units from the list +[] call FUNC(updateUnits); + +// Camera shouldn't stay on unit that isn't in the list (unless dead) +if !(GVAR(camUnit) in GVAR(unitList)) then { + if (alive GVAR(camUnit) || isNull GVAR(camUnit)) then { + [nil,1] call FUNC(cycleCamera); + }; +}; + +// Reduce overhead when unit tree is hidden +if (ctrlShown (_display displayCtrl IDC_UNIT)) then { + // Reduce overhead by spreading across frames + [FUNC(handleInterface),["onUnitsUpdate",[(_display displayCtrl IDC_UNIT) controlsGroupCtrl IDC_UNIT_TREE]],1] call EFUNC(common,waitAndExecute); +}; diff --git a/addons/spectator/functions/fnc_interrupt.sqf b/addons/spectator/functions/fnc_interrupt.sqf new file mode 100644 index 0000000000..48cca7d102 --- /dev/null +++ b/addons/spectator/functions/fnc_interrupt.sqf @@ -0,0 +1,44 @@ +/* + * Author: SilentSpike + * Interrupts the spectator interface for external systems + * + * Arguments: + * 0: Reason + * 1: Interrupting + * + * Return Value: + * None + * + * Example: + * ["mySystem"] call ace_spectator_fnc_interrupt + * + * Public: Yes + */ +#include "script_component.hpp" + +params [["_reason", "", [""]], ["_interrupt", true, [true]]]; + +// Nothing to do when spectator is closed +if !(GVAR(isSet)) exitWith {}; + +if (_reason == "") exitWith { ERROR("Invalid Reason"); }; +if (_interrupt) then { + GVAR(interrupts) pushBack _reason; +} else { + GVAR(interrupts) = GVAR(interrupts) - [_reason]; +}; + +if (GVAR(interrupts) isEqualTo []) then { + if (isNull (findDisplay 12249)) then { + createDialog QGVAR(interface); + [] call FUNC(transitionCamera); + }; +} else { + if !(isNull (findDisplay 12249)) then { + while {dialog} do { + closeDialog 0; + }; + + (findDisplay 12249) closeDisplay 0; + }; +}; diff --git a/addons/spectator/functions/fnc_moduleSpectatorSettings.sqf b/addons/spectator/functions/fnc_moduleSpectatorSettings.sqf new file mode 100644 index 0000000000..52b6e5d8fa --- /dev/null +++ b/addons/spectator/functions/fnc_moduleSpectatorSettings.sqf @@ -0,0 +1,25 @@ +/* + * Author: SilentSpike + * Read spectator settings from module + * + * Arguments: + * 0: The module logic + * 1: units + * 2: activated + * + * Return Value: + * None + * + * Public: No + */ + +#include "script_component.hpp" + +params ["_logic", "_units", "_activated"]; + +if !(_activated) exitWith {}; + +[_logic, QGVAR(filterUnits), "unitsFilter"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(filterSides), "sidesFilter"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(restrictModes), "cameraModes"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(restrictVisions), "visionModes"] call EFUNC(common,readSettingFromModule); diff --git a/addons/spectator/functions/fnc_respawnTemplate.sqf b/addons/spectator/functions/fnc_respawnTemplate.sqf new file mode 100644 index 0000000000..d903e3ecc4 --- /dev/null +++ b/addons/spectator/functions/fnc_respawnTemplate.sqf @@ -0,0 +1,49 @@ +/* + * Author: SilentSpike + * The ace_spectator respawn template, handles killed + respawn + * Can be used via BI's respawn framework, see: + * https://community.bistudio.com/wiki/Arma_3_Respawn + * + * Arguments: + * 0: Corpse/New Unit + * 1: Killer/Old Unit + * 2: Respawn Type + * 3: Respawn Delay + * + * Return Value: + * None + * + * Public: No + */ + +#include "script_component.hpp" + +params [["_unit",objNull,[objNull]], ["_killer",objNull,[objNull]], ["_respawn",0,[0]], ["_respawnDelay",0,[0]]]; +private ["_vision","_pos"]; + +// When all are dead with respawn type "None" the mission should end +if ((_respawn == 0) && {{alive _x} count allPlayers <= 0}) exitWith { + [["endDeath",false],"BIS_fnc_endMission"] call EFUNC(common,execRemoteFnc); +}; + +// Some environment information can be used for the initial camera attributes +if (isNull _killer) then {_killer = _unit}; +_vision = [-2,-1] select (sunOrMoon < 1); +_pos = (getPosATL _unit) vectorAdd [0,0,5]; + +// Enter/exit spectator based on the respawn type and whether killed/respawned +if (alive _unit) then { + if (_respawn == 1) then { + [_unit,QGVAR(isSeagull)] call EFUNC(common,hideUnit); + [2,_killer,_vision,_pos,getDir _unit] call FUNC(setCameraAttributes); + [true] call FUNC(setSpectator); + } else { + [false] call FUNC(setSpectator); + }; +} else { + // Negligible respawn delay can result in entering spectator after respawn + if (playerRespawnTime <= 1) exitWith {}; + + [2,_killer,_vision,_pos,getDir _unit] call FUNC(setCameraAttributes); + [true] call FUNC(setSpectator); +}; diff --git a/addons/spectator/functions/fnc_setCameraAttributes.sqf b/addons/spectator/functions/fnc_setCameraAttributes.sqf new file mode 100644 index 0000000000..dd8dd3ef6a --- /dev/null +++ b/addons/spectator/functions/fnc_setCameraAttributes.sqf @@ -0,0 +1,67 @@ +/* + * Author: SilentSpike + * Sets the spectator camera attributes as desired + * + * Arguments: + * 0: Camera mode + * - 0: Free + * - 1: Internal + * - 2: External + * 1: Camera unit (objNull for random) + * 2: Camera vision + * - -2: Normal + * - -1: Night vision + * - 0: Thermal white hot + * - 1: Thermal black hot + * 3: Camera position (ATL) + * 4: Camera pan (0 - 360) + * 5: Camera tilt (-90 - 90) + * 6: Camera zoom (0.01 - 2) + * 7: Camera speed in m/s (0.05 - 10) + * + * Return Value: + * None + * + * Example: + * [1, objNull] call ace_spectator_fnc_setCameraAttributes + * + * Public: Yes + */ + +#include "script_component.hpp" + +params [ + ["_mode",GVAR(camMode),[0]], + ["_unit",GVAR(camUnit),[objNull]], + ["_vision",GVAR(camVision),[0]], + ["_position",ASLtoATL GVAR(camPos),[[]],3], + ["_heading",GVAR(camPan),[0]], + ["_tilt",GVAR(camTilt),[0]], + ["_zoom",GVAR(camZoom),[0]], + ["_speed",GVAR(camSpeed),[0]] +]; + +// Normalize input +if !(_mode in GVAR(availableModes)) then { + _mode = GVAR(availableModes) select ((GVAR(availableModes) find GVAR(camMode)) max 0); +}; + +if !(_vision in GVAR(availableVisions)) then { + _vision = GVAR(availableVisions) select ((GVAR(availableVisions) find GVAR(camVision)) max 0); +}; + +GVAR(camPan) = _heading % 360; +GVAR(camSpeed) = (_speed max 0.05) min 10; +GVAR(camTilt) = (_tilt max -89) min 89; +GVAR(camUnit) = _unit; +GVAR(camVision) = _vision; +GVAR(camZoom) = (_zoom min 2) max 0.01; + +// Apply if camera exists +if (GVAR(isSet)) then { + GVAR(freeCamera) setPosATL _position; + [_mode,_unit,_vision] call FUNC(transitionCamera); +} else { + GVAR(camMode) = _mode; + GVAR(camPos) = (ATLtoASL _position); +}; diff --git a/addons/spectator/functions/fnc_setSpectator.sqf b/addons/spectator/functions/fnc_setSpectator.sqf new file mode 100644 index 0000000000..efa7000b8f --- /dev/null +++ b/addons/spectator/functions/fnc_setSpectator.sqf @@ -0,0 +1,138 @@ +/* + * Author: SilentSpike + * Sets local client to the given spectator state (virtually) + * To physically handle a spectator see ace_spectator_fnc_stageSpectator + * + * Client will be able to communicate in ACRE/TFAR as appropriate + * The spectator interface will be opened/closed + * + * Arguments: + * 0: Spectator state of local client + * + * Return Value: + * None + * + * Example: + * [true] call ace_spectator_fnc_setSpectator + * + * Public: Yes + */ + +#include "script_component.hpp" + +params [["_set",true,[true]]]; + +// Only clients can be spectators +if (!hasInterface) exitWith {}; + +// Exit if no change +if (_set isEqualTo GVAR(isSet)) exitwith {}; + +// Handle common addon audio +if (["ace_hearing"] call EFUNC(common,isModLoaded)) then {EGVAR(hearing,disableVolumeUpdate) = _set}; +if (["acre_sys_radio"] call EFUNC(common,isModLoaded)) then {[_set] call acre_api_fnc_setSpectator}; +if (["task_force_radio"] call EFUNC(common,isModLoaded)) then {[player, _set] call TFAR_fnc_forceSpectator}; + +if (_set) then { + // Initalize camera variables + GVAR(camBoom) = 0; + GVAR(camDolly) = [0,0]; + GVAR(camGun) = false; + + // Initalize display variables + GVAR(ctrlKey) = false; + GVAR(heldKeys) = []; + GVAR(heldKeys) resize 255; + GVAR(mouse) = [false,false]; + GVAR(mousePos) = [0.5,0.5]; + GVAR(treeSel) = objNull; + + // Update units before opening to support pre-set camera unit + [] call FUNC(updateUnits); + + // Initalize the camera objects + GVAR(freeCamera) = "Camera" camCreate (ASLtoATL GVAR(camPos)); + GVAR(unitCamera) = "Camera" camCreate [0,0,0]; + GVAR(targetCamera) = "Camera" camCreate [0,0,0]; + + // Initalize view + GVAR(unitCamera) camSetTarget GVAR(targetCamera); + GVAR(unitCamera) camCommit 0; + [] call FUNC(transitionCamera); + + // Close map and clear radio + openMap [false,false]; + clearRadio; + + // Disable BI damage effects + BIS_fnc_feedback_allowPP = false; + + // Close any open dialogs + while {dialog} do { + closeDialog 0; + }; + + [{ + // Create the display + (findDisplay 46) createDisplay QGVAR(interface); + }, []] call EFUNC(common,execNextFrame); + + // Cache and disable nametag settings + if (["ace_nametags"] call EFUNC(common,isModLoaded)) then { + GVAR(nametagSettingCache) = [EGVAR(nametags,showPlayerNames), EGVAR(nametags,showNamesForAI)]; + EGVAR(nametags,showPlayerNames) = 0; + EGVAR(nametags,showNamesForAI) = false; + }; +} else { + // Close any open dialogs (could be interrupts) + while {dialog} do { + closeDialog 0; + }; + + // Kill the display + (findDisplay 12249) closeDisplay 0; + + // Terminate camera + GVAR(freeCamera) cameraEffect ["terminate", "back"]; + camDestroy GVAR(freeCamera); + camDestroy GVAR(unitCamera); + camDestroy GVAR(targetCamera); + + clearRadio; + + // Return to player view + player switchCamera "internal"; + + // Enable BI damage effects + BIS_fnc_feedback_allowPP = true; + + // Cleanup camera variables + GVAR(camBoom) = nil; + GVAR(camDolly) = nil; + GVAR(camGun) = nil; + GVAR(freeCamera) = nil; + GVAR(unitCamera) = nil; + GVAR(targetCamera) = nil; + + // Cleanup display variables + GVAR(ctrlKey) = nil; + GVAR(heldKeys) = nil; + GVAR(mouse) = nil; + GVAR(mousePos) = nil; + GVAR(treeSel) = nil; + + // Reset nametag settings + if (["ace_nametags"] call EFUNC(common,isModLoaded)) then { + EGVAR(nametags,showPlayerNames) = GVAR(nametagSettingCache) select 0; + EGVAR(nametags,showNamesForAI) = GVAR(nametagSettingCache) select 1; + GVAR(nametagSettingCache) = nil; + }; +}; + +// Reset interruptions +GVAR(interrupts) = []; + +// Mark spectator state for reference +GVAR(isSet) = _set; + +["spectatorSet",[_set]] call EFUNC(common,localEvent); diff --git a/addons/spectator/functions/fnc_stageSpectator.sqf b/addons/spectator/functions/fnc_stageSpectator.sqf new file mode 100644 index 0000000000..7f0d862719 --- /dev/null +++ b/addons/spectator/functions/fnc_stageSpectator.sqf @@ -0,0 +1,68 @@ +/* + * Author: SilentSpike + * Sets target unit to the given spectator state (physically) + * To virtually handle a spectator see ace_spectator_fnc_setSpectator + * + * Units will be gathered at marker ace_spectator_respawn (or [0,0,0] by default) + * Upon unstage, units will be moved to the position they were in upon staging + * + * Arguments: + * 0: Unit to put into spectator stage + * 1: Spectator stage + * + * Return Value: + * None + * + * Example: + * [player, false] call ace_spectator_fnc_stageSpectator + * + * Public: Yes + */ + +#include "script_component.hpp" + +params [["_unit",player,[objNull]], ["_set",true,[true]]]; + +// No change, no service (but allow spectators to be reset) +if !(_set || (GETVAR(_unit,GVAR(isStaged),false))) exitWith {}; + +if !(local _unit) exitwith { + [[_unit, _set], QFUNC(stageSpectator), _unit] call EFUNC(common,execRemoteFnc); +}; + +// Prevent unit falling into water +_unit enableSimulation !_set; + +// Move to/from group as appropriate +[_unit, _set, QGVAR(isStaged), side group _unit] call EFUNC(common,switchToGroupSide); + +if (_set) then { + // Position should only be saved on first entry + if !(GETVAR(_unit,GVAR(isStaged),false)) then { + GVAR(oldPos) = getPosATL _unit; + }; + + // Ghosts can't talk + [_unit, QGVAR(isStaged)] call EFUNC(common,hideUnit); + [_unit, QGVAR(isStaged)] call EFUNC(common,muteUnit); + + _unit setPos (markerPos QGVAR(respawn)); +} else { + // Physical beings can talk + [_unit, QGVAR(isStaged)] call EFUNC(common,unhideUnit); + [_unit, QGVAR(isStaged)] call EFUNC(common,unmuteUnit); + + _unit setPosATL GVAR(oldPos); +}; + +// Spectators ignore damage (vanilla and ace_medical) +_unit allowDamage !_set; +_unit setVariable [QEGVAR(medical,allowDamage), !_set]; + +// No theoretical change if an existing spectator was reset +if !(_set isEqualTo (GETVAR(_unit,GVAR(isStaged),false))) then { + // Mark spectator state for reference + _unit setVariable [QGVAR(isStaged), _set, true]; + + ["spectatorStaged",[_set]] call EFUNC(common,localEvent); +}; diff --git a/addons/spectator/functions/fnc_toggleInterface.sqf b/addons/spectator/functions/fnc_toggleInterface.sqf new file mode 100644 index 0000000000..31472702fc --- /dev/null +++ b/addons/spectator/functions/fnc_toggleInterface.sqf @@ -0,0 +1,82 @@ +/* + * Author: SilentSpike + * Correctly handles toggling of spectator interface elements for clean UX + * + * Arguments: + * 0: Display + * 1: Toogle compass + * 2: Toogle help + * 3: Toogle interface + * 4: Toogle map + * 5: Toogle toolbar + * 6: Toogle unit list + * + * Return Value: + * None + * + * Example: + * [_dsiplay, nil, true] call ace_spectator_fnc_toggleInterface + * + * Public: No + */ + +#include "script_component.hpp" + +params ["_display", ["_toggleComp",false], ["_toggleHelp",false], ["_toggleInterface",false], ["_toggleMap",false], ["_toggleTool",false], ["_toggleUnit",false]]; + +private ["_comp","_help","_map","_tool","_unit"]; +_comp = _display displayCtrl IDC_COMP; +_help = _display displayCtrl IDC_HELP; +_map = _display displayCtrl IDC_MAP; +_tool = _display displayCtrl IDC_TOOL; +_unit = _display displayCtrl IDC_UNIT; + +// Map operates outside of interface +GVAR(showMap) = [GVAR(showMap), !GVAR(showMap)] select _toggleMap; +_map ctrlShow GVAR(showMap); + +if (GVAR(showMap)) then { + // When map is shown, temporarily hide interface to stop overlapping + { + _x ctrlShow false; + } forEach [_comp,_help,_tool,_unit]; + + // Centre map on camera/unit upon opening + if (_toggleMap) then { + _map ctrlMapAnimAdd [0, 0.5, [GVAR(camUnit),GVAR(freeCamera)] select (GVAR(camMode) == 0)]; + ctrlMapAnimCommit _map; + }; +} else { + // Can only toggle interface with map minimised + GVAR(showInterface) = [GVAR(showInterface), !GVAR(showInterface)] select _toggleInterface; + + if (GVAR(showInterface)) then { + // Can only toggle interface elements with interface shown + GVAR(showComp) = [GVAR(showComp), !GVAR(showComp)] select _toggleComp; + GVAR(showHelp) = [GVAR(showHelp), !GVAR(showHelp)] select _toggleHelp; + GVAR(showTool) = [GVAR(showTool), !GVAR(showTool)] select _toggleTool; + GVAR(showUnit) = [GVAR(showUnit), !GVAR(showUnit)] select _toggleUnit; + + _comp ctrlShow GVAR(showComp); + _help ctrlShow GVAR(showHelp); + _tool ctrlShow GVAR(showTool); + _unit ctrlShow GVAR(showUnit); + } else { + { + _x ctrlShow false; + } forEach [_comp,_help,_tool,_unit]; + }; +}; + +// Only run PFHs when respective control is shown, otherwise kill +if (ctrlShown _comp) then { + if (isNil QGVAR(compHandler)) then { GVAR(compHandler) = [FUNC(handleCompass), 0, _display] call CBA_fnc_addPerFrameHandler; }; +} else { + GVAR(compHandler) = nil; +}; + +if (ctrlShown _tool) then { + if (isNil QGVAR(toolHandler)) then { GVAR(toolHandler) = [FUNC(handleToolbar), 0, _display] call CBA_fnc_addPerFrameHandler; }; +} else { + GVAR(toolHandler) = nil; +}; diff --git a/addons/spectator/functions/fnc_transitionCamera.sqf b/addons/spectator/functions/fnc_transitionCamera.sqf new file mode 100644 index 0000000000..edc7fa23a2 --- /dev/null +++ b/addons/spectator/functions/fnc_transitionCamera.sqf @@ -0,0 +1,120 @@ +/* + * Author: SilentSpike + * Transitions the spectator camera vision/view/unit + * + * Arguments: + * 0: Camera mode + * - 0: Free + * - 1: Internal + * - 2: External + * 1: Camera unit + * 2: Vision mode + * - -2: Normal + * - -1: NV + * - 0: White hot + * - 1: Black hot + * + * Return Value: + * None + * + * Example: + * [0,objNull] call ace_spectator_fnc_transitionCamera + * + * Public: No + */ + +#include "script_component.hpp" + +params [["_newMode",GVAR(camMode)], ["_newUnit",GVAR(camUnit)], ["_newVision",GVAR(camVision)]]; + +// If new mode isn't available then keep current (unless current also isn't) +if !(_newMode in GVAR(availableModes)) then { + _newMode = GVAR(availableModes) select ((GVAR(availableModes) find GVAR(camMode)) max 0); +}; + +// When no units available to spectate, exit to freecam +if ((GVAR(unitList) isEqualTo []) && (alive _newUnit || isNull _newUnit)) then { + _newMode = 0; + _newUnit = objNull; +}; + +// Reset gun cam if not internal +if (_newMode != 1) then { + GVAR(camGun) = false; +}; + +private ["_camera"]; +if (_newMode == 0) then { // Free + _camera = GVAR(freeCamera); + + // Preserve camUnit value for consistency when manually changing view + _camera cameraEffect ["internal", "back"]; + showCinemaBorder false; + + // Apply the camera zoom + _camera camSetFov -(linearConversion [0.01,2,GVAR(camZoom),-2,-0.01,true]); + _camera camCommit 0; + + // Agent is switched to in free cam to hide death table and prevent AI chat while allowing icons to draw (also prevents systemChat and unit HUD) + // (Why is so much stuff tied into the current camera unit BI?!) + if (isNull GVAR(camAgent)) then { + GVAR(camAgent) = createAgent ["VirtualMan_F",markerPos QGVAR(respawn),[],0,""]; + }; + + GVAR(camAgent) switchCamera "internal"; + clearRadio; + + // If new vision isn't available then keep current (unless current also isn't) + if !(_newVision in GVAR(availableVisions)) then { + _newVision = GVAR(availableVisions) select ((GVAR(availableVisions) find GVAR(camVision)) max 0); + }; + + // Vision mode only applies to free cam + if (_newVision < 0) then { + false setCamUseTi 0; + camUseNVG (_newVision >= -1); + } else { + true setCamUseTi _newVision; + }; + GVAR(camVision) = _newVision; + + // Handle camera movement + if (isNil QGVAR(camHandler)) then { GVAR(camHandler) = [FUNC(handleCamera), 0] call CBA_fnc_addPerFrameHandler; }; +} else { + _camera = GVAR(unitCamera); + + // When null unit is given choose random + if (isNull _newUnit) then { + _newUnit = GVAR(unitList) select floor(random(count GVAR(unitList))); + }; + + // Switch camera view to internal unit view (external uses the camera) + if (GVAR(camGun)) then { + _newUnit switchCamera "gunner"; + } else { + _newUnit switchCamera "internal"; + }; + + // Handle camera differently for internal/external view + if (_newMode == 1) then { + // Terminate camera view + _camera cameraEffect ["terminate", "back"]; + GVAR(camHandler) = nil; + } else { + // Switch to the camera + _camera cameraEffect ["internal", "back"]; + showCinemaBorder false; + + // Handle camera orbit movement + if (isNil QGVAR(camHandler)) then { GVAR(camHandler) = [FUNC(handleCamera), 0] call CBA_fnc_addPerFrameHandler; }; + }; + + // Clear radio if group changed + if (group _newUnit != group GVAR(camUnit)) then { + clearRadio; + }; + + GVAR(camUnit) = _newUnit; +}; + +GVAR(camMode) = _newMode; diff --git a/addons/spectator/functions/fnc_updateCameraModes.sqf b/addons/spectator/functions/fnc_updateCameraModes.sqf new file mode 100644 index 0000000000..de1611823b --- /dev/null +++ b/addons/spectator/functions/fnc_updateCameraModes.sqf @@ -0,0 +1,48 @@ +/* + * Author: SilentSpike + * Adds or removes spectator camera modes from the selection available to the local player. + * Possible camera modes are: + * - 0: Free + * - 1: Internal + * - 2: External + * + * Arguments: + * 0: Camera modes to add + * 1: Camera modes to remove + * + * Return Value: + * Available camera modes + * + * Example: + * [[0], [1,2]] call ace_spectator_fnc_updateCameraModes + * + * Public: Yes + */ + +#include "script_component.hpp" + +params [["_addModes",[],[[]]], ["_removeModes",[],[[]]]]; +private ["_newModes","_currentModes"]; + +_currentModes = GVAR(availableModes); + +// Restrict additions to only possible values +_newModes = _addModes arrayIntersect [0,1,2]; +_newModes append (_currentModes - _removeModes); + +_newModes = _newModes arrayIntersect _newModes; +_newModes sort true; + +// Can't become an empty array +if (_newModes isEqualTo []) then { + ["Cannot remove all camera modes (%1)", QFUNC(updateCameraModes)] call BIS_fnc_error; +} else { + GVAR(availableModes) = _newModes; +}; + +// Update camera in case of change +if (GVAR(isSet)) then { + [] call FUNC(transitionCamera); +}; + +_newModes diff --git a/addons/spectator/functions/fnc_updateSpectatableSides.sqf b/addons/spectator/functions/fnc_updateSpectatableSides.sqf new file mode 100644 index 0000000000..57f7756d54 --- /dev/null +++ b/addons/spectator/functions/fnc_updateSpectatableSides.sqf @@ -0,0 +1,33 @@ +/* + * Author: SilentSpike + * Adds or removes sides from the selection available to spectate by the local player. + * Note that the side filter setting is applied to the available sides dynamically. + * + * Default selection is [west,east,resistance,civilian] + * + * Arguments: + * 0: Sides to add + * 1: Sides to remove + * + * Return Value: + * Spectatable sides + * + * Example: + * [[west], [east,civilian]] call ace_spectator_fnc_updateSpectatableSides + * + * Public: Yes + */ + +#include "script_component.hpp" + +params [["_addSides",[],[[]]], ["_removeSides",[],[[]]]]; + +// Add and remove sides +_addSides append (GVAR(availableSides) - _removeSides); + +// Only need array of unique sides +_addSides = _addSides arrayIntersect _addSides; + +GVAR(availableSides) = _addSides; + +_addSides diff --git a/addons/spectator/functions/fnc_updateUnits.sqf b/addons/spectator/functions/fnc_updateUnits.sqf new file mode 100644 index 0000000000..0297b31b8d --- /dev/null +++ b/addons/spectator/functions/fnc_updateUnits.sqf @@ -0,0 +1,75 @@ +/* + * Author: SilentSpike + * Adds units to spectator whitelist/blacklist and refreshes the filter units + * + * Arguments: + * 0: Units to add to the whitelist + * 1: Use blacklist + * + * Return Value: + * None + * + * Example: + * [allUnits,true] call ace_spectator_fnc_updateUnits + * + * Public: Yes + */ + +#include "script_component.hpp" + +params [["_newUnits",[],[[]]],["_blacklist",false,[false]]]; + +// Function only matters on player clients +if (!hasInterface) exitWith {}; + +// If adding to a list we can exit here, since it won't show up until the UI refreshes anyway +if !(_newUnits isEqualTo []) exitWith { + if (_blacklist) then { + GVAR(unitWhitelist) = GVAR(unitWhitelist) - _newUnits; + GVAR(unitBlacklist) append _newUnits; + } else { + GVAR(unitBlacklist) = GVAR(unitBlacklist) - _newUnits; + GVAR(unitWhitelist) append _newUnits; + }; +}; + +private ["_sides","_cond","_filteredUnits","_filteredGroups"]; + +// Unit setting filter +_newUnits = [[],allPlayers,playableUnits,allUnits] select GVAR(filterUnits); + +// Side setting filter +_sides = []; +_cond = [{_this == (side group player)},{(_this getFriend (side group player)) >= 0.6},{(_this getFriend (side group player)) < 0.6},{true}] select GVAR(filterSides); +{ + if (_x call _cond) then { + _sides pushBack _x; + }; +} forEach GVAR(availableSides); + +// Filter units and append to list +_filteredUnits = []; +{ + if ( + (alive _x) && + {(_x isKindOf "CAManBase")} && + {(side group _x) in _sides} && // Side filter + {simulationEnabled _x} && + {!(_x getVariable [QGVAR(isStaged), false])} // Who watches the watchmen? + ) then { + _filteredUnits pushBack _x; + }; +} forEach (_newUnits - GVAR(unitBlacklist)); +_filteredUnits append GVAR(unitWhitelist); + +// Cache icons and colour for drawing +_filteredGroups = []; +{ + // Intentionally re-applied to units in case their status changes + [_x] call FUNC(cacheUnitInfo); + _filteredGroups pushBack (group _x); +} forEach _filteredUnits; + +// Replace previous lists entirely (removes any no longer valid) +GVAR(unitList) = _filteredUnits arrayIntersect _filteredUnits; +GVAR(groupList) = _filteredGroups arrayIntersect _filteredGroups; diff --git a/addons/spectator/functions/fnc_updateVisionModes.sqf b/addons/spectator/functions/fnc_updateVisionModes.sqf new file mode 100644 index 0000000000..c2bbb09167 --- /dev/null +++ b/addons/spectator/functions/fnc_updateVisionModes.sqf @@ -0,0 +1,56 @@ +/* + * Author: SilentSpike + * Adds or removes spectator vision modes from the selection available to the local player. + * The default selection is [-2,-1,0,1]. + * Possible vision modes are: + * - -2: Normal + * - -1: Night vision + * - 0: White hot + * - 1: Black hot + * - 2: Light Green Hot / Darker Green cold + * - 3: Black Hot / Darker Green cold + * - 4: Light Red Hot / Darker Red Cold + * - 5: Black Hot / Darker Red Cold + * - 6: White Hot / Darker Red Cold + * - 7: Thermal (Shade of Red and Green, Bodies are white) + * + * Arguments: + * 0: Vision modes to add + * 1: Vision modes to remove + * + * Return Value: + * Available vision modes + * + * Example: + * [[0], [1,2]] call ace_spectator_fnc_updateVisionModes + * + * Public: Yes + */ + +#include "script_component.hpp" + +params [["_addModes",[],[[]]], ["_removeModes",[],[[]]]]; +private ["_newModes","_currentModes"]; + +_currentModes = GVAR(availableVisions); + +// Restrict additions to only possible values +_newModes = _addModes arrayIntersect [-2,-1,0,1,2,3,4,5,6,7]; +_newModes append (_currentModes - _removeModes); + +_newModes = _newModes arrayIntersect _newModes; +_newModes sort true; + +// Can't become an empty array +if (_newModes isEqualTo []) then { + ["Cannot remove all vision modes (%1)", QFUNC(updateVisionModes)] call BIS_fnc_error; +} else { + GVAR(availableVisions) = _newModes; +}; + +// Update camera in case of change +if (GVAR(isSet)) then { + [] call FUNC(transitionCamera); +}; + +_newModes diff --git a/addons/spectator/functions/script_component.hpp b/addons/spectator/functions/script_component.hpp new file mode 100644 index 0000000000..d5034cb39c --- /dev/null +++ b/addons/spectator/functions/script_component.hpp @@ -0,0 +1 @@ +#include "\z\ace\addons\spectator\script_component.hpp" \ No newline at end of file diff --git a/addons/spectator/script_component.hpp b/addons/spectator/script_component.hpp new file mode 100644 index 0000000000..de2ee22363 --- /dev/null +++ b/addons/spectator/script_component.hpp @@ -0,0 +1,57 @@ +#define COMPONENT spectator +#include "\z\ace\addons\main\script_mod.hpp" + +#ifdef DEBUG_ENABLED_SPECTATOR + #define DEBUG_MODE_FULL +#endif + +#ifdef DEBUG_SETTINGS_SPECTATOR + #define DEBUG_SETTINGS DEBUG_SETTINGS_SPECTATOR +#endif + +#include "\z\ace\addons\main\script_macros.hpp" + +// UI grid +#define SIZEX ((safezoneW / safezoneH) min 1.2) +#define SIZEY (SIZEX / 1.2) +#define W_PART(num) (num * (SIZEX / 40)) +#define H_PART(num) (num * (SIZEY / 25)) +#define X_PART(num) (W_PART(num) + (safezoneX + (safezoneW - SIZEX)/2)) +#define Y_PART(num) (H_PART(num) + (safezoneY + (safezoneH - SIZEY)/2)) + +// UI tools +#define TOOL_H H_PART(1) +#define TOOL_W W_PART(5) +#define MARGIN TOOL_W * 0.05 + +// UI compass +#define COMPASS_W (TOOL_W * 4) +#define COMPASS_X (safeZoneX + safeZoneW * 0.5 - COMPASS_W * 0.5) + +// UI IDCs +#define IDC_COMP 4490 +#define IDC_COMP_0 5000 +#define IDC_COMP_90 5090 +#define IDC_COMP_180 5180 +#define IDC_COMP_270 5270 + +#define IDC_HELP 7631 +#define IDC_HELP_LIST 7622 + +#define IDC_MAP 6791 + +#define IDC_TOOL 3000 +#define IDC_TOOL_CLOCK 3003 +#define IDC_TOOL_FOV 3005 +#define IDC_TOOL_NAME 3001 +#define IDC_TOOL_SPEED 3006 +#define IDC_TOOL_VIEW 3002 +#define IDC_TOOL_VISION 3004 + +#define IDC_UNIT 6002 +#define IDC_UNIT_TREE 6005 + +// UI colours +#define COL_BACK 0.1,0.1,0.1,0.7 +#define COL_FORE 1,1,1,1 +#define COL_FORE_D 0.1,0.1,0.1,0.8 diff --git a/addons/spectator/stringtable.xml b/addons/spectator/stringtable.xml new file mode 100644 index 0000000000..00d50e4704 --- /dev/null +++ b/addons/spectator/stringtable.xml @@ -0,0 +1,518 @@ + + + + + Spectator Settings + Ustawienia obserwatora + Preferências de Espectador + Настройки спектатора + Nastavení Pozorovatele + Ajustes de espectador + + + Configure how the spectator system will operate by default. + Skonfiguruj domyślne ustawienia obserwatora. + Configura como o sistema de espectador operará por padrão. + Определяют, как система спектатора будет функционировать по-умолчанию. + Configurar cómo el sistema de espectador funcionará por defecto. + + + Unit filter + Filtr jednostek + Filtro de unidades + Фильтр юнитов + Filtr jednotek + Filtro de unidad + + + Method of filtering spectatable units. + Wybierz jednostki, jakie będzie można obserwować po uruchomeniu obserwatora. + Método para filtrar unidades espectáveis + Метод фильтрации наблюдаемых юнитов. + Método de filtrado de unidades de espectador + + + No units + Brak jednostek + Sem unidades + Никто + Žádné jednotky + Ninguna + + + Only players + Tylko gracze + Somente jogadores + Только игроки + Pouze hráči + Solo jugadores + + + Playable Units + Grywalne jednostki + Unidades jogáveis + Играбельные юниты + Hratelné Jednotky + Unidades jugables + + + All units + Wszystkie jednostki + Todas unidades + Все юниты + Všechny jednotky + Todas las unidades + + + Side filter + Filtr stron + Filtro de lados + Фильтр стороны + Filtr stran + Filtro de bando + + + Method of filtering spectatable sides. + Wybierz strony, jakie będzie można obserwować po uruchomeniu obserwatora. + Método para filtrar lados espectáveis. + Метод фильтрации наблюдаемых сторон. + Método de filtrado de bandos de espectador + + + Player side + Strona gracza + Lado do jogador + Сторона игрока + Strana hráče + Bando del jugador + + + Friendly sides + Strony sojusznicze + Lados aliados + Дружественные стороны + Strana spojenců + Bandos amigos + + + Hostile sides + Strony wrogie + Lados hostis + Враждебные стороны + Strana nepřítele + Bandos enemigos + + + All sides + Wszystkie strony + Todos os lados + Все стороны + Všechny strany + Todos los bandos + + + Camera modes + Tryby kamery + Modos de camera + Режимы камеры + Módy kamery + Modos de cámara + + + Camera modes that can be used. + Tryby kamery, jakie mogą być używane. + Modos de camera que podem ser utilizados + Режимы камеры, которые могут быть использованы + Modos de la cámara que se pueden utilizar. + + + All + Wszystkie + Todos + Все + Všechny + Todos + + + Free only + Tylko wolna + Somente livre + Только свободная + Pouze volná + Solo libre + + + Internal only + Tylko wewnętrzna + Somente interna + Только внутренняя + Pouze vnitřní + Solo interna + + + External only + Tylko zewnętrzna + Somente externa + Только внешняя + Pouze vnější + Solo externa + + + Internal and external + Wewnętrzna i zewnętrzna + Interna e externa + Внутренняя и внешняя + Vnitřní a vnější + Interna y externa + + + Vision modes + Tryby wizji + Modos de visão + Режимы видения + Modos de visión + + + Vision modes that can be used. + Tryby wizji, jakie mogą być używane. + Modos de visão que podem ser utilizados + Режимы видения, которые могут быть использованы + Modos de visión que pueden ser utilizados. + + + Night vision + Noktowizja + Visão noturna + Ночное видение + Noktovize + Visión nocturna + + + Thermal imaging + Termowizja + Visão térmica + Тепловизионное + Termovize + Imagen térmica + + + + Spectator Units + Jednostki obserwatora + Unidades espectadoras + Юниты + Unidades espectador + + + Spectator Controls + Sterowanie obserwatorem + Controle do espectador + Управление спектатором + Controles de espectador + + + Free + Wolna + Livre + Свободная + Volná + Libre + + + Internal + Wewnętrzna + Interna + Внутренняя + Vnitřní + Interna + + + External + Zewnętrzna + Externa + Внешняя + Vnější + Externa + + + Normal + Normalna + Normal + Нормальное + Normální + Normal + + + Night + Noc + Visão Norturna + Ночное + Noc + Nocturna + + + Thermal + Termo + Térmica + Тепловизор + Termál + Térmica + + + + Free Camera + Kamera swobodna + Câmera livre + Свободная камера + Volná Kamera + Cámara libre + + + Camera Forward + Kamera naprzód + Câmera para frente + Камера вперед + Kamera Vpřed + Cámara delantera + + + Camera Backward + Kamera w tył + Câmera para trás + Камера назад + Kamera Zpět + Cámara trasera + + + Camera Left + Kamera w lewo + Câmera para esquerda + Камера влево + Kamera Doleva + Cámara izquierda + + + Camera Right + Kamera w prawo + Câmera para direita + Камера вправо + Kamera Doprava + Cámara derecha + + + Camera Up + Kamera w górę + Câmera para cima + Камера вверх + Kamera Nahoru + Cámara arriba + + + Camera Down + Kamera w dół + Câmera para baixo + Камера вниз + Kamera Dolů + Cámara abajo + + + Pan Camera + Panoramowanie + Câmera panorâmica + Панорамирование + Cámara panorámica + + + Dolly Camera + Płynna kamera + Câmera dolly + Рельсовая камера + Cámara dolly + + + Lock Camera to Target + Zablokuj kamerę na celu + Travar câmera em alvo + Зафиксировать камеру на цели + Zamknout Kameru na Cíl + Fijar cámara al objetivo + + + Speed Boost + Przyśpieszenie kamery + Aumento de velocidade + Ускорение камеры + Aumento de velocidad + + + Focus on Unit + Skup na jednostce + Focar na unidade + Фокус на юните + Zaměřit se na Jednotku + Centrarse en la unidad + + + Interface + Interfejs + Interface + Интерфейс + Rozhraní + Interfaz + + + Toggle Interface + Przełącz interfejs + Alternar interface + Переключить интерфейс + Přepnout Rozhraní + Conmutar + + + Toggle Unit Icons + Przełącz ikony jednostek + Alternar ícone de unidades + Вкл./выкл. иконки юнитов + Přepnout Ikony Jednotek + Conmutar iconos de unidad + + + Toggle Unit List + Przełącz listę jednostek + Alternar lista de unidades + Вкл./выкл. список юнитов + Přepnout Seznam Jednotek + Conmutar lista de unidades + + + Toggle Toolbar + Przełącz pasek narzędzi + Alternar barra de ferramentas + Вкл./выкл. тулбар + Conmutar barra de herramientas + + + Toggle Compass + Przełącz kompas + Alternar bússola + Вкл./выкл. компас + Přepnout Kompas + Conmutar brújula + + + Toggle Map + Przełącz mapę + Alternar mapa + Вкл./выкл. карту + Přepnout Mapu + Conmutar map + + + Toggle Help + Przełącz pomoc + Alternar ajuda + Вкл./выкл. помощь + Přepnout Nápovědu + Conmutar ayuda + + + Camera Attributes + Atrybuty kamery + Atributos de câmera + Атрибуты камеры + Atributos de cámara + + + Next Camera + Następna kamera + Próxima câmera + Следующая камера + Následující Kamera + Siguiente cámara + + + Previous Camera + Poprzednia kamera + Câmera anterior + Предыдущая камера + Předchozí Kamera + Anterior cámara + + + Next Unit + Następna jednostka + Próxima unidade + Следующий юнит + Následující Jednotka + Siguiente unidad + + + Previous Unit + Poprzednia jednostka + Unidade anterior + Предыдущий юнит + Předchozí Jednotka + Anterior unidad + + + Next Vision Mode + Następny tryb wizji + Próximo modo de visão + Следующий режим видения + Siguiente modo de visión + + + Previous Vision Mode + Poprzedni tryb wizji + Modo de visão anterior + Предыдущий режим видения + Anterior modo de visión + + + Adjust Zoom + Reguluj zoom + Ajustar zoom + Настроить зум + Regulovat Přiblížení + Ajustar aumento + + + Adjust Speed + Reguluj prędkość + Ajuster velocidade + Настроить скорость + Regulovat Rychlost + Ajustar velocidad + + + Increment Zoom + Reguluj zoom (krok) + Incrementar zoom + Увеличить зум + Incrementar aumento + + + Increment Speed + Reguluj prędkość (krok) + Incrementar velocidade + Увеличить скорость + Incrementar velocidad + + + Reset Zoom + Resetuj zoom + Redefinir zoom + Сбросить зум + Obnovit Přiblížení + Reiniciar aumento + + + Reset Speed + Resetuj prędkość + Redefinir velocidade + Сбросить скорость + Obnovit Rychlost + Reiniciar velocidad + + + diff --git a/addons/spottingscope/CfgMoves.hpp b/addons/spottingscope/CfgMoves.hpp new file mode 100644 index 0000000000..c7436801ee --- /dev/null +++ b/addons/spottingscope/CfgMoves.hpp @@ -0,0 +1,28 @@ + +class CfgMovesBasic { + class DefaultDie; + + class ManActions { + ACE_SpottingScope = "ACE_SpottingScope"; + }; +}; + +class CfgMovesMaleSdr: CfgMovesBasic { + class States { + class ACE_KIA_SpottingScope: DefaultDie { + actions = "DeadActions"; + file = "\A3\anims_f\Data\Anim\Sdr\dth\pne\stp\ras\Rfl\AdthPpneMstpSrasWrflDnon_1"; + speed = 1; + looped = "false"; + terminal = 1; + soundEnabled = 0; + connectTo[] = {"Unconscious",0.1}; + }; + + class Crew; + class ACE_SpottingScope: Crew { + file = "\A3\anims_f\Data\Anim\Sdr\Mov\pne\stp\non\non\AmovPpneMstpSnonWnonDnon"; + interpolateTo[] = {"ACE_KIA_SpottingScope",1}; + }; + }; +}; diff --git a/addons/spottingscope/CfgVehicles.hpp b/addons/spottingscope/CfgVehicles.hpp index b0b8bf9c77..2c8159fbb1 100644 --- a/addons/spottingscope/CfgVehicles.hpp +++ b/addons/spottingscope/CfgVehicles.hpp @@ -77,7 +77,7 @@ class CfgVehicles { gunnerOpticsEffect[] = {"OpticsCHAbera1","OpticsBlur2"}; gunnerOutOpticsShowCursor = 0; gunnerOpticsShowCursor = 0; - gunnerAction = "gunner_static_low01"; + gunnerAction = "ACE_SpottingScope"; gunnerGetInAction = "GetInLow"; gunnerGetOutAction = "GetOutLow"; gunnerForceOptics = 0; diff --git a/addons/spottingscope/README.md b/addons/spottingscope/README.md index ea9f2b819d..a07b9c6c85 100644 --- a/addons/spottingscope/README.md +++ b/addons/spottingscope/README.md @@ -3,8 +3,9 @@ ace_spottingscope Adds a spotting scope. + ## Maintainers The people responsible for merging changes to this component or answering potential questions. -- [Ruthberg] (http://github.com/Ulteq) \ No newline at end of file +- [Ruthberg](http://github.com/Ulteq) diff --git a/addons/spottingscope/config.cpp b/addons/spottingscope/config.cpp index a615e5da79..157e430868 100644 --- a/addons/spottingscope/config.cpp +++ b/addons/spottingscope/config.cpp @@ -6,11 +6,12 @@ class CfgPatches { weapons[] = {"ACE_SpottingScope"}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_apl", "ace_interaction"}; - author[] = {"Rocko", "Scubaman3D", "Ruthberg"}; + author[] = {"Rocko", "Scubaman3D", "Ruthberg", "commy2"}; VERSION_CONFIG; }; }; #include "CfgEventHandlers.hpp" #include "CfgVehicles.hpp" -#include "CfgWeapons.hpp" \ No newline at end of file +#include "CfgWeapons.hpp" +#include "CfgMoves.hpp" diff --git a/addons/spottingscope/data/spottingscope.p3d b/addons/spottingscope/data/spottingscope.p3d index c4e0363dcf..fba9d66b91 100644 Binary files a/addons/spottingscope/data/spottingscope.p3d and b/addons/spottingscope/data/spottingscope.p3d differ diff --git a/addons/switchunits/functions/fnc_addMapFunction.sqf b/addons/switchunits/functions/fnc_addMapFunction.sqf index 7204e73d36..3a7b20601c 100644 --- a/addons/switchunits/functions/fnc_addMapFunction.sqf +++ b/addons/switchunits/functions/fnc_addMapFunction.sqf @@ -10,19 +10,18 @@ * None * * Example: - * [_unit, _sides] call FUNC(addMapFunction) + * [_unit, _sides] call ace_switchunits_fnc_addMapFunction * * Public: No */ - #include "script_component.hpp" -PARAMS_2(_unit,_sides); +params ["_unit", "_sides"]; ["theMapClick", "onMapSingleClick", { // IGNORE_PRIVATE_WARNING(_pos,_shift,_alt) if (alive ACE_player && {GVAR(OriginalUnit) getVariable ["ACE_CanSwitchUnits", false]}) then { [_this, _pos, _shift, _alt] call FUNC(handleMapClick); }; - + }, [_unit, _sides]] call BIS_fnc_addStackedEventHandler; diff --git a/addons/switchunits/functions/fnc_handleMapClick.sqf b/addons/switchunits/functions/fnc_handleMapClick.sqf index e8efa2640f..03a94f81af 100644 --- a/addons/switchunits/functions/fnc_handleMapClick.sqf +++ b/addons/switchunits/functions/fnc_handleMapClick.sqf @@ -3,24 +3,25 @@ * Switches to a unit close to a clicked map position * * Arguments: - * 0: unit - * 1: sides > + * 0: Faction + * 0: unit + * 1: sides + * 1: Map Position * * Return Value: * None * * Example: - * [unit, _sides] call FUNC(handleMapClick) + * [[unit, _sides], [20, 30]] call ace_switchunits_fnc_handleMapClick * * Public: No */ - #include "script_component.hpp" -private ["_sides", "_pos", "_sideNearest"]; +private ["_sideNearest"]; -_sides = (_this select 0) select 1; -_pos = _this select 1; +params ["_faction", "_pos"]; +_faction params ["", "_sides"]; _sideNearest = []; @@ -28,7 +29,8 @@ _sideNearest = []; if ([_x] call FUNC(isValidAi) && (side group _x in _sides)) then { _sideNearest pushBack _x; }; -} forEach (nearestObjects [_pos, ["Man"], 15]); + nil +} count (nearestObjects [_pos, ["Man"], 15]); if (count _sideNearest > 0) then { [_sideNearest select 0] call FUNC(switchUnit); diff --git a/addons/switchunits/functions/fnc_initPlayer.sqf b/addons/switchunits/functions/fnc_initPlayer.sqf index 67669c071c..80388a9d2b 100644 --- a/addons/switchunits/functions/fnc_initPlayer.sqf +++ b/addons/switchunits/functions/fnc_initPlayer.sqf @@ -10,24 +10,21 @@ * None * * Example: - * [player, [west]] call FUNC(initPlayer) + * [player, [west]] call ace_switchunits_fnc_initPlayer * * Public: No */ - #include "script_component.hpp" -PARAMS_2(_playerUnit,_sides); +params ["_playerUnit", "_sides"]; if (vehicle _playerUnit == _playerUnit) then { - [_sides] call FUNC(markAiOnMap); _playerUnit setVariable [QGVAR(IsPlayerUnit), true]; _playerUnit allowDamage false; GVAR(OriginalUnit) = _playerUnit; - //GVAR(OriginalName) = [_playerUnit] call EFUNC(common,getName); GVAR(OriginalName) = name _playerUnit; GVAR(OriginalGroup) = group _playerUnit; diff --git a/addons/switchunits/functions/fnc_isValidAi.sqf b/addons/switchunits/functions/fnc_isValidAi.sqf index 61c2401da9..0b6a35c257 100644 --- a/addons/switchunits/functions/fnc_isValidAi.sqf +++ b/addons/switchunits/functions/fnc_isValidAi.sqf @@ -6,22 +6,19 @@ * 0: unit * * Return Value: - * Boolean + * Valid AI * * Example: - * [_unit] call FUNC(isValidAi) + * [_unit] call ace_switchunits_fnc_isValidAi * * Public: Yes */ - #include "script_component.hpp" -private "_unit"; - -_unit = _this select 0; +params ["_unit"]; !([_unit] call EFUNC(common,isPlayer) || {_unit in playableUnits} -|| {vehicle _unit != _unit} -|| {_unit getVariable [QGVAR(IsPlayerUnit), false]} -|| {_unit getVariable [QGVAR(IsPlayerControlled), false]}) +|| {vehicle _unit != _unit} +|| {_unit getVariable [QGVAR(IsPlayerUnit), false]} +|| {_unit getVariable [QGVAR(IsPlayerControlled), false]}) // return diff --git a/addons/switchunits/functions/fnc_markAiOnMap.sqf b/addons/switchunits/functions/fnc_markAiOnMap.sqf index 620b805cb9..db43c58f43 100644 --- a/addons/switchunits/functions/fnc_markAiOnMap.sqf +++ b/addons/switchunits/functions/fnc_markAiOnMap.sqf @@ -1,7 +1,7 @@ /* * Author: bux578 * Creates markers for AI units for given sides. - * Marks players in a different colour. + * Marks players in a different colour. * * Arguments: * 0: side @@ -10,28 +10,24 @@ * None * * Example: - * [[west, east]] call FUNC(markAiOnMap) + * [[west, east]] call ace_switchunits_fnc_markAiOnMap * * Public: No */ - #include "script_component.hpp" -private "_sidesToShow"; -_sidesToShow = _this select 0; +params ["_sidesToShow"]; GVAR(AllMarkerNames) = []; -DFUNC(pfhMarkAiOnMap) = { - private ["_args", "_sides"]; - _args = _this select 0; - _sides = _args select 0; - +[{ + params ["_args"]; + _args params ["_sides"]; // delete markers { - deleteMarkerLocal _x; - } forEach GVAR(AllMarkerNames); + deleteMarkerLocal _x; + } count GVAR(AllMarkerNames); // reset the array GVAR(AllMarkerNames) = []; @@ -48,7 +44,7 @@ DFUNC(pfhMarkAiOnMap) = { _marker = createMarkerLocal [_markerName, position _x]; _markerName setMarkerTypeLocal "mil_triangle"; _markerName setMarkerShapeLocal "ICON"; - _markerName setMarkerSizeLocal [0.5,0.7]; + _markerName setMarkerSizeLocal [0.5, 0.7]; _markerName setMarkerDirLocal getDir _x; // commy's one liner magic @@ -63,9 +59,8 @@ DFUNC(pfhMarkAiOnMap) = { }; GVAR(AllMarkerNames) pushBack _markerName; + nil }; - } forEach allUnits; + } count allUnits; }; -}; - -[FUNC(pfhMarkAiOnMap), 1.5, [_sidesToShow]] call CBA_fnc_addPerFrameHandler; +}, 1.5, [_sidesToShow]] call CBA_fnc_addPerFrameHandler; diff --git a/addons/switchunits/functions/fnc_module.sqf b/addons/switchunits/functions/fnc_module.sqf index 9563dea71f..3b8cea4037 100644 --- a/addons/switchunits/functions/fnc_module.sqf +++ b/addons/switchunits/functions/fnc_module.sqf @@ -15,12 +15,11 @@ * * Public: No */ - #include "script_component.hpp" if !(isServer) exitWith {}; -EXPLODE_3_PVT(_this,_logic,_units,_activated); +params ["_logic", "_units", "_activated"]; if !(_activated) exitWith {}; @@ -36,4 +35,4 @@ GVAR(Module) = true; [QGVAR(EnableSwitchUnits), true, false, true] call EFUNC(common,setSetting); -diag_log text "[ACE]: SwitchUnits Module Initialized."; +ACE_LOGINFO("Switch Unit Module Initialized."); diff --git a/addons/switchunits/functions/fnc_nearestPlayers.sqf b/addons/switchunits/functions/fnc_nearestPlayers.sqf index 987c4e3528..64e347d7da 100644 --- a/addons/switchunits/functions/fnc_nearestPlayers.sqf +++ b/addons/switchunits/functions/fnc_nearestPlayers.sqf @@ -10,7 +10,7 @@ * Player units > * * Example: - * [[300,300,0], 100] call FUNC(nearestPlayers) + * [[300,300,0], 100] call ace_switchunits_fnc_nearestPlayers * * Public: Yes */ @@ -18,10 +18,7 @@ private ["_nearestPlayers"]; -PARAMS_2(_position,_radius); - -_position = _this select 0; -_radius = _this select 1; +params ["_position", "_radius"]; _nearestPlayers = []; diff --git a/addons/switchunits/functions/fnc_startSwitchUnits.sqf b/addons/switchunits/functions/fnc_startSwitchUnits.sqf index 7985bfa094..481b04d2cd 100644 --- a/addons/switchunits/functions/fnc_startSwitchUnits.sqf +++ b/addons/switchunits/functions/fnc_startSwitchUnits.sqf @@ -9,14 +9,14 @@ * None * * Example: - * [_player] call FUNC(startSwitchUnits) + * [_player] call ace_switchunits_fnc_startSwitchUnits * * Public: No */ #include "script_component.hpp" -PARAMS_1(_player); +params ["_player"]; if (GVAR(EnableSwitchUnits)) then { private "_sides"; diff --git a/addons/switchunits/functions/fnc_switchBack.sqf b/addons/switchunits/functions/fnc_switchBack.sqf index c9ca731427..c3cb99588a 100644 --- a/addons/switchunits/functions/fnc_switchBack.sqf +++ b/addons/switchunits/functions/fnc_switchBack.sqf @@ -10,20 +10,19 @@ * None * * Example: - * [_originalPlayerUnit, _currentUnit] call FUNC(switchBack) + * [_originalPlayerUnit, _currentUnit] call ace_switchunits_fnc_switchBack * * Public: Yes */ - #include "script_component.hpp" -PARAMS_1(_originalPlayerUnit); +params ["_originalPlayerUnit"]; [_originalPlayerUnit] joinSilent GVAR(OriginalGroup); -DFUNC(pfhSwitchBack) = { - PARAMS_2(_args,_pfID); - EXPLODE_2_PVT(_args,_originalPlayerUnit,_currentUnit); +[{ + params ["_args", "_pfhId"]; + _args params ["_originalPlayerUnit", "_currentUnit"]; if (local _originalPlayerUnit) exitWith { selectPlayer _originalPlayerUnit; @@ -33,8 +32,6 @@ DFUNC(pfhSwitchBack) = { _layer = "BIS_fnc_respawnCounter" call bis_fnc_rscLayer; _layer cuttext ["","plain"]; - [(_this select 1)] call cba_fnc_removePerFrameHandler; + [_pfhId] call cba_fnc_removePerFrameHandler; }; -}; - -[FUNC(pfhSwitchBack), 0.2, _this] call CBA_fnc_addPerFrameHandler; +}, 0.2, _this] call CBA_fnc_addPerFrameHandler; diff --git a/addons/switchunits/functions/fnc_switchUnit.sqf b/addons/switchunits/functions/fnc_switchUnit.sqf index c57012afdb..793e72bb71 100644 --- a/addons/switchunits/functions/fnc_switchUnit.sqf +++ b/addons/switchunits/functions/fnc_switchUnit.sqf @@ -3,24 +3,21 @@ * Switches to the new given player unit * * Arguments: - * 0: current unit - * 1: the unit to switch to + * 0: the unit to switch to * * Return Value: * None * * Example: - * [_unit] call FUNC(switchUnit) + * [_unit] call ace_switchunits_fnc_switchUnit * * Public: Yes */ - - #include "script_component.hpp" private ["_nearestEnemyPlayers", "_allNearestPlayers", "_oldUnit", "_leave"]; -PARAMS_1(_unit); +params ["_unit"]; // don't switch to original player units if (!([_unit] call FUNC(isValidAi))) exitWith {}; @@ -29,14 +26,12 @@ if (!([_unit] call FUNC(isValidAi))) exitWith {}; _leave = false; if (GVAR(EnableSafeZone)) then { - _allNearestPlayers = [position _unit, GVAR(SafeZoneRadius)] call FUNC(nearestPlayers); _nearestEnemyPlayers = [_allNearestPlayers, {((side GVAR(OriginalGroup)) getFriend (side _this) < 0.6) && !(_this getVariable [QGVAR(IsPlayerControlled), false])}] call EFUNC(common,filter); if (count _nearestEnemyPlayers > 0) exitWith { _leave = true; }; - }; // exitWith doesn't exit past the "if(EnableSafeZone)" block @@ -49,21 +44,12 @@ if (_leave) exitWith { //[_unit] joinSilent group player; [[_unit, player], QUOTE({(_this select 0) setVariable [ARR_3(QUOTE(QGVAR(OriginalOwner)), owner (_this select 0), true)]; (_this select 0) setOwner owner (_this select 1)}), 1] call EFUNC(common,execRemoteFnc); -_oldUnit = player; - - -DFUNC(pfhSwitchUnit) = { - - private ["_args", "_unit", "_oldUnit", "_respawnEhId", "_oldOwner"]; - _args = _this select 0; - - _unit = _args select 0; - _oldUnit = _args select 1; - - +[{ + private ["_respawnEhId", "_oldOwner"]; + params ["_args", "_pfhId"]; + _args params ["_unit", "_oldUnit"]; if (local _unit) exitWith { - _oldUnit setVariable [QGVAR(IsPlayerControlled), false, true]; _oldUnit setVariable [QGVAR(PlayerControlledName), "", true]; @@ -90,9 +76,6 @@ DFUNC(pfhSwitchUnit) = { [localize LSTRING(SwitchedUnit)] call EFUNC(common,displayTextStructured); - [(_this select 1)] call cba_fnc_removePerFrameHandler; - + [_pfhId] call cba_fnc_removePerFrameHandler; }; -}; - -[FUNC(pfhSwitchUnit), 0.2, [_unit, _oldUnit]] call CBA_fnc_addPerFrameHandler; +}, 0.2, [_unit, player]] call CBA_fnc_addPerFrameHandler; diff --git a/addons/switchunits/stringtable.xml b/addons/switchunits/stringtable.xml index 2d0bc91314..d38175b1da 100644 --- a/addons/switchunits/stringtable.xml +++ b/addons/switchunits/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -32,6 +32,9 @@ Einheiten-Switch-System? Systém výměny stran Sistema de troca de unidades + Système de changement d'unité + Egységváltó-rendszer + Переключение между юнитами Switch to West? @@ -40,6 +43,9 @@ Nach BLUFOR wechseln? Přesunout k BLUFOR? Trocar para Oeste? + Changer en OUEST? + Átváltás BLUFOR-ra? + На синих? Allow switching to west units? @@ -48,6 +54,9 @@ Erlaube das Wechseln zu BLUFOR-Einheiten? Povolit přesun k BLUFOR? Permitir troca de unidades para o Oeste? + Permettre le changement en unité OUEST? + Nyugat-fakciós egységekre való váltás engedélyezése? + Разрешить переключаться на синих юнитов? Switch to East? @@ -56,6 +65,9 @@ Nach OPFOR wechseln? Přesunout k OPFOR? Trocar para Leste? + Changer en EST? + Átváltás OPFOR-ra? + На красных? Allow switching to east units? @@ -64,6 +76,9 @@ Erlaube das Wechseln zu OPFOR-Einheiten? Povolit přesun k OPFOR? Permitir troca de unidades para o Leste? + Permettre le changement en unité EST? + Kelet-fakciós egységekre való váltás engedélyezése? + Разрешить переключаться на красных юнитов? Switch to Independent? @@ -72,6 +87,9 @@ Nach INDFOR wechseln? Přesunout k INDFOR? Trocar para Indenpendente + Changer en INDE? + Átváltás INDFOR-ra? + На независимых? Allow switching to independent units? @@ -80,6 +98,9 @@ Erlaube das Wechseln zu INDFOR-Einheiten? Povolit přesun k INDFOR? Permitir troca de unidades para o Indenpendente? + Permettre le changement en unité INDE? + Független egységekre való váltás engedélyezése? + Разрешить переключаться на независимых юнитов? Switch to Civilian? @@ -88,6 +109,9 @@ Nach CIVILIAN wechseln? Přesunout k CIVILISTŮM? Trocar para Civis? + Changer en CIV? + Átváltás civilre? + На гражданских? Allow switching to civilian units? @@ -96,6 +120,9 @@ Erlaube das Wechseln zu CIVILIAN-Einheiten? Povolit přesun k CIVILISTŮM? Permitir troca de unidades para o Civil? + Permettre le changement en unité CIV? + Civil egységekre való váltás engedélyezése? + Разрешить переключаться на гражданских юнитов? Enable Safe Zone? @@ -104,6 +131,9 @@ Aktiviere Sicherheitszone? Povolit bezpečné oblasti? Habilitar zona segura? + Activer la zone sécurisée? + Biztonságos zóna engedélyezése? + Безопасная зона Enable a safe zone around enemy units? Players can't switch to units inside of the safe zone. @@ -112,6 +142,9 @@ Aktiviere eine Sicherheitszone um feindliche Einheiten? Spieler können nicht zu Einheiten in der Sicherheitszone wechseln. Povolit bezpečnou zónu kolem nepřátelských jednotek? Hráči se nemohou změnit strany/jednotky uvnitř bezpečné zóny. Habilitar uma zona segur ao redor das unidades inimigas? Jogadores não conseguirão trocar para unidades dentro dessa zona segura. + Activer une zone sécurisée autour des enemis? Les joueurs ne peuvent changer d'unité dand la zone sécurisée + Engedélyezve legyen-e egy biztonságos zóna az ellenségek körül? A játékosok nem tudnak a biztonságos zónán belüli egységekre váltani. + Включить безопасную зону вокруг вражеских юнитов? Игроки не могут переключаться на юнитов, находящихся в безопасной зоне. Safe Zone Radius @@ -120,6 +153,9 @@ Sicherheitszonenradius Oblast bezpečné zóny Raio da zona segura + Rayon de la zone sécurisée + Biztonságos zóna hatóköre + Радиус безопасной зоны The safe zone around players from a different team. Default: 200 @@ -128,12 +164,17 @@ Die Sicherheitszone um Spieler von einem anderen Team. Standard: 200 Bezpečná zóna kolem hráče z jiných týmu. Výchozí: 200 A zona segura ao redor dos jogadores de diferentes equipes. Padrão: 200 + Rayon de la zone sécurisée autour de joueurs d'équipe différentes. Défaut: 200 + A biztonságos zóna más csapatból lévő játékosok körül. Alapértelmezett: 200 + Радиус безопасной зоны вокруг ироков из противоположной команды. По-умолчанию: 200 - + Module allows you to switch side during the game. Moduł ten pozwala na zmianę strony w trakcie gry. Tento modul umožňuje přepínání mazi dostupnými stranami. Este módulo permite mudar o lado à disposição dos jogadores. + Этот модуль позволяет игрокам переключаться между доступными юнитами. + Ce module permet le changement de faction des joueurs - \ No newline at end of file + diff --git a/addons/tacticalladder/CfgEventHandlers.hpp b/addons/tacticalladder/CfgEventHandlers.hpp index 737cae5e43..f9ceb35aa5 100644 --- a/addons/tacticalladder/CfgEventHandlers.hpp +++ b/addons/tacticalladder/CfgEventHandlers.hpp @@ -1,3 +1,4 @@ + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE( call COMPILE_FILE(XEH_preInit) ); @@ -9,3 +10,11 @@ class Extended_PostInit_EventHandlers { init = QUOTE( call COMPILE_FILE(XEH_postInit) ); }; }; + +class Extended_Killed_EventHandlers { + class CAManBase { + class ADDON { + killed = QUOTE(_this call FUNC(handleKilled)); + }; + }; +}; diff --git a/addons/tacticalladder/CfgVehicles.hpp b/addons/tacticalladder/CfgVehicles.hpp index a1eda1a955..1457c4ddee 100644 --- a/addons/tacticalladder/CfgVehicles.hpp +++ b/addons/tacticalladder/CfgVehicles.hpp @@ -5,8 +5,8 @@ class CfgVehicles { class ACE_SelfActions { class ACE_TacticalLadders { displayName = CSTRING(Deploy); - condition = QUOTE((backpack ACE_player) == QUOTE(QUOTE(ACE_TacticalLadder_Pack))); - statement = QUOTE(call FUNC(deployTL)); + condition = QUOTE(backpack _player == 'ACE_TacticalLadder_Pack'); + statement = QUOTE([_player] call FUNC(deployTL)); exceptions[] = {}; showDisabled = 1; priority = 4; @@ -33,7 +33,7 @@ class CfgVehicles { }; class House; - class ACE_Tactical_Ladder: House { + class ACE_TacticalLadder: House { XEH_ENABLED; displayName = CSTRING(DisplayName); class DestructionEffects {}; @@ -42,6 +42,7 @@ class CfgVehicles { autocenter = 0; featureSize = 12; ladders[] = {{"start","end"}}; + class AnimationSources { class rotate { source = "user"; @@ -62,28 +63,31 @@ class CfgVehicles { class extract_10: extract_1 {}; class extract_11: extract_1 {}; }; + class ACE_Actions { class ACE_MainActions { selection = "roadway"; distance = 5; condition = "true"; + class ACE_PickUp { selection = ""; displayName = CSTRING(Pickup); distance = 4; condition = QUOTE((backpack ACE_player) == ''); - statement = QUOTE([ARR_2(_target,_player)] call FUNC(pickupTL)); + statement = QUOTE([ARR_2(_player,_target)] call FUNC(pickupTL)); showDisabled = 0; exceptions[] = {}; priority = 5; }; + class ACE_Position { selection = ""; displayName = CSTRING(Position); distance = 4; condition = "true"; //wait a frame to handle "Do When releasing action menu key" option: - statement = QUOTE([ARR_2({_this call FUNC(positionTL)}, [ARR_2(_target,_player)])] call EFUNC(common,execNextFrame)); + statement = QUOTE([ARR_2({_this call FUNC(positionTL)},[ARR_2(_player,_target)])] call EFUNC(common,execNextFrame)); showDisabled = 0; exceptions[] = {}; priority = 5; diff --git a/addons/tacticalladder/README.md b/addons/tacticalladder/README.md index ff6b8ecad3..c4b84b1613 100644 --- a/addons/tacticalladder/README.md +++ b/addons/tacticalladder/README.md @@ -3,8 +3,9 @@ ace_tacticalladder Adds a packable tactical ladder. + ## Maintainers The people responsible for merging changes to this component or answering potential questions. -- [Ruthberg] (http://github.com/Ulteq) \ No newline at end of file +- [Ruthberg](http://github.com/Ulteq) diff --git a/addons/tacticalladder/XEH_postInit.sqf b/addons/tacticalladder/XEH_postInit.sqf index f0091ec7fa..8ebf776987 100644 --- a/addons/tacticalladder/XEH_postInit.sqf +++ b/addons/tacticalladder/XEH_postInit.sqf @@ -1,15 +1,28 @@ #include "script_component.hpp" +if (!hasInterface) exitWith {}; + GVAR(ladder) = objNull; GVAR(cancelTime) = 0; GVAR(currentStep) = 3; GVAR(currentAngle) = 0; -// Cancel tactical ladder deployment if the interact menu is opened -["interactMenuOpened", { +/*["interactMenuOpened", { if ((ACE_time > GVAR(cancelTime)) && !isNull GVAR(ladder)) then { GVAR(ladder) call FUNC(cancelTLdeploy); }; -}] call EFUNC(common,addEventHandler); +}] call EFUNC(common,addEventHandler);*/ -[{(_this select 0) call FUNC(handleScrollWheel);}] call EFUNC(Common,addScrollWheelEventHandler); +// Cancel adjustment if interact menu opens +["interactMenuOpened", {[ACE_player] call FUNC(handleInteractMenuOpened)}] call EFUNC(common,addEventHandler); + +[{_this call FUNC(handleScrollWheel)}] call EFUNC(common,addScrollWheelEventHandler); + +// Cancel adjusting on player change. +["playerChanged", {_this call FUNC(handlePlayerChanged)}] call EFUNC(common,addEventhandler); +["playerVehicleChanged", {[ACE_player, objNull] call FUNC(handlePlayerChanged)}] call EFUNC(common,addEventhandler); + +// handle falling unconscious +["medical_onUnconscious", {_this call FUNC(handleUnconscious)}] call EFUNC(common,addEventhandler); + +// @todo captivity? diff --git a/addons/tacticalladder/XEH_preInit.sqf b/addons/tacticalladder/XEH_preInit.sqf index e434974c9a..cb1d3a8cf3 100644 --- a/addons/tacticalladder/XEH_preInit.sqf +++ b/addons/tacticalladder/XEH_preInit.sqf @@ -5,7 +5,11 @@ ADDON = false; PREP(cancelTLdeploy); PREP(confirmTLdeploy); PREP(deployTL); +PREP(handleKilled); +PREP(handleInteractMenuOpened); +PREP(handlePlayerChanged); PREP(handleScrollWheel); +PREP(handleUnconscious); PREP(pickupTL); PREP(positionTL); diff --git a/addons/tacticalladder/data/ace_tacticalladder.p3d b/addons/tacticalladder/data/ace_tacticalladder.p3d index a331f24084..ad1c21c144 100644 Binary files a/addons/tacticalladder/data/ace_tacticalladder.p3d and b/addons/tacticalladder/data/ace_tacticalladder.p3d differ diff --git a/addons/tacticalladder/data/ace_tacticalladder_pack.p3d b/addons/tacticalladder/data/ace_tacticalladder_pack.p3d index e7b565ff11..5373648426 100644 Binary files a/addons/tacticalladder/data/ace_tacticalladder_pack.p3d and b/addons/tacticalladder/data/ace_tacticalladder_pack.p3d differ diff --git a/addons/tacticalladder/data/model.cfg b/addons/tacticalladder/data/model.cfg index 1fc8840d4f..ba19d58c65 100644 --- a/addons/tacticalladder/data/model.cfg +++ b/addons/tacticalladder/data/model.cfg @@ -1,4 +1,4 @@ -class CfgSkeletons { +class CfgSkeletons { class Default { isDiscrete = 1; skeletonInherit = ""; @@ -21,7 +21,7 @@ class CfgSkeletons { "10","9", "11","10", "step","11" - }; + }; }; class OFP2_ManSkeleton { isDiscrete = 0; @@ -180,7 +180,7 @@ class CfgModels { class ace_tacticalladder { skeletonName = "ace_tacticalladder_skeleton"; sections[] = { "roadway" }; - sectionsInherit = ""; + sectionsInherit = ""; class Animations { class rotate { type = "rotation"; @@ -192,7 +192,7 @@ class CfgModels { maxValue = 90; angle0="rad 0"; angle1="rad +90"; - }; + }; class extract_1 { type = "translation"; source = ""; @@ -280,4 +280,4 @@ class CfgModels { }; class ace_tacticalladder_pack: ArmaMan { }; -}; \ No newline at end of file +}; diff --git a/addons/tacticalladder/functions/fnc_cancelTLdeploy.sqf b/addons/tacticalladder/functions/fnc_cancelTLdeploy.sqf index 456d245832..c134df31d1 100644 --- a/addons/tacticalladder/functions/fnc_cancelTLdeploy.sqf +++ b/addons/tacticalladder/functions/fnc_cancelTLdeploy.sqf @@ -1,9 +1,10 @@ /* - * Author: Rocko, Ruthberg + * Author: Rocko, Ruthberg, commy2 * Cancel tactical ladder deployment * * Arguments: - * 0: ladder + * 0: unit + * 1: ladder * * Return Value: * None @@ -17,16 +18,23 @@ #define __ANIMS ["extract_1","extract_2","extract_3","extract_4","extract_5","extract_6","extract_7","extract_8","extract_9","extract_10","extract_11"] -params ["_ladder"]; +params ["_unit", "_ladder"]; + +// enable running again +[_unit, "ACE_Ladder", false] call EFUNC(common,setForceWalkStatus); detach _ladder; + _ladder animate ["rotate", 0]; + { _ladder animate [_x, 0]; } count __ANIMS; +// remove mouse buttons and hint call EFUNC(interaction,hideMouseHint); -[ACE_player, "DefaultAction", ACE_player getVariable [QGVAR(Deploy), -1]] call EFUNC(Common,removeActionEventHandler); -[ACE_player, "zoomtemp", ACE_player getVariable [QGVAR(Cancel), -1]] call EFUNC(Common,removeActionEventHandler); + +[_unit, "DefaultAction", _unit getVariable [QGVAR(Deploy), -1]] call EFUNC(Common,removeActionEventHandler); +[_unit, "zoomtemp", _unit getVariable [QGVAR(Cancel), -1]] call EFUNC(Common,removeActionEventHandler); GVAR(ladder) = objNull; diff --git a/addons/tacticalladder/functions/fnc_confirmTLdeploy.sqf b/addons/tacticalladder/functions/fnc_confirmTLdeploy.sqf index 764e5c73d8..0094e460dc 100644 --- a/addons/tacticalladder/functions/fnc_confirmTLdeploy.sqf +++ b/addons/tacticalladder/functions/fnc_confirmTLdeploy.sqf @@ -1,9 +1,10 @@ /* - * Author: Rocko, Ruthberg + * Author: Rocko, Ruthberg, commy2 * Confirm tactical ladder deployment * * Arguments: - * 0: ladder + * 0: unit + * 1: ladder * * Return Value: * Success @@ -15,18 +16,26 @@ */ #include "script_component.hpp" -params ["_ladder"]; +params ["_unit", "_ladder"]; + +// enable running again +[_unit, "ACE_Ladder", false] call EFUNC(common,setForceWalkStatus); private ["_pos1", "_pos2"]; -_pos1 = getPosASL GVAR(ladder); -_pos2 = (GVAR(ladder) modelToWorld (GVAR(ladder) selectionPosition "check2")) call EFUNC(common,positionToASL); -if (lineIntersects [_pos1, _pos2, GVAR(ladder)]) exitWith { false }; -call EFUNC(interaction,hideMouseHint); -[ACE_player, "DefaultAction", ACE_player getVariable [QGVAR(Deploy), -1]] call EFUNC(Common,removeActionEventHandler); -[ACE_player, "zoomtemp", ACE_player getVariable [QGVAR(Cancel), -1]] call EFUNC(Common,removeActionEventHandler); +_pos1 = getPosASL _ladder; +_pos2 = AGLToASL (_ladder modelToWorld (_ladder selectionPosition "check2")); + +if (lineIntersects [_pos1, _pos2, _ladder]) exitWith {false}; detach _ladder; + +// remove mouse buttons and hint +call EFUNC(interaction,hideMouseHint); + +[_unit, "DefaultAction", _unit getVariable [QGVAR(Deploy), -1]] call EFUNC(common,removeActionEventHandler); +[_unit, "zoomtemp", _unit getVariable [QGVAR(Cancel), -1]] call EFUNC(common,removeActionEventHandler); + GVAR(ladder) = objNull; true diff --git a/addons/tacticalladder/functions/fnc_deployTL.sqf b/addons/tacticalladder/functions/fnc_deployTL.sqf index 14c386dda1..b0eb1e0f68 100644 --- a/addons/tacticalladder/functions/fnc_deployTL.sqf +++ b/addons/tacticalladder/functions/fnc_deployTL.sqf @@ -3,32 +3,35 @@ * Deploy tactical ladder * * Arguments: - * None + * 0: unit * * Return Value: * None * * Example: - * [] call ace_tacticalladder_fnc_deployTL + * [_unit] call ace_tacticalladder_fnc_deployTL * * Public: No */ #include "script_component.hpp" -if ((backpack ACE_player) != "ACE_TacticalLadder_Pack") exitWith {}; +params ["_unit"]; + +if (backpack _unit != 'ACE_TacticalLadder_Pack') exitWith {}; + +removeBackpack _unit; private ["_pos", "_offset", "_ladder"]; -removeBackpack ACE_player; +_pos = _unit modelToWorld [0,0,0]; +_offset = if ((_unit call CBA_fnc_getUnitAnim select 0) == "prone") then { 1 } else {0.8}; -_pos = ACE_player modelToWorld [0,0,0]; -_offset = if ((ACE_player call CBA_fnc_getUnitAnim select 0) == "prone") then { 1 } else {0.8}; -_pos set [0, (_pos select 0) + (sin (direction ACE_player) * _offset)]; -_pos set [1, (_pos select 1) + (cos (direction ACE_player) * _offset)]; -_pos set [2, [ACE_player] call CBA_fnc_realHeight]; +_pos set [0, (_pos select 0) + (sin getDir _unit) * _offset]; +_pos set [1, (_pos select 1) + (cos getDir _unit) * _offset]; +_pos set [2, [_unit] call CBA_fnc_realHeight]; -_ladder = "ACE_Tactical_Ladder" createVehicle _pos; +_ladder = "ACE_TacticalLadder" createVehicle _pos; _ladder setPos _pos; -_ladder setDir (direction ACE_player); +_ladder setDir getDir _unit; -ACE_player reveal _ladder; +_unit reveal _ladder; diff --git a/addons/tacticalladder/functions/fnc_handleInteractMenuOpened.sqf b/addons/tacticalladder/functions/fnc_handleInteractMenuOpened.sqf new file mode 100644 index 0000000000..c7187acd55 --- /dev/null +++ b/addons/tacticalladder/functions/fnc_handleInteractMenuOpened.sqf @@ -0,0 +1,19 @@ +/* + * Author: commy2 + * Handle opening of interaction menu. + * + * Arguments: + * 0: Unit + * + * Return Value: + * None + * + * Public: No +*/ +#include "script_component.hpp" + +params ["_unit"]; + +if (!isNull (GETMVAR(GVAR(ladder),objNull)) && {GVAR(ladder) in attachedObjects _unit}) then { + [_unit, GVAR(ladder)] call FUNC(cancelTLdeploy); +}; diff --git a/addons/tacticalladder/functions/fnc_handleKilled.sqf b/addons/tacticalladder/functions/fnc_handleKilled.sqf new file mode 100644 index 0000000000..c5d6aa1314 --- /dev/null +++ b/addons/tacticalladder/functions/fnc_handleKilled.sqf @@ -0,0 +1,19 @@ +/* + * Author: commy2 + * Handle death. + * + * Arguments: + * 0: Unit + * + * Return Value: + * None + * + * Public: No +*/ +#include "script_component.hpp" + +params ["_unit"]; + +if (!isNull (GETMVAR(ladder,objNull)) && {GVAR(ladder) in attachedObjects _unit}) then { + [_unit, GVAR(ladder)] call FUNC(cancelTLdeploy); +}; diff --git a/addons/tacticalladder/functions/fnc_handlePlayerChanged.sqf b/addons/tacticalladder/functions/fnc_handlePlayerChanged.sqf new file mode 100644 index 0000000000..07118acbaf --- /dev/null +++ b/addons/tacticalladder/functions/fnc_handlePlayerChanged.sqf @@ -0,0 +1,26 @@ +/* + * Author: commy2 + * Handle player changes. + * + * Arguments: + * 0: New Player Unit + * 1: Old Player Unit + * + * Return Value: + * None + * + * Public: No +*/ +#include "script_component.hpp" + +if (isNull (GETGVAR(ladder,objNull))) exitWith {}; + +params ["_newPlayer", "_oldPlayer"]; + +if (GVAR(ladder) in attachedObjects _newPlayer) then { + [_newPlayer, GVAR(ladder)] call FUNC(cancelTLdeploy); +}; + +if (GVAR(ladder) in attachedObjects _oldPlayer) then { + [_oldPlayer, GVAR(ladder)] call FUNC(cancelTLdeploy); +}; diff --git a/addons/tacticalladder/functions/fnc_handleScrollWheel.sqf b/addons/tacticalladder/functions/fnc_handleScrollWheel.sqf index 6b5107b814..0b64d89610 100644 --- a/addons/tacticalladder/functions/fnc_handleScrollWheel.sqf +++ b/addons/tacticalladder/functions/fnc_handleScrollWheel.sqf @@ -41,7 +41,7 @@ if (GETMVAR(ACE_Modifier,0) == 0) then { }; } else { // Tilting - GVAR(currentAngle) = 0 max (GVAR(currentAngle) + _scroll) min 90; + GVAR(currentAngle) = 0 max (GVAR(currentAngle) + _scroll) min 30; GVAR(ladder) animate ["rotate", GVAR(currentAngle)]; }; diff --git a/addons/tacticalladder/functions/fnc_handleUnconscious.sqf b/addons/tacticalladder/functions/fnc_handleUnconscious.sqf new file mode 100644 index 0000000000..e9ce28d524 --- /dev/null +++ b/addons/tacticalladder/functions/fnc_handleUnconscious.sqf @@ -0,0 +1,19 @@ +/* + * Author: commy2 + * Handle unconsciousness. + * + * Arguments: + * 0: Unit + * + * Return Value: + * None + * + * Public: No +*/ +#include "script_component.hpp" + +params ["_unit"]; + +if (!isNull (GETMVAR(ladder,objNull)) && {GVAR(ladder) in attachedObjects _unit}) then { + [_unit, GVAR(ladder)] call FUNC(cancelTLdeploy); +}; diff --git a/addons/tacticalladder/functions/fnc_pickupTL.sqf b/addons/tacticalladder/functions/fnc_pickupTL.sqf index ad409f8870..d8e313a17b 100644 --- a/addons/tacticalladder/functions/fnc_pickupTL.sqf +++ b/addons/tacticalladder/functions/fnc_pickupTL.sqf @@ -1,26 +1,27 @@ /* - * Author: Rocko, Ruthberg + * Author: Rocko, Ruthberg, commy2 * Pick up tactical ladder * * Arguments: - * 0: ladder - * 1: unit + * 0: unit + * 1: ladder * * Return Value: * Success * * Example: - * [_ladder, _unit] call ace_tacticalladder_fnc_pickupTL + * [_unit, _ladder] call ace_tacticalladder_fnc_pickupTL * * Public: No */ #include "script_component.hpp" -if ((backpack ACE_player) != "") exitWith { false }; +params ["_unit", "_ladder"]; -params ["_ladder", "_unit"]; +if (backpack _unit != "") exitWith {false}; deleteVehicle _ladder; + _unit addBackpack "ACE_TacticalLadder_Pack"; true diff --git a/addons/tacticalladder/functions/fnc_positionTL.sqf b/addons/tacticalladder/functions/fnc_positionTL.sqf index 1035101556..1e7f0db209 100644 --- a/addons/tacticalladder/functions/fnc_positionTL.sqf +++ b/addons/tacticalladder/functions/fnc_positionTL.sqf @@ -3,14 +3,14 @@ * Position tactical ladder * * Arguments: - * 0: sandbag - * 1: unit + * 0: unit + * 1: ladder * * Return Value: * None * * Example: - * [_ladder, _unit] call ace_tacticalladder_fnc_positionTL + * [_unit, _ladder] call ace_tacticalladder_fnc_positionTL * * Public: No */ @@ -18,13 +18,17 @@ #define __ANIMS ["extract_1","extract_2","extract_3","extract_4","extract_5","extract_6","extract_7","extract_8","extract_9","extract_10","extract_11"] -params ["_ladder", "_unit"]; +params ["_unit", "_ladder"]; + +// prevent the placing unit from running +[_unit, "ACE_Ladder", true] call EFUNC(common,setForceWalkStatus); { _ladder animate [_x, 0]; } count __ANIMS; -_unit switchMove "amovpercmstpslowwrfldnon_player_idlesteady03"; +[_unit, "amovpercmstpslowwrfldnon_player_idlesteady03", 2] call EFUNC(common,doAnimation); + _ladder attachTo [_unit, [0, 0.75, 0], ""]; // Position ladder in front of player _ladder animate ["rotate", 0]; @@ -37,16 +41,17 @@ GVAR(cancelTime) = ACE_time + 1; // Workaround to prevent accidental canceling GVAR(currentStep) = 3; GVAR(currentAngle) = 0; +// add mouse buttons and hints [localize LSTRING(Deploy), localize LSTRING(Drop), localize LSTRING(Adjust)] call EFUNC(interaction,showMouseHint); -ACE_player setVariable [QGVAR(Deploy), - [ACE_player, "DefaultAction", +_unit setVariable [QGVAR(Deploy), [ + _unit, "DefaultAction", {!isNull GVAR(ladder)}, - {GVAR(ladder) call FUNC(confirmTLdeploy);} -] call EFUNC(common,AddActionEventHandler)]; + {[_this select 0, GVAR(ladder)] call FUNC(confirmTLdeploy)} +] call EFUNC(common,addActionEventHandler)]; -ACE_player setVariable [QGVAR(Cancel), - [ACE_player, "zoomtemp", +_unit setVariable [QGVAR(Cancel), [ + _unit, "zoomtemp", {!isNull GVAR(ladder)}, - {GVAR(ladder) call FUNC(cancelTLdeploy);} -] call EFUNC(common,AddActionEventHandler)]; + {[_this select 0, GVAR(ladder)] call FUNC(cancelTLdeploy)} +] call EFUNC(common,addActionEventHandler)]; diff --git a/addons/tacticalladder/stringtable.xml b/addons/tacticalladder/stringtable.xml index 4342ac5408..b347c4e2d9 100644 --- a/addons/tacticalladder/stringtable.xml +++ b/addons/tacticalladder/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -7,10 +7,10 @@ Телескопическая лестница Drabina teleskopowa Escalera telescópica - Telescopic Ladder + Echelle téléscopique Teleskopický žebřík Telescopic Ladder - Telescopic Ladder + Teleszkopikus létra Escada telescópica @@ -19,10 +19,10 @@ Установить лестницу Rozłóż drabinę Despelgar escalera - Deploy ladder + Déployer l'échelle Rozložit žebřík Deploy ladder - Deploy ladder + Létra lerakása Implantar escada @@ -31,19 +31,16 @@ Положить лестницу Zostaw drabinę Soltar escalera - Drop ladder + Lacher l'échelle Položit žebřík Drop ladder - Drop ladder + Létra eldobása Derrubar escada - Adjust ladder - Leiter einstellen - Reguluj drabinę - Upravit žebřík - Ajustar escalera - Ajustar escada + Extend, +Ctrl tilt + Ausfahren, +Strg kippen + Rozłóż, +Ctrl nachyl Position ladder @@ -51,10 +48,10 @@ Перенести лестницу Postaw drabinę Colocar escalera - Position ladder + Positionner l'échelle Umístit žebřík Position ladder - Position ladder + Létra elhelyezése Posicionar escada @@ -63,11 +60,11 @@ Взять лестницу Zabierz drabinę Recoger escalera - Pickup ladder + Prendre l'échelle Vzít žebřík Pickup ladder - Pickup ladder + Létra felvétele Pegar escada - \ No newline at end of file + diff --git a/addons/testmissions/README.md b/addons/testmissions/README.md new file mode 100644 index 0000000000..e8737f0ab6 --- /dev/null +++ b/addons/testmissions/README.md @@ -0,0 +1,11 @@ +ace_testmissions +=========== + +Provides test missions. + + +## Maintainers + +The people responsible for merging changes to this component or answering potential questions. + +- None diff --git a/addons/tripod/CfgEventHandlers.hpp b/addons/tripod/CfgEventHandlers.hpp index d700ed4c85..ed59062ad5 100644 --- a/addons/tripod/CfgEventHandlers.hpp +++ b/addons/tripod/CfgEventHandlers.hpp @@ -1,3 +1,4 @@ + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE( call COMPILE_FILE(XEH_preInit) ); @@ -17,3 +18,11 @@ class Extended_Init_EventHandlers { }; }; }; + +class Extended_Killed_EventHandlers { + class CAManBase { + class ADDON { + killed = QUOTE(_this call FUNC(handleKilled)); + }; + }; +}; diff --git a/addons/tripod/CfgVehicles.hpp b/addons/tripod/CfgVehicles.hpp index 2a689ba349..60486b8afb 100644 --- a/addons/tripod/CfgVehicles.hpp +++ b/addons/tripod/CfgVehicles.hpp @@ -2,15 +2,13 @@ class CfgVehicles { class Man; class CAManBase: Man { class ACE_SelfActions { - class ACE_Equipment { - class GVAR(place) { - displayName = CSTRING(Placedown); - condition = QUOTE([ARR_2(_player,'ACE_Tripod')] call EFUNC(common,hasItem)); - statement = QUOTE([ARR_2(_player,'ACE_Tripod')] call FUNC(place)); - showDisabled = 0; - priority = 2; - icon = PATHTOF(UI\w_sniper_tripod_ca.paa); - }; + class GVAR(place) { + displayName = CSTRING(Placedown); + condition = QUOTE([ARR_2(_player,'ACE_Tripod')] call EFUNC(common,hasItem)); + statement = QUOTE([ARR_2(_player,'ACE_Tripod')] call FUNC(place)); + showDisabled = 0; + priority = 2; + icon = PATHTOF(UI\w_sniper_tripod_ca.paa); }; }; }; @@ -37,9 +35,13 @@ class CfgVehicles { class thingX; class ACE_TripodObject: thingX { XEH_ENABLED; + EGVAR(dragging,canDrag) = 1; + EGVAR(dragging,dragPosition[]) = {0,1,0}; + EGVAR(dragging,dragDirection) = 0; scope = 2; displayName = CSTRING(DisplayName); model = PATHTOF(data\sniper_tripod.p3d); + class AnimationSources { class slide_down_tripod { source = "user"; @@ -52,32 +54,32 @@ class CfgVehicles { class retract_leg_2: retract_leg_1 {}; class retract_leg_3: retract_leg_2 {}; }; - EGVAR(dragging,canDrag) = 1; - EGVAR(dragging,dragPosition[]) = {0,1,0}; - EGVAR(dragging,dragDirection) = 0; + class ACE_Actions { class ACE_MainActions { selection = ""; distance = 5; condition = "true"; + class ACE_Pickup { selection = ""; displayName = CSTRING(PickUp); distance = 5; condition = "true"; - statement = QUOTE([ARR_2(_target,_player)] call FUNC(pickup)); + statement = QUOTE([ARR_2(_player,_target)] call FUNC(pickup)); showDisabled = 0; exceptions[] = {}; priority = 5; icon = PATHTOF(UI\w_sniper_tripod_ca.paa); }; + class ACE_Adjust { selection = ""; displayName = CSTRING(Adjust); distance = 5; condition = "true"; //wait a frame to handle "Do When releasing action menu key" option: - statement = QUOTE([ARR_2({_this call FUNC(adjust)}, [_target])] call EFUNC(common,execNextFrame)); + statement = QUOTE([ARR_2({_this call FUNC(adjust)}, [ARR_2(_player,_target)])] call EFUNC(common,execNextFrame)); showDisabled = 0; exceptions[] = {}; priority = 5; diff --git a/addons/tripod/README.md b/addons/tripod/README.md index 1f4282f1ab..beb6791b6d 100644 --- a/addons/tripod/README.md +++ b/addons/tripod/README.md @@ -3,8 +3,9 @@ ace_tripod Adds a packable tripod. + ## Maintainers The people responsible for merging changes to this component or answering potential questions. -- [Ruthberg] (http://github.com/Ulteq) \ No newline at end of file +- [Ruthberg](http://github.com/Ulteq) diff --git a/addons/tripod/XEH_postInit.sqf b/addons/tripod/XEH_postInit.sqf index 706aaecae9..6f2dc9b7e0 100644 --- a/addons/tripod/XEH_postInit.sqf +++ b/addons/tripod/XEH_postInit.sqf @@ -1,16 +1,21 @@ #include "script_component.hpp" -GVAR(adjuster) = objNull; -GVAR(adjusting) = false; +if (!hasInterface) exitWith {}; + GVAR(adjustPFH) = -1; GVAR(height) = 0; // Cancel adjustment if interact menu opens -["interactMenuOpened", { - if (GVAR(adjustPFH) != -1 && GVAR(adjusting)) then { - GVAR(adjusting) = false; - }; -}] call EFUNC(common,addEventHandler); +["interactMenuOpened", {[ACE_player] call FUNC(handleInteractMenuOpened)}] call EFUNC(common,addEventHandler); -[{(_this select 0) call FUNC(handleScrollWheel);}] call EFUNC(Common,addScrollWheelEventHandler); +[{_this call FUNC(handleScrollWheel)}] call EFUNC(common,addScrollWheelEventHandler); + +// Cancel adjusting on player change. +["playerChanged", {_this call FUNC(handlePlayerChanged)}] call EFUNC(common,addEventhandler); +["playerVehicleChanged", {[ACE_player, objNull] call FUNC(handlePlayerChanged)}] call EFUNC(common,addEventhandler); + +// handle falling unconscious +["medical_onUnconscious", {_this call FUNC(handleUnconscious)}] call EFUNC(common,addEventhandler); + +// @todo captivity? diff --git a/addons/tripod/XEH_preInit.sqf b/addons/tripod/XEH_preInit.sqf index f27b707936..1699258b47 100644 --- a/addons/tripod/XEH_preInit.sqf +++ b/addons/tripod/XEH_preInit.sqf @@ -3,7 +3,11 @@ ADDON = false; PREP(adjust); +PREP(handleInteractMenuOpened); +PREP(handleKilled); +PREP(handlePlayerChanged); PREP(handleScrollWheel); +PREP(handleUnconscious); PREP(pickup); PREP(place); diff --git a/addons/tripod/functions/fnc_adjust.sqf b/addons/tripod/functions/fnc_adjust.sqf index 1ba99cedbe..2b8659b2a4 100644 --- a/addons/tripod/functions/fnc_adjust.sqf +++ b/addons/tripod/functions/fnc_adjust.sqf @@ -9,37 +9,39 @@ * None * * Example: - * [tripod] call ace_tripod_fnc_adjust + * [ACE_player, tripod] call ace_tripod_fnc_adjust * * Public: No */ #include "script_component.hpp" -params ["_tripod"]; +params ["_unit", "_tripod"]; -GVAR(adjuster) = ACE_player; -GVAR(adjusting) = true; +_unit setVariable [QGVAR(adjusting), true, true]; +// add PFH to adjust the tripod animation GVAR(adjustPFH) = [{ - params ["_args", "_pfhId"]; - _args params ["_tripod"]; + (_this select 0) params ["_unit", "_tripod"]; - if (GVAR(adjuster) != ACE_player || !GVAR(adjusting)) exitWith { + if (!(_unit getVariable [QGVAR(adjusting), false]) || {isNull _tripod} || {_unit distance _tripod > 5}) exitWith { call EFUNC(interaction,hideMouseHint); - [ACE_player, "DefaultAction", ACE_player getVariable [QGVAR(Adjust), -1]] call EFUNC(Common,removeActionEventHandler); - [_pfhId] call cba_fnc_removePerFrameHandler; + + [_unit, "DefaultAction", _unit getVariable [QGVAR(Adjust), -1]] call EFUNC(common,removeActionEventHandler); + + [_this select 1] call CBA_fnc_removePerFrameHandler; }; { _tripod animate [_x, 1 - GVAR(height)]; } count ["slide_down_tripod", "retract_leg_1", "retract_leg_2", "retract_leg_3"]; -}, 0, [_tripod]] call CBA_fnc_addPerFrameHandler; +}, 0, [_unit, _tripod]] call CBA_fnc_addPerFrameHandler; +// add mouse button action and hint [localize "STR_ACE_Tripod_Done", "", localize "STR_ACE_Tripod_ScrollAction"] call EFUNC(interaction,showMouseHint); -ACE_player setVariable [QGVAR(Adjust), - [ACE_player, "DefaultAction", - {GVAR(adjustPFH) != -1 && GVAR(adjusting)}, - {GVAR(adjusting) = false;} -] call EFUNC(common,AddActionEventHandler)]; +_unit setVariable [QGVAR(Adjust), [ + _unit, "DefaultAction", + {GVAR(adjustPFH) != -1}, + {(_this select 0) setVariable [QGVAR(adjusting), false, true]} +] call EFUNC(common,addActionEventHandler)]; diff --git a/addons/tripod/functions/fnc_handleInteractMenuOpened.sqf b/addons/tripod/functions/fnc_handleInteractMenuOpened.sqf new file mode 100644 index 0000000000..8c49359d96 --- /dev/null +++ b/addons/tripod/functions/fnc_handleInteractMenuOpened.sqf @@ -0,0 +1,19 @@ +/* + * Author: commy2 + * Handle opening of interaction menu. + * + * Arguments: + * 0: Unit + * + * Return Value: + * None + * + * Public: No +*/ +#include "script_component.hpp" + +params ["_unit"]; + +if (_unit getVariable [QGVAR(adjusting), false]) then { + _unit setVariable [QGVAR(adjusting), false, true]; +}; diff --git a/addons/tripod/functions/fnc_handleKilled.sqf b/addons/tripod/functions/fnc_handleKilled.sqf new file mode 100644 index 0000000000..ee28fc1f45 --- /dev/null +++ b/addons/tripod/functions/fnc_handleKilled.sqf @@ -0,0 +1,19 @@ +/* + * Author: commy2 + * Handle death. + * + * Arguments: + * 0: Unit + * + * Return Value: + * None + * + * Public: No +*/ +#include "script_component.hpp" + +params ["_unit"]; + +if (_unit getVariable [QGVAR(adjusting), false]) then { + _unit setVariable [QGVAR(adjusting), false, true]; +}; diff --git a/addons/tripod/functions/fnc_handlePlayerChanged.sqf b/addons/tripod/functions/fnc_handlePlayerChanged.sqf new file mode 100644 index 0000000000..dd0cad6533 --- /dev/null +++ b/addons/tripod/functions/fnc_handlePlayerChanged.sqf @@ -0,0 +1,24 @@ +/* + * Author: commy2 + * Handle player changes. + * + * Arguments: + * 0: New Player Unit + * 1: Old Player Unit + * + * Return Value: + * None + * + * Public: No +*/ +#include "script_component.hpp" + +params ["_newPlayer", "_oldPlayer"]; + +if (_newPlayer getVariable [QGVAR(adjusting), false]) then { + _newPlayer setVariable [QGVAR(adjusting), false, true]; +}; + +if (_oldPlayer getVariable [QGVAR(adjusting), false]) then { + _oldPlayer setVariable [QGVAR(adjusting), false, true]; +}; diff --git a/addons/tripod/functions/fnc_handleScrollWheel.sqf b/addons/tripod/functions/fnc_handleScrollWheel.sqf index 973a57dd2f..1589bbc476 100644 --- a/addons/tripod/functions/fnc_handleScrollWheel.sqf +++ b/addons/tripod/functions/fnc_handleScrollWheel.sqf @@ -17,7 +17,7 @@ params ["_scroll"]; -if (GETMVAR(ACE_Modifier,0) == 0 || GVAR(adjustPFH) == -1) exitWith { false }; +if (GVAR(adjustPFH) == -1) exitWith {false}; GVAR(height) = 0 max (GVAR(height) + (_scroll / 20)) min 1; diff --git a/addons/tripod/functions/fnc_handleUnconscious.sqf b/addons/tripod/functions/fnc_handleUnconscious.sqf new file mode 100644 index 0000000000..f81cecea58 --- /dev/null +++ b/addons/tripod/functions/fnc_handleUnconscious.sqf @@ -0,0 +1,19 @@ +/* + * Author: commy2 + * Handle unconsciousness. + * + * Arguments: + * 0: Unit + * + * Return Value: + * None + * + * Public: No +*/ +#include "script_component.hpp" + +params ["_unit"]; + +if (_unit getVariable [QGVAR(adjusting), false]) then { + _unit setVariable [QGVAR(adjusting), false, true]; +}; diff --git a/addons/tripod/functions/fnc_pickup.sqf b/addons/tripod/functions/fnc_pickup.sqf index 24fc26ea1d..886aa5087e 100644 --- a/addons/tripod/functions/fnc_pickup.sqf +++ b/addons/tripod/functions/fnc_pickup.sqf @@ -3,28 +3,31 @@ * Pick up tripod * * Arguments: - * 0: tripod - * 1: unit + * 0: unit + * 1: tripod * * Return value: * None * * Example: - * [tripod, player] call ace_tripod_fnc_pickup + * [ACE_player, tripod] call ace_tripod_fnc_pickup * * Public: No */ #include "script_component.hpp" -params ["_tripod", "_unit"]; +params ["_unit", "_tripod"]; -if ((_unit call CBA_fnc_getUnitAnim) select 0 == "stand") then { - _unit playMove "AmovPercMstpSrasWrflDnon_diary"; +if (stance _unit == "STAND") then { + [_unit, "AmovPercMstpSrasWrflDnon_diary"] call EFUNC(common,doAnimation); }; [{ - params ["_tripod", "_unit"]; + params ["_unit", "_tripod"]; + + if (isNull _tripod) exitWith {}; + + deleteVehicle _tripod; [_unit, "ACE_Tripod"] call EFUNC(common,addToInventory); - deleteVehicle _tripod; -}, [_tripod, _unit], 1, 0]call EFUNC(common,waitAndExecute); +}, [_unit, _tripod], 1] call EFUNC(common,waitAndExecute); diff --git a/addons/tripod/functions/fnc_place.sqf b/addons/tripod/functions/fnc_place.sqf index ce7f445885..3168703f31 100644 --- a/addons/tripod/functions/fnc_place.sqf +++ b/addons/tripod/functions/fnc_place.sqf @@ -20,34 +20,37 @@ params ["_unit", "_tripodClass"]; _unit removeItem _tripodClass; -if ((_unit call CBA_fnc_getUnitAnim) select 0 == "stand") then { - _unit playMove "AmovPercMstpSrasWrflDnon_diary"; +if (stance _unit == "STAND") then { + [_unit, "AmovPercMstpSrasWrflDnon_diary"] call EFUNC(common,doAnimation); }; [{ params ["_unit"]; private ["_direction", "_position", "_tripod"]; + _direction = getDir _unit; - _position = (getPosASL _unit) vectorAdd [0.8 * sin(_direction), 0.8 * cos(_direction), 0.02]; + _position = getPosASL _unit vectorAdd [0.8 * sin _direction, 0.8 * cos _direction, 0.02]; _tripod = "ACE_TripodObject" createVehicle [0, 0, 0]; + { _tripod animate [_x, 1]; } count ["slide_down_tripod", "retract_leg_1", "retract_leg_2", "retract_leg_3"]; [{ - params ["_args", "_pfhId"]; - _args params ["_tripod", "_direction", "_position"]; + (_this select 0) params ["_tripod", "_direction", "_position"]; if (_tripod animationPhase "slide_down_tripod" == 1) then { _tripod setDir _direction; _tripod setPosASL _position; - if ((getPosATL _tripod select 2) - (getPos _tripod select 2) < 1E-5) then { + + if ((getPosATL _tripod select 2) - (getPos _tripod select 2) < 1E-5) then { // if not on object, then adjust to surface normale _tripod setVectorUp (surfaceNormal (position _tripod)); }; - [_pfhId] call CBA_fnc_removePerFrameHandler; + + [_this select 1] call CBA_fnc_removePerFrameHandler; }; }, 0, [_tripod, _direction, _position]] call CBA_fnc_addPerFrameHandler; -}, [_unit], 1, 0] call EFUNC(common,waitAndExecute); +}, [_unit], 1] call EFUNC(common,waitAndExecute); diff --git a/addons/tripod/stringtable.xml b/addons/tripod/stringtable.xml index caddca415f..c6366ba8de 100644 --- a/addons/tripod/stringtable.xml +++ b/addons/tripod/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -7,10 +7,10 @@ Снайперский штатив Trójnóg snajperski SSWT Kit - SSWT Kit + Kit SSWT SSWT souprava SSWT Kit - SSWT Kit + SSWT Készlet Kit SSWT @@ -19,10 +19,10 @@ Установить снайперский штатив Postaw trójnóg snajperski Place SSWT Kit - Place SSWT Kit + Placer le kit SSWT Rozlož souprava SSWT Place SSWT Kit - Place SSWT Kit + SSWT készlet elhelyezése Colocar kit SSWT @@ -32,6 +32,9 @@ Zvednout SSWT soupravu SSWT-Werkzeug aufheben Pegar kit SSWT + Prendre le kit SSWT + SSWT készlet felvétele + Подобрать снайперский штатив Adjust SSWT Kit @@ -40,6 +43,9 @@ Regulovat SSWT soupravu SSWT-Werkzeug anpassen Ajustar kit SSWT + Régler le kit SSWT + SSWT készlet állítása + Выровнять снайперский штатив Done @@ -48,14 +54,20 @@ Hotovo Fertig Feito + Terminé + Kész + Готово - + Modifier, adjust - + Modyfikator, regulacja - + Modificador, ajuste - + Modifikátor, regulace - + Modifikator, anpassen - + Modificador, ajuste + adjust + regulacja + ajuste + regulace + anpassen + ajuste + régler + szabályzás + подстройка diff --git a/addons/ui/$PBOPREFIX$ b/addons/ui/$PBOPREFIX$ index 601bbd5f60..9b6ac48f4f 100644 --- a/addons/ui/$PBOPREFIX$ +++ b/addons/ui/$PBOPREFIX$ @@ -1 +1 @@ -z\ace\Addons\ui \ No newline at end of file +z\ace\addons\ui \ No newline at end of file diff --git a/addons/ui/README.md b/addons/ui/README.md index f11027038f..340e3ad0f6 100644 --- a/addons/ui/README.md +++ b/addons/ui/README.md @@ -1,9 +1,11 @@ ace_ui ======= -Changes the chat contrast on the map to allow easier reading +Removes vignette and changes the chat contrast on the map to allow easier reading. + ## Maintainers The people responsible for merging changes to this component or answering potential questions. +- [VKing](https://github.com/VKing6) diff --git a/addons/ui/RscChat.hpp b/addons/ui/RscChat.hpp new file mode 100644 index 0000000000..46d8ff0acb --- /dev/null +++ b/addons/ui/RscChat.hpp @@ -0,0 +1,15 @@ +class RscText; +class RscDisplayChat { + class controls { + delete Line; + delete Background; + class CA_Background: RscText { + colorBackground[] = {0.5, 0.5, 0.5, 0.33}; // Make the chat entry field slightly darker + }; + }; +}; + +class RscChatListDefault { + colorBackground[] = {0, 0, 0, 0.5}; // Make the chat background darker + colorMessageProtocol[] = {0.85, 0.85, 0.85, 1}; // And the chat text brighter +}; diff --git a/addons/ui/RscVignette.hpp b/addons/ui/RscVignette.hpp new file mode 100644 index 0000000000..1da39c2118 --- /dev/null +++ b/addons/ui/RscVignette.hpp @@ -0,0 +1,4 @@ +class RscPicture; +class RscVignette: RscPicture { + text = ""; // Remove Vignette Texture +}; diff --git a/addons/ui/config.cpp b/addons/ui/config.cpp index e7ea4b32eb..f545600758 100644 --- a/addons/ui/config.cpp +++ b/addons/ui/config.cpp @@ -6,25 +6,11 @@ class CfgPatches { weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_common"}; - author[] = {"VKing"}; - authorUrl = "https://github.com/ACEMod/"; + author[] = {"VKing", "Jonpas"}; + authorUrl = "http://ace3mod.com/"; VERSION_CONFIG; }; }; -class RscText; - -class RscDisplayChat { - class controls { - delete Line; - delete Background; - class CA_Background: RscText { - colorBackground[] = {0.5,0.5,0.5,0.33}; // Make the chat entry field slightly darker - }; - }; -}; - -class RscChatListDefault { - colorBackground[] = {0,0,0,0.5}; // Make the chat background darker - colorMessageProtocol[] = {0.85,0.85,0.85,1}; // And the chat text brighter -}; +#include "RscChat.hpp" +#include "RscVignette.hpp" diff --git a/addons/ui/functions/script_component.hpp b/addons/ui/functions/script_component.hpp deleted file mode 100644 index 656228f742..0000000000 --- a/addons/ui/functions/script_component.hpp +++ /dev/null @@ -1 +0,0 @@ -#include "\z\ace\addons\ui\script_component.hpp" diff --git a/addons/ui/script_component.hpp b/addons/ui/script_component.hpp index a1a210701c..a0fa713f9f 100644 --- a/addons/ui/script_component.hpp +++ b/addons/ui/script_component.hpp @@ -1,5 +1,5 @@ #define COMPONENT ui -#include "\z\ace\Addons\main\script_mod.hpp" +#include "\z\ace\addons\main\script_mod.hpp" #ifdef DEBUG_ENABLED_UI #define DEBUG_MODE_FULL @@ -9,5 +9,4 @@ #define DEBUG_SETTINGS DEBUG_SETTINGS_UI #endif -#include "\z\ace\Addons\main\script_macros.hpp" - +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/addons/vehiclelock/functions/fnc_lockpick.sqf b/addons/vehiclelock/functions/fnc_lockpick.sqf index f4837c742b..5c0e04ee0b 100644 --- a/addons/vehiclelock/functions/fnc_lockpick.sqf +++ b/addons/vehiclelock/functions/fnc_lockpick.sqf @@ -43,7 +43,7 @@ if (_vehLockpickStrenth < 0) exitWith {false}; //Condition check for progressBar _condition = { params ["_args"]; - _args params ["_args", "_unit", "_veh"]; + _args params ["_unit", "_veh"]; ((_unit distance _veh) < 5) && {(speed _veh) < 0.1} }; diff --git a/addons/vehiclelock/stringtable.xml b/addons/vehiclelock/stringtable.xml index 89a64faf8a..e1d08762cd 100644 --- a/addons/vehiclelock/stringtable.xml +++ b/addons/vehiclelock/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -140,6 +140,9 @@ Fahrzeugsperreinstellungen Nastavení zámku vozidla Configuração de fechadura do veículo + Paramétrage du sytème de verrouillage + Jármű-zár beállítás + Запирание транспорта Lock Vehicle Inventory @@ -148,6 +151,9 @@ Sperre Fahrzeuginventar Inventář zamčeného vozidla Bloquear inventário do veículo + Verrouiller l'inventaire du véhicule + Jármű rakodótér zárás + Закрывать инвентарь транспорта Locks the inventory of locked vehicles @@ -156,6 +162,9 @@ Sperrt das Inventar von gesperrten Fahrzeugen Zamknout inventář u zamčených vozidel Bloqueia o inventário de veículos fechados + Verrouille l'inventaire de véhicule fermés à clé + Bezárja a zárt járművek rakterét is + Закрывать инвентарь транспорта, если транспорт закрыт Vehicle Starting Lock State @@ -164,6 +173,9 @@ Fahrzeuge spawnen gesperrt Počáteční stav zámku vozidla Estado inicial da fechadura dos veículos + Etat du verrouillage du véhicule au démarrage + Jármű kezdő zár-állapot + Начальное состояние замков Set lock state for all vehicles (removes ambiguous lock states) @@ -172,6 +184,9 @@ Setze Sperrstatus für alle Fahrzeuge (entfernt unklare Sperrzustände) Nastavit stav zámku u všech vozidel (odstraňuje nejednoznačné stavy zámků) Definir estados de fechadura para todos os veículos (remove estados de fechadura ambíguos) + Défini l'état de vérrouillage pour tous les véhicules (supprime les vérrouillage ambigue) + Beállítja a zár-állapotot az összes járműhöz (eltávolítja az azonosíthatatlan zárállapotokat) + Устанавливает начальное состояние замков всех транспортных средств (устраняет неоднозначные состояния) As Is @@ -180,6 +195,9 @@ Unverändert Jak je Como está + Pas de changement + Úgy-ahogy + Как есть Locked @@ -188,6 +206,9 @@ Gesperrt Zamčeno Fechado + Verrouillé + Zárva + Закрыт Unlocked @@ -196,6 +217,9 @@ Offen Odemčeno Aberto + Déverrouillé + Nyitva + Открыт Default Lockpick Strength @@ -204,6 +228,9 @@ Standard-Pick-Stärke Výchozí síla páčidla Durabilidade padrão da chave micha + Force de crochetage par défaut + Alapértelmezett zártörő-erősség + Сила отмычки по-умолчанию Default Time to lockpick (in seconds). Default: 10 @@ -212,6 +239,9 @@ Standardzeit um ein Schloss zu knacken (in Sekunden). Standard: 10 Čas k vypáčení zámku (v sekundách). Výchozí: 10 Tempo padrão para forçar a fechadura (em segundos). Padrão: 10 + Temps par défaut pour le crochetage + Alapértelmezett idő a zárfeltöréshez (másodpercben). Alapértelmezett: 10 + Время для взлома замка отмычкой (в секундах). По-умолчанию: 10 Settings for lockpick strength and initial vehicle lock state. Removes ambiguous lock states.<br />Source: vehiclelock.pbo @@ -220,6 +250,9 @@ Einstellungen für Pick-Stärke und anfänglichen Fahrzeugsperrzustand. Entfernt unklare Sperrzustände.<br />Quelle: vehiclelock.pbo Nastavení síly vypáčení a počáteční stav zámku vozidla. Odstraňuje nejednoznačné stavy zámků.<br />Zdroj: vehiclelock.pbo Definições para a durabilidade da chave micha e estado inicial da fechadura do veículo. Remove estados de fechadura ambíguas <br /> Fonte: Vehiclelock.pbo + Paramètres pour le crochetage et état inital des véhicules. Supprime les états de verrouillage ambigue. <br/>Source: véhicle.pbo + Beállítások a zártörő erősségére és alapértelmezett zár-állapotra a járműveken. Eltávolítja az azonosíthatatlan zár-állapotokat. <br />Forrás: vehiclelock.pbo + Настройки силы отмычек и начальное состояние замков транспорта. Устраняет неоднозначные состояния замков.<br />Источник: vehiclelock.pbo Vehicle Key Assign @@ -228,6 +261,9 @@ Fahrzeugschlüsselzuweisung Přidělení klíče k vozidlu Atribuição de chave de veículo + Assignation des clés de véhicule + Járműkulcs-osztás + Назначение ключей от транспорта Sync with vehicles and players. Will handout custom keys to players for every synced vehicle. Only valid for objects present at mission start.<br />Source: vehiclelock.pbo @@ -236,6 +272,9 @@ Synchronisiere mit Fahrzeugen und Spielern. Wird eigene Schlüssel an Spieler für jedes synchronisierte Fahrzeuge aushändigen. Nur gültig für am Missionsstart existierende Fahrzeuge.<br />Quelle: vehiclelock.pbo Synchronizuj s vozidly a hráči. Hráč dostane klíč ke každému synchonizovanému vozidlu. Platné pouze pro objekty přítomné na začátku mise.<br />Zdroj: vehiclelock.pbo Sincronizar com veículos e jogadores. Irá distribuir chaves personalizadas para os jogadores para cada veículo sincronizado. Só é válido para objetos presentes no início da missão <br /> Fonte: vehiclelock.pbo + Synchronise avec les véhicules et les joueurs. Distribue les clés aux joueurs pour chaque véhicule synchronisé. Uniquement valide pour les objects présent au démarrage. <br/>Source: vehiclelock.pbo + Szinkronizál a járművekkel és játékosokkal. Egyedi kulcsokat oszt ki a játékosoknak minden szinkronizált járműhöz. Csak a küldetés indításakor jelenlévő járművekhez érvényes. <br />Forrás: vehiclelock.pbo + Синхронизируйте с транспортом и игроком. Это выдаст игроку ключи от всех синхронизированных транспортных средств. Работает только для объектов, присутствующих на старте миссии.<br />Источник: vehiclelock.pbo - \ No newline at end of file + diff --git a/addons/vehicles/CfgVehicles.hpp b/addons/vehicles/CfgVehicles.hpp index fa60a72961..a07781a413 100644 --- a/addons/vehicles/CfgVehicles.hpp +++ b/addons/vehicles/CfgVehicles.hpp @@ -331,4 +331,97 @@ class CfgVehicles { }; }; }; + + // static mgs shouldn't use 500 rnd mags. + class StaticWeapon: LandVehicle { + class Turrets { + class MainTurret; //: NewTurret {}; + }; + }; + + class StaticMGWeapon: StaticWeapon {}; + + class HMG_01_base_F: StaticMGWeapon { + class Turrets: Turrets { + class MainTurret: MainTurret { + magazines[] = {"100Rnd_127x99_mag","100Rnd_127x99_mag","100Rnd_127x99_mag","100Rnd_127x99_mag","100Rnd_127x99_mag"}; + }; + }; + }; + + class B_HMG_01_F: HMG_01_base_F { + class Turrets: Turrets { + class MainTurret: MainTurret { + magazines[] = {"100Rnd_127x99_mag_Tracer_Red","100Rnd_127x99_mag_Tracer_Red","100Rnd_127x99_mag_Tracer_Red","100Rnd_127x99_mag_Tracer_Red","100Rnd_127x99_mag_Tracer_Red"}; + }; + }; + }; + + class O_HMG_01_F: HMG_01_base_F { + class Turrets: Turrets { + class MainTurret: MainTurret { + magazines[] = {"100Rnd_127x99_mag_Tracer_Green","100Rnd_127x99_mag_Tracer_Green","100Rnd_127x99_mag_Tracer_Green","100Rnd_127x99_mag_Tracer_Green","100Rnd_127x99_mag_Tracer_Green"}; + }; + }; + }; + + class I_HMG_01_F: HMG_01_base_F { + class Turrets: Turrets { + class MainTurret: MainTurret { + magazines[] = {"100Rnd_127x99_mag_Tracer_Yellow","100Rnd_127x99_mag_Tracer_Yellow","100Rnd_127x99_mag_Tracer_Yellow","100Rnd_127x99_mag_Tracer_Yellow","100Rnd_127x99_mag_Tracer_Yellow"}; + }; + }; + }; + + class HMG_01_high_base_F: HMG_01_base_F {}; + + class B_HMG_01_high_F: HMG_01_high_base_F { + class Turrets: Turrets { + class MainTurret: MainTurret { + magazines[] = {"100Rnd_127x99_mag_Tracer_Red","100Rnd_127x99_mag_Tracer_Red","100Rnd_127x99_mag_Tracer_Red","100Rnd_127x99_mag_Tracer_Red","100Rnd_127x99_mag_Tracer_Red"}; + }; + }; + }; + + class O_HMG_01_high_F: HMG_01_high_base_F { + class Turrets: Turrets { + class MainTurret: MainTurret { + magazines[] = {"100Rnd_127x99_mag_Tracer_Green","100Rnd_127x99_mag_Tracer_Green","100Rnd_127x99_mag_Tracer_Green","100Rnd_127x99_mag_Tracer_Green","100Rnd_127x99_mag_Tracer_Green"}; + }; + }; + }; + + class I_HMG_01_high_F: HMG_01_high_base_F { + class Turrets: Turrets { + class MainTurret: MainTurret { + magazines[] = {"100Rnd_127x99_mag_Tracer_Yellow","100Rnd_127x99_mag_Tracer_Yellow","100Rnd_127x99_mag_Tracer_Yellow","100Rnd_127x99_mag_Tracer_Yellow","100Rnd_127x99_mag_Tracer_Yellow"}; + }; + }; + }; + + class HMG_01_A_base_F: HMG_01_base_F {}; + + class B_HMG_01_A_F: HMG_01_A_base_F { + class Turrets: Turrets { + class MainTurret: MainTurret { + magazines[] = {"100Rnd_127x99_mag_Tracer_Red","100Rnd_127x99_mag_Tracer_Red","100Rnd_127x99_mag_Tracer_Red","100Rnd_127x99_mag_Tracer_Red","100Rnd_127x99_mag_Tracer_Red"}; + }; + }; + }; + + class O_HMG_01_A_F: HMG_01_A_base_F { + class Turrets: Turrets { + class MainTurret: MainTurret { + magazines[] = {"100Rnd_127x99_mag_Tracer_Green","100Rnd_127x99_mag_Tracer_Green","100Rnd_127x99_mag_Tracer_Green","100Rnd_127x99_mag_Tracer_Green","100Rnd_127x99_mag_Tracer_Green"}; + }; + }; + }; + + class I_HMG_01_A_F: HMG_01_A_base_F { + class Turrets: Turrets { + class MainTurret: MainTurret { + magazines[] = {"100Rnd_127x99_mag_Tracer_Yellow","100Rnd_127x99_mag_Tracer_Yellow","100Rnd_127x99_mag_Tracer_Yellow","100Rnd_127x99_mag_Tracer_Yellow","100Rnd_127x99_mag_Tracer_Yellow"}; + }; + }; + }; }; diff --git a/addons/vehicles/CfgWeapons.hpp b/addons/vehicles/CfgWeapons.hpp index 2eee38643f..76feb1818a 100644 --- a/addons/vehicles/CfgWeapons.hpp +++ b/addons/vehicles/CfgWeapons.hpp @@ -62,4 +62,9 @@ class CfgWeapons { muzzles[] = {"AP"}; }; + + // make static weapons compatible with 100rnd mag variants + class HMG_static: HMG_01 { + magazines[] = {"500Rnd_127x99_mag","500Rnd_127x99_mag_Tracer_Red","500Rnd_127x99_mag_Tracer_Green","500Rnd_127x99_mag_Tracer_Yellow","200Rnd_127x99_mag","200Rnd_127x99_mag_Tracer_Red","200Rnd_127x99_mag_Tracer_Green","200Rnd_127x99_mag_Tracer_Yellow","100Rnd_127x99_mag","100Rnd_127x99_mag_Tracer_Red","100Rnd_127x99_mag_Tracer_Green","100Rnd_127x99_mag_Tracer_Yellow"}; + }; }; diff --git a/addons/vehicles/XEH_postInit.sqf b/addons/vehicles/XEH_postInit.sqf index 253f5eab39..a8ec2fb75f 100644 --- a/addons/vehicles/XEH_postInit.sqf +++ b/addons/vehicles/XEH_postInit.sqf @@ -1,7 +1,7 @@ // by esteldunedain #include "script_component.hpp" -if !(hasInterface) exitWith {}; +if (!hasInterface) exitWith {}; // Add keybinds ["ACE3 Vehicles", QGVAR(speedLimiter), localize LSTRING(SpeedLimiter), diff --git a/addons/vehicles/stringtable.xml b/addons/vehicles/stringtable.xml index e1002bc154..a912701b27 100644 --- a/addons/vehicles/stringtable.xml +++ b/addons/vehicles/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -38,4 +38,4 @@ Limitatore di Velocità - \ No newline at end of file + diff --git a/addons/viewdistance/README.md b/addons/viewdistance/README.md new file mode 100644 index 0000000000..67860b1ad0 --- /dev/null +++ b/addons/viewdistance/README.md @@ -0,0 +1,11 @@ +ace_viewdistance +=========== + +Adds various View Distance settings and allows limiting maximum view distance that can be set by players. + + +## Maintainers + +The people responsible for merging changes to this component or answering potential questions. + +- [Winter](https://github.com/Winter259) diff --git a/addons/viewdistance/XEH_postInit.sqf b/addons/viewdistance/XEH_postInit.sqf index 865e5527e5..a30befaa81 100644 --- a/addons/viewdistance/XEH_postInit.sqf +++ b/addons/viewdistance/XEH_postInit.sqf @@ -5,17 +5,10 @@ if (!hasInterface) exitWith {}; ["SettingsInitialized", { // if not enabled, then bugger off. if !(GVAR(enabled)) exitWith {}; - - // Force the view distance down to the limit. - if (viewDistance > GVAR(limitViewDistance)) then { - setViewDistance GVAR(limitViewDistance); - }; - - // Adapt view distance when the player is created or changed according to whether client is on foot or vehicle. - ["playerChanged",{ - [false] call FUNC(adaptViewDistance); - }] call EFUNC(common,addEventHandler); - + + // Limit on load + [false] call FUNC(adaptViewDistance); + // Set the EH which waits for any of the view distance settings to be changed, so that the effect is show immediately ["SettingChanged",{ if ((_this select 0 == QGVAR(viewDistanceOnFoot)) || @@ -28,7 +21,8 @@ if (!hasInterface) exitWith {}; }] call EFUNC(common,addEventHandler); // Set the EH which waits for a vehicle change to automatically swap between On Foot/In Land Vehicle/In Air Vehicle + // Also run when SettingsInitialized runs (not guaranteed) ["playerVehicleChanged",{ [false] call FUNC(adaptViewDistance) }] call EFUNC(common,addEventHandler); -}] call EFUNC(common,addEventHandler); \ No newline at end of file +}] call EFUNC(common,addEventHandler); diff --git a/addons/viewdistance/functions/fnc_changeViewDistance.sqf b/addons/viewdistance/functions/fnc_changeViewDistance.sqf index 34a3f5ba46..30dc4f8144 100644 --- a/addons/viewdistance/functions/fnc_changeViewDistance.sqf +++ b/addons/viewdistance/functions/fnc_changeViewDistance.sqf @@ -26,6 +26,7 @@ _new_view_distance = [_index_requested] call FUNC(returnValue); // changes the s _object_view_distance_coeff = [GVAR(objectViewDistanceCoeff)] call FUNC(returnObjectCoeff); // changes the setting index into a coefficient. _view_distance_limit = GVAR(limitViewDistance); // Grab the limit +TRACE_2("Limit",_new_view_distance,_view_distance_limit); setViewDistance (_new_view_distance min _view_distance_limit); if (_object_view_distance_coeff > 0) then { diff --git a/addons/viewdistance/functions/fnc_initModule.sqf b/addons/viewdistance/functions/fnc_initModule.sqf index 26072e5b5f..47cf27025e 100644 --- a/addons/viewdistance/functions/fnc_initModule.sqf +++ b/addons/viewdistance/functions/fnc_initModule.sqf @@ -20,10 +20,10 @@ if (!isServer) exitWith {}; params ["_logic", "_units", "_activated"]; if (!_activated) exitWith { - diag_log text "[ACE]: View Distance Limit Module is placed but NOT active."; + ACE_LOGWARNING("View Distance Limit Module is placed but NOT active."); }; [_logic, QGVAR(enabled),"moduleViewDistanceEnabled"] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(limitViewDistance),"moduleViewDistanceLimit"] call EFUNC(common,readSettingFromModule); -diag_log format ["[ACE]: View Distance Limit Module Initialized. Limit set by module: %1",GVAR(limitViewDistance)]; \ No newline at end of file +ACE_LOGINFO_1("View Distance Limit Module Initialized. Limit set by module: %1",GVAR(limitViewDistance)); diff --git a/addons/viewdistance/functions/fnc_returnValue.sqf b/addons/viewdistance/functions/fnc_returnValue.sqf index d374d69d60..7e0c41f1be 100644 --- a/addons/viewdistance/functions/fnc_returnValue.sqf +++ b/addons/viewdistance/functions/fnc_returnValue.sqf @@ -22,7 +22,7 @@ private ["_return"]; params ["_index"]; _return = switch (_index) do { - case 0: {-1}; + case 0: {viewDistance}; // Video Settings option case 1: {500}; case 2: {1000}; case 3: {1500}; @@ -40,4 +40,5 @@ _return = switch (_index) do { default {1000}; }; -_return; +TRACE_1("VD Index Return",_return); +_return diff --git a/addons/viewdistance/stringtable.xml b/addons/viewdistance/stringtable.xml index bdf96f35a0..b3058bc29e 100644 --- a/addons/viewdistance/stringtable.xml +++ b/addons/viewdistance/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -8,6 +8,9 @@ Omezovač dohlednosti Sichtweitenbegrenzung Limitador de distância de visão + Limiteur de distance de vue + Látótáv-korlátozó + Ограничитель дальности видимости Allows limiting maximum view distance that can be set by players. @@ -16,6 +19,9 @@ Umožňuje určit maximální dohlednost, kterou si může hráč nastavit Erlaubt das Einschränken der maximalen Sichtweite, welche von Spielern eingestellt werden kann. Permite limitar a distância máxima de visão que pode ser definida pelos jogadores. + Permet de limiter la distance de vue que les joueurs peuvent choisir + Lehetővé teszi a játékosok által a látótávolság maximumának korlátozását. + Позволяет ограничить максимальную дальность видимости, которая может быть установлена игроками. Enable ACE viewdistance @@ -24,6 +30,9 @@ Povolit ACE dohlednost Aktiviere ACE-Sichtweite Habilitar distância de visão ACE + Activer la distance de vue ACE + ACE látótávolság engedélyezése + Ограничить дальность видимости Enables ACE viewdistance @@ -32,6 +41,9 @@ Povolit ACE dohlednost Aktiviert ACE-Sichtweite Habilita a distância de visão ACE + Activer la distance de vue ACE + Engedélyezi az ACE látótávolságot + Включает ограничитель дальности видимости ACE View Distance Limit @@ -40,6 +52,9 @@ Limit dohlednosti Sichtweitengrenze Limite da distância de visão + Limite de distance de vue + Látótáv-korlát + Дальность видимости Sets the limit for how high clients can raise their view distance (up to 10000) @@ -48,6 +63,9 @@ Stanoví limit jak daleko si může client zvýšit dohlednost (do 10000) Setze die Grenze fest, wie weit Spieler ihre Sichtweite erhöhen können (bis 10000) Estabelecer um limite de quão alto os clientes podem aumentar sua distância de visão (até 10000) + Défini pour les clients la limite de distance de vue maximale (jusqu'à 10000) + Korlátozza, mekkora látótávolságot állíthatnak be a kliensek (maximum 10000-ig) + Устанавливает предел дальности, насколько клиенты могут увеличить свою дальность видимости (до 10000) Limit for client's view distance set here and can overridden by module @@ -56,6 +74,9 @@ Limit dohlednoti pro klienty se nastavuje zde a může být potlačeno pomocí modulu. Stellt die Grenze für die Sichtweite des Spielers ein. Das kann von einem Modul überschrieben werden. Permite limitar a distância de visão máxima que pode ser definida por jogadores. Pode ser substituído por módulo. + Limite de la distance de vue pour les clients et peut être forcé par ce module + A kliens látótávolsága itt állítható be, és felülbírálható modulok által + Предел дальности видимости клиентов устанавливается здесь и может быть переопределен модулем Client View Distance (On Foot) @@ -64,6 +85,9 @@ Dohlednost (Pěšák) Spielersichtweite (zu Fuß) Distância de visão do cliente (A pé) + Distance de vue (à pied) + Kliens látótáv (gyalog) + Дальность видимости (Пешком) Changes in game view distance when the player is on foot. @@ -72,6 +96,9 @@ Změna dohlednosti pro hráče pokud jde po svých. Verändert die Sichtweite, wenn ein Spieler zu Fuß unterwegs ist. Muda a distância de visão do jogador dentro do jogo quando ele está a pé. + Change la distance de vue quand le joueur est à pied + Megváltoztatja a játékon belüli látótávolságot, amennyiben a játékos gyalogosan van. + Изменяет дальность видимости в игре, когда игрок перемещается пешком. Client View Distance (Land Vehicle) @@ -80,6 +107,9 @@ Dohlednost (Pozemní technika) Spielersichtweite (Landfahrzeuge) Distância de visão do cliente (Veículo terrestre) + Distance de vue (à pied) + Kliens látótáv (szárazföldi jármű) + Дальность видимости (В наземном трансп.) Changes in game view distance when the player is in a land vehicle. @@ -88,6 +118,9 @@ Změna dohlednosti pro hráče pokud je v pozemní technice. Verändert die Sichtweite, wenn ein Spieler in einem Landfahrzeug ist. Muda a distância de visão do jogador dentro do jogo quando ele está dentro de um veículo terrestre. + Change la distance de vue quand le joueur est dans un véhicule + Megváltoztatja a játékon belüli látótávolságot, amennyiben a játékos szárazföldi járműben van. + Изменяет дальность видимости в игре, когда игрок перемещается в наземном транспорте. Client View Distance (Air Vehicle) @@ -96,6 +129,9 @@ Dohlednost (Vzdušná technika) Spielersichtweite (Luftfahrzeuge) Distância de visão do cliente (Veículo aéreo) + Distance de vue (véhicule aérien) + Kliens látótáv (légi jármű) + Дальность видимости (В воздушном трансп.) Changes in game view distance when the player is in an air vehicle. @@ -104,6 +140,9 @@ Změna dohlednosti pro hráče pokud je ve vzdušné technice. Verändert die Sichtweite wenn ein Spieler in einem Luftfahrzeug ist. Muda a distância de visão do jogador dentro do jogo quando ele está dentro de um veículo aéreo. + Change la distance de vue quand le joueur est dans un véhicule aérien + Megváltoztatja a játékon belüli látótávolságot, amennyiben a játékos légi járműben van. + Изменяет дальность видимости в игре, когда игрок перемещается в воздушном транспорте. Dynamic Object View Distance @@ -112,6 +151,9 @@ Dynamická dohlednost objektů Dynamische Objektsichtweite Distância de visão dinâmica dos objetos + Distance de vue pour les objet dynamique + Dinamikus objektum-látótáv + Динамич. дальность отрисовки объектов Sets the object view distance as a coefficient of the view distance. @@ -120,6 +162,9 @@ Nastaví objekt dohlednosti jako koeficient dohlednosti. Passt die Objektsichtweite dynamisch der Sichtweite an. Estabelece a distância de visão dos objetos com um coeficiente da distância de visão. + Défini la distance d'affichage des objets comme un coefficient de la distance de vue + Beállítja az objektum-látótávot a megadott látótáv koefficienseként. + Устанавливает дальность отрисовки объектов как коэффициент от общей дальности видимости. Off @@ -128,6 +173,9 @@ Vypnout Aus Desligado + Eteint + Kikapcsolva + Выкл. Very Low @@ -136,6 +184,9 @@ Velmi málo Sehr niedrig Muito baixo + Très bas + Minimális + Очень низкая Low @@ -144,6 +195,9 @@ Málo Niedrig Baixo + Bas + Alacsony + Низкая Medium @@ -152,6 +206,9 @@ Středně Mittel Médio + Moyen + Közepes + Средняя High @@ -160,6 +217,9 @@ Hodně Hoch Alto + Haut + Magas + Высокая Very High @@ -168,6 +228,9 @@ Velmi hodně Sehr hoch Muito alto + Très haut + Maximális + Очень высокая View Distance: @@ -176,6 +239,9 @@ Dohlednost: Sichtweite: Distância de visão: + Distance de vue + Látótávolság: + Дальность видимости: Object View Distance is @@ -184,6 +250,9 @@ Dohlednost objektů je Objektsichtweite ist Distância de visão do objeto é + La distance d'affichage des objets est: + Az objektum-látótávolság: + Дальность видимости объектов: That option is invalid! The limit is @@ -192,6 +261,9 @@ Tato volba je neplatná! Limit je Diese Option ist ungültig! Die Grenze ist Essa opção é inválida. O limte é + Cette option est non valide! La limite est + Ez a beállítás érvénytelen! A maximum mennyiség + Настройка не верна! Текущий предел Video Settings @@ -200,6 +272,9 @@ Nastavení videa Grafikeinstellungen Ajustes de vídeo + Paramètres vidéo + Videobeállítások + Видео настройки diff --git a/addons/weaponselect/ACE_Settings.hpp b/addons/weaponselect/ACE_Settings.hpp index 7b60527449..2214451247 100644 --- a/addons/weaponselect/ACE_Settings.hpp +++ b/addons/weaponselect/ACE_Settings.hpp @@ -1,3 +1,4 @@ + class ACE_Settings { class GVAR(DisplayText) { typeName = "BOOL"; diff --git a/addons/weaponselect/CfgEventHandlers.hpp b/addons/weaponselect/CfgEventHandlers.hpp index f409a36e5a..fd928fde2a 100644 --- a/addons/weaponselect/CfgEventHandlers.hpp +++ b/addons/weaponselect/CfgEventHandlers.hpp @@ -13,8 +13,8 @@ class Extended_PostInit_EventHandlers { class Extended_FiredBIS_EventHandlers { class CAManBase { - class GVAR(ThrowGrenade) { - clientFiredBIS = QUOTE(if (_this select 0 == ACE_player) then {_this call FUNC(throwGrenade)};); + class GVAR(throwGrenade) { + clientFiredBIS = QUOTE(if (_this select 0 == ACE_player) then {_this call FUNC(throwGrenade)}); }; }; }; diff --git a/addons/weaponselect/XEH_postInit.sqf b/addons/weaponselect/XEH_postInit.sqf index dfb70f4f71..491a86f39d 100644 --- a/addons/weaponselect/XEH_postInit.sqf +++ b/addons/weaponselect/XEH_postInit.sqf @@ -1,13 +1,12 @@ // by esteldunedain #include "script_component.hpp" -if !(hasInterface) exitWith {}; +if (!hasInterface) exitWith {}; -// Add keybinds -["ACE3 Weapons", QGVAR(SelectPistolNew), localize LSTRING(SelectPistol), -{ +// add keybinds +["ACE3 Weapons", QGVAR(SelectPistolNew), localize LSTRING(SelectPistol), { // Conditions: canInteract - if !([ACE_player, ACE_player, ["isNotEscorting"]] call EFUNC(common,canInteractWith)) exitWith {false}; + if !([ACE_player, ACE_player, ["isNotInside", "isNotEscorting"]] call EFUNC(common,canInteractWith)) exitWith {false}; // Conditions: specific if !([ACE_player] call EFUNC(common,canUseWeapon)) exitWith {false}; @@ -16,12 +15,11 @@ if !(hasInterface) exitWith {}; false }, {false}, -[0, [false, false, false]], false] call cba_fnc_addKeybind; //Unbound (was 1 Key) +[0, [false, false, false]], false] call CBA_fnc_addKeybind; //Unbound (was 1 Key) -["ACE3 Weapons", QGVAR(SelectRifleNew), localize LSTRING(SelectRifle), -{ +["ACE3 Weapons", QGVAR(SelectRifleNew), localize LSTRING(SelectRifle), { // Conditions: canInteract - if !([ACE_player, ACE_player, ["isNotEscorting"]] call EFUNC(common,canInteractWith)) exitWith {false}; + if !([ACE_player, ACE_player, ["isNotInside", "isNotEscorting"]] call EFUNC(common,canInteractWith)) exitWith {false}; // Conditions: specific if !([ACE_player] call EFUNC(common,canUseWeapon)) exitWith {false}; @@ -30,12 +28,11 @@ if !(hasInterface) exitWith {}; false }, {false}, -[0, [false, false, false]], false] call cba_fnc_addKeybind; //Unbound (was 2 Key) +[0, [false, false, false]], false] call CBA_fnc_addKeybind; //Unbound (was 2 Key) -["ACE3 Weapons", QGVAR(SelectRifleMuzzleNew), localize LSTRING(SelectRifleMuzzle), -{ +["ACE3 Weapons", QGVAR(SelectRifleMuzzleNew), localize LSTRING(SelectRifleMuzzle), { // Conditions: canInteract - if !([ACE_player, ACE_player, ["isNotEscorting"]] call EFUNC(common,canInteractWith)) exitWith {false}; + if !([ACE_player, ACE_player, ["isNotInside", "isNotEscorting"]] call EFUNC(common,canInteractWith)) exitWith {false}; // Conditions: specific if !([ACE_player] call EFUNC(common,canUseWeapon)) exitWith {false}; @@ -44,12 +41,11 @@ if !(hasInterface) exitWith {}; false }, {false}, -[0, [false, false, false]], false] call cba_fnc_addKeybind; //Unbound (was 3 Key) +[0, [false, false, false]], false] call CBA_fnc_addKeybind; //Unbound (was 3 Key) -["ACE3 Weapons", QGVAR(SelectLauncherNew), localize LSTRING(SelectLauncher), -{ +["ACE3 Weapons", QGVAR(SelectLauncherNew), localize LSTRING(SelectLauncher), { // Conditions: canInteract - if !([ACE_player, ACE_player, ["isNotEscorting"]] call EFUNC(common,canInteractWith)) exitWith {false}; + if !([ACE_player, ACE_player, ["isNotInside", "isNotEscorting"]] call EFUNC(common,canInteractWith)) exitWith {false}; // Conditions: specific if !([ACE_player] call EFUNC(common,canUseWeapon)) exitWith {false}; @@ -58,12 +54,11 @@ if !(hasInterface) exitWith {}; false }, {false}, -[0, [false, false, false]], false] call cba_fnc_addKeybind; //Unbound (was 4 Key) +[0, [false, false, false]], false] call CBA_fnc_addKeybind; //Unbound (was 4 Key) -["ACE3 Weapons", QGVAR(SelectBinocularNew), localize LSTRING(SelectBinocular), -{ +["ACE3 Weapons", QGVAR(SelectBinocularNew), localize LSTRING(SelectBinocular), { // Conditions: canInteract - if !([ACE_player, ACE_player, ["isNotEscorting"]] call EFUNC(common,canInteractWith)) exitWith {false}; + if !([ACE_player, ACE_player, ["isNotInside", "isNotEscorting"]] call EFUNC(common,canInteractWith)) exitWith {false}; // Conditions: specific if !([ACE_player] call EFUNC(common,canUseWeapon)) exitWith {false}; @@ -72,40 +67,37 @@ if !(hasInterface) exitWith {}; false }, {false}, -[0, [false, false, false]], false] call cba_fnc_addKeybind; //Unbound (was 5 Key) +[0, [false, false, false]], false] call CBA_fnc_addKeybind; //Unbound (was 5 Key) -["ACE3 Weapons", QGVAR(SelectGrenadeFrag), localize LSTRING(SelectGrenadeFrag), -{ +["ACE3 Weapons", QGVAR(SelectGrenadeFrag), localize LSTRING(SelectGrenadeFrag), { // Conditions: canInteract - if !([ACE_player, ACE_player, ["isNotEscorting"]] call EFUNC(common,canInteractWith)) exitWith {false}; + if !([ACE_player, ACE_player, ["isNotInside", "isNotEscorting"]] call EFUNC(common,canInteractWith)) exitWith {false}; // Conditions: specific if !([ACE_player] call EFUNC(common,canUseWeapon)) exitWith {false}; // Statement - [ACE_player] call FUNC(selectGrenadeFrag); + [ACE_player, 1] call FUNC(selectNextGrenade); true }, {false}, -[7, [false, false, false]], false] call cba_fnc_addKeybind; //6 Key +[7, [false, false, false]], false] call CBA_fnc_addKeybind; //6 Key -["ACE3 Weapons", QGVAR(SelectGrenadeOther), localize LSTRING(SelectGrenadeOther), -{ +["ACE3 Weapons", QGVAR(SelectGrenadeOther), localize LSTRING(SelectGrenadeOther), { // Conditions: canInteract - if !([ACE_player, ACE_player, ["isNotEscorting"]] call EFUNC(common,canInteractWith)) exitWith {false}; + if !([ACE_player, ACE_player, ["isNotInside", "isNotEscorting"]] call EFUNC(common,canInteractWith)) exitWith {false}; // Conditions: specific if !([ACE_player] call EFUNC(common,canUseWeapon)) exitWith {false}; // Statement - [ACE_player] call FUNC(selectGrenadeOther); + [ACE_player, 2] call FUNC(selectNextGrenade); true }, {false}, -[8, [false, false, false]], false] call cba_fnc_addKeybind; //7 Key +[8, [false, false, false]], false] call CBA_fnc_addKeybind; //7 Key -["ACE3 Weapons", QGVAR(HolsterWeapon), localize LSTRING(HolsterWeapon), -{ +["ACE3 Weapons", QGVAR(HolsterWeapon), localize LSTRING(HolsterWeapon), { // Conditions: canInteract - if !([ACE_player, ACE_player, ["isNotEscorting"]] call EFUNC(common,canInteractWith)) exitWith {false}; + if !([ACE_player, ACE_player, ["isNotInside", "isNotEscorting"]] call EFUNC(common,canInteractWith)) exitWith {false}; // Conditions: specific if !([ACE_player] call EFUNC(common,canUseWeapon)) exitWith {false}; @@ -125,40 +117,37 @@ if !(hasInterface) exitWith {}; true }, {false}, -[11, [false, false, false]], false] call cba_fnc_addKeybind; //0 Key +[11, [false, false, false]], false] call CBA_fnc_addKeybind; //0 Key -["ACE3 Vehicles", QGVAR(EngineOn), localize LSTRING(EngineOn), -{ +["ACE3 Vehicles", QGVAR(EngineOn), localize LSTRING(EngineOn), { // Conditions: canInteract - if !([ACE_player, (vehicle ACE_player), []] call EFUNC(common,canInteractWith)) exitWith {false}; + if !([ACE_player, vehicle ACE_player, []] call EFUNC(common,canInteractWith)) exitWith {false}; // Conditions: specific if !((ACE_player != vehicle ACE_player) && {ACE_player == driver vehicle ACE_player} && {!isEngineOn vehicle ACE_player}) exitWith {false}; // Statement - (vehicle ACE_player) engineOn true; + vehicle ACE_player engineOn true; true }, {false}, -[3, [false, false, false]], false] call cba_fnc_addKeybind; //2 Key +[3, [false, false, false]], false] call CBA_fnc_addKeybind; //2 Key -["ACE3 Vehicles", QGVAR(EngineOff), localize LSTRING(EngineOff), -{ +["ACE3 Vehicles", QGVAR(EngineOff), localize LSTRING(EngineOff), { // Conditions: canInteract - if !([ACE_player, (vehicle ACE_player), []] call EFUNC(common,canInteractWith)) exitWith {false}; + if !([ACE_player, vehicle ACE_player, []] call EFUNC(common,canInteractWith)) exitWith {false}; // Conditions: specific if !(ACE_player != vehicle ACE_player && {ACE_player == driver vehicle ACE_player} && {isEngineOn vehicle ACE_player}) exitWith {false}; // Statement - (vehicle ACE_player) engineOn false; + vehicle ACE_player engineOn false; true }, {false}, -[2, [false, false, false]], false] call cba_fnc_addKeybind; //1 Key +[2, [false, false, false]], false] call CBA_fnc_addKeybind; //1 Key -["ACE3 Vehicles", QGVAR(SelectMainGunNew), localize LSTRING(SelectMainGun), -{ +["ACE3 Vehicles", QGVAR(SelectMainGunNew), localize LSTRING(SelectMainGun), { // Conditions: canInteract - if !([ACE_player, (vehicle ACE_player), []] call EFUNC(common,canInteractWith)) exitWith {false}; + if !([ACE_player, vehicle ACE_player, []] call EFUNC(common,canInteractWith)) exitWith {false}; // Conditions: specific if !(ACE_player != vehicle ACE_player) exitWith {false}; @@ -167,12 +156,11 @@ if !(hasInterface) exitWith {}; true }, {false}, -[0, [false, false, false]], false] call cba_fnc_addKeybind; //Unbound (was 3 Key) +[0, [false, false, false]], false] call CBA_fnc_addKeybind; //Unbound (was 3 Key) -["ACE3 Vehicles", QGVAR(SelectMachineGunNew), localize LSTRING(SelectMachineGun), -{ +["ACE3 Vehicles", QGVAR(SelectMachineGunNew), localize LSTRING(SelectMachineGun), { // Conditions: canInteract - if !([ACE_player, (vehicle ACE_player), []] call EFUNC(common,canInteractWith)) exitWith {false}; + if !([ACE_player, vehicle ACE_player, []] call EFUNC(common,canInteractWith)) exitWith {false}; // Conditions: specific if !(ACE_player != vehicle ACE_player) exitWith {false}; @@ -181,12 +169,11 @@ if !(hasInterface) exitWith {}; true }, {false}, -[0, [false, false, false]], false] call cba_fnc_addKeybind; //Unbound (was 4 Key) +[0, [false, false, false]], false] call CBA_fnc_addKeybind; //Unbound (was 4 Key) -["ACE3 Vehicles", QGVAR(SelectMissilesNew), localize LSTRING(SelectMissiles), -{ +["ACE3 Vehicles", QGVAR(SelectMissilesNew), localize LSTRING(SelectMissiles), { // Conditions: canInteract - if !([ACE_player, (vehicle ACE_player), []] call EFUNC(common,canInteractWith)) exitWith {false}; + if !([ACE_player, vehicle ACE_player, []] call EFUNC(common,canInteractWith)) exitWith {false}; // Conditions: specific if !(ACE_player != vehicle ACE_player) exitWith {false}; @@ -195,12 +182,11 @@ if !(hasInterface) exitWith {}; true }, {false}, -[0, [false, false, false]], false] call cba_fnc_addKeybind; //Unbound (was 5 Key) +[0, [false, false, false]], false] call CBA_fnc_addKeybind; //Unbound (was 5 Key) -["ACE3 Vehicles", QGVAR(FireSmokeLauncher), localize LSTRING(FireSmokeLauncher), -{ +["ACE3 Vehicles", QGVAR(FireSmokeLauncher), localize LSTRING(FireSmokeLauncher), { // Conditions: canInteract - if !([ACE_player, (vehicle ACE_player), []] call EFUNC(common,canInteractWith)) exitWith {false}; + if !([ACE_player, vehicle ACE_player, []] call EFUNC(common,canInteractWith)) exitWith {false}; // Conditions: specific if !(ACE_player != vehicle ACE_player && {ACE_player == commander vehicle ACE_player}) exitWith {false}; @@ -209,4 +195,4 @@ if !(hasInterface) exitWith {}; true }, {false}, -[10, [false, false, false]], false] call cba_fnc_addKeybind; //9 Key +[10, [false, false, false]], false] call CBA_fnc_addKeybind; //9 Key diff --git a/addons/weaponselect/XEH_preInit.sqf b/addons/weaponselect/XEH_preInit.sqf index 4c5216c2f6..1f324f7fb0 100644 --- a/addons/weaponselect/XEH_preInit.sqf +++ b/addons/weaponselect/XEH_preInit.sqf @@ -2,67 +2,36 @@ ADDON = false; -PREP(countMagazinesForGrenadeMuzzle); PREP(displayGrenadeTypeAndNumber); -PREP(findNextGrenadeMagazine); -PREP(findNextGrenadeMuzzle); PREP(fireSmokeLauncher); -PREP(getSelectedGrenade); PREP(playChangeFiremodeSound); PREP(putWeaponAway); -PREP(selectGrenadeAll); -PREP(selectGrenadeFrag); -PREP(selectGrenadeOther); +PREP(selectNextGrenade); PREP(selectWeaponMode); PREP(selectWeaponMuzzle); PREP(selectWeaponVehicle); -PREP(setNextGrenadeMuzzle); PREP(throwGrenade); -// prepare grenades from config -GVAR(CurrentGrenadeMuzzleIsFrag) = true; -GVAR(CurrentGrenadeMuzzleFrag) = ""; -GVAR(CurrentGrenadeMuzzleOther) = ""; +// collect frag and other grenades separately +GVAR(GrenadesAll) = []; +GVAR(GrenadesFrag) = []; +GVAR(GrenadesNonFrag) = []; -// Collect frag and other muzzles separately -with uiNamespace do { - private ["_magazines", "_magazine", "_ammo", "_explosive"]; - if (isNil QGVAR(FragMuzzles)) then { - GVAR(FragMuzzles) = []; - GVAR(NonFragMuzzles) = []; - GVAR(AllMuzzles) = []; +private ["_magazines", "_ammo", "_explosive"]; - GVAR(FragMagazines) = []; - GVAR(NonFragMagazines) = []; - GVAR(AllMagazines) = []; +{ + _magazines = getArray (configFile >> "CfgWeapons" >> "Throw" >> _x >> "magazines"); - { - _magazines = getArray (configFile >> "CfgWeapons" >> "Throw" >> _x >> "magazines"); - _magazine = _magazines select 0; + GVAR(GrenadesAll) append _magazines; - _ammo = getText (configfile >> "CfgMagazines" >> _magazine >> "ammo"); - _explosive = getNumber (configfile >> "CfgAmmo" >> _ammo >> "explosive"); + { + _ammo = getText (configfile >> "CfgMagazines" >> _x >> "ammo"); + _explosive = getNumber (configfile >> "CfgAmmo" >> _ammo >> "explosive"); - if (_explosive == 0) then { - GVAR(NonFragMuzzles) pushBack _x; - GVAR(NonFragMagazines) pushBack _magazines; - } else { - GVAR(FragMuzzles) pushBack _x; - GVAR(FragMagazines) pushBack _magazines; - }; - - GVAR(AllMuzzles) pushBack _x; - GVAR(AllMagazines) pushBack _magazines; - - } forEach getArray (configfile >> "CfgWeapons" >> "Throw" >> "muzzles"); - }; -}; - -GVAR(FragMuzzles) = uiNamespace getVariable QGVAR(FragMuzzles); -GVAR(NonFragMuzzles) = uiNamespace getVariable QGVAR(NonFragMuzzles); -GVAR(AllMuzzles) = uiNamespace getVariable QGVAR(AllMuzzles); -GVAR(FragMagazines) = uiNamespace getVariable QGVAR(FragMagazines); -GVAR(NonFragMagazines) = uiNamespace getVariable QGVAR(NonFragMagazines); -GVAR(AllMagazines) = uiNamespace getVariable QGVAR(AllMagazines); + ([GVAR(GrenadesFrag), GVAR(GrenadesNonFrag)] select (_explosive == 0)) pushBack _x; + false + } count _magazines; + false +} count getArray (configfile >> "CfgWeapons" >> "Throw" >> "muzzles"); ADDON = true; diff --git a/addons/weaponselect/functions/fnc_countMagazinesForGrenadeMuzzle.sqf b/addons/weaponselect/functions/fnc_countMagazinesForGrenadeMuzzle.sqf deleted file mode 100644 index 572a83edf1..0000000000 --- a/addons/weaponselect/functions/fnc_countMagazinesForGrenadeMuzzle.sqf +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Author: esteldunedain - * Count how many grenade magazines the unit has on the uniform and vest. - * - * Arguments: - * 0: Unit - * 1: Muzzle Class - * - * Return Value: - * 0: Number of magazines - * 1: First magazine name - * - * Example: - * [player, currentMuzzle player] call ace_weaponselect_fnc_countMagazinesForGrenadeMuzzle - * - * Public: No - */ -#include "script_component.hpp" - -private ["_uniformMags", "_vestMags", "_backpackMags", "_numberOfMagazines", "_magazineClasses", "_firstMagazine"]; - -params ["_unit", "_muzzle"]; - -_uniformMags = getMagazineCargo uniformContainer _unit; -_vestMags = getMagazineCargo vestContainer _unit; -_backpackMags = getMagazineCargo backpackContainer _unit; - -_numberOfMagazines = 0; -_magazineClasses = getArray (configFile >> "CfgWeapons" >> "Throw" >> _muzzle >> "magazines"); -_firstMagazine = _magazineClasses select 0; - -{ - private ["_indexInUniform", "_indexInVest", "_indexInBackpack"]; - - _indexInUniform = (_uniformMags select 0) find _x; - if (_indexInUniform > -1) then { - _numberOfMagazines = _numberOfMagazines + ((_uniformMags select 1) select _indexInUniform); - _firstMagazine = _x; - }; - - _indexInVest = (_vestMags select 0) find _x; - if (_indexInVest > -1) then { - _numberOfMagazines = _numberOfMagazines + ((_vestMags select 1) select _indexInVest); - _firstMagazine = _x; - }; - - _indexInBackpack = (_backpackMags select 0) find _x; - if (_indexInBackpack > -1) then { - _numberOfMagazines = _numberOfMagazines + ((_backpackMags select 1) select _indexInBackpack); - _firstMagazine = _x; - }; - -} forEach _magazineClasses; - -[_numberOfMagazines, _firstMagazine] diff --git a/addons/weaponselect/functions/fnc_displayGrenadeTypeAndNumber.sqf b/addons/weaponselect/functions/fnc_displayGrenadeTypeAndNumber.sqf index 37956d2121..6ae945e2fd 100644 --- a/addons/weaponselect/functions/fnc_displayGrenadeTypeAndNumber.sqf +++ b/addons/weaponselect/functions/fnc_displayGrenadeTypeAndNumber.sqf @@ -1,10 +1,10 @@ /* - * Author: esteldunedain + * Author: esteldunedain, commy2 * Display a grenade type and quantity. * * Arguments: - * 0: magazine class - * 1: number of magazines + * 0: grenade magazine class + * 1: number of grenades * * Return Value: * None @@ -18,14 +18,14 @@ if !(GVAR(DisplayText)) exitwith {}; +params ["_magazine", "_numberofGrenades"]; + private ["_color", "_name", "_text", "_picture"]; -params ["_magazine", "_numberofMagazines"]; - -_color = [[1, 0, 0], [1, 1, 1]] select (_numberofMagazines > 0); +_color = [[1, 0, 0], [1, 1, 1]] select (_numberofGrenades > 0); _name = getText (configFile >> "CfgMagazines" >> _magazine >> "displayNameShort"); -_text = [format["%1 x%2", _name, _numberofMagazines], _color] call EFUNC(common,stringToColoredText); +_text = [format ["%1 x%2", _name, _numberofGrenades], _color] call EFUNC(common,stringToColoredText); _picture = getText (configFile >> "CfgMagazines" >> _magazine >> "picture"); -[_text, _picture] call EFUNC(common,displayTextPicture); +["displayTextPicture", [_text, _picture]] call EFUNC(common,localEvent); diff --git a/addons/weaponselect/functions/fnc_findNextGrenadeMagazine.sqf b/addons/weaponselect/functions/fnc_findNextGrenadeMagazine.sqf deleted file mode 100644 index 2b2370260a..0000000000 --- a/addons/weaponselect/functions/fnc_findNextGrenadeMagazine.sqf +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Author: commy2 - * Find the next Grenade Magazine. - * - * Arguments: - * 0: Grenade Type ("All", "Frag", "NonFrag") - * - * Return Value: - * Magazine classname - * - * Example: - * ["All"] call ace_weaponselect_fnc_findNextGrenadeMagazine - * - * Public: No - */ -#include "script_component.hpp" - -private ["_allMags", "_allMuzzles", "_magazines", "_start", "_index", "_nextMagazine"]; - -params ["_type"]; - -_allMags = missionNamespace getVariable [format [QGVAR(%1Magazines), _type], []]; -_allMuzzles = missionNamespace getVariable [format [QGVAR(%1Muzzles), _type], []]; - -_magazines = magazines ACE_player; - -_start = [GVAR(CurrentGrenadeMuzzleOther), GVAR(CurrentGrenadeMuzzleFrag)] select GVAR(CurrentGrenadeMuzzleIsFrag); -_index = _allMuzzles find _start; - -scopeName "SearchMain"; - -_nextMagazine = ""; -for "_index" from (_index + 1) to (count _allMuzzles - 1) do { - { - if (_x in (_allMags select _index)) exitWith {_nextMagazine = _x; breakTo "SearchMain"}; - } count _magazines; -}; - -if (_nextMagazine != "") exitWith {_nextMagazine}; - -for "_index" from 0 to _index do { - { - if (_x in (_allMags select _index)) exitWith {_nextMagazine = _x; breakTo "SearchMain"}; - } count _magazines; -}; - -_nextMagazine diff --git a/addons/weaponselect/functions/fnc_findNextGrenadeMuzzle.sqf b/addons/weaponselect/functions/fnc_findNextGrenadeMuzzle.sqf deleted file mode 100644 index 5aa096f44e..0000000000 --- a/addons/weaponselect/functions/fnc_findNextGrenadeMuzzle.sqf +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Author: commy2 - * Find the next Grenade Muzzle. - * - * Arguments: - * 0: Grenade Type ("All", "Frag", "NonFrag") - * - * Return Value: - * Class name of next throw muzzle - * - * Example: - * ["All"] call ace_weaponselect_fnc_findNextGrenadeMuzzle - * - * Public: No - */ -#include "script_component.hpp" - -private ["_allMags", "_allMuzzles", "_magazines", "_start", "_index", "_nextMuzzle"]; - -params ["_type"]; - -_allMags = missionNamespace getVariable [format [QGVAR(%1Magazines), _type], []]; -_allMuzzles = missionNamespace getVariable [format [QGVAR(%1Muzzles), _type], []]; - -_magazines = magazines ACE_player; - -_start = [GVAR(CurrentGrenadeMuzzleOther), GVAR(CurrentGrenadeMuzzleFrag)] select GVAR(CurrentGrenadeMuzzleIsFrag); -_index = _allMuzzles find _start; - -scopeName "SearchMain"; - -_nextMuzzle = ""; -for "_index" from (_index + 1) to (count _allMuzzles - 1) do { - { - if (_x in (_allMags select _index)) exitWith {_nextMuzzle = _allMuzzles select _index; breakTo "SearchMain"}; - } count _magazines; -}; - -if (_nextMuzzle != "") exitWith {_nextMuzzle}; - -for "_index" from 0 to _index do { - { - if (_x in (_allMags select _index)) exitWith {_nextMuzzle = _allMuzzles select _index; breakTo "SearchMain"}; - } count _magazines; -}; - -_nextMuzzle diff --git a/addons/weaponselect/functions/fnc_fireSmokeLauncher.sqf b/addons/weaponselect/functions/fnc_fireSmokeLauncher.sqf index 20ef674dae..71ef89ecf6 100644 --- a/addons/weaponselect/functions/fnc_fireSmokeLauncher.sqf +++ b/addons/weaponselect/functions/fnc_fireSmokeLauncher.sqf @@ -15,10 +15,10 @@ */ #include "script_component.hpp" -private ["_turret", "_weapons"]; - params ["_vehicle"]; +private ["_turret", "_weapons"]; + _turret = [_vehicle] call EFUNC(common,getTurretCommander); _weapons = _vehicle weaponsTurret _turret; @@ -29,11 +29,10 @@ if ( ) then { //This doesn't work reliably for vehilces with additional weapons for the commander. Select smoke launcher instead. - private "_index"; - // avoid infinite loop if !("SmokeLauncher" in _weapons) exitWith {}; + private "_index"; _index = 0; while { _vehicle currentWeaponTurret _turret != "SmokeLauncher" @@ -46,8 +45,9 @@ if ( // fire away! private "_logic"; - _logic = createGroup sideLogic createUnit ["Logic", [0,0,0], [], 0, "NONE"]; + _logic action ["useWeapon", _vehicle, commander _vehicle, 0]; + deleteVehicle _logic; }; diff --git a/addons/weaponselect/functions/fnc_getSelectedGrenade.sqf b/addons/weaponselect/functions/fnc_getSelectedGrenade.sqf deleted file mode 100644 index aa89a13c98..0000000000 --- a/addons/weaponselect/functions/fnc_getSelectedGrenade.sqf +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Author: commy2 - * Returns the selected Grenade Muzzle. - * - * Arguments: - * None - * - * Return Value: - * Class name of selected throw muzzle - * - * Example: - * [] call ace_weaponselect_fnc_getSelectedGrenade - * - * Public: No - */ -#include "script_component.hpp" - -[GVAR(CurrentGrenadeMuzzleOther), GVAR(CurrentGrenadeMuzzleFrag)] select GVAR(CurrentGrenadeMuzzleIsFrag) diff --git a/addons/weaponselect/functions/fnc_playChangeFiremodeSound.sqf b/addons/weaponselect/functions/fnc_playChangeFiremodeSound.sqf index c79f03c6f2..28ef5d21e5 100644 --- a/addons/weaponselect/functions/fnc_playChangeFiremodeSound.sqf +++ b/addons/weaponselect/functions/fnc_playChangeFiremodeSound.sqf @@ -1,6 +1,6 @@ /* * Author: commy2 - * Play the change firemode sound for specified weapon at units position. + * Play weapon firemode change sound. * * Arguments: * 0: Unit @@ -16,32 +16,24 @@ */ #include "script_component.hpp" -private ["_sound"]; - params ["_unit", "_weapon"]; +private ["_sound", "_position"]; + _sound = getArray (configFile >> "CfgWeapons" >> _weapon >> "changeFiremodeSound"); -if (count _sound == 0) exitWith {}; +if (_sound isEqualTo []) exitWith {}; -// add file extension -if call { - { - if (toLower (_sound select 0) find _x == count toArray (_sound select 0) - count toArray _x - 1) exitWith {false}; - true - } forEach [".wav", ".ogg", ".wss"]; -} then { - _sound set [0, (_sound select 0) + ".wss"]; +// get position where to play the sound (position of the weapon) +_position = AGLToASL (_unit modelToWorldVisual (_unit selectionPosition "RightHand")); + +_sound params ["_filename", ["_volume", 1], ["_soundPitch", 1], ["_distance", 0]]; + +if (_filename == "") exitWith {}; + +// add file extension .wss as default +if !(toLower (_filename select [count _filename - 4]) in [".wav", ".ogg", ".wss"]) then { + _filename = format ["%1.wss", _filename]; }; -// add default volume, pitch and distance -if (count _sound < 2) then {_sound pushBack 1}; -if (count _sound < 3) then {_sound pushBack 1}; -if (count _sound < 4) then {_sound pushBack 0}; - -private "_position"; - -_position = _unit modelToWorldVisual (_unit selectionPosition "RightHand"); -_position set [2, (_position select 2) + ((getPosASLW _unit select 2) - (getPosATL _unit select 2) max 0)]; - -playSound3D [_sound select 0, objNull, false, _position, _sound select 1, _sound select 2, _sound select 3]; +playSound3D [_filename, objNull, false, _position, _volume, _soundPitch, _distance]; diff --git a/addons/weaponselect/functions/fnc_putWeaponAway.sqf b/addons/weaponselect/functions/fnc_putWeaponAway.sqf index faddb4d869..fd1e463a4d 100644 --- a/addons/weaponselect/functions/fnc_putWeaponAway.sqf +++ b/addons/weaponselect/functions/fnc_putWeaponAway.sqf @@ -11,7 +11,7 @@ * Example: * [player] call ace_weaponselect_fnc_putWeaponAway * - * Public: NO + * Public: Yes */ #include "script_component.hpp" diff --git a/addons/weaponselect/functions/fnc_selectGrenadeAll.sqf b/addons/weaponselect/functions/fnc_selectGrenadeAll.sqf deleted file mode 100644 index a68670184a..0000000000 --- a/addons/weaponselect/functions/fnc_selectGrenadeAll.sqf +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Author: esteldunedain, commy2 - * Cycle through all grenades. - * - * Arguments: - * 0: Unit - * - * Return Value: - * None - * - * Example: - * [player] call ace_weaponselect_fnc_selectGrenadeAll - * - * Public: No - */ -#include "script_component.hpp" - -private ["_text", "_nextMuzzle"]; - -params ["_unit"]; - -_nextMuzzle = ["All"] call FUNC(findNextGrenadeMuzzle); - -if (_nextMuzzle != "") then { - - private ["_magazines", "_magazine", "_count", "_return"]; - _magazines = GVAR(AllMagazines) select (GVAR(AllMuzzles) find _nextMuzzle); - reverse _magazines; - - _magazine = ""; - _count = {_return = _x in _magazines; if (_return) then {_magazine = _x}; _return} count magazines _unit; - - // There is a muzzle with magazines --> cycle to it - [_unit, _nextMuzzle] call FUNC(setNextGrenadeMuzzle); - - [_magazine, _count] call FUNC(displayGrenadeTypeAndNumber); - -} else { - // There is a no muzzle with magazines --> select nothing - GVAR(CurrentGrenadeMuzzleFrag) = ""; GVAR(CurrentGrenadeMuzzleOther) = ""; - - if (GVAR(DisplayText)) then { - _text = [localize LSTRING(NoGrenadesLeft), [1,0,0]] call EFUNC(common,stringToColoredText); - [composeText [lineBreak, _text]] call EFUNC(common,displayTextStructured); - }; -}; - -if (_nextMuzzle in GVAR(FragMuzzles)) then { - GVAR(CurrentGrenadeMuzzleFrag) = _nextMuzzle; - GVAR(CurrentGrenadeMuzzleIsFrag) = true; -} else { - GVAR(CurrentGrenadeMuzzleOther) = _nextMuzzle; - GVAR(CurrentGrenadeMuzzleIsFrag) = false; -}; diff --git a/addons/weaponselect/functions/fnc_selectGrenadeFrag.sqf b/addons/weaponselect/functions/fnc_selectGrenadeFrag.sqf deleted file mode 100644 index c221b6cc30..0000000000 --- a/addons/weaponselect/functions/fnc_selectGrenadeFrag.sqf +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Author: esteldunedain, commy2 - * Cycle through frags. - * - * Arguments: - * 0: Unit - * - * Return Value: - * None - * - * Example: - * [player] call ace_weaponselect_fnc_selectGrenadeFrag - * - * Public: No - */ -#include "script_component.hpp" - -private ["_text", "_nextMuzzle"]; - -params ["_unit"]; - -_nextMuzzle = ["Frag"] call FUNC(findNextGrenadeMuzzle); - -if (_nextMuzzle != "") then { - GVAR(CurrentGrenadeMuzzleFrag) = _nextMuzzle; - - private ["_magazines", "_magazine", "_count", "_return"]; - _magazines = GVAR(FragMagazines) select (GVAR(FragMuzzles) find _nextMuzzle); - reverse _magazines; - - _magazine = ""; - _count = {_return = _x in _magazines; if (_return) then {_magazine = _x}; _return} count magazines _unit; - - // There is a muzzle with magazines --> cycle to it - [_unit, _nextMuzzle] call FUNC(setNextGrenadeMuzzle); - - [_magazine, _count] call FUNC(displayGrenadeTypeAndNumber); - -} else { - // There is a no muzzle with magazines --> select nothing - GVAR(CurrentGrenadeMuzzleFrag) = ""; - if (GVAR(DisplayText)) then { - _text = [localize LSTRING(NoFragsLeft), [1,0,0]] call EFUNC(common,stringToColoredText); - [composeText [lineBreak, _text]] call EFUNC(common,displayTextStructured); - }; -}; - -GVAR(CurrentGrenadeMuzzleIsFrag) = true; diff --git a/addons/weaponselect/functions/fnc_selectGrenadeOther.sqf b/addons/weaponselect/functions/fnc_selectGrenadeOther.sqf deleted file mode 100644 index 2f219989eb..0000000000 --- a/addons/weaponselect/functions/fnc_selectGrenadeOther.sqf +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Author: esteldunedain, commy2 - * Cycle through non explosive grenades. - * - * Arguments: - * 0: Unit - * - * Return Value: - * None - * - * Example: - * [player] call ace_weaponselect_fnc_selectGrenadeOther - * - * Public: No - */ -#include "script_component.hpp" - -private ["_nextMuzzle", "_text"]; - -params ["_unit"]; - -_nextMuzzle = ["NonFrag"] call FUNC(findNextGrenadeMuzzle); - -if (_nextMuzzle != "") then { - GVAR(CurrentGrenadeMuzzleOther) = _nextMuzzle; - - private ["_magazines", "_magazine", "_count", "_return"]; - _magazines = GVAR(NonFragMagazines) select (GVAR(NonFragMuzzles) find _nextMuzzle); - reverse _magazines; - - _magazine = ""; - _count = {_return = _x in _magazines; if (_return) then {_magazine = _x}; _return} count magazines _unit; - - // There is a muzzle with magazines --> cycle to it - [_unit, _nextMuzzle] call FUNC(setNextGrenadeMuzzle); - - [_magazine, _count] call FUNC(displayGrenadeTypeAndNumber); - -} else { - // There is a no muzzle with magazines --> select nothing - GVAR(CurrentGrenadeMuzzleOther) = ""; - if (GVAR(DisplayText)) then { - _text = [localize LSTRING(NoMiscGrenadeLeft), [1,0,0]] call EFUNC(common,stringToColoredText); - [composeText [lineBreak, _text]] call EFUNC(common,displayTextStructured); - }; -}; - -GVAR(CurrentGrenadeMuzzleIsFrag) = false; diff --git a/addons/weaponselect/functions/fnc_selectNextGrenade.sqf b/addons/weaponselect/functions/fnc_selectNextGrenade.sqf new file mode 100644 index 0000000000..d4a00b5718 --- /dev/null +++ b/addons/weaponselect/functions/fnc_selectNextGrenade.sqf @@ -0,0 +1,78 @@ +/* + * Author: commy2 + * Select the next grenade. + * + * Arguments: + * 0: Unit + * 1: Grenade type [0: all, 1: frags, 2: non-frags] (default: 0) + * + * Return Value: + * Selecting successful? + * + * Example: + * [player] call ace_weaponselect_fnc_selectNextGrenade + * + * Public: Yes + */ +#include "script_component.hpp" + +params ["_unit", ["_type", 0]]; + +private ["_currentGrenade", "_magazines", "_grenades", "_nextGrenadeIndex", "_nextGrenade", "_uniformGrenades", "_vestGrenades", "_backpackGrenades"]; + +// get currently selected grenade +_currentGrenade = currentThrowable _unit; + +// get correct array format if no grenade is selected +if (_currentGrenade isEqualTo []) then { + _currentGrenade = ["", ""]; +}; + +_currentGrenade = _currentGrenade select 0; + +// get available magazines for that unit +_magazines = magazines _unit; + +_grenades = []; + +{ + if (_x in _magazines) then { + _grenades pushBack _x; + }; + false +} count ([GVAR(GrenadesAll), GVAR(GrenadesFrag), GVAR(GrenadesNonFrag)] select _type); + +// abort if no grenades are available +if (_grenades isEqualTo []) exitWith {false}; + +// get next grenade muzzle +_nextGrenadeIndex = (_grenades find _currentGrenade) + 1; + +// roll over if the last grenade was selected +if (_nextGrenadeIndex >= count _grenades) then { + _nextGrenadeIndex = 0; +}; + +_nextGrenade = _grenades select _nextGrenadeIndex; + +// abort if the same grenade would be selected +if (_currentGrenade == _nextGrenade) exitWith {false}; + +// current best method to select a grenade: remove all grenades except the one you want to select, then add them back +_uniformGrenades = [uniformItems _unit, {_x in GVAR(GrenadesAll) && {_x != _nextGrenade}}] call EFUNC(common,filter); +_vestGrenades = [vestItems _unit, {_x in GVAR(GrenadesAll) && {_x != _nextGrenade}}] call EFUNC(common,filter); +_backpackGrenades = [backpackItems _unit, {_x in GVAR(GrenadesAll) && {_x != _nextGrenade}}] call EFUNC(common,filter); + +// remove all grenades except those we are switching to --> this breaks the selector +{_unit removeItemFromUniform _x; false} count _uniformGrenades; +{_unit removeItemFromVest _x; false} count _vestGrenades; +{_unit removeItemFromBackpack _x; false} count _backpackGrenades; + +// readd grenades +{_unit addItemToUniform _x; false} count _uniformGrenades; +{_unit addItemToVest _x; false} count _vestGrenades; +{_unit addItemToBackpack _x; false} count _backpackGrenades; + +[_nextGrenade, {_x == _nextGrenade} count _magazines] call FUNC(displayGrenadeTypeAndNumber); + +true diff --git a/addons/weaponselect/functions/fnc_setNextGrenadeMuzzle.sqf b/addons/weaponselect/functions/fnc_setNextGrenadeMuzzle.sqf deleted file mode 100644 index ce7ec55393..0000000000 --- a/addons/weaponselect/functions/fnc_setNextGrenadeMuzzle.sqf +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Author: esteldunedain - * Select the next grenade muzzle to throw. - * - * Arguments: - * 0: Unit - * 1: Muzzlename - * - * Return Value: - * None - * - * Example: - * [player, currentMuzzle player] call ace_weaponselect_fnc_setNextGrenadeMuzzle - * - * Public: No - */ -#include "script_component.hpp" - -private ["_uniformMags", "_vestMags", "_backpackMags", "_i", "_uniformMagsToRemove", "_vestMagsToRemove", "_backpackMagsToRemove", "_firstMagazine", "_throwMuzzleNames"]; - -params ["_unit", "_muzzle"]; - -_uniformMags = getMagazineCargo uniformContainer _unit; -_vestMags = getMagazineCargo vestContainer _unit; -_backpackMags = getMagazineCargo backpackContainer _unit; - -_uniformMagsToRemove = []; -_vestMagsToRemove = []; -_backpackMagsToRemove = []; - -_firstMagazine = ""; -_throwMuzzleNames = getArray (configfile >> "CfgWeapons" >> "Throw" >> "muzzles"); - -// Collect which magazines to remove -{ - private "_muzzleMagazines"; - _muzzleMagazines = getArray (configFile >> "CfgWeapons" >> "Throw" >> _x >> "magazines" ); - - if (_x != _muzzle) then { - - { - private "_index"; - _index = (_uniformMags select 0) find _x; - if (_index > -1) then { - _uniformMagsToRemove = _uniformMagsToRemove + [[_x, (_uniformMags select 1) select _index]]; - }; - - _index = (_vestMags select 0) find _x; - if (_index > -1) then { - _vestMagsToRemove = _vestMagsToRemove + [[_x, (_vestMags select 1) select _index]]; - }; - - _index = (_backpackMags select 0) find _x; - if (_index > -1) then { - _backpackMagsToRemove = _backpackMagsToRemove + [[_x, (_backpackMags select 1) select _index]]; - }; - } forEach _muzzleMagazines; - - } else { - - { - private "_index"; - _index = (_uniformMags select 0) find _x; - if (_index > -1) then { - _firstMagazine = _x; - }; - - _index = (_vestMags select 0) find _x; - if (_index > -1) then { - _firstMagazine = _x; - }; - - _index = (_backpackMags select 0) find _x; - if (_index > -1) then { - _firstMagazine = _x; - }; - } forEach _muzzleMagazines; - - }; -} forEach _throwMuzzleNames; - -// Remove all magazines except those we are switching to --> this breaks the selector -{ - for [{_i = 0}, {_i < (_x select 1)}, {_i = _i + 1}] do { - _unit removeItem (_x select 0); - }; -} forEach _uniformMagsToRemove; - -{ - for [{_i = 0}, {_i < (_x select 1)}, {_i = _i + 1}] do { - _unit removeItem (_x select 0); - }; -} forEach _vestMagsToRemove; - -{ - for [{_i = 0}, {_i < (_x select 1)}, {_i = _i + 1}] do { - _unit removeItem (_x select 0); - }; -} forEach _backpackMagsToRemove; - -// Readd magazines -{ - for [{_i = 0}, {_i < (_x select 1)}, {_i = _i + 1}] do { - _unit addItemToUniform (_x select 0); - }; -} forEach _uniformMagsToRemove; - -{ - for [{_i = 0}, {_i < (_x select 1)}, {_i = _i + 1}] do { - _unit addItemToVest (_x select 0); - }; -} forEach _vestMagsToRemove; - -{ - for [{_i = 0}, {_i < (_x select 1)}, {_i = _i + 1}] do { - _unit addItemToBackpack (_x select 0); - }; -} forEach _backpackMagsToRemove; diff --git a/addons/weather/README.md b/addons/weather/README.md index a2b719fc11..da83f62fd2 100644 --- a/addons/weather/README.md +++ b/addons/weather/README.md @@ -4,6 +4,7 @@ ace_weather This module simulates realistic weather effects, according to the geographical location of the map, the date and time. It also ensures that all players experience the same weather effects. + ## Maintainers The people responsible for merging changes to this component or answering potential questions. diff --git a/addons/weather/functions/fnc_calculateAirDensity.sqf b/addons/weather/functions/fnc_calculateAirDensity.sqf index 921bff3bf3..f3de65f99d 100644 --- a/addons/weather/functions/fnc_calculateAirDensity.sqf +++ b/addons/weather/functions/fnc_calculateAirDensity.sqf @@ -9,14 +9,14 @@ * 2: relativeHumidity - value between 0.0 and 1.0 * * Return Value: - * 0: density of air - kg * m^(-3) + * density of air - kg * m^(-3) * * Return value: * None */ #include "script_component.hpp" -PARAMS_3(_temperature,_pressure,_relativeHumidity); +params ["_temperature", "_pressure", "_relativeHumidity"]; _pressure = _pressure * 100; // hPa to Pa diff --git a/addons/weather/functions/fnc_calculateBarometricPressure.sqf b/addons/weather/functions/fnc_calculateBarometricPressure.sqf index 869deb93cb..134a741127 100644 --- a/addons/weather/functions/fnc_calculateBarometricPressure.sqf +++ b/addons/weather/functions/fnc_calculateBarometricPressure.sqf @@ -4,10 +4,10 @@ * Calculates the barometric pressure based on altitude and weather * * Arguments: - * 0: altitude - meters + * altitude - meters * * Return Value: - * 0: barometric pressure - hPA + * barometric pressure - hPA * * Return value: * None diff --git a/addons/weather/functions/fnc_calculateDewPoint.sqf b/addons/weather/functions/fnc_calculateDewPoint.sqf index 76656b1f55..cbfc606054 100644 --- a/addons/weather/functions/fnc_calculateDewPoint.sqf +++ b/addons/weather/functions/fnc_calculateDewPoint.sqf @@ -8,7 +8,7 @@ * 2: relativeHumidity - value between 0.0 and 1.0 * * Return Value: - * 0: dew point + * dew point * * Return value: * None @@ -18,7 +18,7 @@ #define __b 17.67 #define __c 243.5 -PARAMS_2(_t,_rh); +params ["_t", "_rh"]; if (_rh == 0) exitWith { CELSIUS(0) }; diff --git a/addons/weather/functions/fnc_calculateHeatIndex.sqf b/addons/weather/functions/fnc_calculateHeatIndex.sqf index 473360c867..057c13d7ad 100644 --- a/addons/weather/functions/fnc_calculateHeatIndex.sqf +++ b/addons/weather/functions/fnc_calculateHeatIndex.sqf @@ -5,10 +5,10 @@ * * Arguments: * 0: temperature - degrees celcius - * 2: relativeHumidity - value between 0.0 and 1.0 + * 1: relativeHumidity - value between 0.0 and 1.0 * * Return Value: - * 0: heat index + * heat index * * Return value: * None @@ -24,7 +24,7 @@ #define __C7 0.000687678 #define __C8 0.000274954 -PARAMS_2(_t,_rh); +params ["_t", "_rh"]; // Source: https://en.wikipedia.org/wiki/Heat_index diff --git a/addons/weather/functions/fnc_calculateRoughnessLength.sqf b/addons/weather/functions/fnc_calculateRoughnessLength.sqf index 08ae44cc74..4fd0d18fb3 100644 --- a/addons/weather/functions/fnc_calculateRoughnessLength.sqf +++ b/addons/weather/functions/fnc_calculateRoughnessLength.sqf @@ -4,10 +4,10 @@ * Calculates the terrain roughness length at a given world position * * Arguments: - * 0: _this - world position + * world position * * Return Value: - * 0: roughness length + * roughness length * * Public: No */ diff --git a/addons/weather/functions/fnc_calculateTemperatureAtHeight.sqf b/addons/weather/functions/fnc_calculateTemperatureAtHeight.sqf index dd31dfe05e..5e02795d59 100644 --- a/addons/weather/functions/fnc_calculateTemperatureAtHeight.sqf +++ b/addons/weather/functions/fnc_calculateTemperatureAtHeight.sqf @@ -4,10 +4,10 @@ * Calculates the temperature based on altitude and weather * * Arguments: - * 0: height - meters + * height - meters * * Return Value: - * 0: temperature - degrees celsius + * temperature - degrees celsius * * Return value: * None diff --git a/addons/weather/functions/fnc_calculateWetBulb.sqf b/addons/weather/functions/fnc_calculateWetBulb.sqf index c180cf8384..94e96cd11b 100644 --- a/addons/weather/functions/fnc_calculateWetBulb.sqf +++ b/addons/weather/functions/fnc_calculateWetBulb.sqf @@ -9,7 +9,7 @@ * 2: relativeHumidity - value between 0.0 and 1.0 * * Return Value: - * 0: wet bulb + * wet bulb * * Return value: * None @@ -18,7 +18,7 @@ private ["_es", "_e", "_eDiff", "_eGuessPrev", "_cTempDelta", "_twGuess", "_eguess"]; -PARAMS_3(_temperature,_pressure,_relativeHumidity); +params ["_temperature", "_pressure", "_relativeHumidity"]; // Source: http://cosmoquest.org/forum/showthread.php?155366-Calculating-Wet-Bulb-Temperature-from-RH-amp-Dry-Bulb _es = 6.112 * exp((17.67 * _temperature) / (_temperature + 243.5)); diff --git a/addons/weather/functions/fnc_calculateWindChill.sqf b/addons/weather/functions/fnc_calculateWindChill.sqf index 021d2f8b99..ee3a20283b 100644 --- a/addons/weather/functions/fnc_calculateWindChill.sqf +++ b/addons/weather/functions/fnc_calculateWindChill.sqf @@ -5,16 +5,16 @@ * * Arguments: * 0: temperature - degrees celcius - * 2: wind speed - m/s + * 1: wind speed - m/s * * Return Value: - * 0: wind chill + * wind chill * * Public: No */ #include "script_component.hpp" -PARAMS_2(_t,_v); +params ["_t", "_v"]; // Source: https://en.wikipedia.org/wiki/Wind_chill diff --git a/addons/weather/functions/fnc_calculateWindSpeed.sqf b/addons/weather/functions/fnc_calculateWindSpeed.sqf index d991897b97..87c6c49d42 100644 --- a/addons/weather/functions/fnc_calculateWindSpeed.sqf +++ b/addons/weather/functions/fnc_calculateWindSpeed.sqf @@ -10,24 +10,26 @@ * 3: Account for obstacles * * Return Value: - * 0: wind speed - m/s + * wind speed - m/s * * Public: No */ #include "script_component.hpp" -private ["_windSpeed", "_windDir", "_height", "_newWindSpeed", "_windSource", "_roughnessLength"]; +private ["_fnc_polar2vect", "_windSpeed", "_windDir", "_windDirAdjusted", "_height", "_newWindSpeed", "_windSource", "_roughnessLength"]; -PARAMS_4(_position,_windGradientEnabled,_terrainEffectEnabled,_obstacleEffectEnabled); +params ["_position", "_windGradientEnabled", "_terrainEffectEnabled", "_obstacleEffectEnabled"]; -fnc_polar2vect = { +_fnc_polar2vect = { private ["_mag2D"]; - _mag2D = (_this select 0) * cos((_this select 2)); - [_mag2D * sin((_this select 1)), _mag2D * cos((_this select 1)), (_this select 0) * sin((_this select 2))]; + params ["_x", "_y", "_z"]; + _mag2D = _x * cos(_z); + [_mag2D * sin(_y), _mag2D * cos(_y), _x * sin(_z)]; }; _windSpeed = vectorMagnitude ACE_wind; _windDir = (ACE_wind select 0) atan2 (ACE_wind select 1); +_windDirAdjusted = _windDir + 180; // Wind gradient if (_windGradientEnabled) then { @@ -46,19 +48,19 @@ if (_terrainEffectEnabled) then { if (_windSpeed > 0.05) then { _newWindSpeed = 0; { - _windSource = [100, _windDir + 180, _x] call fnc_polar2vect; + _windSource = [100, _windDirAdjusted, _x] call _fnc_polar2vect; if (!(terrainIntersectASL [_position, _position vectorAdd _windSource])) exitWith { _newWindSpeed = cos(_x * 9) * _windSpeed; }; - _windSource = [100, _windDir + 180 + _x, 0] call fnc_polar2vect; + _windSource = [100, _windDirAdjusted + _x, 0] call _fnc_polar2vect; if (!(terrainIntersectASL [_position, _position vectorAdd _windSource])) exitWith { _newWindSpeed = cos(_x * 9) * _windSpeed; }; - _windSource = [100, _windDir + 180 - _x, 0] call fnc_polar2vect; + _windSource = [100, _windDirAdjusted - _x, 0] call _fnc_polar2vect; if (!(terrainIntersectASL [_position, _position vectorAdd _windSource])) exitWith { _newWindSpeed = cos(_x * 9) * _windSpeed; }; - } forEach [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + } count [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; _windSpeed = _newWindSpeed; }; }; @@ -68,19 +70,19 @@ if (_obstacleEffectEnabled) then { if (_windSpeed > 0.05) then { _newWindSpeed = 0; { - _windSource = [20, _windDir + 180, _x] call fnc_polar2vect; + _windSource = [20, _windDirAdjusted, _x] call _fnc_polar2vect; if (!(lineIntersects [_position, _position vectorAdd _windSource])) exitWith { _newWindSpeed = cos(_x * 2) * _windSpeed; }; - _windSource = [20, _windDir + 180 + _x, 0] call fnc_polar2vect; + _windSource = [20, _windDirAdjusted + _x, 0] call _fnc_polar2vect; if (!(lineIntersects [_position, _position vectorAdd _windSource])) exitWith { _newWindSpeed = cos(_x * 2) * _windSpeed; }; - _windSource = [20, _windDir + 180 - _x, 0] call fnc_polar2vect; + _windSource = [20, _windDirAdjusted - _x, 0] call _fnc_polar2vect; if (!(lineIntersects [_position, _position vectorAdd _windSource])) exitWith { _newWindSpeed = cos(_x * 2) * _windSpeed; }; - } forEach [0, 5, 10, 15, 20, 25, 30, 35, 40, 45]; + } count [0, 5, 10, 15, 20, 25, 30, 35, 40, 45]; _windSpeed = _newWindSpeed; }; }; diff --git a/addons/weather/functions/fnc_getWind.sqf b/addons/weather/functions/fnc_getWind.sqf index 5b123afaa0..7e133896a6 100644 --- a/addons/weather/functions/fnc_getWind.sqf +++ b/addons/weather/functions/fnc_getWind.sqf @@ -11,11 +11,12 @@ */ #include "script_component.hpp" +private ["_periodPercent", "_periodPosition"]; + if (isNil "ACE_WIND_PARAMS") exitWith { [0, 0, 0] }; -EXPLODE_5_PVT(ACE_WIND_PARAMS,_dir,_dirChange,_spd,_spdChange,_period); +ACE_WIND_PARAMS params ["_dir", "_dirChange", "_spd", "_spdChange", "_period"]; -private ["_periodPercent", "_periodPosition"]; _periodPosition = (ACE_time - GVAR(wind_period_start_time)) min _period; _periodPercent = _periodPosition / _period; diff --git a/addons/weather/functions/fnc_initModuleSettings.sqf b/addons/weather/functions/fnc_initModuleSettings.sqf index eb0eaafc31..034612ab58 100644 --- a/addons/weather/functions/fnc_initModuleSettings.sqf +++ b/addons/weather/functions/fnc_initModuleSettings.sqf @@ -15,10 +15,7 @@ #include "script_component.hpp" -private ["_logic", "_units", "_activated"]; -_logic = _this select 0; -_units = _this select 1; -_activated = _this select 2; +params ["_logic", "_units", "_activated"]; if !(_activated) exitWith {}; @@ -36,4 +33,4 @@ if !(_activated) exitWith {}; // Server weather update interval [_logic, QGVAR(serverUpdateInterval), "serverUpdateInterval"] call EFUNC(common,readSettingFromModule); -GVAR(serverUpdateInterval) = 1 max GVAR(serverUpdateInterval) min 600; \ No newline at end of file +GVAR(serverUpdateInterval) = 1 max GVAR(serverUpdateInterval) min 600; diff --git a/addons/weather/functions/fnc_updateRain.sqf b/addons/weather/functions/fnc_updateRain.sqf index ced8641f61..6c4c829747 100644 --- a/addons/weather/functions/fnc_updateRain.sqf +++ b/addons/weather/functions/fnc_updateRain.sqf @@ -14,8 +14,8 @@ if (!GVAR(syncRain)) exitWith {}; if (!isNil "ACE_RAIN_PARAMS") then { - EXPLODE_3_PVT(ACE_RAIN_PARAMS,_oldRain,_newRain,_period); - + ACE_RAIN_PARAMS params ["_oldRain", "_newRain", "_period"]; + private ["_periodPosition", "_periodPercent"]; _periodPosition = (ACE_time - GVAR(rain_period_start_time)) min _period; _periodPercent = (_periodPosition / _period) min 1; diff --git a/addons/weather/stringtable.xml b/addons/weather/stringtable.xml index 69e2d4a792..d6129f67e5 100644 --- a/addons/weather/stringtable.xml +++ b/addons/weather/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -20,6 +20,9 @@ Wetter Počasí Clima + Météo + Időjárás + Погода Multiplayer synchronized ACE weather module @@ -28,6 +31,9 @@ ACE-Wettermodul (synchron im Multiplayer) Synchronizovat ACE počasí v multiplayeru Módulo climático ACE para sincronismo multiplayer + Module ACE de synchronisation de la météo en multi. + Többjátékos szinkronizált ACE időjárás modul + ACE Модуль для синхронизации погоды в мультиплеере Weather propagation @@ -36,6 +42,9 @@ Wetterübertragung Změny počasí Propagação do clima + Propagation de la météo + Időjárás-változás + Единая погода для всех Enables server side weather propagation @@ -44,6 +53,9 @@ Aktiviere serverseitige Wetterübertragung Aktivuje změny počasí na straně serveru Ativa propagação de clima via server + Active la propagation météo par le serveur + Engedélyezi a szerveroldali időjárás-változást + Включает управление погодой на серверной стороне ACE Weather @@ -52,6 +64,9 @@ ACE-Wetter ACE počasí Clima ACE + ACE Météo + ACE Időjárás + Погода ACE Overrides the default weather (editor, mission settings) with ACE weather (map based) @@ -60,6 +75,9 @@ Überschreibt das Standardwetter (Editor, Missionseinstellungen) mit dem ACE-Wetter (kartenbasiert) Přepíše výchozí počasí (editor, nastavení mise) s ACE počasím (podle mapy) Sobreescreve o clima padrão (editor, ajustes de missão) pelo sistema de clima ACE (baseado por mapa) + Force la métao par défaut (éditeur, paramètres de mission) avec la météo ACE (basé sur la carte) + Felülbírálja az alapértelmezett időjárást (editor, küldetésbeállítások) az ACE időjárással (térkép-alapú) + Заменяет погоду по-умолчанию (из редактора, настроек миссии) погодой ACE (на основе карты) Sync Rain @@ -68,6 +86,9 @@ Regen synchronisieren Synchronizuj déšť Sincronizar chuva + Synchronisation de la pluie + Eső szinkronizálása + Синхрониз. дождь Synchronizes rain @@ -76,6 +97,9 @@ Synchronisiert den Regen Synchronizace deště Sincroniza a chuva + Synchronise la pluie + Szinkronizálja az esőt + Синхронизирует дождь Sync Wind @@ -84,6 +108,9 @@ Wind synchronisieren Synchronizuj vítr Sincronizar vento + Synchronisation du vent + Szél szinkronizálása + Синхрониз. ветер Synchronizes wind @@ -92,6 +119,9 @@ Synchronisiert den Wind Synchronizace větru Sincroniza o vento + Synchronise le vent + Szinkronizálja a szelet + Синхронизирует ветер Sync Misc @@ -100,6 +130,9 @@ Sonstiges synchronisieren Synchronizuj různé Sincronizar outros + Synchronisation autres + Egyéb szinkronizálása + Синхрониз. прочее Synchronizes lightnings, rainbow, fog, ... @@ -108,6 +141,9 @@ Synchronisiert Blitze, Regenbögen, Nebel, ... Synchronizace blesků, duhy, mlhy, ... Sincroniza relâmpagos, arco-íris, neblina... + Synchronise les éclairs, les arcs en ciel, le brouillard + Szinkronizálja a villámokat, szivárványokat, ködöt, ... + Синхронизирует молнии, радугу, туман, ... Update Interval @@ -116,6 +152,9 @@ Aktualisierungsintervall Interval aktualizace Intervalo de atualização + Intervalle de synchronisation + Frissítési intervallum + Интервал обновления Defines the interval (seconds) between weather updates @@ -124,6 +163,9 @@ Definiert das Intervall (in Sekunden) zwischen Wetteraktualisierungen Určit interval (v sekundách) mezi aktualizacemi počasí Defina o intervalo (em segundos) entre as atualizações de clima + Défini un intervalle (secondes) entre deux synchronisations + Megadja az intervallumot (másodpercben) az időjárás-frissítések között + Определяет интервал (в секундах) между обновлениями погоды - \ No newline at end of file + diff --git a/addons/winddeflection/README.md b/addons/winddeflection/README.md index c2908a6f85..926b957715 100644 --- a/addons/winddeflection/README.md +++ b/addons/winddeflection/README.md @@ -3,9 +3,10 @@ ace_winddeflection Wind deflection for projectiles/bullets. + ## Maintainers The people responsible for merging changes to this component or answering potential questions. - [Glowbal](https://github.com/Glowbal) -- [Ruthberg] (http://github.com/Ulteq) \ No newline at end of file +- [Ruthberg](http://github.com/Ulteq) diff --git a/addons/winddeflection/XEH_postInit.sqf b/addons/winddeflection/XEH_postInit.sqf index 63d866fb60..ff9e2427f4 100644 --- a/addons/winddeflection/XEH_postInit.sqf +++ b/addons/winddeflection/XEH_postInit.sqf @@ -1,6 +1,6 @@ #include "script_component.hpp" -if !(hasInterface) exitWith {}; +if (!hasInterface) exitWith {}; GVAR(trackedBullets) = []; diff --git a/addons/winddeflection/config.cpp b/addons/winddeflection/config.cpp index 82a51a4b73..a7bedbb9ef 100644 --- a/addons/winddeflection/config.cpp +++ b/addons/winddeflection/config.cpp @@ -6,9 +6,8 @@ class CfgPatches { weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_weather"}; - versionDesc = "ACE Wind Deflection"; author[] = {ECSTRING(common,ACETeam), "Glowbal", "Ruthberg"}; - authorUrl = "http://csemod.com"; + authorUrl = "http://ace3mod.com/"; VERSION_CONFIG; }; }; @@ -23,4 +22,4 @@ class CfgAddons { #include "CfgEventHandlers.hpp" #include "CfgVehicles.hpp" -#include "ACE_Settings.hpp" \ No newline at end of file +#include "ACE_Settings.hpp" diff --git a/addons/winddeflection/stringtable.xml b/addons/winddeflection/stringtable.xml index f7b4324233..76e3f7f4e4 100644 --- a/addons/winddeflection/stringtable.xml +++ b/addons/winddeflection/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -68,6 +68,9 @@ Účinky větru Windablenkung Desvio de vento + Déflexion du vent + Szél-hárítás + Отклонение ветром Wind Deflection @@ -76,6 +79,9 @@ Windablenkung Účinky větru Desvio de vento + Déflexion du vent + Szél-hárítás + Отклонение ветром Enables wind deflection @@ -84,6 +90,9 @@ Aktiviert Windablenkung Umožňit vliv větru Ativa o desvio de vento + Active la déflexion dûe au vent + Engedélyezi a szél-hárítást + Включает отклонение ветром Vehicle Enabled @@ -92,6 +101,9 @@ Fahrzeuge aktiviert Vozidla povolena Ativado em veículos + Activer les véhicules + Jármű engedélyezve + Для техники Enables wind deflection for static/vehicle gunners @@ -100,6 +112,9 @@ Aktiviere Windablenkung für statische oder Fahrzeugschützen Umožnit vliv větru pro střelce z vozidla/statiky Ativa o desvio de vento para atiradores de estáticas e veículos + Activer la déflection dûe au vent pour les armes statique et les véhicules + Engedélyezi a szél-hárítást a statikus/jármű-lövészeknél + Включает отклонение ветром для стрелков стационарных орудий и техники Simulation Interval @@ -108,6 +123,9 @@ Simulationsintervall Interval simulace Intervalo de simulação + Intervalle de simulation + Szimulációs intervallum + Интервал симуляции Defines the interval between every calculation step @@ -116,6 +134,9 @@ Definiert das Intervall zwischen jedem Berechnungsschritt Určuje interval mezi každým výpočtem Define o intervalo entre cada cálculo + Défini l'intervalle entre deux points de calcul + Megszabja a számítási lépések közötti intervallumot + Определяет временной интервал между расчетами Simulation Radius @@ -124,6 +145,9 @@ Simulationsradius Oblast simulace Radio da Simulação + Rayon de simulation + Szimulációs hatókör + Радиус симуляции Defines the radius around the player (in meters) at which projectiles are wind deflected @@ -132,6 +156,9 @@ Gibt den Radius (in Metern) um den Spieler an, in dem Projektile vom Wind beeinflusst werden Definuje oblast kolem hráče (v metrech) v které je projektil ovlivněn větrem Define o raio ao redor do jogador (em metros) em qual os projéteis são desviados pelo vento + Défini un rayon autour du joueur (en mètres) autour duquel les projectiles sont influencés par le vent + Meghatározza a játékos körüli hatókört (méterben), ahol a lövedékeket háríthatja a szél + Определяет радиус вокруг игрока (а метрах), в котором снаряды отклоняются ветром Wind influence on projectiles trajectory @@ -140,6 +167,9 @@ Windeinfluss auf die Geschossbahnen Vítr ovlivňuje trajektorii projektilu Influência do vento na trajetória dos projéteis + Le vent influe sur la trajectoire des projectiles + Szél hatása a lövedékek röppályájára + Влияние втера на траекторию снарядов diff --git a/addons/yardage450/README.md b/addons/yardage450/README.md index 6301233fe4..991c4f8a22 100644 --- a/addons/yardage450/README.md +++ b/addons/yardage450/README.md @@ -3,8 +3,9 @@ ace_yardage450 Adds the Bushnell Yardage Pro Sport 450 Laser Rangefinder. + ## Maintainers The people responsible for merging changes to this component or answering potential questions. -- [Ruthberg] (http://github.com/Ulteq) +- [Ruthberg](http://github.com/Ulteq) diff --git a/addons/yardage450/stringtable.xml b/addons/yardage450/stringtable.xml index 30887673e7..5a57ff2193 100644 --- a/addons/yardage450/stringtable.xml +++ b/addons/yardage450/stringtable.xml @@ -8,6 +8,8 @@ Yardage 450 Yardage 450 Yardage 450 + Yardage 450 + Yardage 450 Laser Rangefinder @@ -16,6 +18,8 @@ Telémetro láser Laserový dálkoměr Medidor de Distância a laser + Lézeres távolságmérő + Лазерный дальномер Yardage 450 - Power Button @@ -24,6 +28,8 @@ Yardage 450 - Botón de encendido Yardage 450 - Tlačítko napájení Yardage 450 - Botão de energia + Yardage 450 - Főkapcsoló gomb + Yardage 450 - Кнопка питания - + \ No newline at end of file diff --git a/addons/zeus/ACE_Settings.hpp b/addons/zeus/ACE_Settings.hpp index 388e3c42cb..6488a23e4e 100644 --- a/addons/zeus/ACE_Settings.hpp +++ b/addons/zeus/ACE_Settings.hpp @@ -20,4 +20,10 @@ class ACE_Settings { value = 0; values[] = {"$STR_A3_OPTIONS_DISABLED", CSTRING(revealMines_partial), CSTRING(revealMines_full)}; }; + class GVAR(autoAddObjects) { + displayName = CSTRING(AddObjectsToCurator); + description = CSTRING(AddObjectsToCurator_desc); + value = 0; + typeName = "BOOL"; + }; }; diff --git a/addons/zeus/CfgEventHandlers.hpp b/addons/zeus/CfgEventHandlers.hpp index f0a9f14d91..57d6a1afd0 100644 --- a/addons/zeus/CfgEventHandlers.hpp +++ b/addons/zeus/CfgEventHandlers.hpp @@ -4,3 +4,11 @@ class Extended_PreInit_EventHandlers { init = QUOTE(call COMPILE_FILE(XEH_preInit)); }; }; + +class Extended_InitPost_EventHandlers { + class AllVehicles { + class ADDON { + serverInit = QUOTE(call FUNC(addObjectToCurator)); + }; + }; +}; diff --git a/addons/zeus/CfgVehicles.hpp b/addons/zeus/CfgVehicles.hpp index 77273c60b7..35c43b0e84 100644 --- a/addons/zeus/CfgVehicles.hpp +++ b/addons/zeus/CfgVehicles.hpp @@ -115,4 +115,55 @@ class CfgVehicles { sync[] = {}; }; }; + class GVAR(moduleSetMedic): GVAR(moduleBase) { + curatorCanAttach = 1; + displayName = CSTRING(ModuleSetMedic_DisplayName); + function = QFUNC(moduleSetMedic); + icon = QUOTE(PATHTOF(UI\Icon_Module_Zeus_Medic_ca.paa)); + class ModuleDescription { + description = ""; + sync[] = {}; + }; + }; + class GVAR(moduleSetMedicalVehicle): GVAR(moduleBase) { + curatorCanAttach = 1; + displayName = CSTRING(ModuleSetMedicalVehicle_DisplayName); + function = QFUNC(moduleSetMedicalVehicle); + icon = QUOTE(PATHTOF(UI\Icon_Module_Zeus_Medic_ca.paa)); + class ModuleDescription { + description = ""; + sync[] = {}; + }; + }; + class GVAR(moduleSetMedicalFacility): GVAR(moduleBase) { + curatorCanAttach = 1; + displayName = CSTRING(ModuleSetMedicalFacility_DisplayName); + function = QFUNC(moduleSetMedicalFacility); + icon = QUOTE(PATHTOF(UI\Icon_Module_Zeus_Medic_ca.paa)); + class ModuleDescription { + description = ""; + sync[] = {}; + }; + }; + + class GVAR(moduleAddSpareTrack): GVAR(moduleBase) { + curatorCanAttach = 1; + displayName = CSTRING(ModuleAddSpareTrack_DisplayName); + function = QFUNC(moduleAddSpareTrack); + icon = QUOTE(PATHTOF(UI\Icon_Module_Zeus_Medic_ca.paa));//@todo + class ModuleDescription { + description = CSTRING(ModuleAddSpareTrack_Description); + sync[] = {}; + }; + }; + class GVAR(moduleAddSpareWheel): GVAR(moduleBase) { + curatorCanAttach = 1; + displayName = CSTRING(ModuleAddSpareWheel_DisplayName); + function = QFUNC(moduleAddSpareWheel); + icon = QUOTE(PATHTOF(UI\Icon_Module_Zeus_Medic_ca.paa));//@todo + class ModuleDescription { + description = CSTRING(ModuleAddSpareWheel_Description); + sync[] = {}; + }; + }; }; diff --git a/addons/zeus/README.md b/addons/zeus/README.md index b99edb66bb..35e7da1cdd 100644 --- a/addons/zeus/README.md +++ b/addons/zeus/README.md @@ -1,15 +1,16 @@ ace_zeus ========== -Provides control over various aspects of zeus: +Provides control over various aspects of Zeus: - Ascension messages - Eagle - Wind sounds - Ordnance radio messages - Mine markers + ## Maintainers The people responsible for merging changes to this component or answering potential questions. -- [SilentSpike] (http://github.com/SilentSpike) +- [SilentSpike](http://github.com/SilentSpike) diff --git a/addons/zeus/XEH_preInit.sqf b/addons/zeus/XEH_preInit.sqf index 1b2ac19263..9837d7162b 100644 --- a/addons/zeus/XEH_preInit.sqf +++ b/addons/zeus/XEH_preInit.sqf @@ -2,12 +2,18 @@ ADDON = false; +PREP(addObjectToCurator); PREP(bi_moduleCurator); PREP(bi_moduleMine); PREP(bi_moduleProjectile); PREP(bi_moduleRemoteControl); PREP(handleZeusUnitAssigned); +PREP(moduleAddSpareTrack); +PREP(moduleAddSpareWheel); PREP(moduleCaptive); +PREP(moduleSetMedic); +PREP(moduleSetMedicalVehicle); +PREP(moduleSetMedicalFacility); PREP(moduleSurrender); PREP(moduleUnconscious); PREP(moduleZeusSettings); diff --git a/addons/zeus/config.cpp b/addons/zeus/config.cpp index 7505f2770e..853edaf2e9 100644 --- a/addons/zeus/config.cpp +++ b/addons/zeus/config.cpp @@ -19,7 +19,16 @@ class CfgPatches { }; class GVAR(medical): ADDON { units[] = { - QGVAR(moduleUnconscious) + QGVAR(moduleUnconscious), + QGVAR(moduleSetMedic), + QGVAR(moduleSetMedicalVehicle), + QGVAR(moduleSetMedicalFacility) + }; + }; + class GVAR(cargoAndRepair): ADDON { + units[] = { + QGVAR(moduleAddSpareTrack), + QGVAR(moduleAddSpareWheel) }; }; }; @@ -27,6 +36,7 @@ class CfgPatches { class ACE_Curator { GVAR(captives) = "ace_captives"; GVAR(medical) = "ace_medical"; + GVAR(cargoAndRepair[]) = {"ace_cargo", "ace_repair"}; }; #include "CfgEventHandlers.hpp" diff --git a/addons/zeus/functions/fnc_addObjectToCurator.sqf b/addons/zeus/functions/fnc_addObjectToCurator.sqf new file mode 100644 index 0000000000..be814266ab --- /dev/null +++ b/addons/zeus/functions/fnc_addObjectToCurator.sqf @@ -0,0 +1,24 @@ +/* + * Author: Glowbal + * Adds an object to curator upon spawn + * + * Arguments: + * Object + * + * Return Value: + * None + * + * Public: No + */ + +#include "script_component.hpp" + +if (!isServer) exitwith {}; + +params ["_object"]; + +if (!(_object getvariable [QGVAR(addObject), GVAR(autoAddObjects)])) exitwith {}; + +{ + _x addCuratorEditableObjects [[_object], true]; +}foreach allCurators; diff --git a/addons/zeus/functions/fnc_moduleAddSpareTrack.sqf b/addons/zeus/functions/fnc_moduleAddSpareTrack.sqf new file mode 100644 index 0000000000..3acb024476 --- /dev/null +++ b/addons/zeus/functions/fnc_moduleAddSpareTrack.sqf @@ -0,0 +1,41 @@ +/* + * Author: Jonpas + * Adds a Spare Track to the vehicle. + * + * Arguments: + * 0: The module logic + * 1: Synchronized units + * 2: Activated + * + * Return Value: + * None + * + * Public: No + */ +#include "script_component.hpp" + +params ["_logic", "_units", "_activated"]; + +if !(_activated && local _logic) exitWith {}; + +if !(["ace_cargo"] call EFUNC(common,isModLoaded) && ["ace_repair"] call EFUNC(common,isModLoaded)) then { + [LSTRING(RequiresAddon)] call EFUNC(common,displayTextStructured); +} else { + (GETMVAR(bis_fnc_curatorObjectPlaced_mouseOver,[""])) params ["_mouseOverType", "_mouseOverUnit"]; + + if (_mouseOverType != "OBJECT") then { + [LSTRING(NothingSelected)] call EFUNC(common,displayTextStructured); + } else { + if !(alive _mouseOverUnit) then { + [LSTRING(OnlyAlive)] call EFUNC(common,displayTextStructured); + } else { + if (getNumber (configFile >> "CfgVehicles" >> "ACE_Track" >> QEGVAR(cargo,size)) > [_mouseOverUnit] call EFUNC(cargo,getCargoSpaceLeft)) then { + [LSTRING(OnlyEnoughCargoSpace)] call EFUNC(common,displayTextStructured); + } else { + ["AddCargoByClass", ["ACE_Track", _mouseOverUnit, 1, true]] call EFUNC(common,localEvent); + }; + }; + }; +}; + +deleteVehicle _logic; diff --git a/addons/zeus/functions/fnc_moduleAddSpareWheel.sqf b/addons/zeus/functions/fnc_moduleAddSpareWheel.sqf new file mode 100644 index 0000000000..c353af189b --- /dev/null +++ b/addons/zeus/functions/fnc_moduleAddSpareWheel.sqf @@ -0,0 +1,41 @@ +/* + * Author: Jonpas + * Adds a Spare Wheel to the vehicle. + * + * Arguments: + * 0: The module logic + * 1: Synchronized units + * 2: Activated + * + * Return Value: + * None + * + * Public: No + */ +#include "script_component.hpp" + +params ["_logic", "_units", "_activated"]; + +if !(_activated && local _logic) exitWith {}; + +if !(["ace_cargo"] call EFUNC(common,isModLoaded) && ["ace_repair"] call EFUNC(common,isModLoaded)) then { + [LSTRING(RequiresAddon)] call EFUNC(common,displayTextStructured); +} else { + (GETMVAR(bis_fnc_curatorObjectPlaced_mouseOver,[""])) params ["_mouseOverType", "_mouseOverUnit"]; + + if (_mouseOverType != "OBJECT") then { + [LSTRING(NothingSelected)] call EFUNC(common,displayTextStructured); + } else { + if !(alive _mouseOverUnit) then { + [LSTRING(OnlyAlive)] call EFUNC(common,displayTextStructured); + } else { + if (getNumber (configFile >> "CfgVehicles" >> "ACE_Wheel" >> QEGVAR(cargo,size)) > [_mouseOverUnit] call EFUNC(cargo,getCargoSpaceLeft)) then { + [LSTRING(OnlyEnoughCargoSpace)] call EFUNC(common,displayTextStructured); + } else { + ["AddCargoByClass", ["ACE_Wheel", _mouseOverUnit, 1, true]] call EFUNC(common,localEvent); + }; + }; + }; +}; + +deleteVehicle _logic; diff --git a/addons/zeus/functions/fnc_moduleCaptive.sqf b/addons/zeus/functions/fnc_moduleCaptive.sqf index 94e421e8d9..8273c8ba6f 100644 --- a/addons/zeus/functions/fnc_moduleCaptive.sqf +++ b/addons/zeus/functions/fnc_moduleCaptive.sqf @@ -3,21 +3,20 @@ * Flips the capture state of the unit the module is placed on. * * Arguments: - * 0: The module logic - * 1: units - * 2: activated + * 0: The module logic + * 1: Synchronized units + * 2: Activated * - * ReturnValue: - * nil + * Return Value: + * None * - * Public: no + * Public: No */ #include "script_component.hpp" -private ["_mouseOver", "_unit", "_captive"]; - params ["_logic", "_units", "_activated"]; +private ["_mouseOver", "_unit", "_captive"]; if !(_activated && local _logic) exitWith {}; diff --git a/addons/zeus/functions/fnc_moduleSetMedic.sqf b/addons/zeus/functions/fnc_moduleSetMedic.sqf new file mode 100644 index 0000000000..661e33f907 --- /dev/null +++ b/addons/zeus/functions/fnc_moduleSetMedic.sqf @@ -0,0 +1,52 @@ +/* + * Author: SilentSpike, Glowbal + * Assigns a medic role from the medical module to a unit + * + * Arguments: + * 0: The module logic + * 1: Synchronized units + * 2: Activated + * + * Return Value: + * None + * + * Public: No + */ + +#include "script_component.hpp" + +params ["_logic", "_units", "_activated"]; +private ["_mouseOver", "_unit", "_medicN"]; + +if !(_activated && local _logic) exitWith {}; + +if !(["ACE_Medical"] call EFUNC(common,isModLoaded)) then { + [LSTRING(RequiresAddon)] call EFUNC(common,displayTextStructured); +} else { + _mouseOver = GETMVAR(bis_fnc_curatorObjectPlaced_mouseOver,[""]); + + if ((_mouseOver select 0) != "OBJECT") then { + [LSTRING(NothingSelected)] call EFUNC(common,displayTextStructured); + } else { + _unit = effectivecommander (_mouseOver select 1); + + if !(_unit isKindOf "CAManBase") then { + [LSTRING(OnlyInfantry)] call EFUNC(common,displayTextStructured); + } else { + if !(alive _unit) then { + [LSTRING(OnlyAlive)] call EFUNC(common,displayTextStructured); + } else { + if (GETVAR(_unit,EGVAR(captives,isHandcuffed),false)) then { + [LSTRING(OnlyNonCaptive)] call EFUNC(common,displayTextStructured); + } else { + _medicN = GETVAR(_unit,EGVAR(medical,medicClass),0); + if (_medicN < 1) then { + _unit setvariable [QEGVAR(medical,medicClass), 1, true]; + }; + }; + }; + }; + }; +}; + +deleteVehicle _logic; diff --git a/addons/zeus/functions/fnc_moduleSetMedicalFacility.sqf b/addons/zeus/functions/fnc_moduleSetMedicalFacility.sqf new file mode 100644 index 0000000000..22826108e7 --- /dev/null +++ b/addons/zeus/functions/fnc_moduleSetMedicalFacility.sqf @@ -0,0 +1,51 @@ +/* + * Author: SilentSpike, Glowbal + * Assigns a medic role from the medical module to a unit + * + * Arguments: + * 0: The module logic + * 1: Synchronized units + * 2: Activated + * + * Return Value: + * None + * + * Public: No + */ + +#include "script_component.hpp" + +params ["_logic", "_units", "_activated"]; +private ["_mouseOver", "_unit"]; + +if !(_activated && local _logic) exitWith {}; + +if !(["ACE_Medical"] call EFUNC(common,isModLoaded)) then { + [LSTRING(RequiresAddon)] call EFUNC(common,displayTextStructured); +} else { + _mouseOver = GETMVAR(bis_fnc_curatorObjectPlaced_mouseOver,[""]); + + if ((_mouseOver select 0) != "OBJECT") then { + [LSTRING(NothingSelected)] call EFUNC(common,displayTextStructured); + } else { + _unit = (_mouseOver select 1); + + if (_unit isKindOf "Man" || {!(_unit isKindOf "Building")}) then { + [LSTRING(OnlyStructures)] call EFUNC(common,displayTextStructured); + } else { + if !(alive _unit) then { + [LSTRING(OnlyAlive)] call EFUNC(common,displayTextStructured); + } else { + if (GETVAR(_unit,EGVAR(captives,isHandcuffed),false)) then { + [LSTRING(OnlyNonCaptive)] call EFUNC(common,displayTextStructured); + } else { + if (!(GETVAR(_unit,EGVAR(medical,isMedicalFacility),false))) then { + _unit setvariable [QEGVAR(medical,isMedicalFacility), true, true]; + }; + }; + }; + }; + }; +}; + +deleteVehicle _logic; diff --git a/addons/zeus/functions/fnc_moduleSetMedicalVehicle.sqf b/addons/zeus/functions/fnc_moduleSetMedicalVehicle.sqf new file mode 100644 index 0000000000..9e5e788461 --- /dev/null +++ b/addons/zeus/functions/fnc_moduleSetMedicalVehicle.sqf @@ -0,0 +1,52 @@ +/* + * Author: SilentSpike, Glowbal + * Assigns a medic role from the medical module to a unit + * + * Arguments: + * 0: The module logic + * 1: Synchronized units + * 2: Activated + * + * Return Value: + * None + * + * Public: No + */ + +#include "script_component.hpp" + +params ["_logic", "_units", "_activated"]; +private ["_mouseOver", "_unit", "_medicN"]; + +if !(_activated && local _logic) exitWith {}; + +if !(["ACE_Medical"] call EFUNC(common,isModLoaded)) then { + [LSTRING(RequiresAddon)] call EFUNC(common,displayTextStructured); +} else { + _mouseOver = GETMVAR(bis_fnc_curatorObjectPlaced_mouseOver,[""]); + + if ((_mouseOver select 0) != "OBJECT") then { + [LSTRING(NothingSelected)] call EFUNC(common,displayTextStructured); + } else { + _unit = (_mouseOver select 1); + + if (_unit isKindOf "Man" || {_unit isKindOf "Building"}) then { + [LSTRING(OnlyVehicles)] call EFUNC(common,displayTextStructured); + } else { + if !(alive _unit) then { + [LSTRING(OnlyAlive)] call EFUNC(common,displayTextStructured); + } else { + if (GETVAR(_unit,EGVAR(captives,isHandcuffed),false)) then { + [LSTRING(OnlyNonCaptive)] call EFUNC(common,displayTextStructured); + } else { + _medicN = GETVAR(_unit,EGVAR(medical,medicClass),0); + if (_medicN < 1) then { + _unit setvariable [QEGVAR(medical,medicClass), 1, true]; + }; + }; + }; + }; + }; +}; + +deleteVehicle _logic; diff --git a/addons/zeus/functions/fnc_moduleSurrender.sqf b/addons/zeus/functions/fnc_moduleSurrender.sqf index b5365f8fc9..95f35593a5 100644 --- a/addons/zeus/functions/fnc_moduleSurrender.sqf +++ b/addons/zeus/functions/fnc_moduleSurrender.sqf @@ -3,21 +3,20 @@ * Flips the surrender state of the unit the module is placed on. * * Arguments: - * 0: The module logic - * 1: units - * 2: activated + * 0: The module logic + * 1: Synchronized units + * 2: Activated * - * ReturnValue: - * nil + * Return Value: + * None * - * Public: no + * Public: No */ #include "script_component.hpp" -private ["_mouseOver", "_unit", "_surrendering"]; - params ["_logic", "_units", "_activated"]; +private ["_mouseOver", "_unit", "_surrendering"]; if !(_activated && local _logic) exitWith {}; diff --git a/addons/zeus/functions/fnc_moduleUnconscious.sqf b/addons/zeus/functions/fnc_moduleUnconscious.sqf index eeff54a0f8..d9f9031cee 100644 --- a/addons/zeus/functions/fnc_moduleUnconscious.sqf +++ b/addons/zeus/functions/fnc_moduleUnconscious.sqf @@ -3,21 +3,20 @@ * Flips the unconscious state of the unit the module is placed on. * * Arguments: - * 0: The module logic - * 1: units - * 2: activated + * 0: The module logic + * 1: Synchronized units + * 2: Activated * - * ReturnValue: - * nil + * Return Value: + * None * - * Public: no + * Public: No */ #include "script_component.hpp" -private ["_mouseOver", "_unit", "_conscious"]; - params ["_logic", "_units", "_activated"]; +private ["_mouseOver", "_unit", "_conscious"]; if !(_activated && local _logic) exitWith {}; diff --git a/addons/zeus/stringtable.xml b/addons/zeus/stringtable.xml index 7c70978aa4..6063f5011a 100644 --- a/addons/zeus/stringtable.xml +++ b/addons/zeus/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -8,6 +8,9 @@ Nastavení Zeuse Zeus-Einstellungen Ajustes do Zeus + Paramètres du Zeus + Zeus beállítások + Настройки Зевса Provides control over various aspects of Zeus. @@ -16,6 +19,9 @@ Poskytuje kontrolu na různými aspekty Zeuse. Bietet die Steuerung verschiedener Zeus-Optionen an. Proporciona controle sobre diversos aspectos do Zeus. + Fourni le contrôle des différents aspects de Zeus + Különböző beállítási lehetőségeket biztosít a Zeus részeihez. + Позволяет контролировать различные аспекты Зевса. Ascension Messages @@ -24,6 +30,9 @@ Zpráva o novém Zeusovi Aufstiegsnachrichten Mensagens de ascensão + Message ascension + Felemelkedési üzenetek + Сообщения о вознесении Display global popup messages when a player is assigned as Zeus. @@ -32,6 +41,9 @@ Zobrazit globální zprávu když je hráč přiřazen jako Zeus. Zeige globale Popup-Nachrichten wenn ein Spieler zu Zeus wird. Mostra uma mensagem popup quando um jogador é atribuido ao Zeus. + Affiche un message en global quand un joueur est assigner comme Zeus + Globális üzeneteket jelez ki, ha egy játékos Zeus-nak lesz beosztva. + Отображает глобальное всплывающее сообщение, когда один из игроков становится Зевсом. Zeus Eagle @@ -40,6 +52,9 @@ Orel Zeuse Zeus-Adler Águia do Zeus + Aigle Zeus + Zeus sas + Орел Зевса Spawn an eagle that follows the Zeus camera. @@ -48,6 +63,9 @@ Vytvoří orla, který následuje kameru Zeuse. Erstelle einen Adler, der der Zeus-Kamera folgt. Cria uma águia que segue a câmera do Zeus + Faire apparaitre un aigle qui suit la caméra Zeus + Lerak egy sast, ami követi a Zeus kamerát. + Спавнит орла, который следует за камерой Зевса. Wind Sounds @@ -56,6 +74,9 @@ Zvuky větru Windgeräusche Sons de vento + Bruit de vent + Szélhangok + Звук ветра Play wind sounds when Zeus remote controls a unit. @@ -64,6 +85,9 @@ Přehrát varování (vítr) když Zeus převezmě kontrolu nad jednotkou. Spiele Windgeräusche ab, wenn Zeus eine Einheit steuert. Reproduz sons de vento quando uma unidade é remotamente controlada pelo Zeus. + Joue des bruits de vent quand Zeus controle une unité + Szélhangokat játszik le, ha a Zeus távvezérel egy egységet. + Проигрывает звук ветра каждый раз, когда Зевс вселяется в юнита. Ordnance Warning @@ -72,6 +96,9 @@ Varování před dělostřelectvem Artilleriewarnung Aviso de explosivos + Alerte d'équipement militaire + Tüzérségi figyelmeztetés + Предупреждение об арте Play a radio warning when Zeus uses ordnance. @@ -80,6 +107,9 @@ Přehrát varování (rádio) když Zeus použije dělostřelectvo. Spiele eine Radiowarnung ab, wenn Zeus Artillerie verwendet. Reproduz uma aviso via rádio quando o Zeus usa um explosivo. + Joue un son radio quand le Zeus utilise du matériel militaire + Rádiós figyelmeztetés kiadása, ha a Zeus tüzérséget használ. + Проигрывает звук радио каждый раз, когда Зевс использует артиллерию. Reveal Mines @@ -88,6 +118,9 @@ Odhalit miny Enthülle Minen Revelar minas + Révéler les mines + Aknák feltárása + Показывать мины Reveal mines to allies and place map markers. @@ -96,6 +129,9 @@ Odhalí miny pro spojence a umístnit jejich značku na mapu. Enthülle Minen gegenüber Verbündeten und platziere Kartenmarkierungen. Revelar minas para aliados e colocar marcadores no mapa. + Révéler les mines et placer un marqueur sur la carte + Feltárja az aknákat a szövetségeseknek, és jelölőket helyez el a térképen. + Показывает мины союзникам и отмечает их маркерами на карте. Reveal to Allies @@ -104,6 +140,9 @@ Odhalit pro spojence An Verbündete weitergeben Revelar para aliados + Révéler aux alliés + Feltárás a szövetségeseknek + Показывать союзникам Allies + Map Markers @@ -112,6 +151,9 @@ Spojenci + Značky na mapě Verbündete + Kartenmarkierungen Aliados + Marcadores no mapa + Alliés + marqueurs sur la carte + Szövetségesek + térkép jelölők + Союзники + Маркеры на карте Toggle Captive @@ -120,6 +162,9 @@ Přepnout - Vězeň Gefangennahme umschalten Alternar prisioneiro + Basculer en captif + Elfogott állapot váltása + Пленный (вкл./выкл.) Toggle Surrender @@ -128,6 +173,9 @@ Přepnout - Vzdávání Aufgabe umschalten Alternar rendição + Basculer en capitulation + Kapituláló állapot váltása + Сдавшийся (вкл./выкл.) Toggle Unconscious @@ -136,6 +184,45 @@ Přepnout - Bezvědomí Bewusstlosigkeit umschalten Alternar inconsciência + Basculer en inconscient + Eszméletlen állapot váltása + Без сознания (вкл./выкл.) + + + Assign Medic + Przydziel medyka + Definir médico + Назначить медиком + Přiřadit Zdravotníka + Asignar médico + + + Assign Medical Vehicle + Przydziel pojazd medyczny + Definir veículo médico + Назначить медицинским транспортом + Přiřadit Zdravotnické Vozidlo + Asignar vehículo médico + + + Assign Medical Facility + Przydziel budynek medyczny + Definir instalação médica + Назанчить медицинским сооружением + Přiřadit Zdravotnické Zařízení + Asignar instalación médica + + + Add Spare Wheel + + + Adds a Spare Wheel to the vehicle + + + Add Spare Track + + + Adds a Spare Track to the vehicle Unit must be alive @@ -161,6 +248,26 @@ Si può usare solo su fanteria a piedi Usar somente em infantaria desmontada + + Unit must be a structure + Jednostka musi być budynkiem + Unidade deve ser uma estrutura + Юнит должен быть строением + La unidad debe ser una estructura + + + Unit must be a vehicle + Jednostka musi być pojazdem + Unidade deve ser um veículo + Юнит должен быть транспортом + La unidad debe ser un vehículo + + + Unit must be a vehicle with cargo space + + + Unit must have cargo space left + Unit must not be captive Jednostka nie może być więźniem @@ -168,6 +275,9 @@ Jednotka nemí být vězeň Einheit darf nicht gefangen sein Unidade não pode ser prisioneira + L'unité ne doit pas être captive + Csak elfogatlan egységeken használni + Юнит не должен быть пленным Place on a unit @@ -188,6 +298,23 @@ Vyžaduje addon, který není přítomen Benötigt ein Addon, das nicht vorhanden ist Requer um addon que não está presente + Requiert un addon qui n'est pas présent + Egy jelenleg hiányzó bővítményt igényel + Требуется аддон, который отсутствует + + + Add Objects to Curator + Dodaj obiekt do kuratora + Adicionar objetos para o Curator + Добавить объекты куратору + Agregar objetos al director + + + Adds any spawned object to all curators in the mission + Dodaje każdy zespawnowany obiekt do wszystkich kuratorów podczas misji + Adicionar qualquer objeto criado para todos os curators na missão + Добавляет любой отспавненный объект всем кураторам в миссии + Añadir cualquier objeto creado a todos los directores en la misión diff --git a/addons/zeus/ui/Icon_Module_Zeus_Medic_ca.paa b/addons/zeus/ui/Icon_Module_Zeus_Medic_ca.paa new file mode 100644 index 0000000000..60963046a7 Binary files /dev/null and b/addons/zeus/ui/Icon_Module_Zeus_Medic_ca.paa differ diff --git a/docs/README_DE.md b/docs/README_DE.md new file mode 100644 index 0000000000..9921bf3fc6 --- /dev/null +++ b/docs/README_DE.md @@ -0,0 +1,56 @@ +

+ +

+

+ + ACE3 Version + + + ACE3 Download + + + ACE3 Issues + + + BIF Thread + + + ACE3 License + + + ACE3 Slack + +

+

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

+ +**ACE3** ist ein Gemeinschaftsprojekt der sich zusammengeschlossenen Moddinggruppen von **ACE2**, **AGM** und **CSE** mit dem Ziel den Realismus und die Spieltiefe von Arma 3 zu steigern. + +Da die MOD vollkommen als **open-source** Projekt gestaltet ist, steht es jedem frei Änderungen vorzuschlagen, oder seine eigene, modifizierte Version zu erstellen, solange diese ebenfalls der Öffentlichkeit zugänglich ist und mit GNU General Public License übereinstimmt. (Weitere Informationen ist der Lizenzdatei in diesem Projekt entnehmbar) + +Die Mod ist **modular gestaltet** — beinahe jede PBO kann entfernt werden, sodass jede Gemeinschaft ihre eigene Version der Mod unterhalten kann. Dies kann zum Beispiel einige Funktionalitäten ausschließen, da das Feature nicht gewünscht ist, oder es mit einer anderen MOD in Konflikt gerät etc. .Ebenfalls können viele Einstellungen vom Missionsersteller vorgenommen werden (u.a. am medizinischem System), sodass eine individuelle Erfahrung gewährleistet wird. + +### Features +- Verbessertes medizinisches System +- Logistik System: U.a. Transport und Fahrzeugreparatur +- Sprengstoffsystem mit unterschiedlichen Zündern +- Gefangenensystem +- Reale Namen für Arma 3 Fahrzeuge und Waffen +- Realistisches, ballistisches Verhalten (Wind und Luftfeuchtigkeit) +- Simulation der Rückstrahlzone +- Ein Feuerleitsystem für gepanzerte Fahrzeuge und Hubschrauber +***und noch viel mehr...*** + +#### Anleitungen +Du hast ACE3 installiert, hast aber keine Ahnung was und wie alles funktioniert und wo sich was befindet? +- [Erste Schritte](http://ace3mod.com/wiki/user/getting-started.html). + +#### Mitwirken +Wenn du bei der Entwicklung der MOD mithelfen möchtest, so kannst du dies tun, indem du nach Fehlern Ausschau hältst, oder neue Funktionen vorschlägst. Um etwas beizutragen, "Forke" einfach dieses Archiv (bzw. repository) und erstelle deine "Pull-Request", welche von anderen Entwicklern und Beiträgern überprüft wird. Bitte trage dich dabei in [`AUTHORS.txt`](https://github.com/acemod/ACE3/blob/master/AUTHORS.txt) mit deinem Nutzernamen und einer gütligen Email-Adresse ein. + +Um einen Fehler oder ein Feature zu melden bzw. ein bereits Bestehendes zu ändern - nutze unseren [Issue Tracker](https://github.com/acemod/ACE3/issues). Besuche auch: +- [Wie kann ich ein Problem melden](http://ace3mod.com/wiki/user/how-to-report-an-issue.html) +- [Wie kann ich ein Feature Request erstellen](http://ace3mod.com/wiki/user/how-to-make-a-feature-request.html) + +#### Testen & MOD erstellen +Wenn du die neusten Entwicklungen erleben und uns dabei helfen möchtest bestehende Fehler zu entdecken, lade dir einfach die "Master Branch" herunter. Entweder nutzt du [Git](https://help.github.com/articles/fetching-a-remote/) - wenn die Schritte bekannt sind - oder du lädst es dir direkt über [diesen Link](https://github.com/acemod/ACE3/archive/master.zip) herunter. +Wie du deine eigene Entwicklungsumgebung und eine Testversion von ACE3 erstellst folge [dieser Anleitung](https://github.com/acemod/ACE3/blob/master/documentation/development/setting-up-the-development-environment.md). diff --git a/docs/README_PL.md b/docs/README_PL.md new file mode 100644 index 0000000000..aa7023a9e4 --- /dev/null +++ b/docs/README_PL.md @@ -0,0 +1,80 @@ +

+ +

+

+ + ACE3 Wersja + + + ACE3 Pobierz + + + ACE3 Zagadnienia + + + Temat BIF + + + ACE3 Licencja + + + ACE3 Slack + +

+

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

+ +**ACE3** to efekt wspólnego wysiłku grup moderów odpowiedzialnych za **ACE2**, **AGM** oraz **CSE** w celu zwiększenia realizmu i autentyczności Arma 3. + +Projekt ten jest całkowicie **otwarty źródłowo** i wszelki wkład w rozwój jest mile widziany. Możesz bez przeszkód prowadzić swoją własną dostosowaną wersję, o ile zmiany jakie wprowadzisz będą otwarte dla publiki zgodnie z GNU General Public License ([GPLv2](https://github.com/acemod/ACE3/blob/master/LICENSE)). + +Modyfikacja ta jest **budowana modułowo**, dzięki temu prawie każdy dostarczony plik PBO może zostać łatwo usunięty z konfiguracji. Dzięki temu, grupa może prowadzić własną, dostosowaną do siebie, wersję ACE3 wyłączając elementy, których nie potrzebują, lub które po prostu nie działają z innymi addonami. Moduły same w sobie np. system medyczny, posiadają wiele możliwości konfiguracji, pozwalając mission designerom dostosować ogólne doświadczenie z gry. + +### Główne cechy +- Całkowicie nowy system akcji/interakcji 3D +- Wydajna i niezawodna struktura +- Skupienie na modułowości i customizacji +- Elastyczny system ustawień i konfiguracji opcji u klienta i serwera +- Ulepszony system medyczny z różnymi stopniami zaawansowania (podstawowy/rozszerzony) skupiony na grywalności i realizmowi +- Prawidłowa i spójna synchronizowana pogoda +- Balistyka oparta na warunkach pogodowych i wietrze +- Możliwość brania jeńców +- Rozszerzony system ładunków wybuchowych, włączając w to użycie różnego rodzaju zapalników +- Ulepszenia mapy - stawianie markerów i przybory mapy +- Zaawansowane naprowadzanie rakiet i wskazywanie laserem + +#### Dodatkowe cechy +- Przeciąganie i przenoszenie +- Realistyczne nazwy pojazdów i broni +- System kontroli ognia (SKO) dla pojazdów opancerzonych oraz śmigłowców +- Realistyczna balistyka/SKO obliczana w rozszerzeniach C/C++ +- Symulacja strefy backblastu i podciśnienia +- Jednorazowe wyrzutnie +- Realistyczne siły G +- Zamykanie pojazdów na kluczyk +- Realistyczne tryby termowizji oraz noktowizji +- Przepakowywanie magazynków +- Realistyczna mechanika przegrzewania broni +- Symulacja głuchoty bitewnej (tymczasowej utraty słuchu) +- Ulepszona fizyka ragdoll +- Ulepszona interakcja dla asystentów i amunicyjnych +- Regulowane celowniki snajperskie +- Usunięte animacje bezczynności z opuszczoną bronią +- Usunięte głosy awatara gracza +- Skakanie przez przeszkody, wspinanie się na ściany i przecinanie płotów +- Urządzenia Vector, MicroDAGR, Kestrel
+***i wiele wiele więcej...*** + +### Poradniki i instrukcje +Jeżeli zainstalowałeś ACE3 lecz masz problem ze zrozumieniem jak to wszystko działa, lub gdzie zacząć, zacznij od przeczytania tego: +- [Wprowadzenie](http://ace3mod.com/wiki/user/getting-started.html) + +#### Współpraca +Możesz pomóc w rozwoju addonu szukając potencjalnych bugów w naszym kodzie, lub zgłaszając nowe funkcje. Aby wnieść swój wkład do ACE3, po prostu zforkuj to repozytorium na swoje konto GitHub i zgłoś swoje pull requesty do przeglądu przez innych współpracowników. Pamiętaj, aby dodać siebie do listy autorów każdego PBO jakie edytujesz oraz do pliku ['AUTHORS.txt'](https://github.com/acemod/ACE3/blob/master/AUTHORS.txt) dodając także swój adres e-mail. + +Używaj naszego [Issue Tracker-a](https://github.com/acemod/ACE3/issues) aby zgłaszać bugi, proponować nowe funkcje lub sugerować zmiany do aktualnie istniejących. Zobacz także: +- [Jak zgłosić bug-a](http://ace3mod.com/wiki/user/how-to-report-an-issue.html) +- [Jak zgłosić feature request-a](http://ace3mod.com/wiki/user/how-to-make-a-feature-request.html) + +#### Testowanie i budowanie +Aby pomóc nam w testowaniu najnowszych zmian rozwojowych, pobierz nasz master branch ([bezpośrednio](https://github.com/acemod/ACE3/archive/master.zip), lub [korzystając z git](https://help.github.com/articles/fetching-a-remote/)), a następnie złóż testowego build-a: +- [Konfiguracja środowiska do testów](http://ace3mod.com/wiki/development/setting-up-the-development-environment.html) – intrukcja krok-po-kroku jak poprawnie ustawić i zbudować wersję ACE3 do celów testowych. diff --git a/documentation/README_DE.md b/documentation/README_DE.md deleted file mode 100644 index 0b5ca4d0ef..0000000000 --- a/documentation/README_DE.md +++ /dev/null @@ -1,48 +0,0 @@ -

- -

-

- - ACE version - - - ACE download - - - ACE issues - - - ACE license - -

-

Benötigt eine Aktuelle Version von CBA A3 | BIF thread

- -**ACE3** ist ein Gemeinschaftsprojekt der sich zusammengeschlossenen Moddinggruppen von **ACE2**, **AGM** und **CSE** mit dem Ziel den Realismus und die Spieltiefe von Arma 3 zu steigern. - -Da die MOD vollkommen als **open-source** Projekt gestaltet ist, steht es jedem frei Änderungen vorzuschlagen, oder seine eigene, modifizierte Version zu erstellen, solange diese ebenfalls der Öffentlichkeit zugänglich ist und mit GNU General Public License übereinstimmt. (Weitere Informationen ist der Lizenzdatei in diesem Projekt entnehmbar) - -Die Mod ist **modular gestaltet** — beinahe jede PBO kann entfernt werden, sodass jede Gemeinschaft ihre eigene Version der Mod unterhalten kann. Dies kann zum Beispiel einige Funktionalitäten ausschließen, da das Feature nicht gewünscht ist, oder es mit einer anderen MOD in Konflikt gerät etc. .Ebenfalls können viele Einstellungen vom Missionsersteller vorgenommen werden (u.a. am medizinischem System), sodass eine individuelle Erfahrung gewährleistet wird. - -### Features -* Verbessertes medizinisches System -* Logistik System: U.a. Transport und Fahrzeugreparatur -* Sprengstoffsystem mit unterschiedlichen Zündern -* Gefangenensystem -* Reale Namen für Arma 3 Fahrzeuge und Waffen -* Realistisches, ballistisches Verhalten (Wind und Luftfeuchtigkeit) -* Simulation der Rückstrahlzone -* Ein Feuerleitsystem für gepanzerte Fahrzeuge und Hubschrauber - ***und noch viel mehr...*** - -#### Anleitungen -Du hast ACE3 installiert, hast aber keine Ahnung was und wie alles funktioniert und wo sich was befindet? [Erste Schritte](https://github.com/acemod/ACE3/blob/master/documentation/user/getting-started.md). - -#### Mitwirken -Wenn du bei der Entwicklung der MOD mithelfen möchtest, so kannst du dies tun, indem du nach Fehlern Ausschau hältst, oder neue Funktionen vorschlägst. Um etwas beizutragen, "Forke" einfach dieses Archiv (bzw. repository) und erstelle deine "Pull-Request", welche von anderen Entwicklern und Beiträgern überprüft wird. Bitte trage dich dabei in "AUTHORS.txt" mit deinem Nutzernamen und einer gütligen Email-Adresse ein. - -Um einen Fehler oder ein Feature zu melden bzw. ein bereits Bestehendes zu ändern - nutze unseren [Issue Tracker](https://github.com/acemod/ACE3/issues). - -#### Testen & MOD erstellen -Wenn du die neusten Entwicklungen erleben und uns dabei helfen möchtest bestehende Fehler zu entdecken, lade dir einfach die "Master Branch" herunter. Entweder nutzt du Git - wenn die Schritte bekannt sind - oder du lädst es dir direkt über [diesen Link] (https://github.com/acemod/ACE3/archive/master.zip) herunter. - -Wie du deine eigene Entwicklungsumgebung und eine Testversion von ACE erstellst folge [dieser Anleitung](https://github.com/acemod/ACE3/blob/master/documentation/development/setting-up-the-development-environment.md). diff --git a/documentation/README_PL.md b/documentation/README_PL.md deleted file mode 100644 index 4d4c36a619..0000000000 --- a/documentation/README_PL.md +++ /dev/null @@ -1,83 +0,0 @@ -

- -

-

- - ACE wersja - - - ACE pobierz - - - ACE zagadnienia - - - Temat BIF - - - ACE licencja - -

-

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

- -**ACE3** to efekt wspólnego wysiłku grup moderów odpowiedzialnych za **ACE2**, **AGM** oraz **CSE** w celu zwiększenia realizmu i autentyczności Arma 3. - -Projekt ten jest całkowicie **otwarty źródłowo** i wszelki wkład w rozwój jest mile widziany. Możesz bez przeszkód prowadzić swoją własną dostosowaną wersję, o ile zmiany jakie wprowadzisz będą otwarte dla publiki zgodnie z GNU General Public License ([GPLv2](https://github.com/acemod/ACE3/blob/master/LICENSE)). - -Modyfikacja ta jest **budowana modułowo**, dzięki temu prawie każdy dostarczony plik PBO może zostać łatwo usunięty z konfiguracji. Dzięki temu, grupa może prowadzić własną, dostosowaną do siebie, wersję ACE wyłączając elementy, których nie potrzebują, lub które po prostu nie działają z innymi addonami. Moduły same w sobie np. system medyczny, posiadają wiele możliwości konfiguracji, pozwalając mission designerom dostosować ogólne doświadczenie z gry. - -### Główne cechy -* Całkowicie nowy system akcji/interakcji 3D -* Wydajna i niezawodna struktura -* Skupienie na modułowości i customizacji -* Elastyczny system ustawień i konfiguracji opcji u klienta i serwera -* Ulepszony system medyczny z różnymi stopniami zaawansowania (podstawowy/rozszerzony) skupiony na grywalności i realizmowi -* Prawidłowa i spójna synchronizowana pogoda -* Balistyka oparta na warunkach pogodowych i wietrze -* Możliwość brania jeńców -* Rozszerzony system ładunków wybuchowych, włączając w to użycie różnego rodzaju zapalników -* Ulepszenia mapy - stawianie markerów i przybory mapy -* Zaawansowane naprowadzanie rakiet i wskazywanie laserem - -#### Dodatkowe cechy -* Przeciąganie i przenoszenie -* Realistyczne nazwy pojazdów i broni -* System kontroli ognia (SKO) dla pojazdów opancerzonych oraz śmigłowców -* Realistyczna balistyka/SKO obliczana w rozszerzeniach C/C++ -* Symulacja strefy backblastu i podciśnienia -* Jednorazowe wyrzutnie -* Realistyczne siły G -* Zamykanie pojazdów na kluczyk -* Realistyczne tryby termowizji oraz noktowizji -* Przepakowywanie magazynków -* Realistyczna mechanika przegrzewania broni -* Symulacja głuchoty bitewnej (tymczasowej utraty słuchu) -* Ulepszona fizyka ragdoll -* Ulepszona interakcja dla asystentów i amunicyjnych -* Regulowane celowniki snajperskie -* Usunięte animacje bezczynności z opuszczoną bronią -* Usunięte głosy awatara gracza -* Skakanie przez przeszkody, wspinanie się na ściany i przecinanie płotów -* Urządzenia Vector, MicroDAGR, Kestrel
-***i wiele wiele więcej...*** - -### Poradniki i instrukcje -Jeżeli zainstalowałeś ACE3 lecz masz problem ze zrozumieniem jak to wszystko działa, lub gdzie zacząć, zacznij od przeczytania tego: -* [Wprowadzenie](http://ace3mod.com/wiki/user/getting-started.html) - -#### Współpraca -Możesz pomóc w rozwoju addonu szukając potencjalnych bugów w naszym kodzie, lub zgłaszając nowe funkcje. Aby wnieść swój wkład do ACE, po prostu zforkuj to repozytorium na swoje konto GitHub i zgłoś swoje pull requesty do przeglądu przez innych współpracowników. Pamiętaj, aby dodać siebie do listy autorów każdego PBO jakie edytujesz oraz do pliku ['AUTHORS.txt'](https://github.com/acemod/ACE3/blob/master/AUTHORS.txt) dodając także swój adres e-mail. - -Używaj naszego [Issue Tracker-a](https://github.com/acemod/ACE3/issues) aby zgłaszać bugi, proponować nowe funkcje lub sugerować zmiany do aktualnie istniejących. Zobacz także: -* [Jak zgłosić bug-a](http://ace3mod.com/wiki/user/how-to-report-an-issue.html) -* [Jak zgłosić feature request-a](http://ace3mod.com/wiki/user/how-to-make-a-feature-request.html) - -#### Testowanie i budowanie -Aby pomóc nam w testowaniu najnowszych zmian rozwojowych, pobierz nasz master branch ([bezpośrednio](https://github.com/acemod/ACE3/archive/master.zip), lub [korzystając z git](https://help.github.com/articles/fetching-a-remote/)), a następnie złóż testowego build-a: -* [Konfiguracja środowiska do testów](http://ace3mod.com/wiki/development/setting-up-the-development-environment.html) – intrukcja krok-po-kroku jak poprawnie ustawić i zbudować wersję ACE do celów testowych. diff --git a/documentation/development/ace3-config-entries.md b/documentation/development/ace3-config-entries.md deleted file mode 100644 index 3ba9092d4a..0000000000 --- a/documentation/development/ace3-config-entries.md +++ /dev/null @@ -1,128 +0,0 @@ ---- -layout: wiki -title: ACE3 Config Entries -description: A list of all ACE3 config entries. -group: development -parent: wiki -order: 2 ---- - -## 1. CfgVehicles -Entries found in the `CfgVehicles.hpp` files - - -```c++ -ace_nightvision_grain -ace_nightvision_blur -ace_recoil_enablecamshake -ace_dragging_cancarry -ace_dragging_carryposition -ace_dragging_carrydirection -ace_dragging_candrag -ace_dragging_dragposition -ace_dragging_dragdirection -ace_gforcecoef -ace_offset -ace_hasReserveParachute -ace_reserveParachute -``` - - -## 2. CfgWeapons -Entries found in the `CfgWeapons.hpp` files - - -```c++ -ace_recoil_shakemultiplier -ace_overpressure_angle -ace_overpressure_range -ace_overpressure_damage -ace_overheating_dispersion -ace_overheating_slowdownfactor -ace_overheating_jamchance -ace_nightvision_grain -ace_nightvision_blur -ace_nightvision_radblur -ace_usedtube -ace_reloadlaunchers_enabled -ace_bipod -ace_overheating_allowswapbarrel -ace_clearjamaction -ace_checktemperatureaction -ace_gforcecoef -ace_protection -ace_scopeadjust_horizontal -ace_scopeadjust_vertical -ace_scopeadjust_verticalincrement -ace_scopeadjust_horizontalincrement -ace_isusedlauncher -ace_attachable -ace_range -ace_detonator -ace_barrelTwist -ace_twistDirection -ace_barrelLength -ace_laserpointer -ace_nextmodeclass -ace_modedescription -ace_hearing_protection -ace_hearing_lowerVolume -``` - - -## 3. CfgAmmo -Entries found in the `CfgAmmo.hpp` files - -```c++ -ace_recoil_shakemultiplier -ace_frag_skip -ace_frag_force -ace_frag_classes -ace_frag_metal -ace_frag_charge -ace_frag_gurney_c -ace_frag_gurney_k -ace_explodeondefuse -ace_explosive -ace_fcs_airburst -ace_caliber -ace_bulletlength -ace_bulletmass -ace_transonicstabilitycoef -ace_ammotempmuzzlevelocityshifts -ace_ballisticcoefficients -ace_velocityboundaries -ace_standardatmosphere -ace_dragmodel -ace_muzzlevelocities -ace_barrellengths -``` - - -## 4. CfgGlasses -Entries found in the `CfgGlasses.hpp` file - -```c++ -ace_color -ace_tintamount -ace_overlay -ace_overlaydirt -ace_overlaycracked -ace_resistance -ace_protection -ace_dustpath -``` - - -## 5. CfgMagazines -Entries found in the `CfgMagazines.hpp` files - -```c++ -ace_isbelt -ace_attachable -ace_placeable -ace_setupobject -ace_delaytime -ace_triggers -ace_magazines_forcemagazinemuzzlevelocity -``` diff --git a/documentation/development/ace3-events-system.md b/documentation/development/ace3-events-system.md deleted file mode 100644 index 7f3dbf6a49..0000000000 --- a/documentation/development/ace3-events-system.md +++ /dev/null @@ -1,254 +0,0 @@ ---- -layout: wiki -title: ACE3 Events System -description: Event handlers in ACE3 are implemented through our event system. They should be used to trigger or allow triggering of specific functionality. -group: development -parent: wiki -order: 3 ---- - -## 1. Event Handlers - -Event handlers in ACE3 are implemented through our event system. They should be used to trigger or allow triggering of specific functionality. - -The commands are listed below. - -* `[eventName, eventCodeBlock] call ace_common_fnc_addEventHandler`
adds an event handler with the event name and returns the event handler id. -* `[eventName, args] call ace_common_fnc_globalEvent`
calls an event with the listed args on all machines, the local machine, and the server. -* `[eventName, args] call ace_common_fnc_serverEvent`
calls an event just on the server computer (dedicated or self-hosted). -* `[eventName, targetObject(s), args] call ace_common_fnc_targetEvent`
calls an event just on the targeted object or list of objects. -* `[eventName, args] call ace_common_fnc_localEvent`
calls an event just on the local machine, useful for inter-module events. - -Events can be removed or cleared with the following commands. - -* `[eventName, eventHandlerId] call ace_common_fnc_removeEventHandler`
will remove a specific event handler of the event name, using the ID returned from `ace_common_fnc_addEventHandler`. -* `[eventName] call ace_common_fnc_removeAllEventHandlers`
will remove all event handlers for that type of event. - -### 1.1 Synchronized Events - -* `[eventName, eventCodeBlock, ttlNumberOrCodeBlock] call ace_common_fnc_addSyncedEventHandler`
adds a globally synchronized event handler which will expire events after the provided TTL, or the code returns true. -* `[eventName] call ace_common_fnc_removeSyncedEventHandler`
will remove a specific event handler of the event name, using the ID returned from `ace_common_fnc_addSyncedEventHandler`. -* * `[eventName, args, ttlNumberOrCodeBlock] call ace_common_fnc_syncedEvent`
calls a global synchronized event, which will also be run on JIP players unless it has expired; event will expire after the provided TTL, or the code returns true. - -### 1.2 Pattern: - -```c++ -// tapper machine -["tapShoulder", [_target], [otherArguments]] call EFUNC(common,targetEvent); - -// target machine XEH_preInit.sqf -PREP(onTapShoulder); -["tapShoulder", FUNC(onTapShoulder) ] call EFUNC(common,addEventHandler); -``` - -### 1.3 Listenable Event List: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Event KeyDescriptionSource(s)Passed Parameter(s) (_this)Locality
"playerChanged"`player` changed (zeus/respawn/init)common[_newPlayer, _oldPlayer]local
"PlayerJIP"Player was a JIP player, and `player` object is now created.common[_player]local
"playerInventoryChanged"Inventory changedcommon[_player, getAllGear-Array]local
"playerVisionModeChanged"Vision mode changed (e.g. NVG on)common[_unit, _newVisionMode]local
"inventoryDisplayChanged"Inventory display opened/closedcommon[_unit, _isOpen]local
"zeusDisplayChanged"Zeus display opened/closedcommon[_unit, _isOpen]local
"cameraViewChanged"Camera view changedcommon[_unit, _newCameraView]local
"playerVehicleChanged"Player vehicle changedcommon[_unit, _newVehicle]local
"playerTurretChanged"Player turret changedcommon[_unit, _newTurretIndexArray]local
"infoDisplayChanged"On info box change (e.g. entering and leaving a vehicle)common[_display, _type]local
"inventoryDisplayLoaded"On opening the inventory displaycommon[_display]local
"mapDisplayLoaded"On loading the map (briefing and mission start)common[_display, _mapType]local
"SettingsInitialized"Settings are now safe to use (at mission start)commonlocal
"SettingChanged"A setting was changedcommon[_name, _value]local
"interactionMenuOpened"Interaction Menu Openedinteractionlocal
"killedByFriendly"On TK/Civilian Killedrespawnlocal
"drawing_requestMarkers"Request Drawing Markersmaptarget
"drawing_sendbackMarkers"Send Drawing Markersmaptarget
"drawing_addLineMarker"Line Drawnmapglobal
"drawing_removeLineMarker"Line Deletedmapglobal
"flashbangExplosion"Flashbang Goes Banggrenadestarget
"zeusUnitAssigned"A player was assigned as zeuszeus[_logic,_player]global
- -### 1.4 Callable Event List: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Event KeyDescriptionParametersOwnerLocality
"SetHandcuffed"Set the captive (handcuffed) state of a unit[_unit, _state]captiveslocal
"SetSurrendered"Set the surrender state of a unit[_unit, _state]captiveslocal
"ace_fcs_forceChange"force FCS updatesfcsfcslocal
diff --git a/documentation/development/arma-3-issues.md b/documentation/development/arma-3-issues.md deleted file mode 100644 index 16f9988409..0000000000 --- a/documentation/development/arma-3-issues.md +++ /dev/null @@ -1,30 +0,0 @@ ---- -layout: wiki -title: Arma 3 Issues -description: Keeping track of Arma 3 issues that need to be fixed. If you want to support us and help raise Bohemia's awareness of those issues, please upvote them. -group: development -parent: wiki -order: 6 ---- - - -Keeping track of Arma 3 issues that need to be fixed. If you want to support us and help raise Bohemia's awareness of those issues, please upvote them: - -**Open:** - -* [bux578: 0020997: MineDetector equipable in Launcher slot](http://feedback.arma3.com/view.php?id=20997) -* [bux578: 0021176: Zeus / Curator Add Remote Controlled Event](http://feedback.arma3.com/view.php?id=21176) -* [bux578: 0021469: Add script commands "addPrimaryWeaponMagazine" and "addSecondaryWeaponMagazine"](http://feedback.arma3.com/view.php?id=21469) -* [bux578: 0022000: Add/Alter script command to add perfectly configured weapons to cargo](http://feedback.arma3.com/view.php?id=22000) -* [commy2: 0021443: Unexpected behavior of += array in configs](http://feedback.arma3.com/view.php?id=21443) -* [commy2: 0022671: setVariable is not always JIP persistent](http://feedback.arma3.com/view.php?id=22671) -* [CorruptedHeart: 0022318: Can no longer use "MenuBack" shortcut in AddAction](http://feedback.arma3.com/view.php?id=22318) -* [James2464: 0023725: All Environment Rocks Should Have PhysX LODs](http://feedback.arma3.com/view.php?id=23725) -* [Jaynus: 0023679: Display event handler return values for mouse buttons should be respected](http://feedback.arma3.com/view.php?id=23679) -* [Heisenberg: 0023741: Switching between optic modes of a sniper scope (AMS, DMS, MOS) will result in a blurred vision](http://feedback.arma3.com/view.php?id=23741) -* [AgentRev: 0022310: setObjectTextureGlobal causing "Cannot load texture" errors when used with valid mission files](http://feedback.arma3.com/view.php?id=22310) - -**Resolved:** - -* [Nou: 0020761: Memory points rfemur, lfemur, and other leg memory points returned incorrectly with SQF command selectionPosition](http://feedback.arma3.com/view.php?id=20761) -* [commy2: 0023136: isLightOn doesn't recognize destroyed light bulbs for streetlamps](http://feedback.arma3.com/view.php?id=23136) diff --git a/documentation/development/arma-3-scheduler-and-our-practices.md b/documentation/development/arma-3-scheduler-and-our-practices.md deleted file mode 100644 index 3d9bf0525e..0000000000 --- a/documentation/development/arma-3-scheduler-and-our-practices.md +++ /dev/null @@ -1,96 +0,0 @@ ---- -layout: wiki -title: Arma 3 Scheduler And Our Practices -description: -group: development -parent: wiki -order: 8 ---- - -## 1. Terminology - -### 1.1 Frame -A single rendered frame of Arma 3. - -### 1.2 Scheduled Space - -This refers to execution would is ruled by the Arma 3 default script scheduling engine. This would include: - -* spawn -* execVM - -### 1.3 Unscheduled Space -This refers to execution which is linear; what this means is that the code will run to completion prior to executing the current frame. It must complete, but is guaranteed to run within a given frame. - -* perFrameHandler -* Extended_EventHandlers -* addEventHandler - - -## 2. What is the scheduler and why do I care? - -BIKI Article: https://community.bistudio.com/wiki/Biki2.0:Performance_Considerations - -The Arma 3 script scheduler basically gives a fair-share execution to all running scripts, FSMs, and SQS files running on any given client or server at any given time. See the BIKI article for a in-depth explanation of this. What this basically means though, is that all scripts get a fair share; this also means scheduled execution is drastically affected by other poorly written mods. For example, if 2 different spawn's are running in a tight loop of `do { foo } while (true);`, they will both get exactly 50% of the scheduling time. - -With the way mission makers and mod makers generally use spawn/execVM, this means you're actually getting drastically less execution time in the scheduled environment than you might think. This leads to visible delay issues all the way up to massive delay on execution. You can easily test and prove this by looping spawns and watching the execution times extend. - -What does this all mean? It means we need to live outside of the spawn execution as much as possible. There are 2 places that the majority of our functionality should stem from, which means that as long as we strictly always perform calls between functions, we are executing within the same frame. If our execution is either stemming from the perFrameHandlers, or any default Extended_EventHandlers, than we can guarantee execution within a single frame. *ANY OTHER CIRCUMSTANCE IS NOT GUARANTEED.* - -The scheduler will also actually halt your script mid-execution, usually at the end of a given control block, and pause you to yield to other scripts. This can lead to drastically incorrect results when performing calculations. Again, this is the reason we want all our given code to run to completion in a single given frame. - -## 3 Design Patterns - -Because we are attempting to always run to completion; execution occurs from 2 places. Either PFH handles or event handlers; in both cases, we wish our code to run to completion. This takes a change in mind set for design to ensure your executing that way. In a nutshell though, this all distills down to the fact that you will always call other chunks of code; nothing will ever be spawned off. The only circumstance this really becomes a problem is for waiting or delay. If designed correctly, though, you can avoid those circumstances. - -Rules of thumb for component design: - -* If you need to wait for a value, don't wait, use a CBA event! This means everything should be designed and written with an event-driven model in mind. -* If you have to wait, use a PFH delay/diag_tickTime check. - - -### 3.1 PFH-Design Pattern - -Line Notes: - -* PerFrameHandlers should be self-removing. If a PFH is no longer needed, it is responsible for removing itself. - - - -### 3.2 ACE3 General Rules - -* Always use call whenever possible. We should be calling functions chains exclusive and not be relying on spawn/execVM ever. Consider spawn/execVM banned without good reason. All code should be a chain of execution which is traceable, and not triggered between seperate threads. -* waitUntil and sleep are banned. If you need to use them, use scheduled delay execution instead. **Reasoning: Sleep/waitUntil surrender about 5x the scheduler time than even normal execution does.** -* If we need a spawn or exec, we should utilize the perFrame scheduler. Spawn/execVM are subject to the Arma 3 scheduler and as such, cannot be relied upon. In order to give our players a consistent gameplay experience, we need to have total control over how and when all of our code runs. -* PFH should be utilized at all possible times when the player can see the result of whatever the code is. This applies to missile guidance, bullets, wind, optics, interactive UI, HUD's, and rendering. We should only consider scheduled execution if the code is running out of the visual range of the player. - - -### 3.3 Code Examples - -#### 3.3.1 Generic PFH functions -See: https://dev.withsix.com/docs/cba/files/common/fnc_addPerFrameHandler-sqf.html for more details. - -```c++ -[{ code } , delayTime, [ARGS] ] call CBA_fnc_addPerFrameHandler; -``` - - -#### 3.3.2 PFH Wait - -```c++ -DFUNC(myDelayedFunction) = { - // Our argument array is passed in a PFH as select 0 - _args = _this select 0; - - // Print our arguments - diag_log text format["I received: %1", (_args select 0)]; - - // Delete this PFH, so it is only executed once - [_this select 1] call CBA_fnc_removePerFrameHandler; -}; - -// This runs the PFH once every 5 seconds, with the variable array ["balls"] being passed in -// This executes FUNC(myDelayedFunction), that could also be a { code } block. -// Parameter 2 is the delay (in seconds) for a PFH. This is "execute every N seconds", 0 will be every frame. -[FUNC(myDelayedFunction), 5, ["balls"] ] call CBA_fnc_addPerFrameHandler; -``` diff --git a/documentation/development/branching-and-release.md b/documentation/development/branching-and-release.md deleted file mode 100644 index ae7b67b1e9..0000000000 --- a/documentation/development/branching-and-release.md +++ /dev/null @@ -1,37 +0,0 @@ ---- -layout: wiki -title: Branching and Release -description: -group: development -parent: wiki -order: 5 ---- - - -## 1 Versioning - -For ACE3 we use an versioning strategy based on Semver. This means our version numbering is structured `MAJOR.MINOR.PATCH.BUILD`. - -Because this modification is for Arma and backwards compatability is not always possible, our `MAJOR.MINOR.PATCH.BUILD` rules are slightly different. We increment the: - - MAJOR version when we switch to a new arma version (ie Arma 4 or standalone expansion), - MINOR version when we add new features or large amount of bug fixes. - PATCH version when a release only contains bug fixes. - -## 2 Branching and releases - -We have a release scheduled every 2 weeks on a Tuesday. On the Friday before release, the project management will decide whether or not this scheduled release will continue. When continuing with the release, the current `master branch` will be merged into the `release branch`. The release branch will not contain any direct commits and no other branches will be merged into this branch. The exception being `hotfixes`, which are branched off `Release` and merged back into `Release` and `Master`. - -`Hotfixes` are fixes for critical bugs that prevent stable gameplay with the currently available version of ACE3. - -During this release process between the Friday and Tuesday, the day of release, work can continue on as normal on the `Master branch`. This includes new features, bug fixes that won't make it for release or other work. These will not be merged into the `Release branch` until the next release cycle, normally 2 weeks later. - -### 2.1 Branching - -* New features, bug fixes that are not a hotfix or other work will always be branched off `master` or another branch but never a `hotfix` or the `Release branch`. -* Hotfixes are always branched off the `Release branch` -* The release branch is never merged or deleted. Only master or hotfixes are allowed to merge into the `Release branch`. - -### 2.2 Diagram - -Release and branching flowchart diff --git a/documentation/development/coding-guidelines.md b/documentation/development/coding-guidelines.md deleted file mode 100644 index 1ab53046ec..0000000000 --- a/documentation/development/coding-guidelines.md +++ /dev/null @@ -1,298 +0,0 @@ ---- -layout: wiki -title: Coding Guidelines -description: -group: development -parent: wiki -order: 1 ---- - - -## 1. Indentation - -4 spaces for indentation. - -```c++ -class Something: Or { -....class Other { -........foo = "bar"; -....}; -}; -``` - -### 1.1 Reasoning - -Tabs can be tricky sometimes, especially when it comes to sharing code with others. Additionally, a lot of people tend to forget they're using tabs when they're aligning things after the first character, which causes things to fall apart when viewing the code at different tab lengths. - - -## 2. Braces - -- opening brace on the same line as keyword -- closing brace in own line, same level of indentation as keyword - -**Yes:** - -```c++ -class Something: Or { - class Other { - foo = "bar"; - }; -}; -``` - -**No:** - -```c++ -class Something : Or -{ - class Other - { - foo = "bar"; - }; -}; -``` - -**Also no:** - -```c++ -class Something : Or { - class Other { - foo = "bar"; - }; - }; -``` - -When using `if`/`else`, it is encouraged to put `else` on the same line as the closing brace to save space: - -```c++ -if (alive player) then { - player setDamage 1; -} else { - hint ":("; -}; -``` - -In cases where you , e.g, have a lot of one-liner classes, it is allowed to use something like this to save space: - -```c++ -class One {foo = 1;}; -class Two {foo = 2;}; -class Three {foo = 3;}; -``` - -### 2.1 Reasoning - -Putting the opening brace in it's own line wastes a lot of space, and keeping the closing brace on the same level as the keyword makes it easier to recognize what exactly the brace closes. - - -## 3. How to create a new module - -1. Copy the structure from `extras\blank` to the `addons\` folder and name it what you wish the new module to be named. -1. Edit `script_component.hpp`, change the `COMPONENT` definition to the name of the module. Also edit each of the `DEBUG` definitions to be the name of the module (for example, `DEBUG_SETTINGS_BLANK` should be `DEBUG_SETTINGS_BALLS` for module balls) -1. Edit the `script_component.hpp` file in the the `functions` directory to match the path of the new module, for example `#include "\z\ace\addons\blank\script_component.hpp"` for module called balls should now be `#include "\z\ace\addons\ballls\script_component.hpp"`. -1. The module is now prepared for development - - -### 3.1 Function Definitions - -Functions should be created in the functions\ subdirectory, named `fnc_FunctionName.sqf` They should then be indexed via the `PREP(FunctionName)` macro in the XEH_preInit.sqf file. The `PREP` macro allows for CBA function caching, which drastically speeds up load times. **Beware though that function caching is enabled by default and as such to disable it you need to `#define DISABLE_COMPILE_CACHE` above your `#include "script_components.hpp"` include!** - -Every function should have a header of the following format: - -```cpp -/* - * Author: [Name of Author(s)] - * [Description] - * - * Arguments: - * 0: The first argument - * 1: The second argument - * - * Return Value: - * The return value - * - * Example: - * ["something", player] call ace_common_fnc_imanexample - * - * Public: [Yes/No] - */ -``` - - -## 4. Macro Usage - -### 4.1 Module/PBO specific Macro Usage -The family of `GVAR` macro's define global variable strings or constants for use within a module. Please use these to make sure we follow naming conventions across all modules and also prevent duplicate/overwriting between variables in different modules. The macro family expands as follows, for the example of the module 'balls': - - -| Macros | is the same as | -| -------|---------| -| `GVAR(face)` | ace_balls_face | -|`QGVAR(face)` | ace_balls_face | -| `EGVAR(balls,face)` | ace_balls_face | -| `EGVAR(leg,face)` | ace_leg_face | -| `QEGVAR(leg,face)` | ace_leg_face | - -There also exists the FUNC family of Macros: - -| Macros | is the same as | -| -------|---------| -|`FUNC(face)` | ace_balls_fnc_face or the call trace wrapper for that function.| -|`EFUNC(balls,face)` | ace_balls_fnc_face or the call trace wrapper for that function.| -|`EFUNC(leg,face) `| ace_leg_fnc_face or the call trace wrapper for that function.| -|`DFUNC(face)` | ace_balls_fnc_face and will ALWAYS be the function global variable.| -|`DEFUNC(leg,face)` | ace_leg_fnc_face and will ALWAYS be the function global variable.| -|`QFUNC(face)` | ace_balls_fnc_face | -|`QEFUNC(leg,face)` |ace_leg_fnc_face| - -The `FUNC` and `EFUNC` macros should NOT be used inside `QUOTE` macros if the intention is to get the function name or assumed to be the function variable due to call tracing (see below). If you need to 100% always be sure that you are getting the function name or variable use the `DFUNC` or `DEFUNC` macros. For example `QUOTE(FUNC(face)) == "ace_balls_fnc_face"` would be an illegal use of `FUNC` inside `QUOTE`. - -Using `FUNC` or `EFUNC` inside a `QUOTE` macro is fine if the intention is for it to be executed as a function. - -#### 4.1.1 FUNC Macros, Call Tracing, and Non-ACE3 /Anonymous Functions - -ACE3 implements a basic call tracing system that can dump the call stack on errors or wherever you want. To do this the `FUNC` macros in debug mode will expand out to include metadata about the call including line numbers and files. This functionality is automatic with the use of calls via `FUNC` and `EFUNC`, but any calls to other functions need to use the following macros: - -| Macro | example | -| -------|---------| -|`CALLSTACK(functionName)` | `[] call CALLSTACK(cba_fnc_someFunction)` | -|`CALLSTACK_NAMED(function,functionName)` | `[] call CALLSTACK_NAMED(_anonymousFunction,'My anonymous function!')`| - -These macros will call these functions with the appropriate wrappers and enable call logging into them (but to no further calls inside obviously). - -### 4.2 General Purpose Macros - -[CBA script_macros_common.hpp](https://gist.github.com/commy2/9ed6cc73fbe6a2b3f4e1) - -* `QUOTE()` is utilized within configuration files for bypassing the quote issues in configuration macros. So, all code segments inside a given config should utilize wrapping in the QUOTE() macro instead of direct strings. This allows us to use our macros inside the string segments, such as `QUOTE(_this call FUNC(balls))` - -#### 4.2.1 setVariable, getVariable family macros - -| Macro | is the same as | -| -------|---------| -|`GETVAR(player,MyVarName,false)` | player getVariable ["MyVarName", false]| -|`GETMVAR(MyVarName,objNull)` | missionNamespace getVariable ["MyVarName", objNull]| -|`GETUVAR(MyVarName,displayNull)` | uiNamespace getVariable ["MyVarName", displayNull]| -|`SETVAR(player,MyVarName,127)` | player setVariable ["MyVarName", 127] SETPVAR(player,MyVarName,127) player setVariable ["MyVarName", 127, true] | -|`SETMVAR(MyVarName,player)` | missionNamespace setVariable ["MyVarName", player] | -|`SETUVAR(MyVarName,_control)` | uiNamespace setVariable ["MyVarName", _control] | - -#### 4.2.2 STRING family macros - -Note that you need the strings in module stringtable.xml in the correct format -`STR_ACE__`
-Example:
-`STR_Balls_Banana`
- -Script strings: - -| Macro | is the same as | -| -------|---------| -| `LSTRING(banana)` | "STR_ACE_balls_banana"| -| `ELSTRING(balls,banana)` | "STR_ACE_balls_banana"| - - -Config Strings (require `$` as first character): - -| Macro | is the same as | -| -------|---------| -| `CSTRING(banana)` | "$STR_ACE_balls_banana" | -| `ECSTRING(balls,banana)` | "$STR_ACE_balls_banana" | - - -## 5. Event Handlers - -Event handlers in ACE3 are implemented through our event system. They should be used to trigger or allow triggering of specific functionality. - -The commands are listed below. - -| Even Handler | use | -| -------|---------| -|`[eventName, eventCodeBlock] call ace_common_fnc_addEventHandler` | adds an event handler with the event name and returns the event handler id.| -| `[eventName, args] call ace_common_fnc_globalEvent` | calls an event with the listed args on all machines, the local machine, and the server. | -|`[eventName, args] call ace_common_fnc_serverEvent` | calls an event just on the server computer (dedicated or self-hosted).| -| `[eventName, targetObject(s), args] call ace_common_fnc_targetEvent` | calls an event just on the targeted object or list of objects.| -|`[eventName, args] call ace_common_fnc_localEvent` | calls an event just on the local machine, useful for inter-module events.| - -Events can be removed or cleared with the following commands. - -| Even Handler | use | -| -------|---------| -|`[eventName, eventHandlerId] call ace_common_fnc_removeEventHandler` | will remove a specific event handler of the event name, using the ID returned from `ace_common_fnc_addEventHandler`.| -|`[eventName] call ace_common_fnc_removeAllEventHandlers` | will remove all event handlers for that type of event.| - -More information on the [ACE3 Events System](https://github.com/KoffeinFlummi/ACE3/wiki/ACE-Events-System) page. - -## 6. Hashes - -Hashes are a variable type that store key value pairs. They are not implemented natively in SQF, so there are a number of macros and functions for their usage in ACE3. If you are unfamiliar with the idea, they are similar in function to `setVariable`/`getVariable` but do not require an object to use. - -The following example is a simple usage using our macros which will be explained further below. - -```c++ -_hash = HASHCREATE; -HASH_SET(_hash, "key", "value"); -if(HASH_HASKEY(_hash, "key")) then { - player sideChat format["val: %1", HASH_GET(_hash, "key"); // will print out "val: value" -}; -HASH_REM(_hash, "key"); -if(HASH_HASKEY(_hash, "key")) then { - // this will never execute because we removed the hash key/val pair "key" -}; -``` - -A description of the above macros is below. - -| Macro | use | -| -------|---------| -|`HASHCREATE` | used to create an empty hash.| -| `HASH_SET(hash, key, val)` | will set the hash key to that value, a key can be anything, even objects. | -|`HASH_GET(hash, key)` | will return the value of that key (or nil if it doesn't exist). | -| `HASH_HASKEY(hash, key)` | will return true/false if that key exists in the hash. | -| `HASH_REM(hash, key)` | will remove that hash key.| - -### 6.1 Hashlists - -A hashlist is an extension of a hash. It is a list of hashes! The reason for having this special type of storage container rather than using a normal array is that an array of normal hashes that are are similar will duplicate a large amount of data in their storage of keys. A hashlist on the other hand uses a common list of keys and an array of unique value containers. The following will demonstrate it's usage. - -```c++ -_defaultKeys = ["key1","key2","key3"]; -// create a new hashlist using the above keys as default -_hashList = HASHLIST_CREATELIST(_defaultKeys); - -//lets get a blank hash template out of this hashlist -_hash = HASHLIST_CREATEHASH(_hashList); - -//_hash is now a standard hash... -HASH_SET(_hash, "key1", "1"); - -//to store it to the list we need to push it to the list -HASHLIST_PUSH(_hashList, _hash); - -//now lets get it out and store it in something else for fun -//it was pushed to an empty list, so it's index is 0 -_anotherHash = HASHLIST_SELECT(_hashList, 0); - -// this should print "val: 1" -player sideChat format["val: %1", HASH_GET(_anotherHash, "key1")]; - -//Say we need to add a new key to the hashlist -//that we didn't initialize it with? We can simply -//set a new key using the standard HASH_SET macro -HASH_SET(_anotherHash, "anotherKey", "another value"); -``` - -As you can see above working with hashlists are fairly simple, a more in depth explanation of the macros is below. - - -| Macro | use | -| -------|---------| -|`HASHLIST_CREATELIST(keys)` | creates a new hashlist with the default keys, pass [] for no default keys.| -|`HASHLIST_CREATEHASH(hashlist)` | returns a blank hash template from a hashlist.| -|`HASHLIST_PUSH(hashList, hash)` | pushes a new hash onto the end of the list.| -|`HASHLIST_SELECT(hashlist, index)` | returns the hash at that index in the list. | -|`HASHLIST_SET(hashlist, index, hash)` | sets a specific index to that hash.| - -#### 6.1.1 A note on pass by reference and hashes - -Hashes and hashlists are implemented with SQF arrays, and as such they are passed by reference to other functions. Remember to make copies (using the + operator) if you intend for the hash or hashlist to be modified with out the need for changing the original value. diff --git a/documentation/development/documentation-guidelines-and-tips.md b/documentation/development/documentation-guidelines-and-tips.md deleted file mode 100644 index adb3c48b9c..0000000000 --- a/documentation/development/documentation-guidelines-and-tips.md +++ /dev/null @@ -1,65 +0,0 @@ ---- -layout: wiki -title: Documentation guidelines and tips -group: development -parent: wiki -order: 19 ---- - -# Documentation guidelines - - - - - -## Example entry -``` ---- -layout: wiki -title: Mission Modules -group: feature -parent: wiki ---- - -## 1. Overview - -### 1.1 Sub-feature 1 -Short description of sub-feature 1. - -### 1.2 Sub-feature 2 -Short description of sub-feature 2. - -## 2. Usage - -### 2.1 thing n°1 -- Step 1. -- Step 2. -- Step 3. - -### 2.2 thing n°2 -- Step 1. -- Step 2. -- Step 3. - -## 3. Dependencies - -`ace_something` - -## 4. Guides -``` - -# Guidelines - -- A line between each entry like above. -- Use `ACE3` instead of `ACE 3`. -- Remove each entry that is not used. -- Don't forget to say what you're going to work on in #documentation in slack or [this topic] (https://github.com/acemod/ACE3/issues/1166) -- Keybinds in ``` thoses thingies ``` -- Keywords in ``` `thoses thingies` ``` -- Capitals at the start of a sentence and `.`at the end. -- VERIFY EVERYTHING IN GAME, ALL THE THINGS - -# Tips - -- Use http://dillinger.io/ to keep your sanity -- [Markdown cheat sheet] (https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet) diff --git a/documentation/development/extension-guidelines.md b/documentation/development/extension-guidelines.md deleted file mode 100644 index 2d551c4278..0000000000 --- a/documentation/development/extension-guidelines.md +++ /dev/null @@ -1,60 +0,0 @@ ---- -layout: wiki -title: Extension Guidelines -description: -group: development -parent: wiki -order: 9 ---- - -## 1. Basics - -### 1.1 Requirements - -- A compiler (VS/GCC/Clang) - - If starting with Visual Studio, you need to make sure to use the Visual studio command prompt -- cmake 3.0 or later in your path - -### 1.2 Cross-Platform Guidelines - -### 1.3 C++ basic style and naming guide - -### 1.4 ace_common cpp library - ---- - -## 2 Building Extensions on Windows - -### 2.1 Compiling - -#### 2.1.1 Windows - Creating a Visual Studio Project -1. Open your compiling command prompt (which has cmake and your compiler) -2. From this directory, you need to use cmake to build the appropriate build files. Change the -G property appropriately. run cmake --help to get a list of the options. - -``` -cd extensions\build -cmake .. -G "Visual Studio 14 2015" -``` - -A Visual studio project file will now be generated in your build directory. - -#### 2.1.2 Windows - Visual Studio - Compile only (nmake) -1. Open your compiling command prompt (which has cmake and your compiler) -2. From this directory, you need to use cmake to build the appropriate build files. Change the -G property appropriately. run cmake --help to get a list of the options. - -``` -cd extensions\build -cmake .. -G "NMake Makefiles" -nmake -``` - -The extensions will not be built in its appropriate project folder, for example: - -``` -extensions\ - build\ - fcs\ace_fcs.dll - somethingElse\ace_somethingElse.dll -``` - -### 2.2 Creating a New Extension diff --git a/documentation/development/how-to-translate-ace3.md b/documentation/development/how-to-translate-ace3.md deleted file mode 100644 index edb88263b1..0000000000 --- a/documentation/development/how-to-translate-ace3.md +++ /dev/null @@ -1,31 +0,0 @@ ---- -layout: wiki -title: How to translate ACE3 -description: This page describes in short how you can help translating ACE3 into your language. -group: development -parent: wiki -order: 20 ---- - -This page describes in short how you can help translating ACE3 into your language. - -1. If you don't already have a GitHub account create one at http://github.com -2. Open the ACE3 repository at https://github.com/acemod/ACE3 -3. In the top right corner press the "Fork" button -4. You are being redirected to your personal fork, a version that is hosted on your GitHub account (it says "yourUsername/ACE3") -5. Clone that fork to your PC (There are a lot of tools and tutorials how to do this (e.g. [GitHub for Windows](https://windows.github.com))) -6. Download [tabler](https://github.com/bux578/tabler/releases) and extract it somewhere -7. Open the tabler.exe and in the menu click "File > Open language files" -8. Point tabler to the cloned ACE3 directory -9. Start translating -10. When done go to the menu and click "File > Save language files" -11. Commit your changes to your local cloned repository -12. Sync (Push) your commit(s) to your fork -13. Create a Pull Request for your changes - -(The last three steps require some git knowledge, but there are a lot of tutorials out there) -[GitHub for Windows help](https://windows.github.com/help.html) - - -#### Community Translation Guides -**Spanish:** [https://gist.github.com/Legolasindar/bf8a3b09cb835f72501f](https://gist.github.com/Legolasindar/bf8a3b09cb835f72501f) diff --git a/documentation/development/merging-pull-requests.md b/documentation/development/merging-pull-requests.md deleted file mode 100644 index 208c9c786d..0000000000 --- a/documentation/development/merging-pull-requests.md +++ /dev/null @@ -1,37 +0,0 @@ ---- -layout: wiki -title: Merging Pull Requests -description: -group: development -parent: wiki -order: 5 ---- - -Who's responsible for merging pull requests. - -All authors must add themselves to the AUTHORS.txt file **with a valid email adress**. - - -#### Changes To Existing Addons - -The people responsible for merging changes to existing addons are the maintainers listed in the README.md file of the respective addon folder. - -If the changes consists of trivial changes, such as spelling or indentation fixes: - -```diff - valueA = 12; - valueB = 31; -- valueC =2; -+ valueC = 2; -``` - -... the PR can be merged right away by one of the maintainers. - -Non-trivial pull requests remain open for a minimum of 48 hours, to give all other contributors time to comment on potential issues, and are then merged by a maintainer, should no issues arise. - - -#### New Addons / Other Changes - -If a pull request adds a new addon, or changes something else, like the README, everyone has 72 hours to comment on the changes. After that, one of the team leads ([NouberNou](https://github.com/NouberNou), [KoffeinFlummi](https://github.com/KoffeinFlummi), [Glowbal](https://github.com/Glowbal)) will merge it. - -Trivial changes such as spelling fixes can be merged immediately by any contributor. diff --git a/documentation/development/modularity-and-pbo-structure.md b/documentation/development/modularity-and-pbo-structure.md deleted file mode 100644 index 7e4a926de8..0000000000 --- a/documentation/development/modularity-and-pbo-structure.md +++ /dev/null @@ -1,42 +0,0 @@ ---- -layout: wiki -title: Modularity And PBO Structure -description: -group: development -parent: wiki -order: 4 ---- - -## 1. Modularity - -Main principles: -- As much stuff as possible should be modular -- Strive to make as much stuff as possible run-time togglable. Adding/removing PBOS would still be requiring to toggle any feature relying on config changes. - -## 2. PBO Structure - -Main principles: - -- Try to keep single module dependencies as much as possible -- Interaction would be the requirement for most modules. -- Anything that is 100% config should require Common and not Interaction. - -``` -Main -> Common -> OptionsMenu -> Interaction -> Most things - -Main -> Common -> Config things - -Main -> Common -> 3D Models | - Interaction | -> Feature -``` - -## 3. Optional .PBOs for 3rd Party Mods - -- ACE3 policy is to NOT take care of compatibility with third party addons single handely. The current compatible .PBOs were kickstarted by the ACE3 team as an example to mod creators so it's clear which entries are needed for compatibility. The authors of those addons have been contacted and many of those pbos are due to be included in their respective mods eventually. - -
-
Notice for 3rd party mod creators:
-

Most of the config entries are inert if ACE3 is not present, so addons can be made ACE3 compatible without explicitly requiring ACE3. However, for addons that are not inert (for example, scope configs), it is best to create and distribute compatibility .PBOs along with the original mod content; feel free to consult with ACE3 devs about how to correctly implement this. All existing compatibility .PBOs are examples and thus no further compatibility .PBOs will be provided by the ACE3 team.

-
- - diff --git a/documentation/development/setting-up-the-development-environment.md b/documentation/development/setting-up-the-development-environment.md deleted file mode 100644 index e02760f96d..0000000000 --- a/documentation/development/setting-up-the-development-environment.md +++ /dev/null @@ -1,112 +0,0 @@ ---- -layout: wiki -title: Setting Up The Development Environment -description: This page describes how you can setup your development environment for ACE3, allowing you to properly build ACE and utilize file patching. -group: development -parent: wiki -order: 0 ---- - -This page describes how you can setup your development environment for ACE3, allowing you to properly build ACE and utilize file patching. - - -## 1. Requirements - -- Arma 3 (duh) -- A proper installation of the Arma 3 Tools (available on Steam) -- A properly setup P-drive -- Run ArmA 3 and Arma 3 Tools directly from steam once to install registry entries (and again after every update) -- Python 3.x, available [here](http://www.python.org) -- The following Mikero Tools (available [here](https://dev.withsix.com/projects/mikero-pbodll/files)): DePBO, DeOgg, Rapify, MakePBO, PBOProject -- A properly setup PATH variable (containing Python ,the Mikero tools and git) - - -## 2. Why so complicated? - -If you have contributed to AGM you might be used to an easier build process, where there was even an .exe you could use for building. ACE3, however, makes use of CBA macros to simplify things and give the developer access to a better debug process, which requires a stricter build environment. Additionally, Mikero's tools are stricter and report more errors than AddonBuilder does. The structure of this development environment also allows for [file patching](#7-file-patching), which is very useful for debugging. - -Not offering .exes for the Python scripts we use allows us to make easy changes without the hassle of compiling self-extracting exes all the time. - - -## 3. Getting ACE - -To actually get the ACE source code on your machine, it is recommended that you use Git. Tutorials for this are all around the web, and it allows you to track your changes and easily update your local copy. - -If you just want to create a quick and dirty build, you can also directly download the source code using the "Download ZIP" button on the front page of the GitHub repo. - - -## 4. Initial Setup - -After ensuring that you have installed all requirements, execute the `setup.py` script found in the `tools` folder. This will do most of the heavy lifting for you, create the links you need and copy the required CBA code to the proper place. Please note that these links are tied to the location of your ACE3 source code, so make sure that the project folder is where you want it to be. We recommend that you store the ACE3 project on your P-drive. - -### 4.1 Manual Setup - -Should the script fail, here is how you create the required links manually: - -First, to set up the links, create `z` folders both in your Arma 3 directory and on your P-drive. Then run the following commands as admin, replacing the text in brackets with the appropriate paths: - -Windows 8: - -``` -mklink /D /J "[Arma 3 installation folder]\z\ace" "[location of the ACE3 project]" -mklink /D /J "P:\z\ace" "[location of the ACE3 project]" -``` - -Windows 7 and Vista: - -``` -mklink /D "[Arma 3 installation folder]\z\ace" "[location of the ACE3 project]" -mklink /D "P:\z\ace" "[location of the ACE3 project]" -``` - -Then, copy the `cba` folder from the `tools` folder to `P:\x\cba`. Create the `x` folder if needed. That folder contains the parts of the CBA source code that are required for the macros to work. - - -## 5. Creating a Test Build - -To create a development build of ACE to test changes or to debug something, run the `build.py` file in the `tools` folder. This will populate the `addons` folder with binarized PBOs. These PBOs still point to the source files in their respective folders however, which allows you to use [file patching](#file-patching). - -This also means that you cannot distribute this build to others. - -To start the game using this build, you can use the following modline: - -``` --mod=@cba_a3;z\ace -``` - - -## 6. Creating a Release Build - -To create a complete build of ACE that you can use without the source files, run the `make.py` file in the `tools` folder. This will populate the `release` folder with binarized PBOs that you can redistribute. These handle like those of any other mod. - - -## 7. File Patching - -File Patching allows you to change the files in an addon while the game is running, requiring only a restart of the mission. This makes it great for debugging, as it cuts down the time required between tests. Note that this only works with PBOs created using MakePBO, as outlined in [Creating a Test Build](#creating-a-test-build). - -### 7.1 Enabling File Patching - -There are two ways to enable file patching: - -- Load cba_cache_disable.pbo (included in CBA's optional folder) -- Add the following to your test missions description.ext: - -```c++ -class CfgSettings { - class CBA { - class Caching { - compile = 0; - xeh = 0; - functions = 0; - }; - }; -}; -``` - -### 7.2 Restrictions of File Patching - -Files must exist in the built PBOs for filepatching to work. If you create a new file you must rebuild the PBO or Arma will not find it in your file paths. - -Configs are not patched during run time, only at load time. You do not have have to rebuild a PBO to make config changes, just restart Arma. You can get around this though if you are on the dev branch of Arma 3 and running the diagnostic exe. That includes `diag_mergeConfig` which takes a full system path (as in `p:\z\ace\addons\my_module\config.cpp`) and allows you selectivly reload config files. - -If you need to add/remove files, then you'll need to run build.py again without the game running, and restart. That is all that is required to add new files to then further use in testing. diff --git a/documentation/feature/advanced-ballistics.md b/documentation/feature/advanced-ballistics.md deleted file mode 100644 index 78ec99ef17..0000000000 --- a/documentation/feature/advanced-ballistics.md +++ /dev/null @@ -1,32 +0,0 @@ ---- -layout: wiki -title: Advanced Ballistics -description: The advanced ballistics module improves internal and external ballistics. -group: feature -category: realism -parent: wiki ---- - -## 1. Overview -The Advanced Ballistics module improves internal and external ballistics. - -## 1.1 Features -- Drag modelling based on real-world ballistic coefficients. -- Ambient air density (air pressure, temperature, humidity) affects drag. -- Wind affects drag and deflects the trajectory. -- Wind speed varies with altitude. -- Terrain features, buildings and other objects disrupt the wind. -- [Magnus effect](https://en.wikipedia.org/wiki/Magnus_effect) (spin drift) -- [Coriolis effect](https://en.wikipedia.org/wiki/Coriolis_effect) and [Eötvös effect](https://en.wikipedia.org/wiki/Eotvos_effect) (Earth rotation) -- Loss of stability during transonic flight. -- Variable muzzle velocity based on powder burn rate and barrel length. -- Bullet trace effect for supersonic bullets (light refraction due to air pressure waves). -- A protractor for quickly measuring the inclination angle. - -## 2. Usage - -### 2.1 Protractor -Press Ctrl+⇧ Shift+K while using a compatible weapon to toggle the protractor. The red line indicates the current inclination angle in degrees. The protractor will disappear if you lower or holster your weapon. - -## 3. Dependencies -`ace_ballistics`, `ace_weather`, `ace_modules` diff --git a/documentation/feature/ai.md b/documentation/feature/ai.md deleted file mode 100644 index 15d770395d..0000000000 --- a/documentation/feature/ai.md +++ /dev/null @@ -1,31 +0,0 @@ ---- -layout: wiki -title: AI (Artificial Intelligence) -description: Config based changes to AI to ensure compatibility with advanced AI modifications -group: feature -category: realism -parent: wiki ---- - -## 1. Overview - -### 1.1 Adjusted AI skill values -The idea here is to reduce the AI's godlike aiming capabilities while retaining its high intelligence. The AI should be smart enough to move through a town, but also be 'human' in their reaction time and aim. - -*Note: All these values can still be adjusted via scripts, these arrays just change what 0 & 1 are for `setSkill`.* - -### 1.2 Firing in burst mode -AI will now use the automatic mode of their weapons at short distances, instead of always relying on firing single shots in quick succession. - -### 1.3 Longer engagement ranges -The maximum engagement ranges are increased: AI will fire in bursts with variable lengths on high ranges of 500 - 700 meters, depending on their weapon and optic. - -### 1.4 No dead zones in CQB -Some weapons had minimum engagement ranges. If you were as close as 2 meters to an AAF soldier, he wouldn't open fire, because the AI couldn't find any valid fire mode for their weapon. ACE3 removes this behaviour mostly notable in CQB by adding a valid firing mode. - -### 1.5 No scripting -All changes of ACE3 AI are config based to ensure full compatibility with advanced AI modifications like e.g. "ASR AI 3". - -## 2. Dependencies - -`ace_common` diff --git a/documentation/feature/aircraft.md b/documentation/feature/aircraft.md deleted file mode 100644 index 43753a8d25..0000000000 --- a/documentation/feature/aircraft.md +++ /dev/null @@ -1,42 +0,0 @@ ---- -layout: wiki -title: Aircraft -description: Aircraft overhaul -group: feature -category: realism -parent: wiki ---- - -## 1. Overview - -### 1.1 Adjusted flight behaviour -Changes the flight behaviour of various aircraft. - -### 1.2 Various adjustments to aircraft and gunships munitions -- Higher capacity magazines for the Comanche. -- Gatling rate of fire (ROF) increased. -- AP rockets have less splash damage. - -### 1.3 Missile lock warnings -Adds missile-lock warning systems to helicopters and planes based on the equivalent real life capabilities. - -### 1.4 Semi-automatic flare mode -Adds the semi-automatic flare mode known from Arma 2. The key to switch modes existed in Arma 3's key settings, but wasn't operational until now. - -### 1.5 Ejecting from pilot and copilot seats -Pilots and copilots of all helicopters can now eject. - -### 1.6 Laser marker for Wildcat -Adds a laser marker to the copilot seat of the Wildcat. - -### 1.7 HUD for AH-9 -Adds a HUD to the AH-9 based on the Comanche's HUD. - -## 2. Usage - -### 2.1 Switching flare modes -Press Ctrl+C to switch between flare firing modes (Arma 3 default key bind `countermeasure mode`) - -## 3. Dependencies - -`ace_common` diff --git a/documentation/feature/apl.md b/documentation/feature/apl.md deleted file mode 100644 index 3be2d6c243..0000000000 --- a/documentation/feature/apl.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -layout: wiki -title: APL -description: assets under APL license -group: feature -category: equipment -parent: wiki ---- - -## 1. Overview - -This folder regroups all assets released under the APL license. - -## 2. Dependencies - -`ace_main` diff --git a/documentation/feature/atragmx.md b/documentation/feature/atragmx.md deleted file mode 100644 index c5ead1cf00..0000000000 --- a/documentation/feature/atragmx.md +++ /dev/null @@ -1,27 +0,0 @@ ---- -layout: wiki -title: ATragMX -description: -group: feature -category: equipment -parent: wiki ---- - -## Overview - -### Sub-feature 1 -Short description of sub-feature 1. - -### Sub-feature 2 -Short description of sub-feature 2. - - -## Usage - -Short overview of how to use the feature, e.g. menu options, key bindings, -instructions. May not apply to all modules. - - -## Dependencies - -`ace_common`, `ace_weather` diff --git a/documentation/feature/attach.md b/documentation/feature/attach.md deleted file mode 100644 index 6f291a99ad..0000000000 --- a/documentation/feature/attach.md +++ /dev/null @@ -1,35 +0,0 @@ ---- -layout: wiki -title: Attach -description: Allow players to attach items to vehicles or themselves -group: feature -category: interaction -parent: wiki ---- - -## 1. Overview - -### 1.1 Attach items to uniform -Allows players to attach IR grenades and chemlights to themselves. - -### 1.2 IR Strobe -Adds an attachable IR strobe, which is only visible using night vision devices and offers better visibility than IR grenades. - -## 2. Usage - -### 2.1 Attaching to yourself -- Use Self Interact Ctrl+⊞ Win (ACE3 default). -- Select `Equipment`. -- Select `Attach item`. -- Select which item you want to attach. -- Repeat the process to detach. - -### 2.2 Attaching to a vehicle -- Interact with the vehicle ⊞ Win (ACE3 default). -- Select `Attach item`. -- Select your item and follow the instructions on the screen. -- Repeat the process to detach. - -## 3. Dependencies - -`ace_interaction` diff --git a/documentation/feature/backpacks.md b/documentation/feature/backpacks.md deleted file mode 100644 index b86f801770..0000000000 --- a/documentation/feature/backpacks.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -layout: wiki -title: Backpacks -description: Notifies a player when his backpack is opened -group: feature -category: equipment -parent: wiki ---- - -## 1. Overview - -### 1.1 Zipping sounds -A zipper sound is played when someone opens your backpack. - -## 2. Dependencies - -`ace_common` diff --git a/documentation/feature/ballistics.md b/documentation/feature/ballistics.md deleted file mode 100644 index 70552a8d25..0000000000 --- a/documentation/feature/ballistics.md +++ /dev/null @@ -1,32 +0,0 @@ ---- -layout: wiki -title: Ballistics -description: Realistic ballistic improvements -group: feature -category: realism -parent: wiki ---- - -## 1. Overview - -### 1.1 Realistic ballistics -Changes include adjusted muzzle velocity, air friction and dispersion based on real life values. - -### 1.2 Realistic silencers and subsonic ammunition -Silencers no longer decrease the muzzle velocity and are generally less effective when used with normal ammunition. They now only remove the muzzle blast and flash. To prevent the crack caused by supersonic projectiles, ACE3 introduces subsonic ammunition for the 7.62mm caliber. This is also fully compatible with AI. - -### 1.3 Armor piercing ammunition -Armor piercing rounds have higher penetration values against light armored targets and other obstacles on the battlefield. Their drawback is a slightly decreased man-stopping power. AP rounds are available in multiple calibers including 5.56mm and 7.62mm. - -### 1.4 IR-Dim tracer ammunition -IR-Dim ammunition is similar to tracer rounds, but these tracers are only visible using night vision devices. - -### 1.5 M118 long range ammunition -The M14 EBR now uses ammunition with decreased muzzle velocity and air friction to improve precision and energy retention at long ranges. - -### 1.6 Fully config-based -This module applies configuration changes only and does not decrease game performance. - -## 2. Dependencies - -`ace_common` diff --git a/documentation/feature/captives.md b/documentation/feature/captives.md deleted file mode 100644 index 4cb495d810..0000000000 --- a/documentation/feature/captives.md +++ /dev/null @@ -1,48 +0,0 @@ ---- -layout: wiki -title: Captives -description: System for taking and handling captives -group: feature -category: interaction -parent: wiki ---- - -## 1. Overview - -### 1.1 Take captives -Introduces a captivity system. - -### 1.2 Load and unload captives into / from vehicles -You can load and unload captives from vehicles using ACE3 interactions. - -### 1.3 Frisk captives -You can frisk a restrained captive. - -### 1.4 Surrendering -Allows players to surrender. It renders the unit unable to move and with the hands behind its head. When surrendered AI won't fire. - -## 2. Usage - -### 2.1 Taking a unit into captivity -- You need `Cable Tie`. -- Approach the unit and Interact ⊞ win (ACE3 default). -- The interaction is located around the hands in the form of a handcuffs icon. -- Repeat to release. - -### 2.2 Escorting a captive -- Interact with the captive ⊞ win. -- Select the `Escort prisoner` option. -- To stop escorting, use the mousewheel and select `Release` or use Self Interaction Ctrl+⊞ win and select `Release`. - -### 2.3 Loading and unloading a captive into/from a vehicle -- Escort the captive. -- Approach the vehicle you wish to load the captive unit into. -- Interact with the vehicle ⊞ win and select `Load captive`. -- To unload the captive interact with the vehicle ⊞ win -- Select `Passengers`. -- Select the captive. -- Select `Unload captive`. - -## 3. Dependencies - -`ace_interaction` diff --git a/documentation/feature/common.md b/documentation/feature/common.md deleted file mode 100644 index 7a7c25166e..0000000000 --- a/documentation/feature/common.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -layout: wiki -title: Common -description: Common functions and systems used by most other components. -group: feature -category: general -parent: wiki ---- - -## 1. Overview - -Common functions and systems used by most other components. - -## 2. Dependencies - -`ace_main` - -*Note: The Common module is required by nearly all other modules. Do NOT remove it!* diff --git a/documentation/feature/concertina-wire.md b/documentation/feature/concertina-wire.md deleted file mode 100644 index 6e462438b9..0000000000 --- a/documentation/feature/concertina-wire.md +++ /dev/null @@ -1,23 +0,0 @@ ---- -layout: wiki -title: Concertina Wire -description: -group: feature -category: equipment -parent: wiki ---- - -## 1. Overview - -A concertina wire is a type of barbed wire formed in large coils that can be expanded to form obstacles, in ACE3 any vehicle making contact with it gets its tires destroyed. - -## 2. Usage - -### 2.1 Deploying the concertina wire -- Approach the concertina coil and select ⊞ Win (ACE3 default) -- Select `Deploy concertina wire`. -- Follow the instructions on screen. - -## 3. Dependencies - -`ace_apl` , `ace_interaction` diff --git a/documentation/feature/dagr.md b/documentation/feature/dagr.md deleted file mode 100644 index 24f80cf0cf..0000000000 --- a/documentation/feature/dagr.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -layout: wiki -title: Dagr -group: feature -category: equipment -parent: wiki ---- - -## 1. Overview - -Adds the Defense Advanced GPS Receiver. - -## 3. Dependencies - -`ace_weather` diff --git a/documentation/feature/difficulties.md b/documentation/feature/difficulties.md deleted file mode 100644 index 0bc6e7e6da..0000000000 --- a/documentation/feature/difficulties.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -layout: wiki -title: Difficulties -description: Tweak to Vanilla hardest difficulty -group: feature -category: realism -parent: wiki ---- - -## 1. Overview - -### 1.1 Elite mode adjustments -Adjusts the default settings of the hardest difficulty to better resemble Arma 2 settings (no crosshair, stat screen, death messages). - -## 2. Dependencies - -`ace_common` diff --git a/documentation/feature/disarming.md b/documentation/feature/disarming.md deleted file mode 100644 index d7b043ab24..0000000000 --- a/documentation/feature/disarming.md +++ /dev/null @@ -1,24 +0,0 @@ ---- -layout: wiki -title: Disarming -description: -group: feature -category: interaction -parent: wiki ---- - -## 1. Overview - -### 1.1 Searching through a unit's inventory -You can search the inventory and disarm captured or unconscious units. - -## 2. Usage - -### 2.1 Searching and disarming -- Interact with the captured or unconscious unit ⊞ Win (ACE3 default key bind `Interaction Key`). -- Select `Open inventory`. -- Drag & Drop the items you wish to remove from the unit. - -## 3. Dependencies - -`ace_interaction` diff --git a/documentation/feature/disposable.md b/documentation/feature/disposable.md deleted file mode 100644 index 16e7a5ca71..0000000000 --- a/documentation/feature/disposable.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -layout: wiki -title: Disposable -description: Makes NLAW disposable and allows addons to do the same -group: feature -category: equipment -parent: wiki ---- - -## 1. Overview - -The NLAW is shoulder fired and disposable, firing just once before being needed to be disposed of. This feature makes the NLAW disposable and provides the tools for other addons to do the same. - -## 2. Dependencies - -`ace_common` diff --git a/documentation/feature/dragging.md b/documentation/feature/dragging.md deleted file mode 100644 index a93089cf3b..0000000000 --- a/documentation/feature/dragging.md +++ /dev/null @@ -1,24 +0,0 @@ ---- -layout: wiki -title: Dragging -description: Adds the option to drag and carry units and objects -group: feature -category: interaction -parent: wiki ---- - -## 1. Overview - -This adds the option to drag or carry units or objects. - -## 2. Usage - -### 2.1 Dragging / Carrying units and objects -- You can only drag or carry an unconscious unit. -- Interact with the unit or object ⊞ Win (ACE3 default key bind `Interact Key`). -- Select `Drag` or `Carry`. -- To release, use the mouse wheel and select `Release` or use Self Interaction Ctrl+⊞ Win and select `Release`. - -## 3. Dependencies - -`ace_interaction` diff --git a/documentation/feature/explosives.md b/documentation/feature/explosives.md deleted file mode 100644 index 214ec7dcab..0000000000 --- a/documentation/feature/explosives.md +++ /dev/null @@ -1,41 +0,0 @@ ---- -layout: wiki -title: Explosives -description: Adds numerous improvements to using and handling explosives -group: feature -category: interaction -parent: wiki ---- - -## 1. Overview - -### 1.1 Advanced explosives placement -Enables more precise placement of explosives. - -### 1.2 Numerous trigger types -Offers different trigger types, like clackers and dead man switches. - -### 1.3 Attach explosives to vehicles -Enables attaching explosives to vehicles. - -## 2. Usage - -### 2.1 Placing explosives -- Use self interaction Ctrl+⊞ Win (ACE3 default key bind `Self Interaction Key`). -- Select `Explosives`. -- Choose your explosive type and follow the instructions on the screen. - -### 2.2 Arming and detonating explosives -- Interact with the explosive ⊞ Win (ACE3 default key bind `Interact Key`). -- Choose the arming method. -- For clackers use Self Interaction `Explosives` → `Detonate` and choose the corresponding Firing Device. - -### 2.3 Defusing explosives -- A `Defusal Kit` is required. -- Interact with the explosive ⊞ Win. -- Select `Disarm`. -- You are safe to pick it up after the action has completed. - -## 3. Dependencies - -`ace_interaction` diff --git a/documentation/feature/fcs.md b/documentation/feature/fcs.md deleted file mode 100644 index bf176179e5..0000000000 --- a/documentation/feature/fcs.md +++ /dev/null @@ -1,36 +0,0 @@ ---- -layout: wiki -title: FCS (Fire Control System) -description: -category: equipment -group: feature -parent: wiki ---- - -## 1. Overview - -### 1.1 Fire control system -Offers a custom fire control system for tanks and helicopters. It enables engaging stationary and moving targets. - -### 1.2 Manual lasing targets -Changes the default rangefinders, including those in vehicles, to require manual lasing. - -### 1.3 Air burst ammunition -Anti air cannons can now use airburst ammunition. It will explode on the FCS' zeroed in range. - -## 2. Usage - -### 2.1 Engaging moving targets -- Place the crosshair on the enemy vehicle. -- Press and hold Tab ↹ (ACE 3 default key bind `Lock Target [Hold]`) and follow the target for about 2 seconds. -- Release Tab ↹. -- The optic is now adjusted sideways to ensure a hit. - -### 2.2 Ranging stationary targets -- Place the crosshair on the object to range. -- Tap Tab ↹ -- The optic is now adjusted. - -## 3. Dependencies - -`ace_interaction` diff --git a/documentation/feature/finger.md b/documentation/feature/finger.md deleted file mode 100644 index 3943980a97..0000000000 --- a/documentation/feature/finger.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -layout: wiki -title: Finger -description: Finger pointing -group: feature -category: realism -parent: wiki ---- - -## 1. Overview -Allows players to point in a direction with their fingers, when they do so people around (4m by default) can see a big circle in the pointed direction. - - -## 2. Usage - -### 2.1 How to point things -- Press ⇧ Shift+` (QWERTY and AZERTY layouts) - -## 3. Dependencies - -`ace_common` diff --git a/documentation/feature/flashsuppressors.md b/documentation/feature/flashsuppressors.md deleted file mode 100644 index ba59dd0907..0000000000 --- a/documentation/feature/flashsuppressors.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -layout: wiki -title: Flash Suppressors -description: -group: feature -category: equipment -parent: wiki ---- - -## 1. Overview - -This adds the ability to use the flash suppressors that are already in game but not accessible. - -Flash suppressors are devices that reduce the muzzle flash while firing by cooling or dispersing the burning gases that exit the muzzle. Its intent is to reduce the chances that the shooter will be blinded in low-light shooting conditions as well as reducing the intensity of the flash visible to the enemy. - -## 2. Dependencies - -`ace_common` diff --git a/documentation/feature/fonts.md b/documentation/feature/fonts.md deleted file mode 100644 index 198e3f8bd0..0000000000 --- a/documentation/feature/fonts.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -layout: wiki -title: Fonts -group: feature -category: general -parent: wiki ---- - -## 1. Overview - -This module adds a font that will be used in the future, characters with equal widths to make it easy to structure correctly. This is **NOT** present in 3.1.1 because of a bug even if it's present in the sources. - - -## 3. Dependencies - -`ace_main` diff --git a/documentation/feature/frag.md b/documentation/feature/frag.md deleted file mode 100644 index 406b6f65ad..0000000000 --- a/documentation/feature/frag.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -layout: wiki -title: Frag -description: -group: feature -category: realism -parent: wiki ---- - -## 1. Overview - -Adds a shrapnel system for explosives. - -## 2. Dependencies - -`ace_common` diff --git a/documentation/feature/gforces.md b/documentation/feature/gforces.md deleted file mode 100644 index be58b966c1..0000000000 --- a/documentation/feature/gforces.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -layout: wiki -title: G-Forces -description: -group: feature -category: realism -parent: wiki ---- - -## 1. Overview - -Adds G-force induced tunnel vision and unconsciousness. - -## 2. Dependencies - -`ace_common` diff --git a/documentation/feature/goggles.md b/documentation/feature/goggles.md deleted file mode 100644 index 945df87a3e..0000000000 --- a/documentation/feature/goggles.md +++ /dev/null @@ -1,23 +0,0 @@ ---- -layout: wiki -title: Goggles -description: -group: feature -category: equipment -parent: wiki ---- - -## 1. Overview - -### 1.1 Visual Effects for eyewear -Adds color tint to sunglasses and other eyewear. Causes raindrops to appear on the screen in rain. Causes dirt to appear on the screen when dirt is kicked up nearby (e.g. explosions, rotor wash, bullet impacts, muzzle blast). - - -## 2. Usage - -### 2.1 Cleaning your goggles -- To clean your goggles press SHIFT + ALT + T(ACE3 deault key bind `Wipe goggles`) - -## 3. Dependencies - -`ace_common` diff --git a/documentation/feature/grenades.md b/documentation/feature/grenades.md deleted file mode 100644 index f5f4e101ce..0000000000 --- a/documentation/feature/grenades.md +++ /dev/null @@ -1,32 +0,0 @@ ---- -layout: wiki -title: Grenades -description: -group: feature -category: equipment -parent: wiki ---- - -## 1. Overview - -### 1.1 Throw modes -Provides different modes for throwing grenades (high throw, precision throw and drop mode). - -### 1.2 Hand flares -Adds throwable hand flares in the colors white, red, green and yellow. Additionally buffs existing flares by making them brighter and last longer. - -### 1.3 M84 stun grenade -Adds the M84 stun grenade. The stun effect will also affect AI. - -## 2. Usage - -### 2.1 Switching between throw modes -- Press 8 (ACE3 default key bind `Switch Grenade Mode`) - -### 2.2 Switching between grenades -- Press 6 (ACE3 default key bind `Select frag`) to switch between `LETHAL` grenades -- Press 7 (ACE3 default key bind `Select non-frag`) to switch between `NON LETHAL` grenades - -## 3. Dependencies - -`ace_common` diff --git a/documentation/feature/hearing.md b/documentation/feature/hearing.md deleted file mode 100644 index f935a6286c..0000000000 --- a/documentation/feature/hearing.md +++ /dev/null @@ -1,34 +0,0 @@ ---- -layout: wiki -title: Hearing -description: -group: feature -category: realism -parent: wiki ---- - -## 1. Overview - -### 1.1 Hearing damage simulation -Introduces hearing damage caused by nearby explosions and large-caliber weapons. - -### 1.2 Earplugs -Adds earplugs to mitigate that effect. Soldiers with high caliber weapons or -missile launchers will be equipped with those, but remember to put them in. - -### 1.3 Helmets -Some types of helmets can mitigate hearing damage also (ie. crewman helmet, pilot helmet etc.). - -## 2. Usage - -### 2.1 Equipping earplugs -- For this you need the `Earplugs` item. -- Press the self interaction key Ctrl + ⊞ Win (ACE3 default key bind `Self Interaction Key`). -- Select `Equipment`. -- Select `Earplugs in`. -- Same method to remove them but the option is `Earplugs out`. -- Note: you're able to re-use earplugs. - -## 3. Dependencies - -`ace_interaction` diff --git a/documentation/feature/hitreactions.md b/documentation/feature/hitreactions.md deleted file mode 100644 index 002cd2b7c6..0000000000 --- a/documentation/feature/hitreactions.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -layout: wiki -title: Hit Reactions -description: -group: feature -category: realism -parent: wiki ---- - -## 1. Overview - -### 1.1 Falling under fire -If a unit is shot while running it falls to the ground in a prone position, the area where the shot lands does not matters. -Note that the shot needs to inflict a certain amount of damage to make the unit fall, a small cut won't make the unit stumble. - -## 2. Dependencies - -`ace_common` diff --git a/documentation/feature/huntIR.md b/documentation/feature/huntIR.md deleted file mode 100644 index bd4841c184..0000000000 --- a/documentation/feature/huntIR.md +++ /dev/null @@ -1,43 +0,0 @@ ---- -layout: wiki -title: HuntIR -group: feature -category: equipment -parent: wiki ---- - -## 1. Overview - -### 1.1 The HuntIR -The **H**igh altitude **U**nit **N**avigated **T**actical **I**maging **R**ound (HuntIR) is designed to be fired from a grenade launcher. After being fired in the air the in built parachute will be deployed and the IR CMOS camera will activate, providing a video stream until it touches the ground or get shot down. - -## 2. Usage -NOTE: the HuntIR round doesn't work with modded weapons without a compatibility fix made either by the ACE3 team or the mod team. - -### 2.1 Using the HuntIR -- To be able to connect to the IR CMOS camera you'll need a `HuntIR monitor`. -- Fire the HuntIR round as high as possible over the area you want to observe. -- Open the `HuntIR monitor`. - - To open the `HuntIR monitor` self interact Ctrl + ⊞ Win (ACE3 default) - - Select `Equipment`. - - Select `Activate HuntIR monitor`. -- You now have control of the IR CMOS camera to close the monitor press ESC or ⊞ Win - -### 2.2 IR CMOS camera controls - -Shortcut | Action ------------- | ------------- -A | Lower zoom level -D | Increase zoom level -N | Toggle NV and TI modes -S | Next camera -W | Previous camera - | Rotate camera anticlockwise -| Rotate camera clockwise - | Raise camera - | Lower camera -R | Reset camera - -## 3. Dependencies - -`ace_common` diff --git a/documentation/feature/interact-menu.md b/documentation/feature/interact-menu.md deleted file mode 100644 index 96364c522b..0000000000 --- a/documentation/feature/interact-menu.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -layout: wiki -title: Interact Menu -description: -group: feature -category: interaction -parent: wiki ---- - -## 1. Overview - -This handles the interaction layer of ACE3. - -## 2. Dependencies - -`ace_common` - -*Note: The Interact Menu module is required by most of the other modules. Do NOT remove it!* diff --git a/documentation/feature/interaction.md b/documentation/feature/interaction.md deleted file mode 100644 index 3916afede2..0000000000 --- a/documentation/feature/interaction.md +++ /dev/null @@ -1,46 +0,0 @@ ---- -layout: wiki -title: Interaction -description: -group: feature -category: interaction -parent: wiki ---- - -## 1. Overview - -This provides interaction options between units, vehicles, buildings and objects. -Some of the zeus actions are also available (while in zeus) in the interaction menu (remote control, group management). - -## 2. Usage - -### 2.1 Opening the self interaction menu -- Press and hold Ctrl + ⊞ Win (ACE3 default). - -### 2.2 Opening the interaction menu -- Press and hold ⊞ Win (ACE3 default). - -### 2.3 Using the zeus interactions -- Units - - Select the unit(s). - - Open the interaction menu. - - Select `Units`. - - Select the stance (works for multiple units) or remote control. - -- Groups - - Select a group by clicking on the icon hovering above it's squad leader, to select multiple squads press and hold Ctrl. - - Open the interaction menu. - - Select `Groups`. - - From here you can select the speed / formation / behavior of all the units of the group(s). - -- Waypoints - - Select a waypoint by clicking on it, same as above press and hold Ctrl to select multiple. - - Open the interaction menu. - - Select `Waypoints`. - - From here you can modify the speed / formation / behavior of the units / groups that are moving to that waypoint. - -## 3. Dependencies - -`ace_interact_menu` - -*Note: The Interaction module is required by most of the other modules. Do NOT remove it!* diff --git a/documentation/feature/inventory.md b/documentation/feature/inventory.md deleted file mode 100644 index f4d4dcfd2b..0000000000 --- a/documentation/feature/inventory.md +++ /dev/null @@ -1,26 +0,0 @@ ---- -layout: wiki -title: Inventory -description: -group: feature -category: interaction -parent: wiki ---- - -## 1. Overview - -### 1.1 Resized inventory UI -Makes the inventory dialog bigger and increases the number of items that can be seen in the list at once. - -## 2. Usage - -### 2.1 Changing the size of the UI -- Press Escape. -- Click on `ACE OPTIONS` on the top left corner of the screen. -- Click on `Make Inventory Display Bigger`. -- Choose the size desired on the right drop down menu. -- Press the `Close` button, your changes are automatically saved. - -## 3. Dependencies - -`ace_common` diff --git a/documentation/feature/javelin.md b/documentation/feature/javelin.md deleted file mode 100644 index baa1549e7e..0000000000 --- a/documentation/feature/javelin.md +++ /dev/null @@ -1,34 +0,0 @@ ---- -layout: wiki -title: Javelin -description: -group: feature -category: equipment -parent: wiki ---- - -## 1. Overview - -### 1.1 Improved locking -The locking capabilities of the Titan and Javelin got improved, you can now lock on anything that has a thermal signature, including houses. - -### 1.2 Fire mode switching -The Titan / Javelin now posses the ability to be used in top down attack or direct. - -## 2. Usage - -### 2.1 Locking with the Titan / Javelin -- For this feature you need to have a compatible launcher. -- Fully zoom in with the launcher. -- Switch to thermals N (Arma 3 default key bind `Night vision`). -- While keeping your aim steadily on target press and hold Tab ↹ (ACE3 default key bind `Lock Target [Hold]`). -- When the sound changes and a cross appears on the screen the target is locked and you're able to fire. - -### 2.2 Switching fire mode -- For this feature you need to have a compatible launcher. -- When aiming with your launcher press Ctrl + Tab ↹. -- On the right side of the screen (for most launchers) you should see that `TOP`is now illumiated in green which means that your missile will be fired in top down mode. - -## 3. Dependencies - -`ace_main`, `ace_common`, `ace_missileguidance` diff --git a/documentation/feature/kestrel4500.md b/documentation/feature/kestrel4500.md deleted file mode 100644 index 3769385c5e..0000000000 --- a/documentation/feature/kestrel4500.md +++ /dev/null @@ -1,27 +0,0 @@ ---- -layout: wiki -title: Kestrel 4500 -description: -group: feature -category: equipment -parent: wiki ---- - -## Overview - -### Sub-feature 1 -Short description of sub-feature 1. - -### Sub-feature 2 -Short description of sub-feature 2. - - -## Usage - -Short overview of how to use the feature, e.g. menu options, key bindings, -instructions. May not apply to all modules. - - -## Dependencies - -`ace_common`, `ace_weather` diff --git a/documentation/feature/laser-selfdesignate.md b/documentation/feature/laser-selfdesignate.md deleted file mode 100644 index cdc35914c5..0000000000 --- a/documentation/feature/laser-selfdesignate.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -layout: wiki -title: Laser Self-Designate -description: -group: feature -category: equipment -parent: wiki ---- - -## 1. Overview - -Allows gunners to lase their own targets. See [Feature: "FCS"]({{ site.productionUrl }}/wiki/feature/fcs.html) for more information. - -## 2. Dependencies - -`ace_laser` diff --git a/documentation/feature/laser.md b/documentation/feature/laser.md deleted file mode 100644 index 27718d6d61..0000000000 --- a/documentation/feature/laser.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -layout: wiki -title: Laser -description: -group: feature -category: realism -parent: wiki ---- - -## 1. Overview - -Contains various functions necessary for the realistic portrayal of laser mechanics in other components. - -## 2. Dependencies - -`ace_common` diff --git a/documentation/feature/laserpointer.md b/documentation/feature/laserpointer.md deleted file mode 100644 index 1e962919c9..0000000000 --- a/documentation/feature/laserpointer.md +++ /dev/null @@ -1,24 +0,0 @@ ---- -layout: wiki -title: Laser Pointer -description: Switching laser modes, daylight lasers -group: feature -category: equipment -parent: wiki ---- - -## 1. Overview - -### 1.1 Visible light laser -ACE3 adds a visible laser attachment for weapons. This feature is compatible with BI's lasers as well as supported modded ones. - -## 2. Usage - -### 2.1 Switching laser mode -- For this feature you need to have a compatible side attachment. -- Press Ctrl + L (ACE3 default key bind `Switch Laser / IR Laser`). -- A hint indicating the mode switch will appear in the top right corner. - -## 3. Dependencies - -`ace_common` diff --git a/documentation/feature/logistics-uavbattery.md b/documentation/feature/logistics-uavbattery.md deleted file mode 100644 index af57c4b2a2..0000000000 --- a/documentation/feature/logistics-uavbattery.md +++ /dev/null @@ -1,24 +0,0 @@ ---- -layout: wiki -title: Logistics - UAV Battery -description: UAV recharging -group: feature -category: equipment -parent: wiki ---- - -## 1. Overview - -### 1.1 Rechargeable darters. -Adds an item `ACE_UAVBattery` that allows refuelling / recharging of the "Darter" quad-copter UAVs. - -## 2. Usage - -### 2.1 Recharging the darter -- For this you need a `UAV battery` and the UAV needs to be a quad-copter. -- Interact with the UAV ⊞ Win (ACE3 default key bind `Interact Key`) -- Select `Recharge` - -## 3. Dependencies - -`ace_interaction` diff --git a/documentation/feature/logistics-wirecutter.md b/documentation/feature/logistics-wirecutter.md deleted file mode 100644 index 9e180c9b62..0000000000 --- a/documentation/feature/logistics-wirecutter.md +++ /dev/null @@ -1,25 +0,0 @@ ---- -layout: wiki -title: Logistics - Wirecutter -description: -group: feature -category: equipment -parent: wiki ---- - -## 1. Overview - -### 1.1 Wirecutter -Adds an item `ACE_wirecutter` that allows cutting of fences in Arma 3 and AllInArma maps. - -## 2. Usage - -### 2.1 Using the wirecutter -- For this you need a `Wirecutter`. -- Approach the fence you want to cut. -- Press the interaction key ⊞ Win (ACE3 default key bind `Interaction Key`). -- Find the interaction point and select `Cut Fence` (the only option). - -## 3. Dependencies - -`ace_interaction` diff --git a/documentation/feature/magazinerepack.md b/documentation/feature/magazinerepack.md deleted file mode 100644 index 870281693c..0000000000 --- a/documentation/feature/magazinerepack.md +++ /dev/null @@ -1,25 +0,0 @@ ---- -layout: wiki -title: Magazine Repack -description: Repacking magazines, and maybe your bananas. -group: feature -category: realism -parent: wiki ---- - -## 1. Overview - -### 1.1 Repacking magazines -Adds the ability to repack magazines of the same type. - -## 2. Usage - -### 2.1 Repacking -- For this you need multiple half empty mags of the same type. -- Press the self interaction button Ctrl + ⊞ Win (ACE3 default key bind `Self Interaction Key`). -- Select `Repack magazines`. -- Select the type of magazines you want to repack. - -## 3. Dependencies - -`ace_interaction` diff --git a/documentation/feature/main.md b/documentation/feature/main.md deleted file mode 100644 index 668cfb531f..0000000000 --- a/documentation/feature/main.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -layout: wiki -title: Main -description: main module -group: feature -category: general -parent: wiki ---- - -## 1. Overview - -Main module which acts as the ACE3 core module. - -## 2. Dependencies - -`Arma 3` and `CBA_A3` - -*Note: The Main module is required by all other modules. Do not remove it!* diff --git a/documentation/feature/map.md b/documentation/feature/map.md deleted file mode 100644 index 9e45c5a359..0000000000 --- a/documentation/feature/map.md +++ /dev/null @@ -1,34 +0,0 @@ ---- -layout: wiki -title: Map -description: Map improvements -group: feature -category: realism -parent: wiki ---- - -## 1. Overview - -### 1.1 Map styling -Better map styling (contours, legend, hiding bushes and trees, etc). - -### 1.2 Map zoom level (optional) -The mission maker / server owner can restrict the maximum zoom level of the map. - -### 1.3 Map shake (optional) -While walking your map will move slightly. - -### 1.4 Map illumination (optional) -The map illumination will be the same as your surroundings meaning that in a dark night you'll either need a light source or NVGs to see your map. - -### 1.5 Blufor tracker (optional) -The Blufor tracker marks the position of your faction's group leaders on the map. - - -## 2. Usage - -- IMPORTANT NOTICE: The (optional) features above CAN be restricted by the mission maker / server owner. User experience may vary. - -## 3. Dependencies - -`ace_interaction` diff --git a/documentation/feature/maptools.md b/documentation/feature/maptools.md deleted file mode 100644 index 0e99b9feef..0000000000 --- a/documentation/feature/maptools.md +++ /dev/null @@ -1,39 +0,0 @@ ---- -layout: wiki -title: Map Tools -description: Map tools, a roamer and pens -group: feature -category: equipment -parent: wiki ---- - -## 1. Overview - -### 1.1 Line drawing -This adds the possibility to draw accurate lines on the map screen. - -### 1.2 Map tools -This adds map tools that can be used to measure distances between two points or bearings on the map. - -### 1.3 GPS on map -If you are equipped with a vanilla GPS it will be shown on the map. (You don't need the map tools in your inventory for this.) - -## 2. Usage - -### 2.1 Using map tools -- For this you need to have `Map Tools`. -- Open the map M (Arma 3 default key bind `Map`). -- Press the self interaction key Ctrl + ⊞ Win (ACE3 default key bind `Self Interaction Key`). -- Select `Map tools`. -- Select the type of tools you want to use. -- Note that you can drag the Roamer (map tool) around with LMB and rotate it with Ctrl + LMB. - -### 2.2 Drawing lines -- To draw lines `Map Tools` are not required. -- Press ALT + LMB to start the line, left click again to end it. -- To delete a line press Del around the center of the line. -- Note that you can change the color of the lines by clicking on one of the coloured column on top of the screen (While the map is opened) - -## 3. Dependencies - -`ace_interaction` diff --git a/documentation/feature/markers.md b/documentation/feature/markers.md deleted file mode 100644 index 73560dd99f..0000000000 --- a/documentation/feature/markers.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -layout: wiki -title: Markers -description: improved markers -group: feature -category: interaction -parent: wiki ---- - -## 1. Overview - -### 1.1 Improved marker placement -Expands the "Insert Marker" menu and allows to rotate map markers. Shows the currently selected channel to prevent misplacement. - -## 2. Dependencies - -`ace_common` diff --git a/documentation/feature/medical-system.md b/documentation/feature/medical-system.md deleted file mode 100644 index 4bc0ae1557..0000000000 --- a/documentation/feature/medical-system.md +++ /dev/null @@ -1,292 +0,0 @@ ---- -layout: wiki -title: Medical System -description: ACE provide users with a more realistic medical system and comes in both a basic and advanced version. Both versions have overlap but each have their own unique characteristics. -group: feature -order: 4 -category: realism -parent: wiki ---- -**Disclaimer:** The documentation for the medical system being extremely long it's highly advised to use the table of contents at the top right corner of the page. - -## 1. Overview -ACE3 provides users with a more realistic medical system and comes in both a basic and an advanced version. This page will detail the differences between both systems and what they do as well as how to use them efficiently. - -### 1.1 Basic medical -ACE3's basic medical system is quite a bit more complex than Arma 3's default system, but not really difficult to grasp. ACE3 basic medical is a mixture between the ACE2 and AGM medical systems. -All interactions in the medical system are done with the interaction menu. Non-medics can - by default - not perform all actions (Epinephrine and IVs) and their actions take more time as when performed by trained medics. - -### 1.2 Revive system -The revive system lets you bring downed units back up. -Upon receiving a deadly amount of damage a unit will fall unconscious for a determined amount of time. In that time a medic will need to treat them and give them epinephrine to bring them back up. - -### 1.3 Advanced medical - -The advanced medical system provides a more complex and detailed medical simulation and is based off the CSE CMS. It focuses on a more realistic model for injuries and treatments, thus resulting in a more important and prominent role for combat medics, and a bigger incentive to avoid getting shot. - -The system behind advanced medical is designed to attempt to mimic important parts of the human body, as well as react to any injuries sustained and treatments applied in a realistic manner. The available treatments and supplies in advanced medical are based off the Tactical Combat Casualty Care (TCCC) guidelines, which are the same guidelines used by real-life combat medics around the world. - -Besides the 4 elements introduced by basic medical, advanced introduces the following: - -- More detailed wound system. -- Accurate blood loss based upon sustained injuries. -- Vitals, including heart rate and blood pressure. -- Cardiac Arrest. -- Various treatment methods such as CPR, different kinds of IVs and a working tourniquet. -- A basic medication simulation. - -## 2. Usage - -### 2.1 Basic - -When hit, units start to lose blood depending on the severity of their wounds. Once the level of blood falls below a certain threshold, the unit will fall unconscious and eventually die. Units will also fall unconscious when sustaining large amounts of damage at once or from high amounts of pain. - -#### 2.1.1 Wounds, bandages and medications - - -##### 2.1.1.1 Wounds - -It's pretty straightforward compared to advanced, you only have two types of wounds. - -- Yellow: you need one bandage to heal it. -- Red: you need two bandages to heal it. - -##### 2.1.1.2 Bandages - -- All of them have the same effect. - -##### 2.1.1.3 Tourniquet - -- Serves no use in basic - -##### 2.1.1.4 IVs - -IV | Effect ----------- | ---------- | -Saline | Serves no use in basic -Plasma | Serves no use in basic -Blood | Restores the blood of the patient - -Use the appropriate amount depending on the situation (low / heavy loss of blood) (250, 500 or 1 000 mL) - - -##### 2.1.1.5 Autoinjectors - -Autoinjector | Effect ----------- | ---------- | -Morphine | Removes pain -Epinephrine | Wakes up the patient -Atropine | Serves no use in basic - -#### 2.1.2 Treating the patient - -- **Step 1:** Is the patient responsive? - - **Yes:** Ask him if he has wounds / he is in pain. - - **No:** Go to step 2. - - -- **Step 2:** Is the patient wounded? - - **Yes:** Treat the wounds and go to step 3. - - **No:** Skip this step. - - -- **Step 3:** Is the patient in pain? - - **Yes:** Give him morphine. - - **No:** Skip this step. - - -- **Step 4:** Did the patient lose blood? - - **Yes:** Give blood via IV. - - **No:** Go to step 5. - - **No and patient responsive:** You're done. - - -- **Step 5** - - If at this point the patient is still not back on its feet it's time to use an epinephrine autoinjector. - -#### 2.1.3 Additional informations - -- If the revive system is in place your character will not die until the revive timer is at 0. Even if a tank shoots your ass off an epinephrine shot will bring you back up after your wounds are treated. (The timer is invisible and may vary from mission to mission, it also depends on the amount of lives remaining you have.) -- You can't do an overdose in basic. - -### 2.2 Advanced - -Same as with basic, when hit an injury is sustained. Different though is that the type of injury and the severity of it are based upon how the damage was done and what caused it. This affects both blood loss and immediate consequences, such as being knocked out or being killed right away. When a player has sustained an injury, this will be indicated by flashing red on the screen; this means the player is bleeding. - -#### 2.2.1 Wounds, bandages and medications - - -##### 2.2.1.1 Abrasions (or scrapes) - -- They occur when the skin is rubbed away by friction against another rough surface (e.g. rope burns and skinned knees). -- Sources: falling, rope burn, vehicle crashes. -- Effects: pain - extremely light, bleeding - extremely slowly. - -##### 2.2.1.2 Avulsions - -- Occur when an entire structure or part of it is forcibly pulled away, such as the loss of a permanent tooth or an ear lobe. Explosions, gunshots, and animal bites may cause avulsions. -- Sources: explosions, vehicle crashes, grenades, artillery shells, bullets, backblast, bites. -- Effects: pain - extremely high, bleeding - extremely fast (depends on wound size). - -##### 2.2.1.3 Contusions - -- Also called bruises, these are the result of a forceful trauma that injures an internal structure without breaking the skin. Blows to the chest, abdomen, or head with a blunt instrument (e.g. a football or a fist) can cause contusions. -- Sources: bullets, backblast, punches, vehicle crashes, falling. -- Effects: pain - light, no bleeding. - -##### 2.2.1.4 Crush wounds - -- Occur when a heavy object falls onto a person, splitting the skin and shattering or tearing underlying structures. -- Sources: falling, vehicle crashes, punches. -- Effects: pain - light, bleeding - extremely slowly. - -##### 2.2.1.5 Cut wounds** - -- Slicing wounds made with a sharp instrument, leaving even edges. They may be as minimal as a paper cut or as significant as a surgical incision. -- Sources: vehicle crashes, grenades, explosions, artillery shells, backblast, stabs. -- Effects: pain - light, bleeding - speed depends on length and size of the wound. - - -##### 2.2.1.6 Lacerations (tears) - -- these are separating wounds that produce ragged edges. They are produced by a tremendous force against the body, either from an internal source or from an external source like a punch. -- Sources: vehicle crashes, punches. -- Effects: pain - light, bleeding - slow to medium speed (depends on wound size). - -##### 2.2.1.7 Velocity wound - -- They are caused by an object entering the body at a high speed, typically a bullet or small pieces of shrapnel. -- Sources: bullets, grenades, explosions, artillery shells. -- Effects: pain - extremely high, bleeding - medium speed (depends on wound size). - - -##### 2.2.1.8 Puncture wounds - -- Deep, narrow wounds produced by sharp objects such as nails, knives, and broken glass. -- Sources: stabs, grenades. -- Effects: pain - light, bleeding - slowly. - -In order to stop the bleeding, all bleeding injuries on every body part requires treatment. This is done by either applying a tourniquet to legs or arms as a temporary solution, or by using bandages to stop the bleeding as a more permanent fix. - - -##### 2.2.1.9 Bandages effectiveness - -Bandage | Abrasions | Avulsions | Contusions | Crush wounds | Cut wounds | Lacerations | Velocity wounds | Puncture wounds| ----------- | ---------- | ---------- | ---------- | ---------- | ---------- | ---------- | ---------- | ------- | -Basic | `highest` | lowest | `highest` | low | very low | medium | lowest | low -Bandage (packing) | `highest` | `highest` | `highest` | low | lowest | lowest | `highest` | lowest -Bandage (elastic) | `highest` | lowest | `highest` | `highest` | `highest` | `highest` | low | high -QuikClot | medium | high | medium | medium | medium | medium | high | high - -##### 2.2.1.10 Tourniquet - -- Can only be applied on limbs. -- Stops bleeding from wounds. -- Should be taken off as fast as possible and applied only to give medic time to bandage all the wounds. -- If not taken off for a while it will cause pain to the patient. - -##### 2.2.1.11 IVs - -IV | Effect ----------- | ---------- | -Saline plasma and blood | All three restore the volume of liquid in the blood stream. as a result blood pressure is raised for all of them. - -Use the appropriate amount depending on the situation (heavy loss of blood, blood pressure too low) (250, 500 or 1 000 mL) - -##### 2.2.1.12 Autoinjectors - -Autoinjector | Effect ----------- | ---------- | -Morphine | lower the blood pressure and heart rate of the patient, also suppress pain -Epinephrine | raise the heart rate of the patient -Atropine | lower the heart rate of the patient - -##### 2.2.1.13 Surgical kit - -- Is only useful when advanced wounds (reopening) is enabled. -- Stitch a wound to stop it from reopening. -- It's use may be limited to a certain class and / or near a vehicle / facility. -- It's use can also be limited according to the condition of the patient, you might need to stabilize him first before using it. - -##### 2.2.1.14 PAK - -- Used to fully heal someone. (Removes any injury, restore vitals to a stable state and reset the medical history, clears all medication in the system.) -- It's use may be limited to a certain class and / or near a vehicle / facility. -- It's use can also be limited according to the condition of the patient, you might need to stabilize him first before using it. - -#### 2.2.2 Vitals - -##### 2.2.2.1 Blood pressure - - NOTE:the `systolic` blood pressure is the number on the left, the `diastolic` blood pressure is the number on the right. - -- Blood pressure is affected by the amount of blood lost as well as IVs and medication. - - **Non existent:** 0 - 20 `systolic`. - - **Low:** 20 - 100 `systolic`. - - **Normal:** 100 - 160 `systolic`. - - **High:** 160 and above `systolic`. - -##### 2.2.2.2 Heart rate - -- The heart rate (pulse) is affected by the amount of blood lost and medications. - - **Low:** 45 and below - - **Normal:** between 46 and 119 - - **High:** 120 and above - - -##### 2.2.2.3 Cardiac arrest - -- A patient will enter cardiac arrest when:
- - The heart rate is below 20. - - The heart rate is above 200. - - The systolic blood pressure is above 260. - - The diastolic blood pressure is below 40 and the heart rate is above 190. - - The systolic blood pressure is above 145 and the heart rate is above 150. - - -#### 2.2.3 Treating the patient -This is a step by step guide, follow the steps from 1 to 6 in order unless stated otherwise. - - -- **Step 1:** Is the patient responsive? - - **Yes:** Ask him if he has wounds / he is in pain and act accordingly. - - **No:** Go to step 2. - - -- **Step 2:** Does the patient have a pulse? - - **Yes:** Go to step 3. - - **No:** If you are alone provide CPR, if you have someone else get him to do CPR while you treat the patient's wounds. skip to step 3 or 4 depending on the situation. - - -- **Step 3:** Is the patient wounded? - - **Yes**: Treat the wounds. - - **No:** Skip this step. - - -- **Step 4:** Did the patient lose blood? - - **Yes:** Use IVs to restore the volume of liquid in the blood stream of the patient. - - **No:** Skip this step. - - -- **Step 5:** Is the patient in pain? - - **Yes and stable pulse:** Give him morphine. - - **Yes and unstable heart rate:** Stabilize the heart rate before administrating morphine. - - **No:** You're done. - - -- **Step 6:** is the patient awake now? - - **Yes:** You're done. - - **No:** Stabilize his pulse / make sure he isn't in pain or missing blood. - -Note that keeping the patient's vitals stable is very important while treating him. - -#### 2.2.4 Additional informations - -- As an infantryman you can use a tourniquet to stop a limb from bleeding, note that this is supposed to be a temporary solution and leaving the tourniquet more than 5 minutes will induce pain. -- Epinephrine should **NEVER** be used in case of cardiac arrest, it will only make the patient harder to treat afterwards or might outright kill him (remember epinephrine raises the blood pressure, a blood pressure too high is deadly). -- Pain is only suppressed and not removed by default. -- You don't have to take epinephrine after you take morphine, just wait until your pulse stabilizes by itself (Provided that you are in a stable condition). -- Giving too much morphine to a patient (more than one every 10 minutes) will put him in cardiac arrest because of a blood pressure / heart rate too low. - -## 3. Dependencies -`ace_interaction`, `ace_modules`, `ace_apl` \ No newline at end of file diff --git a/documentation/feature/microdagr.md b/documentation/feature/microdagr.md deleted file mode 100644 index a7172031f6..0000000000 --- a/documentation/feature/microdagr.md +++ /dev/null @@ -1,149 +0,0 @@ ---- -layout: wiki -title: MicroDAGR -description: A GPS device and much more -group: feature -category: equipment -parent: wiki ---- - -For an easier time reading don't forget that you can view all chapters on the right side of the page by clicking on Show/hide under table of content. - -## 1. Overview - -"Military operations rely on the position, -navigation and timing (PNT) data that GPS -can provide. In combat, the accuracy of -PNT data can mean the difference between -life and death. Non-military GPS receivers -simply aren’t good enough when lives are -on the line" (Extracted from the real life manual) - -that's where the MicroDAGR comes in, here's a list of it's features (in arma 3) : - -- Compass and headings. -- Date and hour synced to the mission. -- Elevation (above or below sea level) -- Current speed. -- GPS with topographic and satellite view. -- Creating, naming, deleting waypoints. -- Friendly identification (BLUFOR tracker need to be on) -- The MicroDAGR is also able to connect to your vector to retrieve data from it. - -## 2. Usage - -Please note that the numbers in 2.1 are going to be referred to as `1` `2` etc when explaining how to use the MicroDAGR - -### 2.1 Bringing the MicroDAGR - -- Self interact Ctrl+⊞ Win. -- Select `Equipment`. -- Select `configure MicroDAGR`. - -### 2.2 The MicroDAGR interface - - - -number | function | ------- | ----------------------------------------------------- | -`1` | Options menu and hour display. -`2` | Grid position `e` is west to east `n` is south to north. -`3` | Elevation above sea level in meters. -`4` & `11` | Compass heading. -`5` & `10` | Current speed. -`6` | Date (mission). -`7` | Main menu button. -`8` | Compass menu button. -`9` | Map menu button. -`12` | Compass -`13` | Player heading (your eyes). -`14` | Center the map on your position. -`15` | Map zoom. -`16` | Map dezoom -`17` | Your position. -`18` | Waypoint creation menu -`19` | Waypoint editing menu. -`20` | Connection menu. -`21` | Settings menu. - -### 2.3 Waypoints -#### 2.3.1 Adding waypoints -- There's three ways of adding a waypoint. - -- First way: Using the waypoint creation menu. - - Find the position you want to mark on the map. - - Get it's map grid. - - The grid is composed of 6 digits. - - The first three digits are read west to east. (Top of the map screen). - - The last three are read south to north. (Left side of the map screen). - - Go to the options menu (Click in `1` area, above the bar). - - Click on `Mark`(`18`). - - Enter the grid number. - - Press OK. - - Enter the desired name of the waypoint. - - Press OK. - -- Second way: Using the waypoint menu - - Find the position you want to mark on the map. - - Get it's map grid. - - The grid is composed of 6 digits. - - The first three digits are read west to east. (Top of the map screen). - - The last three are read south to north. (Left side of the map screen). - - Go to the options menu (Click in `1` area, above the bar). - - CLick on `Waypoints` (`19`). - - Click on `Add`. - - Enter the grid number. - - Press OK. - - Enter the name of the waypoint. - - Press OK. - -- Third way: Using the Map menu. - - Go to the map menu (click on `9`) - - double left click on the position where you want your waypoint. - - Enter the name of the waypoint. - - Press OK. - -#### 2.3.2 Setting a waypoint -- Go to the options menu (Click in `1` area, above the bar). -- CLick on `Waypoints` (`19`). -- Select the waypoint. -- Click on `SetWp`. - - -- Once a waypoint is set: - - It's heading, elevation and distance are marked on the main menu. (`7`) - - It's heading, direction, grid position and name are marked in the compass menu (`8`) - - A marker appear at the waypoint grid location in the map menu (`9`) - -#### 2.3.3 Deleting a waypoint -- Go to the options menu (Click in `1` area, above the bar). -- CLick on `Waypoints` (`19`). -- Select the waypoint. -- Click on `Delete`. - -### 2.4 Switching between mils and degrees -- Go to the options menu (Click in `1` area, above the bar). -- Click on `Settings` (`21`) -- Double left click on the unit next to `Angular unit:` - -### 2.5 Switching between topographical and satellite view - -- Go to the map menu (`9`) -- Click on the map menu button again (`9`) - -### 2.6 Retrieving data from the vector -- For this you obviously need a `vector 21`. -- Go to the options menu (Click in `1` area, above the bar). -- Click on `Connect to` (`20`). -- Pull out your `vector 21`. - - Press and hold both R and Tab ↹ until the red pointing circle appears. - - Sight the circle on the object and release both keys. -- The data on the main menu now have changed, you can now see the azimuth the range and the elevation of the point you sighted. -- Note that the compass menu also changed and now features the azimuth, compass bearing, distance and grid position of the point you sighted. - -Note that the results of the measure you took won't change until you do an other measure. - - -## 3. Dependencies - -`ace_common` diff --git a/documentation/feature/missileguidance.md b/documentation/feature/missileguidance.md deleted file mode 100644 index c718788f0c..0000000000 --- a/documentation/feature/missileguidance.md +++ /dev/null @@ -1,29 +0,0 @@ ---- -layout: wiki -title: Missile Guidance -description: -group: feature -category: realism -parent: wiki ---- - -## 1. Overview - -Adds the AMG framework, for more information about it refer to the [AMG framework documentation] ({{site.productionUrl}}/wiki/framework/advanced-missile-guidance.html) - -## 2. Usage - -### 2.1 Switching fire mode -- Press Ctrl + Tab ↹ the LED's on the right of the UI will change. -- `TOP` for top down mode. -- `DIR` for direct mode. - -### 2.2 Locking -- Fully zoom in by using NUMPAD + -- Switch to thermals by pressing N the `FLTR` LED should light up. -- Aim at the target and hold Tab ↹ a crosshair will appear and the `SEEK` LED will light up. -- Fire! - -## 3. Dependencies - -`ace_laser` diff --git a/documentation/feature/missionmodules.md b/documentation/feature/missionmodules.md deleted file mode 100644 index e96f9dcdd9..0000000000 --- a/documentation/feature/missionmodules.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -layout: wiki -title: Mission Modules -description: modules that can be used by mission makers. -group: feature -category: general -parent: wiki ---- - -## 1. Overview - -Add modules that can be used by mission makers. - -### 1.1 Ambient sounds - -That module can be used to add ambient sounds around players, it let you choose the sounds and some parameters (distance, volume interval). - -## 2. Dependencies - -`ace_common` diff --git a/documentation/feature/mk6mortar.md b/documentation/feature/mk6mortar.md deleted file mode 100644 index 691a6bc8ef..0000000000 --- a/documentation/feature/mk6mortar.md +++ /dev/null @@ -1,66 +0,0 @@ ---- -layout: wiki -title: Mk6 Mortar -description: Improve the existing mk6 mortar. -group: feature -category: equipment -parent: wiki ---- - -## 1. Overview - -### 1.1 mk6 mortar overhaul -ACE3 adds wind deflection for shells as well as a rangetable to accurately take out your target without the artillery computer. - -## 2. Usage - -### 2.1 Switching charge -- Press F (Arma 3 default key bind `Fire Mode Switch`) to switch between charges - -### 2.2 Working with the rangetable -- To open the table: - - Self interact Ctrl + ⊞ Win - - Select `equipment`. - - Select `Open 82mm Rangetable`. - -- Using the table: - - Get the distance and elevation difference between you and the target for this you can use map tools. For this example we'll say we're 2 000m away and 50m below (we're at 20m they are at 70m, 70-20=50). - - - Select the charge you want to use (0 = close / 1 = medium / 2 = far). For this case we're using charge 2. - - - Check the range column on the table, we're at 2 000 then look at the corresponding entry in the column on the right (ELEV = elevation) For this example it's 1339. - - - After that's done move by one column on the right that's the elevation for 100m heigh so in our case we're subtracting 2 (4:2 = 2) if our target was 300m above us we would have to subtract 12 from our elevation (3x4 = 12). - - - Once you finished your maths, it's time to aim, get the cross of the mortar on target, if you don't see it use a waypoint if possible. In our case ELEV is 1339-2 = 1337. - - - On the right side of the screen, while looking through the mk6 scope you should see ELV, we need to match this number with the one we found. - - To adjust the ELV use Page Up and page Down. - - Once the number you found and ELV are the same FIRE ! - - On top of that you can calculate the time the shell will take to land by using the third row from the left, in our case the shell need to travel 2000m that's 20xthe number indicated. so 20x0,5 = 10s. - -### 2.3 Working with the rangetable (Crosswinds enabled) -- Same as above there's just an extra step, I'll provide an other example in case you forgot. - - - Get the distance and elevation difference between you and the target for this you can use map tools. For this example we'll say we're 2 400m away and 223m below (we're at 2m they are at 225, 225-2=223) - - Select the charge you want to use (0 = close / 1 = medium / 2 = far). For this case we're using charge 2. - - - Check the range column on the table, we're 2 400m a then look at the corresponding entry in the column on the right (ELEV = elevation) For this example it's 1145. - - After that's done move by one column on the right that's the elevation for 100m heigh so in our case we're subtracting 22 (2,2 x 10 (2,2 because we're around 220m below)). - - Extra step needed here, a kestrel 4500 IS NEEDED. - - Pick the crosswind on your kestrel (for this refer to the kestrel documentation). - - - For this example the crosswind is of 2 MPS on my table I can see under Azimuth correction that for each 1MPS I need to correct by 2.5 mill. - - So in this case i'm subtracting 5 mill from the ELV. - - - It's MATH TIME the ELV given by the table is 1 145, we subtract 22 because of the heigh, we also subtract 5 for the crosswind ( 1 145-22-5 = 1 118 ). - - After you finished your maths, it's time to aim, get the cross of the mortar on target, if you don't see it use a waypoint if possible. In our case ELEV is 1 118. - - - On the right side of the screen, while looking through the mk6 scope you should see ELV, we need to match this number with the one we found. - - - FIREEEE !!!! - - Little advantage of having crosswind enabled is that you don't have to calculate the flight time, it's marked on the table in this case it's 33,8s. - -## 3. Dependencies - -`ace_interaction` diff --git a/documentation/feature/modules.md b/documentation/feature/modules.md deleted file mode 100644 index 1cdbe9dae4..0000000000 --- a/documentation/feature/modules.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -layout: wiki -title: Modules -group: feature -category: general -parent: wiki ---- - -## 1. Overview - -This is taking care of module initialization **DO NOT REMOVE**. - -## 2. Dependencies - -`ace_main` diff --git a/documentation/feature/movement.md b/documentation/feature/movement.md deleted file mode 100644 index cf64c40945..0000000000 --- a/documentation/feature/movement.md +++ /dev/null @@ -1,41 +0,0 @@ ---- -layout: wiki -title: Movement -description: Movement improvements -group: feature -category: realism -parent: wiki ---- - -## 1. Overview - -### 1.1 Jumping -Adds the ability to jump when pressing the vault key while moving. (V) - -### 1.2 Minor animation tweaks -Walking slowly with the weapon lowered now has a less silly looking animation. - -### 1.3 Fatigue adjustments -Soldiers get fatigued slower, but regain their stamina slower aswell. Fatigued soldiers have a faster walking speed and no longer turn into snails. - -### 1.4 Weight display -Adds a weight of the current loadout display in the inventory to estimate the fatigue gain while moving in combat. Can be adjusted to display lb. instead of kg in the ACE Options Menu. - -### 1.5 Optics view in all stances -The player can now use the sights of rifles and pistols in all prone stances. - - -## 2. Usage - -### 2.1 Jumping -- For this you need your weapon up -- While jogging or running press V - -### 2.2 Climbing -- Approach what you want to climb. -- Press ctrl + V (ACE3 default key bind `Climb`). -- Note that when climbing your character will put his weapon on his back. - -## Dependencies - -`ace_common` diff --git a/documentation/feature/mx2a.md b/documentation/feature/mx2a.md deleted file mode 100644 index c83325f575..0000000000 --- a/documentation/feature/mx2a.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -layout: wiki -title: MX-2A -description: Movement improvements -group: feature -category: equipment -parent: wiki ---- - -## 1. Overview - -Adds the MX-2A thermal imaging device. - -## 3. Dependencies - -`ace_apl` diff --git a/documentation/feature/nametags.md b/documentation/feature/nametags.md deleted file mode 100644 index 00a582c010..0000000000 --- a/documentation/feature/nametags.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -layout: wiki -title: Nametags -description: -group: feature -category: interaction -parent: wiki ---- - -## 1. Overview - -### 1.1 Nametag and rank display -Adds nametags and soldier ranks to friendly players in multiplayer. This can be adjusted in the ACE Options Menu to not display the rank, display all nametags of nearby soldiers instead of those who are looked directly at, to require a button press to show the nametags or to disable them altogether. - -### 1.2 Arma 3 VON, ACRE and TFAR soundwaves -A soundwave effect is shown when someone is speaking using either the vanilla VON, ACRE 1 or 2 and TFAR. - -## 2. Dependencies - -`ace_interaction` diff --git a/documentation/feature/nightvision.md b/documentation/feature/nightvision.md deleted file mode 100644 index 256670a8bd..0000000000 --- a/documentation/feature/nightvision.md +++ /dev/null @@ -1,28 +0,0 @@ ---- -layout: wiki -title: Nightvision -description: -group: feature -category: equipment -parent: wiki ---- - -## 1. Overview - -### 1.1 Multiple Generation NVGs -Adds different night vision devices with varying image quality and field of view. New Classnames for Generations 1, 2, and 4 NVG's (default Arma 3 NVG's represents Generation 3) and a wide view NVG. - -### 1.2 Blending effects -Adds a blending effect depending on ammunition type when firing while using a night vision device. Especially tracer rounds are bright, but you can use the IR-dim tracers from the Ballistics module to reduce tis effect. - -### 1.3 Brightness adjustment -Enables the user to manually adjust NVG brightness. - -## 2. Usage - -### 2.1 Adjusting brightness -- Use ALT + PageUP and ALT + PageDOWN to adjust NVG brightness (ACE3 default key bind `Increase/Decrease NVG Brightness`). - -## 3. Dependencies - -`ace_common` diff --git a/documentation/feature/noidle.md b/documentation/feature/noidle.md deleted file mode 100644 index b57455315c..0000000000 --- a/documentation/feature/noidle.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -layout: wiki -title: No Idle -description: Disables idle animations -group: feature -category: interaction -parent: wiki ---- - -## 1. Overview - -### 1.1 Idle animations removed - -This removes idle animations. - -## 2. Dependencies - -`ace_common` diff --git a/documentation/feature/noradio.md b/documentation/feature/noradio.md deleted file mode 100644 index a3ee167c32..0000000000 --- a/documentation/feature/noradio.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -layout: wiki -title: No Radio -description: Disable callouts -group: feature -category: interaction -parent: wiki ---- - -## 1. Overview - -### 1.1 Silent avatar -Mutes the player's automatic callouts ("Enemy man, 100 meters, front!"). -Does not mute AI callouts. - -## 2. Dependencies - -`ace_common` diff --git a/documentation/feature/norearm.md b/documentation/feature/norearm.md deleted file mode 100644 index 0b5f00d28b..0000000000 --- a/documentation/feature/norearm.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -layout: wiki -title: No Rearm -description: Remove rearm from -group: feature -category: interaction -parent: wiki ---- - -## 1. Overview - -Hides the rearm action for players (on cars / boxes / corpses / ground) - -## 2. Dependencies - -`ace_common` diff --git a/documentation/feature/optics.md b/documentation/feature/optics.md deleted file mode 100644 index 2602d98d98..0000000000 --- a/documentation/feature/optics.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -layout: wiki -title: Optics -description: 2D and PIP optics -group: feature -category: equipment -parent: wiki ---- - -## 1. Overview - -Adds animated 2D and PIP variants of some optics (RCO / MRCO / ARCO / LRPS / MOS) - -## 2. Dependencies - -`ace_common` diff --git a/documentation/feature/optionsmenu.md b/documentation/feature/optionsmenu.md deleted file mode 100644 index 345bb81af8..0000000000 --- a/documentation/feature/optionsmenu.md +++ /dev/null @@ -1,28 +0,0 @@ ---- -layout: wiki -title: Options Menu -description: ACE3 options menu -group: feature -category: interaction -parent: wiki ---- - -## 1. Overview - -Adds the options menu used by other components. - -## 2. Usage - -### 2.1 Opening the user menu -- Press Escape -- In the top left corner of the screen you should see `ACE Options`. -- Click it. - -### 2.2 Options menu informations -- You don't have to press a save button. When a setting is changed it's saved automatically. - -## 3. Dependencies - -`ace_common` - -*Note: The Options Menu module is utilized by many other modules. Disabling it is not recommended.* diff --git a/documentation/feature/overheating.md b/documentation/feature/overheating.md deleted file mode 100644 index ff2e6c6778..0000000000 --- a/documentation/feature/overheating.md +++ /dev/null @@ -1,43 +0,0 @@ ---- -layout: wiki -title: Overheating -description: Weapon temperature and jamming, barrel swapping. -group: feature -category: realism -parent: wiki ---- - -## 1. Overview - -### 1.1 Weapon Jamming -Adds a probability to jam a weapon when firing. Jams can be cleared by reloading or by using the clear jam-key. - -### 1.2 Temperature simulation -Introduces weapon temperature simulation depending on weapon and bullet mass. Hot weapons are more prone to jamming. Depending on weapon type the accuracy and in extreme cases the muzzle velocity might be reduced on high temperatures. Adds smoke puff and heat refraction effects to indicate this. - -### 1.3 Spare barrels -Adds the ability to changes barrels on machine guns to compensate for those effects. - - -## 2. Usage - -### 2.1 Clearing a jammed weapon -- To clear a jammed weapon, press SHIFT + R (ACE3 default key bind `Clear jam`). - -### 2.2 Swapping barrels -- For this you need a `Spare barrel` and a compatible weapon. -- Press self interaction Ctrl + ⊞ Win (ACE3 default key bind `Self Interaction Key`). -- Select `Equipment`. -- Select `Swap barrel`. - -### 2.3 Checking your barrel temperature -- Press self interaction Ctrl + ⊞ Win. -- Select `Equipment`. -- Select `Check weapon temperature`. - -**NOTE** When the bar is half full (yellow) it means the barrel is around 500°c. -Your weapon will be even more prone to jams, and it'll get worse if you don't let the barrel cool down or swap it. - -## 3. Dependencies - -`ace_interaction` diff --git a/documentation/feature/overpressure.md b/documentation/feature/overpressure.md deleted file mode 100644 index 77d16145d8..0000000000 --- a/documentation/feature/overpressure.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -layout: wiki -title: Overpressure -description: backblast and overpressure -group: feature -category: realism -parent: wiki ---- - -## 1. Overview - -### 1.1 Overpressure -Adds backblast to AT launchers and overpressure zones to tank cannons, don't stay behind a firing RPG or it'll hurt. - -## 2. Dependencies - -`ace_common` diff --git a/documentation/feature/parachute.md b/documentation/feature/parachute.md deleted file mode 100644 index 39f353f08b..0000000000 --- a/documentation/feature/parachute.md +++ /dev/null @@ -1,36 +0,0 @@ ---- -layout: wiki -title: Parachute -description: Add an altimeter and a non-steerable parachute -group: feature -category: equipment -parent: wiki ---- - -## 1. Overview - -### 1.1 Altimeter -Removes the altitude and descend speed UI elements when free-falling and parachuting on higher difficulties. Adds an altimeter watch type item. - -### 1.2 Non-steerable parachute -Adds a non-steerable parachute variant for jet pilots. - -### 1.3 Parachute cutting and reserve parachutes -You are now able to cut parachutes and deploy a reserve one. - -### 1.4 Landing animation -Smoothens the parachute landing animation. - -## 2. Usage - -### 2.1 bringing up the altimeter -- For this you need to have an `Altimeter Watch` in the watch slot. -- Press O (Arma 3 default key bind `Watch`) to bring up the altimeter. - -### 2.2 Cutting a parachute -- While falling with a parachute deployed open the self interaction menu Ctrl+⊞ Win (ACE3 default). -- Select `Cut Parachute` - -## 3. Dependencies - -`ace_common` diff --git a/documentation/feature/protection.md b/documentation/feature/protection.md deleted file mode 100644 index a0efe09e05..0000000000 --- a/documentation/feature/protection.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -layout: wiki -title: Protection -description: Tweaks armor values -group: feature -category: realism -parent: wiki ---- - -## 1. Overview - -### 1.1 Tweaked protection values -Fixes and tweaks the protection values of body armour, helmets and uniforms. - -## 2. Dependencies - -`ace_common` diff --git a/documentation/feature/ragdolls.md b/documentation/feature/ragdolls.md deleted file mode 100644 index 603dd13691..0000000000 --- a/documentation/feature/ragdolls.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -layout: wiki -title: Ragdolls -description: Changes the ragdolls to react more to the force of shots and explosions. -group: feature -category: realism -parent: wiki ---- - -## 1. Overview - -### 1.1 Adjusted Ragdolls -Changes the ragdolls to react more to the force of shots and explosions. - -## 2. Dependencies - -`ace_common` diff --git a/documentation/feature/rangecard.md b/documentation/feature/rangecard.md deleted file mode 100644 index 7f3a49251c..0000000000 --- a/documentation/feature/rangecard.md +++ /dev/null @@ -1,32 +0,0 @@ ---- -layout: wiki -title: Rangecard -description: Adds a range card for your weapons -group: feature -category: equipment -parent: wiki ---- - -## 1. Overview - -Add a range card that updates itself for your weapon and the type of ammo you're using. - -## 2. Usage - -### 2.1 Opening the range card -- Open the self interaction menu Ctrl + ⊞ Win -- Select `Equipment` -- Select `Open Range Card` - -### 2.2 Using the range card -- To use this to it's full potential the use of a `Vector 21` is strongly recommended, a `Kestrel 4500` will also help. - -- Pull out your rangefinder (`Vector 21` preferred) and get the distance between you and your target. - -- Open your rangetable and look under the `Target range` column. - -- Move to the `Bullet Drop` column, the drop is in MRADs, you need to compensate for it by adjusting your sight. Example, you want to adjust for a bullet drop of -7.9 MRADs simply adjust your scope 7.9 MRADs vertically. (check [feature scopes](http://ace3mod.com/wiki/feature/scopes.html) ) for this. - -## 3. Dependencies - -`ACE_Advanced_Ballistics` diff --git a/documentation/feature/realisticnames.md b/documentation/feature/realisticnames.md deleted file mode 100644 index 2ec556bfea..0000000000 --- a/documentation/feature/realisticnames.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -layout: wiki -title: Realistic Names -description: More realistic weapon names -group: feature -category: realism -parent: wiki ---- - -## 1. Overview - -### 1.1 Real names -Changes the names of vehicles, magazines, weapons, grenades, explosive charges and mines to their respective real-world counterparts whenever possible. - -## 2. Dependencies - -`ace_common` diff --git a/documentation/feature/recoil.md b/documentation/feature/recoil.md deleted file mode 100644 index fd34686012..0000000000 --- a/documentation/feature/recoil.md +++ /dev/null @@ -1,23 +0,0 @@ ---- -layout: wiki -title: Recoil -description: Recoil overhaul -group: feature -category: realism -parent: wiki ---- - -## 1. Overview - -### 1.1 Recoil adjustment -Overhauls the recoil system reducing upwards recoil. - -### 1.2 Advanced cam shake -Introducing camshake when firing on foot or as vehicle gunner depending on stance and weapon type. - -### 1.3 Burst dispersion -Firing in longer burst (> 3 rounds per burst) slightly reduces the accuracy. Firing machine guns in bursts is now useful. - -## 2. Dependencies - -`ace_common` diff --git a/documentation/feature/reload.md b/documentation/feature/reload.md deleted file mode 100644 index 2c23fadb29..0000000000 --- a/documentation/feature/reload.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -layout: wiki -title: Reload -description: -group: feature -category: interaction -parent: wiki ---- - -## 1. Overview - -### 1.1 Ammo count -Hides the actual round count of magazines and removes the icon when the current magazine is emptied. The player can instead check the magazine weight, but that gives only estimated values for magazines with more than 10 rounds. - -## 2. Usage - -### 2.1 Checking your ammo -- Press Ctrl + R (ACE3 default key bind `Check Ammo`). - -## 3. Dependencies - -`ace_interaction` diff --git a/documentation/feature/reloadlaunchers.md b/documentation/feature/reloadlaunchers.md deleted file mode 100644 index 16bed1b541..0000000000 --- a/documentation/feature/reloadlaunchers.md +++ /dev/null @@ -1,23 +0,0 @@ ---- -layout: wiki -title: Reload Launchers -description: -group: feature -category: interaction -parent: wiki ---- - -## 1. Overview - -Add the ability to reload someone else's launcher. - -### 2. Usage - -### 2.1 Reloading someone else's launcher -- Press the interaction key ⊞ Win and aim at your buddy's launcher. -- Select `reload launcher`. -- Select the type of ammo. - -## 3. Dependencies - -`ace_interaction` diff --git a/documentation/feature/respawn.md b/documentation/feature/respawn.md deleted file mode 100644 index 90d6b0d68d..0000000000 --- a/documentation/feature/respawn.md +++ /dev/null @@ -1,33 +0,0 @@ ---- -layout: wiki -title: Respawn -description: Same gear on respawn, FF message, rallypoints -group: feature -category: interaction -parent: wiki ---- - -## 1. Overview - -### 1.1 Respawn with same gear -Requires the Respawn Gear module to be placed. Respawned soldiers now have their loadout when killed. - -### 1.2 Friendly Fire messages -Shows friendly fire warnings in system chat if the module is placed. Works even in higher difficulties where kill messages are normally disabled. - -### 1.3 Rallypoints -Adds rallypoints to all 3 sides to enable teleportation from base spawn to FOB's. Requires some setup from the mission maker. - - -## 2. Usage - -### 2.1 Using rallypoints -- For this to work pre-emptive preparations need to be made by the mission maker. -- Approach the rallypoint flagpole -- Use the interaction key ⊞ Win (ACE3 default key bind `Interaction key`). -- Select teleport to (base / rallypoint). - - -## 3. Dependencies - -`ace_common` diff --git a/documentation/feature/safemode.md b/documentation/feature/safemode.md deleted file mode 100644 index 5065fb717c..0000000000 --- a/documentation/feature/safemode.md +++ /dev/null @@ -1,23 +0,0 @@ ---- -layout: wiki -title: Safe Mode -description: Introduce safe mode -group: feature -category: equipment -parent: wiki ---- - -## 1. Overview - -### 1.1 Safety -You can now use the safety mode of any weapon. Switching weapon modes takes the safety off. - -## 2. Usage - -### 2.1 Switching safety on / off -- To turn it on press Ctrl + ` (QWERTY layout) (ACE3 default key bind `Safe Mode`). -- To turn it off press Ctrl + ` (QWERTY layout) again or switch firing mode. - -## 3. Dependencies - -`ace_common` diff --git a/documentation/feature/sandbags.md b/documentation/feature/sandbags.md deleted file mode 100644 index dbe450eb31..0000000000 --- a/documentation/feature/sandbags.md +++ /dev/null @@ -1,26 +0,0 @@ ---- -layout: wiki -title: Sandbags -description: Adds stackable sandbags -group: feature -category: equipment -parent: wiki ---- - -## 1. Overview - -Adds stackable sandbags able to block bullets, shrapnel and small explosions. -Note that those sandbags are affected by physics, a rocket will send them flying. - -## 2. Usage - -### 2.1 Placing the sandbags -- You'll need at least one `sandbag (empty)`. -- You need to be over a grass area / sand area to be able to fill the sandbag. -- Self interact Ctrl+⊞ Win (ACE3 default). -- Select `Deploy sandbag`. -- Follow the instruction on screen. - -## 3. Dependencies - -`ace_interaction` diff --git a/documentation/feature/scopes.md b/documentation/feature/scopes.md deleted file mode 100644 index 359f5a8bf6..0000000000 --- a/documentation/feature/scopes.md +++ /dev/null @@ -1,32 +0,0 @@ ---- -layout: wiki -title: Scopes -description: Scope adjustment -group: feature -category: equipment -parent: wiki ---- - -## 1. Overview - -### Sniper Scope Adjustment -Allows snipers to adjust their scopes horizontally and vertically in mils. - -## 2. Usage - -### 2.1 Adjusting your scope vertically -Please not that the following key combinations are ACE3 default key binds. -- Minor adjustment up Page Up. -- Minor adjustment down page Down. -- Major adjustment up ⇧ Shift + Page Up. -- Major adjustment down ⇧ Shift + page Down. - -### 2.2 Adjusting your scope horizontally -- Minor adjustment right Ctrl + Page Up. -- Minor adjustment left Ctrl + page Down. -- Major adjustment right Ctrl + ⇧ Shift + Page Up. -- Major adjustment left Ctrl + ⇧ Shift + page Down. - -## 3. Dependencies - -`ace_common` diff --git a/documentation/feature/sitting.md b/documentation/feature/sitting.md deleted file mode 100644 index aee2ee859d..0000000000 --- a/documentation/feature/sitting.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -layout: wiki -title: Sitting -description: -group: feature -category: interaction -parent: wiki ---- - -## 1. Overview -Adds the ability to sit on chairs. - -## 2. Usage -Please note that to be able to use this function the sitting module need to be placed down (or set to 1 in the server config) - -### 2.1 How to sit / stand up -- Look at the chair and press the interaction key Ctrl+⊞ Win (ACE3 default). -- Select `Sit Down`. -- To stand up press the self interaction key ⊞ Win (ACE3 default) and select `Stand Up`. - -## 3. Dependencies -`ace_interaction` \ No newline at end of file diff --git a/documentation/feature/slideshow.md b/documentation/feature/slideshow.md deleted file mode 100644 index 0ff2372064..0000000000 --- a/documentation/feature/slideshow.md +++ /dev/null @@ -1,23 +0,0 @@ ---- -layout: wiki -title: Slideshow -group: feature -category: interaction -parent: wiki ---- - -## 1. Overview -This adds the ability to have images shown on some objects and have other objects being used as remotes. -Please note that only objects with hiddenSelection 0 can be used to render images (whiteboard, TV, PC Screen being the most notable examples). - -## 2. Usage -Note that this sections is for users, for mission makers refer to [the entry in mission-tools](../missionmaker/mission-tools.html) -Also if no remotes are defined the "screen" object itself becomes the remote. - -### 2.1 Switching between images -- Look at the object used as a remote and use the interaction menu ⊞ Win (ACE3 default). -- Select the action that correspond to the image you want (the name of the action depends on the mission maker). - -## 3. Dependencies - -`ace_common` \ No newline at end of file diff --git a/documentation/feature/smallarms.md b/documentation/feature/smallarms.md deleted file mode 100644 index ffa905eacf..0000000000 --- a/documentation/feature/smallarms.md +++ /dev/null @@ -1,23 +0,0 @@ ---- -layout: wiki -title: Small Arms -description: Various improvements to small arms -group: feature -category: realism -parent: wiki ---- - -## 1. Overview - -### 1.1 Magazine Names -Unifies the name formatting of magazines similar to Arma 2 standards. - -### 1.2 No tracers in non-tracer mags -Assault rifles no longer have tracer rounds in their non-tracer magazines. This doesn't effect the additional tracers in the last rounds of machine gun magazines. - -### 1.3 Real magazine round counts -All pistol and sub machine gun magazines now have adjusted capacities to match their real life counterparts. - -## 2. Dependencies - -`ace_common` diff --git a/documentation/feature/spectator.md b/documentation/feature/spectator.md deleted file mode 100644 index 438d731c3e..0000000000 --- a/documentation/feature/spectator.md +++ /dev/null @@ -1,375 +0,0 @@ ---- -layout: wiki -title: Spectator -description: A flexible spectator system -group: feature -category: interaction -parent: wiki ---- - -
-
Please note:
-

This is not part of ACE3 yet. It will be released in a future version.

-
- -## 1. Overview - -The ACE3 spectator system is designed to act as a flexible and easy to configure framework. Most scenarios can be set up as desired using only the settings provided, however public functions are available for finer control of these configurable aspects. - -### 1.1 Spectator System - -The current iteration of the ACE3 spectator system only officially supports scenarios using [respawn type](https://community.bistudio.com/wiki/Arma_3_Respawn#Respawn_Types) 3 (or "BASE"). However there's nothing to stop its use alongside anything else, just be aware that it might not function entirely as expected. - -By default, the ACE3 spectator system does nothing - meaning existing missions will behave exactly as before. The setting `ace_spectator_onDeath` can be used to automatically put players into spectator mode each time they die. - -For mission makers who seek a more advanced setup (such as multiple lives or wave respawning) the function `ace_spectator_fnc_setSpectator` is provided to transition players to/from spectator mode as desired: - -``` - * Arguments: - * 0: Unit to put into spectator state - * 1: New spectator state - * - * Return Value: - * None - * - * Example: - * [player, true] call ace_spectator_fnc_setSpectator -``` - -### 1.2 Spectatable Units - -Spectatable units are stored in an automatically maintained list (`ace_spectator_unitList`) on each client. However, directly accessing this list is not encouraged. Instead mission makers have two tools at their disposal to tweak the list: - -- Unit filter -- Unit whitelist/blacklist - -The unit filter determines which units will automatically be used to populate the spectatable unit list. It's controlled by setting `ace_spectator_filterUnits` and there are three possible options: - -- **No units** -- **Player units** *(default)* -- **All units** - -In cases where more specific control is required function `ace_spectator_fnc_updateUnits` can be used to whitelist units from the filter or blacklist them from the list (on the local client): - -``` - * Arguments: - * 0: Units to add to the whitelist - * 1: Use blacklist - * - * Return Value: - * None - * - * Example: - * [allUnits,true] call ace_spectator_fnc_updateUnits - * -``` - -### 1.3 Spectatable Sides - -Spectatable sides can simply be considered an extra layer of filtering for the spectatable unit list. Again, there are two methods of controlling the spectatable sides: - -- Side filter -- Side list - -The side list is exactly what it sounds like, a list of sides spectatable by the local client. However, unlike spectatable units the side list remains static and can only be updated manually. This is because the side filter is applied on top of the side list whenever the unit list is automatically maintained - meaning the unit list will update if the player changes side or if the side relations change. - -Note that the unit whitelist/blacklist also serves to override this side filtering mechanism. - -The default side list is `[west,east,resistance,civilian]` and to update it (on the local client) function `ace_spectator_fnc_updateSpectatableSides` can be used: - -``` - * Arguments: - * 0: Sides to add - * 1: Sides to remove - * - * Return Value: - * Spectatable sides - * - * Example: - * [[west], [east,civilian]] call ace_spectator_fnc_updateSpectatableSides -``` - -The side filter determines which sides from the side list are valid each time the unit list is updated. It's controlled by setting `ace_spectator_filterSides` and there are four possible options: - -- **Player side** *(default)* -- **Friendly sides** -- **Hostile sides** -- **All sides** - -### 1.4 Camera Modes - -There are 3 possible camera modes: - -- **Free** -- **Internal** -- **External** - -Mission makers can control the camera modes available to spectators via the setting `ace_spectator_restrictModes`. Function `ace_spectator_fnc_updateCameraModes` is also provided to alter the available modes (to the local player) as desired at any point in the mission: - -``` - * Arguments: - * 0: Camera modes to add - * 1: Camera modes to remove - * - * Return Value: - * Available camera modes - * - * Example: - * [[0], [1,2]] call ace_spectator_fnc_updateCameraModes -``` - -### 1.5 Vision Modes - -Vision modes are only available in free camera mode. By default there are 4 available vision modes: - -- **Normal** -- **Night vision** -- **Thermal imaging (white hot)** -- **Thermal imaging (black hot)** - -Mission makers can control which of these vision modes are available to spectators via the setting `ace_spectator_restrictVisions`. However, there are actually a total of 10 possible vision modes and function `ace_spectator_fnc_updateVisionModes` can be used to alter which of them are available (to the local player) at any point in the mission: - -``` - * Possible vision modes are: - * - -2: Normal - * - -1: Night vision - * - 0: White hot - * - 1: Black hot - * - 2: Light Green Hot / Darker Green cold - * - 3: Black Hot / Darker Green cold - * - 4: Light Red Hot / Darker Red Cold - * - 5: Black Hot / Darker Red Cold - * - 6: White Hot / Darker Red Cold - * - 7: Thermal (Shade of Red and Green, Bodies are white) - * - * Arguments: - * 0: Vision modes to add - * 1: Vision modes to remove - * - * Return Value: - * Available vision modes - * - * Example: - * [[0], [1,2]] call ace_spectator_fnc_updateVisionModes -``` - -### 1.6 Camera Attributes - -The spectator camera has 8 manipulatable attributes: - -- **Camera mode:** The camera view -- **Camera unit:** The unit used for internal and external view -- **Camera vision:** The vision mode used by the free camera -- **Camera position:** The position of the free camera -- **Camera pan:** The pan (direction/heading) of the free camera -- **Camera tilt:** The tilt (pitch) of the free camera -- **Camera zoom:** The zoom level of the free camera -- **Camera speed:** The movement speed of the free camera - -Function `ace_spectator_fnc_setCameraAttributes` can be used to change any of these attributes at ay point (including before spectator has ever opened): - -``` - * Arguments: - * 0: Camera mode - * - 0: Free - * - 1: Internal - * - 2: External - * 1: Camera unit (objNull for random) - * 2: Camera vision - * - -2: Normal - * - -1: Night vision - * - 0: Thermal white hot - * - 1: Thermal black hot - * 3: Camera position (ATL) - * 4: Camera pan (0 - 360) - * 5: Camera tilt (-90 - 90) - * 6: Camera zoom (0.01 - 2) - * 7: Camera speed in m/s (0.05 - 10) - * - * Return Value: - * None - * - * Example: - * [1, objNull] call ace_spectator_fnc_setCameraAttributes -``` - -## 2. Usage - -### 2.1 Spectator Shortcuts - -Shortcuts are currently hardcoded in the ACE3 spectator system. Future versions are likely to change that. - -#### 2.1.1 Interface Shortcuts - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ShortcutAction
HToggle help
MToggle map
1Toggle unit list
2Toggle toolbar
3Toggle compass
4Toggle unit icons
BackspaceToggle interface
- -#### 2.1.2 Free Camera Shortcuts - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ShortcutAction
WCamera forward
SCamera backward
ACamera left
DCamera right
QCamera up
ZCamera down
LMBCamera dolly
RMBCamera pan and tilt
ScrollwheelZoom +/-
Ctrl+ScrollwheelSpeed +/-
NNext vision mode
Ctrl+NPrevious vision mode
- -#### 2.1.3 Unit Camera Shortcuts - - - - - - - - - - - - - - - - - - - - - - -
ShortcutAction
Right arrowNext unit
Left arrowPrevious unit
RMBToggle gun camera
- -#### 2.1.4 General shortcuts - - - - - - - - - - - - - - - - - - -
ShortcutAction
Up arrowNext camera
Down arrowPrevious camera
- -### 2.2 The Interface - -#### 2.2.1 Unit list - -The unit list on the left lists all of the units currently available to spectate. -Double click on any unit name in the list to switch to the unit. -Double click on the current unit to switch between internal and external view. - -#### 2.2.2 Toolbar - -The toolbar along the bottom of the screen displays various useful values. From left to right these are: - -- Unit name -- Camera mode -- Camera zoom/Unit side -- 24-hour Clock -- Vision mode/Unit depth -- Camera/Unit speed - -#### 2.2.3 Map - -The map overlay will show the current position of the free camera and all spectatable units. The unit icons are tied into the unit icon toggle shortcut. When spectating a unit the map will also show the icons of units it knows about. In free camera you can double click on the map to teleport the camera to the position of the mouse. - -## 3. Dependencies - -`ace_common` diff --git a/documentation/feature/spotting-scope.md b/documentation/feature/spotting-scope.md deleted file mode 100644 index c0c79fb1ad..0000000000 --- a/documentation/feature/spotting-scope.md +++ /dev/null @@ -1,23 +0,0 @@ ---- -layout: wiki -title: Spotting scope -description: Adds a deployable spotting scope -group: feature -category: equipment -parent: wiki ---- - -## 1. Overview - -Adds a deployable spotting scope. - -## 2. Usage - -### 2.1 Deploying the spotting scope -- Self interact Ctrl+⊞ Win (ACE3 default). -- Select `Equipment`. -- Select `Place spotting scope` (note that the scope will be at your feet). - -## 3. Dependencies - -`ace_apl` , `ace_interaction` diff --git a/documentation/feature/switchunits.md b/documentation/feature/switchunits.md deleted file mode 100644 index da45041fb4..0000000000 --- a/documentation/feature/switchunits.md +++ /dev/null @@ -1,30 +0,0 @@ ---- -layout: wiki -title: Switch Units -description: -group: feature -category: interaction -parent: wiki ---- - -## 1. Overview - -### 1.1 Switch units - -"ACE SwitchUnits" is a tool for mission makers to quickly add PvP (Player vs. Player) elements to a mission. In short it enables a player to control AI units. Allowing players to perform as enemies even during a COOP mission increases the authenticity of the enemy and thus the immersion for everyone. - -The most prominent feature of ACE SwitchUnits is that you can add it to nearly every existing mission and get AI control out of the box. Dynamic mission like "Enemy Assault", "Patrol Ops", "Invade & Annex", etc. don't need to be touched to make all random spawned AI's controllable. - -In its current form you're able to switch to infantry (vehicles, etc. are planned) from all four sides (West, East, Independent, Civilian). - -## 2. Usage - -### 2.1 Switching to a unit -- Open your map -- Find a unit you can access (they are showed with special icons and names on the map). -- Press LMB on the desired unit. -- You'll control that unit until it dies or until you switch to an other one. If the unit dies you'll be brought back to your original unit.. - -## 3. Dependencies - -`ace_common` diff --git a/documentation/feature/tacticallader.md b/documentation/feature/tacticallader.md deleted file mode 100644 index efc05fccf9..0000000000 --- a/documentation/feature/tacticallader.md +++ /dev/null @@ -1,23 +0,0 @@ ---- -layout: wiki -title: Tactical ladder -description: Adds a deployable ladder with adjustable height that you can transport on your back. -group: feature -category: equipment -parent: wiki ---- - -## 1. Overview - -Adds a deployable ladder with adjustable height that you can transport on your back. - -## 2. Usage - -### 2.1 Deploying the ladder -- Self interact Ctrl+⊞ Win (ACE3 default). -- Select `Deploy ladder`. -- You can adjust it's position and height by interacting with it ⊞ Win (ACE3 default) and following the instructions on screen. - -## 3. Dependencies - -`ace_apl` , `ace_interaction` diff --git a/documentation/feature/testmissions.md b/documentation/feature/testmissions.md deleted file mode 100644 index a49ff963b0..0000000000 --- a/documentation/feature/testmissions.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -layout: wiki -title: Test Missions -description: Adds an ACE3 Test Missions -group: feature -category: general -parent: wiki ---- - -## 1. Overview - -Adds an ACE3 Test Missions - -## 2. Dependencies - -`ace_common` diff --git a/documentation/feature/thermals.md b/documentation/feature/thermals.md deleted file mode 100644 index 051bbc8241..0000000000 --- a/documentation/feature/thermals.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -layout: wiki -title: Thermals -description: -group: feature -category: equipment -parent: wiki ---- - -## 1. Overview - -### 1.1 Body Warmth -Adjusts the thermal properties of humans making them less like torches. - -## 2. Dependencies - -`ace_common` diff --git a/documentation/feature/tripod.md b/documentation/feature/tripod.md deleted file mode 100644 index 06d8fc0b4a..0000000000 --- a/documentation/feature/tripod.md +++ /dev/null @@ -1,26 +0,0 @@ ---- -layout: wiki -title: Tripod -description: Adds a packable tripod deployable on the field -group: feature -category: equipment -parent: wiki ---- - -## 1. Overview - -Adds a packable tripod deployable on the field. It features a flat part to deploy your weapon on and adjustable legs. - -## 2. Usage - -### 2.1 deploying the tripod -- Note that you need a `SSWT kit` in your inventory. -- Self interact Ctrl+⊞ Win. -- Select `Equipment` -- Select `Place SSWT kit`. - -To adjust or pick up the tripod just interact with it ⊞ Win and select the desired action. - -## 3. Dependencies - -`ace_interaction` diff --git a/documentation/feature/ui.md b/documentation/feature/ui.md deleted file mode 100644 index b079773d60..0000000000 --- a/documentation/feature/ui.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -layout: wiki -title: UI -description: -group: feature -category: general -parent: wiki ---- - -## 1. Overview - -Changes the chat contrast on the map to allow easier reading. - -## 2. Dependencies - -`ace_common` diff --git a/documentation/feature/vector.md b/documentation/feature/vector.md deleted file mode 100644 index 1dbd11001d..0000000000 --- a/documentation/feature/vector.md +++ /dev/null @@ -1,85 +0,0 @@ ---- -layout: wiki -title: Vector -description: Adds a realistic depiction of the Vector 21 rangefinder -group: feature -category: equipment -parent: wiki ---- - -## 1. Overview - -### 1.1 Vector 21 Rangefinder -ACE3 adds a realistic depiction of the Vector 21 rangefinder to the game. Unlike other rangefinders, it doesn't just magically show you the range to your target, but in exchange allows you to do alot of things with it that the other choices in Arma do not offer. The Vector's functions include, but are not limited to: - -- Distance to a target -- Azimuth to a target -- Horizontal and vertical distance to a target -- Distance between 2 targets -- Angle between 2 targets -- Switching between feet and meters -- Switching between degrees and mils -... - -## 2. Usage - -The Vector is controlled with 2 keys: the azimuth key and the range key; Tab and R and is brought up like any other binoculars. - -#### 2.1 Slope distance -Measuring Slope distance - -- Press and hold R until the red pointing circle appears. Sight the circle on the object and release the key. - -#### 2.2 Azimuth -Measuring Azimuth - -- Press and hold the Tab ↹ until the azimuth is displayed. - -#### 2.3 Slope distance and Azimuth -Measuring Slope distance and Azimuth - -- Press and hold both R and Tab ↹ until the red pointing circle appears. -- Sight the circle on the object and release both keys. - -#### 2.4 Horizontal distance and height difference -Measuring Horizontal distance and height difference - -- Tap R once then press and hold it until the red pointing circle appears. -- Sight the circle on the object and release the key. - -#### 2.5 Azimuth and Inclination -Measuring Azimuth and Inclination - -- Tap Tab ↹ once then press and hold it until the azimuth and inclination is displayed. - -#### 2.6 Distance between two points -Measuring Distance between two points - -- Press and hold R until the red pointing circle appears. -- Sight the circle on the first object and tap Tab ↹ while further holding R. The first measurement is confirmed ("1-P" = first point). -- Sight the second object and release R. - -#### 2.7 Horizontal and vertical distance between two points -Measuring Horizontal and vertical distance between two points - -- Tap R once then press and hold it until the red pointing circle appears. -- Sight the circle on the object and tap Tab ↹ once. The first measurement is confirmed ("1-P" = first point). -- Sight the second object and release R. - -#### 2.8 Horizontal distance and azimuth between two points -Measuring Horizontal distance and azimuth between two points - -- Press and hold Tab ↹ until the azimuth appears. -- Sight the circle on the first object and tap R while further holding Tab ↹. The first measurement is confirmed ("1-P" = first point). -- Sight the second object and release Tab ↹. - -### 2.9 Fall of shot -Measuring Fall of shot - -- Tap Tab ↹ once then press and hold it until the azimuth appears. -- Sight the circle on the object and tap R while further holding Tab ↹. The first measurement is confirmed ("1-P" = first point). -- Sight the Fall of shot and release Tab ↹. The left digits display the left (`L`)/right (`r`) correction value in meter and the right digits display the longer (`A` = add)/shorter (`d` = drop) correction value in meter. If R is tapped the height correction values will be displayed (`UP` and `dn`). - -## 3. Dependencies - -`ace_common` diff --git a/documentation/feature/vehiclelock.md b/documentation/feature/vehiclelock.md deleted file mode 100644 index c4162ace7b..0000000000 --- a/documentation/feature/vehiclelock.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -layout: wiki -title: Vehicle Lock -description: The vehicle lock module enables locking vehicles and their inventory -group: feature -category: interaction -parent: wiki ---- - -## 1. Overview -This feature adds the ability to lock and unlock vehicles and their inventory using a key, as well as picking locks of locked vehicles. It's disabled by default. - -## 2. Usage -Locking, unlocking and picking vehicle locks is possible via the ACE Interact menu. - -
-
Note:
-

Different locking modes can be set, consult with your mission maker for more information.

-
- -## 3. Dependencies -`ace_interaction` diff --git a/documentation/feature/vehicles.md b/documentation/feature/vehicles.md deleted file mode 100644 index 5575a457fc..0000000000 --- a/documentation/feature/vehicles.md +++ /dev/null @@ -1,51 +0,0 @@ ---- -layout: wiki -title: Vehicles -description: -group: feature -category: realism -parent: wiki ---- - -## 1. Overview - -### 1.1 Speed limiter -Adds ability to limit the max. speed of any vehicle. - -### 1.2 Engine start delay -The engine has to be started before the vehicle can move. Starting the engine takes aprox. 1 to 2 seconds. - -### 1.3 Fuel capacity -The range of all vehicle gets significantly reduced to reflect ranges of their real life counterparts. Scaled down to match the relative short distances in Arma 3. A full vehicle on mission start should still most likely never need a refueling during a mission. - -### 1.4 Main gun muzzles -APC's and tanks now share a muzzle for all ammunition types of their main guns. This prevents an exploit that skips the reloading time of a round or clip while changing the ammunition type. Also makes it possible to switch between ammunition types using the scroll wheel like in Arma 2. - -### 1.5 Boat machine gun tracers -NATO and AAF armed boats now use their respective tracer colours like any vehicle when they fire their rear gun. (Red for Blufor, yellow for Indep) - -### 1.6 Improved smoke launcher of Fennek (Strider) -Reduced smoke shell count and launch angle of the AAF Fennek to match the models smoke launcher. - -### 1.7 Stabilized optic of Fennek (Strider) -Stabilizes the commander's view in the Fennek (Strider). - -### 1.8 Vehicle mounted machine guns ROF -The rate of fire of vehicle mounted miniguns and machine guns is adjusted to match real life values. - -### 1.9 120mm gun and mortar behaviour -MBT main guns and mortars can no longer lock on enemies. The AT rounds of both now have raised cost values to encourage the AI to not use those rounds against foot soldiers over their machine guns or HE rounds. - -## 2. Usage - -### 2.1 Turning the engine on / off -- To turn the engine on press 2. -- To turn the engine off press 1. - -### 2.2 Turning the speed limiter on / off -- To turn the speed limiter on press Del. -- To turn it off press Del again. - -## 3. Dependencies - -`ace_common` diff --git a/documentation/feature/viewdistance.md b/documentation/feature/viewdistance.md deleted file mode 100644 index 5c9bd3a815..0000000000 --- a/documentation/feature/viewdistance.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -layout: wiki -title: View Distance -description: The view distance module adds extra view distance settings -group: feature -category: interaction -parent: wiki ---- - -## 1. Overview -ACE3 View Distance adds the ability to have different view distance settings when on foot, in a vehicle or in the air. It is enabled by default. - -## 2. Usage -- When in-game, press ESC. -- Click `ACE Options` in the top-left corner. -- Scroll down to the `Client View Distance` settings. - -## 3. Dependencies -`ace_common` diff --git a/documentation/feature/weaponselect.md b/documentation/feature/weaponselect.md deleted file mode 100644 index ec638ea943..0000000000 --- a/documentation/feature/weaponselect.md +++ /dev/null @@ -1,37 +0,0 @@ ---- -layout: wiki -title: Weapon Select -description: -group: feature -category: interaction -parent: wiki ---- - -## 1. Overview - -### 1.1 Holster weapon -Adds the ability to holster a weapon on the back. - -### 1.2 Quick weapon select -Adds key bindings to quickly switch weapons while on foot or in a vehicle. (Unbound by default). - -### 1.3 Quick vehicle engine on/off -Adds key bindings to quickly turn a vehicle engine on or off. - -### 1.4 Grenade select -Changes the grenade selection key bindings to help prevent accidents. - -## 2. Usage - -### 2.1 Weapons - -- Press 0 to holster and unholster a weapon. -- When a weapon is holstered, the weapon fire button will not pull the weapon out. This can be used as an additional level of safety or as a role-playing feature. - -Quick weapon selection is not bound by default, but can be bound in the controls menu under `ACE3 Weapons`. - -Quick vehicle weapon selection is not bound by default, but can be bound in the controls menu under `ACE3 Vehicles`. - -## 3. Dependencies - -`ace_common` diff --git a/documentation/feature/weather.md b/documentation/feature/weather.md deleted file mode 100644 index e6d6aa6a4e..0000000000 --- a/documentation/feature/weather.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -layout: wiki -title: Weather -description: The Weather module overrides the mission/editor weather setting with a synchronized realistic weather simulation -group: feature -category: realism -parent: wiki ---- - -## 1. Overview -ACE3 Weather simulates realistic weather effects, according to the geographical location of the map, the date and time. It also ensures that all players experience the same weather effects. - -## 2. Usage - -### 2.1 Wind info -- Wind info is toggled on/off using SHIFT + K. -- The arrow representing wind info is based on [Beaufort scale](http://en.wikipedia.org/wiki/Beaufort_scale#Modern_scale) - -## 3. Dependencies -`ace_common`, `ace_modules` diff --git a/documentation/feature/windeflection.md b/documentation/feature/windeflection.md deleted file mode 100644 index ffec021d26..0000000000 --- a/documentation/feature/windeflection.md +++ /dev/null @@ -1,23 +0,0 @@ ---- -layout: wiki -title: Wind Deflection -description: The wind deflection module simulates wind deflection of projectiles -group: feature -category: realism -parent: wiki ---- - -## 1. Overview -ACE3 Wind Deflection is enabled by default. This feature simulates the wind deflection of projectiles fired by players and is designed to work independently or in conjunction with the Advanced Ballistic feature. - -
-
Note:
-

The only affected projectiles are bullets and grenades. Mortar shells, tank shells, missiles and rockets are not affected.

-
- -## 2. Usage -ACE3 Wind Deflection can be disabled or modified via a module in the 2D editor. - - -## 3. Dependencies -`ace_weather` diff --git a/documentation/feature/yardage450.md b/documentation/feature/yardage450.md deleted file mode 100644 index 7aabbf36f2..0000000000 --- a/documentation/feature/yardage450.md +++ /dev/null @@ -1,24 +0,0 @@ ---- -layout: wiki -title: Yardage 450 -description: Adds the Bushnell Yardage Pro Sport 450 Laser Rangefinder -group: feature -category: equipment -parent: wiki ---- - -## 1. Overview - -Adds the Bushnell Yardage Pro Sport 450 Laser Rangefinder. - -## 2. Usage - -### 2.1 How to use the Yardage 450 -- Bring it up like any other binocular -- Tap R once to activate the device. -- Sight the target and Hold R until `TARGET AQCUIRED` appears on top of the screen. -- The range in meters should now appear at the bottom of the screen. - -## 3. Dependencies - -`ace_apl` , `ace_laser` diff --git a/documentation/feature/zeus.md b/documentation/feature/zeus.md deleted file mode 100644 index 36e7f5e434..0000000000 --- a/documentation/feature/zeus.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -layout: wiki -title: Zeus -description: The Zeus module improves the Vanilla functionality -group: feature -category: interaction -parent: wiki ---- - -## 1. Overview -ACE3 Zeus is enabled by default. This feature provides control over vanilla aspects of Zeus. - -## 2. Usage -ACE3 Zeus can be disabled or modified via a module in the 2D editor. - -## 3. Dependencies -`ace_common`, `ace_modules` diff --git a/documentation/framework/advanced-missile-guidance.md b/documentation/framework/advanced-missile-guidance.md deleted file mode 100644 index 14f1d1feae..0000000000 --- a/documentation/framework/advanced-missile-guidance.md +++ /dev/null @@ -1,108 +0,0 @@ ---- -layout: wiki -title: Advanced Missile Guidance -description: The ACE3 Advanced Missile Guidance Framework provides a setup of configuration settings, functions and a execution framework for addon makers to integrate with the missile guidance and targeting mechanisms of ACE3. -group: framework -order: 5 -parent: wiki ---- - -## 1. Overview - -The ACE3 Advanced Missile Guidance Framework provides a setup of configuration settings, functions and a execution framework for addon makers to integrate with the missile guidance and targeting mechanisms of ACE3. It also provides for mod makers to create their own custom guidance methods within the framework. - -The framework provides all the functionality needed for guidance; from laser locking, target specification and selection, to handling the fired events and tracking and steering the vehicle based on provided parameters. This way, all that needs to be defined in addons is the appropriate CfgAmmo entries for the missile. - -The framework also provides addon makers and scripters with the ability to configure custom seeker types and attack profiles, which are defined below. This allows for complete control of the guidance, locking and flight of a missile at the discretion of the addon maker. - -ACE3 provides a full suite of base concepts and guidance for the majority of modern missile weaponry avialable today; these includes all basic types of seekers (SALH/SACLOS/Optic/Thermal/etc) - as well as the different common attack profiles utilized with guided munitions (such as top-down attacks). - -Finally, flight profiles and mechanics for realistic missile simulations are also implemented; allowing for lock-steering bump guidance flight such as with the M47 Dragon or GBU steering fins, or finely tuned direct flight guidance which is currently avialable with other missile types. - -## 2. Details - -The framework is broken up into 3 major components: Locking Types, Seeker Types and Attack Profiles. In combination, these components build out the entire process of launching, locking and going terminal flight against targets. - -### 2.1 Components - -#### 2.1.1 Locking Types -Locking types provide the basic functionality of targeting which will be based to a seeker type, providing target aquisition for seekers. This provides the basic functionality for providing pre-determined targets for a seeker, or allowing the seeker to perform its own target aquisition and locking. Additionally, the seeker may reference back into the locking type in order to re-perform target aquisition. - -#### 2.1.2 Seeker Types -Each seeker is generally assumed to be the logic for the seeker head unit within any given munition. Seekers within this framework provide the basic targeting functionality for the entire framework. The locking type will provide a generic target to the seeker, or the seeker may aquire a target on its own. The seeker then provides a target, either an object or a ASL position, which is then passed further into the framework. This target (or position) should be the actual current target position for the missiles flight. Seekers are required to perform all limitations and checks within their systems, although various limitations have been provided in this framework such as LOS FOV, laser guidance, etc. - -#### 2.1.3 Attack Profiles - -An attack profile adjusts the current target flight location to create the actual flight path of the missile. The attack profile is provided with all parameters of the system, including the returned target of the seeker. Using this information, the attack profile then will adjust the *direct flight target position* to specifically direct where and how the missile shall flight. - -## 3. How it all ties together - -The system is executed in a linear series of calls to each step of the process, and feeding back the return from that step to the next step. Execution is conducted using Locking->Seeker->Profile, iteratively every frame of execution. Flight times are adjusted to accTime values and FPS lag, giving consistent flight. - -On each step of execution, a target specification array [targetObj, targetPos] is passed to the locking type, which then will return a possible modified target array. Next, this modified data is passed to the seeker type - which then, in turn, returns a position vector to the current "seeked" target position (ASL). Last, this target position is passed to the attack profile, who then returns an "adjusted attack position (ASL)", which is the location the missile should *currently* be homing on for flight. - -In the simplest sense, the entire system provides the flight trajectory of the missile homing directly on the "adjusted attack position"; thus, an attack profile would ajust this position to direct the missile. For example, Top down attacks return the adjusted attack position high above the target, until entering their terminal stages, which then changes the position to be directly ontop of the target - thus "walking the missile" along its flight path and to the kill. - -## 4. Adding AMG to a missile - -### 4.1 Enabling guidance on Ammo Types -``` -class CfgAmmo { - class MissileBase; - class MyMissileType : MissileBase { - // Turn off arma crosshair-guidance - manualControl = 0; - - // Begin ACE guidance Configs - class ace_missileguidance { - enabled = 1; - - minDeflection = 0.00025; // Minium flap deflection for guidance - maxDeflection = 0.001; // Maximum flap deflection for guidance - incDeflection = 0.0005; // The incrmeent in which deflection adjusts. - - canVanillaLock = 0; // Can this default vanilla lock? Only applicable to non-cadet modes. All 'recruit' games use vanilla locking - - // Seeker type and settings for munitions - defaultSeekerType = "SALH"; - seekerTypes[] = { "SALH", "LIDAR", "SARH", "Optic", "Thermal", "GPS", "SACLOS", "MCLOS" }; - - defaultSeekerLockMode = "LOAL"; - seekerLockModes[] = { "LOAL", "LOBL" }; - - seekerAngle = 90; // Angle in front of the missile which can be searched - seekerAccuracy = 1; // seeker accuracy multiplier - - seekerMinRange = 1; - seekerMaxRange = 2500; // Range from the missile which the seeker can visually search - - // Attack profile type selection - defaultAttackProfile = "LIN"; - attackProfiles[] = { "LIN", "DIR", "MID", "HI" }; - }; -``` - -## 5. Creating your own custom seekers and attack profiles - -### 5.1 Adding seeker types and attack profiles - -``` -class ace_missileguidance_attackProfiles{ - class MyAttackProfile { - name = ""; - visualName = ""; - description = ""; - - functionName = "my_fnc_doAttackProfile"; - }; -}; -class ace_missileguidance_seekerTypes { - class MySeekerType { - name = ""; - visualName = ""; - description = ""; - - functionName = "my_fnc_doSeekerType"; - }; -}; -``` diff --git a/documentation/framework/carry-drag.md b/documentation/framework/carry-drag.md deleted file mode 100644 index cfa4eb13af..0000000000 --- a/documentation/framework/carry-drag.md +++ /dev/null @@ -1,96 +0,0 @@ ---- -layout: wiki -title: Carry and Drag System -description: -group: framework -order: 5 -parent: wiki ---- - -## 1. Config Values - -``` -class CfgVehicles { - class MyVehicle { - - - ace_dragging_canDrag = 1; // can this object be dragged?; 1 yes, 0 no (0 default) - ace_dragging_dragPosition[] = {0,1.2,0} // Offset of the model from the body while dragging, comparable to the offset in attachTo (It's the same actually) - ace_dragging_dragDirection = 0; // how much degrees is the model rotatated after dragging it (a global setDir after attachTo) - - ace_dragging_canCarry = 1; // can this object be carried?; 1 yes, 0 no (0 default) - ace_dragging_carryPosition[] = {0,1.2,0}; // Same as drag, but for carrying objects - ace_dragging_carryDirection = 0; // Same as drag, but for carrying objects - - }; -}; -``` - -## 2. Functions - -**NOTE THAT THE FOLLOWING FUNCTIONS ARE NOT PUBLIC AND THUS MAY CHANGE IN THE FUTURE.**
- - -Also note that if the item is too heavy you won't be able to carry / drag it, the mass is also affected by what's inside it.
-To bypass this empty the object and / or use setMass.
- -### 2.1 Enabling / disabling dragging - -`ace_dragging_fnc_setDraggable.`
-Enable the object to be dragged.
- -| Arguments | | ---------------| -------- | -0 | Any object (Object) -1: | true to enable dragging, false to disable (Bool) -2:| Position offset for attachTo command (Array, optional; default: [0,0,0]) -3: | Direction in degree to rotate the object after attachTo (Number, optional; default: 0) -Return value: NONE
- -#### 2.1.1 example 1: -``` -[foo,true,[0,2,0],45] call ace_dragging_fnc_setDraggable -``` -| Arguments | | ---------------| -------- | -0:| foo (my object) -1:| true (dragging is enabled) -2:| `[0,2,0]` (0 meters sideways, 2 meters forward, 0 meters upwards) -3:| 45 (the object is rotated by 45°) - -#### 2.1.2 example 2 -``` -[bar,false,[3,-2,2],20] call ace_dragging_fnc_setDraggable -``` - -| Arguments | | ---------------| -------- | -0:| bar (object) -1:| false (dragging is disabled) -2:| 3 meters sideways, -2 meters backwards, 2 meters upwards -3:| the object is rotated by 20° - -### 2.2 Enabling / disabling carrying -`ace_dragging_fnc_setCarryable.`
-Enable the object to be carried.
- -| Arguments | | ---------------| -------- | -0 | Any object (Object) -1:| true to enable carrying, false to disable (Bool) -2:| Position offset for attachTo command (Array, optional; default: [0,1,1]) -3:| Direction in degree to rotate the object after attachTo (Number, optional; default: 0) -Return value: NONE
- - -#### 2.1.1 example 1: -``` -[foo,true,[0,3,1],10] call ace_dragging_fnc_setCarryable -``` -| Arguments | | ---------------| -------- | -0:| foo (my object) -1:| true (carrying is enabled) -2:| `[0,2,0]` (0 meters sideways, 3 meters forward, 1 meters upwards) -3:| 10 (the object is rotated by 10°) - diff --git a/documentation/framework/fragmentation-configuration.md b/documentation/framework/fragmentation-configuration.md deleted file mode 100644 index 876074e6f4..0000000000 --- a/documentation/framework/fragmentation-configuration.md +++ /dev/null @@ -1,77 +0,0 @@ ---- -layout: wiki -title: Fragmentation Configuration -description: The fragmentation system (ace_frag) in ACE3 is a significant improvement over the fragmentation system in ACE2. -group: framework -parent: wiki -order: 7 ---- - -The fragmentation system (ace_frag) in ACE3 is a significant improvement over the fragmentation system in ACE2. Previously the system relied on fuzzy math from the values of `indirectHit` and `indirectHitRange` in CfgAmmo to calculate roughly the velocity and range of fragmentation. This had some serious drawbacks, especially in the case of smaller explosives such as hand grenades and 40mm grenades where casualty production was lower than desired. - -In ACE3 the system has moved away from what "feels" right to actual explosive engineering equations, primarily the [Gurney equations](http://en.wikipedia.org/wiki/Gurney_equations). This allows us to get close to the actual fragmentation velocities that would be produced by an explosive configuration similar to type of ammo we are simulating. - -The system for the end-developer is easy to use, and only requires minimal research into the type of ammo being represented. I will describe how to do this in this ticket. - -Below is an example set of explosives configuration properties for sys_frag (in this case an M67 hand grenade): - -```c++ -ace_frag_metal = 210; // metal in grams -ace_frag_charge = 185; // explosive in grams -ace_frag_gurney_c = 2843; // Gurney velocity constant for explosive type. See: http://en.wikipedia.org/wiki/Gurney_equations -ace_frag_gurney_k = 3/5; // Gurney shape factor, in this case a sphere. See: http://en.wikipedia.org/wiki/Gurney_equations -``` - -`ace_frag_metal` is the amount of metal being fragmented (generally taken as the entire weight of the warhead, though in some cases you might want to only include the fragmentation jacket or body. `ace_frag_charge` is the amount of explosive filler in the warhead. `ace_frag_metal` and `ace_frag_charge` are dimensionless values, as long as they are both in the same unit (for example kg/kg g/g lbs/lbs). - -`ace_frag_gurney_c` is the Gurney constant for explosive force. You can find a list of common explosive types below. If you can not find it here, or want more accurate numbers, just google the type of explosive and Gurney constant and you can find substantial information. This is *NOT* the detonation velocity of the explosive, do not confuse them! - -| Type | Speed | -|------------------|----------| -|Composition B | 2700 m/s | -|Composition C-3 | 2680 m/s | -|Cyclotol 75/25 | 2790 m/s | -|HMX | 2800 m/s | -|LX-14 | 2970 m/s | -|Octol 75/25 | 2800 m/s | -|PBX 9404 | 2900 m/s | -|PBX 9502 | 2377 m/s | -|PETN | 2930 m/s | -|RDX | 2830 m/s | -|Tetryl | 2500 m/s | -|TNT | 2440 m/s | -|Tritonal | 2320 m/s | - - -`ace_frag_gurney_k` is the shape factor for the explosive configuration. You should choose it based on the general configuration of explosives/metal in the warhead. Most grenades for example are a sphere. Artillery and aircraft bombs are a cylinder. Mines generally a flat plate. Below is a list of the three common shapes and their factors. - -``` -Sphere = 3/5 -Cylinder = 1/2 -Plate = 3/5 -``` - -There are other configurations but these are the most common. If you are interested in others check out the wikipedia link given above. Most of these will not correctly function in sys_frag though due to additional variables for the equation. - -In addition to these variables there are different types of fragmentation fragments to choose from, and they can be defined in the config value `ace_frag_classes[]`. Below are a list of the types. - -``` -ACE_frag_tiny -ACE_frag_tiny_HD -ACE_frag_small -ACE_frag_small_HD -ACE_frag_medium -ACE_frag_medium_HD -ACE_frag_large -ACE_frag_large_HD -ACE_frag_huge -ACE_frag_huge_HD -``` - -The tinier the piece of fragmentation the shorter the distance of travel. The `_HD` variants are all even higher drag versions. Grenades generally should use the `_HD` variants. Experimentation here is important. - -The final information needed is a couple of entries for forcing or ignoring fragmentation for this ammo. - -If you set `ace_frag_skip` to 1 then you will skip fragmentation for ammo of this type. This is useful for things that might cause high network load, such as FFAR rockets, or possibly even 40mm grenades from AGLs. Experimentation under network conditions is required. - -If you set `ace_frag_force` to 1 it will force the fragmentation system to use frag on this ammo, ignoring sys_frags internal qualifications based on hit values. diff --git a/documentation/framework/settings.md b/documentation/framework/settings.md deleted file mode 100644 index 58208a873d..0000000000 --- a/documentation/framework/settings.md +++ /dev/null @@ -1,95 +0,0 @@ ---- -layout: wiki -title: Settings Framework -description: ACE3 contains an extensive settings framework that allows you to tweak the modification without having to mess around with deleting pbos. -group: framework -order: 5 -parent: wiki ---- - -ACE3 contains an extensive settings framework that allows you to tweak the modification without having to mess around with deleting pbos. These settings are all handled server side and broadcasted to the clients connecting to that server. This ensures that everyone playing on the server will have a uniform experience. - -Part of this settings framework are global settings and client settings. Both use the same underlaying framework, with the difference that client settings can be adjusted by clients, where global settings can not. - - -## 1. How do they work - -Settings are entries in the config that get translated to `missionnamespace` global variables. An example settings entry looks like this: - -```c++ -class ACE_module_sampleSetting { - // Value - value = 1; - - // Type (SCALAR, BOOL, STRING, ARRAY, COLOR) - typeName = "SCALAR"; - - // Force the setting? - force = 0; - - // Does it appear on the options menu? - isClientSettable = 1; - - // The following settings only apply when isClientSettable == 1 - // Stringtable entry with the setting name - displayName = "$STR_ACE_Common_SettingName"; - - // Stringtable entry with the setting description - description = "$STR_ACE_Common_SettingDescription"; - - // Stringtable entries that describe the options - // Only applies if typeName == "SCALAR"; and is optional - values[] = {"Disabled", "Enabled", "Only Cursor", "Only On Keypress", "Only Cursor and KeyPress"}; -}; -``` - -Settings are defined from the mods config but can be adjusted through the following methods: - -* Optional config entries -* Mission side modules - -## 2. Load order - -The load order for the settings are: - -* 1. Mod config -* 2. Server config -* 3. Mission config -* 4. Placed down mission modules - -What this means is that at any the 3 points after the mod config it is possible to insert your adjusted settings and force those (optionally). This is a powerful tool for server admins, whom can ensure that everyone is using uniform settings across the board on their server. And it provides mission makers the ability to easily set settings for their mission, without creating a large dependency on ACE3; you do not have to place down mission modules. - -## 3. How do I use them? - -In the 'how do they work' chapter an example of settings was shown. This is the same for any settings config. The only difference is the location. For ACE3 modules, the settings are placed in the class `ACE_settings`. The same goes for the mission config. - -The server config setting entries are done through our optional ACE_server.pbo, which can be found in the optionals folder of @ace. It also contains a `userconfig` folder, which inside contains the file `ace\serverconfig.hpp`. This is the location ACE3 settings are placed. There is no need for a sub class. - -### 3.1 Getting all the settings! - -ACE3 contains a lot of settings; for that reason tweaking everything to your liking manually can be quite a task. We have provided the option to export all settings in the editor (single-player). For this, follow these simple steps: - -* Open the editor (single-player). -* Under modules (F7), find ACE, `Config Export [ACE]`. -* Place down the module, ensure that the allow parameter is set to yes. -* Press preview, once in game, press Esc and open the ACE3 Options dialog (top left) -* This is the dialog where you can modify client side settings. On the bottom left of it, you will now see a button called `Config Export`. Press it and a new dialog opens. -* You are now in the dialog that allows you to adjust all settings from ACE3. Tweak this to your liking. -* Once you are done tweaking, press the `Export` button and all settings will be copied to your clipboard. -* Paste the settings in your `serverconfig.hpp` file and you're done. - -Note that the format copied to your clipboard by this can also be used in the mission config (`description.ext`), as long as they are in the class `ACE_Settings`. - -```c++ -class ACE_Settings { - // add exported settings here -}; -``` - - -### 3.2 Loading up the server config - -As stated before, the server config gets loaded through the optional `ACE_server.pbo`. This PBO is only required (and should only be used) on the server - clients do not need to have this! It is for this reason we have not signed this PBO. - -Load the `ACE_server.pbo` like any other addon on your server. It is advised to create an `@aceServer` mod folder with an `addons` sub folder where you would paste the `ACE_server.pbo` and load that through `-serverMod=@aceServer`. - diff --git a/documentation/missionmaker/class-names.md b/documentation/missionmaker/class-names.md deleted file mode 100644 index 9866f20064..0000000000 --- a/documentation/missionmaker/class-names.md +++ /dev/null @@ -1,341 +0,0 @@ ---- -layout: wiki -title: Class names -description: A list of all the class names in ACE3 -group: missionmaker -order: 11 -parent: wiki ---- - -Everything is ordered alphabetically. - -You know an in-game name but want the class name? CTRL + F - -## AtragMX -`added in 3.0.0.3` - -class name | in game name | type | ----------- | --------- | --------- | -ACE_ATragMX | ATragMX | ACE_ItemCore | - -## Attachable -`added in 3.0.0.3` - -class name | in game name | type | ----------- | --------- | --------- | -ACE_IR_Strobe_Item | IR strobe | ACE_ItemCore | - -## Ballistics -`added in 3.0.0.3` - -class name | in game name | type | ----------- | --------- | --------- | -ACE_100Rnd_65x39_caseless_mag_Tracer_Dim | 6.5mm IR-DIM | Magazine | -ACE_200Rnd_65x39_cased_Box_Tracer_Dim | 6.5mm IR-DIM | Magazine | -ACE_30Rnd_65x39_caseless_mag_Tracer_Dim | 6.5mm IR-DIM | Magazine | -ACE_30Rnd_65x39_caseless_green_mag_Tracer_Dim | 6.5mm IR-DIM | Magazine | -ACE_30Rnd_556x45_Stanag_M995_AP_mag | 5.56mm AP | Magazine | -ACE_30Rnd_556x45_Stanag_Mk262_mag | 5.56mm Mk262 | Magazine | -ACE_30Rnd_556x45_Stanag_Mk318_mag | 5.56mm Mk318 | Magazine | -ACE_30Rnd_556x45_Stanag_Tracer_Dim | 5.56mm IR-DIM | Magazine | -ACE_20Rnd_762x51_Mag_Tracer | 7.62mm Tracer | Magazine | -ACE_20Rnd_762x51_Mag_Tracer_Dim | 7.62mm IR-DIM | Magazine | -ACE_20Rnd_762x51_Mag_SD | 7.62mm SD | Magazine | -ACE_10Rnd_762x51_M118LR_Mag | 7.62mm M118LR | Magazine | -ACE_10Rnd_762x51_Mk316_Mod_0_Mag | 7.62mm Mk316 | Magazine| -ACE_10Rnd_762x51_Mk319_Mod_0_Mag | 7.62mm Mk319 | Magazine | -ACE_10Rnd_762x51_M993_AP_Mag | 7.62mm AP | Magazine | -ACE_20Rnd_762x51_M118LR_Mag | 7.62mm M118LR | Magazine | -ACE_20Rnd_762x51_Mk316_Mod_0_Mag | 7.62mm Mk316 | Magazine | -ACE_20Rnd_762x51_Mk319_Mod_0_Mag | 7.62mm Mk319 | Magazine | -ACE_20Rnd_762x51_M993_AP_Mag | 7.62mm AP | Magazine | -ACE_20Rnd_762x67_Mk248_Mod_0_Mag | 7.62mm Mk248 | Magazine | -ACE_20Rnd_762x67_Mk248_Mod_1_Mag | 7.62mm Mk248 | Magazine | -ACE_20Rnd_762x67_Berger_Hybrid_OTM_Mag | 7.62mm OTM | Magazine | -ACE_30Rnd_65x47_Scenar_mag | 6.5mm Lapua | Magazine | -ACE_30Rnd_65_Creedmor_mag | 6.5mm CM | Magazine | -ACE_10Rnd_338_300gr_HPBT_Mag |.338 HPBT | Magazine | -ACE_10Rnd_338_API526_Mag |.338 AP | Magazine | -ACE_5Rnd_127x99_Mag | 12.7mm | Magazine | -ACE_5Rnd_127x99_API_Mag | 12.7mm API | Magazine | -ACE_5Rnd_127x99_AMAX_Mag | 12.7mm | Magazine | -ACE_30Rnd_9x19_mag | 9x19mm | Magazine | -ACE_16Rnd_9x19_mag | 9x19mm | Magazine | -ACE_10Rnd_762x54_Tracer_mag | 7.62mm | Magazine | - -## Captive -`added in 3.0.0.3` - -class name | in game name | type | ----------- | --------- | --------- -ACE_CableTie | cable tie | ACE_ItemCore | - -## Common -`added in 3.0.0.3` - -class name | in game name | type | ----------- | --------- | --------- -ACE_Banana | banana | ACE_ItemCore | - -## Concertina Wire -`added in 3.1.1` - -class name | in game name | type | ----------- | --------- | --------- -ACE_ConcertinaWireCoil | Concertina Wire Coil | ThingX | -ACE_ConcertinaWire | Concertina Wire | deployed concertina wire | - -## DAGR -`added in 3.1.1` - -class name | in game name | type | ----------- | --------- | --------- -ACE_DAGR | DAGR | ACE_ItemCore | - -## Disposable -`added in 3.0.0.3` - -class name | in game name | type | ----------- | --------- | --------- -ACE_launch_NLAW_Used_F | used NLAW | Weapon | - -## Explosives -`added in 3.0.0.3` - -class name | in game name | type | ----------- | --------- | --------- -ACE_Clacker| M57 Firing Device | ACE_ItemCore | -ACE_M26_Clacker| M26 Firing Device | ACE_ItemCore | -ACE_DefusalKit | Defusal Kit | ACE_ItemCore | -ACE_DeadManSwitch | Dead Man's Switch | ACE_ItemCore | -ACE_Cellphone | Cellphone | ACE_ItemCore | - -## Grenades -`added in 3.0.0.3` - -class name | in game name | type | ----------- | --------- | --------- -ACE_HandFlare_White | M127A1 Hand Held Signal (White) | Grenade | -ACE_HandFlare_Red | M127A1 Hand Held Signal (Red | Grenade | -ACE_HandFlare_Green | M127A1 Hand Held Signal (Green) | Grenade | -ACE_HandFlare_Yellow | M127A1 Hand Held Signal (Yellow) | Grenade | -ACE_M84 | M84 Stun Grenade | Grenade | - -## Hearing -`added in 3.0.0.3` - -class name | in game name | type | ----------- | --------- | --------- -ACE_EarPlugs | Earplugs | ACE_ItemCore | - -## HuntIR -`added in 3.1.1` - -class name | in game name | type | ----------- | --------- | --------- -ACE_HuntIR_monitor | HuntIR monitor | ACE_ItemCore | -ACE_HuntIR_M203 | HuntIR Round | Grenade shell | -ACE_HuntIR_Box | HuntIR Transport Box | ammo box | - -## Kestrel -`added in 3.0.0.3` - -class name | in game name | type | ----------- | --------- | --------- -ACE_Kestrel4500 | Kestrel 4500NV | ACE_ItemCore | - -## Laser Pointers -`added in 3.0.0.3` - -class name | in game name | type | ----------- | --------- | --------- -acc_pointer_IR | Laser Pointer (red) | Weapon accessory | -ACE_acc_pointer_red | Laser Pointer (green) | Weapon accessory | -ACE_acc_pointer_green_IR | Laser Pointer (green) | Weapon accessory | -ACE_acc_pointer_green | Laser Pointer (green) | Weapon accessory | - -## Logistics -`added in 3.0.0.3` - -class name | in game name | type | ----------- | --------- | --------- -ACE_UAVBattery | UAV Battery | ACE_ItemCore | -ACE_wirecutter | Wirecutter | ACE_ItemCore | - -## Map Tools -`added in 3.0.0.3` - -class name | in game name | type | ----------- | --------- | --------- -ACE_MapTools | Map Tools | ACE_ItemCore | - -## Medical -`added in 3.0.0.3` - - -class name | in game name | type | ----------- | --------- | --------- -ACE_atropine | Atropin autoinjector | ACE_ItemCore | -ACE_fieldDressing | Bandage (Basic) | ACE_ItemCore | -ACE_elasticBandage | Bandage (Elastic) | ACE_ItemCore | -ACE_quikclot | Basic Field Dressing (QuikClot) | ACE_ItemCore | -ACE_bloodIV | Blood IV (1000ml) | ACE_ItemCore | -ACE_bloodIV_500 | Blood IV (500ml) | ACE_ItemCore | -ACE_bloodIV_250 | Blood IV (250ml) | ACE_ItemCore | -ACE_bodyBag | Bodybag | ACE_ItemCore | -ACE_bodyBagObject | Bodybag (packed) | | -ACE_epinephrine | Epinephrine autoinjector | ACE_ItemCore | -ACE_morphine | Morphine autoinjector | ACE_ItemCore | -ACE_packingBandage | Packing Bandage | ACE_ItemCore | -ACE_personalAidKit | Personal Aid Kit | ACE_ItemCore | -ACE_plasmaIV | Plasma IV (1000ml) | ACE_ItemCore | -ACE_plasmaIV_500 | Plasma IV (500ml) | ACE_ItemCore | -ACE_plasmaIV_250 | Plasma IV (250ml) | ACE_ItemCore | -ACE_salineIV | Saline IV (1000ml) | ACE_ItemCore | -ACE_salineIV_500 | Saline IV (500ml) | ACE_ItemCore | -ACE_salineIV_250 | Saline IV (250ml) | ACE_ItemCore | -ACE_surgicalKit | Surgical Kit | ACE_ItemCore | -ACE_tourniquet | Tourniquet (CAT) | ACE_ItemCore | - -## MicroDAGR -`added in 3.0.0.3` - -class name | in game name | type | ----------- | --------- | --------- -ACE_microDAGR | MicroDAGR GPS | ACE_ItemCore | - -## MK6 Mortar -`added in 3.0.0.3` - -class name | in game name | type | ----------- | --------- | --------- -ACE_RangeTable_82mm | 82mm Rangetable | ACE_ItemCore | - -## M2XA -`added in 3.1.1` - -class name | in game name | type | ----------- | --------- | --------- -ACE_MX2A | MX-2A | Binocular | - - -## Nightvision -`added in 3.0.0.3` - -class name | in game name | type | ----------- | --------- | --------- -ACE_NVG_Gen1 | NV Goggles (Gen1) | Nvgs | -ACE_NVG_Gen2 | NV Goggles (Gen2) | Nvgs | -ACE_NVG_Gen3 | NV Goggles (Gen3) | Nvgs | -ACE_NVG_Gen4 | NV Goggles (Gen4) | Nvgs | -ACE_NVG_Wide | NV Goggles (Wide) | Nvgs | - - -## Optics -`added in 3.0.0.3` - -class name | in game name | type | ----------- | --------- | --------- -ACE_optic_Arco_2D | ARCO (2D) | Weapon accessory | -ACE_optic_Arco_PIP | ARCO (PIP) | Weapon accessory | -ACE_optic_LRPS_2D | LRPS (2D) | Weapon accessory | -ACE_optic_LRPS_PIP | LRPS (PIP) | Weapon accessory | -ACE_optic_SOS_2D| MOS (2D) | Weapon accessory | -ACE_optic_SOS_PIP | MOS (PIP) | Weapon accessory | -ACE_optic_MRCO_2D | MRCO (2D) | Weapon accessory | -ACE_optic_MRCO_PIP | MRCO (PIP) | Weapon accessory | -ACE_optic_Hamr_2D | RCO (2D) | Weapon accessory | -ACE_optic_Hamr_PIP | RCO (PIP) | Weapon accessory | - -## Overheating -`added in 3.0.0.3` - -class name | in game name | type | ----------- | --------- | --------- -ACE_SpareBarrel | Spare barrel | ACE_ItemCore | - -## Parachute -`last modified in 3.2.0` - -class name | in game name | type | ----------- | --------- | --------- -ACE_Altimeter | Altimeter Watch | ACE_ItemCore | -ACE_NonSteerableParachute | Non-Steerable Parachute | Backpack | -ACE_ReserveParachute | Reserve Parachute | Backpack | - -## Rangecard -`added in 3.1.1` - -class name | in game name | type | ----------- | --------- | --------- -ACE_RangeCard | rangecard | ACE_ItemCore | - -## Respawn -`last modified in 3.2.0` - -class name | in game name | type | ----------- | --------- | --------- -ACE_Rallypoint_West | Rallypoint West | FlagCarrier | -ACE_Rallypoint_East | Rallypoint East | FlagCarrier | -ACE_Rallypoint_Independent | Rallypoint Independent | FlagCarrier | -ACE_Rallypoint_West_Base | Rallypoint West (Base) | FlagCarrier | -ACE_Rallypoint_East_Base | Rallypoint East (Base) | FlagCarrier | -ACE_Rallypoint_Independent_Base | Rallypoint Independent (Base) | FlagCarrier | - -## Vector -`added in 3.0.0.3` - -class name | in game name | type | ---------- | --------- | --------- -ACE_Vector | Vector 21 | Binoculars | - -## Vehicle Lock -`added in 3.0.0.3` - -class name | in game name | type | ----------- | --------- | --------- -ACE_key_master | Vehicle Key: Master | ACE_ItemCore | -ACE_key_lockpick | Lockpick | ACE_ItemCore | -ACE_key_west | Vehicle Key: West | ACE_ItemCore | -ACE_key_east | Vehicle Key: East | ACE_ItemCore | -ACE_key_indp | Vehicle Key: Independent | ACE_ItemCore | -ACE_key_civ | Vehicle Key: Civilian | ACE_ItemCore | - -## Sandbag -`added in 3.1.1` - -class name | in game name | type | ----------- | --------- | --------- -ACE_Sandbag_empty | Sandbag (empty) | ACE_ItemCore | -ACE_SandbagObject | Sandbag | ThingX | - -## Spotting Scope -`added in 3.1.1` - -class name | in game name | type | ----------- | --------- | --------- -ACE_SpottingScope | Spotting Scope | ACE_ItemCore | -ACE_SpottingScopeObject | Spotting Scope (placed) | StaticATWeapon | - -## Tactical Ladder -`added in 3.1.1` - -class name | in game name | type | ----------- | --------- | --------- -ACE_TacticalLadder_Pack | Telescopic Ladder | Backpack | -ACE_Tactical_Ladder | Telescopic Ladder (placed) | house | - -## Tripod -`added in 3.1.1` - -class name | in game name | type | ----------- | --------- | --------- -ACE_Tripod | SSWT Kit | ACE_ItemCore | -ACE_TripodObject | SSWT Kit (placed) | ThingX | - -## Yardage 450 -`added in 3.1.1` - -class name | in game name | type | ----------- | --------- | --------- -ACE_Yardage450 | Yardage 450 | Binocular | \ No newline at end of file diff --git a/documentation/missionmaker/mission-tools.md b/documentation/missionmaker/mission-tools.md deleted file mode 100644 index eeb4c2be06..0000000000 --- a/documentation/missionmaker/mission-tools.md +++ /dev/null @@ -1,138 +0,0 @@ ---- -layout: wiki -title: Mission tools -description: A short description of ACE3's mission tools that help mission makers to provide awesome missions -group: missionmaker -order: 10 -parent: wiki ---- - -## 1. ACE Rallypoints -*Part of: ace_respawn* - -"ACE Rallypoints" is a two way teleport system between two positions. Usually this is used to transport units that have died during a mission back to the front line. The rally points are portrayed by flagpoles (West, East and Independant flagpoles are available) that have a "Base" and an "Exit" version. - -They can be found in the editor under: "Empty" >> "ACE Respawn" - -**Classnames:** -- `ACE_Rallypoint_West`, `ACE_Rallypoint_West_Base` -- `ACE_Rallypoint_East`, `ACE_Rallypoint_East_Base` -- `ACE_Rallypoint_Independent`, `ACE_Rallypoint_Independent_Base` - -Using the Interaction Menu on a rallypoint offers the ability to teleport from one flagpole to the other flagpole and vice versa. - -If you want to change the texture of the flag use this line: - -```c++ -this setFlagTexture 'path\to\my\texture\my_awesome_clan_logo.paa'; -``` - -*Note: You can't place more than one rallypoint of the same type.* - -All units synced to the ["Rallypoint System" module](./modules.html#1.14-rallypoint-system) are able to move the rallypoint. - -
-
Note:
-

It's important to mention that this doesn't work for player who join during a mission (JIP = Join in progress). That's something we can't change because that's the way Bohemia Interactive has implemented their module framework.

-
- -To enable other units to move them add this to the unit's initialization code: - -```c++ -_unit setVariable ["ACE_canMoveRallypoint", true, true]; -``` - -## 2. ACE SwitchUnits -*Part of: ace_switchunits* - -"ACE SwitchUnits" is a tool for misson makers to quickly add PvP (Player vs. Player) elements to a mission. In short it enables a player to control AI units. Allowing players to perform as enemies even during a COOP mission increases the authenticity of the enemy and thus the immersion for everyone. - -The most prominent feature of ACE SwitchUnits is that you can add it to nearly every existing mission and get AI control out of the box. Dynamic mission like "Enemy Assault", "Patrol Ops", "Invade & Annex", etc. don't need to be touched to make all random spawned AI's controllable. - -In its current form you're able to switch to infantry (vehicles, etc. are planned) from all four sides (West, East, Independent, Civilian). - -To enable a player to control AI add the following to its init line: - -```c++ -this setVariable ["ACE_CanSwitchUnits", true]; -``` -Once this player spawns, all controllable AI will be marked on his map and he'll be able to click on the map to switch to this unit. The initial unit will be prone to damage, but has no equipment and can't run. So it would be wise to hide or move this unit far from other players. - -The [module settings](./modules.html#1.16-switchunits-system) define which side a player can control or how big the radius of the safe zone is. The safe zone is a circular zone around AI units that must be clear from players of an opposing side to be able to switch to. - -## 3. ACE Slideshow -*Part of: ace_slideshow* - -"ACE Slideshow" is a very powerful tool for mission makers and platoon leaders giving them the power to project images on some objects. -You will now learn how to set up everything for it to work properly. - -### 3.1 The module explained -Name | Explanation ----- | ----- -Objects | Name of the objects used as screens -Controllers | Name of the objects used as controllers -Images | Full path of the image from the mission folder/file or from an other mod (even BI PBOs work) -Interaction names | Name of your interactions -Slide duration | 0 (0 = disabled, number is in seconds) - -- Only objects with hiddenSelection 0 can be used as "screens". -- If you set a duration the remotes will be disabled. (If the remotes are disabled `ace_interaction` is not needed) -- You can have multiple sets of images on different screens, see the advanced slideshow below. -- It is advisable images resolution sizes are powers of 2 (eg. 512x512) to avoid graphical glitches in them. - -
-
Note:
-

Mission MUST be in a PBO format (not bare folder) when used on a dedicated server due to an [issue](http://feedback.arma3.com/view.php?id=22310) to prevent errors.

-
- -### 3.2 Basic slideshow -*A set of 4 images that are swapped via a remote* - -Note that all names and interaction names are examples. - -- First place the slideshow module down. -- Place the object that will be used as a "screen" and give it the name `foo1` -- Place the object you want to use as a remote and name it `bar1` -- In your mission folder create a new folder called images and drop your banana images there. -- Place down the module and fill it as follows: - -Name | Written ----- | ----- -Objects | foo1 -Controllers | bar1 -Images | images\banana1.jpg,images\banana2.jpg,images\banana3.jpg,images\banana4.jpg -Interaction names | banana1,banana2,banana3,banana4 -Slide duration | 0 - -- Go in game and enjoy your bananas - -### 3.3 Multiple screens and remotes -*2 set of "screens" and remotes* - -- First place the slideshow module down. -- Place 2 objects that you want to use as "screens" and call them `foo1` and `foo2` -- Place 2 objects you want to use as remotes and call them `bar1` and `bar2` -- In your mission folder create a new folder called images and drop your banana images there. -- Place down 2 modules and fill them as follows: - -*Module 1* - -Name | Written ----- | ----- -Objects | foo1 -Controllers | bar1 -Images | images\banana1.jpg,images\banana2.jpg -Interaction names | banana1,banana2 -Slide duration | 0 - -*Module 2* - -Name | Written ----- | ----- -objects | foo2 -Controllers | bar2 -images | images\banana3.jpg,images\banana4.jpg -Interaction names | banana3,banana4 -Slide duration | 0 - -- You now have two set of "screens" with a remote each. \ No newline at end of file diff --git a/documentation/missionmaker/modules.md b/documentation/missionmaker/modules.md deleted file mode 100644 index 9ee9ee7e57..0000000000 --- a/documentation/missionmaker/modules.md +++ /dev/null @@ -1,492 +0,0 @@ ---- -layout: wiki -title: Modules -description: A list of all modules in ACE3 and all the settings that can be tweaked by them -group: missionmaker -order: 5 -parent: wiki ---- - -## 1. ACE3 -### 1.1 Advanced Ballistics -*Part of: ace_advanced_ballistics* - -This module allows enabling and configuring advanced ballistic simulations. - -**Settings:** - -Name | Type | Description | Default value ----- | ---- | ---- | ---- | -Advanced Ballistics | Boolean | Enables advanced ballistics. | No -Enabled For Snipers | Boolean | Enables advanced ballistics for non local snipers (when using high power optics). | Yes -Enabled For Group Members | Boolean | Enables advanced ballistics for non local group members.| No -Enabled For Everyone | Boolean | Enables advanced ballistics for all non local players (enabling this feature may degrade performance during heavy firefights in multiplayer). | No -Disabled In FullAuto Mode | Boolean | Disables the advanced ballistics during full auto fire. | No -Enable Ammo Temperature Simulation | Boolean | Muzzle velocity varies with ammo temperature. | Yes -Enable Barrel Length Simulation | Boolean | Muzzle velocity varies with barrel length. | Yes -Enable Bullet Trace Effect | Boolean | Enables a bullet trace effect to high caliber bullets (only visible when looking through high power optics). | Yes -Simulation Interval | Number | Defines the interval between every calculation step. | 0.00 -Simulation Radius | Number | Defines the radius around the player (in meters) at which advanced ballistics are applied to projectiles. | 3000 - -### 1.2 Allow Config Export -*Part of: ace_Optionmenu* - -This modules allows to export all current ACE3 settings from the ACE3 Option menu to the clipboard and RPT file. - -**Settings:** - -Name | Type | Description | Default value ----- | ---- | ---- | ---- | -Allow | Boolean | Enables the "export" button in the ACE3 Option menu. | Yes - -### 1.3 BlueForceTracking -*Part of: ace_map* - -When adding the "Blue Force Tracking" module to your mission it adds map markers to every group on the players side and refreshes them in certain configurable interval (in seconds). The module takes the group type into account and uses the proper NATO icon for each marker. - -**Settings:** - -Name | Type | Description | Default value ----- | ---- | ---- | ---- | -BFT Enable | Boolean | Enable blue force tracking | No -Interval | Number | How often the markers should be refreshed (in seconds). | 1 -Hide AI Groups | Boolean | Hide markers for "AI only" groups. | No - -### 1.4 Captives settings -*Part of: ace_captives* - -Controls the settings for cable ties and surrendering. -Very useful if you don't want your players to be able to restrict each others. - -**Settings:** - -Name | Type | Description | Default value ----- | ---- | ---- | ---- | -Can handcuff own side | Boolean | Determine if you are able to handcuff your own side or not. | Yes -Allow surrendering | Boolean | Determine if you are able to surrender or not when your weapon is holstered. | Yes - -### 1.5 Check PBOs -*Part of: ace_common* - -If you are worried that players haven't updated ACE3 or other mods to the version you're using on the server, you can place the "Check PBOs" module on your map. You can choose one of three posible actions that are being executed when a player joins that has a wrong version of ACE3 or an other mod: - -* Warn once -* Warn permanent -* Kick - -**Settings:** - -Name | Type | Description | Default value ----- | ---- | ---- | ---- | -Action | Option | What to do with people who do not have the right PBOs. | "Warn once" -Check all addons | Boolean | Check all addons instead of only those of ACE3? | "No" - - **Whitelist** - -You can make a whitelist of addons that don't have to be on the server. If you want to use the "Check all addons" option of this module and allow the usage of client side modifications like Blastcore or JSRS, you have to list them here. -The list must be in the following format: `["ADDON1","ADDON2",...]` where the addons are CfgPatches references to all PBOs of the optional mod. To figure these out, you can use the scripting command `activatedAddons` in the editor while those mods are enabled. - -Example 1: @Blastcore-A3:
-``` -["warfxpe","blastcore_vep"] -``` - -Example 2: @JSRS:
-``` -[TBD] -``` - -Example 3: @JSRS + @Blastcore-A3:
-``` -[TBD, "warfxpe","blastcore_vep"] -``` - -### 1.6 Explosive System -*Part of: ace_explosive* - -The "Explosive System" module lets you tweak the settings for the new explosive system that ACE3 introduces. - -**Settings:** - -Name | Type | Description | Default value ----- | ---- | ---- | ---- | -Require specialists? | Boolean | Require explosive specialists to disable explosives. | No -Punish non-specialists? | Boolean | Increase the time it takes to complete actions for non-specialists. | Yes -Explode on defusal? | Boolean | Enables certain explosives to explode on defusal? | Yes - -### 1.7 Finger settings -*Part of ace_finger* - -This module allow you to tweak settings for finger pointing such as is if it's enabled or the distance people can see you finger things - -**Settings:** - -Name | Type | Description | Default value ----- | ---- | ---- | ---- | -Finger pointing enabled | Boolean | | Yes -Finger Max Range | Number | How far away players can finger each others (in meters) | 4 - -### 1.8 Friendly Fire Messages -*Part of: ace_respawn* - -The "Friendly Fire Messages" module triggers a message when a player kills a friendly or civilian unit. This module isn't needed on servers with a low difficulty setting. - -### 1.9 Hearing -*Part of: ace_hearing* - -Placing this modules allows you to disable combat deafness usually triggered by loud explosions or heavy weapons in a players proximity. - -**Settings:** - -Name | Type | Description | Default value ----- | ---- | ---- | ---- | -Enable combat deafness? | Boolean | Enable combat deafness? | Yes - -### 1.10 Interaction System -*Part of: ace_interaction* - -This module allows you to tweak if players should be able to use team management functions (e.g. "switch group", "become leader"). - -**Settings:** - -Name | Type | Description | Default value ----- | ---- | ---- | ---- | -Enable Team Management | Boolean | Should players be allowed to use the Team Management Menu?. | Yes - -### 1.11 LSD Vehicles -*part of ace_common* - -Any vehicle linked to this module will become a seizure inducing machine of doom, no, really. - -### 1.12 Make Unit Surrender -*Part of: ace_captives* - -Syncing units to that module sets them in the captive state with their arms behind their back. Useful for e.g. hostage rescue missions. - -### 1.13 Map -*Part of: ace_map* - -ACE3 introduces a bit more realism for the vanilla Arma 3 map and how it behaves. Some of these settings can be toggled by this module. - -**Settings:** - -Name | Type | Description | Default value ----- | ---- | ---- | ---- | -Map illumination? | Boolean | Calculate dynamic map illumination based on light conditions?. | Yes -Map shake? | Boolean | Make map shake when walking?. | Yes -Limit map zoom? | Boolean | Limit the amount of zoom available for the map?. | No -Show cursor coordinates? | Boolean | Show the grid coordinates on the mouse pointer?. | No - -### 1.14 MicroDAGR Map Fill -*Part of: ace_microdagr* - -Controls how much data is filled on the microDAGR items. Less data restricts the map view to show less on the minimap. - -**Settings:** - -Name | Type | Description | Default value ----- | ---- | ---- | ---- | -MicroDAGR Map Fill | Option | How much map data is filled on MicroDAGR's. | "Full Satellite + Buildings" - -### 1.15 MK6 Settings -*Part of: ace_mk6mortar* - -ACE3 now includes the first iteration of getting a less arcady point and click mortar experience. -Placing this modules allows you to enable the increased realism in game. - -**Settings:** - -Name | Type | Description | Default value ----- | ---- | ---- | ---- | -Air Resistance | Boolean | For Player Shots, Model Air Resistance and Wind Effects. | No -Allow MK6 Computer | Boolean | Show the Computer and Rangefinder (these **NEED** to be removed if you enable air resistance). | No -Allow MK6 Compass | Boolean | Show the MK6 Digital Compass. | Yes - -### 1.16 Name Tags -*Part of: ace_nametags* - -This module allows you to tweak the settings for player names tags. - -**Settings:** - -Name | Type | Description | Default value ----- | ---- | ---- | ---- | -Show player names | Option | Let you choose when nametags appears. | "Do Not Force" -layer Names View Distance | Number | Distance (in meters) at which player names are shown. | 5 -Show name tags for AI? | Option | Show the name and rank tags for friendly AI units, or by default allows players to choose it on their own. | "Do Not Force" -Show crew info? | Option | Show vehicle crew info, or by default allows players to choose it on their own. | "Do Not Force" -Show for Vehicles? | Boolean | Show cursor NameTag for vehicle commander (only if client has name tags enabled). | No - -### 1.17 Rallypoint System -*Part of: ace_respawn* - -This module enables Mission Makers to specifically enable units to move a rallypoint. Every unit that is synced with that module is able to move a rallypoint. - -
-
Note:
-

It's important to mention that this doesn't work for player who join during a mission (JIP = Join in progress). That's something we can't change because that's the way Bohemia has implemented their module framework.

-
- -To enable JIP players to move rally points have a look at [ACE3 Rallypoints](./mission-tools.html#1.-ace-rallypoints). - -### 1.18 Respawn System -*Part of: ace_respawn* - -The "Respawn System" module enables players to respawn with the gear they had before dying and to remove bodies of players after a configurable interval (in seconds). - -**Settings:** - -Name | Type | Description | Default value ----- | ---- | ---- | ---- | -Save Gear? | Boolean | Respawn with the gear a player had just before his death. | No - -### 1.19 Sitting -*part of ace_sitting* - -This module is used to turn sitting on. - -**Settings:** - -Name | Type | Description | Default value ----- | ---- | ---- | ---- | -Enable sitting | Boolean | | Yes - -### 1.20 SwitchUnits System -*Part of: ace_switchunits* - -The [SwitchUnits System](./mission-tools.html#2.-ace-switchunits) enables players to control certain AI units on the map. - -**Settings:** - -Name | Type | Description | Default value ----- | ---- | ---- | ---- | -Switch To West? | Boolean | Allow switching to west units? | No -Switch To East? | Boolean | Allow switching to east units? | No -Switch To Independent? | Boolean | Allow switching to independent units? | No -Switch To Civilian? | Boolean | Allow switching to civilian units? | No -Enable Safe Zone? | Boolean | Enable a safe zone around enemy units? Players can't switch to units inside of the safe zone. | Yes -Safe Zone Radius | Number | The safe zone around players from a different team (in meters). | 200 - -### 1.21 Vehicle Lock -*Part of: ace_vehiclelock* - -These modules allow you to lock and unlock vehicles and their inventory using a key. Players don't receive a key automatically; for key names, see [Classnames Wiki](http://ace3mod.com/wiki/missionmaker/classnames.html#vehicle-lock). - -#### 1.21.1 Vehicle Key Assign -Sync with vehicles and players. Will handout custom keys to players for every synced vehicle. Only valid for objects present at mission start. -Example: `[bob, car1, true] call ACE_VehicleLock_fnc_addKeyForVehicle;` - will add a key to bob and program it to work only on car1 - -#### 1.21.2.1 Vehicle Lock Setup -Settings for lockpick strength and initial vehicle lock state. Removes ambiguous lock states. - -**Settings:** - -Name | Type | Description | Default value ----- | ---- | ---- | ---- | -Lock Vehicle Inventory? | Boolean | Locks the inventory of locked vehicles. | No -Vehicle Starting Lock State | Option | Set lock state for all vehicles (removes ambiguous lock states). | "As Is" -Default Lockpick Strength | Number | Default Time to lockpick (in seconds). | 10 - -#### 1.21.2.2 Vehicle setVariables -* `ACE_VehicleLock_lockSide` - SIDE: overrides a vehicle's side, allowing locking and unlocking using a different side's key. For example: Unlocking INDEP vehicles with a BLUFOR key. -* `ACE_vehicleLock_lockpickStrength` - NUMBER: seconds, determines how long lockpicking with take, overrides the value set in the module for a specific vehicle of the mission maker's choice. - -### 1.22 View Distance Limiter -*Part of: ace_viewdistance* - -This module allows disabling the ACE3 View Distance feature as well as setting a view distance limit. - -**Settings:** - -Name | Type | Description | Default value ----- | ---- | ---- | ---- | -Enable ACE viewdistance | Boolean | Enables ACE viewdistance. | Yes -View Distance Limit | Number | Sets the limit for how high clients can raise their view distance (<= 10 000) | 10000 - -### 1.23 Weather -*Part of: ace_weather* - -This module allows you to customize the weather settings. - -
-
Note:
-

ACE3 Weather overrides weather settings (editor, mission settings) and automatically calculates wind, temperature and pressure according to map location, date, time of day and cloud coverage and allows the weather to evolve realistically as the simulation progresses. Weather synchronization occurs between all clients.
Adjustment of the weather is possible by modifying the overcast value (for example: 0.7 may result in intermittent rain).

-
- -**Settings:** - -Name | Type | Description | Default value ----- | ---- | ---- | ---- | -Weather propagation | Boolean | Enables sever side weather propagation.(This is responsible for synchronizing weather between all clients. Disabling it is **NOT** recommended). | Yes -ACE3 Weather | Boolean | Overrides the default weather with ACE3 weather (map based)(This can be disabled without affecting the weather propagation above. Useful if you prefer changing weather settings manually). | Yes -Sync Rain | Boolean | Synchronizes rain. | Yes -Sync Wind | Boolean | Synchronizes wind. | Yes -Sync Misc | Boolean | Synchronizes lightnings, rainbow, fog, ... | Yes -Update Interval | Number | Defines the interval (seconds) between weather updates. | 60 - -### 1.24 Wind Deflection -*Part of: ace_winddeflection* - -This module allows you to define when wind deflection is active. - -
-
Note:
-

Wind Deflection is compatible with Advanced Ballistics and allows the following combinations: -

    -
  • Only wind deflection
  • -
  • Only advanced ballistics
  • -
  • Combined wind deflection + advanced ballistics
  • -

-
- -**Settings:** - -Name | Type | Description | Default value ----- | ---- | ---- | ---- | -Wind Deflection | Boolean | Enables wind deflection. | Yes -Vehicle Enabled | Boolean | Enables wind deflection for static/vehicle gunners. | Yes -Simulation Interval | Number | Defines the interval between every calculation step. | 0.05 -Simulation Radius | Number | Defines the radius around the player (in meters) at which projectiles are wind deflected. | 3000 - -### 1.25 Zeus Settings -*part of: ace_zeus* - -This module provides control over vanilla aspects of Zeus. - -**Settings:** - -Name | Type | Description | Default value ----- | ---- | ---- | ---- | -Ascension Messages | Boolean | Display global pop-up messages when a player is assigned as Zeus. | No -Zeus Eagle | Boolean | Spawn an eagle that follows the Zeus camera. | No -Wind Sounds | Boolean | Play wind sounds when Zeus remote controls a unit. | No -Ordnance Warning | Boolean | Play a radio warning when Zeus uses ordnance. | No -Reveal Mines | Option | Reveal mines to allies and place map markers. | "Disabled" - -## 2. ACE3 Medical -*Part of: ace_medical* - -### 2.1 Medical Settings - -This module allows to tweak all the medical settings used in ACE3 - -**Settings:** - -Name | Type | Description | Default value ----- | ---- | ---- | ---- | -Medical Level | Option | What is the medical simulation level? | "Basic" -Medics setting | Option | What is the level of detail preferred for medics? | "Basic" -Enable Litter | Boolean | Enable litter being created upon treatment. | "Yes" -Life time of litter objects | Number | How long should litter objects stay? In seconds. -1 is forever. | 1800 -Enable Screams | Boolean | Enable screaming by injured units. | Yes -Player Damage | Number | What is the damage a player can take before being killed? | 1 -AI Damage | Number | What is the damage an AI can take before being killed? | 1 -AI Unconsciousness | Option | Allow AI to go unconscious. | "50/50" -Remote controlled AI | Boolean | Treats remote controlled units as AI not players? | Yes -Prevent instant death | Boolean | Have a unit move to unconscious instead of death. | No -Bleeding coefficient | Number | Coefficient to modify the bleeding speed. | 1 -Pain coefficient | Number | Coefficient to modify the pain intensity. | 1 -Sync status | Boolean | Keep unit status synced. (Recommended on). | Yes - -### 2.2 Advanced Medical Settings - -This module allows you to change the default Advanced Medical Settings, when [2.1 Medical Settings](#2.1-medical-settings) is set to "Advanced". - -**Settings:** - -Name | Type | Description | Default value ----- | ---- | ---- | ---- | -Enabled for | Option | Select what units the advanced medical system will be enabled for. | "Players only" -Enable Advanced wounds | Boolean | Allow reopening of bandaged wounds? | No -Vehicle Crashes | Boolean | Do units take damage from a vehicle crash? | Yes -Allow PAK | Option | Who can use the PAK for full heal? | "Medics only" -Remove PAK on use | Boolean | Should PAK be removed on usage? | Yes -Locations PAK | Option | Where can the personal aid kit be used? | "Vehicles & facility" -Allow Surgical kit | Option | Who can use the surgical kit? | "Medics only" -Remove Surgical kit | Boolean | Should Surgical kit be removed on usage? | Yes -Locations Surgical kit | Option | Where can the Surgical kit be used? | "Vehicles & facility" -Bloodstains | Boolean | Bandaging removes bloodstains. | No -Pain suppression | Boolean | Pain is only temporarily suppressed not removed. | Yes - -### 2.3 Revive Settings - -This modules allows a mission maker to limit the amount of revives for units in basic and advanced medical. - -**Settings:** - -Name | Type | Description | Default value ----- | ---- | ---- | ---- | -Enable Revive | Option | Enable a basic revive system. | "disabled" -Max Revive time | Number | Max amount of seconds a unit can spend in revive state | 120 -Max Revive lives | Number | Max amount of lives a unit. 0 or -1 is disabled. | -1 - -### 2.4 Set Medic Class - -Using this module you can define which unit class is defined as a medic / doctor. - -**Settings:** - -Name | Type | Description | Default value ----- | ---- | ---- | ---- | -List | String | List of unit names that will be classified as medic, separated by commas. | "" -Is Medic | Boolean | Medics allow for more advanced treatment in case of Advanced Medic roles enabled. | "Regular medic" - - -### 2.5 Set Medical Facility - -Defines an object as a medical facility. This allows for more advanced treatments. Can be synced with buildings and vehicles. - -**Settings:** - -Name | Type | Description | Default value ----- | ---- | ---- | ---- | -Is Medical Facility | Boolean | Registers an object as a medical facility. | Yes - -### 2.6 Set Medical Vehicle - -Defines an object as a medical facility. This allows for more advanced treatments. Can be synced with buildings and vehicles. - -**Settings:** - -Name | Type | Description | Default value ----- | ---- | ---- | ---- | -List | String | List of vehicles that will be classified as medical vehicle, separated by commas. | "" -Is Medical Vehicle | Boolean | Whether or not the objects in the list will be a medical vehicle. | Yes - -## 3. ACE3 Mission Modules -*Part of: ace_missionmodules* - -### 3.1 Ambiance Sounds - -Used for ambiance sounds loop (synced across MP). - -This module randomizes the time when the sound file is played and the position where the sound file is played (If "Follow Players" is set to No). -`Minimal Distance` and `Maximal Distance` influence the position from where the sound file is played. Setting both values to 0 forces the module to play the sound from where it was placed in the editor. -`Minimal Delay` and `Maximal Delay` work in a similar fashion but are used to randomize when the sound file is played. Setting both values to 0 plays the sound from mission start. - -**Settings:** - -Name | Type | Description | Default value ----- | ---- | ---- | ---- | -Sounds | String | Class names of the ambiance sounds played. Separated by ','. (Example: `radio_track_01, electricity_loop`)| "" -Minimal Distance | Number | Used for calculating a random position and sets the minimal distance between the players and the played sound file(s) (in meters) | 400 -Maximum Distance | Number | Used for calculating a random position and sets the maximum distance between the players and the played sound file(s) (in meters) | 900 -Minimal Delay | Number | Minimal delay (in seconds) between sounds played | 10 -Maximum Delay | Number | Maximum delay (in seconds) between sounds played | 10 -Follow Players | Boolean | Follow players. If set to false, loop will play sounds only nearby logic position. | No -Volume | Number | The volume of the sounds played. | 1 - -### 3.2 Slideshow -*part of ace_slideshow* - -This module is the core of `ace_slideshow` for more informations about slideshow check [the mission-tools section](./mission-tools.html) - -**Settings:** - -Name | Type | Description | Default value ----- | ---- | ---- | ---- | -Objects | String | Object names (can also be synchronized objects) slide-show will be displayed on, separated by commas if multiple. | "" -Controllers | String | Controller object names, separated by commas if multiple. | "" -Images | String | List of images that will be used for the slide-show, separated by commas, with full path correctly formatted (eg. images\image.paa). | "" -Interaction names | String | List of names that will be used for interaction entries, separated by commas, in order of images. | Number | | 0 "" -Slide Duration | Number | Duration of each slide (in seconds) (0 = automatic slides disabled) | 0 \ No newline at end of file diff --git a/documentation/user/how-to-make-a-feature-request.md b/documentation/user/how-to-make-a-feature-request.md deleted file mode 100644 index 96bec54fb8..0000000000 --- a/documentation/user/how-to-make-a-feature-request.md +++ /dev/null @@ -1,23 +0,0 @@ ---- -layout: wiki -title: How to make a feature request -description: ACE3 requires a special procedure to make feature requests. Because due to our current work load, in the period of weeks prior and posterior to the first release, new feature requests are under embargo. -group: user -order: 11 -parent: wiki ---- - -### 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. - -
-
Note:
-

Due to our current work load, in the period of weeks prior and posterior to the first release, new feature requests are under embargo. Feel free to submit yours now, but don't expect them to be considered just yet. Any treatment or attention by developers towards the feature request thread is highly unlikely during this time.

-
- -### 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. diff --git a/documentation/user/how-to-report-an-issue.md b/documentation/user/how-to-report-an-issue.md deleted file mode 100644 index 96f2dd76c3..0000000000 --- a/documentation/user/how-to-report-an-issue.md +++ /dev/null @@ -1,53 +0,0 @@ ---- -layout: wiki -title: How to report an issue -description: If you've found an issue with ACE3 please read this entry before reporting it. -group: user -order: 10 -parent: wiki ---- - -### Before reporting - -If you've 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 `@ACE3` 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 @ACE3 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 -* @ace3 - -**Placed ACE3 Modules:** -* *Add the list of modules you have placed on the map. Use 'None' if the error occurs without using any modules.* - -**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", "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. diff --git a/documentation/user/information-center.md b/documentation/user/information-center.md deleted file mode 100644 index b1a1e8e9f0..0000000000 --- a/documentation/user/information-center.md +++ /dev/null @@ -1,53 +0,0 @@ ---- -layout: wiki -title: Information center -description: Downloaded ACE3 and have no idea where to start? This page serves as a document to help new players get started with things or get an answer to some of your questions. -group: user -order: 0 -parent: wiki ---- - -Downloaded ACE3 and have no idea where to start? This page serves as a starting point to help new players and mission makers understand what's available to them. - - -- You don't know where to begin your ACE3 journey? [**Check out ACE3 features**](http://ace3mod.com/wiki/feature/) - - -- You are a mission maker but you don't know what ACE3 has to offer? [**We have some documentation for you**](http://ace3mod.com/wiki/missionmaker/) - - -- Are you searching for ACE3 classnames ? [**Here they are**](http://ace3mod.com/wiki/missionmaker/classnames.html) - - -## 1. FAQ -### 1.1 Features -**Q:** Where is X feature?
-**A:** When it's done.
- -**Q:** Feature X was in ACE2/AGM/CSE where is it?
-**A:** It's going to be ported at some point.
- -**Q:** Why was my feature request closed on GitHub?
-**A:** Feature requests should initially be added to issue #414 for easy tracking.[HERE](https://github.com/acemod/ACE3/issues/414/) - -**Q:** I want to disable feature X how do I do it?
-**A:** Simply delete the PBO.(note that some features depends on others, check dependencies before deleting anything).
- -### 1.2 Issues - -**Q:** Laser locking is broken, when are you going to fix it?
-**A:** Fun fact, it isn't, you need to come from the direction of the laser, (laser is pointing to the east, you come from the west) and you drop the GBU, it will then guide itself to the target. The reasoning behind that is that the vehicle or building laser designated would obstruct the laser and the GBU would then be unable to lock on it.
- -**Q:** I take vanilla damage with ACE 3.1.1
-**A:** This has been fixed on ACE3 master and will be fixed in the next release, in the meantime Basic medical doesn't have that issue.
- -**Q:** I'm having dll errors.
-**A:** Remove ACE3 from your Arma 3 folder and repeat the installation process (don't forget to re-download).
- -### 1.3 Compatibility - -**Q:**(mod) doesn't have some ACE3 features.
-**A:**ACE3 isn't and can't be responsible for compatibility with every (mod), due it's size other (mod) authors are strongly encouraged to provide that from their side. Compatibility PBOs currently in ACE3 are there to kick-start and provide examples for (mod) authors.
- -**Q:** ACE3 causes issues in (mod).
-**A:**If you've 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 @ACE3 on a newly created mission. ACE3 isn't and can't be responsible for all mod conflicts, due it's size other mod authors are strongly encouraged to provide that from their side.
\ No newline at end of file diff --git a/documentation/user/installation-guide.md b/documentation/user/installation-guide.md deleted file mode 100644 index 751b698cce..0000000000 --- a/documentation/user/installation-guide.md +++ /dev/null @@ -1,63 +0,0 @@ ---- -layout: wiki -title: Installation Guide -description: Step-by-step guide for installing ACE3 -group: user -order: 0 -parent: wiki ---- - -## 1. Overview -This guide will explain how to get ACE3 up and running faster than you can say banana. - -## 2. Prerequisites -- Download [CBA](http://www.armaholic.com/page.php?id=18767). -- Download [ACE3](https://github.com/acemod/ACE3/releases/latest). -- Know how to extract .zip files. Use [Google](https://www.google.com) if not sure. - -## 3. Install ACE3 -- Extract both CBA and ACE3 .zip files into your Arma 3 folder. By default this is located in:
-32-Bit - `C:/Program Files/Steam/Steamapps/Common/Arma 3/`
-64-Bit - `C:/Program Files (x86)/Steam/Steamapps/Common/Arma 3/` -- After extraction you should have the `@ace` and `@CBA_A3` folders inside your Arma 3 folder. - -## 4. Install ACE3 Optional components -
-
Note:
-

Skip this step if you're not using additional mods. If you are, consult with your mission maker before installing any of these components. If you are a Mod creator, please visit the [Modularity and PBO Structure](http://ace3mod.com/wiki/development/modularity-and-pbo-structure.html) page for more information.

-
- -### 4.1 What do they do? -Optional components supplement 3rd party mods with ACE3 features, for example: -- Optional weapon components make Advanced Ballistics possible, as well as the ability to use ACE3 weapon attachments with 3rd party weapons like RHS, HLC, etc. -- Optional tracers component brings back ACE2 ball tracers. -- Optional server component is used to load the userconfig files. - -### 4.2 Which optionals should I use? -Only use the optional components that correspond with your mod-pack. - -### 4.3 How to install these components? -- Inside your `Arma 3/@ace/` folder, you'll find the `optionals` and `addons` folders. -- Copy and paste the relevant `.pbo` and `.bisign` files from the `optionals` folder into the `addons` folder. -- Copy and paste the `userconfig` folder from the `optionals` folder into root `Arma 3` folder. - -## 5. Launch Arma 3 with ACE3 -- Launch Arma 3 to start the official game Launcher. -- Click `Mods` and make sure the checkboxes next to `ace` and `CBA_A3` are ticked. -Arma 3 Vanilla Launcher -- Click `Play` - -## 6. Alternative launch methods - -### 6.1 Steam Launch Parameters -- Not supported with the new Arma 3 Launcher - -### 6.2 Arma 3Sync -- Inspect `Addon Options` and verify the `Addon Search Directories` are leading to your Arma 3 folder. -- Return to the `Addons` tab and click `Refresh`. -- Right-click inside `Addon Groups`, click `Create Group` and give it a name. -- Drag and drop `@ace` and `@CBA_A3` from `Available Addons` into the new Group you created inside `Addon Groups` and make sure the checkboxes are ticked. -Arma 3Sync Launcher -- Click `Start Game` - -### 5.3 Play withSIX diff --git a/documentation/user/promotional-material.md b/documentation/user/promotional-material.md deleted file mode 100644 index 98a8ace6b5..0000000000 --- a/documentation/user/promotional-material.md +++ /dev/null @@ -1,36 +0,0 @@ ---- -layout: wiki -title: Promotional Material -description: Promotional materials like logos and color values. -group: user -order: 20 -parent: wiki ---- - -You are hereby granted to use the ACE3 logos and imagery for promotional purposes. You are NOT allowed to use it commercially. - -## 1. Colors - -* White: `#ffffff, rgb(255, 255, 255)` -* Black: `#000000, rgb(0, 0, 0)` -* Red: `#ba2619, rgb(186, 38, 25)` - - -## 2. Logo -When using the ACE3 logo please do not stretch or skew it. - -### 2.1 Black - - - -* [JPG (white background)](https://github.com/KoffeinFlummi/ACE3/blob/master/extras/assets/logo/black/ACE3-Logo.jpg) -* [PNG (transparent background)](https://github.com/KoffeinFlummi/ACE3/blob/master/extras/assets/logo/black/ACE3-Logo.png) -* [EPS (vector file)](https://github.com/KoffeinFlummi/ACE3/blob/master/extras/assets/logo/black/ACE3-Logo.eps) - -### 2.2 White - - - -* [JPG (black background)](https://github.com/KoffeinFlummi/ACE3/blob/master/extras/assets/logo/white/ACE3-Logo.jpg) -* [PNG (transparent background)](https://github.com/KoffeinFlummi/ACE3/blob/master/extras/assets/logo/white/ACE3-Logo.png) -* [EPS (vector file)](https://github.com/KoffeinFlummi/ACE3/blob/master/extras/assets/logo/white/ACE3-Logo.eps) diff --git a/documentation/user/shortcuts.md b/documentation/user/shortcuts.md deleted file mode 100644 index 59b7975340..0000000000 --- a/documentation/user/shortcuts.md +++ /dev/null @@ -1,215 +0,0 @@ ---- -layout: wiki -title: Shortcuts -description: A list containing all default shortcuts in ACE3 -group: user -order: 5 -parent: wiki ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ShortcutActionPBO
Ctrl+⇧ Shift+KShow ProtractorACE_Advanced_Ballistics
⊞ WinInteraction menuACE_Interaction
Ctrl+⊞ WinSelf-interaction menuACE_Interaction
Ctrl+SpaceOpen/close doorACE_Interaction
Ctrl+TTap on the shoulderACE_Interaction
CtrlModifier keyACE_Logistics
Ctrl+⇧ Shift+TWipe off gogglesACE_Goggles
8Switch grenade modeACE_Grenades
CtrlShow namesACE_NameTags
Alt+Page UpNVG: Increase brightnessACE_NightVision
Alt+Page DownNVG: Decrease brightnessACE_NightVision
⇧ Shift+RClear firearm malfunctionACE_Overheating
OAltimeterACE_Parachute
Ctrl+RCheck ammunitionACE_Reload
`Safety toggleACE_SafeMode
Page UpScope: Elevation upACE_Scopes
Page DownScope: Elevation downACE_Scopes
Ctrl+Page UpScope: Windage leftACE_Scopes
Ctrl+Page DownScope: Windage rightACE_Scopes
Tab ↹Vector: Azimuth keyACE_Vector
RVector: Distance keyACE_Vector
DelSpeed limiterACE_Vehicles
1PistolACE_WeaponSelect
2RifleACE_WeaponSelect
3Grenade launcherACE_WeaponSelect
5BinocularsACE_WeaponSelect
6Frag grenadeACE_WeaponSelect
7Non-frag grenadeACE_WeaponSelect
0Holster weaponACE_WeaponSelect
2Engine onACE_WeaponSelect
1Engine offACE_WeaponSelect
3Primary weaponACE_WeaponSelect
4Machine gunACE_WeaponSelect
5MissilesACE_WeaponSelect
9Fire smoke launcherACE_WeaponSelect
Tab ↹FCS: Lase target (measure distance)ACE_FireControlSsystem
Page UpFCS: Range upACE_FireControlSsystem
Page DownFCS: Range downACE_FireControlSsystem
⇧ Shift+KShow Wind InfoACE_Weather
diff --git a/extensions/medical/medical.cpp b/extensions/medical/medical.cpp index 3dcf3196ab..78517b99d4 100644 --- a/extensions/medical/medical.cpp +++ b/extensions/medical/medical.cpp @@ -39,26 +39,47 @@ void __stdcall RVExtension(char *output, int outputSize, const char *function) { std::vector arguments = parseExtensionInput(function); if (arguments.size() > 0) { - std::string command = arguments.at(0); - arguments.erase(arguments.begin()); - - if (command == "addInjuryType") { - returnValue = ace::medical::handleDamage::GetInstance().AddInjuryType(arguments); - } - else if (command == "addDamageType") { - returnValue = ace::medical::handleDamage::GetInstance().AddDamageType(arguments); - } - else if (command == "HandleDamageWounds") { - if (arguments.size() >= 4) { - std::string selectionName = arguments.at(0); - double amountOfDamage = std::stod(arguments.at(1)); - std::string typeOfDamage = arguments.at(2); - int woundID = std::stoi(arguments.at(3)); - returnValue = ace::medical::handleDamage::GetInstance().HandleDamageWounds(selectionName, amountOfDamage, typeOfDamage, woundID); + try { + std::string command = arguments.at(0); + arguments.erase(arguments.begin()); + + if (command == "addInjuryType") { + returnValue = ace::medical::handleDamage::GetInstance().AddInjuryType(arguments); + } + else if (command == "addDamageType") { + returnValue = ace::medical::handleDamage::GetInstance().AddDamageType(arguments); + } + else if (command == "HandleDamageWounds") { + if (arguments.size() >= 4) { + std::string selectionName = arguments.at(0); + double amountOfDamage = std::stod(arguments.at(1)); + std::string typeOfDamage = arguments.at(2); + int woundID = std::stoi(arguments.at(3)); + returnValue = ace::medical::handleDamage::GetInstance().HandleDamageWounds(selectionName, amountOfDamage, typeOfDamage, woundID); + } + } + else if (command == "ConfigComplete") { + ace::medical::handleDamage::GetInstance().FinalizeDefinitions(); } } - else if (command == "ConfigComplete") { - ace::medical::handleDamage::GetInstance().FinalizeDefinitions(); + catch (std::exception e) { + std::stringstream debugreturn; + debugreturn << "diag_log format['ACE3 ERROR - Medical Extension: Something went wrong. Input: '];"; + int i = 0; + for (auto arg : arguments) { + debugreturn << "diag_log format[' arg " << i++ << ":" << arg << "'];"; + } + debugreturn << "diag_log format['Exception: " << e.what() << "'];"; + returnValue = debugreturn.str(); + } + catch (...) { + std::stringstream debugreturn; + debugreturn << "diag_log format['ACE3 ERROR - Medical Extension: Something went wrong. Input: '];"; + int i = 0; + for (auto arg : arguments) { + debugreturn << "diag_log format[' arg " << i++ << ":" << arg << "'];"; + } + returnValue = debugreturn.str(); } } strncpy(output, returnValue.c_str(), outputSize); diff --git a/extras/assets/icons/Icon_Module_png/Icon_Module_Cargo_ca.png b/extras/assets/icons/Icon_Module_png/Icon_Module_Cargo_ca.png new file mode 100644 index 0000000000..0209ed8676 Binary files /dev/null and b/extras/assets/icons/Icon_Module_png/Icon_Module_Cargo_ca.png differ diff --git a/mod.cpp b/mod.cpp index 0f16ca182a..2e8513a952 100644 --- a/mod.cpp +++ b/mod.cpp @@ -1,8 +1,8 @@ -name = "Advanced Combat Environment 3.2.1"; +name = "Advanced Combat Environment 3.3.2"; picture = "logo_ace3_ca.paa"; actionName = "GitHub"; action = "https://github.com/acemod/ACE3"; -description = "ACE3 - Version 3.2.1"; +description = "ACE3 - Version 3.3.2"; logo = "logo_ace3_ca.paa"; logoOver = "logo_ace3_ca.paa"; tooltip = "ACE3"; diff --git a/optionals/compat_asdg/$PBOPREFIX$ b/optionals/compat_asdg/$PBOPREFIX$ deleted file mode 100644 index 0ba5166c16..0000000000 --- a/optionals/compat_asdg/$PBOPREFIX$ +++ /dev/null @@ -1 +0,0 @@ -z\ace\addons\compat_asdg \ No newline at end of file diff --git a/optionals/compat_asdg/config.cpp b/optionals/compat_asdg/config.cpp deleted file mode 100644 index 40dae32051..0000000000 --- a/optionals/compat_asdg/config.cpp +++ /dev/null @@ -1,38 +0,0 @@ -#include "script_component.hpp" - -class CfgPatches { - class ADDON { - units[] = {}; - weapons[] = {}; - requiredVersion = REQUIRED_VERSION; - requiredAddons[] = {"asdg_jointrails","ace_laserpointer","ace_optics"}; - author[]={"OnkelDisMaster"}; - authorUrl = "http://2.xn--gebirgsjgerkompanie-nwb.de/"; - VERSION_CONFIG; - }; -}; - -class asdg_SlotInfo; -class asdg_FrontSideRail: asdg_SlotInfo { - class compatibleItems { - ACE_acc_pointer_red = 1; - ACE_acc_pointer_green = 1; - ACE_acc_pointer_green_IR = 1; - }; -}; - -class asdg_OpticRail; -class asdg_OpticRail1913: asdg_OpticRail { - class compatibleItems { - ACE_optic_Hamr_2D = 1; - ACE_optic_Hamr_PIP = 1; - ACE_optic_Arco_2D = 1; - ACE_optic_Arco_PIP = 1; - ACE_optic_MRCO_2D = 1; - ACE_optic_MRCO_PIP = 1; - ACE_optic_SOS_2D = 1; - ACE_optic_SOS_PIP = 1; - ACE_optic_LRPS_2D = 1; - ACE_optic_LRPS_PIP = 1; - }; -}; diff --git a/optionals/compat_asdg/script_component.hpp b/optionals/compat_asdg/script_component.hpp deleted file mode 100644 index e67bf3b9e4..0000000000 --- a/optionals/compat_asdg/script_component.hpp +++ /dev/null @@ -1,5 +0,0 @@ -#define COMPONENT asdg_comp - -#include "\z\ace\addons\main\script_mod.hpp" - -#include "\z\ace\addons\main\script_macros.hpp" diff --git a/optionals/compat_bwa3/$PBOPREFIX$ b/optionals/compat_bwa3/$PBOPREFIX$ deleted file mode 100644 index 7331009959..0000000000 --- a/optionals/compat_bwa3/$PBOPREFIX$ +++ /dev/null @@ -1 +0,0 @@ -z\ace\addons\compat_bwa3 \ No newline at end of file diff --git a/optionals/compat_bwa3/CfgAmmo.hpp b/optionals/compat_bwa3/CfgAmmo.hpp deleted file mode 100644 index c19e00819a..0000000000 --- a/optionals/compat_bwa3/CfgAmmo.hpp +++ /dev/null @@ -1,142 +0,0 @@ -class CfgAmmo { - class B_9x21_Ball; - class B_556x45_Ball_Tracer_Red; - class B_762x51_Tracer_Red; - class B_127x99_Ball_Tracer_Red; - class GrenadeHand; - class BWA3_B_556x45_Ball: B_556x45_Ball_Tracer_Red { - ACE_caliber=5.69; - ACE_bulletLength=23.012; - ACE_bulletMass=4.0176; - ACE_ammoTempMuzzleVelocityShifts[]={-27.20, -26.44, -23.76, -21.00, -17.54, -13.10, -7.95, -1.62, 6.24, 15.48, 27.75}; - ACE_ballisticCoefficients[]={0.151}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ASM"; - ACE_dragModel=7; - ACE_muzzleVelocities[]={723, 764, 796, 825, 843, 866, 878, 892, 906, 915, 922, 900}; - ACE_barrelLengths[]={210.82, 238.76, 269.24, 299.72, 330.2, 360.68, 391.16, 419.1, 449.58, 480.06, 508.0, 609.6}; - }; - class BWA3_B_556x45_Ball_SD: BWA3_B_556x45_Ball { - // Reference? - ACE_ballisticCoefficients[]={}; - ACE_velocityBoundaries[]={}; - ACE_muzzleVelocities[]={}; - ACE_barrelLengths[]={}; - }; - class BWA3_B_556x45_Ball_AP: BWA3_B_556x45_Ball { - ACE_caliber=5.69; - ACE_bulletLength=23.012; - ACE_bulletMass=4.5359237; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; - ACE_ballisticCoefficients[]={0.310}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ASM"; - ACE_dragModel=1; - ACE_muzzleVelocities[]={820, 865, 880}; - ACE_barrelLengths[]={254.0, 393.7, 508.0}; - }; - class BWA3_B_762x51_Ball: B_762x51_Tracer_Red { - ACE_caliber=7.823; - ACE_bulletLength=28.956; - ACE_bulletMass=9.4608; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; - ACE_ballisticCoefficients[]={0.2}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ICAO"; - ACE_dragModel=7; - ACE_muzzleVelocities[]={700, 800, 820, 833, 845}; - ACE_barrelLengths[]={254.0, 406.4, 508.0, 609.6, 660.4}; - }; - class BWA3_B_762x51_Ball_SD: BWA3_B_762x51_Ball { - ACE_caliber=7.823; - ACE_bulletLength=34.036; - ACE_bulletMass=12.96; - ACE_ammoTempMuzzleVelocityShifts[]={-2.655, -2.547, -2.285, -2.012, -1.698, -1.280, -0.764, -0.153, 0.596, 1.517, 2.619}; - ACE_ballisticCoefficients[]={0.235}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ICAO"; - ACE_dragModel=7; - ACE_muzzleVelocities[]={305, 325, 335, 340}; - ACE_barrelLengths[]={406.4, 508.0, 609.6, 660.4}; - }; - class BWA3_B_762x51_Ball_AP: BWA3_B_762x51_Ball { - ACE_caliber=7.823; - ACE_bulletLength=31.496; - ACE_bulletMass=8.22946157; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; - ACE_ballisticCoefficients[]={0.359}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ICAO"; - ACE_dragModel=1; - ACE_muzzleVelocities[]={875, 910, 930}; - ACE_barrelLengths[]={330.2, 406.4, 508.0}; - }; - class BWA3_B_762x51_Ball_LR: BWA3_B_762x51_Ball { - ACE_caliber=7.823; - ACE_bulletLength=31.496; - ACE_bulletMass=11.34; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; - ACE_ballisticCoefficients[]={0.243}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ICAO"; - ACE_dragModel=7; - ACE_muzzleVelocities[]={750, 780, 790, 794}; - ACE_barrelLengths[]={406.4, 508.0, 609.6, 660.4}; - }; - class BWA3_B_127x99_Ball: B_127x99_Ball_Tracer_Red { - ACE_caliber=12.954; - ACE_bulletLength=58.674; - ACE_bulletMass=41.9256; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; - ACE_ballisticCoefficients[]={0.670}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ASM"; - ACE_dragModel=1; - ACE_muzzleVelocities[]={900}; - ACE_barrelLengths[]={736.6}; - }; - class BWA3_B_127x99_Ball_SD: BWA3_B_127x99_Ball { - // Reference? - ACE_ballisticCoefficients[]={}; - ACE_velocityBoundaries[]={}; - ACE_muzzleVelocities[]={}; - ACE_barrelLengths[]={}; - }; - class BWA3_B_127x99_Ball_AP: BWA3_B_127x99_Ball { - ACE_caliber=12.954; - ACE_bulletLength=58.674; - ACE_bulletMass=41.9904; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; - ACE_ballisticCoefficients[]={0.670}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ASM"; - ACE_dragModel=1; - ACE_muzzleVelocities[]={900}; - ACE_barrelLengths[]={736.6}; - }; - class BWA3_B_46x30_Ball: B_9x21_Ball { - ACE_caliber=4.902; - ACE_bulletLength=13.005; - ACE_bulletMass=2.0088; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; - ACE_ballisticCoefficients[]={0.1455}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ICAO"; - ACE_dragModel=1; - ACE_muzzleVelocities[]={680, 720, 730, 740}; - ACE_barrelLengths[]={101.6, 177.8, 228.6, 304.8}; - }; - class BWA3_B_46x30_Ball_SD: BWA3_B_46x30_Ball { - // Reference? - ACE_ballisticCoefficients[]={}; - ACE_velocityBoundaries[]={}; - ACE_muzzleVelocities[]={}; - ACE_barrelLengths[]={}; - }; - class BWA3_G_DM51A1: GrenadeHand { - ace_frag_metal = 296; - ace_frag_charge = 180; - ace_frag_gurney_c = 2930; // Gurney velocity constant for PETN - ace_frag_gurney_k = 1/2; // shape factor for a cylinder - }; -}; \ No newline at end of file diff --git a/optionals/compat_bwa3/CfgMagazines.hpp b/optionals/compat_bwa3/CfgMagazines.hpp deleted file mode 100644 index bf43af6426..0000000000 --- a/optionals/compat_bwa3/CfgMagazines.hpp +++ /dev/null @@ -1,9 +0,0 @@ -class CfgMagazines { - class CA_Magazine; - class BWA3_200Rnd_556x45: CA_Magazine { - ACE_isBelt = 1; - }; - class BWA3_120Rnd_762x51: CA_Magazine { - ACE_isBelt = 1; - }; -}; \ No newline at end of file diff --git a/optionals/compat_bwa3/CfgWeapons.hpp b/optionals/compat_bwa3/CfgWeapons.hpp deleted file mode 100644 index c0acea9912..0000000000 --- a/optionals/compat_bwa3/CfgWeapons.hpp +++ /dev/null @@ -1,173 +0,0 @@ -class CfgWeapons { - class Pistol_Base_F; - class Rifle_Base_F; - class Rifle_Long_Base_F; - class UGL_F; - class BWA3_P8: Pistol_Base_F { - ACE_barrelTwist=248.92; - ACE_barrelLength=108; - }; - class BWA3_MP7: Pistol_Base_F { - ACE_barrelTwist=160.02; - ACE_barrelLength=180; - }; - class BWA3_G36: Rifle_Base_F { - ACE_barrelTwist=177.8; - ACE_barrelLength=480; - }; - class BWA3_G36K: BWA3_G36 { - ACE_barrelTwist=177.8; - ACE_barrelLength=318; - }; - class BWA3_G28_Standard: Rifle_Long_Base_F { - ACE_barrelTwist=304.8; - ACE_barrelLength=421; - }; - class BWA3_G28_Assault: BWA3_G28_Standard { - ACE_barrelTwist=304.8; - ACE_barrelLength=421; - }; - class BWA3_G27: BWA3_G28_Standard { - ACE_barrelTwist=304.8; - ACE_barrelLength=406; - }; - class BWA3_G27_AG: BWA3_G27 { - class AG40: UGL_F { - magazines[] += { - "ACE_HuntIR_M203" - }; - }; - }; - class BWA3_MG4: Rifle_Long_Base_F { - ACE_barrelTwist=177.8; - ACE_barrelLength=480; - }; - class BWA3_MG5: Rifle_Long_Base_F { - ACE_barrelTwist=304.8; - ACE_barrelLength=550; - }; - class BWA3_G82: Rifle_Long_Base_F { - ACE_barrelTwist=381.0; - ACE_barrelLength=736.7; - }; - class AG40: UGL_F { - magazines[] += { - "ACE_HuntIR_M203" - }; - }; - class optic_Hamr; - class InventoryOpticsItem_Base_F; - - class BWA3_optic_ZO4x30 : optic_Hamr { - ACE_ScopeAdjust_Vertical[] = { -10, 10 }; - ACE_ScopeAdjust_Horizontal[] = { -10, 10 }; - ACE_ScopeAdjust_VerticalIncrement = 0.2; - ACE_ScopeAdjust_HorizontalIncrement = 0.2; - class ItemInfo : InventoryOpticsItem_Base_F { - class OpticsModes { - class Scope { - discreteDistance[] = { 200 }; - discreteDistanceInitIndex = 0; - }; - }; - }; - }; - class BWA3_optic_ZO4x30_NSV : optic_Hamr { - ACE_ScopeAdjust_Vertical[] = { -10, 10 }; - ACE_ScopeAdjust_Horizontal[] = { -10, 10 }; - ACE_ScopeAdjust_VerticalIncrement = 0.2; - ACE_ScopeAdjust_HorizontalIncrement = 0.2; - class ItemInfo : InventoryOpticsItem_Base_F { - class OpticsModes { - class Scope { - discreteDistance[] = { 200 }; - discreteDistanceInitIndex = 0; - }; - }; - }; - }; - class BWA3_optic_ZO4x30_IRV : optic_Hamr { - ACE_ScopeAdjust_Vertical[] = { -10, 10 }; - ACE_ScopeAdjust_Horizontal[] = { -10, 10 }; - ACE_ScopeAdjust_VerticalIncrement = 0.2; - ACE_ScopeAdjust_HorizontalIncrement = 0.2; - class ItemInfo : InventoryOpticsItem_Base_F { - class OpticsModes { - class Scope { - discreteDistance[] = { 200 }; - discreteDistanceInitIndex = 0; - }; - }; - }; - }; - class BWA3_optic_Shortdot : optic_Hamr { - ACE_ScopeAdjust_Vertical[] = { -0.1, 10.1 }; - ACE_ScopeAdjust_Horizontal[] = { -5.1, 5.1 }; - ACE_ScopeAdjust_VerticalIncrement = 0.1; - ACE_ScopeAdjust_HorizontalIncrement = 0.1; - class ItemInfo : InventoryOpticsItem_Base_F { - class OpticsModes { - class Scope { - discreteDistance[] = { 100 }; - discreteDistanceInitIndex = 0; - }; - }; - }; - }; - class BWA3_optic_20x50 : optic_Hamr { - ACE_ScopeAdjust_Vertical[] = { 0, 26 }; - ACE_ScopeAdjust_Horizontal[] = { -6, 6 }; - ACE_ScopeAdjust_VerticalIncrement = 0.1; - ACE_ScopeAdjust_HorizontalIncrement = 0.1; - class ItemInfo : InventoryOpticsItem_Base_F { - class OpticsModes { - class Scope { - discreteDistance[] = { 100 }; - discreteDistanceInitIndex = 0; - }; - }; - }; - }; - class BWA3_optic_20x50_NSV : BWA3_optic_20x50 { - ACE_ScopeAdjust_Vertical[] = { 0, 26 }; - ACE_ScopeAdjust_Horizontal[] = { -6, 6 }; - ACE_ScopeAdjust_VerticalIncrement = 0.1; - ACE_ScopeAdjust_HorizontalIncrement = 0.1; - class ItemInfo : InventoryOpticsItem_Base_F { - class OpticsModes { - class Scope { - discreteDistance[] = { 100 }; - discreteDistanceInitIndex = 0; - }; - }; - }; - }; - class BWA3_optic_24x72 : optic_Hamr { - ACE_ScopeAdjust_Vertical[] = { 0, 16 }; - ACE_ScopeAdjust_Horizontal[] = { -7, 7 }; - ACE_ScopeAdjust_VerticalIncrement = 0.1; - ACE_ScopeAdjust_HorizontalIncrement = 0.1; - class ItemInfo : InventoryOpticsItem_Base_F { - class OpticsModes { - class Scope { - discreteDistance[] = { 100 }; - discreteDistanceInitIndex = 0; - }; - }; - }; - }; - class BWA3_optic_24x72_NSV : BWA3_optic_20x50 { - ACE_ScopeAdjust_Vertical[] = { 0, 16 }; - ACE_ScopeAdjust_Horizontal[] = { -7, 7 }; - ACE_ScopeAdjust_VerticalIncrement = 0.1; - ACE_ScopeAdjust_HorizontalIncrement = 0.1; - class ItemInfo : InventoryOpticsItem_Base_F { - class OpticsModes { - class Scope { - discreteDistance[] = { 100 }; - discreteDistanceInitIndex = 0; - }; - }; - }; - }; -}; diff --git a/optionals/compat_bwa3/script_component.hpp b/optionals/compat_bwa3/script_component.hpp deleted file mode 100644 index 86bb669119..0000000000 --- a/optionals/compat_bwa3/script_component.hpp +++ /dev/null @@ -1,5 +0,0 @@ -#define COMPONENT BWA3_Weapons_comp - -#include "\z\ace\addons\main\script_mod.hpp" - -#include "\z\ace\addons\main\script_macros.hpp" diff --git a/optionals/compat_cup/CfgAmmo.hpp b/optionals/compat_cup/CfgAmmo.hpp deleted file mode 100644 index f5ba34fc7e..0000000000 --- a/optionals/compat_cup/CfgAmmo.hpp +++ /dev/null @@ -1,434 +0,0 @@ -class CfgAmmo -{ - class BulletBase; - class B_762x51_Ball; - class B_127x99_Ball; - class CUP_B_545x39_Ball: BulletBase { - airFriction=-0.0011204; - ACE_caliber=5.588; - ACE_bulletLength=21.59; - ACE_bulletMass=3.42792; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; - ACE_ballisticCoefficients[]={0.168}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ASM"; - ACE_dragModel=7; - ACE_muzzleVelocities[]={780, 880, 920}; - ACE_barrelLengths[]={254.0, 414.02, 508.0}; - }; - class CUP_B_545x39_Ball_Tracer_Green: CUP_B_545x39_Ball { - airFriction=-0.0011204; - ACE_caliber=5.588; - ACE_bulletLength=21.59; - ACE_bulletMass=3.22704; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; - ACE_ballisticCoefficients[]={0.168}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ASM"; - ACE_dragModel=7; - ACE_muzzleVelocities[]={785, 883, 925}; - ACE_barrelLengths[]={254.0, 414.02, 508.0}; - }; - class CUP_B_545x39_Ball_Tracer_Red: BulletBase { - airFriction=-0.0011204; - ACE_caliber=5.588; - ACE_bulletLength=21.59; - ACE_bulletMass=3.22704; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; - ACE_ballisticCoefficients[]={0.168}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ASM"; - ACE_dragModel=7; - ACE_muzzleVelocities[]={785, 883, 925}; - ACE_barrelLengths[]={254.0, 414.02, 508.0}; - }; - class CUP_B_545x39_Ball_Tracer_White: BulletBase { - airFriction=-0.0011204; - ACE_caliber=5.588; - ACE_bulletLength=21.59; - ACE_bulletMass=3.22704; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; - ACE_ballisticCoefficients[]={0.168}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ASM"; - ACE_dragModel=7; - ACE_muzzleVelocities[]={785, 883, 925}; - ACE_barrelLengths[]={254.0, 414.02, 508.0}; - }; - class CUP_B_545x39_Ball_Tracer_Yellow: BulletBase { - airFriction=-0.0011204; - ACE_caliber=5.588; - ACE_bulletLength=21.59; - ACE_bulletMass=3.22704; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; - ACE_ballisticCoefficients[]={0.168}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ASM"; - ACE_dragModel=7; - ACE_muzzleVelocities[]={785, 883, 925}; - ACE_barrelLengths[]={254.0, 414.02, 508.0}; - }; - class CUP_B_762x39_Ball: BulletBase { - airFriction=-0.00150173; - ACE_caliber=7.823; - ACE_bulletLength=28.956; - ACE_bulletMass=7.9704; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; - ACE_ballisticCoefficients[]={0.275}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ICAO"; - ACE_dragModel=1; - ACE_muzzleVelocities[]={650, 716, 750}; - ACE_barrelLengths[]={254.0, 414.02, 508.0}; - }; - class CUP_B_762x39_Ball_Tracer_Green: BulletBase { - airFriction=-0.00150173; - ACE_caliber=7.823; - ACE_bulletLength=28.956; - ACE_bulletMass=7.5816; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; - ACE_ballisticCoefficients[]={0.275}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ICAO"; - ACE_dragModel=1; - ACE_muzzleVelocities[]={650, 716, 750}; - ACE_barrelLengths[]={254.0, 414.02, 508.0}; - }; - class B_762x39mm_KLT: BulletBase { - airFriction=-0.00150173; - ACE_caliber=7.823; - ACE_bulletLength=28.956; - ACE_bulletMass=7.5816; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; - ACE_ballisticCoefficients[]={0.275}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ICAO"; - ACE_dragModel=1; - ACE_muzzleVelocities[]={650, 716, 750}; - ACE_barrelLengths[]={254.0, 414.02, 508.0}; - }; - class CUP_B_9x18_Ball: BulletBase { - airFriction=-0.00180193; - ACE_caliber=9.271; - ACE_bulletLength=15.494; - ACE_bulletMass=6.00048; - ACE_ammoTempMuzzleVelocityShifts[]={-2.655, -2.547, -2.285, -2.012, -1.698, -1.280, -0.764, -0.153, 0.596, 1.517, 2.619}; - ACE_ballisticCoefficients[]={0.125}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ASM"; - ACE_dragModel=1; - ACE_muzzleVelocities[]={298, 330, 350}; - ACE_barrelLengths[]={96.52, 127.0, 228.6}; - }; - class CUP_B_9x18_Ball_Tracer_Green: BulletBase { - airFriction=-0.00180193; - ACE_caliber=9.271; - ACE_bulletLength=15.494; - ACE_bulletMass=6.00048; - ACE_ammoTempMuzzleVelocityShifts[]={-2.655, -2.547, -2.285, -2.012, -1.698, -1.280, -0.764, -0.153, 0.596, 1.517, 2.619}; - ACE_ballisticCoefficients[]={0.125}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ASM"; - ACE_dragModel=1; - ACE_muzzleVelocities[]={298, 330, 350}; - ACE_barrelLengths[]={96.52, 127.0, 228.6}; - }; - class CUP_B_9x18_Ball_Tracer_Red: BulletBase { - airFriction=-0.00180193; - ACE_caliber=9.271; - ACE_bulletLength=15.494; - ACE_bulletMass=6.00048; - ACE_ammoTempMuzzleVelocityShifts[]={-2.655, -2.547, -2.285, -2.012, -1.698, -1.280, -0.764, -0.153, 0.596, 1.517, 2.619}; - ACE_ballisticCoefficients[]={0.125}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ASM"; - ACE_dragModel=1; - ACE_muzzleVelocities[]={298, 330, 350}; - ACE_barrelLengths[]={96.52, 127.0, 228.6}; - }; - class CUP_B_9x18_Ball_Tracer_Yellow: BulletBase { - airFriction=-0.00180193; - ACE_caliber=9.271; - ACE_bulletLength=15.494; - ACE_bulletMass=6.00048; - ACE_ammoTempMuzzleVelocityShifts[]={-2.655, -2.547, -2.285, -2.012, -1.698, -1.280, -0.764, -0.153, 0.596, 1.517, 2.619}; - ACE_ballisticCoefficients[]={0.125}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ASM"; - ACE_dragModel=1; - ACE_muzzleVelocities[]={298, 330, 350}; - ACE_barrelLengths[]={96.52, 127.0, 228.6}; - }; - class CUP_B_9x18_Ball_White_Tracer: BulletBase { - airFriction=-0.00180193; - ACE_caliber=9.271; - ACE_bulletLength=15.494; - ACE_bulletMass=6.00048; - ACE_ammoTempMuzzleVelocityShifts[]={-2.655, -2.547, -2.285, -2.012, -1.698, -1.280, -0.764, -0.153, 0.596, 1.517, 2.619}; - ACE_ballisticCoefficients[]={0.125}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ASM"; - ACE_dragModel=1; - ACE_muzzleVelocities[]={298, 330, 350}; - ACE_barrelLengths[]={96.52, 127.0, 228.6}; - }; - class CUP_B_9x19_Ball: BulletBase { - airFriction=-0.00205726; - ACE_caliber=9.017; - ACE_bulletLength=15.494; - ACE_bulletMass=8.0352; - ACE_ammoTempMuzzleVelocityShifts[]={-2.655, -2.547, -2.285, -2.012, -1.698, -1.280, -0.764, -0.153, 0.596, 1.517, 2.619}; - ACE_ballisticCoefficients[]={0.165}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ASM"; - ACE_dragModel=1; - ACE_muzzleVelocities[]={340, 370, 400}; - ACE_barrelLengths[]={101.6, 127.0, 228.6}; - }; - class CUP_B_762x51_noTracer: B_762x51_Ball { - airFriction=-0.00099036; - ACE_caliber=7.823; - ACE_bulletLength=28.956; - ACE_bulletMass=9.4608; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; - ACE_ballisticCoefficients[]={0.2}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ICAO"; - ACE_dragModel=7; - ACE_muzzleVelocities[]={700, 800, 820, 833, 845}; - ACE_barrelLengths[]={254.0, 406.4, 508.0, 609.6, 660.4}; - }; - class CUP_B_303_Ball: BulletBase { - airFriction=-0.00082199; - ACE_caliber=7.899; - ACE_bulletLength=31.166; - ACE_bulletMass=11.2752; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; - ACE_ballisticCoefficients[]={0.499, 0.493, 0.48}; - ACE_velocityBoundaries[]={671, 549}; - ACE_standardAtmosphere="ASM"; - ACE_dragModel=1; - ACE_muzzleVelocities[]={748, 761, 765}; - ACE_barrelLengths[]={508.0, 609.6, 660.4}; - }; - class CUP_B_127x107_Ball_Green_Tracer: BulletBase { - airFriction=-0.00062618; - ACE_caliber=12.979; - ACE_bulletLength=64.008; - ACE_bulletMass=48.276; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; - ACE_ballisticCoefficients[]={0.63}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ASM"; - ACE_dragModel=1; - ACE_muzzleVelocities[]={820}; - ACE_barrelLengths[]={728.98}; - }; - class CUP_B_127x108_Ball_Green_Tracer: BulletBase { - airFriction=-0.00062618; - ACE_caliber=12.979; - ACE_bulletLength=64.008; - ACE_bulletMass=48.276; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; - ACE_ballisticCoefficients[]={0.63}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ASM"; - ACE_dragModel=1; - ACE_muzzleVelocities[]={820}; - ACE_barrelLengths[]={728.98}; - }; - class CUP_B_762x54_Ball_White_Tracer: BulletBase { - airFriction=-0.00101742; - ACE_caliber=7.925; - ACE_bulletLength=28.956; - ACE_bulletMass=9.6552; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; - ACE_ballisticCoefficients[]={0.395}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ICAO"; - ACE_dragModel=1; - ACE_muzzleVelocities[]={680, 750, 798, 800}; - ACE_barrelLengths[]={406.4, 508.0, 609.6, 660.4}; - }; - class CUP_B_762x54_Ball_Red_Tracer: BulletBase { - airFriction=-0.00101742; - ACE_caliber=7.925; - ACE_bulletLength=28.956; - ACE_bulletMass=9.6552; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; - ACE_ballisticCoefficients[]={0.395}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ICAO"; - ACE_dragModel=1; - ACE_muzzleVelocities[]={680, 750, 798, 800}; - ACE_barrelLengths[]={406.4, 508.0, 609.6, 660.4}; - }; - class CUP_B_762x54_Ball_Green_Tracer: BulletBase { - airFriction=-0.00101742; - ACE_caliber=7.925; - ACE_bulletLength=28.956; - ACE_bulletMass=9.6552; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; - ACE_ballisticCoefficients[]={0.395}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ICAO"; - ACE_dragModel=1; - ACE_muzzleVelocities[]={680, 750, 798, 800}; - ACE_barrelLengths[]={406.4, 508.0, 609.6, 660.4}; - }; - class CUP_B_762x54_Ball_Yellow_Tracer: BulletBase { - airFriction=-0.00101742; - ACE_caliber=7.925; - ACE_bulletLength=28.956; - ACE_bulletMass=9.6552; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; - ACE_ballisticCoefficients[]={0.395}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ICAO"; - ACE_dragModel=1; - ACE_muzzleVelocities[]={680, 750, 798, 800}; - ACE_barrelLengths[]={406.4, 508.0, 609.6, 660.4}; - }; - class CUP_B_9x39_SP5: BulletBase { - airFriction=-0.00075274; - ACE_caliber=9.246; - ACE_bulletLength=31.496; - ACE_bulletMass=16.2; - ACE_ammoTempMuzzleVelocityShifts[]={-2.655, -2.547, -2.285, -2.012, -1.698, -1.280, -0.764, -0.153, 0.596, 1.517, 2.619}; - ACE_ballisticCoefficients[]={0.275}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ICAO"; - ACE_dragModel=1; - ACE_muzzleVelocities[]={280, 300, 320}; - ACE_barrelLengths[]={254.0, 414.02, 508.0}; - }; - class CUP_B_762x51_Tracer_Green: BulletBase { - airFriction=-0.00099036; - ACE_caliber=7.823; - ACE_bulletLength=28.956; - ACE_bulletMass=9.4608; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; - ACE_ballisticCoefficients[]={0.2}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ICAO"; - ACE_dragModel=7; - ACE_muzzleVelocities[]={700, 800, 820, 833, 845}; - ACE_barrelLengths[]={254.0, 406.4, 508.0, 609.6, 660.4}; - }; - class CUP_B_762x51_Tracer_Red: BulletBase { - airFriction=-0.00099036; - ACE_caliber=7.823; - ACE_bulletLength=28.956; - ACE_bulletMass=9.4608; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; - ACE_ballisticCoefficients[]={0.2}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ICAO"; - ACE_dragModel=7; - ACE_muzzleVelocities[]={700, 800, 820, 833, 845}; - ACE_barrelLengths[]={254.0, 406.4, 508.0, 609.6, 660.4}; - }; - class CUP_B_762x51_Tracer_Yellow: BulletBase { - airFriction=-0.00099036; - ACE_caliber=7.823; - ACE_bulletLength=28.956; - ACE_bulletMass=9.4608; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; - ACE_ballisticCoefficients[]={0.2}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ICAO"; - ACE_dragModel=7; - ACE_muzzleVelocities[]={700, 800, 820, 833, 845}; - ACE_barrelLengths[]={254.0, 406.4, 508.0, 609.6, 660.4}; - }; - class CUP_B_762x51_Tracer_White: BulletBase { - airFriction=-0.00099036; - ACE_caliber=7.823; - ACE_bulletLength=28.956; - ACE_bulletMass=9.4608; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; - ACE_ballisticCoefficients[]={0.2}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ICAO"; - ACE_dragModel=7; - ACE_muzzleVelocities[]={700, 800, 820, 833, 845}; - ACE_barrelLengths[]={254.0, 406.4, 508.0, 609.6, 660.4}; - }; - class B_127x107_Ball: BulletBase { - ACE_caliber=12.979; - ACE_bulletLength=64.008; - ACE_bulletMass=48.276; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; - ACE_ballisticCoefficients[]={0.63}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ASM"; - ACE_dragModel=1; - ACE_muzzleVelocities[]={820}; - ACE_barrelLengths[]={728.98}; - }; - class CUP_B_9x18_SD: BulletBase { - airFriction=-0.00180193; - ACE_caliber=9.271; - ACE_bulletLength=15.494; - ACE_bulletMass=6.00048; - ACE_ammoTempMuzzleVelocityShifts[]={-2.655, -2.547, -2.285, -2.012, -1.698, -1.280, -0.764, -0.153, 0.596, 1.517, 2.619}; - ACE_ballisticCoefficients[]={0.125}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ASM"; - ACE_dragModel=1; - ACE_muzzleVelocities[]={298, 330, 340}; - ACE_barrelLengths[]={96.52, 127.0, 228.6}; - }; - class CUP_B_765x17_Ball: BulletBase { - airFriction=-0.00173452; - ACE_caliber=7.938; - ACE_bulletLength=15.494; - ACE_bulletMass=4.212; - ACE_ammoTempMuzzleVelocityShifts[]={-2.655, -2.547, -2.285, -2.012, -1.698, -1.280, -0.764, -0.153, 0.596, 1.517, 2.619}; - ACE_ballisticCoefficients[]={0.118}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ASM"; - ACE_dragModel=1; - ACE_muzzleVelocities[]={282, 300, 320}; - ACE_barrelLengths[]={101.6, 127.0, 228.6}; - }; - class CUP_B_145x115_AP_Green_Tracer: BulletBase { - airFriction=-0.00059041; - ACE_caliber=14.884; - ACE_bulletLength=50.8; - ACE_bulletMass=65.448; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; - ACE_ballisticCoefficients[]={0.620}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ASM"; - ACE_dragModel=1; - ACE_muzzleVelocities[]={1000}; - ACE_barrelLengths[]={1346.2}; - }; - class CUP_B_127x99_Ball_White_Tracer: B_127x99_Ball { - airFriction=-0.00057503; - ACE_caliber=12.954; - ACE_bulletLength=58.674; - ACE_bulletMass=41.9256; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; - ACE_ballisticCoefficients[]={0.670}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ASM"; - ACE_dragModel=1; - ACE_muzzleVelocities[]={853}; - ACE_barrelLengths[]={736.6}; - }; - class CUP_B_86x70_Ball_noTracer: BulletBase { - airFriction=-0.0005788; - ACE_caliber=8.585; - ACE_bulletLength=39.573; - ACE_bulletMass=16.2; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; - ACE_ballisticCoefficients[]={0.322}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ICAO"; - ACE_dragModel=7; - ACE_muzzleVelocities[]={880, 915, 925}; - ACE_barrelLengths[]={508.0, 660.4, 711.2}; - }; -}; \ No newline at end of file diff --git a/optionals/compat_cup/CfgMagazines.hpp b/optionals/compat_cup/CfgMagazines.hpp index 469476734c..b05b0c3efd 100644 --- a/optionals/compat_cup/CfgMagazines.hpp +++ b/optionals/compat_cup/CfgMagazines.hpp @@ -45,223 +45,4 @@ class CfgMagazines { modelSpecial = ""; mass = 0; }; - - class CA_Magazine; - class 30Rnd_556x45_Stanag; - class CUP_30Rnd_545x39_AK_M: CA_Magazine { - initSpeed = 880; - }; - class CUP_30Rnd_TE1_Green_Tracer_545x39_AK_M: CA_Magazine { - initSpeed = 880; - }; - class CUP_30Rnd_TE1_Red_Tracer_545x39_AK_M: CA_Magazine { - initSpeed = 880; - }; - class CUP_30Rnd_TE1_White_Tracer_545x39_AK_M: CA_Magazine { - initSpeed = 880; - }; - class CUP_30Rnd_TE1_Yellow_Tracer_545x39_AK_M: CA_Magazine { - initSpeed = 880; - }; - class CUP_75Rnd_TE4_LRT4_Green_Tracer_545x39_RPK_M: CA_Magazine { - initSpeed = 880; - }; - class CUP_30Rnd_762x39_AK47_M: CA_Magazine { - initSpeed = 750; - }; - class CUP_64Rnd_9x19_Bizon_M: CA_Magazine { - initSpeed = 350; - }; - class CUP_64Rnd_Green_Tracer_9x19_Bizon_M: CA_Magazine { - initSpeed = 350; - }; - class CUP_64Rnd_Red_Tracer_9x19_Bizon_M: CA_Magazine { - initSpeed = 350; - }; - class CUP_64Rnd_White_Tracer_9x19_Bizon_M: CA_Magazine { - initSpeed = 350; - }; - class CUP_64Rnd_Yellow_Tracer_9x19_Bizon_M: CA_Magazine { - initSpeed = 350; - }; - class CUP_5x_22_LR_17_HMR_M: CA_Magazine { - initSpeed = 830; - }; - class CUP_10x_303_M: CA_Magazine { - initSpeed = 765; - }; - class CUP_20Rnd_762x51_FNFAL_M: CA_Magazine { - initSpeed = 833; - }; - class CUP_5Rnd_127x108_KSVK_M: CA_Magazine { - initSpeed = 820; - }; - class CUP_100Rnd_TE4_LRT4_White_Tracer_762x51_Belt_M: CA_Magazine { - initSpeed = 833; - }; - class CUP_100Rnd_TE4_LRT4_Red_Tracer_762x51_Belt_M: CUP_100Rnd_TE4_LRT4_White_Tracer_762x51_Belt_M { - initSpeed = 833; - }; - class CUP_200Rnd_TE4_LRT4_White_Tracer_762x51_Belt_M: CA_Magazine { - initSpeed = 833; - }; - class CUP_200Rnd_TE4_LRT4_Red_Tracer_762x51_Belt_M: CA_Magazine { - initSpeed = 833; - }; - class CUP_100Rnd_TE4_LRT4_762x54_PK_Tracer_Green_M: CA_Magazine { - initSpeed = 800; - }; - class CUP_10Rnd_762x54_SVD_M: CA_Magazine { - initSpeed = 800; - }; - class CUP_10Rnd_9x39_SP5_VSS_M: CA_Magazine { - initSpeed = 300; - }; - class CUP_20Rnd_9x39_SP5_VSS_M: CA_Magazine { - initSpeed = 300; - }; - class CUP_5Rnd_127x99_as50_M: CA_Magazine { - initSpeed = 900; - }; - class CUP_20Rnd_762x51_DMR: CA_Magazine { - initSpeed = 833; - }; - class CUP_20Rnd_TE1_Yellow_Tracer_762x51_DMR: CUP_20Rnd_762x51_DMR { - initSpeed = 833; - }; - class CUP_20Rnd_TE1_Red_Tracer_762x51_DMR: CUP_20Rnd_762x51_DMR { - initSpeed = 833; - }; - class CUP_20Rnd_TE1_Green_Tracer_762x51_DMR: CUP_20Rnd_762x51_DMR { - initSpeed = 833; - }; - class CUP_20Rnd_TE1_White_Tracer_762x51_DMR: CUP_20Rnd_762x51_DMR { - initSpeed = 833; - }; - class CUP_20Rnd_762x51_B_SCAR: CA_Magazine { - initSpeed = 833; - }; - class CUP_20Rnd_TE1_Yellow_Tracer_762x51_SCAR: CUP_20Rnd_762x51_B_SCAR { - initSpeed = 833; - }; - class CUP_20Rnd_TE1_Red_Tracer_762x51_SCAR: CUP_20Rnd_762x51_B_SCAR { - initSpeed = 833; - }; - class CUP_20Rnd_TE1_Green_Tracer_762x51_SCAR: CUP_20Rnd_762x51_B_SCAR { - initSpeed = 833; - }; - class CUP_20Rnd_TE1_White_Tracer_762x51_SCAR: CUP_20Rnd_762x51_B_SCAR { - initSpeed = 833; - }; - class CUP_20Rnd_762x51_B_M110: CA_Magazine { - initSpeed = 833; - }; - class CUP_5Rnd_762x51_M24: CA_Magazine { - initSpeed = 833; - }; - class CUP_20Rnd_TE1_Yellow_Tracer_762x51_M110: CUP_20Rnd_762x51_B_M110 { - initSpeed = 833; - }; - class CUP_20Rnd_TE1_Red_Tracer_762x51_M110: CUP_20Rnd_762x51_B_M110 { - initSpeed = 833; - }; - class CUP_20Rnd_TE1_Green_Tracer_762x51_M110: CUP_20Rnd_762x51_B_M110 { - initSpeed = 833; - }; - class CUP_20Rnd_TE1_White_Tracer_762x51_M110: CUP_20Rnd_762x51_B_M110 { - initSpeed = 833; - }; - class CUP_30Rnd_556x45_G36: 30Rnd_556x45_Stanag { - initSpeed = 920; - }; - class CUP_30Rnd_TE1_Red_Tracer_556x45_G36: CUP_30Rnd_556x45_G36 { - initSpeed = 920; - }; - class CUP_30Rnd_TE1_Green_Tracer_556x45_G36: CUP_30Rnd_556x45_G36 { - initSpeed = 920; - }; - class CUP_30Rnd_TE1_Yellow_Tracer_556x45_G36: CUP_30Rnd_556x45_G36 { - initSpeed = 920; - }; - class CUP_100Rnd_556x45_BetaCMag: 30Rnd_556x45_Stanag { - initSpeed = 920; - }; - class CUP_100Rnd_TE1_Red_Tracer_556x45_BetaCMag: CUP_100Rnd_556x45_BetaCMag { - initSpeed = 920; - }; - class CUP_100Rnd_TE1_Green_Tracer_556x45_BetaCMag: CUP_100Rnd_556x45_BetaCMag { - initSpeed = 920; - }; - class CUP_100Rnd_TE1_Yellow_Tracer_556x45_BetaCMag: CUP_100Rnd_556x45_BetaCMag { - initSpeed = 920; - }; - class CUP_200Rnd_TE4_Green_Tracer_556x45_M249: CA_Magazine { - initSpeed = 920; - }; - class CUP_200Rnd_TE4_Red_Tracer_556x45_M249: CUP_200Rnd_TE4_Green_Tracer_556x45_M249 { - initSpeed = 920; - }; - class CUP_200Rnd_TE4_Yellow_Tracer_556x45_M249: CUP_200Rnd_TE4_Green_Tracer_556x45_M249 { - initSpeed = 920; - }; - class CUP_200Rnd_TE1_Red_Tracer_556x45_M249: CUP_200Rnd_TE4_Red_Tracer_556x45_M249 { - initSpeed = 920; - }; - class CUP_100Rnd_TE4_Green_Tracer_556x45_M249: CA_Magazine { - initSpeed = 920; - }; - class CUP_100Rnd_TE4_Red_Tracer_556x45_M249: CUP_100Rnd_TE4_Green_Tracer_556x45_M249 { - initSpeed = 920; - }; - class CUP_100Rnd_TE4_Yellow_Tracer_556x45_M249: CUP_100Rnd_TE4_Green_Tracer_556x45_M249 { - initSpeed = 920; - }; - class CUP_200Rnd_TE4_Green_Tracer_556x45_L110A1: CUP_200Rnd_TE4_Green_Tracer_556x45_M249 { - initSpeed = 920; - }; - class CUP_200Rnd_TE4_Red_Tracer_556x45_L110A1: CUP_200Rnd_TE4_Red_Tracer_556x45_M249 { - initSpeed = 920; - }; - class CUP_200Rnd_TE4_Yellow_Tracer_556x45_L110A1: CUP_200Rnd_TE4_Yellow_Tracer_556x45_M249 { - initSpeed = 920; - }; - class CUP_30Rnd_556x45_Stanag: CA_Magazine { - initSpeed = 920; - }; - class CUP_20Rnd_556x45_Stanag: CUP_30Rnd_556x45_Stanag { - initSpeed = 920; - }; - class CUP_10Rnd_127x99_M107: CA_Magazine { - initSpeed = 900; - }; - class CUP_10Rnd_762x51_CZ750: CA_Magazine { - initSpeed = 833; - }; - class CUP_10Rnd_762x51_CZ750_Tracer: CUP_10Rnd_762x51_CZ750 { - initSpeed = 833; - }; - class CUP_50Rnd_UK59_762x54R_Tracer: CA_Magazine { - initSpeed = 800; - }; - class CUP_8Rnd_9x18_Makarov_M: CA_Magazine { - initSpeed = 300; - }; - class CUP_8Rnd_9x18_MakarovSD_M: CUP_8Rnd_9x18_Makarov_M { - initSpeed = 300; - }; - class CUP_6Rnd_45ACP_M: CA_Magazine { - initSpeed = 250; - }; - class CUP_17Rnd_9x19_glock17: CA_Magazine { - initSpeed = 370; - }; - class CUP_5Rnd_86x70_L115A1: CA_Magazine { - initSpeed = 915; - }; - class CUP_20Rnd_B_765x17_Ball_M: CA_Magazine { - initSpeed = 290; - }; - class CUP_30Rnd_9x19_MP5: CA_Magazine { - initSpeed = 400; - }; }; \ No newline at end of file diff --git a/optionals/compat_cup/CfgWeapons.hpp b/optionals/compat_cup/CfgWeapons.hpp index 76d442ee53..bbd49548da 100644 --- a/optionals/compat_cup/CfgWeapons.hpp +++ b/optionals/compat_cup/CfgWeapons.hpp @@ -1,432 +1,6 @@ class CfgWeapons { - class Pistol_Base_F; - class Rifle_Base_F; - class Rifle_Long_Base_F; class Launcher_Base_F; - class CUP_hgun_Colt1911 : Pistol_Base_F { - initSpeed=-1.04; - ACE_barrelTwist=406.4; - ACE_barrelLength=127.0; - }; - class CUP_sgun_AA12 : Rifle_Base_F { - initSpeed=-1.0; - ACE_barrelTwist=0.0; - ACE_twistDirection=0; - ACE_barrelLength=457.2; - }; - class CUP_arifle_AK_Base : Rifle_Base_F { - initSpeed=-0.95467; - ACE_barrelTwist=240.03; - ACE_barrelLength=414.02; - }; - class CUP_arifle_AK107_Base : CUP_arifle_AK_Base { - initSpeed=-1.0; - ACE_barrelTwist=199.898; - ACE_barrelLength=414.02; - }; - class CUP_arifle_AKS_Base : CUP_arifle_AK_Base { - initSpeed=-0.95467; - ACE_barrelTwist=199.898; - ACE_barrelLength=414.02; - }; - class CUP_arifle_AKS74U : CUP_arifle_AK_Base { - initSpeed=-0.88636; - ACE_barrelTwist=160.02; - ACE_barrelLength=210.82; - }; - class CUP_arifle_AK74; - class CUP_arifle_RPK74 : CUP_arifle_AK74 { - initSpeed=-1.0; - ACE_barrelTwist=195.072; - ACE_barrelLength=589.28; - }; - class CUP_srifle_AS50 : Rifle_Long_Base_F { - initSpeed=-1.0; - ACE_barrelTwist=381.0; - ACE_barrelLength=736.6; - }; - class CUP_srifle_AWM_Base : Rifle_Long_Base_F { - initSpeed=-1.00547; - ACE_barrelTwist=279.4; - ACE_barrelLength=685.8; - }; - class CUP_smg_bizon : Rifle_Base_F { - initSpeed=-1.0; - ACE_barrelTwist=240.03; - ACE_barrelLength=231.14; - }; - class CUP_hgun_Compact : Pistol_Base_F { - initSpeed=-0.97778; - ACE_barrelTwist=248.92; - ACE_barrelLength=94.996; - }; - class CUP_srifle_CZ750 : Rifle_Long_Base_F { - initSpeed=-1.0; - ACE_barrelTwist=304.8; - ACE_barrelLength=660.4; - }; - class CUP_arifle_CZ805_Base : Rifle_Base_F { - initSpeed=-0.87283; - ACE_barrelTwist=304.8; - ACE_barrelLength=355.6; - }; - class CUP_arifle_CZ805_A1 : CUP_arifle_CZ805_Base { - initSpeed=-0.93696; - ACE_barrelTwist=304.8; - ACE_barrelLength=355.6; - }; - class CUP_arifle_CZ805_A2 : CUP_arifle_CZ805_Base { - initSpeed=-0.87283; - ACE_barrelTwist=304.8; - ACE_barrelLength=276.86; - }; - class CUP_srifle_DMR : Rifle_Base_F { - initSpeed=-1.0; - ACE_barrelTwist=304.8; - ACE_barrelLength=558.8; - }; - class CUP_hgun_Duty : Pistol_Base_F { - initSpeed=-0.97778; - ACE_barrelTwist=248.92; - ACE_barrelLength=94.996; - }; - class CUP_arifle_FNFAL : Rifle_Base_F { - initSpeed=-0.98796; - ACE_barrelTwist=304.8; - ACE_barrelLength=533.4; - }; - class CUP_arifle_G36_Base; - class CUP_arifle_G36A : CUP_arifle_G36_Base { - initSpeed=-0.99357; - ACE_barrelTwist=177.8; - ACE_barrelLength=480; - }; - class CUP_arifle_G36K : CUP_arifle_G36A { - initSpeed=-0.90761; - ACE_barrelTwist=177.8; - ACE_barrelLength=318; - }; - class CUP_arifle_G36C : Rifle_Base_F { - initSpeed=-0.81522; - ACE_barrelTwist=177.8; - ACE_barrelLength=228; - }; - class CUP_arifle_MG36 : CUP_arifle_G36C { - initSpeed=-0.99457; - ACE_barrelTwist=177.8; - ACE_barrelLength=480; - }; - class CUP_hgun_Glock17 : Pistol_Base_F { - initSpeed=-0.9595; - ACE_barrelTwist=248.92; - ACE_barrelLength=114.046; - }; - class CUP_srifle_CZ550 : Rifle_Base_F { - initSpeed=-1.0; - ACE_barrelTwist=304.8; - ACE_barrelLength=599.999; - }; - class CUP_srifle_ksvk : Rifle_Base_F { - initSpeed=-1.0; - ACE_barrelTwist=457.2; - ACE_barrelLength=999.998; - }; - class CUP_lmg_L7A2 : Rifle_Long_Base_F { - initSpeed=-1.0; - ACE_barrelTwist=304.8; - ACE_barrelLength=629.92; - }; - class CUP_arifle_L85A2_Base : Rifle_Base_F { - initSpeed=-1.0; - ACE_barrelTwist=177.8; - ACE_barrelLength=518.16; - }; - class CUP_arifle_L86A2_Base: Rifle_Base_F { - initSpeed=-0.97826; - ACE_barrelTwist=177.8; - ACE_barrelLength=646; - }; - class CUP_lmg_L110A1 : Rifle_Long_Base_F { - initSpeed=-0.93044; - ACE_barrelTwist=177.8; - ACE_barrelLength=347.98; - }; - class CUP_srifle_LeeEnfield : Rifle_Base_F { - initSpeed=-1.0; - ACE_barrelTwist=254.0; - ACE_barrelLength=640.08; - }; - class CUP_hgun_M9 : Pistol_Base_F { - initSpeed=-1.0; - ACE_barrelTwist=248.92; - ACE_barrelLength=124.46; - }; - class CUP_srifle_M14 : Rifle_Base_F { - initSpeed=-0.99160; - ACE_barrelTwist=304.8; - ACE_barrelLength=558.8; - }; - class CUP_arifle_M16_Base : Rifle_Base_F { - initSpeed=-1.0; - ACE_barrelTwist=355.6; - ACE_barrelLength=508.0; - }; - class CUP_arifle_M16A4_Base; - class CUP_arifle_M4_Base : CUP_arifle_M16A4_Base { - initSpeed=-0.94565; - ACE_barrelTwist=177.8; - ACE_barrelLength=368.3; - }; - class CUP_arifle_M4A1; - class CUP_srifle_Mk12SPR : CUP_arifle_M4A1 { - initSpeed=-0.98696; - ACE_barrelTwist=177.8; - ACE_barrelLength=457.2; - }; - class CUP_srifle_M24_des : Rifle_Base_F { - initSpeed=-1.0; - ACE_barrelTwist=285.75; - ACE_barrelLength=609.6; - }; - class CUP_lmg_M60A4 : Rifle_Long_Base_F { - initSpeed=-0.96639; - ACE_barrelTwist=304.8; - ACE_barrelLength=431.8; - }; - class CUP_srifle_M107_Base : Rifle_Long_Base_F { - initSpeed=-1.0; - ACE_barrelTwist=381.0; - ACE_barrelLength=736.6; - }; - class CUP_srifle_M110 : Rifle_Base_F { - initSpeed=-0.98558; - ACE_barrelTwist=279.4; - ACE_barrelLength=508.0; - }; - class CUP_lmg_M240 : Rifle_Long_Base_F { - initSpeed=-1.00600; - ACE_barrelTwist=304.8; - ACE_barrelLength=629.92; - }; - class CUP_lmg_M249_para : Rifle_Long_Base_F { - initSpeed=-0.96739; - ACE_barrelTwist=177.8; - ACE_barrelLength=414.02; - }; - class CUP_lmg_M249 : Rifle_Long_Base_F { - initSpeed=-0.98696; - ACE_barrelTwist=177.8; - ACE_barrelLength=457.2; - }; - class CUP_sgun_M1014 : Rifle_Base_F { - ACE_twistDirection=0; - ACE_barrelTwist=0.0; - ACE_barrelLength=469.9; - }; - class CUP_hgun_Makarov : Pistol_Base_F { - initSpeed=-1.0; - ACE_barrelTwist=240.03; - ACE_barrelLength=93.472; - }; - class CUP_hgun_MicroUzi : Pistol_Base_F { - initSpeed=-1.0; - ACE_barrelTwist=248.92; - ACE_barrelLength=127.0; - }; - class CUP_lmg_Mk48_Base : Rifle_Long_Base_F { - initSpeed=-0.98558; - ACE_barrelTwist=304.8; - ACE_barrelLength=501.65; - }; - class CUP_smg_MP5SD6 : Rifle_Base_F { - initSpeed=-0.9375; - ACE_barrelTwist=254.0; - ACE_barrelLength=144.78; - }; - class CUP_smg_MP5A5 : CUP_smg_MP5SD6 { - initSpeed=-1.0; - ACE_barrelTwist=254.0; - ACE_barrelLength=226.06; - }; - class CUP_smg_EVO : Rifle_Base_F { - initSpeed=-0.975; - ACE_barrelTwist=254.0; - ACE_barrelLength=195.58; - }; - class CUP_hgun_PB6P9 : Pistol_Base_F { - initSpeed=-1.0; - ACE_barrelTwist=240.03; - ACE_barrelLength=104.14; - }; - class CUP_hgun_Phantom : Pistol_Base_F { - initSpeed=-1.0; - ACE_barrelTwist=246.38; - ACE_barrelLength=119.38; - }; - class CUP_lmg_PKM : Rifle_Long_Base_F { - initSpeed=-1.0; - ACE_barrelTwist=240.03; - ACE_barrelLength=645.16; - }; - class CUP_lmg_Pecheneg : CUP_lmg_PKM { - initSpeed=-1.0; - ACE_barrelTwist=240.03; - ACE_barrelLength=657.86; - }; - class CUP_hgun_TaurusTracker455 : Pistol_Base_F { - initSpeed=-0.92; - ACE_barrelTwist=304.8; - ACE_barrelLength=101.6; - }; - class CUP_arifle_Sa58_base; - class CUP_arifle_Sa58P : CUP_arifle_Sa58_base { - initSpeed=-1.0; - ACE_barrelTwist=240.03; - ACE_barrelLength=391.16; - }; - class CUP_arifle_Sa58V : CUP_arifle_Sa58P { - initSpeed=-1.0; - ACE_barrelTwist=240.03; - ACE_barrelLength=391.16; - }; - class CUP_arifle_Sa58RIS1 : CUP_arifle_Sa58_base { - initSpeed=-1.0; - ACE_barrelTwist=240.03; - ACE_barrelLength=391.16; - }; - class CUP_hgun_SA61 : Pistol_Base_F { - initSpeed=-1.0; - ACE_barrelTwist=406.4; - ACE_barrelLength=114.3; - }; - class CUP_sgun_Saiga12K: Rifle_Base_F { - initSpeed=-1.0; - ACE_barrelTwist=0.0; - ACE_twistDirection=0; - ACE_barrelLength=429.26; - }; - class CUP_arifle_SCAR_L_Base; - class CUP_arifle_Mk16_CQC : CUP_arifle_SCAR_L_Base { - initSpeed=-0.84783; - ACE_barrelTwist=177.8; - ACE_barrelLength=254.0; - }; - class CUP_arifle_Mk16_STD : CUP_arifle_SCAR_L_Base { - initSpeed=-0.93696; - ACE_barrelTwist=177.8; - ACE_barrelLength=355.6; - }; - class CUP_arifle_Mk16_SV : CUP_arifle_SCAR_L_Base { - initSpeed=-0.98696; - ACE_barrelTwist=177.8; - ACE_barrelLength=457.2; - }; - class CUP_arifle_Mk17_Base; - class CUP_arifle_Mk17_CQC : CUP_arifle_Mk17_Base { - initSpeed=-0.90144; - ACE_barrelTwist=304.8; - ACE_barrelLength=330.2; - }; - class CUP_arifle_Mk17_STD : CUP_arifle_Mk17_Base { - initSpeed=-0.96154; - ACE_barrelTwist=304.8; - ACE_barrelLength=406.4; - }; - class CUP_arifle_Mk20 : CUP_arifle_Mk17_Base { - initSpeed=-0.98558; - ACE_barrelTwist=304.8; - ACE_barrelLength=508.0; - }; - class CUP_srifle_SVD : Rifle_Base_F { - initSpeed=-1.0; - ACE_barrelTwist=238.76; - ACE_barrelLength=619.76; - }; - class CUP_lmg_UK59 : Rifle_Long_Base_F { - initSpeed=-0.9625; - ACE_barrelTwist=381.0; - ACE_barrelLength=551.18; - }; - class MGun; - class CUP_DSHKM_W : MGun { - initSpeed=-1.0; - ACE_barrelTwist=381.0; - ACE_barrelLength=1069.34; - }; - class CUP_KPVT_W : MGun { - initSpeed=-1.0; - ACE_barrelTwist=454.914; - ACE_barrelLength=1346.2; - }; - class CUP_M242_W; - class CUP_KPVB_W : CUP_M242_W { - initSpeed=-1.0; - ACE_barrelTwist=454.914; - ACE_barrelLength=1346.2; - }; - class MGunCore; - class CUP_M134 : MGunCore { - initSpeed=-1.0; - ACE_barrelTwist=304.8; - ACE_barrelLength=558.8; - }; - class CUP_M240_veh_W : Rifle_Long_Base_F { - initSpeed=-1.0; - ACE_barrelTwist=304.8; - ACE_barrelLength=629.92; - }; - class CUP_PKT_W : MGun { - initSpeed=-1.0; - ACE_barrelTwist=240.03; - ACE_barrelLength=722.122; - }; - class CUP_srifle_VSSVintorez : Rifle_Base_F { - initSpeed=-0.93334; - ACE_barrelTwist=210.82; - ACE_barrelLength=200.66; - }; - class CUP_arifle_XM8_Base : Rifle_Base_F { - initSpeed=-1.0; - ACE_barrelTwist=177.8; - ACE_barrelLength=317.5; - }; - class CUP_arifle_XM8_Carbine : CUP_arifle_XM8_Base { - initSpeed=-0.90760; - ACE_barrelTwist=177.8; - ACE_barrelLength=317.5; - }; - class CUP_arifle_xm8_sharpshooter : CUP_arifle_XM8_Base { - initSpeed=-1.0; - ACE_barrelTwist=177.8; - ACE_barrelLength=508.0; - }; - class CUP_arifle_xm8_SAW : CUP_arifle_XM8_Base { - initSpeed=-1.0; - ACE_barrelTwist=177.8; - ACE_barrelLength=508.0; - }; - class CUP_arifle_XM8_Compact : CUP_arifle_XM8_Base { - initSpeed=-0.81522; - ACE_barrelTwist=177.8; - ACE_barrelLength=228.6; - }; - class CUP_arifle_XM8_Railed_Base : Rifle_Base_F { - initSpeed=-0.90760; - ACE_barrelTwist=177.8; - ACE_barrelLength=317.5; - }; - class CUP_arifle_XM8_Carbine_FG : CUP_arifle_XM8_Base { - initSpeed=-0.90870; - ACE_barrelTwist=177.8; - ACE_barrelLength=317.5; - }; - class CUP_arifle_XM8_Carbine_GL : CUP_arifle_XM8_Base { - initSpeed=-0.90870; - ACE_barrelTwist=177.8; - ACE_barrelLength=317.5; - }; - class ItemCore; class InventoryOpticsItem_Base_F; diff --git a/optionals/compat_cup/config.cpp b/optionals/compat_cup/config.cpp index d013c9034a..20ae5d6911 100644 --- a/optionals/compat_cup/config.cpp +++ b/optionals/compat_cup/config.cpp @@ -11,6 +11,5 @@ class CfgPatches { }; }; -#include "CfgAmmo.hpp" #include "CfgWeapons.hpp" #include "CfgMagazines.hpp" \ No newline at end of file diff --git a/optionals/noactionmenu/$PBOPREFIX$ b/optionals/noactionmenu/$PBOPREFIX$ new file mode 100644 index 0000000000..5b0abc60fd --- /dev/null +++ b/optionals/noactionmenu/$PBOPREFIX$ @@ -0,0 +1 @@ +z\ace\addons\noactionmenu \ No newline at end of file diff --git a/optionals/noactionmenu/CfgActions.hpp b/optionals/noactionmenu/CfgActions.hpp new file mode 100644 index 0000000000..164ac31117 --- /dev/null +++ b/optionals/noactionmenu/CfgActions.hpp @@ -0,0 +1,24 @@ + +class CfgActions { + // to pistol + class None; + class HandGunOn: None { + show = 0; + }; + // to rifle + class HandGunOff: None { + show = 0; + }; + + // to launcher, (also used for binoculars?) + class SwitchWeapon: None { + show = 0; + }; + class SwitchMagazine: SwitchWeapon { + show = 1; + }; + // no idea, probably unused + class HideWeapon: SwitchWeapon { + show = 0; + }; +}; diff --git a/optionals/noactionmenu/README.md b/optionals/noactionmenu/README.md new file mode 100644 index 0000000000..c2e247bf44 --- /dev/null +++ b/optionals/noactionmenu/README.md @@ -0,0 +1,11 @@ +ace_noactionmenu +=========== + +Removes weapon select action. + + +## Maintainers + +The people responsible for merging changes to this component or answering potential questions. + +- [commy2](https://github.com/commy2) diff --git a/addons/protection/config.cpp b/optionals/noactionmenu/config.cpp similarity index 85% rename from addons/protection/config.cpp rename to optionals/noactionmenu/config.cpp index bb4ef3f739..763665660b 100644 --- a/addons/protection/config.cpp +++ b/optionals/noactionmenu/config.cpp @@ -2,6 +2,7 @@ class CfgPatches { class ADDON { + ACE_isOptional = 1; units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; @@ -12,5 +13,4 @@ class CfgPatches { }; }; -#include "CfgVehicles.hpp" -#include "CfgWeapons.hpp" +#include "CfgActions.hpp" diff --git a/optionals/noactionmenu/script_component.hpp b/optionals/noactionmenu/script_component.hpp new file mode 100644 index 0000000000..ee07b73c4f --- /dev/null +++ b/optionals/noactionmenu/script_component.hpp @@ -0,0 +1,12 @@ +#define COMPONENT noactionmenu +#include "\z\ace\addons\main\script_mod.hpp" + +#ifdef DEBUG_ENABLED_NOACTIONMENU + #define DEBUG_MODE_FULL +#endif + +#ifdef DEBUG_ENABLED_NOACTIONMENU + #define DEBUG_SETTINGS DEBUG_ENABLED_NOACTIONMENU +#endif + +#include "\z\ace\addons\main\script_macros.hpp" \ No newline at end of file diff --git a/tools/cba/addons/main/script_macros_common.hpp b/tools/cba/addons/main/script_macros_common.hpp index 1385d7b389..78893db662 100644 --- a/tools/cba/addons/main/script_macros_common.hpp +++ b/tools/cba/addons/main/script_macros_common.hpp @@ -1,11 +1,11 @@ /* - Header: script_macros_common.hpp + Header: script_macros_common.hpp - Description: - A general set of useful macro functions for use by CBA itself or by any module that uses CBA. + Description: + A general set of useful macro functions for use by CBA itself or by any module that uses CBA. - Authors: - Sickboy and Spooner + Authors: + Sickboy and Spooner */ /* **************************************************** @@ -40,27 +40,27 @@ */ #ifndef MAINPREFIX - #define MAINPREFIX x + #define MAINPREFIX x #endif #ifndef SUBPREFIX - #define SUBPREFIX addons + #define SUBPREFIX addons #endif #ifndef MAINLOGIC - #define MAINLOGIC main + #define MAINLOGIC main #endif #ifndef VERSION - #define VERSION 0 + #define VERSION 0 #endif #ifndef VERSION_AR - #define VERSION_AR VERSION + #define VERSION_AR VERSION #endif #ifndef VERSION_CONFIG - #define VERSION_CONFIG version = VERSION; versionStr = QUOTE(VERSION); versionAr[] = {VERSION_AR} + #define VERSION_CONFIG version = VERSION; versionStr = QUOTE(VERSION); versionAr[] = {VERSION_AR} #endif #define ADDON DOUBLES(PREFIX,COMPONENT) @@ -72,50 +72,50 @@ Group: Debugging /* ------------------------------------------- Macros: DEBUG_MODE_x - Managing debugging based on debug level. + Managing debugging based on debug level. - According to the *highest* level of debugging that has been defined *before* script_macros_common.hpp is included, - only the appropriate debugging commands will be functional. With no level explicitely defined, assume DEBUG_MODE_NORMAL. + According to the *highest* level of debugging that has been defined *before* script_macros_common.hpp is included, + only the appropriate debugging commands will be functional. With no level explicitely defined, assume DEBUG_MODE_NORMAL. - DEBUG_MODE_FULL - Full debugging output. - DEBUG_MODE_NORMAL - All debugging except and (Default setting if none specified). - DEBUG_MODE_MINIMAL - Only and enabled. + DEBUG_MODE_FULL - Full debugging output. + DEBUG_MODE_NORMAL - All debugging except and (Default setting if none specified). + DEBUG_MODE_MINIMAL - Only and enabled. Examples: - In order to turn on full debugging for a single file, - (begin example) - // Top of individual script file. - #define DEBUG_MODE_FULL - #include "script_component.hpp" - (end) + In order to turn on full debugging for a single file, + (begin example) + // Top of individual script file. + #define DEBUG_MODE_FULL + #include "script_component.hpp" + (end) - In order to force minimal debugging for a single component, - (begin example) - // Top of addons\\script_component.hpp - // Ensure that any FULL and NORMAL setting from the individual files are undefined and MINIMAL is set. - #ifdef DEBUG_MODE_FULL - #undef DEBUG_MODE_FULL - #endif - #ifdef DEBUG_MODE_NORMAL - #undef DEBUG_MODE_NORMAL - #endif - #ifndef DEBUG_MODE_MINIMAL - #define DEBUG_MODE_MINIMAL - #endif - #include "script_macros.hpp" - (end) + In order to force minimal debugging for a single component, + (begin example) + // Top of addons\\script_component.hpp + // Ensure that any FULL and NORMAL setting from the individual files are undefined and MINIMAL is set. + #ifdef DEBUG_MODE_FULL + #undef DEBUG_MODE_FULL + #endif + #ifdef DEBUG_MODE_NORMAL + #undef DEBUG_MODE_NORMAL + #endif + #ifndef DEBUG_MODE_MINIMAL + #define DEBUG_MODE_MINIMAL + #endif + #include "script_macros.hpp" + (end) - In order to turn on full debugging for a whole addon, - (begin example) - // Top of addons\main\script_macros.hpp - #ifndef DEBUG_MODE_FULL - #define DEBUG_MODE_FULL - #endif - #include "\x\cba\addons\main\script_macros_common.hpp" - (end) + In order to turn on full debugging for a whole addon, + (begin example) + // Top of addons\main\script_macros.hpp + #ifndef DEBUG_MODE_FULL + #define DEBUG_MODE_FULL + #endif + #include "\x\cba\addons\main\script_macros_common.hpp" + (end) Author: - Spooner + Spooner ------------------------------------------- */ // If DEBUG_MODE_FULL, then also enable DEBUG_MODE_NORMAL. @@ -142,20 +142,20 @@ Author: /* ------------------------------------------- Macro: LOG() - Log a timestamped message into the RPT log. + Log a timestamped message into the RPT log. - Only run if or higher is defined. + Only run if or higher is defined. Parameters: - MESSAGE - Message to record [String] + MESSAGE - Message to record [String] Example: - (begin example) - LOG("Initiated clog-dancing simulator."); - (end) + (begin example) + LOG("Initiated clog-dancing simulator."); + (end) Author: - Spooner + Spooner ------------------------------------------- */ #ifdef DEBUG_MODE_FULL #define LOG(MESSAGE) [THIS_FILE_, __LINE__, MESSAGE] call CBA_fnc_log @@ -165,20 +165,20 @@ Author: /* ------------------------------------------- Macro: WARNING() - Record a timestamped, non-critical error in the RPT log. + Record a timestamped, non-critical error in the RPT log. - Only run if or higher is defined. + Only run if or higher is defined. Parameters: - MESSAGE - Message to record [String] + MESSAGE - Message to record [String] Example: - (begin example) - WARNING("This function has been deprecated. Please don't use it in future!"); - (end) + (begin example) + WARNING("This function has been deprecated. Please don't use it in future!"); + (end) Author: - Spooner + Spooner ------------------------------------------- */ #ifdef DEBUG_MODE_NORMAL #define WARNING(MESSAGE) [THIS_FILE_, __LINE__, ('WARNING: ' + MESSAGE)] call CBA_fnc_log @@ -188,152 +188,171 @@ Author: /* ------------------------------------------- Macro: ERROR() - Record a timestamped, critical error in the RPT log. + Record a timestamped, critical error in the RPT log. - The heading is "ERROR" (use for a specific title). + The heading is "ERROR" (use for a specific title). - TODO: Popup an error dialog & throw an exception. + TODO: Popup an error dialog & throw an exception. Parameters: - MESSAGE - Message to record [String] + MESSAGE - Message to record [String] Example: - (begin example) - ERROR("Value not found","value of frog not found in config ...yada...yada..."); - (end) + (begin example) + ERROR("Value not found","value of frog not found in config ...yada...yada..."); + (end) Author: - Spooner + Spooner ------------------------------------------- */ #define ERROR(MESSAGE) \ - [THIS_FILE_, __LINE__, "ERROR", MESSAGE] call CBA_fnc_error; + [THIS_FILE_, __LINE__, "ERROR", MESSAGE] call CBA_fnc_error; /* ------------------------------------------- Macro: ERROR_WITH_TITLE() - Record a timestamped, critical error in the RPT log. + Record a timestamped, critical error in the RPT log. - The title can be specified (in the heading is always just "ERROR") - Newlines (\n) in the MESSAGE will be put on separate lines. + The title can be specified (in the heading is always just "ERROR") + Newlines (\n) in the MESSAGE will be put on separate lines. - TODO: Popup an error dialog & throw an exception. + TODO: Popup an error dialog & throw an exception. Parameters: - TITLE - Title of error message [String] - MESSAGE - Body of error message [String] + TITLE - Title of error message [String] + MESSAGE - Body of error message [String] Example: - (begin example) - ERROR_WITH_TITLE("Value not found","Value of frog not found in config ...yada...yada..."); - (end) + (begin example) + ERROR_WITH_TITLE("Value not found","Value of frog not found in config ...yada...yada..."); + (end) Author: - Spooner + Spooner ------------------------------------------- */ #define ERROR_WITH_TITLE(TITLE,MESSAGE) \ - [THIS_FILE_, __LINE__, TITLE, MESSAGE] call CBA_fnc_error; + [THIS_FILE_, __LINE__, TITLE, MESSAGE] call CBA_fnc_error; + +/* ------------------------------------------- +Macro: MESSAGE_WITH_TITLE() + Record a single line, timestamped log entry in the RPT log. + +Parameters: + TITLE - Title of log message [String] + MESSAGE - Body of message [String] + +Example: + (begin example) + MESSAGE_WITH_TITLE("Value found","Value of frog found in config "); + (end) + +Author: + Killswitch +------------------------------------------- */ +#define MESSAGE_WITH_TITLE(TITLE,MESSAGE) \ + [THIS_FILE_, __LINE__, TITLE + ': ' + (MESSAGE)] call CBA_fnc_log; /* ------------------------------------------- Macro: RETNIL() - If a variable is undefined, return the value nil. Otherwise, return the - variable itself. + If a variable is undefined, return the value nil. Otherwise, return the + variable itself. Parameters: - VARIABLE - the variable to check + VARIABLE - the variable to check Example: - (begin example) - // _var is undefined - hintSilent format ["_var=%1", RETNIL(_var) ]; // "_var=any" - (end example) + (begin example) + // _var is undefined + hintSilent format ["_var=%1", RETNIL(_var) ]; // "_var=any" + (end example) Author: - Alef (see CBA issue #8514) + Alef (see CBA issue #8514) ------------------------------------------- */ #define RETNIL(VARIABLE) if (isNil{VARIABLE}) then {nil} else {VARIABLE} /* ------------------------------------------- Macros: TRACE_n() - Log a message and 1-8 variables to the RPT log. + Log a message and 1-8 variables to the RPT log. - Only run if is defined. + Only run if is defined. - TRACE_1(MESSAGE,A) - Log 1 variable. - TRACE_2(MESSAGE,A,B) - Log 2 variables. - TRACE_3(MESSAGE,A,B,C) - Log 3 variables. - TRACE_4(MESSAGE,A,B,C,D) - Log 4 variables. - TRACE_5(MESSAGE,A,B,C,D,E) - Log 5 variables. - TRACE_6(MESSAGE,A,B,C,D,E,F) - Log 6 variables. - TRACE_7(MESSAGE,A,B,C,D,E,F,G) - Log 7 variables. - TRACE_8(MESSAGE,A,B,C,D,E,F,G,H) - Log 8 variables. - TRACE_9(MESSAGE,A,B,C,D,E,F,G,H,I) - Log 9 variables. + TRACE_1(MESSAGE,A) - Log 1 variable. + TRACE_2(MESSAGE,A,B) - Log 2 variables. + TRACE_3(MESSAGE,A,B,C) - Log 3 variables. + TRACE_4(MESSAGE,A,B,C,D) - Log 4 variables. + TRACE_5(MESSAGE,A,B,C,D,E) - Log 5 variables. + TRACE_6(MESSAGE,A,B,C,D,E,F) - Log 6 variables. + TRACE_7(MESSAGE,A,B,C,D,E,F,G) - Log 7 variables. + TRACE_8(MESSAGE,A,B,C,D,E,F,G,H) - Log 8 variables. + TRACE_9(MESSAGE,A,B,C,D,E,F,G,H,I) - Log 9 variables. Parameters: - MESSAGE - Message to add to the trace [String] - A..H - Variable names to log values of [Any] + MESSAGE - Message to add to the trace [String] + A..H - Variable names to log values of [Any] Example: - (begin example) - TRACE_3("After takeoff",_vehicle player,getPos (_vehicle player), getPosASL (_vehicle player)); - (end) + (begin example) + TRACE_3("After takeoff",_vehicle player,getPos (_vehicle player), getPosASL (_vehicle player)); + (end) Author: - Spooner + Spooner ------------------------------------------- */ #define PFORMAT_1(MESSAGE,A) \ - format ['%1: A=%2', MESSAGE, RETNIL(A)] + format ['%1: A=%2', MESSAGE, RETNIL(A)] #define PFORMAT_2(MESSAGE,A,B) \ - format ['%1: A=%2, B=%3', MESSAGE, RETNIL(A), RETNIL(B)] + format ['%1: A=%2, B=%3', MESSAGE, RETNIL(A), RETNIL(B)] #define PFORMAT_3(MESSAGE,A,B,C) \ - format ['%1: A=%2, B=%3, C=%4', MESSAGE, RETNIL(A), RETNIL(B), RETNIL(C)] + format ['%1: A=%2, B=%3, C=%4', MESSAGE, RETNIL(A), RETNIL(B), RETNIL(C)] #define PFORMAT_4(MESSAGE,A,B,C,D) \ - format ['%1: A=%2, B=%3, C=%4, D=%5', MESSAGE, RETNIL(A), RETNIL(B), RETNIL(C), RETNIL(D)] + format ['%1: A=%2, B=%3, C=%4, D=%5', MESSAGE, RETNIL(A), RETNIL(B), RETNIL(C), RETNIL(D)] #define PFORMAT_5(MESSAGE,A,B,C,D,E) \ - format ['%1: A=%2, B=%3, C=%4, D=%5, E=%6', MESSAGE, RETNIL(A), RETNIL(B), RETNIL(C), RETNIL(D), RETNIL(E)] + format ['%1: A=%2, B=%3, C=%4, D=%5, E=%6', MESSAGE, RETNIL(A), RETNIL(B), RETNIL(C), RETNIL(D), RETNIL(E)] #define PFORMAT_6(MESSAGE,A,B,C,D,E,F) \ - format ['%1: A=%2, B=%3, C=%4, D=%5, E=%6, F=%7', MESSAGE, RETNIL(A), RETNIL(B), RETNIL(C), RETNIL(D), RETNIL(E), RETNIL(F)] + format ['%1: A=%2, B=%3, C=%4, D=%5, E=%6, F=%7', MESSAGE, RETNIL(A), RETNIL(B), RETNIL(C), RETNIL(D), RETNIL(E), RETNIL(F)] #define PFORMAT_7(MESSAGE,A,B,C,D,E,F,G) \ - format ['%1: A=%2, B=%3, C=%4, D=%5, E=%6, F=%7, G=%8', MESSAGE, RETNIL(A), RETNIL(B), RETNIL(C), RETNIL(D), RETNIL(E), RETNIL(F), RETNIL(G)] + format ['%1: A=%2, B=%3, C=%4, D=%5, E=%6, F=%7, G=%8', MESSAGE, RETNIL(A), RETNIL(B), RETNIL(C), RETNIL(D), RETNIL(E), RETNIL(F), RETNIL(G)] #define PFORMAT_8(MESSAGE,A,B,C,D,E,F,G,H) \ - format ['%1: A=%2, B=%3, C=%4, D=%5, E=%6, F=%7, G=%8, H=%9', MESSAGE, RETNIL(A), RETNIL(B), RETNIL(C), RETNIL(D), RETNIL(E), RETNIL(F), RETNIL(G), RETNIL(H)] + format ['%1: A=%2, B=%3, C=%4, D=%5, E=%6, F=%7, G=%8, H=%9', MESSAGE, RETNIL(A), RETNIL(B), RETNIL(C), RETNIL(D), RETNIL(E), RETNIL(F), RETNIL(G), RETNIL(H)] #define PFORMAT_9(MESSAGE,A,B,C,D,E,F,G,H,I) \ - format ['%1: A=%2, B=%3, C=%4, D=%5, E=%6, F=%7, G=%8, H=%9, I=%10', MESSAGE, RETNIL(A), RETNIL(B), RETNIL(C), RETNIL(D), RETNIL(E), RETNIL(F), RETNIL(G), RETNIL(H), RETNIL(I)] + format ['%1: A=%2, B=%3, C=%4, D=%5, E=%6, F=%7, G=%8, H=%9, I=%10', MESSAGE, RETNIL(A), RETNIL(B), RETNIL(C), RETNIL(D), RETNIL(E), RETNIL(F), RETNIL(G), RETNIL(H), RETNIL(I)] #ifdef DEBUG_MODE_FULL #define TRACE_1(MESSAGE,A) \ - [THIS_FILE_, __LINE__, PFORMAT_1(MESSAGE,A)] call CBA_fnc_log + [THIS_FILE_, __LINE__, PFORMAT_1(MESSAGE,A)] call CBA_fnc_log #define TRACE_2(MESSAGE,A,B) \ - [THIS_FILE_, __LINE__, PFORMAT_2(MESSAGE,A,B)] call CBA_fnc_log + [THIS_FILE_, __LINE__, PFORMAT_2(MESSAGE,A,B)] call CBA_fnc_log #define TRACE_3(MESSAGE,A,B,C) \ - [THIS_FILE_, __LINE__, PFORMAT_3(MESSAGE,A,B,C)] call CBA_fnc_log + [THIS_FILE_, __LINE__, PFORMAT_3(MESSAGE,A,B,C)] call CBA_fnc_log #define TRACE_4(MESSAGE,A,B,C,D) \ - [THIS_FILE_, __LINE__, PFORMAT_4(MESSAGE,A,B,C,D)] call CBA_fnc_log + [THIS_FILE_, __LINE__, PFORMAT_4(MESSAGE,A,B,C,D)] call CBA_fnc_log #define TRACE_5(MESSAGE,A,B,C,D,E) \ - [THIS_FILE_, __LINE__, PFORMAT_5(MESSAGE,A,B,C,D,E)] call CBA_fnc_log + [THIS_FILE_, __LINE__, PFORMAT_5(MESSAGE,A,B,C,D,E)] call CBA_fnc_log #define TRACE_6(MESSAGE,A,B,C,D,E,F) \ - [THIS_FILE_, __LINE__, PFORMAT_6(MESSAGE,A,B,C,D,E,F)] call CBA_fnc_log + [THIS_FILE_, __LINE__, PFORMAT_6(MESSAGE,A,B,C,D,E,F)] call CBA_fnc_log #define TRACE_7(MESSAGE,A,B,C,D,E,F,G) \ - [THIS_FILE_, __LINE__, PFORMAT_7(MESSAGE,A,B,C,D,E,F,G)] call CBA_fnc_log + [THIS_FILE_, __LINE__, PFORMAT_7(MESSAGE,A,B,C,D,E,F,G)] call CBA_fnc_log #define TRACE_8(MESSAGE,A,B,C,D,E,F,G,H) \ - [THIS_FILE_, __LINE__, PFORMAT_8(MESSAGE,A,B,C,D,E,F,G,H)] call CBA_fnc_log + [THIS_FILE_, __LINE__, PFORMAT_8(MESSAGE,A,B,C,D,E,F,G,H)] call CBA_fnc_log #define TRACE_9(MESSAGE,A,B,C,D,E,F,G,H,I) \ - [THIS_FILE_, __LINE__, PFORMAT_9(MESSAGE,A,B,C,D,E,F,G,H,I)] call CBA_fnc_log + [THIS_FILE_, __LINE__, PFORMAT_9(MESSAGE,A,B,C,D,E,F,G,H,I)] call CBA_fnc_log #else @@ -360,37 +379,37 @@ Group: General #define QUOTE(var1) #var1 #ifdef MODULAR - #define COMPONENT_T DOUBLES(t,COMPONENT) - #define COMPONENT_M DOUBLES(m,COMPONENT) - #define COMPONENT_S DOUBLES(s,COMPONENT) - #define COMPONENT_C DOUBLES(c,COMPONENT) - #define COMPONENT_F COMPONENT_C + #define COMPONENT_T DOUBLES(t,COMPONENT) + #define COMPONENT_M DOUBLES(m,COMPONENT) + #define COMPONENT_S DOUBLES(s,COMPONENT) + #define COMPONENT_C DOUBLES(c,COMPONENT) + #define COMPONENT_F COMPONENT_C #else - #define COMPONENT_T COMPONENT - #define COMPONENT_M COMPONENT - #define COMPONENT_S COMPONENT - #define COMPONENT_F COMPONENT - #define COMPONENT_C COMPONENT + #define COMPONENT_T COMPONENT + #define COMPONENT_M COMPONENT + #define COMPONENT_S COMPONENT + #define COMPONENT_F COMPONENT + #define COMPONENT_C COMPONENT #endif /* ------------------------------------------- Macro: INC() Description: - Increase a number by one. + Increase a number by one. Parameters: - VAR - Variable to increment [Number] + VAR - Variable to increment [Number] Example: - (begin example) - _counter = 0; - INC(_counter); - // _counter => 1 - (end) + (begin example) + _counter = 0; + INC(_counter); + // _counter => 1 + (end) Author: - Spooner + Spooner ------------------------------------------- */ #define INC(var) var = (var) + 1 @@ -398,20 +417,20 @@ Author: Macro: DEC() Description: - Decrease a number by one. + Decrease a number by one. Parameters: - VAR - Variable to decrement [Number] + VAR - Variable to decrement [Number] Example: - (begin example) - _counter = 99; - DEC(_counter); - // _counter => 98 - (end) + (begin example) + _counter = 99; + DEC(_counter); + // _counter => 98 + (end) Author: - Spooner + Spooner ------------------------------------------- */ #define DEC(var) var = (var) - 1 @@ -419,27 +438,27 @@ Author: Macro: ADD() Description: - Add a value to a variable. Variable and value should be both Numbers or both Strings. + Add a value to a variable. Variable and value should be both Numbers or both Strings. Parameters: - VAR - Variable to add to [Number or String] - VALUE - Value to add [Number or String] + VAR - Variable to add to [Number or String] + VALUE - Value to add [Number or String] Examples: - (begin example) - _counter = 2; - ADD(_counter,3); - // _counter => 5 - (end) - (begin example) - _str = "hello"; - ADD(_str," "); - ADD(_str,"Fred"); - // _str => "hello Fred" - (end) + (begin example) + _counter = 2; + ADD(_counter,3); + // _counter => 5 + (end) + (begin example) + _str = "hello"; + ADD(_str," "); + ADD(_str,"Fred"); + // _str => "hello Fred" + (end) Author: - Sickboy + Sickboy ------------------------------------------- */ #define ADD(var1,var2) var1 = (var1) + (var2) @@ -447,18 +466,18 @@ Author: Macro: SUB() Description: - Subtract a value from a number variable. VAR and VALUE should both be Numbers. + Subtract a value from a number variable. VAR and VALUE should both be Numbers. Parameters: - VAR - Variable to subtract from [Number] - VALUE - Value to subtract [Number] + VAR - Variable to subtract from [Number] + VALUE - Value to subtract [Number] Examples: - (begin example) - _numChickens = 2; - SUB(_numChickens,3); - // _numChickens => -1 - (end) + (begin example) + _numChickens = 2; + SUB(_numChickens,3); + // _numChickens => -1 + (end) ------------------------------------------- */ #define SUB(var1,var2) var1 = (var1) - (var2) @@ -466,24 +485,24 @@ Examples: Macro: REM() Description: - Remove an element from an array each time it occurs. + Remove an element from an array each time it occurs. - This recreates the entire array, so use BIS_fnc_removeIndex if modification of the original array is required - or if only one of the elements that matches ELEMENT needs to be removed. + This recreates the entire array, so use BIS_fnc_removeIndex if modification of the original array is required + or if only one of the elements that matches ELEMENT needs to be removed. Parameters: - ARRAY - Array to modify [Array] - ELEMENT - Element to remove [Any] + ARRAY - Array to modify [Array] + ELEMENT - Element to remove [Any] Examples: - (begin example) - _array = [1, 2, 3, 4, 3, 8]; - REM(_array,3); - // _array = [1, 2, 4, 8]; - (end) + (begin example) + _array = [1, 2, 3, 4, 3, 8]; + REM(_array,3); + // _array = [1, 2, 4, 8]; + (end) Author: - Spooner + Spooner ------------------------------------------- */ #define REM(var1,var2) SUB(var1,[var2]) @@ -491,21 +510,21 @@ Author: Macro: PUSH() Description: - Appends a single value onto the end of an ARRAY. Change is made to the ARRAY itself, not creating a new array. + Appends a single value onto the end of an ARRAY. Change is made to the ARRAY itself, not creating a new array. Parameters: - ARRAY - Array to push element onto [Array] - ELEMENT - Element to push [Any] + ARRAY - Array to push element onto [Array] + ELEMENT - Element to push [Any] Examples: - (begin example) - _fish = ["blue", "green", "smelly"]; - PUSH(_fish,"monkey-flavoured"); - // _fish => ["blue", "green", "smelly", "monkey-flavoured"] - (end) + (begin example) + _fish = ["blue", "green", "smelly"]; + PUSH(_fish,"monkey-flavoured"); + // _fish => ["blue", "green", "smelly", "monkey-flavoured"] + (end) Author: - Spooner + Spooner ------------------------------------------- */ #define PUSH(var1,var2) (var1) pushBack (var2) @@ -513,27 +532,27 @@ Author: Macro: ISNILS() Description: - Sets a variable with a value, but only if it is undefined. + Sets a variable with a value, but only if it is undefined. Parameters: - VARIABLE - Variable to set [Any, not nil] - DEFAULT_VALUE - Value to set VARIABLE to if it is undefined [Any, not nil] + VARIABLE - Variable to set [Any, not nil] + DEFAULT_VALUE - Value to set VARIABLE to if it is undefined [Any, not nil] Examples: - (begin example) - // _fish is undefined - ISNILS(_fish,0); - // _fish => 0 - (end) - (begin example) - _fish = 12; - // ...later... - ISNILS(_fish,0); - // _fish => 12 - (end) + (begin example) + // _fish is undefined + ISNILS(_fish,0); + // _fish => 0 + (end) + (begin example) + _fish = 12; + // ...later... + ISNILS(_fish,0); + // _fish => 12 + (end) Author: - Sickboy + Sickboy ------------------------------------------- */ #define ISNILS(VARIABLE,DEFAULT_VALUE) if (isNil #VARIABLE) then { ##VARIABLE = ##DEFAULT_VALUE } #define ISNILS2(var1,var2,var3,var4) ISNILS(TRIPLES(var1,var2,var3),var4) @@ -550,14 +569,14 @@ Author: #define GETVARMAINS(var1,var2) GETVARS(var1,MAINLOGIC,var2) #ifndef PATHTO_SYS - #define PATHTO_SYS(var1,var2,var3) \MAINPREFIX\##var1\SUBPREFIX\##var2\##var3.sqf + #define PATHTO_SYS(var1,var2,var3) \MAINPREFIX\##var1\SUBPREFIX\##var2\##var3.sqf #endif #ifndef PATHTOF_SYS - #define PATHTOF_SYS(var1,var2,var3) \MAINPREFIX\##var1\SUBPREFIX\##var2\##var3 + #define PATHTOF_SYS(var1,var2,var3) \MAINPREFIX\##var1\SUBPREFIX\##var2\##var3 #endif #ifndef PATHTOF2_SYS - #define PATHTOF2_SYS(var1,var2,var3) MAINPREFIX\##var1\SUBPREFIX\##var2\##var3 + #define PATHTOF2_SYS(var1,var2,var3) MAINPREFIX\##var1\SUBPREFIX\##var2\##var3 #endif #define PATHTO_R(var1) PATHTOF2_SYS(PREFIX,COMPONENT_C,var1) @@ -606,7 +625,7 @@ Author: #define CACHE_DIS(var1) (!isNil "CBA_RECOMPILE" || CACHE_DIS_SYS(configFile,var1) || CACHE_DIS_SYS(missionConfigFile,var1)) #ifndef DEBUG_SETTINGS - #define DEBUG_SETTINGS [false, true, false] + #define DEBUG_SETTINGS [false, true, false] #endif #define MSG_INIT QUOTE(Initializing: ADDON version: VERSION) @@ -625,34 +644,34 @@ Author: #define VERSIONING_SYS(var1) class CfgSettings \ { \ - class CBA \ - { \ - class Versioning \ - { \ - class var1 \ - { \ - }; \ - }; \ - }; \ + class CBA \ + { \ + class Versioning \ + { \ + class var1 \ + { \ + }; \ + }; \ + }; \ }; #define VERSIONING VERSIONING_SYS(PREFIX) /* ------------------------------------------- Macro: GVAR() - Get full variable identifier for a global variable owned by this component. + Get full variable identifier for a global variable owned by this component. Parameters: - VARIABLE - Partial name of global variable owned by this component [Any]. + VARIABLE - Partial name of global variable owned by this component [Any]. Example: - (begin example) - GVAR(frog) = 12; - // In SPON_FrogDancing component, equivalent to SPON_FrogDancing_frog = 12 - (end) + (begin example) + GVAR(frog) = 12; + // In SPON_FrogDancing component, equivalent to SPON_FrogDancing_frog = 12 + (end) Author: - Sickboy + Sickboy ------------------------------------------- */ #define GVAR(var1) DOUBLES(ADDON,var1) #define EGVAR(var1,var2) DOUBLES(DOUBLES(PREFIX,var1),var2) @@ -660,19 +679,19 @@ Author: /* ------------------------------------------- Macro: GVARMAIN() - Get full variable identifier for a global variable owned by this addon. + Get full variable identifier for a global variable owned by this addon. Parameters: - VARIABLE - Partial name of global variable owned by this addon [Any]. + VARIABLE - Partial name of global variable owned by this addon [Any]. Example: - (begin example) - GVARMAIN(frog) = 12; - // In SPON_FrogDancing component, equivalent to SPON_frog = 12 - (end) + (begin example) + GVARMAIN(frog) = 12; + // In SPON_FrogDancing component, equivalent to SPON_frog = 12 + (end) Author: - Sickboy + Sickboy ------------------------------------------- */ #define GVARMAIN(var1) GVARMAINS(PREFIX,var1) // TODO: What's this? @@ -693,7 +712,7 @@ Author: #define PREP(var1) TRIPLES(ADDON,fnc,var1) = compile preProcessFileLineNumbers 'PATHTO_SYS(PREFIX,COMPONENT_F,DOUBLES(fnc,var1))' #define PREPMAIN(var1) TRIPLES(PREFIX,fnc,var1) = compile preProcessFileLineNumbers 'PATHTO_SYS(PREFIX,COMPONENT_F,DOUBLES(fnc,var1))' #else - #define PREP(var1) ['PATHTO_SYS(PREFIX,COMPONENT_F,DOUBLES(fnc,var1))', 'TRIPLES(ADDON,fnc,var1)'] call SLX_XEH_COMPILE_NEW + #define PREP(var1) ['PATHTO_SYS(PREFIX,COMPONENT_F,DOUBLES(fnc,var1))', 'TRIPLES(ADDON,fnc,var1)'] call SLX_XEH_COMPILE_NEW #define PREPMAIN(var1) ['PATHTO_SYS(PREFIX,COMPONENT_F,DOUBLES(fnc,var1))', 'TRIPLES(PREFIX,fnc,var1)'] call SLX_XEH_COMPILE_NEW #endif @@ -703,27 +722,27 @@ Author: #define EFUNC(var1,var2) FUNC_INNER(var1,var2) #ifndef PRELOAD_ADDONS - #define PRELOAD_ADDONS class CfgAddons \ + #define PRELOAD_ADDONS class CfgAddons \ { \ - class PreloadAddons \ - { \ - class ADDON \ - { \ - list[]={ QUOTE(ADDON) }; \ - }; \ - }; \ + class PreloadAddons \ + { \ + class ADDON \ + { \ + list[]={ QUOTE(ADDON) }; \ + }; \ + }; \ } #endif /* ------------------------------------------- Macros: ARG_#() - Select from list of array arguments + Select from list of array arguments Parameters: - VARIABLE(1-8) - elements for the list + VARIABLE(1-8) - elements for the list Author: - Rommel + Rommel ------------------------------------------- */ #define ARG_1(A,B) ((A) select (B)) #define ARG_2(A,B,C) (ARG_1(ARG_1(A,B),C)) @@ -736,14 +755,14 @@ Author: /* ------------------------------------------- Macros: ARR_#() - Create list from arguments. Useful for working around , in macro parameters. - 1-8 arguments possible. + Create list from arguments. Useful for working around , in macro parameters. + 1-8 arguments possible. Parameters: - VARIABLE(1-8) - elements for the list + VARIABLE(1-8) - elements for the list Author: - Nou + Nou ------------------------------------------- */ #define ARR_1(ARG1) ARG1 #define ARR_2(ARG1,ARG2) ARG1, ARG2 @@ -756,15 +775,15 @@ Author: /* ------------------------------------------- Macros: FORMAT_#(STR, ARG1) - Format - Useful for working around , in macro parameters. - 1-8 arguments possible. + Format - Useful for working around , in macro parameters. + 1-8 arguments possible. Parameters: - STRING - string used by format - VARIABLE(1-8) - elements for usage in format + STRING - string used by format + VARIABLE(1-8) - elements for usage in format Author: - Nou & Sickboy + Nou & Sickboy ------------------------------------------- */ #define FORMAT_1(STR,ARG1) format[STR, ARG1] #define FORMAT_2(STR,ARG1,ARG2) format[STR, ARG1, ARG2] @@ -781,32 +800,32 @@ Author: /* ------------------------------------------- Macros: IS_x() - Checking the data types of variables. + Checking the data types of variables. - IS_ARRAY() - Array - IS_BOOL() - Boolean - IS_BOOLEAN() - UI display handle(synonym for ) - IS_CODE() - Code block (i.e a compiled function) - IS_CONFIG() - Configuration - IS_CONTROL() - UI control handle. - IS_DISPLAY() - UI display handle. - IS_FUNCTION() - A compiled function (synonym for ) - IS_GROUP() - Group. - IS_INTEGER() - Is a number a whole number? - IS_LOCATION() - World location. - IS_NUMBER() - A floating point number (synonym for ) - IS_OBJECT() - World object. - IS_SCALAR() - Floating point number. - IS_SCRIPT() - A script handle (as returned by execVM and spawn commands). - IS_SIDE() - Game side. - IS_STRING() - World object. - IS_TEXT() - Structured text. + IS_ARRAY() - Array + IS_BOOL() - Boolean + IS_BOOLEAN() - UI display handle(synonym for ) + IS_CODE() - Code block (i.e a compiled function) + IS_CONFIG() - Configuration + IS_CONTROL() - UI control handle. + IS_DISPLAY() - UI display handle. + IS_FUNCTION() - A compiled function (synonym for ) + IS_GROUP() - Group. + IS_INTEGER() - Is a number a whole number? + IS_LOCATION() - World location. + IS_NUMBER() - A floating point number (synonym for ) + IS_OBJECT() - World object. + IS_SCALAR() - Floating point number. + IS_SCRIPT() - A script handle (as returned by execVM and spawn commands). + IS_SIDE() - Game side. + IS_STRING() - World object. + IS_TEXT() - Structured text. Parameters: - VARIABLE - Variable to check if it is of a particular type [Any, not nil] + VARIABLE - Variable to check if it is of a particular type [Any, not nil] Author: - Spooner + Spooner ------------------------------------------- */ #define IS_META_SYS(VAR,TYPE) (if (isNil {VAR}) then { false } else { (typeName (VAR)) == TYPE }) #define IS_ARRAY(VAR) IS_META_SYS(VAR,"ARRAY") @@ -829,107 +848,120 @@ Author: #define IS_INTEGER(VAR) if ( IS_SCALAR(VAR) ) then { (floor(VAR) == (VAR)) } else { false } #define IS_NUMBER(VAR) IS_SCALAR(VAR) +#define FLOAT_TO_STRING(num) (str parseNumber (str (_this%_this) + str floor abs _this) + "." + (str (abs _this-floor abs _this) select [2]) + "0") + /* ------------------------------------------- Macro: SCRIPT() - Sets name of script (relies on PREFIX and COMPONENT values being #defined). + Sets name of script (relies on PREFIX and COMPONENT values being #defined). Parameters: - NAME - Name of script [Indentifier] + NAME - Name of script [Indentifier] Example: - (begin example) - SCRIPT(eradicateMuppets); - (end) + (begin example) + SCRIPT(eradicateMuppets); + (end) Author: - Spooner + Spooner ------------------------------------------- */ #define SCRIPT(NAME) \ - scriptName 'PREFIX\COMPONENT\NAME' + scriptName 'PREFIX\COMPONENT\NAME' /* ------------------------------------------- Macros: EXPLODE_n() - Splitting an ARRAY into a number of variables (A, B, C, etc). + DEPRECATED - Use param/params commands added in Arma 3 1.48 - Note that this NOT does make the created variables private. - _PVT variants do. + Splitting an ARRAY into a number of variables (A, B, C, etc). - EXPLODE_1(ARRAY,A,B) - Split a 1-element array into separate variable. - EXPLODE_2(ARRAY,A,B) - Split a 2-element array into separate variables. - EXPLODE_3(ARRAY,A,B,C) - Split a 3-element array into separate variables. - EXPLODE_4(ARRAY,A,B,C,D) - Split a 4-element array into separate variables. - EXPLODE_5(ARRAY,A,B,C,D,E) - Split a 5-element array into separate variables. - EXPLODE_6(ARRAY,A,B,C,D,E,F) - Split a 6-element array into separate variables. - EXPLODE_7(ARRAY,A,B,C,D,E,F,G) - Split a 7-element array into separate variables. - EXPLODE_8(ARRAY,A,B,C,D,E,F,G,H) - Split a 8-element array into separate variables. - EXPLODE_9(ARRAY,A,B,C,D,E,F,G,H,I) - Split a 9-element array into separate variables. + Note that this NOT does make the created variables private. + _PVT variants do. + + EXPLODE_1(ARRAY,A,B) - Split a 1-element array into separate variable. + EXPLODE_2(ARRAY,A,B) - Split a 2-element array into separate variables. + EXPLODE_3(ARRAY,A,B,C) - Split a 3-element array into separate variables. + EXPLODE_4(ARRAY,A,B,C,D) - Split a 4-element array into separate variables. + EXPLODE_5(ARRAY,A,B,C,D,E) - Split a 5-element array into separate variables. + EXPLODE_6(ARRAY,A,B,C,D,E,F) - Split a 6-element array into separate variables. + EXPLODE_7(ARRAY,A,B,C,D,E,F,G) - Split a 7-element array into separate variables. + EXPLODE_8(ARRAY,A,B,C,D,E,F,G,H) - Split a 8-element array into separate variables. + EXPLODE_9(ARRAY,A,B,C,D,E,F,G,H,I) - Split a 9-element array into separate variables. Parameters: - ARRAY - Array to read from [Array] - A..H - Names of variables to set from array [Identifier] + ARRAY - Array to read from [Array] + A..H - Names of variables to set from array [Identifier] Example: - (begin example) - _array = ["fred", 156.8, 120.9]; - EXPLODE_3(_array,_name_height,_weight); - (end) + (begin example) + _array = ["fred", 156.8, 120.9]; + EXPLODE_3(_array,_name,_height,_weight); + (end) Author: - Spooner + Spooner ------------------------------------------- */ -#define EXPLODE_1_SYS(ARRAY,A) A = if (IS_ARRAY((ARRAY))) then { (ARRAY) select 0 } else { ARRAY } +#define EXPLODE_1_SYS(ARRAY,A) A = ARRAY param [0] #define EXPLODE_1(ARRAY,A) EXPLODE_1_SYS(ARRAY,A); TRACE_1("EXPLODE_1, " + QUOTE(ARRAY),A) -#define EXPLODE_1_PVT(ARRAY,A) \ - private #A; \ - EXPLODE_1(ARRAY,A) +#define EXPLODE_1_PVT(ARRAY,A) ARRAY params [#A]; TRACE_1("EXPLODE_1, " + QUOTE(ARRAY),A) -#define EXPLODE_2_SYS(ARRAY,A,B) EXPLODE_1_SYS(ARRAY,A); B = (ARRAY) select 1 +#define EXPLODE_2_SYS(ARRAY,A,B) EXPLODE_1_SYS(ARRAY,A); B = ARRAY param [1] #define EXPLODE_2(ARRAY,A,B) EXPLODE_2_SYS(ARRAY,A,B); TRACE_2("EXPLODE_2, " + QUOTE(ARRAY),A,B) -#define EXPLODE_2_PVT(ARRAY,A,B) \ - private [#A,#B]; \ - EXPLODE_2(ARRAY,A,B) +#define EXPLODE_2_PVT(ARRAY,A,B) ARRAY params [#A,#B]; TRACE_2("EXPLODE_2, " + QUOTE(ARRAY),A,B) -#define EXPLODE_3_SYS(ARRAY,A,B,C) EXPLODE_2_SYS(ARRAY,A,B); C = (ARRAY) select 2 +#define EXPLODE_3_SYS(ARRAY,A,B,C) EXPLODE_2_SYS(ARRAY,A,B); C = ARRAY param [2] #define EXPLODE_3(ARRAY,A,B,C) EXPLODE_3_SYS(ARRAY,A,B,C); TRACE_3("EXPLODE_3, " + QUOTE(ARRAY),A,B,C) -#define EXPLODE_3_PVT(ARRAY,A,B,C) \ - private [#A,#B,#C]; \ - EXPLODE_3(ARRAY,A,B,C) - -#define EXPLODE_4_SYS(ARRAY,A,B,C,D) EXPLODE_3_SYS(ARRAY,A,B,C); D = (ARRAY) select 3 +#define EXPLODE_3_PVT(ARRAY,A,B,C) ARRAY params [#A,#B,#C]; TRACE_3("EXPLODE_3, " + QUOTE(ARRAY),A,B,C) + +#define EXPLODE_4_SYS(ARRAY,A,B,C,D) EXPLODE_3_SYS(ARRAY,A,B,C); D = ARRAY param [3] #define EXPLODE_4(ARRAY,A,B,C,D) EXPLODE_4_SYS(ARRAY,A,B,C,D); TRACE_4("EXPLODE_4, " + QUOTE(ARRAY),A,B,C,D) -#define EXPLODE_4_PVT(ARRAY,A,B,C,D) \ - private [#A,#B,#C,#D]; \ - EXPLODE_4(ARRAY,A,B,C,D) +#define EXPLODE_4_PVT(ARRAY,A,B,C,D) ARRAY params [#A,#B,#C,#D]; TRACE_4("EXPLODE_4, " + QUOTE(ARRAY),A,B,C,D) -#define EXPLODE_5_SYS(ARRAY,A,B,C,D,E) EXPLODE_4_SYS(ARRAY,A,B,C,D); E = (ARRAY) select 4 +#define EXPLODE_5_SYS(ARRAY,A,B,C,D,E) EXPLODE_4_SYS(ARRAY,A,B,C,D); E = ARRAY param [4] #define EXPLODE_5(ARRAY,A,B,C,D,E) EXPLODE_5_SYS(ARRAY,A,B,C,D,E); TRACE_5("EXPLODE_5, " + QUOTE(ARRAY),A,B,C,D,E) -#define EXPLODE_5_PVT(ARRAY,A,B,C,D,E) \ - private [#A,#B,#C,#D,#E]; \ - EXPLODE_5(ARRAY,A,B,C,D,E) +#define EXPLODE_5_PVT(ARRAY,A,B,C,D,E) ARRAY params [#A,#B,#C,#D,#E]; TRACE_5("EXPLODE_5, " + QUOTE(ARRAY),A,B,C,D,E) -#define EXPLODE_6_SYS(ARRAY,A,B,C,D,E,F) EXPLODE_5_SYS(ARRAY,A,B,C,D,E); F = (ARRAY) select 5 +#define EXPLODE_6_SYS(ARRAY,A,B,C,D,E,F) EXPLODE_5_SYS(ARRAY,A,B,C,D,E); F = ARRAY param [5] #define EXPLODE_6(ARRAY,A,B,C,D,E,F) EXPLODE_6_SYS(ARRAY,A,B,C,D,E,F); TRACE_6("EXPLODE_6, " + QUOTE(ARRAY),A,B,C,D,E,F) -#define EXPLODE_6_PVT(ARRAY,A,B,C,D,E,F) \ - private [#A,#B,#C,#D,#E,#F]; \ - EXPLODE_6(ARRAY,A,B,C,D,E,F) +#define EXPLODE_6_PVT(ARRAY,A,B,C,D,E,F) ARRAY params [#A,#B,#C,#D,#E,#F]; TRACE_6("EXPLODE_6, " + QUOTE(ARRAY),A,B,C,D,E,F) -#define EXPLODE_7_SYS(ARRAY,A,B,C,D,E,F,G) EXPLODE_6_SYS(ARRAY,A,B,C,D,E,F); G = (ARRAY) select 6 +#define EXPLODE_7_SYS(ARRAY,A,B,C,D,E,F,G) EXPLODE_6_SYS(ARRAY,A,B,C,D,E,F); G = ARRAY param [6] #define EXPLODE_7(ARRAY,A,B,C,D,E,F,G) EXPLODE_7_SYS(ARRAY,A,B,C,D,E,F,G); TRACE_7("EXPLODE_7, " + QUOTE(ARRAY),A,B,C,D,E,F,G) -#define EXPLODE_7_PVT(ARRAY,A,B,C,D,E,F,G) \ - private [#A,#B,#C,#D,#E,#F,#G]; \ - EXPLODE_7(ARRAY,A,B,C,D,E,F,G) +#define EXPLODE_7_PVT(ARRAY,A,B,C,D,E,F,G) ARRAY params [#A,#B,#C,#D,#E,#F,#G]; TRACE_7("EXPLODE_7, " + QUOTE(ARRAY),A,B,C,D,E,F,G) -#define EXPLODE_8_SYS(ARRAY,A,B,C,D,E,F,G,H) EXPLODE_7_SYS(ARRAY,A,B,C,D,E,F,G); H = (ARRAY) select 7 +#define EXPLODE_8_SYS(ARRAY,A,B,C,D,E,F,G,H) EXPLODE_7_SYS(ARRAY,A,B,C,D,E,F,G); H = ARRAY param [7] #define EXPLODE_8(ARRAY,A,B,C,D,E,F,G,H) EXPLODE_8_SYS(ARRAY,A,B,C,D,E,F,G,H); TRACE_8("EXPLODE_8, " + QUOTE(ARRAY),A,B,C,D,E,F,G,H) -#define EXPLODE_8_PVT(ARRAY,A,B,C,D,E,F,G,H) \ - private [#A,#B,#C,#D,#E,#F,#G,#H]; \ - EXPLODE_8(ARRAY,A,B,C,D,E,F,G,H) +#define EXPLODE_8_PVT(ARRAY,A,B,C,D,E,F,G,H) ARRAY params [#A,#B,#C,#D,#E,#F,#G,#H]; TRACE_8("EXPLODE_8, " + QUOTE(ARRAY),A,B,C,D,E,F,G,H) -#define EXPLODE_9_SYS(ARRAY,A,B,C,D,E,F,G,H,I) EXPLODE_8_SYS(ARRAY,A,B,C,D,E,F,G,H); I = (ARRAY) select 8 +#define EXPLODE_9_SYS(ARRAY,A,B,C,D,E,F,G,H,I) EXPLODE_8_SYS(ARRAY,A,B,C,D,E,F,G,H); I = ARRAY param [8] #define EXPLODE_9(ARRAY,A,B,C,D,E,F,G,H,I) EXPLODE_9_SYS(ARRAY,A,B,C,D,E,F,G,H,I); TRACE_9("EXPLODE_9, " + QUOTE(ARRAY),A,B,C,D,E,F,G,H,I) -#define EXPLODE_9_PVT(ARRAY,A,B,C,D,E,F,G,H,I) \ - private [#A,#B,#C,#D,#E,#F,#G,#H,#I]; \ - EXPLODE_9(ARRAY,A,B,C,D,E,F,G,H,I) +#define EXPLODE_9_PVT(ARRAY,A,B,C,D,E,F,G,H,I) ARRAY params [#A,#B,#C,#D,#E,#F,#G,#H,#I]; TRACE_9("EXPLODE_9, " + QUOTE(ARRAY),A,B,C,D,E,F,G,H,I) + +/* ------------------------------------------- +Macro: xSTRING() + Get full string identifier from a stringtable owned by this component. + +Parameters: + VARIABLE - Partial name of global variable owned by this component [Any]. + +Example: + ADDON is CBA_Balls. + (begin example) + // Localized String (localize command must still be used with it) + LSTRING(Example); // STR_CBA_Balls_Example; + // Config String (note the $) + CSTRING(Example); // $STR_CBA_Balls_Example; + (end) + +Author: + Jonpas +------------------------------------------- */ +#ifndef STRING_MACROS_GUARD +#define STRING_MACROS_GUARD + #define LSTRING(var1) QUOTE(TRIPLES(STR,ADDON,var1)) + #define ELSTRING(var1,var2) QUOTE(TRIPLES(STR,DOUBLES(PREFIX,var1),var2)) + #define CSTRING(var1) QUOTE(TRIPLES($STR,ADDON,var1)) + #define ECSTRING(var1,var2) QUOTE(TRIPLES($STR,DOUBLES(PREFIX,var1),var2)) +#endif /* ------------------------------------------- @@ -938,37 +970,39 @@ Group: Managing Function Parameters /* ------------------------------------------- Macros: PARAMS_n() - Setting variables based on parameters passed to a function. + DEPRECATED - Use param/params commands added in Arma 3 1.48 - Each parameter is defines as private and set to the appropriate value from _this. + Setting variables based on parameters passed to a function. - PARAMS_1(A) - Get 1 parameter from the _this array (or _this if it's not an array). - PARAMS_2(A,B) - Get 2 parameters from the _this array. - PARAMS_3(A,B,C) - Get 3 parameters from the _this array. - PARAMS_4(A,B,C,D) - Get 4 parameters from the _this array. - PARAMS_5(A,B,C,D,E) - Get 5 parameters from the _this array. - PARAMS_6(A,B,C,D,E,F) - Get 6 parameters from the _this array. - PARAMS_7(A,B,C,D,E,F,G) - Get 7 parameters from the _this array. - PARAMS_8(A,B,C,D,E,F,G,H) - Get 8 parameters from the _this array. + Each parameter is defines as private and set to the appropriate value from _this. + + PARAMS_1(A) - Get 1 parameter from the _this array (or _this if it's not an array). + PARAMS_2(A,B) - Get 2 parameters from the _this array. + PARAMS_3(A,B,C) - Get 3 parameters from the _this array. + PARAMS_4(A,B,C,D) - Get 4 parameters from the _this array. + PARAMS_5(A,B,C,D,E) - Get 5 parameters from the _this array. + PARAMS_6(A,B,C,D,E,F) - Get 6 parameters from the _this array. + PARAMS_7(A,B,C,D,E,F,G) - Get 7 parameters from the _this array. + PARAMS_8(A,B,C,D,E,F,G,H) - Get 8 parameters from the _this array. Parameters: - A..H - Name of variable to read from _this [Identifier] + A..H - Name of variable to read from _this [Identifier] Example: - A function called like this: - (begin example) - [_name,_address,_telephone] call recordPersonalDetails; - (end) - expects 3 parameters and those variables could be initialised at the start of the function definition with: - (begin example) - recordPersonalDetails = { - PARAMS_3(_name,_address,_telephone); - // Rest of function follows... - }; - (end) + A function called like this: + (begin example) + [_name,_address,_telephone] call recordPersonalDetails; + (end) + expects 3 parameters and those variables could be initialised at the start of the function definition with: + (begin example) + recordPersonalDetails = { + PARAMS_3(_name,_address,_telephone); + // Rest of function follows... + }; + (end) Author: - Spooner + Spooner ------------------------------------------- */ #define PARAMS_1(A) EXPLODE_1_PVT(_this,A) #define PARAMS_2(A,B) EXPLODE_2_PVT(_this,A,B) @@ -982,59 +1016,62 @@ Author: /* ------------------------------------------- Macro: DEFAULT_PARAM() - Getting a default function parameter. This may be used together with to have a mix of required and - optional parameters. + DEPRECATED - Use param/params commands added in Arma 3 1.48 + + Getting a default function parameter. This may be used together with to have a mix of required and + optional parameters. Parameters: - INDEX - Index of parameter in _this [Integer, 0+] - NAME - Name of the variable to set [Identifier] - DEF_VALUE - Default value to use in case the array is too short or the value at INDEX is nil [Any] + INDEX - Index of parameter in _this [Integer, 0+] + NAME - Name of the variable to set [Identifier] + DEF_VALUE - Default value to use in case the array is too short or the value at INDEX is nil [Any] Example: - A function called with optional parameters: - (begin example) - [_name] call myFunction; - [_name, _numberOfLegs] call myFunction; - [_name, _numberOfLegs, _hasAHead] call myFunction; - (end) - 1 required parameter and 2 optional parameters. Those variables could be initialised at the start of the function - definition with: - (begin example) - myFunction = { - PARAMS_1(_name); - DEFAULT_PARAM(1,_numberOfLegs,2); - DEFAULT_PARAM(2,_hasAHead,true); - // Rest of function follows... - }; - (end) + A function called with optional parameters: + (begin example) + [_name] call myFunction; + [_name, _numberOfLegs] call myFunction; + [_name, _numberOfLegs, _hasAHead] call myFunction; + (end) + 1 required parameter and 2 optional parameters. Those variables could be initialised at the start of the function + definition with: + (begin example) + myFunction = { + PARAMS_1(_name); + DEFAULT_PARAM(1,_numberOfLegs,2); + DEFAULT_PARAM(2,_hasAHead,true); + // Rest of function follows... + }; + (end) Author: - Spooner + Spooner ------------------------------------------- */ #define DEFAULT_PARAM(INDEX,NAME,DEF_VALUE) \ - private #NAME; \ - NAME = [RETNIL(_this), INDEX, DEF_VALUE] call CBA_fnc_defaultParam; \ - TRACE_3("DEFAULT_PARAM",INDEX,NAME,DEF_VALUE) + private [#NAME,"_this"]; \ + ISNILS(_this,[]); \ + NAME = _this param [INDEX, DEF_VALUE]; \ + TRACE_3("DEFAULT_PARAM",INDEX,NAME,DEF_VALUE) /* ------------------------------------------- Macro: KEY_PARAM() - Get value from key in _this list, return default when key is not included in list. + Get value from key in _this list, return default when key is not included in list. Parameters: - KEY - Key name [String] - NAME - Name of the variable to set [Identifier] - DEF_VALUE - Default value to use in case key not found [ANY] + KEY - Key name [String] + NAME - Name of the variable to set [Identifier] + DEF_VALUE - Default value to use in case key not found [ANY] Example: Author: - Muzzleflash + Muzzleflash ------------------------------------------- */ #define KEY_PARAM(KEY,NAME,DEF_VALUE) \ - private #NAME; \ - NAME = [toLower KEY, toUpper KEY, DEF_VALUE, RETNIL(_this)] call CBA_fnc_getArg; \ - TRACE_3("KEY_PARAM",KEY,NAME,DEF_VALUE) + private #NAME; \ + NAME = [toLower KEY, toUpper KEY, DEF_VALUE, RETNIL(_this)] call CBA_fnc_getArg; \ + TRACE_3("KEY_PARAM",KEY,NAME,DEF_VALUE) /* ------------------------------------------- Group: Assertions @@ -1044,94 +1081,210 @@ Group: Assertions /* ------------------------------------------- Macro: ASSERT_TRUE() - Asserts that a CONDITION is true. When an assertion fails, an error is raised with the given MESSAGE. + Asserts that a CONDITION is true. When an assertion fails, an error is raised with the given MESSAGE. Parameters: - CONDITION - Condition to assert as true [Boolean] - MESSSAGE - Message to display if (A OPERATOR B) is false [String] + CONDITION - Condition to assert as true [Boolean] + MESSSAGE - Message to display if (A OPERATOR B) is false [String] Example: - (begin example) - ASSERT_TRUE(_frogIsDead,"The frog is alive"); - (end) + (begin example) + ASSERT_TRUE(_frogIsDead,"The frog is alive"); + (end) Author: - Spooner + Spooner ------------------------------------------- */ #define ASSERT_TRUE(CONDITION,MESSAGE) \ - if (not (CONDITION)) then \ - { \ - ASSERTION_ERROR('Assertion (CONDITION) failed!\n\n' + (MESSAGE)); \ - } + if (not (CONDITION)) then \ + { \ + ASSERTION_ERROR('Assertion (CONDITION) failed!\n\n' + (MESSAGE)); \ + } /* ------------------------------------------- Macro: ASSERT_FALSE() - Asserts that a CONDITION is false. When an assertion fails, an error is raised with the given MESSAGE. + Asserts that a CONDITION is false. When an assertion fails, an error is raised with the given MESSAGE. Parameters: - CONDITION - Condition to assert as false [Boolean] - MESSSAGE - Message to display if (A OPERATOR B) is true [String] + CONDITION - Condition to assert as false [Boolean] + MESSSAGE - Message to display if (A OPERATOR B) is true [String] Example: - (begin example) - ASSERT_FALSE(_frogIsDead,"The frog died"); - (end) + (begin example) + ASSERT_FALSE(_frogIsDead,"The frog died"); + (end) Author: - Spooner + Spooner ------------------------------------------- */ #define ASSERT_FALSE(CONDITION,MESSAGE) \ - if (CONDITION) then \ - { \ - ASSERTION_ERROR('Assertion (not (CONDITION)) failed!\n\n' + (MESSAGE)) \ - } + if (CONDITION) then \ + { \ + ASSERTION_ERROR('Assertion (not (CONDITION)) failed!\n\n' + (MESSAGE)) \ + } /* ------------------------------------------- Macro: ASSERT_OP() - Asserts that (A OPERATOR B) is true. When an assertion fails, an error is raised with the given MESSAGE. + Asserts that (A OPERATOR B) is true. When an assertion fails, an error is raised with the given MESSAGE. Parameters: - A - First value [Any] - OPERATOR - Binary operator to use [Operator] - B - Second value [Any] - MESSSAGE - Message to display if (A OPERATOR B) is false. [String] + A - First value [Any] + OPERATOR - Binary operator to use [Operator] + B - Second value [Any] + MESSSAGE - Message to display if (A OPERATOR B) is false. [String] Example: - (begin example) - ASSERT_OP(_fish,>,5,"Too few fish!"); - (end) + (begin example) + ASSERT_OP(_fish,>,5,"Too few fish!"); + (end) Author: - Spooner + Spooner ------------------------------------------- */ #define ASSERT_OP(A,OPERATOR,B,MESSAGE) \ - if (not ((A) OPERATOR (B))) then \ - { \ - ASSERTION_ERROR('Assertion (A OPERATOR B) failed!\n' + 'A: ' + (str (A)) + '\n' + 'B: ' + (str (B)) + "\n\n" + (MESSAGE)); \ - } + if (not ((A) OPERATOR (B))) then \ + { \ + ASSERTION_ERROR('Assertion (A OPERATOR B) failed!\n' + 'A: ' + (str (A)) + '\n' + 'B: ' + (str (B)) + "\n\n" + (MESSAGE)); \ + } /* ------------------------------------------- Macro: ASSERT_DEFINED() - Asserts that a VARIABLE is defined. When an assertion fails, an error is raised with the given MESSAGE.. + Asserts that a VARIABLE is defined. When an assertion fails, an error is raised with the given MESSAGE.. Parameters: - VARIABLE - Variable to test if defined [String or Function]. - MESSAGE - Message to display if variable is undefined [String]. + VARIABLE - Variable to test if defined [String or Function]. + MESSAGE - Message to display if variable is undefined [String]. Examples: - (begin example) - ASSERT_DEFINED("_anUndefinedVar","Too few fish!"); - ASSERT_DEFINED({ obj getVariable "anUndefinedVar" },"Too many fish!"); - (end) + (begin example) + ASSERT_DEFINED("_anUndefinedVar","Too few fish!"); + ASSERT_DEFINED({ obj getVariable "anUndefinedVar" },"Too many fish!"); + (end) Author: - Spooner + Spooner ------------------------------------------- */ #define ASSERT_DEFINED(VARIABLE,MESSAGE) \ - if (isNil VARIABLE) then \ - { \ - ASSERTION_ERROR('Assertion (VARIABLE is defined) failed!\n\n' + (MESSAGE)); \ - } + if (isNil VARIABLE) then \ + { \ + ASSERTION_ERROR('Assertion (VARIABLE is defined) failed!\n\n' + (MESSAGE)); \ + } + +/* ------------------------------------------- +Group: Unit tests +------------------------------------------- */ +#define TEST_SUCCESS(MESSAGE) MESSAGE_WITH_TITLE("Test OK",MESSAGE) +#define TEST_FAIL(MESSAGE) ERROR_WITH_TITLE("Test FAIL",MESSAGE) + +/* ------------------------------------------- +Macro: TEST_TRUE() + Tests that a CONDITION is true. + If the condition is not true, an error is raised with the given MESSAGE. + +Parameters: + CONDITION - Condition to assert as true [Boolean] + MESSSAGE - Message to display if (A OPERATOR B) is false [String] + +Example: + (begin example) + TEST_TRUE(_frogIsDead,"The frog is alive"); + (end) + +Author: + Killswitch +------------------------------------------- */ +#define TEST_TRUE(CONDITION, MESSAGE) \ + if (CONDITION) then \ + { \ + TEST_SUCCESS('(CONDITION)'); \ + } \ + else \ + { \ + TEST_FAIL('(CONDITION) ' + (MESSAGE)); \ + } + +/* ------------------------------------------- +Macro: TEST_FALSE() + Tests that a CONDITION is false. + If the condition is not false, an error is raised with the given MESSAGE. + +Parameters: + CONDITION - Condition to test as false [Boolean] + MESSSAGE - Message to display if (A OPERATOR B) is true [String] + +Example: + (begin example) + TEST_FALSE(_frogIsDead,"The frog died"); + (end) + +Author: + Killswitch +------------------------------------------- */ +#define TEST_FALSE(CONDITION, MESSAGE) \ + if (not (CONDITION)) then \ + { \ + TEST_SUCCESS('(not (CONDITION))'); \ + } \ + else \ + { \ + TEST_FAIL('(not (CONDITION)) ' + (MESSAGE)); \ + } + +/* ------------------------------------------- +Macro: TEST_OP() + Tests that (A OPERATOR B) is true. + If the test fails, an error is raised with the given MESSAGE. + +Parameters: + A - First value [Any] + OPERATOR - Binary operator to use [Operator] + B - Second value [Any] + MESSSAGE - Message to display if (A OPERATOR B) is false. [String] + +Example: + (begin example) + TEST_OP(_fish,>,5,"Too few fish!"); + (end) + +Author: + Killswitch +------------------------------------------- */ +#define TEST_OP(A,OPERATOR,B,MESSAGE) \ + if ((A) OPERATOR (B)) then \ + { \ + TEST_SUCCESS('(A OPERATOR B)') \ + } \ + else \ + { \ + TEST_FAIL('(A OPERATOR B)') \ + }; + +/* ------------------------------------------- +Macro: TEST_DEFINED() + Tests that a VARIABLE is defined. + +Parameters: + VARIABLE - Variable to test if defined [String or Function]. + MESSAGE - Message to display if variable is undefined [String]. + +Examples: + (begin example) + TEST_DEFINED("_anUndefinedVar","Too few fish!"); + TEST_DEFINED({ obj getVariable "anUndefinedVar" },"Too many fish!"); + (end) + +Author: + Killswitch +------------------------------------------- */ +#define TEST_DEFINED(VARIABLE,MESSAGE) \ + if (not isNil VARIABLE) then \ + { \ + TEST_SUCCESS('(' + VARIABLE + ' is defined)'); \ + } \ + else \ + { \ + TEST_FAIL('(' + VARIABLE + ' is not defined)' + (MESSAGE)); \ + } /* ------------------------------------------- Group: Managing Deprecation @@ -1139,117 +1292,117 @@ Group: Managing Deprecation /* ------------------------------------------- Macro: DEPRECATE_SYS() - Allow deprecation of a function that has been renamed. + Allow deprecation of a function that has been renamed. - Replaces an old OLD_FUNCTION (which will have PREFIX_ prepended) with a NEW_FUNCTION - (PREFIX_ prepended) with the intention that the old function will be disabled in the future. + Replaces an old OLD_FUNCTION (which will have PREFIX_ prepended) with a NEW_FUNCTION + (PREFIX_ prepended) with the intention that the old function will be disabled in the future. - Shows a warning in RPT each time the deprecated function is used, but runs the new function. + Shows a warning in RPT each time the deprecated function is used, but runs the new function. Parameters: - OLD_FUNCTION - Full name of old function [Identifier for function that does not exist any more] - NEW_FUNCTION - Full name of new function [Function] + OLD_FUNCTION - Full name of old function [Identifier for function that does not exist any more] + NEW_FUNCTION - Full name of new function [Function] Example: - (begin example) - // After renaming CBA_fnc_frog as CBA_fnc_fish - DEPRECATE_SYS(CBA_fnc_frog,CBA_fnc_fish); - (end) + (begin example) + // After renaming CBA_fnc_frog as CBA_fnc_fish + DEPRECATE_SYS(CBA_fnc_frog,CBA_fnc_fish); + (end) Author: - Sickboy + Sickboy ------------------------------------------- */ #define DEPRECATE_SYS(OLD_FUNCTION,NEW_FUNCTION) \ - OLD_FUNCTION = { \ - WARNING('Deprecated function used: OLD_FUNCTION (new: NEW_FUNCTION) in ADDON'); \ - if (isNil "_this") then { call NEW_FUNCTION } else { _this call NEW_FUNCTION }; \ - } + OLD_FUNCTION = { \ + WARNING('Deprecated function used: OLD_FUNCTION (new: NEW_FUNCTION) in ADDON'); \ + if (isNil "_this") then { call NEW_FUNCTION } else { _this call NEW_FUNCTION }; \ + } /* ------------------------------------------- Macro: DEPRECATE() - Allow deprecation of a function, in the current component, that has been renamed. + Allow deprecation of a function, in the current component, that has been renamed. - Replaces an OLD_FUNCTION (which will have PREFIX_ prepended) with a NEW_FUNCTION - (PREFIX_ prepended) with the intention that the old function will be disabled in the future. + Replaces an OLD_FUNCTION (which will have PREFIX_ prepended) with a NEW_FUNCTION + (PREFIX_ prepended) with the intention that the old function will be disabled in the future. - Shows a warning in RPT each time the deprecated function is used, but runs the new function. + Shows a warning in RPT each time the deprecated function is used, but runs the new function. Parameters: - OLD_FUNCTION - Name of old function, assuming PREFIX [Identifier for function that does not exist any more] - NEW_FUNCTION - Name of new function, assuming PREFIX [Function] + OLD_FUNCTION - Name of old function, assuming PREFIX [Identifier for function that does not exist any more] + NEW_FUNCTION - Name of new function, assuming PREFIX [Function] Example: - (begin example) - // After renaming CBA_fnc_frog as CBA_fnc_fish - DEPRECATE(fnc_frog,fnc_fish); - (end) + (begin example) + // After renaming CBA_fnc_frog as CBA_fnc_fish + DEPRECATE(fnc_frog,fnc_fish); + (end) Author: - Sickboy + Sickboy ------------------------------------------- */ #define DEPRECATE(OLD_FUNCTION,NEW_FUNCTION) \ - DEPRECATE_SYS(DOUBLES(PREFIX,OLD_FUNCTION),DOUBLES(PREFIX,NEW_FUNCTION)) + DEPRECATE_SYS(DOUBLES(PREFIX,OLD_FUNCTION),DOUBLES(PREFIX,NEW_FUNCTION)) /* ------------------------------------------- Macro: OBSOLETE_SYS() - Replace a function that has become obsolete. + Replace a function that has become obsolete. - Replace an obsolete OLD_FUNCTION with a simple COMMAND_FUNCTION, with the intention that anyone - using the function should replace it with the simple command, since the function will be disabled in the future. + Replace an obsolete OLD_FUNCTION with a simple COMMAND_FUNCTION, with the intention that anyone + using the function should replace it with the simple command, since the function will be disabled in the future. - Shows a warning in RPT each time the deprecated function is used, and runs the command function. + Shows a warning in RPT each time the deprecated function is used, and runs the command function. Parameters: - OLD_FUNCTION - Full name of old function [Identifier for function that does not exist any more] - COMMAND_CODE - Code to replace the old function [Function] + OLD_FUNCTION - Full name of old function [Identifier for function that does not exist any more] + COMMAND_CODE - Code to replace the old function [Function] Example: - (begin example) - // In Arma2, currentWeapon command made the CBA_fMyWeapon function obsolete: - OBSOLETE_SYS(CBA_fMyWeapon,{ currentWeapon player }); - (end) + (begin example) + // In Arma2, currentWeapon command made the CBA_fMyWeapon function obsolete: + OBSOLETE_SYS(CBA_fMyWeapon,{ currentWeapon player }); + (end) Author: - Spooner + Spooner ------------------------------------------- */ #define OBSOLETE_SYS(OLD_FUNCTION,COMMAND_CODE) \ - OLD_FUNCTION = { \ - WARNING('Obsolete function used: (use: OLD_FUNCTION) in ADDON'); \ - if (isNil "_this") then { call COMMAND_CODE } else { _this call COMMAND_CODE }; \ - } + OLD_FUNCTION = { \ + WARNING('Obsolete function used: (use: OLD_FUNCTION) in ADDON'); \ + if (isNil "_this") then { call COMMAND_CODE } else { _this call COMMAND_CODE }; \ + } /* ------------------------------------------- Macro: OBSOLETE() - Replace a function, in the current component, that has become obsolete. + Replace a function, in the current component, that has become obsolete. - Replace an obsolete OLD_FUNCTION (which will have PREFIX_ prepended) with a simple - COMMAND_CODE, with the intention that anyone using the function should replace it with the simple - command. + Replace an obsolete OLD_FUNCTION (which will have PREFIX_ prepended) with a simple + COMMAND_CODE, with the intention that anyone using the function should replace it with the simple + command. - Shows a warning in RPT each time the deprecated function is used. + Shows a warning in RPT each time the deprecated function is used. Parameters: - OLD_FUNCTION - Name of old function, assuming PREFIX [Identifier for function that does not exist any more] - COMMAND_CODE - Code to replace the old function [Function] + OLD_FUNCTION - Name of old function, assuming PREFIX [Identifier for function that does not exist any more] + COMMAND_CODE - Code to replace the old function [Function] Example: - (begin example) - // In Arma2, currentWeapon command made the CBA_fMyWeapon function obsolete: - OBSOLETE(fMyWeapon,{ currentWeapon player }); - (end) + (begin example) + // In Arma2, currentWeapon command made the CBA_fMyWeapon function obsolete: + OBSOLETE(fMyWeapon,{ currentWeapon player }); + (end) Author: - Spooner + Spooner ------------------------------------------- */ #define OBSOLETE(OLD_FUNCTION,COMMAND_CODE) \ - OBSOLETE_SYS(DOUBLES(PREFIX,OLD_FUNCTION),COMMAND_CODE) + OBSOLETE_SYS(DOUBLES(PREFIX,OLD_FUNCTION),COMMAND_CODE) #define BWC_CONFIG(NAME) class NAME { \ - units[] = {}; \ - weapons[] = {}; \ - requiredVersion = REQUIRED_VERSION; \ - requiredAddons[] = {}; \ - version = VERSION; \ + units[] = {}; \ + weapons[] = {}; \ + requiredVersion = REQUIRED_VERSION; \ + requiredAddons[] = {}; \ + version = VERSION; \ } // XEH Specific diff --git a/tools/cba/addons/xeh/init_pre.sqf b/tools/cba/addons/xeh/init_pre.sqf index 8e6a31f8c8..44b4657aca 100644 --- a/tools/cba/addons/xeh/init_pre.sqf +++ b/tools/cba/addons/xeh/init_pre.sqf @@ -23,10 +23,10 @@ uiNamespace setVariable ["CBA_isCached", CBA_isCached]; if (isNil "SLX_XEH_RECOMPILE") then { SLX_XEH_RECOMPILE = CACHE_DIS(xeh) }; if (!isMultiplayer || {isDedicated} || {CBA_isCached == -1}) then { - uiNamespace setVariable ["SLX_XEH_CACHE_KEYS", []]; - uiNamespace setVariable ["SLX_XEH_CACHE_KEYS2", []]; - uiNamespace setVariable ["SLX_XEH_CACHE_KEYS3", []]; - uiNamespace setVariable ["CBA_CACHE_KEYS", []]; + uiNamespace setVariable ["SLX_XEH_CACHE_KEYS", []]; + uiNamespace setVariable ["SLX_XEH_CACHE_KEYS2", []]; + uiNamespace setVariable ["SLX_XEH_CACHE_KEYS3", []]; + uiNamespace setVariable ["CBA_CACHE_KEYS", []]; }; SLX_XEH_CACHE_KEYS = uiNamespace getVariable "SLX_XEH_CACHE_KEYS"; @@ -46,24 +46,24 @@ SLX_XEH_DisableLogging = isClass(configFile/"CfgPatches"/"Disable_XEH_Logging"); /* CBA_fnc_defaultParam = { - PARAMS_3(_params,_index,_defaultValue); - - private "_value"; - - if (!isNil "_defaultValue") then { - _value = _defaultValue; - }; - - if (!isNil "_params" && {(typeName _params) == "ARRAY"} && {count _params > _index} && {!isNil { _params select _index }}) then { - _value = _params select _index; - }; - - // Return. - if (isNil "_value") then { - nil; - } else { - _value; - }; + params ["_params","_index","_defaultValue"]; + + private "_value"; + + if (!isNil "_defaultValue") then { + _value = _defaultValue; + }; + + if (!isNil "_params" && {(typeName _params) == "ARRAY"} && {count _params > _index} && {!isNil { _params select _index }}) then { + _value = _params select _index; + }; + + // Return. + if (isNil "_value") then { + nil; + } else { + _value; + }; }; */ @@ -74,10 +74,10 @@ if (time > 0) then { XEH_LOG("XEH WARNING: Time > 0; This probably means there a _cfgRespawn = (missionConfigFile/"respawn"); _respawn = false; if ( isNumber(_cfgRespawn) ) then { - _respawn = !(getNumber(_cfgRespawn) in [0, 1, 4, 5]); + _respawn = !(getNumber(_cfgRespawn) in [0, 1, 4, 5]); }; if ( isText(_cfgRespawn) ) then { - _respawn = !(getText(_cfgRespawn) in ["none", "bird", "group", "side"]); + _respawn = !(getText(_cfgRespawn) in ["none", "bird", "group", "side"]); }; SLX_XEH_objects = []; // Temporary array, to track InitPosts at mission initialization @@ -90,81 +90,81 @@ _level = 0; // pre v1.60 // TODO: Improve v1.60 detection // TODO: Temporary disabled due to #28652 //if ((isNumber (configFile >> "CfgDifficulties" >> "recruit" >> "recoilCoef")) && (isNumber (configFile >> "CfgVehicles" >> "Car" >> "turnCoef"))) then { - //_level = 1; // v1.60 + //_level = 1; // v1.60 //}; FUNC(determineProductVersion) = { - private "_pv"; - _pv = call {productVersion}; + private "_pv"; + _pv = call {productVersion}; - // A2 (and OA pre 1.61beta, and TOH pre 1.05?) does not support productVersion so we deal with it manually - if (isNil "_pv") then { - _pv = if (isClass(configFile >> "CfgPatches" >> "A3_Map_Stratis")) then { - // A3 Backup - ["Arma 3 Alpha","Arma3Alpha", -1, -1]; //,5,102571] + // A2 (and OA pre 1.61beta, and TOH pre 1.05?) does not support productVersion so we deal with it manually + if (isNil "_pv") then { + _pv = if (isClass(configFile >> "CfgPatches" >> "A3_Map_Stratis")) then { + // A3 Backup + ["Arma 3 Alpha","Arma3Alpha", -1, -1]; //,5,102571] - } else { - if (isClass(configFile >> "CfgPatches" >> "United_States_H")) then { - // TOH Backup - ["TakeOn H", "TakeOnH", -1, -1]; - } else { - if (isClass(configFile >> "CfgPatches" >> "Takistan")) then { - // OA Backup - ["ArmA 2OA", "ArmA2OA", -1, -1]; - } else { - // A2 Backup - ["ArmA 2", "ArmA2", -1, -1]; - }; - }; - }; - }; + } else { + if (isClass(configFile >> "CfgPatches" >> "United_States_H")) then { + // TOH Backup + ["TakeOn H", "TakeOnH", -1, -1]; + } else { + if (isClass(configFile >> "CfgPatches" >> "Takistan")) then { + // OA Backup + ["ArmA 2OA", "ArmA2OA", -1, -1]; + } else { + // A2 Backup + ["ArmA 2", "ArmA2", -1, -1]; + }; + }; + }; + }; - _pv; + _pv; }; FUNC(determineGame) = { - // 0 = A2 - // 1 = OA - // 2 = TOH - // 3 = A3 :P - private "_pv"; - _pv = call FUNC(determineProductVersion); + // 0 = A2 + // 1 = OA + // 2 = TOH + // 3 = A3 :P + private "_pv"; + _pv = call FUNC(determineProductVersion); - switch (_pv select 1) do { - case "ArmA2": {0}; - case "ArmA2OA": {1}; - case "TakeOnH": {2}; - case "Arma3Alpha": {3}; - case "Arma3": {3}; - default {0}; - }; + switch (_pv select 1) do { + case "ArmA2": {0}; + case "ArmA2OA": {1}; + case "TakeOnH": {2}; + case "Arma3Alpha": {3}; + case "Arma3": {3}; + default {0}; + }; }; // System array with machine / mission / session information SLX_XEH_MACHINE = [ - !isDedicated, // 0 - isClient (and thus has player) - false, // 1 - isJip - !isServer, // 2 - isDedicatedClient (and thus not a Client-Server) - isServer, // 3 - isServer - isDedicated, // 4 - isDedicatedServer (and thus not a Client-Server) - false, // 5 - Player Check Finished - !isMultiplayer, // 6 - SP? - false, // 7 - StartInit Passed - false, // 8 - Postinit Passed - isMultiplayer && {_respawn}, // 9 - Multiplayer && respawn? - if (isDedicated) then { 0 } else { if (isServer) then { 1 } else { 2 } }, // 10 - Machine type (only 3 possible configurations) - _id, // 11 - SESSION_ID - _level, // 12 - LEVEL - Used for version determination - false, // 13 - TIMEOUT - PostInit timedOut - call FUNC(determineGame), // 14 - Game - call FUNC(determineProductVersion) // 15 - Product+Version + !isDedicated, // 0 - isClient (and thus has player) + false, // 1 - isJip + !isServer, // 2 - isDedicatedClient (and thus not a Client-Server) + isServer, // 3 - isServer + isDedicated, // 4 - isDedicatedServer (and thus not a Client-Server) + false, // 5 - Player Check Finished + !isMultiplayer, // 6 - SP? + false, // 7 - StartInit Passed + false, // 8 - Postinit Passed + isMultiplayer && {_respawn}, // 9 - Multiplayer && respawn? + if (isDedicated) then { 0 } else { if (isServer) then { 1 } else { 2 } }, // 10 - Machine type (only 3 possible configurations) + _id, // 11 - SESSION_ID + _level, // 12 - LEVEL - Used for version determination + false, // 13 - TIMEOUT - PostInit timedOut + call FUNC(determineGame), // 14 - Game + call FUNC(determineProductVersion) // 15 - Product+Version ]; SLX_XEH_DUMMY = switch (SLX_XEH_MACHINE select 14) do { - case 2: {"Helipad_Invisible_H" }; - case 3: {"Land_HelipadEmpty_F" }; - default { "HeliHEmpty" }; + case 2: {"Helipad_Invisible_H" }; + case 3: {"Land_HelipadEmpty_F" }; + default { "HeliHEmpty" }; }; SLX_XEH_STR = ""; // Empty string @@ -259,24 +259,24 @@ call COMPILE_FILE(init_eh); // All XEH Event functions GVAR(init_obj) = SLX_XEH_DUMMY createVehicleLocal [0, 0, 0]; GVAR(init_obj) addEventHandler ["killed", { - #ifdef DEBUG_MODE_FULL - XEH_LOG("XEH: VehicleCrewInit: "+str(count vehicles)); - #endif + #ifdef DEBUG_MODE_FULL + XEH_LOG("XEH: VehicleCrewInit: "+str(count vehicles)); + #endif - { - _sim = getText(configFile/"CfgVehicles"/(typeOf _x)/"simulation"); - _crew = crew _x; - /* - * If it's a vehicle then start event handlers for the crew. - * (Vehicles have crew and are neither humanoids nor game logics) - */ - if (count _crew > 0 && {{ _sim == _x }count["soldier", "invisible"] == 0}) then { - { if !(_x in SLX_XEH_INIT_MEN) then { [_x] call SLX_XEH_EH_Init } } forEach _crew; - }; - } forEach vehicles; - SLX_XEH_INIT_MEN = nil; - - deleteVehicle GVAR(init_obj);GVAR(init_obj) = nil + { + _sim = getText(configFile/"CfgVehicles"/(typeOf _x)/"simulation"); + _crew = crew _x; + /* + * If it's a vehicle then start event handlers for the crew. + * (Vehicles have crew and are neither humanoids nor game logics) + */ + if (count _crew > 0 && {{ _sim == _x }count["soldier", "invisible"] == 0}) then { + { if !(_x in SLX_XEH_INIT_MEN) then { [_x] call SLX_XEH_EH_Init } } forEach _crew; + }; + } forEach vehicles; + SLX_XEH_INIT_MEN = nil; + + deleteVehicle GVAR(init_obj);GVAR(init_obj) = nil }]; GVAR(init_obj) setDamage 1; // Schedule to run itsy bitsy later @@ -284,73 +284,75 @@ GVAR(init_obj) setDamage 1; // Schedule to run itsy bitsy later // Prepare postInit GVAR(init_obj2) = SLX_XEH_DUMMY createVehicleLocal [0, 0, 0]; GVAR(init_obj2) addEventHandler ["killed", { - call COMPILE_FILE(init_post); - deleteVehicle GVAR(init_obj2);GVAR(init_obj2) = nil; + call COMPILE_FILE(init_post); + deleteVehicle GVAR(init_obj2);GVAR(init_obj2) = nil; }]; // Schedule PostInit SLX_XEH_STR spawn { - // Warn if PostInit takes longer than 10 tickTime seconds - SLX_XEH_STR spawn { - private["_time2Wait"]; - _time2Wait = diag_ticktime + 10; - waituntil {diag_ticktime > _time2Wait}; - if !(SLX_XEH_MACHINE select 8) then { - XEH_LOG("WARNING: PostInit did not finish in a timely fashion"); - waitUntil {time > 0}; - // Consider there will be no player if neither PostInit-Ready, nor PlayerCheck-Ready - if !(SLX_XEH_MACHINE select 8 || {SLX_XEH_MACHINE select 5}) then { SLX_XEH_MACHINE set [13, true]; }; - }; - }; + // Warn if PostInit takes longer than 10 tickTime seconds + SLX_XEH_STR spawn { + private["_time2Wait"]; + _time2Wait = diag_ticktime + 10; + waituntil {diag_ticktime > _time2Wait}; + if !(SLX_XEH_MACHINE select 8) then { + XEH_LOG("WARNING: PostInit did not finish in a timely fashion"); + waitUntil {time > 0}; + // Consider there will be no player if neither PostInit-Ready, nor PlayerCheck-Ready + if !(SLX_XEH_MACHINE select 8 || {SLX_XEH_MACHINE select 5}) then { SLX_XEH_MACHINE set [13, true]; }; + }; + }; - // On Server + Non JIP Client, we are now after all objects have inited - // and at the briefing, still time == 0 - if (isNull player) then { - #ifdef DEBUG_MODE_FULL - "NULL PLAYER" call SLX_XEH_LOG; - #endif - if !((SLX_XEH_MACHINE select 4) || {(SLX_XEH_MACHINE select 6)}) then { // only if MultiPlayer and not dedicated - #ifdef DEBUG_MODE_FULL - "JIP" call SLX_XEH_LOG; - #endif - - SLX_XEH_MACHINE set [1, true]; // set JIP - // TEST for weird jip-is-server-issue :S - if (!(SLX_XEH_MACHINE select 2) || {SLX_XEH_MACHINE select 3} || {SLX_XEH_MACHINE select 4}) then { - str(["WARNING: JIP Client, yet wrong detection", SLX_XEH_MACHINE]) call SLX_XEH_LOG; - SLX_XEH_MACHINE set [2, true]; // set Dedicated client - SLX_XEH_MACHINE set [3, false]; // set server - SLX_XEH_MACHINE set [4, false]; // set dedicatedserver - }; - waitUntil { !(isNull player) || {SLX_XEH_MACHINE select 13} }; - if (SLX_XEH_MACHINE select 13) then { XEH_LOG("WARNING: TimedOut waiting for player object to be ready. Continueing PostInit without Player ready") }; - }; - }; - - if !(isNull player) then { - if (isNull (group player) && {player isKindOf "CAManBase"}) then { - // DEBUG TEST: Crashing due to JIP, or when going from briefing - // into game - #ifdef DEBUG_MODE_FULL - "NULLGROUP" call SLX_XEH_LOG; - #endif - waitUntil { !(isNull (group player)) }; - }; - waitUntil { local player }; - }; + // On Server + Non JIP Client, we are now after all objects have inited + // and at the briefing, still time == 0 + if (isNull player) then { + #ifdef DEBUG_MODE_FULL + "NULL PLAYER" call SLX_XEH_LOG; + #endif + if !((SLX_XEH_MACHINE select 4) || {(SLX_XEH_MACHINE select 6)}) then { // only if MultiPlayer and not dedicated + #ifdef DEBUG_MODE_FULL + "JIP" call SLX_XEH_LOG; + #endif - GVAR(init_obj2) setDamage 1; // Schedule to run itsy bitsy later + // TEST for weird jip-is-server-issue :S + if (!(SLX_XEH_MACHINE select 2) || {SLX_XEH_MACHINE select 3} || {SLX_XEH_MACHINE select 4}) then { + str(["WARNING: JIP Client, yet wrong detection", SLX_XEH_MACHINE]) call SLX_XEH_LOG; + SLX_XEH_MACHINE set [2, true]; // set Dedicated client + SLX_XEH_MACHINE set [3, false]; // set server + SLX_XEH_MACHINE set [4, false]; // set dedicatedserver + }; + waitUntil { !(isNull player) || {SLX_XEH_MACHINE select 13} }; + if (SLX_XEH_MACHINE select 13) then { XEH_LOG("WARNING: TimedOut waiting for player object to be ready. Continueing PostInit without Player ready") }; + }; + }; - SLX_XEH_MACHINE set [5, true]; // set player check = complete + if !(isNull player) then { + if (isNull (group player) && {player isKindOf "CAManBase"}) then { + // DEBUG TEST: Crashing due to JIP, or when going from briefing + // into game + #ifdef DEBUG_MODE_FULL + "NULLGROUP" call SLX_XEH_LOG; + #endif + waitUntil { !(isNull (group player)) }; + }; + waitUntil { local player }; + }; + + // set JIP + SLX_XEH_MACHINE set [1, !isDedicated && getClientState in ["BRIEFING SHOWN","BRIEFING READ","GAME FINISHED","DEBRIEFING READ"]]; + + GVAR(init_obj2) setDamage 1; // Schedule to run itsy bitsy later + + SLX_XEH_MACHINE set [5, true]; // set player check = complete }; // Load and call any "pre-init", run-once event handlers /* - Compile code strings in the Extended_PreInit_EventHandlers class and call - them. This is done once per mission and before any extended init event - handler code is run. An addon maker can put run-once initialisation code - in such a pre-init "EH" rather than in a normal XEH init EH which might be - called several times. + Compile code strings in the Extended_PreInit_EventHandlers class and call + them. This is done once per mission and before any extended init event + handler code is run. An addon maker can put run-once initialisation code + in such a pre-init "EH" rather than in a normal XEH init EH which might be + called several times. */ { (_x/SLX_XEH_STR_PreInit) call FUNC(init_once) } forEach SLX_XEH_CONFIG_FILES; diff --git a/tools/cba/addons/xeh/script_xeh.hpp b/tools/cba/addons/xeh/script_xeh.hpp index ec7a1d8b88..ba55dbc917 100644 --- a/tools/cba/addons/xeh/script_xeh.hpp +++ b/tools/cba/addons/xeh/script_xeh.hpp @@ -1,8 +1,14 @@ +/* + Header: script_xeh.hpp + + Description: + Used internally. +*/ ///////////////////////////////////////////////////////////////////////////////// // MACRO: EXTENDED_EVENTHANDLERS -// XEH uses all existing event handlers +// Add all XEH event handlers ///////////////////////////////////////////////////////////////////////////////// -#define EXTENDED_EVENTHANDLERS init = QUOTE(if(isNil'SLX_XEH_MACHINE')then{call compile preProcessFileLineNumbers '\x\cba\addons\xeh\init_pre.sqf'};_this call SLX_XEH_EH_Init); \ +#define EXTENDED_EVENTHANDLERS init = "_this call SLX_XEH_EH_Init"; \ fired = "_this call SLX_XEH_EH_Fired"; \ animChanged = "_this call SLX_XEH_EH_AnimChanged"; \ animDone = "_this call SLX_XEH_EH_AnimDone"; \ @@ -45,22 +51,25 @@ weaponDisAssembled = "_this call SLX_XEH_EH_WeaponDisassembled"; -///////////////////////////////////////////////////////////////////////////////// -// MACRO: DELETE_EVENTHANDLERS -// -// Example: -// -// class DefaultEventhandlers; -// class Car_F; -// class MRAP_01_base_F: Car_F { -// class EventHandlers; -// }; -// class B_MRAP_01_F: MRAP_01_base_F { -// class Eventhandlers: EventHandlers { -// DELETE_EVENTHANDLERS -// }; -// }; -///////////////////////////////////////////////////////////////////////////////// +/* + MACRO: DELETE_EVENTHANDLERS + + Removes all event handlers. + + Example: + (begin example) + class DefaultEventhandlers; + class Car_F; + class MRAP_01_base_F: Car_F { + class EventHandlers; + }; + class B_MRAP_01_F: MRAP_01_base_F { + class Eventhandlers: EventHandlers { + DELETE_EVENTHANDLERS + }; + }; + (end example) +*/ #define DELETE_EVENTHANDLERS delete init; \ delete fired; \ diff --git a/tools/deploy.py b/tools/deploy.py index b9fade83a0..ff2d499d9f 100755 --- a/tools/deploy.py +++ b/tools/deploy.py @@ -38,38 +38,6 @@ def update_translations(token): issue.edit(body=TRANSLATIONBODY.format(diag)) -def deploy_documentation(token): - devnull = open(os.devnull, "w") - url = "https://{}@github.com/{}".format(token, REPOPATH) - - sp.check_call(["git", "clone", url, "out", "--depth", "10", "--branch", "gh-pages"], stdout=devnull, stderr=devnull) - os.chdir("out") - - sp.check_call(["git", "config", "user.name", USERNAME]) - sp.check_call(["git", "config", "user.email", USEREMAIL]) - - for root, dirs, files in os.walk("../documentation", topdown=False): - target = root.replace("../documentation", "wiki") - if root == "../documentation": - continue - for name in files: - print("{} => {}".format(os.path.join(root, name), os.path.join(target, name))) - shutil.copyfile(os.path.join(root, name), os.path.join(target, name)) - - sp.check_call(["git", "add", "--all", "."]) - - filenum = sp.check_output(["git", "status", "--porcelain"]) - filenum = len(str(filenum, "utf-8").split("\n")) - 1 - if filenum > 0: - sp.check_call(["git", "commit", "-m", "Automatic gh-pages deployment"]) - print("Pushing changes ...") - sp.check_call(["git", "push", "origin", "gh-pages"], stdout=devnull, stderr=devnull) - else: - print("No changes.") - - os.chdir("..") - - def main(): print("Obtaining token ...") try: @@ -91,16 +59,6 @@ def main(): else: print("done.") - print("\nDeploying documentation ...") - try: - deploy_documentation(token) - except: - print("Failed to deploy documentation.") - print(traceback.format_exc()) - return 1 - else: - print("done.") - return 0 diff --git a/tools/make.py b/tools/make.py index 8eb8950c7f..f8a4c80886 100644 --- a/tools/make.py +++ b/tools/make.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!/usr/bin/env python3 # vim: set fileencoding=utf-8 : # make.py @@ -30,7 +30,7 @@ ############################################################################### -__version__ = "0.4" +__version__ = "0.7" import sys @@ -49,6 +49,7 @@ import configparser import json import traceback import time +import timeit import re from tempfile import mkstemp @@ -58,7 +59,7 @@ if sys.platform == "win32": ######## GLOBALS ######### project = "@ace" -ACE_VERSION = "3.0.0" +project_version = "3.0.0" arma3tools_path = "" work_drive = "" module_root = "" @@ -116,6 +117,19 @@ def get_directory_hash(directory): #print_yellow("Hash Value for {} is {}".format(directory,retVal)) return directory_hash.hexdigest() +def Fract_Sec(s): + temp = float() + temp = float(s) / (60*60*24) + d = int(temp) + temp = (temp - d) * 24 + h = int(temp) + temp = (temp - h) * 60 + m = int(temp) + temp = (temp - m) * 60 + sec = temp + return d,h,m,sec + #endef Fract_Sec + # Copyright (c) André Burgaud # http://www.burgaud.com/bring-colors-to-the-windows-console-with-python/ if sys.platform == "win32": @@ -372,6 +386,7 @@ def copy_optionals_for_building(mod,pbos): if (os.path.isfile(sig_path)): #print("Moving {} for processing.".format(sig_path)) shutil.move(sig_path, os.path.join(release_dir, project, "addons", sigFile_name)) + except: print_error("Error in moving") raise @@ -435,6 +450,9 @@ def cleanup_optionals(mod): continue shutil.rmtree(destination) + except FileNotFoundError: + print_yellow("{} file not found".format(file_name)) + except: print_error("Cleaning Optionals Failed") raise @@ -541,9 +559,9 @@ def addon_restore(modulePath): return True -def get_ace_version(): - global ACE_VERSION - versionStamp = ACE_VERSION +def get_project_version(): + global project_version + versionStamp = project_version #do the magic based on https://github.com/acemod/ACE3/issues/806#issuecomment-95639048 try: @@ -568,16 +586,16 @@ def get_ace_version(): raise FileNotFoundError("File Not Found: {}".format(scriptModPath)) except Exception as e: - print_error("Get_Ace_Version error: {}".format(e)) + print_error("Get_project_version error: {}".format(e)) print_error("Check the integrity of the file: {}".format(scriptModPath)) - versionStamp = ACE_VERSION + versionStamp = project_version print_error("Resetting to the default version stamp: {}".format(versionStamp)) input("Press Enter to continue...") print("Resuming build...") print_yellow("{} VERSION set to {}".format(project.lstrip("@").upper(),versionStamp)) - ACE_VERSION = versionStamp - return ACE_VERSION + project_version = versionStamp + return project_version def replace_file(filePath, oldSubstring, newSubstring): @@ -595,7 +613,7 @@ def replace_file(filePath, oldSubstring, newSubstring): def set_version_in_files(): - newVersion = ACE_VERSION # MAJOR.MINOR.PATCH.BUILD + newVersion = project_version # MAJOR.MINOR.PATCH.BUILD newVersionShort = newVersion[:-2] # MAJOR.MINOR.PATCH # Regex patterns @@ -677,7 +695,7 @@ def restore_version_files(): def get_private_keyname(commitID,module="main"): global pbo_name_prefix - aceVersion = get_ace_version() + aceVersion = get_project_version() keyName = str("{prefix}{version}-{commit_id}".format(prefix=pbo_name_prefix,version=aceVersion,commit_id=commitID)) return keyName @@ -754,7 +772,7 @@ def main(argv): """Build an Arma addon suite in a directory from rules in a make.cfg file.""" print_blue("\nmake.py for Arma, modified for Advanced Combat Environment v{}".format(__version__)) - global ACE_VERSION + global project_version global arma3tools_path global work_drive global module_root @@ -840,7 +858,7 @@ See the make.cfg file for additional build options. argv.remove("release") else: make_release_zip = False - release_version = ACE_VERSION + release_version = project_version if "target" in argv: make_target = argv[argv.index("target") + 1] @@ -863,7 +881,7 @@ See the make.cfg file for additional build options. check_external = True else: check_external = False - + if "version" in argv: argv.remove("version") version_update = True @@ -897,7 +915,7 @@ See the make.cfg file for additional build options. # Project prefix (folder path) prefix = cfg.get(make_target, "prefix", fallback="") - + # Release archive prefix zipPrefix = cfg.get(make_target, "zipPrefix", fallback=project.lstrip("@").lower()) @@ -1418,5 +1436,8 @@ See the make.cfg file for additional build options. if __name__ == "__main__": + start_time = timeit.default_timer() main(sys.argv) + d,h,m,s = Fract_Sec(timeit.default_timer() - start_time) + print("\nTotal Program time elapsed: {0:2}h {1:2}m {2:4.5f}s".format(h,m,s)) input("Press Enter to continue...") diff --git a/tools/search_undefinedFunctions.py b/tools/search_undefinedFunctions.py new file mode 100644 index 0000000000..1c281fa717 --- /dev/null +++ b/tools/search_undefinedFunctions.py @@ -0,0 +1,135 @@ +#!/usr/bin/env python3 + +import fnmatch +import os +import re +import ntpath +import sys +import argparse + +import ctypes + +#from http://stackoverflow.com/a/3429034 +#Get required functions, strcpy.. +strcpy = ctypes.cdll.msvcrt.strcpy +ocb = ctypes.windll.user32.OpenClipboard #Basic Clipboard functions +ecb = ctypes.windll.user32.EmptyClipboard +gcd = ctypes.windll.user32.GetClipboardData +scd = ctypes.windll.user32.SetClipboardData +ccb = ctypes.windll.user32.CloseClipboard +ga = ctypes.windll.kernel32.GlobalAlloc # Global Memory allocation +gl = ctypes.windll.kernel32.GlobalLock # Global Memory Locking +gul = ctypes.windll.kernel32.GlobalUnlock +GMEM_DDESHARE = 0x2000 + +def Get( ): + ocb(None) # Open Clip, Default task + pcontents = gcd(1) # 1 means CF_TEXT.. too lazy to get the token thingy ... + data = ctypes.c_char_p(pcontents).value + #gul(pcontents) ? + ccb() + return data + +def Paste( data ): + ocb(None) # Open Clip, Default task + ecb() + hCd = ga( GMEM_DDESHARE, len( bytes(data,"ascii") )+1 ) + pchData = gl(hCd) + strcpy(ctypes.c_char_p(pchData),bytes(data,"ascii")) + gul(hCd) + scd(1,hCd) + ccb() + + +def getFunctions(filepath): + selfmodule = (re.search('addons[\W]*([_a-zA-Z0-9]*)', filepath)).group(1) + # print("Checking {0} from {1}".format(filepath,selfmodule)) + + with open(filepath, 'r') as file: + content = file.read() + + srch = re.compile('[^E]FUNC\(([_a-zA-Z0-9]*)\)') + modfuncs = srch.findall(content) + modfuncs = sorted(set(modfuncs)) + + srch = re.compile('EFUNC\(([_a-zA-Z0-9]*),([_a-zA-Z0-9]*)\)') + exfuncs = srch.findall(content) + exfuncs = sorted(set(exfuncs)) + + fileFuncs = [] + for func in modfuncs: + fileFuncs.append("ace_{0}_fnc_{1}".format(selfmodule,func)) + + for exModule,func in exfuncs: + fileFuncs.append("ace_{0}_fnc_{1}".format(exModule, func)) + + return fileFuncs + + +def getStrings(filepath): + selfmodule = (re.search('addons[\W]*([_a-zA-Z0-9]*)', filepath)).group(1) + # print("Checking {0} from {1}".format(filepath,selfmodule)) + + with open(filepath, 'r') as file: + content = file.read() + + srch = re.compile('[^E][CL]STRING\(([_a-zA-Z0-9]*)\)') + modStrings = srch.findall(content) + modStrings = sorted(set(modStrings)) + + srch = re.compile('E[CL]STRING\(([_a-zA-Z0-9]*),([_a-zA-Z0-9]*)\)') + exStrings = srch.findall(content) + exStrings = sorted(set(exStrings)) + + fileStrings = [] + for localString in modStrings: + fileStrings.append("STR_ACE_{0}_{1}".format(selfmodule, localString)) + + for (exModule, exString) in exStrings: + fileStrings.append("STR_ACE_{0}_{1}".format(exModule, exString)) + + return fileStrings + +def main(): + + print("#########################") + print("# All Functions #") + print("#########################") + + sqf_list = [] + + allFunctions = [] + allStrings = [] + + parser = argparse.ArgumentParser() + 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): + for filename in fnmatch.filter(filenames, '*.sqf'): + sqf_list.append(os.path.join(root, filename)) + for filename in fnmatch.filter(filenames, '*.cpp'): + sqf_list.append(os.path.join(root, filename)) + for filename in fnmatch.filter(filenames, '*.hpp'): + sqf_list.append(os.path.join(root, filename)) + + for filename in sqf_list: + allFunctions = allFunctions + getFunctions(filename) + for filename in sqf_list: + allStrings = allStrings + getStrings(filename) + + + codeHeader = "diag_log text '*********** Scaning for nil functions [funcs {0} / strings {1}]';".format(len(set(allFunctions)), len(set(allStrings))) + codeFuncCheck = "{ if (isNil _x) then {systemChat format ['%1 is nil', _x]; diag_log text format ['%1 is nil', _x];}} forEach allFunctions;" + codeStringCheck = "{ if (!isLocalized _x) then {systemChat format ['%1 is not in stringtable', _x]; diag_log text format ['%1 is not in stringtable', _x];}} forEach allStrings;" + + outputCode = "{0} allFunctions = {1}; allStrings = {2}; {3} {4}".format(codeHeader, list(set(allFunctions)), list(set(allStrings)), codeFuncCheck, codeStringCheck) + + print(outputCode) + Paste(outputCode); + + print ("") + print ("Copied to clipboard, [funcs {0} / strings {1}]'".format(len(set(allFunctions)), len(set(allStrings)))) + +if __name__ == "__main__": + main() diff --git a/tools/sqf_validator.py b/tools/sqf_validator.py new file mode 100644 index 0000000000..e4af90f50f --- /dev/null +++ b/tools/sqf_validator.py @@ -0,0 +1,118 @@ + +import fnmatch +import os +import re +import ntpath +import sys +import argparse + +def check_sqf_syntax(filepath): + bad_count_file = 0 + def pushClosing(t): + closingStack.append(closing.expr) + closing << Literal( closingFor[t[0]] ) + + def popClosing(): + closing << closingStack.pop() + + with open(filepath, 'r') as file: + content = file.read() + brackets_list = [] + + isInCommentBlock = False + checkIfInComment = False + ignoreTillEndOfLine = False + checkIfNextIsClosingBlock = False + isInString = False + + lineNumber = 0 + + for c in content: + if c == '\n': + lineNumber += 1 # so we can print accurate line number information when we detect a possible error + if (isInString): + 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 + 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 + 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 == '"'): + isInString = True + inStringType = c + 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)) + 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)) + bad_count_file += 1 + brackets_list.append(']') + elif (c == '{'): + brackets_list.append('{') + elif (c == '}'): + if (brackets_list[-1] in ['(', '[']): + print("Possible missing curly brace '}}' detected at {0} Line number: {1}".format(filepath,lineNumber)) + bad_count_file += 1 + brackets_list.append('}') + else: + if (c == '*'): + checkIfNextIsClosingBlock = True; + elif (checkIfNextIsClosingBlock): + if (c == '/'): + isInCommentBlock = False + elif (c != '*'): + checkIfNextIsClosingBlock = False + + 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(']'))) + 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(')'))) + 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('}'))) + bad_count_file += 1 + return bad_count_file + +def main(): + + print("#########################") + print("# Validate SQF files missing brackets #") + print("#########################") + + sqf_list = [] + bad_count = 0 + + parser = argparse.ArgumentParser() + 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): + 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)) + return bad_count + +if __name__ == "__main__": + sys.exit(main())